@spree/cli 3.0.2 → 3.1.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/dist/index.js CHANGED
@@ -1,184 +1,184 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
- var ay=Object.create;var $o=Object.defineProperty;var oy=Object.getOwnPropertyDescriptor;var py=Object.getOwnPropertyNames;var cy=Object.getPrototypeOf,dy=Object.prototype.hasOwnProperty;var ge=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var E=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var uy=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of py(t))!dy.call(e,n)&&n!==r&&$o(e,n,{get:()=>t[n],enumerable:!(i=oy(t,n))||i.enumerable});return e};var D=(e,t,r)=>(r=e!=null?ay(cy(e)):{},uy(t||!e||!e.__esModule?$o(r,"default",{value:e,enumerable:!0}):r,e));var or=E(Mn=>{"use strict";var Wr=class extends Error{constructor(t,r,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},zn=class extends Wr{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Mn.CommanderError=Wr;Mn.InvalidArgumentError=zn});var Kr=E(Gn=>{"use strict";var{InvalidArgumentError:ly}=or(),Fn=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new ly(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,i):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function my(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}Gn.Argument=Fn;Gn.humanReadableArgName=my});var Hn=E(Nn=>{"use strict";var{humanReadableArgName:hy}=Kr(),Un=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(n=>!n._hidden),i=t._getHelpCommand();return i&&!i._hidden&&r.push(i),this.sortSubcommands&&r.sort((n,s)=>n.name().localeCompare(s.name())),r}compareOptions(t,r){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(t).localeCompare(i(r))}visibleOptions(t){let r=t.options.filter(n=>!n.hidden),i=t._getHelpOption();if(i&&!i.hidden){let n=i.short&&t._findOption(i.short),s=i.long&&t._findOption(i.long);!n&&!s?r.push(i):i.long&&!s?r.push(t.createOption(i.long,i.description)):i.short&&!n&&r.push(t.createOption(i.short,i.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let i=t.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);r.push(...n)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(i=>hy(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(n)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleOptionTerm(r.optionTerm(n)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleOptionTerm(r.optionTerm(n)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(n)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let i="";for(let n=t.parent;n;n=n.parent)i=n.name()+" "+i;return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatItemList(t,r,i){return r.length===0?[]:[i.styleTitle(t),...r,""]}groupItems(t,r,i){let n=new Map;return t.forEach(s=>{let a=i(s);n.has(a)||n.set(a,[])}),r.forEach(s=>{let a=i(s);n.has(a)||n.set(a,[]),n.get(a).push(s)}),n}formatHelp(t,r){let i=r.padWidth(t,r),n=r.helpWidth??80;function s(u,l){return r.formatItem(u,i,l,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],o=r.commandDescription(t);o.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(o),n),""]));let p=r.visibleArguments(t).map(u=>s(r.styleArgumentTerm(r.argumentTerm(u)),r.styleArgumentDescription(r.argumentDescription(u))));if(a=a.concat(this.formatItemList("Arguments:",p,r)),this.groupItems(t.options,r.visibleOptions(t),u=>u.helpGroupHeading??"Options:").forEach((u,l)=>{let m=u.map(h=>s(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));a=a.concat(this.formatItemList(l,m,r))}),r.showGlobalOptions){let u=r.visibleGlobalOptions(t).map(l=>s(r.styleOptionTerm(r.optionTerm(l)),r.styleOptionDescription(r.optionDescription(l))));a=a.concat(this.formatItemList("Global Options:",u,r))}return this.groupItems(t.commands,r.visibleCommands(t),u=>u.helpGroup()||"Commands:").forEach((u,l)=>{let m=u.map(h=>s(r.styleSubcommandTerm(r.subcommandTerm(h)),r.styleSubcommandDescription(r.subcommandDescription(h))));a=a.concat(this.formatItemList(l,m,r))}),a.join(`
5
- `)}displayWidth(t){return Ao(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,i,n){let a=" ".repeat(2);if(!i)return a+t;let o=t.padEnd(r+t.length-n.displayWidth(t)),p=2,c=(this.helpWidth??80)-r-p-2,u;return c<this.minWidthToWrap||n.preformatted(i)?u=i:u=n.boxWrap(i,c).replace(/\n/g,`
6
- `+" ".repeat(r+p)),a+o+" ".repeat(p)+u.replace(/\n/g,`
7
- ${a}`)}boxWrap(t,r){if(r<this.minWidthToWrap)return t;let i=t.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,s=[];return i.forEach(a=>{let o=a.match(n);if(o===null){s.push("");return}let p=[o.shift()],d=this.displayWidth(p[0]);o.forEach(c=>{let u=this.displayWidth(c);if(d+u<=r){p.push(c),d+=u;return}s.push(p.join(""));let l=c.trimStart();p=[l],d=this.displayWidth(l)}),s.push(p.join(""))}),s.join(`
8
- `)}};function Ao(e){let t=/\x1b\[\d*(;\d*)*m/g;return e.replace(t,"")}Nn.Help=Un;Nn.stripColor=Ao});var Yn=E(Kn=>{"use strict";var{InvalidArgumentError:yy}=or(),Vn=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let i=gy(t);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new yy(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,i):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Eo(this.name().replace(/^no-/,"")):Eo(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Wn=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(t,r){let i=r.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return r.negate===(s===t)}};function Eo(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function gy(e){let t,r,i=/^-[^-]$/,n=/^--[^-]/,s=e.split(/[ |,]+/).concat("guard");if(i.test(s[0])&&(t=s.shift()),n.test(s[0])&&(r=s.shift()),!t&&i.test(s[0])&&(t=s.shift()),!t&&n.test(s[0])&&(t=r,r=s.shift()),s[0].startsWith("-")){let a=s[0],o=`option creation failed due to '${a}' in option flags '${e}'`;throw/^-[^-][^-]/.test(a)?new Error(`${o}
4
+ var $y=Object.create;var Do=Object.defineProperty;var Ay=Object.getOwnPropertyDescriptor;var Ey=Object.getOwnPropertyNames;var Py=Object.getPrototypeOf,jy=Object.prototype.hasOwnProperty;var _e=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Cy=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(i){throw r=[i],i}};var j=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Ty=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ey(t))!jy.call(e,n)&&n!==r&&Do(e,n,{get:()=>t[n],enumerable:!(i=Ay(t,n))||i.enumerable});return e};var B=(e,t,r)=>(r=e!=null?$y(Py(e)):{},Ty(t||!e||!e.__esModule?Do(r,"default",{value:e,enumerable:!0}):r,e));var m,p=Cy(()=>{m={spree_admin_sdk_range:"^1.0.0-beta.3",spree_dashboard_core_range:"^1.0.0-beta.4",spree_dashboard_ui_range:"^1.0.0-beta.4"}});var hr=j(Wn=>{"use strict";p();var ri=class extends Error{constructor(t,r,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},Hn=class extends ri{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Wn.CommanderError=ri;Wn.InvalidArgumentError=Hn});var ii=j(Yn=>{"use strict";p();var{InvalidArgumentError:Iy}=hr(),Kn=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new Iy(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,i):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Oy(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}Yn.Argument=Kn;Yn.humanReadableArgName=Oy});var Zn=j(Xn=>{"use strict";p();var{humanReadableArgName:Dy}=ii(),Jn=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(n=>!n._hidden),i=t._getHelpCommand();return i&&!i._hidden&&r.push(i),this.sortSubcommands&&r.sort((n,s)=>n.name().localeCompare(s.name())),r}compareOptions(t,r){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(t).localeCompare(i(r))}visibleOptions(t){let r=t.options.filter(n=>!n.hidden),i=t._getHelpOption();if(i&&!i.hidden){let n=i.short&&t._findOption(i.short),s=i.long&&t._findOption(i.long);!n&&!s?r.push(i):i.long&&!s?r.push(t.createOption(i.long,i.description)):i.short&&!n&&r.push(t.createOption(i.short,i.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let i=t.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);r.push(...n)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(i=>Dy(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(n)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleOptionTerm(r.optionTerm(n)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleOptionTerm(r.optionTerm(n)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(n)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let i="";for(let n=t.parent;n;n=n.parent)i=n.name()+" "+i;return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatItemList(t,r,i){return r.length===0?[]:[i.styleTitle(t),...r,""]}groupItems(t,r,i){let n=new Map;return t.forEach(s=>{let a=i(s);n.has(a)||n.set(a,[])}),r.forEach(s=>{let a=i(s);n.has(a)||n.set(a,[]),n.get(a).push(s)}),n}formatHelp(t,r){let i=r.padWidth(t,r),n=r.helpWidth??80;function s(l,h){return r.formatItem(l,i,h,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],o=r.commandDescription(t);o.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(o),n),""]));let c=r.visibleArguments(t).map(l=>s(r.styleArgumentTerm(r.argumentTerm(l)),r.styleArgumentDescription(r.argumentDescription(l))));if(a=a.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(t.options,r.visibleOptions(t),l=>l.helpGroupHeading??"Options:").forEach((l,h)=>{let y=l.map(g=>s(r.styleOptionTerm(r.optionTerm(g)),r.styleOptionDescription(r.optionDescription(g))));a=a.concat(this.formatItemList(h,y,r))}),r.showGlobalOptions){let l=r.visibleGlobalOptions(t).map(h=>s(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));a=a.concat(this.formatItemList("Global Options:",l,r))}return this.groupItems(t.commands,r.visibleCommands(t),l=>l.helpGroup()||"Commands:").forEach((l,h)=>{let y=l.map(g=>s(r.styleSubcommandTerm(r.subcommandTerm(g)),r.styleSubcommandDescription(r.subcommandDescription(g))));a=a.concat(this.formatItemList(h,y,r))}),a.join(`
5
+ `)}displayWidth(t){return Lo(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,i,n){let a=" ".repeat(2);if(!i)return a+t;let o=t.padEnd(r+t.length-n.displayWidth(t)),c=2,d=(this.helpWidth??80)-r-c-2,l;return d<this.minWidthToWrap||n.preformatted(i)?l=i:l=n.boxWrap(i,d).replace(/\n/g,`
6
+ `+" ".repeat(r+c)),a+o+" ".repeat(c)+l.replace(/\n/g,`
7
+ ${a}`)}boxWrap(t,r){if(r<this.minWidthToWrap)return t;let i=t.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,s=[];return i.forEach(a=>{let o=a.match(n);if(o===null){s.push("");return}let c=[o.shift()],u=this.displayWidth(c[0]);o.forEach(d=>{let l=this.displayWidth(d);if(u+l<=r){c.push(d),u+=l;return}s.push(c.join(""));let h=d.trimStart();c=[h],u=this.displayWidth(h)}),s.push(c.join(""))}),s.join(`
8
+ `)}};function Lo(e){let t=/\x1b\[\d*(;\d*)*m/g;return e.replace(t,"")}Xn.Help=Jn;Xn.stripColor=Lo});var rs=j(ts=>{"use strict";p();var{InvalidArgumentError:Ly}=hr(),Qn=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let i=By(t);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new Ly(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,i):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Bo(this.name().replace(/^no-/,"")):Bo(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},es=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(t,r){let i=r.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return r.negate===(s===t)}};function Bo(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function By(e){let t,r,i=/^-[^-]$/,n=/^--[^-]/,s=e.split(/[ |,]+/).concat("guard");if(i.test(s[0])&&(t=s.shift()),n.test(s[0])&&(r=s.shift()),!t&&i.test(s[0])&&(t=s.shift()),!t&&n.test(s[0])&&(t=r,r=s.shift()),s[0].startsWith("-")){let a=s[0],o=`option creation failed due to '${a}' in option flags '${e}'`;throw/^-[^-][^-]/.test(a)?new Error(`${o}
9
9
  - a short flag is a single dash and a single character
10
10
  - either use a single dash and a single character (for a short flag)
11
11
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):i.test(a)?new Error(`${o}
12
12
  - too many short flags`):n.test(a)?new Error(`${o}
13
13
  - too many long flags`):new Error(`${o}
14
- - unrecognised flag format`)}if(t===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:r}}Kn.Option=Vn;Kn.DualOptions=Wn});var jo=E(Po=>{"use strict";function fy(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let i=0;i<=e.length;i++)r[i]=[i];for(let i=0;i<=t.length;i++)r[0][i]=i;for(let i=1;i<=t.length;i++)for(let n=1;n<=e.length;n++){let s=1;e[n-1]===t[i-1]?s=0:s=1,r[n][i]=Math.min(r[n-1][i]+1,r[n][i-1]+1,r[n-1][i-1]+s),n>1&&i>1&&e[n-1]===t[i-2]&&e[n-2]===t[i-1]&&(r[n][i]=Math.min(r[n][i],r[n-2][i-2]+1))}return r[e.length][t.length]}function _y(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(a=>a.slice(2)));let i=[],n=3,s=.4;return t.forEach(a=>{if(a.length<=1)return;let o=fy(e,a),p=Math.max(e.length,a.length);(p-o)/p>s&&(o<n?(n=o,i=[a]):o===n&&i.push(a))}),i.sort((a,o)=>a.localeCompare(o)),r&&(i=i.map(a=>`--${a}`)),i.length>1?`
14
+ - unrecognised flag format`)}if(t===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:r}}ts.Option=Qn;ts.DualOptions=es});var Mo=j(zo=>{"use strict";p();function zy(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let i=0;i<=e.length;i++)r[i]=[i];for(let i=0;i<=t.length;i++)r[0][i]=i;for(let i=1;i<=t.length;i++)for(let n=1;n<=e.length;n++){let s=1;e[n-1]===t[i-1]?s=0:s=1,r[n][i]=Math.min(r[n-1][i]+1,r[n][i-1]+1,r[n-1][i-1]+s),n>1&&i>1&&e[n-1]===t[i-2]&&e[n-2]===t[i-1]&&(r[n][i]=Math.min(r[n][i],r[n-2][i-2]+1))}return r[e.length][t.length]}function My(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(a=>a.slice(2)));let i=[],n=3,s=.4;return t.forEach(a=>{if(a.length<=1)return;let o=zy(e,a),c=Math.max(e.length,a.length);(c-o)/c>s&&(o<n?(n=o,i=[a]):o===n&&i.push(a))}),i.sort((a,o)=>a.localeCompare(o)),r&&(i=i.map(a=>`--${a}`)),i.length>1?`
15
15
  (Did you mean one of ${i.join(", ")}?)`:i.length===1?`
16
- (Did you mean ${i[0]}?)`:""}Po.suggestSimilar=_y});var Io=E(es=>{"use strict";var by=ge("events").EventEmitter,Jn=ge("child_process"),Ye=ge("path"),Yr=ge("fs"),R=ge("process"),{Argument:qy,humanReadableArgName:ky}=Kr(),{CommanderError:Xn}=or(),{Help:vy,stripColor:wy}=Hn(),{Option:Co,DualOptions:xy}=Yn(),{suggestSimilar:To}=jo(),Zn=class e extends by{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>R.stdout.write(r),writeErr:r=>R.stderr.write(r),outputError:(r,i)=>i(r),getOutHelpWidth:()=>R.stdout.isTTY?R.stdout.columns:void 0,getErrHelpWidth:()=>R.stderr.isTTY?R.stderr.columns:void 0,getOutHasColors:()=>Qn()??(R.stdout.isTTY&&R.stdout.hasColors?.()),getErrHasColors:()=>Qn()??(R.stderr.isTTY&&R.stderr.hasColors?.()),stripColor:r=>wy(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,i){let n=r,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,a,o]=t.match(/([^ ]+) *(.*)/),p=this.createCommand(a);return n&&(p.description(n),p._executableHandler=!0),s.isDefault&&(this._defaultCommandName=p._name),p._hidden=!!(s.noHelp||s.hidden),p._executableFile=s.executableFile||null,o&&p.arguments(o),this._registerCommand(p),p.parent=this,p.copyInheritedSettings(this),n?this:p}createCommand(t){return new e(t)}createHelp(){return Object.assign(new vy,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
17
- - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new qy(t,r)}argument(t,r,i,n){let s=this.createArgument(t,r);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,r){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let i=t??"help [command]",[,n,s]=i.match(/([^ ]+) *(.*)/),a=r??"display help for command",o=this.createCommand(n);return o.helpOption(!1),s&&o.arguments(s),a&&o.description(a),this._addImplicitHelpCommand=!0,this._helpCommand=o,(t||r)&&this._initCommandGroup(o),this}addHelpCommand(t,r){return typeof t!="object"?(this.helpCommand(t,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,r){let i=["preSubcommand","preAction","postAction"];if(!i.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
18
- Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,i){this._exitCallback&&this._exitCallback(new Xn(t,r,i)),R.exit(t)}action(t){let r=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),t.apply(this,s)};return this._actionHandler=r,this}createOption(t,r){return new Co(t,r)}_callParseArg(t,r,i,n){try{return t.parseArg(r,i)}catch(s){if(s.code==="commander.invalidArgument"){let a=`${n} ${s.message}`;this.error(a,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(t){let r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){let i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
19
- - already used by option '${r.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let r=n=>[n.name()].concat(n.aliases()),i=r(t).find(n=>this._findCommand(n));if(i){let n=r(this._findCommand(i)).join("|"),s=r(t).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),i=t.attributeName();if(t.negate){let s=t.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(s,a,o)=>{s==null&&t.presetArg!==void 0&&(s=t.presetArg);let p=this.getOptionValue(i);s!==null&&t.parseArg?s=this._callParseArg(t,s,p,a):s!==null&&t.variadic&&(s=t._collectValue(s,p)),s==null&&(t.negate?s=!1:t.isBoolean()||t.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,o)};return this.on("option:"+r,s=>{let a=`error: option '${t.flags}' argument '${s}' is invalid.`;n(s,a,"cli")}),t.envVar&&this.on("optionEnv:"+r,s=>{let a=`error: option '${t.flags}' value '${s}' from env '${t.envVar}' is invalid.`;n(s,a,"env")}),this}_optionEx(t,r,i,n,s){if(typeof r=="object"&&r instanceof Co)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,i);if(a.makeOptionMandatory(!!t.mandatory),typeof n=="function")a.default(s).argParser(n);else if(n instanceof RegExp){let o=n;n=(p,d)=>{let c=o.exec(p);return c?c[0]:d},a.default(s).argParser(n)}else a.default(n);return this.addOption(a)}option(t,r,i,n){return this._optionEx({},t,r,i,n)}requiredOption(t,r,i,n){return this._optionEx({mandatory:!0},t,r,i,n)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,i){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=i,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(t)!==void 0&&(r=i.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},t===void 0&&r.from===void 0){R.versions?.electron&&(r.from="electron");let n=R.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(r.from="eval")}t===void 0&&(t=R.argv),this.rawArgs=t.slice();let i;switch(r.from){case void 0:case"node":this._scriptPath=t[1],i=t.slice(2);break;case"electron":R.defaultApp?(this._scriptPath=t[1],i=t.slice(2)):i=t.slice(1);break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(t,r){this._prepareForParse();let i=this._prepareUserArgs(t,r);return this._parseCommand([],i),this}async parseAsync(t,r){this._prepareForParse();let i=this._prepareUserArgs(t,r);return await this._parseCommand([],i),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
20
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,r,i){if(Yr.existsSync(t))return;let n=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${t}' does not exist
16
+ (Did you mean ${i[0]}?)`:""}zo.suggestSimilar=My});var No=j(os=>{"use strict";p();var Fy=_e("events").EventEmitter,is=_e("child_process"),Ze=_e("path"),ni=_e("fs"),O=_e("process"),{Argument:Gy,humanReadableArgName:Uy}=ii(),{CommanderError:ns}=hr(),{Help:Ny,stripColor:Vy}=Zn(),{Option:Fo,DualOptions:Hy}=rs(),{suggestSimilar:Go}=Mo(),ss=class e extends Fy{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>O.stdout.write(r),writeErr:r=>O.stderr.write(r),outputError:(r,i)=>i(r),getOutHelpWidth:()=>O.stdout.isTTY?O.stdout.columns:void 0,getErrHelpWidth:()=>O.stderr.isTTY?O.stderr.columns:void 0,getOutHasColors:()=>as()??(O.stdout.isTTY&&O.stdout.hasColors?.()),getErrHasColors:()=>as()??(O.stderr.isTTY&&O.stderr.hasColors?.()),stripColor:r=>Vy(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,i){let n=r,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,a,o]=t.match(/([^ ]+) *(.*)/),c=this.createCommand(a);return n&&(c.description(n),c._executableHandler=!0),s.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(s.noHelp||s.hidden),c._executableFile=s.executableFile||null,o&&c.arguments(o),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),n?this:c}createCommand(t){return new e(t)}createHelp(){return Object.assign(new Ny,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
17
+ - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new Gy(t,r)}argument(t,r,i,n){let s=this.createArgument(t,r);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,r){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let i=t??"help [command]",[,n,s]=i.match(/([^ ]+) *(.*)/),a=r??"display help for command",o=this.createCommand(n);return o.helpOption(!1),s&&o.arguments(s),a&&o.description(a),this._addImplicitHelpCommand=!0,this._helpCommand=o,(t||r)&&this._initCommandGroup(o),this}addHelpCommand(t,r){return typeof t!="object"?(this.helpCommand(t,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,r){let i=["preSubcommand","preAction","postAction"];if(!i.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
18
+ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,i){this._exitCallback&&this._exitCallback(new ns(t,r,i)),O.exit(t)}action(t){let r=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),t.apply(this,s)};return this._actionHandler=r,this}createOption(t,r){return new Fo(t,r)}_callParseArg(t,r,i,n){try{return t.parseArg(r,i)}catch(s){if(s.code==="commander.invalidArgument"){let a=`${n} ${s.message}`;this.error(a,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(t){let r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){let i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
19
+ - already used by option '${r.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let r=n=>[n.name()].concat(n.aliases()),i=r(t).find(n=>this._findCommand(n));if(i){let n=r(this._findCommand(i)).join("|"),s=r(t).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),i=t.attributeName();if(t.negate){let s=t.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(s,a,o)=>{s==null&&t.presetArg!==void 0&&(s=t.presetArg);let c=this.getOptionValue(i);s!==null&&t.parseArg?s=this._callParseArg(t,s,c,a):s!==null&&t.variadic&&(s=t._collectValue(s,c)),s==null&&(t.negate?s=!1:t.isBoolean()||t.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,o)};return this.on("option:"+r,s=>{let a=`error: option '${t.flags}' argument '${s}' is invalid.`;n(s,a,"cli")}),t.envVar&&this.on("optionEnv:"+r,s=>{let a=`error: option '${t.flags}' value '${s}' from env '${t.envVar}' is invalid.`;n(s,a,"env")}),this}_optionEx(t,r,i,n,s){if(typeof r=="object"&&r instanceof Fo)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,i);if(a.makeOptionMandatory(!!t.mandatory),typeof n=="function")a.default(s).argParser(n);else if(n instanceof RegExp){let o=n;n=(c,u)=>{let d=o.exec(c);return d?d[0]:u},a.default(s).argParser(n)}else a.default(n);return this.addOption(a)}option(t,r,i,n){return this._optionEx({},t,r,i,n)}requiredOption(t,r,i,n){return this._optionEx({mandatory:!0},t,r,i,n)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,i){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=i,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(t)!==void 0&&(r=i.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},t===void 0&&r.from===void 0){O.versions?.electron&&(r.from="electron");let n=O.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(r.from="eval")}t===void 0&&(t=O.argv),this.rawArgs=t.slice();let i;switch(r.from){case void 0:case"node":this._scriptPath=t[1],i=t.slice(2);break;case"electron":O.defaultApp?(this._scriptPath=t[1],i=t.slice(2)):i=t.slice(1);break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(t,r){this._prepareForParse();let i=this._prepareUserArgs(t,r);return this._parseCommand([],i),this}async parseAsync(t,r){this._prepareForParse();let i=this._prepareUserArgs(t,r);return await this._parseCommand([],i),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
20
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,r,i){if(ni.existsSync(t))return;let n=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${t}' does not exist
21
21
  - if '${i}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
22
22
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
23
- - ${n}`;throw new Error(s)}_executeSubCommand(t,r){r=r.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(c,u){let l=Ye.resolve(c,u);if(Yr.existsSync(l))return l;if(n.includes(Ye.extname(u)))return;let m=n.find(h=>Yr.existsSync(`${l}${h}`));if(m)return`${l}${m}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,o=this._executableDir||"";if(this._scriptPath){let c;try{c=Yr.realpathSync(this._scriptPath)}catch{c=this._scriptPath}o=Ye.resolve(Ye.dirname(c),o)}if(o){let c=s(o,a);if(!c&&!t._executableFile&&this._scriptPath){let u=Ye.basename(this._scriptPath,Ye.extname(this._scriptPath));u!==this._name&&(c=s(o,`${u}-${t._name}`))}a=c||a}i=n.includes(Ye.extname(a));let p;R.platform!=="win32"?i?(r.unshift(a),r=Ro(R.execArgv).concat(r),p=Jn.spawn(R.argv[0],r,{stdio:"inherit"})):p=Jn.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,o,t._name),r.unshift(a),r=Ro(R.execArgv).concat(r),p=Jn.spawn(R.execPath,r,{stdio:"inherit"})),p.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{R.on(u,()=>{p.killed===!1&&p.exitCode===null&&p.kill(u)})});let d=this._exitCallback;p.on("close",c=>{c=c??1,d?d(new Xn(c,"commander.executeSubCommandAsync","(close)")):R.exit(c)}),p.on("error",c=>{if(c.code==="ENOENT")this._checkForMissingExecutable(a,o,t._name);else if(c.code==="EACCES")throw new Error(`'${a}' not executable`);if(!d)R.exit(1);else{let u=new Xn(1,"commander.executeSubCommandAsync","(error)");u.nestedError=c,d(u)}}),this.runningCommand=p}_dispatchSubcommand(t,r,i){let n=this._findCommand(t);n||this.help({error:!0}),n._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,r.concat(i));else return n._parseCommand(r,i)}),s}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(i,n,s)=>{let a=n;if(n!==null&&i.parseArg){let o=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;a=this._callParseArg(i,n,s,o)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((a,o)=>t(i,o,a),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=t(i,s,i.defaultValue))),r[n]=s}),this.processedArgs=r}_chainOrCall(t,r){return t?.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let i=t,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[r]!==void 0).forEach(s=>{s._lifeCycleHooks[r].forEach(a=>{n.push({hookedCommand:s,callback:a})})}),r==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,r,i){let n=t;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,r))}),n}_parseCommand(t,r){let i=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(i.operands),r=i.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(s,t,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});t.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=t.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],i=[],n=r;function s(c){return c.length>1&&c[0]==="-"}let a=c=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(c)?!this._getCommandAndAncestors().some(u=>u.options.map(l=>l.short).some(l=>/^-\d$/.test(l))):!1,o=null,p=null,d=0;for(;d<t.length||p;){let c=p??t[d++];if(p=null,c==="--"){n===i&&n.push(c),n.push(...t.slice(d));break}if(o&&(!s(c)||a(c))){this.emit(`option:${o.name()}`,c);continue}if(o=null,s(c)){let u=this._findOption(c);if(u){if(u.required){let l=t[d++];l===void 0&&this.optionMissingArgument(u),this.emit(`option:${u.name()}`,l)}else if(u.optional){let l=null;d<t.length&&(!s(t[d])||a(t[d]))&&(l=t[d++]),this.emit(`option:${u.name()}`,l)}else this.emit(`option:${u.name()}`);o=u.variadic?u:null;continue}}if(c.length>2&&c[0]==="-"&&c[1]!=="-"){let u=this._findOption(`-${c[1]}`);if(u){u.required||u.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${u.name()}`,c.slice(2)):(this.emit(`option:${u.name()}`),p=`-${c.slice(2)}`);continue}}if(/^--[^=]+=/.test(c)){let u=c.indexOf("="),l=this._findOption(c.slice(0,u));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,c.slice(u+1));continue}}if(n===r&&s(c)&&!(this.commands.length===0&&a(c))&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(c)){r.push(c),i.push(...t.slice(d));break}else if(this._getHelpCommand()&&c===this._getHelpCommand().name()){r.push(c,...t.slice(d));break}else if(this._defaultCommandName){i.push(c,...t.slice(d));break}}if(this._passThroughOptions){n.push(c,...t.slice(d));break}n.push(c)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let i=0;i<r;i++){let n=this.options[i].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
23
+ - ${n}`;throw new Error(s)}_executeSubCommand(t,r){r=r.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(d,l){let h=Ze.resolve(d,l);if(ni.existsSync(h))return h;if(n.includes(Ze.extname(l)))return;let y=n.find(g=>ni.existsSync(`${h}${g}`));if(y)return`${h}${y}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,o=this._executableDir||"";if(this._scriptPath){let d;try{d=ni.realpathSync(this._scriptPath)}catch{d=this._scriptPath}o=Ze.resolve(Ze.dirname(d),o)}if(o){let d=s(o,a);if(!d&&!t._executableFile&&this._scriptPath){let l=Ze.basename(this._scriptPath,Ze.extname(this._scriptPath));l!==this._name&&(d=s(o,`${l}-${t._name}`))}a=d||a}i=n.includes(Ze.extname(a));let c;O.platform!=="win32"?i?(r.unshift(a),r=Uo(O.execArgv).concat(r),c=is.spawn(O.argv[0],r,{stdio:"inherit"})):c=is.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,o,t._name),r.unshift(a),r=Uo(O.execArgv).concat(r),c=is.spawn(O.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(l=>{O.on(l,()=>{c.killed===!1&&c.exitCode===null&&c.kill(l)})});let u=this._exitCallback;c.on("close",d=>{d=d??1,u?u(new ns(d,"commander.executeSubCommandAsync","(close)")):O.exit(d)}),c.on("error",d=>{if(d.code==="ENOENT")this._checkForMissingExecutable(a,o,t._name);else if(d.code==="EACCES")throw new Error(`'${a}' not executable`);if(!u)O.exit(1);else{let l=new ns(1,"commander.executeSubCommandAsync","(error)");l.nestedError=d,u(l)}}),this.runningCommand=c}_dispatchSubcommand(t,r,i){let n=this._findCommand(t);n||this.help({error:!0}),n._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,r.concat(i));else return n._parseCommand(r,i)}),s}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(i,n,s)=>{let a=n;if(n!==null&&i.parseArg){let o=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;a=this._callParseArg(i,n,s,o)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((a,o)=>t(i,o,a),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=t(i,s,i.defaultValue))),r[n]=s}),this.processedArgs=r}_chainOrCall(t,r){return t?.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let i=t,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[r]!==void 0).forEach(s=>{s._lifeCycleHooks[r].forEach(a=>{n.push({hookedCommand:s,callback:a})})}),r==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,r,i){let n=t;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,r))}),n}_parseCommand(t,r){let i=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(i.operands),r=i.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(s,t,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});t.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=t.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],i=[],n=r;function s(d){return d.length>1&&d[0]==="-"}let a=d=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(d)?!this._getCommandAndAncestors().some(l=>l.options.map(h=>h.short).some(h=>/^-\d$/.test(h))):!1,o=null,c=null,u=0;for(;u<t.length||c;){let d=c??t[u++];if(c=null,d==="--"){n===i&&n.push(d),n.push(...t.slice(u));break}if(o&&(!s(d)||a(d))){this.emit(`option:${o.name()}`,d);continue}if(o=null,s(d)){let l=this._findOption(d);if(l){if(l.required){let h=t[u++];h===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,h)}else if(l.optional){let h=null;u<t.length&&(!s(t[u])||a(t[u]))&&(h=t[u++]),this.emit(`option:${l.name()}`,h)}else this.emit(`option:${l.name()}`);o=l.variadic?l:null;continue}}if(d.length>2&&d[0]==="-"&&d[1]!=="-"){let l=this._findOption(`-${d[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,d.slice(2)):(this.emit(`option:${l.name()}`),c=`-${d.slice(2)}`);continue}}if(/^--[^=]+=/.test(d)){let l=d.indexOf("="),h=this._findOption(d.slice(0,l));if(h&&(h.required||h.optional)){this.emit(`option:${h.name()}`,d.slice(l+1));continue}}if(n===r&&s(d)&&!(this.commands.length===0&&a(d))&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(d)){r.push(d),i.push(...t.slice(u));break}else if(this._getHelpCommand()&&d===this._getHelpCommand().name()){r.push(d,...t.slice(u));break}else if(this._defaultCommandName){i.push(d,...t.slice(u));break}}if(this._passThroughOptions){n.push(d,...t.slice(u));break}n.push(d)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let i=0;i<r;i++){let n=this.options[i].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
24
24
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
25
25
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
26
- `),this.outputHelp({error:!0}));let i=r||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in R.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,R.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new xy(this.options),r=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&r(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!r(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let i=a=>{let o=a.attributeName(),p=this.getOptionValue(o),d=this.options.find(u=>u.negate&&o===u.attributeName()),c=this.options.find(u=>!u.negate&&o===u.attributeName());return d&&(d.presetArg===void 0&&p===!1||d.presetArg!==void 0&&p===d.presetArg)?d:c||a},n=a=>{let o=i(a),p=o.attributeName();return this.getOptionValueSource(p)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},s=`error: ${n(t)} cannot be used with ${n(r)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(o=>o.long).map(o=>o.long);n=n.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);r=To(t,n)}let i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,i=r===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${i} but got ${t.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),r=To(t,n)}let i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",i=i||"output the version number";let n=this.createOption(r,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
27
- `),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(i=>ky(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=Ye.basename(t,Ye.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp(),i=this._getOutputContext(t);r.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=r.formatHelp(this,r);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(t){t=t||{};let r=!!t.error,i,n,s;return r?(i=o=>this._outputConfiguration.writeErr(o),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(i=o=>this._outputConfiguration.writeOut(o),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:r,write:o=>(n||(o=this._outputConfiguration.stripColor(o)),i(o)),hasColors:n,helpWidth:s}}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let i=this._getOutputContext(t),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:i.error});if(r&&(s=r(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",n))}helpOption(t,r){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",r??"display help for command"),(t||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let r=Number(R.exitCode??0);r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.
26
+ `),this.outputHelp({error:!0}));let i=r||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in O.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,O.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Hy(this.options),r=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&r(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!r(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let i=a=>{let o=a.attributeName(),c=this.getOptionValue(o),u=this.options.find(l=>l.negate&&o===l.attributeName()),d=this.options.find(l=>!l.negate&&o===l.attributeName());return u&&(u.presetArg===void 0&&c===!1||u.presetArg!==void 0&&c===u.presetArg)?u:d||a},n=a=>{let o=i(a),c=o.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${o.envVar}'`:`option '${o.flags}'`},s=`error: ${n(t)} cannot be used with ${n(r)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(o=>o.long).map(o=>o.long);n=n.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);r=Go(t,n)}let i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,i=r===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${i} but got ${t.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),r=Go(t,n)}let i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",i=i||"output the version number";let n=this.createOption(r,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
27
+ `),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(i=>Uy(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=Ze.basename(t,Ze.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp(),i=this._getOutputContext(t);r.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=r.formatHelp(this,r);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(t){t=t||{};let r=!!t.error,i,n,s;return r?(i=o=>this._outputConfiguration.writeErr(o),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(i=o=>this._outputConfiguration.writeOut(o),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:r,write:o=>(n||(o=this._outputConfiguration.stripColor(o)),i(o)),hasColors:n,helpWidth:s}}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let i=this._getOutputContext(t),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:i.error});if(r&&(s=r(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",n))}helpOption(t,r){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",r??"display help for command"),(t||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let r=Number(O.exitCode??0);r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.
28
28
  Expecting one of '${i.join("', '")}'`);let n=`${t}Help`;return this.on(n,s=>{let a;typeof r=="function"?a=r({error:s.error,command:s.command}):a=r,a&&s.write(`${a}
29
- `)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(n=>r.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ro(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,i="127.0.0.1",n="9229",s;return(s=t.match(/^(--inspect(-brk)?)$/))!==null?r=s[1]:(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=s[1],i=s[3],n=s[4]),r&&n!=="0"?`${r}=${i}:${parseInt(n)+1}`:t})}function Qn(){if(R.env.NO_COLOR||R.env.FORCE_COLOR==="0"||R.env.FORCE_COLOR==="false")return!1;if(R.env.FORCE_COLOR||R.env.CLICOLOR_FORCE!==void 0)return!0}es.Command=Zn;es.useColor=Qn});var Bo=E(ke=>{"use strict";var{Argument:Oo}=Kr(),{Command:ts}=Io(),{CommanderError:Sy,InvalidArgumentError:Do}=or(),{Help:$y}=Hn(),{Option:Lo}=Yn();ke.program=new ts;ke.createCommand=e=>new ts(e);ke.createOption=(e,t)=>new Lo(e,t);ke.createArgument=(e,t)=>new Oo(e,t);ke.Command=ts;ke.Option=Lo;ke.Argument=Oo;ke.Help=$y;ke.CommanderError=Sy;ke.InvalidArgumentError=Do;ke.InvalidOptionArgumentError=Do});var K=E((RS,rs)=>{"use strict";var Xr=process||{},Go=Xr.argv||[],Jr=Xr.env||{},Ay=!(Jr.NO_COLOR||Go.includes("--no-color"))&&(!!Jr.FORCE_COLOR||Go.includes("--color")||Xr.platform==="win32"||(Xr.stdout||{}).isTTY&&Jr.TERM!=="dumb"||!!Jr.CI),Ey=(e,t,r=e)=>i=>{let n=""+i,s=n.indexOf(t,e.length);return~s?e+Py(n,t,r,s)+t:e+n+t},Py=(e,t,r,i)=>{let n="",s=0;do n+=e.substring(s,i)+r,s=i+t.length,i=e.indexOf(t,s);while(~i);return n+e.substring(s)},Uo=(e=Ay)=>{let t=e?Ey:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};rs.exports=Uo();rs.exports.createColors=Uo});var os=E((FS,np)=>{"use strict";var as={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Uy={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},Ny={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?as.up():"");return e&&(t+=as.left),t}};np.exports={cursor:as,scroll:Uy,erase:Ny,beep:"\x07"}});var Gp=E((aE,Fp)=>{"use strict";Fp.exports=Mp;Mp.sync=gf;var Bp=ge("fs");function yf(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var i=0;i<r.length;i++){var n=r[i].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function zp(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:yf(t,r)}function Mp(e,t,r){Bp.stat(e,function(i,n){r(i,i?!1:zp(n,e,t))})}function gf(e,t){return zp(Bp.statSync(e),e,t)}});var Wp=E((oE,Vp)=>{"use strict";Vp.exports=Np;Np.sync=ff;var Up=ge("fs");function Np(e,t,r){Up.stat(e,function(i,n){r(i,i?!1:Hp(n,t))})}function ff(e,t){return Hp(Up.statSync(e),t)}function Hp(e,t){return e.isFile()&&_f(e,t)}function _f(e,t){var r=e.mode,i=e.uid,n=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),a=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),o=parseInt("100",8),p=parseInt("010",8),d=parseInt("001",8),c=o|p,u=r&d||r&p&&n===a||r&o&&i===s||r&c&&s===0;return u}});var Yp=E((cE,Kp)=>{"use strict";var pE=ge("fs"),Si;process.platform==="win32"||global.TESTING_WINDOWS?Si=Gp():Si=Wp();Kp.exports=Ss;Ss.sync=bf;function Ss(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){Ss(e,t||{},function(s,a){s?n(s):i(a)})})}Si(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),r(i,n)})}function bf(e,t){try{return Si.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var rc=E((dE,tc)=>{"use strict";var Ot=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Jp=ge("path"),qf=Ot?";":":",Xp=Yp(),Zp=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Qp=(e,t)=>{let r=t.colon||qf,i=e.match(/\//)||Ot&&e.match(/\\/)?[""]:[...Ot?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=Ot?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Ot?n.split(r):[""];return Ot&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},ec=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:i,pathExt:n,pathExtExe:s}=Qp(e,t),a=[],o=d=>new Promise((c,u)=>{if(d===i.length)return t.all&&a.length?c(a):u(Zp(e));let l=i[d],m=/^".*"$/.test(l)?l.slice(1,-1):l,h=Jp.join(m,e),f=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;c(p(f,d,0))}),p=(d,c,u)=>new Promise((l,m)=>{if(u===n.length)return l(o(c+1));let h=n[u];Xp(d+h,{pathExt:s},(f,w)=>{if(!f&&w)if(t.all)a.push(d+h);else return l(d+h);return l(p(d,c,u+1))})});return r?o(0).then(d=>r(null,d),r):o(0)},kf=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=Qp(e,t),s=[];for(let a=0;a<r.length;a++){let o=r[a],p=/^".*"$/.test(o)?o.slice(1,-1):o,d=Jp.join(p,e),c=!p&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let u=0;u<i.length;u++){let l=c+i[u];try{if(Xp.sync(l,{pathExt:n}))if(t.all)s.push(l);else return l}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw Zp(e)};tc.exports=ec;ec.sync=kf});var nc=E((uE,$s)=>{"use strict";var ic=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};$s.exports=ic;$s.exports.default=ic});var pc=E((lE,oc)=>{"use strict";var sc=ge("path"),vf=rc(),wf=nc();function ac(e,t){let r=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let a;try{a=vf.sync(e.command,{path:r[wf({env:r})],pathExt:t?sc.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return a&&(a=sc.resolve(n?e.options.cwd:"",a)),a}function xf(e){return ac(e)||ac(e,!0)}oc.exports=xf});var cc=E((mE,Es)=>{"use strict";var As=/([()\][%!^"`<>&|;, *?])/g;function Sf(e){return e=e.replace(As,"^$1"),e}function $f(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(As,"^$1"),t&&(e=e.replace(As,"^$1")),e}Es.exports.command=Sf;Es.exports.argument=$f});var uc=E((hE,dc)=>{"use strict";dc.exports=/^#!(.*)/});var mc=E((yE,lc)=>{"use strict";var Af=uc();lc.exports=(e="")=>{let t=e.match(Af);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var yc=E((gE,hc)=>{"use strict";var Ps=ge("fs"),Ef=mc();function Pf(e){let r=Buffer.alloc(150),i;try{i=Ps.openSync(e,"r"),Ps.readSync(i,r,0,150,0),Ps.closeSync(i)}catch{}return Ef(r.toString())}hc.exports=Pf});var bc=E((fE,_c)=>{"use strict";var jf=ge("path"),gc=pc(),fc=cc(),Cf=yc(),Tf=process.platform==="win32",Rf=/\.(?:com|exe)$/i,If=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Of(e){e.file=gc(e);let t=e.file&&Cf(e.file);return t?(e.args.unshift(e.file),e.command=t,gc(e)):e.file}function Df(e){if(!Tf)return e;let t=Of(e),r=!Rf.test(t);if(e.options.forceShell||r){let i=If.test(t);e.command=jf.normalize(e.command),e.command=fc.command(e.command),e.args=e.args.map(s=>fc.argument(s,i));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Lf(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let i={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?i:Df(i)}_c.exports=Lf});var vc=E((_E,kc)=>{"use strict";var js=process.platform==="win32";function Cs(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Bf(e,t){if(!js)return;let r=e.emit;e.emit=function(i,n){if(i==="exit"){let s=qc(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function qc(e,t){return js&&e===1&&!t.file?Cs(t.original,"spawn"):null}function zf(e,t){return js&&e===1&&!t.file?Cs(t.original,"spawnSync"):null}kc.exports={hookChildProcess:Bf,verifyENOENT:qc,verifyENOENTSync:zf,notFoundError:Cs}});var Sc=E((bE,Dt)=>{"use strict";var wc=ge("child_process"),Ts=bc(),Rs=vc();function xc(e,t,r){let i=Ts(e,t,r),n=wc.spawn(i.command,i.args,i.options);return Rs.hookChildProcess(n,i),n}function Mf(e,t,r){let i=Ts(e,t,r),n=wc.spawnSync(i.command,i.args,i.options);return n.error=n.error||Rs.verifyENOENTSync(n.status,i),n}Dt.exports=xc;Dt.exports.spawn=xc;Dt.exports.sync=Mf;Dt.exports._parse=Ts;Dt.exports._enoent=Rs});var ro=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.DEFAULT_COLOR_MAP=void 0;Xt.DEFAULT_COLOR_MAP={red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",white_bold:"\x1B[01m",reset:"\x1B[0m"};var to=class{constructor(t=Xt.DEFAULT_COLOR_MAP){this.text="",this.colorMap=t}addCharsWithColor(t,r){let i=this.colorMap[t];this.text+=i!==void 0?`${i}${r}${this.colorMap.reset}`:r}renderConsole(){return this.text}};Xt.default=to});var Cr=E(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.DEFAULT_HEADER_ALIGNMENT=Q.DEFAULT_ROW_ALIGNMENT=Q.DEFAULT_HEADER_FONT_COLOR=Q.DEFAULT_ROW_FONT_COLOR=Q.COLORS=Q.ALIGNMENTS=Q.DEFAULT_TABLE_STYLE=Q.DEFAULT_ROW_SEPARATOR=Q.DEFAULT_COLUMN_LEN=void 0;Q.DEFAULT_COLUMN_LEN=20;Q.DEFAULT_ROW_SEPARATOR=!1;Q.DEFAULT_TABLE_STYLE={headerTop:{left:"\u250C",mid:"\u252C",right:"\u2510",other:"\u2500"},headerBottom:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"},tableBottom:{left:"\u2514",mid:"\u2534",right:"\u2518",other:"\u2500"},vertical:"\u2502",rowSeparator:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"}};Q.ALIGNMENTS=["right","left","center"];Q.COLORS=["red","green","yellow","white","blue","magenta","cyan","white_bold","reset"];Q.DEFAULT_ROW_FONT_COLOR="white";Q.DEFAULT_HEADER_FONT_COLOR="white_bold";Q.DEFAULT_ROW_ALIGNMENT="right";Q.DEFAULT_HEADER_ALIGNMENT="center"});var Cm=E(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});var ox=[{first:768,last:879},{first:1155,last:1158},{first:1160,last:1161},{first:1425,last:1469},{first:1471,last:1471},{first:1473,last:1474},{first:1476,last:1477},{first:1479,last:1479},{first:1536,last:1539},{first:1552,last:1557},{first:1611,last:1630},{first:1648,last:1648},{first:1750,last:1764},{first:1767,last:1768},{first:1770,last:1773},{first:1807,last:1807},{first:1809,last:1809},{first:1840,last:1866},{first:1958,last:1968},{first:2027,last:2035},{first:2305,last:2306},{first:2364,last:2364},{first:2369,last:2376},{first:2381,last:2381},{first:2385,last:2388},{first:2402,last:2403},{first:2433,last:2433},{first:2492,last:2492},{first:2497,last:2500},{first:2509,last:2509},{first:2530,last:2531},{first:2561,last:2562},{first:2620,last:2620},{first:2625,last:2626},{first:2631,last:2632},{first:2635,last:2637},{first:2672,last:2673},{first:2689,last:2690},{first:2748,last:2748},{first:2753,last:2757},{first:2759,last:2760},{first:2765,last:2765},{first:2786,last:2787},{first:2817,last:2817},{first:2876,last:2876},{first:2879,last:2879},{first:2881,last:2883},{first:2893,last:2893},{first:2902,last:2902},{first:2946,last:2946},{first:3008,last:3008},{first:3021,last:3021},{first:3134,last:3136},{first:3142,last:3144},{first:3146,last:3149},{first:3157,last:3158},{first:3260,last:3260},{first:3263,last:3263},{first:3270,last:3270},{first:3276,last:3277},{first:3298,last:3299},{first:3393,last:3395},{first:3405,last:3405},{first:3530,last:3530},{first:3538,last:3540},{first:3542,last:3542},{first:3633,last:3633},{first:3636,last:3642},{first:3655,last:3662},{first:3761,last:3761},{first:3764,last:3769},{first:3771,last:3772},{first:3784,last:3789},{first:3864,last:3865},{first:3893,last:3893},{first:3895,last:3895},{first:3897,last:3897},{first:3953,last:3966},{first:3968,last:3972},{first:3974,last:3975},{first:3984,last:3991},{first:3993,last:4028},{first:4038,last:4038},{first:4141,last:4144},{first:4146,last:4146},{first:4150,last:4151},{first:4153,last:4153},{first:4184,last:4185},{first:4448,last:4607},{first:4959,last:4959},{first:5906,last:5908},{first:5938,last:5940},{first:5970,last:5971},{first:6002,last:6003},{first:6068,last:6069},{first:6071,last:6077},{first:6086,last:6086},{first:6089,last:6099},{first:6109,last:6109},{first:6155,last:6157},{first:6313,last:6313},{first:6432,last:6434},{first:6439,last:6440},{first:6450,last:6450},{first:6457,last:6459},{first:6679,last:6680},{first:6912,last:6915},{first:6964,last:6964},{first:6966,last:6970},{first:6972,last:6972},{first:6978,last:6978},{first:7019,last:7027},{first:7616,last:7626},{first:7678,last:7679},{first:8203,last:8207},{first:8234,last:8238},{first:8288,last:8291},{first:8298,last:8303},{first:8400,last:8431},{first:12330,last:12335},{first:12441,last:12442},{first:43014,last:43014},{first:43019,last:43019},{first:43045,last:43046},{first:64286,last:64286},{first:65024,last:65039},{first:65056,last:65059},{first:65279,last:65279},{first:65529,last:65531},{first:68097,last:68099},{first:68101,last:68102},{first:68108,last:68111},{first:68152,last:68154},{first:68159,last:68159},{first:119143,last:119145},{first:119155,last:119170},{first:119173,last:119179},{first:119210,last:119213},{first:119362,last:119364},{first:917505,last:917505},{first:917536,last:917631},{first:917760,last:917999}];io.default=ox});var Tm=E(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});var px=(e,t,r)=>{let i=0,n,s=r;if(e<t[0].first||e>t[s].last)return 0;for(;s>=i;)if(n=Math.floor((i+s)/2),e>t[n].last)i=n+1;else if(e<t[n].first)s=n-1;else return 1;return 0};no.default=px});var so=E(Tr=>{"use strict";var Im=Tr&&Tr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tr,"__esModule",{value:!0});var Rm=Im(Cm()),cx=Im(Tm()),dx=e=>e===0?0:e<32||e>=127&&e<160?-1:(0,cx.default)(e,Rm.default,Rm.default.length-1)?0:1+ +(e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141));Tr.default=dx});var Om=E(Rr=>{"use strict";var ux=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Rr,"__esModule",{value:!0});var lx=ux(so()),mx=e=>{let t=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r),n=(0,lx.default)(i);if(n<0)return-1;t+=n}return t};Rr.default=mx});var Lm=E(_t=>{"use strict";var Dm=_t&&_t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_t,"__esModule",{value:!0});_t.wcswidth=_t.wcwidth=void 0;var hx=Dm(Om());_t.wcswidth=hx.default;var yx=Dm(so());_t.wcwidth=yx.default});var ao=E(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.findWidthInConsole=Et.stripAnsi=void 0;var gx=Lm(),fx=/\x1b\[\d{1,3}(;\d{1,3})*m/g,_x=e=>e.replace(fx,"");Et.stripAnsi=_x;var bx=(e,t)=>{let r=0;return e=(0,Et.stripAnsi)(e),t&&Object.entries(t).forEach(([i,n])=>{let s=new RegExp(i,"g");r+=(e.match(s)||[]).length*n,e=e.replace(i,"")}),r+=(0,gx.wcswidth)(e),r};Et.findWidthInConsole=bx});var po=E(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.biggestWordInSentence=Ne.textWithPadding=Ne.splitTextIntoTextsOfMinLen=void 0;var oo=ao(),qx=(e,t,r)=>{let i=[];return e.split(/[\n\r]/).forEach(s=>{let a=s.split(" "),o=[],p=0;a.forEach(d=>{let c=(0,oo.findWidthInConsole)(d,r);p+c<=t?(p+=c+1,o.push(d)):(o.length>0&&i.push(o.join(" ")),o=[d],p=c+1)}),i.push(o.join(" "))}),i};Ne.splitTextIntoTextsOfMinLen=qx;var kx=(e,t,r,i)=>{let n=(0,oo.findWidthInConsole)(e,i),s=Math.floor((r-n)/2),a=r-s-n;if(r<n){let o=(0,Ne.splitTextIntoTextsOfMinLen)(e,r);return o.length===1?e:o.map(p=>(0,Ne.textWithPadding)(p,t,r,i)).join(`
30
- `)}switch(t){case"left":return e.concat(" ".repeat(r-n));case"center":return" ".repeat(s).concat(e).concat(" ".repeat(a));default:return" ".repeat(r-n).concat(e)}};Ne.textWithPadding=kx;var vx=(e,t)=>e.split(" ").reduce((r,i)=>Math.max(r,(0,oo.findWidthInConsole)(i,t)),0);Ne.biggestWordInSentence=vx});var Ir=E(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.getWidthLimitedColumnsArray=G.createHeaderAsRow=G.renderTableHorizontalBorders=G.findLenOfColumn=G.createRow=G.createColumFromOnlyName=G.createTableHorizontalBorders=G.convertRawRowOptionsToStandard=G.evaluateCellText=G.cellText=void 0;var Bm=ao(),co=po(),uo=Cr(),Zt=(e,t)=>Math.max(e,t),wx=e=>e==null?"":`${e}`;G.cellText=wx;var xx=(e,t)=>t?`${t(e)}`:(0,G.cellText)(e);G.evaluateCellText=xx;var Sx=e=>{if(e)return{color:e.color,separator:e.separator||uo.DEFAULT_ROW_SEPARATOR}};G.convertRawRowOptionsToStandard=Sx;var $x=({left:e,mid:t,right:r,other:i},n)=>{let s=e;return n.forEach(a=>{s+=i.repeat(a+2),s+=t}),s=s.slice(0,-t.length),s+=r,s};G.createTableHorizontalBorders=$x;var Ax=e=>({name:e,title:e});G.createColumFromOnlyName=Ax;var Ex=(e,t,r)=>({color:e,separator:r,text:t});G.createRow=Ex;var Px=(e,t,r)=>{let i=e.name,n=e.title,s=e.transform,a=Zt(0,e?.minLen||0);return e.maxLen?(a=Zt(a,Zt(e.maxLen,(0,co.biggestWordInSentence)(n,r))),a=t.reduce((o,p)=>Zt(o,(0,co.biggestWordInSentence)((0,G.evaluateCellText)(p.text[i],s),r)),a),a):(a=Zt(a,(0,Bm.findWidthInConsole)(n,r)),t.forEach(o=>{a=Zt(a,(0,Bm.findWidthInConsole)((0,G.evaluateCellText)(o.text[i],s),r))}),a)};G.findLenOfColumn=Px;var jx=(e,t)=>(0,G.createTableHorizontalBorders)(e,t);G.renderTableHorizontalBorders=jx;var Cx=(e,t)=>{let r=uo.DEFAULT_HEADER_FONT_COLOR,i=e(r,{},!1);return t.forEach(n=>{i.text[n.name]=n.title}),i};G.createHeaderAsRow=Cx;var Tx=(e,t,r)=>{let i={};return e.forEach(n=>{i[n.name]=(0,co.splitTextIntoTextsOfMinLen)((0,G.cellText)(t.text[n.name]),n.length||uo.DEFAULT_COLUMN_LEN,r)}),i};G.getWidthLimitedColumnsArray=Tx});var zm=E(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.rawColumnToInternalColumn=rt.objIfExists=void 0;var Rx=Cr(),Ix=(e,t)=>t?{[e]:t}:{};rt.objIfExists=Ix;var Ox=(e,t)=>{var r;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(r=e.title)!==null&&r!==void 0?r:e.name},(0,rt.objIfExists)("color",e.color||t?.color)),(0,rt.objIfExists)("maxLen",e.maxLen||t?.maxLen)),(0,rt.objIfExists)("minLen",e.minLen||t?.minLen)),{alignment:e.alignment||t?.alignment||Rx.DEFAULT_ROW_ALIGNMENT,transform:e.transform})};rt.rawColumnToInternalColumn=Ox});var Mm=E(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.preProcessRows=Qt.preProcessColumns=void 0;var Dx=Ir(),Lx=e=>{e.computedColumns.length&&e.computedColumns.forEach(t=>{e.columns.some(i=>i.name===t.name)||(e.addColumn(Object.assign(Object.assign({},t),e.defaultColumnOptions)),e.rows.forEach((i,n,s)=>{let a=s.map(o=>o.text);i.text[t.name]=t.function(i.text,n,a)}))})},Bx=e=>{e.enabledColumns.length&&(e.columns=e.columns.filter(t=>e.enabledColumns.includes(t.name)))},zx=e=>{e.disabledColumns.length&&(e.columns=e.columns.filter(t=>!e.disabledColumns.includes(t.name)))},Mx=e=>{e.columns.forEach(t=>{t.length=(0,Dx.findLenOfColumn)(t,e.rows,e.charLength)})},Fx=e=>{Lx(e),zx(e),Bx(e),Mx(e)};Qt.preProcessColumns=Fx;var Gx=e=>{let t=e.rows.filter(r=>e.filterFunction(r.text)).sort((r,i)=>e.sortFunction(r.text,i.text));e.rows=t};Qt.preProcessRows=Gx});var lo=E(Se=>{"use strict";var Gm=Se&&Se.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Se,"__esModule",{value:!0});Se.printSimpleTable=Se.renderSimpleTable=Se.renderTable=void 0;var Um=Gm(ro()),Nm=po(),Te=Cr(),bt=Ir(),Ux=Gm(mo()),Fm=Mm(),Nx=(e,t,r,i,n,s,a,o)=>{let p=new Um.default(a);return p.addCharsWithColor("",e.vertical),t.forEach(d=>{let u=r<i[d.name].length?(0,bt.cellText)(i[d.name][r]):"";p.addCharsWithColor(Te.DEFAULT_ROW_FONT_COLOR," "),p.addCharsWithColor(n&&Te.DEFAULT_HEADER_FONT_COLOR||d.color||s.color,(0,Nm.textWithPadding)(u,d.alignment||Te.DEFAULT_ROW_ALIGNMENT,d.length||Te.DEFAULT_COLUMN_LEN,o)),p.addCharsWithColor("",` ${e.vertical}`)}),p.renderConsole()},Hm=(e,t,r,i,n,s)=>{let a=(0,bt.getWidthLimitedColumnsArray)(t,r,s),o=Object.values(a).reduce((d,c)=>Math.max(d,c.length),0),p=[];for(let d=0;d<o;d+=1){let c=Nx(e,t,d,a,n,r,i,s);p.push(c)}return p},Hx=(e,t)=>{let r=JSON.parse(JSON.stringify(e)),i={};return t.filter(n=>!!n.transform).forEach(n=>{i[n.name]=n.transform}),Object.keys(i).forEach(n=>{r.text[n]=i[n](r.text[n])}),r},Vx=(e,t)=>{let r=[],i=Hx(t,e.columns);return r=r.concat(Hm(e.tableStyle,e.columns,i,e.colorMap,void 0,e.charLength)),r},Wx=e=>{let t=[];if(e.title===void 0)return t;let r=()=>{let s=(a,o)=>a+o+2+1;return e.columns.map(a=>a.length||Te.DEFAULT_COLUMN_LEN).reduce(s,1)},i=(0,Nm.textWithPadding)(e.title,Te.DEFAULT_HEADER_ALIGNMENT,r()),n=new Um.default(e.colorMap);return n.addCharsWithColor(Te.DEFAULT_HEADER_FONT_COLOR,i),t.push(n.renderConsole()),t},Kx=e=>{let t=[];t.push((0,bt.renderTableHorizontalBorders)(e.tableStyle.headerTop,e.columns.map(i=>i.length||Te.DEFAULT_COLUMN_LEN)));let r=(0,bt.createHeaderAsRow)(bt.createRow,e.columns);return t=t.concat(Hm(e.tableStyle,e.columns,r,e.colorMap,!0)),t.push((0,bt.renderTableHorizontalBorders)(e.tableStyle.headerBottom,e.columns.map(i=>i.length||Te.DEFAULT_COLUMN_LEN))),t},Yx=e=>{let t=[];return t.push((0,bt.renderTableHorizontalBorders)(e.tableStyle.tableBottom,e.columns.map(r=>r.length||Te.DEFAULT_COLUMN_LEN))),t},Jx=(e,t)=>{let r=[],i=e.rows.length-1;return e.rows.indexOf(t)!==i&&t.separator&&r.push((0,bt.renderTableHorizontalBorders)(e.tableStyle.rowSeparator,e.columns.map(s=>s.length||Te.DEFAULT_COLUMN_LEN))),r},Xx=e=>{(0,Fm.preProcessColumns)(e),(0,Fm.preProcessRows)(e);let t=[];return Wx(e).forEach(r=>t.push(r)),Kx(e).forEach(r=>t.push(r)),e.rows.forEach(r=>{Vx(e,r).forEach(i=>t.push(i)),Jx(e,r).forEach(i=>t.push(i))}),Yx(e).forEach(r=>t.push(r)),t.join(`
31
- `)};Se.renderTable=Xx;var Zx=(e,t)=>{let r=new Ux.default(t);return r.addRows(e),(0,Se.renderTable)(r)};Se.renderSimpleTable=Zx;var Qx=(e,t)=>{console.log((0,Se.renderSimpleTable)(e,t))};Se.printSimpleTable=Qx});var mo=E(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});var e0=ro(),Pn=Cr(),ho=Ir(),yo=zm(),t0=lo(),r0=()=>0,i0=()=>!0,go=class{initSimple(t){this.columns=t.map(r=>({name:r,title:r,alignment:Pn.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var r;this.title=t?.title||this.title,this.tableStyle=Object.assign(Object.assign({},this.tableStyle),t?.style),this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((r=t?.columns)===null||r===void 0?void 0:r.map(i=>(0,yo.rawColumnToInternalColumn)(i,t?.defaultColumnOptions)))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,this.defaultColumnOptions=t?.defaultColumnOptions||this.defaultColumnOptions,t?.shouldDisableColors?this.colorMap={}:t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=Pn.DEFAULT_TABLE_STYLE,this.filterFunction=i0,this.sortFunction=r0,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=Pn.DEFAULT_ROW_SEPARATOR,this.colorMap=e0.DEFAULT_COLOR_MAP,this.charLength={},this.defaultColumnOptions=void 0,this.transforms={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let r=this.columns.map(i=>i.name);Object.keys(t).forEach(i=>{r.includes(i)||this.columns.push((0,yo.rawColumnToInternalColumn)((0,ho.createColumFromOnlyName)(i),this.defaultColumnOptions))})}addColumn(t){let r=typeof t=="string"?(0,ho.createColumFromOnlyName)(t):t;this.columns.push((0,yo.rawColumnToInternalColumn)(r,this.defaultColumnOptions))}addColumns(t){t.forEach(r=>{this.addColumn(r)})}addRow(t,r){this.createColumnFromRow(t),this.rows.push((0,ho.createRow)(r?.color||Pn.DEFAULT_ROW_FONT_COLOR,t,r?.separator!==void 0?r?.separator:this.rowSeparator))}addRows(t,r){t.forEach(i=>{this.addRow(i,r)})}renderTable(){return(0,t0.renderTable)(this)}};fo.default=go});var Wm=E(Or=>{"use strict";var n0=Or&&Or.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Or,"__esModule",{value:!0});var s0=n0(mo()),Vm=Ir(),_o=class{constructor(t){this.table=new s0.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,r){return this.table.addRow(t,(0,Vm.convertRawRowOptionsToStandard)(r)),this}addRows(t,r){return this.table.addRows(t,(0,Vm.convertRawRowOptionsToStandard)(r)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};Or.default=_o});var Dr=E(He=>{"use strict";var a0=He&&He.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(He,"__esModule",{value:!0});He.renderTable=He.printTable=He.Table=void 0;var o0=a0(Wm());He.Table=o0.default;var Km=lo();Object.defineProperty(He,"printTable",{enumerable:!0,get:function(){return Km.printSimpleTable}});Object.defineProperty(He,"renderTable",{enumerable:!0,get:function(){return Km.renderSimpleTable}})});var zo=D(Bo(),1),{program:wS,createCommand:xS,createArgument:SS,createOption:$S,CommanderError:AS,InvalidArgumentError:ES,InvalidOptionArgumentError:PS,Command:Mo,Argument:jS,Option:Fo,Help:CS}=zo.default;var iy=D(K(),1);import de from"fs";import ae from"path";import{fileURLToPath as Kw}from"url";import{styleText as ps}from"util";import{stdout as ds,stdin as ap}from"process";import*as st from"readline";import Hy from"readline";var No=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),Ho=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Vo=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141;var jy=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Cy=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Wo=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Ty=/\t{1,1000}/y,Ko=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),Ry=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Iy=new RegExp("\\p{M}+","gu"),Oy={limit:1/0,ellipsis:""},Yo=(e,t={},r={})=>{let i=t.limit??1/0,n=t.ellipsis??"",s=t?.ellipsisWidth??(n?Yo(n,Oy,r).width:0),a=0,o=r.controlWidth??0,p=r.tabWidth??8,d=r.emojiWidth??2,c=2,u=r.regularWidth??1,l=r.wideWidth??c,m=[[Ry,u],[jy,a],[Cy,o],[Ty,p],[Ko,d],[Wo,l]],h=0,f=0,w=e.length,v=0,x=!1,_=w,T=Math.max(0,i-s),S=0,F=0,O=0,B=0;e:for(;;){if(F>S||f>=w&&f>h){let U=e.slice(S,F)||e.slice(h,f);v=0;for(let W of U.replaceAll(Iy,"")){let $=W.codePointAt(0)||0;if(Ho($)?B=c:Vo($)?B=l:B=u,O+B>T&&(_=Math.min(_,Math.max(S,h)+v)),O+B>i){x=!0;break e}v+=W.length,O+=B}S=F=0}if(f>=w)break e;for(let U=0,W=m.length;U<W;U++){let[$,Ve]=m[U];if($.lastIndex=f,$.test(e)){if(v=$===Wo?No(e.slice(f,$.lastIndex)):$===Ko?1:$.lastIndex-f,B=v*Ve,O+B>T&&(_=Math.min(_,f+Math.floor((T-O)/Ve))),O+B>i){x=!0;break e}O+=B,S=h,F=f,f=h=$.lastIndex;continue e}}f+=1}return{width:x?T:O,index:x?_:w,truncated:x,ellipsed:x&&i>=s}},Jo=Yo;var Dy={limit:1/0,ellipsis:"",ellipsisWidth:0},Ly=(e,t={})=>Jo(e,Dy,t).width,ce=Ly;var Zr="\x1B",tp="\x9B",By=39,ns="\x07",rp="[",zy="]",ip="m",ss=`${zy}8;;`,Xo=new RegExp(`(?:\\${rp}(?<code>\\d+)m|\\${ss}(?<uri>.*)${ns})`,"y"),Zo=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Qo=e=>`${Zr}${rp}${e}${ip}`,ep=e=>`${Zr}${ss}${e}${ns}`,is=(e,t,r)=>{let i=t[Symbol.iterator](),n=!1,s=!1,a=e.at(-1),o=a===void 0?0:ce(a),p=i.next(),d=i.next(),c=0;for(;!p.done;){let u=p.value,l=ce(u);o+l<=r?e[e.length-1]+=u:(e.push(u),o=0),(u===Zr||u===tp)&&(n=!0,s=t.startsWith(ss,c+1)),n?s?u===ns&&(n=!1,s=!1):u===ip&&(n=!1):(o+=l,o===r&&!d.done&&(e.push(""),o=0)),p=d,d=i.next(),c+=u.length}a=e.at(-1),!o&&a!==void 0&&a.length&&e.length>1&&(e[e.length-2]+=e.pop())},My=e=>{let t=e.split(" "),r=t.length;for(;r&&!ce(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Fy=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,s,a=e.split(" "),o=[""],p=0;for(let u=0;u<a.length;u++){let l=a[u];if(r.trim!==!1){let h=o.at(-1)??"",f=h.trimStart();h.length!==f.length&&(o[o.length-1]=f,p=ce(f))}u!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),p=0),(p||r.trim===!1)&&(o[o.length-1]+=" ",p++));let m=ce(l);if(r.hard&&m>t){let h=t-p,f=1+Math.floor((m-h-1)/t);Math.floor((m-1)/t)<f&&o.push(""),is(o,l,t),p=ce(o.at(-1)??"");continue}if(p+m>t&&p&&m){if(r.wordWrap===!1&&p<t){is(o,l,t),p=ce(o.at(-1)??"");continue}o.push(""),p=0}if(p+m>t&&r.wordWrap===!1){is(o,l,t),p=ce(o.at(-1)??"");continue}o[o.length-1]+=l,p+=m}r.trim!==!1&&(o=o.map(u=>My(u)));let d=o.join(`
32
- `),c=!1;for(let u=0;u<d.length;u++){let l=d[u];if(i+=l,c)c=!1;else if(c=l>="\uD800"&&l<="\uDBFF",c)continue;if(l===Zr||l===tp){Xo.lastIndex=u+1;let h=Xo.exec(d)?.groups;if(h?.code!==void 0){let f=Number.parseFloat(h.code);n=f===By?void 0:f}else h?.uri!==void 0&&(s=h.uri.length===0?void 0:h.uri)}if(d[u+1]===`
33
- `){s&&(i+=ep(""));let m=n?Zo(n):void 0;n&&m&&(i+=Qo(m))}else l===`
34
- `&&(n&&Zo(n)&&(i+=Qo(n)),s&&(i+=ep(s)))}return i},Gy=/\r?\n/;function Oe(e,t,r){return String(e).normalize().split(Gy).map(i=>Fy(i,t,r)).join(`
35
- `)}var ne=D(os(),1);import{ReadStream as sp}from"tty";function ei(e,t,r){if(!r.some(a=>!a.disabled))return e;let i=e+t,n=Math.max(r.length-1,0),s=i<0?n:i>n?0:i;return r[s].disabled?ei(s,t<0?-1:1,r):s}var Vy=["up","down","left","right","space","enter","cancel"],Wy=["January","February","March","April","May","June","July","August","September","October","November","December"],re={actions:new Set(Vy),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...Wy],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function us(e,t){if(typeof e=="string")return re.aliases.get(e)===t;for(let r of e)if(r!==void 0&&us(r,t))return!0;return!1}function Ky(e,t){if(e===t)return;let r=e.split(`
29
+ `)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(n=>r.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Uo(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,i="127.0.0.1",n="9229",s;return(s=t.match(/^(--inspect(-brk)?)$/))!==null?r=s[1]:(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=s[1],i=s[3],n=s[4]),r&&n!=="0"?`${r}=${i}:${parseInt(n)+1}`:t})}function as(){if(O.env.NO_COLOR||O.env.FORCE_COLOR==="0"||O.env.FORCE_COLOR==="false")return!1;if(O.env.FORCE_COLOR||O.env.CLICOLOR_FORCE!==void 0)return!0}os.Command=ss;os.useColor=as});var Ko=j(we=>{"use strict";p();var{Argument:Vo}=ii(),{Command:ps}=No(),{CommanderError:Wy,InvalidArgumentError:Ho}=hr(),{Help:Ky}=Zn(),{Option:Wo}=rs();we.program=new ps;we.createCommand=e=>new ps(e);we.createOption=(e,t)=>new Wo(e,t);we.createArgument=(e,t)=>new Vo(e,t);we.Command=ps;we.Option=Wo;we.Argument=Vo;we.Help=Ky;we.CommanderError=Wy;we.InvalidArgumentError=Ho;we.InvalidOptionArgumentError=Ho});var J=j((g$,cs)=>{"use strict";p();var ai=process||{},Zo=ai.argv||[],si=ai.env||{},Yy=!(si.NO_COLOR||Zo.includes("--no-color"))&&(!!si.FORCE_COLOR||Zo.includes("--color")||ai.platform==="win32"||(ai.stdout||{}).isTTY&&si.TERM!=="dumb"||!!si.CI),Jy=(e,t,r=e)=>i=>{let n=""+i,s=n.indexOf(t,e.length);return~s?e+Xy(n,t,r,s)+t:e+n+t},Xy=(e,t,r,i)=>{let n="",s=0;do n+=e.substring(s,i)+r,s=i+t.length,i=e.indexOf(t,s);while(~i);return n+e.substring(s)},Qo=(e=Yy)=>{let t=e?Jy:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};cs.exports=Qo();cs.exports.createColors=Qo});var hs=j((P$,hp)=>{"use strict";p();var ms={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},ug={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},lg={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?ms.up():"");return e&&(t+=ms.left),t}};hp.exports={cursor:ms,scroll:ug,erase:lg,beep:"\x07"}});var Zp=j((gP,Xp)=>{"use strict";p();Xp.exports=Jp;Jp.sync=Bf;var Kp=_e("fs");function Lf(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var i=0;i<r.length;i++){var n=r[i].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Yp(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Lf(t,r)}function Jp(e,t,r){Kp.stat(e,function(i,n){r(i,i?!1:Yp(n,e,t))})}function Bf(e,t){return Yp(Kp.statSync(e),e,t)}});var ic=j((_P,rc)=>{"use strict";p();rc.exports=ec;ec.sync=zf;var Qp=_e("fs");function ec(e,t,r){Qp.stat(e,function(i,n){r(i,i?!1:tc(n,t))})}function zf(e,t){return tc(Qp.statSync(e),t)}function tc(e,t){return e.isFile()&&Mf(e,t)}function Mf(e,t){var r=e.mode,i=e.uid,n=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),a=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),o=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),d=o|c,l=r&u||r&c&&n===a||r&o&&i===s||r&d&&s===0;return l}});var sc=j((kP,nc)=>{"use strict";p();var qP=_e("fs"),Ii;process.platform==="win32"||global.TESTING_WINDOWS?Ii=Zp():Ii=ic();nc.exports=Ts;Ts.sync=Ff;function Ts(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){Ts(e,t||{},function(s,a){s?n(s):i(a)})})}Ii(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),r(i,n)})}function Ff(e,t){try{return Ii.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var lc=j((wP,uc)=>{"use strict";p();var Bt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ac=_e("path"),Gf=Bt?";":":",oc=sc(),pc=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),cc=(e,t)=>{let r=t.colon||Gf,i=e.match(/\//)||Bt&&e.match(/\\/)?[""]:[...Bt?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=Bt?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Bt?n.split(r):[""];return Bt&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},dc=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:i,pathExt:n,pathExtExe:s}=cc(e,t),a=[],o=u=>new Promise((d,l)=>{if(u===i.length)return t.all&&a.length?d(a):l(pc(e));let h=i[u],y=/^".*"$/.test(h)?h.slice(1,-1):h,g=ac.join(y,e),b=!y&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;d(c(b,u,0))}),c=(u,d,l)=>new Promise((h,y)=>{if(l===n.length)return h(o(d+1));let g=n[l];oc(u+g,{pathExt:s},(b,S)=>{if(!b&&S)if(t.all)a.push(u+g);else return h(u+g);return h(c(u,d,l+1))})});return r?o(0).then(u=>r(null,u),r):o(0)},Uf=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=cc(e,t),s=[];for(let a=0;a<r.length;a++){let o=r[a],c=/^".*"$/.test(o)?o.slice(1,-1):o,u=ac.join(c,e),d=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u;for(let l=0;l<i.length;l++){let h=d+i[l];try{if(oc.sync(h,{pathExt:n}))if(t.all)s.push(h);else return h}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw pc(e)};uc.exports=dc;dc.sync=Uf});var hc=j((SP,Rs)=>{"use strict";p();var mc=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};Rs.exports=mc;Rs.exports.default=mc});var _c=j((AP,fc)=>{"use strict";p();var yc=_e("path"),Nf=lc(),Vf=hc();function gc(e,t){let r=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let a;try{a=Nf.sync(e.command,{path:r[Vf({env:r})],pathExt:t?yc.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return a&&(a=yc.resolve(n?e.options.cwd:"",a)),a}function Hf(e){return gc(e)||gc(e,!0)}fc.exports=Hf});var bc=j((PP,Os)=>{"use strict";p();var Is=/([()\][%!^"`<>&|;, *?])/g;function Wf(e){return e=e.replace(Is,"^$1"),e}function Kf(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Is,"^$1"),t&&(e=e.replace(Is,"^$1")),e}Os.exports.command=Wf;Os.exports.argument=Kf});var kc=j((CP,qc)=>{"use strict";p();qc.exports=/^#!(.*)/});var wc=j((RP,vc)=>{"use strict";p();var Yf=kc();vc.exports=(e="")=>{let t=e.match(Yf);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var Sc=j((OP,xc)=>{"use strict";p();var Ds=_e("fs"),Jf=wc();function Xf(e){let r=Buffer.alloc(150),i;try{i=Ds.openSync(e,"r"),Ds.readSync(i,r,0,150,0),Ds.closeSync(i)}catch{}return Jf(r.toString())}xc.exports=Xf});var Pc=j((LP,Ec)=>{"use strict";p();var Zf=_e("path"),$c=_c(),Ac=bc(),Qf=Sc(),e_=process.platform==="win32",t_=/\.(?:com|exe)$/i,r_=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function i_(e){e.file=$c(e);let t=e.file&&Qf(e.file);return t?(e.args.unshift(e.file),e.command=t,$c(e)):e.file}function n_(e){if(!e_)return e;let t=i_(e),r=!t_.test(t);if(e.options.forceShell||r){let i=r_.test(t);e.command=Zf.normalize(e.command),e.command=Ac.command(e.command),e.args=e.args.map(s=>Ac.argument(s,i));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function s_(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let i={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?i:n_(i)}Ec.exports=s_});var Tc=j((zP,Cc)=>{"use strict";p();var Ls=process.platform==="win32";function Bs(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function a_(e,t){if(!Ls)return;let r=e.emit;e.emit=function(i,n){if(i==="exit"){let s=jc(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function jc(e,t){return Ls&&e===1&&!t.file?Bs(t.original,"spawn"):null}function o_(e,t){return Ls&&e===1&&!t.file?Bs(t.original,"spawnSync"):null}Cc.exports={hookChildProcess:a_,verifyENOENT:jc,verifyENOENTSync:o_,notFoundError:Bs}});var Oc=j((FP,zt)=>{"use strict";p();var Rc=_e("child_process"),zs=Pc(),Ms=Tc();function Ic(e,t,r){let i=zs(e,t,r),n=Rc.spawn(i.command,i.args,i.options);return Ms.hookChildProcess(n,i),n}function p_(e,t,r){let i=zs(e,t,r),n=Rc.spawnSync(i.command,i.args,i.options);return n.error=n.error||Ms.verifyENOENTSync(n.status,i),n}zt.exports=Ic;zt.exports.spawn=Ic;zt.exports.sync=p_;zt.exports._parse=zs;zt.exports._enoent=Ms});var co=j(rr=>{"use strict";p();Object.defineProperty(rr,"__esModule",{value:!0});rr.DEFAULT_COLOR_MAP=void 0;rr.DEFAULT_COLOR_MAP={red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",white_bold:"\x1B[01m",reset:"\x1B[0m"};var po=class{constructor(t=rr.DEFAULT_COLOR_MAP){this.text="",this.colorMap=t}addCharsWithColor(t,r){let i=this.colorMap[t];this.text+=i!==void 0?`${i}${r}${this.colorMap.reset}`:r}renderConsole(){return this.text}};rr.default=po});var Br=j(te=>{"use strict";p();Object.defineProperty(te,"__esModule",{value:!0});te.DEFAULT_HEADER_ALIGNMENT=te.DEFAULT_ROW_ALIGNMENT=te.DEFAULT_HEADER_FONT_COLOR=te.DEFAULT_ROW_FONT_COLOR=te.COLORS=te.ALIGNMENTS=te.DEFAULT_TABLE_STYLE=te.DEFAULT_ROW_SEPARATOR=te.DEFAULT_COLUMN_LEN=void 0;te.DEFAULT_COLUMN_LEN=20;te.DEFAULT_ROW_SEPARATOR=!1;te.DEFAULT_TABLE_STYLE={headerTop:{left:"\u250C",mid:"\u252C",right:"\u2510",other:"\u2500"},headerBottom:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"},tableBottom:{left:"\u2514",mid:"\u2534",right:"\u2518",other:"\u2500"},vertical:"\u2502",rowSeparator:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"}};te.ALIGNMENTS=["right","left","center"];te.COLORS=["red","green","yellow","white","blue","magenta","cyan","white_bold","reset"];te.DEFAULT_ROW_FONT_COLOR="white";te.DEFAULT_HEADER_FONT_COLOR="white_bold";te.DEFAULT_ROW_ALIGNMENT="right";te.DEFAULT_HEADER_ALIGNMENT="center"});var Fm=j(uo=>{"use strict";p();Object.defineProperty(uo,"__esModule",{value:!0});var Px=[{first:768,last:879},{first:1155,last:1158},{first:1160,last:1161},{first:1425,last:1469},{first:1471,last:1471},{first:1473,last:1474},{first:1476,last:1477},{first:1479,last:1479},{first:1536,last:1539},{first:1552,last:1557},{first:1611,last:1630},{first:1648,last:1648},{first:1750,last:1764},{first:1767,last:1768},{first:1770,last:1773},{first:1807,last:1807},{first:1809,last:1809},{first:1840,last:1866},{first:1958,last:1968},{first:2027,last:2035},{first:2305,last:2306},{first:2364,last:2364},{first:2369,last:2376},{first:2381,last:2381},{first:2385,last:2388},{first:2402,last:2403},{first:2433,last:2433},{first:2492,last:2492},{first:2497,last:2500},{first:2509,last:2509},{first:2530,last:2531},{first:2561,last:2562},{first:2620,last:2620},{first:2625,last:2626},{first:2631,last:2632},{first:2635,last:2637},{first:2672,last:2673},{first:2689,last:2690},{first:2748,last:2748},{first:2753,last:2757},{first:2759,last:2760},{first:2765,last:2765},{first:2786,last:2787},{first:2817,last:2817},{first:2876,last:2876},{first:2879,last:2879},{first:2881,last:2883},{first:2893,last:2893},{first:2902,last:2902},{first:2946,last:2946},{first:3008,last:3008},{first:3021,last:3021},{first:3134,last:3136},{first:3142,last:3144},{first:3146,last:3149},{first:3157,last:3158},{first:3260,last:3260},{first:3263,last:3263},{first:3270,last:3270},{first:3276,last:3277},{first:3298,last:3299},{first:3393,last:3395},{first:3405,last:3405},{first:3530,last:3530},{first:3538,last:3540},{first:3542,last:3542},{first:3633,last:3633},{first:3636,last:3642},{first:3655,last:3662},{first:3761,last:3761},{first:3764,last:3769},{first:3771,last:3772},{first:3784,last:3789},{first:3864,last:3865},{first:3893,last:3893},{first:3895,last:3895},{first:3897,last:3897},{first:3953,last:3966},{first:3968,last:3972},{first:3974,last:3975},{first:3984,last:3991},{first:3993,last:4028},{first:4038,last:4038},{first:4141,last:4144},{first:4146,last:4146},{first:4150,last:4151},{first:4153,last:4153},{first:4184,last:4185},{first:4448,last:4607},{first:4959,last:4959},{first:5906,last:5908},{first:5938,last:5940},{first:5970,last:5971},{first:6002,last:6003},{first:6068,last:6069},{first:6071,last:6077},{first:6086,last:6086},{first:6089,last:6099},{first:6109,last:6109},{first:6155,last:6157},{first:6313,last:6313},{first:6432,last:6434},{first:6439,last:6440},{first:6450,last:6450},{first:6457,last:6459},{first:6679,last:6680},{first:6912,last:6915},{first:6964,last:6964},{first:6966,last:6970},{first:6972,last:6972},{first:6978,last:6978},{first:7019,last:7027},{first:7616,last:7626},{first:7678,last:7679},{first:8203,last:8207},{first:8234,last:8238},{first:8288,last:8291},{first:8298,last:8303},{first:8400,last:8431},{first:12330,last:12335},{first:12441,last:12442},{first:43014,last:43014},{first:43019,last:43019},{first:43045,last:43046},{first:64286,last:64286},{first:65024,last:65039},{first:65056,last:65059},{first:65279,last:65279},{first:65529,last:65531},{first:68097,last:68099},{first:68101,last:68102},{first:68108,last:68111},{first:68152,last:68154},{first:68159,last:68159},{first:119143,last:119145},{first:119155,last:119170},{first:119173,last:119179},{first:119210,last:119213},{first:119362,last:119364},{first:917505,last:917505},{first:917536,last:917631},{first:917760,last:917999}];uo.default=Px});var Gm=j(lo=>{"use strict";p();Object.defineProperty(lo,"__esModule",{value:!0});var jx=(e,t,r)=>{let i=0,n,s=r;if(e<t[0].first||e>t[s].last)return 0;for(;s>=i;)if(n=Math.floor((i+s)/2),e>t[n].last)i=n+1;else if(e<t[n].first)s=n-1;else return 1;return 0};lo.default=jx});var mo=j(zr=>{"use strict";p();var Nm=zr&&zr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zr,"__esModule",{value:!0});var Um=Nm(Fm()),Cx=Nm(Gm()),Tx=e=>e===0?0:e<32||e>=127&&e<160?-1:(0,Cx.default)(e,Um.default,Um.default.length-1)?0:1+ +(e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141));zr.default=Tx});var Vm=j(Mr=>{"use strict";p();var Rx=Mr&&Mr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mr,"__esModule",{value:!0});var Ix=Rx(mo()),Ox=e=>{let t=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r),n=(0,Ix.default)(i);if(n<0)return-1;t+=n}return t};Mr.default=Ox});var Wm=j(kt=>{"use strict";p();var Hm=kt&&kt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kt,"__esModule",{value:!0});kt.wcswidth=kt.wcwidth=void 0;var Dx=Hm(Vm());kt.wcswidth=Dx.default;var Lx=Hm(mo());kt.wcwidth=Lx.default});var ho=j(Ct=>{"use strict";p();Object.defineProperty(Ct,"__esModule",{value:!0});Ct.findWidthInConsole=Ct.stripAnsi=void 0;var Bx=Wm(),zx=/\x1b\[\d{1,3}(;\d{1,3})*m/g,Mx=e=>e.replace(zx,"");Ct.stripAnsi=Mx;var Fx=(e,t)=>{let r=0;return e=(0,Ct.stripAnsi)(e),t&&Object.entries(t).forEach(([i,n])=>{let s=new RegExp(i,"g");r+=(e.match(s)||[]).length*n,e=e.replace(i,"")}),r+=(0,Bx.wcswidth)(e),r};Ct.findWidthInConsole=Fx});var go=j(We=>{"use strict";p();Object.defineProperty(We,"__esModule",{value:!0});We.biggestWordInSentence=We.textWithPadding=We.splitTextIntoTextsOfMinLen=void 0;var yo=ho(),Gx=(e,t,r)=>{let i=[];return e.split(/[\n\r]/).forEach(s=>{let a=s.split(" "),o=[],c=0;a.forEach(u=>{let d=(0,yo.findWidthInConsole)(u,r);c+d<=t?(c+=d+1,o.push(u)):(o.length>0&&i.push(o.join(" ")),o=[u],c=d+1)}),i.push(o.join(" "))}),i};We.splitTextIntoTextsOfMinLen=Gx;var Ux=(e,t,r,i)=>{let n=(0,yo.findWidthInConsole)(e,i),s=Math.floor((r-n)/2),a=r-s-n;if(r<n){let o=(0,We.splitTextIntoTextsOfMinLen)(e,r);return o.length===1?e:o.map(c=>(0,We.textWithPadding)(c,t,r,i)).join(`
30
+ `)}switch(t){case"left":return e.concat(" ".repeat(r-n));case"center":return" ".repeat(s).concat(e).concat(" ".repeat(a));default:return" ".repeat(r-n).concat(e)}};We.textWithPadding=Ux;var Nx=(e,t)=>e.split(" ").reduce((r,i)=>Math.max(r,(0,yo.findWidthInConsole)(i,t)),0);We.biggestWordInSentence=Nx});var Fr=j(N=>{"use strict";p();Object.defineProperty(N,"__esModule",{value:!0});N.getWidthLimitedColumnsArray=N.createHeaderAsRow=N.renderTableHorizontalBorders=N.findLenOfColumn=N.createRow=N.createColumFromOnlyName=N.createTableHorizontalBorders=N.convertRawRowOptionsToStandard=N.evaluateCellText=N.cellText=void 0;var Km=ho(),fo=go(),_o=Br(),ir=(e,t)=>Math.max(e,t),Vx=e=>e==null?"":`${e}`;N.cellText=Vx;var Hx=(e,t)=>t?`${t(e)}`:(0,N.cellText)(e);N.evaluateCellText=Hx;var Wx=e=>{if(e)return{color:e.color,separator:e.separator||_o.DEFAULT_ROW_SEPARATOR}};N.convertRawRowOptionsToStandard=Wx;var Kx=({left:e,mid:t,right:r,other:i},n)=>{let s=e;return n.forEach(a=>{s+=i.repeat(a+2),s+=t}),s=s.slice(0,-t.length),s+=r,s};N.createTableHorizontalBorders=Kx;var Yx=e=>({name:e,title:e});N.createColumFromOnlyName=Yx;var Jx=(e,t,r)=>({color:e,separator:r,text:t});N.createRow=Jx;var Xx=(e,t,r)=>{let i=e.name,n=e.title,s=e.transform,a=ir(0,e?.minLen||0);return e.maxLen?(a=ir(a,ir(e.maxLen,(0,fo.biggestWordInSentence)(n,r))),a=t.reduce((o,c)=>ir(o,(0,fo.biggestWordInSentence)((0,N.evaluateCellText)(c.text[i],s),r)),a),a):(a=ir(a,(0,Km.findWidthInConsole)(n,r)),t.forEach(o=>{a=ir(a,(0,Km.findWidthInConsole)((0,N.evaluateCellText)(o.text[i],s),r))}),a)};N.findLenOfColumn=Xx;var Zx=(e,t)=>(0,N.createTableHorizontalBorders)(e,t);N.renderTableHorizontalBorders=Zx;var Qx=(e,t)=>{let r=_o.DEFAULT_HEADER_FONT_COLOR,i=e(r,{},!1);return t.forEach(n=>{i.text[n.name]=n.title}),i};N.createHeaderAsRow=Qx;var e0=(e,t,r)=>{let i={};return e.forEach(n=>{i[n.name]=(0,fo.splitTextIntoTextsOfMinLen)((0,N.cellText)(t.text[n.name]),n.length||_o.DEFAULT_COLUMN_LEN,r)}),i};N.getWidthLimitedColumnsArray=e0});var Ym=j(st=>{"use strict";p();Object.defineProperty(st,"__esModule",{value:!0});st.rawColumnToInternalColumn=st.objIfExists=void 0;var t0=Br(),r0=(e,t)=>t?{[e]:t}:{};st.objIfExists=r0;var i0=(e,t)=>{var r;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(r=e.title)!==null&&r!==void 0?r:e.name},(0,st.objIfExists)("color",e.color||t?.color)),(0,st.objIfExists)("maxLen",e.maxLen||t?.maxLen)),(0,st.objIfExists)("minLen",e.minLen||t?.minLen)),{alignment:e.alignment||t?.alignment||t0.DEFAULT_ROW_ALIGNMENT,transform:e.transform})};st.rawColumnToInternalColumn=i0});var Jm=j(nr=>{"use strict";p();Object.defineProperty(nr,"__esModule",{value:!0});nr.preProcessRows=nr.preProcessColumns=void 0;var n0=Fr(),s0=e=>{e.computedColumns.length&&e.computedColumns.forEach(t=>{e.columns.some(i=>i.name===t.name)||(e.addColumn(Object.assign(Object.assign({},t),e.defaultColumnOptions)),e.rows.forEach((i,n,s)=>{let a=s.map(o=>o.text);i.text[t.name]=t.function(i.text,n,a)}))})},a0=e=>{e.enabledColumns.length&&(e.columns=e.columns.filter(t=>e.enabledColumns.includes(t.name)))},o0=e=>{e.disabledColumns.length&&(e.columns=e.columns.filter(t=>!e.disabledColumns.includes(t.name)))},p0=e=>{e.columns.forEach(t=>{t.length=(0,n0.findLenOfColumn)(t,e.rows,e.charLength)})},c0=e=>{s0(e),o0(e),a0(e),p0(e)};nr.preProcessColumns=c0;var d0=e=>{let t=e.rows.filter(r=>e.filterFunction(r.text)).sort((r,i)=>e.sortFunction(r.text,i.text));e.rows=t};nr.preProcessRows=d0});var bo=j(Ae=>{"use strict";p();var Zm=Ae&&Ae.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.printSimpleTable=Ae.renderSimpleTable=Ae.renderTable=void 0;var Qm=Zm(co()),eh=go(),Oe=Br(),vt=Fr(),u0=Zm(qo()),Xm=Jm(),l0=(e,t,r,i,n,s,a,o)=>{let c=new Qm.default(a);return c.addCharsWithColor("",e.vertical),t.forEach(u=>{let l=r<i[u.name].length?(0,vt.cellText)(i[u.name][r]):"";c.addCharsWithColor(Oe.DEFAULT_ROW_FONT_COLOR," "),c.addCharsWithColor(n&&Oe.DEFAULT_HEADER_FONT_COLOR||u.color||s.color,(0,eh.textWithPadding)(l,u.alignment||Oe.DEFAULT_ROW_ALIGNMENT,u.length||Oe.DEFAULT_COLUMN_LEN,o)),c.addCharsWithColor("",` ${e.vertical}`)}),c.renderConsole()},th=(e,t,r,i,n,s)=>{let a=(0,vt.getWidthLimitedColumnsArray)(t,r,s),o=Object.values(a).reduce((u,d)=>Math.max(u,d.length),0),c=[];for(let u=0;u<o;u+=1){let d=l0(e,t,u,a,n,r,i,s);c.push(d)}return c},m0=(e,t)=>{let r=JSON.parse(JSON.stringify(e)),i={};return t.filter(n=>!!n.transform).forEach(n=>{i[n.name]=n.transform}),Object.keys(i).forEach(n=>{r.text[n]=i[n](r.text[n])}),r},h0=(e,t)=>{let r=[],i=m0(t,e.columns);return r=r.concat(th(e.tableStyle,e.columns,i,e.colorMap,void 0,e.charLength)),r},y0=e=>{let t=[];if(e.title===void 0)return t;let r=()=>{let s=(a,o)=>a+o+2+1;return e.columns.map(a=>a.length||Oe.DEFAULT_COLUMN_LEN).reduce(s,1)},i=(0,eh.textWithPadding)(e.title,Oe.DEFAULT_HEADER_ALIGNMENT,r()),n=new Qm.default(e.colorMap);return n.addCharsWithColor(Oe.DEFAULT_HEADER_FONT_COLOR,i),t.push(n.renderConsole()),t},g0=e=>{let t=[];t.push((0,vt.renderTableHorizontalBorders)(e.tableStyle.headerTop,e.columns.map(i=>i.length||Oe.DEFAULT_COLUMN_LEN)));let r=(0,vt.createHeaderAsRow)(vt.createRow,e.columns);return t=t.concat(th(e.tableStyle,e.columns,r,e.colorMap,!0)),t.push((0,vt.renderTableHorizontalBorders)(e.tableStyle.headerBottom,e.columns.map(i=>i.length||Oe.DEFAULT_COLUMN_LEN))),t},f0=e=>{let t=[];return t.push((0,vt.renderTableHorizontalBorders)(e.tableStyle.tableBottom,e.columns.map(r=>r.length||Oe.DEFAULT_COLUMN_LEN))),t},_0=(e,t)=>{let r=[],i=e.rows.length-1;return e.rows.indexOf(t)!==i&&t.separator&&r.push((0,vt.renderTableHorizontalBorders)(e.tableStyle.rowSeparator,e.columns.map(s=>s.length||Oe.DEFAULT_COLUMN_LEN))),r},b0=e=>{(0,Xm.preProcessColumns)(e),(0,Xm.preProcessRows)(e);let t=[];return y0(e).forEach(r=>t.push(r)),g0(e).forEach(r=>t.push(r)),e.rows.forEach(r=>{h0(e,r).forEach(i=>t.push(i)),_0(e,r).forEach(i=>t.push(i))}),f0(e).forEach(r=>t.push(r)),t.join(`
31
+ `)};Ae.renderTable=b0;var q0=(e,t)=>{let r=new u0.default(t);return r.addRows(e),(0,Ae.renderTable)(r)};Ae.renderSimpleTable=q0;var k0=(e,t)=>{console.log((0,Ae.renderSimpleTable)(e,t))};Ae.printSimpleTable=k0});var qo=j(xo=>{"use strict";p();Object.defineProperty(xo,"__esModule",{value:!0});var v0=co(),Dn=Br(),ko=Fr(),vo=Ym(),w0=bo(),x0=()=>0,S0=()=>!0,wo=class{initSimple(t){this.columns=t.map(r=>({name:r,title:r,alignment:Dn.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var r;this.title=t?.title||this.title,this.tableStyle=Object.assign(Object.assign({},this.tableStyle),t?.style),this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((r=t?.columns)===null||r===void 0?void 0:r.map(i=>(0,vo.rawColumnToInternalColumn)(i,t?.defaultColumnOptions)))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,this.defaultColumnOptions=t?.defaultColumnOptions||this.defaultColumnOptions,t?.shouldDisableColors?this.colorMap={}:t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=Dn.DEFAULT_TABLE_STYLE,this.filterFunction=S0,this.sortFunction=x0,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=Dn.DEFAULT_ROW_SEPARATOR,this.colorMap=v0.DEFAULT_COLOR_MAP,this.charLength={},this.defaultColumnOptions=void 0,this.transforms={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let r=this.columns.map(i=>i.name);Object.keys(t).forEach(i=>{r.includes(i)||this.columns.push((0,vo.rawColumnToInternalColumn)((0,ko.createColumFromOnlyName)(i),this.defaultColumnOptions))})}addColumn(t){let r=typeof t=="string"?(0,ko.createColumFromOnlyName)(t):t;this.columns.push((0,vo.rawColumnToInternalColumn)(r,this.defaultColumnOptions))}addColumns(t){t.forEach(r=>{this.addColumn(r)})}addRow(t,r){this.createColumnFromRow(t),this.rows.push((0,ko.createRow)(r?.color||Dn.DEFAULT_ROW_FONT_COLOR,t,r?.separator!==void 0?r?.separator:this.rowSeparator))}addRows(t,r){t.forEach(i=>{this.addRow(i,r)})}renderTable(){return(0,w0.renderTable)(this)}};xo.default=wo});var ih=j(Gr=>{"use strict";p();var $0=Gr&&Gr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gr,"__esModule",{value:!0});var A0=$0(qo()),rh=Fr(),So=class{constructor(t){this.table=new A0.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,r){return this.table.addRow(t,(0,rh.convertRawRowOptionsToStandard)(r)),this}addRows(t,r){return this.table.addRows(t,(0,rh.convertRawRowOptionsToStandard)(r)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};Gr.default=So});var Ur=j(Ke=>{"use strict";p();var E0=Ke&&Ke.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.renderTable=Ke.printTable=Ke.Table=void 0;var P0=E0(ih());Ke.Table=P0.default;var nh=bo();Object.defineProperty(Ke,"printTable",{enumerable:!0,get:function(){return nh.printSimpleTable}});Object.defineProperty(Ke,"renderTable",{enumerable:!0,get:function(){return nh.renderSimpleTable}})});p();p();var Yo=B(Ko(),1),{program:s$,createCommand:a$,createArgument:o$,createOption:p$,CommanderError:c$,InvalidArgumentError:d$,InvalidOptionArgumentError:u$,Command:Jo,Argument:l$,Option:Xo,Help:m$}=Yo.default;var wy=B(J(),1);p();import le from"fs";import pe from"path";import{fileURLToPath as gx}from"url";p();p();import{styleText as ys}from"util";import{stdout as fs,stdin as gp}from"process";import*as pt from"readline";import mg from"readline";p();p();p();p();var ep=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),tp=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,rp=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141;var Zy=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Qy=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,ip=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,eg=/\t{1,1000}/y,np=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),tg=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,rg=new RegExp("\\p{M}+","gu"),ig={limit:1/0,ellipsis:""},sp=(e,t={},r={})=>{let i=t.limit??1/0,n=t.ellipsis??"",s=t?.ellipsisWidth??(n?sp(n,ig,r).width:0),a=0,o=r.controlWidth??0,c=r.tabWidth??8,u=r.emojiWidth??2,d=2,l=r.regularWidth??1,h=r.wideWidth??d,y=[[tg,l],[Zy,a],[Qy,o],[eg,c],[np,u],[ip,h]],g=0,b=0,S=e.length,x=0,$=!1,q=S,I=Math.max(0,i-s),A=0,U=0,L=0,M=0;e:for(;;){if(U>A||b>=S&&b>g){let V=e.slice(A,U)||e.slice(g,b);x=0;for(let Y of V.replaceAll(rg,"")){let E=Y.codePointAt(0)||0;if(tp(E)?M=d:rp(E)?M=h:M=l,L+M>I&&(q=Math.min(q,Math.max(A,g)+x)),L+M>i){$=!0;break e}x+=Y.length,L+=M}A=U=0}if(b>=S)break e;for(let V=0,Y=y.length;V<Y;V++){let[E,Ye]=y[V];if(E.lastIndex=b,E.test(e)){if(x=E===ip?ep(e.slice(b,E.lastIndex)):E===np?1:E.lastIndex-b,M=x*Ye,L+M>I&&(q=Math.min(q,b+Math.floor((I-L)/Ye))),L+M>i){$=!0;break e}L+=M,A=g,U=b,b=g=E.lastIndex;continue e}}b+=1}return{width:$?I:L,index:$?q:S,truncated:$,ellipsed:$&&i>=s}},ap=sp;var ng={limit:1/0,ellipsis:"",ellipsisWidth:0},sg=(e,t={})=>ap(e,ng,t).width,ue=sg;var oi="\x1B",up="\x9B",ag=39,us="\x07",lp="[",og="]",mp="m",ls=`${og}8;;`,op=new RegExp(`(?:\\${lp}(?<code>\\d+)m|\\${ls}(?<uri>.*)${us})`,"y"),pp=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},cp=e=>`${oi}${lp}${e}${mp}`,dp=e=>`${oi}${ls}${e}${us}`,ds=(e,t,r)=>{let i=t[Symbol.iterator](),n=!1,s=!1,a=e.at(-1),o=a===void 0?0:ue(a),c=i.next(),u=i.next(),d=0;for(;!c.done;){let l=c.value,h=ue(l);o+h<=r?e[e.length-1]+=l:(e.push(l),o=0),(l===oi||l===up)&&(n=!0,s=t.startsWith(ls,d+1)),n?s?l===us&&(n=!1,s=!1):l===mp&&(n=!1):(o+=h,o===r&&!u.done&&(e.push(""),o=0)),c=u,u=i.next(),d+=l.length}a=e.at(-1),!o&&a!==void 0&&a.length&&e.length>1&&(e[e.length-2]+=e.pop())},pg=e=>{let t=e.split(" "),r=t.length;for(;r&&!ue(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},cg=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,s,a=e.split(" "),o=[""],c=0;for(let l=0;l<a.length;l++){let h=a[l];if(r.trim!==!1){let g=o.at(-1)??"",b=g.trimStart();g.length!==b.length&&(o[o.length-1]=b,c=ue(b))}l!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),c=0),(c||r.trim===!1)&&(o[o.length-1]+=" ",c++));let y=ue(h);if(r.hard&&y>t){let g=t-c,b=1+Math.floor((y-g-1)/t);Math.floor((y-1)/t)<b&&o.push(""),ds(o,h,t),c=ue(o.at(-1)??"");continue}if(c+y>t&&c&&y){if(r.wordWrap===!1&&c<t){ds(o,h,t),c=ue(o.at(-1)??"");continue}o.push(""),c=0}if(c+y>t&&r.wordWrap===!1){ds(o,h,t),c=ue(o.at(-1)??"");continue}o[o.length-1]+=h,c+=y}r.trim!==!1&&(o=o.map(l=>pg(l)));let u=o.join(`
32
+ `),d=!1;for(let l=0;l<u.length;l++){let h=u[l];if(i+=h,d)d=!1;else if(d=h>="\uD800"&&h<="\uDBFF",d)continue;if(h===oi||h===up){op.lastIndex=l+1;let g=op.exec(u)?.groups;if(g?.code!==void 0){let b=Number.parseFloat(g.code);n=b===ag?void 0:b}else g?.uri!==void 0&&(s=g.uri.length===0?void 0:g.uri)}if(u[l+1]===`
33
+ `){s&&(i+=dp(""));let y=n?pp(n):void 0;n&&y&&(i+=cp(y))}else h===`
34
+ `&&(n&&pp(n)&&(i+=cp(n)),s&&(i+=dp(s)))}return i},dg=/\r?\n/;function Be(e,t,r){return String(e).normalize().split(dg).map(i=>cg(i,t,r)).join(`
35
+ `)}var ae=B(hs(),1);import{ReadStream as yp}from"tty";function ci(e,t,r){if(!r.some(a=>!a.disabled))return e;let i=e+t,n=Math.max(r.length-1,0),s=i<0?n:i>n?0:i;return r[s].disabled?ci(s,t<0?-1:1,r):s}var hg=["up","down","left","right","space","enter","cancel"],yg=["January","February","March","April","May","June","July","August","September","October","November","December"],ne={actions:new Set(hg),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...yg],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function _s(e,t){if(typeof e=="string")return ne.aliases.get(e)===t;for(let r of e)if(r!==void 0&&_s(r,t))return!0;return!1}function gg(e,t){if(e===t)return;let r=e.split(`
36
36
  `),i=t.split(`
37
- `),n=Math.max(r.length,i.length),s=[];for(let a=0;a<n;a++)r[a]!==i[a]&&s.push(a);return{lines:s,numLinesBefore:r.length,numLinesAfter:i.length,numLines:n}}var Yy=globalThis.process.platform.startsWith("win"),cs=Symbol("clack:cancel");function L(e){return e===cs}function Qr(e,t){let r=e;r.isTTY&&r.setRawMode(t)}function op({input:e=ap,output:t=ds,overwrite:r=!0,hideCursor:i=!0}={}){let n=st.createInterface({input:e,output:t,prompt:"",tabSize:1});st.emitKeypressEvents(e,n),e instanceof sp&&e.isTTY&&e.setRawMode(!0);let s=(a,{name:o,sequence:p})=>{let d=String(a);if(us([d,o,p],"cancel")){i&&t.write(ne.cursor.show),process.exit(0);return}if(!r)return;st.moveCursor(t,o==="return"?0:-1,o==="return"?-1:0,()=>{st.clearLine(t,1,()=>{e.once("keypress",s)})})};return i&&t.write(ne.cursor.hide),e.once("keypress",s),()=>{e.off("keypress",s),i&&t.write(ne.cursor.show),e instanceof sp&&e.isTTY&&!Yy&&e.setRawMode(!1),n.terminal=!1,n.close()}}var pr=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,ls=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function cr(e,t,r,i=r,n){let s=pr(e??ds);return Oe(t,s-r.length,{hard:!0,trim:!1}).split(`
38
- `).map((a,o)=>{let p=n?n(a,o):a;return`${o===0?i:r}${p}`}).join(`
39
- `)}var si=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:r=ap,output:i=ds,render:n,signal:s,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=t,this._abortSignal=s,this.input=r,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let r=this._subscribers.get(e)??[],i=[];for(let n of r)n.cb(...t),n.once&&i.push(()=>r.splice(r.indexOf(n),1));for(let n of i)n()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(cs);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Hy.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Qr(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(ne.cursor.show),this.output.off("resize",this.render),Qr(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(ne.cursor.show),this.output.off("resize",this.render),Qr(this.input,!1),e(cs)})})}_isActionKey(e,t){return e===" "}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&re.aliases.has(t.name)&&this.emit("cursor",re.aliases.get(t.name)),re.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"&&this._shouldSubmit(e,t)){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}us([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
40
- `),Qr(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Oe(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
41
- `).length-1;this.output.write(ne.cursor.move(-999,e*-1))}render(){let e=Oe(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(ne.cursor.hide);else{let t=Ky(this._prevFrame,e),r=ls(this.output);if(this.restoreCursor(),t){let i=Math.max(0,t.numLinesAfter-r),n=Math.max(0,t.numLinesBefore-r),s=t.lines.find(a=>a>=i);if(s===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(ne.cursor.move(0,s-n)),this.output.write(ne.erase.lines(1));let a=e.split(`
42
- `);this.output.write(a[s]),this._prevFrame=e,this.output.write(ne.cursor.move(0,a.length-s-1));return}else if(t.lines.length>1){if(i<n)s=i;else{let o=s-n;o>0&&this.output.write(ne.cursor.move(0,o))}this.output.write(ne.erase.down());let a=e.split(`
37
+ `),n=Math.max(r.length,i.length),s=[];for(let a=0;a<n;a++)r[a]!==i[a]&&s.push(a);return{lines:s,numLinesBefore:r.length,numLinesAfter:i.length,numLines:n}}var fg=globalThis.process.platform.startsWith("win"),gs=Symbol("clack:cancel");function z(e){return e===gs}function pi(e,t){let r=e;r.isTTY&&r.setRawMode(t)}function fp({input:e=gp,output:t=fs,overwrite:r=!0,hideCursor:i=!0}={}){let n=pt.createInterface({input:e,output:t,prompt:"",tabSize:1});pt.emitKeypressEvents(e,n),e instanceof yp&&e.isTTY&&e.setRawMode(!0);let s=(a,{name:o,sequence:c})=>{let u=String(a);if(_s([u,o,c],"cancel")){i&&t.write(ae.cursor.show),process.exit(0);return}if(!r)return;pt.moveCursor(t,o==="return"?0:-1,o==="return"?-1:0,()=>{pt.clearLine(t,1,()=>{e.once("keypress",s)})})};return i&&t.write(ae.cursor.hide),e.once("keypress",s),()=>{e.off("keypress",s),i&&t.write(ae.cursor.show),e instanceof yp&&e.isTTY&&!fg&&e.setRawMode(!1),n.terminal=!1,n.close()}}var yr=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,bs=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function gr(e,t,r,i=r,n){let s=yr(e??fs);return Be(t,s-r.length,{hard:!0,trim:!1}).split(`
38
+ `).map((a,o)=>{let c=n?n(a,o):a;return`${o===0?i:r}${c}`}).join(`
39
+ `)}var hi=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:r=gp,output:i=fs,render:n,signal:s,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=t,this._abortSignal=s,this.input=r,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let r=this._subscribers.get(e)??[],i=[];for(let n of r)n.cb(...t),n.once&&i.push(()=>r.splice(r.indexOf(n),1));for(let n of i)n()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(gs);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=mg.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),pi(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(ae.cursor.show),this.output.off("resize",this.render),pi(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(ae.cursor.show),this.output.off("resize",this.render),pi(this.input,!1),e(gs)})})}_isActionKey(e,t){return e===" "}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&ne.aliases.has(t.name)&&this.emit("cursor",ne.aliases.get(t.name)),ne.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"&&this._shouldSubmit(e,t)){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}_s([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
40
+ `),pi(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Be(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
41
+ `).length-1;this.output.write(ae.cursor.move(-999,e*-1))}render(){let e=Be(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(ae.cursor.hide);else{let t=gg(this._prevFrame,e),r=bs(this.output);if(this.restoreCursor(),t){let i=Math.max(0,t.numLinesAfter-r),n=Math.max(0,t.numLinesBefore-r),s=t.lines.find(a=>a>=i);if(s===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(ae.cursor.move(0,s-n)),this.output.write(ae.erase.lines(1));let a=e.split(`
42
+ `);this.output.write(a[s]),this._prevFrame=e,this.output.write(ae.cursor.move(0,a.length-s-1));return}else if(t.lines.length>1){if(i<n)s=i;else{let o=s-n;o>0&&this.output.write(ae.cursor.move(0,o))}this.output.write(ae.erase.down());let a=e.split(`
43
43
  `).slice(s);this.output.write(a.join(`
44
- `)),this._prevFrame=e;return}}this.output.write(ne.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var ti=class extends si{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(ne.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var ri=class extends si{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let t=this.userInput;if(this.cursor>=t.length)return`${this.masked}${ps(["inverse","hidden"],"_")}`;let r=this.masked,i=r.slice(0,this.cursor),n=r.slice(this.cursor);return`${i}${ps("inverse",n[0])}${n.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...r}){super(r),this._mask=t??"\u2022",this.on("userInput",i=>{this._setValue(i)})}},ii=class extends si{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;let r=this.options.findIndex(({value:n})=>n===t.initialValue),i=r===-1?0:r;this.cursor=this.options[i].disabled?ei(i,1,this.options):i,this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=ei(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=ei(this.cursor,1,this.options);break}this.changeValue()})}};var ni=class extends si{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;let r=t.slice(0,this.cursor),[i,...n]=t.slice(this.cursor);return`${r}${ps("inverse",i)}${n.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}};import{styleText as g,stripVTControlCharacters as n$}from"util";import ve from"process";var dr=D(os(),1);import{existsSync as c$,lstatSync as d$,readdirSync as u$}from"fs";import{dirname as m$,join as h$}from"path";function Jy(){return ve.platform!=="win32"?ve.env.TERM!=="linux":!!ve.env.CI||!!ve.env.WT_SESSION||!!ve.env.TERMINUS_SUBLIME||ve.env.ConEmuTask==="{cmd::Cmder}"||ve.env.TERM_PROGRAM==="Terminus-Sublime"||ve.env.TERM_PROGRAM==="vscode"||ve.env.TERM==="xterm-256color"||ve.env.TERM==="alacritty"||ve.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ms=Jy(),Xy=()=>process.env.CI==="true";var z=(e,t)=>ms?e:t,Zy=z("\u25C6","*"),cp=z("\u25A0","x"),dp=z("\u25B2","x"),pi=z("\u25C7","o"),Qy=z("\u250C","T"),P=z("\u2502","|"),at=z("\u2514","\u2014"),y$=z("\u2510","T"),g$=z("\u2518","\u2014"),hs=z("\u25CF",">"),oi=z("\u25CB"," "),f$=z("\u25FB","[\u2022]"),_$=z("\u25FC","[+]"),b$=z("\u25FB","[ ]"),eg=z("\u25AA","\u2022"),pp=z("\u2500","-"),tg=z("\u256E","+"),rg=z("\u251C","+"),ig=z("\u256F","+"),ng=z("\u2570","+"),q$=z("\u256D","+"),sg=z("\u25CF","\u2022"),ag=z("\u25C6","*"),og=z("\u25B2","!"),pg=z("\u25A0","x"),ci=e=>{switch(e){case"initial":case"active":return g("cyan",Zy);case"cancel":return g("red",cp);case"error":return g("yellow",dp);case"submit":return g("green",pi)}},cg=e=>{switch(e){case"initial":case"active":return g("cyan",P);case"cancel":return g("red",P);case"error":return g("yellow",P);case"submit":return g("green",P)}},dg=(e,t,r,i,n)=>{let s=t,a=0;for(let o=r;o<i;o++){let p=e[o];if(s=s-p.length,a++,s<=n)break}return{lineCount:s,removals:a}},ug=({cursor:e,options:t,style:r,output:i=process.stdout,maxItems:n=Number.POSITIVE_INFINITY,columnPadding:s=0,rowPadding:a=4})=>{let o=pr(i)-s,p=ls(i),d=g("dim","..."),c=Math.max(p-a,0),u=Math.max(Math.min(n,c),5),l=0;e>=u-3&&(l=Math.max(Math.min(e-u+3,t.length-u),0));let m=u<t.length&&l>0,h=u<t.length&&l+u<t.length,f=Math.min(l+u,t.length),w=[],v=0;m&&v++,h&&v++;let x=l+(m?1:0),_=f-(h?1:0);for(let S=x;S<_;S++){let F=Oe(r(t[S],S===e),o,{hard:!0,trim:!1}).split(`
45
- `);w.push(F),v+=F.length}if(v>c){let S=0,F=0,O=v,B=e-x,U=(W,$)=>dg(w,O,W,$,c);m?({lineCount:O,removals:S}=U(0,B),O>c&&({lineCount:O,removals:F}=U(B+1,w.length))):({lineCount:O,removals:F}=U(B+1,w.length),O>c&&({lineCount:O,removals:S}=U(0,B))),S>0&&(m=!0,w.splice(0,S)),F>0&&(h=!0,w.splice(w.length-F,F))}let T=[];m&&T.push(d);for(let S of w)for(let F of S)T.push(F);return h&&T.push(d),T};var Je=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new ti({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let i=e.withGuide??re.withGuide,n=`${ci(this.state)} `,s=i?`${g("gray",P)} `:"",a=cr(e.output,e.message,s,n),o=`${i?`${g("gray",P)}
44
+ `)),this._prevFrame=e;return}}this.output.write(ae.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var di=class extends hi{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(ae.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var ui=class extends hi{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let t=this.userInput;if(this.cursor>=t.length)return`${this.masked}${ys(["inverse","hidden"],"_")}`;let r=this.masked,i=r.slice(0,this.cursor),n=r.slice(this.cursor);return`${i}${ys("inverse",n[0])}${n.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...r}){super(r),this._mask=t??"\u2022",this.on("userInput",i=>{this._setValue(i)})}},li=class extends hi{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;let r=this.options.findIndex(({value:n})=>n===t.initialValue),i=r===-1?0:r;this.cursor=this.options[i].disabled?ci(i,1,this.options):i,this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=ci(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=ci(this.cursor,1,this.options);break}this.changeValue()})}};var mi=class extends hi{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;let r=t.slice(0,this.cursor),[i,...n]=t.slice(this.cursor);return`${r}${ys("inverse",i)}${n.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}};import{styleText as _,stripVTControlCharacters as K$}from"util";import xe from"process";var fr=B(hs(),1);import{existsSync as Q$,lstatSync as eA,readdirSync as tA}from"fs";import{dirname as iA,join as nA}from"path";function _g(){return xe.platform!=="win32"?xe.env.TERM!=="linux":!!xe.env.CI||!!xe.env.WT_SESSION||!!xe.env.TERMINUS_SUBLIME||xe.env.ConEmuTask==="{cmd::Cmder}"||xe.env.TERM_PROGRAM==="Terminus-Sublime"||xe.env.TERM_PROGRAM==="vscode"||xe.env.TERM==="xterm-256color"||xe.env.TERM==="alacritty"||xe.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var qs=_g(),bg=()=>process.env.CI==="true";var F=(e,t)=>qs?e:t,qg=F("\u25C6","*"),bp=F("\u25A0","x"),qp=F("\u25B2","x"),fi=F("\u25C7","o"),kg=F("\u250C","T"),C=F("\u2502","|"),ct=F("\u2514","\u2014"),sA=F("\u2510","T"),aA=F("\u2518","\u2014"),ks=F("\u25CF",">"),gi=F("\u25CB"," "),oA=F("\u25FB","[\u2022]"),pA=F("\u25FC","[+]"),cA=F("\u25FB","[ ]"),vg=F("\u25AA","\u2022"),_p=F("\u2500","-"),wg=F("\u256E","+"),xg=F("\u251C","+"),Sg=F("\u256F","+"),$g=F("\u2570","+"),dA=F("\u256D","+"),Ag=F("\u25CF","\u2022"),Eg=F("\u25C6","*"),Pg=F("\u25B2","!"),jg=F("\u25A0","x"),_i=e=>{switch(e){case"initial":case"active":return _("cyan",qg);case"cancel":return _("red",bp);case"error":return _("yellow",qp);case"submit":return _("green",fi)}},Cg=e=>{switch(e){case"initial":case"active":return _("cyan",C);case"cancel":return _("red",C);case"error":return _("yellow",C);case"submit":return _("green",C)}},Tg=(e,t,r,i,n)=>{let s=t,a=0;for(let o=r;o<i;o++){let c=e[o];if(s=s-c.length,a++,s<=n)break}return{lineCount:s,removals:a}},Rg=({cursor:e,options:t,style:r,output:i=process.stdout,maxItems:n=Number.POSITIVE_INFINITY,columnPadding:s=0,rowPadding:a=4})=>{let o=yr(i)-s,c=bs(i),u=_("dim","..."),d=Math.max(c-a,0),l=Math.max(Math.min(n,d),5),h=0;e>=l-3&&(h=Math.max(Math.min(e-l+3,t.length-l),0));let y=l<t.length&&h>0,g=l<t.length&&h+l<t.length,b=Math.min(h+l,t.length),S=[],x=0;y&&x++,g&&x++;let $=h+(y?1:0),q=b-(g?1:0);for(let A=$;A<q;A++){let U=Be(r(t[A],A===e),o,{hard:!0,trim:!1}).split(`
45
+ `);S.push(U),x+=U.length}if(x>d){let A=0,U=0,L=x,M=e-$,V=(Y,E)=>Tg(S,L,Y,E,d);y?({lineCount:L,removals:A}=V(0,M),L>d&&({lineCount:L,removals:U}=V(M+1,S.length))):({lineCount:L,removals:U}=V(M+1,S.length),L>d&&({lineCount:L,removals:A}=V(0,M))),A>0&&(y=!0,S.splice(0,A)),U>0&&(g=!0,S.splice(S.length-U,U))}let I=[];y&&I.push(u);for(let A of S)for(let U of A)I.push(U);return g&&I.push(u),I};var Qe=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new di({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let i=e.withGuide??ne.withGuide,n=`${_i(this.state)} `,s=i?`${_("gray",C)} `:"",a=gr(e.output,e.message,s,n),o=`${i?`${_("gray",C)}
46
46
  `:""}${a}
47
- `,p=this.value?t:r;switch(this.state){case"submit":{let d=i?`${g("gray",P)} `:"";return`${o}${d}${g("dim",p)}`}case"cancel":{let d=i?`${g("gray",P)} `:"";return`${o}${d}${g(["strikethrough","dim"],p)}${i?`
48
- ${g("gray",P)}`:""}`}default:{let d=i?`${g("cyan",P)} `:"",c=i?g("cyan",at):"";return`${o}${d}${this.value?`${g("green",hs)} ${t}`:`${g("dim",oi)} ${g("dim",t)}`}${e.vertical?i?`
49
- ${g("cyan",P)} `:`
50
- `:` ${g("dim","/")} `}${this.value?`${g("dim",oi)} ${g("dim",r)}`:`${g("green",hs)} ${r}`}
51
- ${c}
52
- `}}}}).prompt()};var q={message:(e=[],{symbol:t=g("gray",P),secondarySymbol:r=g("gray",P),output:i=process.stdout,spacing:n=1,withGuide:s}={})=>{let a=[],o=s??re.withGuide,p=o?r:"",d=o?`${t} `:"",c=o?`${r} `:"";for(let l=0;l<n;l++)a.push(p);let u=Array.isArray(e)?e:e.split(`
53
- `);if(u.length>0){let[l,...m]=u;l.length>0?a.push(`${d}${l}`):a.push(o?t:"");for(let h of m)h.length>0?a.push(`${c}${h}`):a.push(o?r:"")}i.write(`${a.join(`
54
- `)}
55
- `)},info:(e,t)=>{q.message(e,{...t,symbol:g("blue",sg)})},success:(e,t)=>{q.message(e,{...t,symbol:g("green",ag)})},step:(e,t)=>{q.message(e,{...t,symbol:g("green",pi)})},warn:(e,t)=>{q.message(e,{...t,symbol:g("yellow",og)})},warning:(e,t)=>{q.warn(e,t)},error:(e,t)=>{q.message(e,{...t,symbol:g("red",pg)})}},j=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??re.withGuide?`${g("gray",at)} `:"";r.write(`${i}${g("red",e)}
56
-
57
- `)},di=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??re.withGuide?`${g("gray",Qy)} `:"";r.write(`${i}${e}
58
- `)},Ct=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??re.withGuide?`${g("gray",P)}
59
- ${g("gray",at)} `:"";r.write(`${i}${e}
60
-
61
- `)};var lg=e=>g("dim",e),mg=(e,t,r)=>{let i={hard:!0,trim:!1},n=Oe(e,t,i).split(`
62
- `),s=n.reduce((p,d)=>Math.max(ce(d),p),0),a=n.map(r).reduce((p,d)=>Math.max(ce(d),p),0),o=t-(a-s);return Oe(e,o,i)},V=(e="",t="",r)=>{let i=r?.output??ve.stdout,n=r?.withGuide??re.withGuide,s=r?.format??lg,a=["",...mg(e,pr(i)-6,s).split(`
63
- `).map(s),""],o=ce(t),p=Math.max(a.reduce((l,m)=>{let h=ce(m);return h>l?h:l},0),o)+2,d=a.map(l=>`${g("gray",P)} ${l}${" ".repeat(p-ce(l))}${g("gray",P)}`).join(`
64
- `),c=n?`${g("gray",P)}
65
- `:"",u=n?rg:ng;i.write(`${c}${g("green",pi)} ${g("reset",t)} ${g("gray",pp.repeat(Math.max(p-o-1,1))+tg)}
47
+ `,c=this.value?t:r;switch(this.state){case"submit":{let u=i?`${_("gray",C)} `:"";return`${o}${u}${_("dim",c)}`}case"cancel":{let u=i?`${_("gray",C)} `:"";return`${o}${u}${_(["strikethrough","dim"],c)}${i?`
48
+ ${_("gray",C)}`:""}`}default:{let u=i?`${_("cyan",C)} `:"",d=i?_("cyan",ct):"";return`${o}${u}${this.value?`${_("green",ks)} ${t}`:`${_("dim",gi)} ${_("dim",t)}`}${e.vertical?i?`
49
+ ${_("cyan",C)} `:`
50
+ `:` ${_("dim","/")} `}${this.value?`${_("dim",gi)} ${_("dim",r)}`:`${_("green",ks)} ${r}`}
66
51
  ${d}
67
- ${g("gray",u+pp.repeat(p+2)+ig)}
68
- `)},ui=e=>new ri({validate:e.validate,mask:e.mask??eg,signal:e.signal,input:e.input,output:e.output,render(){let t=e.withGuide??re.withGuide,r=`${t?`${g("gray",P)}
69
- `:""}${ci(this.state)} ${e.message}
70
- `,i=this.userInputWithCursor,n=this.masked;switch(this.state){case"error":{let s=t?`${g("yellow",P)} `:"",a=t?`${g("yellow",at)} `:"",o=n??"";return e.clearOnError&&this.clear(),`${r.trim()}
52
+ `}}}}).prompt()};var v={message:(e=[],{symbol:t=_("gray",C),secondarySymbol:r=_("gray",C),output:i=process.stdout,spacing:n=1,withGuide:s}={})=>{let a=[],o=s??ne.withGuide,c=o?r:"",u=o?`${t} `:"",d=o?`${r} `:"";for(let h=0;h<n;h++)a.push(c);let l=Array.isArray(e)?e:e.split(`
53
+ `);if(l.length>0){let[h,...y]=l;h.length>0?a.push(`${u}${h}`):a.push(o?t:"");for(let g of y)g.length>0?a.push(`${d}${g}`):a.push(o?r:"")}i.write(`${a.join(`
54
+ `)}
55
+ `)},info:(e,t)=>{v.message(e,{...t,symbol:_("blue",Ag)})},success:(e,t)=>{v.message(e,{...t,symbol:_("green",Eg)})},step:(e,t)=>{v.message(e,{...t,symbol:_("green",fi)})},warn:(e,t)=>{v.message(e,{...t,symbol:_("yellow",Pg)})},warning:(e,t)=>{v.warn(e,t)},error:(e,t)=>{v.message(e,{...t,symbol:_("red",jg)})}},T=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??ne.withGuide?`${_("gray",ct)} `:"";r.write(`${i}${_("red",e)}
56
+
57
+ `)},bi=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??ne.withGuide?`${_("gray",kg)} `:"";r.write(`${i}${e}
58
+ `)},It=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??ne.withGuide?`${_("gray",C)}
59
+ ${_("gray",ct)} `:"";r.write(`${i}${e}
60
+
61
+ `)};var Ig=e=>_("dim",e),Og=(e,t,r)=>{let i={hard:!0,trim:!1},n=Be(e,t,i).split(`
62
+ `),s=n.reduce((c,u)=>Math.max(ue(u),c),0),a=n.map(r).reduce((c,u)=>Math.max(ue(u),c),0),o=t-(a-s);return Be(e,o,i)},H=(e="",t="",r)=>{let i=r?.output??xe.stdout,n=r?.withGuide??ne.withGuide,s=r?.format??Ig,a=["",...Og(e,yr(i)-6,s).split(`
63
+ `).map(s),""],o=ue(t),c=Math.max(a.reduce((h,y)=>{let g=ue(y);return g>h?g:h},0),o)+2,u=a.map(h=>`${_("gray",C)} ${h}${" ".repeat(c-ue(h))}${_("gray",C)}`).join(`
64
+ `),d=n?`${_("gray",C)}
65
+ `:"",l=n?xg:$g;i.write(`${d}${_("green",fi)} ${_("reset",t)} ${_("gray",_p.repeat(Math.max(c-o-1,1))+wg)}
66
+ ${u}
67
+ ${_("gray",l+_p.repeat(c+2)+Sg)}
68
+ `)},qi=e=>new ui({validate:e.validate,mask:e.mask??vg,signal:e.signal,input:e.input,output:e.output,render(){let t=e.withGuide??ne.withGuide,r=`${t?`${_("gray",C)}
69
+ `:""}${_i(this.state)} ${e.message}
70
+ `,i=this.userInputWithCursor,n=this.masked;switch(this.state){case"error":{let s=t?`${_("yellow",C)} `:"",a=t?`${_("yellow",ct)} `:"",o=n??"";return e.clearOnError&&this.clear(),`${r.trim()}
71
71
  ${s}${o}
72
- ${a}${g("yellow",this.error)}
73
- `}case"submit":{let s=t?`${g("gray",P)} `:"",a=n?g("dim",n):"";return`${r}${s}${a}`}case"cancel":{let s=t?`${g("gray",P)} `:"",a=n?g(["strikethrough","dim"],n):"";return`${r}${s}${a}${n&&t?`
74
- ${g("gray",P)}`:""}`}default:{let s=t?`${g("cyan",P)} `:"",a=t?g("cyan",at):"";return`${r}${s}${i}
72
+ ${a}${_("yellow",this.error)}
73
+ `}case"submit":{let s=t?`${_("gray",C)} `:"",a=n?_("dim",n):"";return`${r}${s}${a}`}case"cancel":{let s=t?`${_("gray",C)} `:"",a=n?_(["strikethrough","dim"],n):"";return`${r}${s}${a}${n&&t?`
74
+ ${_("gray",C)}`:""}`}default:{let s=t?`${_("cyan",C)} `:"",a=t?_("cyan",ct):"";return`${r}${s}${i}
75
75
  ${a}
76
- `}}}}).prompt();var hg=e=>g("magenta",e),I=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:i,errorMessage:n,frames:s=ms?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:a=ms?80:120,signal:o,...p}={})=>{let d=Xy(),c,u,l=!1,m=!1,h="",f,w=performance.now(),v=pr(r),x=p?.styleFrame??hg,_=H=>{let ue=H>1?n??re.messages.error:i??re.messages.cancel;m=H===1,l&&($e(ue,H),m&&typeof t=="function"&&t())},T=()=>_(2),S=()=>_(1),F=()=>{process.on("uncaughtExceptionMonitor",T),process.on("unhandledRejection",T),process.on("SIGINT",S),process.on("SIGTERM",S),process.on("exit",_),o&&o.addEventListener("abort",S)},O=()=>{process.removeListener("uncaughtExceptionMonitor",T),process.removeListener("unhandledRejection",T),process.removeListener("SIGINT",S),process.removeListener("SIGTERM",S),process.removeListener("exit",_),o&&o.removeEventListener("abort",S)},B=()=>{if(f===void 0)return;d&&r.write(`
77
- `);let H=Oe(f,v,{hard:!0,trim:!1}).split(`
78
- `);H.length>1&&r.write(dr.cursor.up(H.length-1)),r.write(dr.cursor.to(0)),r.write(dr.erase.down())},U=H=>H.replace(/\.+$/,""),W=H=>{let ue=(performance.now()-H)/1e3,We=Math.floor(ue/60),Ke=Math.floor(ue%60);return We>0?`[${We}m ${Ke}s]`:`[${Ke}s]`},$=p.withGuide??re.withGuide,Ve=(H="")=>{l=!0,c=op({output:r}),h=U(H),w=performance.now(),$&&r.write(`${g("gray",P)}
79
- `);let ue=0,We=0;F(),u=setInterval(()=>{if(d&&h===f)return;B(),f=h;let Ke=x(s[ue]),Vr;if(d)Vr=`${Ke} ${h}...`;else if(e==="timer")Vr=`${Ke} ${h} ${W(w)}`;else{let sy=".".repeat(Math.floor(We)).slice(0,3);Vr=`${Ke} ${h}${sy}`}let ny=Oe(Vr,v,{hard:!0,trim:!1});r.write(ny),ue=ue+1<s.length?ue+1:0,We=We<4?We+.125:0},a)},$e=(H="",ue=0,We=!1)=>{if(!l)return;l=!1,clearInterval(u),B();let Ke=ue===0?g("green",pi):ue===1?g("red",cp):g("red",dp);h=H??h,We||(e==="timer"?r.write(`${Ke} ${h} ${W(w)}
80
- `):r.write(`${Ke} ${h}
81
- `)),O(),c()};return{start:Ve,stop:(H="")=>$e(H,0),message:(H="")=>{h=U(H??h)},cancel:(H="")=>$e(H,1),error:(H="")=>$e(H,2),clear:()=>$e("",0,!0),get isCancelled(){return m}}},k$={light:z("\u2500","-"),heavy:z("\u2501","="),block:z("\u2588","#")};var ai=(e,t)=>e.includes(`
76
+ `}}}}).prompt();var Dg=e=>_("magenta",e),D=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:i,errorMessage:n,frames:s=qs?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:a=qs?80:120,signal:o,...c}={})=>{let u=bg(),d,l,h=!1,y=!1,g="",b,S=performance.now(),x=yr(r),$=c?.styleFrame??Dg,q=K=>{let me=K>1?n??ne.messages.error:i??ne.messages.cancel;y=K===1,h&&(Pe(me,K),y&&typeof t=="function"&&t())},I=()=>q(2),A=()=>q(1),U=()=>{process.on("uncaughtExceptionMonitor",I),process.on("unhandledRejection",I),process.on("SIGINT",A),process.on("SIGTERM",A),process.on("exit",q),o&&o.addEventListener("abort",A)},L=()=>{process.removeListener("uncaughtExceptionMonitor",I),process.removeListener("unhandledRejection",I),process.removeListener("SIGINT",A),process.removeListener("SIGTERM",A),process.removeListener("exit",q),o&&o.removeEventListener("abort",A)},M=()=>{if(b===void 0)return;u&&r.write(`
77
+ `);let K=Be(b,x,{hard:!0,trim:!1}).split(`
78
+ `);K.length>1&&r.write(fr.cursor.up(K.length-1)),r.write(fr.cursor.to(0)),r.write(fr.erase.down())},V=K=>K.replace(/\.+$/,""),Y=K=>{let me=(performance.now()-K)/1e3,Je=Math.floor(me/60),Xe=Math.floor(me%60);return Je>0?`[${Je}m ${Xe}s]`:`[${Xe}s]`},E=c.withGuide??ne.withGuide,Ye=(K="")=>{h=!0,d=fp({output:r}),g=V(K),S=performance.now(),E&&r.write(`${_("gray",C)}
79
+ `);let me=0,Je=0;U(),l=setInterval(()=>{if(u&&g===b)return;M(),b=g;let Xe=$(s[me]),ti;if(u)ti=`${Xe} ${g}...`;else if(e==="timer")ti=`${Xe} ${g} ${Y(S)}`;else{let Sy=".".repeat(Math.floor(Je)).slice(0,3);ti=`${Xe} ${g}${Sy}`}let xy=Be(ti,x,{hard:!0,trim:!1});r.write(xy),me=me+1<s.length?me+1:0,Je=Je<4?Je+.125:0},a)},Pe=(K="",me=0,Je=!1)=>{if(!h)return;h=!1,clearInterval(l),M();let Xe=me===0?_("green",fi):me===1?_("red",bp):_("red",qp);g=K??g,Je||(e==="timer"?r.write(`${Xe} ${g} ${Y(S)}
80
+ `):r.write(`${Xe} ${g}
81
+ `)),L(),d()};return{start:Ye,stop:(K="")=>Pe(K,0),message:(K="")=>{g=V(K??g)},cancel:(K="")=>Pe(K,1),error:(K="")=>Pe(K,2),clear:()=>Pe("",0,!0),get isCancelled(){return y}}},uA={light:F("\u2500","-"),heavy:F("\u2501","="),block:F("\u2588","#")};var yi=(e,t)=>e.includes(`
82
82
  `)?e.split(`
83
83
  `).map(r=>t(r)).join(`
84
- `):t(e),li=e=>{let t=(r,i)=>{let n=r.label??String(r.value);switch(i){case"disabled":return`${g("gray",oi)} ${ai(n,s=>g("gray",s))}${r.hint?` ${g("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${ai(n,s=>g("dim",s))}`;case"active":return`${g("green",hs)} ${n}${r.hint?` ${g("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${ai(n,s=>g(["strikethrough","dim"],s))}`;default:return`${g("dim",oi)} ${ai(n,s=>g("dim",s))}`}};return new ii({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??re.withGuide,i=`${ci(this.state)} `,n=`${cg(this.state)} `,s=cr(e.output,e.message,n,i),a=`${r?`${g("gray",P)}
84
+ `):t(e),ki=e=>{let t=(r,i)=>{let n=r.label??String(r.value);switch(i){case"disabled":return`${_("gray",gi)} ${yi(n,s=>_("gray",s))}${r.hint?` ${_("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${yi(n,s=>_("dim",s))}`;case"active":return`${_("green",ks)} ${n}${r.hint?` ${_("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${yi(n,s=>_(["strikethrough","dim"],s))}`;default:return`${_("dim",gi)} ${yi(n,s=>_("dim",s))}`}};return new li({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??ne.withGuide,i=`${_i(this.state)} `,n=`${Cg(this.state)} `,s=gr(e.output,e.message,n,i),a=`${r?`${_("gray",C)}
85
85
  `:""}${s}
86
- `;switch(this.state){case"submit":{let o=r?`${g("gray",P)} `:"",p=cr(e.output,t(this.options[this.cursor],"selected"),o);return`${a}${p}`}case"cancel":{let o=r?`${g("gray",P)} `:"",p=cr(e.output,t(this.options[this.cursor],"cancelled"),o);return`${a}${p}${r?`
87
- ${g("gray",P)}`:""}`}default:{let o=r?`${g("cyan",P)} `:"",p=r?g("cyan",at):"",d=a.split(`
88
- `).length,c=r?2:1;return`${a}${o}${ug({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:o.length,rowPadding:d+c,style:(u,l)=>t(u,u.disabled?"disabled":l?"active":"inactive")}).join(`
86
+ `;switch(this.state){case"submit":{let o=r?`${_("gray",C)} `:"",c=gr(e.output,t(this.options[this.cursor],"selected"),o);return`${a}${c}`}case"cancel":{let o=r?`${_("gray",C)} `:"",c=gr(e.output,t(this.options[this.cursor],"cancelled"),o);return`${a}${c}${r?`
87
+ ${_("gray",C)}`:""}`}default:{let o=r?`${_("cyan",C)} `:"",c=r?_("cyan",ct):"",u=a.split(`
88
+ `).length,d=r?2:1;return`${a}${o}${Rg({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:o.length,rowPadding:u+d,style:(l,h)=>t(l,l.disabled?"disabled":h?"active":"inactive")}).join(`
89
89
  ${o}`)}
90
- ${p}
91
- `}}}}).prompt()};var v$=`${g("gray",P)} `;var le=e=>new ni({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??re.withGuide,r=`${`${t?`${g("gray",P)}
92
- `:""}${ci(this.state)} `}${e.message}
93
- `,i=e.placeholder?g("inverse",e.placeholder[0])+g("dim",e.placeholder.slice(1)):g(["inverse","hidden"],"_"),n=this.userInput?this.userInputWithCursor:i,s=this.value??"";switch(this.state){case"error":{let a=this.error?` ${g("yellow",this.error)}`:"",o=t?`${g("yellow",P)} `:"",p=t?g("yellow",at):"";return`${r.trim()}
90
+ ${c}
91
+ `}}}}).prompt()};var lA=`${_("gray",C)} `;var he=e=>new mi({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??ne.withGuide,r=`${`${t?`${_("gray",C)}
92
+ `:""}${_i(this.state)} `}${e.message}
93
+ `,i=e.placeholder?_("inverse",e.placeholder[0])+_("dim",e.placeholder.slice(1)):_(["inverse","hidden"],"_"),n=this.userInput?this.userInputWithCursor:i,s=this.value??"";switch(this.state){case"error":{let a=this.error?` ${_("yellow",this.error)}`:"",o=t?`${_("yellow",C)} `:"",c=t?_("yellow",ct):"";return`${r.trim()}
94
94
  ${o}${n}
95
- ${p}${a}
96
- `}case"submit":{let a=s?` ${g("dim",s)}`:"",o=t?g("gray",P):"";return`${r}${o}${a}`}case"cancel":{let a=s?` ${g(["strikethrough","dim"],s)}`:"",o=t?g("gray",P):"";return`${r}${o}${a}${s.trim()?`
97
- ${o}`:""}`}default:{let a=t?`${g("cyan",P)} `:"",o=t?g("cyan",at):"";return`${r}${a}${n}
95
+ ${c}${a}
96
+ `}case"submit":{let a=s?` ${_("dim",s)}`:"",o=t?_("gray",C):"";return`${r}${o}${a}`}case"cancel":{let a=s?` ${_(["strikethrough","dim"],s)}`:"",o=t?_("gray",C):"";return`${r}${o}${a}${s.trim()?`
97
+ ${o}`:""}`}default:{let a=t?`${_("cyan",C)} `:"",o=t?_("cyan",ct):"";return`${r}${a}${n}
98
98
  ${o}
99
- `}}}}).prompt();function Y(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}import{fileURLToPath as yg}from"url";var Tt=(e,t)=>{let r=gs(gg(e));if(typeof r!="string")throw new TypeError(`${t} must be a string or a file URL: ${r}.`);return r},gg=e=>ys(e)?e.toString():e,ys=e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,gs=e=>e instanceof URL?yg(e):e;var mi=(e,t=[],r={})=>{let i=Tt(e,"First argument"),[n,s]=Y(t)?[[],t]:[t,r];if(!Array.isArray(n))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${n}`);if(n.some(p=>typeof p=="object"&&p!==null))throw new TypeError(`Second argument must be an array of strings: ${n}`);let a=n.map(String),o=a.find(p=>p.includes("\0"));if(o!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${o}`);if(!Y(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[i,a,s]};import{ChildProcess as wg}from"child_process";import{StringDecoder as fg}from"string_decoder";var{toString:up}=Object.prototype,lp=e=>up.call(e)==="[object ArrayBuffer]",ee=e=>up.call(e)==="[object Uint8Array]",Xe=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),_g=new TextEncoder,mp=e=>_g.encode(e),bg=new TextDecoder,hi=e=>bg.decode(e),hp=(e,t)=>qg(e,t).join(""),qg=(e,t)=>{if(t==="utf8"&&e.every(s=>typeof s=="string"))return e;let r=new fg(t),i=e.map(s=>typeof s=="string"?mp(s):s).map(s=>r.write(s)),n=r.end();return n===""?i:[...i,n]},ur=e=>e.length===1&&ee(e[0])?e[0]:fs(kg(e)),kg=e=>e.map(t=>typeof t=="string"?mp(t):t),fs=e=>{let t=new Uint8Array(vg(e)),r=0;for(let i of e)t.set(i,r),r+=i.length;return t},vg=e=>{let t=0;for(let r of e)t+=r.length;return t};var _p=e=>Array.isArray(e)&&Array.isArray(e.raw),bp=(e,t)=>{let r=[];for(let[s,a]of e.entries())r=xg({templates:e,expressions:t,tokens:r,index:s,template:a});if(r.length===0)throw new TypeError("Template script must not be empty");let[i,...n]=r;return[i,n,{}]},xg=({templates:e,expressions:t,tokens:r,index:i,template:n})=>{if(n===void 0)throw new TypeError(`Invalid backslash sequence: ${e.raw[i]}`);let{nextTokens:s,leadingWhitespaces:a,trailingWhitespaces:o}=Sg(n,e.raw[i]),p=gp(r,s,a);if(i===t.length)return p;let d=t[i],c=Array.isArray(d)?d.map(u=>fp(u)):[fp(d)];return gp(p,c,o)},Sg=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],i=0,n=yp.has(t[0]);for(let a=0,o=0;a<e.length;a+=1,o+=1){let p=t[o];if(yp.has(p))i!==a&&r.push(e.slice(i,a)),i=a+1;else if(p==="\\"){let d=t[o+1];d===`
100
- `?(a-=1,o+=1):d==="u"&&t[o+2]==="{"?o=t.indexOf("}",o+3):o+=$g[d]??1}}let s=i===e.length;return s||r.push(e.slice(i)),{nextTokens:r,leadingWhitespaces:n,trailingWhitespaces:s}},yp=new Set([" "," ","\r",`
101
- `]),$g={x:3,u:5},gp=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],fp=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(Y(e)&&("stdout"in e||"isMaxBuffer"in e))return Ag(e);throw e instanceof wg||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${t}" in template expression`)},Ag=({stdout:e})=>{if(typeof e=="string")return e;if(ee(e))return hi(e);throw e===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as Tk}from"child_process";import{debuglog as Eg}from"util";import _s from"process";var Ae=e=>yi.includes(e),yi=[_s.stdin,_s.stdout,_s.stderr],we=["stdin","stdout","stderr"],gi=e=>we[e]??`stdio[${e}]`;var kp=e=>{let t={...e};for(let r of ks)t[r]=bs(e,r);return t},bs=(e,t)=>{let r=Array.from({length:Pg(e)+1}),i=jg(e[t],r,t);return Og(i,t)},Pg=({stdio:e})=>Array.isArray(e)?Math.max(e.length,we.length):we.length,jg=(e,t,r)=>Y(e)?Cg(e,t,r):t.fill(e),Cg=(e,t,r)=>{for(let i of Object.keys(e).sort(Tg))for(let n of Rg(i,r,t))t[n]=e[i];return t},Tg=(e,t)=>qp(e)<qp(t)?1:-1,qp=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,Rg=(e,t,r)=>{if(e==="ipc")return[r.length-1];let i=qs(e);if(i===void 0||i===0)throw new TypeError(`"${t}.${e}" is invalid.
99
+ `}}}}).prompt();p();p();p();function Z(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}p();p();import{fileURLToPath as Lg}from"url";var Ot=(e,t)=>{let r=ws(Bg(e));if(typeof r!="string")throw new TypeError(`${t} must be a string or a file URL: ${r}.`);return r},Bg=e=>vs(e)?e.toString():e,vs=e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,ws=e=>e instanceof URL?Lg(e):e;var vi=(e,t=[],r={})=>{let i=Ot(e,"First argument"),[n,s]=Z(t)?[[],t]:[t,r];if(!Array.isArray(n))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${n}`);if(n.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${n}`);let a=n.map(String),o=a.find(c=>c.includes("\0"));if(o!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${o}`);if(!Z(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[i,a,s]};p();import{ChildProcess as Vg}from"child_process";p();import{StringDecoder as zg}from"string_decoder";var{toString:kp}=Object.prototype,vp=e=>kp.call(e)==="[object ArrayBuffer]",re=e=>kp.call(e)==="[object Uint8Array]",et=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Mg=new TextEncoder,wp=e=>Mg.encode(e),Fg=new TextDecoder,wi=e=>Fg.decode(e),xp=(e,t)=>Gg(e,t).join(""),Gg=(e,t)=>{if(t==="utf8"&&e.every(s=>typeof s=="string"))return e;let r=new zg(t),i=e.map(s=>typeof s=="string"?wp(s):s).map(s=>r.write(s)),n=r.end();return n===""?i:[...i,n]},_r=e=>e.length===1&&re(e[0])?e[0]:xs(Ug(e)),Ug=e=>e.map(t=>typeof t=="string"?wp(t):t),xs=e=>{let t=new Uint8Array(Ng(e)),r=0;for(let i of e)t.set(i,r),r+=i.length;return t},Ng=e=>{let t=0;for(let r of e)t+=r.length;return t};var Ep=e=>Array.isArray(e)&&Array.isArray(e.raw),Pp=(e,t)=>{let r=[];for(let[s,a]of e.entries())r=Hg({templates:e,expressions:t,tokens:r,index:s,template:a});if(r.length===0)throw new TypeError("Template script must not be empty");let[i,...n]=r;return[i,n,{}]},Hg=({templates:e,expressions:t,tokens:r,index:i,template:n})=>{if(n===void 0)throw new TypeError(`Invalid backslash sequence: ${e.raw[i]}`);let{nextTokens:s,leadingWhitespaces:a,trailingWhitespaces:o}=Wg(n,e.raw[i]),c=$p(r,s,a);if(i===t.length)return c;let u=t[i],d=Array.isArray(u)?u.map(l=>Ap(l)):[Ap(u)];return $p(c,d,o)},Wg=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],i=0,n=Sp.has(t[0]);for(let a=0,o=0;a<e.length;a+=1,o+=1){let c=t[o];if(Sp.has(c))i!==a&&r.push(e.slice(i,a)),i=a+1;else if(c==="\\"){let u=t[o+1];u===`
100
+ `?(a-=1,o+=1):u==="u"&&t[o+2]==="{"?o=t.indexOf("}",o+3):o+=Kg[u]??1}}let s=i===e.length;return s||r.push(e.slice(i)),{nextTokens:r,leadingWhitespaces:n,trailingWhitespaces:s}},Sp=new Set([" "," ","\r",`
101
+ `]),Kg={x:3,u:5},$p=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],Ap=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(Z(e)&&("stdout"in e||"isMaxBuffer"in e))return Yg(e);throw e instanceof Vg||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${t}" in template expression`)},Yg=({stdout:e})=>{if(typeof e=="string")return e;if(re(e))return wi(e);throw e===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};p();import{spawnSync as ev}from"child_process";p();p();p();p();import{debuglog as Jg}from"util";p();import Ss from"process";var je=e=>xi.includes(e),xi=[Ss.stdin,Ss.stdout,Ss.stderr],Se=["stdin","stdout","stderr"],Si=e=>Se[e]??`stdio[${e}]`;var Cp=e=>{let t={...e};for(let r of Es)t[r]=$s(e,r);return t},$s=(e,t)=>{let r=Array.from({length:Xg(e)+1}),i=Zg(e[t],r,t);return nf(i,t)},Xg=({stdio:e})=>Array.isArray(e)?Math.max(e.length,Se.length):Se.length,Zg=(e,t,r)=>Z(e)?Qg(e,t,r):t.fill(e),Qg=(e,t,r)=>{for(let i of Object.keys(e).sort(ef))for(let n of tf(i,r,t))t[n]=e[i];return t},ef=(e,t)=>jp(e)<jp(t)?1:-1,jp=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,tf=(e,t,r)=>{if(e==="ipc")return[r.length-1];let i=As(e);if(i===void 0||i===0)throw new TypeError(`"${t}.${e}" is invalid.
102
102
  It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(i>=r.length)throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
103
- Please set the "stdio" option to ensure that file descriptor exists.`);return i==="all"?[1,2]:[i]},qs=e=>{if(e==="all")return e;if(we.includes(e))return we.indexOf(e);let t=Ig.exec(e);if(t!==null)return Number(t[1])},Ig=/^fd(\d+)$/,Og=(e,t)=>e.map(r=>r===void 0?Lg[t]:r),Dg=Eg("execa").enabled?"full":"none",Lg={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Dg,stripFinalNewline:!0},ks=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Ze=(e,t)=>t==="ipc"?e.at(-1):e[t];var Rt=({verbose:e},t)=>vs(e,t)!=="none",It=({verbose:e},t)=>!["none","short"].includes(vs(e,t)),vp=({verbose:e},t)=>{let r=vs(e,t);return fi(r)?r:void 0},vs=(e,t)=>t===void 0?Bg(e):Ze(e,t),Bg=e=>e.find(t=>fi(t))??_i.findLast(t=>e.includes(t)),fi=e=>typeof e=="function",_i=["none","short","full"];import{inspect as of}from"util";import{platform as zg}from"process";import{stripVTControlCharacters as Mg}from"util";var wp=(e,t)=>{let r=[e,...t],i=r.join(" "),n=r.map(s=>Vg(xp(s))).join(" ");return{command:i,escapedCommand:n}},lr=e=>Mg(e).split(`
104
- `).map(t=>xp(t)).join(`
105
- `),xp=e=>e.replaceAll(Ug,t=>Fg(t)),Fg=e=>{let t=Ng[e];if(t!==void 0)return t;let r=e.codePointAt(0),i=r.toString(16);return r<=Hg?`\\u${i.padStart(4,"0")}`:`\\U${i}`},Gg=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Ug=Gg(),Ng={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Hg=65535,Vg=e=>Wg.test(e)?e:zg==="win32"?`"${e.replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,Wg=/^[\w./-]+$/;import Sp from"process";function ws(){let{env:e}=Sp,{TERM:t,TERM_PROGRAM:r}=e;return Sp.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var $p={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},Ap={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Kg={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Yg={...$p,...Ap},Jg={...$p,...Kg},Xg=ws(),Zg=Xg?Yg:Jg,bi=Zg,J$=Object.entries(Ap);import Qg from"tty";var ef=Qg?.WriteStream?.prototype?.hasColors?.()??!1,A=(e,t)=>{if(!ef)return n=>n;let r=`\x1B[${e}m`,i=`\x1B[${t}m`;return n=>{let s=n+"",a=s.indexOf(i);if(a===-1)return r+s+i;let o=r,p=0,c=(t===22?i:"")+r;for(;a!==-1;)o+=s.slice(p,a)+c,p=a+i.length,a=s.indexOf(i,p);return o+=s.slice(p)+i,o}},Q$=A(0,0),Ep=A(1,22),eA=A(2,22),tA=A(3,23),rA=A(4,24),iA=A(53,55),nA=A(7,27),sA=A(8,28),aA=A(9,29),oA=A(30,39),pA=A(31,39),cA=A(32,39),dA=A(33,39),uA=A(34,39),lA=A(35,39),mA=A(36,39),hA=A(37,39),qi=A(90,39),yA=A(40,49),gA=A(41,49),fA=A(42,49),_A=A(43,49),bA=A(44,49),qA=A(45,49),kA=A(46,49),vA=A(47,49),wA=A(100,49),Pp=A(91,39),xA=A(92,39),jp=A(93,39),SA=A(94,39),$A=A(95,39),AA=A(96,39),EA=A(97,39),PA=A(101,49),jA=A(102,49),CA=A(103,49),TA=A(104,49),RA=A(105,49),IA=A(106,49),OA=A(107,49);var Rp=({type:e,message:t,timestamp:r,piped:i,commandId:n,result:{failed:s=!1}={},options:{reject:a=!0}})=>{let o=tf(r),p=rf[e]({failed:s,reject:a,piped:i}),d=nf[e]({reject:a});return`${qi(`[${o}]`)} ${qi(`[${n}]`)} ${d(p)} ${d(t)}`},tf=e=>`${ki(e.getHours(),2)}:${ki(e.getMinutes(),2)}:${ki(e.getSeconds(),2)}.${ki(e.getMilliseconds(),3)}`,ki=(e,t)=>String(e).padStart(t,"0"),Cp=({failed:e,reject:t})=>e?t?bi.cross:bi.warning:bi.tick,rf={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"*",error:Cp,duration:Cp},Tp=e=>e,nf={command:()=>Ep,output:()=>Tp,ipc:()=>Tp,error:({reject:e})=>e?Pp:jp,duration:()=>qi};var Ip=(e,t,r)=>{let i=vp(t,r);return e.map(({verboseLine:n,verboseObject:s})=>sf(n,s,i)).filter(n=>n!==void 0).map(n=>af(n)).join("")},sf=(e,t,r)=>{if(r===void 0)return e;let i=r(e,t);if(typeof i=="string")return i},af=e=>e.endsWith(`
103
+ Please set the "stdio" option to ensure that file descriptor exists.`);return i==="all"?[1,2]:[i]},As=e=>{if(e==="all")return e;if(Se.includes(e))return Se.indexOf(e);let t=rf.exec(e);if(t!==null)return Number(t[1])},rf=/^fd(\d+)$/,nf=(e,t)=>e.map(r=>r===void 0?af[t]:r),sf=Jg("execa").enabled?"full":"none",af={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:sf,stripFinalNewline:!0},Es=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],tt=(e,t)=>t==="ipc"?e.at(-1):e[t];var Dt=({verbose:e},t)=>Ps(e,t)!=="none",Lt=({verbose:e},t)=>!["none","short"].includes(Ps(e,t)),Tp=({verbose:e},t)=>{let r=Ps(e,t);return $i(r)?r:void 0},Ps=(e,t)=>t===void 0?of(e):tt(e,t),of=e=>e.find(t=>$i(t))??Ai.findLast(t=>e.includes(t)),$i=e=>typeof e=="function",Ai=["none","short","full"];p();import{inspect as Pf}from"util";p();import{platform as pf}from"process";import{stripVTControlCharacters as cf}from"util";var Rp=(e,t)=>{let r=[e,...t],i=r.join(" "),n=r.map(s=>yf(Ip(s))).join(" ");return{command:i,escapedCommand:n}},br=e=>cf(e).split(`
104
+ `).map(t=>Ip(t)).join(`
105
+ `),Ip=e=>e.replaceAll(lf,t=>df(t)),df=e=>{let t=mf[e];if(t!==void 0)return t;let r=e.codePointAt(0),i=r.toString(16);return r<=hf?`\\u${i.padStart(4,"0")}`:`\\U${i}`},uf=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},lf=uf(),mf={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},hf=65535,yf=e=>gf.test(e)?e:pf==="win32"?`"${e.replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,gf=/^[\w./-]+$/;p();p();p();import Op from"process";function js(){let{env:e}=Op,{TERM:t,TERM_PROGRAM:r}=e;return Op.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Dp={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},Lp={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},ff={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},_f={...Dp,...Lp},bf={...Dp,...ff},qf=js(),kf=qf?_f:bf,Ei=kf,XA=Object.entries(Lp);p();import vf from"tty";var wf=vf?.WriteStream?.prototype?.hasColors?.()??!1,P=(e,t)=>{if(!wf)return n=>n;let r=`\x1B[${e}m`,i=`\x1B[${t}m`;return n=>{let s=n+"",a=s.indexOf(i);if(a===-1)return r+s+i;let o=r,c=0,d=(t===22?i:"")+r;for(;a!==-1;)o+=s.slice(c,a)+d,c=a+i.length,a=s.indexOf(i,c);return o+=s.slice(c)+i,o}},tE=P(0,0),Bp=P(1,22),rE=P(2,22),iE=P(3,23),nE=P(4,24),sE=P(53,55),aE=P(7,27),oE=P(8,28),pE=P(9,29),cE=P(30,39),dE=P(31,39),uE=P(32,39),lE=P(33,39),mE=P(34,39),hE=P(35,39),yE=P(36,39),gE=P(37,39),Pi=P(90,39),fE=P(40,49),_E=P(41,49),bE=P(42,49),qE=P(43,49),kE=P(44,49),vE=P(45,49),wE=P(46,49),xE=P(47,49),SE=P(100,49),zp=P(91,39),$E=P(92,39),Mp=P(93,39),AE=P(94,39),EE=P(95,39),PE=P(96,39),jE=P(97,39),CE=P(101,49),TE=P(102,49),RE=P(103,49),IE=P(104,49),OE=P(105,49),DE=P(106,49),LE=P(107,49);var Up=({type:e,message:t,timestamp:r,piped:i,commandId:n,result:{failed:s=!1}={},options:{reject:a=!0}})=>{let o=xf(r),c=Sf[e]({failed:s,reject:a,piped:i}),u=$f[e]({reject:a});return`${Pi(`[${o}]`)} ${Pi(`[${n}]`)} ${u(c)} ${u(t)}`},xf=e=>`${ji(e.getHours(),2)}:${ji(e.getMinutes(),2)}:${ji(e.getSeconds(),2)}.${ji(e.getMilliseconds(),3)}`,ji=(e,t)=>String(e).padStart(t,"0"),Fp=({failed:e,reject:t})=>e?t?Ei.cross:Ei.warning:Ei.tick,Sf={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"*",error:Fp,duration:Fp},Gp=e=>e,$f={command:()=>Bp,output:()=>Gp,ipc:()=>Gp,error:({reject:e})=>e?zp:Mp,duration:()=>Pi};p();var Np=(e,t,r)=>{let i=Tp(t,r);return e.map(({verboseLine:n,verboseObject:s})=>Af(n,s,i)).filter(n=>n!==void 0).map(n=>Ef(n)).join("")},Af=(e,t,r)=>{if(r===void 0)return e;let i=r(e,t);if(typeof i=="string")return i},Ef=e=>e.endsWith(`
106
106
  `)?e:`${e}
107
- `;var De=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:i,result:n})=>{let s=pf({type:e,result:n,verboseInfo:i}),a=cf(t,s),o=Ip(a,i,r);o!==""&&console.warn(o.slice(0,-1))},pf=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:i,rawOptions:{piped:n=!1,...s}}})=>({type:e,escapedCommand:r,commandId:`${i}`,timestamp:new Date,piped:n,result:t,options:s}),cf=(e,t)=>e.split(`
108
- `).map(r=>df({...t,message:r})),df=e=>({verboseLine:Rp(e),verboseObject:e}),vi=e=>{let t=typeof e=="string"?e:of(e);return lr(t).replaceAll(" "," ".repeat(uf))},uf=2;var Op=(e,t)=>{Rt(t)&&De({type:"command",verboseMessage:e,verboseInfo:t})};var Dp=(e,t,r)=>{hf(e);let i=lf(e);return{verbose:e,escapedCommand:t,commandId:i,rawOptions:r}},lf=e=>Rt({verbose:e})?mf++:void 0,mf=0n,hf=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!_i.includes(t)&&!fi(t)){let r=_i.map(i=>`'${i}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${r} or a function.`)}}};import{hrtime as Lp}from"process";var wi=()=>Lp.bigint(),xs=e=>Number(Lp.bigint()-e)/1e6;var xi=(e,t,r)=>{let i=wi(),{command:n,escapedCommand:s}=wp(e,t),a=bs(r,"verbose"),o=Dp(a,s,{...r});return Op(s,o),{command:n,escapedCommand:s,startTime:i,verboseInfo:o}};var Dd=D(Sc(),1);import X_ from"path";import Od from"process";import Ei from"process";import qt from"path";function $i(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"}import{promisify as Ff}from"util";import{execFile as Gf,execFileSync as wE}from"child_process";import $c from"path";import{fileURLToPath as Uf}from"url";var $E=Ff(Gf);function Ai(e){return e instanceof URL?Uf(e):e}function Ac(e){return{*[Symbol.iterator](){let t=$c.resolve(Ai(e)),r;for(;r!==t;)yield t,r=t,t=$c.resolve(t,"..")}}}var AE=10*1024*1024;var Nf=({cwd:e=Ei.cwd(),path:t=Ei.env[$i()],preferLocal:r=!0,execPath:i=Ei.execPath,addExecPath:n=!0}={})=>{let s=qt.resolve(Ai(e)),a=[],o=t.split(qt.delimiter);return r&&Hf(a,o,s),n&&Vf(a,o,i,s),t===""||t===qt.delimiter?`${a.join(qt.delimiter)}${t}`:[...a,t].join(qt.delimiter)},Hf=(e,t,r)=>{for(let i of Ac(r)){let n=qt.join(i,"node_modules/.bin");t.includes(n)||e.push(n)}},Vf=(e,t,r,i)=>{let n=qt.resolve(i,Ai(r),"..");t.includes(n)||e.push(n)},Ec=({env:e=Ei.env,...t}={})=>{e={...e};let r=$i({env:e});return t.path=e[r],e[r]=Nf(t),e};import{setTimeout as o_}from"timers/promises";var Pc=(e,t,r)=>{let i=r?hr:mr,n=e instanceof Ee?{}:{cause:e};return new i(t,n)},Ee=class extends Error{},jc=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,Tc,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Cc=e=>Pi(e)&&Tc in e,Tc=Symbol("isExecaError"),Pi=e=>Object.prototype.toString.call(e)==="[object Error]",mr=class extends Error{};jc(mr,mr.name);var hr=class extends Error{};jc(hr,hr.name);import{constants as yr}from"os";import{constants as Jf}from"os";var Rc=()=>{let e=Oc-Ic+1;return Array.from({length:e},Wf)},Wf=(e,t)=>({name:`SIGRT${t+1}`,number:Ic+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Ic=34,Oc=64;import{constants as Kf}from"os";var Dc=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var Is=()=>{let e=Rc();return[...Dc,...e].map(Yf)},Yf=({name:e,number:t,description:r,action:i,forced:n=!1,standard:s})=>{let{signals:{[e]:a}}=Kf,o=a!==void 0;return{name:e,number:o?a:t,description:r,supported:o,action:i,forced:n,standard:s}};var Xf=()=>{let e=Is();return Object.fromEntries(e.map(Zf))},Zf=({name:e,number:t,description:r,supported:i,action:n,forced:s,standard:a})=>[e,{name:e,number:t,description:r,supported:i,action:n,forced:s,standard:a}],Lc=Xf(),Qf=()=>{let e=Is(),t=65,r=Array.from({length:t},(i,n)=>e_(n,e));return Object.assign({},...r)},e_=(e,t)=>{let r=t_(e,t);if(r===void 0)return{};let{name:i,description:n,supported:s,action:a,forced:o,standard:p}=r;return{[e]:{name:i,number:e,description:n,supported:s,action:a,forced:o,standard:p}}},t_=(e,t)=>{let r=t.find(({name:i})=>Jf.signals[i]===e);return r!==void 0?r:t.find(i=>i.number===e)},NE=Qf();var zc=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return Fc(e,t)},Mc=e=>e===0?e:Fc(e,"`subprocess.kill()`'s argument"),Fc=(e,t)=>{if(Number.isInteger(e))return r_(e,t);if(typeof e=="string")return n_(e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
109
- ${Os()}`)},r_=(e,t)=>{if(Bc.has(e))return Bc.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
110
- ${Os()}`)},i_=()=>new Map(Object.entries(yr.signals).reverse().map(([e,t])=>[t,e])),Bc=i_(),n_=(e,t)=>{if(e in yr.signals)return e;throw e.toUpperCase()in yr.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
111
- ${Os()}`)},Os=()=>`Available signal names: ${s_()}.
112
- Available signal numbers: ${a_()}.`,s_=()=>Object.keys(yr.signals).sort().map(e=>`'${e}'`).join(", "),a_=()=>[...new Set(Object.values(yr.signals).sort((e,t)=>e-t))].join(", "),ji=e=>Lc[e].description;var Gc=e=>{if(e===!1)return e;if(e===!0)return p_;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},p_=1e3*5,Uc=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},onInternalError:i,context:n,controller:s},a,o)=>{let{signal:p,error:d}=c_(a,o,r);d_(d,i);let c=e(p);return u_({kill:e,signal:p,forceKillAfterDelay:t,killSignal:r,killResult:c,context:n,controller:s}),c},c_=(e,t,r)=>{let[i=r,n]=Pi(e)?[void 0,e]:[e,t];if(typeof i!="string"&&!Number.isInteger(i))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(i)}`);if(n!==void 0&&!Pi(n))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${n}`);return{signal:Mc(i),error:n}},d_=(e,t)=>{e!==void 0&&t.reject(e)},u_=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:i,killResult:n,context:s,controller:a})=>{t===i&&n&&Ds({kill:e,forceKillAfterDelay:r,context:s,controllerSignal:a.signal})},Ds=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:i})=>{if(t!==!1)try{await o_(t,void 0,{signal:i}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};import{once as l_}from"events";var Ci=async(e,t)=>{e.aborted||await l_(e,"abort",{signal:t})};var Nc=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Hc=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:i,controller:n})=>t===void 0||r?[]:[m_(e,t,i,n)],m_=async(e,t,r,{signal:i})=>{throw await Ci(t,i),r.terminationReason??="cancel",e.kill(),t.reason};import{scheduler as I_}from"timers/promises";import{promisify as C_}from"util";var Lt=({methodName:e,isSubprocess:t,ipc:r,isConnected:i})=>{h_(e,t,r),Ls(e,t,i)},h_=(e,t,r)=>{if(!r)throw new Error(`${Pe(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Ls=(e,t,r)=>{if(!r)throw new Error(`${Pe(e,t)} cannot be used: the ${ot(t)} has already exited or disconnected.`)},Vc=e=>{throw new Error(`${Pe("getOneMessage",e)} could not complete: the ${ot(e)} exited or disconnected.`)},Wc=e=>{throw new Error(`${Pe("sendMessage",e)} failed: the ${ot(e)} is sending a message too, instead of listening to incoming messages.
107
+ `;var ze=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:i,result:n})=>{let s=jf({type:e,result:n,verboseInfo:i}),a=Cf(t,s),o=Np(a,i,r);o!==""&&console.warn(o.slice(0,-1))},jf=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:i,rawOptions:{piped:n=!1,...s}}})=>({type:e,escapedCommand:r,commandId:`${i}`,timestamp:new Date,piped:n,result:t,options:s}),Cf=(e,t)=>e.split(`
108
+ `).map(r=>Tf({...t,message:r})),Tf=e=>({verboseLine:Up(e),verboseObject:e}),Ci=e=>{let t=typeof e=="string"?e:Pf(e);return br(t).replaceAll(" "," ".repeat(Rf))},Rf=2;var Vp=(e,t)=>{Dt(t)&&ze({type:"command",verboseMessage:e,verboseInfo:t})};p();var Hp=(e,t,r)=>{Df(e);let i=If(e);return{verbose:e,escapedCommand:t,commandId:i,rawOptions:r}},If=e=>Dt({verbose:e})?Of++:void 0,Of=0n,Df=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Ai.includes(t)&&!$i(t)){let r=Ai.map(i=>`'${i}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${r} or a function.`)}}};p();import{hrtime as Wp}from"process";var Ti=()=>Wp.bigint(),Cs=e=>Number(Wp.bigint()-e)/1e6;var Ri=(e,t,r)=>{let i=Ti(),{command:n,escapedCommand:s}=Rp(e,t),a=$s(r,"verbose"),o=Hp(a,s,{...r});return Vp(s,o),{command:n,escapedCommand:s,startTime:i,verboseInfo:o}};p();var Hd=B(Oc(),1);import bb from"path";import Vd from"process";p();import Li from"process";import wt from"path";p();function Oi(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"}p();import{promisify as c_}from"util";import{execFile as d_,execFileSync as WP}from"child_process";import Dc from"path";import{fileURLToPath as u_}from"url";var JP=c_(d_);function Di(e){return e instanceof URL?u_(e):e}function Lc(e){return{*[Symbol.iterator](){let t=Dc.resolve(Di(e)),r;for(;r!==t;)yield t,r=t,t=Dc.resolve(t,"..")}}}var XP=10*1024*1024;var l_=({cwd:e=Li.cwd(),path:t=Li.env[Oi()],preferLocal:r=!0,execPath:i=Li.execPath,addExecPath:n=!0}={})=>{let s=wt.resolve(Di(e)),a=[],o=t.split(wt.delimiter);return r&&m_(a,o,s),n&&h_(a,o,i,s),t===""||t===wt.delimiter?`${a.join(wt.delimiter)}${t}`:[...a,t].join(wt.delimiter)},m_=(e,t,r)=>{for(let i of Lc(r)){let n=wt.join(i,"node_modules/.bin");t.includes(n)||e.push(n)}},h_=(e,t,r,i)=>{let n=wt.resolve(i,Di(r),"..");t.includes(n)||e.push(n)},Bc=({env:e=Li.env,...t}={})=>{e={...e};let r=Oi({env:e});return t.path=e[r],e[r]=l_(t),e};p();import{setTimeout as P_}from"timers/promises";p();var zc=(e,t,r)=>{let i=r?kr:qr,n=e instanceof Ce?{}:{cause:e};return new i(t,n)},Ce=class extends Error{},Mc=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,Gc,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Fc=e=>Bi(e)&&Gc in e,Gc=Symbol("isExecaError"),Bi=e=>Object.prototype.toString.call(e)==="[object Error]",qr=class extends Error{};Mc(qr,qr.name);var kr=class extends Error{};Mc(kr,kr.name);p();import{constants as vr}from"os";p();import{constants as __}from"os";p();var Uc=()=>{let e=Vc-Nc+1;return Array.from({length:e},y_)},y_=(e,t)=>({name:`SIGRT${t+1}`,number:Nc+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Nc=34,Vc=64;p();import{constants as g_}from"os";p();var Hc=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var Fs=()=>{let e=Uc();return[...Hc,...e].map(f_)},f_=({name:e,number:t,description:r,action:i,forced:n=!1,standard:s})=>{let{signals:{[e]:a}}=g_,o=a!==void 0;return{name:e,number:o?a:t,description:r,supported:o,action:i,forced:n,standard:s}};var b_=()=>{let e=Fs();return Object.fromEntries(e.map(q_))},q_=({name:e,number:t,description:r,supported:i,action:n,forced:s,standard:a})=>[e,{name:e,number:t,description:r,supported:i,action:n,forced:s,standard:a}],Wc=b_(),k_=()=>{let e=Fs(),t=65,r=Array.from({length:t},(i,n)=>v_(n,e));return Object.assign({},...r)},v_=(e,t)=>{let r=w_(e,t);if(r===void 0)return{};let{name:i,description:n,supported:s,action:a,forced:o,standard:c}=r;return{[e]:{name:i,number:e,description:n,supported:s,action:a,forced:o,standard:c}}},w_=(e,t)=>{let r=t.find(({name:i})=>__.signals[i]===e);return r!==void 0?r:t.find(i=>i.number===e)},qj=k_();var Yc=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return Xc(e,t)},Jc=e=>e===0?e:Xc(e,"`subprocess.kill()`'s argument"),Xc=(e,t)=>{if(Number.isInteger(e))return x_(e,t);if(typeof e=="string")return $_(e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
109
+ ${Gs()}`)},x_=(e,t)=>{if(Kc.has(e))return Kc.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
110
+ ${Gs()}`)},S_=()=>new Map(Object.entries(vr.signals).reverse().map(([e,t])=>[t,e])),Kc=S_(),$_=(e,t)=>{if(e in vr.signals)return e;throw e.toUpperCase()in vr.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
111
+ ${Gs()}`)},Gs=()=>`Available signal names: ${A_()}.
112
+ Available signal numbers: ${E_()}.`,A_=()=>Object.keys(vr.signals).sort().map(e=>`'${e}'`).join(", "),E_=()=>[...new Set(Object.values(vr.signals).sort((e,t)=>e-t))].join(", "),zi=e=>Wc[e].description;var Zc=e=>{if(e===!1)return e;if(e===!0)return j_;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},j_=1e3*5,Qc=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},onInternalError:i,context:n,controller:s},a,o)=>{let{signal:c,error:u}=C_(a,o,r);T_(u,i);let d=e(c);return R_({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:d,context:n,controller:s}),d},C_=(e,t,r)=>{let[i=r,n]=Bi(e)?[void 0,e]:[e,t];if(typeof i!="string"&&!Number.isInteger(i))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(i)}`);if(n!==void 0&&!Bi(n))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${n}`);return{signal:Jc(i),error:n}},T_=(e,t)=>{e!==void 0&&t.reject(e)},R_=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:i,killResult:n,context:s,controller:a})=>{t===i&&n&&Us({kill:e,forceKillAfterDelay:r,context:s,controllerSignal:a.signal})},Us=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:i})=>{if(t!==!1)try{await P_(t,void 0,{signal:i}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};p();p();import{once as I_}from"events";var Mi=async(e,t)=>{e.aborted||await I_(e,"abort",{signal:t})};var ed=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},td=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:i,controller:n})=>t===void 0||r?[]:[O_(e,t,i,n)],O_=async(e,t,r,{signal:i})=>{throw await Mi(t,i),r.terminationReason??="cancel",e.kill(),t.reason};p();p();import{scheduler as rb}from"timers/promises";p();import{promisify as Q_}from"util";p();var Mt=({methodName:e,isSubprocess:t,ipc:r,isConnected:i})=>{D_(e,t,r),Ns(e,t,i)},D_=(e,t,r)=>{if(!r)throw new Error(`${Te(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Ns=(e,t,r)=>{if(!r)throw new Error(`${Te(e,t)} cannot be used: the ${dt(t)} has already exited or disconnected.`)},rd=e=>{throw new Error(`${Te("getOneMessage",e)} could not complete: the ${dt(e)} exited or disconnected.`)},id=e=>{throw new Error(`${Te("sendMessage",e)} failed: the ${dt(e)} is sending a message too, instead of listening to incoming messages.
113
113
  This can be fixed by both sending a message and listening to incoming messages at the same time:
114
114
 
115
115
  const [receivedMessage] = await Promise.all([
116
- ${Pe("getOneMessage",e)},
117
- ${Pe("sendMessage",e,"message, {strict: true}")},
118
- ]);`)},Ti=(e,t)=>new Error(`${Pe("sendMessage",t)} failed when sending an acknowledgment response to the ${ot(t)}.`,{cause:e}),Kc=e=>{throw new Error(`${Pe("sendMessage",e)} failed: the ${ot(e)} is not listening to incoming messages.`)},Yc=e=>{throw new Error(`${Pe("sendMessage",e)} failed: the ${ot(e)} exited without listening to incoming messages.`)},Jc=()=>new Error(`\`cancelSignal\` aborted: the ${ot(!0)} disconnected.`),Xc=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},Zc=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(`${Pe(t,r)} cannot be used: the ${ot(r)} is disconnecting.`,{cause:e})},Qc=({error:e,methodName:t,isSubprocess:r,message:i})=>{if(y_(e))throw new Error(`${Pe(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(i)}.`,{cause:e})},y_=({code:e,message:t})=>g_.has(e)||f_.some(r=>t.includes(r)),g_=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),f_=["could not be cloned","circular structure","call stack size exceeded"],Pe=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${__(t)}${e}(${r})`,__=e=>e?"":"subprocess.",ot=e=>e?"parent process":"subprocess",Bt=e=>{e.connected&&e.disconnect()};var Le=()=>{let e={},t=new Promise((r,i)=>{Object.assign(e,{resolve:r,reject:i})});return Object.assign(t,e)};var Ii=(e,t="stdin")=>{let{options:i,fileDescriptors:n}=Be.get(e),s=ed(n,t,!0),a=e.stdio[s];if(a===null)throw new TypeError(td(s,t,i,!0));return a},zt=(e,t="stdout")=>{let{options:i,fileDescriptors:n}=Be.get(e),s=ed(n,t,!1),a=s==="all"?e.all:e.stdio[s];if(a==null)throw new TypeError(td(s,t,i,!1));return a},Be=new WeakMap,ed=(e,t,r)=>{let i=b_(t,r);return q_(i,t,r,e),i},b_=(e,t)=>{let r=qs(e);if(r!==void 0)return r;let{validOptions:i,defaultValue:n}=t?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${gr(t)}" must not be "${e}".
116
+ ${Te("getOneMessage",e)},
117
+ ${Te("sendMessage",e,"message, {strict: true}")},
118
+ ]);`)},Fi=(e,t)=>new Error(`${Te("sendMessage",t)} failed when sending an acknowledgment response to the ${dt(t)}.`,{cause:e}),nd=e=>{throw new Error(`${Te("sendMessage",e)} failed: the ${dt(e)} is not listening to incoming messages.`)},sd=e=>{throw new Error(`${Te("sendMessage",e)} failed: the ${dt(e)} exited without listening to incoming messages.`)},ad=()=>new Error(`\`cancelSignal\` aborted: the ${dt(!0)} disconnected.`),od=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},pd=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(`${Te(t,r)} cannot be used: the ${dt(r)} is disconnecting.`,{cause:e})},cd=({error:e,methodName:t,isSubprocess:r,message:i})=>{if(L_(e))throw new Error(`${Te(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(i)}.`,{cause:e})},L_=({code:e,message:t})=>B_.has(e)||z_.some(r=>t.includes(r)),B_=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),z_=["could not be cloned","circular structure","call stack size exceeded"],Te=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${M_(t)}${e}(${r})`,M_=e=>e?"":"subprocess.",dt=e=>e?"parent process":"subprocess",Ft=e=>{e.connected&&e.disconnect()};p();p();var Me=()=>{let e={},t=new Promise((r,i)=>{Object.assign(e,{resolve:r,reject:i})});return Object.assign(t,e)};p();var Ui=(e,t="stdin")=>{let{options:i,fileDescriptors:n}=Fe.get(e),s=dd(n,t,!0),a=e.stdio[s];if(a===null)throw new TypeError(ud(s,t,i,!0));return a},Gt=(e,t="stdout")=>{let{options:i,fileDescriptors:n}=Fe.get(e),s=dd(n,t,!1),a=s==="all"?e.all:e.stdio[s];if(a==null)throw new TypeError(ud(s,t,i,!1));return a},Fe=new WeakMap,dd=(e,t,r)=>{let i=F_(t,r);return G_(i,t,r,e),i},F_=(e,t)=>{let r=As(e);if(r!==void 0)return r;let{validOptions:i,defaultValue:n}=t?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${wr(t)}" must not be "${e}".
119
119
  It must be ${i} or "fd3", "fd4" (and so on).
120
- It is optional and defaults to "${n}".`)},q_=(e,t,r,i)=>{let n=i[rd(e)];if(n===void 0)throw new TypeError(`"${gr(r)}" must not be ${t}. That file descriptor does not exist.
121
- Please set the "stdio" option to ensure that file descriptor exists.`);if(n.direction==="input"&&!r)throw new TypeError(`"${gr(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(n.direction!=="input"&&r)throw new TypeError(`"${gr(r)}" must not be ${t}. It must be a writable stream, not readable.`)},td=(e,t,r,i)=>{if(e==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:n,optionValue:s}=k_(e,r);return`The "${n}: ${Ri(s)}" option is incompatible with using "${gr(i)}: ${Ri(t)}".
122
- Please set this option with "pipe" instead.`},k_=(e,{stdin:t,stdout:r,stderr:i,stdio:n})=>{let s=rd(e);return s===0&&t!==void 0?{optionName:"stdin",optionValue:t}:s===1&&r!==void 0?{optionName:"stdout",optionValue:r}:s===2&&i!==void 0?{optionName:"stderr",optionValue:i}:{optionName:`stdio[${s}]`,optionValue:n[s]}},rd=e=>e==="all"?1:e,gr=e=>e?"to":"from",Ri=e=>typeof e=="string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as A_}from"events";import{addAbortListener as v_}from"events";var kt=(e,t,r)=>{let i=e.getMaxListeners();i===0||i===Number.POSITIVE_INFINITY||(e.setMaxListeners(i+t),v_(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as S_}from"events";import{once as w_}from"events";import{scheduler as x_}from"timers/promises";var Oi=(e,t)=>{t&&Bs(e)},Bs=e=>{e.refCounted()},Di=(e,t)=>{t&&zs(e)},zs=e=>{e.unrefCounted()},id=(e,t)=>{t&&(zs(e),zs(e))},nd=(e,t)=>{t&&(Bs(e),Bs(e))};var sd=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i},n)=>{if(pd(n)||dd(n))return;Li.has(e)||Li.set(e,[]);let s=Li.get(e);if(s.push(n),!(s.length>1))for(;s.length>0;){await cd(e,i,n),await x_.yield();let a=await od({wrappedMessage:s[0],anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i});s.shift(),i.emit("message",a),i.emit("message:done")}},ad=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i,boundOnMessage:n})=>{Ms();let s=Li.get(e);for(;s?.length>0;)await w_(i,"message:done");e.removeListener("message",n),nd(t,r),i.connected=!1,i.emit("disconnect")},Li=new WeakMap;var pt=(e,t,r)=>{if(Bi.has(e))return Bi.get(e);let i=new S_;return i.connected=!0,Bi.set(e,i),$_({ipcEmitter:i,anyProcess:e,channel:t,isSubprocess:r}),i},Bi=new WeakMap,$_=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:i})=>{let n=sd.bind(void 0,{anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:e});t.on("message",n),t.once("disconnect",ad.bind(void 0,{anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:e,boundOnMessage:n})),id(r,i)},zi=e=>{let t=Bi.get(e);return t===void 0?e.channel!==null:t.connected};var ud=({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:n})=>{if(!n)return i;let s=pt(e,t,r),a=Gi(e,s);return{id:E_++,type:Fi,message:i,hasListeners:a}},E_=0n,ld=(e,t)=>{if(!(t?.type!==Fi||t.hasListeners))for(let{id:r}of e)r!==void 0&&Mi[r].resolve({isDeadlock:!0,hasListeners:!1})},od=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:n})=>{if(e?.type!==Fi||!t.connected)return e;let{id:s,message:a}=e,o={id:s,type:hd,message:Gi(t,n)};try{await Ui({anyProcess:t,channel:r,isSubprocess:i,ipc:!0},o)}catch(p){n.emit("strict:error",p)}return a},pd=e=>{if(e?.type!==hd)return!1;let{id:t,message:r}=e;return Mi[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},md=async(e,t,r)=>{if(e?.type!==Fi)return;let i=Le();Mi[e.id]=i;let n=new AbortController;try{let{isDeadlock:s,hasListeners:a}=await Promise.race([i,P_(t,r,n)]);s&&Wc(r),a||Kc(r)}finally{n.abort(),delete Mi[e.id]}},Mi={},P_=async(e,t,{signal:r})=>{kt(e,1,r),await A_(e,"disconnect",{signal:r}),Yc(t)},Fi="execa:ipc:request",hd="execa:ipc:response";var yd=(e,t,r)=>{fr.has(e)||fr.set(e,new Set);let i=fr.get(e),n=Le(),s=r?t.id:void 0,a={onMessageSent:n,id:s};return i.add(a),{outgoingMessages:i,outgoingMessage:a}},gd=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},cd=async(e,t,r)=>{for(;!Gi(e,t)&&fr.get(e)?.size>0;){let i=[...fr.get(e)];ld(i,r),await Promise.all(i.map(({onMessageSent:n})=>n))}},fr=new WeakMap,Gi=(e,t)=>t.listenerCount("message")>j_(e),j_=e=>Be.has(e)&&!Ze(Be.get(e).options.buffer,"ipc")?1:0;var Ui=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},n,{strict:s=!1}={})=>{let a="sendMessage";return Lt({methodName:a,isSubprocess:r,ipc:i,isConnected:e.connected}),T_({anyProcess:e,channel:t,methodName:a,isSubprocess:r,message:n,strict:s})},T_=async({anyProcess:e,channel:t,methodName:r,isSubprocess:i,message:n,strict:s})=>{let a=ud({anyProcess:e,channel:t,isSubprocess:i,message:n,strict:s}),o=yd(e,a,s);try{await Gs({anyProcess:e,methodName:r,isSubprocess:i,wrappedMessage:a,message:n})}catch(p){throw Bt(e),p}finally{gd(o)}},Gs=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:i,message:n})=>{let s=R_(e);try{await Promise.all([md(i,e,r),s(i)])}catch(a){throw Zc({error:a,methodName:t,isSubprocess:r}),Qc({error:a,methodName:t,isSubprocess:r,message:n}),a}},R_=e=>{if(Fs.has(e))return Fs.get(e);let t=C_(e.send.bind(e));return Fs.set(e,t),t},Fs=new WeakMap;var _d=(e,t)=>{let r="cancelSignal";return Ls(r,!1,e.connected),Gs({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:qd,message:t},message:t})},bd=async({anyProcess:e,channel:t,isSubprocess:r,ipc:i})=>(await O_({anyProcess:e,channel:t,isSubprocess:r,ipc:i}),Us.signal),O_=async({anyProcess:e,channel:t,isSubprocess:r,ipc:i})=>{if(!fd){if(fd=!0,!i){Xc();return}if(t===null){Ms();return}pt(e,t,r),await I_.yield()}},fd=!1,dd=e=>e?.type!==qd?!1:(Us.abort(e.message),!0),qd="execa:ipc:cancel",Ms=()=>{Us.abort(Jc())},Us=new AbortController;var kd=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:i})=>{if(e){if(t===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(i==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},vd=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:i,context:n,controller:s})=>r?[D_({subprocess:e,cancelSignal:t,forceKillAfterDelay:i,context:n,controller:s})]:[],D_=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:{signal:n}})=>{await Ci(t,n);let s=L_(t);throw await _d(e,s),Ds({kill:e.kill,forceKillAfterDelay:r,context:i,controllerSignal:n}),i.terminationReason??="gracefulCancel",t.reason},L_=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as B_}from"timers/promises";var wd=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},xd=(e,t,r,i)=>t===0||t===void 0?[]:[z_(e,t,r,i)],z_=async(e,t,r,{signal:i})=>{throw await B_(t,void 0,{signal:i}),r.terminationReason??="timeout",e.kill(),new Ee};import{execPath as M_,execArgv as F_}from"process";import Sd from"path";var $d=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},Ad=(e,t,{node:r=!1,nodePath:i=M_,nodeOptions:n=F_.filter(p=>!p.startsWith("--inspect")),cwd:s,execPath:a,...o})=>{if(a!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let p=Tt(i,'The "nodePath" option'),d=Sd.resolve(s,p),c={...o,nodePath:d,node:r,cwd:s};if(!r)return[e,t,c];if(Sd.basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[d,[...n,e,...t],{ipc:!0,...c,shell:!1}]};import{serialize as G_}from"v8";var Ed=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");H_[r](e)}},U_=e=>{try{G_(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},N_=e=>{try{JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},H_={advanced:U_,json:N_},Pd=async(e,t)=>{t!==void 0&&await e.sendMessage(t)};var Cd=({encoding:e})=>{if(Ns.has(e))return;let t=W_(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${Ni(e)}\`.
123
- Please rename it to ${Ni(t)}.`);let r=[...Ns].map(i=>Ni(i)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Ni(e)}\`.
124
- Please rename it to one of: ${r}.`)},V_=new Set(["utf8","utf16le"]),fe=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),Ns=new Set([...V_,...fe]),W_=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();if(t in jd)return jd[t];if(Ns.has(t))return t},jd={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Ni=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as K_}from"fs";import Y_ from"path";import J_ from"process";var Td=(e=Rd())=>{let t=Tt(e,'The "cwd" option');return Y_.resolve(t)},Rd=()=>{try{return J_.cwd()}catch(e){throw e.message=`The current directory does not exist.
125
- ${e.message}`,e}},Id=(e,t)=>{if(t===Rd())return e;let r;try{r=K_(t)}catch(i){return`The "cwd" option is invalid: ${t}.
120
+ It is optional and defaults to "${n}".`)},G_=(e,t,r,i)=>{let n=i[ld(e)];if(n===void 0)throw new TypeError(`"${wr(r)}" must not be ${t}. That file descriptor does not exist.
121
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(n.direction==="input"&&!r)throw new TypeError(`"${wr(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(n.direction!=="input"&&r)throw new TypeError(`"${wr(r)}" must not be ${t}. It must be a writable stream, not readable.`)},ud=(e,t,r,i)=>{if(e==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:n,optionValue:s}=U_(e,r);return`The "${n}: ${Gi(s)}" option is incompatible with using "${wr(i)}: ${Gi(t)}".
122
+ Please set this option with "pipe" instead.`},U_=(e,{stdin:t,stdout:r,stderr:i,stdio:n})=>{let s=ld(e);return s===0&&t!==void 0?{optionName:"stdin",optionValue:t}:s===1&&r!==void 0?{optionName:"stdout",optionValue:r}:s===2&&i!==void 0?{optionName:"stderr",optionValue:i}:{optionName:`stdio[${s}]`,optionValue:n[s]}},ld=e=>e==="all"?1:e,wr=e=>e?"to":"from",Gi=e=>typeof e=="string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";p();import{once as Y_}from"events";p();import{addAbortListener as N_}from"events";var xt=(e,t,r)=>{let i=e.getMaxListeners();i===0||i===Number.POSITIVE_INFINITY||(e.setMaxListeners(i+t),N_(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};p();import{EventEmitter as W_}from"events";p();import{once as V_}from"events";import{scheduler as H_}from"timers/promises";p();var Ni=(e,t)=>{t&&Vs(e)},Vs=e=>{e.refCounted()},Vi=(e,t)=>{t&&Hs(e)},Hs=e=>{e.unrefCounted()},md=(e,t)=>{t&&(Hs(e),Hs(e))},hd=(e,t)=>{t&&(Vs(e),Vs(e))};var yd=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i},n)=>{if(_d(n)||qd(n))return;Hi.has(e)||Hi.set(e,[]);let s=Hi.get(e);if(s.push(n),!(s.length>1))for(;s.length>0;){await bd(e,i,n),await H_.yield();let a=await fd({wrappedMessage:s[0],anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i});s.shift(),i.emit("message",a),i.emit("message:done")}},gd=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i,boundOnMessage:n})=>{Ws();let s=Hi.get(e);for(;s?.length>0;)await V_(i,"message:done");e.removeListener("message",n),hd(t,r),i.connected=!1,i.emit("disconnect")},Hi=new WeakMap;var ut=(e,t,r)=>{if(Wi.has(e))return Wi.get(e);let i=new W_;return i.connected=!0,Wi.set(e,i),K_({ipcEmitter:i,anyProcess:e,channel:t,isSubprocess:r}),i},Wi=new WeakMap,K_=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:i})=>{let n=yd.bind(void 0,{anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:e});t.on("message",n),t.once("disconnect",gd.bind(void 0,{anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:e,boundOnMessage:n})),md(r,i)},Ki=e=>{let t=Wi.get(e);return t===void 0?e.channel!==null:t.connected};var kd=({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:n})=>{if(!n)return i;let s=ut(e,t,r),a=Xi(e,s);return{id:J_++,type:Ji,message:i,hasListeners:a}},J_=0n,vd=(e,t)=>{if(!(t?.type!==Ji||t.hasListeners))for(let{id:r}of e)r!==void 0&&Yi[r].resolve({isDeadlock:!0,hasListeners:!1})},fd=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:n})=>{if(e?.type!==Ji||!t.connected)return e;let{id:s,message:a}=e,o={id:s,type:xd,message:Xi(t,n)};try{await Zi({anyProcess:t,channel:r,isSubprocess:i,ipc:!0},o)}catch(c){n.emit("strict:error",c)}return a},_d=e=>{if(e?.type!==xd)return!1;let{id:t,message:r}=e;return Yi[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},wd=async(e,t,r)=>{if(e?.type!==Ji)return;let i=Me();Yi[e.id]=i;let n=new AbortController;try{let{isDeadlock:s,hasListeners:a}=await Promise.race([i,X_(t,r,n)]);s&&id(r),a||nd(r)}finally{n.abort(),delete Yi[e.id]}},Yi={},X_=async(e,t,{signal:r})=>{xt(e,1,r),await Y_(e,"disconnect",{signal:r}),sd(t)},Ji="execa:ipc:request",xd="execa:ipc:response";var Sd=(e,t,r)=>{xr.has(e)||xr.set(e,new Set);let i=xr.get(e),n=Me(),s=r?t.id:void 0,a={onMessageSent:n,id:s};return i.add(a),{outgoingMessages:i,outgoingMessage:a}},$d=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},bd=async(e,t,r)=>{for(;!Xi(e,t)&&xr.get(e)?.size>0;){let i=[...xr.get(e)];vd(i,r),await Promise.all(i.map(({onMessageSent:n})=>n))}},xr=new WeakMap,Xi=(e,t)=>t.listenerCount("message")>Z_(e),Z_=e=>Fe.has(e)&&!tt(Fe.get(e).options.buffer,"ipc")?1:0;var Zi=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},n,{strict:s=!1}={})=>{let a="sendMessage";return Mt({methodName:a,isSubprocess:r,ipc:i,isConnected:e.connected}),eb({anyProcess:e,channel:t,methodName:a,isSubprocess:r,message:n,strict:s})},eb=async({anyProcess:e,channel:t,methodName:r,isSubprocess:i,message:n,strict:s})=>{let a=kd({anyProcess:e,channel:t,isSubprocess:i,message:n,strict:s}),o=Sd(e,a,s);try{await Ys({anyProcess:e,methodName:r,isSubprocess:i,wrappedMessage:a,message:n})}catch(c){throw Ft(e),c}finally{$d(o)}},Ys=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:i,message:n})=>{let s=tb(e);try{await Promise.all([wd(i,e,r),s(i)])}catch(a){throw pd({error:a,methodName:t,isSubprocess:r}),cd({error:a,methodName:t,isSubprocess:r,message:n}),a}},tb=e=>{if(Ks.has(e))return Ks.get(e);let t=Q_(e.send.bind(e));return Ks.set(e,t),t},Ks=new WeakMap;var Ed=(e,t)=>{let r="cancelSignal";return Ns(r,!1,e.connected),Ys({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:jd,message:t},message:t})},Pd=async({anyProcess:e,channel:t,isSubprocess:r,ipc:i})=>(await ib({anyProcess:e,channel:t,isSubprocess:r,ipc:i}),Js.signal),ib=async({anyProcess:e,channel:t,isSubprocess:r,ipc:i})=>{if(!Ad){if(Ad=!0,!i){od();return}if(t===null){Ws();return}ut(e,t,r),await rb.yield()}},Ad=!1,qd=e=>e?.type!==jd?!1:(Js.abort(e.message),!0),jd="execa:ipc:cancel",Ws=()=>{Js.abort(ad())},Js=new AbortController;var Cd=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:i})=>{if(e){if(t===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(i==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},Td=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:i,context:n,controller:s})=>r?[nb({subprocess:e,cancelSignal:t,forceKillAfterDelay:i,context:n,controller:s})]:[],nb=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:{signal:n}})=>{await Mi(t,n);let s=sb(t);throw await Ed(e,s),Us({kill:e.kill,forceKillAfterDelay:r,context:i,controllerSignal:n}),i.terminationReason??="gracefulCancel",t.reason},sb=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};p();import{setTimeout as ab}from"timers/promises";var Rd=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Id=(e,t,r,i)=>t===0||t===void 0?[]:[ob(e,t,r,i)],ob=async(e,t,r,{signal:i})=>{throw await ab(t,void 0,{signal:i}),r.terminationReason??="timeout",e.kill(),new Ce};p();import{execPath as pb,execArgv as cb}from"process";import Od from"path";var Dd=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},Ld=(e,t,{node:r=!1,nodePath:i=pb,nodeOptions:n=cb.filter(c=>!c.startsWith("--inspect")),cwd:s,execPath:a,...o})=>{if(a!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=Ot(i,'The "nodePath" option'),u=Od.resolve(s,c),d={...o,nodePath:u,node:r,cwd:s};if(!r)return[e,t,d];if(Od.basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[u,[...n,e,...t],{ipc:!0,...d,shell:!1}]};p();import{serialize as db}from"v8";var Bd=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");mb[r](e)}},ub=e=>{try{db(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},lb=e=>{try{JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},mb={advanced:ub,json:lb},zd=async(e,t)=>{t!==void 0&&await e.sendMessage(t)};p();var Fd=({encoding:e})=>{if(Xs.has(e))return;let t=yb(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${Qi(e)}\`.
123
+ Please rename it to ${Qi(t)}.`);let r=[...Xs].map(i=>Qi(i)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Qi(e)}\`.
124
+ Please rename it to one of: ${r}.`)},hb=new Set(["utf8","utf16le"]),be=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),Xs=new Set([...hb,...be]),yb=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();if(t in Md)return Md[t];if(Xs.has(t))return t},Md={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Qi=e=>typeof e=="string"?`"${e}"`:String(e);p();import{statSync as gb}from"fs";import fb from"path";import _b from"process";var Gd=(e=Ud())=>{let t=Ot(e,'The "cwd" option');return fb.resolve(t)},Ud=()=>{try{return _b.cwd()}catch(e){throw e.message=`The current directory does not exist.
125
+ ${e.message}`,e}},Nd=(e,t)=>{if(t===Ud())return e;let r;try{r=gb(t)}catch(i){return`The "cwd" option is invalid: ${t}.
126
126
  ${i.message}
127
127
  ${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
128
- ${e}`};var Hi=(e,t,r)=>{r.cwd=Td(r.cwd);let[i,n,s]=Ad(e,t,r),{command:a,args:o,options:p}=Dd.default._parse(i,n,s),d=kp(p),c=Z_(d);return wd(c),Cd(c),Ed(c),Nc(c),kd(c),c.shell=gs(c.shell),c.env=Q_(c),c.killSignal=zc(c.killSignal),c.forceKillAfterDelay=Gc(c.forceKillAfterDelay),c.lines=c.lines.map((u,l)=>u&&!fe.has(c.encoding)&&c.buffer[l]),Od.platform==="win32"&&X_.basename(a,".exe")==="cmd"&&o.unshift("/q"),{file:a,commandArguments:o,options:c}},Z_=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:i=r,encoding:n="utf8",reject:s=!0,cleanup:a=!0,all:o=!1,windowsHide:p=!0,killSignal:d="SIGTERM",forceKillAfterDelay:c=!0,gracefulCancel:u=!1,ipcInput:l,ipc:m=l!==void 0||u,serialization:h="advanced",...f})=>({...f,extendEnv:e,preferLocal:t,cwd:r,localDirectory:i,encoding:n,reject:s,cleanup:a,all:o,windowsHide:p,killSignal:d,forceKillAfterDelay:c,gracefulCancel:u,ipcInput:l,ipc:m,serialization:h}),Q_=({env:e,extendEnv:t,preferLocal:r,node:i,localDirectory:n,nodePath:s})=>{let a=t?{...Od.env,...e}:e;return r||i?Ec({env:a,cwd:n,execPath:s,preferLocal:r,addExecPath:i}):a};var Vi=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as Rb}from"util";function Mt(e){if(typeof e=="string")return eb(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return tb(e)}var eb=e=>e.at(-1)===Ld?e.slice(0,e.at(-2)===Bd?-2:-1):e,tb=e=>e.at(-1)===rb?e.subarray(0,e.at(-2)===ib?-2:-1):e,Ld=`
129
- `,rb=Ld.codePointAt(0),Bd="\r",ib=Bd.codePointAt(0);import{on as Pb}from"events";import{finished as jb}from"stream/promises";function je(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe=="function"}function Hs(e,{checkOpen:t=!0}={}){return je(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function vt(e,{checkOpen:t=!0}={}){return je(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function Vs(e,t){return Hs(e,t)&&vt(e,t)}var nb=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),Ws=class{#t;#r;#e=!1;#i=void 0;constructor(t,r){this.#t=t,this.#r=r}next(){let t=()=>this.#s();return this.#i=this.#i?this.#i.then(t,t):t(),this.#i}return(t){let r=()=>this.#n(t);return this.#i?this.#i.then(r,r):r()}async#s(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){throw this.#i=void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#i=void 0,this.#e=!0,this.#t.releaseLock()),t}async#n(t){if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},Ks=Symbol();function zd(){return this[Ks].next()}Object.defineProperty(zd,"name",{value:"next"});function Md(e){return this[Ks].return(e)}Object.defineProperty(Md,"name",{value:"return"});var sb=Object.create(nb,{next:{enumerable:!0,configurable:!0,writable:!0,value:zd},return:{enumerable:!0,configurable:!0,writable:!0,value:Md}});function Ys({preventCancel:e=!1}={}){let t=this.getReader(),r=new Ws(t,e),i=Object.create(sb);return i[Ks]=r,i}var Fd=e=>{if(vt(e,{checkOpen:!1})&&_r.on!==void 0)return ob(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;if(ab.call(e)==="[object ReadableStream]")return Ys.call(e);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ab}=Object.prototype,ob=async function*(e){let t=new AbortController,r={};pb(e,t,r);try{for await(let[i]of _r.on(e,"data",{signal:t.signal}))yield i}catch(i){if(r.error!==void 0)throw r.error;if(!t.signal.aborted)throw i}finally{e.destroy()}},pb=async(e,t,r)=>{try{await _r.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(i){r.error=i}finally{t.abort()}},_r={};var Ft=async(e,{init:t,convertChunk:r,getSize:i,truncateChunk:n,addChunk:s,getFinalChunk:a,finalize:o},{maxBuffer:p=Number.POSITIVE_INFINITY}={})=>{let d=Fd(e),c=t();c.length=0;try{for await(let u of d){let l=db(u),m=r[l](u,c);Nd({convertedChunk:m,state:c,getSize:i,truncateChunk:n,addChunk:s,maxBuffer:p})}return cb({state:c,convertChunk:r,getSize:i,truncateChunk:n,addChunk:s,getFinalChunk:a,maxBuffer:p}),o(c)}catch(u){let l=typeof u=="object"&&u!==null?u:new Error(u);throw l.bufferedData=o(c),l}},cb=({state:e,getSize:t,truncateChunk:r,addChunk:i,getFinalChunk:n,maxBuffer:s})=>{let a=n(e);a!==void 0&&Nd({convertedChunk:a,state:e,getSize:t,truncateChunk:r,addChunk:i,maxBuffer:s})},Nd=({convertedChunk:e,state:t,getSize:r,truncateChunk:i,addChunk:n,maxBuffer:s})=>{let a=r(e),o=t.length+a;if(o<=s){Gd(e,t,n,o);return}let p=i(e,s-t.length);throw p!==void 0&&Gd(p,t,n,s),new ze},Gd=(e,t,r,i)=>{t.contents=r(e,t,i),t.length=i},db=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=Ud.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Ud.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Ud}=Object.prototype,ze=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};var Qe=e=>e,br=()=>{},Wi=({contents:e})=>e,Ki=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},Yi=e=>e.length;async function Ji(e,t){return Ft(e,hb,t)}var ub=()=>({contents:[]}),lb=()=>1,mb=(e,{contents:t})=>(t.push(e),t),hb={init:ub,convertChunk:{string:Qe,buffer:Qe,arrayBuffer:Qe,dataView:Qe,typedArray:Qe,others:Qe},getSize:lb,truncateChunk:br,addChunk:mb,getFinalChunk:br,finalize:Wi};async function Xi(e,t){return Ft(e,wb,t)}var yb=()=>({contents:new ArrayBuffer(0)}),gb=e=>fb.encode(e),fb=new TextEncoder,Hd=e=>new Uint8Array(e),Vd=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),_b=(e,t)=>e.slice(0,t),bb=(e,{contents:t,length:r},i)=>{let n=Yd()?kb(t,i):qb(t,i);return new Uint8Array(n).set(e,r),n},qb=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(Kd(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},kb=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:Kd(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},Kd=e=>Wd**Math.ceil(Math.log(e)/Math.log(Wd)),Wd=2,vb=({contents:e,length:t})=>Yd()?e:e.slice(0,t),Yd=()=>"resize"in ArrayBuffer.prototype,wb={init:yb,convertChunk:{string:gb,buffer:Hd,arrayBuffer:Hd,dataView:Vd,typedArray:Vd,others:Ki},getSize:Yi,truncateChunk:_b,addChunk:bb,getFinalChunk:br,finalize:vb};async function Qi(e,t){return Ft(e,Eb,t)}var xb=()=>({contents:"",textDecoder:new TextDecoder}),Zi=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Sb=(e,{contents:t})=>t+e,$b=(e,t)=>e.slice(0,t),Ab=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},Eb={init:xb,convertChunk:{string:Qe,buffer:Zi,arrayBuffer:Zi,dataView:Zi,typedArray:Zi,others:Ki},getSize:Yi,truncateChunk:$b,addChunk:Sb,getFinalChunk:Ab,finalize:Wi};Object.assign(_r,{on:Pb,finished:jb});var Jd=({error:e,stream:t,readableObjectMode:r,lines:i,encoding:n,fdNumber:s})=>{if(!(e instanceof ze))throw e;if(s==="all")return e;let a=Cb(r,i,n);throw e.maxBufferInfo={fdNumber:s,unit:a},t.destroy(),e},Cb=(e,t,r)=>e?"objects":t?"lines":r==="buffer"?"bytes":"characters",Xd=(e,t,r)=>{if(t.length!==r)return;let i=new ze;throw i.maxBufferInfo={fdNumber:"ipc"},i},Zd=(e,t)=>{let{streamName:r,threshold:i,unit:n}=Tb(e,t);return`Command's ${r} was larger than ${i} ${n}`},Tb=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:i}}=e;delete e.maxBufferInfo;let n=Ze(t,r);return r==="ipc"?{streamName:"IPC output",threshold:n,unit:"messages"}:{streamName:gi(r),threshold:n,unit:i}},Qd=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(i=>i!==null&&i.length>en(r)),eu=(e,t,r)=>{if(!t)return e;let i=en(r);return e.length>i?e.slice(0,i):e},en=([,e])=>e;var ru=({stdio:e,all:t,ipcOutput:r,originalError:i,signal:n,signalDescription:s,exitCode:a,escapedCommand:o,timedOut:p,isCanceled:d,isGracefullyCanceled:c,isMaxBuffer:u,isForcefullyTerminated:l,forceKillAfterDelay:m,killSignal:h,maxBuffer:f,timeout:w,cwd:v})=>{let x=i?.code,_=Ib({originalError:i,timedOut:p,timeout:w,isMaxBuffer:u,maxBuffer:f,errorCode:x,signal:n,signalDescription:s,exitCode:a,isCanceled:d,isGracefullyCanceled:c,isForcefullyTerminated:l,forceKillAfterDelay:m,killSignal:h}),T=Db(i,v),S=T===void 0?"":`
130
- ${T}`,F=`${_}: ${o}${S}`,O=t===void 0?[e[2],e[1]]:[t],B=[F,...O,...e.slice(3),r.map(U=>Lb(U)).join(`
131
- `)].map(U=>lr(Mt(Bb(U)))).filter(Boolean).join(`
132
-
133
- `);return{originalMessage:T,shortMessage:F,message:B}},Ib=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:i,maxBuffer:n,errorCode:s,signal:a,signalDescription:o,exitCode:p,isCanceled:d,isGracefullyCanceled:c,isForcefullyTerminated:u,forceKillAfterDelay:l,killSignal:m})=>{let h=Ob(u,l);return t?`Command timed out after ${r} milliseconds${h}`:c?a===void 0?`Command was gracefully canceled with exit code ${p}`:u?`Command was gracefully canceled${h}`:`Command was gracefully canceled with ${a} (${o})`:d?`Command was canceled${h}`:i?`${Zd(e,n)}${h}`:s!==void 0?`Command failed with ${s}${h}`:u?`Command was killed with ${m} (${ji(m)})${h}`:a!==void 0?`Command was killed with ${a} (${o})`:p!==void 0?`Command failed with exit code ${p}`:"Command failed"},Ob=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",Db=(e,t)=>{if(e instanceof Ee)return;let r=Cc(e)?e.originalMessage:String(e?.message??e),i=lr(Id(r,t));return i===""?void 0:i},Lb=e=>typeof e=="string"?e:Rb(e),Bb=e=>Array.isArray(e)?e.map(t=>Mt(tu(t))).filter(Boolean).join(`
134
- `):tu(e),tu=e=>typeof e=="string"?e:ee(e)?hi(e):"";var tn=({command:e,escapedCommand:t,stdio:r,all:i,ipcOutput:n,options:{cwd:s},startTime:a})=>iu({command:e,escapedCommand:t,cwd:s,durationMs:xs(a),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:i,stdio:r,ipcOutput:n,pipedFrom:[]}),Gt=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,isSync:a})=>qr({error:e,command:t,escapedCommand:r,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:i.length}),ipcOutput:[],options:n,isSync:a}),qr=({error:e,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:o,isForcefullyTerminated:p,exitCode:d,signal:c,stdio:u,all:l,ipcOutput:m,options:{timeoutDuration:h,timeout:f=h,forceKillAfterDelay:w,killSignal:v,cwd:x,maxBuffer:_},isSync:T})=>{let{exitCode:S,signal:F,signalDescription:O}=Mb(d,c),{originalMessage:B,shortMessage:U,message:W}=ru({stdio:u,all:l,ipcOutput:m,originalError:e,signal:F,signalDescription:O,exitCode:S,escapedCommand:r,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:o,isForcefullyTerminated:p,forceKillAfterDelay:w,killSignal:v,maxBuffer:_,timeout:f,cwd:x}),$=Pc(e,W,T);return Object.assign($,zb({error:$,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:o,isForcefullyTerminated:p,exitCode:S,signal:F,signalDescription:O,stdio:u,all:l,ipcOutput:m,cwd:x,originalMessage:B,shortMessage:U})),$},zb=({error:e,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:o,isForcefullyTerminated:p,exitCode:d,signal:c,signalDescription:u,stdio:l,all:m,ipcOutput:h,cwd:f,originalMessage:w,shortMessage:v})=>iu({shortMessage:v,originalMessage:w,command:t,escapedCommand:r,cwd:f,durationMs:xs(i),failed:!0,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isTerminated:c!==void 0,isMaxBuffer:o,isForcefullyTerminated:p,exitCode:d,signal:c,signalDescription:u,code:e.cause?.code,stdout:l[1],stderr:l[2],all:m,stdio:l,ipcOutput:h,pipedFrom:[]}),iu=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),Mb=(e,t)=>{let r=e===null?void 0:e,i=t===null?void 0:t,n=i===void 0?void 0:ji(t);return{exitCode:r,signal:i,signalDescription:n}};var nu=e=>Number.isFinite(e)?e:0;function Fb(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(nu(e*1e3)%1e3),nanoseconds:Math.trunc(nu(e*1e6)%1e3)}}function Gb(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function Js(e){switch(typeof e){case"number":{if(Number.isFinite(e))return Fb(e);break}case"bigint":return Gb(e)}throw new TypeError("Expected a finite number or bigint")}var Ub=e=>e===0||e===0n,Nb=(e,t)=>t===1||t===1n?e:`${e}s`,Hb=1e-7,Vb=24n*60n*60n*1000n;function Xs(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let i=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let n=[],s=(c,u)=>{let l=Math.floor(c*10**u+Hb);return(Math.round(l)/10**u).toFixed(u)},a=(c,u,l,m)=>{if(!((n.length===0||!t.colonNotation)&&Ub(c)&&!(t.colonNotation&&l==="m"))){if(m??=String(c),t.colonNotation){let h=m.includes(".")?m.split(".")[0].length:m.length,f=n.length>0?2:1;m="0".repeat(Math.max(0,f-h))+m}else m+=t.verbose?" "+Nb(u,c):l;n.push(m)}},o=Js(e),p=BigInt(o.days);if(t.hideYearAndDays?a(BigInt(p)*24n+BigInt(o.hours),"hour","h"):(t.hideYear?a(p,"day","d"):(a(p/365n,"year","y"),a(p%365n,"day","d")),a(Number(o.hours),"hour","h")),a(Number(o.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let c=Number(o.seconds),u=Number(o.milliseconds),l=Number(o.microseconds),m=Number(o.nanoseconds);if(a(c,"second","s"),t.formatSubMilliseconds)a(u,"millisecond","ms"),a(l,"microsecond","\xB5s"),a(m,"nanosecond","ns");else{let h=u+l/1e3+m/1e6,f=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,w=h>=1?Math.round(h):Math.ceil(h),v=f?h.toFixed(f):w;a(Number.parseFloat(v),"millisecond","ms",v)}}else{let c=(r?Number(e%Vb):e)/1e3%60,u=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,l=s(c,u),m=t.keepDecimalsOnWholeSeconds?l:l.replace(/\.0+$/,"");a(Number.parseFloat(m),"second","s",m)}if(n.length===0)return i+"0"+(t.verbose?" milliseconds":"ms");let d=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(n=n.slice(0,Math.max(t.unitCount,1))),i+n.join(d)}var su=(e,t)=>{e.failed&&De({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var au=(e,t)=>{Rt(t)&&(su(e,t),Wb(e,t))},Wb=(e,t)=>{let r=`(done in ${Xs(e.durationMs)})`;De({type:"duration",verboseMessage:r,verboseInfo:t,result:e})};var Ut=(e,t,{reject:r})=>{if(au(e,t),e.failed&&r)throw e;return e};import{readFileSync as Ru}from"fs";var cu=(e,t)=>wt(e)?"asyncGenerator":lu(e)?"generator":rn(e)?"fileUrl":Zb(e)?"filePath":tq(e)?"webStream":je(e,{checkOpen:!1})?"native":ee(e)?"uint8Array":rq(e)?"asyncIterable":iq(e)?"iterable":ea(e)?du({transform:e},t):Xb(e)?Kb(e,t):"native",Kb=(e,t)=>Vs(e.transform,{checkOpen:!1})?Yb(e,t):ea(e.transform)?du(e,t):Jb(e,t),Yb=(e,t)=>(uu(e,t,"Duplex stream"),"duplex"),du=(e,t)=>(uu(e,t,"web TransformStream"),"webTransform"),uu=({final:e,binary:t,objectMode:r},i,n)=>{ou(e,`${i}.final`,n),ou(t,`${i}.binary`,n),Zs(r,`${i}.objectMode`)},ou=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${r}.`)},Jb=({transform:e,final:t,binary:r,objectMode:i},n)=>{if(e!==void 0&&!pu(e))throw new TypeError(`The \`${n}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(Vs(t,{checkOpen:!1}))throw new TypeError(`The \`${n}.final\` option must not be a Duplex stream.`);if(ea(t))throw new TypeError(`The \`${n}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!pu(t))throw new TypeError(`The \`${n}.final\` option must be a generator.`);return Zs(r,`${n}.binary`),Zs(i,`${n}.objectMode`),wt(e)||wt(t)?"asyncGenerator":"generator"},Zs=(e,t)=>{if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},pu=e=>wt(e)||lu(e),wt=e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",lu=e=>Object.prototype.toString.call(e)==="[object GeneratorFunction]",Xb=e=>Y(e)&&(e.transform!==void 0||e.final!==void 0),rn=e=>Object.prototype.toString.call(e)==="[object URL]",mu=e=>rn(e)&&e.protocol!=="file:",Zb=e=>Y(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>Qb.has(t))&&Qs(e.file),Qb=new Set(["file","append"]),Qs=e=>typeof e=="string",hu=(e,t)=>e==="native"&&typeof t=="string"&&!eq.has(t),eq=new Set(["ipc","ignore","inherit","overlapped","pipe"]),yu=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",nn=e=>Object.prototype.toString.call(e)==="[object WritableStream]",tq=e=>yu(e)||nn(e),ea=e=>yu(e?.readable)&&nn(e?.writable),rq=e=>gu(e)&&typeof e[Symbol.asyncIterator]=="function",iq=e=>gu(e)&&typeof e[Symbol.iterator]=="function",gu=e=>typeof e=="object"&&e!==null,xe=new Set(["generator","asyncGenerator","duplex","webTransform"]),sn=new Set(["fileUrl","filePath","fileNumber"]),ta=new Set(["fileUrl","filePath"]),fu=new Set([...ta,"webStream","nodeStream"]),_u=new Set(["webTransform","duplex"]),ct={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var ra=(e,t,r,i)=>i==="output"?nq(e,t,r):sq(e,t,r),nq=(e,t,r)=>{let i=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:i,readableObjectMode:e??i}},sq=(e,t,r)=>{let i=t===0?e===!0:r[t-1].value.readableObjectMode,n=t!==r.length-1&&(e??i);return{writableObjectMode:i,readableObjectMode:n}},bu=(e,t)=>{let r=e.findLast(({type:i})=>xe.has(i));return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode};var qu=(e,t,r,i)=>[...e.filter(({type:n})=>!xe.has(n)),...aq(e,t,r,i)],aq=(e,t,r,{encoding:i})=>{let n=e.filter(({type:a})=>xe.has(a)),s=Array.from({length:n.length});for(let[a,o]of Object.entries(n))s[a]=oq({stdioItem:o,index:Number(a),newTransforms:s,optionName:t,direction:r,encoding:i});return uq(s,r)},oq=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:i,optionName:n,direction:s,encoding:a})=>t==="duplex"?pq({stdioItem:e,optionName:n}):t==="webTransform"?cq({stdioItem:e,index:r,newTransforms:i,direction:s}):dq({stdioItem:e,index:r,newTransforms:i,direction:s,encoding:a}),pq=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:i},objectMode:n=i}},optionName:s})=>{if(n&&!i)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!n&&i)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:i}}},cq=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:i,direction:n})=>{let{transform:s,objectMode:a}=Y(t)?t:{transform:t},{writableObjectMode:o,readableObjectMode:p}=ra(a,r,i,n);return{...e,value:{transform:s,writableObjectMode:o,readableObjectMode:p}}},dq=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:i,direction:n,encoding:s})=>{let{transform:a,final:o,binary:p=!1,preserveNewlines:d=!1,objectMode:c}=Y(t)?t:{transform:t},u=p||fe.has(s),{writableObjectMode:l,readableObjectMode:m}=ra(c,r,i,n);return{...e,value:{transform:a,final:o,binary:u,preserveNewlines:d,writableObjectMode:l,readableObjectMode:m}}},uq=(e,t)=>t==="input"?e.reverse():e;import ia from"process";var ku=(e,t,r)=>{let i=e.map(n=>lq(n,t));if(i.includes("input")&&i.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return i.find(Boolean)??yq},lq=({type:e,value:t},r)=>mq[r]??vu[e](t),mq=["input","output","output"],Nt=()=>{},na=()=>"input",vu={generator:Nt,asyncGenerator:Nt,fileUrl:Nt,filePath:Nt,iterable:na,asyncIterable:na,uint8Array:na,webStream:e=>nn(e)?"output":"input",nodeStream(e){return vt(e,{checkOpen:!1})?Hs(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:Nt,duplex:Nt,native(e){let t=hq(e);if(t!==void 0)return t;if(je(e,{checkOpen:!1}))return vu.nodeStream(e)}},hq=e=>{if([0,ia.stdin].includes(e))return"input";if([1,2,ia.stdout,ia.stderr].includes(e))return"output"},yq="output";var wu=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var xu=({stdio:e,ipc:t,buffer:r,...i},n,s)=>{let a=gq(e,i).map((o,p)=>Su(o,p));return s?_q(a,r,n):wu(a,t)},gq=(e,t)=>{if(e===void 0)return we.map(i=>t[i]);if(fq(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${we.map(i=>`\`${i}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,we.length);return Array.from({length:r},(i,n)=>e[n])},fq=e=>we.some(t=>e[t]!==void 0),Su=(e,t)=>Array.isArray(e)?e.map(r=>Su(r,t)):e??(t>=we.length?"ignore":"pipe"),_q=(e,t,r)=>e.map((i,n)=>!t[n]&&n!==0&&!It(r,n)&&bq(i)?"ignore":i),bq=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe");import{readFileSync as qq}from"fs";import kq from"tty";var Au=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:i,direction:n,isSync:s})=>!r||t!=="native"?e:s?vq({stdioItem:e,fdNumber:i,direction:n}):Sq({stdioItem:e,fdNumber:i}),vq=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:i,direction:n})=>{let s=wq({value:t,optionName:r,fdNumber:i,direction:n});if(s!==void 0)return s;if(je(t,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},wq=({value:e,optionName:t,fdNumber:r,direction:i})=>{let n=xq(e,r);if(n!==void 0){if(i==="output")return{type:"fileNumber",value:n,optionName:t};if(kq.isatty(n))throw new TypeError(`The \`${t}: ${Ri(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Xe(qq(n)),optionName:t}}},xq=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")return e;let r=yi.indexOf(e);if(r!==-1)return r},Sq=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:i})=>t==="inherit"?{type:"nodeStream",value:$u(i,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:$u(t,t,r),optionName:r}:je(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,$u=(e,t,r)=>{let i=yi[e];if(i===void 0)throw new TypeError(`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return i};var Eu=({input:e,inputFile:t},r)=>r===0?[...$q(e),...Eq(t)]:[],$q=e=>e===void 0?[]:[{type:Aq(e),value:e,optionName:"input"}],Aq=e=>{if(vt(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(ee(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Eq=e=>e===void 0?[]:[{...Pq(e),optionName:"inputFile"}],Pq=e=>{if(rn(e))return{type:"fileUrl",value:e};if(Qs(e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};var Pu=e=>e.filter((t,r)=>e.every((i,n)=>t.value!==i.value||r>=n||t.type==="generator"||t.type==="asyncGenerator")),ju=({stdioItem:{type:e,value:t,optionName:r},direction:i,fileDescriptors:n,isSync:s})=>{let a=jq(n,e);if(a.length!==0){if(s){Cq({otherStdioItems:a,type:e,value:t,optionName:r,direction:i});return}if(fu.has(e))return Cu({otherStdioItems:a,type:e,value:t,optionName:r,direction:i});_u.has(e)&&Rq({otherStdioItems:a,type:e,value:t,optionName:r})}},jq=(e,t)=>e.flatMap(({direction:r,stdioItems:i})=>i.filter(n=>n.type===t).map((n=>({...n,direction:r})))),Cq=({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})=>{ta.has(t)&&Cu({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})},Cu=({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})=>{let s=e.filter(o=>Tq(o,r));if(s.length===0)return;let a=s.find(o=>o.direction!==n);return Tu(a,i,t),n==="output"?s[0].stream:void 0},Tq=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUrl"?t.href===r.href:t===r,Rq=({otherStdioItems:e,type:t,value:r,optionName:i})=>{let n=e.find(({value:{transform:s}})=>s===r.transform);Tu(n,i,t)},Tu=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${ct[r]} that is the same.`)};var an=(e,t,r,i)=>{let s=xu(t,r,i).map((o,p)=>Iq({stdioOption:o,fdNumber:p,options:t,isSync:i})),a=Gq({initialFileDescriptors:s,addProperties:e,options:t,isSync:i});return t.stdio=a.map(({stdioItems:o})=>Hq(o)),a},Iq=({stdioOption:e,fdNumber:t,options:r,isSync:i})=>{let n=gi(t),{stdioItems:s,isStdioArray:a}=Oq({stdioOption:e,fdNumber:t,options:r,optionName:n}),o=ku(s,t,n),p=s.map(u=>Au({stdioItem:u,isStdioArray:a,fdNumber:t,direction:o,isSync:i})),d=qu(p,n,o,r),c=bu(d,o);return Fq(d,c),{direction:o,objectMode:c,stdioItems:d}},Oq=({stdioOption:e,fdNumber:t,options:r,optionName:i})=>{let s=[...(Array.isArray(e)?e:[e]).map(p=>Dq(p,i)),...Eu(r,t)],a=Pu(s),o=a.length>1;return Lq(a,o,i),zq(a),{stdioItems:a,isStdioArray:o}},Dq=(e,t)=>({type:cu(e,t),value:e,optionName:t}),Lq=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:i,optionName:n}of e)if(Bq.has(i))throw new Error(`The \`${n}\` option must not include \`${i}\`.`)}},Bq=new Set(["ignore","ipc"]),zq=e=>{for(let t of e)Mq(t)},Mq=({type:e,value:t,optionName:r})=>{if(mu(t))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme.
135
- For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(hu(e,t))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Fq=(e,t)=>{if(!t)return;let r=e.find(({type:i})=>sn.has(i));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Gq=({initialFileDescriptors:e,addProperties:t,options:r,isSync:i})=>{let n=[];try{for(let s of e)n.push(Uq({fileDescriptor:s,fileDescriptors:n,addProperties:t,options:r,isSync:i}));return n}catch(s){throw sa(n),s}},Uq=({fileDescriptor:{direction:e,objectMode:t,stdioItems:r},fileDescriptors:i,addProperties:n,options:s,isSync:a})=>{let o=r.map(p=>Nq({stdioItem:p,addProperties:n,direction:e,options:s,fileDescriptors:i,isSync:a}));return{direction:e,objectMode:t,stdioItems:o}},Nq=({stdioItem:e,addProperties:t,direction:r,options:i,fileDescriptors:n,isSync:s})=>{let a=ju({stdioItem:e,direction:r,fileDescriptors:n,isSync:s});return a!==void 0?{...e,stream:a}:{...e,...t[r][e.type](e,i)}},sa=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!Ae(r)&&r.destroy()},Hq=e=>{if(e.length>1)return e.some(({value:i})=>i==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;return t==="native"?r:"pipe"};var Ou=(e,t)=>an(Wq,e,t,!0),Me=({type:e,optionName:t})=>{Du(t,ct[e])},Vq=({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&Du(e,`"${t}"`),{}),Du=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},Iu={generator(){},asyncGenerator:Me,webStream:Me,nodeStream:Me,webTransform:Me,duplex:Me,asyncIterable:Me,native:Vq},Wq={input:{...Iu,fileUrl:({value:e})=>({contents:[Xe(Ru(e))]}),filePath:({value:{file:e}})=>({contents:[Xe(Ru(e))]}),fileNumber:Me,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...Iu,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Me,string:Me,uint8Array:Me}};var et=(e,{stripFinalNewline:t},r)=>aa(t,r)&&e!==void 0&&!Array.isArray(e)?Mt(e):e,aa=(e,t)=>t==="all"?e[1]||e[2]:e[t];import{Transform as hk,getDefaultHighWaterMark as Wu}from"stream";var on=(e,t,r,i)=>e||r?void 0:Bu(t,i),pa=(e,t,r)=>r?e.flatMap(i=>Lu(i,t)):Lu(e,t),Lu=(e,t)=>{let{transform:r,final:i}=Bu(t,{});return[...r(e),...i()]},Bu=(e,t)=>(t.previousChunks="",{transform:Kq.bind(void 0,t,e),final:Jq.bind(void 0,t)}),Kq=function*(e,t,r){if(typeof r!="string"){yield r;return}let{previousChunks:i}=e,n=-1;for(let s=0;s<r.length;s+=1)if(r[s]===`
136
- `){let a=Yq(r,s,t,e),o=r.slice(n+1,s+1-a);i.length>0&&(o=oa(i,o),i=""),yield o,n=s}n!==r.length-1&&(i=oa(i,r.slice(n+1))),e.previousChunks=i},Yq=(e,t,r,i)=>r?0:(i.isWindowsNewline=t!==0&&e[t-1]==="\r",i.isWindowsNewline?2:1),Jq=function*({previousChunks:e}){e.length>0&&(yield e)},zu=({binary:e,preserveNewlines:t,readableObjectMode:r,state:i})=>e||t||r?void 0:{transform:Xq.bind(void 0,i)},Xq=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:i,LF:n,concatBytes:s}=typeof t=="string"?Zq:ek;if(t.at(-1)===n){yield t;return}yield s(t,e?i:r)},oa=(e,t)=>`${e}${t}`,Zq={windowsNewline:`\r
128
+ ${e}`};var en=(e,t,r)=>{r.cwd=Gd(r.cwd);let[i,n,s]=Ld(e,t,r),{command:a,args:o,options:c}=Hd.default._parse(i,n,s),u=Cp(c),d=qb(u);return Rd(d),Fd(d),Bd(d),ed(d),Cd(d),d.shell=ws(d.shell),d.env=kb(d),d.killSignal=Yc(d.killSignal),d.forceKillAfterDelay=Zc(d.forceKillAfterDelay),d.lines=d.lines.map((l,h)=>l&&!be.has(d.encoding)&&d.buffer[h]),Vd.platform==="win32"&&bb.basename(a,".exe")==="cmd"&&o.unshift("/q"),{file:a,commandArguments:o,options:d}},qb=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:i=r,encoding:n="utf8",reject:s=!0,cleanup:a=!0,all:o=!1,windowsHide:c=!0,killSignal:u="SIGTERM",forceKillAfterDelay:d=!0,gracefulCancel:l=!1,ipcInput:h,ipc:y=h!==void 0||l,serialization:g="advanced",...b})=>({...b,extendEnv:e,preferLocal:t,cwd:r,localDirectory:i,encoding:n,reject:s,cleanup:a,all:o,windowsHide:c,killSignal:u,forceKillAfterDelay:d,gracefulCancel:l,ipcInput:h,ipc:y,serialization:g}),kb=({env:e,extendEnv:t,preferLocal:r,node:i,localDirectory:n,nodePath:s})=>{let a=t?{...Vd.env,...e}:e;return r||i?Bc({env:a,cwd:n,execPath:s,preferLocal:r,addExecPath:i}):a};p();var tn=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];p();p();import{inspect as tq}from"util";p();function Ut(e){if(typeof e=="string")return vb(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return wb(e)}var vb=e=>e.at(-1)===Wd?e.slice(0,e.at(-2)===Kd?-2:-1):e,wb=e=>e.at(-1)===xb?e.subarray(0,e.at(-2)===Sb?-2:-1):e,Wd=`
129
+ `,xb=Wd.codePointAt(0),Kd="\r",Sb=Kd.codePointAt(0);p();p();import{on as Xb}from"events";import{finished as Zb}from"stream/promises";p();p();function Re(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe=="function"}function Zs(e,{checkOpen:t=!0}={}){return Re(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function St(e,{checkOpen:t=!0}={}){return Re(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function Qs(e,t){return Zs(e,t)&&St(e,t)}p();p();var $b=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),ea=class{#t;#r;#e=!1;#i=void 0;constructor(t,r){this.#t=t,this.#r=r}next(){let t=()=>this.#s();return this.#i=this.#i?this.#i.then(t,t):t(),this.#i}return(t){let r=()=>this.#n(t);return this.#i?this.#i.then(r,r):r()}async#s(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){throw this.#i=void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#i=void 0,this.#e=!0,this.#t.releaseLock()),t}async#n(t){if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},ta=Symbol();function Yd(){return this[ta].next()}Object.defineProperty(Yd,"name",{value:"next"});function Jd(e){return this[ta].return(e)}Object.defineProperty(Jd,"name",{value:"return"});var Ab=Object.create($b,{next:{enumerable:!0,configurable:!0,writable:!0,value:Yd},return:{enumerable:!0,configurable:!0,writable:!0,value:Jd}});function ra({preventCancel:e=!1}={}){let t=this.getReader(),r=new ea(t,e),i=Object.create(Ab);return i[ta]=r,i}p();var Xd=e=>{if(St(e,{checkOpen:!1})&&Sr.on!==void 0)return Pb(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;if(Eb.call(e)==="[object ReadableStream]")return ra.call(e);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Eb}=Object.prototype,Pb=async function*(e){let t=new AbortController,r={};jb(e,t,r);try{for await(let[i]of Sr.on(e,"data",{signal:t.signal}))yield i}catch(i){if(r.error!==void 0)throw r.error;if(!t.signal.aborted)throw i}finally{e.destroy()}},jb=async(e,t,r)=>{try{await Sr.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(i){r.error=i}finally{t.abort()}},Sr={};p();p();p();var Nt=async(e,{init:t,convertChunk:r,getSize:i,truncateChunk:n,addChunk:s,getFinalChunk:a,finalize:o},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let u=Xd(e),d=t();d.length=0;try{for await(let l of u){let h=Tb(l),y=r[h](l,d);eu({convertedChunk:y,state:d,getSize:i,truncateChunk:n,addChunk:s,maxBuffer:c})}return Cb({state:d,convertChunk:r,getSize:i,truncateChunk:n,addChunk:s,getFinalChunk:a,maxBuffer:c}),o(d)}catch(l){let h=typeof l=="object"&&l!==null?l:new Error(l);throw h.bufferedData=o(d),h}},Cb=({state:e,getSize:t,truncateChunk:r,addChunk:i,getFinalChunk:n,maxBuffer:s})=>{let a=n(e);a!==void 0&&eu({convertedChunk:a,state:e,getSize:t,truncateChunk:r,addChunk:i,maxBuffer:s})},eu=({convertedChunk:e,state:t,getSize:r,truncateChunk:i,addChunk:n,maxBuffer:s})=>{let a=r(e),o=t.length+a;if(o<=s){Zd(e,t,n,o);return}let c=i(e,s-t.length);throw c!==void 0&&Zd(c,t,n,s),new Ge},Zd=(e,t,r,i)=>{t.contents=r(e,t,i),t.length=i},Tb=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=Qd.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Qd.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Qd}=Object.prototype,Ge=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};p();var rt=e=>e,$r=()=>{},rn=({contents:e})=>e,nn=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},sn=e=>e.length;async function an(e,t){return Nt(e,Db,t)}var Rb=()=>({contents:[]}),Ib=()=>1,Ob=(e,{contents:t})=>(t.push(e),t),Db={init:Rb,convertChunk:{string:rt,buffer:rt,arrayBuffer:rt,dataView:rt,typedArray:rt,others:rt},getSize:Ib,truncateChunk:$r,addChunk:Ob,getFinalChunk:$r,finalize:rn};p();async function on(e,t){return Nt(e,Vb,t)}var Lb=()=>({contents:new ArrayBuffer(0)}),Bb=e=>zb.encode(e),zb=new TextEncoder,tu=e=>new Uint8Array(e),ru=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Mb=(e,t)=>e.slice(0,t),Fb=(e,{contents:t,length:r},i)=>{let n=su()?Ub(t,i):Gb(t,i);return new Uint8Array(n).set(e,r),n},Gb=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(nu(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},Ub=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:nu(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},nu=e=>iu**Math.ceil(Math.log(e)/Math.log(iu)),iu=2,Nb=({contents:e,length:t})=>su()?e:e.slice(0,t),su=()=>"resize"in ArrayBuffer.prototype,Vb={init:Lb,convertChunk:{string:Bb,buffer:tu,arrayBuffer:tu,dataView:ru,typedArray:ru,others:nn},getSize:sn,truncateChunk:Mb,addChunk:Fb,getFinalChunk:$r,finalize:Nb};p();async function cn(e,t){return Nt(e,Jb,t)}var Hb=()=>({contents:"",textDecoder:new TextDecoder}),pn=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Wb=(e,{contents:t})=>t+e,Kb=(e,t)=>e.slice(0,t),Yb=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},Jb={init:Hb,convertChunk:{string:rt,buffer:pn,arrayBuffer:pn,dataView:pn,typedArray:pn,others:nn},getSize:sn,truncateChunk:Kb,addChunk:Wb,getFinalChunk:Yb,finalize:rn};Object.assign(Sr,{on:Xb,finished:Zb});var au=({error:e,stream:t,readableObjectMode:r,lines:i,encoding:n,fdNumber:s})=>{if(!(e instanceof Ge))throw e;if(s==="all")return e;let a=Qb(r,i,n);throw e.maxBufferInfo={fdNumber:s,unit:a},t.destroy(),e},Qb=(e,t,r)=>e?"objects":t?"lines":r==="buffer"?"bytes":"characters",ou=(e,t,r)=>{if(t.length!==r)return;let i=new Ge;throw i.maxBufferInfo={fdNumber:"ipc"},i},pu=(e,t)=>{let{streamName:r,threshold:i,unit:n}=eq(e,t);return`Command's ${r} was larger than ${i} ${n}`},eq=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:i}}=e;delete e.maxBufferInfo;let n=tt(t,r);return r==="ipc"?{streamName:"IPC output",threshold:n,unit:"messages"}:{streamName:Si(r),threshold:n,unit:i}},cu=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(i=>i!==null&&i.length>dn(r)),du=(e,t,r)=>{if(!t)return e;let i=dn(r);return e.length>i?e.slice(0,i):e},dn=([,e])=>e;var lu=({stdio:e,all:t,ipcOutput:r,originalError:i,signal:n,signalDescription:s,exitCode:a,escapedCommand:o,timedOut:c,isCanceled:u,isGracefullyCanceled:d,isMaxBuffer:l,isForcefullyTerminated:h,forceKillAfterDelay:y,killSignal:g,maxBuffer:b,timeout:S,cwd:x})=>{let $=i?.code,q=rq({originalError:i,timedOut:c,timeout:S,isMaxBuffer:l,maxBuffer:b,errorCode:$,signal:n,signalDescription:s,exitCode:a,isCanceled:u,isGracefullyCanceled:d,isForcefullyTerminated:h,forceKillAfterDelay:y,killSignal:g}),I=nq(i,x),A=I===void 0?"":`
130
+ ${I}`,U=`${q}: ${o}${A}`,L=t===void 0?[e[2],e[1]]:[t],M=[U,...L,...e.slice(3),r.map(V=>sq(V)).join(`
131
+ `)].map(V=>br(Ut(aq(V)))).filter(Boolean).join(`
132
+
133
+ `);return{originalMessage:I,shortMessage:U,message:M}},rq=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:i,maxBuffer:n,errorCode:s,signal:a,signalDescription:o,exitCode:c,isCanceled:u,isGracefullyCanceled:d,isForcefullyTerminated:l,forceKillAfterDelay:h,killSignal:y})=>{let g=iq(l,h);return t?`Command timed out after ${r} milliseconds${g}`:d?a===void 0?`Command was gracefully canceled with exit code ${c}`:l?`Command was gracefully canceled${g}`:`Command was gracefully canceled with ${a} (${o})`:u?`Command was canceled${g}`:i?`${pu(e,n)}${g}`:s!==void 0?`Command failed with ${s}${g}`:l?`Command was killed with ${y} (${zi(y)})${g}`:a!==void 0?`Command was killed with ${a} (${o})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},iq=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",nq=(e,t)=>{if(e instanceof Ce)return;let r=Fc(e)?e.originalMessage:String(e?.message??e),i=br(Nd(r,t));return i===""?void 0:i},sq=e=>typeof e=="string"?e:tq(e),aq=e=>Array.isArray(e)?e.map(t=>Ut(uu(t))).filter(Boolean).join(`
134
+ `):uu(e),uu=e=>typeof e=="string"?e:re(e)?wi(e):"";var un=({command:e,escapedCommand:t,stdio:r,all:i,ipcOutput:n,options:{cwd:s},startTime:a})=>mu({command:e,escapedCommand:t,cwd:s,durationMs:Cs(a),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:i,stdio:r,ipcOutput:n,pipedFrom:[]}),Vt=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,isSync:a})=>Ar({error:e,command:t,escapedCommand:r,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:i.length}),ipcOutput:[],options:n,isSync:a}),Ar=({error:e,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:o,isForcefullyTerminated:c,exitCode:u,signal:d,stdio:l,all:h,ipcOutput:y,options:{timeoutDuration:g,timeout:b=g,forceKillAfterDelay:S,killSignal:x,cwd:$,maxBuffer:q},isSync:I})=>{let{exitCode:A,signal:U,signalDescription:L}=pq(u,d),{originalMessage:M,shortMessage:V,message:Y}=lu({stdio:l,all:h,ipcOutput:y,originalError:e,signal:U,signalDescription:L,exitCode:A,escapedCommand:r,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:o,isForcefullyTerminated:c,forceKillAfterDelay:S,killSignal:x,maxBuffer:q,timeout:b,cwd:$}),E=zc(e,Y,I);return Object.assign(E,oq({error:E,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:o,isForcefullyTerminated:c,exitCode:A,signal:U,signalDescription:L,stdio:l,all:h,ipcOutput:y,cwd:$,originalMessage:M,shortMessage:V})),E},oq=({error:e,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isMaxBuffer:o,isForcefullyTerminated:c,exitCode:u,signal:d,signalDescription:l,stdio:h,all:y,ipcOutput:g,cwd:b,originalMessage:S,shortMessage:x})=>mu({shortMessage:x,originalMessage:S,command:t,escapedCommand:r,cwd:b,durationMs:Cs(i),failed:!0,timedOut:n,isCanceled:s,isGracefullyCanceled:a,isTerminated:d!==void 0,isMaxBuffer:o,isForcefullyTerminated:c,exitCode:u,signal:d,signalDescription:l,code:e.cause?.code,stdout:h[1],stderr:h[2],all:y,stdio:h,ipcOutput:g,pipedFrom:[]}),mu=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),pq=(e,t)=>{let r=e===null?void 0:e,i=t===null?void 0:t,n=i===void 0?void 0:zi(t);return{exitCode:r,signal:i,signalDescription:n}};p();p();p();p();var hu=e=>Number.isFinite(e)?e:0;function cq(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(hu(e*1e3)%1e3),nanoseconds:Math.trunc(hu(e*1e6)%1e3)}}function dq(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function ia(e){switch(typeof e){case"number":{if(Number.isFinite(e))return cq(e);break}case"bigint":return dq(e)}throw new TypeError("Expected a finite number or bigint")}var uq=e=>e===0||e===0n,lq=(e,t)=>t===1||t===1n?e:`${e}s`,mq=1e-7,hq=24n*60n*60n*1000n;function na(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let i=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let n=[],s=(d,l)=>{let h=Math.floor(d*10**l+mq);return(Math.round(h)/10**l).toFixed(l)},a=(d,l,h,y)=>{if(!((n.length===0||!t.colonNotation)&&uq(d)&&!(t.colonNotation&&h==="m"))){if(y??=String(d),t.colonNotation){let g=y.includes(".")?y.split(".")[0].length:y.length,b=n.length>0?2:1;y="0".repeat(Math.max(0,b-g))+y}else y+=t.verbose?" "+lq(l,d):h;n.push(y)}},o=ia(e),c=BigInt(o.days);if(t.hideYearAndDays?a(BigInt(c)*24n+BigInt(o.hours),"hour","h"):(t.hideYear?a(c,"day","d"):(a(c/365n,"year","y"),a(c%365n,"day","d")),a(Number(o.hours),"hour","h")),a(Number(o.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let d=Number(o.seconds),l=Number(o.milliseconds),h=Number(o.microseconds),y=Number(o.nanoseconds);if(a(d,"second","s"),t.formatSubMilliseconds)a(l,"millisecond","ms"),a(h,"microsecond","\xB5s"),a(y,"nanosecond","ns");else{let g=l+h/1e3+y/1e6,b=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,S=g>=1?Math.round(g):Math.ceil(g),x=b?g.toFixed(b):S;a(Number.parseFloat(x),"millisecond","ms",x)}}else{let d=(r?Number(e%hq):e)/1e3%60,l=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,h=s(d,l),y=t.keepDecimalsOnWholeSeconds?h:h.replace(/\.0+$/,"");a(Number.parseFloat(y),"second","s",y)}if(n.length===0)return i+"0"+(t.verbose?" milliseconds":"ms");let u=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(n=n.slice(0,Math.max(t.unitCount,1))),i+n.join(u)}p();var yu=(e,t)=>{e.failed&&ze({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var gu=(e,t)=>{Dt(t)&&(yu(e,t),yq(e,t))},yq=(e,t)=>{let r=`(done in ${na(e.durationMs)})`;ze({type:"duration",verboseMessage:r,verboseInfo:t,result:e})};var Ht=(e,t,{reject:r})=>{if(gu(e,t),e.failed&&r)throw e;return e};p();import{readFileSync as Uu}from"fs";p();p();p();var bu=(e,t)=>$t(e)?"asyncGenerator":vu(e)?"generator":ln(e)?"fileUrl":qq(e)?"filePath":wq(e)?"webStream":Re(e,{checkOpen:!1})?"native":re(e)?"uint8Array":xq(e)?"asyncIterable":Sq(e)?"iterable":oa(e)?qu({transform:e},t):bq(e)?gq(e,t):"native",gq=(e,t)=>Qs(e.transform,{checkOpen:!1})?fq(e,t):oa(e.transform)?qu(e,t):_q(e,t),fq=(e,t)=>(ku(e,t,"Duplex stream"),"duplex"),qu=(e,t)=>(ku(e,t,"web TransformStream"),"webTransform"),ku=({final:e,binary:t,objectMode:r},i,n)=>{fu(e,`${i}.final`,n),fu(t,`${i}.binary`,n),sa(r,`${i}.objectMode`)},fu=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${r}.`)},_q=({transform:e,final:t,binary:r,objectMode:i},n)=>{if(e!==void 0&&!_u(e))throw new TypeError(`The \`${n}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(Qs(t,{checkOpen:!1}))throw new TypeError(`The \`${n}.final\` option must not be a Duplex stream.`);if(oa(t))throw new TypeError(`The \`${n}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!_u(t))throw new TypeError(`The \`${n}.final\` option must be a generator.`);return sa(r,`${n}.binary`),sa(i,`${n}.objectMode`),$t(e)||$t(t)?"asyncGenerator":"generator"},sa=(e,t)=>{if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},_u=e=>$t(e)||vu(e),$t=e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",vu=e=>Object.prototype.toString.call(e)==="[object GeneratorFunction]",bq=e=>Z(e)&&(e.transform!==void 0||e.final!==void 0),ln=e=>Object.prototype.toString.call(e)==="[object URL]",wu=e=>ln(e)&&e.protocol!=="file:",qq=e=>Z(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>kq.has(t))&&aa(e.file),kq=new Set(["file","append"]),aa=e=>typeof e=="string",xu=(e,t)=>e==="native"&&typeof t=="string"&&!vq.has(t),vq=new Set(["ipc","ignore","inherit","overlapped","pipe"]),Su=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",mn=e=>Object.prototype.toString.call(e)==="[object WritableStream]",wq=e=>Su(e)||mn(e),oa=e=>Su(e?.readable)&&mn(e?.writable),xq=e=>$u(e)&&typeof e[Symbol.asyncIterator]=="function",Sq=e=>$u(e)&&typeof e[Symbol.iterator]=="function",$u=e=>typeof e=="object"&&e!==null,$e=new Set(["generator","asyncGenerator","duplex","webTransform"]),hn=new Set(["fileUrl","filePath","fileNumber"]),pa=new Set(["fileUrl","filePath"]),Au=new Set([...pa,"webStream","nodeStream"]),Eu=new Set(["webTransform","duplex"]),lt={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};p();var ca=(e,t,r,i)=>i==="output"?$q(e,t,r):Aq(e,t,r),$q=(e,t,r)=>{let i=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:i,readableObjectMode:e??i}},Aq=(e,t,r)=>{let i=t===0?e===!0:r[t-1].value.readableObjectMode,n=t!==r.length-1&&(e??i);return{writableObjectMode:i,readableObjectMode:n}},Pu=(e,t)=>{let r=e.findLast(({type:i})=>$e.has(i));return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode};var ju=(e,t,r,i)=>[...e.filter(({type:n})=>!$e.has(n)),...Eq(e,t,r,i)],Eq=(e,t,r,{encoding:i})=>{let n=e.filter(({type:a})=>$e.has(a)),s=Array.from({length:n.length});for(let[a,o]of Object.entries(n))s[a]=Pq({stdioItem:o,index:Number(a),newTransforms:s,optionName:t,direction:r,encoding:i});return Rq(s,r)},Pq=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:i,optionName:n,direction:s,encoding:a})=>t==="duplex"?jq({stdioItem:e,optionName:n}):t==="webTransform"?Cq({stdioItem:e,index:r,newTransforms:i,direction:s}):Tq({stdioItem:e,index:r,newTransforms:i,direction:s,encoding:a}),jq=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:i},objectMode:n=i}},optionName:s})=>{if(n&&!i)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!n&&i)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:i}}},Cq=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:i,direction:n})=>{let{transform:s,objectMode:a}=Z(t)?t:{transform:t},{writableObjectMode:o,readableObjectMode:c}=ca(a,r,i,n);return{...e,value:{transform:s,writableObjectMode:o,readableObjectMode:c}}},Tq=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:i,direction:n,encoding:s})=>{let{transform:a,final:o,binary:c=!1,preserveNewlines:u=!1,objectMode:d}=Z(t)?t:{transform:t},l=c||be.has(s),{writableObjectMode:h,readableObjectMode:y}=ca(d,r,i,n);return{...e,value:{transform:a,final:o,binary:l,preserveNewlines:u,writableObjectMode:h,readableObjectMode:y}}},Rq=(e,t)=>t==="input"?e.reverse():e;p();import da from"process";var Cu=(e,t,r)=>{let i=e.map(n=>Iq(n,t));if(i.includes("input")&&i.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return i.find(Boolean)??Lq},Iq=({type:e,value:t},r)=>Oq[r]??Tu[e](t),Oq=["input","output","output"],Wt=()=>{},ua=()=>"input",Tu={generator:Wt,asyncGenerator:Wt,fileUrl:Wt,filePath:Wt,iterable:ua,asyncIterable:ua,uint8Array:ua,webStream:e=>mn(e)?"output":"input",nodeStream(e){return St(e,{checkOpen:!1})?Zs(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:Wt,duplex:Wt,native(e){let t=Dq(e);if(t!==void 0)return t;if(Re(e,{checkOpen:!1}))return Tu.nodeStream(e)}},Dq=e=>{if([0,da.stdin].includes(e))return"input";if([1,2,da.stdout,da.stderr].includes(e))return"output"},Lq="output";p();p();var Ru=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var Iu=({stdio:e,ipc:t,buffer:r,...i},n,s)=>{let a=Bq(e,i).map((o,c)=>Ou(o,c));return s?Mq(a,r,n):Ru(a,t)},Bq=(e,t)=>{if(e===void 0)return Se.map(i=>t[i]);if(zq(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Se.map(i=>`\`${i}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,Se.length);return Array.from({length:r},(i,n)=>e[n])},zq=e=>Se.some(t=>e[t]!==void 0),Ou=(e,t)=>Array.isArray(e)?e.map(r=>Ou(r,t)):e??(t>=Se.length?"ignore":"pipe"),Mq=(e,t,r)=>e.map((i,n)=>!t[n]&&n!==0&&!Lt(r,n)&&Fq(i)?"ignore":i),Fq=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe");p();import{readFileSync as Gq}from"fs";import Uq from"tty";var Lu=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:i,direction:n,isSync:s})=>!r||t!=="native"?e:s?Nq({stdioItem:e,fdNumber:i,direction:n}):Wq({stdioItem:e,fdNumber:i}),Nq=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:i,direction:n})=>{let s=Vq({value:t,optionName:r,fdNumber:i,direction:n});if(s!==void 0)return s;if(Re(t,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},Vq=({value:e,optionName:t,fdNumber:r,direction:i})=>{let n=Hq(e,r);if(n!==void 0){if(i==="output")return{type:"fileNumber",value:n,optionName:t};if(Uq.isatty(n))throw new TypeError(`The \`${t}: ${Gi(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:et(Gq(n)),optionName:t}}},Hq=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")return e;let r=xi.indexOf(e);if(r!==-1)return r},Wq=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:i})=>t==="inherit"?{type:"nodeStream",value:Du(i,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:Du(t,t,r),optionName:r}:Re(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,Du=(e,t,r)=>{let i=xi[e];if(i===void 0)throw new TypeError(`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return i};p();var Bu=({input:e,inputFile:t},r)=>r===0?[...Kq(e),...Jq(t)]:[],Kq=e=>e===void 0?[]:[{type:Yq(e),value:e,optionName:"input"}],Yq=e=>{if(St(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(re(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Jq=e=>e===void 0?[]:[{...Xq(e),optionName:"inputFile"}],Xq=e=>{if(ln(e))return{type:"fileUrl",value:e};if(aa(e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};p();var zu=e=>e.filter((t,r)=>e.every((i,n)=>t.value!==i.value||r>=n||t.type==="generator"||t.type==="asyncGenerator")),Mu=({stdioItem:{type:e,value:t,optionName:r},direction:i,fileDescriptors:n,isSync:s})=>{let a=Zq(n,e);if(a.length!==0){if(s){Qq({otherStdioItems:a,type:e,value:t,optionName:r,direction:i});return}if(Au.has(e))return Fu({otherStdioItems:a,type:e,value:t,optionName:r,direction:i});Eu.has(e)&&tk({otherStdioItems:a,type:e,value:t,optionName:r})}},Zq=(e,t)=>e.flatMap(({direction:r,stdioItems:i})=>i.filter(n=>n.type===t).map((n=>({...n,direction:r})))),Qq=({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})=>{pa.has(t)&&Fu({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})},Fu=({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})=>{let s=e.filter(o=>ek(o,r));if(s.length===0)return;let a=s.find(o=>o.direction!==n);return Gu(a,i,t),n==="output"?s[0].stream:void 0},ek=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUrl"?t.href===r.href:t===r,tk=({otherStdioItems:e,type:t,value:r,optionName:i})=>{let n=e.find(({value:{transform:s}})=>s===r.transform);Gu(n,i,t)},Gu=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${lt[r]} that is the same.`)};var yn=(e,t,r,i)=>{let s=Iu(t,r,i).map((o,c)=>rk({stdioOption:o,fdNumber:c,options:t,isSync:i})),a=dk({initialFileDescriptors:s,addProperties:e,options:t,isSync:i});return t.stdio=a.map(({stdioItems:o})=>mk(o)),a},rk=({stdioOption:e,fdNumber:t,options:r,isSync:i})=>{let n=Si(t),{stdioItems:s,isStdioArray:a}=ik({stdioOption:e,fdNumber:t,options:r,optionName:n}),o=Cu(s,t,n),c=s.map(l=>Lu({stdioItem:l,isStdioArray:a,fdNumber:t,direction:o,isSync:i})),u=ju(c,n,o,r),d=Pu(u,o);return ck(u,d),{direction:o,objectMode:d,stdioItems:u}},ik=({stdioOption:e,fdNumber:t,options:r,optionName:i})=>{let s=[...(Array.isArray(e)?e:[e]).map(c=>nk(c,i)),...Bu(r,t)],a=zu(s),o=a.length>1;return sk(a,o,i),ok(a),{stdioItems:a,isStdioArray:o}},nk=(e,t)=>({type:bu(e,t),value:e,optionName:t}),sk=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:i,optionName:n}of e)if(ak.has(i))throw new Error(`The \`${n}\` option must not include \`${i}\`.`)}},ak=new Set(["ignore","ipc"]),ok=e=>{for(let t of e)pk(t)},pk=({type:e,value:t,optionName:r})=>{if(wu(t))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme.
135
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(xu(e,t))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},ck=(e,t)=>{if(!t)return;let r=e.find(({type:i})=>hn.has(i));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},dk=({initialFileDescriptors:e,addProperties:t,options:r,isSync:i})=>{let n=[];try{for(let s of e)n.push(uk({fileDescriptor:s,fileDescriptors:n,addProperties:t,options:r,isSync:i}));return n}catch(s){throw la(n),s}},uk=({fileDescriptor:{direction:e,objectMode:t,stdioItems:r},fileDescriptors:i,addProperties:n,options:s,isSync:a})=>{let o=r.map(c=>lk({stdioItem:c,addProperties:n,direction:e,options:s,fileDescriptors:i,isSync:a}));return{direction:e,objectMode:t,stdioItems:o}},lk=({stdioItem:e,addProperties:t,direction:r,options:i,fileDescriptors:n,isSync:s})=>{let a=Mu({stdioItem:e,direction:r,fileDescriptors:n,isSync:s});return a!==void 0?{...e,stream:a}:{...e,...t[r][e.type](e,i)}},la=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!je(r)&&r.destroy()},mk=e=>{if(e.length>1)return e.some(({value:i})=>i==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;return t==="native"?r:"pipe"};var Vu=(e,t)=>yn(yk,e,t,!0),Ue=({type:e,optionName:t})=>{Hu(t,lt[e])},hk=({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&Hu(e,`"${t}"`),{}),Hu=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},Nu={generator(){},asyncGenerator:Ue,webStream:Ue,nodeStream:Ue,webTransform:Ue,duplex:Ue,asyncIterable:Ue,native:hk},yk={input:{...Nu,fileUrl:({value:e})=>({contents:[et(Uu(e))]}),filePath:({value:{file:e}})=>({contents:[et(Uu(e))]}),fileNumber:Ue,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...Nu,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Ue,string:Ue,uint8Array:Ue}};p();var it=(e,{stripFinalNewline:t},r)=>ma(t,r)&&e!==void 0&&!Array.isArray(e)?Ut(e):e,ma=(e,t)=>t==="all"?e[1]||e[2]:e[t];p();p();import{Transform as Dk,getDefaultHighWaterMark as il}from"stream";p();var gn=(e,t,r,i)=>e||r?void 0:Ku(t,i),ya=(e,t,r)=>r?e.flatMap(i=>Wu(i,t)):Wu(e,t),Wu=(e,t)=>{let{transform:r,final:i}=Ku(t,{});return[...r(e),...i()]},Ku=(e,t)=>(t.previousChunks="",{transform:gk.bind(void 0,t,e),final:_k.bind(void 0,t)}),gk=function*(e,t,r){if(typeof r!="string"){yield r;return}let{previousChunks:i}=e,n=-1;for(let s=0;s<r.length;s+=1)if(r[s]===`
136
+ `){let a=fk(r,s,t,e),o=r.slice(n+1,s+1-a);i.length>0&&(o=ha(i,o),i=""),yield o,n=s}n!==r.length-1&&(i=ha(i,r.slice(n+1))),e.previousChunks=i},fk=(e,t,r,i)=>r?0:(i.isWindowsNewline=t!==0&&e[t-1]==="\r",i.isWindowsNewline?2:1),_k=function*({previousChunks:e}){e.length>0&&(yield e)},Yu=({binary:e,preserveNewlines:t,readableObjectMode:r,state:i})=>e||t||r?void 0:{transform:bk.bind(void 0,i)},bk=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:i,LF:n,concatBytes:s}=typeof t=="string"?qk:vk;if(t.at(-1)===n){yield t;return}yield s(t,e?i:r)},ha=(e,t)=>`${e}${t}`,qk={windowsNewline:`\r
137
137
  `,unixNewline:`
138
138
  `,LF:`
139
- `,concatBytes:oa},Qq=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},ek={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Qq};import{Buffer as tk}from"buffer";var Mu=(e,t)=>e?void 0:rk.bind(void 0,t),rk=function*(e,t){if(typeof t!="string"&&!ee(t)&&!tk.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},Fu=(e,t)=>e?ik.bind(void 0,t):nk.bind(void 0,t),ik=function*(e,t){Gu(e,t),yield t},nk=function*(e,t){if(Gu(e,t),typeof t!="string"&&!ee(t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},Gu=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
139
+ `,concatBytes:ha},kk=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},vk={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:kk};p();import{Buffer as wk}from"buffer";var Ju=(e,t)=>e?void 0:xk.bind(void 0,t),xk=function*(e,t){if(typeof t!="string"&&!re(t)&&!wk.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},Xu=(e,t)=>e?Sk.bind(void 0,t):$k.bind(void 0,t),Sk=function*(e,t){Zu(e,t),yield t},$k=function*(e,t){if(Zu(e,t),typeof t!="string"&&!re(t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},Zu=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
140
140
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
141
- if (condition) { yield value; }`)};import{Buffer as sk}from"buffer";import{StringDecoder as ak}from"string_decoder";var pn=(e,t,r)=>{if(r)return;if(e)return{transform:ok.bind(void 0,new TextEncoder)};let i=new ak(t);return{transform:pk.bind(void 0,i),final:ck.bind(void 0,i)}},ok=function*(e,t){sk.isBuffer(t)?yield Xe(t):typeof t=="string"?yield e.encode(t):yield t},pk=function*(e,t){yield ee(t)?e.write(t):t},ck=function*(e){let t=e.end();t!==""&&(yield t)};import{callbackify as Uu}from"util";var ca=Uu(async(e,t,r,i)=>{t.currentIterable=e(...r);try{for await(let n of t.currentIterable)i.push(n)}finally{delete t.currentIterable}}),cn=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:i=uk}=t[r];for await(let n of i(e))yield*cn(n,t,r+1)},Nu=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*dk(r,Number(t),e)},dk=async function*(e,t,r){if(e!==void 0)for await(let i of e())yield*cn(i,r,t+1)},Hu=Uu(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),uk=function*(e){yield e};var da=(e,t,r,i)=>{try{for(let n of e(...t))r.push(n);i()}catch(n){i(n)}},Vu=(e,t)=>[...t.flatMap(r=>[...xt(r,e,0)]),...kr(e)],xt=function*(e,t,r){if(r===t.length){yield e;return}let{transform:i=mk}=t[r];for(let n of i(e))yield*xt(n,t,r+1)},kr=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*lk(r,Number(t),e)},lk=function*(e,t,r){if(e!==void 0)for(let i of e())yield*xt(i,r,t+1)},mk=function*(e){yield e};var ua=({value:e,value:{transform:t,final:r,writableObjectMode:i,readableObjectMode:n},optionName:s},{encoding:a})=>{let o={},p=Ku(e,a,s),d=wt(t),c=wt(r),u=d?ca.bind(void 0,cn,o):da.bind(void 0,xt),l=d||c?ca.bind(void 0,Nu,o):da.bind(void 0,kr),m=d||c?Hu.bind(void 0,o):void 0;return{stream:new hk({writableObjectMode:i,writableHighWaterMark:Wu(i),readableObjectMode:n,readableHighWaterMark:Wu(n),transform(f,w,v){u([f,p,0],this,v)},flush(f){l([p],this,f)},destroy:m})}},dn=(e,t,r,i)=>{let n=t.filter(({type:a})=>a==="generator"),s=i?n.reverse():n;for(let{value:a,optionName:o}of s){let p=Ku(a,r,o);e=Vu(p,e)}return e},Ku=({transform:e,final:t,binary:r,writableObjectMode:i,readableObjectMode:n,preserveNewlines:s},a,o)=>{let p={};return[{transform:Mu(i,o)},pn(r,a,i),on(r,s,i,p),{transform:e,final:t},{transform:Fu(n,o)},zu({binary:r,preserveNewlines:s,readableObjectMode:n,state:p})].filter(Boolean)};var Yu=(e,t)=>{for(let r of yk(e))gk(e,r,t)},yk=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(([t])=>Number(t))),gk=(e,t,r)=>{let{stdioItems:i}=e[t],n=i.filter(({contents:o})=>o!==void 0);if(n.length===0)return;if(t!==0){let[{type:o,optionName:p}]=n;throw new TypeError(`Only the \`stdin\` option, not \`${p}\`, can be ${ct[o]} with synchronous methods.`)}let a=n.map(({contents:o})=>o).map(o=>fk(o,i));r.input=ur(a)},fk=(e,t)=>{let r=dn(e,t,"utf8",!0);return _k(r),ur(r)},_k=e=>{let t=e.find(r=>typeof r!="string"&&!ee(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as vk,appendFileSync as wk}from"fs";var un=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:i})=>i!=="all"&&It(r,i)&&!fe.has(t)&&bk(i)&&(e.some(({type:n,value:s})=>n==="native"&&qk.has(s))||e.every(({type:n})=>xe.has(n))),bk=e=>e===1||e===2,qk=new Set(["pipe","overlapped"]),Ju=async(e,t,r,i)=>{for await(let n of e)kk(t)||Zu(n,r,i)},Xu=(e,t,r)=>{for(let i of e)Zu(i,t,r)},kk=e=>e._readableState.pipes.length>0,Zu=(e,t,r)=>{let i=vi(e);De({type:"output",verboseMessage:i,fdNumber:t,verboseInfo:r})};var Qu=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:i,verboseInfo:n})=>{if(t===null)return{output:Array.from({length:3})};let s={},a=new Set([]);return{output:t.map((p,d)=>xk({result:p,fileDescriptors:e,fdNumber:d,state:s,outputFiles:a,isMaxBuffer:i,verboseInfo:n},r)),...s}},xk=({result:e,fileDescriptors:t,fdNumber:r,state:i,outputFiles:n,isMaxBuffer:s,verboseInfo:a},{buffer:o,encoding:p,lines:d,stripFinalNewline:c,maxBuffer:u})=>{if(e===null)return;let l=eu(e,s,u),m=Xe(l),{stdioItems:h,objectMode:f}=t[r],w=Sk([m],h,p,i),{serializedResult:v,finalResult:x=v}=$k({chunks:w,objectMode:f,encoding:p,lines:d,stripFinalNewline:c,fdNumber:r});Ak({serializedResult:v,fdNumber:r,state:i,verboseInfo:a,encoding:p,stdioItems:h,objectMode:f});let _=o[r]?x:void 0;try{return i.error===void 0&&Ek(v,h,n),_}catch(T){return i.error=T,_}},Sk=(e,t,r,i)=>{try{return dn(e,t,r,!1)}catch(n){return i.error=n,e}},$k=({chunks:e,objectMode:t,encoding:r,lines:i,stripFinalNewline:n,fdNumber:s})=>{if(t)return{serializedResult:e};if(r==="buffer")return{serializedResult:ur(e)};let a=hp(e,r);return i[s]?{serializedResult:a,finalResult:pa(a,!n[s],t)}:{serializedResult:a}},Ak=({serializedResult:e,fdNumber:t,state:r,verboseInfo:i,encoding:n,stdioItems:s,objectMode:a})=>{if(!un({stdioItems:s,encoding:n,verboseInfo:i,fdNumber:t}))return;let o=pa(e,!1,a);try{Xu(o,t,i)}catch(p){r.error??=p}},Ek=(e,t,r)=>{for(let{path:i,append:n}of t.filter(({type:s})=>sn.has(s))){let s=typeof i=="string"?i:i.toString();n||r.has(s)?wk(i,e):(r.add(s),vk(i,e))}};var el=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,et(t,r,"all")]:Array.isArray(t)?[et(e,r,"all"),...t]:ee(e)&&ee(t)?fs([e,t]):`${e}${t}`};import{once as la}from"events";var tl=async(e,t)=>{let[r,i]=await Pk(e);return t.isForcefullyTerminated??=!1,[r,i]},Pk=async e=>{let[t,r]=await Promise.allSettled([la(e,"spawn"),la(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?rl(e):r.value},rl=async e=>{try{return await la(e,"exit")}catch{return rl(e)}},il=async e=>{let[t,r]=await e;if(!jk(t,r)&&ma(t,r))throw new Ee;return[t,r]},jk=(e,t)=>e===void 0&&t===void 0,ma=(e,t)=>e!==0||t!==null;var nl=({error:e,status:t,signal:r,output:i},{maxBuffer:n})=>{let s=Ck(e,t,r),a=s?.code==="ETIMEDOUT",o=Qd(s,i,n);return{resultError:s,exitCode:t,signal:r,timedOut:a,isMaxBuffer:o}},Ck=(e,t,r)=>e!==void 0?e:ma(t,r)?new Ee:void 0;var sl=(e,t,r)=>{let{file:i,commandArguments:n,command:s,escapedCommand:a,startTime:o,verboseInfo:p,options:d,fileDescriptors:c}=Rk(e,t,r),u=Dk({file:i,commandArguments:n,options:d,command:s,escapedCommand:a,verboseInfo:p,fileDescriptors:c,startTime:o});return Ut(u,p,d)},Rk=(e,t,r)=>{let{command:i,escapedCommand:n,startTime:s,verboseInfo:a}=xi(e,t,r),o=Ik(r),{file:p,commandArguments:d,options:c}=Hi(e,t,o);Ok(c);let u=Ou(c,a);return{file:p,commandArguments:d,command:i,escapedCommand:n,startTime:s,verboseInfo:a,options:c,fileDescriptors:u}},Ik=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,Ok=({ipc:e,ipcInput:t,detached:r,cancelSignal:i})=>{t&&ln("ipcInput"),e&&ln("ipc: true"),r&&ln("detached: true"),i&&ln("cancelSignal")},ln=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},Dk=({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,verboseInfo:s,fileDescriptors:a,startTime:o})=>{let p=Lk({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,fileDescriptors:a,startTime:o});if(p.failed)return p;let{resultError:d,exitCode:c,signal:u,timedOut:l,isMaxBuffer:m}=nl(p,r),{output:h,error:f=d}=Qu({fileDescriptors:a,syncResult:p,options:r,isMaxBuffer:m,verboseInfo:s}),w=h.map((x,_)=>et(x,r,_)),v=et(el(h,r),r,"all");return zk({error:f,exitCode:c,signal:u,timedOut:l,isMaxBuffer:m,stdio:w,all:v,options:r,command:i,escapedCommand:n,startTime:o})},Lk=({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,fileDescriptors:s,startTime:a})=>{try{Yu(s,r);let o=Bk(r);return Tk(...Vi(e,t,o))}catch(o){return Gt({error:o,command:i,escapedCommand:n,fileDescriptors:s,options:r,startTime:a,isSync:!0})}},Bk=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:en(t)}),zk=({error:e,exitCode:t,signal:r,timedOut:i,isMaxBuffer:n,stdio:s,all:a,options:o,command:p,escapedCommand:d,startTime:c})=>e===void 0?tn({command:p,escapedCommand:d,stdio:s,all:a,ipcOutput:[],options:o,startTime:c}):qr({error:e,command:p,escapedCommand:d,timedOut:i,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:n,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:s,all:a,ipcOutput:[],options:o,startTime:c,isSync:!0});import{setMaxListeners as $w}from"events";import{spawn as Aw}from"child_process";import dl from"process";import{once as ha,on as Mk}from"events";var al=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},{reference:n=!0,filter:s}={})=>(Lt({methodName:"getOneMessage",isSubprocess:r,ipc:i,isConnected:zi(e)}),Fk({anyProcess:e,channel:t,isSubprocess:r,filter:s,reference:n})),Fk=async({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:n})=>{Oi(t,n);let s=pt(e,t,r),a=new AbortController;try{return await Promise.race([Gk(s,i,a),Uk(s,r,a),Nk(s,r,a)])}catch(o){throw Bt(e),o}finally{a.abort(),Di(t,n)}},Gk=async(e,t,{signal:r})=>{if(t===void 0){let[i]=await ha(e,"message",{signal:r});return i}for await(let[i]of Mk(e,"message",{signal:r}))if(t(i))return i},Uk=async(e,t,{signal:r})=>{await ha(e,"disconnect",{signal:r}),Vc(t)},Nk=async(e,t,{signal:r})=>{let[i]=await ha(e,"strict:error",{signal:r});throw Ti(i,t)};import{once as pl,on as Hk}from"events";var cl=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},{reference:n=!0}={})=>ya({anyProcess:e,channel:t,isSubprocess:r,ipc:i,shouldAwait:!r,reference:n}),ya=({anyProcess:e,channel:t,isSubprocess:r,ipc:i,shouldAwait:n,reference:s})=>{Lt({methodName:"getEachMessage",isSubprocess:r,ipc:i,isConnected:zi(e)}),Oi(t,s);let a=pt(e,t,r),o=new AbortController,p={};return Vk(e,a,o),Wk({ipcEmitter:a,isSubprocess:r,controller:o,state:p}),Kk({anyProcess:e,channel:t,ipcEmitter:a,isSubprocess:r,shouldAwait:n,controller:o,state:p,reference:s})},Vk=async(e,t,r)=>{try{await pl(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},Wk=async({ipcEmitter:e,isSubprocess:t,controller:r,state:i})=>{try{let[n]=await pl(e,"strict:error",{signal:r.signal});i.error=Ti(n,t),r.abort()}catch{}},Kk=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:i,shouldAwait:n,controller:s,state:a,reference:o}){try{for await(let[p]of Hk(r,"message",{signal:s.signal}))ol(a),yield p}catch{ol(a)}finally{s.abort(),Di(t,o),i||Bt(e),n&&await e}},ol=({error:e})=>{if(e)throw e};var ul=(e,{ipc:t})=>{Object.assign(e,ml(e,!1,t))},ll=()=>{let e=dl,t=!0,r=dl.channel!==void 0;return{...ml(e,t,r),getCancelSignal:bd.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},ml=(e,t,r)=>({sendMessage:Ui.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:al.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:cl.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as Yk}from"child_process";import{PassThrough as Jk,Readable as Xk,Writable as Zk,Duplex as Qk}from"stream";var hl=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,verboseInfo:a})=>{sa(i);let o=new Yk;ev(o,i),Object.assign(o,{readable:tv,writable:rv,duplex:iv});let p=Gt({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,isSync:!1}),d=nv(p,a,n);return{subprocess:o,promise:d}},ev=(e,t)=>{let r=vr(),i=vr(),n=vr(),s=Array.from({length:t.length-3},vr),a=vr(),o=[r,i,n,...s];Object.assign(e,{stdin:r,stdout:i,stderr:n,all:a,stdio:o})},vr=()=>{let e=new Jk;return e.end(),e},tv=()=>new Xk({read(){}}),rv=()=>new Zk({write(){}}),iv=()=>new Qk({read(){},write(){}}),nv=async(e,t,r)=>Ut(e,t,r);import{createReadStream as yl,createWriteStream as gl}from"fs";import{Buffer as sv}from"buffer";import{Readable as wr,Writable as av,Duplex as ov}from"stream";var _l=(e,t)=>an(pv,e,t,!1),xr=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${ct[e]}.`)},fl={fileNumber:xr,generator:ua,asyncGenerator:ua,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:r}}){let i=t||r;return{stream:ov.fromWeb(e,{objectMode:i})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},pv={input:{...fl,fileUrl:({value:e})=>({stream:yl(e)}),filePath:({value:{file:e}})=>({stream:yl(e)}),webStream:({value:e})=>({stream:wr.fromWeb(e)}),iterable:({value:e})=>({stream:wr.from(e)}),asyncIterable:({value:e})=>({stream:wr.from(e)}),string:({value:e})=>({stream:wr.from(e)}),uint8Array:({value:e})=>({stream:wr.from(sv.from(e))})},output:{...fl,fileUrl:({value:e})=>({stream:gl(e)}),filePath:({value:{file:e,append:t}})=>({stream:gl(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:av.fromWeb(e)}),iterable:xr,asyncIterable:xr,string:xr,uint8Array:xr}};import{on as cv,once as bl}from"events";import{PassThrough as dv,getDefaultHighWaterMark as uv}from"stream";import{finished as vl}from"stream/promises";function St(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, got \`${typeof e}\`.`);for(let n of e)fa(n);let t=e.some(({readableObjectMode:n})=>n),r=lv(e,t),i=new ga({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let n of e)i.add(n);return i}var lv=(e,t)=>{if(e.length===0)return uv(t);let r=e.filter(({readableObjectMode:i})=>i===t).map(({readableHighWaterMark:i})=>i);return Math.max(...r)},ga=class extends dv{#t=new Set([]);#r=new Set([]);#e=new Set([]);#i;#s=Symbol("unpipe");#n=new WeakMap;add(t){if(fa(t),this.#t.has(t))return;this.#t.add(t),this.#i??=mv(this,this.#t,this.#s);let r=gv({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#i,unpipeEvent:this.#s});this.#n.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(fa(t),!this.#t.has(t))return!1;let r=this.#n.get(t);return r===void 0?!1:(this.#n.delete(t),t.unpipe(this),await r,!0)}},mv=async(e,t,r)=>{mn(e,ql);let i=new AbortController;try{await Promise.race([hv(e,i),yv(e,t,r,i)])}finally{i.abort(),mn(e,-ql)}},hv=async(e,{signal:t})=>{try{await vl(e,{signal:t,cleanup:!0})}catch(r){throw wl(e,r),r}},yv=async(e,t,r,{signal:i})=>{for await(let[n]of cv(e,"unpipe",{signal:i}))t.has(n)&&n.emit(r)},fa=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},gv=async({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,onFinished:s,unpipeEvent:a})=>{mn(e,kl);let o=new AbortController;try{await Promise.race([fv(s,t,o),_v({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,controller:o}),bv({stream:t,streams:r,ended:i,aborted:n,unpipeEvent:a,controller:o})])}finally{o.abort(),mn(e,-kl)}r.size>0&&r.size===i.size+n.size&&(i.size===0&&n.size>0?_a(e):qv(e))},fv=async(e,t,{signal:r})=>{try{await e,r.aborted||_a(t)}catch(i){r.aborted||wl(t,i)}},_v=async({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,controller:{signal:s}})=>{try{await vl(t,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&i.add(t)}catch(a){if(s.aborted||!r.has(t))return;xl(a)?n.add(t):Sl(e,a)}},bv=async({stream:e,streams:t,ended:r,aborted:i,unpipeEvent:n,controller:{signal:s}})=>{if(await bl(e,n,{signal:s}),!e.readable)return bl(s,"abort",{signal:s});t.delete(e),r.delete(e),i.delete(e)},qv=e=>{e.writable&&e.end()},wl=(e,t)=>{xl(t)?_a(e):Sl(e,t)},xl=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",_a=e=>{(e.readable||e.writable)&&e.destroy()},Sl=(e,t)=>{e.destroyed||(e.once("error",kv),e.destroy(t))},kv=()=>{},mn=(e,t)=>{let r=e.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},ql=2,kl=1;import{finished as $l}from"stream/promises";var Ht=(e,t)=>{e.pipe(t),vv(e,t),wv(e,t)},vv=async(e,t)=>{if(!(Ae(e)||Ae(t))){try{await $l(e,{cleanup:!0,readable:!0,writable:!1})}catch{}ba(t)}},ba=e=>{e.writable&&e.end()},wv=async(e,t)=>{if(!(Ae(e)||Ae(t))){try{await $l(t,{cleanup:!0,readable:!1,writable:!0})}catch{}qa(e)}},qa=e=>{e.readable&&e.destroy()};var Al=(e,t,r)=>{let i=new Map;for(let[n,{stdioItems:s,direction:a}]of Object.entries(t)){for(let{stream:o}of s.filter(({type:p})=>xe.has(p)))xv(e,o,a,n);for(let{stream:o}of s.filter(({type:p})=>!xe.has(p)))$v({subprocess:e,stream:o,direction:a,fdNumber:n,pipeGroups:i,controller:r})}for(let[n,s]of i.entries()){let a=s.length===1?s[0]:St(s);Ht(a,n)}},xv=(e,t,r,i)=>{r==="output"?Ht(e.stdio[i],t):Ht(t,e.stdio[i]);let n=Sv[i];n!==void 0&&(e[n]=t),e.stdio[i]=t},Sv=["stdin","stdout","stderr"],$v=({subprocess:e,stream:t,direction:r,fdNumber:i,pipeGroups:n,controller:s})=>{if(t===void 0)return;Av(t,s);let[a,o]=r==="output"?[t,e.stdio[i]]:[e.stdio[i],t],p=n.get(a)??[];n.set(a,[...p,o])},Av=(e,{signal:t})=>{Ae(e)&&kt(e,Ev,t)},Ev=2;import{addAbortListener as Cv}from"events";var $t=[];$t.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&$t.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&$t.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var hn=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",ka=Symbol.for("signal-exit emitter"),va=globalThis,Pv=Object.defineProperty.bind(Object),wa=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(va[ka])return va[ka];Pv(va,ka,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let i=this.listeners[t],n=i.indexOf(r);n!==-1&&(n===0&&i.length===1?i.length=0:i.splice(n,1))}emit(t,r,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(let s of this.listeners[t])n=s(r,i)===!0||n;return t==="exit"&&(n=this.emit("afterExit",r,i)||n),n}},yn=class{},jv=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),xa=class extends yn{onExit(){return()=>{}}load(){}unload(){}},Sa=class extends yn{#t=$a.platform==="win32"?"SIGINT":"SIGHUP";#r=new wa;#e;#i;#s;#n={};#a=!1;constructor(t){super(),this.#e=t,this.#n={};for(let r of $t)this.#n[r]=()=>{let i=this.#e.listeners(r),{count:n}=this.#r,s=t;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(n+=s.__signal_exit_emitter__.count),i.length===n){this.unload();let a=this.#r.emit("exit",null,r),o=r==="SIGHUP"?this.#t:r;a||t.kill(t.pid,o)}};this.#s=t.reallyExit,this.#i=t.emit}onExit(t,r){if(!hn(this.#e))return()=>{};this.#a===!1&&this.load();let i=r?.alwaysLast?"afterExit":"exit";return this.#r.on(i,t),()=>{this.#r.removeListener(i,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#a){this.#a=!0,this.#r.count+=1;for(let t of $t)try{let r=this.#n[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#p(t,...r),this.#e.reallyExit=t=>this.#o(t)}}unload(){this.#a&&(this.#a=!1,$t.forEach(t=>{let r=this.#n[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#i,this.#e.reallyExit=this.#s,this.#r.count-=1)}#o(t){return hn(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)):0}#p(t,...r){let i=this.#i;if(t==="exit"&&hn(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let n=i.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),n}else return i.call(this.#e,t,...r)}},$a=globalThis.process,{onExit:El,load:AI,unload:EI}=jv(hn($a)?new Sa($a):new xa);var Pl=(e,{cleanup:t,detached:r},{signal:i})=>{if(!t||r)return;let n=El(()=>{e.kill()});Cv(i,()=>{n()})};var Cl=({source:e,sourcePromise:t,boundOptions:r,createNested:i},...n)=>{let s=wi(),{destination:a,destinationStream:o,destinationError:p,from:d,unpipeSignal:c}=Tv(r,i,n),{sourceStream:u,sourceError:l}=Iv(e,d),{options:m,fileDescriptors:h}=Be.get(e);return{sourcePromise:t,sourceStream:u,sourceOptions:m,sourceError:l,destination:a,destinationStream:o,destinationError:p,unpipeSignal:c,fileDescriptors:h,startTime:s}},Tv=(e,t,r)=>{try{let{destination:i,pipeOptions:{from:n,to:s,unpipeSignal:a}={}}=Rv(e,t,...r),o=Ii(i,s);return{destination:i,destinationStream:o,from:n,unpipeSignal:a}}catch(i){return{destinationError:i}}},Rv=(e,t,r,...i)=>{if(Array.isArray(r))return{destination:t(jl,e)(r,...i),pipeOptions:e};if(typeof r=="string"||r instanceof URL||ys(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[n,s,a]=mi(r,...i);return{destination:t(jl)(n,s,a),pipeOptions:a}}if(Be.has(r)){if(Object.keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:i[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},jl=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),Iv=(e,t)=>{try{return{sourceStream:zt(e,t)}}catch(r){return{sourceError:r}}};var Rl=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i,fileDescriptors:n,sourceOptions:s,startTime:a})=>{let o=Ov({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i});if(o!==void 0)throw Aa({error:o,fileDescriptors:n,sourceOptions:s,startTime:a})},Ov=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i})=>{if(t!==void 0&&i!==void 0)return i;if(i!==void 0)return qa(e),i;if(t!==void 0)return ba(r),t},Aa=({error:e,fileDescriptors:t,sourceOptions:r,startTime:i})=>Gt({error:e,command:Tl,escapedCommand:Tl,fileDescriptors:t,options:r,startTime:i,isSync:!1}),Tl="source.pipe(destination)";var Il=async e=>{let[{status:t,reason:r,value:i=r},{status:n,reason:s,value:a=s}]=await e;if(a.pipedFrom.includes(i)||a.pipedFrom.push(i),n==="rejected")throw a;if(t==="rejected")throw i;return a};import{finished as Dv}from"stream/promises";var Ol=(e,t,r)=>{let i=gn.has(t)?Bv(e,t):Lv(e,t);return kt(e,Mv,r.signal),kt(t,Fv,r.signal),zv(t),i},Lv=(e,t)=>{let r=St([e]);return Ht(r,t),gn.set(t,r),r},Bv=(e,t)=>{let r=gn.get(t);return r.add(e),r},zv=async e=>{try{await Dv(e,{cleanup:!0,readable:!1,writable:!0})}catch{}gn.delete(e)},gn=new WeakMap,Mv=2,Fv=1;import{aborted as Gv}from"util";var Dl=(e,t)=>e===void 0?[]:[Uv(e,t)],Uv=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:i,sourceOptions:n,startTime:s})=>{await Gv(e,t),await r.remove(t);let a=new Error("Pipe canceled by `unpipeSignal` option.");throw Aa({error:a,fileDescriptors:i,sourceOptions:n,startTime:s})};var fn=(e,...t)=>{if(Y(t[0]))return fn.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...i}=Cl(e,...t),n=Nv({...i,destination:r});return n.pipe=fn.bind(void 0,{...e,source:r,sourcePromise:n,boundOptions:{}}),n},Nv=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:i,destination:n,destinationStream:s,destinationError:a,unpipeSignal:o,fileDescriptors:p,startTime:d})=>{let c=Hv(e,n);Rl({sourceStream:t,sourceError:i,destinationStream:s,destinationError:a,fileDescriptors:p,sourceOptions:r,startTime:d});let u=new AbortController;try{let l=Ol(t,s,u);return await Promise.race([Il(c),...Dl(o,{sourceStream:t,mergedStream:l,sourceOptions:r,fileDescriptors:p,startTime:d})])}finally{u.abort()}},Hv=(e,t)=>Promise.allSettled([e,t]);import{setImmediate as Zv}from"timers/promises";import{on as Vv}from"events";import{getDefaultHighWaterMark as Wv}from"stream";var _n=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:i,encoding:n,preserveNewlines:s})=>{let a=new AbortController;return Kv(t,a),Bl({stream:e,controller:a,binary:r,shouldEncode:!e.readableObjectMode&&i,encoding:n,shouldSplit:!e.readableObjectMode,preserveNewlines:s})},Kv=async(e,t)=>{try{await e}catch{}finally{t.abort()}},Ea=({stream:e,onStreamEnd:t,lines:r,encoding:i,stripFinalNewline:n,allMixed:s})=>{let a=new AbortController;Yv(t,a,e);let o=e.readableObjectMode&&!s;return Bl({stream:e,controller:a,binary:i==="buffer",shouldEncode:!o,encoding:i,shouldSplit:!o&&r,preserveNewlines:!n})},Yv=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},Bl=({stream:e,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:a})=>{let o=Vv(e,"data",{signal:t.signal,highWaterMark:Ll,highWatermark:Ll});return Jv({onStdoutChunk:o,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:a})},Pa=Wv(!0),Ll=Pa,Jv=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:a}){let o=Xv({binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:a});try{for await(let[p]of e)yield*xt(p,o,0)}catch(p){if(!t.signal.aborted)throw p}finally{yield*kr(o)}},Xv=({binary:e,shouldEncode:t,encoding:r,shouldSplit:i,preserveNewlines:n})=>[pn(e,r,!t),on(e,n,!i,{})].filter(Boolean);var zl=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,buffer:n,maxBuffer:s,lines:a,allMixed:o,stripFinalNewline:p,verboseInfo:d,streamInfo:c})=>{let u=Qv({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,allMixed:o,verboseInfo:d,streamInfo:c});if(!n){await Promise.all([ew(e),u]);return}let l=aa(p,r),m=Ea({stream:e,onStreamEnd:t,lines:a,encoding:i,stripFinalNewline:l,allMixed:o}),[h]=await Promise.all([tw({stream:e,iterable:m,fdNumber:r,encoding:i,maxBuffer:s,lines:a}),u]);return h},Qv=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,allMixed:n,verboseInfo:s,streamInfo:{fileDescriptors:a}})=>{if(!un({stdioItems:a[r]?.stdioItems,encoding:i,verboseInfo:s,fdNumber:r}))return;let o=Ea({stream:e,onStreamEnd:t,lines:!0,encoding:i,stripFinalNewline:!0,allMixed:n});await Ju(o,e,r,s)},ew=async e=>{await Zv(),e.readableFlowing===null&&e.resume()},tw=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:i,encoding:n,maxBuffer:s,lines:a})=>{try{return t||a?await Ji(r,{maxBuffer:s}):n==="buffer"?new Uint8Array(await Xi(r,{maxBuffer:s})):await Qi(r,{maxBuffer:s})}catch(o){return Ml(Jd({error:o,stream:e,readableObjectMode:t,lines:a,encoding:n,fdNumber:i}))}},ja=async e=>{try{return await e}catch(t){return Ml(t)}},Ml=({bufferedData:e})=>lp(e)?new Uint8Array(e):e;import{finished as rw}from"stream/promises";var Sr=async(e,t,r,{isSameDirection:i,stopOnExit:n=!1}={})=>{let s=iw(e,r),a=new AbortController;try{await Promise.race([...n?[r.exitPromise]:[],rw(e,{cleanup:!0,signal:a.signal})])}catch(o){s.stdinCleanedUp||aw(o,t,r,i)}finally{a.abort()}},iw=(e,{originalStreams:[t],subprocess:r})=>{let i={stdinCleanedUp:!1};return e===t&&nw(e,r,i),i},nw=(e,t,r)=>{let{_destroy:i}=e;e._destroy=(...n)=>{sw(t,r),i.call(e,...n)}},sw=({exitCode:e,signalCode:t},r)=>{(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},aw=(e,t,r,i)=>{if(!ow(e,t,r,i))throw e},ow=(e,t,r,i=!0)=>r.propagating?Fl(e)||bn(e):(r.propagating=!0,Ca(r,t)===i?Fl(e):bn(e)),Ca=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",bn=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Fl=e=>e?.code==="EPIPE";var Gl=({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:s,verboseInfo:a,streamInfo:o})=>e.stdio.map((p,d)=>Ta({stream:p,fdNumber:d,encoding:t,buffer:r[d],maxBuffer:i[d],lines:n[d],allMixed:!1,stripFinalNewline:s,verboseInfo:a,streamInfo:o})),Ta=async({stream:e,fdNumber:t,encoding:r,buffer:i,maxBuffer:n,lines:s,allMixed:a,stripFinalNewline:o,verboseInfo:p,streamInfo:d})=>{if(!e)return;let c=Sr(e,t,d);if(Ca(d,t)){await c;return}let[u]=await Promise.all([zl({stream:e,onStreamEnd:c,fdNumber:t,encoding:r,buffer:i,maxBuffer:n,lines:s,allMixed:a,stripFinalNewline:o,verboseInfo:p,streamInfo:d}),c]);return u};var Ul=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?St([e,t].filter(Boolean)):void 0,Nl=({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:s,verboseInfo:a,streamInfo:o})=>Ta({...pw(e,r),fdNumber:"all",encoding:t,maxBuffer:i[1]+i[2],lines:n[1]||n[2],allMixed:cw(e),stripFinalNewline:s,verboseInfo:a,streamInfo:o}),pw=({stdout:e,stderr:t,all:r},[,i,n])=>{let s=i||n;return s?i?n?{stream:r,buffer:s}:{stream:e,buffer:s}:{stream:t,buffer:s}:{stream:r,buffer:s}},cw=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as dw}from"events";var Hl=e=>It(e,"ipc"),Vl=(e,t)=>{let r=vi(e);De({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var Wl=async({subprocess:e,buffer:t,maxBuffer:r,ipc:i,ipcOutput:n,verboseInfo:s})=>{if(!i)return n;let a=Hl(s),o=Ze(t,"ipc"),p=Ze(r,"ipc");for await(let d of ya({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:i,shouldAwait:!1,reference:!0}))o&&(Xd(e,n,p),n.push(d)),a&&Vl(d,s);return n},Kl=async(e,t)=>(await Promise.allSettled([e]),t);var Yl=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:i,lines:n,timeoutDuration:s,cancelSignal:a,gracefulCancel:o,forceKillAfterDelay:p,stripFinalNewline:d,ipc:c,ipcInput:u},context:l,verboseInfo:m,fileDescriptors:h,originalStreams:f,onInternalError:w,controller:v})=>{let x=tl(e,l),_={originalStreams:f,fileDescriptors:h,subprocess:e,exitPromise:x,propagating:!1},T=Gl({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:d,verboseInfo:m,streamInfo:_}),S=Nl({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:d,verboseInfo:m,streamInfo:_}),F=[],O=Wl({subprocess:e,buffer:r,maxBuffer:i,ipc:c,ipcOutput:F,verboseInfo:m}),B=uw(f,e,_),U=lw(h,_);try{return await Promise.race([Promise.all([{},il(x),Promise.all(T),S,O,Pd(e,u),...B,...U]),w,mw(e,v),...xd(e,s,l,v),...Hc({subprocess:e,cancelSignal:a,gracefulCancel:o,context:l,controller:v}),...vd({subprocess:e,cancelSignal:a,gracefulCancel:o,forceKillAfterDelay:p,context:l,controller:v})])}catch(W){return l.terminationReason??="other",Promise.all([{error:W},x,Promise.all(T.map($=>ja($))),ja(S),Kl(O,F),Promise.allSettled(B),Promise.allSettled(U)])}},uw=(e,t,r)=>e.map((i,n)=>i===t.stdio[n]?void 0:Sr(i,n,r)),lw=(e,t)=>e.flatMap(({stdioItems:r},i)=>r.filter(({value:n,stream:s=n})=>je(s,{checkOpen:!1})&&!Ae(s)).map(({type:n,value:s,stream:a=s})=>Sr(a,i,t,{isSameDirection:xe.has(n),stopOnExit:n==="native"}))),mw=async(e,{signal:t})=>{let[r]=await dw(e,"error",{signal:t});throw r};var Jl=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),$r=(e,t,r)=>{let i=e[r];i.has(t)||i.set(t,[]);let n=i.get(t),s=Le();return n.push(s),{resolve:s.resolve.bind(s),promises:n}},Vt=async({resolve:e,promises:t},r)=>{e();let[i]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!i};import{Readable as hw}from"stream";import{callbackify as yw}from"util";import{finished as Xl}from"stream/promises";var Ra=async e=>{if(e!==void 0)try{await Ia(e)}catch{}},Zl=async e=>{if(e!==void 0)try{await Oa(e)}catch{}},Ia=async e=>{await Xl(e,{cleanup:!0,readable:!1,writable:!0})},Oa=async e=>{await Xl(e,{cleanup:!0,readable:!0,writable:!1})},qn=async(e,t)=>{if(await e,t)throw t},kn=(e,t,r)=>{r&&!bn(r)?e.destroy(r):t&&e.destroy()};var Ql=({subprocess:e,concurrentStreams:t,encoding:r},{from:i,binary:n=!0,preserveNewlines:s=!0}={})=>{let a=n||fe.has(r),{subprocessStdout:o,waitReadableDestroy:p}=Da(e,i,t),{readableEncoding:d,readableObjectMode:c,readableHighWaterMark:u}=La(o,a),{read:l,onStdoutDataDone:m}=Ba({subprocessStdout:o,subprocess:e,binary:a,encoding:r,preserveNewlines:s}),h=new hw({read:l,destroy:yw(Ma.bind(void 0,{subprocessStdout:o,subprocess:e,waitReadableDestroy:p})),highWaterMark:u,objectMode:c,encoding:d});return za({subprocessStdout:o,onStdoutDataDone:m,readable:h,subprocess:e}),h},Da=(e,t,r)=>{let i=zt(e,t),n=$r(r,i,"readableDestroy");return{subprocessStdout:i,waitReadableDestroy:n}},La=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},i)=>i?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Pa},Ba=({subprocessStdout:e,subprocess:t,binary:r,encoding:i,preserveNewlines:n})=>{let s=Le(),a=_n({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:i,preserveNewlines:n});return{read(){gw(this,a,s)},onStdoutDataDone:s}},gw=async(e,t,r)=>{try{let{value:i,done:n}=await t.next();n?r.resolve():e.push(i)}catch{}},za=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:i,subprocessStdin:n})=>{try{await Oa(e),await i,await Ra(n),await t,r.readable&&r.push(null)}catch(s){await Ra(n),em(r,s)}},Ma=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},i)=>{await Vt(r,t)&&(em(e,i),await qn(t,i))},em=(e,t)=>{kn(e,e.readable,t)};import{Writable as fw}from"stream";import{callbackify as tm}from"util";var rm=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:i,waitWritableFinal:n,waitWritableDestroy:s}=Fa(e,r,t),a=new fw({...Ga(i,e,n),destroy:tm(Na.bind(void 0,{subprocessStdin:i,subprocess:e,waitWritableFinal:n,waitWritableDestroy:s})),highWaterMark:i.writableHighWaterMark,objectMode:i.writableObjectMode});return Ua(i,a),a},Fa=(e,t,r)=>{let i=Ii(e,t),n=$r(r,i,"writableFinal"),s=$r(r,i,"writableDestroy");return{subprocessStdin:i,waitWritableFinal:n,waitWritableDestroy:s}},Ga=(e,t,r)=>({write:_w.bind(void 0,e),final:tm(bw.bind(void 0,e,t,r))}),_w=(e,t,r,i)=>{e.write(t,r)?i():e.once("drain",i)},bw=async(e,t,r)=>{await Vt(r,t)&&(e.writable&&e.end(),await t)},Ua=async(e,t,r)=>{try{await Ia(e),t.writable&&t.end()}catch(i){await Zl(r),im(t,i)}},Na=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:i},n)=>{await Vt(r,t),await Vt(i,t)&&(im(e,n),await qn(t,n))},im=(e,t)=>{kn(e,e.writable,t)};import{Duplex as qw}from"stream";import{callbackify as kw}from"util";var nm=({subprocess:e,concurrentStreams:t,encoding:r},{from:i,to:n,binary:s=!0,preserveNewlines:a=!0}={})=>{let o=s||fe.has(r),{subprocessStdout:p,waitReadableDestroy:d}=Da(e,i,t),{subprocessStdin:c,waitWritableFinal:u,waitWritableDestroy:l}=Fa(e,n,t),{readableEncoding:m,readableObjectMode:h,readableHighWaterMark:f}=La(p,o),{read:w,onStdoutDataDone:v}=Ba({subprocessStdout:p,subprocess:e,binary:o,encoding:r,preserveNewlines:a}),x=new qw({read:w,...Ga(c,e,u),destroy:kw(vw.bind(void 0,{subprocessStdout:p,subprocessStdin:c,subprocess:e,waitReadableDestroy:d,waitWritableFinal:u,waitWritableDestroy:l})),readableHighWaterMark:f,writableHighWaterMark:c.writableHighWaterMark,readableObjectMode:h,writableObjectMode:c.writableObjectMode,encoding:m});return za({subprocessStdout:p,onStdoutDataDone:v,readable:x,subprocess:e,subprocessStdin:c}),Ua(c,x,p),x},vw=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:i,waitWritableFinal:n,waitWritableDestroy:s},a)=>{await Promise.all([Ma({subprocessStdout:e,subprocess:r,waitReadableDestroy:i},a),Na({subprocessStdin:t,subprocess:r,waitWritableFinal:n,waitWritableDestroy:s},a)])};var Ha=(e,t,{from:r,binary:i=!1,preserveNewlines:n=!1}={})=>{let s=i||fe.has(t),a=zt(e,r),o=_n({subprocessStdout:a,subprocess:e,binary:s,shouldEncode:!0,encoding:t,preserveNewlines:n});return ww(o,a,e)},ww=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}};var sm=(e,{encoding:t})=>{let r=Jl();e.readable=Ql.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=rm.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=nm.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=Ha.bind(void 0,e,t),e[Symbol.asyncIterator]=Ha.bind(void 0,e,t,{})};var am=(e,t)=>{for(let[r,i]of Sw){let n=i.value.bind(t);Reflect.defineProperty(e,r,{...i,value:n})}},xw=(async()=>{})().constructor.prototype,Sw=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(xw,e)]);var om=(e,t,r,i)=>{let{file:n,commandArguments:s,command:a,escapedCommand:o,startTime:p,verboseInfo:d,options:c,fileDescriptors:u}=Ew(e,t,r),{subprocess:l,promise:m}=jw({file:n,commandArguments:s,options:c,startTime:p,verboseInfo:d,command:a,escapedCommand:o,fileDescriptors:u});return l.pipe=fn.bind(void 0,{source:l,sourcePromise:m,boundOptions:{},createNested:i}),am(l,m),Be.set(l,{options:c,fileDescriptors:u}),l},Ew=(e,t,r)=>{let{command:i,escapedCommand:n,startTime:s,verboseInfo:a}=xi(e,t,r),{file:o,commandArguments:p,options:d}=Hi(e,t,r),c=Pw(d),u=_l(c,a);return{file:o,commandArguments:p,command:i,escapedCommand:n,startTime:s,verboseInfo:a,options:c,fileDescriptors:u}},Pw=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},jw=({file:e,commandArguments:t,options:r,startTime:i,verboseInfo:n,command:s,escapedCommand:a,fileDescriptors:o})=>{let p;try{p=Aw(...Vi(e,t,r))}catch(h){return hl({error:h,command:s,escapedCommand:a,fileDescriptors:o,options:r,startTime:i,verboseInfo:n})}let d=new AbortController;$w(Number.POSITIVE_INFINITY,d.signal);let c=[...p.stdio];Al(p,o,d),Pl(p,r,d);let u={},l=Le();p.kill=Uc.bind(void 0,{kill:p.kill.bind(p),options:r,onInternalError:l,context:u,controller:d}),p.all=Ul(p,r),sm(p,r),ul(p,r);let m=Cw({subprocess:p,options:r,startTime:i,verboseInfo:n,fileDescriptors:o,originalStreams:c,command:s,escapedCommand:a,context:u,onInternalError:l,controller:d});return{subprocess:p,promise:m}},Cw=async({subprocess:e,options:t,startTime:r,verboseInfo:i,fileDescriptors:n,originalStreams:s,command:a,escapedCommand:o,context:p,onInternalError:d,controller:c})=>{let[u,[l,m],h,f,w]=await Yl({subprocess:e,options:t,context:p,verboseInfo:i,fileDescriptors:n,originalStreams:s,onInternalError:d,controller:c});c.abort(),d.resolve();let v=h.map((T,S)=>et(T,t,S)),x=et(f,t,"all"),_=Tw({errorInfo:u,exitCode:l,signal:m,stdio:v,all:x,ipcOutput:w,context:p,options:t,command:a,escapedCommand:o,startTime:r});return Ut(_,i,t)},Tw=({errorInfo:e,exitCode:t,signal:r,stdio:i,all:n,ipcOutput:s,context:a,options:o,command:p,escapedCommand:d,startTime:c})=>"error"in e?qr({error:e.error,command:p,escapedCommand:d,timedOut:a.terminationReason==="timeout",isCanceled:a.terminationReason==="cancel"||a.terminationReason==="gracefulCancel",isGracefullyCanceled:a.terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof ze,isForcefullyTerminated:a.isForcefullyTerminated,exitCode:t,signal:r,stdio:i,all:n,ipcOutput:s,options:o,startTime:c,isSync:!1}):tn({command:p,escapedCommand:d,stdio:i,all:n,ipcOutput:s,options:o,startTime:c});var vn=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([i,n])=>[i,Rw(i,e[i],n)]));return{...e,...r}},Rw=(e,t,r)=>Iw.has(e)&&Y(t)&&Y(r)?{...t,...r}:r,Iw=new Set(["env",...ks]);var dt=(e,t,r,i)=>{let n=(a,o,p)=>dt(a,o,r,p),s=(...a)=>Ow({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:i,createNested:n},...a);return i!==void 0&&i(s,n,t),s},Ow=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:i,createNested:n},s,...a)=>{if(Y(s))return n(e,vn(r,s),i);let{file:o,commandArguments:p,options:d,isSync:c}=Dw({mapArguments:e,firstArgument:s,nextArguments:a,deepOptions:t,boundOptions:r});return c?sl(o,p,d):om(o,p,d,n)},Dw=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:i,boundOptions:n})=>{let s=_p(t)?bp(t,r):[t,...r],[a,o,p]=mi(...s),d=vn(vn(i,n),p),{file:c=a,commandArguments:u=o,options:l=d,isSync:m=!1}=e({file:a,commandArguments:o,options:d});return{file:c,commandArguments:u,options:l,isSync:m}};var pm=({file:e,commandArguments:t})=>dm(e,t),cm=({file:e,commandArguments:t})=>({...dm(e,t),isSync:!0}),dm=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...i]=Lw(e);return{file:r,commandArguments:i}},Lw=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let i of t.split(Bw)){let n=r.at(-1);n&&n.endsWith("\\")?r[r.length-1]=`${n.slice(0,-1)} ${i}`:r.push(i)}return r},Bw=/ +/g;var um=(e,t,r)=>{e.sync=t(zw,r),e.s=e.sync},lm=({options:e})=>mm(e),zw=({options:e})=>({...mm(e),isSync:!0}),mm=e=>({options:{...Mw(e),...e}}),Mw=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},hm={preferLocal:!0};var te=dt(()=>({})),f1=dt(()=>({isSync:!0})),ut=dt(pm),_1=dt(cm),b1=dt($d),q1=dt(lm,{},hm,um),{sendMessage:k1,getOneMessage:v1,getEachMessage:w1,getCancelSignal:x1}=ll();var ye=D(K(),1);var Wt=D(K(),1);import he from"fs";import Nw from"os";import me from"path";import Ce from"fs";import tt from"path";function b(e=process.cwd()){let t=Fw(e),r=tt.join(t,"docker-compose.yml");if(!Ce.existsSync(r))throw new Error(`Not a Spree project directory. No docker-compose.yml found.
142
- Run this command from a directory created with create-spree-app.`);let i=Gw(t);return{mode:"docker",projectDir:t,port:i}}var ym=["server","backend"];function xn(e){return ym.find(t=>Ce.existsSync(tt.join(e,t)))??"server"}function Fw(e){let t=tt.basename(e);if(!ym.includes(t))return e;let r=tt.dirname(e),i=new RegExp(`\\./${t}:/rails(:\\w+)?(\\s|$)`,"m");for(let n of["docker-compose.yml","docker-compose.dev.yml"]){let s=tt.join(r,n);if(Ce.existsSync(s))try{if(i.test(Ce.readFileSync(s,"utf-8")))return r}catch{}}return e}function Fe(e){let t=tt.join(e,".env");if(!Ce.existsSync(t))return!1;try{let r=Ce.readFileSync(t,"utf-8");return/^\s*SPREE_PATH\s*=/m.test(r)}catch{return!1}}function Sn(e){let t=tt.join(e,"docker-compose.yml");if(!Ce.existsSync(t))return!1;try{return/^\s*build\s*:/m.test(Ce.readFileSync(t,"utf-8"))}catch{return!1}}function $n(e){try{let r=Ce.readFileSync(tt.join(e,".env"),"utf-8").match(/^SPREE_SAMPLE_DATA=(true|false)\b/m);return r?r[1]==="true":void 0}catch{return}}function Gw(e){let t=tt.join(e,".env");if(!Ce.existsSync(t))return 3e3;let i=Ce.readFileSync(t,"utf-8").match(/^SPREE_PORT=(\d+)/m);return i?Number(i[1]):3e3}var gm=D(K(),1);async function Z(e,t,r){return te("docker",["compose",...e],{cwd:t,...r})}async function lt(e,t){try{await Z(["up","-d","--no-deps","web"],e,{stdio:t?.stdio??"inherit"})}catch{}}async function se(e,t,r){return(await Wa(["bin/rails",e],t,{env:r})).split(`
141
+ if (condition) { yield value; }`)};p();import{Buffer as Ak}from"buffer";import{StringDecoder as Ek}from"string_decoder";var fn=(e,t,r)=>{if(r)return;if(e)return{transform:Pk.bind(void 0,new TextEncoder)};let i=new Ek(t);return{transform:jk.bind(void 0,i),final:Ck.bind(void 0,i)}},Pk=function*(e,t){Ak.isBuffer(t)?yield et(t):typeof t=="string"?yield e.encode(t):yield t},jk=function*(e,t){yield re(t)?e.write(t):t},Ck=function*(e){let t=e.end();t!==""&&(yield t)};p();import{callbackify as Qu}from"util";var ga=Qu(async(e,t,r,i)=>{t.currentIterable=e(...r);try{for await(let n of t.currentIterable)i.push(n)}finally{delete t.currentIterable}}),_n=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:i=Rk}=t[r];for await(let n of i(e))yield*_n(n,t,r+1)},el=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Tk(r,Number(t),e)},Tk=async function*(e,t,r){if(e!==void 0)for await(let i of e())yield*_n(i,r,t+1)},tl=Qu(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Rk=function*(e){yield e};p();var fa=(e,t,r,i)=>{try{for(let n of e(...t))r.push(n);i()}catch(n){i(n)}},rl=(e,t)=>[...t.flatMap(r=>[...At(r,e,0)]),...Er(e)],At=function*(e,t,r){if(r===t.length){yield e;return}let{transform:i=Ok}=t[r];for(let n of i(e))yield*At(n,t,r+1)},Er=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Ik(r,Number(t),e)},Ik=function*(e,t,r){if(e!==void 0)for(let i of e())yield*At(i,r,t+1)},Ok=function*(e){yield e};var _a=({value:e,value:{transform:t,final:r,writableObjectMode:i,readableObjectMode:n},optionName:s},{encoding:a})=>{let o={},c=nl(e,a,s),u=$t(t),d=$t(r),l=u?ga.bind(void 0,_n,o):fa.bind(void 0,At),h=u||d?ga.bind(void 0,el,o):fa.bind(void 0,Er),y=u||d?tl.bind(void 0,o):void 0;return{stream:new Dk({writableObjectMode:i,writableHighWaterMark:il(i),readableObjectMode:n,readableHighWaterMark:il(n),transform(b,S,x){l([b,c,0],this,x)},flush(b){h([c],this,b)},destroy:y})}},bn=(e,t,r,i)=>{let n=t.filter(({type:a})=>a==="generator"),s=i?n.reverse():n;for(let{value:a,optionName:o}of s){let c=nl(a,r,o);e=rl(c,e)}return e},nl=({transform:e,final:t,binary:r,writableObjectMode:i,readableObjectMode:n,preserveNewlines:s},a,o)=>{let c={};return[{transform:Ju(i,o)},fn(r,a,i),gn(r,s,i,c),{transform:e,final:t},{transform:Xu(n,o)},Yu({binary:r,preserveNewlines:s,readableObjectMode:n,state:c})].filter(Boolean)};var sl=(e,t)=>{for(let r of Lk(e))Bk(e,r,t)},Lk=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(([t])=>Number(t))),Bk=(e,t,r)=>{let{stdioItems:i}=e[t],n=i.filter(({contents:o})=>o!==void 0);if(n.length===0)return;if(t!==0){let[{type:o,optionName:c}]=n;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${lt[o]} with synchronous methods.`)}let a=n.map(({contents:o})=>o).map(o=>zk(o,i));r.input=_r(a)},zk=(e,t)=>{let r=bn(e,t,"utf8",!0);return Mk(r),_r(r)},Mk=e=>{let t=e.find(r=>typeof r!="string"&&!re(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};p();import{writeFileSync as Nk,appendFileSync as Vk}from"fs";p();var qn=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:i})=>i!=="all"&&Lt(r,i)&&!be.has(t)&&Fk(i)&&(e.some(({type:n,value:s})=>n==="native"&&Gk.has(s))||e.every(({type:n})=>$e.has(n))),Fk=e=>e===1||e===2,Gk=new Set(["pipe","overlapped"]),al=async(e,t,r,i)=>{for await(let n of e)Uk(t)||pl(n,r,i)},ol=(e,t,r)=>{for(let i of e)pl(i,t,r)},Uk=e=>e._readableState.pipes.length>0,pl=(e,t,r)=>{let i=Ci(e);ze({type:"output",verboseMessage:i,fdNumber:t,verboseInfo:r})};var cl=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:i,verboseInfo:n})=>{if(t===null)return{output:Array.from({length:3})};let s={},a=new Set([]);return{output:t.map((c,u)=>Hk({result:c,fileDescriptors:e,fdNumber:u,state:s,outputFiles:a,isMaxBuffer:i,verboseInfo:n},r)),...s}},Hk=({result:e,fileDescriptors:t,fdNumber:r,state:i,outputFiles:n,isMaxBuffer:s,verboseInfo:a},{buffer:o,encoding:c,lines:u,stripFinalNewline:d,maxBuffer:l})=>{if(e===null)return;let h=du(e,s,l),y=et(h),{stdioItems:g,objectMode:b}=t[r],S=Wk([y],g,c,i),{serializedResult:x,finalResult:$=x}=Kk({chunks:S,objectMode:b,encoding:c,lines:u,stripFinalNewline:d,fdNumber:r});Yk({serializedResult:x,fdNumber:r,state:i,verboseInfo:a,encoding:c,stdioItems:g,objectMode:b});let q=o[r]?$:void 0;try{return i.error===void 0&&Jk(x,g,n),q}catch(I){return i.error=I,q}},Wk=(e,t,r,i)=>{try{return bn(e,t,r,!1)}catch(n){return i.error=n,e}},Kk=({chunks:e,objectMode:t,encoding:r,lines:i,stripFinalNewline:n,fdNumber:s})=>{if(t)return{serializedResult:e};if(r==="buffer")return{serializedResult:_r(e)};let a=xp(e,r);return i[s]?{serializedResult:a,finalResult:ya(a,!n[s],t)}:{serializedResult:a}},Yk=({serializedResult:e,fdNumber:t,state:r,verboseInfo:i,encoding:n,stdioItems:s,objectMode:a})=>{if(!qn({stdioItems:s,encoding:n,verboseInfo:i,fdNumber:t}))return;let o=ya(e,!1,a);try{ol(o,t,i)}catch(c){r.error??=c}},Jk=(e,t,r)=>{for(let{path:i,append:n}of t.filter(({type:s})=>hn.has(s))){let s=typeof i=="string"?i:i.toString();n||r.has(s)?Vk(i,e):(r.add(s),Nk(i,e))}};p();var dl=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,it(t,r,"all")]:Array.isArray(t)?[it(e,r,"all"),...t]:re(e)&&re(t)?xs([e,t]):`${e}${t}`};p();p();import{once as ba}from"events";var ul=async(e,t)=>{let[r,i]=await Xk(e);return t.isForcefullyTerminated??=!1,[r,i]},Xk=async e=>{let[t,r]=await Promise.allSettled([ba(e,"spawn"),ba(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?ll(e):r.value},ll=async e=>{try{return await ba(e,"exit")}catch{return ll(e)}},ml=async e=>{let[t,r]=await e;if(!Zk(t,r)&&qa(t,r))throw new Ce;return[t,r]},Zk=(e,t)=>e===void 0&&t===void 0,qa=(e,t)=>e!==0||t!==null;var hl=({error:e,status:t,signal:r,output:i},{maxBuffer:n})=>{let s=Qk(e,t,r),a=s?.code==="ETIMEDOUT",o=cu(s,i,n);return{resultError:s,exitCode:t,signal:r,timedOut:a,isMaxBuffer:o}},Qk=(e,t,r)=>e!==void 0?e:qa(t,r)?new Ce:void 0;var yl=(e,t,r)=>{let{file:i,commandArguments:n,command:s,escapedCommand:a,startTime:o,verboseInfo:c,options:u,fileDescriptors:d}=tv(e,t,r),l=nv({file:i,commandArguments:n,options:u,command:s,escapedCommand:a,verboseInfo:c,fileDescriptors:d,startTime:o});return Ht(l,c,u)},tv=(e,t,r)=>{let{command:i,escapedCommand:n,startTime:s,verboseInfo:a}=Ri(e,t,r),o=rv(r),{file:c,commandArguments:u,options:d}=en(e,t,o);iv(d);let l=Vu(d,a);return{file:c,commandArguments:u,command:i,escapedCommand:n,startTime:s,verboseInfo:a,options:d,fileDescriptors:l}},rv=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,iv=({ipc:e,ipcInput:t,detached:r,cancelSignal:i})=>{t&&kn("ipcInput"),e&&kn("ipc: true"),r&&kn("detached: true"),i&&kn("cancelSignal")},kn=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},nv=({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,verboseInfo:s,fileDescriptors:a,startTime:o})=>{let c=sv({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,fileDescriptors:a,startTime:o});if(c.failed)return c;let{resultError:u,exitCode:d,signal:l,timedOut:h,isMaxBuffer:y}=hl(c,r),{output:g,error:b=u}=cl({fileDescriptors:a,syncResult:c,options:r,isMaxBuffer:y,verboseInfo:s}),S=g.map(($,q)=>it($,r,q)),x=it(dl(g,r),r,"all");return ov({error:b,exitCode:d,signal:l,timedOut:h,isMaxBuffer:y,stdio:S,all:x,options:r,command:i,escapedCommand:n,startTime:o})},sv=({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,fileDescriptors:s,startTime:a})=>{try{sl(s,r);let o=av(r);return ev(...tn(e,t,o))}catch(o){return Vt({error:o,command:i,escapedCommand:n,fileDescriptors:s,options:r,startTime:a,isSync:!0})}},av=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:dn(t)}),ov=({error:e,exitCode:t,signal:r,timedOut:i,isMaxBuffer:n,stdio:s,all:a,options:o,command:c,escapedCommand:u,startTime:d})=>e===void 0?un({command:c,escapedCommand:u,stdio:s,all:a,ipcOutput:[],options:o,startTime:d}):Ar({error:e,command:c,escapedCommand:u,timedOut:i,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:n,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:s,all:a,ipcOutput:[],options:o,startTime:d,isSync:!0});p();import{setMaxListeners as Kw}from"events";import{spawn as Yw}from"child_process";p();import ql from"process";p();import{once as ka,on as pv}from"events";var gl=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},{reference:n=!0,filter:s}={})=>(Mt({methodName:"getOneMessage",isSubprocess:r,ipc:i,isConnected:Ki(e)}),cv({anyProcess:e,channel:t,isSubprocess:r,filter:s,reference:n})),cv=async({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:n})=>{Ni(t,n);let s=ut(e,t,r),a=new AbortController;try{return await Promise.race([dv(s,i,a),uv(s,r,a),lv(s,r,a)])}catch(o){throw Ft(e),o}finally{a.abort(),Vi(t,n)}},dv=async(e,t,{signal:r})=>{if(t===void 0){let[i]=await ka(e,"message",{signal:r});return i}for await(let[i]of pv(e,"message",{signal:r}))if(t(i))return i},uv=async(e,t,{signal:r})=>{await ka(e,"disconnect",{signal:r}),rd(t)},lv=async(e,t,{signal:r})=>{let[i]=await ka(e,"strict:error",{signal:r});throw Fi(i,t)};p();import{once as _l,on as mv}from"events";var bl=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},{reference:n=!0}={})=>va({anyProcess:e,channel:t,isSubprocess:r,ipc:i,shouldAwait:!r,reference:n}),va=({anyProcess:e,channel:t,isSubprocess:r,ipc:i,shouldAwait:n,reference:s})=>{Mt({methodName:"getEachMessage",isSubprocess:r,ipc:i,isConnected:Ki(e)}),Ni(t,s);let a=ut(e,t,r),o=new AbortController,c={};return hv(e,a,o),yv({ipcEmitter:a,isSubprocess:r,controller:o,state:c}),gv({anyProcess:e,channel:t,ipcEmitter:a,isSubprocess:r,shouldAwait:n,controller:o,state:c,reference:s})},hv=async(e,t,r)=>{try{await _l(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},yv=async({ipcEmitter:e,isSubprocess:t,controller:r,state:i})=>{try{let[n]=await _l(e,"strict:error",{signal:r.signal});i.error=Fi(n,t),r.abort()}catch{}},gv=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:i,shouldAwait:n,controller:s,state:a,reference:o}){try{for await(let[c]of mv(r,"message",{signal:s.signal}))fl(a),yield c}catch{fl(a)}finally{s.abort(),Vi(t,o),i||Ft(e),n&&await e}},fl=({error:e})=>{if(e)throw e};var kl=(e,{ipc:t})=>{Object.assign(e,wl(e,!1,t))},vl=()=>{let e=ql,t=!0,r=ql.channel!==void 0;return{...wl(e,t,r),getCancelSignal:Pd.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},wl=(e,t,r)=>({sendMessage:Zi.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:gl.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:bl.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});p();import{ChildProcess as fv}from"child_process";import{PassThrough as _v,Readable as bv,Writable as qv,Duplex as kv}from"stream";var xl=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,verboseInfo:a})=>{la(i);let o=new fv;vv(o,i),Object.assign(o,{readable:wv,writable:xv,duplex:Sv});let c=Vt({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,isSync:!1}),u=$v(c,a,n);return{subprocess:o,promise:u}},vv=(e,t)=>{let r=Pr(),i=Pr(),n=Pr(),s=Array.from({length:t.length-3},Pr),a=Pr(),o=[r,i,n,...s];Object.assign(e,{stdin:r,stdout:i,stderr:n,all:a,stdio:o})},Pr=()=>{let e=new _v;return e.end(),e},wv=()=>new bv({read(){}}),xv=()=>new qv({write(){}}),Sv=()=>new kv({read(){},write(){}}),$v=async(e,t,r)=>Ht(e,t,r);p();import{createReadStream as Sl,createWriteStream as $l}from"fs";import{Buffer as Av}from"buffer";import{Readable as jr,Writable as Ev,Duplex as Pv}from"stream";var El=(e,t)=>yn(jv,e,t,!1),Cr=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${lt[e]}.`)},Al={fileNumber:Cr,generator:_a,asyncGenerator:_a,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:r}}){let i=t||r;return{stream:Pv.fromWeb(e,{objectMode:i})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},jv={input:{...Al,fileUrl:({value:e})=>({stream:Sl(e)}),filePath:({value:{file:e}})=>({stream:Sl(e)}),webStream:({value:e})=>({stream:jr.fromWeb(e)}),iterable:({value:e})=>({stream:jr.from(e)}),asyncIterable:({value:e})=>({stream:jr.from(e)}),string:({value:e})=>({stream:jr.from(e)}),uint8Array:({value:e})=>({stream:jr.from(Av.from(e))})},output:{...Al,fileUrl:({value:e})=>({stream:$l(e)}),filePath:({value:{file:e,append:t}})=>({stream:$l(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:Ev.fromWeb(e)}),iterable:Cr,asyncIterable:Cr,string:Cr,uint8Array:Cr}};p();p();import{on as Cv,once as Pl}from"events";import{PassThrough as Tv,getDefaultHighWaterMark as Rv}from"stream";import{finished as Tl}from"stream/promises";function Et(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, got \`${typeof e}\`.`);for(let n of e)xa(n);let t=e.some(({readableObjectMode:n})=>n),r=Iv(e,t),i=new wa({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let n of e)i.add(n);return i}var Iv=(e,t)=>{if(e.length===0)return Rv(t);let r=e.filter(({readableObjectMode:i})=>i===t).map(({readableHighWaterMark:i})=>i);return Math.max(...r)},wa=class extends Tv{#t=new Set([]);#r=new Set([]);#e=new Set([]);#i;#s=Symbol("unpipe");#n=new WeakMap;add(t){if(xa(t),this.#t.has(t))return;this.#t.add(t),this.#i??=Ov(this,this.#t,this.#s);let r=Bv({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#i,unpipeEvent:this.#s});this.#n.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(xa(t),!this.#t.has(t))return!1;let r=this.#n.get(t);return r===void 0?!1:(this.#n.delete(t),t.unpipe(this),await r,!0)}},Ov=async(e,t,r)=>{vn(e,jl);let i=new AbortController;try{await Promise.race([Dv(e,i),Lv(e,t,r,i)])}finally{i.abort(),vn(e,-jl)}},Dv=async(e,{signal:t})=>{try{await Tl(e,{signal:t,cleanup:!0})}catch(r){throw Rl(e,r),r}},Lv=async(e,t,r,{signal:i})=>{for await(let[n]of Cv(e,"unpipe",{signal:i}))t.has(n)&&n.emit(r)},xa=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},Bv=async({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,onFinished:s,unpipeEvent:a})=>{vn(e,Cl);let o=new AbortController;try{await Promise.race([zv(s,t,o),Mv({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,controller:o}),Fv({stream:t,streams:r,ended:i,aborted:n,unpipeEvent:a,controller:o})])}finally{o.abort(),vn(e,-Cl)}r.size>0&&r.size===i.size+n.size&&(i.size===0&&n.size>0?Sa(e):Gv(e))},zv=async(e,t,{signal:r})=>{try{await e,r.aborted||Sa(t)}catch(i){r.aborted||Rl(t,i)}},Mv=async({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,controller:{signal:s}})=>{try{await Tl(t,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&i.add(t)}catch(a){if(s.aborted||!r.has(t))return;Il(a)?n.add(t):Ol(e,a)}},Fv=async({stream:e,streams:t,ended:r,aborted:i,unpipeEvent:n,controller:{signal:s}})=>{if(await Pl(e,n,{signal:s}),!e.readable)return Pl(s,"abort",{signal:s});t.delete(e),r.delete(e),i.delete(e)},Gv=e=>{e.writable&&e.end()},Rl=(e,t)=>{Il(t)?Sa(e):Ol(e,t)},Il=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Sa=e=>{(e.readable||e.writable)&&e.destroy()},Ol=(e,t)=>{e.destroyed||(e.once("error",Uv),e.destroy(t))},Uv=()=>{},vn=(e,t)=>{let r=e.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},jl=2,Cl=1;p();import{finished as Dl}from"stream/promises";var Kt=(e,t)=>{e.pipe(t),Nv(e,t),Vv(e,t)},Nv=async(e,t)=>{if(!(je(e)||je(t))){try{await Dl(e,{cleanup:!0,readable:!0,writable:!1})}catch{}$a(t)}},$a=e=>{e.writable&&e.end()},Vv=async(e,t)=>{if(!(je(e)||je(t))){try{await Dl(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Aa(e)}},Aa=e=>{e.readable&&e.destroy()};var Ll=(e,t,r)=>{let i=new Map;for(let[n,{stdioItems:s,direction:a}]of Object.entries(t)){for(let{stream:o}of s.filter(({type:c})=>$e.has(c)))Hv(e,o,a,n);for(let{stream:o}of s.filter(({type:c})=>!$e.has(c)))Kv({subprocess:e,stream:o,direction:a,fdNumber:n,pipeGroups:i,controller:r})}for(let[n,s]of i.entries()){let a=s.length===1?s[0]:Et(s);Kt(a,n)}},Hv=(e,t,r,i)=>{r==="output"?Kt(e.stdio[i],t):Kt(t,e.stdio[i]);let n=Wv[i];n!==void 0&&(e[n]=t),e.stdio[i]=t},Wv=["stdin","stdout","stderr"],Kv=({subprocess:e,stream:t,direction:r,fdNumber:i,pipeGroups:n,controller:s})=>{if(t===void 0)return;Yv(t,s);let[a,o]=r==="output"?[t,e.stdio[i]]:[e.stdio[i],t],c=n.get(a)??[];n.set(a,[...c,o])},Yv=(e,{signal:t})=>{je(e)&&xt(e,Jv,t)},Jv=2;p();import{addAbortListener as Qv}from"events";p();p();var Pt=[];Pt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Pt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Pt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var wn=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Ea=Symbol.for("signal-exit emitter"),Pa=globalThis,Xv=Object.defineProperty.bind(Object),ja=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Pa[Ea])return Pa[Ea];Xv(Pa,Ea,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let i=this.listeners[t],n=i.indexOf(r);n!==-1&&(n===0&&i.length===1?i.length=0:i.splice(n,1))}emit(t,r,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(let s of this.listeners[t])n=s(r,i)===!0||n;return t==="exit"&&(n=this.emit("afterExit",r,i)||n),n}},xn=class{},Zv=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Ca=class extends xn{onExit(){return()=>{}}load(){}unload(){}},Ta=class extends xn{#t=Ra.platform==="win32"?"SIGINT":"SIGHUP";#r=new ja;#e;#i;#s;#n={};#a=!1;constructor(t){super(),this.#e=t,this.#n={};for(let r of Pt)this.#n[r]=()=>{let i=this.#e.listeners(r),{count:n}=this.#r,s=t;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(n+=s.__signal_exit_emitter__.count),i.length===n){this.unload();let a=this.#r.emit("exit",null,r),o=r==="SIGHUP"?this.#t:r;a||t.kill(t.pid,o)}};this.#s=t.reallyExit,this.#i=t.emit}onExit(t,r){if(!wn(this.#e))return()=>{};this.#a===!1&&this.load();let i=r?.alwaysLast?"afterExit":"exit";return this.#r.on(i,t),()=>{this.#r.removeListener(i,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#a){this.#a=!0,this.#r.count+=1;for(let t of Pt)try{let r=this.#n[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#p(t,...r),this.#e.reallyExit=t=>this.#o(t)}}unload(){this.#a&&(this.#a=!1,Pt.forEach(t=>{let r=this.#n[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#i,this.#e.reallyExit=this.#s,this.#r.count-=1)}#o(t){return wn(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)):0}#p(t,...r){let i=this.#i;if(t==="exit"&&wn(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let n=i.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),n}else return i.call(this.#e,t,...r)}},Ra=globalThis.process,{onExit:Bl,load:E1,unload:P1}=Zv(wn(Ra)?new Ta(Ra):new Ca);var zl=(e,{cleanup:t,detached:r},{signal:i})=>{if(!t||r)return;let n=Bl(()=>{e.kill()});Qv(i,()=>{n()})};p();p();var Fl=({source:e,sourcePromise:t,boundOptions:r,createNested:i},...n)=>{let s=Ti(),{destination:a,destinationStream:o,destinationError:c,from:u,unpipeSignal:d}=ew(r,i,n),{sourceStream:l,sourceError:h}=rw(e,u),{options:y,fileDescriptors:g}=Fe.get(e);return{sourcePromise:t,sourceStream:l,sourceOptions:y,sourceError:h,destination:a,destinationStream:o,destinationError:c,unpipeSignal:d,fileDescriptors:g,startTime:s}},ew=(e,t,r)=>{try{let{destination:i,pipeOptions:{from:n,to:s,unpipeSignal:a}={}}=tw(e,t,...r),o=Ui(i,s);return{destination:i,destinationStream:o,from:n,unpipeSignal:a}}catch(i){return{destinationError:i}}},tw=(e,t,r,...i)=>{if(Array.isArray(r))return{destination:t(Ml,e)(r,...i),pipeOptions:e};if(typeof r=="string"||r instanceof URL||vs(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[n,s,a]=vi(r,...i);return{destination:t(Ml)(n,s,a),pipeOptions:a}}if(Fe.has(r)){if(Object.keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:i[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ml=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),rw=(e,t)=>{try{return{sourceStream:Gt(e,t)}}catch(r){return{sourceError:r}}};p();var Ul=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i,fileDescriptors:n,sourceOptions:s,startTime:a})=>{let o=iw({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i});if(o!==void 0)throw Ia({error:o,fileDescriptors:n,sourceOptions:s,startTime:a})},iw=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i})=>{if(t!==void 0&&i!==void 0)return i;if(i!==void 0)return Aa(e),i;if(t!==void 0)return $a(r),t},Ia=({error:e,fileDescriptors:t,sourceOptions:r,startTime:i})=>Vt({error:e,command:Gl,escapedCommand:Gl,fileDescriptors:t,options:r,startTime:i,isSync:!1}),Gl="source.pipe(destination)";p();var Nl=async e=>{let[{status:t,reason:r,value:i=r},{status:n,reason:s,value:a=s}]=await e;if(a.pipedFrom.includes(i)||a.pipedFrom.push(i),n==="rejected")throw a;if(t==="rejected")throw i;return a};p();import{finished as nw}from"stream/promises";var Vl=(e,t,r)=>{let i=Sn.has(t)?aw(e,t):sw(e,t);return xt(e,pw,r.signal),xt(t,cw,r.signal),ow(t),i},sw=(e,t)=>{let r=Et([e]);return Kt(r,t),Sn.set(t,r),r},aw=(e,t)=>{let r=Sn.get(t);return r.add(e),r},ow=async e=>{try{await nw(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Sn.delete(e)},Sn=new WeakMap,pw=2,cw=1;p();import{aborted as dw}from"util";var Hl=(e,t)=>e===void 0?[]:[uw(e,t)],uw=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:i,sourceOptions:n,startTime:s})=>{await dw(e,t),await r.remove(t);let a=new Error("Pipe canceled by `unpipeSignal` option.");throw Ia({error:a,fileDescriptors:i,sourceOptions:n,startTime:s})};var $n=(e,...t)=>{if(Z(t[0]))return $n.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...i}=Fl(e,...t),n=lw({...i,destination:r});return n.pipe=$n.bind(void 0,{...e,source:r,sourcePromise:n,boundOptions:{}}),n},lw=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:i,destination:n,destinationStream:s,destinationError:a,unpipeSignal:o,fileDescriptors:c,startTime:u})=>{let d=mw(e,n);Ul({sourceStream:t,sourceError:i,destinationStream:s,destinationError:a,fileDescriptors:c,sourceOptions:r,startTime:u});let l=new AbortController;try{let h=Vl(t,s,l);return await Promise.race([Nl(d),...Hl(o,{sourceStream:t,mergedStream:h,sourceOptions:r,fileDescriptors:c,startTime:u})])}finally{l.abort()}},mw=(e,t)=>Promise.allSettled([e,t]);p();p();p();import{setImmediate as qw}from"timers/promises";p();import{on as hw}from"events";import{getDefaultHighWaterMark as yw}from"stream";var An=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:i,encoding:n,preserveNewlines:s})=>{let a=new AbortController;return gw(t,a),Kl({stream:e,controller:a,binary:r,shouldEncode:!e.readableObjectMode&&i,encoding:n,shouldSplit:!e.readableObjectMode,preserveNewlines:s})},gw=async(e,t)=>{try{await e}catch{}finally{t.abort()}},Oa=({stream:e,onStreamEnd:t,lines:r,encoding:i,stripFinalNewline:n,allMixed:s})=>{let a=new AbortController;fw(t,a,e);let o=e.readableObjectMode&&!s;return Kl({stream:e,controller:a,binary:i==="buffer",shouldEncode:!o,encoding:i,shouldSplit:!o&&r,preserveNewlines:!n})},fw=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},Kl=({stream:e,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:a})=>{let o=hw(e,"data",{signal:t.signal,highWaterMark:Wl,highWatermark:Wl});return _w({onStdoutChunk:o,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:a})},Da=yw(!0),Wl=Da,_w=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:a}){let o=bw({binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:a});try{for await(let[c]of e)yield*At(c,o,0)}catch(c){if(!t.signal.aborted)throw c}finally{yield*Er(o)}},bw=({binary:e,shouldEncode:t,encoding:r,shouldSplit:i,preserveNewlines:n})=>[fn(e,r,!t),gn(e,n,!i,{})].filter(Boolean);var Yl=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,buffer:n,maxBuffer:s,lines:a,allMixed:o,stripFinalNewline:c,verboseInfo:u,streamInfo:d})=>{let l=kw({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,allMixed:o,verboseInfo:u,streamInfo:d});if(!n){await Promise.all([vw(e),l]);return}let h=ma(c,r),y=Oa({stream:e,onStreamEnd:t,lines:a,encoding:i,stripFinalNewline:h,allMixed:o}),[g]=await Promise.all([ww({stream:e,iterable:y,fdNumber:r,encoding:i,maxBuffer:s,lines:a}),l]);return g},kw=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,allMixed:n,verboseInfo:s,streamInfo:{fileDescriptors:a}})=>{if(!qn({stdioItems:a[r]?.stdioItems,encoding:i,verboseInfo:s,fdNumber:r}))return;let o=Oa({stream:e,onStreamEnd:t,lines:!0,encoding:i,stripFinalNewline:!0,allMixed:n});await al(o,e,r,s)},vw=async e=>{await qw(),e.readableFlowing===null&&e.resume()},ww=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:i,encoding:n,maxBuffer:s,lines:a})=>{try{return t||a?await an(r,{maxBuffer:s}):n==="buffer"?new Uint8Array(await on(r,{maxBuffer:s})):await cn(r,{maxBuffer:s})}catch(o){return Jl(au({error:o,stream:e,readableObjectMode:t,lines:a,encoding:n,fdNumber:i}))}},La=async e=>{try{return await e}catch(t){return Jl(t)}},Jl=({bufferedData:e})=>vp(e)?new Uint8Array(e):e;p();import{finished as xw}from"stream/promises";var Tr=async(e,t,r,{isSameDirection:i,stopOnExit:n=!1}={})=>{let s=Sw(e,r),a=new AbortController;try{await Promise.race([...n?[r.exitPromise]:[],xw(e,{cleanup:!0,signal:a.signal})])}catch(o){s.stdinCleanedUp||Ew(o,t,r,i)}finally{a.abort()}},Sw=(e,{originalStreams:[t],subprocess:r})=>{let i={stdinCleanedUp:!1};return e===t&&$w(e,r,i),i},$w=(e,t,r)=>{let{_destroy:i}=e;e._destroy=(...n)=>{Aw(t,r),i.call(e,...n)}},Aw=({exitCode:e,signalCode:t},r)=>{(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},Ew=(e,t,r,i)=>{if(!Pw(e,t,r,i))throw e},Pw=(e,t,r,i=!0)=>r.propagating?Xl(e)||En(e):(r.propagating=!0,Ba(r,t)===i?Xl(e):En(e)),Ba=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",En=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Xl=e=>e?.code==="EPIPE";var Zl=({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:s,verboseInfo:a,streamInfo:o})=>e.stdio.map((c,u)=>za({stream:c,fdNumber:u,encoding:t,buffer:r[u],maxBuffer:i[u],lines:n[u],allMixed:!1,stripFinalNewline:s,verboseInfo:a,streamInfo:o})),za=async({stream:e,fdNumber:t,encoding:r,buffer:i,maxBuffer:n,lines:s,allMixed:a,stripFinalNewline:o,verboseInfo:c,streamInfo:u})=>{if(!e)return;let d=Tr(e,t,u);if(Ba(u,t)){await d;return}let[l]=await Promise.all([Yl({stream:e,onStreamEnd:d,fdNumber:t,encoding:r,buffer:i,maxBuffer:n,lines:s,allMixed:a,stripFinalNewline:o,verboseInfo:c,streamInfo:u}),d]);return l};var Ql=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?Et([e,t].filter(Boolean)):void 0,em=({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:s,verboseInfo:a,streamInfo:o})=>za({...jw(e,r),fdNumber:"all",encoding:t,maxBuffer:i[1]+i[2],lines:n[1]||n[2],allMixed:Cw(e),stripFinalNewline:s,verboseInfo:a,streamInfo:o}),jw=({stdout:e,stderr:t,all:r},[,i,n])=>{let s=i||n;return s?i?n?{stream:r,buffer:s}:{stream:e,buffer:s}:{stream:t,buffer:s}:{stream:r,buffer:s}},Cw=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode;p();import{once as Tw}from"events";p();p();var tm=e=>Lt(e,"ipc"),rm=(e,t)=>{let r=Ci(e);ze({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var im=async({subprocess:e,buffer:t,maxBuffer:r,ipc:i,ipcOutput:n,verboseInfo:s})=>{if(!i)return n;let a=tm(s),o=tt(t,"ipc"),c=tt(r,"ipc");for await(let u of va({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:i,shouldAwait:!1,reference:!0}))o&&(ou(e,n,c),n.push(u)),a&&rm(u,s);return n},nm=async(e,t)=>(await Promise.allSettled([e]),t);var sm=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:i,lines:n,timeoutDuration:s,cancelSignal:a,gracefulCancel:o,forceKillAfterDelay:c,stripFinalNewline:u,ipc:d,ipcInput:l},context:h,verboseInfo:y,fileDescriptors:g,originalStreams:b,onInternalError:S,controller:x})=>{let $=ul(e,h),q={originalStreams:b,fileDescriptors:g,subprocess:e,exitPromise:$,propagating:!1},I=Zl({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:u,verboseInfo:y,streamInfo:q}),A=em({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:u,verboseInfo:y,streamInfo:q}),U=[],L=im({subprocess:e,buffer:r,maxBuffer:i,ipc:d,ipcOutput:U,verboseInfo:y}),M=Rw(b,e,q),V=Iw(g,q);try{return await Promise.race([Promise.all([{},ml($),Promise.all(I),A,L,zd(e,l),...M,...V]),S,Ow(e,x),...Id(e,s,h,x),...td({subprocess:e,cancelSignal:a,gracefulCancel:o,context:h,controller:x}),...Td({subprocess:e,cancelSignal:a,gracefulCancel:o,forceKillAfterDelay:c,context:h,controller:x})])}catch(Y){return h.terminationReason??="other",Promise.all([{error:Y},$,Promise.all(I.map(E=>La(E))),La(A),nm(L,U),Promise.allSettled(M),Promise.allSettled(V)])}},Rw=(e,t,r)=>e.map((i,n)=>i===t.stdio[n]?void 0:Tr(i,n,r)),Iw=(e,t)=>e.flatMap(({stdioItems:r},i)=>r.filter(({value:n,stream:s=n})=>Re(s,{checkOpen:!1})&&!je(s)).map(({type:n,value:s,stream:a=s})=>Tr(a,i,t,{isSameDirection:$e.has(n),stopOnExit:n==="native"}))),Ow=async(e,{signal:t})=>{let[r]=await Tw(e,"error",{signal:t});throw r};p();p();var am=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Rr=(e,t,r)=>{let i=e[r];i.has(t)||i.set(t,[]);let n=i.get(t),s=Me();return n.push(s),{resolve:s.resolve.bind(s),promises:n}},Yt=async({resolve:e,promises:t},r)=>{e();let[i]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!i};p();import{Readable as Dw}from"stream";import{callbackify as Lw}from"util";p();import{finished as om}from"stream/promises";var Ma=async e=>{if(e!==void 0)try{await Fa(e)}catch{}},pm=async e=>{if(e!==void 0)try{await Ga(e)}catch{}},Fa=async e=>{await om(e,{cleanup:!0,readable:!1,writable:!0})},Ga=async e=>{await om(e,{cleanup:!0,readable:!0,writable:!1})},Pn=async(e,t)=>{if(await e,t)throw t},jn=(e,t,r)=>{r&&!En(r)?e.destroy(r):t&&e.destroy()};var cm=({subprocess:e,concurrentStreams:t,encoding:r},{from:i,binary:n=!0,preserveNewlines:s=!0}={})=>{let a=n||be.has(r),{subprocessStdout:o,waitReadableDestroy:c}=Ua(e,i,t),{readableEncoding:u,readableObjectMode:d,readableHighWaterMark:l}=Na(o,a),{read:h,onStdoutDataDone:y}=Va({subprocessStdout:o,subprocess:e,binary:a,encoding:r,preserveNewlines:s}),g=new Dw({read:h,destroy:Lw(Wa.bind(void 0,{subprocessStdout:o,subprocess:e,waitReadableDestroy:c})),highWaterMark:l,objectMode:d,encoding:u});return Ha({subprocessStdout:o,onStdoutDataDone:y,readable:g,subprocess:e}),g},Ua=(e,t,r)=>{let i=Gt(e,t),n=Rr(r,i,"readableDestroy");return{subprocessStdout:i,waitReadableDestroy:n}},Na=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},i)=>i?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Da},Va=({subprocessStdout:e,subprocess:t,binary:r,encoding:i,preserveNewlines:n})=>{let s=Me(),a=An({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:i,preserveNewlines:n});return{read(){Bw(this,a,s)},onStdoutDataDone:s}},Bw=async(e,t,r)=>{try{let{value:i,done:n}=await t.next();n?r.resolve():e.push(i)}catch{}},Ha=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:i,subprocessStdin:n})=>{try{await Ga(e),await i,await Ma(n),await t,r.readable&&r.push(null)}catch(s){await Ma(n),dm(r,s)}},Wa=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},i)=>{await Yt(r,t)&&(dm(e,i),await Pn(t,i))},dm=(e,t)=>{jn(e,e.readable,t)};p();import{Writable as zw}from"stream";import{callbackify as um}from"util";var lm=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:i,waitWritableFinal:n,waitWritableDestroy:s}=Ka(e,r,t),a=new zw({...Ya(i,e,n),destroy:um(Xa.bind(void 0,{subprocessStdin:i,subprocess:e,waitWritableFinal:n,waitWritableDestroy:s})),highWaterMark:i.writableHighWaterMark,objectMode:i.writableObjectMode});return Ja(i,a),a},Ka=(e,t,r)=>{let i=Ui(e,t),n=Rr(r,i,"writableFinal"),s=Rr(r,i,"writableDestroy");return{subprocessStdin:i,waitWritableFinal:n,waitWritableDestroy:s}},Ya=(e,t,r)=>({write:Mw.bind(void 0,e),final:um(Fw.bind(void 0,e,t,r))}),Mw=(e,t,r,i)=>{e.write(t,r)?i():e.once("drain",i)},Fw=async(e,t,r)=>{await Yt(r,t)&&(e.writable&&e.end(),await t)},Ja=async(e,t,r)=>{try{await Fa(e),t.writable&&t.end()}catch(i){await pm(r),mm(t,i)}},Xa=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:i},n)=>{await Yt(r,t),await Yt(i,t)&&(mm(e,n),await Pn(t,n))},mm=(e,t)=>{jn(e,e.writable,t)};p();import{Duplex as Gw}from"stream";import{callbackify as Uw}from"util";var hm=({subprocess:e,concurrentStreams:t,encoding:r},{from:i,to:n,binary:s=!0,preserveNewlines:a=!0}={})=>{let o=s||be.has(r),{subprocessStdout:c,waitReadableDestroy:u}=Ua(e,i,t),{subprocessStdin:d,waitWritableFinal:l,waitWritableDestroy:h}=Ka(e,n,t),{readableEncoding:y,readableObjectMode:g,readableHighWaterMark:b}=Na(c,o),{read:S,onStdoutDataDone:x}=Va({subprocessStdout:c,subprocess:e,binary:o,encoding:r,preserveNewlines:a}),$=new Gw({read:S,...Ya(d,e,l),destroy:Uw(Nw.bind(void 0,{subprocessStdout:c,subprocessStdin:d,subprocess:e,waitReadableDestroy:u,waitWritableFinal:l,waitWritableDestroy:h})),readableHighWaterMark:b,writableHighWaterMark:d.writableHighWaterMark,readableObjectMode:g,writableObjectMode:d.writableObjectMode,encoding:y});return Ha({subprocessStdout:c,onStdoutDataDone:x,readable:$,subprocess:e,subprocessStdin:d}),Ja(d,$,c),$},Nw=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:i,waitWritableFinal:n,waitWritableDestroy:s},a)=>{await Promise.all([Wa({subprocessStdout:e,subprocess:r,waitReadableDestroy:i},a),Xa({subprocessStdin:t,subprocess:r,waitWritableFinal:n,waitWritableDestroy:s},a)])};p();var Za=(e,t,{from:r,binary:i=!1,preserveNewlines:n=!1}={})=>{let s=i||be.has(t),a=Gt(e,r),o=An({subprocessStdout:a,subprocess:e,binary:s,shouldEncode:!0,encoding:t,preserveNewlines:n});return Vw(o,a,e)},Vw=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}};var ym=(e,{encoding:t})=>{let r=am();e.readable=cm.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=lm.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=hm.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=Za.bind(void 0,e,t),e[Symbol.asyncIterator]=Za.bind(void 0,e,t,{})};p();var gm=(e,t)=>{for(let[r,i]of Ww){let n=i.value.bind(t);Reflect.defineProperty(e,r,{...i,value:n})}},Hw=(async()=>{})().constructor.prototype,Ww=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Hw,e)]);var fm=(e,t,r,i)=>{let{file:n,commandArguments:s,command:a,escapedCommand:o,startTime:c,verboseInfo:u,options:d,fileDescriptors:l}=Jw(e,t,r),{subprocess:h,promise:y}=Zw({file:n,commandArguments:s,options:d,startTime:c,verboseInfo:u,command:a,escapedCommand:o,fileDescriptors:l});return h.pipe=$n.bind(void 0,{source:h,sourcePromise:y,boundOptions:{},createNested:i}),gm(h,y),Fe.set(h,{options:d,fileDescriptors:l}),h},Jw=(e,t,r)=>{let{command:i,escapedCommand:n,startTime:s,verboseInfo:a}=Ri(e,t,r),{file:o,commandArguments:c,options:u}=en(e,t,r),d=Xw(u),l=El(d,a);return{file:o,commandArguments:c,command:i,escapedCommand:n,startTime:s,verboseInfo:a,options:d,fileDescriptors:l}},Xw=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},Zw=({file:e,commandArguments:t,options:r,startTime:i,verboseInfo:n,command:s,escapedCommand:a,fileDescriptors:o})=>{let c;try{c=Yw(...tn(e,t,r))}catch(g){return xl({error:g,command:s,escapedCommand:a,fileDescriptors:o,options:r,startTime:i,verboseInfo:n})}let u=new AbortController;Kw(Number.POSITIVE_INFINITY,u.signal);let d=[...c.stdio];Ll(c,o,u),zl(c,r,u);let l={},h=Me();c.kill=Qc.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:h,context:l,controller:u}),c.all=Ql(c,r),ym(c,r),kl(c,r);let y=Qw({subprocess:c,options:r,startTime:i,verboseInfo:n,fileDescriptors:o,originalStreams:d,command:s,escapedCommand:a,context:l,onInternalError:h,controller:u});return{subprocess:c,promise:y}},Qw=async({subprocess:e,options:t,startTime:r,verboseInfo:i,fileDescriptors:n,originalStreams:s,command:a,escapedCommand:o,context:c,onInternalError:u,controller:d})=>{let[l,[h,y],g,b,S]=await sm({subprocess:e,options:t,context:c,verboseInfo:i,fileDescriptors:n,originalStreams:s,onInternalError:u,controller:d});d.abort(),u.resolve();let x=g.map((I,A)=>it(I,t,A)),$=it(b,t,"all"),q=ex({errorInfo:l,exitCode:h,signal:y,stdio:x,all:$,ipcOutput:S,context:c,options:t,command:a,escapedCommand:o,startTime:r});return Ht(q,i,t)},ex=({errorInfo:e,exitCode:t,signal:r,stdio:i,all:n,ipcOutput:s,context:a,options:o,command:c,escapedCommand:u,startTime:d})=>"error"in e?Ar({error:e.error,command:c,escapedCommand:u,timedOut:a.terminationReason==="timeout",isCanceled:a.terminationReason==="cancel"||a.terminationReason==="gracefulCancel",isGracefullyCanceled:a.terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof Ge,isForcefullyTerminated:a.isForcefullyTerminated,exitCode:t,signal:r,stdio:i,all:n,ipcOutput:s,options:o,startTime:d,isSync:!1}):un({command:c,escapedCommand:u,stdio:i,all:n,ipcOutput:s,options:o,startTime:d});p();var Cn=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([i,n])=>[i,tx(i,e[i],n)]));return{...e,...r}},tx=(e,t,r)=>rx.has(e)&&Z(t)&&Z(r)?{...t,...r}:r,rx=new Set(["env",...Es]);var mt=(e,t,r,i)=>{let n=(a,o,c)=>mt(a,o,r,c),s=(...a)=>ix({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:i,createNested:n},...a);return i!==void 0&&i(s,n,t),s},ix=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:i,createNested:n},s,...a)=>{if(Z(s))return n(e,Cn(r,s),i);let{file:o,commandArguments:c,options:u,isSync:d}=nx({mapArguments:e,firstArgument:s,nextArguments:a,deepOptions:t,boundOptions:r});return d?yl(o,c,u):fm(o,c,u,n)},nx=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:i,boundOptions:n})=>{let s=Ep(t)?Pp(t,r):[t,...r],[a,o,c]=vi(...s),u=Cn(Cn(i,n),c),{file:d=a,commandArguments:l=o,options:h=u,isSync:y=!1}=e({file:a,commandArguments:o,options:u});return{file:d,commandArguments:l,options:h,isSync:y}};p();var _m=({file:e,commandArguments:t})=>qm(e,t),bm=({file:e,commandArguments:t})=>({...qm(e,t),isSync:!0}),qm=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...i]=sx(e);return{file:r,commandArguments:i}},sx=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let i of t.split(ax)){let n=r.at(-1);n&&n.endsWith("\\")?r[r.length-1]=`${n.slice(0,-1)} ${i}`:r.push(i)}return r},ax=/ +/g;p();var km=(e,t,r)=>{e.sync=t(ox,r),e.s=e.sync},vm=({options:e})=>wm(e),ox=({options:e})=>({...wm(e),isSync:!0}),wm=e=>({options:{...px(e),...e}}),px=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},xm={preferLocal:!0};var ie=mt(()=>({})),WB=mt(()=>({isSync:!0})),ht=mt(_m),KB=mt(bm),YB=mt(Dd),JB=mt(vm,{},xm,km),{sendMessage:XB,getOneMessage:ZB,getEachMessage:QB,getCancelSignal:ez}=vl();var fe=B(J(),1);p();var Zt=B(J(),1);import ge from"fs";import lx from"os";import ye from"path";p();p();import Ie from"fs";import nt from"path";function k(e=process.cwd()){let t=cx(e),r=nt.join(t,"docker-compose.yml");if(!Ie.existsSync(r))throw new Error(`Not a Spree project directory. No docker-compose.yml found.
142
+ Run this command from a directory created with create-spree-app.`);let i=dx(t);return{mode:"docker",projectDir:t,port:i}}var Sm=["server","backend"];function Jt(e){return Sm.find(t=>Ie.existsSync(nt.join(e,t)))??"server"}function cx(e){let t=nt.basename(e);if(!Sm.includes(t))return e;let r=nt.dirname(e),i=new RegExp(`\\./${t}:/rails(:\\w+)?(\\s|$)`,"m");for(let n of["docker-compose.yml","docker-compose.dev.yml"]){let s=nt.join(r,n);if(Ie.existsSync(s))try{if(i.test(Ie.readFileSync(s,"utf-8")))return r}catch{}}return e}function Ne(e){let t=nt.join(e,".env");if(!Ie.existsSync(t))return!1;try{let r=Ie.readFileSync(t,"utf-8");return/^\s*SPREE_PATH\s*=/m.test(r)}catch{return!1}}function Xt(e){let t=nt.join(e,"docker-compose.yml");if(!Ie.existsSync(t))return!1;try{return/^\s*build\s*:/m.test(Ie.readFileSync(t,"utf-8"))}catch{return!1}}function Rn(e){try{let r=Ie.readFileSync(nt.join(e,".env"),"utf-8").match(/^SPREE_SAMPLE_DATA=(true|false)\b/m);return r?r[1]==="true":void 0}catch{return}}function dx(e){let t=nt.join(e,".env");if(!Ie.existsSync(t))return 3e3;let i=Ie.readFileSync(t,"utf-8").match(/^SPREE_PORT=(\d+)/m);return i?Number(i[1]):3e3}p();var $m=B(J(),1);async function ee(e,t,r){return ie("docker",["compose",...e],{cwd:t,...r})}async function yt(e,t){try{await ee(["up","-d","--no-deps","web"],e,{stdio:t?.stdio??"inherit"})}catch{}}async function oe(e,t,r){return(await eo(["bin/rails",e],t,{env:r})).split(`
143
143
  `).filter(n=>!n.startsWith("[")).join(`
144
- `).trim()}async function Ge(e){try{let{stdout:t}=await te("docker",["compose","config","--services"],{cwd:e}),r=t.split(`
145
- `).map(n=>n.trim()),i=["web","worker"].filter(n=>r.includes(n));return i.length>0?i:["web"]}catch{return["web"]}}async function fm(e){let{stdout:t}=await te("docker",["compose","ps","-a","-q"],{cwd:e});return t.trim().length>0}async function mt(e,t){let{stdout:r}=await te("docker",["compose","ps",e,"--format","{{.State}}"],{cwd:t});return r.split(`
146
- `).some(i=>i.trim()==="running")}async function ht(e,t,r={}){let{service:i="web",tty:n=!0,detach:s=!1,env:a}=r,o=["compose","exec"];if(s&&o.push("-d"),n||o.push("-T"),a)for(let[p,d]of Object.entries(a))o.push("-e",`${p}=${d}`);o.push(i,...e),await te("docker",o,{cwd:t,stdio:"inherit"})}async function Va(e,t,r={}){let{service:i="web",env:n,captureStderr:s=!1}=r,a=["compose","run","--rm"];if(n)for(let[p,d]of Object.entries(n))a.push("-e",`${p}=${d}`);a.push(i,...e),await te("docker",a,{cwd:t,...s?{stdin:"inherit",stdout:"inherit",stderr:["pipe","inherit"]}:{stdio:"inherit"}})}async function _m(e,t={}){let{service:r="web",edgeHint:i}=t;return await mt(r,e)?"exec":(Fe(e)&&(j([`The ${r} container is not running, and this is a monorepo edge project.`,`Run ${gm.default.bold("pnpm server:dev")} from the monorepo root${i?` \u2014 ${i}`:""}.`].join(`
147
- `)),process.exit(1)),q.info(`${r} container is not running \u2014 using a one-off container (\`docker compose run\`) instead.`),"run")}async function M(e,t,r={}){let{service:i="web",env:n}=r;await _m(t,r)==="exec"?await ht(e,t,{service:i,env:n}):await Va(e,t,{service:i,env:n})}async function Wa(e,t,r={}){let{service:i="web",env:n}=r,s=await _m(t,r),a=["compose",s];if(s==="run"&&a.push("--rm"),a.push("-T"),n)for(let[p,d]of Object.entries(n))a.push("-e",`${p}=${d}`);a.push(i,...e);let o;for(let p=0;p<5;p++)try{let{stdout:d}=await te("docker",a,{cwd:t});return d}catch(d){if(o=d,!Uw(d))throw d;await new Promise(c=>setTimeout(c,2e3))}throw o}function Uw(e){let t=e instanceof Error?e.message:String(e);return/is not running/i.test(t)||/no such container/i.test(t)||/container .* is restarting/i.test(t)}async function Ar(e,t){await te("docker",["compose","logs","-f",e],{cwd:t,stdio:"inherit"})}var Ka=`http://localhost:${3e3}`,yt=class extends Error{};function bm(){return process.env.XDG_CONFIG_HOME?me.join(process.env.XDG_CONFIG_HOME,"spree"):me.join(Nw.homedir(),".config","spree")}function At(){return me.join(bm(),"config.json")}function Kt(e){return e?.code==="ENOENT"}function Er(){let e;try{e=he.readFileSync(At(),"utf-8")}catch(t){if(Kt(t))return{profiles:{}};throw t}try{let t=JSON.parse(e);return{...t,profiles:t.profiles??{}}}catch{let t=`${At()}.bak`;try{he.renameSync(At(),t)}catch{}return process.stderr.write(`${Wt.default.yellow(`warning: ${At()} was not valid JSON; moved it to ${t} and starting fresh.`)}
148
- `),{profiles:{}}}}function Ya(e){he.mkdirSync(bm(),{recursive:!0,mode:448}),qm(At(),`${JSON.stringify(e,null,2)}
149
- `)}function qm(e,t){he.writeFileSync(e,t,{mode:384}),he.chmodSync(e,384)}function Yt(e){return me.join(e,".spree","credentials.json")}function Ja(e){return me.join(e,".spree","setup-complete")}function km(e){let t=Ja(e);he.mkdirSync(me.dirname(t),{recursive:!0,mode:448}),Xa(me.join(me.dirname(t),".gitignore")),he.writeFileSync(t,`${new Date().toISOString()}
150
- `)}function vm(e){return me.join(e,".spree","admin-email")}function wm(e,t){let r=vm(e);he.mkdirSync(me.dirname(r),{recursive:!0,mode:448}),Xa(me.join(me.dirname(r),".gitignore")),he.writeFileSync(r,`${t}
151
- `)}function xm(e){try{return he.readFileSync(vm(e),"utf-8").trim()||null}catch(t){if(Kt(t))return null;throw t}}function Hw(e){let t;try{t=he.readFileSync(Yt(e),"utf-8")}catch(r){if(Kt(r))return null;throw r}try{return JSON.parse(t)}catch{return null}}function Vw(e,t){let r=Yt(e),i=me.dirname(r);he.mkdirSync(i,{recursive:!0,mode:448}),Xa(me.join(i,".gitignore")),qm(r,`${JSON.stringify(t,null,2)}
152
- `)}function Xa(e){let t="";try{t=he.readFileSync(e,"utf-8")}catch(i){if(!Kt(i))throw i}t.split(`
153
- `).some(i=>i.trim()==="*")||he.writeFileSync(e,t&&!t.endsWith(`
144
+ `).trim()}async function Ve(e){try{let{stdout:t}=await ie("docker",["compose","config","--services"],{cwd:e}),r=t.split(`
145
+ `).map(n=>n.trim()),i=["web","worker"].filter(n=>r.includes(n));return i.length>0?i:["web"]}catch{return["web"]}}async function Am(e){let{stdout:t}=await ie("docker",["compose","ps","-a","-q"],{cwd:e});return t.trim().length>0}async function gt(e,t){let{stdout:r}=await ie("docker",["compose","ps",e,"--format","{{.State}}"],{cwd:t});return r.split(`
146
+ `).some(i=>i.trim()==="running")}async function ft(e,t,r={}){let{service:i="web",tty:n=!0,detach:s=!1,env:a}=r,o=["compose","exec"];if(s&&o.push("-d"),n||o.push("-T"),a)for(let[c,u]of Object.entries(a))o.push("-e",`${c}=${u}`);o.push(i,...e),await ie("docker",o,{cwd:t,stdio:"inherit"})}async function Qa(e,t,r={}){let{service:i="web",env:n,captureStderr:s=!1}=r,a=["compose","run","--rm"];if(n)for(let[c,u]of Object.entries(n))a.push("-e",`${c}=${u}`);a.push(i,...e),await ie("docker",a,{cwd:t,...s?{stdin:"inherit",stdout:"inherit",stderr:["pipe","inherit"]}:{stdio:"inherit"}})}async function Em(e,t={}){let{service:r="web",edgeHint:i}=t;return await gt(r,e)?"exec":(Ne(e)&&(T([`The ${r} container is not running, and this is a monorepo edge project.`,`Run ${$m.default.bold("pnpm server:dev")} from the monorepo root${i?` \u2014 ${i}`:""}.`].join(`
147
+ `)),process.exit(1)),v.info(`${r} container is not running \u2014 using a one-off container (\`docker compose run\`) instead.`),"run")}async function G(e,t,r={}){let{service:i="web",env:n}=r;await Em(t,r)==="exec"?await ft(e,t,{service:i,env:n}):await Qa(e,t,{service:i,env:n})}async function eo(e,t,r={}){let{service:i="web",env:n}=r,s=await Em(t,r),a=["compose",s];if(s==="run"&&a.push("--rm"),a.push("-T"),n)for(let[c,u]of Object.entries(n))a.push("-e",`${c}=${u}`);a.push(i,...e);let o;for(let c=0;c<5;c++)try{let{stdout:u}=await ie("docker",a,{cwd:t});return u}catch(u){if(o=u,!ux(u))throw u;await new Promise(d=>setTimeout(d,2e3))}throw o}function ux(e){let t=e instanceof Error?e.message:String(e);return/is not running/i.test(t)||/no such container/i.test(t)||/container .* is restarting/i.test(t)}async function Ir(e,t){await ie("docker",["compose","logs","-f",e],{cwd:t,stdio:"inherit"})}var to=`http://localhost:${3e3}`,_t=class extends Error{};function Pm(){return process.env.XDG_CONFIG_HOME?ye.join(process.env.XDG_CONFIG_HOME,"spree"):ye.join(lx.homedir(),".config","spree")}function jt(){return ye.join(Pm(),"config.json")}function Qt(e){return e?.code==="ENOENT"}function Or(){let e;try{e=ge.readFileSync(jt(),"utf-8")}catch(t){if(Qt(t))return{profiles:{}};throw t}try{let t=JSON.parse(e);return{...t,profiles:t.profiles??{}}}catch{let t=`${jt()}.bak`;try{ge.renameSync(jt(),t)}catch{}return process.stderr.write(`${Zt.default.yellow(`warning: ${jt()} was not valid JSON; moved it to ${t} and starting fresh.`)}
148
+ `),{profiles:{}}}}function ro(e){ge.mkdirSync(Pm(),{recursive:!0,mode:448}),jm(jt(),`${JSON.stringify(e,null,2)}
149
+ `)}function jm(e,t){ge.writeFileSync(e,t,{mode:384}),ge.chmodSync(e,384)}function er(e){return ye.join(e,".spree","credentials.json")}function io(e){return ye.join(e,".spree","setup-complete")}function Cm(e){let t=io(e);ge.mkdirSync(ye.dirname(t),{recursive:!0,mode:448}),no(ye.join(ye.dirname(t),".gitignore")),ge.writeFileSync(t,`${new Date().toISOString()}
150
+ `)}function Tm(e){return ye.join(e,".spree","admin-email")}function Rm(e,t){let r=Tm(e);ge.mkdirSync(ye.dirname(r),{recursive:!0,mode:448}),no(ye.join(ye.dirname(r),".gitignore")),ge.writeFileSync(r,`${t}
151
+ `)}function Im(e){try{return ge.readFileSync(Tm(e),"utf-8").trim()||null}catch(t){if(Qt(t))return null;throw t}}function mx(e){let t;try{t=ge.readFileSync(er(e),"utf-8")}catch(r){if(Qt(r))return null;throw r}try{return JSON.parse(t)}catch{return null}}function hx(e,t){let r=er(e),i=ye.dirname(r);ge.mkdirSync(i,{recursive:!0,mode:448}),no(ye.join(i,".gitignore")),jm(r,`${JSON.stringify(t,null,2)}
152
+ `)}function no(e){let t="";try{t=ge.readFileSync(e,"utf-8")}catch(i){if(!Qt(i))throw i}t.split(`
153
+ `).some(i=>i.trim()==="*")||ge.writeFileSync(e,t&&!t.endsWith(`
154
154
  `)?`${t}
155
155
  *
156
156
  `:`${t}*
157
- `)}function An(e){return e.slice(0,12)}async function Za(e,t){let r;try{r=await se("spree:cli:create_api_key",e,{NAME:t.name,KEY_TYPE:t.keyType,...t.scopes?.length?{SCOPES:t.scopes.join(",")}:{},...t.replace?{REPLACE:"true"}:{}})}catch(s){let a=s instanceof Error?s.message:String(s),o=a.match(/^\w*(?:::\w+)*(?:Error|Invalid):.*$/m)?.[0];throw new yt(o?`Could not mint an API key.
158
- ${Wt.default.dim(o)}`:`Could not mint an API key via the dev stack. Is it running? Start it with \`spree dev\`.
159
- ${Wt.default.dim(a.split(`
160
- `)[0])}`)}let i=t.keyType==="publishable"?"pk_":"sk_",n=r.match(new RegExp(`${i}[A-Za-z0-9_-]+`))?.[0];if(!n)throw new yt("Could not mint an API key via the dev stack. Is it running? Start it with `spree dev`.");return n}async function Qa(e,t,r=!1){r||process.stderr.write(`${Wt.default.dim("No credentials found \u2014 minting a read-only API key via the dev stack...")}
161
- `);let i=await Za(e,{name:"@spree/cli (auto)",keyType:"secret",scopes:["read_all"],replace:!0}),n={baseUrl:`http://localhost:${t}`,token:i,scopes:["read_all"],mintedAt:new Date().toISOString()};return Vw(e,n),r||process.stderr.write(`${Wt.default.dim("Saved to .spree/credentials.json (scopes: read_all)")}
162
- `),n}async function Pr(e,t={}){let{allowMint:r=!0,cwd:i=process.cwd()}=t,n=Er(),s=e.baseUrl,a=e.apiKey,o;if(a&&(o={apiKey:a,source:"flags"}),!o&&e.profile){let c=n.profiles[e.profile];if(!c)throw new yt(`Unknown profile "${e.profile}". Run \`spree auth login --profile ${e.profile}\` to create it.`);o={baseUrl:c.baseUrl,apiKey:c.token,source:"profile",profileName:e.profile}}if(!o&&process.env.SPREE_API_KEY&&(o={baseUrl:process.env.SPREE_BASE_URL,apiKey:process.env.SPREE_API_KEY,source:"env"}),!o){let c,u=0;try{let l=b(i);c=l.projectDir,u=l.port}catch{}if(c){let l=`http://localhost:${u}`,m=!s||s.replace(/\/$/,"")===l,h=Hw(c);!h&&r&&m&&(h=await Qa(c,u)),h&&(o={baseUrl:h.baseUrl,apiKey:h.token,source:"project",scopes:h.scopes})}}if(!o&&n.defaultProfile){let c=n.profiles[n.defaultProfile];c&&(o={baseUrl:c.baseUrl,apiKey:c.token,source:"profile",profileName:n.defaultProfile})}let p=s??o?.baseUrl,d=o?.apiKey;if(!p&&(o?.source==="flags"||o?.source==="env")&&(p=Ka),!p||!d)throw new yt(["No Admin API credentials found. Provide them via one of (host and key resolve together per source):"," - flags: --api-key <sk_...> (host defaults to "+Ka+"; pass --base-url for a remote store)"," - env: SPREE_API_KEY (host defaults to "+Ka+"; set SPREE_BASE_URL for a remote store)"," - project: run inside a Spree project with the dev stack up (auto-mints a read-only key)"," - profile: spree auth login --profile <name>"].join(`
163
- `));return{baseUrl:p,apiKey:d,source:o?.source??"flags",profileName:o?.profileName,tokenPrefix:An(d),scopes:o?.scopes}}var eo={dashboard:{dir:"dashboard",template:"dashboard-starter",templateEnvVar:"SPREE_DASHBOARD_TEMPLATE",port:5173,label:"Dashboard"},"seller-dashboard":{dir:"seller-dashboard",template:"seller-dashboard-starter",templateEnvVar:"SPREE_SELLER_DASHBOARD_TEMPLATE",port:5174,label:"Seller Panel"}};function $m(e){e.command("add").description("Add an optional component to your project").argument("<thing>","Component to add: dashboard or seller-dashboard").option("--template <src>","Starter template: git URL or local path (default: the template bundled with the CLI; env SPREE_DASHBOARD_TEMPLATE / SPREE_SELLER_DASHBOARD_TEMPLATE overrides)").option("--no-install","Skip dependency install").option("--quiet","Skip the final summary note (for wrapping tools that print their own)").action(async(t,r)=>{let i=eo[t];i||(console.error(`
164
- ${ye.default.red("Error:")} Unknown component: ${t}. Try: ${Object.keys(eo).join(", ")}
165
- `),process.exit(2)),di(ye.default.bgCyan(ye.default.black(` Spree ${i.label} `)));let n=b();await Yw(n,i,{template:r.template??process.env[i.templateEnvVar]??Jw(i),install:r.install,quiet:r.quiet}),Ct("Done!")})}async function Yw(e,t,r){let i=ae.join(e.projectDir,"apps",t.dir),n=ae.join(i,".env.local");if(de.existsSync(i)){let o=Am(e.projectDir,t.dir,e.port);if(o==="untouched"){q.warn(`${ye.default.bold(`apps/${t.dir}/`)} already exists. Nothing to do.`);return}q.info(`${o==="written"?"Wrote missing":"Repaired"} ${ye.default.bold(`apps/${t.dir}/.env.local`)}. Nothing else to do.`);return}let s=I();s.start(`Fetching ${t.label.toLowerCase()} starter...`);try{await Zw(r.template,i),Xw(i)}catch(o){s.stop("Fetch failed."),q.error(o instanceof Error?o.message:String(o)),process.exit(1)}s.stop(`Created ${ye.default.cyan(`apps/${t.dir}/`)}`),Em(n,e.port);let a=Jt(e.projectDir,i);if(r.install){s.start(`Installing dependencies with ${a}...`);try{await te(a,["install"],{cwd:i}),s.stop("Dependencies installed.")}catch(o){s.stop(ye.default.yellow(`${a} install failed \u2014 run it manually in apps/${t.dir}/.`)),q.warn(o instanceof Error?o.message:String(o))}}r.quiet||V(["Start it with:",` ${ye.default.cyan(`${a==="npm"?"npx":a} spree dev`)}`,` ${ye.default.dim("# runs the API and the dashboard together")}`,...r.install?[]:[` ${ye.default.dim(`# install dependencies first: cd apps/${t.dir} && ${a} install`)}`],"",`Then open ${ye.default.bold(`http://localhost:${t.port}`)} and sign in.`].join(`
166
- `),`${t.label} added!`)}function Jw(e){let t=ae.dirname(Kw(import.meta.url)),r=[ae.resolve(t,"../../templates",e.template),ae.resolve(t,"templates",e.template)];for(let i of r)if(de.existsSync(ae.join(i,"package.json")))return i;console.error(`
167
- ${ye.default.red("Error:")} Bundled ${e.label.toLowerCase()} template not found. In the monorepo, run ${ye.default.cyan("pnpm build")} in packages/cli first (it generates the templates), or pass --template <path|git-url>.
168
- `),process.exit(1)}function Xw(e){let t=ae.join(e,"gitignore.template");de.existsSync(t)&&de.renameSync(t,ae.join(e,".gitignore"))}async function Zw(e,t){if(de.existsSync(e)&&de.statSync(e).isDirectory()){de.cpSync(e,t,{recursive:!0,filter:r=>{let i=ae.basename(r);return i!=="node_modules"&&i!=="dist"&&i!==".git"}});return}await te("git",["clone","--depth","1","--",e,t]),de.rmSync(ae.join(t,".git"),{recursive:!0,force:!0})}var Sm=/^VITE_SPREE_API_URL=(https?:\/\/localhost\S*)$/m;function Am(e,t,r){let i=ae.join(e,"apps",t);if(!de.existsSync(ae.join(i,"package.json")))return"untouched";let n=ae.join(i,".env.local"),s;try{s=de.readFileSync(n,"utf-8")}catch(a){if(!Kt(a))throw a;return Em(n,r),"written"}return Sm.test(s)?(de.writeFileSync(n,s.replace(Sm,`VITE_API_PROXY_TARGET=http://localhost:${r}`)),"repaired"):"untouched"}var Qw=Object.values(eo).map(e=>e.dir);function En(e,t){let r="untouched";for(let i of Qw){let n=Am(e,i,t);n!=="untouched"&&(r=n)}return r}function Em(e,t){de.writeFileSync(e,["# Dev-server proxy target \u2014 where Vite forwards /api and /rails (your","# Rails backend). The SPA stays same-origin with the API: the SDK uses","# relative URLs and the proxy bridges the port gap.","#","# Do NOT set VITE_SPREE_API_URL for local dev \u2014 it switches the SDK to","# absolute cross-origin URLs, which breaks on CORS and the SameSite=Lax","# auth cookie. Set it only when building for a deploy where the","# dashboard is hosted on a different origin than the API.","#","# No credentials belong in this file \u2014 every VITE_-prefixed value is","# compiled into the client bundle.",`VITE_API_PROXY_TARGET=http://localhost:${t}`,""].join(`
169
- `))}function Jt(e,t){for(let r of[t,e]){if(de.existsSync(ae.join(r,"pnpm-lock.yaml")))return"pnpm";if(de.existsSync(ae.join(r,"yarn.lock")))return"yarn";if(de.existsSync(ae.join(r,"package-lock.json")))return"npm"}return"pnpm"}function k(e){if(!e)return;let t={};return e.expand?.length&&(t.expand=e.expand.join(",")),e.fields?.length&&(t.fields=e.fields.join(",")),Object.keys(t).length>0?t:void 0}function ex(e){return e===!1?!1:{maxRetries:e?.maxRetries??2,retryOnStatus:e?.retryOnStatus??[429,500,502,503,504],baseDelay:e?.baseDelay??300,maxDelay:e?.maxDelay??1e4,retryOnNetworkError:e?.retryOnNetworkError??!0}}var tx=new Set(["page","limit","expand","sort","fields"]);function y(e){let t={};for(let[r,i]of Object.entries(e))if(i!==void 0){if(tx.has(r)){t[r]=Array.isArray(i)?i.join(","):i;continue}if(r.startsWith("q[")){t[r]=i;continue}if(Array.isArray(i)){let n=r.endsWith("[]")?r.slice(0,-2):r;t[`q[${n}][]`]=i}else t[`q[${r}]`]=i}return t}var ft=class extends Error{code;status;details;constructor(e,t){super(e.error.message),this.name="SpreeError",this.code=e.error.code,this.status=t,this.details=e.error.details}};function Pm(e,t){let r=t.baseDelay*2**e,i=Math.random()*t.baseDelay;return Math.min(r+i,t.maxDelay)}function jm(e){return new Promise(t=>setTimeout(t,e))}function rx(){return`spree-sdk-retry-${crypto.randomUUID()}`}function ix(e,t,r,i){return e==="GET"||e==="HEAD"||i?r.retryOnStatus.includes(t):t===429}function nx(e,t,r){return t.retryOnNetworkError?e==="GET"||e==="HEAD"||r:!1}function sx(e,t,r,i){return async function(s,a,o={}){let{token:p,spreeToken:d,idempotencyKey:c,headers:u={},body:l,params:m}=o,h=o.locale??i?.locale,f=o.currency??i?.currency,w=o.country??i?.country,v=o.channel??i?.channel,x=typeof window<"u"?window.location.origin:void 0,_=e.baseUrl||x;if(!_)throw new TypeError("sdk-core: baseUrl is required in non-browser environments (no window.location to resolve relative URLs against)");let T=new URL(`${e.baseUrl}${t}${a}`,_);m&&Object.entries(m).forEach(([W,$])=>{if($!==void 0)if(Array.isArray($))for(let Ve of $)T.searchParams.append(W,String(Ve));else T.searchParams.set(W,String($))});let S={"Content-Type":"application/json",...u};r.headerValue&&(S[r.headerName]=r.headerValue),p&&(S.Authorization=`Bearer ${p}`),d&&(S["x-spree-token"]=d),h&&(S["x-spree-locale"]=h),f&&(S["x-spree-currency"]=f),w&&(S["x-spree-country"]=w),v&&(S["x-spree-channel"]=v);let O=c??(s!=="GET"&&s!=="HEAD"&&e.retryConfig?rx():void 0);O&&(S["Idempotency-Key"]=O);let B=!!O,U=e.retryConfig?e.retryConfig.maxRetries+1:1;for(let W=0;W<U;W++)try{let $=await e.fetchFn(T.toString(),{method:s,headers:S,body:l?JSON.stringify(l):void 0,credentials:e.credentials});if(!$.ok){if(!(W>=U-1)&&e.retryConfig&&ix(s,$.status,e.retryConfig,B)){let H=$.headers.get("Retry-After"),ue=H?Math.min(parseInt(H,10)*1e3,e.retryConfig.maxDelay):Pm(W,e.retryConfig);await jm(ue);continue}let $e=await $.json().catch(()=>null);throw typeof $e?.error?.code=="string"&&typeof $e.error.message=="string"?new ft($e,$.status):new ft({error:{code:"http_error",message:`Request failed with status ${$.status}`}},$.status)}return $.status===204?void 0:$.status===202?$.headers.get("content-type")?.includes("application/json")?$.json():void 0:$.json()}catch($){if($ instanceof ft)throw $;if(!(W>=U-1)&&e.retryConfig&&nx(s,e.retryConfig,B)){let $e=Pm(W,e.retryConfig);await jm($e);continue}throw $}throw new Error("Unexpected end of retry loop")}}var gt={"Spree::Product":"/products","Spree::Variant":"/variants","Spree::Order":"/orders","Spree::User":"/customers","Spree::Category":"/categories","Spree::Collection":"/collections","Spree::OptionType":"/option_types"},ax=class{request;constructor(e){this.request=e}parentScopedCustomFields(e){return{list:(t,r,i)=>this.request("GET",`${e}/${t}/custom_fields`,{...i,params:r?y(r):void 0}),get:(t,r,i)=>this.request("GET",`${e}/${t}/custom_fields/${r}`,i),create:(t,r,i)=>this.request("POST",`${e}/${t}/custom_fields`,{...i,body:r}),update:(t,r,i,n)=>this.request("PATCH",`${e}/${t}/custom_fields/${r}`,{...n,body:i}),delete:(t,r,i)=>this.request("DELETE",`${e}/${t}/custom_fields/${r}`,i)}}parentScopedTranslations(e){return{get:(t,r)=>this.request("GET",`${e}/${t}/translations`,r).then(i=>i.data)}}productMembership(e){return{list:(t,r,i)=>this.request("GET",`${e}/${t}/products`,{...i,params:r?y(r):void 0}),create:(t,r,i)=>this.request("POST",`${e}/${t}/products`,{...i,body:{product_ids:r}}),delete:(t,r,i)=>this.request("DELETE",`${e}/${t}/products`,{...i,body:{product_ids:r}})}}positionedProductMembership(e){return{...this.productMembership(e),reposition:(t,r,i,n)=>this.request("PATCH",`${e}/${t}/products/${r}/reposition`,{...n,body:i})}}customFields(e,t){let r=gt[e];if(!r)throw new Error(`Unknown custom-field owner type: ${e}. Add it to CUSTOM_FIELD_OWNER_PATHS.`);let i=this.parentScopedCustomFields(r);return{list:(n,s)=>i.list(t,n,s),get:(n,s)=>i.get(t,n,s),create:(n,s)=>i.create(t,n,s),update:(n,s,a)=>i.update(t,n,s,a),delete:(n,s)=>i.delete(t,n,s)}}customFieldDefinitions={list:(e,t)=>this.request("GET","/custom_field_definitions",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/custom_field_definitions/${e}`,t),resourceTypes:e=>this.request("GET","/custom_field_definitions/resource_types",e),create:(e,t)=>this.request("POST","/custom_field_definitions",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/custom_field_definitions/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/custom_field_definitions/${e}`,t)};auth={login:(e,t)=>this.request("POST","/auth/login",{...t,body:e}),refresh:e=>this.request("POST","/auth/refresh",e),logout:e=>this.request("POST","/auth/logout",e),providers:e=>this.request("GET","/auth/providers",e),lookupInvitation:(e,t,r)=>this.request("GET",`/auth/invitations/${e}/lookup`,{...r,params:{token:t}}),acceptInvitation:(e,t,r,i)=>this.request("POST",`/auth/invitations/${e}/accept`,{...i,params:{token:t},body:r}),setupStatus:e=>this.request("GET","/auth/setup",e),setupCountries:e=>this.request("GET","/auth/setup/countries",e),completeSetup:(e,t)=>this.request("POST","/auth/setup",{...t,body:e}),requestPasswordReset:(e,t)=>this.request("POST","/auth/password_resets",{...t,body:e}),resetPassword:(e,t,r)=>this.request("PATCH",`/auth/password_resets/${encodeURIComponent(e)}`,{...r,body:t})};me={get:e=>this.request("GET","/me",e),update:(e,t)=>this.request("PATCH","/me",{...t,body:e})};reporting={query:(e,t)=>this.request("POST","/reporting/query",{...t,body:e}),schema:e=>this.request("GET","/reporting/schema",e),savedReports:{list:(e,t)=>this.request("GET","/reporting/saved_reports",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/reporting/saved_reports/${e}`,t),create:(e,t)=>this.request("POST","/reporting/saved_reports",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/reporting/saved_reports/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/reporting/saved_reports/${e}`,t)}};dashboard={counters:(e,t)=>this.request("GET","/dashboard/counters",{...t,params:e})};store={get:e=>this.request("GET","/store",e),update:(e,t)=>this.request("PATCH","/store",{...t,body:e}),dataSources:e=>this.request("GET","/store/data_sources",e).then(t=>t.data)};locales={list:e=>this.request("GET","/locales",e).then(t=>t.data)};translatableResources={list:e=>this.request("GET","/translatable_resources",e).then(t=>t.data)};translations={coverage:(e,t,r)=>{let{page:i,limit:n,search:s,...a}=t??{};return this.request("GET","/translations",{...r,params:{resource_type:e,...i===void 0?{}:{page:i},...n===void 0?{}:{limit:n},...s===void 0?{}:{search:s},...y(a)}})},batch:(e,t)=>this.request("POST","/translations/batch",{...t,body:{translations:e}}).then(r=>r.data)};products={list:(e,t)=>this.request("GET","/products",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/products/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/products",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/products/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/products/${e}`,t),clone:(e,t)=>this.request("POST",`/products/${e}/clone`,t),approve:(e,t)=>this.request("PATCH",`/products/${e}/approve`,t),reject:(e,t,r)=>this.request("PATCH",`/products/${e}/reject`,{...r,body:t}),bulkStatusUpdate:(e,t)=>this.request("POST","/products/bulk_status_update",{...t,body:e}),bulkAddToCategories:(e,t)=>this.request("POST","/products/bulk_add_to_categories",{...t,body:e}),bulkRemoveFromCategories:(e,t)=>this.request("POST","/products/bulk_remove_from_categories",{...t,body:e}),bulkAddToCollections:(e,t)=>this.request("POST","/products/bulk_add_to_collections",{...t,body:e}),bulkRemoveFromCollections:(e,t)=>this.request("POST","/products/bulk_remove_from_collections",{...t,body:e}),bulkAddToChannels:(e,t)=>this.request("POST","/products/bulk_add_to_channels",{...t,body:e}),bulkRemoveFromChannels:(e,t)=>this.request("POST","/products/bulk_remove_from_channels",{...t,body:e}),bulkAddTags:(e,t)=>this.request("POST","/products/bulk_add_tags",{...t,body:e}),bulkRemoveTags:(e,t)=>this.request("POST","/products/bulk_remove_tags",{...t,body:e}),bulkDestroy:(e,t)=>this.request("DELETE","/products/bulk_destroy",{...t,body:e}),media:{list:(e,t,r)=>this.request("GET",`/products/${e}/media`,{...r,params:t?y(t):void 0}),create:(e,t,r)=>this.request("POST",`/products/${e}/media`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/media/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/media/${t}`,r)},digitalAssets:{list:(e,t,r)=>this.request("GET",`/products/${e}/digital_assets`,{...r,params:t?y(t):void 0}),create:(e,t,r)=>this.request("POST",`/products/${e}/digital_assets`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/digital_assets/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/digital_assets/${t}`,r),providers:(e,t)=>this.request("GET",`/products/${e}/digital_assets/providers`,t)},variants:{list:(e,t,r)=>this.request("GET",`/products/${e}/variants`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/products/${e}/variants/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/products/${e}/variants`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/variants/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/variants/${t}`,r),media:{list:(e,t,r,i)=>this.request("GET",`/products/${e}/variants/${t}/media`,{...i,params:r?y(r):void 0}),create:(e,t,r,i)=>this.request("POST",`/products/${e}/variants/${t}/media`,{...i,body:r}),update:(e,t,r,i,n)=>this.request("PATCH",`/products/${e}/variants/${t}/media/${r}`,{...n,body:i}),delete:(e,t,r,i)=>this.request("DELETE",`/products/${e}/variants/${t}/media/${r}`,i)}},customFields:this.parentScopedCustomFields(gt["Spree::Product"]),translations:this.parentScopedTranslations("/products")};digitalLinks={list:(e,t)=>this.request("GET","/digital_links",{...t,params:e?y(e):void 0}),retrieve:(e,t)=>this.request("GET",`/digital_links/${e}`,t),reset:(e,t)=>this.request("PATCH",`/digital_links/${e}/reset`,t)};orders={list:(e,t)=>this.request("GET","/orders",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/orders",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/orders/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/orders/${e}`,t),complete:(e,t,r)=>this.request("PATCH",`/orders/${e}/complete`,{...r,body:t}),cancel:(e,t,r)=>this.request("PATCH",`/orders/${e}/cancel`,{...r,body:t}),approve:(e,t)=>this.request("PATCH",`/orders/${e}/approve`,t),resendConfirmation:(e,t)=>this.request("POST",`/orders/${e}/resend_confirmation`,t),resendDigitalLinks:(e,t)=>this.request("POST",`/orders/${e}/resend_digital_links`,t),giftCards:{apply:(e,t,r)=>this.request("POST",`/orders/${e}/gift_cards`,{...r,body:t}),remove:(e,t,r)=>this.request("DELETE",`/orders/${e}/gift_cards/${t}`,r)},storeCredits:{apply:(e,t,r)=>this.request("POST",`/orders/${e}/store_credits`,{...r,body:t}),remove:(e,t)=>this.request("DELETE",`/orders/${e}/store_credits`,t)},items:{list:(e,t,r)=>this.request("GET",`/orders/${e}/items`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/items/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/items`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/items/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/items/${t}`,r)},fulfillments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fulfillments`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/fulfillments/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/fulfillments`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}`,{...i,body:r}),fulfill:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/fulfill`,{...i,body:r}),markDelivered:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/mark_delivered`,{...i,body:r}),cancel:(e,t,r)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/cancel`,r),labels:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fulfillments/${t}/labels`,r),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/fulfillments/${t}/labels/${r}`,i),create:(e,t,r,i)=>this.request("POST",`/orders/${e}/fulfillments/${t}/labels`,{...i,body:r}),refund:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/labels/${r}/refund`,i),delete:(e,t,r,i)=>this.request("DELETE",`/orders/${e}/fulfillments/${t}/labels/${r}`,i)},deliveries:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fulfillments/${t}/deliveries`,r),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/fulfillments/${t}/deliveries/${r}`,i),create:(e,t,r,i)=>this.request("POST",`/orders/${e}/fulfillments/${t}/deliveries`,{...i,body:r}),update:(e,t,r,i,n)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/deliveries/${r}`,{...n,body:i}),delete:(e,t,r,i)=>this.request("DELETE",`/orders/${e}/fulfillments/${t}/deliveries/${r}`,i),markDelivered:(e,t,r,i,n)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/deliveries/${r}/mark_delivered`,{...n,body:i})},split:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/split`,{...i,body:r})},returns:{list:(e,t,r)=>this.request("GET",`/orders/${e}/returns`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/returns/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/returns`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}`,{...i,body:r}),approve:(e,t,r)=>this.request("PATCH",`/orders/${e}/returns/${t}/approve`,r),receive:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}/receive`,{...i,body:r}),refund:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}/refund`,{...i,body:r}),cancel:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}/cancel`,{...i,body:r}),labels:{list:(e,t,r)=>this.request("GET",`/orders/${e}/returns/${t}/labels`,r),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/returns/${t}/labels/${r}`,i),create:(e,t,r,i)=>this.request("POST",`/orders/${e}/returns/${t}/labels`,{...i,body:r}),refund:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}/labels/${r}/refund`,i),delete:(e,t,r,i)=>this.request("DELETE",`/orders/${e}/returns/${t}/labels/${r}`,i)}},exchanges:{list:(e,t,r)=>this.request("GET",`/orders/${e}/exchanges`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/exchanges/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/exchanges`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/exchanges/${t}`,{...i,body:r}),approve:(e,t,r)=>this.request("PATCH",`/orders/${e}/exchanges/${t}/approve`,r),receive:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/exchanges/${t}/receive`,{...i,body:r}),fulfill:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/exchanges/${t}/fulfill`,{...i,body:r}),cancel:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/exchanges/${t}/cancel`,{...i,body:r})},claims:{list:(e,t,r)=>this.request("GET",`/orders/${e}/claims`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/claims/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/claims`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/claims/${t}`,{...i,body:r}),approve:(e,t,r)=>this.request("PATCH",`/orders/${e}/claims/${t}/approve`,r),resolve:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/claims/${t}/resolve`,{...i,body:r}),deny:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/claims/${t}/deny`,{...i,body:r}),cancel:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/claims/${t}/cancel`,{...i,body:r})},payments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/payments`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/payments/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/payments`,{...r,body:t}),capture:(e,t,r)=>this.request("PATCH",`/orders/${e}/payments/${t}/capture`,r),void:(e,t,r)=>this.request("PATCH",`/orders/${e}/payments/${t}/void`,r)},refunds:{list:(e,t,r)=>this.request("GET",`/orders/${e}/refunds`,{...r,params:t?y(t):void 0}),create:(e,t,r)=>this.request("POST",`/orders/${e}/refunds`,{...r,body:t})},taxLines:{list:(e,t,r)=>this.request("GET",`/orders/${e}/tax_lines`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}/tax_lines/${t}`,r)},discounts:{list:(e,t,r)=>this.request("GET",`/orders/${e}/discounts`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}/discounts/${t}`,r),create:(e,t,r)=>this.request("POST",`/orders/${e}/discounts`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/discounts/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/discounts/${t}`,r)},discountCodes:{create:(e,t,r)=>this.request("POST",`/orders/${e}/discount_codes`,{...r,body:t}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/discount_codes/${encodeURIComponent(t)}`,r)},fees:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fees`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}/fees/${t}`,r),create:(e,t,r)=>this.request("POST",`/orders/${e}/fees`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fees/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/fees/${t}`,r)},customFields:this.parentScopedCustomFields(gt["Spree::Order"])};optionTypes={list:(e,t)=>this.request("GET","/option_types",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/option_types/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/option_types",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/option_types/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/option_types/${e}`,t),customFields:this.parentScopedCustomFields(gt["Spree::OptionType"]),translations:this.parentScopedTranslations("/option_types")};deliveryMethods={list:(e,t)=>this.request("GET","/delivery_methods",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/delivery_methods/${e}`,t),create:(e,t)=>this.request("POST","/delivery_methods",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/delivery_methods/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/delivery_methods/${e}`,t),calculators:e=>this.request("GET","/delivery_methods/calculators",e),fulfillmentProviders:e=>this.request("GET","/delivery_methods/fulfillment_providers",e),rateProviders:e=>this.request("GET","/delivery_methods/rate_providers",e),rules:{list:(e,t)=>this.request("GET",`/delivery_methods/${e}/rules`,t),create:(e,t,r)=>this.request("POST",`/delivery_methods/${e}/rules`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/delivery_methods/${e}/rules/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/delivery_methods/${e}/rules/${t}`,r)},ruleTypes:e=>this.request("GET","/delivery_method_rules/types",e)};deliveryProfiles={list:(e,t)=>this.request("GET","/delivery_profiles",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/delivery_profiles/${e}`,t),create:(e,t)=>this.request("POST","/delivery_profiles",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/delivery_profiles/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/delivery_profiles/${e}`,t),kinds:e=>this.request("GET","/delivery_profiles/kinds",e),originGroups:{list:(e,t)=>this.request("GET",`/delivery_profiles/${e}/origin_groups`,t),create:(e,t,r)=>this.request("POST",`/delivery_profiles/${e}/origin_groups`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/delivery_profiles/${e}/origin_groups/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/delivery_profiles/${e}/origin_groups/${t}`,r)}};trackingCarriers={list:e=>this.request("GET","/tracking_carriers",e)};deliveryZones={list:(e,t)=>this.request("GET","/delivery_zones",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/delivery_zones/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/delivery_zones",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/delivery_zones/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/delivery_zones/${e}`,t)};packageTypes={list:(e,t)=>this.request("GET","/package_types",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/package_types/${e}`,t),create:(e,t)=>this.request("POST","/package_types",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/package_types/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/package_types/${e}`,t)};paymentMethods={list:(e,t)=>this.request("GET","/payment_methods",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/payment_methods/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/payment_methods",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/payment_methods/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/payment_methods/${e}`,t),types:e=>this.request("GET","/payment_methods/types",e)};integrations={list:(e,t)=>this.request("GET","/integrations",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/integrations/${e}`,t),create:(e,t)=>this.request("POST","/integrations",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/integrations/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/integrations/${e}`,t),types:e=>this.request("GET","/integrations/types",e),test:(e,t)=>this.request("POST",`/integrations/${e}/test`,t)};priceLists={list:(e,t)=>this.request("GET","/price_lists",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/price_lists/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/price_lists",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/price_lists/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/price_lists/${e}`,t),products:this.productMembership("/price_lists"),activate:(e,t)=>this.request("PATCH",`/price_lists/${e}/activate`,t),deactivate:(e,t)=>this.request("PATCH",`/price_lists/${e}/deactivate`,t),ruleTypes:e=>this.request("GET","/price_lists/price_rule_types",e)};prices={list:(e,t)=>this.request("GET","/prices",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/prices/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/prices",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/prices/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/prices/${e}`,t),bulkUpsert:(e,t)=>this.request("POST","/prices/bulk_upsert",{...t,body:e}),bulkDestroy:(e,t)=>this.request("DELETE","/prices/bulk_destroy",{...t,body:e})};promotions={list:(e,t)=>this.request("GET","/promotions",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/promotions",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/promotions/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/promotions/${e}`,t),actions:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_actions`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_actions/${t}`,r),create:(e,t,r)=>this.request("POST",`/promotions/${e}/promotion_actions`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/promotions/${e}/promotion_actions/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/promotions/${e}/promotion_actions/${t}`,r)},rules:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_rules`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_rules/${t}`,r),create:(e,t,r)=>this.request("POST",`/promotions/${e}/promotion_rules`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/promotions/${e}/promotion_rules/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/promotions/${e}/promotion_rules/${t}`,r)},couponCodes:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/coupon_codes`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/coupon_codes/${t}`,r)}};promotionActions={types:e=>this.request("GET","/promotion_actions/types",e),calculators:(e,t)=>this.request("GET","/promotion_actions/calculators",{...t,params:{type:e}})};promotionRules={types:e=>this.request("GET","/promotion_rules/types",e)};tags={list:(e,t)=>this.request("GET","/tags",{...t,params:e})};customerGroups={list:(e,t)=>this.request("GET","/customer_groups",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/customer_groups/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/customer_groups",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/customer_groups/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/customer_groups/${e}`,t)};sellers={list:(e,t)=>this.request("GET","/sellers",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/sellers/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/sellers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/sellers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/sellers/${e}`,t),invite:(e,t,r)=>this.request("POST",`/sellers/${e}/invite`,{...r,body:t}),approve:(e,t,r)=>this.request("PATCH",`/sellers/${e}/approve`,{...r,body:t}),onboarding:(e,t)=>this.request("GET",`/sellers/${e}/onboarding`,t),reopenOnboarding:(e,t,r)=>this.request("PATCH",`/sellers/${e}/reopen_onboarding`,{...r,body:t}),team:{list:(e,t)=>this.request("GET",`/sellers/${e}/team`,t),remove:(e,t,r)=>this.request("DELETE",`/sellers/${e}/team/${t}`,r)},invitations:{list:(e,t)=>this.request("GET",`/sellers/${e}/invitations`,t),remove:(e,t,r)=>this.request("DELETE",`/sellers/${e}/invitations/${t}`,r),resend:(e,t,r)=>this.request("PATCH",`/sellers/${e}/invitations/${t}/resend`,r)},requirementSubmissions:{list:(e,t,r)=>this.request("GET",`/sellers/${e}/requirement_submissions`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/sellers/${e}/requirement_submissions/${t}`,r),accept:(e,t,r,i)=>this.request("PATCH",`/sellers/${e}/requirement_submissions/${t}/accept`,{...i,body:r}),reject:(e,t,r,i)=>this.request("PATCH",`/sellers/${e}/requirement_submissions/${t}/reject`,{...i,body:r}),waive:(e,t,r)=>this.request("POST",`/sellers/${e}/requirement_submissions`,{...r,body:t})},suspend:(e,t,r)=>this.request("PATCH",`/sellers/${e}/suspend`,{...r,body:t}),reject:(e,t,r)=>this.request("PATCH",`/sellers/${e}/reject`,{...r,body:t}),balances:(e,t)=>this.request("GET",`/sellers/${e}/balances`,t),settle:(e,t)=>this.request("POST",`/sellers/${e}/payouts`,t)};sellerRequirements={list:(e,t)=>this.request("GET","/seller_requirements",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/seller_requirements/${e}`,t),create:(e,t)=>this.request("POST","/seller_requirements",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/seller_requirements/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/seller_requirements/${e}`,t),types:e=>this.request("GET","/seller_requirements/types",e)};commissionRates={list:(e,t)=>this.request("GET","/commission_rates",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/commission_rates/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/commission_rates",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/commission_rates/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/commission_rates/${e}`,t),ruleTypes:e=>this.request("GET","/commission_rates/rule_types",e)};commissionLines={list:(e,t)=>this.request("GET","/commission_lines",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/commission_lines/${e}`,{...r,params:k(t)})};orderGroups={list:(e,t)=>this.request("GET","/order_groups",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/order_groups/${e}`,{...r,params:k(t)})};sellerTransfers={list:(e,t)=>this.request("GET","/seller_transfers",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/seller_transfers/${e}`,{...r,params:k(t)})};sellerPayouts={list:(e,t)=>this.request("GET","/seller_payouts",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/seller_payouts/${e}`,{...r,params:k(t)}),complete:(e,t,r)=>this.request("PATCH",`/seller_payouts/${e}/complete`,{...r,body:t})};giftCards={list:(e,t)=>this.request("GET","/gift_cards",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/gift_cards/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/gift_cards",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/gift_cards/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/gift_cards/${e}`,t)};storeCredits={list:(e,t)=>this.request("GET","/store_credits",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/store_credits/${e}`,{...r,params:k(t)}),events:{list:(e,t,r)=>this.request("GET",`/store_credits/${e}/events`,{...r,params:t?y(t):void 0})}};returns={list:(e,t)=>this.request("GET","/returns",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/returns/${e}`,{...r,params:k(t)})};exchanges={list:(e,t)=>this.request("GET","/exchanges",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/exchanges/${e}`,{...r,params:k(t)})};claims={list:(e,t)=>this.request("GET","/claims",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/claims/${e}`,{...r,params:k(t)})};giftCardBatches={list:(e,t)=>this.request("GET","/gift_card_batches",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/gift_card_batches/${e}`,t),create:(e,t)=>this.request("POST","/gift_card_batches",{...t,body:e})};taxRates={list:(e,t)=>this.request("GET","/tax_rates",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/tax_rates/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/tax_rates",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/tax_rates/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/tax_rates/${e}`,t)};taxProviders={list:e=>this.request("GET","/tax_providers",e)};payoutProviders={list:e=>this.request("GET","/payout_providers",e)};companies={list:(e,t)=>this.request("GET","/companies",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/companies/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/companies",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/companies/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/companies/${e}`,t),addresses:{list:(e,t,r)=>this.request("GET",`/companies/${e}/addresses`,{...r,params:t?y(t):void 0}),create:(e,t,r)=>this.request("POST",`/companies/${e}/addresses`,{...r,body:t}),get:(e,t,r)=>this.request("GET",`/companies/${e}/addresses/${t}`,r),update:(e,t,r,i)=>this.request("PATCH",`/companies/${e}/addresses/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/addresses/${t}`,r)},memberships:{list:(e,t,r)=>this.request("GET",`/companies/${e}/memberships`,{...r,params:t?y(t):void 0}),create:(e,t,r)=>this.request("POST",`/companies/${e}/memberships`,{...r,body:t}),get:(e,t,r)=>this.request("GET",`/companies/${e}/memberships/${t}`,r),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/memberships/${t}`,r)},invitations:{list:(e,t,r)=>this.request("GET",`/companies/${e}/invitations`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/companies/${e}/invitations/${t}`,r),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/invitations/${t}`,r)},taxIdentifiers:{list:(e,t,r)=>this.request("GET",`/companies/${e}/tax_identifiers`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/companies/${e}/tax_identifiers/${t}`,r),create:(e,t,r)=>this.request("POST",`/companies/${e}/tax_identifiers`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/companies/${e}/tax_identifiers/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/tax_identifiers/${t}`,r),validate:(e,t,r)=>this.request("POST",`/companies/${e}/tax_identifiers/${t}/validate`,r)},taxExemptionCertificates:{list:(e,t,r)=>this.request("GET",`/companies/${e}/tax_exemption_certificates`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/companies/${e}/tax_exemption_certificates/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/companies/${e}/tax_exemption_certificates`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/companies/${e}/tax_exemption_certificates/${t}`,{...i,body:r}),verify:(e,t,r)=>this.request("PATCH",`/companies/${e}/tax_exemption_certificates/${t}/verify`,r),revoke:(e,t,r)=>this.request("PATCH",`/companies/${e}/tax_exemption_certificates/${t}/revoke`,r),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/tax_exemption_certificates/${t}`,r)}};catalogs={list:(e,t)=>this.request("GET","/catalogs",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/catalogs/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/catalogs",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/catalogs/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/catalogs/${e}`,t),products:this.productMembership("/catalogs"),activate:(e,t)=>this.request("PATCH",`/catalogs/${e}/activate`,t),deactivate:(e,t)=>this.request("PATCH",`/catalogs/${e}/deactivate`,t),importProducts:(e,t)=>this.request("POST",`/catalogs/${e}/import_products`,t),assign:(e,t,r)=>this.request("POST",`/catalogs/${e}/assign`,{...r,body:t}),quantityRules:{upsert:(e,t,r)=>this.request("PUT",`/catalogs/${e}/quantity_rules`,{...r,body:t})},orderMinimums:{list:(e,t,r)=>this.request("GET",`/catalogs/${e}/order_minimums`,{...r,params:t?y(t):void 0}),create:(e,t,r)=>this.request("POST",`/catalogs/${e}/order_minimums`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/catalogs/${e}/order_minimums/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/catalogs/${e}/order_minimums/${t}`,r)}};catalogAssignments={delete:(e,t)=>this.request("DELETE",`/catalog_assignments/${e}`,t)};exports={list:(e,t)=>this.request("GET","/exports",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/exports/${e}`,t),create:(e,t)=>this.request("POST","/exports",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/exports/${e}`,t)};imports={list:(e,t)=>this.request("GET","/imports",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/imports/${e}`,t),create:(e,t)=>this.request("POST","/imports",{...t,body:e}),completeMapping:(e,t,r)=>this.request("PATCH",`/imports/${e}/complete_mapping`,{...r,body:t??{}}),retryFailedRows:(e,t)=>this.request("PATCH",`/imports/${e}/retry_failed_rows`,t),delete:(e,t)=>this.request("DELETE",`/imports/${e}`,t),rows:{list:(e,t,r)=>this.request("GET",`/imports/${e}/rows`,{...r,params:t?y(t):void 0})}};customers={list:(e,t)=>this.request("GET","/customers",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/customers/${e}`,{...r,params:k(t)}),creditCards:{list:(e,t,r)=>this.request("GET",`/customers/${e}/credit_cards`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/credit_cards/${t}`,{...i,params:k(r)}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/credit_cards/${t}`,r)},create:(e,t)=>this.request("POST","/customers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/customers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/customers/${e}`,t),export:(e,t)=>this.request("GET",`/customers/${e}/export`,t),anonymize:(e,t)=>this.request("POST",`/customers/${e}/anonymize`,t),bulkAddToGroups:(e,t)=>this.request("POST","/customers/bulk_add_to_groups",{...t,body:e}),bulkRemoveFromGroups:(e,t)=>this.request("POST","/customers/bulk_remove_from_groups",{...t,body:e}),bulkAddTags:(e,t)=>this.request("POST","/customers/bulk_add_tags",{...t,body:e}),bulkRemoveTags:(e,t)=>this.request("POST","/customers/bulk_remove_tags",{...t,body:e}),addresses:{list:(e,t,r)=>this.request("GET",`/customers/${e}/addresses`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/addresses/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/customers/${e}/addresses`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/addresses/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/addresses/${t}`,r)},taxIdentifiers:{list:(e,t,r)=>this.request("GET",`/customers/${e}/tax_identifiers`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/customers/${e}/tax_identifiers/${t}`,r),create:(e,t,r)=>this.request("POST",`/customers/${e}/tax_identifiers`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/tax_identifiers/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/tax_identifiers/${t}`,r),validate:(e,t,r)=>this.request("POST",`/customers/${e}/tax_identifiers/${t}/validate`,r)},storeCredits:{list:(e,t,r)=>this.request("GET",`/customers/${e}/store_credits`,{...r,params:t?y(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/store_credits/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/customers/${e}/store_credits`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/store_credits/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/store_credits/${t}`,r)},customFields:this.parentScopedCustomFields(gt["Spree::User"])};media={list:(e,t)=>this.request("GET","/media",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/media/${e}`,t),create:(e,t)=>this.request("POST","/media",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/media/${e}`,{...r,body:t}),delete:(e,t,r)=>this.request("DELETE",`/media/${e}`,{...r,params:t?.detach?{detach:"true"}:void 0}),usage:(e,t)=>this.request("GET",`/media/${e}/usage`,t)};categories={list:(e,t)=>this.request("GET","/categories",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/categories/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/categories",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/categories/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/categories/${e}`,t),reposition:(e,t,r)=>this.request("PATCH",`/categories/${e}/reposition`,{...r,body:t}),products:this.positionedProductMembership("/categories"),customFields:this.parentScopedCustomFields(gt["Spree::Category"]),translations:this.parentScopedTranslations("/categories")};collections={list:(e,t)=>this.request("GET","/collections",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/collections/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/collections",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/collections/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/collections/${e}`,t),products:this.positionedProductMembership("/collections"),customFields:this.parentScopedCustomFields(gt["Spree::Collection"]),translations:this.parentScopedTranslations("/collections")};collectionRules={types:e=>this.request("GET","/collection_rules/types",e)};variants={list:(e,t)=>this.request("GET","/variants",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/variants/${e}`,{...r,params:k(t)}),customFields:this.parentScopedCustomFields(gt["Spree::Variant"])};productTypes={list:(e,t)=>this.request("GET","/product_types",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/product_types/${e}`,t),create:(e,t)=>this.request("POST","/product_types",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/product_types/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/product_types/${e}`,t),applyToProducts:(e,t)=>this.request("POST",`/product_types/${e}/apply_to_products`,t)};taxCategories={list:(e,t)=>this.request("GET","/tax_categories",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/tax_categories/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/tax_categories",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/tax_categories/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/tax_categories/${e}`,t)};policies={list:(e,t)=>this.request("GET","/policies",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/policies/${e}`,t),create:(e,t)=>this.request("POST","/policies",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/policies/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/policies/${e}`,t)};returnReasons={list:(e,t)=>this.request("GET","/return_reasons",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/return_reasons/${e}`,t),create:(e,t)=>this.request("POST","/return_reasons",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/return_reasons/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/return_reasons/${e}`,t)};claimReasons={list:(e,t)=>this.request("GET","/claim_reasons",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/claim_reasons/${e}`,t),create:(e,t)=>this.request("POST","/claim_reasons",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/claim_reasons/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/claim_reasons/${e}`,t)};orderCancellationReasons={list:(e,t)=>this.request("GET","/order_cancellation_reasons",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/order_cancellation_reasons/${e}`,t),create:(e,t)=>this.request("POST","/order_cancellation_reasons",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/order_cancellation_reasons/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/order_cancellation_reasons/${e}`,t)};refundReasons={list:(e,t)=>this.request("GET","/refund_reasons",{...t,params:e?y(e):void 0}),get:(e,t)=>this.request("GET",`/refund_reasons/${e}`,t),create:(e,t)=>this.request("POST","/refund_reasons",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/refund_reasons/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/refund_reasons/${e}`,t)};channels={list:(e,t)=>this.request("GET","/channels",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/channels/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/channels",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/channels/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/channels/${e}`,t),addProducts:(e,t,r)=>this.request("POST",`/channels/${e}/add_products`,{...r,body:t}),removeProducts:(e,t,r)=>this.request("POST",`/channels/${e}/remove_products`,{...r,body:t}),orderRoutingRules:{list:(e,t,r)=>this.request("GET",`/channels/${e}/order_routing_rules`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/channels/${e}/order_routing_rules/${t}`,r),create:(e,t,r)=>this.request("POST",`/channels/${e}/order_routing_rules`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/channels/${e}/order_routing_rules/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/channels/${e}/order_routing_rules/${t}`,r)}};orderRoutingRules={types:e=>this.request("GET","/order_routing_rules/types",e)};markets={list:(e,t)=>this.request("GET","/markets",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/markets/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/markets",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/markets/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/markets/${e}`,t)};stockLocations={list:(e,t)=>this.request("GET","/stock_locations",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_locations/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/stock_locations",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/stock_locations/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_locations/${e}`,t)};stockLevels={list:(e,t)=>this.request("GET","/stock_levels",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_levels/${e}`,{...r,params:k(t)}),update:(e,t,r)=>this.request("PATCH",`/stock_levels/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_levels/${e}`,t),bulkUpsert:(e,t)=>this.request("POST","/stock_levels/bulk_upsert",{...t,body:e})};stockMovements={list:(e,t)=>this.request("GET","/stock_movements",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_movements/${e}`,{...r,params:k(t)})};stockTransfers={list:(e,t)=>this.request("GET","/stock_transfers",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_transfers/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/stock_transfers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/stock_transfers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_transfers/${e}`,t),markReady:(e,t)=>this.request("PATCH",`/stock_transfers/${e}/mark_ready`,t),markInTransit:(e,t,r)=>this.request("PATCH",`/stock_transfers/${e}/mark_in_transit`,{...r,body:t}),markDraft:(e,t)=>this.request("PATCH",`/stock_transfers/${e}/mark_draft`,t),close:(e,t,r)=>this.request("PATCH",`/stock_transfers/${e}/close`,{...r,body:t}),stockReceipts:{list:(e,t,r)=>this.request("GET",`/stock_transfers/${e}/stock_receipts`,{...r,params:k(t)}),get:(e,t,r,i)=>this.request("GET",`/stock_transfers/${e}/stock_receipts/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/stock_transfers/${e}/stock_receipts`,{...r,body:t})},cancel:(e,t,r)=>this.request("PATCH",`/stock_transfers/${e}/cancel`,{...r,body:t})};suppliers={list:(e,t)=>this.request("GET","/suppliers",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/suppliers/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/suppliers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/suppliers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/suppliers/${e}`,t)};purchaseOrders={list:(e,t)=>this.request("GET","/purchase_orders",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/purchase_orders/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/purchase_orders",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/purchase_orders/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/purchase_orders/${e}`,t),markOrdered:(e,t)=>this.request("PATCH",`/purchase_orders/${e}/mark_ordered`,t),markDraft:(e,t)=>this.request("PATCH",`/purchase_orders/${e}/mark_draft`,t),close:(e,t,r)=>this.request("PATCH",`/purchase_orders/${e}/close`,{...r,body:t}),stockReceipts:{list:(e,t,r)=>this.request("GET",`/purchase_orders/${e}/stock_receipts`,{...r,params:k(t)}),get:(e,t,r,i)=>this.request("GET",`/purchase_orders/${e}/stock_receipts/${t}`,{...i,params:k(r)}),create:(e,t,r)=>this.request("POST",`/purchase_orders/${e}/stock_receipts`,{...r,body:t})},cancel:(e,t,r)=>this.request("PATCH",`/purchase_orders/${e}/cancel`,{...r,body:t})};countries={list:(e,t)=>this.request("GET","/countries",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/countries/${e}`,{...r,params:k(t)})};directUploads={create:(e,t)=>this.request("POST","/direct_uploads",{...t,body:e})};adminUsers={list:(e,t)=>this.request("GET","/admin_users",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/admin_users/${e}`,{...r,params:k(t)}),update:(e,t,r)=>this.request("PATCH",`/admin_users/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/admin_users/${e}`,t)};invitations={list:(e,t)=>this.request("GET","/invitations",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/invitations/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/invitations",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/invitations/${e}`,t),resend:(e,t)=>this.request("PATCH",`/invitations/${e}/resend`,t)};apiKeys={list:(e,t)=>this.request("GET","/api_keys",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/api_keys/${e}`,{...r,params:k(t)}),current:e=>this.request("GET","/api_keys/current",e??{}),create:(e,t)=>this.request("POST","/api_keys",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/api_keys/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/api_keys/${e}`,t),revoke:(e,t)=>this.request("PATCH",`/api_keys/${e}/revoke`,t)};allowedOrigins={list:(e,t)=>this.request("GET","/allowed_origins",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/allowed_origins/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/allowed_origins",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/allowed_origins/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/allowed_origins/${e}`,t)};webhookEndpoints={list:(e,t)=>this.request("GET","/webhook_endpoints",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/webhook_endpoints",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/webhook_endpoints/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/webhook_endpoints/${e}`,t),sendTest:(e,t)=>this.request("POST",`/webhook_endpoints/${e}/send_test`,t),enable:(e,t)=>this.request("PATCH",`/webhook_endpoints/${e}/enable`,t),disable:(e,t,r)=>this.request("PATCH",`/webhook_endpoints/${e}/disable`,{...r,body:t}),deliveries:{list:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}/deliveries`,{...r,params:t?y(t):void 0}),get:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}/deliveries/${t}`,r),redeliver:(e,t,r)=>this.request("POST",`/webhook_endpoints/${e}/deliveries/${t}/redeliver`,r)}};roles={list:(e,t)=>this.request("GET","/roles",{...t,params:e?y(e):void 0}),get:(e,t,r)=>this.request("GET",`/roles/${e}`,{...r,params:k(t)}),create:(e,t)=>this.request("POST","/roles",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/roles/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/roles/${e}`,t)};permissions={list:e=>this.request("GET","/permissions",e)}};function jr(e){let t=e.baseUrl.replace(/\/$/,""),r=e.fetch||fetch.bind(globalThis),i=ex(e.retry),n={baseUrl:t,fetchFn:r,retryConfig:i,credentials:e.credentials??"include"},s=e.jwtToken,a=e.storeId,o=null,p="/api/v3/admin",d=async(l,m,h={})=>{let f={};a&&!m.startsWith("/auth/")&&(f["X-Spree-Store-Id"]=a);let w={...h,headers:{...f,...h.headers}},v=()=>{let x=e.secretKey?{headerName:"X-Spree-Api-Key",headerValue:e.secretKey}:{headerName:"Authorization",headerValue:s?`Bearer ${s}`:""};return sx(n,p,x)(l,m,w)};try{return await v()}catch(x){if(x instanceof ft&&x.status===401&&o&&!m.includes("/auth/")&&await o())return v();throw x}},c=new ax(d),u=Object.create(c);return u.setStore=l=>{a=l},u.setToken=l=>{s=l},u.onUnauthorized=l=>{o=l},u}var ph=D(Dr(),1),Re=D(K(),1);var Ym=D(K(),1);import p0 from"fs";var bo=Symbol("no-body");async function Jm(e){if(e===void 0)return bo;let t;if(e==="-")t=await c0();else if(e.startsWith("@")){let r=e.slice(1);try{t=p0.readFileSync(r,"utf-8")}catch(i){throw i?.code==="ENOENT"?new Error(`Request body file not found: ${r}`):new Error(`Could not read request body file ${r}: ${i.message}`)}}else t=e;try{return JSON.parse(t)}catch{let r=e==="-"?" (from stdin)":e.startsWith("@")?` (${e.slice(1)})`:"";throw new Error(`Request body is not valid JSON${r}`)}}async function c0(){process.stdin.isTTY&&process.stderr.write(`${Ym.default.dim("Reading request body from stdin \u2014 paste JSON and press Ctrl-D...")}
170
- `);let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf-8")}var qo=D(Dr(),1),_e=D(K(),1);function Lr(e,t="json"){if(e!=null){if(t==="table"){let r=l0(e);if(r){(0,qo.printTable)(r.map(Xm));return}let i=Xm(e);(0,qo.printTable)(Object.entries(i).map(([n,s])=>({field:n,value:s})));return}process.stdout.isTTY?process.stdout.write(`${u0(JSON.stringify(e,null,2))}
157
+ `)}function In(e){return e.slice(0,12)}async function so(e,t){let r;try{r=await oe("spree:cli:create_api_key",e,{NAME:t.name,KEY_TYPE:t.keyType,...t.scopes?.length?{SCOPES:t.scopes.join(",")}:{},...t.replace?{REPLACE:"true"}:{}})}catch(s){let a=s instanceof Error?s.message:String(s),o=a.match(/^\w*(?:::\w+)*(?:Error|Invalid):.*$/m)?.[0];throw new _t(o?`Could not mint an API key.
158
+ ${Zt.default.dim(o)}`:`Could not mint an API key via the dev stack. Is it running? Start it with \`spree dev\`.
159
+ ${Zt.default.dim(a.split(`
160
+ `)[0])}`)}let i=t.keyType==="publishable"?"pk_":"sk_",n=r.match(new RegExp(`${i}[A-Za-z0-9_-]+`))?.[0];if(!n)throw new _t("Could not mint an API key via the dev stack. Is it running? Start it with `spree dev`.");return n}async function ao(e,t,r=!1){r||process.stderr.write(`${Zt.default.dim("No credentials found \u2014 minting a read-only API key via the dev stack...")}
161
+ `);let i=await so(e,{name:"@spree/cli (auto)",keyType:"secret",scopes:["read_all"],replace:!0}),n={baseUrl:`http://localhost:${t}`,token:i,scopes:["read_all"],mintedAt:new Date().toISOString()};return hx(e,n),r||process.stderr.write(`${Zt.default.dim("Saved to .spree/credentials.json (scopes: read_all)")}
162
+ `),n}async function Dr(e,t={}){let{allowMint:r=!0,cwd:i=process.cwd()}=t,n=Or(),s=e.baseUrl,a=e.apiKey,o;if(a&&(o={apiKey:a,source:"flags"}),!o&&e.profile){let d=n.profiles[e.profile];if(!d)throw new _t(`Unknown profile "${e.profile}". Run \`spree auth login --profile ${e.profile}\` to create it.`);o={baseUrl:d.baseUrl,apiKey:d.token,source:"profile",profileName:e.profile}}if(!o&&process.env.SPREE_API_KEY&&(o={baseUrl:process.env.SPREE_BASE_URL,apiKey:process.env.SPREE_API_KEY,source:"env"}),!o){let d,l=0;try{let h=k(i);d=h.projectDir,l=h.port}catch{}if(d){let h=`http://localhost:${l}`,y=!s||s.replace(/\/$/,"")===h,g=mx(d);!g&&r&&y&&(g=await ao(d,l)),g&&(o={baseUrl:g.baseUrl,apiKey:g.token,source:"project",scopes:g.scopes})}}if(!o&&n.defaultProfile){let d=n.profiles[n.defaultProfile];d&&(o={baseUrl:d.baseUrl,apiKey:d.token,source:"profile",profileName:n.defaultProfile})}let c=s??o?.baseUrl,u=o?.apiKey;if(!c&&(o?.source==="flags"||o?.source==="env")&&(c=to),!c||!u)throw new _t(["No Admin API credentials found. Provide them via one of (host and key resolve together per source):"," - flags: --api-key <sk_...> (host defaults to "+to+"; pass --base-url for a remote store)"," - env: SPREE_API_KEY (host defaults to "+to+"; set SPREE_BASE_URL for a remote store)"," - project: run inside a Spree project with the dev stack up (auto-mints a read-only key)"," - profile: spree auth login --profile <name>"].join(`
163
+ `));return{baseUrl:c,apiKey:u,source:o?.source??"flags",profileName:o?.profileName,tokenPrefix:In(u),scopes:o?.scopes}}var oo={dashboard:{dir:"dashboard",template:"dashboard-starter",templateEnvVar:"SPREE_DASHBOARD_TEMPLATE",port:5173,label:"Dashboard"},"seller-dashboard":{dir:"seller-dashboard",template:"seller-dashboard-starter",templateEnvVar:"SPREE_SELLER_DASHBOARD_TEMPLATE",port:5174,label:"Seller Panel"}};function Dm(e){e.command("add").description("Add an optional component to your project").argument("<thing>","Component to add: dashboard or seller-dashboard").option("--template <src>","Starter template: git URL or local path (default: the template bundled with the CLI; env SPREE_DASHBOARD_TEMPLATE / SPREE_SELLER_DASHBOARD_TEMPLATE overrides)").option("--no-install","Skip dependency install").option("--quiet","Skip the final summary note (for wrapping tools that print their own)").action(async(t,r)=>{let i=oo[t];i||(console.error(`
164
+ ${fe.default.red("Error:")} Unknown component: ${t}. Try: ${Object.keys(oo).join(", ")}
165
+ `),process.exit(2)),bi(fe.default.bgCyan(fe.default.black(` Spree ${i.label} `)));let n=k();await fx(n,i,{template:r.template??process.env[i.templateEnvVar]??_x(i),install:r.install,quiet:r.quiet}),It("Done!")})}async function fx(e,t,r){let i=pe.join(e.projectDir,"apps",t.dir),n=pe.join(i,".env.local");if(le.existsSync(i)){let o=Lm(e.projectDir,t.dir,e.port);if(o==="untouched"){v.warn(`${fe.default.bold(`apps/${t.dir}/`)} already exists. Nothing to do.`);return}v.info(`${o==="written"?"Wrote missing":"Repaired"} ${fe.default.bold(`apps/${t.dir}/.env.local`)}. Nothing else to do.`);return}let s=D();s.start(`Fetching ${t.label.toLowerCase()} starter...`);try{await qx(r.template,i),bx(i)}catch(o){s.stop("Fetch failed."),v.error(o instanceof Error?o.message:String(o)),process.exit(1)}s.stop(`Created ${fe.default.cyan(`apps/${t.dir}/`)}`),Bm(n,e.port);let a=tr(e.projectDir,i);if(r.install){s.start(`Installing dependencies with ${a}...`);try{await ie(a,["install"],{cwd:i}),s.stop("Dependencies installed.")}catch(o){s.stop(fe.default.yellow(`${a} install failed \u2014 run it manually in apps/${t.dir}/.`)),v.warn(o instanceof Error?o.message:String(o))}}r.quiet||H(["Start it with:",` ${fe.default.cyan(`${a==="npm"?"npx":a} spree dev`)}`,` ${fe.default.dim("# runs the API and the dashboard together")}`,...r.install?[]:[` ${fe.default.dim(`# install dependencies first: cd apps/${t.dir} && ${a} install`)}`],"",`Then open ${fe.default.bold(`http://localhost:${t.port}`)} and sign in.`].join(`
166
+ `),`${t.label} added!`)}function _x(e){let t=pe.dirname(gx(import.meta.url)),r=[pe.resolve(t,"../../templates",e.template),pe.resolve(t,"templates",e.template)];for(let i of r)if(le.existsSync(pe.join(i,"package.json")))return i;console.error(`
167
+ ${fe.default.red("Error:")} Bundled ${e.label.toLowerCase()} template not found. In the monorepo, run ${fe.default.cyan("pnpm build")} in packages/cli first (it generates the templates), or pass --template <path|git-url>.
168
+ `),process.exit(1)}function bx(e){let t=pe.join(e,"gitignore.template");le.existsSync(t)&&le.renameSync(t,pe.join(e,".gitignore"))}async function qx(e,t){if(le.existsSync(e)&&le.statSync(e).isDirectory()){le.cpSync(e,t,{recursive:!0,filter:r=>{let i=pe.basename(r);return i!=="node_modules"&&i!=="dist"&&i!==".git"}});return}await ie("git",["clone","--depth","1","--",e,t]),le.rmSync(pe.join(t,".git"),{recursive:!0,force:!0})}var Om=/^VITE_SPREE_API_URL=(https?:\/\/localhost\S*)$/m;function Lm(e,t,r){let i=pe.join(e,"apps",t);if(!le.existsSync(pe.join(i,"package.json")))return"untouched";let n=pe.join(i,".env.local"),s;try{s=le.readFileSync(n,"utf-8")}catch(a){if(!Qt(a))throw a;return Bm(n,r),"written"}return Om.test(s)?(le.writeFileSync(n,s.replace(Om,`VITE_API_PROXY_TARGET=http://localhost:${r}`)),"repaired"):"untouched"}var kx=Object.values(oo).map(e=>e.dir);function On(e,t){let r="untouched";for(let i of kx){let n=Lm(e,i,t);n!=="untouched"&&(r=n)}return r}function Bm(e,t){le.writeFileSync(e,["# Dev-server proxy target \u2014 where Vite forwards /api and /rails (your","# Rails backend). The SPA stays same-origin with the API: the SDK uses","# relative URLs and the proxy bridges the port gap.","#","# Do NOT set VITE_SPREE_API_URL for local dev \u2014 it switches the SDK to","# absolute cross-origin URLs, which breaks on CORS and the SameSite=Lax","# auth cookie. Set it only when building for a deploy where the","# dashboard is hosted on a different origin than the API.","#","# No credentials belong in this file \u2014 every VITE_-prefixed value is","# compiled into the client bundle.",`VITE_API_PROXY_TARGET=http://localhost:${t}`,""].join(`
169
+ `))}function tr(e,t){for(let r of[t,e]){if(le.existsSync(pe.join(r,"pnpm-lock.yaml")))return"pnpm";if(le.existsSync(pe.join(r,"yarn.lock")))return"yarn";if(le.existsSync(pe.join(r,"package-lock.json")))return"npm"}return"pnpm"}p();p();function w(e){if(!e)return;let t={};return e.expand?.length&&(t.expand=e.expand.join(",")),e.fields?.length&&(t.fields=e.fields.join(",")),Object.keys(t).length>0?t:void 0}function vx(e){return e===!1?!1:{maxRetries:e?.maxRetries??2,retryOnStatus:e?.retryOnStatus??[429,500,502,503,504],baseDelay:e?.baseDelay??300,maxDelay:e?.maxDelay??1e4,retryOnNetworkError:e?.retryOnNetworkError??!0}}var wx=new Set(["page","limit","expand","sort","fields"]);function f(e){let t={};for(let[r,i]of Object.entries(e))if(i!==void 0){if(wx.has(r)){t[r]=Array.isArray(i)?i.join(","):i;continue}if(r.startsWith("q[")){t[r]=i;continue}if(Array.isArray(i)){let n=r.endsWith("[]")?r.slice(0,-2):r;t[`q[${n}][]`]=i}else t[`q[${r}]`]=i}return t}var qt=class extends Error{code;status;details;constructor(e,t){super(e.error.message),this.name="SpreeError",this.code=e.error.code,this.status=t,this.details=e.error.details}};function zm(e,t){let r=t.baseDelay*2**e,i=Math.random()*t.baseDelay;return Math.min(r+i,t.maxDelay)}function Mm(e){return new Promise(t=>setTimeout(t,e))}function xx(){return`spree-sdk-retry-${crypto.randomUUID()}`}function Sx(e,t,r,i){return e==="GET"||e==="HEAD"||i?r.retryOnStatus.includes(t):t===429}function $x(e,t,r){return t.retryOnNetworkError?e==="GET"||e==="HEAD"||r:!1}function Ax(e,t,r,i){return async function(s,a,o={}){let{token:c,spreeToken:u,idempotencyKey:d,headers:l={},body:h,params:y}=o,g=o.locale??i?.locale,b=o.currency??i?.currency,S=o.country??i?.country,x=o.channel??i?.channel,$=typeof window<"u"?window.location.origin:void 0,q=e.baseUrl||$;if(!q)throw new TypeError("sdk-core: baseUrl is required in non-browser environments (no window.location to resolve relative URLs against)");let I=new URL(`${e.baseUrl}${t}${a}`,q);y&&Object.entries(y).forEach(([Y,E])=>{if(E!==void 0)if(Array.isArray(E))for(let Ye of E)I.searchParams.append(Y,String(Ye));else I.searchParams.set(Y,String(E))});let A={"Content-Type":"application/json",...l};r.headerValue&&(A[r.headerName]=r.headerValue),c&&(A.Authorization=`Bearer ${c}`),u&&(A["x-spree-token"]=u),g&&(A["x-spree-locale"]=g),b&&(A["x-spree-currency"]=b),S&&(A["x-spree-country"]=S),x&&(A["x-spree-channel"]=x);let L=d??(s!=="GET"&&s!=="HEAD"&&e.retryConfig?xx():void 0);L&&(A["Idempotency-Key"]=L);let M=!!L,V=e.retryConfig?e.retryConfig.maxRetries+1:1;for(let Y=0;Y<V;Y++)try{let E=await e.fetchFn(I.toString(),{method:s,headers:A,body:h?JSON.stringify(h):void 0,credentials:e.credentials});if(!E.ok){if(!(Y>=V-1)&&e.retryConfig&&Sx(s,E.status,e.retryConfig,M)){let K=E.headers.get("Retry-After"),me=K?Math.min(parseInt(K,10)*1e3,e.retryConfig.maxDelay):zm(Y,e.retryConfig);await Mm(me);continue}let Pe=await E.json().catch(()=>null);throw typeof Pe?.error?.code=="string"&&typeof Pe.error.message=="string"?new qt(Pe,E.status):new qt({error:{code:"http_error",message:`Request failed with status ${E.status}`}},E.status)}return E.status===204?void 0:E.status===202?E.headers.get("content-type")?.includes("application/json")?E.json():void 0:E.json()}catch(E){if(E instanceof qt)throw E;if(!(Y>=V-1)&&e.retryConfig&&$x(s,e.retryConfig,M)){let Pe=zm(Y,e.retryConfig);await Mm(Pe);continue}throw E}throw new Error("Unexpected end of retry loop")}}var bt={"Spree::Product":"/products","Spree::Variant":"/variants","Spree::Order":"/orders","Spree::Customer":"/customers","Spree::User":"/customers","Spree::Category":"/categories","Spree::Collection":"/collections","Spree::OptionType":"/option_types"},Ex=class{request;constructor(e){this.request=e}parentScopedCustomFields(e){return{list:(t,r,i)=>this.request("GET",`${e}/${t}/custom_fields`,{...i,params:r?f(r):void 0}),get:(t,r,i)=>this.request("GET",`${e}/${t}/custom_fields/${r}`,i),create:(t,r,i)=>this.request("POST",`${e}/${t}/custom_fields`,{...i,body:r}),update:(t,r,i,n)=>this.request("PATCH",`${e}/${t}/custom_fields/${r}`,{...n,body:i}),delete:(t,r,i)=>this.request("DELETE",`${e}/${t}/custom_fields/${r}`,i)}}parentScopedTranslations(e){return{get:(t,r)=>this.request("GET",`${e}/${t}/translations`,r).then(i=>i.data)}}productMembership(e){return{list:(t,r,i)=>this.request("GET",`${e}/${t}/products`,{...i,params:r?f(r):void 0}),create:(t,r,i)=>this.request("POST",`${e}/${t}/products`,{...i,body:{product_ids:r}}),delete:(t,r,i)=>this.request("DELETE",`${e}/${t}/products`,{...i,body:{product_ids:r}})}}positionedProductMembership(e){return{...this.productMembership(e),reposition:(t,r,i,n)=>this.request("PATCH",`${e}/${t}/products/${r}/reposition`,{...n,body:i})}}customFields(e,t){let r=bt[e];if(!r)throw new Error(`Unknown custom-field owner type: ${e}. Add it to CUSTOM_FIELD_OWNER_PATHS.`);let i=this.parentScopedCustomFields(r);return{list:(n,s)=>i.list(t,n,s),get:(n,s)=>i.get(t,n,s),create:(n,s)=>i.create(t,n,s),update:(n,s,a)=>i.update(t,n,s,a),delete:(n,s)=>i.delete(t,n,s)}}customFieldDefinitions={list:(e,t)=>this.request("GET","/custom_field_definitions",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/custom_field_definitions/${e}`,t),resourceTypes:e=>this.request("GET","/custom_field_definitions/resource_types",e),create:(e,t)=>this.request("POST","/custom_field_definitions",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/custom_field_definitions/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/custom_field_definitions/${e}`,t)};auth={login:(e,t)=>this.request("POST","/auth/login",{...t,body:e}),refresh:e=>this.request("POST","/auth/refresh",e),logout:e=>this.request("POST","/auth/logout",e),providers:e=>this.request("GET","/auth/providers",e),lookupInvitation:(e,t,r)=>this.request("GET",`/auth/invitations/${e}/lookup`,{...r,params:{token:t}}),acceptInvitation:(e,t,r,i)=>this.request("POST",`/auth/invitations/${e}/accept`,{...i,params:{token:t},body:r}),setupStatus:e=>this.request("GET","/auth/setup",e),setupCountries:e=>this.request("GET","/auth/setup/countries",e),completeSetup:(e,t)=>this.request("POST","/auth/setup",{...t,body:e}),requestPasswordReset:(e,t)=>this.request("POST","/auth/password_resets",{...t,body:e}),resetPassword:(e,t,r)=>this.request("PATCH",`/auth/password_resets/${encodeURIComponent(e)}`,{...r,body:t})};me={get:e=>this.request("GET","/me",e),update:(e,t)=>this.request("PATCH","/me",{...t,body:e})};reporting={query:(e,t)=>this.request("POST","/reporting/query",{...t,body:e}),schema:e=>this.request("GET","/reporting/schema",e),savedReports:{list:(e,t)=>this.request("GET","/reporting/saved_reports",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/reporting/saved_reports/${e}`,t),create:(e,t)=>this.request("POST","/reporting/saved_reports",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/reporting/saved_reports/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/reporting/saved_reports/${e}`,t)}};dashboard={counters:(e,t)=>this.request("GET","/dashboard/counters",{...t,params:e})};store={get:e=>this.request("GET","/store",e),update:(e,t)=>this.request("PATCH","/store",{...t,body:e}),dataSources:e=>this.request("GET","/store/data_sources",e).then(t=>t.data)};locales={list:e=>this.request("GET","/locales",e).then(t=>t.data)};translatableResources={list:e=>this.request("GET","/translatable_resources",e).then(t=>t.data)};translations={coverage:(e,t,r)=>{let{page:i,limit:n,search:s,...a}=t??{};return this.request("GET","/translations",{...r,params:{resource_type:e,...i===void 0?{}:{page:i},...n===void 0?{}:{limit:n},...s===void 0?{}:{search:s},...f(a)}})},batch:(e,t)=>this.request("POST","/translations/batch",{...t,body:{translations:e}}).then(r=>r.data)};products={list:(e,t)=>this.request("GET","/products",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/products/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/products",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/products/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/products/${e}`,t),clone:(e,t)=>this.request("POST",`/products/${e}/clone`,t),approve:(e,t)=>this.request("PATCH",`/products/${e}/approve`,t),reject:(e,t,r)=>this.request("PATCH",`/products/${e}/reject`,{...r,body:t}),bulkStatusUpdate:(e,t)=>this.request("POST","/products/bulk_status_update",{...t,body:e}),bulkAddToCategories:(e,t)=>this.request("POST","/products/bulk_add_to_categories",{...t,body:e}),bulkRemoveFromCategories:(e,t)=>this.request("POST","/products/bulk_remove_from_categories",{...t,body:e}),bulkAddToCollections:(e,t)=>this.request("POST","/products/bulk_add_to_collections",{...t,body:e}),bulkRemoveFromCollections:(e,t)=>this.request("POST","/products/bulk_remove_from_collections",{...t,body:e}),bulkAddToChannels:(e,t)=>this.request("POST","/products/bulk_add_to_channels",{...t,body:e}),bulkRemoveFromChannels:(e,t)=>this.request("POST","/products/bulk_remove_from_channels",{...t,body:e}),bulkAddTags:(e,t)=>this.request("POST","/products/bulk_add_tags",{...t,body:e}),bulkRemoveTags:(e,t)=>this.request("POST","/products/bulk_remove_tags",{...t,body:e}),bulkDestroy:(e,t)=>this.request("DELETE","/products/bulk_destroy",{...t,body:e}),media:{list:(e,t,r)=>this.request("GET",`/products/${e}/media`,{...r,params:t?f(t):void 0}),create:(e,t,r)=>this.request("POST",`/products/${e}/media`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/media/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/media/${t}`,r)},digitalAssets:{list:(e,t,r)=>this.request("GET",`/products/${e}/digital_assets`,{...r,params:t?f(t):void 0}),create:(e,t,r)=>this.request("POST",`/products/${e}/digital_assets`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/digital_assets/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/digital_assets/${t}`,r),providers:(e,t)=>this.request("GET",`/products/${e}/digital_assets/providers`,t)},variants:{list:(e,t,r)=>this.request("GET",`/products/${e}/variants`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/products/${e}/variants/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/products/${e}/variants`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/variants/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/variants/${t}`,r),media:{list:(e,t,r,i)=>this.request("GET",`/products/${e}/variants/${t}/media`,{...i,params:r?f(r):void 0}),create:(e,t,r,i)=>this.request("POST",`/products/${e}/variants/${t}/media`,{...i,body:r}),update:(e,t,r,i,n)=>this.request("PATCH",`/products/${e}/variants/${t}/media/${r}`,{...n,body:i}),delete:(e,t,r,i)=>this.request("DELETE",`/products/${e}/variants/${t}/media/${r}`,i)}},customFields:this.parentScopedCustomFields(bt["Spree::Product"]),translations:this.parentScopedTranslations("/products")};digitalLinks={list:(e,t)=>this.request("GET","/digital_links",{...t,params:e?f(e):void 0}),retrieve:(e,t)=>this.request("GET",`/digital_links/${e}`,t),reset:(e,t)=>this.request("PATCH",`/digital_links/${e}/reset`,t)};orders={list:(e,t)=>this.request("GET","/orders",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/orders",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/orders/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/orders/${e}`,t),complete:(e,t,r)=>this.request("PATCH",`/orders/${e}/complete`,{...r,body:t}),cancel:(e,t,r)=>this.request("PATCH",`/orders/${e}/cancel`,{...r,body:t}),approve:(e,t)=>this.request("PATCH",`/orders/${e}/approve`,t),resendConfirmation:(e,t)=>this.request("POST",`/orders/${e}/resend_confirmation`,t),resendDigitalLinks:(e,t)=>this.request("POST",`/orders/${e}/resend_digital_links`,t),giftCards:{apply:(e,t,r)=>this.request("POST",`/orders/${e}/gift_cards`,{...r,body:t}),remove:(e,t,r)=>this.request("DELETE",`/orders/${e}/gift_cards/${t}`,r)},storeCredits:{apply:(e,t,r)=>this.request("POST",`/orders/${e}/store_credits`,{...r,body:t}),remove:(e,t)=>this.request("DELETE",`/orders/${e}/store_credits`,t)},items:{list:(e,t,r)=>this.request("GET",`/orders/${e}/items`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/items/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/items`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/items/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/items/${t}`,r)},fulfillments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fulfillments`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/fulfillments/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/fulfillments`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}`,{...i,body:r}),fulfill:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/fulfill`,{...i,body:r}),markDelivered:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/mark_delivered`,{...i,body:r}),cancel:(e,t,r)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/cancel`,r),labels:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fulfillments/${t}/labels`,r),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/fulfillments/${t}/labels/${r}`,i),create:(e,t,r,i)=>this.request("POST",`/orders/${e}/fulfillments/${t}/labels`,{...i,body:r}),refund:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/labels/${r}/refund`,i),delete:(e,t,r,i)=>this.request("DELETE",`/orders/${e}/fulfillments/${t}/labels/${r}`,i)},deliveries:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fulfillments/${t}/deliveries`,r),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/fulfillments/${t}/deliveries/${r}`,i),create:(e,t,r,i)=>this.request("POST",`/orders/${e}/fulfillments/${t}/deliveries`,{...i,body:r}),update:(e,t,r,i,n)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/deliveries/${r}`,{...n,body:i}),delete:(e,t,r,i)=>this.request("DELETE",`/orders/${e}/fulfillments/${t}/deliveries/${r}`,i),markDelivered:(e,t,r,i,n)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/deliveries/${r}/mark_delivered`,{...n,body:i})},split:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/split`,{...i,body:r})},returns:{list:(e,t,r)=>this.request("GET",`/orders/${e}/returns`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/returns/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/returns`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}`,{...i,body:r}),approve:(e,t,r)=>this.request("PATCH",`/orders/${e}/returns/${t}/approve`,r),receive:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}/receive`,{...i,body:r}),refund:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}/refund`,{...i,body:r}),cancel:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}/cancel`,{...i,body:r}),labels:{list:(e,t,r)=>this.request("GET",`/orders/${e}/returns/${t}/labels`,r),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/returns/${t}/labels/${r}`,i),create:(e,t,r,i)=>this.request("POST",`/orders/${e}/returns/${t}/labels`,{...i,body:r}),refund:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/returns/${t}/labels/${r}/refund`,i),delete:(e,t,r,i)=>this.request("DELETE",`/orders/${e}/returns/${t}/labels/${r}`,i)}},exchanges:{list:(e,t,r)=>this.request("GET",`/orders/${e}/exchanges`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/exchanges/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/exchanges`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/exchanges/${t}`,{...i,body:r}),approve:(e,t,r)=>this.request("PATCH",`/orders/${e}/exchanges/${t}/approve`,r),receive:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/exchanges/${t}/receive`,{...i,body:r}),fulfill:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/exchanges/${t}/fulfill`,{...i,body:r}),cancel:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/exchanges/${t}/cancel`,{...i,body:r})},claims:{list:(e,t,r)=>this.request("GET",`/orders/${e}/claims`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/claims/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/claims`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/claims/${t}`,{...i,body:r}),approve:(e,t,r)=>this.request("PATCH",`/orders/${e}/claims/${t}/approve`,r),resolve:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/claims/${t}/resolve`,{...i,body:r}),deny:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/claims/${t}/deny`,{...i,body:r}),cancel:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/claims/${t}/cancel`,{...i,body:r})},payments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/payments`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/payments/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/payments`,{...r,body:t}),capture:(e,t,r)=>this.request("PATCH",`/orders/${e}/payments/${t}/capture`,r),void:(e,t,r)=>this.request("PATCH",`/orders/${e}/payments/${t}/void`,r)},refunds:{list:(e,t,r)=>this.request("GET",`/orders/${e}/refunds`,{...r,params:t?f(t):void 0}),create:(e,t,r)=>this.request("POST",`/orders/${e}/refunds`,{...r,body:t})},taxLines:{list:(e,t,r)=>this.request("GET",`/orders/${e}/tax_lines`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}/tax_lines/${t}`,r)},discounts:{list:(e,t,r)=>this.request("GET",`/orders/${e}/discounts`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}/discounts/${t}`,r),create:(e,t,r)=>this.request("POST",`/orders/${e}/discounts`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/discounts/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/discounts/${t}`,r)},discountCodes:{create:(e,t,r)=>this.request("POST",`/orders/${e}/discount_codes`,{...r,body:t}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/discount_codes/${encodeURIComponent(t)}`,r)},fees:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fees`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}/fees/${t}`,r),create:(e,t,r)=>this.request("POST",`/orders/${e}/fees`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fees/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/fees/${t}`,r)},customFields:this.parentScopedCustomFields(bt["Spree::Order"])};optionTypes={list:(e,t)=>this.request("GET","/option_types",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/option_types/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/option_types",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/option_types/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/option_types/${e}`,t),customFields:this.parentScopedCustomFields(bt["Spree::OptionType"]),translations:this.parentScopedTranslations("/option_types")};deliveryMethods={list:(e,t)=>this.request("GET","/delivery_methods",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/delivery_methods/${e}`,t),create:(e,t)=>this.request("POST","/delivery_methods",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/delivery_methods/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/delivery_methods/${e}`,t),calculators:e=>this.request("GET","/delivery_methods/calculators",e),fulfillmentProviders:e=>this.request("GET","/delivery_methods/fulfillment_providers",e),rateProviders:e=>this.request("GET","/delivery_methods/rate_providers",e),rules:{list:(e,t)=>this.request("GET",`/delivery_methods/${e}/rules`,t),create:(e,t,r)=>this.request("POST",`/delivery_methods/${e}/rules`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/delivery_methods/${e}/rules/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/delivery_methods/${e}/rules/${t}`,r)},ruleTypes:e=>this.request("GET","/delivery_method_rules/types",e)};deliveryProfiles={list:(e,t)=>this.request("GET","/delivery_profiles",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/delivery_profiles/${e}`,t),create:(e,t)=>this.request("POST","/delivery_profiles",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/delivery_profiles/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/delivery_profiles/${e}`,t),kinds:e=>this.request("GET","/delivery_profiles/kinds",e),originGroups:{list:(e,t)=>this.request("GET",`/delivery_profiles/${e}/origin_groups`,t),create:(e,t,r)=>this.request("POST",`/delivery_profiles/${e}/origin_groups`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/delivery_profiles/${e}/origin_groups/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/delivery_profiles/${e}/origin_groups/${t}`,r)}};trackingCarriers={list:e=>this.request("GET","/tracking_carriers",e)};deliveryZones={list:(e,t)=>this.request("GET","/delivery_zones",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/delivery_zones/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/delivery_zones",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/delivery_zones/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/delivery_zones/${e}`,t)};packageTypes={list:(e,t)=>this.request("GET","/package_types",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/package_types/${e}`,t),create:(e,t)=>this.request("POST","/package_types",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/package_types/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/package_types/${e}`,t)};paymentMethods={list:(e,t)=>this.request("GET","/payment_methods",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/payment_methods/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/payment_methods",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/payment_methods/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/payment_methods/${e}`,t),types:e=>this.request("GET","/payment_methods/types",e)};integrations={list:(e,t)=>this.request("GET","/integrations",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/integrations/${e}`,t),create:(e,t)=>this.request("POST","/integrations",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/integrations/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/integrations/${e}`,t),types:e=>this.request("GET","/integrations/types",e),test:(e,t)=>this.request("POST",`/integrations/${e}/test`,t)};priceLists={list:(e,t)=>this.request("GET","/price_lists",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/price_lists/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/price_lists",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/price_lists/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/price_lists/${e}`,t),products:this.productMembership("/price_lists"),activate:(e,t)=>this.request("PATCH",`/price_lists/${e}/activate`,t),deactivate:(e,t)=>this.request("PATCH",`/price_lists/${e}/deactivate`,t),ruleTypes:e=>this.request("GET","/price_lists/price_rule_types",e)};prices={list:(e,t)=>this.request("GET","/prices",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/prices/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/prices",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/prices/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/prices/${e}`,t),bulkUpsert:(e,t)=>this.request("POST","/prices/bulk_upsert",{...t,body:e}),bulkDestroy:(e,t)=>this.request("DELETE","/prices/bulk_destroy",{...t,body:e})};promotions={list:(e,t)=>this.request("GET","/promotions",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/promotions",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/promotions/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/promotions/${e}`,t),actions:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_actions`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_actions/${t}`,r),create:(e,t,r)=>this.request("POST",`/promotions/${e}/promotion_actions`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/promotions/${e}/promotion_actions/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/promotions/${e}/promotion_actions/${t}`,r)},rules:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_rules`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_rules/${t}`,r),create:(e,t,r)=>this.request("POST",`/promotions/${e}/promotion_rules`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/promotions/${e}/promotion_rules/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/promotions/${e}/promotion_rules/${t}`,r)},couponCodes:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/coupon_codes`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/coupon_codes/${t}`,r)}};promotionActions={types:e=>this.request("GET","/promotion_actions/types",e),calculators:(e,t)=>this.request("GET","/promotion_actions/calculators",{...t,params:{type:e}})};promotionRules={types:e=>this.request("GET","/promotion_rules/types",e)};tags={list:(e,t)=>this.request("GET","/tags",{...t,params:e})};customerGroups={list:(e,t)=>this.request("GET","/customer_groups",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/customer_groups/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/customer_groups",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/customer_groups/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/customer_groups/${e}`,t)};sellers={list:(e,t)=>this.request("GET","/sellers",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/sellers/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/sellers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/sellers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/sellers/${e}`,t),invite:(e,t,r)=>this.request("POST",`/sellers/${e}/invite`,{...r,body:t}),approve:(e,t,r)=>this.request("PATCH",`/sellers/${e}/approve`,{...r,body:t}),onboarding:(e,t)=>this.request("GET",`/sellers/${e}/onboarding`,t),reopenOnboarding:(e,t,r)=>this.request("PATCH",`/sellers/${e}/reopen_onboarding`,{...r,body:t}),team:{list:(e,t)=>this.request("GET",`/sellers/${e}/team`,t),remove:(e,t,r)=>this.request("DELETE",`/sellers/${e}/team/${t}`,r)},invitations:{list:(e,t)=>this.request("GET",`/sellers/${e}/invitations`,t),remove:(e,t,r)=>this.request("DELETE",`/sellers/${e}/invitations/${t}`,r),resend:(e,t,r)=>this.request("PATCH",`/sellers/${e}/invitations/${t}/resend`,r),acceptanceLink:(e,t,r)=>this.request("GET",`/sellers/${e}/invitations/${t}/acceptance_link`,r)},requirementSubmissions:{list:(e,t,r)=>this.request("GET",`/sellers/${e}/requirement_submissions`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/sellers/${e}/requirement_submissions/${t}`,r),accept:(e,t,r,i)=>this.request("PATCH",`/sellers/${e}/requirement_submissions/${t}/accept`,{...i,body:r}),reject:(e,t,r,i)=>this.request("PATCH",`/sellers/${e}/requirement_submissions/${t}/reject`,{...i,body:r}),waive:(e,t,r)=>this.request("POST",`/sellers/${e}/requirement_submissions`,{...r,body:t})},suspend:(e,t,r)=>this.request("PATCH",`/sellers/${e}/suspend`,{...r,body:t}),reject:(e,t,r)=>this.request("PATCH",`/sellers/${e}/reject`,{...r,body:t}),balances:(e,t)=>this.request("GET",`/sellers/${e}/balances`,t),settle:(e,t)=>this.request("POST",`/sellers/${e}/payouts`,t)};sellerRequirements={list:(e,t)=>this.request("GET","/seller_requirements",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/seller_requirements/${e}`,t),create:(e,t)=>this.request("POST","/seller_requirements",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/seller_requirements/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/seller_requirements/${e}`,t),types:e=>this.request("GET","/seller_requirements/types",e)};commissionRates={list:(e,t)=>this.request("GET","/commission_rates",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/commission_rates/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/commission_rates",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/commission_rates/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/commission_rates/${e}`,t),ruleTypes:e=>this.request("GET","/commission_rates/rule_types",e)};commissionLines={list:(e,t)=>this.request("GET","/commission_lines",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/commission_lines/${e}`,{...r,params:w(t)})};orderGroups={list:(e,t)=>this.request("GET","/order_groups",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/order_groups/${e}`,{...r,params:w(t)})};sellerTransfers={list:(e,t)=>this.request("GET","/seller_transfers",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/seller_transfers/${e}`,{...r,params:w(t)})};sellerPayouts={list:(e,t)=>this.request("GET","/seller_payouts",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/seller_payouts/${e}`,{...r,params:w(t)}),complete:(e,t,r)=>this.request("PATCH",`/seller_payouts/${e}/complete`,{...r,body:t})};giftCards={list:(e,t)=>this.request("GET","/gift_cards",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/gift_cards/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/gift_cards",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/gift_cards/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/gift_cards/${e}`,t)};storeCredits={list:(e,t)=>this.request("GET","/store_credits",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/store_credits/${e}`,{...r,params:w(t)}),events:{list:(e,t,r)=>this.request("GET",`/store_credits/${e}/events`,{...r,params:t?f(t):void 0})}};returns={list:(e,t)=>this.request("GET","/returns",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/returns/${e}`,{...r,params:w(t)})};exchanges={list:(e,t)=>this.request("GET","/exchanges",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/exchanges/${e}`,{...r,params:w(t)})};claims={list:(e,t)=>this.request("GET","/claims",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/claims/${e}`,{...r,params:w(t)})};giftCardBatches={list:(e,t)=>this.request("GET","/gift_card_batches",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/gift_card_batches/${e}`,t),create:(e,t)=>this.request("POST","/gift_card_batches",{...t,body:e})};taxRates={list:(e,t)=>this.request("GET","/tax_rates",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/tax_rates/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/tax_rates",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/tax_rates/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/tax_rates/${e}`,t)};taxProviders={list:e=>this.request("GET","/tax_providers",e)};payoutProviders={list:e=>this.request("GET","/payout_providers",e)};companies={list:(e,t)=>this.request("GET","/companies",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/companies/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/companies",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/companies/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/companies/${e}`,t),addresses:{list:(e,t,r)=>this.request("GET",`/companies/${e}/addresses`,{...r,params:t?f(t):void 0}),create:(e,t,r)=>this.request("POST",`/companies/${e}/addresses`,{...r,body:t}),get:(e,t,r)=>this.request("GET",`/companies/${e}/addresses/${t}`,r),update:(e,t,r,i)=>this.request("PATCH",`/companies/${e}/addresses/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/addresses/${t}`,r)},memberships:{list:(e,t,r)=>this.request("GET",`/companies/${e}/memberships`,{...r,params:t?f(t):void 0}),create:(e,t,r)=>this.request("POST",`/companies/${e}/memberships`,{...r,body:t}),get:(e,t,r)=>this.request("GET",`/companies/${e}/memberships/${t}`,r),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/memberships/${t}`,r)},invitations:{list:(e,t,r)=>this.request("GET",`/companies/${e}/invitations`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/companies/${e}/invitations/${t}`,r),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/invitations/${t}`,r)},taxIdentifiers:{list:(e,t,r)=>this.request("GET",`/companies/${e}/tax_identifiers`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/companies/${e}/tax_identifiers/${t}`,r),create:(e,t,r)=>this.request("POST",`/companies/${e}/tax_identifiers`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/companies/${e}/tax_identifiers/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/tax_identifiers/${t}`,r),validate:(e,t,r)=>this.request("POST",`/companies/${e}/tax_identifiers/${t}/validate`,r)},taxExemptionCertificates:{list:(e,t,r)=>this.request("GET",`/companies/${e}/tax_exemption_certificates`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/companies/${e}/tax_exemption_certificates/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/companies/${e}/tax_exemption_certificates`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/companies/${e}/tax_exemption_certificates/${t}`,{...i,body:r}),verify:(e,t,r)=>this.request("PATCH",`/companies/${e}/tax_exemption_certificates/${t}/verify`,r),revoke:(e,t,r)=>this.request("PATCH",`/companies/${e}/tax_exemption_certificates/${t}/revoke`,r),delete:(e,t,r)=>this.request("DELETE",`/companies/${e}/tax_exemption_certificates/${t}`,r)}};catalogs={list:(e,t)=>this.request("GET","/catalogs",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/catalogs/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/catalogs",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/catalogs/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/catalogs/${e}`,t),products:this.productMembership("/catalogs"),activate:(e,t)=>this.request("PATCH",`/catalogs/${e}/activate`,t),deactivate:(e,t)=>this.request("PATCH",`/catalogs/${e}/deactivate`,t),importProducts:(e,t)=>this.request("POST",`/catalogs/${e}/import_products`,t),assign:(e,t,r)=>this.request("POST",`/catalogs/${e}/assign`,{...r,body:t}),quantityRules:{upsert:(e,t,r)=>this.request("PUT",`/catalogs/${e}/quantity_rules`,{...r,body:t})},orderMinimums:{list:(e,t,r)=>this.request("GET",`/catalogs/${e}/order_minimums`,{...r,params:t?f(t):void 0}),create:(e,t,r)=>this.request("POST",`/catalogs/${e}/order_minimums`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/catalogs/${e}/order_minimums/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/catalogs/${e}/order_minimums/${t}`,r)}};catalogAssignments={delete:(e,t)=>this.request("DELETE",`/catalog_assignments/${e}`,t)};exports={list:(e,t)=>this.request("GET","/exports",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/exports/${e}`,t),create:(e,t)=>this.request("POST","/exports",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/exports/${e}`,t)};imports={list:(e,t)=>this.request("GET","/imports",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/imports/${e}`,t),create:(e,t)=>this.request("POST","/imports",{...t,body:e}),completeMapping:(e,t,r)=>this.request("PATCH",`/imports/${e}/complete_mapping`,{...r,body:t??{}}),retryFailedRows:(e,t)=>this.request("PATCH",`/imports/${e}/retry_failed_rows`,t),delete:(e,t)=>this.request("DELETE",`/imports/${e}`,t),rows:{list:(e,t,r)=>this.request("GET",`/imports/${e}/rows`,{...r,params:t?f(t):void 0})}};customers={list:(e,t)=>this.request("GET","/customers",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/customers/${e}`,{...r,params:w(t)}),creditCards:{list:(e,t,r)=>this.request("GET",`/customers/${e}/credit_cards`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/credit_cards/${t}`,{...i,params:w(r)}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/credit_cards/${t}`,r)},create:(e,t)=>this.request("POST","/customers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/customers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/customers/${e}`,t),export:(e,t)=>this.request("GET",`/customers/${e}/export`,t),anonymize:(e,t)=>this.request("POST",`/customers/${e}/anonymize`,t),bulkAddToGroups:(e,t)=>this.request("POST","/customers/bulk_add_to_groups",{...t,body:e}),bulkRemoveFromGroups:(e,t)=>this.request("POST","/customers/bulk_remove_from_groups",{...t,body:e}),bulkAddTags:(e,t)=>this.request("POST","/customers/bulk_add_tags",{...t,body:e}),bulkRemoveTags:(e,t)=>this.request("POST","/customers/bulk_remove_tags",{...t,body:e}),addresses:{list:(e,t,r)=>this.request("GET",`/customers/${e}/addresses`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/addresses/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/customers/${e}/addresses`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/addresses/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/addresses/${t}`,r)},taxIdentifiers:{list:(e,t,r)=>this.request("GET",`/customers/${e}/tax_identifiers`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/customers/${e}/tax_identifiers/${t}`,r),create:(e,t,r)=>this.request("POST",`/customers/${e}/tax_identifiers`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/tax_identifiers/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/tax_identifiers/${t}`,r),validate:(e,t,r)=>this.request("POST",`/customers/${e}/tax_identifiers/${t}/validate`,r)},storeCredits:{list:(e,t,r)=>this.request("GET",`/customers/${e}/store_credits`,{...r,params:t?f(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/store_credits/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/customers/${e}/store_credits`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/store_credits/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/store_credits/${t}`,r)},customFields:this.parentScopedCustomFields(bt["Spree::Customer"])};media={list:(e,t)=>this.request("GET","/media",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/media/${e}`,t),create:(e,t)=>this.request("POST","/media",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/media/${e}`,{...r,body:t}),delete:(e,t,r)=>this.request("DELETE",`/media/${e}`,{...r,params:t?.detach?{detach:"true"}:void 0}),usage:(e,t)=>this.request("GET",`/media/${e}/usage`,t)};categories={list:(e,t)=>this.request("GET","/categories",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/categories/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/categories",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/categories/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/categories/${e}`,t),reposition:(e,t,r)=>this.request("PATCH",`/categories/${e}/reposition`,{...r,body:t}),products:this.positionedProductMembership("/categories"),customFields:this.parentScopedCustomFields(bt["Spree::Category"]),translations:this.parentScopedTranslations("/categories")};collections={list:(e,t)=>this.request("GET","/collections",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/collections/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/collections",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/collections/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/collections/${e}`,t),products:this.positionedProductMembership("/collections"),customFields:this.parentScopedCustomFields(bt["Spree::Collection"]),translations:this.parentScopedTranslations("/collections")};collectionRules={types:e=>this.request("GET","/collection_rules/types",e)};variants={list:(e,t)=>this.request("GET","/variants",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/variants/${e}`,{...r,params:w(t)}),customFields:this.parentScopedCustomFields(bt["Spree::Variant"])};productTypes={list:(e,t)=>this.request("GET","/product_types",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/product_types/${e}`,t),create:(e,t)=>this.request("POST","/product_types",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/product_types/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/product_types/${e}`,t),applyToProducts:(e,t)=>this.request("POST",`/product_types/${e}/apply_to_products`,t)};taxCategories={list:(e,t)=>this.request("GET","/tax_categories",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/tax_categories/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/tax_categories",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/tax_categories/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/tax_categories/${e}`,t)};policies={list:(e,t)=>this.request("GET","/policies",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/policies/${e}`,t),create:(e,t)=>this.request("POST","/policies",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/policies/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/policies/${e}`,t)};returnReasons={list:(e,t)=>this.request("GET","/return_reasons",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/return_reasons/${e}`,t),create:(e,t)=>this.request("POST","/return_reasons",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/return_reasons/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/return_reasons/${e}`,t)};claimReasons={list:(e,t)=>this.request("GET","/claim_reasons",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/claim_reasons/${e}`,t),create:(e,t)=>this.request("POST","/claim_reasons",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/claim_reasons/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/claim_reasons/${e}`,t)};orderCancellationReasons={list:(e,t)=>this.request("GET","/order_cancellation_reasons",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/order_cancellation_reasons/${e}`,t),create:(e,t)=>this.request("POST","/order_cancellation_reasons",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/order_cancellation_reasons/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/order_cancellation_reasons/${e}`,t)};refundReasons={list:(e,t)=>this.request("GET","/refund_reasons",{...t,params:e?f(e):void 0}),get:(e,t)=>this.request("GET",`/refund_reasons/${e}`,t),create:(e,t)=>this.request("POST","/refund_reasons",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/refund_reasons/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/refund_reasons/${e}`,t)};channels={list:(e,t)=>this.request("GET","/channels",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/channels/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/channels",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/channels/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/channels/${e}`,t),addProducts:(e,t,r)=>this.request("POST",`/channels/${e}/add_products`,{...r,body:t}),removeProducts:(e,t,r)=>this.request("POST",`/channels/${e}/remove_products`,{...r,body:t}),orderRoutingRules:{list:(e,t,r)=>this.request("GET",`/channels/${e}/order_routing_rules`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/channels/${e}/order_routing_rules/${t}`,r),create:(e,t,r)=>this.request("POST",`/channels/${e}/order_routing_rules`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/channels/${e}/order_routing_rules/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/channels/${e}/order_routing_rules/${t}`,r)}};orderRoutingRules={types:e=>this.request("GET","/order_routing_rules/types",e)};markets={list:(e,t)=>this.request("GET","/markets",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/markets/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/markets",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/markets/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/markets/${e}`,t)};stockLocations={list:(e,t)=>this.request("GET","/stock_locations",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_locations/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/stock_locations",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/stock_locations/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_locations/${e}`,t)};stockLevels={list:(e,t)=>this.request("GET","/stock_levels",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_levels/${e}`,{...r,params:w(t)}),update:(e,t,r)=>this.request("PATCH",`/stock_levels/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_levels/${e}`,t),bulkUpsert:(e,t)=>this.request("POST","/stock_levels/bulk_upsert",{...t,body:e})};stockMovements={list:(e,t)=>this.request("GET","/stock_movements",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_movements/${e}`,{...r,params:w(t)})};stockTransfers={list:(e,t)=>this.request("GET","/stock_transfers",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_transfers/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/stock_transfers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/stock_transfers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_transfers/${e}`,t),markReady:(e,t)=>this.request("PATCH",`/stock_transfers/${e}/mark_ready`,t),markInTransit:(e,t,r)=>this.request("PATCH",`/stock_transfers/${e}/mark_in_transit`,{...r,body:t}),markDraft:(e,t)=>this.request("PATCH",`/stock_transfers/${e}/mark_draft`,t),close:(e,t,r)=>this.request("PATCH",`/stock_transfers/${e}/close`,{...r,body:t}),stockReceipts:{list:(e,t,r)=>this.request("GET",`/stock_transfers/${e}/stock_receipts`,{...r,params:w(t)}),get:(e,t,r,i)=>this.request("GET",`/stock_transfers/${e}/stock_receipts/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/stock_transfers/${e}/stock_receipts`,{...r,body:t})},cancel:(e,t,r)=>this.request("PATCH",`/stock_transfers/${e}/cancel`,{...r,body:t})};suppliers={list:(e,t)=>this.request("GET","/suppliers",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/suppliers/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/suppliers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/suppliers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/suppliers/${e}`,t)};purchaseOrders={list:(e,t)=>this.request("GET","/purchase_orders",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/purchase_orders/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/purchase_orders",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/purchase_orders/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/purchase_orders/${e}`,t),markOrdered:(e,t)=>this.request("PATCH",`/purchase_orders/${e}/mark_ordered`,t),markDraft:(e,t)=>this.request("PATCH",`/purchase_orders/${e}/mark_draft`,t),close:(e,t,r)=>this.request("PATCH",`/purchase_orders/${e}/close`,{...r,body:t}),stockReceipts:{list:(e,t,r)=>this.request("GET",`/purchase_orders/${e}/stock_receipts`,{...r,params:w(t)}),get:(e,t,r,i)=>this.request("GET",`/purchase_orders/${e}/stock_receipts/${t}`,{...i,params:w(r)}),create:(e,t,r)=>this.request("POST",`/purchase_orders/${e}/stock_receipts`,{...r,body:t})},cancel:(e,t,r)=>this.request("PATCH",`/purchase_orders/${e}/cancel`,{...r,body:t})};countries={list:(e,t)=>this.request("GET","/countries",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/countries/${e}`,{...r,params:w(t)})};directUploads={create:(e,t)=>this.request("POST","/direct_uploads",{...t,body:e})};adminUsers={list:(e,t)=>this.request("GET","/admin_users",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/admin_users/${e}`,{...r,params:w(t)}),update:(e,t,r)=>this.request("PATCH",`/admin_users/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/admin_users/${e}`,t)};invitations={list:(e,t)=>this.request("GET","/invitations",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/invitations/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/invitations",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/invitations/${e}`,t),resend:(e,t)=>this.request("PATCH",`/invitations/${e}/resend`,t),acceptanceLink:(e,t)=>this.request("GET",`/invitations/${e}/acceptance_link`,t)};apiKeys={list:(e,t)=>this.request("GET","/api_keys",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/api_keys/${e}`,{...r,params:w(t)}),current:e=>this.request("GET","/api_keys/current",e??{}),create:(e,t)=>this.request("POST","/api_keys",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/api_keys/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/api_keys/${e}`,t),revoke:(e,t)=>this.request("PATCH",`/api_keys/${e}/revoke`,t)};allowedOrigins={list:(e,t)=>this.request("GET","/allowed_origins",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/allowed_origins/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/allowed_origins",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/allowed_origins/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/allowed_origins/${e}`,t)};webhookEndpoints={list:(e,t)=>this.request("GET","/webhook_endpoints",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/webhook_endpoints",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/webhook_endpoints/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/webhook_endpoints/${e}`,t),sendTest:(e,t)=>this.request("POST",`/webhook_endpoints/${e}/send_test`,t),enable:(e,t)=>this.request("PATCH",`/webhook_endpoints/${e}/enable`,t),disable:(e,t,r)=>this.request("PATCH",`/webhook_endpoints/${e}/disable`,{...r,body:t}),deliveries:{list:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}/deliveries`,{...r,params:t?f(t):void 0}),get:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}/deliveries/${t}`,r),redeliver:(e,t,r)=>this.request("POST",`/webhook_endpoints/${e}/deliveries/${t}/redeliver`,r)}};roles={list:(e,t)=>this.request("GET","/roles",{...t,params:e?f(e):void 0}),get:(e,t,r)=>this.request("GET",`/roles/${e}`,{...r,params:w(t)}),create:(e,t)=>this.request("POST","/roles",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/roles/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/roles/${e}`,t)};permissions={list:e=>this.request("GET","/permissions",e)}};function Lr(e){let t=e.baseUrl.replace(/\/$/,""),r=e.fetch||fetch.bind(globalThis),i=vx(e.retry),n={baseUrl:t,fetchFn:r,retryConfig:i,credentials:e.credentials??"include"},s=e.jwtToken,a=e.storeId,o=null,c="/api/v3/admin",u=async(h,y,g={})=>{let b={};a&&!y.startsWith("/auth/")&&(b["X-Spree-Store-Id"]=a);let S={...g,headers:{...b,...g.headers}},x=()=>{let $=e.secretKey?{headerName:"X-Spree-Api-Key",headerValue:e.secretKey}:{headerName:"Authorization",headerValue:s?`Bearer ${s}`:""};return Ax(n,c,$)(h,y,S)};try{return await x()}catch($){if($ instanceof qt&&$.status===401&&o&&!y.includes("/auth/")&&await o())return x();throw $}},d=new Ex(u),l=Object.create(d);return l.setStore=h=>{a=h},l.setToken=h=>{s=h},l.onUnauthorized=h=>{o=h},l}var _h=B(Ur(),1),De=B(J(),1);p();var sh=B(J(),1);import j0 from"fs";var $o=Symbol("no-body");async function ah(e){if(e===void 0)return $o;let t;if(e==="-")t=await C0();else if(e.startsWith("@")){let r=e.slice(1);try{t=j0.readFileSync(r,"utf-8")}catch(i){throw i?.code==="ENOENT"?new Error(`Request body file not found: ${r}`):new Error(`Could not read request body file ${r}: ${i.message}`)}}else t=e;try{return JSON.parse(t)}catch{let r=e==="-"?" (from stdin)":e.startsWith("@")?` (${e.slice(1)})`:"";throw new Error(`Request body is not valid JSON${r}`)}}async function C0(){process.stdin.isTTY&&process.stderr.write(`${sh.default.dim("Reading request body from stdin \u2014 paste JSON and press Ctrl-D...")}
170
+ `);let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf-8")}p();var Ao=B(Ur(),1),qe=B(J(),1);function Nr(e,t="json"){if(e!=null){if(t==="table"){let r=I0(e);if(r){(0,Ao.printTable)(r.map(oh));return}let i=oh(e);(0,Ao.printTable)(Object.entries(i).map(([n,s])=>({field:n,value:s})));return}process.stdout.isTTY?process.stdout.write(`${R0(JSON.stringify(e,null,2))}
171
171
  `):process.stdout.write(`${JSON.stringify(e)}
172
- `)}}var d0=/("(?:\\.|[^"\\])*"(\s*:)?)|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function u0(e){return e.replace(d0,(t,r,i,n,s)=>r!==void 0?i?_e.default.cyan(r.slice(0,-i.length))+i:_e.default.green(r):n!==void 0?_e.default.yellow(n):s!==void 0?_e.default.yellow(s):t)}function l0(e){return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.data)?e.data:null}function Xm(e){let t={};for(let[r,i]of Object.entries(e))i===null||["string","number","boolean"].includes(typeof i)?t[r]=i:Array.isArray(i)?t[r]=`[${i.length}]`:t[r]="{\u2026}";return t}function Pt(e,t={}){if(e instanceof ft){let i=e.details?`
173
- ${JSON.stringify({details:e.details},null,2)}`:"";process.stderr.write(`${_e.default.red(`${e.code}:`)} ${e.message}${i}
174
- `);let n=e.details?.required_scope;typeof n=="string"&&process.stderr.write(`${_e.default.dim(`Hint: this key lacks \`${n}\`. Create one that has it and use it:`)}
175
- ${_e.default.dim(` spree api-key create --type secret --scopes ${n}`)}
176
- ${_e.default.dim(" then pass it via --api-key <sk_...> or export SPREE_API_KEY=<sk_...>")}
177
- `),process.exit(1)}if(e instanceof yt&&(process.stderr.write(`${_e.default.red("error:")} ${e.message}
178
- `),process.exit(2)),e instanceof TypeError&&/fetch failed/i.test(e.message)){let i=e.cause,n=i instanceof Error?i.message:i?String(i):"",s=t.baseUrl?` (${t.baseUrl})`:"";process.stderr.write(`${_e.default.red("error:")} could not reach the server${s}${n?`: ${n}`:""}
179
- `),process.stderr.write(`${_e.default.dim("Hint: check the URL, or run `spree api status` to diagnose reachability and credentials.")}
180
- `),process.exit(2)}let r=e instanceof Error?e.message:String(e);process.stderr.write(`${_e.default.red("error:")} ${r}
181
- `),process.exit(2)}function Qm(e){let t=new Map;for(let i of e.query??[]){let n=i.indexOf("=");if(n<=0)throw new Error(`Invalid -q expression "${i}" \u2014 expected key=value (e.g. -q status_eq=active)`);let s=i.slice(0,n),a=i.slice(n+1),o=t.get(s);o?o.push(a):t.set(s,[a])}let r={};for(let[i,n]of t)n.length>1?r[`q[${i}][]`]=n:r[`q[${i}]`]=n[0];return e.sort&&(r.sort=e.sort),e.page!==void 0&&(r.page=Zm(e.page,"--page")),e.limit!==void 0&&(r.limit=Zm(e.limit,"--limit")),e.expand&&(r.expand=e.expand),e.fields&&(r.fields=e.fields),r}function Zm(e,t){if(!/^[1-9]\d*$/.test(e))throw new Error(`Invalid ${t} "${e}" \u2014 expected a positive integer`);return Number(e)}function Br(e){let t=e.startsWith("/")?e:`/${e}`,r="/api/v3/admin";return t===r?"/":t.startsWith(`${r}/`)?t.slice(r.length):t}var er=D(K(),1);async function zr(e,t){let r=jr({baseUrl:e,secretKey:t,retry:!1});try{return{status:"connected",storeName:(await r.request("GET","/store",{}))?.name}}catch(i){return i instanceof ft?i.status===401?{status:"unauthorized",message:i.message}:i.status===403?{status:"forbidden"}:{status:"unreachable",message:`server responded HTTP ${i.status}: ${i.message}`}:{status:"unreachable",message:i instanceof Error?i.message:String(i)}}}async function eh(e,t){let r=jr({baseUrl:e,secretKey:t,retry:!1});try{return(await r.apiKeys.current()).scopes??null}catch{return null}}function jn(e){return e.status==="unauthorized"||e.status==="unreachable"}function Cn(e){return{connected:er.default.green(`connected${e.storeName?` (${e.storeName})`:""}`),forbidden:er.default.green("connected")+er.default.dim(" (key valid; lacks read_settings for store details)"),unauthorized:er.default.red("key rejected (401)"),unreachable:er.default.red(`unreachable \u2014 ${e.message}`)}[e.status]}var th={info:{title:"Admin API",contact:{name:"Spree Commerce",url:"https://spreecommerce.org",email:"hello@spreecommerce.org"},description:`Spree Admin API v3 - Administrative API for managing products, orders, and store settings.
172
+ `)}}var T0=/("(?:\\.|[^"\\])*"(\s*:)?)|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function R0(e){return e.replace(T0,(t,r,i,n,s)=>r!==void 0?i?qe.default.cyan(r.slice(0,-i.length))+i:qe.default.green(r):n!==void 0?qe.default.yellow(n):s!==void 0?qe.default.yellow(s):t)}function I0(e){return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.data)?e.data:null}function oh(e){let t={};for(let[r,i]of Object.entries(e))i===null||["string","number","boolean"].includes(typeof i)?t[r]=i:Array.isArray(i)?t[r]=`[${i.length}]`:t[r]="{\u2026}";return t}function Tt(e,t={}){if(e instanceof qt){let i=e.details?`
173
+ ${JSON.stringify({details:e.details},null,2)}`:"";process.stderr.write(`${qe.default.red(`${e.code}:`)} ${e.message}${i}
174
+ `);let n=e.details?.required_scope;typeof n=="string"&&process.stderr.write(`${qe.default.dim(`Hint: this key lacks \`${n}\`. Create one that has it and use it:`)}
175
+ ${qe.default.dim(` spree api-key create --type secret --scopes ${n}`)}
176
+ ${qe.default.dim(" then pass it via --api-key <sk_...> or export SPREE_API_KEY=<sk_...>")}
177
+ `),process.exit(1)}if(e instanceof _t&&(process.stderr.write(`${qe.default.red("error:")} ${e.message}
178
+ `),process.exit(2)),e instanceof TypeError&&/fetch failed/i.test(e.message)){let i=e.cause,n=i instanceof Error?i.message:i?String(i):"",s=t.baseUrl?` (${t.baseUrl})`:"";process.stderr.write(`${qe.default.red("error:")} could not reach the server${s}${n?`: ${n}`:""}
179
+ `),process.stderr.write(`${qe.default.dim("Hint: check the URL, or run `spree api status` to diagnose reachability and credentials.")}
180
+ `),process.exit(2)}let r=e instanceof Error?e.message:String(e);process.stderr.write(`${qe.default.red("error:")} ${r}
181
+ `),process.exit(2)}p();function ch(e){let t=new Map;for(let i of e.query??[]){let n=i.indexOf("=");if(n<=0)throw new Error(`Invalid -q expression "${i}" \u2014 expected key=value (e.g. -q status_eq=active)`);let s=i.slice(0,n),a=i.slice(n+1),o=t.get(s);o?o.push(a):t.set(s,[a])}let r={};for(let[i,n]of t)n.length>1?r[`q[${i}][]`]=n:r[`q[${i}]`]=n[0];return e.sort&&(r.sort=e.sort),e.page!==void 0&&(r.page=ph(e.page,"--page")),e.limit!==void 0&&(r.limit=ph(e.limit,"--limit")),e.expand&&(r.expand=e.expand),e.fields&&(r.fields=e.fields),r}function ph(e,t){if(!/^[1-9]\d*$/.test(e))throw new Error(`Invalid ${t} "${e}" \u2014 expected a positive integer`);return Number(e)}function Vr(e){let t=e.startsWith("/")?e:`/${e}`,r="/api/v3/admin";return t===r?"/":t.startsWith(`${r}/`)?t.slice(r.length):t}p();var sr=B(J(),1);async function Hr(e,t){let r=Lr({baseUrl:e,secretKey:t,retry:!1});try{return{status:"connected",storeName:(await r.request("GET","/store",{}))?.name}}catch(i){return i instanceof qt?i.status===401?{status:"unauthorized",message:i.message}:i.status===403?{status:"forbidden"}:{status:"unreachable",message:`server responded HTTP ${i.status}: ${i.message}`}:{status:"unreachable",message:i instanceof Error?i.message:String(i)}}}async function dh(e,t){let r=Lr({baseUrl:e,secretKey:t,retry:!1});try{return(await r.apiKeys.current()).scopes??null}catch{return null}}function Ln(e){return e.status==="unauthorized"||e.status==="unreachable"}function Bn(e){return{connected:sr.default.green(`connected${e.storeName?` (${e.storeName})`:""}`),forbidden:sr.default.green("connected")+sr.default.dim(" (key valid; lacks read_settings for store details)"),unauthorized:sr.default.red("key rejected (401)"),unreachable:sr.default.red(`unreachable \u2014 ${e.message}`)}[e.status]}p();var uh={info:{title:"Admin API",contact:{name:"Spree Commerce",url:"https://spreecommerce.org",email:"hello@spreecommerce.org"},description:`Spree Admin API v3 - Administrative API for managing products, orders, and store settings.
182
182
 
183
183
  ## Authentication
184
184
 
@@ -233,12 +233,13 @@ is required \u2014 the cookie alone authenticates the call.
233
233
  whether or not the email matches an account, to prevent enumeration.
234
234
 
235
235
  \`redirect_url\` is where the emailed link should point (the reset token
236
- is appended as a \`token\` query param). It must match one of the store's
237
- allowed origins \u2014 otherwise it is silently ignored and the server-side
238
- default is used. The email is delivered by Spree itself via the
236
+ is appended as a \`token\` query param). It is honoured only on the
237
+ dashboard's origin and for an account that is staff of the store \u2014
238
+ otherwise it is silently ignored and the link opens the dashboard's
239
+ reset page. The email is delivered by Spree itself via the
239
240
  \`admin_user.password_reset_requested\` event; this event is never
240
241
  forwarded to webhook endpoints.
241
- `,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}}],responses:{"202":{description:"reset requested",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{email:{type:"string",format:"email"},redirect_url:{type:"string",description:"Must match an allowed origin of the store; ignored otherwise."}},required:["email"]}}}}}},"/api/v3/admin/auth/password_resets/{id}":{patch:{summary:"Reset password",tags:["Authentication"],security:[{api_key:[]}],description:`Consumes a password reset token (the \`token\` query param from the
242
+ `,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}}],responses:{"202":{description:"reset requested",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{email:{type:"string",format:"email"},redirect_url:{type:"string",description:"Honoured only on the dashboard origin, for an account that is staff of the store; ignored otherwise."}},required:["email"]}}}}}},"/api/v3/admin/auth/password_resets/{id}":{patch:{summary:"Reset password",tags:["Authentication"],security:[{api_key:[]}],description:`Consumes a password reset token (the \`token\` query param from the
242
243
  emailed link), sets the new password, and signs the admin in: the
243
244
  response carries a JWT access token and the rotatable refresh token is
244
245
  set in an HttpOnly cookie. The token is single-use \u2014 it invalidates as
@@ -314,7 +315,16 @@ Invalid coupon codes are non-fatal \u2014 the order is created and the failure
314
315
  is reported on the service result (not in the API response body for now).
315
316
 
316
317
 
317
- **Required scope:** \`write_orders\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"201":{description:"order created with preferred_stock_location_id",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{email:{type:"string"},customer_id:{type:"string",description:"Customer ID."},use_customer_default_address:{type:"boolean",description:"When true with customer_id, copies the customer's saved billing/shipping addresses onto the order."},currency:{type:"string"},market_id:{type:"string",description:"Market ID"},channel_id:{type:"string",description:"Channel ID. Defaults to the store primary channel when omitted."},preferred_stock_location_id:{type:"string",description:"Stock Location ID to prefer for fulfillment. Order Routing's built-in PreferredLocation rule reads this and ranks the location first; routing falls back to the next rule when the preferred location can't cover the cart."},locale:{type:"string"},customer_note:{type:"string",description:"Public, customer-visible note"},internal_note:{type:"string",description:"Staff-only note"},metadata:{type:"object",description:"Arbitrary key/value metadata"},shipping_address:{type:"object",properties:{first_name:{type:"string"},last_name:{type:"string"},address1:{type:"string"},city:{type:"string"},postal_code:{type:"string"},country_code:{type:"string"},state_code:{type:"string"},phone:{type:"string"}}},shipping_address_id:{type:"string",description:"Existing customer address ID"},billing_address:{type:"object",properties:{first_name:{type:"string"},last_name:{type:"string"},address1:{type:"string"},city:{type:"string"},postal_code:{type:"string"},country_code:{type:"string"},state_code:{type:"string"},phone:{type:"string"}}},billing_address_id:{type:"string",description:"Existing customer address ID"},items:{type:"array",items:{type:"object",required:["variant_id","quantity"],properties:{variant_id:{type:"string",description:"Variant ID"},quantity:{type:"integer"},metadata:{type:"object"}}}},coupon_code:{type:"string",description:"Optional. Applied non-fatally; invalid codes do not block creation."}}}}}}}},"/api/v3/admin/orders/{id}":{get:{summary:"Show an order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:"Returns full order details including admin-only fields.\n\n**Required scope:** `read_orders` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Order ID (e.g., or_xxx)",schema:{type:"string"}},{name:"expand",in:"query",required:!1,description:"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).",schema:{type:"string"}},{name:"fields",in:"query",required:!1,description:"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.",schema:{type:"string"}}],responses:{"200":{description:"order found",content:{"application/json":{}}},"404":{description:"order not found",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}}},patch:{summary:"Update an order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:"Updates an order. Supports updating email, addresses, special instructions, and line items.\n\n**Required scope:** `write_orders` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Order ID",schema:{type:"string"}}],responses:{"200":{description:"order updated",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{email:{type:"string"},customer_note:{type:"string"},internal_note:{type:"string"},channel_id:{type:"string",description:"Channel ID"},preferred_stock_location_id:{type:"string",description:"Stock Location ID to prefer for fulfillment. Re-runs Order Routing's PreferredLocation rule on subsequent shipment rebuilds."},shipping_address:{type:"object",properties:{firstname:{type:"string"},lastname:{type:"string"},address1:{type:"string"},city:{type:"string"},zipcode:{type:"string"},country_code:{type:"string"},state_code:{type:"string"},phone:{type:"string"}}},billing_address:{type:"object",properties:{firstname:{type:"string"},lastname:{type:"string"},address1:{type:"string"},city:{type:"string"},zipcode:{type:"string"},country_code:{type:"string"},state_code:{type:"string"},phone:{type:"string"}}},items:{type:"array",items:{type:"object",required:["variant_id"],properties:{variant_id:{type:"string",description:"Variant ID"},quantity:{type:"integer"},metadata:{type:"object"}}}}}}}}}},delete:{summary:"Delete a draft order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:"Deletes a draft order. Completed orders cannot be deleted.\n\n**Required scope:** `write_orders` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Order ID",schema:{type:"string"}}],responses:{"204":{description:"order deleted"}}}},"/api/v3/admin/orders/{id}/complete":{patch:{summary:"Complete an order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:"Completes an order in the `confirm` state, marking it as placed.\n\nSet `notify_customer: true` to send the order confirmation email.\n\n\n**Required scope:** `write_orders` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Order ID",schema:{type:"string"}}],responses:{"200":{description:"order completed",content:{"application/json":{}}},"422":{description:"order cannot be completed",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{notify_customer:{type:"boolean",description:"Send the order confirmation email after completion."}}}}}}}},"/api/v3/admin/orders/{id}/cancel":{patch:{summary:"Cancel an order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:`Cancels a completed order.
318
+ **Required scope:** \`write_orders\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"201":{description:"order created with preferred_stock_location_id",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{email:{type:"string"},customer_id:{type:"string",description:"Customer ID."},use_customer_default_address:{type:"boolean",description:"When true with customer_id, copies the customer's saved billing/shipping addresses onto the order."},currency:{type:"string"},market_id:{type:"string",description:"Market ID"},channel_id:{type:"string",description:"Channel ID. Defaults to the store primary channel when omitted."},preferred_stock_location_id:{type:"string",description:"Stock Location ID to prefer for fulfillment. Order Routing's built-in PreferredLocation rule reads this and ranks the location first; routing falls back to the next rule when the preferred location can't cover the cart."},locale:{type:"string"},customer_note:{type:"string",description:"Public, customer-visible note"},internal_note:{type:"string",description:"Staff-only note"},metadata:{type:"object",description:"Arbitrary key/value metadata"},shipping_address:{type:"object",properties:{first_name:{type:"string"},last_name:{type:"string"},address1:{type:"string"},city:{type:"string"},postal_code:{type:"string"},country_code:{type:"string"},state_code:{type:"string"},phone:{type:"string"}}},shipping_address_id:{type:"string",description:"Existing customer address ID"},billing_address:{type:"object",properties:{first_name:{type:"string"},last_name:{type:"string"},address1:{type:"string"},city:{type:"string"},postal_code:{type:"string"},country_code:{type:"string"},state_code:{type:"string"},phone:{type:"string"}}},billing_address_id:{type:"string",description:"Existing customer address ID"},items:{type:"array",items:{type:"object",required:["variant_id","quantity"],properties:{variant_id:{type:"string",description:"Variant ID"},quantity:{type:"integer"},metadata:{type:"object"}}}},coupon_code:{type:"string",description:"Optional. Applied non-fatally; invalid codes do not block creation."}}}}}}}},"/api/v3/admin/orders/{id}":{get:{summary:"Show an order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:"Returns full order details including admin-only fields.\n\n**Required scope:** `read_orders` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Order ID (e.g., or_xxx)",schema:{type:"string"}},{name:"expand",in:"query",required:!1,description:"Comma-separated associations to expand (e.g., items, fulfillments, payments, customer, discounts, billing_address, shipping_address). Use dot notation for nested expand (max 4 levels).",schema:{type:"string"}},{name:"fields",in:"query",required:!1,description:"Comma-separated list of fields to include (e.g., number,total,status,completed_at). id is always included.",schema:{type:"string"}}],responses:{"200":{description:"order found",content:{"application/json":{}}},"404":{description:"order not found",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}}},patch:{summary:"Update an order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:"Updates an order. Supports updating email, addresses, special instructions, and line items.\n\n**Required scope:** `write_orders` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Order ID",schema:{type:"string"}}],responses:{"200":{description:"order updated",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{email:{type:"string"},customer_note:{type:"string"},internal_note:{type:"string"},channel_id:{type:"string",description:"Channel ID"},preferred_stock_location_id:{type:"string",description:"Stock Location ID to prefer for fulfillment. Re-runs Order Routing's PreferredLocation rule on subsequent shipment rebuilds."},shipping_address:{type:"object",properties:{firstname:{type:"string"},lastname:{type:"string"},address1:{type:"string"},city:{type:"string"},zipcode:{type:"string"},country_code:{type:"string"},state_code:{type:"string"},phone:{type:"string"}}},billing_address:{type:"object",properties:{firstname:{type:"string"},lastname:{type:"string"},address1:{type:"string"},city:{type:"string"},zipcode:{type:"string"},country_code:{type:"string"},state_code:{type:"string"},phone:{type:"string"}}},items:{type:"array",items:{type:"object",required:["variant_id"],properties:{variant_id:{type:"string",description:"Variant ID"},quantity:{type:"integer"},metadata:{type:"object"}}}}}}}}}},delete:{summary:"Delete a draft order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:"Deletes a draft order. Completed orders cannot be deleted.\n\n**Required scope:** `write_orders` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Order ID",schema:{type:"string"}}],responses:{"204":{description:"order deleted"}}}},"/api/v3/admin/orders/{id}/complete":{patch:{summary:"Complete an order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:`Completes an order in the \`confirm\` state, marking it as placed.
319
+
320
+ Set \`notify_customer: true\` to send the order confirmation email.
321
+
322
+ On a marketplace, an order holding several sellers' goods becomes one
323
+ order per seller, and the response is the order group they belong to
324
+ with those orders nested inside it.
325
+
326
+
327
+ **Required scope:** \`write_orders\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Order ID",schema:{type:"string"}}],responses:{"200":{description:"order completed",content:{"application/json":{}}},"422":{description:"order cannot be completed",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{notify_customer:{type:"boolean",description:"Send the order confirmation email after completion."}}}}}}}},"/api/v3/admin/orders/{id}/cancel":{patch:{summary:"Cancel an order",tags:["Orders"],security:[{api_key:[],bearer_auth:[]}],description:`Cancels a completed order.
318
328
 
319
329
  \`cancel_reason_id\` records why, from the store's own cancellation-reason
320
330
  vocabulary (\`/admin/order_cancellation_reasons\`), and \`cancel_note\` is a
@@ -443,7 +453,7 @@ Markets using an external tax provider ignore these rows \u2014 that
443
453
  provider carries its own jurisdiction data.
444
454
 
445
455
 
446
- **Required scope:** \`read_settings\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"page",in:"query",required:!1,description:"Page number",schema:{type:"integer"}},{name:"limit",in:"query",required:!1,description:"Number of records per page",schema:{type:"integer"}},{name:"q[name_cont]",in:"query",required:!1,description:"Filter by name (contains)",schema:{type:"string"}},{name:"q[included_in_price_true]",in:"query",required:!1,description:"Only rates included in the product price",schema:{type:"boolean"}},{name:"sort",in:"query",required:!1,description:"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).",schema:{type:"string"}}],responses:{"200":{description:"tax rates found",content:{"application/json":{schema:{type:"object",properties:{data:{type:"array",items:{$ref:"#/components/schemas/TaxRate"}},meta:{$ref:"#/components/schemas/PaginationMeta"}},required:["data","meta"]}}}},"401":{description:"unauthorized",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}}},post:{summary:"Create a tax rate",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"Creates a tax rate for the current store. Give either `amount` as a\ndecimal (`0.19`) or `amount_percentage` as a percentage (`19`).\n\nName the jurisdiction with `country_code` (and `state_code` for a\nstate-level rate). Omitting the country makes the rate apply everywhere.\n\nSet `included_in_price` for VAT-style pricing, where the rate is backed\nout of the displayed price rather than added to it.\n\n\n**Required scope:** `write_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"201":{description:"tax rate created",content:{"application/json":{schema:{$ref:"#/components/schemas/TaxRate"}}}},"422":{description:"validation failed",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string",description:'Customer-facing rate name, e.g. "VAT"'},amount:{type:"string",description:'Rate as a decimal, e.g. "0.19"'},amount_percentage:{type:"number",description:"Rate as a percentage, e.g. 19"},included_in_price:{type:"boolean"},show_rate_in_label:{type:"boolean"},tax_category_id:{type:"string"},country_code:{type:"string",description:'ISO code, e.g. "DE". Omit for every country.'},state_code:{type:"string",description:'State abbreviation within that country, e.g. "CA".'}},required:["name","tax_category_id"]}}},required:!0}}},"/api/v3/admin/tax_rates/{id}":{parameters:[{name:"id",in:"path",description:"Tax rate ID",required:!0,schema:{type:"string"}}],get:{summary:"Get a tax rate",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"**Required scope:** `read_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"200":{description:"tax rate found",content:{"application/json":{schema:{$ref:"#/components/schemas/TaxRate"}}}}}},patch:{summary:"Update a tax rate",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"**Required scope:** `write_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"200":{description:"tax rate updated",content:{"application/json":{schema:{$ref:"#/components/schemas/TaxRate"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},amount:{type:"string"},amount_percentage:{type:"number"},included_in_price:{type:"boolean"},show_rate_in_label:{type:"boolean"},tax_category_id:{type:"string"},country_code:{type:"string"},state_code:{type:"string"}}}}},required:!0}},delete:{summary:"Delete a tax rate",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"Soft-deletes the rate. Tax lines it already produced keep their own rate snapshot.\n\n**Required scope:** `write_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"204":{description:"tax rate deleted"}}}},"/api/v3/admin/translatable_resources":{get:{summary:"List translatable resources",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"Returns every translatable resource type and its translatable fields (key + content type), so clients can render translation editors generically.\n\n**Required scope:** `read_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"translatable resources found",content:{"application/json":{}}}}}},"/api/v3/admin/translations/batch":{post:{summary:"Batch upsert translations",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"Atomically upserts translations across many records of (possibly) different translatable resource types in one request \u2014 e.g. an option type and all its option values in one save. A flat list of independent registry writes; all entries succeed or none do.\n\n**Required scope:** `write_<resource>` for every resource type in the batch (for API-key authentication) (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"translations upserted",content:{"application/json":{}}},"422":{description:"unsupported locale rolls back the whole batch",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",required:["translations"],properties:{translations:{type:"array",items:{type:"object",required:["resource_type","resource_id","values"],properties:{resource_type:{type:"string",description:"Translatable resource type token, e.g. `option_type`"},resource_id:{type:"string",description:"Prefixed id of the record"},values:{type:"object",description:"Map of locale code to { field: value }",additionalProperties:{type:"object",additionalProperties:!0}}}}}}}}}}}},"/api/v3/admin/admin_users":{get:{summary:"List staff",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns admin users with at least one role assignment on the current store.\n\n**Required scope:** `read_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"staff found",content:{"application/json":{}}}}}},"/api/v3/admin/admin_users/{id}":{get:{summary:"Show a staff member",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"**Required scope:** `read_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"200":{description:"staff member found",content:{"application/json":{}}}}},patch:{summary:"Update a staff member",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Updates name fields and reassigns roles for the current store. `role_ids` is a complete replacement \u2014 roles not in the array are removed for this store.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"200":{description:"staff member updated",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{first_name:{type:"string"},last_name:{type:"string"},role_ids:{type:"array",items:{type:"string"}}}}}}}},delete:{summary:"Remove a staff member from this store",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Removes the user's role assignments on the current store. The account is preserved \u2014 the user keeps access to any other stores.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"204":{description:"staff removed from store"}}}},"/api/v3/admin/invitations":{get:{summary:"List invitations",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns invitations for the current store, including pending and accepted.\n\n**Required scope:** `read_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"invitations found",content:{"application/json":{}}}}},post:{summary:"Create an invitation",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Invites a teammate by email. The invitation is scoped to the current store and carries the chosen role; on accept, a `RoleUser` is created via the invitation's `after_accept` callback.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"201":{description:"invitation created",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",required:["email","role_id"],properties:{email:{type:"string"},role_id:{type:"string"}}}}}}}},"/api/v3/admin/invitations/{id}":{delete:{summary:"Revoke an invitation",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"204":{description:"invitation revoked"}}}},"/api/v3/admin/invitations/{id}/resend":{patch:{summary:"Resend an invitation",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Issues a fresh token and dispatches the invitation email again.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"200":{description:"invitation resent",content:{"application/json":{}}}}}},"/api/v3/admin/permissions":{get:{summary:"List the permission catalog",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns the permission catalog \u2014 the grant vocabulary shared by staff role permissions and secret API key scopes. Entries are grouped for permission pickers; labels and descriptions are localized. Readable by any authenticated admin credential.",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"catalog returned",content:{"application/json":{}}}}}},"/api/v3/admin/roles":{get:{summary:"List roles",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns staff roles with their catalog permissions. Roles are global, not per-store; `mutable: false` marks the protected admin role and host-locked rows.\n\n**Required scope:** `read_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"roles found",content:{"application/json":{}}}}},post:{summary:"Create a role",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Creates a staff role. `permissions` holds catalog keys (see GET /admin/permissions); a caller may only grant keys they effectively hold.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"201":{description:"role created",content:{"application/json":{}}},"422":{description:"invalid request",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},description:{type:"string",nullable:!0},permissions:{type:"array",items:{type:"string"}}},required:["name"]}}}}}},"/api/v3/admin/roles/{id}":{parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],patch:{summary:"Update a role",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Updates a role name, description or permissions. The admin role and host-locked roles (`mutable: false`) reject changes.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"role updated",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},description:{type:"string",nullable:!0},permissions:{type:"array",items:{type:"string"}}}}}}}},delete:{summary:"Delete a role",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Deletes a role. Fails with 422 while the role is protected or still referenced by staff members or pending invitations.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"204":{description:"role deleted"},"422":{description:"role cannot be deleted",content:{"application/json":{}}}}}},"/api/v3/admin/stock_locations":{get:{summary:"List stock locations",tags:["Stock Locations"],security:[{api_key:[],bearer_auth:[]}],description:"Returns the configured stock locations. Stock locations are global\n(shared across stores). Filter with Ransack predicates such as\n`q[active_eq]`, `q[kind_eq]`, `q[pickup_enabled_eq]`, or\n`q[name_cont]`.\n\nPickup-related attributes (`kind`, `pickup_enabled`,\n`pickup_stock_policy`, `pickup_ready_in_minutes`,\n`pickup_instructions`) drive merchant pickup support at checkout \u2014\ncustomers can collect orders from any active location with\n`pickup_enabled: true`.\n\n\n**Required scope:** `read_stock` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"page",in:"query",required:!1,description:"Page number",schema:{type:"integer"}},{name:"limit",in:"query",required:!1,description:"Number of records per page",schema:{type:"integer"}},{name:"q[name_cont]",in:"query",required:!1,description:"Filter by name (contains)",schema:{type:"string"}},{name:"q[active_eq]",in:"query",required:!1,description:"Filter by active status",schema:{type:"boolean"}},{name:"q[kind_eq]",in:"query",required:!1,description:"Filter by kind (built-in: 'warehouse', 'store', 'fulfillment_center')",schema:{type:"string"}},{name:"q[pickup_enabled_eq]",in:"query",required:!1,description:"Filter by pickup-enabled flag",schema:{type:"boolean"}},{name:"sort",in:"query",required:!1,description:"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).",schema:{type:"string"}},{name:"fields",in:"query",required:!1,description:"Comma-separated list of fields to include. id is always included.",schema:{type:"string"}}],responses:{"200":{description:"stock locations found",content:{"application/json":{schema:{type:"object",properties:{data:{type:"array",items:{$ref:"#/components/schemas/StockLocation"}},meta:{$ref:"#/components/schemas/PaginationMeta"}},required:["data","meta"]}}}},"401":{description:"unauthorized",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}}},post:{summary:"Create a stock location",tags:["Stock Locations"],security:[{api_key:[],bearer_auth:[]}],description:`Creates a new stock location.
456
+ **Required scope:** \`read_settings\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"page",in:"query",required:!1,description:"Page number",schema:{type:"integer"}},{name:"limit",in:"query",required:!1,description:"Number of records per page",schema:{type:"integer"}},{name:"q[name_cont]",in:"query",required:!1,description:"Filter by name (contains)",schema:{type:"string"}},{name:"q[included_in_price_true]",in:"query",required:!1,description:"Only rates included in the product price",schema:{type:"boolean"}},{name:"sort",in:"query",required:!1,description:"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).",schema:{type:"string"}}],responses:{"200":{description:"tax rates found",content:{"application/json":{schema:{type:"object",properties:{data:{type:"array",items:{$ref:"#/components/schemas/TaxRate"}},meta:{$ref:"#/components/schemas/PaginationMeta"}},required:["data","meta"]}}}},"401":{description:"unauthorized",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}}},post:{summary:"Create a tax rate",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"Creates a tax rate for the current store. Give either `amount` as a\ndecimal (`0.19`) or `amount_percentage` as a percentage (`19`).\n\nName the jurisdiction with `country_code` (and `state_code` for a\nstate-level rate). Omitting the country makes the rate apply everywhere.\n\nSet `included_in_price` for VAT-style pricing, where the rate is backed\nout of the displayed price rather than added to it.\n\n\n**Required scope:** `write_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"201":{description:"tax rate created",content:{"application/json":{schema:{$ref:"#/components/schemas/TaxRate"}}}},"422":{description:"validation failed",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string",description:'Customer-facing rate name, e.g. "VAT"'},amount:{type:"string",description:'Rate as a decimal, e.g. "0.19"'},amount_percentage:{type:"number",description:"Rate as a percentage, e.g. 19"},included_in_price:{type:"boolean"},show_rate_in_label:{type:"boolean"},tax_category_id:{type:"string"},country_code:{type:"string",description:'ISO code, e.g. "DE". Omit for every country.'},state_code:{type:"string",description:'State abbreviation within that country, e.g. "CA".'}},required:["name","tax_category_id"]}}},required:!0}}},"/api/v3/admin/tax_rates/{id}":{parameters:[{name:"id",in:"path",description:"Tax rate ID",required:!0,schema:{type:"string"}}],get:{summary:"Get a tax rate",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"**Required scope:** `read_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"200":{description:"tax rate found",content:{"application/json":{schema:{$ref:"#/components/schemas/TaxRate"}}}}}},patch:{summary:"Update a tax rate",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"**Required scope:** `write_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"200":{description:"tax rate updated",content:{"application/json":{schema:{$ref:"#/components/schemas/TaxRate"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},amount:{type:"string"},amount_percentage:{type:"number"},included_in_price:{type:"boolean"},show_rate_in_label:{type:"boolean"},tax_category_id:{type:"string"},country_code:{type:"string"},state_code:{type:"string"}}}}},required:!0}},delete:{summary:"Delete a tax rate",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"Soft-deletes the rate. Tax lines it already produced keep their own rate snapshot.\n\n**Required scope:** `write_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"204":{description:"tax rate deleted"}}}},"/api/v3/admin/translatable_resources":{get:{summary:"List translatable resources",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"Returns every translatable resource type and its translatable fields (key + content type), so clients can render translation editors generically.\n\n**Required scope:** `read_settings` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"translatable resources found",content:{"application/json":{}}}}}},"/api/v3/admin/translations/batch":{post:{summary:"Batch upsert translations",tags:["Settings"],security:[{api_key:[],bearer_auth:[]}],description:"Atomically upserts translations across many records of (possibly) different translatable resource types in one request \u2014 e.g. an option type and all its option values in one save. A flat list of independent registry writes; all entries succeed or none do.\n\n**Required scope:** `write_<resource>` for every resource type in the batch (for API-key authentication) (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"translations upserted",content:{"application/json":{}}},"422":{description:"unsupported locale rolls back the whole batch",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",required:["translations"],properties:{translations:{type:"array",items:{type:"object",required:["resource_type","resource_id","values"],properties:{resource_type:{type:"string",description:"Translatable resource type token, e.g. `option_type`"},resource_id:{type:"string",description:"Prefixed id of the record"},values:{type:"object",description:"Map of locale code to { field: value }",additionalProperties:{type:"object",additionalProperties:!0}}}}}}}}}}}},"/api/v3/admin/admin_users":{get:{summary:"List staff",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns admin users with at least one role assignment on the current store.\n\n**Required scope:** `read_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"staff found",content:{"application/json":{}}}}}},"/api/v3/admin/admin_users/{id}":{get:{summary:"Show a staff member",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"**Required scope:** `read_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"200":{description:"staff member found",content:{"application/json":{}}}}},patch:{summary:"Update a staff member",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Updates name fields and reassigns roles for the current store. `role_ids` is a complete replacement \u2014 roles not in the array are removed for this store.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"200":{description:"staff member updated",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{first_name:{type:"string"},last_name:{type:"string"},role_ids:{type:"array",items:{type:"string"}}}}}}}},delete:{summary:"Remove a staff member from this store",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Removes the user's role assignments on the current store. The account is preserved \u2014 the user keeps access to any other stores. Removing a role needs the same rights as granting it, and the store always keeps at least one admin.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"204":{description:"staff removed from store"}}}},"/api/v3/admin/invitations":{get:{summary:"List invitations",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns invitations for the current store, including pending and accepted.\n\n**Required scope:** `read_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"invitations found",content:{"application/json":{}}}}},post:{summary:"Create an invitation",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Invites a teammate by email. The invitation is scoped to the current store and carries the chosen role; on accept, a `RoleUser` is created via the invitation's `after_accept` callback.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"201":{description:"invitation created",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",required:["email","role_id"],properties:{email:{type:"string"},role_id:{type:"string"}}}}}}}},"/api/v3/admin/invitations/{id}":{delete:{summary:"Revoke an invitation",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"204":{description:"invitation revoked"}}}},"/api/v3/admin/invitations/{invitation_id}/acceptance_link":{get:{summary:"Get an invitation acceptance link",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns the link the invitee opens to accept a pending invitation. The link carries the invitation token, so it needs write access to staff and the right to grant the invitation's role; invitation listings never include it.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"invitation_id",in:"path",required:!0,schema:{type:"string"}}],responses:{"200":{description:"acceptance link found",content:{"application/json":{schema:{$ref:"#/components/schemas/InvitationAcceptanceLink"}}}}}}},"/api/v3/admin/invitations/{id}/resend":{patch:{summary:"Resend an invitation",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Issues a fresh token and dispatches the invitation email again.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}},{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{"200":{description:"invitation resent",content:{"application/json":{}}}}}},"/api/v3/admin/permissions":{get:{summary:"List the permission catalog",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns the permission catalog \u2014 the grant vocabulary shared by staff role permissions and secret API key scopes. Entries are grouped for permission pickers; labels and descriptions are localized. Readable by any authenticated admin credential.",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"catalog returned",content:{"application/json":{}}}}}},"/api/v3/admin/roles":{get:{summary:"List roles",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Returns staff roles with their catalog permissions. Roles are global, not per-store; `mutable: false` marks the protected admin role and host-locked rows.\n\n**Required scope:** `read_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"roles found",content:{"application/json":{}}}}},post:{summary:"Create a role",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Creates a staff role. `permissions` holds catalog keys (see GET /admin/permissions); a caller may only grant keys they effectively hold.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"201":{description:"role created",content:{"application/json":{}}},"422":{description:"invalid request",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},description:{type:"string",nullable:!0},permissions:{type:"array",items:{type:"string"}}},required:["name"]}}}}}},"/api/v3/admin/roles/{id}":{parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],patch:{summary:"Update a role",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Updates a role name, description or permissions. The admin role and host-locked roles (`mutable: false`) reject changes.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"200":{description:"role updated",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},description:{type:"string",nullable:!0},permissions:{type:"array",items:{type:"string"}}}}}}}},delete:{summary:"Delete a role",tags:["Staff"],security:[{api_key:[],bearer_auth:[]}],description:"Deletes a role. Fails with 422 while the role is protected or still referenced by staff members or pending invitations.\n\n**Required scope:** `write_staff` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,schema:{type:"string"}}],responses:{"204":{description:"role deleted"},"422":{description:"role cannot be deleted",content:{"application/json":{}}}}}},"/api/v3/admin/stock_locations":{get:{summary:"List stock locations",tags:["Stock Locations"],security:[{api_key:[],bearer_auth:[]}],description:"Returns the configured stock locations. Stock locations are global\n(shared across stores). Filter with Ransack predicates such as\n`q[active_eq]`, `q[kind_eq]`, `q[pickup_enabled_eq]`, or\n`q[name_cont]`.\n\nPickup-related attributes (`kind`, `pickup_enabled`,\n`pickup_stock_policy`, `pickup_ready_in_minutes`,\n`pickup_instructions`) drive merchant pickup support at checkout \u2014\ncustomers can collect orders from any active location with\n`pickup_enabled: true`.\n\n\n**Required scope:** `read_stock` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"page",in:"query",required:!1,description:"Page number",schema:{type:"integer"}},{name:"limit",in:"query",required:!1,description:"Number of records per page",schema:{type:"integer"}},{name:"q[name_cont]",in:"query",required:!1,description:"Filter by name (contains)",schema:{type:"string"}},{name:"q[active_eq]",in:"query",required:!1,description:"Filter by active status",schema:{type:"boolean"}},{name:"q[kind_eq]",in:"query",required:!1,description:"Filter by kind (built-in: 'warehouse', 'store', 'fulfillment_center')",schema:{type:"string"}},{name:"q[pickup_enabled_eq]",in:"query",required:!1,description:"Filter by pickup-enabled flag",schema:{type:"boolean"}},{name:"sort",in:"query",required:!1,description:"Sort by field. Prefix with `-` for descending (e.g., `-created_at`).",schema:{type:"string"}},{name:"fields",in:"query",required:!1,description:"Comma-separated list of fields to include. id is always included.",schema:{type:"string"}}],responses:{"200":{description:"stock locations found",content:{"application/json":{schema:{type:"object",properties:{data:{type:"array",items:{$ref:"#/components/schemas/StockLocation"}},meta:{$ref:"#/components/schemas/PaginationMeta"}},required:["data","meta"]}}}},"401":{description:"unauthorized",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}}},post:{summary:"Create a stock location",tags:["Stock Locations"],security:[{api_key:[],bearer_auth:[]}],description:`Creates a new stock location.
447
457
 
448
458
  Setting \`default: true\` automatically demotes the previous default
449
459
  location.
@@ -875,24 +885,24 @@ shape a stock location uses.
875
885
  readable. Refused with a 422 while a purchase order still points at it.
876
886
 
877
887
 
878
- **Required scope:** \`write_purchasing\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"204":{description:"supplier deleted"}}}}},components:{schemas:{PaginationMeta:{type:"object",properties:{page:{type:"integer"},limit:{type:"integer"},count:{type:"integer",description:"Total number of records"},pages:{type:"integer",description:"Total number of pages"},from:{type:"integer",description:"Index of first record on this page"},to:{type:"integer",description:"Index of last record on this page"},in:{type:"integer",description:"Number of records on this page"},previous:{type:"integer",nullable:!0,description:"Previous page number"},next:{type:"integer",nullable:!0,description:"Next page number"}},required:["page","limit","count","pages","from","to","in"]},ErrorResponse:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"},details:{type:"object",description:"Field-specific validation errors",nullable:!0}},required:["code","message"]}},required:["error"]},AuthResponse:{type:"object",properties:{token:{type:"string",description:"JWT access token"},user:{$ref:"#/components/schemas/AdminUser"}},required:["token","user"]},PermissionRule:{type:"object",description:"A single permission rule (CanCanCan rule). Rules are applied in order, last-matching-wins.",properties:{allow:{type:"boolean",description:"true for `can`, false for `cannot`"},actions:{type:"array",items:{type:"string"},description:'Action names, e.g. ["read", "update"] or ["manage"]'},subjects:{type:"array",items:{type:"string"},description:'Subject class names, e.g. ["Spree::Product"] or ["all"]'},has_conditions:{type:"boolean",description:"True if the server-side rule has per-record conditions. The SPA shows the action optimistically and handles 403 from the API."}},required:["allow","actions","subjects","has_conditions"]},ImportSchemaField:{type:"object",description:"A canonical column of an import type, including per-store custom field columns",properties:{name:{type:"string",description:"Canonical field name used in mappings"},label:{type:"string",description:"Human-readable label"},required:{type:"boolean",description:"Whether the field must be mapped before processing"}},required:["name","label","required"]},CheckoutRequirement:{type:"object",properties:{step:{type:"string",description:"Checkout step this requirement belongs to"},field:{type:"string",description:"Field that needs to be satisfied"},message:{type:"string",description:"Human-readable requirement message"}},required:["step","field","message"]},CartWarning:{type:"object",description:"A warning about a cart issue (e.g., item removed due to stock change)",properties:{code:{type:"string",description:"Machine-readable warning code"},message:{type:"string",description:"Human-readable warning message"},line_item_id:{type:"string",nullable:!0,description:"Prefixed line item ID (when applicable)"},variant_id:{type:"string",nullable:!0,description:"Prefixed variant ID (when applicable)"},item_index:{type:"integer",nullable:!0,description:"Position in the submitted items array, for warnings raised while applying a batch of item changes"}},required:["code","message"]},FulfillmentManifestItem:{type:"object",description:"An item within a fulfillment \u2014 which line item and how many units are in this fulfillment",properties:{item_id:{type:"string",description:"Line item ID"},variant_id:{type:"string",description:"Variant ID"},quantity:{type:"integer",description:"Quantity in this fulfillment"}},required:["item_id","variant_id","quantity"]},AdminUserRoleAssignment:{type:"object",description:"A role assignment for the current store on a staff member",properties:{id:{type:"string",description:"Prefixed role ID"},name:{type:"string",description:"Role name"}},required:["id","name"]},AdminUserStore:{type:"object",description:"A store the staff member can access through a role assignment",properties:{id:{type:"string",description:"Prefixed store ID"},name:{type:"string",description:"Store name"},code:{type:"string",description:"Store code"}},required:["id","name","code"]},PreferenceField:{type:"object",description:"A single configurable preference on a payment method, promotion rule/action, or calculator. The frontend uses `type` + `default` to render a sensible input.",properties:{key:{type:"string"},type:{type:"string",description:"string | text | password | integer | decimal | boolean | array | hash"},default:{description:"Default value (any JSON type), null when there is no default",nullable:!0}},required:["key","type"]},PromotionActionCalculator:{type:"object",description:"The action's nested calculator (when the action carries one \u2014 null for actions like `free_shipping`)",properties:{type:{type:"string",description:"Wire shorthand for the calculator subclass"},label:{type:"string"},preferences:{type:"object",additionalProperties:!0},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}}},required:["type","label","preferences","preference_schema"]},PromotionActionLineItem:{type:"object",description:"One row in a `create_line_items` action \u2014 the variant added to the order and how many",properties:{variant_id:{type:"string"},quantity:{type:"integer"}},required:["variant_id","quantity"]},MeResponse:{type:"object",description:"Current admin user profile and serialized permissions",properties:{user:{$ref:"#/components/schemas/AdminUser"},permissions:{type:"array",items:{$ref:"#/components/schemas/PermissionRule"}}},required:["user","permissions"]},Actor:{type:"object",properties:{id:{type:"string"},type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},label:{type:"string",nullable:!0}},required:["id","type","label"],"x-typelizer":!0},Address:{type:"object",properties:{id:{type:"string"},label:{type:"string",nullable:!0},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string"},address1:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},postal_code:{type:"string",nullable:!0},city:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},company:{type:"string",nullable:!0},country_name:{type:"string"},country_code:{type:"string"},state_text:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},quick_checkout:{type:"boolean"},is_default_billing:{type:"boolean"},is_default_shipping:{type:"boolean"},state_abbr:{type:"string",nullable:!0},country_iso:{type:"string"},state_name:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},latitude:{type:"number",nullable:!0},longitude:{type:"number",nullable:!0},customer_id:{type:"string",nullable:!0},owner_id:{type:"string",nullable:!0},owner_type:{type:"string",nullable:!0}},required:["id","label","first_name","last_name","full_name","address1","address2","postal_code","city","phone","company","country_name","country_code","state_text","state_code","quick_checkout","is_default_billing","is_default_shipping","state_abbr","country_iso","state_name","metadata","created_at","updated_at","latitude","longitude","customer_id","owner_id","owner_type"],"x-typelizer":!0},AdminUser:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string",nullable:!0},selected_locale:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},avatar_url:{type:"string",nullable:!0},roles:{type:"array",items:{$ref:"#/components/schemas/AdminUserRoleAssignment"}},stores:{type:"array",items:{$ref:"#/components/schemas/AdminUserStore"}}},required:["id","email","first_name","last_name","full_name","selected_locale","created_at","updated_at","avatar_url","roles","stores"],"x-typelizer":!0},AllowedOrigin:{type:"object",properties:{id:{type:"string"},origin:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","origin","created_at","updated_at"],"x-typelizer":!0},ApiKey:{type:"object",properties:{id:{type:"string"},name:{type:"string"},key_type:{type:"string",enum:["publishable","secret"]},token_prefix:{type:"string",nullable:!0},scopes:{type:"array",items:{type:"string"}},created_at:{type:"string"},updated_at:{type:"string"},revoked_at:{type:"string",nullable:!0},last_used_at:{type:"string",nullable:!0},channel_id:{type:"string",nullable:!0},plaintext_token:{type:"string",nullable:!0},created_by_email:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by_label:{type:"string",nullable:!0}},required:["id","name","key_type","token_prefix","scopes","created_at","updated_at","revoked_at","last_used_at","channel_id","plaintext_token","created_by_email","created_by_type","created_by_label"],"x-typelizer":!0},AppliedPromotion:{type:"object",properties:{id:{type:"string"},promotion_id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},code:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","promotion_id","name","description","code","amount","display_amount","created_at","updated_at"],"x-typelizer":!0},Cart:{type:"object",properties:{id:{type:"string"},market_id:{type:"string",nullable:!0},channel_id:{type:"string",nullable:!0},preferred_stock_location_id:{type:"string",nullable:!0},company_id:{type:"string",nullable:!0},company_name:{type:"string",nullable:!0},po_number_required:{type:"boolean"},po_document_filename:{type:"string",nullable:!0},po_document_byte_size:{type:"number",nullable:!0},number:{type:"string"},token:{type:"string"},email:{type:"string",nullable:!0},customer_note:{type:"string",nullable:!0},po_number:{type:"string",nullable:!0},currency:{type:"string"},locale:{type:"string",nullable:!0},total_quantity:{type:"number"},warnings:{type:"array",items:{$ref:"#/components/schemas/CartWarning"}},coupon_code:{type:"string",nullable:!0},item_total:{type:"string",nullable:!0},display_item_total:{type:"string",nullable:!0},adjustment_total:{type:"string",nullable:!0},display_adjustment_total:{type:"string",nullable:!0},discount_total:{type:"string",nullable:!0},display_discount_total:{type:"string",nullable:!0},tax_total:{type:"string",nullable:!0},display_tax_total:{type:"string",nullable:!0},included_tax_total:{type:"string",nullable:!0},display_included_tax_total:{type:"string",nullable:!0},additional_tax_total:{type:"string",nullable:!0},display_additional_tax_total:{type:"string",nullable:!0},total:{type:"string",nullable:!0},display_total:{type:"string",nullable:!0},gift_card_total:{type:"string",nullable:!0},display_gift_card_total:{type:"string",nullable:!0},amount_due:{type:"string",nullable:!0},display_amount_due:{type:"string",nullable:!0},delivery_total:{type:"string",nullable:!0},display_delivery_total:{type:"string",nullable:!0},fee_total:{type:"string",nullable:!0},display_fee_total:{type:"string",nullable:!0},store_credit_total:{type:"string",nullable:!0},display_store_credit_total:{type:"string",nullable:!0},covered_by_store_credit:{type:"boolean"},current_step:{type:"string"},completed_steps:{type:"array",items:{type:"string"}},requirements:{type:"array",items:{$ref:"#/components/schemas/CheckoutRequirement"}},order_minimum:{type:"number",nullable:!0},order_minimum_shortfall:{type:"number",nullable:!0},below_order_minimum:{type:"boolean",nullable:!0},freight_summary:{allOf:[{$ref:"#/components/schemas/FreightSummary"}],nullable:!0},shipping_eq_billing_address:{type:"boolean"},items:{type:"array",items:{$ref:"#/components/schemas/LineItem"}},billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0},completed_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},applied_promotions:{type:"array",items:{$ref:"#/components/schemas/AppliedPromotion"}}},required:["id","market_id","channel_id","preferred_stock_location_id","company_id","company_name","po_number_required","po_document_filename","po_document_byte_size","number","token","email","customer_note","po_number","currency","locale","total_quantity","warnings","coupon_code","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fee_total","display_fee_total","store_credit_total","display_store_credit_total","covered_by_store_credit","current_step","completed_steps","requirements","order_minimum","order_minimum_shortfall","below_order_minimum","freight_summary","shipping_eq_billing_address","items","billing_address","shipping_address","market","completed_at","created_at","updated_at","applied_promotions"],"x-typelizer":!0},CatalogAssignment:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},catalog_id:{type:"string"},assignable_type:{type:"string"},assignable_id:{type:"string"},assignable_name:{type:"string",nullable:!0}},required:["id","created_at","catalog_id","assignable_type","assignable_id","assignable_name"],"x-typelizer":!0},CatalogOrderMinimum:{type:"object",properties:{id:{type:"string"},currency:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string"},display_amount:{type:"string"}},required:["id","currency","created_at","updated_at","amount","display_amount"],"x-typelizer":!0},CatalogPrice:{type:"object",properties:{id:{type:"string",nullable:!0},label:{type:"string",nullable:!0},sku:{type:"string",nullable:!0},currency:{type:"string"},source:{type:"string",enum:["explicit","automatic","base"]},break_count:{type:"number"},amount:{type:"string"},display_amount:{type:"string"},tiers:{type:"array",items:{$ref:"#/components/schemas/CatalogPriceTier"}}},required:["id","label","sku","currency","source","break_count","amount","display_amount","tiers"],"x-typelizer":!0},CatalogPriceTier:{type:"object",properties:{min_quantity:{type:"number"},display_amount:{type:"string"},amount:{type:"string"}},required:["min_quantity","display_amount","amount"],"x-typelizer":!0},CatalogProduct:{type:"object",properties:{id:{type:"string"},name:{type:"string"},thumbnail_url:{type:"string",nullable:!0},quantity_rule:{allOf:[{$ref:"#/components/schemas/CatalogProductTerm"}],nullable:!0},catalog_variants:{type:"array",items:{$ref:"#/components/schemas/CatalogPrice"}}},required:["id","name","thumbnail_url"],"x-typelizer":!0},CatalogProductTerm:{type:"object",properties:{id:{type:"string"},product_id:{type:"string"},product_name:{type:"string",nullable:!0},minimum_order_quantity:{type:"number",nullable:!0},order_multiple:{type:"number",nullable:!0},mixed:{type:"boolean"}},required:["id","product_id","product_name","minimum_order_quantity","order_multiple","mixed"],"x-typelizer":!0},CatalogQuantityRule:{type:"object",properties:{id:{type:"string"},minimum_order_quantity:{type:"number",nullable:!0},order_multiple:{type:"number",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},variant_id:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},product_name:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0}},required:["id","minimum_order_quantity","order_multiple","created_at","updated_at","variant_id","variant_sku","product_name","options_text"],"x-typelizer":!0},Catalog:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},active:{type:"boolean"},position:{type:"number",nullable:!0},metadata:{type:"object",nullable:!0},minimum_order_quantity:{type:"number",nullable:!0},order_multiple:{type:"number",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},products_count:{type:"number"},pricing_strategy:{type:"string"},order_minimums:{type:"array",items:{$ref:"#/components/schemas/CatalogOrderMinimum"}},price_list:{$ref:"#/components/schemas/PriceList"},assignments:{type:"array",items:{$ref:"#/components/schemas/CatalogAssignment"}}},required:["id","name","description","active","position","metadata","minimum_order_quantity","order_multiple","created_at","updated_at","products_count","pricing_strategy"],"x-typelizer":!0},Category:{type:"object",properties:{id:{type:"string"},name:{type:"string"},permalink:{type:"string"},position:{type:"number"},depth:{type:"number"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},children_count:{type:"number"},parent_id:{type:"string",nullable:!0},description:{type:"string"},description_html:{type:"string"},image_url:{type:"string",nullable:!0},square_image_url:{type:"string",nullable:!0},is_root:{type:"boolean"},is_child:{type:"boolean"},is_leaf:{type:"boolean"},parent:{$ref:"#/components/schemas/Category"},children:{type:"array",items:{$ref:"#/components/schemas/Category"}},ancestors:{type:"array",items:{$ref:"#/components/schemas/Category"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},external_references:{type:"object"},translations:{type:"object"},metadata:{type:"object"},pretty_name:{type:"string"},lft:{type:"number"},rgt:{type:"number"},products_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","permalink","position","depth","meta_title","meta_description","meta_keywords","children_count","parent_id","description","description_html","image_url","square_image_url","is_root","is_child","is_leaf","external_references","metadata","pretty_name","lft","rgt","products_count","created_at","updated_at"],"x-typelizer":!0},Channel:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string"},active:{type:"boolean"},default:{type:"boolean"},storefront_access:{type:"string"},guest_checkout:{type:"boolean"},preferred_order_routing_strategy:{type:"string",nullable:!0},preferred_storefront_access:{type:"string",nullable:!0},preferred_guest_checkout:{type:"boolean",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},stock_location_ids:{type:"array",items:{type:"string"}},default_catalog_id:{type:"string",nullable:!0}},required:["id","name","code","active","default","storefront_access","guest_checkout","preferred_order_routing_strategy","preferred_storefront_access","preferred_guest_checkout","created_at","updated_at","stock_location_ids","default_catalog_id"],"x-typelizer":!0},ClaimLineItem:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},send_replacement:{type:"boolean"},description:{type:"string",nullable:!0},refund_amount:{type:"string"},paid_amount:{type:"string"},display_refund_amount:{type:"string"},variant_id:{type:"string",nullable:!0},replacement_variant_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},variant:{$ref:"#/components/schemas/Variant"},created_at:{type:"string"},updated_at:{type:"string"},replacement_variant:{$ref:"#/components/schemas/Variant"}},required:["id","quantity","send_replacement","description","refund_amount","paid_amount","display_refund_amount","variant_id","replacement_variant_id","line_item_id","created_at","updated_at"],"x-typelizer":!0},ClaimReason:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},can_be_deleted:{type:"boolean"}},required:["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":!0},Claim:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{anyOf:[{type:"string",enum:["open","approved","resolved","denied","canceled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},resolution:{type:"string",nullable:!0},order_id:{type:"string",nullable:!0},reason_id:{type:"string",nullable:!0},refund_total:{type:"string"},display_refund_total:{type:"string"},approved_at:{type:"string",nullable:!0},resolved_at:{type:"string",nullable:!0},denied_at:{type:"string",nullable:!0},canceled_at:{type:"string",nullable:!0},reason:{$ref:"#/components/schemas/ClaimReason"},claim_line_items:{type:"array",items:{$ref:"#/components/schemas/ClaimLineItem"}},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},created_by_id:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by:{$ref:"#/components/schemas/Actor"},order:{$ref:"#/components/schemas/Order"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}}},required:["id","number","status","resolution","order_id","reason_id","refund_total","display_refund_total","approved_at","resolved_at","denied_at","canceled_at","memo","metadata","created_at","updated_at","created_by_id","created_by_type"],"x-typelizer":!0},CollectionRule:{type:"object",properties:{id:{type:"string"},value:{type:"string",nullable:!0},match_policy:{type:"string",enum:["is_equal_to","is_not_equal_to","contains","does_not_contain"]},type:{type:"string",description:"Rule type. Built-in: tag, available_on, sale. Extensions may register more."}},required:["id","value","match_policy","type"],"x-typelizer":!0},Collection:{type:"object",properties:{id:{type:"string"},name:{type:"string"},permalink:{type:"string"},position:{type:"number"},sort_order:{type:"string"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},products_count:{type:"number"},description:{type:"string"},description_html:{type:"string"},image_url:{type:"string",nullable:!0},square_image_url:{type:"string",nullable:!0},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},translations:{type:"object"},automatic:{type:"boolean"},rules_match_policy:{type:"string",enum:["all","any"]},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},rules:{type:"array",items:{$ref:"#/components/schemas/CollectionRule"}}},required:["id","name","permalink","position","sort_order","meta_title","meta_description","meta_keywords","products_count","description","description_html","image_url","square_image_url","automatic","rules_match_policy","metadata","created_at","updated_at"],"x-typelizer":!0},CommissionLine:{type:"object",properties:{id:{type:"string"},kind:{type:"string",enum:["percentage","fixed"]},currency:{type:"string"},taxability_reason:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},rate:{type:"string"},tax_rate:{type:"string"},amount:{type:"string"},tax_amount:{type:"string"},total:{type:"string"},display_amount:{type:"string"},display_tax_amount:{type:"string"},display_total:{type:"string"},order_id:{type:"string"},seller_id:{type:"string"},line_item_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},commission_rate_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},commission_rate:{$ref:"#/components/schemas/CommissionRate"}},required:["id","kind","currency","taxability_reason","country_code","state_code","created_at","updated_at","rate","tax_rate","amount","tax_amount","total","display_amount","display_tax_amount","display_total","order_id","seller_id","line_item_id","fulfillment_id","commission_rate_id","seller_name"],"x-typelizer":!0},CommissionRate:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string",nullable:!0},enabled:{type:"boolean"},position:{type:"number"},kind:{type:"string",enum:["percentage","fixed"]},tax_inclusive:{type:"boolean"},include_shipping:{type:"boolean"},metadata:{type:"object",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},value:{type:"string"},commission_tax_rate:{type:"string",nullable:!0},amounts:{type:"object"},bounds:{type:"object"},global:{type:"boolean"},rules:{type:"array",items:{$ref:"#/components/schemas/CommissionRule"}}},required:["id","name","code","enabled","position","kind","tax_inclusive","include_shipping","metadata","deleted_at","created_at","updated_at","value","commission_tax_rate","amounts","bounds","global","rules"],"x-typelizer":!0},CommissionRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: seller_rule, category_rule, product_rule, item_total_rule. Extensions may register more."},commission_rate_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"object"},product_ids:{type:"object",nullable:!0},seller_ids:{type:"object",nullable:!0},category_ids:{type:"object",nullable:!0},sellers:{type:"array",items:{$ref:"#/components/schemas/Seller"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}}},required:["id","created_at","updated_at","type","commission_rate_id","preferences","preference_schema","product_ids","seller_ids","category_ids"],"x-typelizer":!0},CompanyInvitation:{type:"object",properties:{id:{type:"string"},email:{type:"string"},expires_at:{type:"string",nullable:!0},company_id:{type:"string"},status:{type:"string",enum:["pending","accepted","revoked","expired"]},accepted_at:{type:"string",nullable:!0},revoked_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","email","expires_at","company_id","status","accepted_at","revoked_at","created_at","updated_at"],"x-typelizer":!0},CompanyMembership:{type:"object",properties:{id:{type:"string"},company_id:{type:"string"},customer_id:{type:"string"},email:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","company_id","customer_id","email","created_at","updated_at"],"x-typelizer":!0},Company:{type:"object",properties:{id:{type:"string"},name:{type:"string"},kind:{type:"string",enum:["company","division"]},po_number_required:{type:"boolean"},parent_id:{type:"string",nullable:!0},ancestors:{type:"object"},external_references:{type:"object"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},children_count:{type:"number"},members_count:{type:"number"},children:{type:"array",items:{$ref:"#/components/schemas/Company"}},addresses:{type:"array",items:{$ref:"#/components/schemas/Address"}},memberships:{type:"array",items:{$ref:"#/components/schemas/CompanyMembership"}}},required:["id","name","kind","po_number_required","parent_id","ancestors","external_references","metadata","created_at","updated_at","children_count","members_count"],"x-typelizer":!0},ConsentRecord:{type:"object",properties:{id:{type:"string"},purpose:{type:"string"},source:{type:"string",enum:["checkout","registration","account","admin","newsletter","anonymization","unknown","import","storefront"]},accepted:{type:"boolean"},email:{type:"string",nullable:!0},ip_address:{type:"string",nullable:!0},created_at:{type:"string"},recorded_at:{type:"string",nullable:!0},documents:{type:"object"}},required:["id","purpose","source","accepted","email","ip_address","created_at","recorded_at","documents"],"x-typelizer":!0},Country:{type:"object",properties:{iso:{type:"string"},iso3:{type:"string"},name:{type:"string"},states_required:{type:"boolean"},zipcode_required:{type:"boolean"},states:{type:"array",items:{$ref:"#/components/schemas/State"}},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0}},required:["iso","iso3","name","states_required","zipcode_required"],"x-typelizer":!0},CouponCode:{type:"object",properties:{id:{type:"string"},code:{type:"string"},state:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},promotion_id:{type:"string"},order_id:{type:"string",nullable:!0}},required:["id","code","state","created_at","updated_at","promotion_id","order_id"],"x-typelizer":!0},CreditCard:{type:"object",properties:{id:{type:"string"},brand:{type:"string"},last4:{type:"string"},month:{type:"number"},year:{type:"number"},name:{type:"string",nullable:!0},default:{type:"boolean"},gateway_payment_profile_id:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0},payment_method_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","brand","last4","month","year","name","default","gateway_payment_profile_id","customer_id","payment_method_id","metadata","created_at","updated_at"],"x-typelizer":!0},CustomFieldDefinition:{type:"object",properties:{id:{type:"string"},namespace:{type:"string"},key:{type:"string"},label:{type:"string"},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},resource_type:{type:"string",description:"Class name of the resource the field attaches to, for example Spree::Product, Spree::Order or Spree::Customer. Extensions may register more."},storefront_visible:{type:"boolean"},searchable:{type:"boolean"},sortable:{type:"boolean"},filter_key:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","namespace","key","label","field_type","resource_type","storefront_visible","searchable","sortable","filter_key","created_at","updated_at"],"x-typelizer":!0},CustomField:{type:"object",properties:{id:{type:"string"},label:{type:"string"},type:{type:"string",deprecated:!0},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},key:{type:"string"},value:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},storefront_visible:{type:"boolean"},custom_field_definition_id:{type:"string"}},required:["id","label","type","field_type","key","value","created_at","updated_at","storefront_visible","custom_field_definition_id"],"x-typelizer":!0},CustomerGroup:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},customers_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}}},required:["id","name","description","customers_count","created_at","updated_at"],"x-typelizer":!0},Customer:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},accepts_email_marketing:{type:"boolean"},email_marketing_consent_updated_at:{type:"string",nullable:!0},full_name:{type:"string"},available_store_credit_total:{type:"string"},display_available_store_credit_total:{type:"string"},addresses:{type:"array",items:{$ref:"#/components/schemas/Address"}},default_billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},default_shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},newsletter_subscriber:{allOf:[{$ref:"#/components/schemas/NewsletterSubscriber"}],nullable:!0},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},failed_attempts:{type:"number"},metadata:{type:"object"},email_marketing_consent_source:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},anonymized_at:{type:"string",nullable:!0},anonymized:{type:"boolean"},tags:{type:"array",items:{type:"string"}},internal_note:{type:"string",nullable:!0},internal_note_html:{type:"string",nullable:!0},default_billing_address_id:{type:"string",nullable:!0},default_shipping_address_id:{type:"string",nullable:!0},orders_count:{type:"number"},total_spent:{type:"string"},display_total_spent:{type:"string"},last_order_completed_at:{type:"string",nullable:!0},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}},store_credits:{type:"array",items:{$ref:"#/components/schemas/StoreCredit"}},customer_group_ids:{type:"array",items:{type:"string"}},companies:{type:"array",items:{$ref:"#/components/schemas/Company"}}},required:["id","email","first_name","last_name","phone","accepts_email_marketing","email_marketing_consent_updated_at","full_name","available_store_credit_total","display_available_store_credit_total","failed_attempts","metadata","email_marketing_consent_source","created_at","updated_at","anonymized_at","anonymized","tags","internal_note","internal_note_html","default_billing_address_id","default_shipping_address_id","orders_count","total_spent","display_total_spent","last_order_completed_at","customer_group_ids"],"x-typelizer":!0},DashboardCounter:{type:"object",properties:{key:{type:"string",description:"Registered counter name. The dashboard translates it; built-in: orders_to_fulfill, payments_to_collect, open_returns, open_exchanges, open_claims, low_stock_items, out_of_stock_items."},value:{type:"number"},link:{type:"object",nullable:!0,description:"The list filter that shows exactly the rows counted, or null when no list can."},nav:{type:"string",nullable:!0,description:"Sidebar entry key this count badges, or null."}},required:["key","value","link","nav"],"x-typelizer":!0},DataRequest:{type:"object",properties:{id:{type:"string"},number:{type:"string"},kind:{type:"string",enum:["access","erasure"]},status:{anyOf:[{type:"string",enum:["pending","processing","completed","failed"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},requested_at:{type:"string",nullable:!0},completed_at:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},email:{type:"string"},error_message:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0},requested_by_id:{type:"string",nullable:!0},customer:{$ref:"#/components/schemas/Customer"}},required:["id","number","kind","status","requested_at","completed_at","expires_at","email","error_message","created_at","updated_at","customer_id","requested_by_id"],"x-typelizer":!0},DeliveryMethodRule:{type:"object",properties:{id:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: item_total_rule, weight_rule, excluded_products_rule, channel_rule, volume_rule, company_rule. Extensions may register more."},preferences:{type:"object"},preference_schema:{type:"object"},product_ids:{type:"array",items:{type:"string"}}},required:["id","active","created_at","updated_at","type","preferences","preference_schema","product_ids"],"x-typelizer":!0},DeliveryMethod:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string",nullable:!0},estimated_transit_business_days_min:{type:"number",nullable:!0},estimated_transit_business_days_max:{type:"number",nullable:!0},digital:{type:"boolean"},pickup:{type:"boolean"},pickup_point:{type:"boolean"},admin_name:{type:"string",nullable:!0},fulfillment_provider:{type:"string"},pickup_point_provider:{type:"string",nullable:!0},rate_provider:{type:"string",nullable:!0},storefront_visible:{type:"boolean"},tracking_url:{type:"string",nullable:!0},markup_flat:{type:"string",nullable:!0},markup_percent:{type:"string",nullable:!0},available_to_sellers:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},deleted_at:{type:"string"},seller_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},services:{type:"array",items:{$ref:"#/components/schemas/DeliveryMethodService"}},rules:{type:"array",items:{$ref:"#/components/schemas/DeliveryMethodRule"}},tax_category_id:{type:"string",nullable:!0},delivery_profile_id:{type:"string"},delivery_origin_group_id:{type:"string",nullable:!0},delivery_zone_id:{type:"string",nullable:!0},stock_location_ids:{type:"array",items:{type:"string"}},calculator_type:{type:"string",nullable:!0},calculator_preferences:{type:"object",nullable:!0}},required:["id","name","code","estimated_transit_business_days_min","estimated_transit_business_days_max","digital","pickup","pickup_point","admin_name","fulfillment_provider","pickup_point_provider","rate_provider","storefront_visible","tracking_url","markup_flat","markup_percent","available_to_sellers","created_at","updated_at","deleted_at","seller_id","seller_name","services","rules","tax_category_id","delivery_profile_id","delivery_origin_group_id","delivery_zone_id","stock_location_ids","calculator_type","calculator_preferences"],"x-typelizer":!0},DeliveryMethodService:{type:"object",properties:{id:{type:"string"},carrier:{type:"string"},service:{type:"string"},label:{type:"string",nullable:!0},markup_flat:{type:"string",nullable:!0},markup_percent:{type:"string",nullable:!0},position:{type:"number"}},required:["id","carrier","service","label","markup_flat","markup_percent","position"],"x-typelizer":!0},DeliveryOriginGroup:{type:"object",properties:{id:{type:"string"},name:{type:"string",nullable:!0},position:{type:"number",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},delivery_profile_id:{type:"string"},stock_location_ids:{type:"array",items:{type:"string"}},delivery_zones_count:{type:"number"},delivery_methods_count:{type:"number"}},required:["id","name","position","created_at","updated_at","delivery_profile_id","stock_location_ids","delivery_zones_count","delivery_methods_count"],"x-typelizer":!0},DeliveryProfile:{type:"object",properties:{id:{type:"string"},name:{type:"string"},default:{type:"boolean"},position:{type:"number",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},kind:{type:"string",description:"Profile kind. Built-in: shipping, digital. Extensions may register more."},digital:{type:"boolean"},offers_pickup:{type:"boolean"},offers_shipping:{type:"boolean"},stock_location_ids:{type:"array",items:{type:"string"}},origin_groups:{type:"object"},products_count:{type:"number"},delivery_methods_count:{type:"number"},delivery_zones_count:{type:"number"}},required:["id","name","default","position","created_at","updated_at","kind","digital","offers_pickup","offers_shipping","stock_location_ids","origin_groups","products_count","delivery_methods_count","delivery_zones_count"],"x-typelizer":!0},DeliveryRate:{type:"object",properties:{id:{type:"string"},delivery_method_id:{type:"string"},name:{type:"string"},selected:{type:"boolean"},cost:{type:"string"},total:{type:"string"},additional_tax_total:{type:"string"},included_tax_total:{type:"string"},tax_total:{type:"string"},carrier:{type:"string",nullable:!0},service_level:{type:"string",nullable:!0},estimated_delivery_date:{type:"string",nullable:!0},unpriced:{type:"boolean"},freight_summary:{allOf:[{$ref:"#/components/schemas/FreightSummary"}],nullable:!0},display_cost:{type:"string"},display_total:{type:"string"},display_additional_tax_total:{type:"string"},display_included_tax_total:{type:"string"},display_tax_total:{type:"string"},delivery_method:{$ref:"#/components/schemas/DeliveryMethod"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","delivery_method_id","name","selected","cost","total","additional_tax_total","included_tax_total","tax_total","carrier","service_level","estimated_delivery_date","unpriced","freight_summary","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","metadata","created_at","updated_at"],"x-typelizer":!0},Delivery:{type:"object",properties:{id:{type:"string"},tracking_number:{type:"string"},carrier:{type:"string",nullable:!0},carrier_name:{type:"string",nullable:!0},service:{type:"string",nullable:!0},status:{type:"string",enum:["pending","pre_transit","in_transit","out_for_delivery","available_for_pickup","delivered","return_to_sender","failure","unknown"]},tracking_url:{type:"string",nullable:!0},estimated_delivery_at:{type:"string",nullable:!0},delivered_at:{type:"string",nullable:!0},details:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},shipping_label_id:{type:"string",nullable:!0}},required:["id","tracking_number","carrier","carrier_name","service","status","tracking_url","estimated_delivery_at","delivered_at","details","created_at","updated_at","shipping_label_id"],"x-typelizer":!0},DeliveryZoneMember:{type:"object",properties:{id:{type:"string"},member_type:{type:"string",enum:["country","state","postal_code"]},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},postal_code_prefix:{type:"string",nullable:!0},postal_code_from:{type:"string",nullable:!0},postal_code_to:{type:"string",nullable:!0},country_name:{type:"string",nullable:!0},state_name:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","member_type","country_code","state_code","postal_code_prefix","postal_code_from","postal_code_to","country_name","state_name","created_at","updated_at"],"x-typelizer":!0},DeliveryZone:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},members:{type:"array",items:{$ref:"#/components/schemas/DeliveryZoneMember"}},created_at:{type:"string"},updated_at:{type:"string"},delivery_profile_id:{type:"string"},delivery_origin_group_id:{type:"string",nullable:!0},delivery_method_ids:{type:"array",items:{type:"string"}}},required:["id","name","description","created_at","updated_at","delivery_profile_id","delivery_origin_group_id","delivery_method_ids"],"x-typelizer":!0},DigitalAsset:{type:"object",properties:{id:{type:"string"},variant_id:{type:"string",nullable:!0},filename:{type:"string",nullable:!0},content_type:{type:"string",nullable:!0},authorized_clicks:{type:"number",nullable:!0},authorized_days:{type:"number",nullable:!0},byte_size:{type:"number",nullable:!0},provider_type:{type:"string",nullable:!0},provider_settings:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},provider_name:{type:"string",description:"Digital asset provider name. Built-in: File. Extensions may register more."},download_url:{type:"string",nullable:!0},effective_authorized_clicks:{type:"number"},effective_authorized_days:{type:"number"}},required:["id","variant_id","filename","content_type","authorized_clicks","authorized_days","byte_size","provider_type","provider_settings","created_at","updated_at","provider_name","download_url","effective_authorized_clicks","effective_authorized_days"],"x-typelizer":!0},DigitalLink:{type:"object",properties:{id:{type:"string"},access_counter:{type:"number"},filename:{type:"string"},content_type:{type:"string"},download_url:{type:"string"},expires_at:{type:"string",nullable:!0},authorizable:{type:"boolean"},expired:{type:"boolean"},access_limit_exceeded:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","access_counter","filename","content_type","download_url","expires_at","authorizable","expired","access_limit_exceeded","created_at","updated_at"],"x-typelizer":!0},Discount:{type:"object",properties:{id:{type:"string"},label:{type:"string"},kind:{type:"string",enum:["promotion","manual"]},code:{type:"string",nullable:!0},value_type:{type:"string",nullable:!0},value:{type:"string",nullable:!0},promotion_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","label","kind","code","value_type","value","promotion_id","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":!0},ExchangeLineItem:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},received_quantity:{type:"number"},resellable:{type:"boolean"},original_price:{type:"string"},new_variant_price:{type:"string"},price_difference:{type:"string"},original_variant_id:{type:"string",nullable:!0},new_variant_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},fulfillment_item_id:{type:"string",nullable:!0},original_variant:{$ref:"#/components/schemas/Variant"},new_variant:{$ref:"#/components/schemas/Variant"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","quantity","received_quantity","resellable","original_price","new_variant_price","price_difference","original_variant_id","new_variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":!0},Exchange:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{anyOf:[{type:"string",enum:["requested","approved","received","fulfilled","canceled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},order_id:{type:"string",nullable:!0},reason_id:{type:"string",nullable:!0},price_difference:{type:"string"},display_price_difference:{type:"string"},approved_at:{type:"string",nullable:!0},received_at:{type:"string",nullable:!0},fulfilled_at:{type:"string",nullable:!0},canceled_at:{type:"string",nullable:!0},reason:{$ref:"#/components/schemas/ReturnReason"},exchange_line_items:{type:"array",items:{$ref:"#/components/schemas/ExchangeLineItem"}},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},stock_location_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by:{$ref:"#/components/schemas/Actor"},order:{$ref:"#/components/schemas/Order"},stock_location:{$ref:"#/components/schemas/StockLocation"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}}},required:["id","number","status","order_id","reason_id","price_difference","display_price_difference","approved_at","received_at","fulfilled_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id","created_by_type"],"x-typelizer":!0},Export:{type:"object",properties:{id:{type:"string"},number:{type:"string"},format:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",nullable:!0},user_id:{type:"string",nullable:!0},done:{type:"boolean"},store_id:{type:"string",nullable:!0},seller_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},filename:{type:"string",nullable:!0},byte_size:{type:"number",nullable:!0},download_url:{type:"string",nullable:!0}},required:["id","number","format","created_at","updated_at","type","user_id","done","store_id","seller_id","seller_name","filename","byte_size","download_url"],"x-typelizer":!0},Fee:{type:"object",properties:{id:{type:"string"},label:{type:"string"},kind:{anyOf:[{type:"string",enum:["surcharge","handling","gift_wrap","cod","payment","duty"]},{type:"string"}],description:"What sort of charge this is. `duty` is a customs duty on a cross-border order and is not taxed; the other kinds are. Extensions may register further kinds."},line_item_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","label","kind","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":!0},FreightSummaryLine:{type:"object",properties:{variant_id:{type:"string",nullable:!0},sku:{type:"string",nullable:!0},name:{type:"string",nullable:!0},units:{type:"number"},cartons:{type:"number",nullable:!0},pallets:{type:"number",nullable:!0},units_per_carton:{type:"number",nullable:!0},cartons_per_pallet:{type:"number",nullable:!0},complete:{type:"boolean"},weight_per_carton:{type:"string",nullable:!0},volume:{type:"string"},weight:{type:"string"}},required:["variant_id","sku","name","units","cartons","pallets","units_per_carton","cartons_per_pallet","complete","weight_per_carton","volume","weight"],"x-typelizer":!0},FreightSummary:{type:"object",properties:{total_units:{type:"number"},total_cartons:{type:"number"},total_pallets:{type:"number",nullable:!0},total_volume:{type:"string"},total_weight:{type:"string"},complete:{type:"boolean"},lines:{type:"array",items:{$ref:"#/components/schemas/FreightSummaryLine"}}},required:["total_units","total_cartons","total_pallets","total_volume","total_weight","complete","lines"],"x-typelizer":!0},FulfillmentItem:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},status:{anyOf:[{type:"string",enum:["on_hand","backordered","shipped","returned"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},variant_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},name:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0}},required:["id","quantity","status","variant_id","line_item_id","name","options_text"],"x-typelizer":!0},Fulfillment:{type:"object",properties:{id:{type:"string"},number:{type:"string"},tracking:{type:"string",nullable:!0},tracking_url:{type:"string",nullable:!0},pickup_point_data:{type:"object",nullable:!0},selected_delivery_rate_id:{type:"string",nullable:!0},unpriced:{type:"boolean"},cost:{type:"string"},display_cost:{type:"string"},total:{type:"string"},display_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},tax_total:{type:"string"},display_tax_total:{type:"string"},status:{anyOf:[{type:"string",enum:["unfulfilled","fulfilled","delivered","canceled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},fulfillment_type:{type:"string",enum:["shipping","digital","pickup","pickup_point"]},fulfilled_at:{type:"string",nullable:!0},delivered_at:{type:"string",nullable:!0},items:{type:"array",items:{$ref:"#/components/schemas/FulfillmentManifestItem"}},deliveries:{type:"array",items:{$ref:"#/components/schemas/Delivery"}},delivery_method:{$ref:"#/components/schemas/DeliveryMethod"},stock_location:{$ref:"#/components/schemas/StockLocation"},delivery_rates:{type:"array",items:{$ref:"#/components/schemas/DeliveryRate"}},tax_lines:{type:"array",items:{$ref:"#/components/schemas/TaxLine"}},metadata:{type:"object"},adjustment_total:{type:"string"},pre_tax_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},order_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},documents:{type:"object"},labels:{type:"array",items:{$ref:"#/components/schemas/ShippingLabel"}},provider_generates_labels:{type:"boolean"},fulfillment_items:{type:"array",items:{$ref:"#/components/schemas/FulfillmentItem"}},order:{$ref:"#/components/schemas/Order"}},required:["id","number","tracking","tracking_url","pickup_point_data","selected_delivery_rate_id","unpriced","cost","display_cost","total","display_total","discount_total","display_discount_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","tax_total","display_tax_total","status","fulfillment_type","fulfilled_at","delivered_at","items","deliveries","metadata","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id","documents","labels","provider_generates_labels"],"x-typelizer":!0},GiftCardBatch:{type:"object",properties:{id:{type:"string"},codes_count:{type:"number"},currency:{type:"string",nullable:!0},prefix:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0}},required:["id","codes_count","currency","prefix","created_at","updated_at","amount","expires_at","created_by_id"],"x-typelizer":!0},GiftCard:{type:"object",properties:{id:{type:"string"},code:{type:"string"},status:{anyOf:[{type:"string",enum:["active","partially_redeemed","redeemed","canceled","expired"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},currency:{type:"string"},amount:{type:"string"},amount_used:{type:"string"},amount_authorized:{type:"string"},amount_remaining:{type:"string"},display_amount:{type:"string"},display_amount_used:{type:"string"},display_amount_remaining:{type:"string"},expires_at:{type:"string",nullable:!0},redeemed_at:{type:"string",nullable:!0},expired:{type:"boolean"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},customer:{$ref:"#/components/schemas/Customer"},created_by:{$ref:"#/components/schemas/AdminUser"},gift_card_batch:{$ref:"#/components/schemas/GiftCardBatch"},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}}},required:["id","code","status","currency","amount","amount_used","amount_authorized","amount_remaining","display_amount","display_amount_used","display_amount_remaining","expires_at","redeemed_at","expired","active","created_at","updated_at","customer_id","created_by_id"],"x-typelizer":!0},ImportMapping:{type:"object",properties:{id:{type:"string"},schema_field:{type:"string"},file_column:{type:"string",nullable:!0},required:{type:"boolean"}},required:["id","schema_field","file_column","required"],"x-typelizer":!0},ImportRow:{type:"object",properties:{id:{type:"string"},row_number:{type:"number"},status:{anyOf:[{type:"string",enum:["pending","processing","completed","failed"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},validation_errors:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},import_id:{type:"string",nullable:!0},item_type:{type:"string",nullable:!0},item_id:{type:"string",nullable:!0},data:{type:"object"}},required:["id","row_number","status","validation_errors","created_at","updated_at","import_id","item_type","item_id","data"],"x-typelizer":!0},Import:{type:"object",properties:{id:{type:"string"},number:{type:"string"},rows_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",nullable:!0,description:"Import type. Built-in: products, product_translations, customers, price_list_prices. Extensions may register more."},status:{anyOf:[{type:"string",enum:["pending","mapping","completed_mapping","processing","completed","failed"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},store_id:{type:"string",nullable:!0},seller_id:{type:"string",nullable:!0},owner_type:{type:"string",nullable:!0},owner_id:{type:"string",nullable:!0},user_id:{type:"string",nullable:!0},processing_errors:{type:"string",nullable:!0},preferred_delimiter:{type:"string"},price_list_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},original_filename:{type:"string",nullable:!0},original_byte_size:{type:"number",nullable:!0},original_file_url:{type:"string",nullable:!0},completed_rows_count:{type:"number"},failed_rows_count:{type:"number"},schema_fields:{type:"array",items:{$ref:"#/components/schemas/ImportSchemaField"}},csv_headers:{type:"array",items:{type:"string"}},sample_row:{type:"object"},mappings:{type:"array",items:{$ref:"#/components/schemas/ImportMapping"}}},required:["id","number","rows_count","created_at","updated_at","type","status","store_id","seller_id","owner_type","owner_id","user_id","processing_errors","preferred_delimiter","price_list_id","seller_name","original_filename","original_byte_size","original_file_url","completed_rows_count","failed_rows_count","schema_fields","csv_headers","sample_row","mappings"],"x-typelizer":!0},Integration:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Integration type, registered by the provider gem that owns it (for example the EasyPost provider). Core ships none."},group:{type:"string",nullable:!0},preferences:{type:"object"},preference_schema:{type:"object"}},required:["id","name","active","created_at","updated_at","type","group","preferences","preference_schema"],"x-typelizer":!0},Invitation:{type:"object",properties:{id:{type:"string"},email:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","accepted"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},created_at:{type:"string"},updated_at:{type:"string"},expires_at:{type:"string"},role_id:{type:"string"},role_name:{type:"string"},inviter_email:{type:"string"},acceptance_url:{type:"string"},invitee_exists:{type:"boolean"},store:{type:"object"}},required:["id","email","status","created_at","updated_at","expires_at","role_id","role_name","inviter_email","acceptance_url","invitee_exists","store"],"x-typelizer":!0},LineItem:{type:"object",properties:{id:{type:"string"},variant_id:{type:"string"},seller_id:{type:"string",nullable:!0},preorder:{type:"boolean"},preorder_ships_at:{type:"string",nullable:!0},quantity:{type:"number"},currency:{type:"string"},name:{type:"string"},slug:{type:"string"},options_text:{type:"string"},price:{type:"string"},display_price:{type:"string"},total:{type:"string"},display_total:{type:"string"},adjustment_total:{type:"string"},display_adjustment_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},pre_tax_amount:{type:"string"},display_pre_tax_amount:{type:"string"},discounted_amount:{type:"string"},display_discounted_amount:{type:"string"},display_compare_at_amount:{type:"string",nullable:!0},compare_at_amount:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},digital_links:{type:"array",items:{$ref:"#/components/schemas/DigitalLink"}},tax_lines:{type:"array",items:{$ref:"#/components/schemas/TaxLine"}},metadata:{type:"object"},price_source:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},catalog_price:{type:"string",nullable:!0},cost_price:{type:"string",nullable:!0},tax_category_id:{type:"string",nullable:!0},variant:{$ref:"#/components/schemas/Variant"},tax_category:{$ref:"#/components/schemas/TaxCategory"}},required:["id","variant_id","seller_id","preorder","preorder_ships_at","quantity","currency","name","slug","options_text","price","display_price","total","display_total","adjustment_total","display_adjustment_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","discount_total","display_discount_total","pre_tax_amount","display_pre_tax_amount","discounted_amount","display_discounted_amount","display_compare_at_amount","compare_at_amount","thumbnail_url","option_values","digital_links","metadata","price_source","created_at","updated_at","catalog_price","cost_price","tax_category_id"],"x-typelizer":!0},Market:{type:"object",properties:{id:{type:"string"},name:{type:"string"},currency:{type:"string"},default_locale:{type:"string"},tax_inclusive:{type:"boolean"},default:{type:"boolean"},country_codes:{type:"array",items:{type:"string"}},supported_locales:{type:"array",items:{type:"string"}},countries:{type:"array",items:{$ref:"#/components/schemas/Country"}},tax_provider:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","currency","default_locale","tax_inclusive","default","country_codes","supported_locales","tax_provider","created_at","updated_at"],"x-typelizer":!0},Media:{type:"object",properties:{id:{type:"string"},product_id:{type:"string",nullable:!0},variant_ids:{type:"array",items:{type:"string"}},position:{type:"number"},alt:{type:"string",nullable:!0},media_type:{type:"string",enum:["image","video","external_video"]},focal_point_x:{type:"number",nullable:!0},focal_point_y:{type:"number",nullable:!0},external_video_url:{type:"string",nullable:!0},video_provider:{type:"string",nullable:!0},video_embed_url:{type:"string",nullable:!0},video_url:{type:"string",nullable:!0},poster_url:{type:"string",nullable:!0},original_url:{type:"string",nullable:!0},mini_url:{type:"string",nullable:!0},small_url:{type:"string",nullable:!0},medium_url:{type:"string",nullable:!0},large_url:{type:"string",nullable:!0},xlarge_url:{type:"string",nullable:!0},og_image_url:{type:"string",nullable:!0},external_references:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},attached:{type:"boolean"},filename:{type:"string",nullable:!0},content_type:{type:"string",nullable:!0},byte_size:{type:"number",nullable:!0},embed_url:{type:"string",nullable:!0},signed_id:{type:"string",nullable:!0},viewable_id:{type:"string",nullable:!0},download_url:{type:"string",nullable:!0},metadata:{type:"object"},viewable_type:{type:"string",nullable:!0}},required:["id","product_id","variant_ids","position","alt","media_type","focal_point_x","focal_point_y","external_video_url","video_provider","video_embed_url","video_url","poster_url","original_url","mini_url","small_url","medium_url","large_url","xlarge_url","og_image_url","external_references","created_at","updated_at","attached","filename","content_type","byte_size","embed_url","signed_id","viewable_id","download_url","metadata","viewable_type"],"x-typelizer":!0},MembershipProduct:{type:"object",properties:{id:{type:"string"},name:{type:"string"},thumbnail_url:{type:"string",nullable:!0}},required:["id","name","thumbnail_url"],"x-typelizer":!0},NewsletterSubscriber:{type:"object",properties:{id:{type:"string"},email:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},verified:{type:"boolean"},verified_at:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0}},required:["id","email","created_at","updated_at","verified","verified_at","customer_id"],"x-typelizer":!0},OptionType:{type:"object",properties:{id:{type:"string"},name:{type:"string"},label:{type:"string"},position:{type:"number"},kind:{type:"string",enum:["dropdown","color_swatch","buttons"]},translations:{type:"object"},metadata:{type:"object"},filterable:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}}},required:["id","name","label","position","kind","metadata","filterable","created_at","updated_at"],"x-typelizer":!0},OptionValue:{type:"object",properties:{id:{type:"string"},option_type_id:{type:"string"},name:{type:"string"},label:{type:"string"},position:{type:"number"},color_code:{type:"string",nullable:!0},option_type_name:{type:"string"},option_type_label:{type:"string"},image_url:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},option_type:{$ref:"#/components/schemas/OptionType"}},required:["id","option_type_id","name","label","position","color_code","option_type_name","option_type_label","image_url","metadata","created_at","updated_at"],"x-typelizer":!0},OrderCancellationReason:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},can_be_deleted:{type:"boolean"}},required:["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":!0},OrderGroup:{type:"object",properties:{id:{type:"string"},number:{type:"string"},email:{type:"string",nullable:!0},currency:{type:"string"},total:{type:"string",nullable:!0},display_total:{type:"string",nullable:!0},item_total:{type:"string",nullable:!0},display_item_total:{type:"string",nullable:!0},fulfillment_status:{type:"string",nullable:!0,enum:["backorder","canceled","partial","unfulfilled","fulfilled","delivered","pending","ready","shipped"]},payment_status:{type:"string",nullable:!0,enum:["none","authorized","partially_paid","paid","partially_refunded","refunded","overcharged","voided"]},completed_at:{type:"string",nullable:!0},billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}},customer_id:{type:"string",nullable:!0},cart_id:{type:"string",nullable:!0},seller_count:{type:"number"},includes_first_party:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},payments:{type:"array",items:{$ref:"#/components/schemas/Payment"}}},required:["id","number","email","currency","total","display_total","item_total","display_item_total","fulfillment_status","payment_status","completed_at","billing_address","shipping_address","orders","customer_id","cart_id","seller_count","includes_first_party","created_at","updated_at","payments"],"x-typelizer":!0},OrderRoutingRule:{type:"object",properties:{id:{type:"string"},position:{type:"number"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: preferred_location, default_location, minimize_splits. Extensions may register more."},channel_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"object"}},required:["id","position","active","created_at","updated_at","type","channel_id","preferences","preference_schema"],"x-typelizer":!0},Order:{type:"object",properties:{id:{type:"string"},market_id:{type:"string",nullable:!0},withdrawal_period_ends_at:{type:"string",nullable:!0},within_withdrawal_period:{type:"boolean"},cart_id:{type:"string",nullable:!0},channel_id:{type:"string",nullable:!0},company_id:{type:"string",nullable:!0},company_name:{type:"string",nullable:!0},po_document_filename:{type:"string",nullable:!0},po_document_byte_size:{type:"number",nullable:!0},number:{type:"string"},email:{type:"string"},customer_note:{type:"string",nullable:!0},po_number:{type:"string",nullable:!0},currency:{type:"string"},locale:{type:"string",nullable:!0},total_quantity:{type:"number"},coupon_code:{type:"string",nullable:!0},fulfillment_status:{type:"string",nullable:!0,enum:["backorder","canceled","partial","unfulfilled","fulfilled","delivered","pending","ready","shipped"]},payment_status:{type:"string",nullable:!0,enum:["none","authorized","partially_paid","paid","partially_refunded","refunded","overcharged","voided"]},completed_at:{type:"string",nullable:!0},item_total:{type:"string"},display_item_total:{type:"string"},adjustment_total:{type:"string"},display_adjustment_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},tax_total:{type:"string"},display_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},total:{type:"string"},display_total:{type:"string"},gift_card_total:{type:"string"},display_gift_card_total:{type:"string"},amount_due:{type:"string"},display_amount_due:{type:"string"},delivery_total:{type:"string"},display_delivery_total:{type:"string"},fee_total:{type:"string"},display_fee_total:{type:"string"},store_credit_total:{type:"string"},display_store_credit_total:{type:"string"},covered_by_store_credit:{type:"boolean"},items:{type:"array",items:{$ref:"#/components/schemas/LineItem"}},fulfillments:{type:"array",items:{$ref:"#/components/schemas/Fulfillment"}},payments:{type:"array",items:{$ref:"#/components/schemas/Payment"}},billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},gift_card:{allOf:[{$ref:"#/components/schemas/GiftCard"}],nullable:!0},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0},external_references:{type:"object"},status:{type:"string",enum:["draft","placed","canceled"]},last_ip_address:{type:"string",nullable:!0},considered_risky:{type:"boolean"},confirmation_delivered:{type:"boolean"},store_owner_notification_delivered:{type:"boolean"},payment_total:{type:"string"},display_payment_total:{type:"string"},metadata:{type:"object"},cancel_note:{type:"string",nullable:!0},commission_amount_total:{type:"string"},display_commission_amount_total:{type:"string"},commission_tax_total:{type:"string"},display_commission_tax_total:{type:"string"},commission_total:{type:"string"},display_commission_total:{type:"string"},canceled_at:{type:"string",nullable:!0},approved_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},preferred_stock_location_id:{type:"string",nullable:!0},po_document_url:{type:"string",nullable:!0},seller_id:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"},order_group_id:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},internal_note:{type:"string",nullable:!0},internal_note_html:{type:"string",nullable:!0},approver_id:{type:"string",nullable:!0},approver_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},approver:{$ref:"#/components/schemas/Actor"},canceler_id:{type:"string",nullable:!0},canceler_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},canceler:{$ref:"#/components/schemas/Actor"},created_by_id:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by:{$ref:"#/components/schemas/Actor"},cancel_reason_id:{type:"string",nullable:!0},cancel_reason_name:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0},applied_promotions:{type:"array",items:{$ref:"#/components/schemas/AppliedPromotion"}},payment_splits:{type:"array",items:{$ref:"#/components/schemas/PaymentSplit"}},cart:{$ref:"#/components/schemas/Cart"},channel:{$ref:"#/components/schemas/Channel"},preferred_stock_location:{$ref:"#/components/schemas/StockLocation"},payment_methods:{type:"array",items:{$ref:"#/components/schemas/PaymentMethod"}},customer:{$ref:"#/components/schemas/Customer"},cancel_reason:{$ref:"#/components/schemas/OrderCancellationReason"},returns:{type:"array",items:{$ref:"#/components/schemas/Return"}},exchanges:{type:"array",items:{$ref:"#/components/schemas/Exchange"}},claims:{type:"array",items:{$ref:"#/components/schemas/Claim"}},freight_summary:{allOf:[{$ref:"#/components/schemas/FreightSummary"}],nullable:!0}},required:["id","market_id","withdrawal_period_ends_at","within_withdrawal_period","cart_id","channel_id","company_id","company_name","po_document_filename","po_document_byte_size","number","email","customer_note","po_number","currency","locale","total_quantity","coupon_code","fulfillment_status","payment_status","completed_at","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fee_total","display_fee_total","store_credit_total","display_store_credit_total","covered_by_store_credit","gift_card","market","external_references","status","last_ip_address","considered_risky","confirmation_delivered","store_owner_notification_delivered","payment_total","display_payment_total","metadata","cancel_note","commission_amount_total","display_commission_amount_total","commission_tax_total","display_commission_tax_total","commission_total","display_commission_total","canceled_at","approved_at","created_at","updated_at","preferred_stock_location_id","po_document_url","seller_id","order_group_id","tags","internal_note","internal_note_html","approver_id","approver_type","canceler_id","canceler_type","created_by_id","created_by_type","cancel_reason_id","cancel_reason_name","customer_id","freight_summary"],"x-typelizer":!0},PackageType:{type:"object",properties:{id:{type:"string"},name:{type:"string"},kind:{type:"string",enum:["box","envelope","carton","pallet","container"]},length:{type:"string",nullable:!0},width:{type:"string",nullable:!0},height:{type:"string",nullable:!0},weight:{type:"string",nullable:!0},max_weight:{type:"string",nullable:!0},default:{type:"boolean"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},dimensions_unit:{type:"string",enum:["mm","cm","in","ft"]},weight_unit:{type:"string",enum:["g","kg","lb","oz"]},volume:{type:"string",nullable:!0},seller_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0}},required:["id","name","kind","length","width","height","weight","max_weight","default","metadata","created_at","updated_at","dimensions_unit","weight_unit","volume","seller_id","seller_name"],"x-typelizer":!0},PaymentMethod:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},type:{type:"string",description:"Payment method type. Built-in: check, store_credit, custom_payment_source_method, bogus (test only); payment provider gems register their own, for example stripe."},session_required:{type:"boolean"},source_required:{type:"boolean"},metadata:{type:"object"},active:{type:"boolean"},auto_capture:{type:"boolean",nullable:!0},capture_method:{type:"string",enum:["checkout","on_dispatch","manual"],nullable:!0},resolved_capture_method:{type:"string",enum:["checkout","on_dispatch","manual"]},storefront_visible:{type:"boolean"},position:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},preferences:{type:"object"},preference_schema:{type:"object"}},required:["id","name","description","type","session_required","source_required","metadata","active","auto_capture","capture_method","resolved_capture_method","storefront_visible","position","created_at","updated_at","preferences","preference_schema"],"x-typelizer":!0},Payment:{type:"object",properties:{id:{type:"string"},payment_method_id:{type:"string"},response_code:{type:"string",nullable:!0},number:{type:"string"},status:{anyOf:[{type:"string",enum:["checkout","processing","pending","completed","failed","void","invalid"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},amount:{type:"string"},display_amount:{type:"string"},source_type:{type:"string",nullable:!0,enum:["credit_card","store_credit","payment_source"]},source_id:{type:"string",nullable:!0},source:{anyOf:[{$ref:"#/components/schemas/CreditCard"},{$ref:"#/components/schemas/StoreCredit"},{$ref:"#/components/schemas/PaymentSource"}],nullable:!0},payment_method:{$ref:"#/components/schemas/PaymentMethod"},metadata:{type:"object"},avs_response:{type:"string",nullable:!0},cvv_response_code:{type:"string",nullable:!0},cvv_response_message:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},captured_amount:{type:"string"},order_id:{type:"string",nullable:!0},order:{$ref:"#/components/schemas/Order"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}},payment_splits:{type:"array",items:{$ref:"#/components/schemas/PaymentSplit"}}},required:["id","payment_method_id","response_code","number","status","amount","display_amount","source_type","source_id","source","metadata","avs_response","cvv_response_code","cvv_response_message","created_at","updated_at","captured_amount","order_id"],"x-typelizer":!0},PaymentSource:{type:"object",properties:{id:{type:"string"},gateway_payment_profile_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","gateway_payment_profile_id","metadata","created_at","updated_at"],"x-typelizer":!0},PaymentSplit:{type:"object",properties:{id:{type:"string"},currency:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},authorized_amount:{type:"string"},display_authorized_amount:{type:"string"},captured_amount:{type:"string"},display_captured_amount:{type:"string"},refunded_amount:{type:"string"},display_refunded_amount:{type:"string"},claimed_amount:{type:"string"},display_claimed_amount:{type:"string"},net_captured_amount:{type:"string"},display_net_captured_amount:{type:"string"},refundable_amount:{type:"string"},display_refundable_amount:{type:"string"},payment_id:{type:"string"},payment_number:{type:"string",nullable:!0},order_id:{type:"string"},order_number:{type:"string",nullable:!0}},required:["id","currency","created_at","updated_at","authorized_amount","display_authorized_amount","captured_amount","display_captured_amount","refunded_amount","display_refunded_amount","claimed_amount","display_claimed_amount","net_captured_amount","display_net_captured_amount","refundable_amount","display_refundable_amount","payment_id","payment_number","order_id","order_number"],"x-typelizer":!0},Permission:{type:"object",properties:{key:{type:"string"},resource:{type:"string"},kind:{type:"string",enum:["read","write"]},group:{type:"string"},group_label:{type:"string"},label:{type:"string"},description:{type:"string"}},required:["key","resource","kind","group","group_label","label","description"],"x-typelizer":!0},Policy:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},body:{type:"string",nullable:!0},body_html:{type:"string",nullable:!0},updated_at:{type:"string"},created_at:{type:"string"}},required:["id","name","slug","body","body_html","updated_at","created_at"],"x-typelizer":!0},PriceAdjustmentTier:{type:"object",properties:{id:{type:"string"},min_quantity:{type:"number"},percentage:{type:"string"}},required:["id","min_quantity","percentage"],"x-typelizer":!0},PriceHistory:{type:"object",properties:{id:{type:"string"},amount:{type:"string"},amount_in_cents:{type:"number"},currency:{type:"string"},display_amount:{type:"string"},recorded_at:{type:"string"},variant_id:{type:"string"},price_id:{type:"string"},compare_at_amount:{type:"string",nullable:!0},created_at:{type:"string"}},required:["id","amount","amount_in_cents","currency","display_amount","recorded_at","variant_id","price_id","compare_at_amount","created_at"],"x-typelizer":!0},PriceListProduct:{type:"object",properties:{id:{type:"string"},name:{type:"string"},thumbnail_url:{type:"string",nullable:!0},price_list_variants:{type:"array",items:{$ref:"#/components/schemas/CatalogPrice"}}},required:["id","name","thumbnail_url"],"x-typelizer":!0},PriceList:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},status:{anyOf:[{type:"string",enum:["draft","active","inactive","scheduled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},position:{type:"number"},match_policy:{type:"string",enum:["all","any"]},adjust_compare_at:{type:"boolean"},starts_at:{type:"string",nullable:!0},ends_at:{type:"string",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},price_adjustment_percentage:{type:"string",nullable:!0},automatic_pricing:{type:"boolean"},currently_active:{type:"boolean"},products_count:{type:"number"},prices_count:{type:"number"},price_adjustment_tiers:{type:"array",items:{$ref:"#/components/schemas/PriceAdjustmentTier"}},price_rules:{type:"array",items:{$ref:"#/components/schemas/PriceRule"}}},required:["id","name","description","status","position","match_policy","adjust_compare_at","starts_at","ends_at","deleted_at","created_at","updated_at","price_adjustment_percentage","automatic_pricing","currently_active","products_count","prices_count","price_adjustment_tiers"],"x-typelizer":!0},PriceRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: channel_rule, customer_group_rule, market_rule, user_rule, volume_rule, zone_rule. Extensions may register more."},price_list_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},markets:{type:"array",items:{$ref:"#/components/schemas/Market"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},channels:{type:"array",items:{$ref:"#/components/schemas/Channel"}},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}}},required:["id","created_at","updated_at","type","price_list_id","preferences","preference_schema"],"x-typelizer":!0},Price:{type:"object",properties:{id:{type:"string"},amount:{type:"string",nullable:!0},amount_in_cents:{type:"number",nullable:!0},compare_at_amount:{type:"string",nullable:!0},compare_at_amount_in_cents:{type:"number",nullable:!0},currency:{type:"string",nullable:!0},display_amount:{type:"string",nullable:!0},display_compare_at_amount:{type:"string",nullable:!0},price_list_id:{type:"string",nullable:!0},min_quantity:{type:"number"},variant_id:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},variant:{$ref:"#/components/schemas/Variant"}},required:["id","amount","amount_in_cents","compare_at_amount","compare_at_amount_in_cents","currency","display_amount","display_compare_at_amount","price_list_id","min_quantity","variant_id","created_at","updated_at"],"x-typelizer":!0},ProductPublication:{type:"object",properties:{id:{type:"string"},published_at:{type:"string",nullable:!0},unpublished_at:{type:"string",nullable:!0},product_id:{type:"string"},channel_id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","published_at","unpublished_at","product_id","channel_id","created_at","updated_at"],"x-typelizer":!0},Product:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},variant_count:{type:"number"},available_on:{type:"string",nullable:!0},preorder_ships_at:{type:"string",nullable:!0},purchasable:{type:"boolean"},preorder:{type:"boolean"},in_stock:{type:"boolean"},backorderable:{type:"boolean"},available:{type:"boolean"},description:{type:"string",nullable:!0},description_html:{type:"string",nullable:!0},default_variant_id:{type:"string"},buy_box_variant_id:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},original_price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},seller_id:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"},primary_media:{$ref:"#/components/schemas/Media"},media:{type:"array",items:{$ref:"#/components/schemas/Media"}},variants:{type:"array",items:{$ref:"#/components/schemas/Variant"}},default_variant:{$ref:"#/components/schemas/Variant"},option_types:{type:"array",items:{$ref:"#/components/schemas/OptionType"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},prior_price:{allOf:[{$ref:"#/components/schemas/PriceHistory"}],nullable:!0},external_references:{type:"object"},translations:{type:"object"},status:{anyOf:[{type:"string",enum:["draft","active","archived","proposed","rejected"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},metadata:{type:"object"},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},delivery_profile_id:{type:"string",nullable:!0},submission:{allOf:[{$ref:"#/components/schemas/ProductSubmission"}],nullable:!0},seller_name:{type:"string",nullable:!0},product_type_id:{type:"string",nullable:!0},tax_category_id:{type:"string",nullable:!0},digital_assets:{type:"array",items:{$ref:"#/components/schemas/DigitalAsset"}},collections:{type:"array",items:{$ref:"#/components/schemas/Collection"}},product_publications:{type:"array",items:{$ref:"#/components/schemas/ProductPublication"}},channels:{type:"array",items:{$ref:"#/components/schemas/Channel"}},product_type:{$ref:"#/components/schemas/ProductType"}},required:["id","name","slug","meta_title","meta_description","meta_keywords","variant_count","available_on","preorder_ships_at","purchasable","preorder","in_stock","backorderable","available","description","description_html","default_variant_id","buy_box_variant_id","thumbnail_url","tags","price","original_price","seller_id","external_references","status","metadata","deleted_at","created_at","updated_at","delivery_profile_id","seller_name","product_type_id","tax_category_id"],"x-typelizer":!0},ProductSubmission:{type:"object",properties:{id:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","approved","rejected","withdrawn"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},review_note:{type:"string",nullable:!0},reviewed_at:{type:"string",nullable:!0},created_at:{type:"string"},product_id:{type:"string"},metadata:{type:"object",nullable:!0},updated_at:{type:"string"},submitted_by_id:{type:"string",nullable:!0},reviewed_by_id:{type:"string",nullable:!0},reviewed_by_name:{type:"string",nullable:!0},auto_approved:{type:"boolean"}},required:["id","status","review_note","reviewed_at","created_at","product_id","metadata","updated_at","submitted_by_id","reviewed_by_id","reviewed_by_name","auto_approved"],"x-typelizer":!0},ProductTypeCustomFieldDefinition:{type:"object",properties:{id:{type:"string"},key:{type:"string"},namespace:{type:"string"},label:{type:"string"},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},required:{type:"boolean"},sort_order:{type:"number"}},required:["id","key","namespace","label","field_type","required","sort_order"],"x-typelizer":!0},ProductType:{type:"object",properties:{id:{type:"string"},name:{type:"string"},translations:{type:"object"},products_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},delivery_profile_id:{type:"string",nullable:!0},option_type_ids:{type:"array",items:{type:"string"}},category_ids:{type:"array",items:{type:"string"}},custom_field_definitions:{type:"array",items:{$ref:"#/components/schemas/ProductTypeCustomFieldDefinition"}}},required:["id","name","products_count","created_at","updated_at","delivery_profile_id","option_type_ids","category_ids","custom_field_definitions"],"x-typelizer":!0},PromotionAction:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Action type. Built-in: create_adjustment, create_item_adjustments, create_line_items, free_shipping. Extensions may register more."},promotion_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},calculator:{allOf:[{$ref:"#/components/schemas/PromotionActionCalculator"}],nullable:!0},line_items:{type:"array",items:{$ref:"#/components/schemas/PromotionActionLineItem"},nullable:!0}},required:["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","calculator","line_items"],"x-typelizer":!0},PromotionRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: currency, country, channel, market, item_total, product, customer, customer_group, first_order, customer_logged_in, one_use_per_user, category, option_value. Extensions may register more."},promotion_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},product_ids:{type:"array",items:{type:"string"},nullable:!0},category_ids:{type:"array",items:{type:"string"},nullable:!0},customer_ids:{type:"array",items:{type:"string"},nullable:!0},option_value_ids:{type:"array",items:{type:"string"},nullable:!0},products:{type:"array",items:{$ref:"#/components/schemas/Product"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},countries:{type:"array",items:{$ref:"#/components/schemas/Country"}},channels:{type:"array",items:{$ref:"#/components/schemas/Channel"}},markets:{type:"array",items:{$ref:"#/components/schemas/Market"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}}},required:["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","product_ids","category_ids","customer_ids","option_value_ids"],"x-typelizer":!0},Promotion:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},code:{type:"string",nullable:!0},starts_at:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},usage_limit:{type:"number",nullable:!0},match_policy:{type:"string",enum:["all","any"]},path:{type:"string",nullable:!0},kind:{type:"string",enum:["coupon_code","automatic"]},multi_codes:{type:"boolean"},number_of_codes:{type:"number",nullable:!0},code_prefix:{type:"string",nullable:!0},promotion_category_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},action_ids:{type:"array",items:{type:"string"}},rule_ids:{type:"array",items:{type:"string"}}},required:["id","name","description","code","starts_at","expires_at","usage_limit","match_policy","path","kind","multi_codes","number_of_codes","code_prefix","promotion_category_id","metadata","created_at","updated_at","action_ids","rule_ids"],"x-typelizer":!0},PurchaseOrderItem:{type:"object",properties:{id:{type:"string"},quantity_ordered:{type:"number"},quantity_received:{type:"number"},quantity_rejected:{type:"number"},quantity_over:{type:"number"},outstanding:{type:"number"},currency:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},unit_cost:{type:"string"},total_cost:{type:"string"},display_unit_cost:{type:"string"},display_total_cost:{type:"string"},purchase_order_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},product_id:{type:"string",nullable:!0},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0}},required:["id","quantity_ordered","quantity_received","quantity_rejected","quantity_over","outstanding","currency","created_at","updated_at","unit_cost","total_cost","display_unit_cost","display_total_cost","purchase_order_id","variant_id","product_id","variant_name","variant_sku","options_text","thumbnail_url"],"x-typelizer":!0},PurchaseOrder:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{type:"string"},currency:{type:"string"},reference:{type:"string",nullable:!0},notes:{type:"string",nullable:!0},metadata:{type:"object"},close_reason:{type:"string",nullable:!0},items_count:{type:"number"},quantity_received_total:{type:"number"},quantity_rejected_total:{type:"number"},ordered_at:{type:"string",nullable:!0},received_at:{type:"string",nullable:!0},closed_short_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},expected_at:{type:"string",nullable:!0},cancel_by:{type:"string",nullable:!0},closed_short:{type:"boolean"},quantity_ordered_total:{type:"number"},editable:{type:"boolean"},subtotal:{type:"string"},display_subtotal:{type:"string"},supplier_id:{type:"string",nullable:!0},destination_location_id:{type:"string",nullable:!0},items:{type:"array",items:{$ref:"#/components/schemas/PurchaseOrderItem"}},stock_receipts:{type:"array",items:{$ref:"#/components/schemas/StockReceipt"}},supplier:{$ref:"#/components/schemas/Supplier"},destination_location:{$ref:"#/components/schemas/StockLocation"}},required:["id","number","status","currency","reference","notes","metadata","close_reason","items_count","quantity_received_total","quantity_rejected_total","ordered_at","received_at","closed_short_at","created_at","updated_at","expected_at","cancel_by","closed_short","quantity_ordered_total","editable","subtotal","display_subtotal","supplier_id","destination_location_id"],"x-typelizer":!0},RefundReason:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},can_be_deleted:{type:"boolean"}},required:["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":!0},Refund:{type:"object",properties:{id:{type:"string"},transaction_id:{type:"string",nullable:!0},amount:{type:"string",nullable:!0},payment_id:{type:"string",nullable:!0},refund_reason_id:{type:"string",nullable:!0},originator_id:{type:"string",nullable:!0},originator_type:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},refunder_id:{type:"string",nullable:!0},refunder_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},refunder:{$ref:"#/components/schemas/Actor"},payment:{$ref:"#/components/schemas/Payment"}},required:["id","transaction_id","amount","payment_id","refund_reason_id","originator_id","originator_type","metadata","created_at","updated_at","refunder_id","refunder_type"],"x-typelizer":!0},ReturnLineItem:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},received_quantity:{type:"number"},resellable:{type:"boolean"},pre_tax_amount:{type:"string"},display_pre_tax_amount:{type:"string"},variant_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},fulfillment_item_id:{type:"string",nullable:!0},variant:{$ref:"#/components/schemas/Variant"},created_at:{type:"string"},updated_at:{type:"string"},line_item:{$ref:"#/components/schemas/LineItem"}},required:["id","quantity","received_quantity","resellable","pre_tax_amount","display_pre_tax_amount","variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":!0},ReturnReason:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},can_be_deleted:{type:"boolean"}},required:["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":!0},Return:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{anyOf:[{type:"string",enum:["requested","approved","received","refunded","canceled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},order_id:{type:"string",nullable:!0},reason_id:{type:"string",nullable:!0},refund_total:{type:"string"},display_refund_total:{type:"string"},approved_at:{type:"string",nullable:!0},received_at:{type:"string",nullable:!0},refunded_at:{type:"string",nullable:!0},canceled_at:{type:"string",nullable:!0},reason:{$ref:"#/components/schemas/ReturnReason"},return_line_items:{type:"array",items:{$ref:"#/components/schemas/ReturnLineItem"}},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},stock_location_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by:{$ref:"#/components/schemas/Actor"},refunded_total:{type:"string"},refundable_total:{type:"string"},order:{$ref:"#/components/schemas/Order"},stock_location:{$ref:"#/components/schemas/StockLocation"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}},documents:{type:"object"},labels:{type:"array",items:{$ref:"#/components/schemas/ShippingLabel"}},deliveries:{type:"array",items:{$ref:"#/components/schemas/Delivery"}}},required:["id","number","status","order_id","reason_id","refund_total","display_refund_total","approved_at","received_at","refunded_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id","created_by_type","refunded_total","refundable_total","documents","labels","deliveries"],"x-typelizer":!0},Role:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},permissions:{type:"array",items:{type:"string"}},mutable:{type:"boolean"},users_count:{type:"number"}},required:["id","name","description","created_at","updated_at","permissions","mutable","users_count"],"x-typelizer":!0},SavedReport:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},query:{type:"object"},seeded:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},user_id:{type:"string",nullable:!0},author_name:{type:"string",nullable:!0}},required:["id","name","description","query","seeded","created_at","updated_at","user_id","author_name"],"x-typelizer":!0},SellerBalance:{type:"object",properties:{currency:{type:"string"},settlement_currency:{type:"string"},converted:{type:"boolean"},seller_id:{type:"string"},earned:{type:"string"},display_earned:{type:"string"},payable:{type:"string"},display_payable:{type:"string"},paid:{type:"string"},display_paid:{type:"string"},balance:{type:"string"},display_balance:{type:"string"},pending:{type:"string"},display_pending:{type:"string"}},required:["currency","settlement_currency","converted","seller_id","earned","display_earned","payable","display_payable","paid","display_paid","balance","display_balance","pending","display_pending"],"x-typelizer":!0},SellerPayout:{type:"object",properties:{id:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","processing","completed","failed","unresolved"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},currency:{type:"string"},provider:{type:"string",description:"Payout provider class name. Built-in: Spree::PayoutProvider::System. Provider gems register more."},reference:{type:"string",nullable:!0},metadata:{type:"object"},period_start:{type:"string",nullable:!0},period_end:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string"},display_amount:{type:"string"},seller_id:{type:"string"},seller_name:{type:"string",nullable:!0},transfers_count:{type:"number"}},required:["id","status","currency","provider","reference","metadata","period_start","period_end","created_at","updated_at","amount","display_amount","seller_id","seller_name","transfers_count"],"x-typelizer":!0},SellerRequirement:{type:"object",properties:{id:{type:"string"},position:{type:"number"},active:{type:"boolean"},required:{type:"boolean"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},kind:{type:"string",description:"Requirement kind. Built-in: accept_terms, complete_profile, billing_address, returns_address, delivery_method, package_type, minimum_products, payout_account, required_custom_fields, policy, attestation, operator_review, document. Extensions may register more."},name:{type:"string"},description:{type:"string",nullable:!0},preferences:{type:"object"},custom_field_definition_ids:{type:"array",items:{type:"string"}},allow_multiple:{type:"boolean"},accepts_submissions:{type:"boolean"},reviewed_by_operator:{type:"boolean"}},required:["id","position","active","required","metadata","created_at","updated_at","kind","name","description","preferences","custom_field_definition_ids","allow_multiple","accepts_submissions","reviewed_by_operator"],"x-typelizer":!0},SellerRequirementStatus:{type:"object",properties:{id:{type:"string"},kind:{type:"string",description:"Requirement kind. Built-in: accept_terms, complete_profile, billing_address, returns_address, delivery_method, package_type, minimum_products, payout_account, required_custom_fields, policy, attestation, operator_review, document. Extensions may register more."},name:{type:"string"},description:{type:"string",nullable:!0},required:{type:"boolean"},position:{type:"number"},status:{type:"string",enum:["complete","incomplete","pending","rejected"]},action_url:{type:"string",nullable:!0},blocker:{type:"object",nullable:!0},blocking:{type:"boolean"},required_policy_name:{type:"string",nullable:!0},submission:{$ref:"#/components/schemas/SellerRequirementSubmission"},published_policy:{$ref:"#/components/schemas/Policy"}},required:["id","kind","name","description","required","position","status","action_url","blocker","blocking","required_policy_name"],"x-typelizer":!0},SellerRequirementSubmission:{type:"object",properties:{id:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","accepted","rejected","waived"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},note:{type:"string",nullable:!0},review_note:{type:"string",nullable:!0},reference:{type:"string",nullable:!0},metadata:{type:"object",nullable:!0},reviewed_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},seller_id:{type:"string"},requirement_id:{type:"string"},requirement_name:{type:"string"},file_url:{type:"string",nullable:!0},file_name:{type:"string",nullable:!0}},required:["id","status","note","review_note","reference","metadata","reviewed_at","created_at","updated_at","seller_id","requirement_id","requirement_name","file_url","file_name"],"x-typelizer":!0},Seller:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},about:{type:"string"},about_html:{type:"string"},logo_url:{type:"string",nullable:!0},square_logo_url:{type:"string",nullable:!0},cover_photo_url:{type:"string",nullable:!0},status:{anyOf:[{type:"string",enum:["pending","invited","canceled","onboarding","ready_for_review","approved","rejected","suspended"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},contact_email:{type:"string",nullable:!0},billing_email:{type:"string",nullable:!0},tax_remittance:{type:"string"},payouts_schedule_interval:{type:"string",nullable:!0},metadata:{type:"object",nullable:!0},holiday_mode_until:{type:"string",nullable:!0},terms_accepted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},deleted_at:{type:"string",nullable:!0},minimum_payout_amount:{type:"string",nullable:!0},on_holiday:{type:"boolean"},sellable:{type:"boolean"},products_count:{type:"number"},users_count:{type:"number"},onboarding_progress:{type:"object"},onboarding_complete:{type:"boolean"},legal_name:{type:"string",nullable:!0},registration_number:{type:"string",nullable:!0},billing_address:{$ref:"#/components/schemas/Address"},returns_address:{$ref:"#/components/schemas/Address"}},required:["id","name","slug","about","about_html","logo_url","square_logo_url","cover_photo_url","status","contact_email","billing_email","tax_remittance","payouts_schedule_interval","metadata","holiday_mode_until","terms_accepted_at","created_at","updated_at","deleted_at","minimum_payout_amount","on_holiday","sellable","products_count","users_count","onboarding_progress","onboarding_complete","legal_name","registration_number"],"x-typelizer":!0},SellerTeamMember:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},avatar_url:{type:"string",nullable:!0}},required:["id","email","first_name","last_name","full_name","created_at","updated_at","avatar_url"],"x-typelizer":!0},SellerTransfer:{type:"object",properties:{id:{type:"string"},kind:{type:"string",enum:["earning","refund_reversal"]},status:{anyOf:[{type:"string",enum:["pending","processing","completed","failed","unresolved"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},currency:{type:"string"},provider:{type:"string",description:"Payout provider class name. Built-in: Spree::PayoutProvider::System. Provider gems register more."},reference:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string"},display_amount:{type:"string"},settled_amount:{type:"string",nullable:!0},settled_currency:{type:"string",nullable:!0},converted:{type:"boolean"},seller_id:{type:"string"},order_id:{type:"string",nullable:!0},payout_id:{type:"string",nullable:!0},reversed_from_id:{type:"string",nullable:!0},refund_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},order_number:{type:"string",nullable:!0}},required:["id","kind","status","currency","provider","reference","metadata","created_at","updated_at","amount","display_amount","settled_amount","settled_currency","converted","seller_id","order_id","payout_id","reversed_from_id","refund_id","seller_name","order_number"],"x-typelizer":!0},SetupTask:{type:"object",properties:{name:{type:"string"},done:{type:"boolean"}},required:["name","done"],"x-typelizer":!0},ShippingLabel:{type:"object",properties:{id:{type:"string"},source:{type:"string",enum:["purchased","uploaded"]},status:{anyOf:[{type:"string",enum:["purchased","refund_requested","refunded"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},carrier:{type:"string",nullable:!0},carrier_name:{type:"string",nullable:!0},service:{type:"string",nullable:!0},tracking_number:{type:"string",nullable:!0},currency:{type:"string",nullable:!0},format:{type:"string",nullable:!0},external_id:{type:"string",nullable:!0},metadata:{type:"object"},refunded_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},owner_id:{type:"string"},owner_type:{type:"string",enum:["Spree::Fulfillment","Spree::Return"]},cost:{type:"string"},display_cost:{type:"string"},integration_id:{type:"string",nullable:!0},file_pending:{type:"boolean"},download_url:{type:"string",nullable:!0}},required:["id","source","status","carrier","carrier_name","service","tracking_number","currency","format","external_id","metadata","refunded_at","created_at","updated_at","owner_id","owner_type","cost","display_cost","integration_id","file_pending","download_url"],"x-typelizer":!0},State:{type:"object",properties:{abbr:{type:"string"},name:{type:"string"}},required:["abbr","name"],"x-typelizer":!0},StockLevel:{type:"object",properties:{id:{type:"string"},count_on_hand:{type:"number"},backorderable:{type:"boolean"},stock_location_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},external_references:{type:"object"},metadata:{type:"object"},reserved_count:{type:"number"},incoming_count:{type:"number"},purchasable_count:{type:"number"},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},stock_location_name:{type:"string",nullable:!0},product_id:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},allocated_count:{type:"number"},available_count:{type:"number"},stock_location:{$ref:"#/components/schemas/StockLocation"},variant:{$ref:"#/components/schemas/Variant"}},required:["id","count_on_hand","backorderable","stock_location_id","variant_id","external_references","metadata","reserved_count","incoming_count","purchasable_count","variant_name","variant_sku","created_at","updated_at","stock_location_name","product_id","options_text","thumbnail_url","allocated_count","available_count"],"x-typelizer":!0},StockLocation:{type:"object",properties:{id:{type:"string"},name:{type:"string"},address1:{type:"string",nullable:!0},city:{type:"string",nullable:!0},zipcode:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},country_name:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},state_text:{type:"string",nullable:!0},pickup_ready_in_minutes:{type:"number",nullable:!0},pickup_instructions:{type:"string",nullable:!0},external_references:{type:"object"},admin_name:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},state_name:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},company:{type:"string",nullable:!0},active:{type:"boolean"},default:{type:"boolean"},backorderable_default:{type:"boolean"},propagate_all_variants:{type:"boolean"},kind:{anyOf:[{type:"string",enum:["warehouse","store","fulfillment_center"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},pickup_enabled:{type:"boolean"},pickup_stock_policy:{type:"string",enum:["local","any"]},returns_enabled:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},seller_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"}},required:["id","name","address1","city","zipcode","country_code","country_name","state_code","state_text","pickup_ready_in_minutes","pickup_instructions","external_references","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","returns_enabled","created_at","updated_at","seller_id","seller_name"],"x-typelizer":!0},StockMovement:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},kind:{type:"string",nullable:!0,enum:["received","allocated","shipped","released","adjusted"]},reason:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},stock_level_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},stock_location_name:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},order_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},return_id:{type:"string",nullable:!0},exchange_id:{type:"string",nullable:!0},stock_transfer_id:{type:"string",nullable:!0},stock_receipt_id:{type:"string",nullable:!0},purchase_order_id:{type:"string",nullable:!0},order_number:{type:"string",nullable:!0},return_number:{type:"string",nullable:!0},exchange_number:{type:"string",nullable:!0},stock_transfer_number:{type:"string",nullable:!0},purchase_order_number:{type:"string",nullable:!0},unit_cost:{type:"string",nullable:!0},display_unit_cost:{type:"string",nullable:!0}},required:["id","quantity","kind","reason","created_at","updated_at","stock_level_id","stock_location_id","stock_location_name","variant_id","variant_name","variant_sku","order_id","fulfillment_id","return_id","exchange_id","stock_transfer_id","stock_receipt_id","purchase_order_id","order_number","return_number","exchange_number","stock_transfer_number","purchase_order_number","unit_cost","display_unit_cost"],"x-typelizer":!0},StockReceiptItem:{type:"object",properties:{id:{type:"string"},quantity_accepted:{type:"number"},quantity_rejected:{type:"number"},rejection_reason:{type:"string",nullable:!0,enum:["damaged","wrong_item","expired","other"]},notes:{type:"string",nullable:!0},line_type:{type:"string",enum:["purchase_order_item","stock_transfer_item"]},line_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},product_id:{type:"string",nullable:!0},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0}},required:["id","quantity_accepted","quantity_rejected","rejection_reason","notes","line_type","line_id","variant_id","product_id","variant_name","variant_sku","thumbnail_url"],"x-typelizer":!0},StockReceipt:{type:"object",properties:{id:{type:"string"},number:{type:"string"},reference:{type:"string",nullable:!0},notes:{type:"string",nullable:!0},metadata:{type:"object"},quantity_accepted_total:{type:"number"},quantity_rejected_total:{type:"number"},received_at:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},receivable_type:{type:"string",enum:["purchase_order","stock_transfer"]},receivable_id:{type:"string"},received_by_id:{type:"string",nullable:!0},received_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},received_by:{$ref:"#/components/schemas/Actor"},items_count:{type:"number"},items:{type:"array",items:{$ref:"#/components/schemas/StockReceiptItem"}}},required:["id","number","reference","notes","metadata","quantity_accepted_total","quantity_rejected_total","received_at","created_at","updated_at","receivable_type","receivable_id","received_by_id","received_by_type","items_count"],"x-typelizer":!0},StockReservation:{type:"object",properties:{id:{type:"string"},stock_level_id:{type:"string"},line_item_id:{type:"string"},order_id:{type:"string"},variant_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},quantity:{type:"number"},expires_at:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","stock_level_id","line_item_id","order_id","variant_id","stock_location_id","quantity","expires_at","active","created_at","updated_at"],"x-typelizer":!0},StockTransferItem:{type:"object",properties:{id:{type:"string"},quantity_shipped:{type:"number"},quantity_received:{type:"number"},quantity_rejected:{type:"number"},quantity_over:{type:"number"},outstanding:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},stock_transfer_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},product_id:{type:"string",nullable:!0},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0}},required:["id","quantity_shipped","quantity_received","quantity_rejected","quantity_over","outstanding","created_at","updated_at","stock_transfer_id","variant_id","product_id","variant_name","variant_sku","options_text","thumbnail_url"],"x-typelizer":!0},StockTransfer:{type:"object",properties:{id:{type:"string"},number:{type:"string"},reference:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},source_location_id:{type:"string"},destination_location_id:{type:"string"},status:{type:"string"},notes:{type:"string",nullable:!0},metadata:{type:"object"},close_reason:{type:"string",nullable:!0},items_count:{type:"number"},quantity_received_total:{type:"number"},quantity_rejected_total:{type:"number"},shipped_at:{type:"string",nullable:!0},received_at:{type:"string",nullable:!0},closed_short_at:{type:"string",nullable:!0},deleted_at:{type:"string",nullable:!0},closed_short:{type:"boolean"},quantity_shipped_total:{type:"number"},editable:{type:"boolean"},items:{type:"array",items:{$ref:"#/components/schemas/StockTransferItem"}},stock_receipts:{type:"array",items:{$ref:"#/components/schemas/StockReceipt"}},source_location:{$ref:"#/components/schemas/StockLocation"},destination_location:{$ref:"#/components/schemas/StockLocation"}},required:["id","number","reference","created_at","updated_at","source_location_id","destination_location_id","status","notes","metadata","close_reason","items_count","quantity_received_total","quantity_rejected_total","shipped_at","received_at","closed_short_at","deleted_at","closed_short","quantity_shipped_total","editable"],"x-typelizer":!0},StoreCreditEvent:{type:"object",properties:{id:{type:"string"},action:{type:"string"},authorization_code:{type:"string",nullable:!0},display_action:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},store_credit_id:{type:"string"},originator_type:{type:"string",nullable:!0},originator_id:{type:"string",nullable:!0}},required:["id","action","authorization_code","display_action","amount","display_amount","created_at","updated_at","store_credit_id","originator_type","originator_id"],"x-typelizer":!0},StoreCredit:{type:"object",properties:{id:{type:"string"},amount:{type:"string"},amount_used:{type:"string"},amount_remaining:{type:"string"},display_amount:{type:"string"},display_amount_used:{type:"string"},display_amount_remaining:{type:"string"},currency:{type:"string"},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},amount_authorized:{type:"string"},outstanding:{type:"boolean"},display_amount_authorized:{type:"string"},customer_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},originator_type:{type:"string",nullable:!0},originator_id:{type:"string",nullable:!0},customer:{$ref:"#/components/schemas/Customer"},created_by:{$ref:"#/components/schemas/AdminUser"}},required:["id","amount","amount_used","amount_remaining","display_amount","display_amount_used","display_amount_remaining","currency","memo","metadata","created_at","updated_at","amount_authorized","outstanding","display_amount_authorized","customer_id","created_by_id","originator_type","originator_id"],"x-typelizer":!0},Store:{type:"object",properties:{id:{type:"string"},metadata:{type:"object"},name:{type:"string"},code:{type:"string"},preferred_storefront_url:{type:"string",nullable:!0},default_currency:{type:"string"},default_locale:{type:"string"},default_country_code:{type:"string",nullable:!0},mail_from_address:{type:"string",nullable:!0},customer_support_email:{type:"string",nullable:!0},new_order_notifications_email:{type:"string",nullable:!0},preferred_send_consumer_transactional_emails:{type:"boolean"},preferred_admin_locale:{type:"string",nullable:!0},preferred_timezone:{type:"string"},preferred_weight_unit:{type:"string",enum:["g","kg","lb","oz"]},preferred_unit_system:{type:"string"},preferred_storefront_access:{type:"string"},preferred_guest_checkout:{type:"boolean"},preferred_always_include_confirm_step:{type:"boolean"},preferred_company_field_enabled:{type:"boolean"},preferred_address_requires_company:{type:"boolean"},preferred_address_requires_phone:{type:"boolean"},preferred_capture_method:{type:"string"},preferred_track_inventory_levels:{type:"boolean"},preferred_stock_reservations_enabled:{type:"boolean"},preferred_low_stock_threshold:{type:"number"},preferred_tax_using_ship_address:{type:"boolean"},preferred_track_price_history:{type:"boolean"},preferred_show_products_without_price:{type:"boolean"},preferred_disable_sku_validation:{type:"boolean"},preferred_order_routing_strategy:{type:"string"},preferred_pricing_provider:{type:"string"},preferred_inventory_provider:{type:"string"},preferred_pricing_provider_failure_policy:{type:"string"},preferred_inventory_provider_failure_policy:{type:"string"},preferred_payout_provider:{type:"string",nullable:!0},preferred_default_payouts_schedule_interval:{type:"string"},preferred_default_minimum_payout_amount:{type:"number"},preferred_document_number_format:{type:"string"},preferred_order_number_prefix:{type:"string"},preferred_order_number_suffix:{type:"string"},preferred_order_number_sequence_start:{type:"number"},preferred_limit_digital_download_count:{type:"boolean"},preferred_digital_asset_authorized_clicks:{type:"number"},preferred_limit_digital_download_days:{type:"boolean"},preferred_digital_asset_authorized_days:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},order_number_sequence_started:{type:"boolean"},url:{type:"string"},api_url:{type:"string"},setup_tasks:{type:"array",items:{$ref:"#/components/schemas/SetupTask"}},supported_currencies:{type:"array",items:{type:"string"}},supported_locales:{type:"array",items:{type:"string"}},available_locales:{type:"array",items:{type:"string"}},logo_url:{type:"string",nullable:!0},mailer_logo_url:{type:"string",nullable:!0}},required:["id","metadata","name","code","preferred_storefront_url","default_currency","default_locale","default_country_code","mail_from_address","customer_support_email","new_order_notifications_email","preferred_send_consumer_transactional_emails","preferred_admin_locale","preferred_timezone","preferred_weight_unit","preferred_unit_system","preferred_storefront_access","preferred_guest_checkout","preferred_always_include_confirm_step","preferred_company_field_enabled","preferred_address_requires_company","preferred_address_requires_phone","preferred_capture_method","preferred_track_inventory_levels","preferred_stock_reservations_enabled","preferred_low_stock_threshold","preferred_tax_using_ship_address","preferred_track_price_history","preferred_show_products_without_price","preferred_disable_sku_validation","preferred_order_routing_strategy","preferred_pricing_provider","preferred_inventory_provider","preferred_pricing_provider_failure_policy","preferred_inventory_provider_failure_policy","preferred_payout_provider","preferred_default_payouts_schedule_interval","preferred_default_minimum_payout_amount","preferred_document_number_format","preferred_order_number_prefix","preferred_order_number_suffix","preferred_order_number_sequence_start","preferred_limit_digital_download_count","preferred_digital_asset_authorized_clicks","preferred_limit_digital_download_days","preferred_digital_asset_authorized_days","created_at","updated_at","order_number_sequence_started","url","api_url","setup_tasks","supported_currencies","supported_locales","available_locales","logo_url","mailer_logo_url"],"x-typelizer":!0},Supplier:{type:"object",properties:{id:{type:"string"},name:{type:"string"},contact_name:{type:"string",nullable:!0},email:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},notes:{type:"string",nullable:!0},address1:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},city:{type:"string",nullable:!0},state_name:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},postal_code:{type:"string",nullable:!0},purchase_orders_count:{type:"number"},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},deleted_at:{type:"string",nullable:!0},can_be_deleted:{type:"boolean"}},required:["id","name","contact_name","email","phone","notes","address1","address2","city","state_name","state_code","country_code","postal_code","purchase_orders_count","metadata","created_at","updated_at","deleted_at","can_be_deleted"],"x-typelizer":!0},TaxCategory:{type:"object",properties:{id:{type:"string"},name:{type:"string"},tax_code:{type:"string",nullable:!0},description:{type:"string",nullable:!0},is_default:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","tax_code","description","is_default","created_at","updated_at"],"x-typelizer":!0},TaxExemptionCertificate:{type:"object",properties:{id:{type:"string"},certificate_number:{type:"string"},reason_code:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","verified","expired","revoked"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},issuing_authority:{type:"string",nullable:!0},metadata:{type:"object",nullable:!0},issued_at:{type:"string"},expires_at:{type:"string"},verified_at:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},company_id:{type:"string"},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},active:{type:"boolean"},lapsed:{type:"boolean"},can_be_deleted:{type:"boolean"},document_filename:{type:"string",nullable:!0},document_byte_size:{type:"number",nullable:!0},document_url:{type:"string",nullable:!0}},required:["id","certificate_number","reason_code","status","issuing_authority","metadata","issued_at","expires_at","verified_at","created_at","updated_at","company_id","country_code","state_code","active","lapsed","can_be_deleted","document_filename","document_byte_size","document_url"],"x-typelizer":!0},TaxIdentifier:{type:"object",properties:{id:{type:"string"},kind:{type:"string",description:"Tax identifier kind, keyed to a registered validator. Built-in: eu_vat. Extensions may register more."},value:{type:"string"},validation_status:{type:"string",nullable:!0,enum:["pending","verified","unverified","unavailable","unsupported"]},validation_evidence:{type:"object",nullable:!0},source:{type:"string",nullable:!0,enum:["override","company","customer"]},validated_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},validatable:{type:"boolean"},customer_id:{type:"string",nullable:!0},cart_id:{type:"string",nullable:!0},order_id:{type:"string",nullable:!0}},required:["id","kind","value","validation_status","validation_evidence","source","validated_at","created_at","updated_at","validatable","customer_id","cart_id","order_id"],"x-typelizer":!0},TaxLine:{type:"object",properties:{id:{type:"string"},label:{type:"string"},included:{type:"boolean"},rate:{type:"string"},tax_rate_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},fee_id:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},provider_id:{type:"string",nullable:!0},metadata:{type:"object",nullable:!0},taxability_reason:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},data:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","label","included","rate","tax_rate_id","line_item_id","fulfillment_id","fee_id","amount","display_amount","provider_id","metadata","taxability_reason","country_code","state_code","data","created_at","updated_at"],"x-typelizer":!0},TaxRate:{type:"object",properties:{id:{type:"string"},name:{type:"string"},included_in_price:{type:"boolean"},show_rate_in_label:{type:"boolean"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},deleted_at:{type:"string",nullable:!0},amount:{type:"string"},amount_percentage:{type:"number",nullable:!0},tax_category_id:{type:"string",nullable:!0},store_id:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0}},required:["id","name","included_in_price","show_rate_in_label","metadata","created_at","updated_at","deleted_at","amount","amount_percentage","tax_category_id","store_id","country_code","state_code"],"x-typelizer":!0},Variant:{type:"object",properties:{id:{type:"string"},product_id:{type:"string"},sku:{type:"string",nullable:!0},options_text:{type:"string"},track_inventory:{type:"boolean"},media_count:{type:"number"},preorder_ships_at:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},purchasable:{type:"boolean"},in_stock:{type:"boolean"},backorderable:{type:"boolean"},preorder:{type:"boolean"},weight:{type:"number",nullable:!0},height:{type:"number",nullable:!0},width:{type:"number",nullable:!0},depth:{type:"number",nullable:!0},weight_unit:{type:"string",enum:["g","kg","lb","oz"]},dimensions_unit:{type:"string",enum:["mm","cm","in","ft"]},minimum_order_quantity:{type:"number",nullable:!0},order_multiple:{type:"number",nullable:!0},purchase_unit:{type:"string",nullable:!0,enum:["unit","carton"]},units_per_carton:{type:"number",nullable:!0},price:{$ref:"#/components/schemas/Price"},original_price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},seller_id:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"},primary_media:{$ref:"#/components/schemas/Media"},media:{type:"array",items:{$ref:"#/components/schemas/Media"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},prior_price:{allOf:[{$ref:"#/components/schemas/PriceHistory"}],nullable:!0},external_references:{type:"object"},metadata:{type:"object"},position:{type:"number"},cost_price:{type:"string",nullable:!0},cost_currency:{type:"string",nullable:!0},barcode:{type:"string",nullable:!0},backorder_limit:{type:"number",nullable:!0},hs_code:{type:"string",nullable:!0},country_of_origin:{type:"string",nullable:!0},customs_description:{type:"string",nullable:!0},carton_weight:{type:"string",nullable:!0},cartons_per_pallet:{type:"number",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},preorderable:{type:"boolean"},tax_category_id:{type:"string",nullable:!0},carton_package_type_id:{type:"string",nullable:!0},units_per_pallet:{type:"number",nullable:!0},available_stock:{type:"number",nullable:!0},reserved_quantity:{type:"number"},total_on_hand:{type:"number",nullable:!0},product_name:{type:"string"},delivery_profile_id:{type:"string",nullable:!0},prices:{type:"array",items:{$ref:"#/components/schemas/Price"}},stock_levels:{type:"array",items:{$ref:"#/components/schemas/StockLevel"}}},required:["id","product_id","sku","options_text","track_inventory","media_count","preorder_ships_at","thumbnail_url","purchasable","in_stock","backorderable","preorder","weight","height","width","depth","weight_unit","dimensions_unit","minimum_order_quantity","order_multiple","purchase_unit","units_per_carton","price","original_price","seller_id","option_values","external_references","metadata","position","cost_price","cost_currency","barcode","backorder_limit","hs_code","country_of_origin","customs_description","carton_weight","cartons_per_pallet","deleted_at","created_at","updated_at","preorderable","tax_category_id","carton_package_type_id","units_per_pallet","available_stock","reserved_quantity","total_on_hand","product_name","delivery_profile_id"],"x-typelizer":!0},WebhookDelivery:{type:"object",properties:{id:{type:"string"},event_name:{type:"string"},event_id:{type:"string",nullable:!0},response_code:{type:"number",nullable:!0},execution_time:{type:"number",nullable:!0},error_type:{type:"string",nullable:!0},request_errors:{type:"string",nullable:!0},response_body:{type:"string",nullable:!0},success:{type:"boolean",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},delivered_at:{type:"string",nullable:!0},payload:{type:"object"},webhook_endpoint_id:{type:"string"},webhook_endpoint_url:{type:"string"}},required:["id","event_name","event_id","response_code","execution_time","error_type","request_errors","response_body","success","created_at","updated_at","delivered_at","payload","webhook_endpoint_id","webhook_endpoint_url"],"x-typelizer":!0},WebhookEndpoint:{type:"object",properties:{id:{type:"string"},name:{type:"string",nullable:!0},url:{type:"string"},active:{type:"boolean"},subscriptions:{type:"array",items:{type:"string"}},disabled_reason:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},disabled_at:{type:"string",nullable:!0},secret_key:{type:"string",nullable:!0},last_delivery_at:{type:"string",nullable:!0},recent_delivery_count:{type:"number"},recent_failure_count:{type:"number"},total_delivery_count:{type:"number"},successful_delivery_count:{type:"number"},failed_delivery_count:{type:"number"}},required:["id","name","url","active","subscriptions","disabled_reason","created_at","updated_at","disabled_at","secret_key","last_delivery_at","recent_delivery_count","recent_failure_count","total_delivery_count","successful_delivery_count","failed_delivery_count"],"x-typelizer":!0}}}};var ih=new Set(["get","post","put","patch","delete"]);function Tn(){return th}function h0(e){let t=e.description?.match(/\*\*Required scope:\*\* (.+?) \(for API-key authentication\)\./);return t?t[1].replaceAll("`",""):"\u2014"}function nh(e,t={}){let r=[];for(let[i,n]of Object.entries(e.paths)){let s=i.replace("/api/v3/admin","")||"/";for(let[a,o]of Object.entries(n)){if(!ih.has(a))continue;if(t.resource){let d=s.split("/")[1]??"";if(d!==t.resource&&!d.startsWith(t.resource))continue}let p=o.summary??"";t.search&&!`${a} ${s} ${p}`.toLowerCase().includes(t.search.toLowerCase())||r.push({method:a.toUpperCase(),path:s,scope:h0(o),summary:p})}}return r}function sh(e,t){let r=t.trim().split(/\s+/),i=r.length>1?r[0].toLowerCase():void 0,n=r.length>1?r[1]:r[0],s=Br(n),a=rh(e,i,o=>o===s);return a.length>0?a:rh(e,i,o=>y0(o,s))}function rh(e,t,r){let i=[];for(let[n,s]of Object.entries(e.paths)){let a=n.replace("/api/v3/admin","")||"/";if(r(a))for(let[o,p]of Object.entries(s))ih.has(o)&&(t&&o!==t||i.push({method:o.toUpperCase(),path:a,summary:p.summary,description:p.description,parameters:tr(p.parameters,e),requestBody:tr(p.requestBody,e),responses:tr(p.responses,e)}))}return i}function y0(e,t){if(e===t)return!0;let r=e.split("/"),i=t.split("/");return r.length!==i.length?!1:r.every((n,s)=>n.startsWith("{")&&n.endsWith("}")?i[s].length>0:n===i[s])}var g0=8;function tr(e,t,r=[]){if(Array.isArray(e))return e.map(a=>tr(a,t,r));if(!e||typeof e!="object")return e;let i=e,n=i.$ref;if(typeof n=="string"){let a=n.replace("#/components/schemas/","");return r.includes(a)||r.length>=g0||!(a in t.components.schemas)?{$ref:n}:tr(t.components.schemas[a],t,[...r,a])}let s={};for(let[a,o]of Object.entries(i))s[a]=tr(o,t,r);return s}function f0(e,t){return[...t,e]}function ch(e){return e.option("--profile <name>","use a saved profile (see `spree auth`)").option("--base-url <url>","store URL (overrides profile/env/project)").option("--api-key <key>","secret API key (prefer SPREE_API_KEY \u2014 flags leak into shell history)").option("--store-id <id>","X-Spree-Store-Id for hosts serving multiple stores")}function dh(){return new Fo("--format <format>","output format").choices(["json","table"]).default("json")}function ah(e){return ch(e).addOption(dh())}async function oh(e){let t=await Pr({baseUrl:e.baseUrl,apiKey:e.apiKey,profile:e.profile});return{client:jr({baseUrl:t.baseUrl,secretKey:t.apiKey,...e.storeId?{storeId:e.storeId}:{}}),credentials:t}}function uh(e){let t=e.command("api").description("Call the Admin API directly (generic get/post/patch/delete)");t.addHelpText("after",["","Examples:"," spree api get /products -q status_eq=active --limit 10",` spree api post /products -d '{"name":"Classic Tee","prices":[{"currency":"USD","amount":"29.99"}]}'`," spree api get /orders/ord_x8k2J9aQ --expand items,payments","","Discover the surface (offline, no server needed):"," spree api endpoints --search <term> # find endpoints + required scopes",' spree api schema "POST /orders" # request/response schema for one operation'," spree completion zsh # tab-completion for paths, filters, scopes"].join(`
879
- `)),ah(t.command("get <path>").description("GET an Admin API path, e.g. `spree api get /products -q status_eq=active`").option("-q, --query <expr>","Ransack predicate key=value (repeatable)",f0,[]).option("--sort <fields>","sort, e.g. -created_at").option("--page <n>","page number").option("--limit <n>","page size (max 100)").option("--expand <relations>","expand relations, e.g. variants,variants.prices").option("--fields <fields>","sparse fields, e.g. id,name")).action(async(r,i)=>{let n;try{let s=Qm(i),{client:a,credentials:o}=await oh(i);n=o.baseUrl;let p=await a.request("GET",Br(r),{params:s});Lr(p,i.format)}catch(s){Pt(s,{baseUrl:n})}});for(let r of["post","patch","delete"])ah(t.command(`${r} <path>`).description(`${r.toUpperCase()} an Admin API path`).option("-d, --data <json>","request body: inline JSON, @file, or '-' for stdin")).action(async(i,n)=>{let s;try{let a=await Jm(n.data),{client:o,credentials:p}=await oh(n);s=p.baseUrl;let d=await o.request(r.toUpperCase(),Br(i),{...a===bo?{}:{body:a}});Lr(d,n.format)}catch(a){Pt(a,{baseUrl:s})}});t.command("endpoints").description("List Admin API endpoints with their required scopes").option("--resource <name>","filter by first path segment, e.g. orders").option("--search <term>","filter by method, path, or summary").addOption(dh()).action(r=>{let i=nh(Tn(),{resource:r.resource,search:r.search});if(i.length===0){process.stderr.write(`No endpoints match.
880
- `),process.exitCode=1;return}if(r.format==="table"){(0,ph.printTable)(i.map(n=>({Method:n.method,Path:n.path,Scope:n.scope,Summary:n.summary})));return}Lr(i,"json")}),t.command("schema <operation>").description('Show the request/response schema for an operation, e.g. `spree api schema "POST /products"`').action(r=>{let i=sh(Tn(),r);if(i.length===0){process.stderr.write(`No operation matches "${r}". Try \`spree api endpoints --search ${r.split(/\s+/).pop()}\`.
881
- `),process.exitCode=1;return}let n=/\s/.test(r.trim());Lr(n&&i.length===1?i[0]:i,"json")}),ch(t.command("status").description("Show resolved credentials, server reachability, and the bundled spec version")).action(async r=>{try{let i=await Pr({baseUrl:r.baseUrl,apiKey:r.apiKey,profile:r.profile},{allowMint:!1}),n=await zr(i.baseUrl,i.apiKey),s=Tn(),a=Cn(n),o=[`${Re.default.bold("Base URL:")} ${i.baseUrl}`,`${Re.default.bold("Credentials:")} ${i.source}${i.profileName?` (${i.profileName})`:""}, key ${i.tokenPrefix}${Re.default.dim("\u2026")}`],p=n.status==="unreachable"||n.status==="unauthorized"?null:await eh(i.baseUrl,i.apiKey);p!==null?o.push(`${Re.default.bold("Scopes:")} ${p.length?p.join(", "):Re.default.dim("(none)")}`):i.scopes?.length&&o.push(`${Re.default.bold("Scopes:")} ${i.scopes.join(", ")} ${Re.default.dim("(local snapshot from mint time \u2014 may be stale)")}`),o.push(`${Re.default.bold("Server:")} ${a}`),o.push(`${Re.default.bold("Bundled spec:")} ${s.info?.version??"unknown"} ${Re.default.dim("(spree api endpoints/schema reflect this snapshot, not the live server)")}`),process.stdout.write(`${o.join(`
888
+ **Required scope:** \`write_purchasing\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"204":{description:"supplier deleted"}}}}},components:{schemas:{PaginationMeta:{type:"object",properties:{page:{type:"integer"},limit:{type:"integer"},count:{type:"integer",description:"Total number of records"},pages:{type:"integer",description:"Total number of pages"},from:{type:"integer",description:"Index of first record on this page"},to:{type:"integer",description:"Index of last record on this page"},in:{type:"integer",description:"Number of records on this page"},previous:{type:"integer",nullable:!0,description:"Previous page number"},next:{type:"integer",nullable:!0,description:"Next page number"}},required:["page","limit","count","pages","from","to","in"]},ErrorResponse:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"},details:{type:"object",description:"Field-specific validation errors",nullable:!0}},required:["code","message"]}},required:["error"]},AuthResponse:{type:"object",properties:{token:{type:"string",description:"JWT access token"},user:{$ref:"#/components/schemas/AdminUser"}},required:["token","user"]},PermissionRule:{type:"object",description:"A single permission rule (CanCanCan rule). Rules are applied in order, last-matching-wins.",properties:{allow:{type:"boolean",description:"true for `can`, false for `cannot`"},actions:{type:"array",items:{type:"string"},description:'Action names, e.g. ["read", "update"] or ["manage"]'},subjects:{type:"array",items:{type:"string"},description:'Subject class names, e.g. ["Spree::Product"] or ["all"]'},has_conditions:{type:"boolean",description:"True if the server-side rule has per-record conditions. The SPA shows the action optimistically and handles 403 from the API."}},required:["allow","actions","subjects","has_conditions"]},ImportSchemaField:{type:"object",description:"A canonical column of an import type, including per-store custom field columns",properties:{name:{type:"string",description:"Canonical field name used in mappings"},label:{type:"string",description:"Human-readable label"},required:{type:"boolean",description:"Whether the field must be mapped before processing"}},required:["name","label","required"]},CheckoutRequirement:{type:"object",properties:{step:{type:"string",description:"Checkout step this requirement belongs to"},field:{type:"string",description:"Field that needs to be satisfied"},message:{type:"string",description:"Human-readable requirement message"}},required:["step","field","message"]},CartWarning:{type:"object",description:"A warning about a cart issue (e.g., item removed due to stock change)",properties:{code:{type:"string",description:"Machine-readable warning code"},message:{type:"string",description:"Human-readable warning message"},line_item_id:{type:"string",nullable:!0,description:"Prefixed line item ID (when applicable)"},variant_id:{type:"string",nullable:!0,description:"Prefixed variant ID (when applicable)"},item_index:{type:"integer",nullable:!0,description:"Position in the submitted items array, for warnings raised while applying a batch of item changes"}},required:["code","message"]},FulfillmentManifestItem:{type:"object",description:"An item within a fulfillment \u2014 which line item and how many units are in this fulfillment",properties:{item_id:{type:"string",description:"Line item ID"},variant_id:{type:"string",description:"Variant ID"},quantity:{type:"integer",description:"Quantity in this fulfillment"}},required:["item_id","variant_id","quantity"]},AdminUserRoleAssignment:{type:"object",description:"A role assignment for the current store on a staff member",properties:{id:{type:"string",description:"Prefixed role ID"},name:{type:"string",description:"Role name"}},required:["id","name"]},AdminUserStore:{type:"object",description:"A store the staff member can access through a role assignment",properties:{id:{type:"string",description:"Prefixed store ID"},name:{type:"string",description:"Store name"},code:{type:"string",description:"Store code"}},required:["id","name","code"]},PreferenceField:{type:"object",description:"A single configurable preference on a payment method, promotion rule/action, or calculator. The frontend uses `type` + `default` to render a sensible input.",properties:{key:{type:"string"},type:{type:"string",description:"string | text | password | integer | decimal | boolean | array | hash"},default:{description:"Default value (any JSON type), null when there is no default",nullable:!0}},required:["key","type"]},PromotionActionCalculator:{type:"object",description:"The action's nested calculator (when the action carries one \u2014 null for actions like `free_shipping`)",properties:{type:{type:"string",description:"Wire shorthand for the calculator subclass"},label:{type:"string"},preferences:{type:"object",additionalProperties:!0},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}}},required:["type","label","preferences","preference_schema"]},PromotionActionLineItem:{type:"object",description:"One row in a `create_line_items` action \u2014 the variant added to the order and how many",properties:{variant_id:{type:"string"},quantity:{type:"integer"}},required:["variant_id","quantity"]},MeResponse:{type:"object",description:"Current admin user profile and serialized permissions",properties:{user:{$ref:"#/components/schemas/AdminUser"},permissions:{type:"array",items:{$ref:"#/components/schemas/PermissionRule"}}},required:["user","permissions"]},Actor:{type:"object",properties:{id:{type:"string"},type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},label:{type:"string",nullable:!0}},required:["id","type","label"],"x-typelizer":!0},Address:{type:"object",properties:{id:{type:"string"},label:{type:"string",nullable:!0},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string"},address1:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},postal_code:{type:"string",nullable:!0},city:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},company:{type:"string",nullable:!0},country_name:{type:"string"},country_code:{type:"string"},state_text:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},quick_checkout:{type:"boolean"},is_default_billing:{type:"boolean"},is_default_shipping:{type:"boolean"},state_abbr:{type:"string",nullable:!0},country_iso:{type:"string"},state_name:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},latitude:{type:"number",nullable:!0},longitude:{type:"number",nullable:!0},customer_id:{type:"string",nullable:!0},owner_id:{type:"string",nullable:!0},owner_type:{type:"string",nullable:!0}},required:["id","label","first_name","last_name","full_name","address1","address2","postal_code","city","phone","company","country_name","country_code","state_text","state_code","quick_checkout","is_default_billing","is_default_shipping","state_abbr","country_iso","state_name","metadata","created_at","updated_at","latitude","longitude","customer_id","owner_id","owner_type"],"x-typelizer":!0},AdminUser:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string",nullable:!0},selected_locale:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},avatar_url:{type:"string",nullable:!0},roles:{type:"array",items:{$ref:"#/components/schemas/AdminUserRoleAssignment"}},stores:{type:"array",items:{$ref:"#/components/schemas/AdminUserStore"}}},required:["id","email","first_name","last_name","full_name","selected_locale","created_at","updated_at","avatar_url","roles","stores"],"x-typelizer":!0},AllowedOrigin:{type:"object",properties:{id:{type:"string"},origin:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","origin","created_at","updated_at"],"x-typelizer":!0},ApiKey:{type:"object",properties:{id:{type:"string"},name:{type:"string"},key_type:{type:"string",enum:["publishable","secret"]},token_prefix:{type:"string",nullable:!0},scopes:{type:"array",items:{type:"string"}},created_at:{type:"string"},updated_at:{type:"string"},revoked_at:{type:"string",nullable:!0},last_used_at:{type:"string",nullable:!0},channel_id:{type:"string",nullable:!0},plaintext_token:{type:"string",nullable:!0},created_by_email:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by_label:{type:"string",nullable:!0}},required:["id","name","key_type","token_prefix","scopes","created_at","updated_at","revoked_at","last_used_at","channel_id","plaintext_token","created_by_email","created_by_type","created_by_label"],"x-typelizer":!0},AppliedPromotion:{type:"object",properties:{id:{type:"string"},promotion_id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},code:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","promotion_id","name","description","code","amount","display_amount","created_at","updated_at"],"x-typelizer":!0},Cart:{type:"object",properties:{id:{type:"string"},market_id:{type:"string",nullable:!0},channel_id:{type:"string",nullable:!0},preferred_stock_location_id:{type:"string",nullable:!0},company_id:{type:"string",nullable:!0},company_name:{type:"string",nullable:!0},po_number_required:{type:"boolean"},po_document_filename:{type:"string",nullable:!0},po_document_byte_size:{type:"number",nullable:!0},number:{type:"string"},token:{type:"string"},email:{type:"string",nullable:!0},customer_note:{type:"string",nullable:!0},po_number:{type:"string",nullable:!0},currency:{type:"string"},locale:{type:"string",nullable:!0},total_quantity:{type:"number"},warnings:{type:"array",items:{$ref:"#/components/schemas/CartWarning"}},coupon_code:{type:"string",nullable:!0},item_total:{type:"string",nullable:!0},display_item_total:{type:"string",nullable:!0},adjustment_total:{type:"string",nullable:!0},display_adjustment_total:{type:"string",nullable:!0},discount_total:{type:"string",nullable:!0},display_discount_total:{type:"string",nullable:!0},tax_total:{type:"string",nullable:!0},display_tax_total:{type:"string",nullable:!0},included_tax_total:{type:"string",nullable:!0},display_included_tax_total:{type:"string",nullable:!0},additional_tax_total:{type:"string",nullable:!0},display_additional_tax_total:{type:"string",nullable:!0},total:{type:"string",nullable:!0},display_total:{type:"string",nullable:!0},gift_card_total:{type:"string",nullable:!0},display_gift_card_total:{type:"string",nullable:!0},amount_due:{type:"string",nullable:!0},display_amount_due:{type:"string",nullable:!0},delivery_total:{type:"string",nullable:!0},display_delivery_total:{type:"string",nullable:!0},fee_total:{type:"string",nullable:!0},display_fee_total:{type:"string",nullable:!0},store_credit_total:{type:"string",nullable:!0},display_store_credit_total:{type:"string",nullable:!0},covered_by_store_credit:{type:"boolean"},current_step:{type:"string"},completed_steps:{type:"array",items:{type:"string"}},requirements:{type:"array",items:{$ref:"#/components/schemas/CheckoutRequirement"}},order_minimum:{type:"number",nullable:!0},order_minimum_shortfall:{type:"number",nullable:!0},below_order_minimum:{type:"boolean",nullable:!0},freight_summary:{allOf:[{$ref:"#/components/schemas/FreightSummary"}],nullable:!0},shipping_eq_billing_address:{type:"boolean"},items:{type:"array",items:{$ref:"#/components/schemas/LineItem"}},billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0},completed_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},applied_promotions:{type:"array",items:{$ref:"#/components/schemas/AppliedPromotion"}}},required:["id","market_id","channel_id","preferred_stock_location_id","company_id","company_name","po_number_required","po_document_filename","po_document_byte_size","number","token","email","customer_note","po_number","currency","locale","total_quantity","warnings","coupon_code","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fee_total","display_fee_total","store_credit_total","display_store_credit_total","covered_by_store_credit","current_step","completed_steps","requirements","order_minimum","order_minimum_shortfall","below_order_minimum","freight_summary","shipping_eq_billing_address","items","billing_address","shipping_address","market","completed_at","created_at","updated_at","applied_promotions"],"x-typelizer":!0},CatalogAssignment:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},catalog_id:{type:"string"},assignable_type:{type:"string"},assignable_id:{type:"string"},assignable_name:{type:"string",nullable:!0}},required:["id","created_at","catalog_id","assignable_type","assignable_id","assignable_name"],"x-typelizer":!0},CatalogOrderMinimum:{type:"object",properties:{id:{type:"string"},currency:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string"},display_amount:{type:"string"}},required:["id","currency","created_at","updated_at","amount","display_amount"],"x-typelizer":!0},CatalogPrice:{type:"object",properties:{id:{type:"string",nullable:!0},label:{type:"string",nullable:!0},sku:{type:"string",nullable:!0},currency:{type:"string"},source:{type:"string",enum:["explicit","automatic","base"]},break_count:{type:"number"},amount:{type:"string"},display_amount:{type:"string"},tiers:{type:"array",items:{$ref:"#/components/schemas/CatalogPriceTier"}}},required:["id","label","sku","currency","source","break_count","amount","display_amount","tiers"],"x-typelizer":!0},CatalogPriceTier:{type:"object",properties:{min_quantity:{type:"number"},display_amount:{type:"string"},amount:{type:"string"}},required:["min_quantity","display_amount","amount"],"x-typelizer":!0},CatalogProduct:{type:"object",properties:{id:{type:"string"},name:{type:"string"},thumbnail_url:{type:"string",nullable:!0},quantity_rule:{allOf:[{$ref:"#/components/schemas/CatalogProductTerm"}],nullable:!0},catalog_variants:{type:"array",items:{$ref:"#/components/schemas/CatalogPrice"}}},required:["id","name","thumbnail_url"],"x-typelizer":!0},CatalogProductTerm:{type:"object",properties:{id:{type:"string"},product_id:{type:"string"},product_name:{type:"string",nullable:!0},minimum_order_quantity:{type:"number",nullable:!0},order_multiple:{type:"number",nullable:!0},mixed:{type:"boolean"}},required:["id","product_id","product_name","minimum_order_quantity","order_multiple","mixed"],"x-typelizer":!0},CatalogQuantityRule:{type:"object",properties:{id:{type:"string"},minimum_order_quantity:{type:"number",nullable:!0},order_multiple:{type:"number",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},variant_id:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},product_name:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0}},required:["id","minimum_order_quantity","order_multiple","created_at","updated_at","variant_id","variant_sku","product_name","options_text"],"x-typelizer":!0},Catalog:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},active:{type:"boolean"},position:{type:"number",nullable:!0},metadata:{type:"object",nullable:!0},minimum_order_quantity:{type:"number",nullable:!0},order_multiple:{type:"number",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},products_count:{type:"number"},pricing_strategy:{type:"string"},order_minimums:{type:"array",items:{$ref:"#/components/schemas/CatalogOrderMinimum"}},price_list:{$ref:"#/components/schemas/PriceList"},assignments:{type:"array",items:{$ref:"#/components/schemas/CatalogAssignment"}}},required:["id","name","description","active","position","metadata","minimum_order_quantity","order_multiple","created_at","updated_at","products_count","pricing_strategy"],"x-typelizer":!0},Category:{type:"object",properties:{id:{type:"string"},name:{type:"string"},permalink:{type:"string"},position:{type:"number"},depth:{type:"number"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},children_count:{type:"number"},parent_id:{type:"string",nullable:!0},description:{type:"string"},description_html:{type:"string"},image_url:{type:"string",nullable:!0},square_image_url:{type:"string",nullable:!0},is_root:{type:"boolean"},is_child:{type:"boolean"},is_leaf:{type:"boolean"},parent:{$ref:"#/components/schemas/Category"},children:{type:"array",items:{$ref:"#/components/schemas/Category"}},ancestors:{type:"array",items:{$ref:"#/components/schemas/Category"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},external_references:{type:"object"},translations:{type:"object"},metadata:{type:"object"},pretty_name:{type:"string"},lft:{type:"number"},rgt:{type:"number"},products_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","permalink","position","depth","meta_title","meta_description","meta_keywords","children_count","parent_id","description","description_html","image_url","square_image_url","is_root","is_child","is_leaf","external_references","metadata","pretty_name","lft","rgt","products_count","created_at","updated_at"],"x-typelizer":!0},Channel:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string"},active:{type:"boolean"},default:{type:"boolean"},storefront_access:{type:"string"},guest_checkout:{type:"boolean"},preferred_order_routing_strategy:{type:"string",nullable:!0},preferred_storefront_access:{type:"string",nullable:!0},preferred_guest_checkout:{type:"boolean",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},stock_location_ids:{type:"array",items:{type:"string"}},default_catalog_id:{type:"string",nullable:!0}},required:["id","name","code","active","default","storefront_access","guest_checkout","preferred_order_routing_strategy","preferred_storefront_access","preferred_guest_checkout","created_at","updated_at","stock_location_ids","default_catalog_id"],"x-typelizer":!0},ClaimLineItem:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},send_replacement:{type:"boolean"},description:{type:"string",nullable:!0},refund_amount:{type:"string"},paid_amount:{type:"string"},display_refund_amount:{type:"string"},variant_id:{type:"string",nullable:!0},replacement_variant_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},variant:{$ref:"#/components/schemas/Variant"},created_at:{type:"string"},updated_at:{type:"string"},replacement_variant:{$ref:"#/components/schemas/Variant"}},required:["id","quantity","send_replacement","description","refund_amount","paid_amount","display_refund_amount","variant_id","replacement_variant_id","line_item_id","created_at","updated_at"],"x-typelizer":!0},ClaimReason:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},can_be_deleted:{type:"boolean"}},required:["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":!0},Claim:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{anyOf:[{type:"string",enum:["open","approved","resolved","denied","canceled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},resolution:{type:"string",nullable:!0},order_id:{type:"string",nullable:!0},reason_id:{type:"string",nullable:!0},refund_total:{type:"string"},display_refund_total:{type:"string"},approved_at:{type:"string",nullable:!0},resolved_at:{type:"string",nullable:!0},denied_at:{type:"string",nullable:!0},canceled_at:{type:"string",nullable:!0},reason:{$ref:"#/components/schemas/ClaimReason"},claim_line_items:{type:"array",items:{$ref:"#/components/schemas/ClaimLineItem"}},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},created_by_id:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by:{$ref:"#/components/schemas/Actor"},order:{$ref:"#/components/schemas/Order"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}}},required:["id","number","status","resolution","order_id","reason_id","refund_total","display_refund_total","approved_at","resolved_at","denied_at","canceled_at","memo","metadata","created_at","updated_at","created_by_id","created_by_type"],"x-typelizer":!0},CollectionRule:{type:"object",properties:{id:{type:"string"},value:{type:"string",nullable:!0},match_policy:{type:"string",enum:["is_equal_to","is_not_equal_to","contains","does_not_contain"]},type:{type:"string",description:"Rule type. Built-in: tag, available_on, sale. Extensions may register more."}},required:["id","value","match_policy","type"],"x-typelizer":!0},Collection:{type:"object",properties:{id:{type:"string"},name:{type:"string"},permalink:{type:"string"},position:{type:"number"},sort_order:{type:"string"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},products_count:{type:"number"},description:{type:"string"},description_html:{type:"string"},image_url:{type:"string",nullable:!0},square_image_url:{type:"string",nullable:!0},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},translations:{type:"object"},automatic:{type:"boolean"},rules_match_policy:{type:"string",enum:["all","any"]},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},rules:{type:"array",items:{$ref:"#/components/schemas/CollectionRule"}}},required:["id","name","permalink","position","sort_order","meta_title","meta_description","meta_keywords","products_count","description","description_html","image_url","square_image_url","automatic","rules_match_policy","metadata","created_at","updated_at"],"x-typelizer":!0},CommissionLine:{type:"object",properties:{id:{type:"string"},kind:{type:"string",enum:["percentage","fixed"]},currency:{type:"string"},taxability_reason:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},rate:{type:"string"},tax_rate:{type:"string"},amount:{type:"string"},tax_amount:{type:"string"},total:{type:"string"},display_amount:{type:"string"},display_tax_amount:{type:"string"},display_total:{type:"string"},order_id:{type:"string"},seller_id:{type:"string"},line_item_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},commission_rate_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},commission_rate:{$ref:"#/components/schemas/CommissionRate"}},required:["id","kind","currency","taxability_reason","country_code","state_code","created_at","updated_at","rate","tax_rate","amount","tax_amount","total","display_amount","display_tax_amount","display_total","order_id","seller_id","line_item_id","fulfillment_id","commission_rate_id","seller_name"],"x-typelizer":!0},CommissionRate:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string",nullable:!0},enabled:{type:"boolean"},position:{type:"number"},kind:{type:"string",enum:["percentage","fixed"]},tax_inclusive:{type:"boolean"},include_shipping:{type:"boolean"},metadata:{type:"object",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},value:{type:"string"},commission_tax_rate:{type:"string",nullable:!0},amounts:{type:"object"},bounds:{type:"object"},global:{type:"boolean"},rules:{type:"array",items:{$ref:"#/components/schemas/CommissionRule"}}},required:["id","name","code","enabled","position","kind","tax_inclusive","include_shipping","metadata","deleted_at","created_at","updated_at","value","commission_tax_rate","amounts","bounds","global","rules"],"x-typelizer":!0},CommissionRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: seller_rule, category_rule, product_rule, item_total_rule. Extensions may register more."},commission_rate_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"object"},product_ids:{type:"object",nullable:!0},seller_ids:{type:"object",nullable:!0},category_ids:{type:"object",nullable:!0},sellers:{type:"array",items:{$ref:"#/components/schemas/Seller"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}}},required:["id","created_at","updated_at","type","commission_rate_id","preferences","preference_schema","product_ids","seller_ids","category_ids"],"x-typelizer":!0},CompanyInvitation:{type:"object",properties:{id:{type:"string"},email:{type:"string"},expires_at:{type:"string",nullable:!0},company_id:{type:"string"},status:{type:"string",enum:["pending","accepted","revoked","expired"]},accepted_at:{type:"string",nullable:!0},revoked_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","email","expires_at","company_id","status","accepted_at","revoked_at","created_at","updated_at"],"x-typelizer":!0},CompanyMembership:{type:"object",properties:{id:{type:"string"},company_id:{type:"string"},customer_id:{type:"string"},email:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","company_id","customer_id","email","created_at","updated_at"],"x-typelizer":!0},Company:{type:"object",properties:{id:{type:"string"},name:{type:"string"},kind:{type:"string",enum:["company","division"]},po_number_required:{type:"boolean"},parent_id:{type:"string",nullable:!0},ancestors:{type:"object"},external_references:{type:"object"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},children_count:{type:"number"},members_count:{type:"number"},children:{type:"array",items:{$ref:"#/components/schemas/Company"}},addresses:{type:"array",items:{$ref:"#/components/schemas/Address"}},memberships:{type:"array",items:{$ref:"#/components/schemas/CompanyMembership"}}},required:["id","name","kind","po_number_required","parent_id","ancestors","external_references","metadata","created_at","updated_at","children_count","members_count"],"x-typelizer":!0},ConsentRecord:{type:"object",properties:{id:{type:"string"},purpose:{type:"string"},source:{type:"string",enum:["checkout","registration","account","admin","newsletter","anonymization","unknown","import","storefront"]},accepted:{type:"boolean"},email:{type:"string",nullable:!0},ip_address:{type:"string",nullable:!0},created_at:{type:"string"},recorded_at:{type:"string",nullable:!0},documents:{type:"object"}},required:["id","purpose","source","accepted","email","ip_address","created_at","recorded_at","documents"],"x-typelizer":!0},Country:{type:"object",properties:{iso:{type:"string"},iso3:{type:"string"},name:{type:"string"},states_required:{type:"boolean"},zipcode_required:{type:"boolean"},states:{type:"array",items:{$ref:"#/components/schemas/State"}},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0}},required:["iso","iso3","name","states_required","zipcode_required"],"x-typelizer":!0},CouponCode:{type:"object",properties:{id:{type:"string"},code:{type:"string"},state:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},promotion_id:{type:"string"},order_id:{type:"string",nullable:!0}},required:["id","code","state","created_at","updated_at","promotion_id","order_id"],"x-typelizer":!0},CreditCard:{type:"object",properties:{id:{type:"string"},brand:{type:"string"},last4:{type:"string"},month:{type:"number"},year:{type:"number"},name:{type:"string",nullable:!0},default:{type:"boolean"},gateway_payment_profile_id:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0},payment_method_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","brand","last4","month","year","name","default","gateway_payment_profile_id","customer_id","payment_method_id","metadata","created_at","updated_at"],"x-typelizer":!0},CustomFieldDefinition:{type:"object",properties:{id:{type:"string"},namespace:{type:"string"},key:{type:"string"},label:{type:"string"},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},resource_type:{type:"string",description:"Class name of the resource the field attaches to, for example Spree::Product, Spree::Order or Spree::Customer. Extensions may register more."},storefront_visible:{type:"boolean"},searchable:{type:"boolean"},sortable:{type:"boolean"},filter_key:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","namespace","key","label","field_type","resource_type","storefront_visible","searchable","sortable","filter_key","created_at","updated_at"],"x-typelizer":!0},CustomField:{type:"object",properties:{id:{type:"string"},label:{type:"string"},type:{type:"string",deprecated:!0},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},key:{type:"string"},value:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},storefront_visible:{type:"boolean"},custom_field_definition_id:{type:"string"}},required:["id","label","type","field_type","key","value","created_at","updated_at","storefront_visible","custom_field_definition_id"],"x-typelizer":!0},CustomerGroup:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},customers_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}}},required:["id","name","description","customers_count","created_at","updated_at"],"x-typelizer":!0},Customer:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},accepts_email_marketing:{type:"boolean"},email_marketing_consent_updated_at:{type:"string",nullable:!0},full_name:{type:"string"},available_store_credit_total:{type:"string"},display_available_store_credit_total:{type:"string"},addresses:{type:"array",items:{$ref:"#/components/schemas/Address"}},default_billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},default_shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},newsletter_subscriber:{allOf:[{$ref:"#/components/schemas/NewsletterSubscriber"}],nullable:!0},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},failed_attempts:{type:"number"},metadata:{type:"object"},email_marketing_consent_source:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},anonymized_at:{type:"string",nullable:!0},anonymized:{type:"boolean"},tags:{type:"array",items:{type:"string"}},internal_note:{type:"string",nullable:!0},internal_note_html:{type:"string",nullable:!0},default_billing_address_id:{type:"string",nullable:!0},default_shipping_address_id:{type:"string",nullable:!0},orders_count:{type:"number"},total_spent:{type:"string"},display_total_spent:{type:"string"},last_order_completed_at:{type:"string",nullable:!0},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}},store_credits:{type:"array",items:{$ref:"#/components/schemas/StoreCredit"}},customer_group_ids:{type:"array",items:{type:"string"}},companies:{type:"array",items:{$ref:"#/components/schemas/Company"}}},required:["id","email","first_name","last_name","phone","accepts_email_marketing","email_marketing_consent_updated_at","full_name","available_store_credit_total","display_available_store_credit_total","failed_attempts","metadata","email_marketing_consent_source","created_at","updated_at","anonymized_at","anonymized","tags","internal_note","internal_note_html","default_billing_address_id","default_shipping_address_id","orders_count","total_spent","display_total_spent","last_order_completed_at","customer_group_ids"],"x-typelizer":!0},DashboardCounter:{type:"object",properties:{key:{type:"string",description:"Registered counter name. The dashboard translates it; built-in: orders_to_fulfill, payments_to_collect, open_returns, open_exchanges, open_claims, low_stock_items, out_of_stock_items."},value:{type:"number"},link:{type:"object",nullable:!0,description:"The list filter that shows exactly the rows counted, or null when no list can."},nav:{type:"string",nullable:!0,description:"Sidebar entry key this count badges, or null."}},required:["key","value","link","nav"],"x-typelizer":!0},DataRequest:{type:"object",properties:{id:{type:"string"},number:{type:"string"},kind:{type:"string",enum:["access","erasure"]},status:{anyOf:[{type:"string",enum:["pending","processing","completed","failed"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},requested_at:{type:"string",nullable:!0},completed_at:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},email:{type:"string"},error_message:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0},requested_by_id:{type:"string",nullable:!0},customer:{$ref:"#/components/schemas/Customer"}},required:["id","number","kind","status","requested_at","completed_at","expires_at","email","error_message","created_at","updated_at","customer_id","requested_by_id"],"x-typelizer":!0},DeliveryMethodRule:{type:"object",properties:{id:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: item_total_rule, weight_rule, excluded_products_rule, channel_rule, volume_rule, company_rule. Extensions may register more."},preferences:{type:"object"},preference_schema:{type:"object"},product_ids:{type:"array",items:{type:"string"}}},required:["id","active","created_at","updated_at","type","preferences","preference_schema","product_ids"],"x-typelizer":!0},DeliveryMethod:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string",nullable:!0},estimated_transit_business_days_min:{type:"number",nullable:!0},estimated_transit_business_days_max:{type:"number",nullable:!0},digital:{type:"boolean"},pickup:{type:"boolean"},pickup_point:{type:"boolean"},admin_name:{type:"string",nullable:!0},fulfillment_provider:{type:"string"},pickup_point_provider:{type:"string",nullable:!0},rate_provider:{type:"string",nullable:!0},storefront_visible:{type:"boolean"},tracking_url:{type:"string",nullable:!0},markup_flat:{type:"string",nullable:!0},markup_percent:{type:"string",nullable:!0},available_to_sellers:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},deleted_at:{type:"string"},seller_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},services:{type:"array",items:{$ref:"#/components/schemas/DeliveryMethodService"}},rules:{type:"array",items:{$ref:"#/components/schemas/DeliveryMethodRule"}},tax_category_id:{type:"string",nullable:!0},delivery_profile_id:{type:"string"},delivery_origin_group_id:{type:"string",nullable:!0},delivery_zone_id:{type:"string",nullable:!0},stock_location_ids:{type:"array",items:{type:"string"}},calculator_type:{type:"string",nullable:!0},calculator_preferences:{type:"object",nullable:!0}},required:["id","name","code","estimated_transit_business_days_min","estimated_transit_business_days_max","digital","pickup","pickup_point","admin_name","fulfillment_provider","pickup_point_provider","rate_provider","storefront_visible","tracking_url","markup_flat","markup_percent","available_to_sellers","created_at","updated_at","deleted_at","seller_id","seller_name","services","rules","tax_category_id","delivery_profile_id","delivery_origin_group_id","delivery_zone_id","stock_location_ids","calculator_type","calculator_preferences"],"x-typelizer":!0},DeliveryMethodService:{type:"object",properties:{id:{type:"string"},carrier:{type:"string"},service:{type:"string"},label:{type:"string",nullable:!0},markup_flat:{type:"string",nullable:!0},markup_percent:{type:"string",nullable:!0},position:{type:"number"}},required:["id","carrier","service","label","markup_flat","markup_percent","position"],"x-typelizer":!0},DeliveryOriginGroup:{type:"object",properties:{id:{type:"string"},name:{type:"string",nullable:!0},position:{type:"number",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},delivery_profile_id:{type:"string"},stock_location_ids:{type:"array",items:{type:"string"}},delivery_zones_count:{type:"number"},delivery_methods_count:{type:"number"}},required:["id","name","position","created_at","updated_at","delivery_profile_id","stock_location_ids","delivery_zones_count","delivery_methods_count"],"x-typelizer":!0},DeliveryProfile:{type:"object",properties:{id:{type:"string"},name:{type:"string"},default:{type:"boolean"},position:{type:"number",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},kind:{type:"string",description:"Profile kind. Built-in: shipping, digital. Extensions may register more."},digital:{type:"boolean"},offers_pickup:{type:"boolean"},offers_shipping:{type:"boolean"},stock_location_ids:{type:"array",items:{type:"string"}},origin_groups:{type:"object"},products_count:{type:"number"},delivery_methods_count:{type:"number"},delivery_zones_count:{type:"number"}},required:["id","name","default","position","created_at","updated_at","kind","digital","offers_pickup","offers_shipping","stock_location_ids","origin_groups","products_count","delivery_methods_count","delivery_zones_count"],"x-typelizer":!0},DeliveryRate:{type:"object",properties:{id:{type:"string"},delivery_method_id:{type:"string"},name:{type:"string"},selected:{type:"boolean"},cost:{type:"string"},total:{type:"string"},additional_tax_total:{type:"string"},included_tax_total:{type:"string"},tax_total:{type:"string"},carrier:{type:"string",nullable:!0},service_level:{type:"string",nullable:!0},estimated_delivery_date:{type:"string",nullable:!0},unpriced:{type:"boolean"},freight_summary:{allOf:[{$ref:"#/components/schemas/FreightSummary"}],nullable:!0},display_cost:{type:"string"},display_total:{type:"string"},display_additional_tax_total:{type:"string"},display_included_tax_total:{type:"string"},display_tax_total:{type:"string"},delivery_method:{$ref:"#/components/schemas/DeliveryMethod"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","delivery_method_id","name","selected","cost","total","additional_tax_total","included_tax_total","tax_total","carrier","service_level","estimated_delivery_date","unpriced","freight_summary","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","metadata","created_at","updated_at"],"x-typelizer":!0},Delivery:{type:"object",properties:{id:{type:"string"},tracking_number:{type:"string"},carrier:{type:"string",nullable:!0},carrier_name:{type:"string",nullable:!0},service:{type:"string",nullable:!0},status:{type:"string",enum:["pending","pre_transit","in_transit","out_for_delivery","available_for_pickup","delivered","return_to_sender","failure","unknown"]},tracking_url:{type:"string",nullable:!0},estimated_delivery_at:{type:"string",nullable:!0},delivered_at:{type:"string",nullable:!0},details:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},shipping_label_id:{type:"string",nullable:!0}},required:["id","tracking_number","carrier","carrier_name","service","status","tracking_url","estimated_delivery_at","delivered_at","details","created_at","updated_at","shipping_label_id"],"x-typelizer":!0},DeliveryZoneMember:{type:"object",properties:{id:{type:"string"},member_type:{type:"string",enum:["country","state","postal_code"]},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},postal_code_prefix:{type:"string",nullable:!0},postal_code_from:{type:"string",nullable:!0},postal_code_to:{type:"string",nullable:!0},country_name:{type:"string",nullable:!0},state_name:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","member_type","country_code","state_code","postal_code_prefix","postal_code_from","postal_code_to","country_name","state_name","created_at","updated_at"],"x-typelizer":!0},DeliveryZone:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},members:{type:"array",items:{$ref:"#/components/schemas/DeliveryZoneMember"}},created_at:{type:"string"},updated_at:{type:"string"},delivery_profile_id:{type:"string"},delivery_origin_group_id:{type:"string",nullable:!0},delivery_method_ids:{type:"array",items:{type:"string"}}},required:["id","name","description","created_at","updated_at","delivery_profile_id","delivery_origin_group_id","delivery_method_ids"],"x-typelizer":!0},DigitalAsset:{type:"object",properties:{id:{type:"string"},variant_id:{type:"string",nullable:!0},filename:{type:"string",nullable:!0},content_type:{type:"string",nullable:!0},authorized_clicks:{type:"number",nullable:!0},authorized_days:{type:"number",nullable:!0},byte_size:{type:"number",nullable:!0},provider_type:{type:"string",nullable:!0},provider_settings:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},provider_name:{type:"string",description:"Digital asset provider name. Built-in: File. Extensions may register more."},download_url:{type:"string",nullable:!0},effective_authorized_clicks:{type:"number"},effective_authorized_days:{type:"number"}},required:["id","variant_id","filename","content_type","authorized_clicks","authorized_days","byte_size","provider_type","provider_settings","created_at","updated_at","provider_name","download_url","effective_authorized_clicks","effective_authorized_days"],"x-typelizer":!0},DigitalLink:{type:"object",properties:{id:{type:"string"},access_counter:{type:"number"},filename:{type:"string"},content_type:{type:"string"},download_url:{type:"string"},expires_at:{type:"string",nullable:!0},authorizable:{type:"boolean"},expired:{type:"boolean"},access_limit_exceeded:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","access_counter","filename","content_type","download_url","expires_at","authorizable","expired","access_limit_exceeded","created_at","updated_at"],"x-typelizer":!0},Discount:{type:"object",properties:{id:{type:"string"},label:{type:"string"},kind:{type:"string",enum:["promotion","manual"]},code:{type:"string",nullable:!0},value_type:{type:"string",nullable:!0},value:{type:"string",nullable:!0},promotion_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","label","kind","code","value_type","value","promotion_id","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":!0},ExchangeLineItem:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},received_quantity:{type:"number"},resellable:{type:"boolean"},original_price:{type:"string"},new_variant_price:{type:"string"},price_difference:{type:"string"},original_variant_id:{type:"string",nullable:!0},new_variant_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},fulfillment_item_id:{type:"string",nullable:!0},original_variant:{$ref:"#/components/schemas/Variant"},new_variant:{$ref:"#/components/schemas/Variant"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","quantity","received_quantity","resellable","original_price","new_variant_price","price_difference","original_variant_id","new_variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":!0},Exchange:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{anyOf:[{type:"string",enum:["requested","approved","received","fulfilled","canceled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},order_id:{type:"string",nullable:!0},reason_id:{type:"string",nullable:!0},price_difference:{type:"string"},display_price_difference:{type:"string"},approved_at:{type:"string",nullable:!0},received_at:{type:"string",nullable:!0},fulfilled_at:{type:"string",nullable:!0},canceled_at:{type:"string",nullable:!0},reason:{$ref:"#/components/schemas/ReturnReason"},exchange_line_items:{type:"array",items:{$ref:"#/components/schemas/ExchangeLineItem"}},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},stock_location_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by:{$ref:"#/components/schemas/Actor"},order:{$ref:"#/components/schemas/Order"},stock_location:{$ref:"#/components/schemas/StockLocation"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}}},required:["id","number","status","order_id","reason_id","price_difference","display_price_difference","approved_at","received_at","fulfilled_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id","created_by_type"],"x-typelizer":!0},Export:{type:"object",properties:{id:{type:"string"},number:{type:"string"},format:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",nullable:!0},user_id:{type:"string",nullable:!0},done:{type:"boolean"},store_id:{type:"string",nullable:!0},seller_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},filename:{type:"string",nullable:!0},byte_size:{type:"number",nullable:!0},download_url:{type:"string",nullable:!0}},required:["id","number","format","created_at","updated_at","type","user_id","done","store_id","seller_id","seller_name","filename","byte_size","download_url"],"x-typelizer":!0},Fee:{type:"object",properties:{id:{type:"string"},label:{type:"string"},kind:{anyOf:[{type:"string",enum:["surcharge","handling","gift_wrap","cod","payment","duty"]},{type:"string"}],description:"What sort of charge this is. `duty` is a customs duty on a cross-border order and is not taxed; the other kinds are. Extensions may register further kinds."},line_item_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","label","kind","line_item_id","fulfillment_id","amount","display_amount","metadata","created_at","updated_at"],"x-typelizer":!0},FreightSummaryLine:{type:"object",properties:{variant_id:{type:"string",nullable:!0},sku:{type:"string",nullable:!0},name:{type:"string",nullable:!0},units:{type:"number"},cartons:{type:"number",nullable:!0},pallets:{type:"number",nullable:!0},units_per_carton:{type:"number",nullable:!0},cartons_per_pallet:{type:"number",nullable:!0},complete:{type:"boolean"},weight_per_carton:{type:"string",nullable:!0},volume:{type:"string"},weight:{type:"string"}},required:["variant_id","sku","name","units","cartons","pallets","units_per_carton","cartons_per_pallet","complete","weight_per_carton","volume","weight"],"x-typelizer":!0},FreightSummary:{type:"object",properties:{total_units:{type:"number"},total_cartons:{type:"number"},total_pallets:{type:"number",nullable:!0},total_volume:{type:"string"},total_weight:{type:"string"},complete:{type:"boolean"},lines:{type:"array",items:{$ref:"#/components/schemas/FreightSummaryLine"}}},required:["total_units","total_cartons","total_pallets","total_volume","total_weight","complete","lines"],"x-typelizer":!0},FulfillmentItem:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},status:{anyOf:[{type:"string",enum:["on_hand","backordered","shipped","returned"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},variant_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},name:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0}},required:["id","quantity","status","variant_id","line_item_id","name","options_text"],"x-typelizer":!0},Fulfillment:{type:"object",properties:{id:{type:"string"},number:{type:"string"},tracking:{type:"string",nullable:!0},tracking_url:{type:"string",nullable:!0},pickup_point_data:{type:"object",nullable:!0},selected_delivery_rate_id:{type:"string",nullable:!0},unpriced:{type:"boolean"},cost:{type:"string"},display_cost:{type:"string"},total:{type:"string"},display_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},tax_total:{type:"string"},display_tax_total:{type:"string"},status:{anyOf:[{type:"string",enum:["unfulfilled","fulfilled","delivered","canceled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},fulfillment_type:{type:"string",enum:["shipping","digital","pickup","pickup_point"]},fulfilled_at:{type:"string",nullable:!0},delivered_at:{type:"string",nullable:!0},items:{type:"array",items:{$ref:"#/components/schemas/FulfillmentManifestItem"}},deliveries:{type:"array",items:{$ref:"#/components/schemas/Delivery"}},delivery_method:{$ref:"#/components/schemas/DeliveryMethod"},stock_location:{$ref:"#/components/schemas/StockLocation"},delivery_rates:{type:"array",items:{$ref:"#/components/schemas/DeliveryRate"}},tax_lines:{type:"array",items:{$ref:"#/components/schemas/TaxLine"}},metadata:{type:"object"},adjustment_total:{type:"string"},pre_tax_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},order_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},documents:{type:"object"},labels:{type:"array",items:{$ref:"#/components/schemas/ShippingLabel"}},provider_generates_labels:{type:"boolean"},fulfillment_items:{type:"array",items:{$ref:"#/components/schemas/FulfillmentItem"}},order:{$ref:"#/components/schemas/Order"}},required:["id","number","tracking","tracking_url","pickup_point_data","selected_delivery_rate_id","unpriced","cost","display_cost","total","display_total","discount_total","display_discount_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","tax_total","display_tax_total","status","fulfillment_type","fulfilled_at","delivered_at","items","deliveries","metadata","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id","documents","labels","provider_generates_labels"],"x-typelizer":!0},GiftCardBatch:{type:"object",properties:{id:{type:"string"},codes_count:{type:"number"},currency:{type:"string",nullable:!0},prefix:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0}},required:["id","codes_count","currency","prefix","created_at","updated_at","amount","expires_at","created_by_id"],"x-typelizer":!0},GiftCard:{type:"object",properties:{id:{type:"string"},code:{type:"string"},status:{anyOf:[{type:"string",enum:["active","partially_redeemed","redeemed","canceled","expired"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},currency:{type:"string"},amount:{type:"string"},amount_used:{type:"string"},amount_authorized:{type:"string"},amount_remaining:{type:"string"},display_amount:{type:"string"},display_amount_used:{type:"string"},display_amount_remaining:{type:"string"},expires_at:{type:"string",nullable:!0},redeemed_at:{type:"string",nullable:!0},expired:{type:"boolean"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},customer:{$ref:"#/components/schemas/Customer"},created_by:{$ref:"#/components/schemas/AdminUser"},gift_card_batch:{$ref:"#/components/schemas/GiftCardBatch"},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}}},required:["id","code","status","currency","amount","amount_used","amount_authorized","amount_remaining","display_amount","display_amount_used","display_amount_remaining","expires_at","redeemed_at","expired","active","created_at","updated_at","customer_id","created_by_id"],"x-typelizer":!0},ImportMapping:{type:"object",properties:{id:{type:"string"},schema_field:{type:"string"},file_column:{type:"string",nullable:!0},required:{type:"boolean"}},required:["id","schema_field","file_column","required"],"x-typelizer":!0},ImportRow:{type:"object",properties:{id:{type:"string"},row_number:{type:"number"},status:{anyOf:[{type:"string",enum:["pending","processing","completed","failed"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},validation_errors:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},import_id:{type:"string",nullable:!0},item_type:{type:"string",nullable:!0},item_id:{type:"string",nullable:!0},data:{type:"object"}},required:["id","row_number","status","validation_errors","created_at","updated_at","import_id","item_type","item_id","data"],"x-typelizer":!0},Import:{type:"object",properties:{id:{type:"string"},number:{type:"string"},rows_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",nullable:!0,description:"Import type. Built-in: products, product_translations, customers, price_list_prices. Extensions may register more."},status:{anyOf:[{type:"string",enum:["pending","mapping","completed_mapping","processing","completed","failed"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},store_id:{type:"string",nullable:!0},seller_id:{type:"string",nullable:!0},owner_type:{type:"string",nullable:!0},owner_id:{type:"string",nullable:!0},user_id:{type:"string",nullable:!0},processing_errors:{type:"string",nullable:!0},preferred_delimiter:{type:"string"},price_list_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},original_filename:{type:"string",nullable:!0},original_byte_size:{type:"number",nullable:!0},original_file_url:{type:"string",nullable:!0},completed_rows_count:{type:"number"},failed_rows_count:{type:"number"},schema_fields:{type:"array",items:{$ref:"#/components/schemas/ImportSchemaField"}},csv_headers:{type:"array",items:{type:"string"}},sample_row:{type:"object"},mappings:{type:"array",items:{$ref:"#/components/schemas/ImportMapping"}}},required:["id","number","rows_count","created_at","updated_at","type","status","store_id","seller_id","owner_type","owner_id","user_id","processing_errors","preferred_delimiter","price_list_id","seller_name","original_filename","original_byte_size","original_file_url","completed_rows_count","failed_rows_count","schema_fields","csv_headers","sample_row","mappings"],"x-typelizer":!0},Integration:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Integration type, registered by the provider gem that owns it (for example the EasyPost provider). Core ships none."},group:{type:"string",nullable:!0},preferences:{type:"object"},preference_schema:{type:"object"}},required:["id","name","active","created_at","updated_at","type","group","preferences","preference_schema"],"x-typelizer":!0},InvitationAcceptanceLink:{type:"object",properties:{id:{type:"string"},acceptance_url:{type:"string"}},required:["id","acceptance_url"],"x-typelizer":!0},Invitation:{type:"object",properties:{id:{type:"string"},email:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","accepted"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},created_at:{type:"string"},updated_at:{type:"string"},expires_at:{type:"string"},role_id:{type:"string"},role_name:{type:"string"},inviter_email:{type:"string"},invitee_exists:{type:"boolean"},store:{type:"object"}},required:["id","email","status","created_at","updated_at","expires_at","role_id","role_name","inviter_email","invitee_exists","store"],"x-typelizer":!0},LineItem:{type:"object",properties:{id:{type:"string"},variant_id:{type:"string"},seller_id:{type:"string",nullable:!0},preorder:{type:"boolean"},preorder_ships_at:{type:"string",nullable:!0},quantity:{type:"number"},currency:{type:"string"},name:{type:"string"},slug:{type:"string"},options_text:{type:"string"},price:{type:"string"},display_price:{type:"string"},total:{type:"string"},display_total:{type:"string"},adjustment_total:{type:"string"},display_adjustment_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},pre_tax_amount:{type:"string"},display_pre_tax_amount:{type:"string"},discounted_amount:{type:"string"},display_discounted_amount:{type:"string"},display_compare_at_amount:{type:"string",nullable:!0},compare_at_amount:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},digital_links:{type:"array",items:{$ref:"#/components/schemas/DigitalLink"}},tax_lines:{type:"array",items:{$ref:"#/components/schemas/TaxLine"}},metadata:{type:"object"},price_source:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},catalog_price:{type:"string",nullable:!0},price_list_id:{type:"string",nullable:!0},price_list_name:{type:"string",nullable:!0},catalog_id:{type:"string",nullable:!0},catalog_name:{type:"string",nullable:!0},cost_price:{type:"string",nullable:!0},tax_category_id:{type:"string",nullable:!0},variant:{$ref:"#/components/schemas/Variant"},tax_category:{$ref:"#/components/schemas/TaxCategory"}},required:["id","variant_id","seller_id","preorder","preorder_ships_at","quantity","currency","name","slug","options_text","price","display_price","total","display_total","adjustment_total","display_adjustment_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","discount_total","display_discount_total","pre_tax_amount","display_pre_tax_amount","discounted_amount","display_discounted_amount","display_compare_at_amount","compare_at_amount","thumbnail_url","option_values","digital_links","metadata","price_source","created_at","updated_at","catalog_price","price_list_id","price_list_name","catalog_id","catalog_name","cost_price","tax_category_id"],"x-typelizer":!0},Market:{type:"object",properties:{id:{type:"string"},name:{type:"string"},currency:{type:"string"},default_locale:{type:"string"},tax_inclusive:{type:"boolean"},default:{type:"boolean"},country_codes:{type:"array",items:{type:"string"}},country_isos:{type:"array",items:{type:"string"}},supported_locales:{type:"array",items:{type:"string"}},countries:{type:"array",items:{$ref:"#/components/schemas/Country"}},tax_provider:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","currency","default_locale","tax_inclusive","default","country_codes","country_isos","supported_locales","tax_provider","created_at","updated_at"],"x-typelizer":!0},Media:{type:"object",properties:{id:{type:"string"},product_id:{type:"string",nullable:!0},variant_ids:{type:"array",items:{type:"string"}},position:{type:"number"},alt:{type:"string",nullable:!0},media_type:{type:"string",enum:["image","video","external_video"]},focal_point_x:{type:"number",nullable:!0},focal_point_y:{type:"number",nullable:!0},external_video_url:{type:"string",nullable:!0},video_provider:{type:"string",nullable:!0},video_embed_url:{type:"string",nullable:!0},video_url:{type:"string",nullable:!0},poster_url:{type:"string",nullable:!0},original_url:{type:"string",nullable:!0},mini_url:{type:"string",nullable:!0},small_url:{type:"string",nullable:!0},medium_url:{type:"string",nullable:!0},large_url:{type:"string",nullable:!0},xlarge_url:{type:"string",nullable:!0},og_image_url:{type:"string",nullable:!0},external_references:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},attached:{type:"boolean"},filename:{type:"string",nullable:!0},content_type:{type:"string",nullable:!0},byte_size:{type:"number",nullable:!0},embed_url:{type:"string",nullable:!0},signed_id:{type:"string",nullable:!0},viewable_id:{type:"string",nullable:!0},download_url:{type:"string",nullable:!0},metadata:{type:"object"},viewable_type:{type:"string",nullable:!0}},required:["id","product_id","variant_ids","position","alt","media_type","focal_point_x","focal_point_y","external_video_url","video_provider","video_embed_url","video_url","poster_url","original_url","mini_url","small_url","medium_url","large_url","xlarge_url","og_image_url","external_references","created_at","updated_at","attached","filename","content_type","byte_size","embed_url","signed_id","viewable_id","download_url","metadata","viewable_type"],"x-typelizer":!0},MembershipProduct:{type:"object",properties:{id:{type:"string"},name:{type:"string"},thumbnail_url:{type:"string",nullable:!0}},required:["id","name","thumbnail_url"],"x-typelizer":!0},NewsletterSubscriber:{type:"object",properties:{id:{type:"string"},email:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},verified:{type:"boolean"},verified_at:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0}},required:["id","email","created_at","updated_at","verified","verified_at","customer_id"],"x-typelizer":!0},OptionType:{type:"object",properties:{id:{type:"string"},name:{type:"string"},label:{type:"string"},position:{type:"number"},kind:{type:"string",enum:["dropdown","color_swatch","buttons"]},translations:{type:"object"},metadata:{type:"object"},filterable:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}}},required:["id","name","label","position","kind","metadata","filterable","created_at","updated_at"],"x-typelizer":!0},OptionValue:{type:"object",properties:{id:{type:"string"},option_type_id:{type:"string"},name:{type:"string"},label:{type:"string"},position:{type:"number"},color_code:{type:"string",nullable:!0},option_type_name:{type:"string"},option_type_label:{type:"string"},image_url:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},option_type:{$ref:"#/components/schemas/OptionType"}},required:["id","option_type_id","name","label","position","color_code","option_type_name","option_type_label","image_url","metadata","created_at","updated_at"],"x-typelizer":!0},OrderCancellationReason:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},can_be_deleted:{type:"boolean"}},required:["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":!0},OrderGroup:{type:"object",properties:{id:{type:"string"},number:{type:"string"},email:{type:"string",nullable:!0},currency:{type:"string"},total:{type:"string",nullable:!0},display_total:{type:"string",nullable:!0},item_total:{type:"string",nullable:!0},display_item_total:{type:"string",nullable:!0},fulfillment_status:{type:"string",nullable:!0,enum:["backorder","canceled","partial","unfulfilled","fulfilled","delivered","pending","ready","shipped"]},payment_status:{type:"string",nullable:!0,enum:["none","authorized","partially_paid","paid","partially_refunded","refunded","overcharged","voided"]},completed_at:{type:"string",nullable:!0},billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}},customer_id:{type:"string",nullable:!0},cart_id:{type:"string",nullable:!0},seller_count:{type:"number"},includes_first_party:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},payments:{type:"array",items:{$ref:"#/components/schemas/Payment"}}},required:["id","number","email","currency","total","display_total","item_total","display_item_total","fulfillment_status","payment_status","completed_at","billing_address","shipping_address","orders","customer_id","cart_id","seller_count","includes_first_party","created_at","updated_at","payments"],"x-typelizer":!0},OrderRoutingRule:{type:"object",properties:{id:{type:"string"},position:{type:"number"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: preferred_location, default_location, minimize_splits. Extensions may register more."},channel_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"object"}},required:["id","position","active","created_at","updated_at","type","channel_id","preferences","preference_schema"],"x-typelizer":!0},Order:{type:"object",properties:{id:{type:"string"},market_id:{type:"string",nullable:!0},withdrawal_period_ends_at:{type:"string",nullable:!0},within_withdrawal_period:{type:"boolean"},cart_id:{type:"string",nullable:!0},channel_id:{type:"string",nullable:!0},company_id:{type:"string",nullable:!0},company_name:{type:"string",nullable:!0},po_document_filename:{type:"string",nullable:!0},po_document_byte_size:{type:"number",nullable:!0},number:{type:"string"},email:{type:"string"},customer_note:{type:"string",nullable:!0},po_number:{type:"string",nullable:!0},currency:{type:"string"},locale:{type:"string",nullable:!0},total_quantity:{type:"number"},coupon_code:{type:"string",nullable:!0},fulfillment_status:{type:"string",nullable:!0,enum:["backorder","canceled","partial","unfulfilled","fulfilled","delivered","pending","ready","shipped"]},payment_status:{type:"string",nullable:!0,enum:["none","authorized","partially_paid","paid","partially_refunded","refunded","overcharged","voided"]},completed_at:{type:"string",nullable:!0},item_total:{type:"string"},display_item_total:{type:"string"},adjustment_total:{type:"string"},display_adjustment_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},tax_total:{type:"string"},display_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},total:{type:"string"},display_total:{type:"string"},gift_card_total:{type:"string"},display_gift_card_total:{type:"string"},amount_due:{type:"string"},display_amount_due:{type:"string"},delivery_total:{type:"string"},display_delivery_total:{type:"string"},fee_total:{type:"string"},display_fee_total:{type:"string"},store_credit_total:{type:"string"},display_store_credit_total:{type:"string"},covered_by_store_credit:{type:"boolean"},items:{type:"array",items:{$ref:"#/components/schemas/LineItem"}},fulfillments:{type:"array",items:{$ref:"#/components/schemas/Fulfillment"}},payments:{type:"array",items:{$ref:"#/components/schemas/Payment"}},billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},gift_card:{allOf:[{$ref:"#/components/schemas/GiftCard"}],nullable:!0},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0},external_references:{type:"object"},status:{type:"string",enum:["draft","placed","canceled"]},last_ip_address:{type:"string",nullable:!0},considered_risky:{type:"boolean"},confirmation_delivered:{type:"boolean"},store_owner_notification_delivered:{type:"boolean"},payment_total:{type:"string"},display_payment_total:{type:"string"},metadata:{type:"object"},cancel_note:{type:"string",nullable:!0},commission_amount_total:{type:"string"},display_commission_amount_total:{type:"string"},commission_tax_total:{type:"string"},display_commission_tax_total:{type:"string"},commission_total:{type:"string"},display_commission_total:{type:"string"},canceled_at:{type:"string",nullable:!0},approved_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},preferred_stock_location_id:{type:"string",nullable:!0},po_document_url:{type:"string",nullable:!0},seller_id:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"},order_group_id:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},internal_note:{type:"string",nullable:!0},internal_note_html:{type:"string",nullable:!0},approver_id:{type:"string",nullable:!0},approver_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},approver:{$ref:"#/components/schemas/Actor"},canceler_id:{type:"string",nullable:!0},canceler_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},canceler:{$ref:"#/components/schemas/Actor"},created_by_id:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by:{$ref:"#/components/schemas/Actor"},cancel_reason_id:{type:"string",nullable:!0},cancel_reason_name:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0},applied_promotions:{type:"array",items:{$ref:"#/components/schemas/AppliedPromotion"}},payment_splits:{type:"array",items:{$ref:"#/components/schemas/PaymentSplit"}},cart:{$ref:"#/components/schemas/Cart"},channel:{$ref:"#/components/schemas/Channel"},preferred_stock_location:{$ref:"#/components/schemas/StockLocation"},payment_methods:{type:"array",items:{$ref:"#/components/schemas/PaymentMethod"}},customer:{$ref:"#/components/schemas/Customer"},cancel_reason:{$ref:"#/components/schemas/OrderCancellationReason"},returns:{type:"array",items:{$ref:"#/components/schemas/Return"}},exchanges:{type:"array",items:{$ref:"#/components/schemas/Exchange"}},claims:{type:"array",items:{$ref:"#/components/schemas/Claim"}},freight_summary:{allOf:[{$ref:"#/components/schemas/FreightSummary"}],nullable:!0}},required:["id","market_id","withdrawal_period_ends_at","within_withdrawal_period","cart_id","channel_id","company_id","company_name","po_document_filename","po_document_byte_size","number","email","customer_note","po_number","currency","locale","total_quantity","coupon_code","fulfillment_status","payment_status","completed_at","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fee_total","display_fee_total","store_credit_total","display_store_credit_total","covered_by_store_credit","gift_card","market","external_references","status","last_ip_address","considered_risky","confirmation_delivered","store_owner_notification_delivered","payment_total","display_payment_total","metadata","cancel_note","commission_amount_total","display_commission_amount_total","commission_tax_total","display_commission_tax_total","commission_total","display_commission_total","canceled_at","approved_at","created_at","updated_at","preferred_stock_location_id","po_document_url","seller_id","order_group_id","tags","internal_note","internal_note_html","approver_id","approver_type","canceler_id","canceler_type","created_by_id","created_by_type","cancel_reason_id","cancel_reason_name","customer_id","freight_summary"],"x-typelizer":!0},PackageType:{type:"object",properties:{id:{type:"string"},name:{type:"string"},kind:{type:"string",enum:["box","envelope","carton","pallet","container"]},length:{type:"string",nullable:!0},width:{type:"string",nullable:!0},height:{type:"string",nullable:!0},weight:{type:"string",nullable:!0},max_weight:{type:"string",nullable:!0},default:{type:"boolean"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},dimensions_unit:{type:"string",enum:["mm","cm","in","ft"]},weight_unit:{type:"string",enum:["g","kg","lb","oz"]},volume:{type:"string",nullable:!0},seller_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0}},required:["id","name","kind","length","width","height","weight","max_weight","default","metadata","created_at","updated_at","dimensions_unit","weight_unit","volume","seller_id","seller_name"],"x-typelizer":!0},PaymentMethod:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},type:{type:"string",description:"Payment method type. Built-in: check, store_credit, custom_payment_source_method, bogus (test only); payment provider gems register their own, for example stripe."},session_required:{type:"boolean"},source_required:{type:"boolean"},metadata:{type:"object"},active:{type:"boolean"},auto_capture:{type:"boolean",nullable:!0},capture_method:{type:"string",enum:["checkout","on_dispatch","manual"],nullable:!0},resolved_capture_method:{type:"string",enum:["checkout","on_dispatch","manual"]},storefront_visible:{type:"boolean"},position:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},preferences:{type:"object"},preference_schema:{type:"object"}},required:["id","name","description","type","session_required","source_required","metadata","active","auto_capture","capture_method","resolved_capture_method","storefront_visible","position","created_at","updated_at","preferences","preference_schema"],"x-typelizer":!0},Payment:{type:"object",properties:{id:{type:"string"},payment_method_id:{type:"string"},response_code:{type:"string",nullable:!0},number:{type:"string"},status:{anyOf:[{type:"string",enum:["checkout","processing","pending","completed","failed","void","invalid"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},amount:{type:"string"},display_amount:{type:"string"},source_type:{type:"string",nullable:!0,enum:["credit_card","store_credit","payment_source"]},source_id:{type:"string",nullable:!0},source:{anyOf:[{$ref:"#/components/schemas/CreditCard"},{$ref:"#/components/schemas/StoreCredit"},{$ref:"#/components/schemas/PaymentSource"}],nullable:!0},payment_method:{$ref:"#/components/schemas/PaymentMethod"},metadata:{type:"object"},avs_response:{type:"string",nullable:!0},cvv_response_code:{type:"string",nullable:!0},cvv_response_message:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},captured_amount:{type:"string"},order_id:{type:"string",nullable:!0},order:{$ref:"#/components/schemas/Order"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}},payment_splits:{type:"array",items:{$ref:"#/components/schemas/PaymentSplit"}}},required:["id","payment_method_id","response_code","number","status","amount","display_amount","source_type","source_id","source","metadata","avs_response","cvv_response_code","cvv_response_message","created_at","updated_at","captured_amount","order_id"],"x-typelizer":!0},PaymentSource:{type:"object",properties:{id:{type:"string"},gateway_payment_profile_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","gateway_payment_profile_id","metadata","created_at","updated_at"],"x-typelizer":!0},PaymentSplit:{type:"object",properties:{id:{type:"string"},currency:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},authorized_amount:{type:"string"},display_authorized_amount:{type:"string"},captured_amount:{type:"string"},display_captured_amount:{type:"string"},refunded_amount:{type:"string"},display_refunded_amount:{type:"string"},claimed_amount:{type:"string"},display_claimed_amount:{type:"string"},net_captured_amount:{type:"string"},display_net_captured_amount:{type:"string"},refundable_amount:{type:"string"},display_refundable_amount:{type:"string"},payment_id:{type:"string"},payment_number:{type:"string",nullable:!0},order_id:{type:"string"},order_number:{type:"string",nullable:!0}},required:["id","currency","created_at","updated_at","authorized_amount","display_authorized_amount","captured_amount","display_captured_amount","refunded_amount","display_refunded_amount","claimed_amount","display_claimed_amount","net_captured_amount","display_net_captured_amount","refundable_amount","display_refundable_amount","payment_id","payment_number","order_id","order_number"],"x-typelizer":!0},Permission:{type:"object",properties:{key:{type:"string"},resource:{type:"string"},kind:{type:"string",enum:["read","write"]},group:{type:"string"},group_label:{type:"string"},label:{type:"string"},description:{type:"string"}},required:["key","resource","kind","group","group_label","label","description"],"x-typelizer":!0},Policy:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},body:{type:"string",nullable:!0},body_html:{type:"string",nullable:!0},updated_at:{type:"string"},created_at:{type:"string"}},required:["id","name","slug","body","body_html","updated_at","created_at"],"x-typelizer":!0},PriceAdjustmentTier:{type:"object",properties:{id:{type:"string"},min_quantity:{type:"number"},percentage:{type:"string"}},required:["id","min_quantity","percentage"],"x-typelizer":!0},PriceHistory:{type:"object",properties:{id:{type:"string"},amount:{type:"string"},amount_in_cents:{type:"number"},currency:{type:"string"},display_amount:{type:"string"},recorded_at:{type:"string"},variant_id:{type:"string"},price_id:{type:"string"},compare_at_amount:{type:"string",nullable:!0},created_at:{type:"string"}},required:["id","amount","amount_in_cents","currency","display_amount","recorded_at","variant_id","price_id","compare_at_amount","created_at"],"x-typelizer":!0},PriceListProduct:{type:"object",properties:{id:{type:"string"},name:{type:"string"},thumbnail_url:{type:"string",nullable:!0},price_list_variants:{type:"array",items:{$ref:"#/components/schemas/CatalogPrice"}}},required:["id","name","thumbnail_url"],"x-typelizer":!0},PriceList:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},status:{anyOf:[{type:"string",enum:["draft","active","inactive","scheduled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},position:{type:"number"},match_policy:{type:"string",enum:["all","any"]},adjust_compare_at:{type:"boolean"},starts_at:{type:"string",nullable:!0},ends_at:{type:"string",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},price_adjustment_percentage:{type:"string",nullable:!0},automatic_pricing:{type:"boolean"},currently_active:{type:"boolean"},products_count:{type:"number"},prices_count:{type:"number"},price_adjustment_tiers:{type:"array",items:{$ref:"#/components/schemas/PriceAdjustmentTier"}},price_rules:{type:"array",items:{$ref:"#/components/schemas/PriceRule"}}},required:["id","name","description","status","position","match_policy","adjust_compare_at","starts_at","ends_at","deleted_at","created_at","updated_at","price_adjustment_percentage","automatic_pricing","currently_active","products_count","prices_count","price_adjustment_tiers"],"x-typelizer":!0},PriceRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: channel_rule, customer_group_rule, market_rule, user_rule, volume_rule, zone_rule. Extensions may register more."},price_list_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},markets:{type:"array",items:{$ref:"#/components/schemas/Market"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},channels:{type:"array",items:{$ref:"#/components/schemas/Channel"}},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}}},required:["id","created_at","updated_at","type","price_list_id","preferences","preference_schema"],"x-typelizer":!0},Price:{type:"object",properties:{id:{type:"string"},amount:{type:"string",nullable:!0},amount_in_cents:{type:"number",nullable:!0},compare_at_amount:{type:"string",nullable:!0},compare_at_amount_in_cents:{type:"number",nullable:!0},currency:{type:"string",nullable:!0},display_amount:{type:"string",nullable:!0},display_compare_at_amount:{type:"string",nullable:!0},price_list_id:{type:"string",nullable:!0},min_quantity:{type:"number"},variant_id:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},variant:{$ref:"#/components/schemas/Variant"}},required:["id","amount","amount_in_cents","compare_at_amount","compare_at_amount_in_cents","currency","display_amount","display_compare_at_amount","price_list_id","min_quantity","variant_id","created_at","updated_at"],"x-typelizer":!0},ProductPublication:{type:"object",properties:{id:{type:"string"},published_at:{type:"string",nullable:!0},unpublished_at:{type:"string",nullable:!0},product_id:{type:"string"},channel_id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","published_at","unpublished_at","product_id","channel_id","created_at","updated_at"],"x-typelizer":!0},Product:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},variant_count:{type:"number"},available_on:{type:"string",nullable:!0},preorder_ships_at:{type:"string",nullable:!0},purchasable:{type:"boolean"},preorder:{type:"boolean"},in_stock:{type:"boolean"},backorderable:{type:"boolean"},available:{type:"boolean"},description:{type:"string",nullable:!0},description_html:{type:"string",nullable:!0},default_variant_id:{type:"string"},buy_box_variant_id:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},original_price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},seller_id:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"},primary_media:{$ref:"#/components/schemas/Media"},media:{type:"array",items:{$ref:"#/components/schemas/Media"}},variants:{type:"array",items:{$ref:"#/components/schemas/Variant"}},default_variant:{$ref:"#/components/schemas/Variant"},option_types:{type:"array",items:{$ref:"#/components/schemas/OptionType"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},prior_price:{allOf:[{$ref:"#/components/schemas/PriceHistory"}],nullable:!0},external_references:{type:"object"},translations:{type:"object"},status:{anyOf:[{type:"string",enum:["draft","active","archived","proposed","rejected"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},metadata:{type:"object"},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},delivery_profile_id:{type:"string",nullable:!0},submission:{allOf:[{$ref:"#/components/schemas/ProductSubmission"}],nullable:!0},seller_name:{type:"string",nullable:!0},product_type_id:{type:"string",nullable:!0},tax_category_id:{type:"string",nullable:!0},digital_assets:{type:"array",items:{$ref:"#/components/schemas/DigitalAsset"}},collections:{type:"array",items:{$ref:"#/components/schemas/Collection"}},product_publications:{type:"array",items:{$ref:"#/components/schemas/ProductPublication"}},channels:{type:"array",items:{$ref:"#/components/schemas/Channel"}},product_type:{$ref:"#/components/schemas/ProductType"}},required:["id","name","slug","meta_title","meta_description","meta_keywords","variant_count","available_on","preorder_ships_at","purchasable","preorder","in_stock","backorderable","available","description","description_html","default_variant_id","buy_box_variant_id","thumbnail_url","tags","price","original_price","seller_id","external_references","status","metadata","deleted_at","created_at","updated_at","delivery_profile_id","seller_name","product_type_id","tax_category_id"],"x-typelizer":!0},ProductSubmission:{type:"object",properties:{id:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","approved","rejected","withdrawn"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},review_note:{type:"string",nullable:!0},reviewed_at:{type:"string",nullable:!0},created_at:{type:"string"},product_id:{type:"string"},metadata:{type:"object",nullable:!0},updated_at:{type:"string"},submitted_by_id:{type:"string",nullable:!0},reviewed_by_id:{type:"string",nullable:!0},reviewed_by_name:{type:"string",nullable:!0},auto_approved:{type:"boolean"}},required:["id","status","review_note","reviewed_at","created_at","product_id","metadata","updated_at","submitted_by_id","reviewed_by_id","reviewed_by_name","auto_approved"],"x-typelizer":!0},ProductTypeCustomFieldDefinition:{type:"object",properties:{id:{type:"string"},key:{type:"string"},namespace:{type:"string"},label:{type:"string"},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},required:{type:"boolean"},sort_order:{type:"number"}},required:["id","key","namespace","label","field_type","required","sort_order"],"x-typelizer":!0},ProductType:{type:"object",properties:{id:{type:"string"},name:{type:"string"},translations:{type:"object"},products_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},delivery_profile_id:{type:"string",nullable:!0},option_type_ids:{type:"array",items:{type:"string"}},category_ids:{type:"array",items:{type:"string"}},custom_field_definitions:{type:"array",items:{$ref:"#/components/schemas/ProductTypeCustomFieldDefinition"}}},required:["id","name","products_count","created_at","updated_at","delivery_profile_id","option_type_ids","category_ids","custom_field_definitions"],"x-typelizer":!0},PromotionAction:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Action type. Built-in: create_adjustment, create_item_adjustments, create_line_items, free_shipping. Extensions may register more."},promotion_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},calculator:{allOf:[{$ref:"#/components/schemas/PromotionActionCalculator"}],nullable:!0},line_items:{type:"array",items:{$ref:"#/components/schemas/PromotionActionLineItem"},nullable:!0}},required:["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","calculator","line_items"],"x-typelizer":!0},PromotionRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string",description:"Rule type. Built-in: currency, country, channel, market, item_total, product, customer, customer_group, first_order, customer_logged_in, one_use_per_user, category, option_value. Extensions may register more."},promotion_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},product_ids:{type:"array",items:{type:"string"},nullable:!0},category_ids:{type:"array",items:{type:"string"},nullable:!0},customer_ids:{type:"array",items:{type:"string"},nullable:!0},option_value_ids:{type:"array",items:{type:"string"},nullable:!0},products:{type:"array",items:{$ref:"#/components/schemas/Product"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},countries:{type:"array",items:{$ref:"#/components/schemas/Country"}},channels:{type:"array",items:{$ref:"#/components/schemas/Channel"}},markets:{type:"array",items:{$ref:"#/components/schemas/Market"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}}},required:["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","product_ids","category_ids","customer_ids","option_value_ids"],"x-typelizer":!0},Promotion:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},code:{type:"string",nullable:!0},starts_at:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},usage_limit:{type:"number",nullable:!0},match_policy:{type:"string",enum:["all","any"]},path:{type:"string",nullable:!0},kind:{type:"string",enum:["coupon_code","automatic"]},multi_codes:{type:"boolean"},number_of_codes:{type:"number",nullable:!0},code_prefix:{type:"string",nullable:!0},promotion_category_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},action_ids:{type:"array",items:{type:"string"}},rule_ids:{type:"array",items:{type:"string"}}},required:["id","name","description","code","starts_at","expires_at","usage_limit","match_policy","path","kind","multi_codes","number_of_codes","code_prefix","promotion_category_id","metadata","created_at","updated_at","action_ids","rule_ids"],"x-typelizer":!0},PurchaseOrderItem:{type:"object",properties:{id:{type:"string"},quantity_ordered:{type:"number"},quantity_received:{type:"number"},quantity_rejected:{type:"number"},quantity_over:{type:"number"},outstanding:{type:"number"},currency:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},unit_cost:{type:"string"},total_cost:{type:"string"},display_unit_cost:{type:"string"},display_total_cost:{type:"string"},purchase_order_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},product_id:{type:"string",nullable:!0},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0}},required:["id","quantity_ordered","quantity_received","quantity_rejected","quantity_over","outstanding","currency","created_at","updated_at","unit_cost","total_cost","display_unit_cost","display_total_cost","purchase_order_id","variant_id","product_id","variant_name","variant_sku","options_text","thumbnail_url"],"x-typelizer":!0},PurchaseOrder:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{type:"string"},currency:{type:"string"},reference:{type:"string",nullable:!0},notes:{type:"string",nullable:!0},metadata:{type:"object"},close_reason:{type:"string",nullable:!0},items_count:{type:"number"},quantity_received_total:{type:"number"},quantity_rejected_total:{type:"number"},ordered_at:{type:"string",nullable:!0},received_at:{type:"string",nullable:!0},closed_short_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},expected_at:{type:"string",nullable:!0},cancel_by:{type:"string",nullable:!0},closed_short:{type:"boolean"},quantity_ordered_total:{type:"number"},editable:{type:"boolean"},subtotal:{type:"string"},display_subtotal:{type:"string"},supplier_id:{type:"string",nullable:!0},destination_location_id:{type:"string",nullable:!0},items:{type:"array",items:{$ref:"#/components/schemas/PurchaseOrderItem"}},stock_receipts:{type:"array",items:{$ref:"#/components/schemas/StockReceipt"}},supplier:{$ref:"#/components/schemas/Supplier"},destination_location:{$ref:"#/components/schemas/StockLocation"}},required:["id","number","status","currency","reference","notes","metadata","close_reason","items_count","quantity_received_total","quantity_rejected_total","ordered_at","received_at","closed_short_at","created_at","updated_at","expected_at","cancel_by","closed_short","quantity_ordered_total","editable","subtotal","display_subtotal","supplier_id","destination_location_id"],"x-typelizer":!0},RefundReason:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},can_be_deleted:{type:"boolean"}},required:["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":!0},Refund:{type:"object",properties:{id:{type:"string"},transaction_id:{type:"string",nullable:!0},amount:{type:"string",nullable:!0},payment_id:{type:"string",nullable:!0},refund_reason_id:{type:"string",nullable:!0},originator_id:{type:"string",nullable:!0},originator_type:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},refunder_id:{type:"string",nullable:!0},refunder_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},refunder:{$ref:"#/components/schemas/Actor"},payment:{$ref:"#/components/schemas/Payment"}},required:["id","transaction_id","amount","payment_id","refund_reason_id","originator_id","originator_type","metadata","created_at","updated_at","refunder_id","refunder_type"],"x-typelizer":!0},ReturnLineItem:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},received_quantity:{type:"number"},resellable:{type:"boolean"},pre_tax_amount:{type:"string"},display_pre_tax_amount:{type:"string"},variant_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},fulfillment_item_id:{type:"string",nullable:!0},variant:{$ref:"#/components/schemas/Variant"},created_at:{type:"string"},updated_at:{type:"string"},line_item:{$ref:"#/components/schemas/LineItem"}},required:["id","quantity","received_quantity","resellable","pre_tax_amount","display_pre_tax_amount","variant_id","line_item_id","fulfillment_item_id","created_at","updated_at"],"x-typelizer":!0},ReturnReason:{type:"object",properties:{id:{type:"string"},name:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},can_be_deleted:{type:"boolean"}},required:["id","name","active","created_at","updated_at","can_be_deleted"],"x-typelizer":!0},Return:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{anyOf:[{type:"string",enum:["requested","approved","received","refunded","canceled"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},order_id:{type:"string",nullable:!0},reason_id:{type:"string",nullable:!0},refund_total:{type:"string"},display_refund_total:{type:"string"},approved_at:{type:"string",nullable:!0},received_at:{type:"string",nullable:!0},refunded_at:{type:"string",nullable:!0},canceled_at:{type:"string",nullable:!0},reason:{$ref:"#/components/schemas/ReturnReason"},return_line_items:{type:"array",items:{$ref:"#/components/schemas/ReturnLineItem"}},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},stock_location_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},created_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},created_by:{$ref:"#/components/schemas/Actor"},refunded_total:{type:"string"},refundable_total:{type:"string"},order:{$ref:"#/components/schemas/Order"},stock_location:{$ref:"#/components/schemas/StockLocation"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}},documents:{type:"object"},labels:{type:"array",items:{$ref:"#/components/schemas/ShippingLabel"}},deliveries:{type:"array",items:{$ref:"#/components/schemas/Delivery"}}},required:["id","number","status","order_id","reason_id","refund_total","display_refund_total","approved_at","received_at","refunded_at","canceled_at","memo","metadata","created_at","updated_at","stock_location_id","created_by_id","created_by_type","refunded_total","refundable_total","documents","labels","deliveries"],"x-typelizer":!0},Role:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},permissions:{type:"array",items:{type:"string"}},mutable:{type:"boolean"},users_count:{type:"number"}},required:["id","name","description","created_at","updated_at","permissions","mutable","users_count"],"x-typelizer":!0},SavedReport:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},query:{type:"object"},seeded:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},user_id:{type:"string",nullable:!0},author_name:{type:"string",nullable:!0}},required:["id","name","description","query","seeded","created_at","updated_at","user_id","author_name"],"x-typelizer":!0},SellerBalance:{type:"object",properties:{currency:{type:"string"},settlement_currency:{type:"string"},converted:{type:"boolean"},seller_id:{type:"string"},earned:{type:"string"},display_earned:{type:"string"},payable:{type:"string"},display_payable:{type:"string"},paid:{type:"string"},display_paid:{type:"string"},balance:{type:"string"},display_balance:{type:"string"},pending:{type:"string"},display_pending:{type:"string"}},required:["currency","settlement_currency","converted","seller_id","earned","display_earned","payable","display_payable","paid","display_paid","balance","display_balance","pending","display_pending"],"x-typelizer":!0},SellerPayout:{type:"object",properties:{id:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","processing","completed","failed","unresolved"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},currency:{type:"string"},provider:{type:"string",description:"Payout provider class name. Built-in: Spree::PayoutProvider::System. Provider gems register more."},reference:{type:"string",nullable:!0},metadata:{type:"object"},period_start:{type:"string",nullable:!0},period_end:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string"},display_amount:{type:"string"},seller_id:{type:"string"},seller_name:{type:"string",nullable:!0},transfers_count:{type:"number"}},required:["id","status","currency","provider","reference","metadata","period_start","period_end","created_at","updated_at","amount","display_amount","seller_id","seller_name","transfers_count"],"x-typelizer":!0},SellerRequirement:{type:"object",properties:{id:{type:"string"},position:{type:"number"},active:{type:"boolean"},required:{type:"boolean"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},kind:{type:"string",description:"Requirement kind. Built-in: accept_terms, complete_profile, billing_address, returns_address, delivery_method, package_type, minimum_products, payout_account, required_custom_fields, policy, attestation, operator_review, document. Extensions may register more."},name:{type:"string"},description:{type:"string",nullable:!0},preferences:{type:"object"},custom_field_definition_ids:{type:"array",items:{type:"string"}},allow_multiple:{type:"boolean"},accepts_submissions:{type:"boolean"},reviewed_by_operator:{type:"boolean"}},required:["id","position","active","required","metadata","created_at","updated_at","kind","name","description","preferences","custom_field_definition_ids","allow_multiple","accepts_submissions","reviewed_by_operator"],"x-typelizer":!0},SellerRequirementStatus:{type:"object",properties:{id:{type:"string"},kind:{type:"string",description:"Requirement kind. Built-in: accept_terms, complete_profile, billing_address, returns_address, delivery_method, package_type, minimum_products, payout_account, required_custom_fields, policy, attestation, operator_review, document. Extensions may register more."},name:{type:"string"},description:{type:"string",nullable:!0},required:{type:"boolean"},position:{type:"number"},status:{type:"string",enum:["complete","incomplete","pending","rejected"]},action_url:{type:"string",nullable:!0},blocker:{type:"object",nullable:!0},blocking:{type:"boolean"},required_policy_name:{type:"string",nullable:!0},submission:{$ref:"#/components/schemas/SellerRequirementSubmission"},published_policy:{$ref:"#/components/schemas/Policy"}},required:["id","kind","name","description","required","position","status","action_url","blocker","blocking","required_policy_name"],"x-typelizer":!0},SellerRequirementSubmission:{type:"object",properties:{id:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","accepted","rejected","waived"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},note:{type:"string",nullable:!0},review_note:{type:"string",nullable:!0},reference:{type:"string",nullable:!0},metadata:{type:"object",nullable:!0},reviewed_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},seller_id:{type:"string"},requirement_id:{type:"string"},requirement_name:{type:"string"},file_url:{type:"string",nullable:!0},file_name:{type:"string",nullable:!0}},required:["id","status","note","review_note","reference","metadata","reviewed_at","created_at","updated_at","seller_id","requirement_id","requirement_name","file_url","file_name"],"x-typelizer":!0},Seller:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},about:{type:"string"},about_html:{type:"string"},logo_url:{type:"string",nullable:!0},square_logo_url:{type:"string",nullable:!0},cover_photo_url:{type:"string",nullable:!0},status:{anyOf:[{type:"string",enum:["pending","invited","canceled","onboarding","ready_for_review","approved","rejected","suspended"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},contact_email:{type:"string",nullable:!0},billing_email:{type:"string",nullable:!0},tax_remittance:{type:"string"},payouts_schedule_interval:{type:"string",nullable:!0},metadata:{type:"object",nullable:!0},holiday_mode_until:{type:"string",nullable:!0},terms_accepted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},deleted_at:{type:"string",nullable:!0},minimum_payout_amount:{type:"string",nullable:!0},on_holiday:{type:"boolean"},sellable:{type:"boolean"},products_count:{type:"number"},users_count:{type:"number"},onboarding_progress:{type:"object"},onboarding_complete:{type:"boolean"},legal_name:{type:"string",nullable:!0},registration_number:{type:"string",nullable:!0},billing_address:{$ref:"#/components/schemas/Address"},returns_address:{$ref:"#/components/schemas/Address"}},required:["id","name","slug","about","about_html","logo_url","square_logo_url","cover_photo_url","status","contact_email","billing_email","tax_remittance","payouts_schedule_interval","metadata","holiday_mode_until","terms_accepted_at","created_at","updated_at","deleted_at","minimum_payout_amount","on_holiday","sellable","products_count","users_count","onboarding_progress","onboarding_complete","legal_name","registration_number"],"x-typelizer":!0},SellerTeamMember:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},avatar_url:{type:"string",nullable:!0}},required:["id","email","first_name","last_name","full_name","created_at","updated_at","avatar_url"],"x-typelizer":!0},SellerTransfer:{type:"object",properties:{id:{type:"string"},kind:{type:"string",enum:["earning","refund_reversal"]},status:{anyOf:[{type:"string",enum:["pending","processing","completed","failed","unresolved"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},currency:{type:"string"},provider:{type:"string",description:"Payout provider class name. Built-in: Spree::PayoutProvider::System. Provider gems register more."},reference:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string"},display_amount:{type:"string"},settled_amount:{type:"string",nullable:!0},settled_currency:{type:"string",nullable:!0},converted:{type:"boolean"},seller_id:{type:"string"},order_id:{type:"string",nullable:!0},payout_id:{type:"string",nullable:!0},reversed_from_id:{type:"string",nullable:!0},refund_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},order_number:{type:"string",nullable:!0}},required:["id","kind","status","currency","provider","reference","metadata","created_at","updated_at","amount","display_amount","settled_amount","settled_currency","converted","seller_id","order_id","payout_id","reversed_from_id","refund_id","seller_name","order_number"],"x-typelizer":!0},SetupTask:{type:"object",properties:{name:{type:"string"},done:{type:"boolean"}},required:["name","done"],"x-typelizer":!0},ShippingLabel:{type:"object",properties:{id:{type:"string"},source:{type:"string",enum:["purchased","uploaded"]},status:{anyOf:[{type:"string",enum:["purchased","refund_requested","refunded"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},carrier:{type:"string",nullable:!0},carrier_name:{type:"string",nullable:!0},service:{type:"string",nullable:!0},tracking_number:{type:"string",nullable:!0},currency:{type:"string",nullable:!0},format:{type:"string",nullable:!0},external_id:{type:"string",nullable:!0},metadata:{type:"object"},refunded_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},owner_id:{type:"string"},owner_type:{type:"string",enum:["Spree::Fulfillment","Spree::Return"]},cost:{type:"string"},display_cost:{type:"string"},integration_id:{type:"string",nullable:!0},file_pending:{type:"boolean"},download_url:{type:"string",nullable:!0}},required:["id","source","status","carrier","carrier_name","service","tracking_number","currency","format","external_id","metadata","refunded_at","created_at","updated_at","owner_id","owner_type","cost","display_cost","integration_id","file_pending","download_url"],"x-typelizer":!0},State:{type:"object",properties:{abbr:{type:"string"},name:{type:"string"}},required:["abbr","name"],"x-typelizer":!0},StockLevel:{type:"object",properties:{id:{type:"string"},count_on_hand:{type:"number"},backorderable:{type:"boolean"},stock_location_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},external_references:{type:"object"},metadata:{type:"object"},reserved_count:{type:"number"},incoming_count:{type:"number"},purchasable_count:{type:"number"},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},stock_location_name:{type:"string",nullable:!0},product_id:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},allocated_count:{type:"number"},available_count:{type:"number"},stock_location:{$ref:"#/components/schemas/StockLocation"},variant:{$ref:"#/components/schemas/Variant"}},required:["id","count_on_hand","backorderable","stock_location_id","variant_id","external_references","metadata","reserved_count","incoming_count","purchasable_count","variant_name","variant_sku","created_at","updated_at","stock_location_name","product_id","options_text","thumbnail_url","allocated_count","available_count"],"x-typelizer":!0},StockLocation:{type:"object",properties:{id:{type:"string"},name:{type:"string"},address1:{type:"string",nullable:!0},city:{type:"string",nullable:!0},zipcode:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},country_name:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},state_text:{type:"string",nullable:!0},pickup_ready_in_minutes:{type:"number",nullable:!0},pickup_instructions:{type:"string",nullable:!0},external_references:{type:"object"},admin_name:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},state_name:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},company:{type:"string",nullable:!0},active:{type:"boolean"},default:{type:"boolean"},backorderable_default:{type:"boolean"},propagate_all_variants:{type:"boolean"},kind:{anyOf:[{type:"string",enum:["warehouse","store","fulfillment_center"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},pickup_enabled:{type:"boolean"},pickup_stock_policy:{type:"string",enum:["local","any"]},returns_enabled:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},seller_id:{type:"string",nullable:!0},seller_name:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"}},required:["id","name","address1","city","zipcode","country_code","country_name","state_code","state_text","pickup_ready_in_minutes","pickup_instructions","external_references","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","returns_enabled","created_at","updated_at","seller_id","seller_name"],"x-typelizer":!0},StockMovement:{type:"object",properties:{id:{type:"string"},quantity:{type:"number"},kind:{type:"string",nullable:!0,enum:["received","allocated","shipped","released","adjusted"]},reason:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},stock_level_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},stock_location_name:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},order_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},return_id:{type:"string",nullable:!0},exchange_id:{type:"string",nullable:!0},stock_transfer_id:{type:"string",nullable:!0},stock_receipt_id:{type:"string",nullable:!0},purchase_order_id:{type:"string",nullable:!0},order_number:{type:"string",nullable:!0},return_number:{type:"string",nullable:!0},exchange_number:{type:"string",nullable:!0},stock_transfer_number:{type:"string",nullable:!0},purchase_order_number:{type:"string",nullable:!0},unit_cost:{type:"string",nullable:!0},display_unit_cost:{type:"string",nullable:!0}},required:["id","quantity","kind","reason","created_at","updated_at","stock_level_id","stock_location_id","stock_location_name","variant_id","variant_name","variant_sku","order_id","fulfillment_id","return_id","exchange_id","stock_transfer_id","stock_receipt_id","purchase_order_id","order_number","return_number","exchange_number","stock_transfer_number","purchase_order_number","unit_cost","display_unit_cost"],"x-typelizer":!0},StockReceiptItem:{type:"object",properties:{id:{type:"string"},quantity_accepted:{type:"number"},quantity_rejected:{type:"number"},rejection_reason:{type:"string",nullable:!0,enum:["damaged","wrong_item","expired","other"]},notes:{type:"string",nullable:!0},line_type:{type:"string",enum:["purchase_order_item","stock_transfer_item"]},line_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},product_id:{type:"string",nullable:!0},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0}},required:["id","quantity_accepted","quantity_rejected","rejection_reason","notes","line_type","line_id","variant_id","product_id","variant_name","variant_sku","thumbnail_url"],"x-typelizer":!0},StockReceipt:{type:"object",properties:{id:{type:"string"},number:{type:"string"},reference:{type:"string",nullable:!0},notes:{type:"string",nullable:!0},metadata:{type:"object"},quantity_accepted_total:{type:"number"},quantity_rejected_total:{type:"number"},received_at:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},receivable_type:{type:"string",enum:["purchase_order","stock_transfer"]},receivable_id:{type:"string"},received_by_id:{type:"string",nullable:!0},received_by_type:{anyOf:[{type:"string",enum:["admin_user","api_key"]},{type:"string"}],nullable:!0,description:"The values listed are the built-in ones; extensions may add more."},received_by:{$ref:"#/components/schemas/Actor"},items_count:{type:"number"},items:{type:"array",items:{$ref:"#/components/schemas/StockReceiptItem"}}},required:["id","number","reference","notes","metadata","quantity_accepted_total","quantity_rejected_total","received_at","created_at","updated_at","receivable_type","receivable_id","received_by_id","received_by_type","items_count"],"x-typelizer":!0},StockReservation:{type:"object",properties:{id:{type:"string"},stock_level_id:{type:"string"},line_item_id:{type:"string"},order_id:{type:"string"},variant_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},quantity:{type:"number"},expires_at:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","stock_level_id","line_item_id","order_id","variant_id","stock_location_id","quantity","expires_at","active","created_at","updated_at"],"x-typelizer":!0},StockTransferItem:{type:"object",properties:{id:{type:"string"},quantity_shipped:{type:"number"},quantity_received:{type:"number"},quantity_rejected:{type:"number"},quantity_over:{type:"number"},outstanding:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},stock_transfer_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},product_id:{type:"string",nullable:!0},variant_name:{type:"string",nullable:!0},variant_sku:{type:"string",nullable:!0},options_text:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0}},required:["id","quantity_shipped","quantity_received","quantity_rejected","quantity_over","outstanding","created_at","updated_at","stock_transfer_id","variant_id","product_id","variant_name","variant_sku","options_text","thumbnail_url"],"x-typelizer":!0},StockTransfer:{type:"object",properties:{id:{type:"string"},number:{type:"string"},reference:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},source_location_id:{type:"string"},destination_location_id:{type:"string"},status:{type:"string"},notes:{type:"string",nullable:!0},metadata:{type:"object"},close_reason:{type:"string",nullable:!0},items_count:{type:"number"},quantity_received_total:{type:"number"},quantity_rejected_total:{type:"number"},shipped_at:{type:"string",nullable:!0},received_at:{type:"string",nullable:!0},closed_short_at:{type:"string",nullable:!0},deleted_at:{type:"string",nullable:!0},closed_short:{type:"boolean"},quantity_shipped_total:{type:"number"},editable:{type:"boolean"},items:{type:"array",items:{$ref:"#/components/schemas/StockTransferItem"}},stock_receipts:{type:"array",items:{$ref:"#/components/schemas/StockReceipt"}},source_location:{$ref:"#/components/schemas/StockLocation"},destination_location:{$ref:"#/components/schemas/StockLocation"}},required:["id","number","reference","created_at","updated_at","source_location_id","destination_location_id","status","notes","metadata","close_reason","items_count","quantity_received_total","quantity_rejected_total","shipped_at","received_at","closed_short_at","deleted_at","closed_short","quantity_shipped_total","editable"],"x-typelizer":!0},StoreCreditEvent:{type:"object",properties:{id:{type:"string"},action:{type:"string"},authorization_code:{type:"string",nullable:!0},display_action:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},store_credit_id:{type:"string"},originator_type:{type:"string",nullable:!0},originator_id:{type:"string",nullable:!0}},required:["id","action","authorization_code","display_action","amount","display_amount","created_at","updated_at","store_credit_id","originator_type","originator_id"],"x-typelizer":!0},StoreCredit:{type:"object",properties:{id:{type:"string"},amount:{type:"string"},amount_used:{type:"string"},amount_remaining:{type:"string"},display_amount:{type:"string"},display_amount_used:{type:"string"},display_amount_remaining:{type:"string"},currency:{type:"string"},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},amount_authorized:{type:"string"},outstanding:{type:"boolean"},display_amount_authorized:{type:"string"},customer_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},originator_type:{type:"string",nullable:!0},originator_id:{type:"string",nullable:!0},customer:{$ref:"#/components/schemas/Customer"},created_by:{$ref:"#/components/schemas/AdminUser"}},required:["id","amount","amount_used","amount_remaining","display_amount","display_amount_used","display_amount_remaining","currency","memo","metadata","created_at","updated_at","amount_authorized","outstanding","display_amount_authorized","customer_id","created_by_id","originator_type","originator_id"],"x-typelizer":!0},Store:{type:"object",properties:{id:{type:"string"},metadata:{type:"object"},name:{type:"string"},code:{type:"string"},preferred_storefront_url:{type:"string",nullable:!0},default_currency:{type:"string"},default_locale:{type:"string"},default_country_code:{type:"string",nullable:!0},mail_from_address:{type:"string",nullable:!0},customer_support_email:{type:"string",nullable:!0},new_order_notifications_email:{type:"string",nullable:!0},preferred_send_consumer_transactional_emails:{type:"boolean"},preferred_admin_locale:{type:"string",nullable:!0},preferred_timezone:{type:"string"},preferred_weight_unit:{type:"string",enum:["g","kg","lb","oz"]},preferred_unit_system:{type:"string"},preferred_storefront_access:{type:"string"},preferred_guest_checkout:{type:"boolean"},preferred_always_include_confirm_step:{type:"boolean"},preferred_company_field_enabled:{type:"boolean"},preferred_address_requires_company:{type:"boolean"},preferred_address_requires_phone:{type:"boolean"},preferred_capture_method:{type:"string"},preferred_track_inventory_levels:{type:"boolean"},preferred_stock_reservations_enabled:{type:"boolean"},preferred_low_stock_threshold:{type:"number"},preferred_tax_using_ship_address:{type:"boolean"},preferred_track_price_history:{type:"boolean"},preferred_show_products_without_price:{type:"boolean"},preferred_disable_sku_validation:{type:"boolean"},preferred_order_routing_strategy:{type:"string"},preferred_pricing_provider:{type:"string"},preferred_inventory_provider:{type:"string"},preferred_pricing_provider_failure_policy:{type:"string"},preferred_inventory_provider_failure_policy:{type:"string"},preferred_payout_provider:{type:"string",nullable:!0},preferred_default_payouts_schedule_interval:{type:"string"},preferred_default_minimum_payout_amount:{type:"number"},preferred_auto_approve_sellers:{type:"boolean"},preferred_auto_approve_seller_products:{type:"boolean"},preferred_send_seller_transactional_emails:{type:"boolean"},preferred_default_commission_tax_rate:{type:"number"},preferred_document_number_format:{type:"string"},preferred_order_number_prefix:{type:"string"},preferred_order_number_suffix:{type:"string"},preferred_order_number_sequence_start:{type:"number"},preferred_limit_digital_download_count:{type:"boolean"},preferred_digital_asset_authorized_clicks:{type:"number"},preferred_limit_digital_download_days:{type:"boolean"},preferred_digital_asset_authorized_days:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},order_number_sequence_started:{type:"boolean"},url:{type:"string"},api_url:{type:"string"},setup_tasks:{type:"array",items:{$ref:"#/components/schemas/SetupTask"}},supported_currencies:{type:"array",items:{type:"string"}},supported_locales:{type:"array",items:{type:"string"}},available_locales:{type:"array",items:{type:"string"}},logo_url:{type:"string",nullable:!0},mailer_logo_url:{type:"string",nullable:!0}},required:["id","metadata","name","code","preferred_storefront_url","default_currency","default_locale","default_country_code","mail_from_address","customer_support_email","new_order_notifications_email","preferred_send_consumer_transactional_emails","preferred_admin_locale","preferred_timezone","preferred_weight_unit","preferred_unit_system","preferred_storefront_access","preferred_guest_checkout","preferred_always_include_confirm_step","preferred_company_field_enabled","preferred_address_requires_company","preferred_address_requires_phone","preferred_capture_method","preferred_track_inventory_levels","preferred_stock_reservations_enabled","preferred_low_stock_threshold","preferred_tax_using_ship_address","preferred_track_price_history","preferred_show_products_without_price","preferred_disable_sku_validation","preferred_order_routing_strategy","preferred_pricing_provider","preferred_inventory_provider","preferred_pricing_provider_failure_policy","preferred_inventory_provider_failure_policy","preferred_payout_provider","preferred_default_payouts_schedule_interval","preferred_default_minimum_payout_amount","preferred_auto_approve_sellers","preferred_auto_approve_seller_products","preferred_send_seller_transactional_emails","preferred_default_commission_tax_rate","preferred_document_number_format","preferred_order_number_prefix","preferred_order_number_suffix","preferred_order_number_sequence_start","preferred_limit_digital_download_count","preferred_digital_asset_authorized_clicks","preferred_limit_digital_download_days","preferred_digital_asset_authorized_days","created_at","updated_at","order_number_sequence_started","url","api_url","setup_tasks","supported_currencies","supported_locales","available_locales","logo_url","mailer_logo_url"],"x-typelizer":!0},Supplier:{type:"object",properties:{id:{type:"string"},name:{type:"string"},contact_name:{type:"string",nullable:!0},email:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},notes:{type:"string",nullable:!0},address1:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},city:{type:"string",nullable:!0},state_name:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},postal_code:{type:"string",nullable:!0},purchase_orders_count:{type:"number"},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},deleted_at:{type:"string",nullable:!0},can_be_deleted:{type:"boolean"}},required:["id","name","contact_name","email","phone","notes","address1","address2","city","state_name","state_code","country_code","postal_code","purchase_orders_count","metadata","created_at","updated_at","deleted_at","can_be_deleted"],"x-typelizer":!0},TaxCategory:{type:"object",properties:{id:{type:"string"},name:{type:"string"},tax_code:{type:"string",nullable:!0},description:{type:"string",nullable:!0},is_default:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","tax_code","description","is_default","created_at","updated_at"],"x-typelizer":!0},TaxExemptionCertificate:{type:"object",properties:{id:{type:"string"},certificate_number:{type:"string"},reason_code:{type:"string"},status:{anyOf:[{type:"string",enum:["pending","verified","expired","revoked"]},{type:"string"}],description:"The values listed are the built-in ones; extensions may add more."},issuing_authority:{type:"string",nullable:!0},metadata:{type:"object",nullable:!0},issued_at:{type:"string"},expires_at:{type:"string"},verified_at:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},company_id:{type:"string"},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},active:{type:"boolean"},lapsed:{type:"boolean"},can_be_deleted:{type:"boolean"},document_filename:{type:"string",nullable:!0},document_byte_size:{type:"number",nullable:!0},document_url:{type:"string",nullable:!0}},required:["id","certificate_number","reason_code","status","issuing_authority","metadata","issued_at","expires_at","verified_at","created_at","updated_at","company_id","country_code","state_code","active","lapsed","can_be_deleted","document_filename","document_byte_size","document_url"],"x-typelizer":!0},TaxIdentifier:{type:"object",properties:{id:{type:"string"},kind:{type:"string",description:"Tax identifier kind, keyed to a registered validator. Built-in: eu_vat. Extensions may register more."},value:{type:"string"},validation_status:{type:"string",nullable:!0,enum:["pending","verified","unverified","unavailable","unsupported"]},validation_evidence:{type:"object",nullable:!0},source:{type:"string",nullable:!0,enum:["override","company","customer"]},validated_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},validatable:{type:"boolean"},customer_id:{type:"string",nullable:!0},cart_id:{type:"string",nullable:!0},order_id:{type:"string",nullable:!0}},required:["id","kind","value","validation_status","validation_evidence","source","validated_at","created_at","updated_at","validatable","customer_id","cart_id","order_id"],"x-typelizer":!0},TaxLine:{type:"object",properties:{id:{type:"string"},label:{type:"string"},included:{type:"boolean"},rate:{type:"string"},tax_rate_id:{type:"string",nullable:!0},line_item_id:{type:"string",nullable:!0},fulfillment_id:{type:"string",nullable:!0},fee_id:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},provider_id:{type:"string",nullable:!0},metadata:{type:"object",nullable:!0},taxability_reason:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0},data:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","label","included","rate","tax_rate_id","line_item_id","fulfillment_id","fee_id","amount","display_amount","provider_id","metadata","taxability_reason","country_code","state_code","data","created_at","updated_at"],"x-typelizer":!0},TaxRate:{type:"object",properties:{id:{type:"string"},name:{type:"string"},included_in_price:{type:"boolean"},show_rate_in_label:{type:"boolean"},metadata:{type:"object",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},deleted_at:{type:"string",nullable:!0},amount:{type:"string"},amount_percentage:{type:"number",nullable:!0},tax_category_id:{type:"string",nullable:!0},store_id:{type:"string",nullable:!0},country_code:{type:"string",nullable:!0},state_code:{type:"string",nullable:!0}},required:["id","name","included_in_price","show_rate_in_label","metadata","created_at","updated_at","deleted_at","amount","amount_percentage","tax_category_id","store_id","country_code","state_code"],"x-typelizer":!0},Variant:{type:"object",properties:{id:{type:"string"},product_id:{type:"string"},sku:{type:"string",nullable:!0},options_text:{type:"string"},track_inventory:{type:"boolean"},media_count:{type:"number"},preorder_ships_at:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},purchasable:{type:"boolean"},in_stock:{type:"boolean"},backorderable:{type:"boolean"},preorder:{type:"boolean"},weight:{type:"number",nullable:!0},height:{type:"number",nullable:!0},width:{type:"number",nullable:!0},depth:{type:"number",nullable:!0},weight_unit:{type:"string",enum:["g","kg","lb","oz"]},dimensions_unit:{type:"string",enum:["mm","cm","in","ft"]},minimum_order_quantity:{type:"number",nullable:!0},order_multiple:{type:"number",nullable:!0},purchase_unit:{type:"string",nullable:!0,enum:["unit","carton"]},units_per_carton:{type:"number",nullable:!0},price:{$ref:"#/components/schemas/Price"},original_price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},seller_id:{type:"string",nullable:!0},seller:{$ref:"#/components/schemas/Seller"},primary_media:{$ref:"#/components/schemas/Media"},media:{type:"array",items:{$ref:"#/components/schemas/Media"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},prior_price:{allOf:[{$ref:"#/components/schemas/PriceHistory"}],nullable:!0},external_references:{type:"object"},metadata:{type:"object"},position:{type:"number"},cost_price:{type:"string",nullable:!0},cost_currency:{type:"string",nullable:!0},barcode:{type:"string",nullable:!0},backorder_limit:{type:"number",nullable:!0},hs_code:{type:"string",nullable:!0},country_of_origin:{type:"string",nullable:!0},customs_description:{type:"string",nullable:!0},carton_weight:{type:"string",nullable:!0},cartons_per_pallet:{type:"number",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},preorderable:{type:"boolean"},tax_category_id:{type:"string",nullable:!0},carton_package_type_id:{type:"string",nullable:!0},units_per_pallet:{type:"number",nullable:!0},available_stock:{type:"number",nullable:!0},reserved_quantity:{type:"number"},total_on_hand:{type:"number",nullable:!0},product_name:{type:"string"},delivery_profile_id:{type:"string",nullable:!0},prices:{type:"array",items:{$ref:"#/components/schemas/Price"}},stock_levels:{type:"array",items:{$ref:"#/components/schemas/StockLevel"}}},required:["id","product_id","sku","options_text","track_inventory","media_count","preorder_ships_at","thumbnail_url","purchasable","in_stock","backorderable","preorder","weight","height","width","depth","weight_unit","dimensions_unit","minimum_order_quantity","order_multiple","purchase_unit","units_per_carton","price","original_price","seller_id","option_values","external_references","metadata","position","cost_price","cost_currency","barcode","backorder_limit","hs_code","country_of_origin","customs_description","carton_weight","cartons_per_pallet","deleted_at","created_at","updated_at","preorderable","tax_category_id","carton_package_type_id","units_per_pallet","available_stock","reserved_quantity","total_on_hand","product_name","delivery_profile_id"],"x-typelizer":!0},WebhookDelivery:{type:"object",properties:{id:{type:"string"},event_name:{type:"string"},event_id:{type:"string",nullable:!0},response_code:{type:"number",nullable:!0},execution_time:{type:"number",nullable:!0},error_type:{type:"string",nullable:!0},request_errors:{type:"string",nullable:!0},response_body:{type:"string",nullable:!0},success:{type:"boolean",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},delivered_at:{type:"string",nullable:!0},payload:{type:"object",nullable:!0},webhook_endpoint_id:{type:"string"},webhook_endpoint_url:{type:"string"}},required:["id","event_name","event_id","response_code","execution_time","error_type","request_errors","response_body","success","created_at","updated_at","delivered_at","payload","webhook_endpoint_id","webhook_endpoint_url"],"x-typelizer":!0},WebhookEndpoint:{type:"object",properties:{id:{type:"string"},name:{type:"string",nullable:!0},url:{type:"string"},active:{type:"boolean"},subscriptions:{type:"array",items:{type:"string"}},disabled_reason:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},disabled_at:{type:"string",nullable:!0},secret_key:{type:"string",nullable:!0},last_delivery_at:{type:"string",nullable:!0},recent_delivery_count:{type:"number"},recent_failure_count:{type:"number"},total_delivery_count:{type:"number"},successful_delivery_count:{type:"number"},failed_delivery_count:{type:"number"}},required:["id","name","url","active","subscriptions","disabled_reason","created_at","updated_at","disabled_at","secret_key","last_delivery_at","recent_delivery_count","recent_failure_count","total_delivery_count","successful_delivery_count","failed_delivery_count"],"x-typelizer":!0}}}};var mh=new Set(["get","post","put","patch","delete"]);function zn(){return uh}function D0(e){let t=e.description?.match(/\*\*Required scope:\*\* (.+?) \(for API-key authentication\)\./);return t?t[1].replaceAll("`",""):"\u2014"}function hh(e,t={}){let r=[];for(let[i,n]of Object.entries(e.paths)){let s=i.replace("/api/v3/admin","")||"/";for(let[a,o]of Object.entries(n)){if(!mh.has(a))continue;if(t.resource){let u=s.split("/")[1]??"";if(u!==t.resource&&!u.startsWith(t.resource))continue}let c=o.summary??"";t.search&&!`${a} ${s} ${c}`.toLowerCase().includes(t.search.toLowerCase())||r.push({method:a.toUpperCase(),path:s,scope:D0(o),summary:c})}}return r}function yh(e,t){let r=t.trim().split(/\s+/),i=r.length>1?r[0].toLowerCase():void 0,n=r.length>1?r[1]:r[0],s=Vr(n),a=lh(e,i,o=>o===s);return a.length>0?a:lh(e,i,o=>L0(o,s))}function lh(e,t,r){let i=[];for(let[n,s]of Object.entries(e.paths)){let a=n.replace("/api/v3/admin","")||"/";if(r(a))for(let[o,c]of Object.entries(s))mh.has(o)&&(t&&o!==t||i.push({method:o.toUpperCase(),path:a,summary:c.summary,description:c.description,parameters:ar(c.parameters,e),requestBody:ar(c.requestBody,e),responses:ar(c.responses,e)}))}return i}function L0(e,t){if(e===t)return!0;let r=e.split("/"),i=t.split("/");return r.length!==i.length?!1:r.every((n,s)=>n.startsWith("{")&&n.endsWith("}")?i[s].length>0:n===i[s])}var B0=8;function ar(e,t,r=[]){if(Array.isArray(e))return e.map(a=>ar(a,t,r));if(!e||typeof e!="object")return e;let i=e,n=i.$ref;if(typeof n=="string"){let a=n.replace("#/components/schemas/","");return r.includes(a)||r.length>=B0||!(a in t.components.schemas)?{$ref:n}:ar(t.components.schemas[a],t,[...r,a])}let s={};for(let[a,o]of Object.entries(i))s[a]=ar(o,t,r);return s}function z0(e,t){return[...t,e]}function bh(e){return e.option("--profile <name>","use a saved profile (see `spree auth`)").option("--base-url <url>","store URL (overrides profile/env/project)").option("--api-key <key>","secret API key (prefer SPREE_API_KEY \u2014 flags leak into shell history)").option("--store-id <id>","X-Spree-Store-Id for hosts serving multiple stores")}function qh(){return new Xo("--format <format>","output format").choices(["json","table"]).default("json")}function gh(e){return bh(e).addOption(qh())}async function fh(e){let t=await Dr({baseUrl:e.baseUrl,apiKey:e.apiKey,profile:e.profile});return{client:Lr({baseUrl:t.baseUrl,secretKey:t.apiKey,...e.storeId?{storeId:e.storeId}:{}}),credentials:t}}function kh(e){let t=e.command("api").description("Call the Admin API directly (generic get/post/patch/delete)");t.addHelpText("after",["","Examples:"," spree api get /products -q status_eq=active --limit 10",` spree api post /products -d '{"name":"Classic Tee","prices":[{"currency":"USD","amount":"29.99"}]}'`," spree api get /orders/ord_x8k2J9aQ --expand items,payments","","Discover the surface (offline, no server needed):"," spree api endpoints --search <term> # find endpoints + required scopes",' spree api schema "POST /orders" # request/response schema for one operation'," spree completion zsh # tab-completion for paths, filters, scopes"].join(`
889
+ `)),gh(t.command("get <path>").description("GET an Admin API path, e.g. `spree api get /products -q status_eq=active`").option("-q, --query <expr>","Ransack predicate key=value (repeatable)",z0,[]).option("--sort <fields>","sort, e.g. -created_at").option("--page <n>","page number").option("--limit <n>","page size (max 100)").option("--expand <relations>","expand relations, e.g. variants,variants.prices").option("--fields <fields>","sparse fields, e.g. id,name")).action(async(r,i)=>{let n;try{let s=ch(i),{client:a,credentials:o}=await fh(i);n=o.baseUrl;let c=await a.request("GET",Vr(r),{params:s});Nr(c,i.format)}catch(s){Tt(s,{baseUrl:n})}});for(let r of["post","patch","delete"])gh(t.command(`${r} <path>`).description(`${r.toUpperCase()} an Admin API path`).option("-d, --data <json>","request body: inline JSON, @file, or '-' for stdin")).action(async(i,n)=>{let s;try{let a=await ah(n.data),{client:o,credentials:c}=await fh(n);s=c.baseUrl;let u=await o.request(r.toUpperCase(),Vr(i),{...a===$o?{}:{body:a}});Nr(u,n.format)}catch(a){Tt(a,{baseUrl:s})}});t.command("endpoints").description("List Admin API endpoints with their required scopes").option("--resource <name>","filter by first path segment, e.g. orders").option("--search <term>","filter by method, path, or summary").addOption(qh()).action(r=>{let i=hh(zn(),{resource:r.resource,search:r.search});if(i.length===0){process.stderr.write(`No endpoints match.
890
+ `),process.exitCode=1;return}if(r.format==="table"){(0,_h.printTable)(i.map(n=>({Method:n.method,Path:n.path,Scope:n.scope,Summary:n.summary})));return}Nr(i,"json")}),t.command("schema <operation>").description('Show the request/response schema for an operation, e.g. `spree api schema "POST /products"`').action(r=>{let i=yh(zn(),r);if(i.length===0){process.stderr.write(`No operation matches "${r}". Try \`spree api endpoints --search ${r.split(/\s+/).pop()}\`.
891
+ `),process.exitCode=1;return}let n=/\s/.test(r.trim());Nr(n&&i.length===1?i[0]:i,"json")}),bh(t.command("status").description("Show resolved credentials, server reachability, and the bundled spec version")).action(async r=>{try{let i=await Dr({baseUrl:r.baseUrl,apiKey:r.apiKey,profile:r.profile},{allowMint:!1}),n=await Hr(i.baseUrl,i.apiKey),s=zn(),a=Bn(n),o=[`${De.default.bold("Base URL:")} ${i.baseUrl}`,`${De.default.bold("Credentials:")} ${i.source}${i.profileName?` (${i.profileName})`:""}, key ${i.tokenPrefix}${De.default.dim("\u2026")}`],c=n.status==="unreachable"||n.status==="unauthorized"?null:await dh(i.baseUrl,i.apiKey);c!==null?o.push(`${De.default.bold("Scopes:")} ${c.length?c.join(", "):De.default.dim("(none)")}`):i.scopes?.length&&o.push(`${De.default.bold("Scopes:")} ${i.scopes.join(", ")} ${De.default.dim("(local snapshot from mint time \u2014 may be stale)")}`),o.push(`${De.default.bold("Server:")} ${a}`),o.push(`${De.default.bold("Bundled spec:")} ${s.info?.version??"unknown"} ${De.default.dim("(spree api endpoints/schema reflect this snapshot, not the live server)")}`),process.stdout.write(`${o.join(`
882
892
  `)}
883
- `),jn(n)&&(process.exitCode=1)}catch(i){Pt(i,{baseUrl:r.baseUrl})}})}var lh=D(Dr(),1),it=D(K(),1);function mh(e){let t=e.command("api-key").description("Manage API keys");t.command("create").description("Create an API key").option("--name <name>","key name").option("--type <type>","key type: publishable or secret").option("--scopes <scopes>","comma-separated scopes for secret keys (e.g. read_all or read_orders,write_products)").action(async r=>{let i=b(),n=r.name,s=r.type,a=r.scopes;if(!n){let c=await le({message:"Key name:",placeholder:"My Storefront",validate(u){if(!u)return"Name is required"}});L(c)&&(j("Cancelled."),process.exit(0)),n=c}if(!s){let c=await li({message:"Key type:",options:[{value:"publishable",label:"Publishable (for storefronts)"},{value:"secret",label:"Secret (for server-to-server)"}]});L(c)&&(j("Cancelled."),process.exit(0)),s=c}if(s!=="publishable"&&s!=="secret")throw new Error('Key type must be "publishable" or "secret".');if(s==="secret"&&!a){let c=await le({message:"Scopes (comma-separated):",placeholder:"read_all",initialValue:"read_all",validate(u){if(!u)return"Secret keys require at least one scope"}});L(c)&&(j("Cancelled."),process.exit(0)),a=c}let o=I();o.start("Creating API key...");let p=await Za(i.projectDir,{name:n,keyType:s,scopes:s==="secret"&&a?a.split(",").map(c=>c.trim()):[]});o.stop("API key created.");let d=[`${it.default.bold("Name:")} ${n}`,`${it.default.bold("Type:")} ${s}`,`${it.default.bold("Token:")} ${it.default.cyan(p)}`];s==="secret"&&(d.push(`${it.default.bold("Scopes:")} ${a}`),d.push(""),d.push(it.default.yellow("Save this token now \u2014 secret keys cannot be retrieved later."))),V(d.join(`
884
- `),"API Key")}),t.command("list").description("List API keys").action(async()=>{let r=b(),i=I();i.start("Fetching API keys...");let n=await se("spree:cli:list_api_keys",r.projectDir);i.stop("");let s=n.trim().split(`
885
- `).filter(Boolean);if(s.length===0){q.info("No API keys found.");return}let a=s.map(o=>{let[p,d,c,u,l,m]=o.split("|");return{ID:p??"",Name:d??"",Type:c??"",Token:u??"",Created:l??"",Status:m==="active"?it.default.green(m):it.default.red(m??"")}});(0,lh.printTable)(a)}),t.command("revoke").description("Revoke an API key").argument("<id>","ID of the key to revoke (from api-key list)").action(async r=>{let i=b(),n=I();n.start("Revoking API key...");let a=(await se("spree:cli:revoke_api_key",i.projectDir,{ID:r})).trim();n.stop(`API key "${a}" revoked.`)})}var hh=D(Dr(),1),ie=D(K(),1);function yh(e){let t=e.command("auth").description("Manage Admin API credentials (profiles in ~/.config/spree)");t.command("login").description("Save a secret API key as a named profile").option("--profile <name>","profile name","default").option("--base-url <url>","store URL, e.g. https://store.example.com").action(async r=>{process.stdin.isTTY||(process.stderr.write(`${ie.default.red("error:")} \`spree auth login\` is interactive. For non-interactive use, set SPREE_BASE_URL + SPREE_API_KEY (or pass --base-url/--api-key to \`spree api\`).
886
- `),process.exit(2));let i=r.baseUrl;if(!i){let d=await le({message:"Store URL:",placeholder:"https://store.example.com",validate(c){if(!c)return"URL is required";if(!/^https?:\/\//.test(c))return"Must start with http:// or https://"}});L(d)&&(j("Cancelled."),process.exit(130)),i=d}i=i.replace(/\/$/,"");let n=await ui({message:"Secret API key (sk_...):",validate(d){if(!d)return"Key is required";if(!d.startsWith("sk_"))return"Admin API keys start with sk_"}});L(n)&&(j("Cancelled."),process.exit(130));let s=n,a=I();a.start("Validating credentials...");let o=await zr(i,s);o.status==="unauthorized"&&(a.stop(ie.default.red("The server rejected this key (401). Check the key and try again.")),process.exit(2)),o.status==="unreachable"&&(a.stop(ie.default.red(`Could not reach ${i}: ${o.message}`)),process.exit(2)),a.stop(o.storeName?`Connected to ${ie.default.bold(o.storeName)}.`:"Credentials accepted (key lacks read_settings, so the store name is hidden \u2014 that is fine).");let p=Er();p.profiles[r.profile]={baseUrl:i,token:s},p.defaultProfile||=r.profile,Ya(p),V([`${ie.default.bold("Profile:")} ${r.profile}${p.defaultProfile===r.profile?ie.default.dim(" (default)"):""}`,`${ie.default.bold("Base URL:")} ${i}`,`${ie.default.bold("Key:")} ${An(s)}${ie.default.dim("\u2026")}`,"",ie.default.dim(`Saved to ${At()}`)].join(`
887
- `),"Logged in")}),t.command("status").description("Show which credentials `spree api` would use, and verify them").option("--profile <name>","check a specific profile").action(async r=>{let i;try{i=await Pr({profile:r.profile},{allowMint:!1})}catch(o){Pt(o)}let n=I();n.start("Checking server...");let s=await zr(i.baseUrl,i.apiKey);n.stop("");let a=Cn(s);V([`${ie.default.bold("Source:")} ${i.source}${i.profileName?` (${i.profileName})`:""}`,`${ie.default.bold("Base URL:")} ${i.baseUrl}`,`${ie.default.bold("Key:")} ${i.tokenPrefix}${ie.default.dim("\u2026")}`,...i.scopes?[`${ie.default.bold("Scopes:")} ${i.scopes.join(", ")}`]:[],`${ie.default.bold("Server:")} ${a}`].join(`
888
- `),"Auth status"),jn(s)&&(process.exitCode=1)}),t.command("logout").description("Remove a saved profile (or the project credentials)").option("--profile <name>","profile to remove","default").option("--project","remove .spree/credentials.json from the current project instead").action(async r=>{if(r.project){let n;try{n=b().projectDir}catch(a){Pt(a)}(await import("fs")).rmSync(Yt(n),{force:!0}),q.success("Removed project credentials. The next `spree api` call mints a fresh read-only key.");return}let i=Er();if(!i.profiles[r.profile]){let n=Object.keys(i.profiles),s=n.length?` Saved profiles: ${n.join(", ")}.`:" No profiles are saved.";process.stderr.write(`${ie.default.red("error:")} no profile named "${r.profile}".${s}
889
- `),process.exit(2)}delete i.profiles[r.profile],i.defaultProfile===r.profile&&(i.defaultProfile=Object.keys(i.profiles)[0]),Ya(i),q.success(`Removed profile "${r.profile}". The key itself stays active \u2014 revoke it with \`spree api-key revoke\` or in the admin.`)}),t.command("list").description("List saved profiles").action(()=>{let r=Er(),i=Object.keys(r.profiles);if(i.length===0){q.info("No profiles saved. Run `spree auth login` to add one.");return}(0,hh.printTable)(i.map(n=>({Profile:r.defaultProfile===n?`${n} *`:n,"Base URL":r.profiles[n].baseUrl,Key:`${An(r.profiles[n].token)}\u2026`})))})}import Mr from"fs";import rr from"path";var oe=D(K(),1);function gh(e){e.command("build").description("Rebuild the dev image (after Dockerfile / .ruby-version changes)").option("--reset-bundle","also wipe the bundle_cache volume to re-seed gems").option("--yes","skip confirmation prompts (for CI)").option("--production","build the production image instead \u2014 includes apps/dashboard when present").option("--tag <tag>","image tag for --production (default: <project>-spree:latest)").action(async t=>{if(t.production){await v0(b().projectDir,t.tag);return}await _0(t)})}async function _0(e){let t=b();if(Fe(t.projectDir)&&(j(["This project uses SPREE_PATH for monorepo development.",`Use ${oe.default.bold("pnpm server:build")} from the monorepo root instead of ${oe.default.bold("spree build")}.`,"It builds against the edge compose overlay the running stack was started with."].join(`
890
- `)),process.exit(1)),Sn(t.projectDir)||(console.error(`
891
- ${oe.default.red("Error:")} docker-compose.yml has no \`build:\` section. Run ${oe.default.bold("spree eject")} first to switch to a build-from-source stack.
892
- `),process.exit(1)),e.resetBundle){if(!e.yes){let i=await Je({message:"Wipe the bundle_cache volume? Any gems added via `spree bundle add` since the last image build will be lost.",initialValue:!1});(L(i)||!i)&&(j("Build cancelled."),process.exit(0))}let r=I();r.start("Wiping bundle_cache volume...");try{await Z(["down"],t.projectDir,{stdio:"ignore"});let n=`${await w0(t.projectDir)}_bundle_cache`;await x0(n,t.projectDir)?(await te("docker",["volume","rm",n],{cwd:t.projectDir,stdio:"ignore"}),r.stop("bundle_cache volume wiped.")):r.stop(`bundle_cache volume not present (looked for ${n}).`)}catch(i){throw r.stop("Failed to wipe bundle_cache volume."),i}}console.log(`
893
- ${oe.default.bold("Rebuilding dev image...")}
894
- `),await Z(["build",...await Ge(t.projectDir)],t.projectDir,{stdio:"inherit"}),V([`Image rebuilt. Start the stack with ${oe.default.bold("spree dev")}.`,e.resetBundle?`On next boot, gems will re-seed into a fresh ${oe.default.dim("bundle_cache")} volume.`:""].filter(Boolean).join(`
895
- `),"Build complete")}function b0(e,t){let r=xn(e),i=rr.join(e,r),n=rr.join(i,"Dockerfile");if(!Mr.existsSync(n))throw new Error(`No ${r}/Dockerfile found. Is this a create-spree-app project?`);let s=t??`${rr.basename(e).toLowerCase().replace(/[^a-z0-9_-]/g,"")}-spree:latest`,a=Mr.existsSync(rr.join(e,"apps","dashboard","package.json"));return Mr.readFileSync(n,"utf-8").includes(".spree-custom-dashboard")?(q0(e),{args:["build",e,"-f",n,"-t",s],imageTag:s,apiDir:r,dashboard:a?"custom":"stock-or-none"}):{args:["build",i,"-f",n,"-t",s],imageTag:s,apiDir:r,dashboard:a?"unsupported-dockerfile":"stock-or-none"}}function q0(e){let t=rr.join(e,".dockerignore");Mr.existsSync(t)||Mr.writeFileSync(t,k0)}var k0=`# Build context for server/Dockerfile (repo root): keep it to sources.
893
+ `),Ln(n)&&(process.exitCode=1)}catch(i){Tt(i,{baseUrl:r.baseUrl})}})}p();var vh=B(Ur(),1),at=B(J(),1);function wh(e){let t=e.command("api-key").description("Manage API keys");t.command("create").description("Create an API key").option("--name <name>","key name").option("--type <type>","key type: publishable or secret").option("--scopes <scopes>","comma-separated scopes for secret keys (e.g. read_all or read_orders,write_products)").action(async r=>{let i=k(),n=r.name,s=r.type,a=r.scopes;if(!n){let d=await he({message:"Key name:",placeholder:"My Storefront",validate(l){if(!l)return"Name is required"}});z(d)&&(T("Cancelled."),process.exit(0)),n=d}if(!s){let d=await ki({message:"Key type:",options:[{value:"publishable",label:"Publishable (for storefronts)"},{value:"secret",label:"Secret (for server-to-server)"}]});z(d)&&(T("Cancelled."),process.exit(0)),s=d}if(s!=="publishable"&&s!=="secret")throw new Error('Key type must be "publishable" or "secret".');if(s==="secret"&&!a){let d=await he({message:"Scopes (comma-separated):",placeholder:"read_all",initialValue:"read_all",validate(l){if(!l)return"Secret keys require at least one scope"}});z(d)&&(T("Cancelled."),process.exit(0)),a=d}let o=D();o.start("Creating API key...");let c=await so(i.projectDir,{name:n,keyType:s,scopes:s==="secret"&&a?a.split(",").map(d=>d.trim()):[]});o.stop("API key created.");let u=[`${at.default.bold("Name:")} ${n}`,`${at.default.bold("Type:")} ${s}`,`${at.default.bold("Token:")} ${at.default.cyan(c)}`];s==="secret"&&(u.push(`${at.default.bold("Scopes:")} ${a}`),u.push(""),u.push(at.default.yellow("Save this token now \u2014 secret keys cannot be retrieved later."))),H(u.join(`
894
+ `),"API Key")}),t.command("list").description("List API keys").action(async()=>{let r=k(),i=D();i.start("Fetching API keys...");let n=await oe("spree:cli:list_api_keys",r.projectDir);i.stop("");let s=n.trim().split(`
895
+ `).filter(Boolean);if(s.length===0){v.info("No API keys found.");return}let a=s.map(o=>{let[c,u,d,l,h,y]=o.split("|");return{ID:c??"",Name:u??"",Type:d??"",Token:l??"",Created:h??"",Status:y==="active"?at.default.green(y):at.default.red(y??"")}});(0,vh.printTable)(a)}),t.command("revoke").description("Revoke an API key").argument("<id>","ID of the key to revoke (from api-key list)").action(async r=>{let i=k(),n=D();n.start("Revoking API key...");let a=(await oe("spree:cli:revoke_api_key",i.projectDir,{ID:r})).trim();n.stop(`API key "${a}" revoked.`)})}p();var xh=B(Ur(),1),se=B(J(),1);function Sh(e){let t=e.command("auth").description("Manage Admin API credentials (profiles in ~/.config/spree)");t.command("login").description("Save a secret API key as a named profile").option("--profile <name>","profile name","default").option("--base-url <url>","store URL, e.g. https://store.example.com").action(async r=>{process.stdin.isTTY||(process.stderr.write(`${se.default.red("error:")} \`spree auth login\` is interactive. For non-interactive use, set SPREE_BASE_URL + SPREE_API_KEY (or pass --base-url/--api-key to \`spree api\`).
896
+ `),process.exit(2));let i=r.baseUrl;if(!i){let u=await he({message:"Store URL:",placeholder:"https://store.example.com",validate(d){if(!d)return"URL is required";if(!/^https?:\/\//.test(d))return"Must start with http:// or https://"}});z(u)&&(T("Cancelled."),process.exit(130)),i=u}i=i.replace(/\/$/,"");let n=await qi({message:"Secret API key (sk_...):",validate(u){if(!u)return"Key is required";if(!u.startsWith("sk_"))return"Admin API keys start with sk_"}});z(n)&&(T("Cancelled."),process.exit(130));let s=n,a=D();a.start("Validating credentials...");let o=await Hr(i,s);o.status==="unauthorized"&&(a.stop(se.default.red("The server rejected this key (401). Check the key and try again.")),process.exit(2)),o.status==="unreachable"&&(a.stop(se.default.red(`Could not reach ${i}: ${o.message}`)),process.exit(2)),a.stop(o.storeName?`Connected to ${se.default.bold(o.storeName)}.`:"Credentials accepted (key lacks read_settings, so the store name is hidden \u2014 that is fine).");let c=Or();c.profiles[r.profile]={baseUrl:i,token:s},c.defaultProfile||=r.profile,ro(c),H([`${se.default.bold("Profile:")} ${r.profile}${c.defaultProfile===r.profile?se.default.dim(" (default)"):""}`,`${se.default.bold("Base URL:")} ${i}`,`${se.default.bold("Key:")} ${In(s)}${se.default.dim("\u2026")}`,"",se.default.dim(`Saved to ${jt()}`)].join(`
897
+ `),"Logged in")}),t.command("status").description("Show which credentials `spree api` would use, and verify them").option("--profile <name>","check a specific profile").action(async r=>{let i;try{i=await Dr({profile:r.profile},{allowMint:!1})}catch(o){Tt(o)}let n=D();n.start("Checking server...");let s=await Hr(i.baseUrl,i.apiKey);n.stop("");let a=Bn(s);H([`${se.default.bold("Source:")} ${i.source}${i.profileName?` (${i.profileName})`:""}`,`${se.default.bold("Base URL:")} ${i.baseUrl}`,`${se.default.bold("Key:")} ${i.tokenPrefix}${se.default.dim("\u2026")}`,...i.scopes?[`${se.default.bold("Scopes:")} ${i.scopes.join(", ")}`]:[],`${se.default.bold("Server:")} ${a}`].join(`
898
+ `),"Auth status"),Ln(s)&&(process.exitCode=1)}),t.command("logout").description("Remove a saved profile (or the project credentials)").option("--profile <name>","profile to remove","default").option("--project","remove .spree/credentials.json from the current project instead").action(async r=>{if(r.project){let n;try{n=k().projectDir}catch(a){Tt(a)}(await import("fs")).rmSync(er(n),{force:!0}),v.success("Removed project credentials. The next `spree api` call mints a fresh read-only key.");return}let i=Or();if(!i.profiles[r.profile]){let n=Object.keys(i.profiles),s=n.length?` Saved profiles: ${n.join(", ")}.`:" No profiles are saved.";process.stderr.write(`${se.default.red("error:")} no profile named "${r.profile}".${s}
899
+ `),process.exit(2)}delete i.profiles[r.profile],i.defaultProfile===r.profile&&(i.defaultProfile=Object.keys(i.profiles)[0]),ro(i),v.success(`Removed profile "${r.profile}". The key itself stays active \u2014 revoke it with \`spree api-key revoke\` or in the admin.`)}),t.command("list").description("List saved profiles").action(()=>{let r=Or(),i=Object.keys(r.profiles);if(i.length===0){v.info("No profiles saved. Run `spree auth login` to add one.");return}(0,xh.printTable)(i.map(n=>({Profile:r.defaultProfile===n?`${n} *`:n,"Base URL":r.profiles[n].baseUrl,Key:`${In(r.profiles[n].token)}\u2026`})))})}p();import Wr from"fs";import or from"path";var ce=B(J(),1);function $h(e){e.command("build").description("Rebuild the dev image (after Dockerfile / .ruby-version changes)").option("--reset-bundle","also wipe the bundle_cache volume to re-seed gems").option("--yes","skip confirmation prompts (for CI)").option("--production","build the production image instead \u2014 includes apps/dashboard when present").option("--tag <tag>","image tag for --production (default: <project>-spree:latest)").action(async t=>{if(t.production){await N0(k().projectDir,t.tag);return}await M0(t)})}async function M0(e){let t=k();if(Ne(t.projectDir)&&(T(["This project uses SPREE_PATH for monorepo development.",`Use ${ce.default.bold("pnpm server:build")} from the monorepo root instead of ${ce.default.bold("spree build")}.`,"It builds against the edge compose overlay the running stack was started with."].join(`
900
+ `)),process.exit(1)),Xt(t.projectDir)||(console.error(`
901
+ ${ce.default.red("Error:")} docker-compose.yml has no \`build:\` section. Run ${ce.default.bold("spree eject")} first to switch to a build-from-source stack.
902
+ `),process.exit(1)),e.resetBundle){if(!e.yes){let i=await Qe({message:"Wipe the bundle_cache volume? Any gems added via `spree bundle add` since the last image build will be lost.",initialValue:!1});(z(i)||!i)&&(T("Build cancelled."),process.exit(0))}let r=D();r.start("Wiping bundle_cache volume...");try{await ee(["down"],t.projectDir,{stdio:"ignore"});let n=`${await V0(t.projectDir)}_bundle_cache`;await H0(n,t.projectDir)?(await ie("docker",["volume","rm",n],{cwd:t.projectDir,stdio:"ignore"}),r.stop("bundle_cache volume wiped.")):r.stop(`bundle_cache volume not present (looked for ${n}).`)}catch(i){throw r.stop("Failed to wipe bundle_cache volume."),i}}console.log(`
903
+ ${ce.default.bold("Rebuilding dev image...")}
904
+ `),await ee(["build",...await Ve(t.projectDir)],t.projectDir,{stdio:"inherit"}),H([`Image rebuilt. Start the stack with ${ce.default.bold("spree dev")}.`,e.resetBundle?`On next boot, gems will re-seed into a fresh ${ce.default.dim("bundle_cache")} volume.`:""].filter(Boolean).join(`
905
+ `),"Build complete")}function F0(e,t){let r=Jt(e),i=or.join(e,r),n=or.join(i,"Dockerfile");if(!Wr.existsSync(n))throw new Error(`No ${r}/Dockerfile found. Is this a create-spree-app project?`);let s=t??`${or.basename(e).toLowerCase().replace(/[^a-z0-9_-]/g,"")}-spree:latest`,a=Wr.existsSync(or.join(e,"apps","dashboard","package.json"));return/\.spree-custom-(app|dashboard)\b/.test(Wr.readFileSync(n,"utf-8"))?(G0(e),{args:["build",e,"-f",n,"-t",s],imageTag:s,apiDir:r,dashboard:a?"custom":"stock-or-none"}):{args:["build",i,"-f",n,"-t",s],imageTag:s,apiDir:r,dashboard:a?"unsupported-dockerfile":"stock-or-none"}}function G0(e){let t=or.join(e,".dockerignore");Wr.existsSync(t)||Wr.writeFileSync(t,U0)}var U0=`# Build context for server/Dockerfile (repo root): keep it to sources.
896
906
  **/node_modules
897
907
  **/.git
898
908
  .spree
@@ -908,12 +918,12 @@ backend/log
908
918
  backend/tmp
909
919
  backend/storage
910
920
  backend/.env*
911
- `;async function v0(e,t){let r;try{r=b0(e,t)}catch(i){console.error(`
912
- ${oe.default.red("Error:")} ${i instanceof Error?i.message:String(i)}
913
- `),process.exit(1)}r.dashboard==="custom"?q.info(`Including your dashboard from ${oe.default.bold("apps/dashboard/")} (built in-image).`):r.dashboard==="unsupported-dockerfile"&&q.warn(`${oe.default.bold("apps/dashboard/")} exists, but ${oe.default.bold(`${r.apiDir}/Dockerfile`)} predates dashboard support \u2014 the image will NOT include your dashboard. Update the Dockerfile from the spree-starter template to bake it in.`),console.log(`
914
- ${oe.default.bold(`Building production image ${r.imageTag}...`)}
915
- `),await te("docker",r.args,{cwd:e,stdio:"inherit"}),V([`Run it: ${oe.default.cyan(`docker run --rm -p 3000:3000 ${r.imageTag}`)}`,`Push it: ${oe.default.cyan(`docker tag ${r.imageTag} <registry>/<repo> && docker push <registry>/<repo>`)}`,r.dashboard!=="unsupported-dockerfile"?`Dashboard: served at ${oe.default.bold("/dashboard")} on the same origin as the API.`:""].filter(Boolean).join(`
916
- `),"Production image built")}async function w0(e){try{let{stdout:t}=await te("docker",["compose","config","--format","json"],{cwd:e}),r=JSON.parse(t);if(r.name)return r.name}catch{}return rr.basename(e).toLowerCase().replace(/[^a-z0-9_-]/g,"")}async function x0(e,t){try{return await te("docker",["volume","inspect",e],{cwd:t,stdio:"ignore"}),!0}catch{return!1}}function fh(e){e.command("bundle").description("Run a bundler command (`bundle \u2026`) inside the web container").argument("<args...>","arguments to pass to bundle").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await M(["bundle",...t],r.projectDir,{edgeHint:"the edge stack heals gem drift on boot"})})}var _h=["/admin_users","/allowed_origins","/api_keys","/auth","/catalogs","/categories","/channels","/claim_reasons","/collection_rules","/collections","/commission_lines","/commission_rates","/companies","/custom_field_definitions","/customer_groups","/customers","/delivery_methods","/delivery_profiles","/delivery_zones","/exports","/gift_card_batches","/gift_cards","/imports","/integrations","/invitations","/locales","/markets","/me","/media","/option_types","/order_cancellation_reasons","/order_routing_rules","/orders","/package_types","/payment_methods","/permissions","/policies","/price_lists","/prices","/product_types","/products","/promotion_actions","/promotion_rules","/promotions","/purchase_orders","/refund_reasons","/return_reasons","/roles","/seller_payouts","/seller_requirements","/sellers","/stock_levels","/stock_locations","/stock_movements","/stock_transfers","/store","/store_credits","/suppliers","/tags","/tax_rates","/translatable_resources","/translations","/webhook_endpoints"];var bh=["bash","zsh","fish"],$0=["eq","not_eq","cont","not_cont","start","end","in","not_in","gt","gteq","lt","lteq","null","not_null","present","blank"],A0=["get","post","patch","delete","endpoints","schema","status"],E0=["read_all","write_all","read_orders","write_orders","read_products","write_products","read_media","write_media","read_promotions","write_promotions","read_customers","write_customers","read_payments","write_payments","read_fulfillments","write_fulfillments","read_refunds","write_refunds","read_gift_cards","write_gift_cards","read_store_credits","write_store_credits","read_stock","write_stock","read_categories","write_categories","read_collections","write_collections","read_settings","write_settings","read_webhooks","write_webhooks","read_api_keys","write_api_keys","read_staff","write_staff","read_dashboard"];function P0(e){let[t,r,...i]=e,n=e[e.length-1]??"",s=e[e.length-2]??"";if(e.length<=1)return Rn(["api","auth",...j0],n);if((s==="-q"||s==="--query")&&n.includes("_")&&!n.includes("=")){let a=n.slice(0,n.lastIndexOf("_")+1);return $0.map(o=>`${a}${o}=`)}if(s==="--scopes"){let a=n.includes(",")?n.slice(n.lastIndexOf(",")+1):n,o=n.slice(0,n.length-a.length);return Rn(E0,a).map(p=>o+p)}if(t==="api"){if(e.length===2)return Rn(A0,n);if(["get","post","patch","delete","schema"].includes(r)&&i.length<=1)return Rn(_h,n)}return[]}var j0=["api-key","dev","console","migrate"];function Rn(e,t){return t?e.filter(r=>r.startsWith(t)):e}function C0(e){return e==="fish"?`# spree fish completion \u2014 eval "$(spree completion fish)"
921
+ `;async function N0(e,t){let r;try{r=F0(e,t)}catch(i){console.error(`
922
+ ${ce.default.red("Error:")} ${i instanceof Error?i.message:String(i)}
923
+ `),process.exit(1)}r.dashboard==="custom"?v.info(`Including your dashboard from ${ce.default.bold("apps/dashboard/")} (built in-image).`):r.dashboard==="unsupported-dockerfile"&&v.warn(`${ce.default.bold("apps/dashboard/")} exists, but ${ce.default.bold(`${r.apiDir}/Dockerfile`)} predates dashboard support \u2014 the image will NOT include your dashboard. Update the Dockerfile from the spree-starter template to bake it in.`),console.log(`
924
+ ${ce.default.bold(`Building production image ${r.imageTag}...`)}
925
+ `),await ie("docker",r.args,{cwd:e,stdio:"inherit"}),H([`Run it: ${ce.default.cyan(`docker run --rm -p 3000:3000 ${r.imageTag}`)}`,`Push it: ${ce.default.cyan(`docker tag ${r.imageTag} <registry>/<repo> && docker push <registry>/<repo>`)}`,r.dashboard!=="unsupported-dockerfile"?`Dashboard: served at ${ce.default.bold("/dashboard")} on the same origin as the API.`:""].filter(Boolean).join(`
926
+ `),"Production image built")}async function V0(e){try{let{stdout:t}=await ie("docker",["compose","config","--format","json"],{cwd:e}),r=JSON.parse(t);if(r.name)return r.name}catch{}return or.basename(e).toLowerCase().replace(/[^a-z0-9_-]/g,"")}async function H0(e,t){try{return await ie("docker",["volume","inspect",e],{cwd:t,stdio:"ignore"}),!0}catch{return!1}}p();function Ah(e){e.command("bundle").description("Run a bundler command (`bundle \u2026`) inside the web container").argument("<args...>","arguments to pass to bundle").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=k();await G(["bundle",...t],r.projectDir,{edgeHint:"the edge stack heals gem drift on boot"})})}p();var Eh=["/admin_users","/allowed_origins","/api_keys","/auth","/catalogs","/categories","/channels","/claim_reasons","/collection_rules","/collections","/commission_lines","/commission_rates","/companies","/custom_field_definitions","/customer_groups","/customers","/delivery_methods","/delivery_profiles","/delivery_zones","/exports","/gift_card_batches","/gift_cards","/imports","/integrations","/invitations","/locales","/markets","/me","/media","/option_types","/order_cancellation_reasons","/order_routing_rules","/orders","/package_types","/payment_methods","/permissions","/policies","/price_lists","/prices","/product_types","/products","/promotion_actions","/promotion_rules","/promotions","/purchase_orders","/refund_reasons","/return_reasons","/roles","/seller_payouts","/seller_requirements","/sellers","/stock_levels","/stock_locations","/stock_movements","/stock_transfers","/store","/store_credits","/suppliers","/tags","/tax_rates","/translatable_resources","/translations","/webhook_endpoints"];var Ph=["bash","zsh","fish"],K0=["eq","not_eq","cont","not_cont","start","end","in","not_in","gt","gteq","lt","lteq","null","not_null","present","blank"],Y0=["get","post","patch","delete","endpoints","schema","status"],J0=["read_all","write_all","read_orders","write_orders","read_products","write_products","read_media","write_media","read_promotions","write_promotions","read_customers","write_customers","read_payments","write_payments","read_fulfillments","write_fulfillments","read_refunds","write_refunds","read_gift_cards","write_gift_cards","read_store_credits","write_store_credits","read_stock","write_stock","read_categories","write_categories","read_collections","write_collections","read_settings","write_settings","read_webhooks","write_webhooks","read_api_keys","write_api_keys","read_staff","write_staff","read_dashboard"];function X0(e){let[t,r,...i]=e,n=e[e.length-1]??"",s=e[e.length-2]??"";if(e.length<=1)return Mn(["api","auth",...Z0],n);if((s==="-q"||s==="--query")&&n.includes("_")&&!n.includes("=")){let a=n.slice(0,n.lastIndexOf("_")+1);return K0.map(o=>`${a}${o}=`)}if(s==="--scopes"){let a=n.includes(",")?n.slice(n.lastIndexOf(",")+1):n,o=n.slice(0,n.length-a.length);return Mn(J0,a).map(c=>o+c)}if(t==="api"){if(e.length===2)return Mn(Y0,n);if(["get","post","patch","delete","schema"].includes(r)&&i.length<=1)return Mn(Eh,n)}return[]}var Z0=["api-key","dev","console","migrate"];function Mn(e,t){return t?e.filter(r=>r.startsWith(t)):e}function Q0(e){return e==="fish"?`# spree fish completion \u2014 eval "$(spree completion fish)"
917
927
  function __spree_complete
918
928
  set -l tokens (commandline -opc) (commandline -ct)
919
929
  spree __complete $tokens[2..-1]
@@ -932,43 +942,64 @@ _spree() {
932
942
  COMPREPLY=( $(spree __complete "\${words[@]}") )
933
943
  }
934
944
  complete -F _spree spree
935
- `}function qh(e){e.command("completion <shell>").description("Output a shell completion script (bash, zsh, or fish)").action(t=>{if(!bh.includes(t)){process.stderr.write(`Unsupported shell "${t}". Choose one of: ${bh.join(", ")}.
936
- `),process.exitCode=2;return}process.stdout.write(C0(t))}),e.command("__complete",{hidden:!0}).allowUnknownOption().argument("[words...]").action(t=>{for(let r of P0(t??[]))process.stdout.write(`${r}
937
- `)})}function kh(e){e.command("console").description("Open Rails console").action(async()=>{let t=b();await M(["bin/rails","console"],t.projectDir,{edgeHint:"then open the console"})})}var Ie=D(K(),1);var T0=["bin/rails","db:drop","db:create","spree:install:migrations","db:migrate","db:seed"];function vh(e){e.command("db:reset").description("Drop, create, migrate, and seed the dev database (destructive; self-heals a running stack)").option("--yes","skip the confirmation prompt (for CI)").action(async t=>{let r=b(),i=a=>{j(a.join(`
938
- `)),process.exit(1)};if(Fe(r.projectDir)&&i(["This is a monorepo edge project (SPREE_PATH set in .env).",`Reset the dev database from the monorepo root with ${Ie.default.bold("pnpm server:setup")}`,"(or the relevant `pnpm server:*` script) \u2014 the project-local compose is not the","running config here."]),!t.yes){let a=await Je({message:"This will drop the spree_development database. Continue?",initialValue:!1});(L(a)||!a)&&(j("Cancelled."),process.exit(0))}let n,s;try{s=await Ge(r.projectDir),n=(await Promise.all(s.map(o=>mt(o,r.projectDir)))).some(Boolean)}catch(a){return i(["Could not inspect the Docker stack from this directory.",` ${Ie.default.dim(String(a.message).split(`
939
- `)[0])}`,"",`Run ${Ie.default.bold("spree db:reset")} from your project root (the directory holding the`,".env with SECRET_KEY_BASE), and make sure Docker is running."])}if(n){let a=I();a.start("Stopping the app to release database connections..."),await Z(["stop",...s],r.projectDir),a.stop("App stopped.")}try{await Va(T0,r.projectDir,{captureStderr:!0})}catch(a){let o=String(a.stderr??a.message??"");throw/being accessed by other users|55006/.test(o)&&i(["Could not drop spree_development \u2014 another client is still connected.",`A database client (TablePlus, DataGrip, psql) may be connected on port ${Ie.default.bold("5433")}.`,"Disconnect it, then re-run `spree db:reset`.",...n?["",`Bring the stack back up with ${Ie.default.bold("spree dev")}.`]:[]]),a}q.success("Database reset."),n&&V(`Bring the stack back up with ${Ie.default.bold("spree dev")}.`,"Done")}),e.command("db:console").description("Open a psql session against the dev database").action(async()=>{let t=b(),r;try{r=await mt("postgres",t.projectDir)}catch(i){j(["Could not inspect the Docker stack from this directory.",` ${Ie.default.dim(String(i.message).split(`
940
- `)[0])}`,"",`Run ${Ie.default.bold("spree db:console")} from your project root, and make sure Docker is running.`].join(`
941
- `)),process.exit(1)}r||(j(["Postgres is not running.",`Start the stack with ${Ie.default.bold("spree dev")}, then re-run ${Ie.default.bold("spree db:console")}.`].join(`
942
- `)),process.exit(1)),await ht(["psql","-U","postgres","spree_development"],t.projectDir,{service:"postgres"})})}import $h from"fs";var pe=D(K(),1);import{spawn as R0}from"child_process";import ko from"fs";import ir from"path";var Fr=D(K(),1);function jt(e){return ko.existsSync(ir.join(e,"apps","dashboard","package.json"))}function Gr(e){let t=ir.join(e,"apps","dashboard");return ko.existsSync(ir.join(t,"package.json"))&&ko.existsSync(ir.join(t,"node_modules"))}function In(e){let t=ir.join(e,"apps","dashboard");q.warn(`${Fr.default.bold("apps/dashboard/")} has no dependencies installed \u2014 skipping its dev server. Install them (cd apps/dashboard && ${Jt(e,t)} install) and rerun.`)}var I0=Fr.default.dim("dashboard | "),O0=new RegExp("\x1B\\[[0-9;]*m","g");function On(e){if(!Gr(e))return null;let t=ir.join(e,"apps","dashboard"),r=Jt(e,t),i=process.platform==="win32",n=R0(r,["run","dev"],{cwd:t,stdio:["ignore","pipe","pipe"],detached:!i,shell:i}),s=`http://localhost:${5173}`,a=!1,o=()=>{},p=new Promise(m=>{o=m}),d=m=>{a=!0,clearTimeout(c),o(m)},c=setTimeout(()=>d(s),3e4);c.unref();let u=(m,h)=>{let f="";m.on("data",w=>{f+=w.toString();let v=f.split(`
943
- `);f=v.pop()??"";for(let x of v)if(h.write(`${I0}${x}
944
- `),!a){let _=x.replace(O0,"").match(/Local:\s+(http:\/\/\S+?)\/?\s*$/);_&&d(_[1])}})};n.stdout&&u(n.stdout,process.stdout),n.stderr&&u(n.stderr,process.stderr);let l=!1;return n.on("error",m=>{d(s),q.warn(`Could not start the dashboard dev server (${m.message}) \u2014 start it manually with ${Fr.default.bold(`cd apps/dashboard && ${r} run dev`)}. The API keeps running.`)}),n.on("exit",(m,h)=>{d(s),!l&&h===null&&m!==null&&m!==0&&m!==130&&q.warn(`The dashboard dev server exited (code ${m}) \u2014 restart it with ${Fr.default.bold(`cd apps/dashboard && ${r} run dev`)}. The API keeps running.`)}),{url:p,stop:()=>{if(l=!0,d(s),!(n.exitCode!==null||n.killed)){if(!i&&n.pid)try{process.kill(-n.pid,"SIGTERM");return}catch{}n.kill("SIGTERM")}}}}import nr from"fs";import{platform as L0}from"os";import Ur from"path";var J=D(K(),1);var B0=3e3,wh=12e4;function Sh(e){e.command("init").description("First-run setup: start services, seed the database, configure API keys").option("--no-sample-data","skip loading sample data on scripted installs (see --admin-email)").option("--no-open","skip opening browser").option("--admin-email <email>","scripted installs only: seed an admin account instead of printing the setup link").option("--admin-password <password>","password for the admin account seeded by --admin-email").action(async t=>{await vo(t)})}async function vo(e){let t=b(),{adminEmail:r,adminPassword:i}=N0(e),n=e.sampleData&&($n(t.projectDir)??!0);q.step("Pulling latest images..."),await Z(["pull"],t.projectDir,{stdio:"inherit"});let s=I();s.start("Starting Docker services..."),await lt(t.projectDir,{stdio:"ignore"}),await Z(["up","-d"],t.projectDir),s.stop("Docker services started."),s.start("Waiting for Spree to be ready..."),await z0(t.port),s.stop("Spree is ready."),s.start("Seeding database...");let o=(await se("db:seed",t.projectDir,r&&i?{ADMIN_EMAIL:r,ADMIN_PASSWORD:i}:void 0)).match(/\/setup\?token=(\S+)/)?.[1];s.stop("Database seeded."),r&&i&&wm(t.projectDir,r),s.start("Configuring API keys...");let p=await M0(t.projectDir);U0(t.projectDir,p);let d=await G0(t.projectDir,t.port);s.stop("API keys configured."),await xh(t.projectDir,"storefront"),await xh(t.projectDir,"dashboard"),En(t.projectDir,t.port);let c=n&&!!(r&&i);c?(s.start("Loading sample data..."),await se("spree:load_sample_data",t.projectDir),s.stop("Sample data loaded.")):n&&q.info('Sample data: tick "Load sample data" on the setup screen, or run `spree sample-data` any time later.'),s.start("Indexing products for search..."),await se("spree:search:reindex",t.projectDir),s.stop("Search index ready."),km(t.projectDir);let u=Gr(t.projectDir);jt(t.projectDir)&&!u&&In(t.projectDir);let l=u?`http://localhost:${5173}`:`http://localhost:${t.port}/dashboard`,m=r&&i?[` Email: ${r}`,` Password: ${i}`]:[` ${J.default.dim("Create your admin account (and load sample data, if you like):")}`,` ${J.default.cyan(o?`${l}/setup?token=${o}`:"run `spree run bin/rails spree:setup:token` for the setup link")}`],h=u?[J.default.bold("Admin Dashboard"),` ${J.default.cyan(`http://localhost:${5173}`)}`,...m,` ${J.default.dim("Live-reloading from apps/dashboard/")}`]:[J.default.bold("Admin Dashboard"),` ${J.default.dim(`Not installed \u2014 add it with ${J.default.bold("spree add dashboard")}`)}`,...m],f=c&&F0(t.projectDir)?[J.default.bold("Wholesale portal (B2B demo)"),` ${J.default.cyan(`http://localhost:${3001}/wholesale`)} ${J.default.dim("\u2014 needs the storefront dev server running")}`,` ${J.default.dim('Register a buyer, then approve them in the admin (add to the "Wholesale" customer group)')}`,""]:[];V(["",...h,"",J.default.bold("Store API"),` ${J.default.cyan(`http://localhost:${t.port}/api/v3/store`)}`,` Publishable key: ${J.default.cyan(p)}`,"",...f,J.default.bold("Admin API"),` ${J.default.cyan(`http://localhost:${t.port}/api/v3/admin`)}`,` Secret key: ${J.default.cyan(d)}`,` ${J.default.dim("Saved to .spree/credentials.json")}`,""].join(`
945
- `),"Your Spree store is ready!");let w=u?On(t.projectDir):null,v=()=>{w?.stop(),process.exit(130)};process.once("SIGINT",v);try{if(e.open){let x=w?await w.url:null,_=o&&x?`${x.replace(/\/$/,"")}/setup?token=${o}`:x??`http://localhost:${t.port}`;await H0(_)}q.info(`Streaming logs (Ctrl+C to stop)...
946
- `),await Ar("web",t.projectDir)}finally{process.removeListener("SIGINT",v),w?.stop()}}async function xh(e,t){let r=Ur.join(e,"apps",t);if(!nr.existsSync(Ur.join(r,"package.json"))||nr.existsSync(Ur.join(r,"node_modules")))return;let i=Jt(e,r),n=I();n.start(`Installing ${t} dependencies with ${i}...`);try{await te(i,["install"],{cwd:r}),n.stop(`${t==="dashboard"?"Dashboard":"Storefront"} dependencies installed.`)}catch(s){n.stop(J.default.yellow(`${i} install failed \u2014 run it manually in apps/${t}/.`)),q.warn(s instanceof Error?s.message:String(s))}}async function z0(e){let t=`http://localhost:${e}/up`,r=Date.now();for(;Date.now()-r<wh;){try{if((await fetch(t)).ok)return}catch{}await new Promise(i=>setTimeout(i,B0))}throw new Error(`Spree did not become healthy within ${wh/1e3}s`)}async function M0(e){let t=await se("spree:cli:ensure_api_key",e),r=t.match(/pk_[A-Za-z0-9_-]+/);if(!r)throw new Error(`Could not extract API key from Rails output: ${t}`);return r[0]}function F0(e){let t=Ur.join(e,"apps","storefront",".env.local");try{return nr.readFileSync(t,"utf-8").match(/^SPREE_WHOLESALE_CHANNEL=(\S+)/m)?.[1]??null}catch{return null}}async function G0(e,t){let{token:r}=await Qa(e,t,!0);return r}function U0(e,t){let r=Ur.join(e,"apps","storefront",".env.local");if(!nr.existsSync(r))return;let i=nr.readFileSync(r,"utf-8");nr.writeFileSync(r,i.replace(/^SPREE_PUBLISHABLE_KEY=.*/m,`SPREE_PUBLISHABLE_KEY=${t}`))}function N0(e){let{adminEmail:t,adminPassword:r}=e;return t&&!t.includes("@")&&(j(`Invalid --admin-email: ${t}`),process.exit(1)),r&&r.length<8&&(j("Invalid --admin-password: use at least 8 characters."),process.exit(1)),!!t!=!!r&&(j("Pass both --admin-email and --admin-password, or neither."),process.exit(1)),{adminEmail:t,adminPassword:r}}async function H0(e){let t=L0(),r=t==="darwin"?"open":t==="win32"?"start":"xdg-open";try{await ut(`${r} ${e}`,{stdio:"ignore"})}catch{}}function Eh(e){e.command("dev").description("Run the app in the foreground \u2014 the API, plus the React Dashboard dev server when apps/dashboard exists; Ctrl+C stops them").action(async()=>{let t=b();if(Fe(t.projectDir)&&(j(["This project uses SPREE_PATH for monorepo development.",`Use ${pe.default.bold("pnpm server:dev")} from the monorepo root instead of ${pe.default.bold("spree dev")}.`,"It loads the edge compose overlay and sets SPREE_PATH so the Spree gems resolve to the monorepo source."].join(`
947
- `)),process.exit(1)),En(t.projectDir,t.port),!Sn(t.projectDir)&&!$h.existsSync(Ja(t.projectDir))&&!$h.existsSync(Yt(t.projectDir))){let o=$n(t.projectDir)!==void 0;if(!o)try{o=!await fm(t.projectDir)}catch{}if(o){q.info("First run detected \u2014 completing setup automatically."),await vo({sampleData:!0,open:!0});return}}let r=jt(t.projectDir)&&Gr(t.projectDir);jt(t.projectDir)&&!r&&In(t.projectDir),V(["",...r?[pe.default.bold("Admin Dashboard"),` ${pe.default.cyan(`http://localhost:${5173}`)}`,...Ah(t.projectDir),` ${pe.default.dim("Live-reloading from apps/dashboard/")}`]:[pe.default.bold("Admin Dashboard"),` ${pe.default.dim(`Not installed \u2014 add it with ${pe.default.bold("spree add dashboard")}`)}`,...Ah(t.projectDir)],"",pe.default.bold("Store API"),` ${pe.default.cyan(`http://localhost:${t.port}/api/v3/store`)}`,""].join(`
948
- `),"Spree Commerce"),q.info(`Starting services \u2014 ${r?"API + dashboard logs":"API logs"} stream below. ${pe.default.bold("Ctrl+C")} stops them (databases keep running; ${pe.default.bold("spree stop")} shuts everything down).
949
- `);let i=()=>{};process.on("SIGINT",i);let n,s=null;try{await lt(t.projectDir),s=r?On(t.projectDir):null,n=await Z(["up",...await Ge(t.projectDir)],t.projectDir,{stdio:"inherit",reject:!1})}finally{s?.stop(),process.off("SIGINT",i)}let a=n.exitCode??0;a!==0&&a!==130&&(j(`docker compose exited with code ${a} \u2014 see the output above.`),process.exit(a)),Ct(`${r?"API + dashboard":"API"} stopped. Databases keep running \u2014 ${pe.default.bold("spree stop")} shuts everything down.`)})}function Ah(e){let t=xm(e);return t?[` Email: ${t}`,` Password: ${pe.default.dim("chosen during spree init")}`]:[` ${pe.default.dim("Create your admin account with the setup link from `spree init`")}`]}import Nr from"fs";import wo from"path";var be=D(K(),1);function Ph(e){e.command("eject").description("Switch to the dev compose: bind-mount the Rails app with hot reload").action(async()=>{let t=b(),r=xn(t.projectDir),i=wo.join(t.projectDir,r);Nr.existsSync(i)||(console.error(`
950
- ${be.default.red("Error:")} No ${r}/ directory found.
951
- `),process.exit(1));let n=wo.join(t.projectDir,"docker-compose.dev.yml");Nr.existsSync(n)||(console.error(`
952
- ${be.default.red("Error:")} No docker-compose.dev.yml found.
953
- `),process.exit(1));let s=Nr.readFileSync(n,"utf-8");s.includes("- .:/rails")&&(s=s.replace("- .:/rails",`- ./${r}:/rails`),Nr.writeFileSync(n,s)),Nr.writeFileSync(wo.join(t.projectDir,"docker-compose.yml"),s),console.log(`
954
- ${be.default.bold(`Switching to dev compose (bind-mounts ./${r})...`)}
955
- `),await lt(t.projectDir),await Z(["up","-d"],t.projectDir,{stdio:"inherit"}),console.log(`
956
- ${be.default.bold("Preparing the development database...")}
957
- `),await ht(["bin/rails","db:prepare"],t.projectDir,{tty:!1}),V([`The Rails API is now bind-mounted from ${be.default.bold(`./${r}`)} \u2014 edits are live.`,"",`The dev stack uses its own ${be.default.bold("spree_development")} database (just`,`created and seeded). Load demo products with ${be.default.bold("spree sample-data")}.`,"","You can now customize:",` ${be.default.dim(`${r}/app/`)} \u2014 models, controllers, services (instant reload)`,` ${be.default.dim(`${r}/config/`)} \u2014 Rails configuration (instant reload)`,` ${be.default.dim(`${r}/Gemfile`)} \u2014 add gems via ${be.default.bold("spree bundle add <gem>")}`,"",`Rebuild only on Dockerfile / .ruby-version changes: ${be.default.bold("spree build")}`].join(`
958
- `),"Ejected!")})}function jh(e){e.command("exec").description("Run an arbitrary command inside the web container").argument("<command...>","command and arguments to run").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await M(t,r.projectDir)})}var V0=new Set(["migration","controller","scaffold","scaffold_controller","mailer","job","channel","helper","resource","integration_test","system_test","task","generator","benchmark"]);function Ch(e){e.command("generate").alias("g").description("Run a generator (Spree generators auto-prefixed; Rails built-ins forwarded as-is)").argument("<name>","generator name (`model`, `model_decorator`, `migration`, \u2026)").argument("[args...]","arguments to pass to the generator").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let i=b(),n=t.includes(":")||V0.has(t)?t:`spree:${t}`;await M(["bin/rails","g",n,...r],i.projectDir)})}var Dn=D(K(),1);function Th(e){e.command("logs").description("Stream service logs").argument("[service]","service name (e.g. web)","web").action(async t=>{let r=b();if(t==="worker"&&!(await Ge(r.projectDir)).includes("worker")){q.info(`This project has no ${Dn.default.bold("worker")} service \u2014 jobs run inside the web process (Solid Queue in Puma). Streaming ${Dn.default.bold("web")} logs; the job dashboard is at ${Dn.default.cyan(`http://localhost:${r.port}/jobs`)}.`),await Ar("web",r.projectDir);return}await Ar(t,r.projectDir)})}var Hr=D(K(),1);function Rh(e){e.command("migrate").description("Install pending Spree migrations from gems, then run them (`spree:install:migrations` + `db:migrate`)").argument("[args...]","extra args forwarded to db:migrate").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await mt("web",r.projectDir)?(console.log(`
959
- ${Hr.default.bold("\u2192 Installing pending Spree migrations from gems...")}`),await ht(["bin/rails","spree:install:migrations"],r.projectDir),console.log(`
960
- ${Hr.default.bold("\u2192 Running db:migrate...")}`),await ht(["bin/rails","db:migrate",...t],r.projectDir)):(console.log(`
961
- ${Hr.default.bold("\u2192 Installing + running pending Spree migrations...")}`),await M(["bin/rails","spree:install:migrations","db:migrate",...t],r.projectDir,{edgeHint:"the edge boot installs and runs pending migrations itself"})),V(`Run ${Hr.default.bold("spree migrate:status")} to inspect the migration log.`,"Migrations up to date")}),e.command("migrate:rollback").description("Roll back the last migration (`STEP=n` to roll back n steps)").argument("[args...]","extra args forwarded to db:rollback (e.g. STEP=2)").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await M(["bin/rails","db:rollback",...t],r.projectDir)}),e.command("migrate:status").description("Show migration status (`bin/rails db:migrate:status`)").action(async()=>{let t=b();await M(["bin/rails","db:migrate:status"],t.projectDir)})}import{platform as W0}from"os";function Ih(e){e.command("open").description("Open the admin dashboard in the browser").action(async()=>{let t=b(),r=jt(t.projectDir)?`http://localhost:${5173}`:`http://localhost:${t.port}`,i=W0();await ut(`${i==="darwin"?"open":i==="win32"?"start":"xdg-open"} ${r}`)})}import So from"fs";import ar from"path";import{fileURLToPath as K0}from"url";var N=D(K(),1);import nt from"fs";import Ln from"path";function Dh(e){let{src:t,dst:r,vars:i,skip:n,force:s}=e;if(!nt.existsSync(t))throw new Error(`Template source not found: ${t}`);if(nt.existsSync(r)){if(nt.readdirSync(r).length>0&&!s)throw new Error(`Destination ${r} is not empty. Pass force=true to overwrite.`)}else nt.mkdirSync(r,{recursive:!0});Lh(t,r,"",i,n)}function Lh(e,t,r,i,n){let s=Ln.join(e,r);for(let a of nt.readdirSync(s,{withFileTypes:!0})){let o=r?`${r}/${a.name}`:a.name;if(n?.(o))continue;let p=Bh(xo(a.name,i)),d=Ln.join(e,o);if(a.isDirectory()){let h=r?`${Oh(r,i)}/${p}`:p,f=Ln.join(t,h);nt.mkdirSync(f,{recursive:!0}),Lh(e,t,o,i,n);continue}let c=p.endsWith(".tt"),u=c?p.slice(0,-3):p,l=r?`${Oh(r,i)}/${u}`:u,m=Ln.join(t,l);if(c){let h=nt.readFileSync(d,"utf8");nt.writeFileSync(m,xo(h,i))}else nt.copyFileSync(d,m)}}function xo(e,t){return e.replace(/\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}/g,(r,i)=>Object.hasOwn(t,i)?t[i]:r)}function Oh(e,t){return e.split("/").map(r=>Bh(xo(r,t))).join("/")}function Bh(e){if(e.includes("/")||e.includes("\\")||e==="..")throw new Error(`Template variable produced an unsafe path segment: "${e}"`);return e}var Y0="../../templates/plugin",Bn=["MIT","Apache-2.0","BSD-3-Clause"];function Mh(e){e.command("plugin").description("Scaffold and manage Spree plugins (dashboard + Rails engine)").command("new").description("Scaffold a new Spree plugin monorepo (dashboard plugin half today; Rails engine coming soon)").argument("[name]","Plugin name (e.g. brands). If omitted, you will be prompted.").option("--ruby-name <name>","Ruby gem name (default: spree_<name>)").option("--module-name <name>","Ruby module / TS namespace (default: PascalCase of the gem name)").option("--npm-scope <scope>","npm scope, e.g. @acme (default: unscoped)").option("--author <name>","Author name (default: git config user.name)").option("--author-email <email>","Author email (default: git config user.email)").option("--license <license>",`License: ${Bn.join(", ")} (default: MIT)`).option("-y, --yes","Non-interactive: accept the default for every prompt not answered by a flag",!1).option("--no-dashboard","Skip the dashboard plugin half").option("--no-engine","Skip the Rails engine half (currently always skipped \u2014 engine support coming soon)").option("--no-install","Skip running pnpm install").option("--force","Overwrite a non-empty destination directory").action(async(r,i)=>{di(N.default.bgCyan(N.default.black(" Spree Plugin Scaffolder ")));let n=await J0(r,i);L(n)&&(j("Scaffolding cancelled."),process.exit(0));let s=ar.resolve(process.cwd(),n.name);So.existsSync(s)&&So.readdirSync(s).length>0&&!i.force&&(j(`Destination ${N.default.bold(s)} is not empty. Choose a different name or rerun with ${N.default.cyan("--force")}.`),process.exit(1));let a=Z0(n),o=iS(),p=I();p.start(`Scaffolding ${N.default.cyan(n.name)}...`);try{Dh({src:o,dst:s,vars:a,skip:Q0(n),force:i.force})}catch(d){p.stop("Scaffolding failed."),q.error(d instanceof Error?d.message:String(d)),process.exit(1)}p.stop(`Created ${N.default.cyan(s)}`),i.install?await eS(s,n):q.info(N.default.dim("Skipping dependency install \u2014 run them yourself when ready.")),tS(n,s,i.install),Ct("Happy hacking!")})}async function J0(e,t){let r=_=>{if(!_)return"Required";if(!/^[a-z][a-z0-9-]*$/.test(_))return'Use lowercase letters, digits, and dashes (e.g. "brands" or "loyalty-points")'};if(e!==void 0){let _=r(e);_&&(q.error(`Invalid plugin name ${N.default.bold(e)}: ${_}`),process.exit(2))}e===void 0&&t.yes&&(q.error("Pass the plugin name as an argument when using --yes: spree plugin new <name> -y"),process.exit(2));let i=e??await le({message:"Plugin name",placeholder:"brands",validate:r});if(L(i))return i;let n=`spree_${i.replace(/-/g,"_")}`,s=await sr({flag:"--ruby-name",flagValue:t.rubyName,fallback:n,yes:t.yes,validate:_=>_&&/^[a-z][a-z0-9_]*$/.test(_)?void 0:'Use lowercase letters, digits, and underscores (e.g. "spree_brands")',prompt:()=>le({message:"Ruby gem name",placeholder:n,initialValue:n,validate:_=>_&&/^[a-z][a-z0-9_]*$/.test(_)?void 0:'Use lowercase letters, digits, and underscores (e.g. "spree_brands")'})});if(L(s))return s;let a=rS(s),o=await sr({flag:"--module-name",flagValue:t.moduleName,fallback:a,yes:t.yes,validate:_=>_&&/^[A-Z][A-Za-z0-9]*$/.test(_)?void 0:'PascalCase (e.g. "SpreeBrands")',prompt:()=>le({message:"Ruby module / TS namespace",placeholder:a,initialValue:a,validate:_=>_&&/^[A-Z][A-Za-z0-9]*$/.test(_)?void 0:'PascalCase (e.g. "SpreeBrands")'})});if(L(o))return o;let p=_=>!_||/^@[a-z0-9][a-z0-9-]*$/.test(_)?void 0:"Must start with @ and contain lowercase letters/digits/dashes",d=await sr({flag:"--npm-scope",flagValue:t.npmScope,fallback:"",yes:t.yes,validate:p,prompt:()=>le({message:"npm scope (optional, leave blank for unscoped)",placeholder:"@my-org",initialValue:"",validate:p})});if(L(d))return d;let c=t.author===void 0?await zh("user.name"):void 0,u=await sr({flag:"--author",flagValue:t.author,fallback:c,yes:t.yes,validate:_=>_?void 0:"Required",prompt:()=>le({message:"Author name",placeholder:"Jane Developer",initialValue:c??"",validate:_=>_?void 0:"Required"})});if(L(u))return u;let l=_=>_&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(_)?void 0:"Enter a valid email",m=t.authorEmail===void 0?await zh("user.email"):void 0,h=await sr({flag:"--author-email",flagValue:t.authorEmail,fallback:m,yes:t.yes,validate:l,prompt:()=>le({message:"Author email",placeholder:"jane@example.com",initialValue:m??"",validate:l})});if(L(h))return h;let f=_=>_&&Bn.includes(_)?void 0:`Must be one of: ${Bn.join(", ")}`,w=await sr({flag:"--license",flagValue:t.license,fallback:"MIT",yes:t.yes,validate:f,prompt:()=>li({message:"License",options:Bn.map(_=>({value:_,label:_})),initialValue:"MIT"})});if(L(w))return w;let v=t.dashboard===!1?!1:t.yes||await X0("Include dashboard plugin?",!0);if(L(v))return v;let x=!1;return t.engine!==!1&&q.warn("Rails engine generation is coming in a future release. For now, scaffold the dashboard half here and use `spree-extension create` for the Ruby side."),!v&&!x&&(j("Nothing to scaffold (dashboard half declined)."),process.exit(1)),{name:i,rubyName:s,moduleName:o,npmScope:d.trim(),authorName:u,authorEmail:h,license:w,includeDashboard:v,includeEngine:x}}async function X0(e,t){return await Je({message:e,initialValue:t})}async function sr(e){if(e.flagValue!==void 0){let t=e.validate(e.flagValue);return t&&(q.error(`Invalid value for ${N.default.cyan(e.flag)}: ${t}`),process.exit(2)),e.flagValue}if(e.yes){let t=e.validate(e.fallback);return(e.fallback===void 0||t)&&(q.error(`--yes could not resolve a default for ${N.default.cyan(e.flag)}`+(t?` (${t})`:"")+` \u2014 pass ${N.default.cyan(e.flag)} explicitly.`),process.exit(2)),e.fallback}return e.prompt()}async function zh(e){try{let{stdout:t}=await ut(`git config --get ${e}`);return t.trim()||void 0}catch{return}}function Z0(e){let t=e.npmScope?`${e.npmScope}/${e.name}`:e.name;return{name:e.name,plugin_name:e.name,ruby_name:e.rubyName,module_name:e.moduleName,npm_scope:e.npmScope,npm_package_name:t,npm_dashboard_package:e.npmScope?`${e.npmScope}/${e.name}-dashboard`:`${e.name}-dashboard`,author_name:e.authorName,author_email:e.authorEmail,license:e.license,year:String(new Date().getFullYear())}}function Q0(e){let t=!e.includeDashboard,r=!e.includeEngine;return i=>!!(t&&(i==="packages/dashboard"||i.startsWith("packages/dashboard/"))||r&&(i==="engine"||i.startsWith("engine/")))}async function eS(e,t){let r=I();if(t.includeDashboard){r.start("Running pnpm install...");try{await ut("pnpm install",{cwd:e,stdio:"pipe"}),r.stop("pnpm install complete.")}catch(i){r.stop(N.default.yellow("pnpm install failed \u2014 run it manually.")),q.warn(i instanceof Error?i.message:String(i))}}if(t.includeEngine){r.start("Running bundle install in engine/...");try{await ut("bundle install",{cwd:ar.join(e,"engine"),stdio:"pipe"}),r.stop("bundle install complete.")}catch(i){r.stop(N.default.yellow("bundle install failed \u2014 run it manually.")),q.warn(i instanceof Error?i.message:String(i))}}}function tS(e,t,r){let i=[""];i.push(N.default.bold("Next steps")),i.push(` ${N.default.dim("cd")} ${ar.relative(process.cwd(),t)||"."}`),r||(e.includeDashboard&&i.push(` ${N.default.dim("pnpm")} install`),e.includeEngine&&i.push(` ${N.default.dim("cd engine && bundle")} install && ${N.default.dim("cd ..")}`)),e.includeDashboard&&(i.push(""),i.push(N.default.bold("Dashboard plugin")),i.push(` Edit ${N.default.cyan("packages/dashboard/src/index.tsx")} to register nav entries and slot widgets.`),i.push(` Add pages as file routes in ${N.default.cyan("packages/dashboard/src/routes/")} \u2014 compiled into the host's typed route tree.`),i.push(` See ${N.default.cyan("https://spreecommerce.org/docs/developer/dashboard/plugins/overview")}`)),e.includeEngine&&(i.push(""),i.push(N.default.bold("Rails engine")),i.push(` Edit ${N.default.cyan(`engine/app/controllers/spree/api/v3/admin/${e.rubyName}_controller.rb`)}`),i.push(` See ${N.default.cyan("https://spreecommerce.org/docs/developer/contributing/creating-an-extension")}`)),i.push(""),V(i.join(`
962
- `),"Your plugin is scaffolded.")}function rS(e){return e.split(/[_-]/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function iS(){let e=ar.dirname(K0(import.meta.url)),t=[ar.resolve(e,Y0),ar.resolve(e,"templates/plugin")];for(let r of t)if(So.existsSync(r))return r;throw new Error(`Plugin template not found. Looked in:
945
+ `}function jh(e){e.command("completion <shell>").description("Output a shell completion script (bash, zsh, or fish)").action(t=>{if(!Ph.includes(t)){process.stderr.write(`Unsupported shell "${t}". Choose one of: ${Ph.join(", ")}.
946
+ `),process.exitCode=2;return}process.stdout.write(Q0(t))}),e.command("__complete",{hidden:!0}).allowUnknownOption().argument("[words...]").action(t=>{for(let r of X0(t??[]))process.stdout.write(`${r}
947
+ `)})}p();function Ch(e){e.command("console").description("Open Rails console").action(async()=>{let t=k();await G(["bin/rails","console"],t.projectDir,{edgeHint:"then open the console"})})}p();var Le=B(J(),1);var eS=["bin/rails","db:drop","db:create","spree:install:migrations","db:migrate","db:seed"];function Th(e){e.command("db:reset").description("Drop, create, migrate, and seed the dev database (destructive; self-heals a running stack)").option("--yes","skip the confirmation prompt (for CI)").action(async t=>{let r=k(),i=a=>{T(a.join(`
948
+ `)),process.exit(1)};if(Ne(r.projectDir)&&i(["This is a monorepo edge project (SPREE_PATH set in .env).",`Reset the dev database from the monorepo root with ${Le.default.bold("pnpm server:setup")}`,"(or the relevant `pnpm server:*` script) \u2014 the project-local compose is not the","running config here."]),!t.yes){let a=await Qe({message:"This will drop the spree_development database. Continue?",initialValue:!1});(z(a)||!a)&&(T("Cancelled."),process.exit(0))}let n,s;try{s=await Ve(r.projectDir),n=(await Promise.all(s.map(o=>gt(o,r.projectDir)))).some(Boolean)}catch(a){return i(["Could not inspect the Docker stack from this directory.",` ${Le.default.dim(String(a.message).split(`
949
+ `)[0])}`,"",`Run ${Le.default.bold("spree db:reset")} from your project root (the directory holding the`,".env with SECRET_KEY_BASE), and make sure Docker is running."])}if(n){let a=D();a.start("Stopping the app to release database connections..."),await ee(["stop",...s],r.projectDir),a.stop("App stopped.")}try{await Qa(eS,r.projectDir,{captureStderr:!0})}catch(a){let o=String(a.stderr??a.message??"");throw/being accessed by other users|55006/.test(o)&&i(["Could not drop spree_development \u2014 another client is still connected.",`A database client (TablePlus, DataGrip, psql) may be connected on port ${Le.default.bold("5433")}.`,"Disconnect it, then re-run `spree db:reset`.",...n?["",`Bring the stack back up with ${Le.default.bold("spree dev")}.`]:[]]),a}v.success("Database reset."),n&&H(`Bring the stack back up with ${Le.default.bold("spree dev")}.`,"Done")}),e.command("db:console").description("Open a psql session against the dev database").action(async()=>{let t=k(),r;try{r=await gt("postgres",t.projectDir)}catch(i){T(["Could not inspect the Docker stack from this directory.",` ${Le.default.dim(String(i.message).split(`
950
+ `)[0])}`,"",`Run ${Le.default.bold("spree db:console")} from your project root, and make sure Docker is running.`].join(`
951
+ `)),process.exit(1)}r||(T(["Postgres is not running.",`Start the stack with ${Le.default.bold("spree dev")}, then re-run ${Le.default.bold("spree db:console")}.`].join(`
952
+ `)),process.exit(1)),await ft(["psql","-U","postgres","spree_development"],t.projectDir,{service:"postgres"})})}p();import Dh from"fs";var de=B(J(),1);p();import{spawn as tS}from"child_process";import Eo from"fs";import pr from"path";var Kr=B(J(),1);function Rt(e){return Eo.existsSync(pr.join(e,"apps","dashboard","package.json"))}function Yr(e){let t=pr.join(e,"apps","dashboard");return Eo.existsSync(pr.join(t,"package.json"))&&Eo.existsSync(pr.join(t,"node_modules"))}function Fn(e){let t=pr.join(e,"apps","dashboard");v.warn(`${Kr.default.bold("apps/dashboard/")} has no dependencies installed \u2014 skipping its dev server. Install them (cd apps/dashboard && ${tr(e,t)} install) and rerun.`)}var rS=Kr.default.dim("dashboard | "),iS=new RegExp("\x1B\\[[0-9;]*m","g");function Gn(e){if(!Yr(e))return null;let t=pr.join(e,"apps","dashboard"),r=tr(e,t),i=process.platform==="win32",n=tS(r,["run","dev"],{cwd:t,stdio:["ignore","pipe","pipe"],detached:!i,shell:i}),s=`http://localhost:${5173}`,a=!1,o=()=>{},c=new Promise(y=>{o=y}),u=y=>{a=!0,clearTimeout(d),o(y)},d=setTimeout(()=>u(s),3e4);d.unref();let l=(y,g)=>{let b="";y.on("data",S=>{b+=S.toString();let x=b.split(`
953
+ `);b=x.pop()??"";for(let $ of x)if(g.write(`${rS}${$}
954
+ `),!a){let q=$.replace(iS,"").match(/Local:\s+(http:\/\/\S+?)\/?\s*$/);q&&u(q[1])}})};n.stdout&&l(n.stdout,process.stdout),n.stderr&&l(n.stderr,process.stderr);let h=!1;return n.on("error",y=>{u(s),v.warn(`Could not start the dashboard dev server (${y.message}) \u2014 start it manually with ${Kr.default.bold(`cd apps/dashboard && ${r} run dev`)}. The API keeps running.`)}),n.on("exit",(y,g)=>{u(s),!h&&g===null&&y!==null&&y!==0&&y!==130&&v.warn(`The dashboard dev server exited (code ${y}) \u2014 restart it with ${Kr.default.bold(`cd apps/dashboard && ${r} run dev`)}. The API keeps running.`)}),{url:c,stop:()=>{if(h=!0,u(s),!(n.exitCode!==null||n.killed)){if(!i&&n.pid)try{process.kill(-n.pid,"SIGTERM");return}catch{}n.kill("SIGTERM")}}}}p();import cr from"fs";import{platform as sS}from"os";import Jr from"path";var Q=B(J(),1);var aS=3e3,Rh=12e4;function Oh(e){e.command("init").description("First-run setup: start services, seed the database, configure API keys").option("--no-sample-data","skip loading sample data on scripted installs (see --admin-email)").option("--no-open","skip opening browser").option("--admin-email <email>","scripted installs only: seed an admin account instead of printing the setup link").option("--admin-password <password>","password for the admin account seeded by --admin-email").action(async t=>{await Po(t)})}async function Po(e){let t=k(),{adminEmail:r,adminPassword:i}=lS(e),n=e.sampleData&&(Rn(t.projectDir)??!0);v.step("Pulling latest images..."),await ee(["pull"],t.projectDir,{stdio:"inherit"});let s=D();s.start("Starting Docker services..."),await yt(t.projectDir,{stdio:"ignore"}),await ee(["up","-d"],t.projectDir),s.stop("Docker services started."),s.start("Waiting for Spree to be ready..."),await oS(t.port),s.stop("Spree is ready."),s.start("Seeding database...");let o=(await oe("db:seed",t.projectDir,r&&i?{ADMIN_EMAIL:r,ADMIN_PASSWORD:i}:void 0)).match(/\/setup\?token=(\S+)/)?.[1];s.stop("Database seeded."),r&&i&&Rm(t.projectDir,r),s.start("Configuring API keys...");let c=await pS(t.projectDir);uS(t.projectDir,c);let u=await dS(t.projectDir,t.port);s.stop("API keys configured."),await Ih(t.projectDir,"storefront"),await Ih(t.projectDir,"dashboard"),On(t.projectDir,t.port);let d=n&&!!(r&&i);d?(s.start("Loading sample data..."),await oe("spree:load_sample_data",t.projectDir),s.stop("Sample data loaded.")):n&&v.info('Sample data: tick "Load sample data" on the setup screen, or run `spree sample-data` any time later.'),s.start("Indexing products for search..."),await oe("spree:search:reindex",t.projectDir),s.stop("Search index ready."),Cm(t.projectDir);let l=Yr(t.projectDir);Rt(t.projectDir)&&!l&&Fn(t.projectDir);let h=l?`http://localhost:${5173}`:`http://localhost:${t.port}/dashboard`,y=r&&i?[` Email: ${r}`,` Password: ${i}`]:[` ${Q.default.dim("Create your admin account (and load sample data, if you like):")}`,` ${Q.default.cyan(o?`${h}/setup?token=${o}`:"run `spree run bin/rails spree:setup:token` for the setup link")}`],g=l?[Q.default.bold("Admin Dashboard"),` ${Q.default.cyan(`http://localhost:${5173}`)}`,...y,` ${Q.default.dim("Live-reloading from apps/dashboard/")}`]:[Q.default.bold("Admin Dashboard"),` ${Q.default.dim(`Not installed \u2014 add it with ${Q.default.bold("spree add dashboard")}`)}`,...y],b=d&&cS(t.projectDir)?[Q.default.bold("Wholesale portal (B2B demo)"),` ${Q.default.cyan(`http://localhost:${3001}/wholesale`)} ${Q.default.dim("\u2014 needs the storefront dev server running")}`,` ${Q.default.dim('Register a buyer, then approve them in the admin (add to the "Wholesale" customer group)')}`,""]:[];H(["",...g,"",Q.default.bold("Store API"),` ${Q.default.cyan(`http://localhost:${t.port}/api/v3/store`)}`,` Publishable key: ${Q.default.cyan(c)}`,"",...b,Q.default.bold("Admin API"),` ${Q.default.cyan(`http://localhost:${t.port}/api/v3/admin`)}`,` Secret key: ${Q.default.cyan(u)}`,` ${Q.default.dim("Saved to .spree/credentials.json")}`,""].join(`
955
+ `),"Your Spree store is ready!");let S=l?Gn(t.projectDir):null,x=()=>{S?.stop(),process.exit(130)};process.once("SIGINT",x);try{if(e.open){let $=S?await S.url:null,q=o&&$?`${$.replace(/\/$/,"")}/setup?token=${o}`:$??`http://localhost:${t.port}`;await mS(q)}v.info(`Streaming logs (Ctrl+C to stop)...
956
+ `),await Ir("web",t.projectDir)}finally{process.removeListener("SIGINT",x),S?.stop()}}async function Ih(e,t){let r=Jr.join(e,"apps",t);if(!cr.existsSync(Jr.join(r,"package.json"))||cr.existsSync(Jr.join(r,"node_modules")))return;let i=tr(e,r),n=D();n.start(`Installing ${t} dependencies with ${i}...`);try{await ie(i,["install"],{cwd:r}),n.stop(`${t==="dashboard"?"Dashboard":"Storefront"} dependencies installed.`)}catch(s){n.stop(Q.default.yellow(`${i} install failed \u2014 run it manually in apps/${t}/.`)),v.warn(s instanceof Error?s.message:String(s))}}async function oS(e){let t=`http://localhost:${e}/up`,r=Date.now();for(;Date.now()-r<Rh;){try{if((await fetch(t)).ok)return}catch{}await new Promise(i=>setTimeout(i,aS))}throw new Error(`Spree did not become healthy within ${Rh/1e3}s`)}async function pS(e){let t=await oe("spree:cli:ensure_api_key",e),r=t.match(/pk_[A-Za-z0-9_-]+/);if(!r)throw new Error(`Could not extract API key from Rails output: ${t}`);return r[0]}function cS(e){let t=Jr.join(e,"apps","storefront",".env.local");try{return cr.readFileSync(t,"utf-8").match(/^SPREE_WHOLESALE_CHANNEL=(\S+)/m)?.[1]??null}catch{return null}}async function dS(e,t){let{token:r}=await ao(e,t,!0);return r}function uS(e,t){let r=Jr.join(e,"apps","storefront",".env.local");if(!cr.existsSync(r))return;let i=cr.readFileSync(r,"utf-8");cr.writeFileSync(r,i.replace(/^SPREE_PUBLISHABLE_KEY=.*/m,`SPREE_PUBLISHABLE_KEY=${t}`))}function lS(e){let{adminEmail:t,adminPassword:r}=e;return t&&!t.includes("@")&&(T(`Invalid --admin-email: ${t}`),process.exit(1)),r&&r.length<8&&(T("Invalid --admin-password: use at least 8 characters."),process.exit(1)),!!t!=!!r&&(T("Pass both --admin-email and --admin-password, or neither."),process.exit(1)),{adminEmail:t,adminPassword:r}}async function mS(e){let t=sS(),r=t==="darwin"?"open":t==="win32"?"start":"xdg-open";try{await ht(`${r} ${e}`,{stdio:"ignore"})}catch{}}function Bh(e){e.command("dev").description("Run the app in the foreground \u2014 the API, plus the React Dashboard dev server when apps/dashboard exists; Ctrl+C stops them").action(async()=>{let t=k();if(Ne(t.projectDir)&&(T(["This project uses SPREE_PATH for monorepo development.",`Use ${de.default.bold("pnpm server:dev")} from the monorepo root instead of ${de.default.bold("spree dev")}.`,"It loads the edge compose overlay and sets SPREE_PATH so the Spree gems resolve to the monorepo source."].join(`
957
+ `)),process.exit(1)),On(t.projectDir,t.port),!Xt(t.projectDir)&&!Dh.existsSync(io(t.projectDir))&&!Dh.existsSync(er(t.projectDir))){let o=Rn(t.projectDir)!==void 0;if(!o)try{o=!await Am(t.projectDir)}catch{}if(o){v.info("First run detected \u2014 completing setup automatically."),await Po({sampleData:!0,open:!0});return}}let r=Rt(t.projectDir)&&Yr(t.projectDir);Rt(t.projectDir)&&!r&&Fn(t.projectDir),H(["",...r?[de.default.bold("Admin Dashboard"),` ${de.default.cyan(`http://localhost:${5173}`)}`,...Lh(t.projectDir),` ${de.default.dim("Live-reloading from apps/dashboard/")}`]:[de.default.bold("Admin Dashboard"),` ${de.default.dim(`Not installed \u2014 add it with ${de.default.bold("spree add dashboard")}`)}`,...Lh(t.projectDir)],"",de.default.bold("Store API"),` ${de.default.cyan(`http://localhost:${t.port}/api/v3/store`)}`,""].join(`
958
+ `),"Spree Commerce"),v.info(`Starting services \u2014 ${r?"API + dashboard logs":"API logs"} stream below. ${de.default.bold("Ctrl+C")} stops them (databases keep running; ${de.default.bold("spree stop")} shuts everything down).
959
+ `);let i=()=>{};process.on("SIGINT",i);let n,s=null;try{await yt(t.projectDir),s=r?Gn(t.projectDir):null,n=await ee(["up",...await Ve(t.projectDir)],t.projectDir,{stdio:"inherit",reject:!1})}finally{s?.stop(),process.off("SIGINT",i)}let a=n.exitCode??0;a!==0&&a!==130&&(T(`docker compose exited with code ${a} \u2014 see the output above.`),process.exit(a)),It(`${r?"API + dashboard":"API"} stopped. Databases keep running \u2014 ${de.default.bold("spree stop")} shuts everything down.`)})}function Lh(e){let t=Im(e);return t?[` Email: ${t}`,` Password: ${de.default.dim("chosen during spree init")}`]:[` ${de.default.dim("Create your admin account with the setup link from `spree init`")}`]}p();import Xr from"fs";import jo from"path";var ke=B(J(),1);function zh(e){e.command("eject").description("Switch to the dev compose: bind-mount the Rails app with hot reload").action(async()=>{let t=k(),r=Jt(t.projectDir),i=jo.join(t.projectDir,r);Xr.existsSync(i)||(console.error(`
960
+ ${ke.default.red("Error:")} No ${r}/ directory found.
961
+ `),process.exit(1));let n=jo.join(t.projectDir,"docker-compose.dev.yml");Xr.existsSync(n)||(console.error(`
962
+ ${ke.default.red("Error:")} No docker-compose.dev.yml found.
963
+ `),process.exit(1));let s=Xr.readFileSync(n,"utf-8");s.includes("- .:/rails")&&(s=s.replace("- .:/rails",`- ./${r}:/rails`),Xr.writeFileSync(n,s)),Xr.writeFileSync(jo.join(t.projectDir,"docker-compose.yml"),s),console.log(`
964
+ ${ke.default.bold(`Switching to dev compose (bind-mounts ./${r})...`)}
965
+ `),await yt(t.projectDir),await ee(["up","-d"],t.projectDir,{stdio:"inherit"}),console.log(`
966
+ ${ke.default.bold("Preparing the development database...")}
967
+ `),await ft(["bin/rails","db:prepare"],t.projectDir,{tty:!1}),H([`The Rails API is now bind-mounted from ${ke.default.bold(`./${r}`)} \u2014 edits are live.`,"",`The dev stack uses its own ${ke.default.bold("spree_development")} database (just`,`created and seeded). Load demo products with ${ke.default.bold("spree sample-data")}.`,"","You can now customize:",` ${ke.default.dim(`${r}/app/`)} \u2014 models, controllers, services (instant reload)`,` ${ke.default.dim(`${r}/config/`)} \u2014 Rails configuration (instant reload)`,` ${ke.default.dim(`${r}/Gemfile`)} \u2014 add gems via ${ke.default.bold("spree bundle add <gem>")}`,"",`Rebuild only on Dockerfile / .ruby-version changes: ${ke.default.bold("spree build")}`].join(`
968
+ `),"Ejected!")})}p();import gS from"crypto";import Ee from"fs";import ur from"path";var Qr=B(J(),1);p();import hS from"crypto";import dr from"fs";import Zr from"path";var To=["ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY","ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY","ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT"],Mh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Co(e=32){let t="";for(let r=0;r<e;r++)t+=Mh[hS.randomInt(Mh.length)];return t}function Ro(){return{ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY:Co(),ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY:Co(),ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT:Co()}}function Fh(e){return To.map(t=>`${t}=${e[t]}`).join(`
969
+ `)}function Gh(e){return new RegExp(`^[ \\t]*(?:export[ \\t]+)?${e}[ \\t]*=(.*)$`,"m")}function yS(e){let t=e.trim(),r=t.match(/^(['"])(.*?)\1/);return r?r[2]:t.replace(/(^|\s)#.*$/,"").trim()}function Uh(e){return To.filter(t=>{let r=e.match(Gh(t));return r?yS(r[1]).length>0:!1})}function Nh(e){let t=Zr.join(e,"config"),r=[];dr.existsSync(Zr.join(t,"credentials.yml.enc"))&&r.push("config/credentials.yml.enc");let i=Zr.join(t,"credentials");if(dr.existsSync(i))for(let n of dr.readdirSync(i))n.endsWith(".yml.enc")&&r.push(`config/credentials/${n}`);return r}function Vh(e,t){let r=e,i=[];for(let n of To){let s=Gh(n);s.test(r)?r=r.replace(s,`${n}=${t[n]}`):i.push(n)}return i.length>0&&(r.length>0&&!r.endsWith(`
970
+ `)&&(r+=`
971
+ `),r+=`# Active Record encryption \u2014 back these up; never change them once data is encrypted
972
+ `,r+=`${i.map(n=>`${n}=${t[n]}`).join(`
973
+ `)}
974
+ `),r}function Hh(e){let t=Zr.join(e,"config");if(!dr.existsSync(t))return!1;let r=[t];for(;r.length>0;){let i=r.pop();for(let n of dr.readdirSync(i,{withFileTypes:!0})){let s=Zr.join(i,n.name);if(n.isDirectory())r.push(s);else if(n.name.endsWith(".rb")&&dr.readFileSync(s,"utf-8").includes("ACTIVE_RECORD_ENCRYPTION_"))return!0}}return!1}var Wh=` %i[primary_key deterministic_key key_derivation_salt].each do |key|
975
+ value = ENV["ACTIVE_RECORD_ENCRYPTION_#{key.upcase}"].presence ||
976
+ credentials.dig(:active_record_encryption, key).presence
977
+ config.active_record.encryption[key] = value if value
978
+ end`;var fS="https://spreecommerce.org/docs/developer/deployment/environment_variables#active-record-encryption";function Kh(e){e.command("encryption").description("Manage Active Record encryption keys").command("init").description("Generate Active Record encryption keys and add them to .env (never overwrites existing keys)").option("--print","only print a fresh set of keys (e.g. for your hosting provider)").addHelpText("after",`
979
+ Spree encrypts webhook signing keys, payment gateway customer ids and OAuth tokens
980
+ at rest only when these keys are set. Once data is encrypted, never change them \u2014
981
+ encrypted rows become unreadable. There is deliberately no --force.`).action(r=>{if(r.print){process.stdout.write(`${Fh(Ro())}
982
+ `);return}_S(k().projectDir)})}function _S(e){let t=ur.join(e,".env"),r=Ee.existsSync(t)?Ee.readFileSync(t,"utf-8"):"",i=Uh(r),n=Jt(e),s=Xt(e);if(s&&!Hh(ur.join(e,n))&&v.warn(`${n}/config doesn't read these env vars yet. Add this inside the Application class in ${n}/config/application.rb:
983
+
984
+ `+Qr.default.dim(Wh)),i.length>0){v.warn(`.env already sets ${i.join(", ")} \u2014 leaving it unchanged.
985
+ Changing encryption keys makes data encrypted with them unreadable.`+(i.length<3?"\nAdd the missing values by hand (`spree encryption init --print`).":""));return}let a=Nh(ur.join(e,n));if(a.length>0){v.warn(`${n} has Rails credentials (${a.join(", ")}) \u2014 leaving .env unchanged.
986
+ If they hold active_record_encryption keys, env vars would take precedence and make
987
+ data encrypted with those keys unreadable. Check with \`bin/rails credentials:show\`;
988
+ if they hold none, add fresh keys to .env by hand (\`spree encryption init --print\`).`);return}bS(t,Vh(r,Ro())),v.success("Added Active Record encryption keys to .env."),H([`1. Recreate the containers to load the new .env: ${Qr.default.cyan(s?"spree dev":"spree update")}`,` (${Qr.default.cyan("spree restart")} keeps the old environment).`,"2. Back up the three values in your secret manager \u2014"," losing them makes encrypted data unreadable.","3. Production: set the three env vars on your host before deploying",` (a separate set: ${Qr.default.cyan("spree encryption init --print")}) and never change them.`,"",fS].join(`
989
+ `),"Next steps")}function bS(e,t){let r=Ee.existsSync(e)?Ee.realpathSync(e):e,i=Ee.existsSync(r)?Ee.statSync(r).mode&511:384,n=gS.randomBytes(6).toString("hex"),s=ur.join(ur.dirname(r),`.${ur.basename(r)}.${n}.tmp`),a=!1;try{let o=Ee.openSync(s,"wx",i);a=!0;try{Ee.writeFileSync(o,t)}finally{Ee.closeSync(o)}Ee.chmodSync(s,i),Ee.renameSync(s,r)}catch(o){throw a&&Ee.rmSync(s,{force:!0}),o}}p();function Yh(e){e.command("exec").description("Run an arbitrary command inside the web container").argument("<command...>","command and arguments to run").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=k();await G(t,r.projectDir)})}p();var qS=new Set(["migration","controller","scaffold","scaffold_controller","mailer","job","channel","helper","resource","integration_test","system_test","task","generator","benchmark"]);function Jh(e){e.command("generate").alias("g").description("Run a generator (Spree generators auto-prefixed; Rails built-ins forwarded as-is)").argument("<name>","generator name (`model`, `model_decorator`, `migration`, \u2026)").argument("[args...]","arguments to pass to the generator").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let i=k(),n=t.includes(":")||qS.has(t)?t:`spree:${t}`;await G(["bin/rails","g",n,...r],i.projectDir)})}p();var Un=B(J(),1);function Xh(e){e.command("logs").description("Stream service logs").argument("[service]","service name (e.g. web)","web").action(async t=>{let r=k();if(t==="worker"&&!(await Ve(r.projectDir)).includes("worker")){v.info(`This project has no ${Un.default.bold("worker")} service \u2014 jobs run inside the web process (Solid Queue in Puma). Streaming ${Un.default.bold("web")} logs; the job dashboard is at ${Un.default.cyan(`http://localhost:${r.port}/jobs`)}.`),await Ir("web",r.projectDir);return}await Ir(t,r.projectDir)})}p();var ei=B(J(),1);function Zh(e){e.command("migrate").description("Install pending Spree migrations from gems, then run them (`spree:install:migrations` + `db:migrate`)").argument("[args...]","extra args forwarded to db:migrate").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=k();await gt("web",r.projectDir)?(console.log(`
990
+ ${ei.default.bold("\u2192 Installing pending Spree migrations from gems...")}`),await ft(["bin/rails","spree:install:migrations"],r.projectDir),console.log(`
991
+ ${ei.default.bold("\u2192 Running db:migrate...")}`),await ft(["bin/rails","db:migrate",...t],r.projectDir)):(console.log(`
992
+ ${ei.default.bold("\u2192 Installing + running pending Spree migrations...")}`),await G(["bin/rails","spree:install:migrations","db:migrate",...t],r.projectDir,{edgeHint:"the edge boot installs and runs pending migrations itself"})),H(`Run ${ei.default.bold("spree migrate:status")} to inspect the migration log.`,"Migrations up to date")}),e.command("migrate:rollback").description("Roll back the last migration (`STEP=n` to roll back n steps)").argument("[args...]","extra args forwarded to db:rollback (e.g. STEP=2)").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=k();await G(["bin/rails","db:rollback",...t],r.projectDir)}),e.command("migrate:status").description("Show migration status (`bin/rails db:migrate:status`)").action(async()=>{let t=k();await G(["bin/rails","db:migrate:status"],t.projectDir)})}p();import{platform as kS}from"os";function Qh(e){e.command("open").description("Open the admin dashboard in the browser").action(async()=>{let t=k(),r=Rt(t.projectDir)?`http://localhost:${5173}`:`http://localhost:${t.port}`,i=kS();await ht(`${i==="darwin"?"open":i==="win32"?"start":"xdg-open"} ${r}`)})}p();import Oo from"fs";import mr from"path";import{fileURLToPath as vS}from"url";var W=B(J(),1);p();var ey=m;p();import ot from"fs";import Nn from"path";function ry(e){let{src:t,dst:r,vars:i,skip:n,force:s}=e;if(!ot.existsSync(t))throw new Error(`Template source not found: ${t}`);if(ot.existsSync(r)){if(ot.readdirSync(r).length>0&&!s)throw new Error(`Destination ${r} is not empty. Pass force=true to overwrite.`)}else ot.mkdirSync(r,{recursive:!0});iy(t,r,"",i,n)}function iy(e,t,r,i,n){let s=Nn.join(e,r);for(let a of ot.readdirSync(s,{withFileTypes:!0})){let o=r?`${r}/${a.name}`:a.name;if(n?.(o))continue;let c=ny(Io(a.name,i)),u=Nn.join(e,o);if(a.isDirectory()){let g=r?`${ty(r,i)}/${c}`:c,b=Nn.join(t,g);ot.mkdirSync(b,{recursive:!0}),iy(e,t,o,i,n);continue}let d=c.endsWith(".tt"),l=d?c.slice(0,-3):c,h=r?`${ty(r,i)}/${l}`:l,y=Nn.join(t,h);if(d){let g=ot.readFileSync(u,"utf8");ot.writeFileSync(y,Io(g,i))}else ot.copyFileSync(u,y)}}function Io(e,t){return e.replace(/\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}/g,(r,i)=>Object.hasOwn(t,i)?t[i]:r)}function ty(e,t){return e.split("/").map(r=>ny(Io(r,t))).join("/")}function ny(e){if(e.includes("/")||e.includes("\\")||e==="..")throw new Error(`Template variable produced an unsafe path segment: "${e}"`);return e}var wS="../../templates/plugin",Vn=["MIT","Apache-2.0","BSD-3-Clause"];function ay(e){e.command("plugin").description("Scaffold and manage Spree plugins (dashboard + Rails engine)").command("new").description("Scaffold a new Spree plugin monorepo (dashboard plugin half today; Rails engine coming soon)").argument("[name]","Plugin name (e.g. brands). If omitted, you will be prompted.").option("--ruby-name <name>","Ruby gem name (default: spree_<name>)").option("--module-name <name>","Ruby module / TS namespace (default: PascalCase of the gem name)").option("--npm-scope <scope>","npm scope, e.g. @acme (default: unscoped)").option("--author <name>","Author name (default: git config user.name)").option("--author-email <email>","Author email (default: git config user.email)").option("--license <license>",`License: ${Vn.join(", ")} (default: MIT)`).option("-y, --yes","Non-interactive: accept the default for every prompt not answered by a flag",!1).option("--no-dashboard","Skip the dashboard plugin half").option("--no-engine","Skip the Rails engine half (currently always skipped \u2014 engine support coming soon)").option("--no-install","Skip running pnpm install").option("--force","Overwrite a non-empty destination directory").action(async(r,i)=>{bi(W.default.bgCyan(W.default.black(" Spree Plugin Scaffolder ")));let n=await xS(r,i);z(n)&&(T("Scaffolding cancelled."),process.exit(0));let s=mr.resolve(process.cwd(),n.name);Oo.existsSync(s)&&Oo.readdirSync(s).length>0&&!i.force&&(T(`Destination ${W.default.bold(s)} is not empty. Choose a different name or rerun with ${W.default.cyan("--force")}.`),process.exit(1));let a=$S(n),o=CS(),c=D();c.start(`Scaffolding ${W.default.cyan(n.name)}...`);try{ry({src:o,dst:s,vars:a,skip:AS(n),force:i.force})}catch(u){c.stop("Scaffolding failed."),v.error(u instanceof Error?u.message:String(u)),process.exit(1)}c.stop(`Created ${W.default.cyan(s)}`),i.install?await ES(s,n):v.info(W.default.dim("Skipping dependency install \u2014 run them yourself when ready.")),PS(n,s,i.install),It("Happy hacking!")})}async function xS(e,t){let r=q=>{if(!q)return"Required";if(!/^[a-z][a-z0-9-]*$/.test(q))return'Use lowercase letters, digits, and dashes (e.g. "brands" or "loyalty-points")'};if(e!==void 0){let q=r(e);q&&(v.error(`Invalid plugin name ${W.default.bold(e)}: ${q}`),process.exit(2))}e===void 0&&t.yes&&(v.error("Pass the plugin name as an argument when using --yes: spree plugin new <name> -y"),process.exit(2));let i=e??await he({message:"Plugin name",placeholder:"brands",validate:r});if(z(i))return i;let n=`spree_${i.replace(/-/g,"_")}`,s=await lr({flag:"--ruby-name",flagValue:t.rubyName,fallback:n,yes:t.yes,validate:q=>q&&/^[a-z][a-z0-9_]*$/.test(q)?void 0:'Use lowercase letters, digits, and underscores (e.g. "spree_brands")',prompt:()=>he({message:"Ruby gem name",placeholder:n,initialValue:n,validate:q=>q&&/^[a-z][a-z0-9_]*$/.test(q)?void 0:'Use lowercase letters, digits, and underscores (e.g. "spree_brands")'})});if(z(s))return s;let a=jS(s),o=await lr({flag:"--module-name",flagValue:t.moduleName,fallback:a,yes:t.yes,validate:q=>q&&/^[A-Z][A-Za-z0-9]*$/.test(q)?void 0:'PascalCase (e.g. "SpreeBrands")',prompt:()=>he({message:"Ruby module / TS namespace",placeholder:a,initialValue:a,validate:q=>q&&/^[A-Z][A-Za-z0-9]*$/.test(q)?void 0:'PascalCase (e.g. "SpreeBrands")'})});if(z(o))return o;let c=q=>!q||/^@[a-z0-9][a-z0-9-]*$/.test(q)?void 0:"Must start with @ and contain lowercase letters/digits/dashes",u=await lr({flag:"--npm-scope",flagValue:t.npmScope,fallback:"",yes:t.yes,validate:c,prompt:()=>he({message:"npm scope (optional, leave blank for unscoped)",placeholder:"@my-org",initialValue:"",validate:c})});if(z(u))return u;let d=t.author===void 0?await sy("user.name"):void 0,l=await lr({flag:"--author",flagValue:t.author,fallback:d,yes:t.yes,validate:q=>q?void 0:"Required",prompt:()=>he({message:"Author name",placeholder:"Jane Developer",initialValue:d??"",validate:q=>q?void 0:"Required"})});if(z(l))return l;let h=q=>q&&/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(q)?void 0:"Enter a valid email",y=t.authorEmail===void 0?await sy("user.email"):void 0,g=await lr({flag:"--author-email",flagValue:t.authorEmail,fallback:y,yes:t.yes,validate:h,prompt:()=>he({message:"Author email",placeholder:"jane@example.com",initialValue:y??"",validate:h})});if(z(g))return g;let b=q=>q&&Vn.includes(q)?void 0:`Must be one of: ${Vn.join(", ")}`,S=await lr({flag:"--license",flagValue:t.license,fallback:"MIT",yes:t.yes,validate:b,prompt:()=>ki({message:"License",options:Vn.map(q=>({value:q,label:q})),initialValue:"MIT"})});if(z(S))return S;let x=t.dashboard===!1?!1:t.yes||await SS("Include dashboard plugin?",!0);if(z(x))return x;let $=!1;return t.engine!==!1&&v.warn("Rails engine generation is coming in a future release. For now, scaffold the dashboard half here and use `spree-extension create` for the Ruby side."),!x&&!$&&(T("Nothing to scaffold (dashboard half declined)."),process.exit(1)),{name:i,rubyName:s,moduleName:o,npmScope:u.trim(),authorName:l,authorEmail:g,license:S,includeDashboard:x,includeEngine:$}}async function SS(e,t){return await Qe({message:e,initialValue:t})}async function lr(e){if(e.flagValue!==void 0){let t=e.validate(e.flagValue);return t&&(v.error(`Invalid value for ${W.default.cyan(e.flag)}: ${t}`),process.exit(2)),e.flagValue}if(e.yes){let t=e.validate(e.fallback);return(e.fallback===void 0||t)&&(v.error(`--yes could not resolve a default for ${W.default.cyan(e.flag)}`+(t?` (${t})`:"")+` \u2014 pass ${W.default.cyan(e.flag)} explicitly.`),process.exit(2)),e.fallback}return e.prompt()}async function sy(e){try{let{stdout:t}=await ht(`git config --get ${e}`);return t.trim()||void 0}catch{return}}function $S(e){let t=e.npmScope?`${e.npmScope}/${e.name}`:e.name;return{name:e.name,plugin_name:e.name,ruby_name:e.rubyName,module_name:e.moduleName,npm_scope:e.npmScope,npm_package_name:t,npm_dashboard_package:e.npmScope?`${e.npmScope}/${e.name}-dashboard`:`${e.name}-dashboard`,author_name:e.authorName,author_email:e.authorEmail,license:e.license,year:String(new Date().getFullYear()),...ey}}function AS(e){let t=!e.includeDashboard,r=!e.includeEngine;return i=>!!(t&&(i==="packages/dashboard"||i.startsWith("packages/dashboard/"))||r&&(i==="engine"||i.startsWith("engine/")))}async function ES(e,t){let r=D();if(t.includeDashboard){r.start("Running pnpm install...");try{await ht("pnpm install",{cwd:e,stdio:"pipe"}),r.stop("pnpm install complete.")}catch(i){r.stop(W.default.yellow("pnpm install failed \u2014 run it manually.")),v.warn(i instanceof Error?i.message:String(i))}}if(t.includeEngine){r.start("Running bundle install in engine/...");try{await ht("bundle install",{cwd:mr.join(e,"engine"),stdio:"pipe"}),r.stop("bundle install complete.")}catch(i){r.stop(W.default.yellow("bundle install failed \u2014 run it manually.")),v.warn(i instanceof Error?i.message:String(i))}}}function PS(e,t,r){let i=[""];i.push(W.default.bold("Next steps")),i.push(` ${W.default.dim("cd")} ${mr.relative(process.cwd(),t)||"."}`),r||(e.includeDashboard&&i.push(` ${W.default.dim("pnpm")} install`),e.includeEngine&&i.push(` ${W.default.dim("cd engine && bundle")} install && ${W.default.dim("cd ..")}`)),e.includeDashboard&&(i.push(""),i.push(W.default.bold("Dashboard plugin")),i.push(` Edit ${W.default.cyan("packages/dashboard/src/index.tsx")} to register nav entries and slot widgets.`),i.push(` Add pages as file routes in ${W.default.cyan("packages/dashboard/src/routes/")} \u2014 compiled into the host's typed route tree.`),i.push(` See ${W.default.cyan("https://spreecommerce.org/docs/developer/dashboard/plugins/overview")}`)),e.includeEngine&&(i.push(""),i.push(W.default.bold("Rails engine")),i.push(` Edit ${W.default.cyan(`engine/app/controllers/spree/api/v3/admin/${e.rubyName}_controller.rb`)}`),i.push(` See ${W.default.cyan("https://spreecommerce.org/docs/developer/contributing/creating-an-extension")}`)),i.push(""),H(i.join(`
993
+ `),"Your plugin is scaffolded.")}function jS(e){return e.split(/[_-]/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function CS(){let e=mr.dirname(vS(import.meta.url)),t=[mr.resolve(e,wS),mr.resolve(e,"templates/plugin")];for(let r of t)if(Oo.existsSync(r))return r;throw new Error(`Plugin template not found. Looked in:
963
994
  ${t.join(`
964
995
  `)}
965
996
 
966
- Reinstall @spree/cli to fix.`)}function Fh(e){e.command("rails").description("Run a Rails command (`bin/rails \u2026`) inside the web container").argument("<args...>","arguments to pass to bin/rails").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await M(["bin/rails",...t],r.projectDir)})}function Gh(e){e.command("rake").description("Run a rake task (`bin/rake \u2026`) inside the web container").argument("<args...>","task name and arguments").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await M(["bin/rake",...t],r.projectDir)})}function Uh(e){e.command("restart").description("Restart web + worker in place (does not reload Gemfile or compose changes)").action(async()=>{let t=b(),r=I();r.start("Restarting web + worker...");try{await Z(["restart",...await Ge(t.projectDir)],t.projectDir),r.stop("Services restarted.")}catch(i){throw r.stop("Restart failed."),i}})}function Nh(e){e.command("routes").description("Show Rails routes (`bin/rails routes`)").argument("[args...]","arguments to pass to bin/rails routes").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await M(["bin/rails","routes",...t],r.projectDir)})}function Hh(e){e.command("rspec").description("Run RSpec tests (`bundle exec rspec \u2026`) inside the web container").argument("[args...]","files, line numbers, and flags to pass to rspec").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await M(["bundle","exec","rspec",...t],r.projectDir,{env:{RAILS_ENV:"test"},edgeHint:"then re-run spree rspec"})})}function Vh(e){e.command("sample-data").description("Load sample data (products, categories, images)").action(async()=>{let t=b(),r=I();r.start("Loading sample data..."),await se("spree:load_sample_data",t.projectDir),r.stop("Sample data loaded.")})}function Wh(e){e.command("seed").description("Seed the database").action(async()=>{let t=b(),r=I();r.start("Seeding database..."),await se("db:seed",t.projectDir),r.stop("Database seeded.")})}function Kh(e){e.command("shell").alias("bash").description("Open an interactive bash shell inside the web container").action(async()=>{let t=b();await M(["bash"],t.projectDir,{edgeHint:"then open the shell"})})}function Yh(e){e.command("stop").description("Stop services").action(async()=>{let t=b(),r=I();r.start("Stopping services..."),await Z(["stop"],t.projectDir),r.stop("Services stopped.")})}function Jh(e){e.command("task").description("Run a Spree rake task (auto-prefixes `spree:`)").argument("<name>","task name (without `spree:` prefix)").argument("[args...]","arguments to pass to the task").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let i=b();await M(["bin/rake",`spree:${t}`,...r],i.projectDir)})}function Xh(e){e.command("update").description("Pull latest image and recreate containers").action(async()=>{let t=b();q.step("Pulling latest images..."),await Z(["pull"],t.projectDir,{stdio:"inherit"});let r=I();r.start("Recreating containers..."),await lt(t.projectDir,{stdio:"ignore"}),await Z(["up","-d"],t.projectDir),r.stop("Containers recreated."),q.success("Update complete! Migrations will run automatically on startup."),q.info("Run `spree logs` to follow the startup progress.")})}import Zh from"fs";import nS from"path";var qe=D(K(),1);function Qh(e){e.command("upgrade").description("Walk through a Spree version upgrade (bundle + migrate + spree:upgrade)").option("--plan","print the plan via spree:upgrade DRY_RUN=1; skip bundle + migrate").option("--step <id>","run a single rake step by id (skips bundle + migrate)").option("--to <version>","explicit target version (auto-detected from installed gem otherwise)").option("--yes","skip prompts on automated steps").action(async t=>{let r=b();await sS(r.projectDir),t.plan||t.step||(await aS(r.projectDir,t),await pS(r.projectDir,t)),await cS(r.projectDir,t),t.plan||uS(r.projectDir)})}async function sS(e){let t=r=>{j(r.join(`
967
- `)),process.exit(1)};Fe(e)&&t(["This is a monorepo edge project (SPREE_PATH set in .env).",`Run the upgrade from the monorepo root with ${qe.default.bold("pnpm server:*")} \u2014 the`,"project-local docker-compose.yml is not the running config here."]);try{await mt("web",e)}catch(r){t(["Could not inspect the Docker stack from this directory.",` ${qe.default.dim(String(r.message).split(`
968
- `)[0])}`,"",`Run ${qe.default.bold("spree upgrade")} from your project root (the directory holding the`,".env with SECRET_KEY_BASE), and make sure Docker is running."])}}async function aS(e,t){if(!t.yes){let i=await Je({message:"Run `bundle update` to bump Spree gems?",initialValue:!0});if(L(i)&&(j("Upgrade aborted."),process.exit(0)),!i){q.info("Skipping `bundle update`.");return}}let r=await oS(e);if(r.length===0)throw new Error('No Spree gems detected in Gemfile.lock. Confirm the project has `gem "spree"` (or `spree_core`/`spree_admin`) in its Gemfile.');q.step(qe.default.bold(`bundle update ${r.join(" ")}`)),await M(["bundle","update",...r],e)}async function oS(e){try{return(await Wa(["bundle","list","--name-only"],e)).split(`
997
+ Reinstall @spree/cli to fix.`)}p();function oy(e){e.command("rails").description("Run a Rails command (`bin/rails \u2026`) inside the web container").argument("<args...>","arguments to pass to bin/rails").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=k();await G(["bin/rails",...t],r.projectDir)})}p();function py(e){e.command("rake").description("Run a rake task (`bin/rake \u2026`) inside the web container").argument("<args...>","task name and arguments").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=k();await G(["bin/rake",...t],r.projectDir)})}p();function cy(e){e.command("restart").description("Restart web + worker in place (does not reload Gemfile or compose changes)").action(async()=>{let t=k(),r=D();r.start("Restarting web + worker...");try{await ee(["restart",...await Ve(t.projectDir)],t.projectDir),r.stop("Services restarted.")}catch(i){throw r.stop("Restart failed."),i}})}p();function dy(e){e.command("routes").description("Show Rails routes (`bin/rails routes`)").argument("[args...]","arguments to pass to bin/rails routes").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=k();await G(["bin/rails","routes",...t],r.projectDir)})}p();function uy(e){e.command("rspec").description("Run RSpec tests (`bundle exec rspec \u2026`) inside the web container").argument("[args...]","files, line numbers, and flags to pass to rspec").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=k();await G(["bundle","exec","rspec",...t],r.projectDir,{env:{RAILS_ENV:"test"},edgeHint:"then re-run spree rspec"})})}p();function ly(e){e.command("sample-data").description("Load sample data (products, categories, images)").action(async()=>{let t=k(),r=D();r.start("Loading sample data..."),await oe("spree:load_sample_data",t.projectDir),r.stop("Sample data loaded.")})}p();function my(e){e.command("seed").description("Seed the database").action(async()=>{let t=k(),r=D();r.start("Seeding database..."),await oe("db:seed",t.projectDir),r.stop("Database seeded.")})}p();function hy(e){e.command("shell").alias("bash").description("Open an interactive bash shell inside the web container").action(async()=>{let t=k();await G(["bash"],t.projectDir,{edgeHint:"then open the shell"})})}p();function yy(e){e.command("stop").description("Stop services").action(async()=>{let t=k(),r=D();r.start("Stopping services..."),await ee(["stop"],t.projectDir),r.stop("Services stopped.")})}p();function gy(e){e.command("task").description("Run a Spree rake task (auto-prefixes `spree:`)").argument("<name>","task name (without `spree:` prefix)").argument("[args...]","arguments to pass to the task").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let i=k();await G(["bin/rake",`spree:${t}`,...r],i.projectDir)})}p();function fy(e){e.command("update").description("Pull latest image and recreate containers").action(async()=>{let t=k();v.step("Pulling latest images..."),await ee(["pull"],t.projectDir,{stdio:"inherit"});let r=D();r.start("Recreating containers..."),await yt(t.projectDir,{stdio:"ignore"}),await ee(["up","-d"],t.projectDir),r.stop("Containers recreated."),v.success("Update complete! Migrations will run automatically on startup."),v.info("Run `spree logs` to follow the startup progress.")})}p();import _y from"fs";import TS from"path";var ve=B(J(),1);function by(e){e.command("upgrade").description("Walk through a Spree version upgrade (bundle + migrate + spree:upgrade)").option("--plan","list the data backfills a run would execute \u2014 for the installed Spree version, or the --to version (DRY_RUN=1); skip bundle + migrate").option("--step <id>","run a single rake step by id (skips bundle + migrate)").option("--to <version>","explicit target version (auto-detected from installed gem otherwise)").option("--yes","skip prompts on automated steps").action(async t=>{let r=k();await RS(r.projectDir),t.plan||t.step||(await IS(r.projectDir,t),await DS(r.projectDir,t)),await LS(r.projectDir,t),t.plan||zS(r.projectDir)})}async function RS(e){let t=r=>{T(r.join(`
998
+ `)),process.exit(1)};Ne(e)&&t(["This is a monorepo edge project (SPREE_PATH set in .env).",`Run the upgrade from the monorepo root with ${ve.default.bold("pnpm server:*")} \u2014 the`,"project-local docker-compose.yml is not the running config here."]);try{await gt("web",e)}catch(r){t(["Could not inspect the Docker stack from this directory.",` ${ve.default.dim(String(r.message).split(`
999
+ `)[0])}`,"",`Run ${ve.default.bold("spree upgrade")} from your project root (the directory holding the`,".env with SECRET_KEY_BASE), and make sure Docker is running."])}}async function IS(e,t){if(!t.yes){let i=await Qe({message:"Run `bundle update` to bump Spree gems?",initialValue:!0});if(z(i)&&(T("Upgrade aborted."),process.exit(0)),!i){v.info("Skipping `bundle update`.");return}}let r=await OS(e);if(r.length===0)throw new Error('No Spree gems detected in Gemfile.lock. Confirm the project has `gem "spree"` (or `spree_core`/`spree_admin`) in its Gemfile.');v.step(ve.default.bold(`bundle update ${r.join(" ")}`)),await G(["bundle","update",...r],e)}async function OS(e){try{return(await eo(["bundle","list","--name-only"],e)).split(`
969
1000
  `).map(r=>r.trim()).filter(r=>r.startsWith("spree"))}catch(t){let r=t;throw new Error("Could not list gems in the web container \u2014 the bundle looks out of sync.\nRun `spree bundle install` first, then re-run `spree upgrade`."+(r.stderr?.trim()?`
970
1001
 
971
- ${r.stderr.trim()}`:""))}}async function pS(e,t){if(!t.yes){let r=await Je({message:"Install + run pending migrations?",initialValue:!0});if(L(r)&&(j("Upgrade aborted."),process.exit(0)),!r){q.info("Skipping migrations.");return}}q.step(qe.default.bold("spree:install:migrations + db:migrate")),await M(["bin/rails","spree:install:migrations","db:migrate"],e)}async function cS(e,t){let r={};t.plan&&(r.DRY_RUN="1"),t.step&&(r.STEP=t.step),t.to&&(r.TO=t.to),q.step(qe.default.bold("spree:upgrade")),await M(["bin/rake","spree:upgrade"],e,{env:r})}function dS(e){let t="Update @spree/sdk in any storefront or integration consuming the API",r=nS.join(e,"apps","storefront","package.json");if(!Zh.existsSync(r))return t;try{let i=JSON.parse(Zh.readFileSync(r,"utf-8")),n=i.dependencies?.["@spree/sdk"]??i.devDependencies?.["@spree/sdk"];return n?`Update @spree/sdk in apps/storefront (currently ${n}) to the release matching the new Spree version`:t}catch{return t}}function uS(e){V([`The manifest only ran ${qe.default.bold("rake-automatable")} steps.`,"","Don't forget the manual parts from the upgrade doc:",` ${qe.default.dim("- Schedule Spree::StockReservations::ExpireJob (cron)")}`,` ${qe.default.dim(`- ${dS(e)}`)}`,` ${qe.default.dim("- Review behavior changes (cart, availability, payment-method types)")}`,` ${qe.default.dim("- Audit custom decorators against renamed APIs")}`,"",`Full checklist: ${qe.default.cyan("https://spreecommerce.org/docs/developer/upgrades")}`].join(`
972
- `),"Next steps")}var ey=D(K(),1);function ty(e){e.command("user").description("Manage admin users").command("create").description("Create an admin user").option("--email <email>","admin email").option("--password <password>","admin password").action(async r=>{let i=b(),n=r.email,s=r.password;if(!n){let o=await le({message:"Admin email:",placeholder:"admin@example.com",validate(p){if(!p)return"Email is required";if(!p.includes("@"))return"Invalid email"}});L(o)&&(j("Cancelled."),process.exit(0)),n=o}if(!s){let o=await ui({message:"Admin password:",validate(p){if(!p||p.length<6)return"Password must be at least 6 characters"}});L(o)&&(j("Cancelled."),process.exit(0)),s=o}let a=I();a.start("Creating admin user..."),await se("spree:cli:create_admin",i.projectDir,{EMAIL:n,PASSWORD:s}),a.stop("Admin user created."),q.success(`Email: ${ey.default.cyan(n)}`)})}import{createRequire as lS}from"module";var mS=lS(import.meta.url),ry=mS("../package.json").version;var C=new Mo().name("spree").description("CLI for managing Spree Commerce projects").version(ry).enablePositionalOptions().showSuggestionAfterError(!0).showHelpAfterError("(run `spree --help` for usage)").exitOverride(e=>{(e.code.startsWith("commander.help")||e.code==="commander.version")&&process.exit(0),process.exit(2)});Sh(C);$m(C);Eh(C);Yh(C);Uh(C);Xh(C);Th(C);Ph(C);gh(C);Ch(C);Rh(C);vh(C);Nh(C);Qh(C);jh(C);Fh(C);fh(C);Gh(C);Jh(C);Hh(C);kh(C);Kh(C);ty(C);mh(C);Ih(C);Wh(C);Vh(C);Mh(C);uh(C);yh(C);qh(C);async function hS(){try{await C.parseAsync()}catch(e){e instanceof Error&&"code"in e&&(e.code==="commander.helpDisplayed"||e.code==="commander.version")&&process.exit(0),e instanceof Error&&"code"in e&&String(e.code).startsWith("commander.")&&process.exit(2);let t=e instanceof Error&&e.constructor.name==="CredentialError"?2:1,r=e instanceof Error?e.message:"An unexpected error occurred.";console.error(`
973
- ${iy.default.red("Error:")} ${r}
974
- `),process.exit(t)}}hS();
1002
+ ${r.stderr.trim()}`:""))}}async function DS(e,t){if(!t.yes){let r=await Qe({message:"Install + run pending migrations?",initialValue:!0});if(z(r)&&(T("Upgrade aborted."),process.exit(0)),!r){v.info("Skipping migrations.");return}}v.step(ve.default.bold("spree:install:migrations + db:migrate")),await G(["bin/rails","spree:install:migrations","db:migrate"],e)}async function LS(e,t){let r={};t.plan&&(r.DRY_RUN="1"),t.step&&(r.STEP=t.step),t.to&&(r.TO=t.to),v.step(ve.default.bold("spree:upgrade")),await G(["bin/rake","spree:upgrade"],e,{env:r})}function BS(e){let t="Update @spree/sdk in any storefront or integration consuming the API",r=TS.join(e,"apps","storefront","package.json");if(!_y.existsSync(r))return t;try{let i=JSON.parse(_y.readFileSync(r,"utf-8")),n=i.dependencies?.["@spree/sdk"]??i.devDependencies?.["@spree/sdk"];return n?`Update @spree/sdk in apps/storefront (currently ${n}) to the release matching the new Spree version`:t}catch{return t}}function zS(e){H([`The manifest only ran ${ve.default.bold("rake-automatable")} steps.`,"","Don't forget the manual parts from the upgrade doc:",` ${ve.default.dim("- Compare your scheduled jobs (config/recurring.yml) with the upgrade guide")}`,` ${ve.default.dim(`- ${BS(e)}`)}`,` ${ve.default.dim("- Review the behavior changes listed in the upgrade guide")}`,` ${ve.default.dim("- Audit custom decorators against renamed APIs")}`,"",`Full checklist: ${ve.default.cyan("https://spreecommerce.org/docs/developer/upgrades/quickstart")}`].join(`
1003
+ `),"Next steps")}p();var qy=B(J(),1);function ky(e){e.command("user").description("Manage admin users").command("create").description("Create an admin user").option("--email <email>","admin email").option("--password <password>","admin password").action(async r=>{let i=k(),n=r.email,s=r.password;if(!n){let o=await he({message:"Admin email:",placeholder:"admin@example.com",validate(c){if(!c)return"Email is required";if(!c.includes("@"))return"Invalid email"}});z(o)&&(T("Cancelled."),process.exit(0)),n=o}if(!s){let o=await qi({message:"Admin password:",validate(c){if(!c||c.length<6)return"Password must be at least 6 characters"}});z(o)&&(T("Cancelled."),process.exit(0)),s=o}let a=D();a.start("Creating admin user..."),await oe("spree:cli:create_admin",i.projectDir,{EMAIL:n,PASSWORD:s}),a.stop("Admin user created."),v.success(`Email: ${qy.default.cyan(n)}`)})}p();import{createRequire as MS}from"module";var FS=MS(import.meta.url),vy=FS("../package.json").version;var R=new Jo().name("spree").description("CLI for managing Spree Commerce projects").version(vy).enablePositionalOptions().showSuggestionAfterError(!0).showHelpAfterError("(run `spree --help` for usage)").exitOverride(e=>{(e.code.startsWith("commander.help")||e.code==="commander.version")&&process.exit(0),process.exit(2)});Oh(R);Dm(R);Bh(R);yy(R);cy(R);fy(R);Xh(R);zh(R);$h(R);Jh(R);Zh(R);Th(R);dy(R);by(R);Yh(R);oy(R);Ah(R);py(R);gy(R);uy(R);Ch(R);hy(R);ky(R);wh(R);Kh(R);Qh(R);my(R);ly(R);ay(R);kh(R);Sh(R);jh(R);async function GS(){try{await R.parseAsync()}catch(e){e instanceof Error&&"code"in e&&(e.code==="commander.helpDisplayed"||e.code==="commander.version")&&process.exit(0),e instanceof Error&&"code"in e&&String(e.code).startsWith("commander.")&&process.exit(2);let t=e instanceof Error&&e.constructor.name==="CredentialError"?2:1,r=e instanceof Error?e.message:"An unexpected error occurred.";console.error(`
1004
+ ${wy.default.red("Error:")} ${r}
1005
+ `),process.exit(t)}}GS();