@shotstack/cli 0.11.0 → 0.13.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/shotstack.js CHANGED
@@ -1,53 +1,53 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as Wa}from"node:module";var Ha=Object.defineProperty;var $e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ga=(e,t,r)=>{for(var n in t)Ha(e,n,{get:t[n],set:r[n],enumerable:!0,configurable:!0})},Te=Wa(import.meta.url);var Ie=$e(function(Ka){class At extends Error{constructor(e,t,r){super(r);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}class Ar extends At{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}Ka.CommanderError=At;Ka.InvalidArgumentError=Ar});var Ge=$e(function(tu){var{InvalidArgumentError:Xa}=Ie();class wr{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t))return[e];return t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new Xa(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(t,r);return t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function eu(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}tu.Argument=wr;tu.humanReadableArgName=eu});var wt=$e(function(su){var{humanReadableArgName:ou}=Ge();class zr{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter((n)=>!n._hidden),r=e._getHelpCommand();if(r&&!r._hidden)t.push(r);if(this.sortSubcommands)t.sort((n,o)=>n.name().localeCompare(o.name()));return t}compareOptions(e,t){let r=(n)=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter((n)=>!n.hidden),r=e._getHelpOption();if(r&&!r.hidden){let n=r.short&&e._findOption(r.short),o=r.long&&e._findOption(r.long);if(!n&&!o)t.push(r);else if(r.long&&!o)t.push(e.createOption(r.long,r.description));else if(r.short&&!n)t.push(e.createOption(r.short,r.description))}if(this.sortOptions)t.sort(this.compareOptions);return t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let n=r.options.filter((o)=>!o.hidden);t.push(...n)}if(this.sortOptions)t.sort(this.compareOptions);return t}visibleArguments(e){if(e._argsDescription)e.registeredArguments.forEach((t)=>{t.description=t.description||e._argsDescription[t.name()]||""});if(e.registeredArguments.find((t)=>t.description))return e.registeredArguments;return[]}subcommandTerm(e){let t=e.registeredArguments.map((r)=>ou(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,n)=>Math.max(r,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,n)=>Math.max(r,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;if(e._aliases[0])t=t+"|"+e._aliases[0];let r="";for(let n=e.parent;n;n=n.parent)r=n.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices)t.push(`choices: ${e.argChoices.map((r)=>JSON.stringify(r)).join(", ")}`);if(e.defaultValue!==void 0){if(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==="boolean")t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(e.presetArg!==void 0&&e.optional)t.push(`preset: ${JSON.stringify(e.presetArg)}`);if(e.envVar!==void 0)t.push(`env: ${e.envVar}`);if(t.length>0)return`${e.description} (${t.join(", ")})`;return e.description}argumentDescription(e){let t=[];if(e.argChoices)t.push(`choices: ${e.argChoices.map((r)=>JSON.stringify(r)).join(", ")}`);if(e.defaultValue!==void 0)t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`);if(t.length>0){let r=`(${t.join(", ")})`;if(e.description)return`${e.description} ${r}`;return r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),n=t.helpWidth||80,o=2,s=2;function i(x,z){if(z){let M=`${x.padEnd(r+2)}${z}`;return t.wrap(M,n-2,r+2)}return x}function u(x){return x.join(`
3
- `).replace(/^/gm," ".repeat(2))}let p=[`Usage: ${t.commandUsage(e)}`,""],l=t.commandDescription(e);if(l.length>0)p=p.concat([t.wrap(l,n,0),""]);let _=t.visibleArguments(e).map((x)=>i(t.argumentTerm(x),t.argumentDescription(x)));if(_.length>0)p=p.concat(["Arguments:",u(_),""]);let y=t.visibleOptions(e).map((x)=>i(t.optionTerm(x),t.optionDescription(x)));if(y.length>0)p=p.concat(["Options:",u(y),""]);if(this.showGlobalOptions){let x=t.visibleGlobalOptions(e).map((z)=>i(t.optionTerm(z),t.optionDescription(z)));if(x.length>0)p=p.concat(["Global Options:",u(x),""])}let A=t.visibleCommands(e).map((x)=>i(t.subcommandTerm(x),t.subcommandDescription(x)));if(A.length>0)p=p.concat(["Commands:",u(A),""]);return p.join(`
4
- `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,n=40){let s=new RegExp(`[\\n][${" \\f\\t\\v   -    \uFEFF"}]+`);if(e.match(s))return e;let i=t-r;if(i<n)return e;let u=e.slice(0,r),p=e.slice(r).replace(`\r
2
+ import{createRequire as Ya}from"node:module";var Ka=Object.defineProperty;var we=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Wa=(e,t,r)=>{for(var n in t)Ka(e,n,{get:t[n],set:r[n],enumerable:!0,configurable:!0})},Ie=Ya(import.meta.url);var je=we(function(Qa){class At extends Error{constructor(e,t,r){super(r);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}class Ar extends At{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}Qa.CommanderError=At;Qa.InvalidArgumentError=Ar});var Ke=we(function(nu){var{InvalidArgumentError:tu}=je();class wr{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t))return[e];return t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new tu(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(t,r);return t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function ru(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}nu.Argument=wr;nu.humanReadableArgName=ru});var wt=we(function(au){var{humanReadableArgName:iu}=Ke();class zr{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter((n)=>!n._hidden),r=e._getHelpCommand();if(r&&!r._hidden)t.push(r);if(this.sortSubcommands)t.sort((n,o)=>n.name().localeCompare(o.name()));return t}compareOptions(e,t){let r=(n)=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter((n)=>!n.hidden),r=e._getHelpOption();if(r&&!r.hidden){let n=r.short&&e._findOption(r.short),o=r.long&&e._findOption(r.long);if(!n&&!o)t.push(r);else if(r.long&&!o)t.push(e.createOption(r.long,r.description));else if(r.short&&!n)t.push(e.createOption(r.short,r.description))}if(this.sortOptions)t.sort(this.compareOptions);return t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let n=r.options.filter((o)=>!o.hidden);t.push(...n)}if(this.sortOptions)t.sort(this.compareOptions);return t}visibleArguments(e){if(e._argsDescription)e.registeredArguments.forEach((t)=>{t.description=t.description||e._argsDescription[t.name()]||""});if(e.registeredArguments.find((t)=>t.description))return e.registeredArguments;return[]}subcommandTerm(e){let t=e.registeredArguments.map((r)=>iu(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,n)=>Math.max(r,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,n)=>Math.max(r,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;if(e._aliases[0])t=t+"|"+e._aliases[0];let r="";for(let n=e.parent;n;n=n.parent)r=n.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices)t.push(`choices: ${e.argChoices.map((r)=>JSON.stringify(r)).join(", ")}`);if(e.defaultValue!==void 0){if(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==="boolean")t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(e.presetArg!==void 0&&e.optional)t.push(`preset: ${JSON.stringify(e.presetArg)}`);if(e.envVar!==void 0)t.push(`env: ${e.envVar}`);if(t.length>0)return`${e.description} (${t.join(", ")})`;return e.description}argumentDescription(e){let t=[];if(e.argChoices)t.push(`choices: ${e.argChoices.map((r)=>JSON.stringify(r)).join(", ")}`);if(e.defaultValue!==void 0)t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`);if(t.length>0){let r=`(${t.join(", ")})`;if(e.description)return`${e.description} ${r}`;return r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),n=t.helpWidth||80,o=2,s=2;function i(x,z){if(z){let v=`${x.padEnd(r+2)}${z}`;return t.wrap(v,n-2,r+2)}return x}function c(x){return x.join(`
3
+ `).replace(/^/gm," ".repeat(2))}let p=[`Usage: ${t.commandUsage(e)}`,""],l=t.commandDescription(e);if(l.length>0)p=p.concat([t.wrap(l,n,0),""]);let h=t.visibleArguments(e).map((x)=>i(t.argumentTerm(x),t.argumentDescription(x)));if(h.length>0)p=p.concat(["Arguments:",c(h),""]);let y=t.visibleOptions(e).map((x)=>i(t.optionTerm(x),t.optionDescription(x)));if(y.length>0)p=p.concat(["Options:",c(y),""]);if(this.showGlobalOptions){let x=t.visibleGlobalOptions(e).map((z)=>i(t.optionTerm(z),t.optionDescription(z)));if(x.length>0)p=p.concat(["Global Options:",c(x),""])}let A=t.visibleCommands(e).map((x)=>i(t.subcommandTerm(x),t.subcommandDescription(x)));if(A.length>0)p=p.concat(["Commands:",c(A),""]);return p.join(`
4
+ `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,n=40){let s=new RegExp(`[\\n][${" \\f\\t\\v   -    \uFEFF"}]+`);if(e.match(s))return e;let i=t-r;if(i<n)return e;let c=e.slice(0,r),p=e.slice(r).replace(`\r
5
5
  `,`
6
6
  `),l=" ".repeat(r),y=`\\s${"​"}`,A=new RegExp(`
7
- |.{1,${i-1}}([${y}]|$)|[^${y}]+?([${y}]|$)`,"g"),x=p.match(A)||[];return u+x.map((z,M)=>{if(z===`
8
- `)return"";return(M>0?l:"")+z.trimEnd()}).join(`
9
- `)}}su.Help=zr});var zt=$e(function(pu){var{InvalidArgumentError:au}=Ie();class Sr{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let r=cu(e);if(this.short=r.shortFlag,this.long=r.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}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;if(typeof e==="string")t={[e]:!0};return this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t))return[e];return t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new au(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(t,r);return t},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return uu(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class kr{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach((t)=>{if(t.negate)this.negativeOptions.set(t.attributeName(),t);else this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,r)=>{if(this.positiveOptions.has(r))this.dualOptions.add(r)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let n=this.negativeOptions.get(r).presetArg,o=n!==void 0?n:!1;return t.negate===(o===e)}}function uu(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function cu(e){let t,r,n=e.split(/[ |,]+/);if(n.length>1&&!/^[[<]/.test(n[1]))t=n.shift();if(r=n.shift(),!t&&/^-[^-]$/.test(r))t=r,r=void 0;return{shortFlag:t,longFlag:r}}pu.Option=Sr;pu.DualOptions=kr});var Zr=$e(function(hu){function du(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let n=0;n<=e.length;n++)r[n]=[n];for(let n=0;n<=t.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let o=1;o<=e.length;o++){let s=1;if(e[o-1]===t[n-1])s=0;else s=1;if(r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+s),o>1&&n>1&&e[o-1]===t[n-2]&&e[o-2]===t[n-1])r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1)}return r[e.length][t.length]}function mu(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");if(r)e=e.slice(2),t=t.map((i)=>i.slice(2));let n=[],o=3,s=0.4;if(t.forEach((i)=>{if(i.length<=1)return;let u=du(e,i),p=Math.max(e.length,i.length);if((p-u)/p>s){if(u<o)o=u,n=[i];else if(u===o)n.push(i)}}),n.sort((i,u)=>i.localeCompare(u)),r)n=n.map((i)=>`--${i}`);if(n.length>1)return`
7
+ |.{1,${i-1}}([${y}]|$)|[^${y}]+?([${y}]|$)`,"g"),x=p.match(A)||[];return c+x.map((z,v)=>{if(z===`
8
+ `)return"";return(v>0?l:"")+z.trimEnd()}).join(`
9
+ `)}}au.Help=zr});var zt=we(function(fu){var{InvalidArgumentError:cu}=je();class Sr{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let r=lu(e);if(this.short=r.shortFlag,this.long=r.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}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;if(typeof e==="string")t={[e]:!0};return this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t))return[e];return t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new cu(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(t,r);return t},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return pu(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class kr{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach((t)=>{if(t.negate)this.negativeOptions.set(t.attributeName(),t);else this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,r)=>{if(this.positiveOptions.has(r))this.dualOptions.add(r)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let n=this.negativeOptions.get(r).presetArg,o=n!==void 0?n:!1;return t.negate===(o===e)}}function pu(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function lu(e){let t,r,n=e.split(/[ |,]+/);if(n.length>1&&!/^[[<]/.test(n[1]))t=n.shift();if(r=n.shift(),!t&&/^-[^-]$/.test(r))t=r,r=void 0;return{shortFlag:t,longFlag:r}}fu.Option=Sr;fu.DualOptions=kr});var Zr=we(function(_u){function hu(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let n=0;n<=e.length;n++)r[n]=[n];for(let n=0;n<=t.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let o=1;o<=e.length;o++){let s=1;if(e[o-1]===t[n-1])s=0;else s=1;if(r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+s),o>1&&n>1&&e[o-1]===t[n-2]&&e[o-2]===t[n-1])r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1)}return r[e.length][t.length]}function gu(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");if(r)e=e.slice(2),t=t.map((i)=>i.slice(2));let n=[],o=3,s=0.4;if(t.forEach((i)=>{if(i.length<=1)return;let c=hu(e,i),p=Math.max(e.length,i.length);if((p-c)/p>s){if(c<o)o=c,n=[i];else if(c===o)n.push(i)}}),n.sort((i,c)=>i.localeCompare(c)),r)n=n.map((i)=>`--${i}`);if(n.length>1)return`
10
10
  (Did you mean one of ${n.join(", ")}?)`;if(n.length===1)return`
11
- (Did you mean ${n[0]}?)`;return""}hu.suggestSimilar=mu});var Rr=$e(function(Au){var _u=Te("node:events").EventEmitter,Ae=Te("node:child_process"),W=Te("node:path"),we=Te("node:fs"),k=Te("node:process"),{Argument:xu,humanReadableArgName:yu}=Ge(),{CommanderError:St}=Ie(),{Help:bu}=wt(),{Option:Or,DualOptions:$u}=zt(),{suggestSimilar:Er}=Zr();class kt extends _u{constructor(e){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",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._outputConfiguration={writeOut:(t)=>k.stdout.write(t),writeErr:(t)=>k.stderr.write(t),getOutHelpWidth:()=>k.stdout.isTTY?k.stdout.columns:void 0,getErrHelpWidth:()=>k.stderr.isTTY?k.stderr.columns:void 0,outputError:(t,r)=>r(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let n=t,o=r;if(typeof n==="object"&&n!==null)o=n,n=null;o=o||{};let[,s,i]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(s);if(n)u.description(n),u._executableHandler=!0;if(o.isDefault)this._defaultCommandName=u._name;if(u._hidden=!!(o.noHelp||o.hidden),u._executableFile=o.executableFile||null,i)u.arguments(i);if(this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),n)return this;return u}createCommand(e){return new kt(e)}createHelp(){return Object.assign(new bu,this.configureHelp())}configureHelp(e){if(e===void 0)return this._helpConfiguration;return this._helpConfiguration=e,this}configureOutput(e){if(e===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,e),this}showHelpAfterError(e=!0){if(typeof e!=="string")e=!!e;return this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);if(t=t||{},t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=!0;return this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new xu(e,t)}argument(e,t,r,n){let o=this.createArgument(e,t);if(typeof r==="function")o.default(n).argParser(r);else o.default(r);return this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach((t)=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,r,n]=e.match(/([^ ]+) *(.*)/),o=t??"display help for command",s=this.createCommand(r);if(s.helpOption(!1),n)s.arguments(n);if(o)s.description(o);return this._addImplicitHelpCommand=!0,this._helpCommand=s,this}addHelpCommand(e,t){if(typeof e!=="object")return this.helpCommand(e,t),this;return this._addImplicitHelpCommand=!0,this._helpCommand=e,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
11
+ (Did you mean ${n[0]}?)`;return""}_u.suggestSimilar=gu});var Rr=we(function(zu){var yu=Ie("node:events").EventEmitter,ze=Ie("node:child_process"),K=Ie("node:path"),Se=Ie("node:fs"),k=Ie("node:process"),{Argument:bu,humanReadableArgName:$u}=Ke(),{CommanderError:St}=je(),{Help:Au}=wt(),{Option:Or,DualOptions:wu}=zt(),{suggestSimilar:Er}=Zr();class kt extends yu{constructor(e){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",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._outputConfiguration={writeOut:(t)=>k.stdout.write(t),writeErr:(t)=>k.stderr.write(t),getOutHelpWidth:()=>k.stdout.isTTY?k.stdout.columns:void 0,getErrHelpWidth:()=>k.stderr.isTTY?k.stderr.columns:void 0,outputError:(t,r)=>r(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let n=t,o=r;if(typeof n==="object"&&n!==null)o=n,n=null;o=o||{};let[,s,i]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);if(n)c.description(n),c._executableHandler=!0;if(o.isDefault)this._defaultCommandName=c._name;if(c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,i)c.arguments(i);if(this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),n)return this;return c}createCommand(e){return new kt(e)}createHelp(){return Object.assign(new Au,this.configureHelp())}configureHelp(e){if(e===void 0)return this._helpConfiguration;return this._helpConfiguration=e,this}configureOutput(e){if(e===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,e),this}showHelpAfterError(e=!0){if(typeof e!=="string")e=!!e;return this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);if(t=t||{},t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=!0;return this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new bu(e,t)}argument(e,t,r,n){let o=this.createArgument(e,t);if(typeof r==="function")o.default(n).argParser(r);else o.default(r);return this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach((t)=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,r,n]=e.match(/([^ ]+) *(.*)/),o=t??"display help for command",s=this.createCommand(r);if(s.helpOption(!1),n)s.arguments(n);if(o)s.description(o);return this._addImplicitHelpCommand=!0,this._helpCommand=s,this}addHelpCommand(e,t){if(typeof e!=="object")return this.helpCommand(e,t),this;return this._addImplicitHelpCommand=!0,this._helpCommand=e,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
13
13
  Expecting one of '${r.join("', '")}'`);if(this._lifeCycleHooks[e])this._lifeCycleHooks[e].push(t);else this._lifeCycleHooks[e]=[t];return this}exitOverride(e){if(e)this._exitCallback=e;else this._exitCallback=(t)=>{if(t.code!=="commander.executeSubCommandAsync")throw t};return this}_exit(e,t,r){if(this._exitCallback)this._exitCallback(new St(e,t,r));k.exit(e)}action(e){let t=(r)=>{let n=this.registeredArguments.length,o=r.slice(0,n);if(this._storeOptionsAsProperties)o[n]=this;else o[n]=this.opts();return o.push(this),e.apply(this,o)};return this._actionHandler=t,this}createOption(e,t){return new Or(e,t)}_callParseArg(e,t,r,n){try{return e.parseArg(t,r)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${n} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let r=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'
14
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=(n)=>[n.name()].concat(n.aliases()),r=t(e).find((n)=>this._findCommand(n));if(r){let n=t(this._findCommand(r)).join("|"),o=t(e).join("|");throw Error(`cannot add command '${o}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),r=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");if(!this._findOption(o))this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else if(e.defaultValue!==void 0)this.setOptionValueWithSource(r,e.defaultValue,"default");let n=(o,s,i)=>{if(o==null&&e.presetArg!==void 0)o=e.presetArg;let u=this.getOptionValue(r);if(o!==null&&e.parseArg)o=this._callParseArg(e,o,u,s);else if(o!==null&&e.variadic)o=e._concatValue(o,u);if(o==null)if(e.negate)o=!1;else if(e.isBoolean()||e.optional)o=!0;else o="";this.setOptionValueWithSource(r,o,i)};if(this.on("option:"+t,(o)=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;n(o,s,"cli")}),e.envVar)this.on("optionEnv:"+t,(o)=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;n(o,s,"env")});return this}_optionEx(e,t,r,n,o){if(typeof t==="object"&&t instanceof Or)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,r);if(s.makeOptionMandatory(!!e.mandatory),typeof n==="function")s.default(o).argParser(n);else if(n instanceof RegExp){let i=n;n=(u,p)=>{let l=i.exec(u);return l?l[0]:p},s.default(o).argParser(n)}else s.default(n);return this.addOption(s)}option(e,t,r,n){return this._optionEx({},e,t,r,n)}requiredOption(e,t,r,n){return this._optionEx({mandatory:!0},e,t,r,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){if(this._storeOptionsAsProperties)return this[e];return this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){if(this._storeOptionsAsProperties)this[e]=t;else this._optionValues[e]=t;return this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach((r)=>{if(r.getOptionValueSource(e)!==void 0)t=r.getOptionValueSource(e)}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){if(k.versions?.electron)t.from="electron";let n=k.execArgv??[];if(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))t.from="eval"}if(e===void 0)e=k.argv;this.rawArgs=e.slice();let r;switch(t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=e[1],r=e.slice(2);else r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",r}parse(e,t){let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_executeSubCommand(e,t){t=t.slice();let r=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function o(l,_){let y=W.resolve(l,_);if(we.existsSync(y))return y;if(n.includes(W.extname(_)))return;let A=n.find((x)=>we.existsSync(`${y}${x}`));if(A)return`${y}${A}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,i=this._executableDir||"";if(this._scriptPath){let l;try{l=we.realpathSync(this._scriptPath)}catch(_){l=this._scriptPath}i=W.resolve(W.dirname(l),i)}if(i){let l=o(i,s);if(!l&&!e._executableFile&&this._scriptPath){let _=W.basename(this._scriptPath,W.extname(this._scriptPath));if(_!==this._name)l=o(i,`${_}-${e._name}`)}s=l||s}r=n.includes(W.extname(s));let u;if(k.platform!=="win32")if(r)t.unshift(s),t=Pr(k.execArgv).concat(t),u=Ae.spawn(k.argv[0],t,{stdio:"inherit"});else u=Ae.spawn(s,t,{stdio:"inherit"});else t.unshift(s),t=Pr(k.execArgv).concat(t),u=Ae.spawn(k.execPath,t,{stdio:"inherit"});if(!u.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((_)=>{k.on(_,()=>{if(u.killed===!1&&u.exitCode===null)u.kill(_)})});let p=this._exitCallback;u.on("close",(l)=>{if(l=l??1,!p)k.exit(l);else p(new St(l,"commander.executeSubCommandAsync","(close)"))}),u.on("error",(l)=>{if(l.code==="ENOENT"){let _=i?`searched for local subcommand relative to directory '${i}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",y=`'${s}' does not exist
14
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=(n)=>[n.name()].concat(n.aliases()),r=t(e).find((n)=>this._findCommand(n));if(r){let n=t(this._findCommand(r)).join("|"),o=t(e).join("|");throw Error(`cannot add command '${o}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),r=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");if(!this._findOption(o))this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else if(e.defaultValue!==void 0)this.setOptionValueWithSource(r,e.defaultValue,"default");let n=(o,s,i)=>{if(o==null&&e.presetArg!==void 0)o=e.presetArg;let c=this.getOptionValue(r);if(o!==null&&e.parseArg)o=this._callParseArg(e,o,c,s);else if(o!==null&&e.variadic)o=e._concatValue(o,c);if(o==null)if(e.negate)o=!1;else if(e.isBoolean()||e.optional)o=!0;else o="";this.setOptionValueWithSource(r,o,i)};if(this.on("option:"+t,(o)=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;n(o,s,"cli")}),e.envVar)this.on("optionEnv:"+t,(o)=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;n(o,s,"env")});return this}_optionEx(e,t,r,n,o){if(typeof t==="object"&&t instanceof Or)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,r);if(s.makeOptionMandatory(!!e.mandatory),typeof n==="function")s.default(o).argParser(n);else if(n instanceof RegExp){let i=n;n=(c,p)=>{let l=i.exec(c);return l?l[0]:p},s.default(o).argParser(n)}else s.default(n);return this.addOption(s)}option(e,t,r,n){return this._optionEx({},e,t,r,n)}requiredOption(e,t,r,n){return this._optionEx({mandatory:!0},e,t,r,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){if(this._storeOptionsAsProperties)return this[e];return this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){if(this._storeOptionsAsProperties)this[e]=t;else this._optionValues[e]=t;return this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach((r)=>{if(r.getOptionValueSource(e)!==void 0)t=r.getOptionValueSource(e)}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){if(k.versions?.electron)t.from="electron";let n=k.execArgv??[];if(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))t.from="eval"}if(e===void 0)e=k.argv;this.rawArgs=e.slice();let r;switch(t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=e[1],r=e.slice(2);else r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",r}parse(e,t){let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_executeSubCommand(e,t){t=t.slice();let r=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function o(l,h){let y=K.resolve(l,h);if(Se.existsSync(y))return y;if(n.includes(K.extname(h)))return;let A=n.find((x)=>Se.existsSync(`${y}${x}`));if(A)return`${y}${A}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,i=this._executableDir||"";if(this._scriptPath){let l;try{l=Se.realpathSync(this._scriptPath)}catch(h){l=this._scriptPath}i=K.resolve(K.dirname(l),i)}if(i){let l=o(i,s);if(!l&&!e._executableFile&&this._scriptPath){let h=K.basename(this._scriptPath,K.extname(this._scriptPath));if(h!==this._name)l=o(i,`${h}-${e._name}`)}s=l||s}r=n.includes(K.extname(s));let c;if(k.platform!=="win32")if(r)t.unshift(s),t=Pr(k.execArgv).concat(t),c=ze.spawn(k.argv[0],t,{stdio:"inherit"});else c=ze.spawn(s,t,{stdio:"inherit"});else t.unshift(s),t=Pr(k.execArgv).concat(t),c=ze.spawn(k.execPath,t,{stdio:"inherit"});if(!c.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((h)=>{k.on(h,()=>{if(c.killed===!1&&c.exitCode===null)c.kill(h)})});let p=this._exitCallback;c.on("close",(l)=>{if(l=l??1,!p)k.exit(l);else p(new St(l,"commander.executeSubCommandAsync","(close)"))}),c.on("error",(l)=>{if(l.code==="ENOENT"){let h=i?`searched for local subcommand relative to directory '${i}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",y=`'${s}' does not exist
15
15
  - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${_}`;throw Error(y)}else if(l.code==="EACCES")throw Error(`'${s}' not executable`);if(!p)k.exit(1);else{let _=new St(1,"commander.executeSubCommandAsync","(error)");_.nestedError=l,p(_)}}),this.runningCommand=u}_dispatchSubcommand(e,t,r){let n=this._findCommand(e);if(!n)this.help({error:!0});let o;return o=this._chainOrCallSubCommandHook(o,n,"preSubcommand"),o=this._chainOrCall(o,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(r));else return n._parseCommand(t,r)}),o}_dispatchHelpCommand(e){if(!e)this.help();let t=this._findCommand(e);if(t&&!t._executableHandler)t.help();return this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((e,t)=>{if(e.required&&this.args[t]==null)this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let e=(r,n,o)=>{let s=n;if(n!==null&&r.parseArg){let i=`error: command-argument value '${n}' is invalid for argument '${r.name()}'.`;s=this._callParseArg(r,n,o,i)}return s};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((r,n)=>{let o=r.defaultValue;if(r.variadic){if(n<this.args.length){if(o=this.args.slice(n),r.parseArg)o=o.reduce((s,i)=>e(r,i,s),r.defaultValue)}else if(o===void 0)o=[]}else if(n<this.args.length){if(o=this.args[n],r.parseArg)o=e(r,o,r.defaultValue)}t[n]=o}),this.processedArgs=t}_chainOrCall(e,t){if(e&&e.then&&typeof e.then==="function")return e.then(()=>t());return t()}_chainOrCallHooks(e,t){let r=e,n=[];if(this._getCommandAndAncestors().reverse().filter((o)=>o._lifeCycleHooks[t]!==void 0).forEach((o)=>{o._lifeCycleHooks[t].forEach((s)=>{n.push({hookedCommand:o,callback:s})})}),t==="postAction")n.reverse();return n.forEach((o)=>{r=this._chainOrCall(r,()=>o.callback(o.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let n=e;if(this._lifeCycleHooks[r]!==void 0)this._lifeCycleHooks[r].forEach((o)=>{n=this._chainOrCall(n,()=>o(this,t))});return n}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{if(r.unknown.length>0)this.unknownOption(r.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let s;if(s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent)s=this._chainOrCall(s,()=>{this.parent.emit(o,e,t)});return s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(o))n(),this._processArguments(),this.parent.emit(o,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);if(this.listenerCount("command:*"))this.emit("command:*",e,t);else if(this.commands.length)this.unknownCommand();else n(),this._processArguments()}else if(this.commands.length)n(),this.help({error:!0});else n(),this._processArguments()}_findCommand(e){if(!e)return;return this.commands.find((t)=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find((t)=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((e)=>{e.options.forEach((t)=>{if(t.mandatory&&e.getOptionValue(t.attributeName())===void 0)e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter((r)=>{let n=r.attributeName();if(this.getOptionValue(n)===void 0)return!1;return this.getOptionValueSource(n)!=="default"});e.filter((r)=>r.conflictsWith.length>0).forEach((r)=>{let n=e.find((o)=>r.conflictsWith.includes(o.attributeName()));if(n)this._conflictingOption(r,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((e)=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],r=[],n=t,o=e.slice();function s(u){return u.length>1&&u[0]==="-"}let i=null;while(o.length){let u=o.shift();if(u==="--"){if(n===r)n.push(u);n.push(...o);break}if(i&&!s(u)){this.emit(`option:${i.name()}`,u);continue}if(i=null,s(u)){let p=this._findOption(u);if(p){if(p.required){let l=o.shift();if(l===void 0)this.optionMissingArgument(p);this.emit(`option:${p.name()}`,l)}else if(p.optional){let l=null;if(o.length>0&&!s(o[0]))l=o.shift();this.emit(`option:${p.name()}`,l)}else this.emit(`option:${p.name()}`);i=p.variadic?p:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let p=this._findOption(`-${u[1]}`);if(p){if(p.required||p.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${p.name()}`,u.slice(2));else this.emit(`option:${p.name()}`),o.unshift(`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let p=u.indexOf("="),l=this._findOption(u.slice(0,p));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,u.slice(p+1));continue}}if(s(u))n=r;if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(u)){if(t.push(u),o.length>0)r.push(...o);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){if(t.push(u),o.length>0)t.push(...o);break}else if(this._defaultCommandName){if(r.push(u),o.length>0)r.push(...o);break}}if(this._passThroughOptions){if(n.push(u),o.length>0)n.push(...o);break}n.push(u)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let n=this.options[r].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){if(this._outputConfiguration.outputError(`${e}
17
+ - ${h}`;throw Error(y)}else if(l.code==="EACCES")throw Error(`'${s}' not executable`);if(!p)k.exit(1);else{let h=new St(1,"commander.executeSubCommandAsync","(error)");h.nestedError=l,p(h)}}),this.runningCommand=c}_dispatchSubcommand(e,t,r){let n=this._findCommand(e);if(!n)this.help({error:!0});let o;return o=this._chainOrCallSubCommandHook(o,n,"preSubcommand"),o=this._chainOrCall(o,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(r));else return n._parseCommand(t,r)}),o}_dispatchHelpCommand(e){if(!e)this.help();let t=this._findCommand(e);if(t&&!t._executableHandler)t.help();return this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((e,t)=>{if(e.required&&this.args[t]==null)this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let e=(r,n,o)=>{let s=n;if(n!==null&&r.parseArg){let i=`error: command-argument value '${n}' is invalid for argument '${r.name()}'.`;s=this._callParseArg(r,n,o,i)}return s};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((r,n)=>{let o=r.defaultValue;if(r.variadic){if(n<this.args.length){if(o=this.args.slice(n),r.parseArg)o=o.reduce((s,i)=>e(r,i,s),r.defaultValue)}else if(o===void 0)o=[]}else if(n<this.args.length){if(o=this.args[n],r.parseArg)o=e(r,o,r.defaultValue)}t[n]=o}),this.processedArgs=t}_chainOrCall(e,t){if(e&&e.then&&typeof e.then==="function")return e.then(()=>t());return t()}_chainOrCallHooks(e,t){let r=e,n=[];if(this._getCommandAndAncestors().reverse().filter((o)=>o._lifeCycleHooks[t]!==void 0).forEach((o)=>{o._lifeCycleHooks[t].forEach((s)=>{n.push({hookedCommand:o,callback:s})})}),t==="postAction")n.reverse();return n.forEach((o)=>{r=this._chainOrCall(r,()=>o.callback(o.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let n=e;if(this._lifeCycleHooks[r]!==void 0)this._lifeCycleHooks[r].forEach((o)=>{n=this._chainOrCall(n,()=>o(this,t))});return n}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{if(r.unknown.length>0)this.unknownOption(r.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let s;if(s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent)s=this._chainOrCall(s,()=>{this.parent.emit(o,e,t)});return s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(o))n(),this._processArguments(),this.parent.emit(o,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);if(this.listenerCount("command:*"))this.emit("command:*",e,t);else if(this.commands.length)this.unknownCommand();else n(),this._processArguments()}else if(this.commands.length)n(),this.help({error:!0});else n(),this._processArguments()}_findCommand(e){if(!e)return;return this.commands.find((t)=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find((t)=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((e)=>{e.options.forEach((t)=>{if(t.mandatory&&e.getOptionValue(t.attributeName())===void 0)e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter((r)=>{let n=r.attributeName();if(this.getOptionValue(n)===void 0)return!1;return this.getOptionValueSource(n)!=="default"});e.filter((r)=>r.conflictsWith.length>0).forEach((r)=>{let n=e.find((o)=>r.conflictsWith.includes(o.attributeName()));if(n)this._conflictingOption(r,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((e)=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],r=[],n=t,o=e.slice();function s(c){return c.length>1&&c[0]==="-"}let i=null;while(o.length){let c=o.shift();if(c==="--"){if(n===r)n.push(c);n.push(...o);break}if(i&&!s(c)){this.emit(`option:${i.name()}`,c);continue}if(i=null,s(c)){let p=this._findOption(c);if(p){if(p.required){let l=o.shift();if(l===void 0)this.optionMissingArgument(p);this.emit(`option:${p.name()}`,l)}else if(p.optional){let l=null;if(o.length>0&&!s(o[0]))l=o.shift();this.emit(`option:${p.name()}`,l)}else this.emit(`option:${p.name()}`);i=p.variadic?p:null;continue}}if(c.length>2&&c[0]==="-"&&c[1]!=="-"){let p=this._findOption(`-${c[1]}`);if(p){if(p.required||p.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${p.name()}`,c.slice(2));else this.emit(`option:${p.name()}`),o.unshift(`-${c.slice(2)}`);continue}}if(/^--[^=]+=/.test(c)){let p=c.indexOf("="),l=this._findOption(c.slice(0,p));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,c.slice(p+1));continue}}if(s(c))n=r;if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(c)){if(t.push(c),o.length>0)r.push(...o);break}else if(this._getHelpCommand()&&c===this._getHelpCommand().name()){if(t.push(c),o.length>0)t.push(...o);break}else if(this._defaultCommandName){if(r.push(c),o.length>0)r.push(...o);break}}if(this._passThroughOptions){if(n.push(c),o.length>0)n.push(...o);break}n.push(c)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let n=this.options[r].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){if(this._outputConfiguration.outputError(`${e}
18
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
19
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
20
- `),this.outputHelp({error:!0});let r=t||{},n=r.exitCode||1,o=r.code||"commander.error";this._exit(n,o,e)}_parseOptionsEnv(){this.options.forEach((e)=>{if(e.envVar&&e.envVar in k.env){let t=e.attributeName();if(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))if(e.required||e.optional)this.emit(`optionEnv:${e.name()}`,k.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new $u(this.options),t=(r)=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter((r)=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach((r)=>{Object.keys(r.implied).filter((n)=>!t(n)).forEach((n)=>{this.setOptionValueWithSource(n,r.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=(s)=>{let i=s.attributeName(),u=this.getOptionValue(i),p=this.options.find((_)=>_.negate&&i===_.attributeName()),l=this.options.find((_)=>!_.negate&&i===_.attributeName());if(p&&(p.presetArg===void 0&&u===!1||p.presetArg!==void 0&&u===p.presetArg))return p;return l||s},n=(s)=>{let i=r(s),u=i.attributeName();if(this.getOptionValueSource(u)==="env")return`environment variable '${i.envVar}'`;return`option '${i.flags}'`},o=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter((i)=>i.long).map((i)=>i.long);n=n.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);t=Er(e,n)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach((o)=>{if(n.push(o.name()),o.alias())n.push(o.alias())}),t=Er(e,n)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let n=this.createOption(t,r);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
- `),this._exit(0,"commander.version",e)}),this}description(e,t){if(e===void 0&&t===void 0)return this._description;if(this._description=e,t)this._argsDescription=t;return this}summary(e){if(e===void 0)return this._summary;return this._summary=e,this}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)t=this.commands[this.commands.length-1];if(e===t._name)throw Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){if(e===void 0)return this._aliases;return e.forEach((t)=>this.alias(t)),this}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map((r)=>yu(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){if(e===void 0)return this._name;return this._name=e,this}nameFromFilename(e){return this._name=W.basename(e,W.extname(e)),this}executableDir(e){if(e===void 0)return this._executableDir;return this._executableDir=e,this}helpInformation(e){let t=this.createHelp();if(t.helpWidth===void 0)t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},r;if(t.error)r=(n)=>this._outputConfiguration.writeErr(n);else r=(n)=>this._outputConfiguration.writeOut(n);return t.write=e.write||r,t.command=this,t}outputHelp(e){let t;if(typeof e==="function")t=e,e=void 0;let r=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach((o)=>o.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let n=this.helpInformation(r);if(t){if(n=t(n),typeof n!=="string"&&!Buffer.isBuffer(n))throw Error("outputHelp callback must return a string or a Buffer")}if(r.write(n),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",r),this._getCommandAndAncestors().forEach((o)=>o.emit("afterAllHelp",r))}helpOption(e,t){if(typeof e==="boolean"){if(e)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=k.exitCode||0;if(t===0&&e&&typeof e!=="function"&&e.error)t=1;this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw Error(`Unexpected value for position to addHelpText.
20
+ `),this.outputHelp({error:!0});let r=t||{},n=r.exitCode||1,o=r.code||"commander.error";this._exit(n,o,e)}_parseOptionsEnv(){this.options.forEach((e)=>{if(e.envVar&&e.envVar in k.env){let t=e.attributeName();if(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))if(e.required||e.optional)this.emit(`optionEnv:${e.name()}`,k.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new wu(this.options),t=(r)=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter((r)=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach((r)=>{Object.keys(r.implied).filter((n)=>!t(n)).forEach((n)=>{this.setOptionValueWithSource(n,r.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=(s)=>{let i=s.attributeName(),c=this.getOptionValue(i),p=this.options.find((h)=>h.negate&&i===h.attributeName()),l=this.options.find((h)=>!h.negate&&i===h.attributeName());if(p&&(p.presetArg===void 0&&c===!1||p.presetArg!==void 0&&c===p.presetArg))return p;return l||s},n=(s)=>{let i=r(s),c=i.attributeName();if(this.getOptionValueSource(c)==="env")return`environment variable '${i.envVar}'`;return`option '${i.flags}'`},o=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter((i)=>i.long).map((i)=>i.long);n=n.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);t=Er(e,n)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach((o)=>{if(n.push(o.name()),o.alias())n.push(o.alias())}),t=Er(e,n)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let n=this.createOption(t,r);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
+ `),this._exit(0,"commander.version",e)}),this}description(e,t){if(e===void 0&&t===void 0)return this._description;if(this._description=e,t)this._argsDescription=t;return this}summary(e){if(e===void 0)return this._summary;return this._summary=e,this}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)t=this.commands[this.commands.length-1];if(e===t._name)throw Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){if(e===void 0)return this._aliases;return e.forEach((t)=>this.alias(t)),this}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map((r)=>$u(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){if(e===void 0)return this._name;return this._name=e,this}nameFromFilename(e){return this._name=K.basename(e,K.extname(e)),this}executableDir(e){if(e===void 0)return this._executableDir;return this._executableDir=e,this}helpInformation(e){let t=this.createHelp();if(t.helpWidth===void 0)t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},r;if(t.error)r=(n)=>this._outputConfiguration.writeErr(n);else r=(n)=>this._outputConfiguration.writeOut(n);return t.write=e.write||r,t.command=this,t}outputHelp(e){let t;if(typeof e==="function")t=e,e=void 0;let r=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach((o)=>o.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let n=this.helpInformation(r);if(t){if(n=t(n),typeof n!=="string"&&!Buffer.isBuffer(n))throw Error("outputHelp callback must return a string or a Buffer")}if(r.write(n),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",r),this._getCommandAndAncestors().forEach((o)=>o.emit("afterAllHelp",r))}helpOption(e,t){if(typeof e==="boolean"){if(e)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=k.exitCode||0;if(t===0&&e&&typeof e!=="function"&&e.error)t=1;this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw Error(`Unexpected value for position to addHelpText.
22
22
  Expecting one of '${r.join("', '")}'`);let n=`${e}Help`;return this.on(n,(o)=>{let s;if(typeof t==="function")s=t({error:o.error,command:o.command});else s=t;if(s)o.write(`${s}
23
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((n)=>t.is(n)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Pr(e){return e.map((t)=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",o="9229",s;if((s=t.match(/^(--inspect(-brk)?)$/))!==null)r=s[1];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(r=s[1],/^\d+$/.test(s[3]))o=s[3];else n=s[3];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)r=s[1],n=s[3],o=s[4];if(r&&o!=="0")return`${r}=${n}:${parseInt(o)+1}`;return t})}Au.Command=kt});var Ot={};Ga(Ot,{program:()=>Ir,createCommand:()=>jr,createOption:()=>Fr,createArgument:()=>Dr,Command:()=>Lr,Option:()=>Ur,Argument:()=>Mr,Help:()=>Vr,CommanderError:()=>vr,InvalidArgumentError:()=>qr,InvalidOptionArgumentError:()=>Jr},{program:(Kd)=>Ir=Kd,createCommand:(Kd)=>jr=Kd,createOption:(Kd)=>Fr=Kd,createArgument:(Kd)=>Dr=Kd,Command:(Kd)=>Lr=Kd,Option:(Kd)=>Ur=Kd,Argument:(Kd)=>Mr=Kd,Help:(Kd)=>Vr=Kd,CommanderError:(Kd)=>vr=Kd,InvalidArgumentError:(Kd)=>qr=Kd,InvalidOptionArgumentError:(Kd)=>Jr=Kd});var{Argument:Cr}=Ge(),{Command:Zt}=Rr(),{CommanderError:zu,InvalidArgumentError:Nr}=Ie(),{Help:Su}=wt(),{Option:Tr}=zt();var Ir=new Zt,jr=(e)=>new Zt(e),Fr=(e,t)=>new Tr(e,t),Dr=(e,t)=>new Cr(e,t),Lr=Zt,Ur=Tr,Mr=Cr,Vr=Su,vr=zu,qr=Nr,Jr=Nr;var{program:Qd,createCommand:Xd,createArgument:em,createOption:tm,CommanderError:rm,InvalidArgumentError:We,InvalidOptionArgumentError:nm,Command:F,Argument:om,Option:sm,Help:im}=Ot;import{readFile as Zf}from"node:fs/promises";import{resolve as Of}from"node:path";var Br={name:"@shotstack/cli",version:"0.11.0",description:"Command-line interface for the Shotstack video rendering API.",license:"Apache-2.0",homepage:"https://github.com/shotstack/shotstack-cli",repository:{type:"git",url:"git+https://github.com/shotstack/shotstack-cli.git"},bugs:{url:"https://github.com/shotstack/shotstack-cli/issues"},type:"module",bin:{shotstack:"dist/shotstack.js"},files:["dist/shotstack.js","skills"],scripts:{start:"bun run src/index.ts",build:"bun build src/index.ts --target=node --minify --outfile=dist/shotstack.js --banner='#!/usr/bin/env node' && chmod +x dist/shotstack.js",prepack:"bun run build",typecheck:"tsc --noEmit",test:"bun test"},dependencies:{"@shotstack/schemas":"^1.22.0",commander:"^12.1.0",zod:"^4.4.3"},devDependencies:{"@types/bun":"latest",typescript:"^5.6.0"}};var je=Br.version,Hr=`shotstack-cli/${je} (${process.platform}-${process.arch})`;class ie extends Error{status;body;constructor(e,t,r){super(r);this.status=e;this.body=t;this.name="ApiError"}get isTransient(){return this.status>=500||this.status===429}}function v(e){let t=e.env.baseUrl.replace(/\/$/,"");async function r(n,o,s){let i=await fetch(`${t}${o}`,{method:n,headers:{...e.apiKey!==void 0?{"x-api-key":e.apiKey}:{},"x-shotstack-origin":"cli","x-shotstack-environment":e.env.name,"user-agent":Hr,...s!==void 0?{"content-type":"application/json"}:{}},body:s!==void 0?JSON.stringify(s):void 0}),u=await i.text(),p=u?Zu(u):void 0;if(!i.ok)throw new ie(i.status,p??u,`${n} ${o} → ${i.status} ${i.statusText}`);return p}return{post:(n,o)=>r("POST",n,o),put:(n,o)=>r("PUT",n,o),get:(n)=>r("GET",n),del:(n)=>r("DELETE",n)}}function Zu(e){try{return JSON.parse(e)}catch{return e}}import{mkdir as Ou,writeFile as Eu,chmod as Pu}from"node:fs/promises";import{readFileSync as Ru}from"node:fs";import{join as Et,dirname as Cu}from"node:path";import{homedir as Gr}from"node:os";function ze(){if(process.platform==="win32"){let e=process.env.APPDATA??Et(Gr(),"AppData","Roaming");return Et(e,"shotstack","credentials.json")}return Et(Gr(),".shotstack","credentials.json")}function Pt(e){try{let t=JSON.parse(Ru(e,"utf8"));if(t&&typeof t==="object"&&!Array.isArray(t))return t}catch{}return{}}function Wr(e,t=ze()){return Pt(t)[e]?.trim()||void 0}async function Kr(e,t,r=ze()){let n=Pt(r);n[e]=t.trim(),await Rt(r,n)}async function Yr(e,t=ze()){let r=Pt(t);if(!(e in r))return!1;return delete r[e],await Rt(t,r),!0}async function Qr(e=ze()){await Rt(e,{})}async function Rt(e,t){await Ou(Cu(e),{recursive:!0,mode:448}),await Eu(e,JSON.stringify(t,null,2)+`
24
- `,{mode:384}),await Pu(e,384).catch(()=>{})}class Se extends Error{constructor(e){let t=e?` for env "${e}"`:"",r=e?`shotstack login --env ${e}`:"shotstack login";super(`No Shotstack API key found${t}. Run \`${r}\` to save one, or set SHOTSTACK_API_KEY. Get a key at https://shotstack.io.`);this.name="MissingApiKeyError"}}function G(e,t){let r=process.env.SHOTSTACK_API_KEY?.trim();if(r)return r;let n=Wr(e,t);if(n)return n;throw new Se(e)}var I=["dev","stage","v1"];class ke extends Error{constructor(e){super(`Invalid environment "${e}". Use one of: ${I.join(", ")}.`);this.name="InvalidEnvError"}}function Ke(e){let t=e??process.env.SHOTSTACK_ENV?.trim()??"v1";if(!Tu(t))throw new ke(t);return t}function q(e,t="edit"){let r=Nu(t);if(r)return{name:"custom",baseUrl:r};let n=Ke(e);return{name:n,baseUrl:`https://api.shotstack.io/${t}/${n}`}}function Nu(e){return(e==="ingest"?process.env.SHOTSTACK_INGEST_BASE_URL:process.env.SHOTSTACK_API_BASE_URL)?.trim()||void 0}function Tu(e){return I.includes(e)}function R(e){if(e==="json")return"json";return"text"}function E(e,t,r){if(e==="json")console.log(JSON.stringify(t));else console.log(r)}import{mkdir as Iu,appendFile as ju,stat as rn,readFile as Fu,writeFile as nn}from"node:fs/promises";import{join as Ct,dirname as Du}from"node:path";import{homedir as Xr}from"node:os";var Lu=1e6,Uu=500000,en=2000;function Ye(){if(process.platform==="win32"){let e=process.env.APPDATA??Ct(Xr(),"AppData","Roaming");return Ct(e,"shotstack","log.jsonl")}return Ct(Xr(),".shotstack","log.jsonl")}function Mu(e,t=new Date){let r={ts:t.toISOString(),cmd:e.cmd,args:e.args.map(Gu),exit:e.exit,durationMs:e.durationMs};if(e.renderId)r.renderId=e.renderId;if(e.response!==void 0)r.response=Ku(Nt(e.response));if(e.error)r.error=Vu(e.error);return r}function Vu(e){return{name:e.name,message:typeof e.message==="string"?Tt(e.message):String(e.message)}}function vu(e){if(e instanceof Error)return{name:e.name,message:e.message};if(e===void 0||e===null)return;return{name:"Unknown",message:String(e)}}async function tn(e,t=Ye()){let r=Mu(e),n=JSON.stringify(r)+`
25
- `;if(await Iu(Du(t),{recursive:!0,mode:448}),!await qu(t))await nn(t,"",{mode:384});await ju(t,n),await Ju(t)}async function qu(e){try{return await rn(e),!0}catch{return!1}}async function Ju(e){let t=await rn(e).catch(()=>null);if(!t||t.size<=Lu)return;let r=await Fu(e),n=r.subarray(Math.max(0,r.length-Uu)),o=n.indexOf(10),s=o>=0?n.subarray(o+1):n;await nn(e,s,{mode:384})}var Bu=/^https?:\/\//i,Hu=/(https?:\/\/[^\s'"<>?]+)\?[^\s'"<>]*?(?:Signature|X-Amz-[A-Za-z0-9-]+|x-amz-security-token)=[^\s'"<>]*/gi;function Tt(e){return e.replace(Hu,"$1?[redacted-signed]")}function Gu(e){if(typeof e!=="string")return e;if(e.startsWith("-"))return e;if(Bu.test(e))return Tt(e);if(/[\/\\]/.test(e))return Wu(e);return e}function Wu(e){let t=e.split(/[\/\\]/);return t[t.length-1]||e}function Nt(e){if(typeof e==="string")return Tt(e);if(Array.isArray(e))return e.map(Nt);if(e&&typeof e==="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=Nt(n);return t}return e}function Ku(e){let t=JSON.stringify(e);if(t===void 0||t.length<=en)return e;return t.slice(0,en)+"...[truncated]"}async function J(e,t,r){let n=Date.now();try{let o=await r(),s=o.exitCode??0;if(await tn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,renderId:o.renderId,response:o.response}).catch(()=>{}),s!==0)process.exit(s)}catch(o){let s=Yu(o),i=o instanceof ie?o.body:void 0;throw await tn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,response:i,error:vu(o)}).catch(()=>{}),o}}function Yu(e){if(e instanceof ie)return e.isTransient?2:1;if(e instanceof Se||e instanceof ke)return 1;if(e instanceof Error&&e.code==="ENOENT")return 1;return 2}function B(e){let t=process.argv.slice(2),r=t.indexOf(e);return r>=0?t.slice(r+1):t}var Qu=new Set(["done","failed"]),Xu=3000,on=new F("status").description("Poll the status of a Shotstack render").argument("<id>","Render ID returned by `shotstack render`").option("--watch","Poll continuously until the render reaches a terminal state").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("status",B("status"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n}),i=await It(s,e,r,t.watch===!0),u=i.status==="failed"?1:0;return{renderId:i.id,response:i,exitCode:u}})});async function It(e,t,r,n){while(!0){let s=(await e.get(`/render/${encodeURIComponent(t)}`)).response;if(E(r,s,ec(s)),!n||Qu.has(s.status))return s;await tc(Xu)}}function ec(e){let t=[e.status];if(e.url)t.push(e.url);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function tc(e){return new Promise((t)=>setTimeout(t,e))}var sn;function m(e,t,r){function n(u,p){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:p,constr:i,traits:new Set},enumerable:!1});if(u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,p);let l=i.prototype,_=Object.keys(l);for(let y=0;y<_.length;y++){let A=_[y];if(!(A in u))u[A]=l[A].bind(u)}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(u){var p;let l=r?.Parent?new s:this;n(l,u),(p=l._zod).deferred??(p.deferred=[]);for(let _ of l._zod.deferred)_();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:(u)=>{if(r?.Parent&&u instanceof r.Parent)return!0;return u?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var jm=Symbol("zod_brand");class ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Fe extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(sn=globalThis).__zod_globalConfig??(sn.__zod_globalConfig={});var Ze=globalThis.__zod_globalConfig;function ee(e){if(e)Object.assign(Ze,e);return Ze}function Xe(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function De(e,t){if(typeof t==="bigint")return t.toString();return t}function Le(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function et(e){return e===null||e===void 0}function tt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function un(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}var an=Symbol("evaluating");function P(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===an)return;if(n===void 0)n=an,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function de(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ue(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ft(e){return JSON.stringify(e)}function cn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Dt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Oe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var pn=Le(()=>{if(Ze.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function me(e){if(Oe(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Oe(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Lt(e){if(me(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var ln=new Set(["string","number","symbol"]);function ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oe(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function w(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function fn(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var dn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function rc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=ue(e._zod.def,{get shape(){let i={};for(let u in t){if(!(u in r.shape))throw Error(`Unrecognized key: "${u}"`);if(!t[u])continue;i[u]=r.shape[u]}return de(this,"shape",i),i},checks:[]});return oe(e,s)}function nc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=ue(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let u in t){if(!(u in r.shape))throw Error(`Unrecognized key: "${u}"`);if(!t[u])continue;delete i[u]}return de(this,"shape",i),i},checks:[]});return oe(e,s)}function oc(e,t){if(!me(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=ue(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return de(this,"shape",s),s}});return oe(e,o)}function sc(e,t){if(!me(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ue(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return de(this,"shape",n),n}});return oe(e,r)}function ic(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ue(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return de(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return oe(e,r)}function ac(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=ue(t._zod.def,{get shape(){let u=t._zod.def.shape,p={...u};if(r)for(let l in r){if(!(l in u))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;p[l]=e?new e({type:"optional",innerType:u[l]}):u[l]}else for(let l in u)p[l]=e?new e({type:"optional",innerType:u[l]}):u[l];return de(this,"shape",p),p},checks:[]});return oe(t,i)}function uc(e,t,r){let n=ue(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return de(this,"shape",s),s}});return oe(t,n)}function he(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function mn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function pe(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Qe(e){return typeof e==="string"?e:e?.message}function te(e,t,r){let n=e.message?e.message:Qe(e.inst?._zod.def?.error?.(e))??Qe(t?.error?.(e))??Qe(r.customError?.(e))??Qe(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...u}=e;if(u.path??(u.path=[]),u.message=n,t?.reportInput)u.input=i;return u}function rt(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ge(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var hn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,De,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},nt=m("$ZodError",hn),Ut=m("$ZodError",hn,{Parent:Error});function gn(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function _n(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((u)=>n({issues:u},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let u=[...s,...i.path];if(u.length===0)r._errors.push(t(i));else{let p=r,l=0;while(l<u.length){let _=u[l];if(l!==u.length-1)p[_]=p[_]||{_errors:[]};else p[_]=p[_]||{_errors:[]},p[_]._errors.push(t(i));p=p[_],l++}}}};return n(e),r}var ot=(e)=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new ae;if(i.issues.length){let u=new(o?.Err??e)(i.issues.map((p)=>te(p,s,ee())));throw Dt(u,o?.callee),u}return i.value};var st=(e)=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let u=new(o?.Err??e)(i.issues.map((p)=>te(p,s,ee())));throw Dt(u,o?.callee),u}return i.value};var Ue=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ae;return s.issues.length?{success:!1,error:new(e??nt)(s.issues.map((i)=>te(i,o,ee())))}:{success:!0,data:s.value}},xn=Ue(Ut),Me=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>te(i,o,ee())))}:{success:!0,data:s.value}},yn=Me(Ut),bn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ot(e)(t,r,o)};var $n=(e)=>(t,r,n)=>ot(e)(t,r,n);var An=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return st(e)(t,r,o)};var wn=(e)=>async(t,r,n)=>st(e)(t,r,n);var zn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ue(e)(t,r,o)};var Sn=(e)=>(t,r,n)=>Ue(e)(t,r,n);var kn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Me(e)(t,r,o)};var Zn=(e)=>async(t,r,n)=>Me(e)(t,r,n);var On=/^[cC][0-9a-z]{6,}$/,En=/^[0-9a-z]+$/,Pn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Rn=/^[0-9a-vA-V]{20}$/,Cn=/^[A-Za-z0-9]{27}$/,Nn=/^[a-zA-Z0-9_-]{21}$/,Tn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var In=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Mt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var jn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var pc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fn(){return new RegExp(pc,"u")}var Dn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Un=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Mn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vt=/^[A-Za-z0-9_-]*$/;var vn=/^https?$/,qn=/^\+[1-9]\d{6,14}$/,Jn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Bn=new RegExp(`^${Jn}$`);function Hn(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Gn(e){return new RegExp(`^${Hn(e)}$`)}function Wn(e){let t=Hn({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Jn}T(?:${n})$`)}var Kn=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Yn=/^-?\d+$/,vt=/^-?\d+(?:\.\d+)?$/,Qn=/^(?:true|false)$/i,Xn=/^null$/i;var eo=/^[^A-Z]*$/,to=/^[^a-z]*$/;var Y=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ro={number:"number",bigint:"bigint",object:"date"},qt=m("$ZodCheckLessThan",(e,t)=>{Y.init(e,t);let r=ro[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jt=m("$ZodCheckGreaterThan",(e,t)=>{Y.init(e,t);let r=ro[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),no=m("$ZodCheckMultipleOf",(e,t)=>{Y.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):un(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),oo=m("$ZodCheckNumberFormat",(e,t)=>{Y.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=dn[t.format];e._zod.onattach.push((i)=>{let u=i._zod.bag;if(u.format=t.format,u.minimum=o,u.maximum=s,r)u.pattern=Yn}),e._zod.check=(i)=>{let u=i.value;if(r){if(!Number.isInteger(u)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){if(u>0)i.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(u<o)i.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(u>s)i.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var so=m("$ZodCheckMaxLength",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!et(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let i=rt(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),io=m("$ZodCheckMinLength",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!et(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let i=rt(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ao=m("$ZodCheckLengthEquals",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!et(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,s=o.length;if(s===t.length)return;let i=rt(o),u=s>t.length;n.issues.push({origin:i,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ve=m("$ZodCheckStringFormat",(e,t)=>{var r,n;if(Y.init(e,t),e._zod.onattach.push((o)=>{let s=o._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),uo=m("$ZodCheckRegex",(e,t)=>{Ve.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),co=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eo),Ve.init(e,t)}),po=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=to),Ve.init(e,t)}),lo=m("$ZodCheckIncludes",(e,t)=>{Y.init(e,t);let r=ce(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),fo=m("$ZodCheckStartsWith",(e,t)=>{Y.init(e,t);let r=new RegExp(`^${ce(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),mo=m("$ZodCheckEndsWith",(e,t)=>{Y.init(e,t);let r=new RegExp(`.*${ce(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var ho=m("$ZodCheckOverwrite",(e,t)=>{Y.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Bt{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
23
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((n)=>t.is(n)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Pr(e){return e.map((t)=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",o="9229",s;if((s=t.match(/^(--inspect(-brk)?)$/))!==null)r=s[1];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(r=s[1],/^\d+$/.test(s[3]))o=s[3];else n=s[3];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)r=s[1],n=s[3],o=s[4];if(r&&o!=="0")return`${r}=${n}:${parseInt(o)+1}`;return t})}zu.Command=kt});var Ot={};Wa(Ot,{program:()=>Ir,createCommand:()=>jr,createOption:()=>Fr,createArgument:()=>Dr,Command:()=>Lr,Option:()=>Ur,Argument:()=>Mr,Help:()=>vr,CommanderError:()=>Vr,InvalidArgumentError:()=>qr,InvalidOptionArgumentError:()=>Jr},{program:(Xd)=>Ir=Xd,createCommand:(Xd)=>jr=Xd,createOption:(Xd)=>Fr=Xd,createArgument:(Xd)=>Dr=Xd,Command:(Xd)=>Lr=Xd,Option:(Xd)=>Ur=Xd,Argument:(Xd)=>Mr=Xd,Help:(Xd)=>vr=Xd,CommanderError:(Xd)=>Vr=Xd,InvalidArgumentError:(Xd)=>qr=Xd,InvalidOptionArgumentError:(Xd)=>Jr=Xd});var{Argument:Cr}=Ke(),{Command:Zt}=Rr(),{CommanderError:ku,InvalidArgumentError:Nr}=je(),{Help:Zu}=wt(),{Option:Tr}=zt();var Ir=new Zt,jr=(e)=>new Zt(e),Fr=(e,t)=>new Tr(e,t),Dr=(e,t)=>new Cr(e,t),Lr=Zt,Ur=Tr,Mr=Cr,vr=Zu,Vr=ku,qr=Nr,Jr=Nr;var{program:tm,createCommand:rm,createArgument:nm,createOption:om,CommanderError:sm,InvalidArgumentError:We,InvalidOptionArgumentError:im,Command:F,Argument:am,Option:um,Help:cm}=Ot;import{readFile as Ef}from"node:fs/promises";import{resolve as Pf}from"node:path";var Br={name:"@shotstack/cli",version:"0.13.0",description:"Command-line interface for the Shotstack video rendering API.",license:"Apache-2.0",homepage:"https://github.com/shotstack/shotstack-cli",repository:{type:"git",url:"git+https://github.com/shotstack/shotstack-cli.git"},bugs:{url:"https://github.com/shotstack/shotstack-cli/issues"},type:"module",bin:{shotstack:"dist/shotstack.js"},files:["dist/shotstack.js","skills"],scripts:{start:"bun run src/index.ts",build:"bun build src/index.ts --target=node --minify --outfile=dist/shotstack.js --banner='#!/usr/bin/env node' && chmod +x dist/shotstack.js",prepack:"bun run build",typecheck:"tsc --noEmit",test:"bun test"},dependencies:{"@shotstack/schemas":"^1.22.0",commander:"^12.1.0",zod:"^4.4.3"},devDependencies:{"@types/bun":"latest",typescript:"^5.6.0"}};var Fe=Br.version,Hr=`shotstack-cli/${Fe} (${process.platform}-${process.arch})`;class ee extends Error{status;body;constructor(e,t,r){super(r);this.status=e;this.body=t;this.name="ApiError"}get isTransient(){return this.status>=500||this.status===429}}function q(e){let t=e.env.baseUrl.replace(/\/$/,"");async function r(n,o,s){let i=await fetch(`${t}${o}`,{method:n,headers:{"x-api-key":e.apiKey,"x-shotstack-origin":"cli","x-shotstack-environment":e.env.name,"user-agent":Hr,...s!==void 0?{"content-type":"application/json"}:{}},body:s!==void 0?JSON.stringify(s):void 0}),c=await i.text(),p=c?Eu(c):void 0;if(!i.ok)throw new ee(i.status,p??c,`${n} ${o} → ${i.status} ${i.statusText}`);return p}return{post:(n,o)=>r("POST",n,o),put:(n,o)=>r("PUT",n,o),get:(n)=>r("GET",n),del:(n)=>r("DELETE",n)}}function Eu(e){try{return JSON.parse(e)}catch{return e}}import{mkdir as Pu,writeFile as Ru,chmod as Cu}from"node:fs/promises";import{readFileSync as Nu}from"node:fs";import{join as Et,dirname as Tu}from"node:path";import{homedir as Gr}from"node:os";function ke(){if(process.platform==="win32"){let e=process.env.APPDATA??Et(Gr(),"AppData","Roaming");return Et(e,"shotstack","credentials.json")}return Et(Gr(),".shotstack","credentials.json")}function Pt(e){try{let t=JSON.parse(Nu(e,"utf8"));if(t&&typeof t==="object"&&!Array.isArray(t))return t}catch{}return{}}function Kr(e,t=ke()){return Pt(t)[e]?.trim()||void 0}async function Wr(e,t,r=ke()){let n=Pt(r);n[e]=t.trim(),await Rt(r,n)}async function Yr(e,t=ke()){let r=Pt(t);if(!(e in r))return!1;return delete r[e],await Rt(t,r),!0}async function Qr(e=ke()){await Rt(e,{})}async function Rt(e,t){await Pu(Tu(e),{recursive:!0,mode:448}),await Ru(e,JSON.stringify(t,null,2)+`
24
+ `,{mode:384}),await Cu(e,384).catch(()=>{})}class ue extends Error{constructor(e){let t=e?` for env "${e}"`:"",r=e?`shotstack login --env ${e}`:"shotstack login";super(`No Shotstack API key found${t}. Run \`${r}\` to save one, or set SHOTSTACK_API_KEY. Get a key at https://shotstack.io.`);this.name="MissingApiKeyError"}}function U(e,t){let r=process.env.SHOTSTACK_API_KEY?.trim();if(r)return r;let n=Kr(e,t);if(n)return n;throw new ue(e)}var R=["dev","stage","v1"];class Ze extends Error{constructor(e){super(`Invalid environment "${e}". Use one of: ${R.join(", ")}.`);this.name="InvalidEnvError"}}function me(e){let t=e??process.env.SHOTSTACK_ENV?.trim()??"v1";if(!ju(t))throw new Ze(t);return t}function J(e,t="edit"){let r=Iu(t);if(r)return{name:"custom",baseUrl:r};let n=me(e);return{name:n,baseUrl:`https://api.shotstack.io/${t}/${n}`}}function Iu(e){return(e==="ingest"?process.env.SHOTSTACK_INGEST_BASE_URL:process.env.SHOTSTACK_API_BASE_URL)?.trim()||void 0}function ju(e){return R.includes(e)}function C(e){if(e==="json")return"json";return"text"}function E(e,t,r){if(e==="json")console.log(JSON.stringify(t));else console.log(r)}import{mkdir as Fu,appendFile as Du,stat as rn,readFile as Lu,writeFile as nn}from"node:fs/promises";import{join as Ct,dirname as Uu}from"node:path";import{homedir as Xr}from"node:os";var Mu=1e6,vu=500000,en=2000;function Ye(){if(process.platform==="win32"){let e=process.env.APPDATA??Ct(Xr(),"AppData","Roaming");return Ct(e,"shotstack","log.jsonl")}return Ct(Xr(),".shotstack","log.jsonl")}function Vu(e,t=new Date){let r={ts:t.toISOString(),cmd:e.cmd,args:e.args.map(Wu),exit:e.exit,durationMs:e.durationMs};if(e.renderId)r.renderId=e.renderId;if(e.response!==void 0)r.response=Qu(Nt(e.response));if(e.error)r.error=qu(e.error);return r}function qu(e){return{name:e.name,message:typeof e.message==="string"?Tt(e.message):String(e.message)}}function Ju(e){if(e instanceof Error)return{name:e.name,message:e.message};if(e===void 0||e===null)return;return{name:"Unknown",message:String(e)}}async function tn(e,t=Ye()){let r=Vu(e),n=JSON.stringify(r)+`
25
+ `;if(await Fu(Uu(t),{recursive:!0,mode:448}),!await Bu(t))await nn(t,"",{mode:384});await Du(t,n),await Hu(t)}async function Bu(e){try{return await rn(e),!0}catch{return!1}}async function Hu(e){let t=await rn(e).catch(()=>null);if(!t||t.size<=Mu)return;let r=await Lu(e),n=r.subarray(Math.max(0,r.length-vu)),o=n.indexOf(10),s=o>=0?n.subarray(o+1):n;await nn(e,s,{mode:384})}var Gu=/^https?:\/\//i,Ku=/(https?:\/\/[^\s'"<>?]+)\?[^\s'"<>]*?(?:Signature|X-Amz-[A-Za-z0-9-]+|x-amz-security-token)=[^\s'"<>]*/gi;function Tt(e){return e.replace(Ku,"$1?[redacted-signed]")}function Wu(e){if(typeof e!=="string")return e;if(e.startsWith("-"))return e;if(Gu.test(e))return Tt(e);if(/[\/\\]/.test(e))return Yu(e);return e}function Yu(e){let t=e.split(/[\/\\]/);return t[t.length-1]||e}function Nt(e){if(typeof e==="string")return Tt(e);if(Array.isArray(e))return e.map(Nt);if(e&&typeof e==="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=Nt(n);return t}return e}function Qu(e){let t=JSON.stringify(e);if(t===void 0||t.length<=en)return e;return t.slice(0,en)+"...[truncated]"}async function B(e,t,r){let n=Date.now();try{let o=await r(),s=o.exitCode??0;if(await tn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,renderId:o.renderId,response:o.response}).catch(()=>{}),s!==0)process.exit(s)}catch(o){let s=Xu(o),i=o instanceof ee?o.body:void 0;throw await tn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,response:i,error:Ju(o)}).catch(()=>{}),o}}function Xu(e){if(e instanceof ee)return e.isTransient?2:1;if(e instanceof ue||e instanceof Ze)return 1;if(e instanceof Error&&e.code==="ENOENT")return 1;return 2}function H(e){let t=process.argv.slice(2),r=t.indexOf(e);return r>=0?t.slice(r+1):t}var ec=new Set(["done","failed"]),tc=3000,on=new F("status").description("Poll the status of a Shotstack render").argument("<id>","Render ID returned by `shotstack render`").option("--watch","Poll continuously until the render reaches a terminal state").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("status",H("status"),async()=>{let r=C(t.output),n=J(t.env),o=U(n.name),s=q({apiKey:o,env:n}),i=await It(s,e,r,t.watch===!0),c=i.status==="failed"?1:0;return{renderId:i.id,response:i,exitCode:c}})});async function It(e,t,r,n){while(!0){let s=(await e.get(`/render/${encodeURIComponent(t)}`)).response;if(E(r,s,rc(s)),!n||ec.has(s.status))return s;await nc(tc)}}function rc(e){let t=[e.status];if(e.url)t.push(e.url);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function nc(e){return new Promise((t)=>setTimeout(t,e))}var sn;function m(e,t,r){function n(c,p){if(!c._zod)Object.defineProperty(c,"_zod",{value:{def:p,constr:i,traits:new Set},enumerable:!1});if(c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,p);let l=i.prototype,h=Object.keys(l);for(let y=0;y<h.length;y++){let A=h[y];if(!(A in c))c[A]=l[A].bind(c)}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(c){var p;let l=r?.Parent?new s:this;n(l,c),(p=l._zod).deferred??(p.deferred=[]);for(let h of l._zod.deferred)h();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:(c)=>{if(r?.Parent&&c instanceof r.Parent)return!0;return c?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var Lm=Symbol("zod_brand");class ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class De extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(sn=globalThis).__zod_globalConfig??(sn.__zod_globalConfig={});var Oe=globalThis.__zod_globalConfig;function te(e){if(e)Object.assign(Oe,e);return Oe}function Xe(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Le(e,t){if(typeof t==="bigint")return t.toString();return t}function Ue(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function et(e){return e===null||e===void 0}function tt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function un(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}var an=Symbol("evaluating");function P(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===an)return;if(n===void 0)n=an,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function he(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ce(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ft(e){return JSON.stringify(e)}function cn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Dt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ee(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var pn=Ue(()=>{if(Oe.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ge(e){if(Ee(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Ee(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Lt(e){if(ge(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var ln=new Set(["string","number","symbol"]);function pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function se(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function w(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function fn(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var dn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function oc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=ce(e._zod.def,{get shape(){let i={};for(let c in t){if(!(c in r.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;i[c]=r.shape[c]}return he(this,"shape",i),i},checks:[]});return se(e,s)}function sc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=ce(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let c in t){if(!(c in r.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;delete i[c]}return he(this,"shape",i),i},checks:[]});return se(e,s)}function ic(e,t){if(!ge(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=ce(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return he(this,"shape",s),s}});return se(e,o)}function ac(e,t){if(!ge(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return he(this,"shape",n),n}});return se(e,r)}function uc(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return he(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return se(e,r)}function cc(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=ce(t._zod.def,{get shape(){let c=t._zod.def.shape,p={...c};if(r)for(let l in r){if(!(l in c))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;p[l]=e?new e({type:"optional",innerType:c[l]}):c[l]}else for(let l in c)p[l]=e?new e({type:"optional",innerType:c[l]}):c[l];return he(this,"shape",p),p},checks:[]});return se(t,i)}function pc(e,t,r){let n=ce(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return he(this,"shape",s),s}});return se(t,n)}function _e(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function mn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function le(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Qe(e){return typeof e==="string"?e:e?.message}function re(e,t,r){let n=e.message?e.message:Qe(e.inst?._zod.def?.error?.(e))??Qe(t?.error?.(e))??Qe(r.customError?.(e))??Qe(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...c}=e;if(c.path??(c.path=[]),c.message=n,t?.reportInput)c.input=i;return c}function rt(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function xe(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var hn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Le,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},nt=m("$ZodError",hn),Ut=m("$ZodError",hn,{Parent:Error});function gn(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function _n(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((c)=>n({issues:c},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let c=[...s,...i.path];if(c.length===0)r._errors.push(t(i));else{let p=r,l=0;while(l<c.length){let h=c[l];if(l!==c.length-1)p[h]=p[h]||{_errors:[]};else p[h]=p[h]||{_errors:[]},p[h]._errors.push(t(i));p=p[h],l++}}}};return n(e),r}var ot=(e)=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new ae;if(i.issues.length){let c=new(o?.Err??e)(i.issues.map((p)=>re(p,s,te())));throw Dt(c,o?.callee),c}return i.value};var st=(e)=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let c=new(o?.Err??e)(i.issues.map((p)=>re(p,s,te())));throw Dt(c,o?.callee),c}return i.value};var Me=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ae;return s.issues.length?{success:!1,error:new(e??nt)(s.issues.map((i)=>re(i,o,te())))}:{success:!0,data:s.value}},xn=Me(Ut),ve=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>re(i,o,te())))}:{success:!0,data:s.value}},yn=ve(Ut),bn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ot(e)(t,r,o)};var $n=(e)=>(t,r,n)=>ot(e)(t,r,n);var An=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return st(e)(t,r,o)};var wn=(e)=>async(t,r,n)=>st(e)(t,r,n);var zn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Me(e)(t,r,o)};var Sn=(e)=>(t,r,n)=>Me(e)(t,r,n);var kn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ve(e)(t,r,o)};var Zn=(e)=>async(t,r,n)=>ve(e)(t,r,n);var On=/^[cC][0-9a-z]{6,}$/,En=/^[0-9a-z]+$/,Pn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Rn=/^[0-9a-vA-V]{20}$/,Cn=/^[A-Za-z0-9]{27}$/,Nn=/^[a-zA-Z0-9_-]{21}$/,Tn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var In=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Mt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var jn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var fc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fn(){return new RegExp(fc,"u")}var Dn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Un=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Mn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vt=/^[A-Za-z0-9_-]*$/;var Vn=/^https?$/,qn=/^\+[1-9]\d{6,14}$/,Jn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Bn=new RegExp(`^${Jn}$`);function Hn(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Gn(e){return new RegExp(`^${Hn(e)}$`)}function Kn(e){let t=Hn({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Jn}T(?:${n})$`)}var Wn=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Yn=/^-?\d+$/,Vt=/^-?\d+(?:\.\d+)?$/,Qn=/^(?:true|false)$/i,Xn=/^null$/i;var eo=/^[^A-Z]*$/,to=/^[^a-z]*$/;var Y=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ro={number:"number",bigint:"bigint",object:"date"},qt=m("$ZodCheckLessThan",(e,t)=>{Y.init(e,t);let r=ro[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jt=m("$ZodCheckGreaterThan",(e,t)=>{Y.init(e,t);let r=ro[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),no=m("$ZodCheckMultipleOf",(e,t)=>{Y.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):un(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),oo=m("$ZodCheckNumberFormat",(e,t)=>{Y.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=dn[t.format];e._zod.onattach.push((i)=>{let c=i._zod.bag;if(c.format=t.format,c.minimum=o,c.maximum=s,r)c.pattern=Yn}),e._zod.check=(i)=>{let c=i.value;if(r){if(!Number.isInteger(c)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)i.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>s)i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var so=m("$ZodCheckMaxLength",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!et(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let i=rt(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),io=m("$ZodCheckMinLength",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!et(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let i=rt(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ao=m("$ZodCheckLengthEquals",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!et(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,s=o.length;if(s===t.length)return;let i=rt(o),c=s>t.length;n.issues.push({origin:i,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ve=m("$ZodCheckStringFormat",(e,t)=>{var r,n;if(Y.init(e,t),e._zod.onattach.push((o)=>{let s=o._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),uo=m("$ZodCheckRegex",(e,t)=>{Ve.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),co=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eo),Ve.init(e,t)}),po=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=to),Ve.init(e,t)}),lo=m("$ZodCheckIncludes",(e,t)=>{Y.init(e,t);let r=pe(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),fo=m("$ZodCheckStartsWith",(e,t)=>{Y.init(e,t);let r=new RegExp(`^${pe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),mo=m("$ZodCheckEndsWith",(e,t)=>{Y.init(e,t);let r=new RegExp(`.*${pe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var ho=m("$ZodCheckOverwrite",(e,t)=>{Y.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Bt{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
26
26
  `).filter((s)=>s),n=Math.min(...r.map((s)=>s.length-s.trimStart().length)),o=r.map((s)=>s.slice(n)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[""]).map((o)=>` ${o}`)];return new e(...t,n.join(`
27
- `))}}var _o={major:4,minor:4,patch:3};var j=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_o;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,u,p)=>{let l=he(i),_;for(let y of u){if(y._zod.def.when){if(mn(i))continue;if(!y._zod.def.when(i))continue}else if(l)continue;let A=i.issues.length,x=y._zod.check(i);if(x instanceof Promise&&p?.async===!1)throw new ae;if(_||x instanceof Promise)_=(_??Promise.resolve()).then(async()=>{if(await x,i.issues.length===A)return;if(!l)l=he(i,A)});else{if(i.issues.length===A)continue;if(!l)l=he(i,A)}}if(_)return _.then(()=>i);return i},s=(i,u,p)=>{if(he(i))return i.aborted=!0,i;let l=o(u,n,p);if(l instanceof Promise){if(p.async===!1)throw new ae;return l.then((_)=>e._zod.parse(_,p))}return e._zod.parse(l,p)};e._zod.run=(i,u)=>{if(u.skipChecks)return e._zod.parse(i,u);if(u.direction==="backward"){let l=e._zod.parse({value:i.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((_)=>s(_,i,u));return s(l,i,u)}let p=e._zod.parse(i,u);if(p instanceof Promise){if(u.async===!1)throw new ae;return p.then((l)=>o(l,n,u))}return o(p,n,u)}}P(e,"~standard",()=>({validate:(o)=>{try{let s=xn(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return yn(e,o).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ct=m("$ZodString",(e,t)=>{j.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Kn(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),D=m("$ZodStringFormat",(e,t)=>{Ve.init(e,t),ct.init(e,t)}),ko=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=In),D.init(e,t)}),Zo=m("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Mt(n))}else t.pattern??(t.pattern=Mt());D.init(e,t)}),Oo=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=jn),D.init(e,t)}),Eo=m("$ZodURL",(e,t)=>{D.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===vn.source){if(!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let o=new URL(n);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Po=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Fn()),D.init(e,t)}),Ro=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Nn),D.init(e,t)}),Co=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=On),D.init(e,t)}),No=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=En),D.init(e,t)}),To=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Pn),D.init(e,t)}),Io=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Rn),D.init(e,t)}),jo=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cn),D.init(e,t)}),Fo=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Wn(t)),D.init(e,t)}),Do=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Bn),D.init(e,t)}),Lo=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Gn(t)),D.init(e,t)}),Uo=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Tn),D.init(e,t)}),Mo=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dn),D.init(e,t),e._zod.bag.format="ipv4"}),Vo=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ln),D.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var vo=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Un),D.init(e,t)}),qo=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Mn),D.init(e,t),e._zod.check=(r)=>{let n=r.value.split("/");try{if(n.length!==2)throw Error();let[o,s]=n;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Jo(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Bo=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vn),D.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Jo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function lc(e){if(!Vt.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jo(r)}var Ho=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Vt),D.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(lc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Go=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qn),D.init(e,t)});function fc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Wo=m("$ZodJWT",(e,t)=>{D.init(e,t),e._zod.check=(r)=>{if(fc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Gt=m("$ZodNumber",(e,t)=>{j.init(e,t),e._zod.pattern=e._zod.bag.pattern??vt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Ko=m("$ZodNumberFormat",(e,t)=>{oo.init(e,t),Gt.init(e,t)}),Yo=m("$ZodBoolean",(e,t)=>{j.init(e,t),e._zod.pattern=Qn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Qo=m("$ZodNull",(e,t)=>{j.init(e,t),e._zod.pattern=Xn,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Xo=m("$ZodUnknown",(e,t)=>{j.init(e,t),e._zod.parse=(r)=>r}),es=m("$ZodNever",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),ts=m("$ZodVoid",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(typeof o>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}});function xo(e,t,r){if(e.issues.length)t.issues.push(...pe(r,e.issues));t.value[r]=e.value}var rs=m("$ZodArray",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let u=o[i],p=t.element._zod.run({value:u,issues:[]},n);if(p instanceof Promise)s.push(p.then((l)=>xo(l,r,i)));else xo(p,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function ut(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...pe(r,e.issues))}if(!i&&!o){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i)t.value[r]=void 0}else t.value[r]=e.value}function ns(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let r=fn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function os(e,t,r,n,o,s){let i=[],u=o.keySet,p=o.catchall._zod,l=p.def.type,_=p.optin==="optional",y=p.optout==="optional";for(let A in t){if(A==="__proto__")continue;if(u.has(A))continue;if(l==="never"){i.push(A);continue}let x=p.run({value:t[A],issues:[]},n);if(x instanceof Promise)e.push(x.then((z)=>ut(z,r,A,t,_,y)));else ut(x,r,A,t,_,y)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var dc=m("$ZodObject",(e,t)=>{if(j.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let u=t.shape;Object.defineProperty(t,"shape",{get:()=>{let p={...u};return Object.defineProperty(t,"shape",{value:p}),p}})}let n=Le(()=>ns(t));P(e._zod,"propValues",()=>{let u=t.shape,p={};for(let l in u){let _=u[l]._zod;if(_.values){p[l]??(p[l]=new Set);for(let y of _.values)p[l].add(y)}}return p});let o=Oe,s=t.catchall,i;e._zod.parse=(u,p)=>{i??(i=n.value);let l=u.value;if(!o(l))return u.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),u;u.value={};let _=[],y=i.shape;for(let A of i.keys){let x=y[A],z=x._zod.optin==="optional",M=x._zod.optout==="optional",C=x._zod.run({value:l[A],issues:[]},p);if(C instanceof Promise)_.push(C.then((se)=>ut(se,u,A,l,z,M)));else ut(C,u,A,l,z,M)}if(!s)return _.length?Promise.all(_).then(()=>u):u;return os(_,l,u,p,n.value,e)}}),ss=m("$ZodObjectJIT",(e,t)=>{dc.init(e,t);let r=e._zod.parse,n=Le(()=>ns(t)),o=(A)=>{let x=new Bt(["shape","payload","ctx"]),z=n.value,M=(ne)=>{let V=Ft(ne);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};x.write("const input = payload.value;");let C=Object.create(null),se=0;for(let ne of z.keys)C[ne]=`key_${se++}`;x.write("const newResult = {};");for(let ne of z.keys){let V=C[ne],K=Ft(ne),br=A[ne],$r=br?._zod?.optin==="optional",Ba=br?._zod?.optout==="optional";if(x.write(`const ${V} = ${M(ne)};`),$r&&Ba)x.write(`
27
+ `))}}var _o={major:4,minor:4,patch:3};var j=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_o;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,c,p)=>{let l=_e(i),h;for(let y of c){if(y._zod.def.when){if(mn(i))continue;if(!y._zod.def.when(i))continue}else if(l)continue;let A=i.issues.length,x=y._zod.check(i);if(x instanceof Promise&&p?.async===!1)throw new ae;if(h||x instanceof Promise)h=(h??Promise.resolve()).then(async()=>{if(await x,i.issues.length===A)return;if(!l)l=_e(i,A)});else{if(i.issues.length===A)continue;if(!l)l=_e(i,A)}}if(h)return h.then(()=>i);return i},s=(i,c,p)=>{if(_e(i))return i.aborted=!0,i;let l=o(c,n,p);if(l instanceof Promise){if(p.async===!1)throw new ae;return l.then((h)=>e._zod.parse(h,p))}return e._zod.parse(l,p)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let l=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((h)=>s(h,i,c));return s(l,i,c)}let p=e._zod.parse(i,c);if(p instanceof Promise){if(c.async===!1)throw new ae;return p.then((l)=>o(l,n,c))}return o(p,n,c)}}P(e,"~standard",()=>({validate:(o)=>{try{let s=xn(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return yn(e,o).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ct=m("$ZodString",(e,t)=>{j.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Wn(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),D=m("$ZodStringFormat",(e,t)=>{Ve.init(e,t),ct.init(e,t)}),ko=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=In),D.init(e,t)}),Zo=m("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Mt(n))}else t.pattern??(t.pattern=Mt());D.init(e,t)}),Oo=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=jn),D.init(e,t)}),Eo=m("$ZodURL",(e,t)=>{D.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Vn.source){if(!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let o=new URL(n);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Po=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Fn()),D.init(e,t)}),Ro=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Nn),D.init(e,t)}),Co=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=On),D.init(e,t)}),No=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=En),D.init(e,t)}),To=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Pn),D.init(e,t)}),Io=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Rn),D.init(e,t)}),jo=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cn),D.init(e,t)}),Fo=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Kn(t)),D.init(e,t)}),Do=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Bn),D.init(e,t)}),Lo=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Gn(t)),D.init(e,t)}),Uo=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Tn),D.init(e,t)}),Mo=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dn),D.init(e,t),e._zod.bag.format="ipv4"}),vo=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ln),D.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var Vo=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Un),D.init(e,t)}),qo=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Mn),D.init(e,t),e._zod.check=(r)=>{let n=r.value.split("/");try{if(n.length!==2)throw Error();let[o,s]=n;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Jo(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Bo=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=vn),D.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Jo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function dc(e){if(!vt.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jo(r)}var Ho=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=vt),D.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(dc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Go=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qn),D.init(e,t)});function mc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Ko=m("$ZodJWT",(e,t)=>{D.init(e,t),e._zod.check=(r)=>{if(mc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Gt=m("$ZodNumber",(e,t)=>{j.init(e,t),e._zod.pattern=e._zod.bag.pattern??Vt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Wo=m("$ZodNumberFormat",(e,t)=>{oo.init(e,t),Gt.init(e,t)}),Yo=m("$ZodBoolean",(e,t)=>{j.init(e,t),e._zod.pattern=Qn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Qo=m("$ZodNull",(e,t)=>{j.init(e,t),e._zod.pattern=Xn,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Xo=m("$ZodUnknown",(e,t)=>{j.init(e,t),e._zod.parse=(r)=>r}),es=m("$ZodNever",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),ts=m("$ZodVoid",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(typeof o>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}});function xo(e,t,r){if(e.issues.length)t.issues.push(...le(r,e.issues));t.value[r]=e.value}var rs=m("$ZodArray",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let c=o[i],p=t.element._zod.run({value:c,issues:[]},n);if(p instanceof Promise)s.push(p.then((l)=>xo(l,r,i)));else xo(p,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function ut(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...le(r,e.issues))}if(!i&&!o){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i)t.value[r]=void 0}else t.value[r]=e.value}function ns(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let r=fn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function os(e,t,r,n,o,s){let i=[],c=o.keySet,p=o.catchall._zod,l=p.def.type,h=p.optin==="optional",y=p.optout==="optional";for(let A in t){if(A==="__proto__")continue;if(c.has(A))continue;if(l==="never"){i.push(A);continue}let x=p.run({value:t[A],issues:[]},n);if(x instanceof Promise)e.push(x.then((z)=>ut(z,r,A,t,h,y)));else ut(x,r,A,t,h,y)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var hc=m("$ZodObject",(e,t)=>{if(j.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let p={...c};return Object.defineProperty(t,"shape",{value:p}),p}})}let n=Ue(()=>ns(t));P(e._zod,"propValues",()=>{let c=t.shape,p={};for(let l in c){let h=c[l]._zod;if(h.values){p[l]??(p[l]=new Set);for(let y of h.values)p[l].add(y)}}return p});let o=Ee,s=t.catchall,i;e._zod.parse=(c,p)=>{i??(i=n.value);let l=c.value;if(!o(l))return c.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),c;c.value={};let h=[],y=i.shape;for(let A of i.keys){let x=y[A],z=x._zod.optin==="optional",v=x._zod.optout==="optional",N=x._zod.run({value:l[A],issues:[]},p);if(N instanceof Promise)h.push(N.then((ie)=>ut(ie,c,A,l,z,v)));else ut(N,c,A,l,z,v)}if(!s)return h.length?Promise.all(h).then(()=>c):c;return os(h,l,c,p,n.value,e)}}),ss=m("$ZodObjectJIT",(e,t)=>{hc.init(e,t);let r=e._zod.parse,n=Ue(()=>ns(t)),o=(A)=>{let x=new Bt(["shape","payload","ctx"]),z=n.value,v=(oe)=>{let V=Ft(oe);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};x.write("const input = payload.value;");let N=Object.create(null),ie=0;for(let oe of z.keys)N[oe]=`key_${ie++}`;x.write("const newResult = {};");for(let oe of z.keys){let V=N[oe],W=Ft(oe),br=A[oe],$r=br?._zod?.optin==="optional",Ga=br?._zod?.optout==="optional";if(x.write(`const ${V} = ${v(oe)};`),$r&&Ga)x.write(`
28
28
  if (${V}.issues.length) {
29
- if (${K} in input) {
29
+ if (${W} in input) {
30
30
  payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
31
31
  ...iss,
32
- path: iss.path ? [${K}, ...iss.path] : [${K}]
32
+ path: iss.path ? [${W}, ...iss.path] : [${W}]
33
33
  })));
34
34
  }
35
35
  }
36
36
 
37
37
  if (${V}.value === undefined) {
38
- if (${K} in input) {
39
- newResult[${K}] = undefined;
38
+ if (${W} in input) {
39
+ newResult[${W}] = undefined;
40
40
  }
41
41
  } else {
42
- newResult[${K}] = ${V}.value;
42
+ newResult[${W}] = ${V}.value;
43
43
  }
44
44
 
45
45
  `);else if(!$r)x.write(`
46
- const ${V}_present = ${K} in input;
46
+ const ${V}_present = ${W} in input;
47
47
  if (${V}.issues.length) {
48
48
  payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
49
49
  ...iss,
50
- path: iss.path ? [${K}, ...iss.path] : [${K}]
50
+ path: iss.path ? [${W}, ...iss.path] : [${W}]
51
51
  })));
52
52
  }
53
53
  if (!${V}_present && !${V}.issues.length) {
@@ -55,15 +55,15 @@ Expecting one of '${r.join("', '")}'`);let n=`${e}Help`;return this.on(n,(o)=>{l
55
55
  code: "invalid_type",
56
56
  expected: "nonoptional",
57
57
  input: undefined,
58
- path: [${K}]
58
+ path: [${W}]
59
59
  });
60
60
  }
61
61
 
62
62
  if (${V}_present) {
63
63
  if (${V}.value === undefined) {
64
- newResult[${K}] = undefined;
64
+ newResult[${W}] = undefined;
65
65
  } else {
66
- newResult[${K}] = ${V}.value;
66
+ newResult[${W}] = ${V}.value;
67
67
  }
68
68
  }
69
69
 
@@ -71,26 +71,26 @@ Expecting one of '${r.join("', '")}'`);let n=`${e}Help`;return this.on(n,(o)=>{l
71
71
  if (${V}.issues.length) {
72
72
  payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
73
73
  ...iss,
74
- path: iss.path ? [${K}, ...iss.path] : [${K}]
74
+ path: iss.path ? [${W}, ...iss.path] : [${W}]
75
75
  })));
76
76
  }
77
77
 
78
78
  if (${V}.value === undefined) {
79
- if (${K} in input) {
80
- newResult[${K}] = undefined;
79
+ if (${W} in input) {
80
+ newResult[${W}] = undefined;
81
81
  }
82
82
  } else {
83
- newResult[${K}] = ${V}.value;
83
+ newResult[${W}] = ${V}.value;
84
84
  }
85
85
 
86
- `)}x.write("payload.value = newResult;"),x.write("return payload;");let Ja=x.compile();return(ne,V)=>Ja(A,ne,V)},s,i=Oe,u=!Ze.jitless,l=u&&pn.value,_=t.catchall,y;e._zod.parse=(A,x)=>{y??(y=n.value);let z=A.value;if(!i(z))return A.issues.push({expected:"object",code:"invalid_type",input:z,inst:e}),A;if(u&&l&&x?.async===!1&&x.jitless!==!0){if(!s)s=o(t.shape);if(A=s(A,x),!_)return A;return os([],z,A,x,y,e)}return r(A,x)}});function yo(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!he(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>te(i,n,ee())))}),t}var Wt=m("$ZodUnion",(e,t)=>{j.init(e,t),P(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),P(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),P(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),P(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${n.map((o)=>tt(o.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let u of t.options){let p=u._zod.run({value:n.value,issues:[]},o);if(p instanceof Promise)i.push(p),s=!0;else{if(p.issues.length===0)return p;i.push(p)}}if(!s)return yo(i,n,e,o);return Promise.all(i).then((u)=>yo(u,n,e,o))}});var is=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Wt.init(e,t);let r=e._zod.parse;P(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[u,p]of Object.entries(i)){if(!o[u])o[u]=new Set;for(let l of p)o[u].add(l)}}return o});let n=Le(()=>{let o=t.options,s=new Map;for(let i of o){let u=i._zod.propValues?.[t.discriminator];if(!u||u.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let p of u){if(s.has(p))throw Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Oe(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let u=n.value.get(i?.[t.discriminator]);if(u)return u._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:i,path:[t.discriminator],inst:e}),o}}),as=m("$ZodIntersection",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([p,l])=>bo(r,p,l));return bo(r,s,i)}});function Ht(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(me(e)&&me(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Ht(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Ht(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bo(e,t,r){let n=new Map,o;for(let u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(let p of u.keys){if(!n.has(p))n.set(p,{});n.get(p).l=!0}}else e.issues.push(u);for(let u of r.issues)if(u.code==="unrecognized_keys")for(let p of u.keys){if(!n.has(p))n.set(p,{});n.get(p).r=!0}else e.issues.push(u);let s=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o)e.issues.push({...o,keys:s});if(he(e))return e;let i=Ht(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var us=m("$ZodRecord",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!me(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let u=new Set;for(let l of i)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){u.add(typeof l==="number"?l.toString():l);let _=t.keyType._zod.run({value:l,issues:[]},n);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(_.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:_.issues.map((x)=>te(x,n,ee())),input:l,path:[l],inst:e});continue}let y=_.value,A=t.valueType._zod.run({value:o[l],issues:[]},n);if(A instanceof Promise)s.push(A.then((x)=>{if(x.issues.length)r.issues.push(...pe(l,x.issues));r.value[y]=x.value}));else{if(A.issues.length)r.issues.push(...pe(l,A.issues));r.value[y]=A.value}}let p;for(let l in o)if(!u.has(l))p=p??[],p.push(l);if(p&&p.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:p})}else{r.value={};for(let u of Reflect.ownKeys(o)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,u))continue;let p=t.keyType._zod.run({value:u,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&vt.test(u)&&p.issues.length){let y=t.keyType._zod.run({value:Number(u),issues:[]},n);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)p=y}if(p.issues.length){if(t.mode==="loose")r.value[u]=o[u];else r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((y)=>te(y,n,ee())),input:u,path:[u],inst:e});continue}let _=t.valueType._zod.run({value:o[u],issues:[]},n);if(_ instanceof Promise)s.push(_.then((y)=>{if(y.issues.length)r.issues.push(...pe(u,y.issues));r.value[p.value]=y.value}));else{if(_.issues.length)r.issues.push(...pe(u,_.issues));r.value[p.value]=_.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var cs=m("$ZodEnum",(e,t)=>{j.init(e,t);let r=Xe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>ln.has(typeof o)).map((o)=>typeof o==="string"?ce(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),ps=m("$ZodLiteral",(e,t)=>{if(j.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?ce(n):n?ce(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var ls=m("$ZodTransform",(e,t)=>{j.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Fe(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r.fallback=!0,r));if(o instanceof Promise)throw new ae;return r.value=o,r.fallback=!0,r}});function $o(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Kt=m("$ZodOptional",(e,t)=>{j.init(e,t),e._zod.optin="optional",e._zod.optout="optional",P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${tt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>$o(i,o));return $o(s,o)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),fs=m("$ZodExactOptional",(e,t)=>{Kt.init(e,t),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ds=m("$ZodNullable",(e,t)=>{j.init(e,t),P(e._zod,"optin",()=>t.innerType._zod.optin),P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${tt(r.source)}|null)$`):void 0}),P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),ms=m("$ZodDefault",(e,t)=>{j.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Ao(s,t));return Ao(o,t)}});function Ao(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var hs=m("$ZodPrefault",(e,t)=>{j.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),gs=m("$ZodNonOptional",(e,t)=>{j.init(e,t),P(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>wo(s,e));return wo(o,e)}});function wo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var _s=m("$ZodCatch",(e,t)=>{j.init(e,t),e._zod.optin="optional",P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>te(i,n,ee()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((s)=>te(s,n,ee()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Yt=m("$ZodPipe",(e,t)=>{j.init(e,t),P(e._zod,"values",()=>t.in._zod.values),P(e._zod,"optin",()=>t.in._zod.optin),P(e._zod,"optout",()=>t.out._zod.optout),P(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>at(i,t.in,n));return at(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>at(s,t.out,n));return at(o,t.out,n)}});function at(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var xs=m("$ZodPreprocess",(e,t)=>{Yt.init(e,t)}),ys=m("$ZodReadonly",(e,t)=>{j.init(e,t),P(e._zod,"propValues",()=>t.innerType._zod.propValues),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"optin",()=>t.innerType?._zod?.optin),P(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(zo);return zo(o)}});function zo(e){return e.value=Object.freeze(e.value),e}var bs=m("$ZodCustom",(e,t)=>{Y.init(e,t),j.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>So(s,r,n,e));So(o,r,n,e);return}});function So(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(ge(o))}}var $s,rh=Symbol("ZodOutput"),nh=Symbol("ZodInput");class As{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function mc(){return new As}($s=globalThis).__zod_globalRegistry??($s.__zod_globalRegistry=mc());var _e=globalThis.__zod_globalRegistry;function ws(e,t){return new e({type:"string",...w(t)})}function zs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function Qt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Ss(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function ks(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function Zs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function Os(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Es(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Ps(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Rs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function Cs(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Ns(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Ts(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function Is(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function js(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function Fs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Ds(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Ls(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function Us(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function Ms(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function Vs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function vs(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function qs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function Js(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function Bs(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function Hs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function Gs(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function Ws(e,t){return new e({type:"number",checks:[],...w(t)})}function Ks(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function Ys(e,t){return new e({type:"boolean",...w(t)})}function Qs(e,t){return new e({type:"null",...w(t)})}function Xs(e){return new e({type:"unknown"})}function ei(e,t){return new e({type:"never",...w(t)})}function ti(e,t){return new e({type:"void",...w(t)})}function pt(e,t){return new qt({check:"less_than",...w(t),value:e,inclusive:!1})}function ve(e,t){return new qt({check:"less_than",...w(t),value:e,inclusive:!0})}function lt(e,t){return new Jt({check:"greater_than",...w(t),value:e,inclusive:!1})}function qe(e,t){return new Jt({check:"greater_than",...w(t),value:e,inclusive:!0})}function ft(e,t){return new no({check:"multiple_of",...w(t),value:e})}function dt(e,t){return new so({check:"max_length",...w(t),maximum:e})}function Ee(e,t){return new io({check:"min_length",...w(t),minimum:e})}function mt(e,t){return new ao({check:"length_equals",...w(t),length:e})}function Xt(e,t){return new uo({check:"string_format",format:"regex",...w(t),pattern:e})}function er(e){return new co({check:"string_format",format:"lowercase",...w(e)})}function tr(e){return new po({check:"string_format",format:"uppercase",...w(e)})}function rr(e,t){return new lo({check:"string_format",format:"includes",...w(t),includes:e})}function nr(e,t){return new fo({check:"string_format",format:"starts_with",...w(t),prefix:e})}function or(e,t){return new mo({check:"string_format",format:"ends_with",...w(t),suffix:e})}function fe(e){return new ho({check:"overwrite",tx:e})}function sr(e){return fe((t)=>t.normalize(e))}function ir(){return fe((e)=>e.trim())}function ar(){return fe((e)=>e.toLowerCase())}function ur(){return fe((e)=>e.toUpperCase())}function cr(){return fe((e)=>cn(e))}function ri(e,t,r){return new e({type:"array",element:t,...w(r)})}function ni(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}function oi(e,t){let r=hc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ge(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(ge(s))}},e(n.value,n)),t);return r}function hc(e,t){let r=new Y({check:"custom",...w(t)});return r._zod.check=e,r}function pr(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??_e,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function H(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let u=e._zod.toJSONSchema?.();if(u)i.schema=u;else{let _={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,_);else{let A=i.schema,x=t.processors[o.type];if(!x)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);x(e,t,A,_)}let y=e._zod.parent;if(y){if(!i.ref)i.ref=y;H(y,t,_),t.seen.get(y).isParent=!0}}let p=t.metadataRegistry.get(e);if(p)Object.assign(i.schema,p);if(t.io==="input"&&Q(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function lr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of e.seen.entries()){let u=e.metadataRegistry.get(i[0])?.id;if(u){let p=n.get(u);if(p&&p!==i[0])throw Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(u,i[0])}}let o=(i)=>{let u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let y=e.external.registry.get(i[0])?.id,A=e.external.uri??((z)=>z);if(y)return{ref:A(y)};let x=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=x,{defId:x,ref:`${A("__shared")}#/${u}/${x}`}}if(i[1]===r)return{ref:"#"};let l=`${"#"}/${u}/`,_=i[1].schema.id??`__schema${e.counter++}`;return{defId:_,ref:l+_}},s=(i)=>{if(i[1].schema.$ref)return;let u=i[1],{ref:p,defId:l}=o(i);if(u.def={...u.schema},l)u.defId=l;let _=u.schema;for(let y in _)delete _[y];_.$ref=p};if(e.cycles==="throw")for(let i of e.seen.entries()){let u=i[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
86
+ `)}x.write("payload.value = newResult;"),x.write("return payload;");let Ha=x.compile();return(oe,V)=>Ha(A,oe,V)},s,i=Ee,c=!Oe.jitless,l=c&&pn.value,h=t.catchall,y;e._zod.parse=(A,x)=>{y??(y=n.value);let z=A.value;if(!i(z))return A.issues.push({expected:"object",code:"invalid_type",input:z,inst:e}),A;if(c&&l&&x?.async===!1&&x.jitless!==!0){if(!s)s=o(t.shape);if(A=s(A,x),!h)return A;return os([],z,A,x,y,e)}return r(A,x)}});function yo(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!_e(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>re(i,n,te())))}),t}var Kt=m("$ZodUnion",(e,t)=>{j.init(e,t),P(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),P(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),P(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),P(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${n.map((o)=>tt(o.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let c of t.options){let p=c._zod.run({value:n.value,issues:[]},o);if(p instanceof Promise)i.push(p),s=!0;else{if(p.issues.length===0)return p;i.push(p)}}if(!s)return yo(i,n,e,o);return Promise.all(i).then((c)=>yo(c,n,e,o))}});var is=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Kt.init(e,t);let r=e._zod.parse;P(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[c,p]of Object.entries(i)){if(!o[c])o[c]=new Set;for(let l of p)o[c].add(l)}}return o});let n=Ue(()=>{let o=t.options,s=new Map;for(let i of o){let c=i._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let p of c){if(s.has(p))throw Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Ee(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let c=n.value.get(i?.[t.discriminator]);if(c)return c._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:i,path:[t.discriminator],inst:e}),o}}),as=m("$ZodIntersection",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([p,l])=>bo(r,p,l));return bo(r,s,i)}});function Ht(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ge(e)&&ge(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Ht(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Ht(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bo(e,t,r){let n=new Map,o;for(let c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(let p of c.keys){if(!n.has(p))n.set(p,{});n.get(p).l=!0}}else e.issues.push(c);for(let c of r.issues)if(c.code==="unrecognized_keys")for(let p of c.keys){if(!n.has(p))n.set(p,{});n.get(p).r=!0}else e.issues.push(c);let s=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length&&o)e.issues.push({...o,keys:s});if(_e(e))return e;let i=Ht(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var us=m("$ZodRecord",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!ge(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let c=new Set;for(let l of i)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){c.add(typeof l==="number"?l.toString():l);let h=t.keyType._zod.run({value:l,issues:[]},n);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map((x)=>re(x,n,te())),input:l,path:[l],inst:e});continue}let y=h.value,A=t.valueType._zod.run({value:o[l],issues:[]},n);if(A instanceof Promise)s.push(A.then((x)=>{if(x.issues.length)r.issues.push(...le(l,x.issues));r.value[y]=x.value}));else{if(A.issues.length)r.issues.push(...le(l,A.issues));r.value[y]=A.value}}let p;for(let l in o)if(!c.has(l))p=p??[],p.push(l);if(p&&p.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:p})}else{r.value={};for(let c of Reflect.ownKeys(o)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,c))continue;let p=t.keyType._zod.run({value:c,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&Vt.test(c)&&p.issues.length){let y=t.keyType._zod.run({value:Number(c),issues:[]},n);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)p=y}if(p.issues.length){if(t.mode==="loose")r.value[c]=o[c];else r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((y)=>re(y,n,te())),input:c,path:[c],inst:e});continue}let h=t.valueType._zod.run({value:o[c],issues:[]},n);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...le(c,y.issues));r.value[p.value]=y.value}));else{if(h.issues.length)r.issues.push(...le(c,h.issues));r.value[p.value]=h.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var cs=m("$ZodEnum",(e,t)=>{j.init(e,t);let r=Xe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>ln.has(typeof o)).map((o)=>typeof o==="string"?pe(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),ps=m("$ZodLiteral",(e,t)=>{if(j.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?pe(n):n?pe(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var ls=m("$ZodTransform",(e,t)=>{j.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new De(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r.fallback=!0,r));if(o instanceof Promise)throw new ae;return r.value=o,r.fallback=!0,r}});function $o(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Wt=m("$ZodOptional",(e,t)=>{j.init(e,t),e._zod.optin="optional",e._zod.optout="optional",P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${tt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>$o(i,o));return $o(s,o)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),fs=m("$ZodExactOptional",(e,t)=>{Wt.init(e,t),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ds=m("$ZodNullable",(e,t)=>{j.init(e,t),P(e._zod,"optin",()=>t.innerType._zod.optin),P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${tt(r.source)}|null)$`):void 0}),P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),ms=m("$ZodDefault",(e,t)=>{j.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Ao(s,t));return Ao(o,t)}});function Ao(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var hs=m("$ZodPrefault",(e,t)=>{j.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),gs=m("$ZodNonOptional",(e,t)=>{j.init(e,t),P(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>wo(s,e));return wo(o,e)}});function wo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var _s=m("$ZodCatch",(e,t)=>{j.init(e,t),e._zod.optin="optional",P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>re(i,n,te()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((s)=>re(s,n,te()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Yt=m("$ZodPipe",(e,t)=>{j.init(e,t),P(e._zod,"values",()=>t.in._zod.values),P(e._zod,"optin",()=>t.in._zod.optin),P(e._zod,"optout",()=>t.out._zod.optout),P(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>at(i,t.in,n));return at(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>at(s,t.out,n));return at(o,t.out,n)}});function at(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var xs=m("$ZodPreprocess",(e,t)=>{Yt.init(e,t)}),ys=m("$ZodReadonly",(e,t)=>{j.init(e,t),P(e._zod,"propValues",()=>t.innerType._zod.propValues),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"optin",()=>t.innerType?._zod?.optin),P(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(zo);return zo(o)}});function zo(e){return e.value=Object.freeze(e.value),e}var bs=m("$ZodCustom",(e,t)=>{Y.init(e,t),j.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>So(s,r,n,e));So(o,r,n,e);return}});function So(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(xe(o))}}var $s,sh=Symbol("ZodOutput"),ih=Symbol("ZodInput");class As{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function gc(){return new As}($s=globalThis).__zod_globalRegistry??($s.__zod_globalRegistry=gc());var ye=globalThis.__zod_globalRegistry;function ws(e,t){return new e({type:"string",...w(t)})}function zs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function Qt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Ss(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function ks(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function Zs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function Os(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Es(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Ps(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Rs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function Cs(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Ns(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Ts(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function Is(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function js(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function Fs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Ds(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Ls(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function Us(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function Ms(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function vs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function Vs(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function qs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function Js(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function Bs(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function Hs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function Gs(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function Ks(e,t){return new e({type:"number",checks:[],...w(t)})}function Ws(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function Ys(e,t){return new e({type:"boolean",...w(t)})}function Qs(e,t){return new e({type:"null",...w(t)})}function Xs(e){return new e({type:"unknown"})}function ei(e,t){return new e({type:"never",...w(t)})}function ti(e,t){return new e({type:"void",...w(t)})}function pt(e,t){return new qt({check:"less_than",...w(t),value:e,inclusive:!1})}function qe(e,t){return new qt({check:"less_than",...w(t),value:e,inclusive:!0})}function lt(e,t){return new Jt({check:"greater_than",...w(t),value:e,inclusive:!1})}function Je(e,t){return new Jt({check:"greater_than",...w(t),value:e,inclusive:!0})}function ft(e,t){return new no({check:"multiple_of",...w(t),value:e})}function dt(e,t){return new so({check:"max_length",...w(t),maximum:e})}function Pe(e,t){return new io({check:"min_length",...w(t),minimum:e})}function mt(e,t){return new ao({check:"length_equals",...w(t),length:e})}function Xt(e,t){return new uo({check:"string_format",format:"regex",...w(t),pattern:e})}function er(e){return new co({check:"string_format",format:"lowercase",...w(e)})}function tr(e){return new po({check:"string_format",format:"uppercase",...w(e)})}function rr(e,t){return new lo({check:"string_format",format:"includes",...w(t),includes:e})}function nr(e,t){return new fo({check:"string_format",format:"starts_with",...w(t),prefix:e})}function or(e,t){return new mo({check:"string_format",format:"ends_with",...w(t),suffix:e})}function de(e){return new ho({check:"overwrite",tx:e})}function sr(e){return de((t)=>t.normalize(e))}function ir(){return de((e)=>e.trim())}function ar(){return de((e)=>e.toLowerCase())}function ur(){return de((e)=>e.toUpperCase())}function cr(){return de((e)=>cn(e))}function ri(e,t,r){return new e({type:"array",element:t,...w(r)})}function ni(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}function oi(e,t){let r=_c((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(xe(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(xe(s))}},e(n.value,n)),t);return r}function _c(e,t){let r=new Y({check:"custom",...w(t)});return r._zod.check=e,r}function pr(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??ye,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function G(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let h={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,h);else{let A=i.schema,x=t.processors[o.type];if(!x)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);x(e,t,A,h)}let y=e._zod.parent;if(y){if(!i.ref)i.ref=y;G(y,t,h),t.seen.get(y).isParent=!0}}let p=t.metadataRegistry.get(e);if(p)Object.assign(i.schema,p);if(t.io==="input"&&Q(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function lr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of e.seen.entries()){let c=e.metadataRegistry.get(i[0])?.id;if(c){let p=n.get(c);if(p&&p!==i[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,i[0])}}let o=(i)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let y=e.external.registry.get(i[0])?.id,A=e.external.uri??((z)=>z);if(y)return{ref:A(y)};let x=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=x,{defId:x,ref:`${A("__shared")}#/${c}/${x}`}}if(i[1]===r)return{ref:"#"};let l=`${"#"}/${c}/`,h=i[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:l+h}},s=(i)=>{if(i[1].schema.$ref)return;let c=i[1],{ref:p,defId:l}=o(i);if(c.def={...c.schema},l)c.defId=l;let h=c.schema;for(let y in h)delete h[y];h.$ref=p};if(e.cycles==="throw")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
87
87
 
88
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let u=i[1];if(t===i[0]){s(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(u.cycle){s(i);continue}if(u.count>1){if(e.reused==="ref"){s(i);continue}}}}function fr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(u)=>{let p=e.seen.get(u);if(p.ref===null)return;let l=p.def??p.schema,_={...l},y=p.ref;if(p.ref=null,y){n(y);let x=e.seen.get(y),z=x.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(z);else Object.assign(l,z);if(Object.assign(l,_),u._zod.parent===y)for(let C in l){if(C==="$ref"||C==="allOf")continue;if(!(C in _))delete l[C]}if(z.$ref&&x.def)for(let C in l){if(C==="$ref"||C==="allOf")continue;if(C in x.def&&JSON.stringify(l[C])===JSON.stringify(x.def[C]))delete l[C]}}let A=u._zod.parent;if(A&&A!==y){n(A);let x=e.seen.get(A);if(x?.schema.$ref){if(l.$ref=x.schema.$ref,x.def)for(let z in l){if(z==="$ref"||z==="allOf")continue;if(z in x.def&&JSON.stringify(l[z])===JSON.stringify(x.def[z]))delete l[z]}}}e.override({zodSchema:u,jsonSchema:l,path:p.path??[]})};for(let u of[...e.seen.entries()].reverse())n(u[0]);let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let u=e.external.registry.get(t)?.id;if(!u)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};for(let u of e.seen.entries()){let p=u[1];if(p.def&&p.defId){if(p.def.id===p.defId)delete p.def.id;i[p.defId]=p.def}}if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Je(t,"input",e.processors),output:Je(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch(u){throw Error("Error converting schema to JSON.")}}function Q(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Q(n.in,r)||Q(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;if(n.rest&&Q(n.rest,r))return!0;return!1}return!1}var si=(e,t={})=>(r)=>{let n=pr({...r,processors:t});return H(e,n),lr(n,e),fr(n,e)},Je=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=pr({...o??{},target:s,io:t,processors:r});return H(e,i),lr(i,e),fr(i,e)};var gc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ii=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:u,patterns:p,contentEncoding:l}=e._zod.bag;if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(u){if(o.format=gc[u]??u,o.format==="")delete o.format;if(u==="time")delete o.format}if(l)o.contentEncoding=l;if(p&&p.size>0){let _=[...p];if(_.length===1)o.pattern=_[0].source;else if(_.length>1)o.allOf=[..._.map((y)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))]}},ai=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,format:u,multipleOf:p,exclusiveMaximum:l,exclusiveMinimum:_}=e._zod.bag;if(typeof u==="string"&&u.includes("int"))o.type="integer";else o.type="number";let y=typeof _==="number"&&_>=(s??Number.NEGATIVE_INFINITY),A=typeof l==="number"&&l<=(i??Number.POSITIVE_INFINITY),x=t.target==="draft-04"||t.target==="openapi-3.0";if(y)if(x)o.minimum=_,o.exclusiveMinimum=!0;else o.exclusiveMinimum=_;else if(typeof s==="number")o.minimum=s;if(A)if(x)o.maximum=l,o.exclusiveMaximum=!0;else o.exclusiveMaximum=l;else if(typeof i==="number")o.maximum=i;if(typeof p==="number")o.multipleOf=p},ui=(e,t,r,n)=>{r.type="boolean"};var ci=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var pi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},li=(e,t,r,n)=>{r.not={}};var fi=(e,t,r,n)=>{};var di=(e,t,r,n)=>{let o=e._zod.def,s=Xe(o.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},mi=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(i));else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}};var hi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var gi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var _i=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:u}=e._zod.bag;if(typeof i==="number")o.minItems=i;if(typeof u==="number")o.maxItems=u;o.type="array",o.items=H(s.element,t,{...n,path:[...n.path,"items"]})},xi=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let l in i)o.properties[l]=H(i[l],t,{...n,path:[...n.path,"properties",l]});let u=new Set(Object.keys(i)),p=new Set([...u].filter((l)=>{let _=s.shape[l]._zod;if(t.io==="input")return _.optin===void 0;else return _.optout===void 0}));if(p.size>0)o.required=Array.from(p);if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=H(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},yi=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((u,p)=>H(u,t,{...n,path:[...n.path,s?"oneOf":"anyOf",p]}));if(s)r.oneOf=i;else r.anyOf=i},bi=(e,t,r,n)=>{let o=e._zod.def,s=H(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=H(o.right,t,{...n,path:[...n.path,"allOf",1]}),u=(l)=>("allOf"in l)&&Object.keys(l).length===1,p=[...u(s)?s.allOf:[s],...u(i)?i.allOf:[i]];r.allOf=p};var $i=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,p=i._zod.bag?.patterns;if(s.mode==="loose"&&p&&p.size>0){let _=H(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let y of p)o.patternProperties[y.source]=_}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=H(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=H(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=i._zod.values;if(l){let _=[...l].filter((y)=>typeof y==="string"||typeof y==="number");if(_.length>0)o.required=_}},Ai=(e,t,r,n)=>{let o=e._zod.def,s=H(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},wi=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},zi=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Si=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},ki=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Zi=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;H(i,t,n);let u=t.seen.get(e);u.ref=i},Oi=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var dr=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var wc=m("ZodISODateTime",(e,t)=>{Fo.init(e,t),U.init(e,t)});function Ei(e){return Js(wc,e)}var zc=m("ZodISODate",(e,t)=>{Do.init(e,t),U.init(e,t)});function Pi(e){return Bs(zc,e)}var Sc=m("ZodISOTime",(e,t)=>{Lo.init(e,t),U.init(e,t)});function Ri(e){return Hs(Sc,e)}var kc=m("ZodISODuration",(e,t)=>{Uo.init(e,t),U.init(e,t)});function Ci(e){return Gs(kc,e)}var Ec=(e,t)=>{nt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>_n(e,r)},flatten:{value:(r)=>gn(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,De,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,De,2)}},isEmpty:{get(){return e.issues.length===0}}})};var X=m("ZodError",Ec,{Parent:Error});var Ni=ot(X),Ti=st(X),Ii=Ue(X),ji=Me(X),Fi=bn(X),Di=$n(X),Li=An(X),Ui=wn(X),Mi=zn(X),Vi=Sn(X),vi=kn(X),qi=Zn(X);var Ji=new WeakMap;function Be(e,t,r){let n=Object.getPrototypeOf(e),o=Ji.get(n);if(!o)o=new Set,Ji.set(n,o);if(o.has(t))return;o.add(t);for(let s in r){let i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let u=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}var L=m("ZodType",(e,t)=>(j.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Je(e,"input"),output:Je(e,"output")}}),e.toJSONSchema=si(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Ni(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Ii(e,r,n),e.parseAsync=async(r,n)=>Ti(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ji(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Fi(e,r,n),e.decode=(r,n)=>Di(e,r,n),e.encodeAsync=async(r,n)=>Li(e,r,n),e.decodeAsync=async(r,n)=>Ui(e,r,n),e.safeEncode=(r,n)=>Mi(e,r,n),e.safeDecode=(r,n)=>Vi(e,r,n),e.safeEncodeAsync=async(r,n)=>vi(e,r,n),e.safeDecodeAsync=async(r,n)=>qi(e,r,n),Be(e,"ZodType",{check(...r){let n=this.def;return this.clone(ue(n,{checks:[...n.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return oe(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Ap(r,n))},superRefine(r,n){return this.check(wp(r,n))},overwrite(r){return this.check(fe(r))},optional(){return a(this)},exactOptional(){return cp(this)},nullable(){return Wi(this)},nullish(){return a(Wi(this))},nonoptional(r){return hp(this,r)},array(){return T(this)},or(r){return f([this,r])},and(r){return sp(this,r)},transform(r){return Ki(this,ta(r))},default(r){return fp(this,r)},prefault(r){return mp(this,r)},catch(r){return _p(this,r)},pipe(r){return Ki(this,r)},readonly(){return bp(this)},describe(r){let n=this.clone();return _e.add(n,{description:r}),n},meta(...r){if(r.length===0)return _e.get(this);let n=this.clone();return _e.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return _e.get(e)?.description},configurable:!0}),e)),Yi=m("_ZodString",(e,t)=>{ct.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>ii(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Be(e,"_ZodString",{regex(...n){return this.check(Xt(...n))},includes(...n){return this.check(rr(...n))},startsWith(...n){return this.check(nr(...n))},endsWith(...n){return this.check(or(...n))},min(...n){return this.check(Ee(...n))},max(...n){return this.check(dt(...n))},length(...n){return this.check(mt(...n))},nonempty(...n){return this.check(Ee(1,...n))},lowercase(n){return this.check(er(n))},uppercase(n){return this.check(tr(n))},trim(){return this.check(ir())},normalize(...n){return this.check(sr(...n))},toLowerCase(){return this.check(ar())},toUpperCase(){return this.check(ur())},slugify(){return this.check(cr())}})}),Rc=m("ZodString",(e,t)=>{ct.init(e,t),Yi.init(e,t),e.email=(r)=>e.check(zs(Cc,r)),e.url=(r)=>e.check(Es(Nc,r)),e.jwt=(r)=>e.check(qs(Gc,r)),e.emoji=(r)=>e.check(Ps(Tc,r)),e.guid=(r)=>e.check(Qt(Bi,r)),e.uuid=(r)=>e.check(Ss(gt,r)),e.uuidv4=(r)=>e.check(ks(gt,r)),e.uuidv6=(r)=>e.check(Zs(gt,r)),e.uuidv7=(r)=>e.check(Os(gt,r)),e.nanoid=(r)=>e.check(Rs(Ic,r)),e.guid=(r)=>e.check(Qt(Bi,r)),e.cuid=(r)=>e.check(Cs(jc,r)),e.cuid2=(r)=>e.check(Ns(Fc,r)),e.ulid=(r)=>e.check(Ts(Dc,r)),e.base64=(r)=>e.check(Ms(Jc,r)),e.base64url=(r)=>e.check(Vs(Bc,r)),e.xid=(r)=>e.check(Is(Lc,r)),e.ksuid=(r)=>e.check(js(Uc,r)),e.ipv4=(r)=>e.check(Fs(Mc,r)),e.ipv6=(r)=>e.check(Ds(Vc,r)),e.cidrv4=(r)=>e.check(Ls(vc,r)),e.cidrv6=(r)=>e.check(Us(qc,r)),e.e164=(r)=>e.check(vs(Hc,r)),e.datetime=(r)=>e.check(Ei(r)),e.date=(r)=>e.check(Pi(r)),e.time=(r)=>e.check(Ri(r)),e.duration=(r)=>e.check(Ci(r))});function c(e){return ws(Rc,e)}var U=m("ZodStringFormat",(e,t)=>{D.init(e,t),Yi.init(e,t)}),Cc=m("ZodEmail",(e,t)=>{Oo.init(e,t),U.init(e,t)});var Bi=m("ZodGUID",(e,t)=>{ko.init(e,t),U.init(e,t)});var gt=m("ZodUUID",(e,t)=>{Zo.init(e,t),U.init(e,t)});var Nc=m("ZodURL",(e,t)=>{Eo.init(e,t),U.init(e,t)});var Tc=m("ZodEmoji",(e,t)=>{Po.init(e,t),U.init(e,t)});var Ic=m("ZodNanoID",(e,t)=>{Ro.init(e,t),U.init(e,t)});var jc=m("ZodCUID",(e,t)=>{Co.init(e,t),U.init(e,t)});var Fc=m("ZodCUID2",(e,t)=>{No.init(e,t),U.init(e,t)});var Dc=m("ZodULID",(e,t)=>{To.init(e,t),U.init(e,t)});var Lc=m("ZodXID",(e,t)=>{Io.init(e,t),U.init(e,t)});var Uc=m("ZodKSUID",(e,t)=>{jo.init(e,t),U.init(e,t)});var Mc=m("ZodIPv4",(e,t)=>{Mo.init(e,t),U.init(e,t)});var Vc=m("ZodIPv6",(e,t)=>{Vo.init(e,t),U.init(e,t)});var vc=m("ZodCIDRv4",(e,t)=>{vo.init(e,t),U.init(e,t)});var qc=m("ZodCIDRv6",(e,t)=>{qo.init(e,t),U.init(e,t)});var Jc=m("ZodBase64",(e,t)=>{Bo.init(e,t),U.init(e,t)});var Bc=m("ZodBase64URL",(e,t)=>{Ho.init(e,t),U.init(e,t)});var Hc=m("ZodE164",(e,t)=>{Go.init(e,t),U.init(e,t)});var Gc=m("ZodJWT",(e,t)=>{Wo.init(e,t),U.init(e,t)});var Qi=m("ZodNumber",(e,t)=>{Gt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>ai(e,n,o,s),Be(e,"ZodNumber",{gt(n,o){return this.check(lt(n,o))},gte(n,o){return this.check(qe(n,o))},min(n,o){return this.check(qe(n,o))},lt(n,o){return this.check(pt(n,o))},lte(n,o){return this.check(ve(n,o))},max(n,o){return this.check(ve(n,o))},int(n){return this.check(Hi(n))},safe(n){return this.check(Hi(n))},positive(n){return this.check(lt(0,n))},nonnegative(n){return this.check(qe(0,n))},negative(n){return this.check(pt(0,n))},nonpositive(n){return this.check(ve(0,n))},multipleOf(n,o){return this.check(ft(n,o))},step(n,o){return this.check(ft(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function h(e){return Ws(Qi,e)}var Wc=m("ZodNumberFormat",(e,t)=>{Ko.init(e,t),Qi.init(e,t)});function Hi(e){return Ks(Wc,e)}var Kc=m("ZodBoolean",(e,t)=>{Yo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ui(e,r,n,o)});function N(e){return Ys(Kc,e)}var Yc=m("ZodNull",(e,t)=>{Qo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ci(e,r,n,o)});function Pe(e){return Qs(Yc,e)}var Qc=m("ZodUnknown",(e,t)=>{Xo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fi(e,r,n,o)});function Z(){return Xs(Qc)}var Xc=m("ZodNever",(e,t)=>{es.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>li(e,r,n,o)});function S(e){return ei(Xc,e)}var ep=m("ZodVoid",(e,t)=>{ts.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pi(e,r,n,o)});function hr(e){return ti(ep,e)}var tp=m("ZodArray",(e,t)=>{rs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_i(e,r,n,o),e.element=t.element,Be(e,"ZodArray",{min(r,n){return this.check(Ee(r,n))},nonempty(r){return this.check(Ee(1,r))},max(r,n){return this.check(dt(r,n))},length(r,n){return this.check(mt(r,n))},unwrap(){return this.element}})});function T(e,t){return ri(tp,e,t)}var rp=m("ZodObject",(e,t)=>{ss.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xi(e,r,n,o),P(e,"shape",()=>t.shape),Be(e,"ZodObject",{keyof(){return b(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Z()})},loose(){return this.clone({...this._zod.def,catchall:Z()})},strict(){return this.clone({...this._zod.def,catchall:S()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return oc(this,r)},safeExtend(r){return sc(this,r)},merge(r){return ic(this,r)},pick(r){return rc(this,r)},omit(r){return nc(this,r)},partial(...r){return ac(ra,this,r[0])},required(...r){return uc(na,this,r[0])}})});function d(e,t){let r={type:"object",shape:e??{},...w(t)};return new rp(r)}var Xi=m("ZodUnion",(e,t)=>{Wt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yi(e,r,n,o),e.options=t.options});function f(e,t){return new Xi({type:"union",options:e,...w(t)})}var np=m("ZodDiscriminatedUnion",(e,t)=>{Xi.init(e,t),is.init(e,t)});function ea(e,t,r){return new np({type:"union",options:t,discriminator:e,...w(r)})}var op=m("ZodIntersection",(e,t)=>{as.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bi(e,r,n,o)});function sp(e,t){return new op({type:"intersection",left:e,right:t})}var Gi=m("ZodRecord",(e,t)=>{us.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$i(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Re(e,t,r){if(!t||!t._zod)return new Gi({type:"record",keyType:c(),valueType:e,...w(t)});return new Gi({type:"record",keyType:e,valueType:t,...w(r)})}var mr=m("ZodEnum",(e,t)=>{cs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>di(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new mr({...t,checks:[],...w(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new mr({...t,checks:[],...w(o),entries:s})}});function b(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new mr({type:"enum",entries:r,...w(t)})}var ip=m("ZodLiteral",(e,t)=>{ps.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mi(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function O(e,t){return new ip({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var ap=m("ZodTransform",(e,t)=>{ls.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gi(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Fe(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(ge(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ge(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r.fallback=!0,r));return r.value=o,r.fallback=!0,r}});function ta(e){return new ap({type:"transform",transform:e})}var ra=m("ZodOptional",(e,t)=>{Kt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function a(e){return new ra({type:"optional",innerType:e})}var up=m("ZodExactOptional",(e,t)=>{fs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cp(e){return new up({type:"optional",innerType:e})}var pp=m("ZodNullable",(e,t)=>{ds.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ai(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wi(e){return new pp({type:"nullable",innerType:e})}var lp=m("ZodDefault",(e,t)=>{ms.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fp(e,t){return new lp({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Lt(t)}})}var dp=m("ZodPrefault",(e,t)=>{hs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Si(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mp(e,t){return new dp({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Lt(t)}})}var na=m("ZodNonOptional",(e,t)=>{gs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hp(e,t){return new na({type:"nonoptional",innerType:e,...w(t)})}var gp=m("ZodCatch",(e,t)=>{_s.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ki(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _p(e,t){return new gp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var oa=m("ZodPipe",(e,t)=>{Yt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zi(e,r,n,o),e.in=t.in,e.out=t.out});function Ki(e,t){return new oa({type:"pipe",in:e,out:t})}var xp=m("ZodPreprocess",(e,t)=>{oa.init(e,t),xs.init(e,t)}),yp=m("ZodReadonly",(e,t)=>{ys.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bp(e){return new yp({type:"readonly",innerType:e})}var $p=m("ZodCustom",(e,t)=>{bs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hi(e,r,n,o)});function Ap(e,t={}){return ni($p,e,t)}function wp(e,t){return oi(e,t)}function g(e,t){return new xp({type:"pipe",in:ta(e),out:t})}var Ce={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var sa;(function(e){})(sa||(sa={}));var Vg=Z(),vg=Z(),qg=Z(),Jg=Z(),Bg=Z(),Hg=Z(),Gg=Z(),Wg=Z(),Kg=Z(),Yg=Z(),Qg=Z(),Xg=Z(),e_=Z(),t_=Z(),r_=Z(),n_=Z(),o_=Z(),s_=Z(),i_=Z(),Sp=d({color:a(c()),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var kp=d({family:a(c()),color:a(c()),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(c()),strokeWidth:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Zp=d({top:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Op=d({type:b(["caption"]),src:c().min(1).regex(/\S/),font:a(kp),background:a(Sp),margin:a(Zp),trim:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),speed:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ep=d({color:f([c().regex(/^#[0-9a-fA-F]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),threshold:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(0).lte(250)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),halo:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(0).lte(250)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var _t=d({top:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),bottom:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Pp=d({host:c(),cpCode:c(),path:a(f([c(),Pe()])),filename:a(f([c(),Pe()]))}).strict(),Rp=d({provider:O("akamai-netstorage"),options:a(Pp)}).strict(),Cp=d({accountName:c(),container:c(),prefix:a(f([c(),Pe()])),filename:a(f([c(),Pe()]))}).strict(),Np=d({provider:O("azure-blob-storage"),options:a(Cp)}).strict(),Tp=d({bucket:c(),prefix:a(c()),filename:a(c())}).strict();var Ip=d({provider:O("google-cloud-storage"),options:a(Tp)}).strict();var jp=d({folderId:a(c()),filename:a(c())}).strict();var Fp=d({provider:O("google-drive"),options:a(jp)}).strict();var Dp=d({playbackPolicy:a(T(b(["public","signed"]))),passthrough:a(c().max(255))}).strict();var Lp=d({provider:O("mux"),options:a(Dp)}).strict();var Up=d({region:c(),bucket:c(),prefix:a(c()),filename:a(c()),acl:a(c())}).strict();var Mp=d({provider:O("s3"),options:a(Up)}).strict();var Vp=d({provider:O("shotstack"),exclude:a(N())}).strict();var vp=d({title:a(c().max(150)),privacyLevel:a(b(["public","friends","private"])),disableDuet:a(N()).default(!1),disableStitch:a(N()).default(!1),disableComment:a(N()).default(!1)}).strict(),qp=d({provider:O("tiktok"),options:a(vp)}).strict(),Jp=d({view:a(b(["anybody","nobody","contacts","password","unlisted"])),embed:a(b(["public","private","whitelist"])),comments:a(b(["anybody","nobody","contacts"])),download:a(N()),add:a(N())}).strict();var Bp=d({name:a(c()),description:a(c()),privacy:a(Jp),folderUri:a(c())}).strict();var Hp=d({provider:O("vimeo"),options:a(Bp)}).strict();var gr=ea("provider",[Vp,Lp,Mp,Ip,Fp,Hp,qp,Rp,Np]);var Gp=d({horizontal:a(N()),vertical:a(N())}).strict();var Wp=d({src:c()}).strict();var Kp=d({type:b(["image","video","audio"]),prompt:c().min(1).max(4000).regex(/\S/),model:a(c()),options:a(Re(c(),Z()))}).strict();var Yp=d({model:c(),type:b(["image","video","audio"]),name:a(c()),description:a(c()),options:a(Re(c(),Z())),available:a(N()),unavailableReason:a(b(["AiCapabilityNotIncluded","AiDisabled","AiAccessUnavailable"]))}).strict();var ia=d({asset:Kp,length:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gt(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Qp=d({type:b(["html5"]),html:c().max(1e6),css:a(c().max(500000)),js:a(c().max(500000))}).strict();var Xp=d({type:b(["html"]),html:c(),css:a(c()),width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(c()),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"]))}).strict();var el=d({type:b(["image"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Re(c(),Z())),crop:a(_t)}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ce.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var tl=d({type:b(["image-to-video"]),src:c().min(1),prompt:a(c()),aspectRatio:a(b(["1:1","4:3","16:9","9:16","3:4","21:9","9:21"])),speed:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(_t)}).strict();var rl=d({preset:b(["conference","interview","lecture","meeting","mobile_phone","music","podcast","studio","voice_over"])}).strict();var nl=d({provider:c().default("dolby"),options:rl}).strict();var ol=d({enhancement:O("dolbyEnhancement_DolbyEnhancement")}).strict().and(nl);var sl=d({audio:a(ol)}).strict();var il=d({status:c(),title:c(),detail:c()}).strict();var a_=d({errors:T(il)}).strict();var al=d({type:c(),id:c()}).strict();var u_=d({data:al}).strict();var ul=d({id:c(),url:c(),expires:c()}).strict();var cl=d({type:c(),id:c(),attributes:ul}).strict();var c_=d({data:cl}).strict();var pl=d({speed:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),preservePitch:a(N())}).strict();var ll=d({format:a(b(["srt","vtt"]))}).strict();var fl=d({type:b(["luma"]),src:c().min(1).regex(/\S/),trim:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var aa=d({find:c(),replace:Z()}).strict();var dl=d({capture:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var ml=d({start:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var hl=d({id:c(),owner:c(),region:a(c()),renderId:a(c()),providerId:a(c()),filename:a(c()),url:a(c()),status:b(["importing","ready","failed","deleted"]),created:a(c()),updated:a(c())}).strict();var ua=d({type:c(),attributes:hl}).strict();var p_=d({data:T(ua)}).strict();var l_=d({data:ua}).strict();var f_=d({error:c(),code:a(c()),available:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var d_=d({error:d({name:b(["UnknownGenerationModel","WithdrawnGenerationModel"]),message:c()})}).strict();var m_=d({models:T(Yp)}).strict();var h_=d({credits:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),ceiling:N()}).strict();var g_=d({id:c(),status:b(["queued","processing","done","failed"]),url:a(c()),error:a(c())}).strict();var __=d({success:N(),message:c(),response:Re(c(),Z())}).strict();var gl=d({message:c(),id:c()}).strict();var x_=d({success:N(),message:c(),response:gl}).strict();var _l=d({id:c(),name:c(),created:a(c()),updated:a(c())}).strict();var xl=d({owner:c(),templates:T(_l)}).strict();var y_=d({success:N(),message:c(),response:xl}).strict();var yl=d({message:c(),id:c()}).strict();var b_=d({success:N(),message:c(),response:yl}).strict();var bl=d({family:a(c()),weight:a(Z()).default("400"),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),size:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"]))}).strict();var $l=d({style:b(["karaoke","highlight","pop","fade","slide","bounce","typewriter","none"]),direction:a(b(["left","right","up","down"]))}).strict();var Al=d({family:a(c()).default("Roboto"),size:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(b(["normal","italic"])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffffff"),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ca=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","middle","bottom"]))}).strict();var wl=d({preset:b(["fadeIn","slideIn","typewriter","ascend","shift","movingLetters"]),duration:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0.1).lte(30)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),style:a(b(["character","word"])),direction:a(b(["left","right","up","down"]))}).strict();var pa=d({color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),borderRadius:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wrap:a(N()).default(!1),padding:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(0).lte(200)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var la=d({width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),radius:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var fa=d({type:a(b(["linear","radial"])),angle:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(360)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),stops:T(d({offset:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),color:f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})).min(2)}).strict();var zl=d({letterSpacing:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(b(["none","uppercase","lowercase","capitalize"])),size:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"])),gradient:a(fa)}).strict(),da=d({top:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),right:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),bottom:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),left:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var _r=d({offsetX:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),offsetY:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),blur:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5)}).strict();var xt=d({width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1)}).strict();var Sl=d({font:a(bl),stroke:a(f([xt,b(["none"])])),shadow:a(f([_r,b(["none"])]))}).strict();var kl=d({type:b(["rich-caption"]),src:c().min(1),font:a(Al),style:a(zl),stroke:a(xt),shadow:a(_r),background:a(pa),border:a(la),padding:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),active:a(Sl),animation:a($l)}).strict();var Zl=d({family:a(c()).default("Open Sans"),size:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(b(["normal","italic"])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(xt)}).strict();var Ol=d({letterSpacing:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wordSpacing:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(b(["none","uppercase","lowercase","capitalize"])),textDecoration:a(b(["none","underline","line-through"])),gradient:a(fa)}).strict();var El=d({type:b(["rich-text"]),text:c().max(5000),font:a(Zl),style:a(Ol),stroke:a(xt),shadow:a(_r),background:a(pa),border:a(la),padding:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),animation:a(wl)}).strict();var Pl=d({id:a(c()),owner:a(c()),status:a(b(["queued","failed"])),created:a(c())}).strict();var Rl=d({type:a(c()),attributes:a(Pl)}).strict();var $_=d({data:Rl}).strict();var Cl=d({url:c(),id:c(),destinations:T(gr)}).strict();var Nl=d({type:b(["shape"]),shape:b(["rectangle","circle","line"]),width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fill:a(d({color:a(c()),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),stroke:a(d({color:a(c()),width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),rectangle:a(d({width:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),height:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),cornerRadius:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),circle:a(d({radius:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})),line:a(d({length:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),thickness:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}))}).strict();var ma=d({width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(1).lte(4096)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(1).lte(4096)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var ha=d({format:a(b(["mp4","webm","mov","avi","mkv","ogv","wmv","avif","gif","mp3","wav","jpg","png","webp","tif"])),size:a(ma),fit:a(b(["cover","contain","crop"])),resolution:a(b(["preview","mobile","sd","hd","fhd"])),quality:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(1).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([O(12),O(15),O(23.976),O(24),O(25),O(29.97),O(30),O(48),O(50),O(59.94),O(60)])),speed:a(pl),keyframeInterval:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int().gte(1).lte(300)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fixOffset:a(N()),fixRotation:a(N()),enhance:a(sl),filename:a(c())}).strict();var Tl=d({renditions:a(T(ha)),transcription:a(ll)}).strict();var Il=d({id:c(),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),url:a(c()),executionTime:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),transformation:a(ha),width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var jl=d({renditions:a(T(Il))}).strict();var Fl=d({id:c(),owner:c(),input:a(c()),source:a(c()),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),outputs:a(jl),width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),created:a(c()),updated:a(c())}).strict();var ga=d({type:c(),id:c(),attributes:Fl}).strict();var A_=d({data:T(ga)}).strict();var w_=d({data:ga}).strict();var Dl=d({url:a(c()),outputs:a(Tl),destinations:a(gr),callback:a(c())}).strict();var Ll=d({src:c().min(1).regex(/\S/),effect:a(b(["fadeIn","fadeOut","fadeInFadeOut"])),volume:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ul=d({type:b(["svg"]),src:c().min(1).max(500000)}).strict();var Ml=d({id:c(),merge:a(T(aa))}).strict();var Vl=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","center","bottom"]))}).strict();var vl=d({preset:b(["typewriter"]),duration:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0.1).lte(30)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ql=d({color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),wrap:a(N())}).strict();var Jl=d({family:a(c()),color:a(c()),opacity:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),weight:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Bl=d({width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),Hl=d({type:b(["text"]),text:c(),width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),font:a(Jl),background:a(ql),alignment:a(Vl),stroke:a(Bl),animation:a(vl),ellipsis:a(c())}).strict().superRefine((e,t)=>{if(e.background&&e.background.wrap===!0)t.addIssue({code:Ce.custom,message:'background.wrap is only supported on rich-text and rich-caption assets. For type "text", migrate to type "rich-text" to use this feature.',path:["background","wrap"]})});var Gl=d({type:b(["text-to-image"]),prompt:c(),width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(_t)}).strict();var Wl=d({capture:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),scale:f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var Kl=d({format:b(["mp4","gif","mp3","jpg","png","bmp"]),resolution:a(b(["preview","mobile","sd","hd","1080","4k"])),aspectRatio:a(b(["16:9","9:16","1:1","4:5","4:3"])),size:a(ma),fps:a(f([O(12),O(15),O(23.976),O(24),O(25),O(29.97),O(30),O(48),O(50),O(59.94),O(60)])),scaleTo:a(b(["preview","mobile","sd","hd","1080","4k"])),quality:a(b(["verylow","low","medium","high","veryhigh"])),repeat:a(N()),mute:a(N()),range:a(ml),poster:a(dl),thumbnail:a(Wl),destinations:a(T(gr))}).strict().superRefine((e,t)=>{var r=e.format==="mp3";if(!r&&e.size!=null&&(e.size.width==null||e.size.height==null)){t.addIssue({code:Ce.custom,path:["size"],message:"size requires both width and height"});return}var n=typeof e.resolution==="string",o=e.size!=null&&e.size.width!=null&&e.size.height!=null;if(!r&&!n&&!o)t.addIssue({code:Ce.custom,message:'output requires either "resolution" or "size" (with width and height)'})});var Yl=d({in:a(b(["none","fade","fadeSlow","fadeFast","reveal","revealSlow","revealFast","wipeLeft","wipeLeftSlow","wipeLeftFast","wipeRight","wipeRightSlow","wipeRightFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast","carouselLeft","carouselLeftSlow","carouselLeftFast","carouselRight","carouselRightSlow","carouselRightFast","carouselUp","carouselUpSlow","carouselUpFast","carouselDown","carouselDownSlow","carouselDownFast","shuffleTopRight","shuffleTopRightSlow","shuffleTopRightFast","shuffleRightTop","shuffleRightTopSlow","shuffleRightTopFast","shuffleRightBottom","shuffleRightBottomSlow","shuffleRightBottomFast","shuffleBottomRight","shuffleBottomRightSlow","shuffleBottomRightFast","shuffleBottomLeft","shuffleBottomLeftSlow","shuffleBottomLeftFast","shuffleLeftBottom","shuffleLeftBottomSlow","shuffleLeftBottomFast","shuffleLeftTop","shuffleLeftTopSlow","shuffleLeftTopFast","shuffleTopLeft","shuffleTopLeftSlow","shuffleTopLeftFast","zoom"])),out:a(b(["none","fade","fadeSlow","fadeFast","reveal","revealSlow","revealFast","wipeLeft","wipeLeftSlow","wipeLeftFast","wipeRight","wipeRightSlow","wipeRightFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast","carouselLeft","carouselLeftSlow","carouselLeftFast","carouselRight","carouselRightSlow","carouselRightFast","carouselUp","carouselUpSlow","carouselUpFast","carouselDown","carouselDownSlow","carouselDownFast","shuffleTopRight","shuffleTopRightSlow","shuffleTopRightFast","shuffleRightTop","shuffleRightTopSlow","shuffleRightTopFast","shuffleRightBottom","shuffleRightBottomSlow","shuffleRightBottomFast","shuffleBottomRight","shuffleBottomRightSlow","shuffleBottomRightFast","shuffleBottomLeft","shuffleBottomLeftSlow","shuffleBottomLeftFast","shuffleLeftBottom","shuffleLeftBottomSlow","shuffleLeftBottomFast","shuffleLeftTop","shuffleLeftTopSlow","shuffleLeftTopFast","shuffleTopLeft","shuffleTopLeftSlow","shuffleTopLeftFast","zoom"]))}).strict();var re=d({from:a(Z()),to:a(Z()),start:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),interpolation:a(b(["linear","bezier","constant"])),easing:a(b(["ease","easeIn","easeOut","easeInOut","easeInQuad","easeInCubic","easeInQuart","easeInQuint","easeInSine","easeInExpo","easeInCirc","easeInBack","easeOutQuad","easeOutCubic","easeOutQuart","easeOutQuint","easeOutSine","easeOutExpo","easeOutCirc","easeOutBack","easeInOutQuad","easeInOutCubic","easeInOutQuart","easeInOutQuint","easeInOutSine","easeInOutExpo","easeInOutCirc","easeInOutBack"]))}).strict();var Ql=d({type:b(["audio"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Re(c(),Z())),trim:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),speed:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ce.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var _a=d({x:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(-10).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),y:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(-10).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)]))}).strict();var Xl=d({angle:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(-360).lte(360)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)]))}).strict();var ef=d({x:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(-100).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),y:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(-100).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)]))}).strict();var tf=d({type:b(["text-to-speech"]),text:c(),voice:c(),language:a(c()),newscaster:a(N()).default(!1),trim:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),speed:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict();var rf=d({type:b(["title"]),text:c(),style:a(b(["minimal","blockbuster","vogue","sketchy","skinny","chunk","chunkLight","marker","future","subtitle"])),color:a(c()),size:a(b(["xx-small","x-small","small","medium","large","x-large","xx-large"])),background:a(c()),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(_a)}).strict();var nf=d({rotate:a(Xl),skew:a(ef),flip:a(Gp)}).strict();var of=d({type:b(["video"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Re(c(),Z())),transcode:a(N()),trim:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),volumeEffect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"])),speed:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),crop:a(_t),chromaKey:a(Ep)}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ce.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var sf=ea("type",[of,el,Hl,El,Ql,fl,Op,kl,Xp,Qp,rf,Nl,Ul,Gl,tl,tf]);var af=d({id:a(c()),asset:sf,start:f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([c().regex(/^(auto|alias:\/\/[A-Za-z0-9_-]+)$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),length:f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([c().regex(/^(auto|end|alias:\/\/[A-Za-z0-9_-]+)$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),fit:a(b(["cover","contain","crop","none"])),scale:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),width:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(1).lte(3840)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h().gte(1).lte(2160)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(_a),transition:a(Yl),effect:a(b(["zoomIn","zoomInSlow","zoomInFast","zoomOut","zoomOutSlow","zoomOutFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast"])),filter:a(b(["none","blur","boost","contrast","darken","greyscale","lighten","muted","negative"])),opacity:a(f([f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),transform:a(nf),alias:a(f([c().regex(/^[A-Za-z0-9_-]+$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var uf=af.transform((e)=>{if(e.asset&&typeof e.asset==="object"&&"type"in e.asset){if(e.asset.type==="rich-text"){let{fit:r,...n}=e;return n}}return e}),cf=d({clips:T(uf).min(1)}).strict();var pf=d({soundtrack:a(Ll),background:a(c()),fonts:a(T(Wp)),tracks:T(cf).min(1),cache:a(N())}).strict();var He=d({timeline:pf,output:Kl,merge:a(T(aa)),callback:a(c()),disk:a(b(["local","mount"])),instance:a(b(["s1","s2","a1"]))}).strict(),xa=He,lf=d({id:c(),owner:c(),plan:a(c()),status:b(["queued","fetching","preprocessing","rendering","generating","saving","done","failed"]),error:a(c()),duration:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),renderTime:a(f([g((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),url:a(c()),poster:a(f([c(),Pe()])),thumbnail:a(f([c(),Pe()])),data:a(He),created:a(c()),updated:a(c())}).strict();var z_=d({success:N(),message:c(),response:lf}).strict();var ff=d({id:c(),name:c(),owner:c(),template:He}).strict();var S_=d({success:N(),message:c(),response:ff}).strict();var ya=d({name:c(),template:a(He)}).strict();var k_=d({body:He,path:a(S()),query:a(S())}).strict();var Z_=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(d({data:a(N()),merged:a(N())}))}).strict();var O_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var E_=d({body:ya,path:a(S()),query:a(S())}).strict();var P_=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),R_=hr(),C_=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var N_=d({body:ya,path:d({id:f([c().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var T_=d({body:Ml,path:a(S()),query:a(S())}).strict();var I_=d({body:a(S()),path:d({url:c()}),query:a(S())}).strict();var j_=d({body:ia,path:a(S()),query:a(S()),headers:a(d({"Idempotency-Key":a(c())}))}).strict();var F_=d({body:ia,path:a(S()),query:a(S())}).strict();var D_=d({body:a(S()),path:d({id:c()}),query:a(S())}).strict();var L_=d({body:a(S()),path:a(S()),query:a(d({expand:a(b(["options"]))}))}).strict();var U_=d({body:a(S()),path:d({id:c()}),query:a(S())}).strict();var M_=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),V_=hr(),v_=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var q_=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var J_=d({body:Cl,path:a(S()),query:a(S())}).strict();var B_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var H_=d({body:Dl,path:a(S()),query:a(S())}).strict();var G_=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),W_=hr(),K_=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var Y_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var df={alignment:"align",duration:"length",transitions:"transition",name:"family"},ba={"align.vertical":{center:"middle"},fit:{cover:"crop"}},mf=new Set(["arapey","clear sans","clearsans","didact gothic","didactgothic","montserrat","movlette","notoemoji","open sans","opensans","permanent marker","permanentmarker","roboto","sue ellen francisco","sueellenfrancisco","uni neue","unineue","work sans","worksans"]),hf=/-(?:(?:Extra(?:Light|Bold)|SemiBold|Regular|Medium|Light|Black|Bold|Thin|Heavy)(?:Italic|Oblique)?|(?:Italic|Oblique))$/i,gf=new Set(["image","video","audio","luma"]);function Ne(e){let t=[],r=xa.safeParse(e);if(!r.success)for(let o of Af(r.error))t.push({...o,level:"error"});for(let o of _f(e))t.push(o);return{ok:!t.some((o)=>(o.level??"error")==="error"),issues:t}}function xe(e){let t=e.filter((o)=>(o.level??"error")==="error"),r=e.filter((o)=>o.level==="warning"),n=[];if(t.length){let o=r.length?`, ${r.length} warning${xr(r.length)}`:"";n.push(`✗ Edit JSON failed validation (${t.length} error${xr(t.length)}${o}):`)}else n.push(`⚠ Edit JSON valid, with ${r.length} warning${xr(r.length)}:`);for(let o of e){let s=(o.level??"error")==="error"?"✗":"⚠",i=o.suggestion?` (did you mean '${o.suggestion}'?)`:"";n.push(` ${s} ${o.path||"<root>"}: ${o.message}${i}`)}return n.join(`
89
- `)}function xr(e){return e===1?"":"s"}function _f(e){let t=[],n=e?.timeline,o=n?.tracks;if(!Array.isArray(o))return t;let s=[];if(Array.isArray(n?.fonts))for(let i of n.fonts){let u=yf(i?.src);if(u)s.push(u)}return o.forEach((i,u)=>{let p=i?.clips;if(!Array.isArray(p))return;let l=p.map((_,y)=>({ci:y,start:_?.start,len:_?.length})).filter((_)=>typeof _.start==="number"&&typeof _.len==="number");for(let _=0;_<l.length;_++)for(let y=_+1;y<l.length;y++){let A=l[_],x=l[y];if(A.start<x.start+x.len&&x.start<A.start+A.len){let[z,M]=A.ci<x.ci?[A.ci,x.ci]:[x.ci,A.ci];t.push({path:`timeline.tracks[${u}].clips`,code:"clip_overlap",level:"error",message:`clips [${z}] and [${M}] overlap in time — clips on one track must not `+"overlap (they flicker). Put simultaneous elements on separate tracks."})}}p.forEach((_,y)=>{let A=_?.asset,x=`timeline.tracks[${u}].clips[${y}]`,z=A?.font?.family;if(typeof z==="string"&&z.length>0){let se=xf(z,s,`${x}.asset.font.family`);if(se)t.push(se)}let M=A?.type;if(M==="html5"&&typeof A?.js==="string"&&A.js.length>0){let se=bf(A.js,`${x}.asset.js`);if(se)t.push(se)}let C=A?.src;if(typeof M==="string"&&gf.has(M)&&typeof C==="string")if(/^https:\/\//i.test(C)||/^alias:\/\//i.test(C));else if(/^data:/i.test(C))t.push({path:`${x}.asset.src`,code:"src_not_public",level:"warning",message:"data: URIs aren't fetched by render workers — host the asset and use a public https:// URL."});else if(/^http:\/\//i.test(C))t.push({path:`${x}.asset.src`,code:"src_not_https",level:"warning",message:"http:// sources are blocked/upgraded — use https://."});else t.push({path:`${x}.asset.src`,code:"src_not_public",level:"warning",message:`'${$f(C,48)}' is not a public https:// URL — local paths don't render. `+"Host it with 'shotstack ingest upload' and use the returned URL."})})}),t}function xf(e,t,r){let n=e.toLowerCase();if(mf.has(n))return null;if(t.some((s)=>n===s.full.toLowerCase()||n===s.base.toLowerCase()))return null;let o="the exact family name stored in the font file, which can differ from the name on Google Fonts (Space Grotesk's file says 'Space Grotesk Light')";if(t.length===0)return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' is neither a built-in font nor loaded via timeline.fonts[] — `+"it renders in Roboto. Add the font's URL to timeline.fonts[] and use its filename as font.family."};if(t.length===1)return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' doesn't match the timeline.fonts[] filename. It renders in that font only because it's the sole entry; add another font and it falls back to Roboto unless it's ${o}. Use the filename to be sure.`,suggestion:t[0].full};return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' doesn't match any timeline.fonts[] filename (${t.map((s)=>`'${s.full}'`).join(", ")}). It renders in Roboto unless it's ${o}. Use the filename to be sure.`}}function yf(e){if(typeof e!=="string")return null;let t=e.split(/[?#]/,1)[0].split("/").pop()??"";try{t=decodeURIComponent(t)}catch{}let r=t.replace(/\.(ttf|otf|woff2?|eot)$/i,"");return r.length?{full:r,base:r.replace(hf,"")}:null}function bf(e,t){try{Function(e)}catch(r){let n=r instanceof Error?r.message:String(r);return{path:t,code:"js_syntax_error",level:"error",message:`asset.js has a syntax error — the html5 clip will render completely blank with no render error. ${n}`}}return null}function $f(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function Af(e){return e.issues.flatMap((t)=>wf(t))}function wf(e){let t=Sf(e.path);if(e.code==="unrecognized_keys"&&"keys"in e)return e.keys.map((n)=>({path:kf(t,n),code:e.code,message:`unrecognized key '${n}'`,suggestion:df[n]}));let r=zf(t,e);return[{path:t,code:e.code,message:e.message,...r?{suggestion:r}:{}}]}function zf(e,t){let r=e.replace(/\[\d+\]/g,""),n=r.split(".").slice(-2).join(".");if(t.code==="invalid_value"&&"received"in t){let o=String(t.received);return ba[n]?.[o]??ba[r]?.[o]}return}function Sf(e){return e.reduce((t,r)=>{if(typeof r==="number")return`${t}[${r}]`;let n=String(r);return t?`${t}.${n}`:n},"")}function kf(e,t){return e?`${e}.${t}`:t}var $a=new F("render").description("Submit a Shotstack Edit JSON to the render API").argument("<file>","Path to a Shotstack Edit JSON file").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--watch","After submitting, poll until the render reaches a terminal state").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("render",B("render"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=Of(process.cwd(),e),i=await Zf(s,"utf8"),u=JSON.parse(i),p=Ne(u);if(!p.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:p.issues}));else console.error(xe(p.issues));return{exitCode:1,validation:p}}if(p.issues.length>0&&r!=="json")console.error(xe(p.issues));let l=v({apiKey:o,env:n}),_=t.watch?2:1,y="";for(let A=1;A<=_;A++){let x=await l.post("/render",u),z=x.response.id;if(y=z,!t.watch)return E(r,{id:z},z),{renderId:z,response:x.response};let M=await It(l,z,r,!0);if(M.status!=="failed")return{renderId:z,response:M,exitCode:0};let C=Pf(M.error);if(C&&A<_){if(r!=="json")console.error(`⚠ render failed (${M.error??"unknown"}) — looks transient, resubmitting ${A+1}/${_}…`);await Rf(2000);continue}if(r!=="json")console.error(C?`✗ render still failing after ${_} attempts. For a complex multi-scene edit, preview it client-side first: shotstack studio ${e}`:`✗ render failed: ${M.error??"unknown error"}`);return{renderId:z,response:M,exitCode:1}}return{renderId:y,exitCode:1}})}),Ef=/temporar|try again|time ?d? ?out|timeout|too many requests|service unavailable|unavailable|throttl/i;function Pf(e){return typeof e==="string"&&Ef.test(e)}function Rf(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as Cf,writeFile as Nf,mkdtemp as Tf}from"node:fs/promises";import{tmpdir as If}from"node:os";import{join as Aa}from"node:path";import{spawn as jf}from"node:child_process";var wa="https://github.com/shotstack/shotstack-cli/issues/new?template=bug.yml",Ff=6000,Za=5,Oa=new F("feedback").description("Open a pre-filled GitHub issue with a flight-recorder dossier from your last 5 invocations").action(async()=>{let e=await Df(Za),t=Lf(e),r=Mf(e),n=`&title=${encodeURIComponent(r)}`,o=`${wa}${n}&body=${encodeURIComponent(t)}`;if(o.length<=Ff){ka(o),console.log("Opened browser with pre-filled issue. Review before submitting.");return}let s=await Tf(Aa(If(),"shotstack-feedback-")),i=Aa(s,"dossier.md");await Nf(i,t),ka(`${wa}${n}`),console.log(`Dossier too large to inline. Saved to: ${i}`),console.log("Drag the file into the issue body, or paste its contents.")});async function Df(e){let t=Ye(),r;try{r=await Cf(t,"utf8")}catch{return[]}let o=r.split(`
90
- `).filter((i)=>i.trim().length>0).slice(-e).reverse(),s=[];for(let i of o)try{s.push(JSON.parse(i))}catch{}return s}function Lf(e){let t=[];if(t.push("## Environment"),t.push(`- Shotstack CLI: ${je}`),t.push(`- OS: ${process.platform}-${process.arch}`),t.push(""),t.push(`## Last ${Za} invocations (most recent first)`),t.push(""),e.length===0)t.push("_No recorded invocations._");else for(let r of e){let n=(r.args??[]).join(" "),o=`### ${r.ts} — shotstack ${r.cmd}${n?" "+n:""}`;if(t.push(o),t.push(`- Exit: ${r.exit} Duration: ${r.durationMs}ms`),r.renderId)t.push(`- Render ID: ${r.renderId}`);if(r.response!==void 0){let s=typeof r.response==="string"?r.response:JSON.stringify(r.response);t.push(`- Response: ${s}`)}if(r.error)t.push(`- Error: ${r.error.name}: ${r.error.message}`);t.push("")}return t.push(`[full log at ${Ye()}]`),t.push(""),t.push("## What I expected vs what happened"),t.push("<!-- Describe the issue, request, or question here. -->"),t.join(`
91
- `)}var za=80,Uf="Feedback from shotstack CLI";function Mf(e){let t=e.find((o)=>o.error);if(t&&t.error)return yr(`${t.cmd}: ${t.error.name} — ${t.error.message}`);let r=e.find((o)=>Sa(o.response)!==null);if(r){let o=Sa(r.response);return yr(`Render failed: ${o}`)}let n=e.find((o)=>o.exit!==0);if(n)return yr(`${n.cmd} exited ${n.exit}`);return Uf}function Sa(e){if(!e||typeof e!=="object"||Array.isArray(e))return null;let t=e;if(t.state!=="failed")return null;return typeof t.error==="string"&&t.error.length>0?t.error:"unknown error"}function yr(e){return e.length<=za?e:e.slice(0,za-1)+"…"}function ka(e){let t=process.platform==="win32",r=process.platform==="darwin"?"open":t?"cmd":"xdg-open",o=jf(r,t?["/c","start","",e]:[e],{stdio:"ignore",detached:!0});o.on("error",()=>{console.error(`Could not open browser. Visit: ${e}`)}),o.unref()}import{readFile as Vf}from"node:fs/promises";import{resolve as vf}from"node:path";import{spawn as Ea,execSync as qf}from"node:child_process";var Pa="https://shotstack.studio",Jf=`${Pa}/api/share`,Bf=3000,Hf=6000,Ra=new F("studio").description("Open the Edit JSON in the shotstack.studio web editor. By default, posts the JSON to the share API and returns a short URL.").argument("<file>","Path to a Shotstack Edit JSON file").option("--copy","Copy the URL to the clipboard").option("--no-open","Do not try to open the URL in a browser").option("--no-shorten","Skip the share API; emit a base64url URL inline").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{let r=R(t.output),n=vf(process.cwd(),e),o=await Vf(n,"utf8"),s=JSON.parse(o),i=Ne(s);if(!i.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:i.issues}));else console.error(xe(i.issues));process.exit(1)}let{url:u,shortened:p}=await Gf(s,{shorten:t.shorten});if(!p&&u.length>Hf)console.error(`warning: encoded URL is ${u.length} characters; large templates may exceed browser URL limits.`);if(t.copy)await Yf(u);let l=t.open&&td()&&Xf(u);if(r==="json"||!l)E(r,{url:u,shortened:p},u)});async function Gf(e,t={}){if(t.shorten!==!1){let n=await Kf(e);if(n)return{url:n,shortened:!0};console.error("warning: could not reach the shotstack.studio share API; falling back to inline URL.")}return{url:Wf(e),shortened:!1}}function Wf(e){let t=Buffer.from(JSON.stringify(e),"utf8").toString("base64url");return`${Pa}/#json=${t}`}async function Kf(e){try{let t=await fetch(Jf,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(Bf)});if(!t.ok)return null;return(await t.json()).url??null}catch{return null}}async function Yf(e){let{cmd:t,args:r}=Qf();await new Promise((n,o)=>{let s=Ea(t,r,{stdio:["pipe","ignore","ignore"]});s.on("error",o),s.on("exit",(i)=>i===0?n():o(Error(`${t} exited ${i}`))),s.stdin.end(e)})}function Qf(){if(process.platform==="darwin")return{cmd:"pbcopy",args:[]};if(process.platform==="win32")return{cmd:"clip",args:[]};return{cmd:"xclip",args:["-selection","clipboard"]}}function Xf(e){let{cmd:t,args:r}=ed(e);try{let n=Ea(t,r,{detached:!0,stdio:"ignore"});return n.on("error",()=>{}),n.unref(),!0}catch{return!1}}function ed(e){if(process.platform==="win32")return{cmd:"cmd",args:["/c","start","",e]};if(process.platform==="darwin")return{cmd:"open",args:[e]};return{cmd:"xdg-open",args:[e]}}function td(){if(process.platform==="darwin"||process.platform==="win32")return!0;if(!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY)return!1;try{return qf("command -v xdg-open",{stdio:"ignore"}),!0}catch{return!1}}import{readFile as rd}from"node:fs/promises";import{resolve as nd,extname as od}from"node:path";var sd=3000,id=new Set(["ready","failed","deleted","overwritten"]),ye=new F("ingest").description("Ingest source media via the Shotstack Ingest API: upload local files, fetch remote URLs, and manage stored sources");ye.command("upload <file>").description("Upload a local file and host it on Shotstack for use as an Edit asset src").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--watch","Poll until the source is ready, then print its hosted URL").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest upload",B("upload"),async()=>{let r=R(t.output),n=q(t.env,"ingest"),o=G(n.name),s=v({apiKey:o,env:n}),i=await rd(nd(process.cwd(),e)),u=await s.post("/upload"),{id:p,url:l}=u.data.attributes;return await ad(l,i,cd(e)),Ca(s,p,r,t.watch===!0)})});ye.command("fetch <url>").description("Ingest a remote URL into Shotstack-hosted storage").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--watch","Poll until the source is ready, then print its hosted URL").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest fetch",B("fetch"),async()=>{let r=R(t.output),n=q(t.env,"ingest"),o=G(n.name),s=v({apiKey:o,env:n}),i=await s.post("/sources",{url:e});return Ca(s,i.data.id,r,t.watch===!0)})});ye.command("status <id>").description("Poll the status of an ingested source").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--watch","Poll continuously until the source reaches a terminal state").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest status",B("status"),async()=>{let r=R(t.output),n=q(t.env,"ingest"),o=G(n.name),s=v({apiKey:o,env:n}),i=await Na(s,e,r,t.watch===!0);return{renderId:i.id,response:yt(i),exitCode:i.status==="failed"?1:0}})});ye.command("list").description("List ingested sources").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await J("ingest list",B("list"),async()=>{let t=R(e.output),r=q(e.env,"ingest"),n=G(r.name),i=(await v({apiKey:n,env:r}).get("/sources")).data.map((p)=>yt(p.attributes)),u=i.length?i.map((p)=>[p.id,p.status,p.source??""].join(" ").trimEnd()).join(`
92
- `):"No sources.";return E(t,i,u),{response:{count:i.length}}})});ye.command("delete <id>").description("Delete an ingested source").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest delete",B("delete"),async()=>{let r=R(t.output),n=q(t.env,"ingest"),o=G(n.name);return await v({apiKey:o,env:n}).del(`/sources/${encodeURIComponent(e)}`),E(r,{id:e,deleted:!0},`deleted ${e}`),{renderId:e,response:{id:e,deleted:!0}}})});async function Ca(e,t,r,n){if(!n)return E(r,{id:t},t),{renderId:t,response:{id:t}};let o=await Na(e,t,r,!0);return{renderId:t,response:yt(o),exitCode:o.status==="failed"?1:0}}async function Na(e,t,r,n,o=sd){while(!0){let i=(await e.get(`/sources/${encodeURIComponent(t)}`)).data.attributes;if(E(r,yt(i),pd(i)),!n||id.has(i.status))return i;await ld(o)}}async function ad(e,t,r){let n=await fetch(e,{method:"PUT",headers:r?{"content-type":r}:void 0,body:t});if(!n.ok){let o=await n.text().catch(()=>"");throw new ie(n.status,o||void 0,`PUT upload → ${n.status} ${n.statusText}`)}}var ud={".mp4":"video/mp4",".webm":"video/webm",".mov":"video/quicktime",".avi":"video/x-msvideo",".mkv":"video/x-matroska",".ogv":"video/ogg",".wmv":"video/x-ms-wmv",".gif":"image/gif",".mp3":"audio/mpeg",".wav":"audio/wav",".m4a":"audio/mp4",".aac":"audio/aac",".ogg":"audio/ogg",".flac":"audio/flac",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp",".avif":"image/avif",".tif":"image/tiff",".tiff":"image/tiff",".svg":"image/svg+xml",".srt":"application/x-subrip",".vtt":"text/vtt",".ttf":"font/ttf",".otf":"font/otf",".woff":"font/woff",".woff2":"font/woff2"};function cd(e){return ud[od(e).toLowerCase()]}function yt(e){let t={id:e.id,status:e.status};if(e.source)t.source=e.source;if(e.input)t.input=e.input;if(e.width)t.width=e.width;if(e.height)t.height=e.height;if(e.duration)t.duration=e.duration;if(e.error)t.error=e.error;return t}function pd(e){let t=[e.status];if(e.source)t.push(e.source);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function ld(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as fd}from"node:fs/promises";import{resolve as dd}from"node:path";async function md(e,t){return(await e.get(`/templates/${encodeURIComponent(t)}`)).response}async function hd(e){return(await e.get("/templates")).response.templates}async function gd(e,t,r){return(await e.post("/templates",{name:t,template:r})).response.id}async function _d(e,t,r,n){let o={template:r};if(n)o.name=n;await e.put(`/templates/${encodeURIComponent(t)}`,o)}async function xd(e,t){await e.del(`/templates/${encodeURIComponent(t)}`)}async function Ta(e){let t=await fd(dd(process.cwd(),e),"utf8");return JSON.parse(t)}var be=new F("template").description("Work with saved Shotstack templates");be.command("get <id>").description("Fetch a saved template's Edit JSON by id — pipe it to a file or `shotstack render`").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template get",B("get"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n}),i=await md(s,e);return E(r,i.template,JSON.stringify(i.template,null,2)),{templateId:i.id,exitCode:0}})});be.command("list").description("List your saved templates (id and name), newest first").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await J("template list",B("list"),async()=>{let t=R(e.output),r=q(e.env),n=G(r.name),o=v({apiKey:n,env:r}),s=await hd(o),i=s.length?s.map((u)=>`${u.id} ${u.name??""}`.trimEnd()).join(`
93
- `):"No templates found";return E(t,s,i),{count:s.length,exitCode:0}})});be.command("create <file>").description("Save an Edit JSON file as a new template; prints the new template id").requiredOption("--name <name>","Name for the saved template").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template create",B("create"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n}),i=await Ta(e),u=await gd(s,t.name,i);return E(r,{id:u},u),{templateId:u,exitCode:0}})});be.command("update <id> <file>").description("Overwrite a saved template with an Edit JSON file").option("--name <name>","Also rename the template").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await J("template update",B("update"),async()=>{let n=R(r.output),o=q(r.env),s=G(o.name),i=v({apiKey:s,env:o}),u=await Ta(t);return await _d(i,e,u,r.name),E(n,{id:e,status:"updated"},`updated ${e}`),{templateId:e,exitCode:0}})});be.command("delete <id>").description("Delete a saved template").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template delete",B("delete"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n});return await xd(s,e),E(r,{id:e,status:"deleted"},`deleted ${e}`),{templateId:e,exitCode:0}})});import{readFile as yd}from"node:fs/promises";import{resolve as bd}from"node:path";var Ia=new F("validate").description("Validate an Edit JSON offline — schema (property names, enums, types) plus "+"same-track overlaps, unloaded fonts, non-public asset URLs and html5 JS syntax errors. No API key, no credits.").argument("<file>","Path to a Shotstack Edit JSON file").option("--strict","Treat warnings as errors (exit 1 on any warning)").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{let r=R(t.output),n=bd(process.cwd(),e),o=await yd(n,"utf8"),s;try{s=JSON.parse(o)}catch(l){let _=l instanceof Error?l.message:String(l),y={path:"<root>",code:"invalid_json",level:"error",message:_};if(r==="json")console.log(JSON.stringify({ok:!1,issues:[y]}));else console.error(`✗ ${e}: invalid JSON — ${_}`);process.exitCode=1;return}let i=Ne(s),u=i.issues.some((l)=>l.level==="warning"),p=!i.ok||t.strict===!0&&u;if(r==="json")console.log(JSON.stringify({ok:!p,issues:i.issues}));else if(i.issues.length===0)console.log(`✓ ${e} is valid`);else{let l=xe(i.issues);if(p)console.error(l);else console.log(l)}process.exitCode=p?1:0});async function $d(e){return(await e.get("/models")).models}async function bt(e,t){return e.get(`/models/${encodeURIComponent(t)}`)}var ja=new F("models").description("List generation models with availability, or show one model's options").argument("[id]","Model id; prints the JSON Schema for its options").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("models",B("models"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n});if(e){let u=await bt(s,e);return E(r,u,wd(u)),{response:{model:u.model,available:u.available}}}let i=await $d(s);return E(r,i,i.length?Ad(i):"No models."),{response:{count:i.length}}})});function $t(e){if(e.available===!0)return"available";if(e.available===!1)return`unavailable: ${e.unavailableReason??"no reason given"}`;return"availability unknown"}function Ad(e){let t=e.map((n)=>[n.model,n.type,$t(n)]),r=t[0].map((n,o)=>Math.max(...t.map((s)=>s[o].length)));return t.map((n)=>n.map((o,s)=>o.padEnd(r[s])).join(" ").trimEnd()).join(`
94
- `)}function wd(e){let t=[`${e.model} ${e.type} ${$t(e)}`];if(e.name)t.push(e.description?`${e.name}: ${e.description}`:e.name);if(e.options)t.push("Options:",JSON.stringify(e.options,null,2));return t.join(`
95
- `)}var Fa=new Set(["done","failed"]),Da=3000,La=new F("generate").description("Generate one image, video or audio asset from a prompt").argument("<model>","Model id from `shotstack models`").argument("<prompt>","Text prompt; for a speech model, the words to speak").option("--options <json>","Model options as a JSON object (see `shotstack models <model>`)",Od).option("--length <seconds>","Length of the clip the asset fills; models that generate to a duration use it",Ed).option("--watch","Poll until the asset is ready, then print its URL").option("--quote","Print the credits this exact request would cost, without generating or charging").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await J("generate",B("generate"),async()=>{let n=R(r.output),o=q(r.env),s=G(o.name),i=v({apiKey:s,env:o}),u={model:e,prompt:t,options:r.options,length:r.length};if(r.quote)return Sd(i,u,n);return zd(i,u,n,r.watch===!0)})});async function zd(e,t,r,n,o=Da){let s=await bt(e,t.model);if(s.available===!1){let p={model:s.model,available:!1,unavailableReason:s.unavailableReason};if(r==="json")console.log(JSON.stringify(p));else console.error(`✗ ${s.model} is ${$t(s)}`);return{response:p,exitCode:1}}let i=await e.post("/generate",Ua(s,t));E(r,i,Ma(i));let u=i;if(!Fa.has(i.status)){if(n)u=await Zd(e,i.id,r,o);else if(r!=="json")console.error("Still generating. Run the same command with --watch to wait; the same request returns this job instead of starting another.")}return{renderId:u.id,response:u,exitCode:u.status==="failed"?1:0}}async function Sd(e,t,r){let n=await bt(e,t.model),o=await e.post("/generate/quote",Ua(n,t));return E(r,o,kd(o)),{response:o}}function kd(e){return`${e.ceiling?"up to ":""}${e.credits} ${e.credits===1?"credit":"credits"}`}function Ua(e,t){return{asset:{type:e.type,prompt:t.prompt,model:e.model,...t.options&&{options:t.options}},...t.length!==void 0&&{length:t.length}}}async function Zd(e,t,r,n=Da){while(!0){await Pd(n);let o=await e.get(`/generate/${encodeURIComponent(t)}`);if(E(r,o,Ma(o)),Fa.has(o.status))return o}}function Od(e){let t;try{t=JSON.parse(e)}catch{throw new We("Not valid JSON.")}if(t===null||typeof t!=="object"||Array.isArray(t))throw new We("Expected a JSON object.");return t}function Ed(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new We("Expected a positive number of seconds.");return t}function Ma(e){if(e.status==="done")return`done ${e.url??""}`.trimEnd();if(e.status==="failed")return`failed error: ${e.error??"unknown error"}`;return`${e.status} ${e.id}`}function Pd(e){return new Promise((t)=>setTimeout(t,e))}var Rd=new Set(["done","failed"]),Cd=3000,Va=new F("analyze").alias("analyse").description("Find a music track's tempo, beats, bars, drops and sections").argument("<src>","Public URL of an audio or video file; host a local file with `shotstack ingest upload` first").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("analyze",B("analyze"),async()=>{let r=R(t.output),n=v({env:q(t.env)});return Nd(n,e,r)})});async function Nd(e,t,r,n=Cd){let o=await e.post("/analysis",{src:t});while(!Rd.has(o.status)){if(r!=="json")console.error(`${o.status} ${o.id}`);await Id(n),o=await e.get(`/analysis/${encodeURIComponent(o.id)}`)}if(o.status==="failed")return E(r,o,`failed error: ${o.error??"unknown error"}`),{response:o,exitCode:1};if(E(r,o.result,`done ${Td(o.result??{})}`),r!=="json")console.error("Print the full map with --output json.");return{response:o,exitCode:0}}function Td(e){let t=`${e.drops?.length??0} drops, ${e.sections?.length??0} sections`;if(!e.steady)return`tempo varies (about ${e.bpm} BPM): ${e.beats?.length??0} beats, ${e.downbeats?.length??0} downbeats, ${t}`;return`${e.bpm} BPM, ${e.meter}/4, bar ${e.bar?.toFixed(2)} s from ${e.origin?.toFixed(2)} s, ${e.bars?.count??0} bars, ${t}`}function Id(e){return new Promise((t)=>setTimeout(t,e))}import{createInterface as jd}from"node:readline";import{Writable as Fd}from"node:stream";var va=new F("login").description("Save your Shotstack API key so you don't have to set SHOTSTACK_API_KEY every session").option("--env <name>",`Environment the key belongs to: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=R(e.output),r=Ke(e.env),n=await Dd();if(!n)console.error("No API key provided."),process.exit(1);await Kr(r,n);let o=ze();E(t,{env:r,stored:!0,path:o},`Saved API key for ${r} → ${o} (chmod 600).`)}),qa=new F("logout").description("Remove a saved Shotstack API key").option("--env <name>",`Environment to forget: ${I.join(" | ")}`).option("--all","Remove saved keys for every environment").option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=R(e.output);if(e.all){await Qr(),E(t,{cleared:!0},"Removed all saved API keys.");return}let r=Ke(e.env),n=await Yr(r);E(t,{env:r,removed:n},n?`Removed saved API key for ${r}.`:`No saved API key for ${r}.`)});async function Dd(){if(!process.stdin.isTTY){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}return Ld("Shotstack API key: ")}function Ld(e){return new Promise((t)=>{let r=!1,n=new Fd({write(s,i,u){if(!r)process.stdout.write(s);u()}}),o=jd({input:process.stdin,output:n,terminal:!0});o.question(e,(s)=>{o.close(),process.stdout.write(`
96
- `),t(s.trim())}),r=!0})}var Ud=new F().name("shotstack").description("Command-line interface for the Shotstack video rendering API").version(je).addCommand($a).addCommand(on).addCommand(Ra).addCommand(ye).addCommand(be).addCommand(Ia).addCommand(ja).addCommand(La).addCommand(Va).addCommand(va).addCommand(qa).addCommand(Oa);try{await Ud.parseAsync(process.argv)}catch(e){process.exit(Md(e))}function Md(e){if(e instanceof Se||e instanceof ke)return console.error(e.message),1;if(e instanceof ie){if(console.error(e.message),e.body)console.error(typeof e.body==="string"?e.body:JSON.stringify(e.body));return e.isTransient?2:1}if(e instanceof Error){if("code"in e&&e.code==="ENOENT")return console.error(e.message),1;return console.error(e.message),2}return console.error(String(e)),2}
88
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let c=i[1];if(t===i[0]){s(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(c.cycle){s(i);continue}if(c.count>1){if(e.reused==="ref"){s(i);continue}}}}function fr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let p=e.seen.get(c);if(p.ref===null)return;let l=p.def??p.schema,h={...l},y=p.ref;if(p.ref=null,y){n(y);let x=e.seen.get(y),z=x.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(z);else Object.assign(l,z);if(Object.assign(l,h),c._zod.parent===y)for(let N in l){if(N==="$ref"||N==="allOf")continue;if(!(N in h))delete l[N]}if(z.$ref&&x.def)for(let N in l){if(N==="$ref"||N==="allOf")continue;if(N in x.def&&JSON.stringify(l[N])===JSON.stringify(x.def[N]))delete l[N]}}let A=c._zod.parent;if(A&&A!==y){n(A);let x=e.seen.get(A);if(x?.schema.$ref){if(l.$ref=x.schema.$ref,x.def)for(let z in l){if(z==="$ref"||z==="allOf")continue;if(z in x.def&&JSON.stringify(l[z])===JSON.stringify(x.def[z]))delete l[z]}}}e.override({zodSchema:c,jsonSchema:l,path:p.path??[]})};for(let c of[...e.seen.entries()].reverse())n(c[0]);let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Object.assign(o,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};for(let c of e.seen.entries()){let p=c[1];if(p.def&&p.defId){if(p.def.id===p.defId)delete p.def.id;i[p.defId]=p.def}}if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Be(t,"input",e.processors),output:Be(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function Q(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Q(n.in,r)||Q(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;if(n.rest&&Q(n.rest,r))return!0;return!1}return!1}var si=(e,t={})=>(r)=>{let n=pr({...r,processors:t});return G(e,n),lr(n,e),fr(n,e)},Be=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=pr({...o??{},target:s,io:t,processors:r});return G(e,i),lr(i,e),fr(i,e)};var xc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ii=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:c,patterns:p,contentEncoding:l}=e._zod.bag;if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(c){if(o.format=xc[c]??c,o.format==="")delete o.format;if(c==="time")delete o.format}if(l)o.contentEncoding=l;if(p&&p.size>0){let h=[...p];if(h.length===1)o.pattern=h[0].source;else if(h.length>1)o.allOf=[...h.map((y)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))]}},ai=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,format:c,multipleOf:p,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;if(typeof c==="string"&&c.includes("int"))o.type="integer";else o.type="number";let y=typeof h==="number"&&h>=(s??Number.NEGATIVE_INFINITY),A=typeof l==="number"&&l<=(i??Number.POSITIVE_INFINITY),x=t.target==="draft-04"||t.target==="openapi-3.0";if(y)if(x)o.minimum=h,o.exclusiveMinimum=!0;else o.exclusiveMinimum=h;else if(typeof s==="number")o.minimum=s;if(A)if(x)o.maximum=l,o.exclusiveMaximum=!0;else o.exclusiveMaximum=l;else if(typeof i==="number")o.maximum=i;if(typeof p==="number")o.multipleOf=p},ui=(e,t,r,n)=>{r.type="boolean"};var ci=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var pi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},li=(e,t,r,n)=>{r.not={}};var fi=(e,t,r,n)=>{};var di=(e,t,r,n)=>{let o=e._zod.def,s=Xe(o.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},mi=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(i));else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}};var hi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var gi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var _i=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:c}=e._zod.bag;if(typeof i==="number")o.minItems=i;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=G(s.element,t,{...n,path:[...n.path,"items"]})},xi=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let l in i)o.properties[l]=G(i[l],t,{...n,path:[...n.path,"properties",l]});let c=new Set(Object.keys(i)),p=new Set([...c].filter((l)=>{let h=s.shape[l]._zod;if(t.io==="input")return h.optin===void 0;else return h.optout===void 0}));if(p.size>0)o.required=Array.from(p);if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=G(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},yi=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((c,p)=>G(c,t,{...n,path:[...n.path,s?"oneOf":"anyOf",p]}));if(s)r.oneOf=i;else r.anyOf=i},bi=(e,t,r,n)=>{let o=e._zod.def,s=G(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=G(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(l)=>("allOf"in l)&&Object.keys(l).length===1,p=[...c(s)?s.allOf:[s],...c(i)?i.allOf:[i]];r.allOf=p};var $i=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,p=i._zod.bag?.patterns;if(s.mode==="loose"&&p&&p.size>0){let h=G(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let y of p)o.patternProperties[y.source]=h}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=G(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=G(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=i._zod.values;if(l){let h=[...l].filter((y)=>typeof y==="string"||typeof y==="number");if(h.length>0)o.required=h}},Ai=(e,t,r,n)=>{let o=e._zod.def,s=G(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},wi=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},zi=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Si=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},ki=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Zi=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;G(i,t,n);let c=t.seen.get(e);c.ref=i},Oi=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var dr=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var Sc=m("ZodISODateTime",(e,t)=>{Fo.init(e,t),M.init(e,t)});function Ei(e){return Js(Sc,e)}var kc=m("ZodISODate",(e,t)=>{Do.init(e,t),M.init(e,t)});function Pi(e){return Bs(kc,e)}var Zc=m("ZodISOTime",(e,t)=>{Lo.init(e,t),M.init(e,t)});function Ri(e){return Hs(Zc,e)}var Oc=m("ZodISODuration",(e,t)=>{Uo.init(e,t),M.init(e,t)});function Ci(e){return Gs(Oc,e)}var Rc=(e,t)=>{nt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>_n(e,r)},flatten:{value:(r)=>gn(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Le,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Le,2)}},isEmpty:{get(){return e.issues.length===0}}})};var X=m("ZodError",Rc,{Parent:Error});var Ni=ot(X),Ti=st(X),Ii=Me(X),ji=ve(X),Fi=bn(X),Di=$n(X),Li=An(X),Ui=wn(X),Mi=zn(X),vi=Sn(X),Vi=kn(X),qi=Zn(X);var Ji=new WeakMap;function He(e,t,r){let n=Object.getPrototypeOf(e),o=Ji.get(n);if(!o)o=new Set,Ji.set(n,o);if(o.has(t))return;o.add(t);for(let s in r){let i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let c=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}var L=m("ZodType",(e,t)=>(j.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Be(e,"input"),output:Be(e,"output")}}),e.toJSONSchema=si(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Ni(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Ii(e,r,n),e.parseAsync=async(r,n)=>Ti(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ji(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Fi(e,r,n),e.decode=(r,n)=>Di(e,r,n),e.encodeAsync=async(r,n)=>Li(e,r,n),e.decodeAsync=async(r,n)=>Ui(e,r,n),e.safeEncode=(r,n)=>Mi(e,r,n),e.safeDecode=(r,n)=>vi(e,r,n),e.safeEncodeAsync=async(r,n)=>Vi(e,r,n),e.safeDecodeAsync=async(r,n)=>qi(e,r,n),He(e,"ZodType",{check(...r){let n=this.def;return this.clone(ce(n,{checks:[...n.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return se(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(zp(r,n))},superRefine(r,n){return this.check(Sp(r,n))},overwrite(r){return this.check(de(r))},optional(){return a(this)},exactOptional(){return lp(this)},nullable(){return Ki(this)},nullish(){return a(Ki(this))},nonoptional(r){return _p(this,r)},array(){return I(this)},or(r){return f([this,r])},and(r){return ap(this,r)},transform(r){return Wi(this,ta(r))},default(r){return mp(this,r)},prefault(r){return gp(this,r)},catch(r){return yp(this,r)},pipe(r){return Wi(this,r)},readonly(){return Ap(this)},describe(r){let n=this.clone();return ye.add(n,{description:r}),n},meta(...r){if(r.length===0)return ye.get(this);let n=this.clone();return ye.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return ye.get(e)?.description},configurable:!0}),e)),Yi=m("_ZodString",(e,t)=>{ct.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>ii(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,He(e,"_ZodString",{regex(...n){return this.check(Xt(...n))},includes(...n){return this.check(rr(...n))},startsWith(...n){return this.check(nr(...n))},endsWith(...n){return this.check(or(...n))},min(...n){return this.check(Pe(...n))},max(...n){return this.check(dt(...n))},length(...n){return this.check(mt(...n))},nonempty(...n){return this.check(Pe(1,...n))},lowercase(n){return this.check(er(n))},uppercase(n){return this.check(tr(n))},trim(){return this.check(ir())},normalize(...n){return this.check(sr(...n))},toLowerCase(){return this.check(ar())},toUpperCase(){return this.check(ur())},slugify(){return this.check(cr())}})}),Nc=m("ZodString",(e,t)=>{ct.init(e,t),Yi.init(e,t),e.email=(r)=>e.check(zs(Tc,r)),e.url=(r)=>e.check(Es(Ic,r)),e.jwt=(r)=>e.check(qs(Wc,r)),e.emoji=(r)=>e.check(Ps(jc,r)),e.guid=(r)=>e.check(Qt(Bi,r)),e.uuid=(r)=>e.check(Ss(gt,r)),e.uuidv4=(r)=>e.check(ks(gt,r)),e.uuidv6=(r)=>e.check(Zs(gt,r)),e.uuidv7=(r)=>e.check(Os(gt,r)),e.nanoid=(r)=>e.check(Rs(Fc,r)),e.guid=(r)=>e.check(Qt(Bi,r)),e.cuid=(r)=>e.check(Cs(Dc,r)),e.cuid2=(r)=>e.check(Ns(Lc,r)),e.ulid=(r)=>e.check(Ts(Uc,r)),e.base64=(r)=>e.check(Ms(Hc,r)),e.base64url=(r)=>e.check(vs(Gc,r)),e.xid=(r)=>e.check(Is(Mc,r)),e.ksuid=(r)=>e.check(js(vc,r)),e.ipv4=(r)=>e.check(Fs(Vc,r)),e.ipv6=(r)=>e.check(Ds(qc,r)),e.cidrv4=(r)=>e.check(Ls(Jc,r)),e.cidrv6=(r)=>e.check(Us(Bc,r)),e.e164=(r)=>e.check(Vs(Kc,r)),e.datetime=(r)=>e.check(Ei(r)),e.date=(r)=>e.check(Pi(r)),e.time=(r)=>e.check(Ri(r)),e.duration=(r)=>e.check(Ci(r))});function u(e){return ws(Nc,e)}var M=m("ZodStringFormat",(e,t)=>{D.init(e,t),Yi.init(e,t)}),Tc=m("ZodEmail",(e,t)=>{Oo.init(e,t),M.init(e,t)});var Bi=m("ZodGUID",(e,t)=>{ko.init(e,t),M.init(e,t)});var gt=m("ZodUUID",(e,t)=>{Zo.init(e,t),M.init(e,t)});var Ic=m("ZodURL",(e,t)=>{Eo.init(e,t),M.init(e,t)});var jc=m("ZodEmoji",(e,t)=>{Po.init(e,t),M.init(e,t)});var Fc=m("ZodNanoID",(e,t)=>{Ro.init(e,t),M.init(e,t)});var Dc=m("ZodCUID",(e,t)=>{Co.init(e,t),M.init(e,t)});var Lc=m("ZodCUID2",(e,t)=>{No.init(e,t),M.init(e,t)});var Uc=m("ZodULID",(e,t)=>{To.init(e,t),M.init(e,t)});var Mc=m("ZodXID",(e,t)=>{Io.init(e,t),M.init(e,t)});var vc=m("ZodKSUID",(e,t)=>{jo.init(e,t),M.init(e,t)});var Vc=m("ZodIPv4",(e,t)=>{Mo.init(e,t),M.init(e,t)});var qc=m("ZodIPv6",(e,t)=>{vo.init(e,t),M.init(e,t)});var Jc=m("ZodCIDRv4",(e,t)=>{Vo.init(e,t),M.init(e,t)});var Bc=m("ZodCIDRv6",(e,t)=>{qo.init(e,t),M.init(e,t)});var Hc=m("ZodBase64",(e,t)=>{Bo.init(e,t),M.init(e,t)});var Gc=m("ZodBase64URL",(e,t)=>{Ho.init(e,t),M.init(e,t)});var Kc=m("ZodE164",(e,t)=>{Go.init(e,t),M.init(e,t)});var Wc=m("ZodJWT",(e,t)=>{Ko.init(e,t),M.init(e,t)});var Qi=m("ZodNumber",(e,t)=>{Gt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>ai(e,n,o,s),He(e,"ZodNumber",{gt(n,o){return this.check(lt(n,o))},gte(n,o){return this.check(Je(n,o))},min(n,o){return this.check(Je(n,o))},lt(n,o){return this.check(pt(n,o))},lte(n,o){return this.check(qe(n,o))},max(n,o){return this.check(qe(n,o))},int(n){return this.check(Hi(n))},safe(n){return this.check(Hi(n))},positive(n){return this.check(lt(0,n))},nonnegative(n){return this.check(Je(0,n))},negative(n){return this.check(pt(0,n))},nonpositive(n){return this.check(qe(0,n))},multipleOf(n,o){return this.check(ft(n,o))},step(n,o){return this.check(ft(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function g(e){return Ks(Qi,e)}var Yc=m("ZodNumberFormat",(e,t)=>{Wo.init(e,t),Qi.init(e,t)});function Hi(e){return Ws(Yc,e)}var Qc=m("ZodBoolean",(e,t)=>{Yo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ui(e,r,n,o)});function T(e){return Ys(Qc,e)}var Xc=m("ZodNull",(e,t)=>{Qo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ci(e,r,n,o)});function Re(e){return Qs(Xc,e)}var ep=m("ZodUnknown",(e,t)=>{Xo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fi(e,r,n,o)});function Z(){return Xs(ep)}var tp=m("ZodNever",(e,t)=>{es.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>li(e,r,n,o)});function S(e){return ei(tp,e)}var rp=m("ZodVoid",(e,t)=>{ts.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pi(e,r,n,o)});function hr(e){return ti(rp,e)}var np=m("ZodArray",(e,t)=>{rs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_i(e,r,n,o),e.element=t.element,He(e,"ZodArray",{min(r,n){return this.check(Pe(r,n))},nonempty(r){return this.check(Pe(1,r))},max(r,n){return this.check(dt(r,n))},length(r,n){return this.check(mt(r,n))},unwrap(){return this.element}})});function I(e,t){return ri(np,e,t)}var op=m("ZodObject",(e,t)=>{ss.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xi(e,r,n,o),P(e,"shape",()=>t.shape),He(e,"ZodObject",{keyof(){return b(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Z()})},loose(){return this.clone({...this._zod.def,catchall:Z()})},strict(){return this.clone({...this._zod.def,catchall:S()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return ic(this,r)},safeExtend(r){return ac(this,r)},merge(r){return uc(this,r)},pick(r){return oc(this,r)},omit(r){return sc(this,r)},partial(...r){return cc(ra,this,r[0])},required(...r){return pc(na,this,r[0])}})});function d(e,t){let r={type:"object",shape:e??{},...w(t)};return new op(r)}var Xi=m("ZodUnion",(e,t)=>{Kt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yi(e,r,n,o),e.options=t.options});function f(e,t){return new Xi({type:"union",options:e,...w(t)})}var sp=m("ZodDiscriminatedUnion",(e,t)=>{Xi.init(e,t),is.init(e,t)});function ea(e,t,r){return new sp({type:"union",options:t,discriminator:e,...w(r)})}var ip=m("ZodIntersection",(e,t)=>{as.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bi(e,r,n,o)});function ap(e,t){return new ip({type:"intersection",left:e,right:t})}var Gi=m("ZodRecord",(e,t)=>{us.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$i(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ce(e,t,r){if(!t||!t._zod)return new Gi({type:"record",keyType:u(),valueType:e,...w(t)});return new Gi({type:"record",keyType:e,valueType:t,...w(r)})}var mr=m("ZodEnum",(e,t)=>{cs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>di(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new mr({...t,checks:[],...w(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new mr({...t,checks:[],...w(o),entries:s})}});function b(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new mr({type:"enum",entries:r,...w(t)})}var up=m("ZodLiteral",(e,t)=>{ps.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mi(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function O(e,t){return new up({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var cp=m("ZodTransform",(e,t)=>{ls.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gi(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new De(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(xe(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(xe(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r.fallback=!0,r));return r.value=o,r.fallback=!0,r}});function ta(e){return new cp({type:"transform",transform:e})}var ra=m("ZodOptional",(e,t)=>{Wt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function a(e){return new ra({type:"optional",innerType:e})}var pp=m("ZodExactOptional",(e,t)=>{fs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function lp(e){return new pp({type:"optional",innerType:e})}var fp=m("ZodNullable",(e,t)=>{ds.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ai(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ki(e){return new fp({type:"nullable",innerType:e})}var dp=m("ZodDefault",(e,t)=>{ms.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mp(e,t){return new dp({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Lt(t)}})}var hp=m("ZodPrefault",(e,t)=>{hs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Si(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gp(e,t){return new hp({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Lt(t)}})}var na=m("ZodNonOptional",(e,t)=>{gs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _p(e,t){return new na({type:"nonoptional",innerType:e,...w(t)})}var xp=m("ZodCatch",(e,t)=>{_s.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ki(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yp(e,t){return new xp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var oa=m("ZodPipe",(e,t)=>{Yt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zi(e,r,n,o),e.in=t.in,e.out=t.out});function Wi(e,t){return new oa({type:"pipe",in:e,out:t})}var bp=m("ZodPreprocess",(e,t)=>{oa.init(e,t),xs.init(e,t)}),$p=m("ZodReadonly",(e,t)=>{ys.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ap(e){return new $p({type:"readonly",innerType:e})}var wp=m("ZodCustom",(e,t)=>{bs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hi(e,r,n,o)});function zp(e,t={}){return ni(wp,e,t)}function Sp(e,t){return oi(e,t)}function _(e,t){return new bp({type:"pipe",in:ta(e),out:t})}var Ne={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var sa;(function(e){})(sa||(sa={}));var Jg=Z(),Bg=Z(),Hg=Z(),Gg=Z(),Kg=Z(),Wg=Z(),Yg=Z(),Qg=Z(),Xg=Z(),e_=Z(),t_=Z(),r_=Z(),n_=Z(),o_=Z(),s_=Z(),i_=Z(),a_=Z(),u_=Z(),c_=Z(),Zp=d({color:a(u()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Op=d({family:a(u()),color:a(u()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(u()),strokeWidth:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ep=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Pp=d({type:b(["caption"]),src:u().min(1).regex(/\S/),font:a(Op),background:a(Zp),margin:a(Ep),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Rp=d({color:f([u().regex(/^#[0-9a-fA-F]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),threshold:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(250)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),halo:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(250)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var _t=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),bottom:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Cp=d({host:u(),cpCode:u(),path:a(f([u(),Re()])),filename:a(f([u(),Re()]))}).strict(),Np=d({provider:O("akamai-netstorage"),options:a(Cp)}).strict(),Tp=d({accountName:u(),container:u(),prefix:a(f([u(),Re()])),filename:a(f([u(),Re()]))}).strict(),Ip=d({provider:O("azure-blob-storage"),options:a(Tp)}).strict(),jp=d({bucket:u(),prefix:a(u()),filename:a(u())}).strict();var Fp=d({provider:O("google-cloud-storage"),options:a(jp)}).strict();var Dp=d({folderId:a(u()),filename:a(u())}).strict();var Lp=d({provider:O("google-drive"),options:a(Dp)}).strict();var Up=d({playbackPolicy:a(I(b(["public","signed"]))),passthrough:a(u().max(255))}).strict();var Mp=d({provider:O("mux"),options:a(Up)}).strict();var vp=d({region:u(),bucket:u(),prefix:a(u()),filename:a(u()),acl:a(u())}).strict();var Vp=d({provider:O("s3"),options:a(vp)}).strict();var qp=d({provider:O("shotstack"),exclude:a(T())}).strict();var Jp=d({title:a(u().max(150)),privacyLevel:a(b(["public","friends","private"])),disableDuet:a(T()).default(!1),disableStitch:a(T()).default(!1),disableComment:a(T()).default(!1)}).strict(),Bp=d({provider:O("tiktok"),options:a(Jp)}).strict(),Hp=d({view:a(b(["anybody","nobody","contacts","password","unlisted"])),embed:a(b(["public","private","whitelist"])),comments:a(b(["anybody","nobody","contacts"])),download:a(T()),add:a(T())}).strict();var Gp=d({name:a(u()),description:a(u()),privacy:a(Hp),folderUri:a(u())}).strict();var Kp=d({provider:O("vimeo"),options:a(Gp)}).strict();var gr=ea("provider",[qp,Mp,Vp,Fp,Lp,Kp,Bp,Np,Ip]);var Wp=d({horizontal:a(T()),vertical:a(T())}).strict();var Yp=d({src:u()}).strict();var Qp=d({type:b(["image","video","audio"]),prompt:u().min(1).max(4000).regex(/\S/),model:a(u()),options:a(Ce(u(),Z()))}).strict();var Xp=d({model:u(),type:b(["image","video","audio"]),name:a(u()),description:a(u()),options:a(Ce(u(),Z())),available:a(T()),unavailableReason:a(b(["AiCapabilityNotIncluded","AiDisabled","AiAccessUnavailable"]))}).strict();var ia=d({asset:Qp,length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gt(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var el=d({type:b(["html5"]),html:u().max(1e6),css:a(u().max(500000)),js:a(u().max(500000))}).strict();var tl=d({type:b(["html"]),html:u(),css:a(u()),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(u()),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"]))}).strict();var rl=d({type:b(["image"]),src:a(u().min(1).regex(/\S/)),prompt:a(u().max(4000)),model:a(u()),options:a(Ce(u(),Z())),crop:a(_t)}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ne.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var nl=d({type:b(["image-to-video"]),src:u().min(1),prompt:a(u()),aspectRatio:a(b(["1:1","4:3","16:9","9:16","3:4","21:9","9:21"])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(_t)}).strict();var ol=d({preset:b(["conference","interview","lecture","meeting","mobile_phone","music","podcast","studio","voice_over"])}).strict();var sl=d({provider:u().default("dolby"),options:ol}).strict();var il=d({enhancement:O("dolbyEnhancement_DolbyEnhancement")}).strict().and(sl);var al=d({audio:a(il)}).strict();var ul=d({status:u(),title:u(),detail:u()}).strict();var p_=d({errors:I(ul)}).strict();var cl=d({type:u(),id:u()}).strict();var l_=d({data:cl}).strict();var pl=d({id:u(),url:u(),expires:u()}).strict();var ll=d({type:u(),id:u(),attributes:pl}).strict();var f_=d({data:ll}).strict();var fl=d({speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),preservePitch:a(T())}).strict();var dl=d({format:a(b(["srt","vtt"]))}).strict();var ml=d({type:b(["luma"]),src:u().min(1).regex(/\S/),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var aa=d({find:u(),replace:Z()}).strict();var hl=d({capture:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var gl=d({start:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var _l=d({id:u(),owner:u(),region:a(u()),renderId:a(u()),providerId:a(u()),filename:a(u()),url:a(u()),status:b(["importing","ready","failed","deleted"]),created:a(u()),updated:a(u())}).strict();var ua=d({type:u(),attributes:_l}).strict();var d_=d({data:I(ua)}).strict();var m_=d({data:ua}).strict();var h_=d({error:u(),code:a(u()),available:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var g_=d({error:d({name:b(["UnknownGenerationModel","WithdrawnGenerationModel"]),message:u()})}).strict();var __=d({models:I(Xp)}).strict();var x_=d({credits:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),ceiling:T()}).strict();var y_=d({id:u(),status:b(["queued","processing","done","failed"]),url:a(u()),error:a(u())}).strict();var b_=d({success:T(),message:u(),response:Ce(u(),Z())}).strict();var xl=d({message:u(),id:u()}).strict();var $_=d({success:T(),message:u(),response:xl}).strict();var yl=d({id:u(),name:u(),created:a(u()),updated:a(u())}).strict();var bl=d({owner:u(),templates:I(yl)}).strict();var A_=d({success:T(),message:u(),response:bl}).strict();var $l=d({message:u(),id:u()}).strict();var w_=d({success:T(),message:u(),response:$l}).strict();var Al=d({family:a(u()),weight:a(Z()).default("400"),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(500)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"]))}).strict();var wl=d({style:b(["karaoke","highlight","pop","fade","slide","bounce","typewriter","none"]),direction:a(b(["left","right","up","down"]))}).strict();var zl=d({family:a(u()).default("Roboto"),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(500)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(b(["normal","italic"])),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffffff"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ca=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","middle","bottom"]))}).strict();var Sl=d({preset:b(["fadeIn","slideIn","typewriter","ascend","shift","movingLetters"]),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0.1).lte(30)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),style:a(b(["character","word"])),direction:a(b(["left","right","up","down"]))}).strict();var pa=d({color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wrap:a(T()).default(!1),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(200)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var la=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),radius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var fa=d({type:a(b(["linear","radial"])),angle:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(360)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),stops:I(d({offset:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),color:f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})).min(2)}).strict();var kl=d({letterSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(b(["none","uppercase","lowercase","capitalize"])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(500)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"])),gradient:a(fa)}).strict(),da=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),bottom:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var _r=d({offsetX:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),offsetY:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),blur:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5)}).strict();var xt=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1)}).strict();var Zl=d({font:a(Al),stroke:a(f([xt,b(["none"])])),shadow:a(f([_r,b(["none"])]))}).strict();var Ol=d({type:b(["rich-caption"]),src:u().min(1),font:a(zl),style:a(kl),stroke:a(xt),shadow:a(_r),background:a(pa),border:a(la),padding:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),active:a(Zl),animation:a(wl)}).strict();var El=d({family:a(u()).default("Open Sans"),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(500)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(b(["normal","italic"])),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(xt)}).strict();var Pl=d({letterSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wordSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(b(["none","uppercase","lowercase","capitalize"])),textDecoration:a(b(["none","underline","line-through"])),gradient:a(fa)}).strict();var Rl=d({type:b(["rich-text"]),text:u().max(5000),font:a(El),style:a(Pl),stroke:a(xt),shadow:a(_r),background:a(pa),border:a(la),padding:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),animation:a(Sl)}).strict();var Cl=d({id:a(u()),owner:a(u()),status:a(b(["queued","failed"])),created:a(u())}).strict();var Nl=d({type:a(u()),attributes:a(Cl)}).strict();var z_=d({data:Nl}).strict();var Tl=d({url:u(),id:u(),destinations:I(gr)}).strict();var Il=d({type:b(["shape"]),shape:b(["rectangle","circle","line"]),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fill:a(d({color:a(u()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),stroke:a(d({color:a(u()),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),rectangle:a(d({width:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),height:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),cornerRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),circle:a(d({radius:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})),line:a(d({length:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),thickness:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}))}).strict();var ma=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(4096)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(4096)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var ha=d({format:a(b(["mp4","webm","mov","avi","mkv","ogv","wmv","avif","gif","mp3","wav","jpg","png","webp","tif"])),size:a(ma),fit:a(b(["cover","contain","crop"])),resolution:a(b(["preview","mobile","sd","hd","fhd"])),quality:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(100)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([O(12),O(15),O(23.976),O(24),O(25),O(29.97),O(30),O(48),O(50),O(59.94),O(60)])),speed:a(fl),keyframeInterval:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(300)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fixOffset:a(T()),fixRotation:a(T()),enhance:a(al),filename:a(u())}).strict();var jl=d({renditions:a(I(ha)),transcription:a(dl)}).strict();var Fl=d({id:u(),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),url:a(u()),executionTime:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),transformation:a(ha),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Dl=d({renditions:a(I(Fl))}).strict();var Ll=d({id:u(),owner:u(),input:a(u()),source:a(u()),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),outputs:a(Dl),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),created:a(u()),updated:a(u())}).strict();var ga=d({type:u(),id:u(),attributes:Ll}).strict();var S_=d({data:I(ga)}).strict();var k_=d({data:ga}).strict();var Ul=d({url:a(u()),outputs:a(jl),destinations:a(gr),callback:a(u())}).strict();var Ml=d({src:u().min(1).regex(/\S/),effect:a(b(["fadeIn","fadeOut","fadeInFadeOut"])),volume:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var vl=d({type:b(["svg"]),src:u().min(1).max(500000)}).strict();var Vl=d({id:u(),merge:a(I(aa))}).strict();var ql=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","center","bottom"]))}).strict();var Jl=d({preset:b(["typewriter"]),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0.1).lte(30)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),Bl=d({color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(100)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),wrap:a(T())}).strict();var Hl=d({family:a(u()),color:a(u()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),weight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Gl=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),Kl=d({type:b(["text"]),text:u(),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),font:a(Hl),background:a(Bl),alignment:a(ql),stroke:a(Gl),animation:a(Jl),ellipsis:a(u())}).strict().superRefine((e,t)=>{if(e.background&&e.background.wrap===!0)t.addIssue({code:Ne.custom,message:'background.wrap is only supported on rich-text and rich-caption assets. For type "text", migrate to type "rich-text" to use this feature.',path:["background","wrap"]})});var Wl=d({type:b(["text-to-image"]),prompt:u(),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(_t)}).strict();var Yl=d({capture:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),scale:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var Ql=d({format:b(["mp4","gif","mp3","jpg","png","bmp"]),resolution:a(b(["preview","mobile","sd","hd","1080","4k"])),aspectRatio:a(b(["16:9","9:16","1:1","4:5","4:3"])),size:a(ma),fps:a(f([O(12),O(15),O(23.976),O(24),O(25),O(29.97),O(30),O(48),O(50),O(59.94),O(60)])),scaleTo:a(b(["preview","mobile","sd","hd","1080","4k"])),quality:a(b(["verylow","low","medium","high","veryhigh"])),repeat:a(T()),mute:a(T()),range:a(gl),poster:a(hl),thumbnail:a(Yl),destinations:a(I(gr))}).strict().superRefine((e,t)=>{var r=e.format==="mp3";if(!r&&e.size!=null&&(e.size.width==null||e.size.height==null)){t.addIssue({code:Ne.custom,path:["size"],message:"size requires both width and height"});return}var n=typeof e.resolution==="string",o=e.size!=null&&e.size.width!=null&&e.size.height!=null;if(!r&&!n&&!o)t.addIssue({code:Ne.custom,message:'output requires either "resolution" or "size" (with width and height)'})});var Xl=d({in:a(b(["none","fade","fadeSlow","fadeFast","reveal","revealSlow","revealFast","wipeLeft","wipeLeftSlow","wipeLeftFast","wipeRight","wipeRightSlow","wipeRightFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast","carouselLeft","carouselLeftSlow","carouselLeftFast","carouselRight","carouselRightSlow","carouselRightFast","carouselUp","carouselUpSlow","carouselUpFast","carouselDown","carouselDownSlow","carouselDownFast","shuffleTopRight","shuffleTopRightSlow","shuffleTopRightFast","shuffleRightTop","shuffleRightTopSlow","shuffleRightTopFast","shuffleRightBottom","shuffleRightBottomSlow","shuffleRightBottomFast","shuffleBottomRight","shuffleBottomRightSlow","shuffleBottomRightFast","shuffleBottomLeft","shuffleBottomLeftSlow","shuffleBottomLeftFast","shuffleLeftBottom","shuffleLeftBottomSlow","shuffleLeftBottomFast","shuffleLeftTop","shuffleLeftTopSlow","shuffleLeftTopFast","shuffleTopLeft","shuffleTopLeftSlow","shuffleTopLeftFast","zoom"])),out:a(b(["none","fade","fadeSlow","fadeFast","reveal","revealSlow","revealFast","wipeLeft","wipeLeftSlow","wipeLeftFast","wipeRight","wipeRightSlow","wipeRightFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast","carouselLeft","carouselLeftSlow","carouselLeftFast","carouselRight","carouselRightSlow","carouselRightFast","carouselUp","carouselUpSlow","carouselUpFast","carouselDown","carouselDownSlow","carouselDownFast","shuffleTopRight","shuffleTopRightSlow","shuffleTopRightFast","shuffleRightTop","shuffleRightTopSlow","shuffleRightTopFast","shuffleRightBottom","shuffleRightBottomSlow","shuffleRightBottomFast","shuffleBottomRight","shuffleBottomRightSlow","shuffleBottomRightFast","shuffleBottomLeft","shuffleBottomLeftSlow","shuffleBottomLeftFast","shuffleLeftBottom","shuffleLeftBottomSlow","shuffleLeftBottomFast","shuffleLeftTop","shuffleLeftTopSlow","shuffleLeftTopFast","shuffleTopLeft","shuffleTopLeftSlow","shuffleTopLeftFast","zoom"]))}).strict();var ne=d({from:a(Z()),to:a(Z()),start:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),interpolation:a(b(["linear","bezier","constant"])),easing:a(b(["ease","easeIn","easeOut","easeInOut","easeInQuad","easeInCubic","easeInQuart","easeInQuint","easeInSine","easeInExpo","easeInCirc","easeInBack","easeOutQuad","easeOutCubic","easeOutQuart","easeOutQuint","easeOutSine","easeOutExpo","easeOutCirc","easeOutBack","easeInOutQuad","easeInOutCubic","easeInOutQuart","easeInOutQuint","easeInOutSine","easeInOutExpo","easeInOutCirc","easeInOutBack"]))}).strict();var ef=d({type:b(["audio"]),src:a(u().min(1).regex(/\S/)),prompt:a(u().max(4000)),model:a(u()),options:a(Ce(u(),Z())),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ne.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var _a=d({x:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-10).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),y:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-10).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)]))}).strict();var tf=d({angle:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-360).lte(360)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)]))}).strict();var rf=d({x:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-100).lte(100)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),y:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-100).lte(100)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)]))}).strict();var nf=d({type:b(["text-to-speech"]),text:u(),voice:u(),language:a(u()),newscaster:a(T()).default(!1),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict();var of=d({type:b(["title"]),text:u(),style:a(b(["minimal","blockbuster","vogue","sketchy","skinny","chunk","chunkLight","marker","future","subtitle"])),color:a(u()),size:a(b(["xx-small","x-small","small","medium","large","x-large","xx-large"])),background:a(u()),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(_a)}).strict();var sf=d({rotate:a(tf),skew:a(rf),flip:a(Wp)}).strict();var af=d({type:b(["video"]),src:a(u().min(1).regex(/\S/)),prompt:a(u().max(4000)),model:a(u()),options:a(Ce(u(),Z())),transcode:a(T()),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),volumeEffect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"])),speed:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),crop:a(_t),chromaKey:a(Rp)}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ne.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var uf=ea("type",[af,rl,Kl,Rl,ef,ml,Pp,Ol,tl,el,of,Il,vl,Wl,nl,nf]);var cf=d({id:a(u()),asset:uf,start:f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([u().regex(/^(auto|alias:\/\/[A-Za-z0-9_-]+)$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),length:f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([u().regex(/^(auto|end|alias:\/\/[A-Za-z0-9_-]+)$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),fit:a(b(["cover","contain","crop","none"])),scale:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(3840)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(2160)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(_a),transition:a(Xl),effect:a(b(["zoomIn","zoomInSlow","zoomInFast","zoomOut","zoomOutSlow","zoomOutFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast"])),filter:a(b(["none","blur","boost","contrast","darken","greyscale","lighten","muted","negative"])),opacity:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),transform:a(sf),alias:a(f([u().regex(/^[A-Za-z0-9_-]+$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var pf=cf.transform((e)=>{if(e.asset&&typeof e.asset==="object"&&"type"in e.asset){if(e.asset.type==="rich-text"){let{fit:r,...n}=e;return n}}return e}),lf=d({clips:I(pf).min(1)}).strict();var ff=d({soundtrack:a(Ml),background:a(u()),fonts:a(I(Yp)),tracks:I(lf).min(1),cache:a(T())}).strict();var Ge=d({timeline:ff,output:Ql,merge:a(I(aa)),callback:a(u()),disk:a(b(["local","mount"])),instance:a(b(["s1","s2","a1"]))}).strict(),xa=Ge,df=d({id:u(),owner:u(),plan:a(u()),status:b(["queued","fetching","preprocessing","rendering","generating","saving","done","failed"]),error:a(u()),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),renderTime:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),url:a(u()),poster:a(f([u(),Re()])),thumbnail:a(f([u(),Re()])),data:a(Ge),created:a(u()),updated:a(u())}).strict();var Z_=d({success:T(),message:u(),response:df}).strict();var mf=d({id:u(),name:u(),owner:u(),template:Ge}).strict();var O_=d({success:T(),message:u(),response:mf}).strict();var ya=d({name:u(),template:a(Ge)}).strict();var E_=d({body:Ge,path:a(S()),query:a(S())}).strict();var P_=d({body:a(S()),path:d({id:f([u().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(d({data:a(T()),merged:a(T())}))}).strict();var R_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var C_=d({body:ya,path:a(S()),query:a(S())}).strict();var N_=d({body:a(S()),path:d({id:f([u().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),T_=hr(),I_=d({body:a(S()),path:d({id:f([u().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var j_=d({body:ya,path:d({id:f([u().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var F_=d({body:Vl,path:a(S()),query:a(S())}).strict();var D_=d({body:a(S()),path:d({url:u()}),query:a(S())}).strict();var L_=d({body:ia,path:a(S()),query:a(S()),headers:a(d({"Idempotency-Key":a(u())}))}).strict();var U_=d({body:ia,path:a(S()),query:a(S())}).strict();var M_=d({body:a(S()),path:d({id:u()}),query:a(S())}).strict();var v_=d({body:a(S()),path:a(S()),query:a(d({expand:a(b(["options"]))}))}).strict();var V_=d({body:a(S()),path:d({id:u()}),query:a(S())}).strict();var q_=d({body:a(S()),path:d({id:f([u().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),J_=hr(),B_=d({body:a(S()),path:d({id:f([u().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var H_=d({body:a(S()),path:d({id:f([u().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var G_=d({body:Tl,path:a(S()),query:a(S())}).strict();var K_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var W_=d({body:Ul,path:a(S()),query:a(S())}).strict();var Y_=d({body:a(S()),path:d({id:f([u().regex(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),Q_=hr(),X_=d({body:a(S()),path:d({id:f([u().regex(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var ex=d({body:a(S()),path:a(S()),query:a(S())}).strict();var hf={alignment:"align",duration:"length",transitions:"transition",name:"family"},ba={"align.vertical":{center:"middle"},fit:{cover:"crop"}},gf=new Set(["arapey","clear sans","clearsans","didact gothic","didactgothic","montserrat","movlette","notoemoji","open sans","opensans","permanent marker","permanentmarker","roboto","sue ellen francisco","sueellenfrancisco","uni neue","unineue","work sans","worksans"]),_f=/-(?:(?:Extra(?:Light|Bold)|SemiBold|Regular|Medium|Light|Black|Bold|Thin|Heavy)(?:Italic|Oblique)?|(?:Italic|Oblique))$/i,xf=new Set(["image","video","audio","luma"]);function Te(e){let t=[],r=xa.safeParse(e);if(!r.success)for(let o of zf(r.error))t.push({...o,level:"error"});for(let o of yf(e))t.push(o);return{ok:!t.some((o)=>(o.level??"error")==="error"),issues:t}}function be(e){let t=e.filter((o)=>(o.level??"error")==="error"),r=e.filter((o)=>o.level==="warning"),n=[];if(t.length){let o=r.length?`, ${r.length} warning${xr(r.length)}`:"";n.push(`✗ Edit JSON failed validation (${t.length} error${xr(t.length)}${o}):`)}else n.push(`⚠ Edit JSON valid, with ${r.length} warning${xr(r.length)}:`);for(let o of e){let s=(o.level??"error")==="error"?"✗":"⚠",i=o.suggestion?` (did you mean '${o.suggestion}'?)`:"";n.push(` ${s} ${o.path||"<root>"}: ${o.message}${i}`)}return n.join(`
89
+ `)}function xr(e){return e===1?"":"s"}function yf(e){let t=[],n=e?.timeline,o=n?.tracks;if(!Array.isArray(o))return t;let s=[];if(Array.isArray(n?.fonts))for(let i of n.fonts){let c=$f(i?.src);if(c)s.push(c)}return o.forEach((i,c)=>{let p=i?.clips;if(!Array.isArray(p))return;let l=p.map((h,y)=>({ci:y,start:h?.start,len:h?.length})).filter((h)=>typeof h.start==="number"&&typeof h.len==="number");for(let h=0;h<l.length;h++)for(let y=h+1;y<l.length;y++){let A=l[h],x=l[y];if(A.start<x.start+x.len&&x.start<A.start+A.len){let[z,v]=A.ci<x.ci?[A.ci,x.ci]:[x.ci,A.ci];t.push({path:`timeline.tracks[${c}].clips`,code:"clip_overlap",level:"error",message:`clips [${z}] and [${v}] overlap in time — clips on one track must not `+"overlap (they flicker). Put simultaneous elements on separate tracks."})}}p.forEach((h,y)=>{let A=h?.asset,x=`timeline.tracks[${c}].clips[${y}]`,z=A?.font?.family;if(typeof z==="string"&&z.length>0){let ie=bf(z,s,`${x}.asset.font.family`);if(ie)t.push(ie)}let v=A?.type;if(v==="html5"&&typeof A?.js==="string"&&A.js.length>0){let ie=Af(A.js,`${x}.asset.js`);if(ie)t.push(ie)}let N=A?.src;if(typeof v==="string"&&xf.has(v)&&typeof N==="string")if(/^https:\/\//i.test(N)||/^alias:\/\//i.test(N));else if(/^data:/i.test(N))t.push({path:`${x}.asset.src`,code:"src_not_public",level:"warning",message:"data: URIs aren't fetched by render workers — host the asset and use a public https:// URL."});else if(/^http:\/\//i.test(N))t.push({path:`${x}.asset.src`,code:"src_not_https",level:"warning",message:"http:// sources are blocked/upgraded — use https://."});else t.push({path:`${x}.asset.src`,code:"src_not_public",level:"warning",message:`'${wf(N,48)}' is not a public https:// URL — local paths don't render. `+"Host it with 'shotstack ingest upload' and use the returned URL."})})}),t}function bf(e,t,r){let n=e.toLowerCase();if(gf.has(n))return null;if(t.some((s)=>n===s.full.toLowerCase()||n===s.base.toLowerCase()))return null;let o="the exact family name stored in the font file, which can differ from the name on Google Fonts (Space Grotesk's file says 'Space Grotesk Light')";if(t.length===0)return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' is neither a built-in font nor loaded via timeline.fonts[] — `+"it renders in Roboto. Add the font's URL to timeline.fonts[] and use its filename as font.family."};if(t.length===1)return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' doesn't match the timeline.fonts[] filename. It renders in that font only because it's the sole entry; add another font and it falls back to Roboto unless it's ${o}. Use the filename to be sure.`,suggestion:t[0].full};return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' doesn't match any timeline.fonts[] filename (${t.map((s)=>`'${s.full}'`).join(", ")}). It renders in Roboto unless it's ${o}. Use the filename to be sure.`}}function $f(e){if(typeof e!=="string")return null;let t=e.split(/[?#]/,1)[0].split("/").pop()??"";try{t=decodeURIComponent(t)}catch{}let r=t.replace(/\.(ttf|otf|woff2?|eot)$/i,"");return r.length?{full:r,base:r.replace(_f,"")}:null}function Af(e,t){try{Function(e)}catch(r){let n=r instanceof Error?r.message:String(r);return{path:t,code:"js_syntax_error",level:"error",message:`asset.js has a syntax error — the html5 clip will render completely blank with no render error. ${n}`}}return null}function wf(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function zf(e){return e.issues.flatMap((t)=>Sf(t))}function Sf(e){let t=Zf(e.path);if(e.code==="unrecognized_keys"&&"keys"in e)return e.keys.map((n)=>({path:Of(t,n),code:e.code,message:`unrecognized key '${n}'`,suggestion:hf[n]}));let r=kf(t,e);return[{path:t,code:e.code,message:e.message,...r?{suggestion:r}:{}}]}function kf(e,t){let r=e.replace(/\[\d+\]/g,""),n=r.split(".").slice(-2).join(".");if(t.code==="invalid_value"&&"received"in t){let o=String(t.received);return ba[n]?.[o]??ba[r]?.[o]}return}function Zf(e){return e.reduce((t,r)=>{if(typeof r==="number")return`${t}[${r}]`;let n=String(r);return t?`${t}.${n}`:n},"")}function Of(e,t){return e?`${e}.${t}`:t}var $a=new F("render").description("Submit a Shotstack Edit JSON to the render API").argument("<file>","Path to a Shotstack Edit JSON file").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--watch","After submitting, poll until the render reaches a terminal state").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("render",H("render"),async()=>{let r=C(t.output),n=J(t.env),o=U(n.name),s=Pf(process.cwd(),e),i=await Ef(s,"utf8"),c=JSON.parse(i),p=Te(c);if(!p.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:p.issues}));else console.error(be(p.issues));return{exitCode:1,validation:p}}if(p.issues.length>0&&r!=="json")console.error(be(p.issues));let l=q({apiKey:o,env:n}),h=t.watch?2:1,y="";for(let A=1;A<=h;A++){let x=await l.post("/render",c),z=x.response.id;if(y=z,!t.watch)return E(r,{id:z},z),{renderId:z,response:x.response};let v=await It(l,z,r,!0);if(v.status!=="failed")return{renderId:z,response:v,exitCode:0};let N=Cf(v.error);if(N&&A<h){if(r!=="json")console.error(`⚠ render failed (${v.error??"unknown"}) — looks transient, resubmitting ${A+1}/${h}…`);await Nf(2000);continue}if(r!=="json")console.error(N?`✗ render still failing after ${h} attempts. For a complex multi-scene edit, preview it client-side first: shotstack studio ${e}`:`✗ render failed: ${v.error??"unknown error"}`);return{renderId:z,response:v,exitCode:1}}return{renderId:y,exitCode:1}})}),Rf=/temporar|try again|time ?d? ?out|timeout|too many requests|service unavailable|unavailable|throttl/i;function Cf(e){return typeof e==="string"&&Rf.test(e)}function Nf(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as Tf,writeFile as If,mkdtemp as jf}from"node:fs/promises";import{tmpdir as Ff}from"node:os";import{join as Aa}from"node:path";import{spawn as Df}from"node:child_process";var wa="https://github.com/shotstack/shotstack-cli/issues/new?template=bug.yml",Lf=6000,Za=5,Oa=new F("feedback").description("Open a pre-filled GitHub issue with a flight-recorder dossier from your last 5 invocations").action(async()=>{let e=await Uf(Za),t=Mf(e),r=Vf(e),n=`&title=${encodeURIComponent(r)}`,o=`${wa}${n}&body=${encodeURIComponent(t)}`;if(o.length<=Lf){ka(o),console.log("Opened browser with pre-filled issue. Review before submitting.");return}let s=await jf(Aa(Ff(),"shotstack-feedback-")),i=Aa(s,"dossier.md");await If(i,t),ka(`${wa}${n}`),console.log(`Dossier too large to inline. Saved to: ${i}`),console.log("Drag the file into the issue body, or paste its contents.")});async function Uf(e){let t=Ye(),r;try{r=await Tf(t,"utf8")}catch{return[]}let o=r.split(`
90
+ `).filter((i)=>i.trim().length>0).slice(-e).reverse(),s=[];for(let i of o)try{s.push(JSON.parse(i))}catch{}return s}function Mf(e){let t=[];if(t.push("## Environment"),t.push(`- Shotstack CLI: ${Fe}`),t.push(`- OS: ${process.platform}-${process.arch}`),t.push(""),t.push(`## Last ${Za} invocations (most recent first)`),t.push(""),e.length===0)t.push("_No recorded invocations._");else for(let r of e){let n=(r.args??[]).join(" "),o=`### ${r.ts} — shotstack ${r.cmd}${n?" "+n:""}`;if(t.push(o),t.push(`- Exit: ${r.exit} Duration: ${r.durationMs}ms`),r.renderId)t.push(`- Render ID: ${r.renderId}`);if(r.response!==void 0){let s=typeof r.response==="string"?r.response:JSON.stringify(r.response);t.push(`- Response: ${s}`)}if(r.error)t.push(`- Error: ${r.error.name}: ${r.error.message}`);t.push("")}return t.push(`[full log at ${Ye()}]`),t.push(""),t.push("## What I expected vs what happened"),t.push("<!-- Describe the issue, request, or question here. -->"),t.join(`
91
+ `)}var za=80,vf="Feedback from shotstack CLI";function Vf(e){let t=e.find((o)=>o.error);if(t&&t.error)return yr(`${t.cmd}: ${t.error.name} — ${t.error.message}`);let r=e.find((o)=>Sa(o.response)!==null);if(r){let o=Sa(r.response);return yr(`Render failed: ${o}`)}let n=e.find((o)=>o.exit!==0);if(n)return yr(`${n.cmd} exited ${n.exit}`);return vf}function Sa(e){if(!e||typeof e!=="object"||Array.isArray(e))return null;let t=e;if(t.state!=="failed")return null;return typeof t.error==="string"&&t.error.length>0?t.error:"unknown error"}function yr(e){return e.length<=za?e:e.slice(0,za-1)+"…"}function ka(e){let t=process.platform==="win32",r=process.platform==="darwin"?"open":t?"cmd":"xdg-open",o=Df(r,t?["/c","start","",e]:[e],{stdio:"ignore",detached:!0});o.on("error",()=>{console.error(`Could not open browser. Visit: ${e}`)}),o.unref()}import{readFile as qf}from"node:fs/promises";import{resolve as Jf}from"node:path";import{spawn as Pa,execSync as Bf}from"node:child_process";var Ra="https://shotstack.studio",Hf=`${Ra}/api/share`,Gf=5000,Kf=6000,Ca=new F("studio").description("Open the Edit JSON in the shotstack.studio web editor. By default, posts the JSON to the share API and returns a short URL.").argument("<file>","Path to a Shotstack Edit JSON file").option("--copy","Copy the URL to the clipboard").option("--no-open","Do not try to open the URL in a browser").option("--no-shorten","Skip the share API; emit a base64url URL inline").option("--env <name>",`Environment whose API key makes the short link permanent: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{let r=C(t.output),n=Jf(process.cwd(),e),o=await qf(n,"utf8"),s=JSON.parse(o),i=Te(s);if(!i.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:i.issues}));else console.error(be(i.issues));process.exit(1)}let c=t.shorten?Yf(t.env):void 0,{url:p,shortened:l}=await Wf(s,{shorten:t.shorten,apiKey:c,env:t.shorten?me(t.env):void 0});if(!l&&p.length>Kf)console.error(`warning: encoded URL is ${p.length} characters; large templates may exceed browser URL limits.`);if(t.copy)await ed(p);let h=t.open&&od()&&rd(p);if(r==="json"||!h)E(r,{url:p,shortened:l},p)});async function Wf(e,t={}){if(t.shorten!==!1){let n=await Xf(e,t.apiKey);if("url"in n){if(!t.apiKey)console.error(t.env==="dev"?"note: this link lasts 30 days. Dev keys can't make links permanent; use --env stage or --env v1.":"note: this link lasts 30 days. Run `shotstack login` or set SHOTSTACK_API_KEY to make your links permanent.");return{url:n.url,shortened:!0}}console.error(`warning: the shotstack.studio share API failed (${n.failed}); falling back to inline URL.`)}return{url:Qf(e),shortened:!1}}function Yf(e,t){let r=me(e);if(r==="dev")return;try{return U(r,t)}catch(n){if(n instanceof ue)return;throw n}}function Qf(e){let t=Buffer.from(JSON.stringify(e),"utf8").toString("base64url");return`${Ra}/#json=${t}`}async function Xf(e,t){let r={"Content-Type":"application/json"};if(t)r["x-api-key"]=t;let n=await Ea(e,r);return"retry"in n&&n.retry?Ea(e,r):n}async function Ea(e,t){let r;try{r=await fetch(Hf,{method:"POST",headers:t,body:JSON.stringify(e),redirect:"error",signal:AbortSignal.timeout(Gf)})}catch(o){return{failed:o.message,retry:!0}}let n=await r.json().catch(()=>({}));if(r.ok&&n.url)return{url:n.url};if(r.status===429||r.status>=500)return{failed:`HTTP ${r.status}`,retry:!0};if(r.status>=400){let o=`${n.error??"no reason given"} (HTTP ${r.status})`;throw new ee(r.status,n,`The shotstack.studio share API refused the request: ${o}`)}return{failed:`HTTP ${r.status} without a url`,retry:!1}}async function ed(e){let{cmd:t,args:r}=td();await new Promise((n,o)=>{let s=Pa(t,r,{stdio:["pipe","ignore","ignore"]});s.on("error",o),s.on("exit",(i)=>i===0?n():o(Error(`${t} exited ${i}`))),s.stdin.end(e)})}function td(){if(process.platform==="darwin")return{cmd:"pbcopy",args:[]};if(process.platform==="win32")return{cmd:"clip",args:[]};return{cmd:"xclip",args:["-selection","clipboard"]}}function rd(e){let{cmd:t,args:r}=nd(e);try{let n=Pa(t,r,{detached:!0,stdio:"ignore"});return n.on("error",()=>{}),n.unref(),!0}catch{return!1}}function nd(e){if(process.platform==="win32")return{cmd:"cmd",args:["/c","start","",e]};if(process.platform==="darwin")return{cmd:"open",args:[e]};return{cmd:"xdg-open",args:[e]}}function od(){if(process.platform==="darwin"||process.platform==="win32")return!0;if(!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY)return!1;try{return Bf("command -v xdg-open",{stdio:"ignore"}),!0}catch{return!1}}import{readFile as sd}from"node:fs/promises";import{resolve as id,extname as ad}from"node:path";var ud=3000,cd=new Set(["ready","failed","deleted","overwritten"]),$e=new F("ingest").description("Ingest source media via the Shotstack Ingest API: upload local files, fetch remote URLs, and manage stored sources");$e.command("upload <file>").description("Upload a local file and host it on Shotstack for use as an Edit asset src").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--watch","Poll until the source is ready, then print its hosted URL").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("ingest upload",H("upload"),async()=>{let r=C(t.output),n=J(t.env,"ingest"),o=U(n.name),s=q({apiKey:o,env:n}),i=await sd(id(process.cwd(),e)),c=await s.post("/upload"),{id:p,url:l}=c.data.attributes;return await pd(l,i,fd(e)),Na(s,p,r,t.watch===!0)})});$e.command("fetch <url>").description("Ingest a remote URL into Shotstack-hosted storage").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--watch","Poll until the source is ready, then print its hosted URL").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("ingest fetch",H("fetch"),async()=>{let r=C(t.output),n=J(t.env,"ingest"),o=U(n.name),s=q({apiKey:o,env:n}),i=await s.post("/sources",{url:e});return Na(s,i.data.id,r,t.watch===!0)})});$e.command("status <id>").description("Poll the status of an ingested source").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--watch","Poll continuously until the source reaches a terminal state").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("ingest status",H("status"),async()=>{let r=C(t.output),n=J(t.env,"ingest"),o=U(n.name),s=q({apiKey:o,env:n}),i=await Ta(s,e,r,t.watch===!0);return{renderId:i.id,response:yt(i),exitCode:i.status==="failed"?1:0}})});$e.command("list").description("List ingested sources").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await B("ingest list",H("list"),async()=>{let t=C(e.output),r=J(e.env,"ingest"),n=U(r.name),i=(await q({apiKey:n,env:r}).get("/sources")).data.map((p)=>yt(p.attributes)),c=i.length?i.map((p)=>[p.id,p.status,p.source??""].join(" ").trimEnd()).join(`
92
+ `):"No sources.";return E(t,i,c),{response:{count:i.length}}})});$e.command("delete <id>").description("Delete an ingested source").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("ingest delete",H("delete"),async()=>{let r=C(t.output),n=J(t.env,"ingest"),o=U(n.name);return await q({apiKey:o,env:n}).del(`/sources/${encodeURIComponent(e)}`),E(r,{id:e,deleted:!0},`deleted ${e}`),{renderId:e,response:{id:e,deleted:!0}}})});async function Na(e,t,r,n){if(!n)return E(r,{id:t},t),{renderId:t,response:{id:t}};let o=await Ta(e,t,r,!0);return{renderId:t,response:yt(o),exitCode:o.status==="failed"?1:0}}async function Ta(e,t,r,n,o=ud){while(!0){let i=(await e.get(`/sources/${encodeURIComponent(t)}`)).data.attributes;if(E(r,yt(i),dd(i)),!n||cd.has(i.status))return i;await md(o)}}async function pd(e,t,r){let n=await fetch(e,{method:"PUT",headers:r?{"content-type":r}:void 0,body:t});if(!n.ok){let o=await n.text().catch(()=>"");throw new ee(n.status,o||void 0,`PUT upload → ${n.status} ${n.statusText}`)}}var ld={".mp4":"video/mp4",".webm":"video/webm",".mov":"video/quicktime",".avi":"video/x-msvideo",".mkv":"video/x-matroska",".ogv":"video/ogg",".wmv":"video/x-ms-wmv",".gif":"image/gif",".mp3":"audio/mpeg",".wav":"audio/wav",".m4a":"audio/mp4",".aac":"audio/aac",".ogg":"audio/ogg",".flac":"audio/flac",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp",".avif":"image/avif",".tif":"image/tiff",".tiff":"image/tiff",".svg":"image/svg+xml",".srt":"application/x-subrip",".vtt":"text/vtt",".ttf":"font/ttf",".otf":"font/otf",".woff":"font/woff",".woff2":"font/woff2"};function fd(e){return ld[ad(e).toLowerCase()]}function yt(e){let t={id:e.id,status:e.status};if(e.source)t.source=e.source;if(e.input)t.input=e.input;if(e.width)t.width=e.width;if(e.height)t.height=e.height;if(e.duration)t.duration=e.duration;if(e.error)t.error=e.error;return t}function dd(e){let t=[e.status];if(e.source)t.push(e.source);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function md(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as hd}from"node:fs/promises";import{resolve as gd}from"node:path";async function _d(e,t){return(await e.get(`/templates/${encodeURIComponent(t)}`)).response}async function xd(e){return(await e.get("/templates")).response.templates}async function yd(e,t,r){return(await e.post("/templates",{name:t,template:r})).response.id}async function bd(e,t,r,n){let o={template:r};if(n)o.name=n;await e.put(`/templates/${encodeURIComponent(t)}`,o)}async function $d(e,t){await e.del(`/templates/${encodeURIComponent(t)}`)}async function Ia(e){let t=await hd(gd(process.cwd(),e),"utf8");return JSON.parse(t)}var Ae=new F("template").description("Work with saved Shotstack templates");Ae.command("get <id>").description("Fetch a saved template's Edit JSON by id — pipe it to a file or `shotstack render`").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("template get",H("get"),async()=>{let r=C(t.output),n=J(t.env),o=U(n.name),s=q({apiKey:o,env:n}),i=await _d(s,e);return E(r,i.template,JSON.stringify(i.template,null,2)),{templateId:i.id,exitCode:0}})});Ae.command("list").description("List your saved templates (id and name), newest first").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await B("template list",H("list"),async()=>{let t=C(e.output),r=J(e.env),n=U(r.name),o=q({apiKey:n,env:r}),s=await xd(o),i=s.length?s.map((c)=>`${c.id} ${c.name??""}`.trimEnd()).join(`
93
+ `):"No templates found";return E(t,s,i),{count:s.length,exitCode:0}})});Ae.command("create <file>").description("Save an Edit JSON file as a new template; prints the new template id").requiredOption("--name <name>","Name for the saved template").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("template create",H("create"),async()=>{let r=C(t.output),n=J(t.env),o=U(n.name),s=q({apiKey:o,env:n}),i=await Ia(e),c=await yd(s,t.name,i);return E(r,{id:c},c),{templateId:c,exitCode:0}})});Ae.command("update <id> <file>").description("Overwrite a saved template with an Edit JSON file").option("--name <name>","Also rename the template").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await B("template update",H("update"),async()=>{let n=C(r.output),o=J(r.env),s=U(o.name),i=q({apiKey:s,env:o}),c=await Ia(t);return await bd(i,e,c,r.name),E(n,{id:e,status:"updated"},`updated ${e}`),{templateId:e,exitCode:0}})});Ae.command("delete <id>").description("Delete a saved template").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("template delete",H("delete"),async()=>{let r=C(t.output),n=J(t.env),o=U(n.name),s=q({apiKey:o,env:n});return await $d(s,e),E(r,{id:e,status:"deleted"},`deleted ${e}`),{templateId:e,exitCode:0}})});import{readFile as Ad}from"node:fs/promises";import{resolve as wd}from"node:path";var ja=new F("validate").description("Validate an Edit JSON offline — schema (property names, enums, types) plus "+"same-track overlaps, unloaded fonts, non-public asset URLs and html5 JS syntax errors. No API key, no credits.").argument("<file>","Path to a Shotstack Edit JSON file").option("--strict","Treat warnings as errors (exit 1 on any warning)").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{let r=C(t.output),n=wd(process.cwd(),e),o=await Ad(n,"utf8"),s;try{s=JSON.parse(o)}catch(l){let h=l instanceof Error?l.message:String(l),y={path:"<root>",code:"invalid_json",level:"error",message:h};if(r==="json")console.log(JSON.stringify({ok:!1,issues:[y]}));else console.error(`✗ ${e}: invalid JSON — ${h}`);process.exitCode=1;return}let i=Te(s),c=i.issues.some((l)=>l.level==="warning"),p=!i.ok||t.strict===!0&&c;if(r==="json")console.log(JSON.stringify({ok:!p,issues:i.issues}));else if(i.issues.length===0)console.log(`✓ ${e} is valid`);else{let l=be(i.issues);if(p)console.error(l);else console.log(l)}process.exitCode=p?1:0});async function zd(e){return(await e.get("/models")).models}async function bt(e,t){return e.get(`/models/${encodeURIComponent(t)}`)}var Fa=new F("models").description("List generation models with availability, or show one model's options").argument("[id]","Model id; prints the JSON Schema for its options").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("models",H("models"),async()=>{let r=C(t.output),n=J(t.env),o=U(n.name),s=q({apiKey:o,env:n});if(e){let c=await bt(s,e);return E(r,c,kd(c)),{response:{model:c.model,available:c.available}}}let i=await zd(s);return E(r,i,i.length?Sd(i):"No models."),{response:{count:i.length}}})});function $t(e){if(e.available===!0)return"available";if(e.available===!1)return`unavailable: ${e.unavailableReason??"no reason given"}`;return"availability unknown"}function Sd(e){let t=e.map((n)=>[n.model,n.type,$t(n)]),r=t[0].map((n,o)=>Math.max(...t.map((s)=>s[o].length)));return t.map((n)=>n.map((o,s)=>o.padEnd(r[s])).join(" ").trimEnd()).join(`
94
+ `)}function kd(e){let t=[`${e.model} ${e.type} ${$t(e)}`];if(e.name)t.push(e.description?`${e.name}: ${e.description}`:e.name);if(e.options)t.push("Options:",JSON.stringify(e.options,null,2));return t.join(`
95
+ `)}var Da=new Set(["done","failed"]),La=3000,Ua=new F("generate").description("Generate one image, video or audio asset from a prompt").argument("<model>","Model id from `shotstack models`").argument("<prompt>","Text prompt; for a speech model, the words to speak").option("--options <json>","Model options as a JSON object (see `shotstack models <model>`)",Rd).option("--length <seconds>","Length of the clip the asset fills; models that generate to a duration use it",Cd).option("--watch","Poll until the asset is ready, then print its URL").option("--quote","Print the credits this exact request would cost, without generating or charging").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await B("generate",H("generate"),async()=>{let n=C(r.output),o=J(r.env),s=U(o.name),i=q({apiKey:s,env:o}),c={model:e,prompt:t,options:r.options,length:r.length};if(r.quote)return Od(i,c,n);return Zd(i,c,n,r.watch===!0)})});async function Zd(e,t,r,n,o=La){let s=await bt(e,t.model);if(s.available===!1){let p={model:s.model,available:!1,unavailableReason:s.unavailableReason};if(r==="json")console.log(JSON.stringify(p));else console.error(`✗ ${s.model} is ${$t(s)}`);return{response:p,exitCode:1}}let i=await e.post("/generate",Ma(s,t));E(r,i,va(i));let c=i;if(!Da.has(i.status)){if(n)c=await Pd(e,i.id,r,o);else if(r!=="json")console.error("Still generating. Run the same command with --watch to wait; the same request returns this job instead of starting another.")}return{renderId:c.id,response:c,exitCode:c.status==="failed"?1:0}}async function Od(e,t,r){let n=await bt(e,t.model),o=await e.post("/generate/quote",Ma(n,t));return E(r,o,Ed(o)),{response:o}}function Ed(e){return`${e.ceiling?"up to ":""}${e.credits} ${e.credits===1?"credit":"credits"}`}function Ma(e,t){return{asset:{type:e.type,prompt:t.prompt,model:e.model,...t.options&&{options:t.options}},...t.length!==void 0&&{length:t.length}}}async function Pd(e,t,r,n=La){while(!0){await Nd(n);let o=await e.get(`/generate/${encodeURIComponent(t)}`);if(E(r,o,va(o)),Da.has(o.status))return o}}function Rd(e){let t;try{t=JSON.parse(e)}catch{throw new We("Not valid JSON.")}if(t===null||typeof t!=="object"||Array.isArray(t))throw new We("Expected a JSON object.");return t}function Cd(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new We("Expected a positive number of seconds.");return t}function va(e){if(e.status==="done")return`done ${e.url??""}`.trimEnd();if(e.status==="failed")return`failed error: ${e.error??"unknown error"}`;return`${e.status} ${e.id}`}function Nd(e){return new Promise((t)=>setTimeout(t,e))}var Td=new Set(["done","failed"]),Id=3000,qa=new F("analyze").alias("analyse").description("Find a music track's tempo, beats, bars, drops and sections").argument("<src>","Public URL of an audio or video file; host a local file with `shotstack ingest upload` first").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("analyze",H("analyze"),async()=>{let r=C(t.output),n=J(t.env),o=q({apiKey:U(n.name),env:n});return jd(o,e,r)})});async function jd(e,t,r,n=Id){let o=await e.post("/generate",{asset:{type:"audio",model:"shotstack-music-analysis",src:t}});while(!Td.has(o.status)){if(r!=="json")console.error(`${o.status} ${o.id}`);await Dd(n),o=await e.get(`/generate/${encodeURIComponent(o.id)}`)}if(o.status==="failed")return E(r,o,`failed error: ${o.error??"unknown error"}`),{response:o,exitCode:1};if(!o.url)return Va(o,"analysis finished without a map URL");let s=await fetch(o.url);if(!s.ok)return Va(o,`could not fetch the analysis map (${s.status}) from ${o.url}`);let i=await s.json();if(E(r,i,`done ${Fd(i)}`),r!=="json")console.error("Print the full map with --output json.");return{response:o,exitCode:0}}function Va(e,t){return console.error(t),{response:e,exitCode:1}}function Fd(e){let t=`${e.drops?.length??0} drops, ${e.sections?.length??0} sections`;if(!e.steady)return`tempo varies (about ${e.bpm} BPM): ${e.beats?.length??0} beats, ${e.downbeats?.length??0} downbeats, ${t}`;return`${e.bpm} BPM, ${e.meter}/4, bar ${e.bar?.toFixed(2)} s from ${e.origin?.toFixed(2)} s, ${e.bars?.count??0} bars, ${t}`}function Dd(e){return new Promise((t)=>setTimeout(t,e))}import{createInterface as Ld}from"node:readline";import{Writable as Ud}from"node:stream";var Ja=new F("login").description("Save your Shotstack API key so you don't have to set SHOTSTACK_API_KEY every session").option("--env <name>",`Environment the key belongs to: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=C(e.output),r=me(e.env),n=await Md();if(!n)console.error("No API key provided."),process.exit(1);await Wr(r,n);let o=ke();E(t,{env:r,stored:!0,path:o},`Saved API key for ${r} → ${o} (chmod 600).`)}),Ba=new F("logout").description("Remove a saved Shotstack API key").option("--env <name>",`Environment to forget: ${R.join(" | ")}`).option("--all","Remove saved keys for every environment").option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=C(e.output);if(e.all){await Qr(),E(t,{cleared:!0},"Removed all saved API keys.");return}let r=me(e.env),n=await Yr(r);E(t,{env:r,removed:n},n?`Removed saved API key for ${r}.`:`No saved API key for ${r}.`)});async function Md(){if(!process.stdin.isTTY){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}return vd("Shotstack API key: ")}function vd(e){return new Promise((t)=>{let r=!1,n=new Ud({write(s,i,c){if(!r)process.stdout.write(s);c()}}),o=Ld({input:process.stdin,output:n,terminal:!0});o.question(e,(s)=>{o.close(),process.stdout.write(`
96
+ `),t(s.trim())}),r=!0})}var Vd=new F().name("shotstack").description("Command-line interface for the Shotstack video rendering API").version(Fe).addCommand($a).addCommand(on).addCommand(Ca).addCommand($e).addCommand(Ae).addCommand(ja).addCommand(Fa).addCommand(Ua).addCommand(qa).addCommand(Ja).addCommand(Ba).addCommand(Oa);try{await Vd.parseAsync(process.argv)}catch(e){process.exit(qd(e))}function qd(e){if(e instanceof ue||e instanceof Ze)return console.error(e.message),1;if(e instanceof ee){if(console.error(e.message),e.body)console.error(typeof e.body==="string"?e.body:JSON.stringify(e.body));return e.isTransient?2:1}if(e instanceof Error){if("code"in e&&e.code==="ENOENT")return console.error(e.message),1;return console.error(e.message),2}return console.error(String(e)),2}