@doguyilmaz/tapster 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +66 -187
  2. package/dist/cli.js +643 -197
  3. package/package.json +30 -4
package/dist/cli.js CHANGED
@@ -1,177 +1,177 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var Hm=Object.defineProperty;var A=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Wm=(e)=>e;function Vm(e,t){this[e]=Wm.bind(null,t)}var ma=(e,t)=>{for(var r in t)Hm(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Vm.bind(t,r)})};var he=import.meta.require;var I=A(function(ng){var zs=Symbol.for("yaml.alias"),ga=Symbol.for("yaml.document"),Hr=Symbol.for("yaml.map"),ya=Symbol.for("yaml.pair"),Ls=Symbol.for("yaml.scalar"),Wr=Symbol.for("yaml.seq"),ze=Symbol.for("yaml.node.type"),Ym=(e)=>!!e&&typeof e==="object"&&e[ze]===zs,Jm=(e)=>!!e&&typeof e==="object"&&e[ze]===ga,Qm=(e)=>!!e&&typeof e==="object"&&e[ze]===Hr,Xm=(e)=>!!e&&typeof e==="object"&&e[ze]===ya,wa=(e)=>!!e&&typeof e==="object"&&e[ze]===Ls,eg=(e)=>!!e&&typeof e==="object"&&e[ze]===Wr;function ba(e){if(e&&typeof e==="object")switch(e[ze]){case Hr:case Wr:return!0}return!1}function tg(e){if(e&&typeof e==="object")switch(e[ze]){case zs:case Hr:case Ls:case Wr:return!0}return!1}var rg=(e)=>(wa(e)||ba(e))&&!!e.anchor;ng.ALIAS=zs;ng.DOC=ga;ng.MAP=Hr;ng.NODE_TYPE=ze;ng.PAIR=ya;ng.SCALAR=Ls;ng.SEQ=Wr;ng.hasAnchor=rg;ng.isAlias=Ym;ng.isCollection=ba;ng.isDocument=Jm;ng.isMap=Qm;ng.isNode=tg;ng.isPair=Xm;ng.isScalar=wa;ng.isSeq=eg});var Vt=A(function(_g){var W=I(),Q=Symbol("break visit"),_a=Symbol("skip children"),ve=Symbol("remove node");function Vr(e,t){let r=va(t);if(W.isDocument(e)){if(At(null,e.contents,r,Object.freeze([e]))===ve)e.contents=null}else At(null,e,r,Object.freeze([]))}Vr.BREAK=Q;Vr.SKIP=_a;Vr.REMOVE=ve;function At(e,t,r,n){let s=ka(e,t,r,n);if(W.isNode(s)||W.isPair(s))return xa(e,n,s),At(e,s,r,n);if(typeof s!=="symbol"){if(W.isCollection(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let i=At(o,t.items[o],r,n);if(typeof i==="number")o=i-1;else if(i===Q)return Q;else if(i===ve)t.items.splice(o,1),o-=1}}else if(W.isPair(t)){n=Object.freeze(n.concat(t));let o=At("key",t.key,r,n);if(o===Q)return Q;else if(o===ve)t.key=null;let i=At("value",t.value,r,n);if(i===Q)return Q;else if(i===ve)t.value=null}}return s}async function Yr(e,t){let r=va(t);if(W.isDocument(e)){if(await $t(null,e.contents,r,Object.freeze([e]))===ve)e.contents=null}else await $t(null,e,r,Object.freeze([]))}Yr.BREAK=Q;Yr.SKIP=_a;Yr.REMOVE=ve;async function $t(e,t,r,n){let s=await ka(e,t,r,n);if(W.isNode(s)||W.isPair(s))return xa(e,n,s),$t(e,s,r,n);if(typeof s!=="symbol"){if(W.isCollection(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let i=await $t(o,t.items[o],r,n);if(typeof i==="number")o=i-1;else if(i===Q)return Q;else if(i===ve)t.items.splice(o,1),o-=1}}else if(W.isPair(t)){n=Object.freeze(n.concat(t));let o=await $t("key",t.key,r,n);if(o===Q)return Q;else if(o===ve)t.key=null;let i=await $t("value",t.value,r,n);if(i===Q)return Q;else if(i===ve)t.value=null}}return s}function va(e){if(typeof e==="object"&&(e.Collection||e.Node||e.Value))return Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e);return e}function ka(e,t,r,n){if(typeof r==="function")return r(e,t,n);if(W.isMap(t))return r.Map?.(e,t,n);if(W.isSeq(t))return r.Seq?.(e,t,n);if(W.isPair(t))return r.Pair?.(e,t,n);if(W.isScalar(t))return r.Scalar?.(e,t,n);if(W.isAlias(t))return r.Alias?.(e,t,n);return}function xa(e,t,r){let n=t[t.length-1];if(W.isCollection(n))n.items[e]=r;else if(W.isPair(n))if(e==="key")n.key=r;else n.value=r;else if(W.isDocument(n))n.contents=r;else{let s=W.isAlias(n)?"alias":"scalar";throw Error(`Cannot replace node with ${s} parent`)}}_g.visit=Vr;_g.visitAsync=Yr});var Ds=A(function($g){var Sa=I(),xg=Vt(),Sg={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ag=(e)=>e.replace(/[!,[\]{}]/g,(t)=>Sg[t]);class ce{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},ce.defaultYaml,e),this.tags=Object.assign({},ce.defaultTags,t)}clone(){let e=new ce(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new ce(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:ce.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},ce.defaultTags);break}return e}add(e,t){if(this.atNextDocument)this.yaml={explicit:ce.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},ce.defaultTags),this.atNextDocument=!1;let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2){if(t(0,"%TAG directive should contain exactly two parts"),r.length<2)return!1}let[s,o]=r;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;else{let o=/^\d+\.\d+$/.test(s);return t(6,`Unsupported YAML version ${s}`,o),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);if(o==="!"||o==="!!")return t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null;if(e[e.length-1]!==">")t("Verbatim tags must end with a >");return o}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);if(!n)t(`The ${e} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(n)}catch(o){return t(String(o)),null}if(r==="!")return e;return t(`Could not resolve tag: ${e}`),null}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+Ag(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&Sa.isNode(e.contents)){let s={};xg.visit(e.contents,(o,i)=>{if(Sa.isNode(i)&&i.tag)s[i.tag]=!0}),n=Object.keys(s)}else n=[];for(let[s,o]of r){if(s==="!!"&&o==="tag:yaml.org,2002:")continue;if(!e||n.some((i)=>i.startsWith(o)))t.push(`%TAG ${s} ${o}`)}return t.join(`
4
- `)}}ce.defaultYaml={explicit:!1,version:"1.2"};ce.defaultTags={"!!":"tag:yaml.org,2002:"};$g.Directives=ce});var Jr=A(function(Ig){var Aa=I(),Eg=Vt();function Tg(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(r)}return!0}function $a(e){let t=new Set;return Eg.visit(e,{Value(r,n){if(n.anchor)t.add(n.anchor)}}),t}function Pa(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function Og(e,t){let r=[],n=new Map,s=null;return{onAnchor:(o)=>{r.push(o),s??(s=$a(e));let i=Pa(t,s);return s.add(i),i},setAnchors:()=>{for(let o of r){let i=n.get(o);if(typeof i==="object"&&i.anchor&&(Aa.isScalar(i.node)||Aa.isCollection(i.node)))i.node.anchor=i.anchor;else{let a=Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}Ig.anchorIsValid=Tg;Ig.anchorNames=$a;Ig.createNodeAnchors=Og;Ig.findNewAnchor=Pa});var js=A(function(Lg){function Yt(e,t,r,n){if(n&&typeof n==="object")if(Array.isArray(n))for(let s=0,o=n.length;s<o;++s){let i=n[s],a=Yt(e,n,String(s),i);if(a===void 0)delete n[s];else if(a!==i)n[s]=a}else if(n instanceof Map)for(let s of Array.from(n.keys())){let o=n.get(s),i=Yt(e,n,s,o);if(i===void 0)n.delete(s);else if(i!==o)n.set(s,i)}else if(n instanceof Set)for(let s of Array.from(n)){let o=Yt(e,n,s,s);if(o===void 0)n.delete(s);else if(o!==s)n.delete(s),n.add(o)}else for(let[s,o]of Object.entries(n)){let i=Yt(e,n,s,o);if(i===void 0)delete n[s];else if(i!==o)n[s]=i}return e.call(t,r,n)}Lg.applyReviver=Yt});var Be=A(function(Ug){var jg=I();function Ea(e,t,r){if(Array.isArray(e))return e.map((n,s)=>Ea(n,String(s),r));if(e&&typeof e.toJSON==="function"){if(!r||!jg.hasAnchor(e))return e.toJSON(t,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(e,n),r.onCreate=(o)=>{n.res=o,delete r.onCreate};let s=e.toJSON(t,r);if(r.onCreate)r.onCreate(s);return s}if(typeof e==="bigint"&&!r?.keep)return Number(e);return e}Ug.toJS=Ea});var Qr=A(function(Bg){var Mg=js(),Ta=I(),qg=Be();class Oa{constructor(e){Object.defineProperty(this,Ta.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)e.range=this.range.slice();return e}toJS(e,{mapAsMap:t,maxAliasCount:r,onAnchor:n,reviver:s}={}){if(!Ta.isDocument(e))throw TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r==="number"?r:100},i=qg.toJS(this,"",o);if(typeof n==="function")for(let{count:a,res:c}of o.anchors.values())n(c,a);return typeof s==="function"?Mg.applyReviver(s,{"":i},"",i):i}}Bg.NodeBase=Oa});var Jt=A(function(Vg){var Fg=Jr(),Gg=Vt(),Pt=I(),Hg=Qr(),Wg=Be();class Ia extends Hg.NodeBase{constructor(e){super(Pt.ALIAS);this.source=e,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let r;if(t?.aliasResolveCache)r=t.aliasResolveCache;else if(r=[],Gg.visit(e,{Node:(s,o)=>{if(Pt.isAlias(o)||Pt.hasAnchor(o))r.push(o)}}),t)t.aliasResolveCache=r;let n=void 0;for(let s of r){if(s===this)break;if(s.anchor===this.source)n=s}if(n&&t){let{anchors:s,doc:o,maxAliasCount:i}=t,a=s.get(n);if(!a)Wg.toJS(n,null,t),a=s.get(n);if(a?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(i>=0){if(a.count+=1,a.aliasCount===0)a.aliasCount=Xr(o,n,s);if(a.count*a.aliasCount>i)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}}return n}toJSON(e,t){if(!t)return{source:this.source};let r=this.resolve(t.doc,t);if(!r){let n=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(n)}return t.anchors.get(r).res}toString(e,t,r){let n=`*${this.source}`;if(e){if(Fg.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(s)}if(e.implicitKey)return`${n} `}return n}}function Xr(e,t,r){if(Pt.isAlias(t)){let n=t.resolve(e),s=r&&n&&r.get(n);return s?s.count*s.aliasCount:0}else if(Pt.isCollection(t)){let n=0;for(let s of t.items){let o=Xr(e,s,r);if(o>n)n=o}return n}else if(Pt.isPair(t)){let n=Xr(e,t.key,r),s=Xr(e,t.value,r);return Math.max(n,s)}return 1}Vg.Alias=Ia});var H=A(function(ty){var Jg=I(),Qg=Qr(),Xg=Be(),ey=(e)=>!e||typeof e!=="function"&&typeof e!=="object";class it extends Qg.NodeBase{constructor(e){super(Jg.SCALAR);this.value=e}toJSON(e,t){return t?.keep?this.value:Xg.toJS(this.value,e,t)}toString(){return String(this.value)}}it.BLOCK_FOLDED="BLOCK_FOLDED";it.BLOCK_LITERAL="BLOCK_LITERAL";it.PLAIN="PLAIN";it.QUOTE_DOUBLE="QUOTE_DOUBLE";it.QUOTE_SINGLE="QUOTE_SINGLE";ty.Scalar=it;ty.isScalarValue=ey});var Qt=A(function(cy){var sy=Jt(),at=I(),Na=H(),oy="tag:yaml.org,2002:";function iy(e,t,r){if(t){let n=r.filter((o)=>o.tag===t),s=n.find((o)=>!o.format)??n[0];if(!s)throw Error(`Tag ${t} not found`);return s}return r.find((n)=>n.identify?.(e)&&!n.format)}function ay(e,t,r){if(at.isDocument(e))e=e.contents;if(at.isNode(e))return e;if(at.isPair(e)){let f=r.schema[at.MAP].createNode?.(r.schema,null,r);return f.items.push(e),f}if(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)e=e.valueOf();let{aliasDuplicateObjects:n,onAnchor:s,onTagObj:o,schema:i,sourceObjects:a}=r,c=void 0;if(n&&e&&typeof e==="object")if(c=a.get(e),c)return c.anchor??(c.anchor=s(e)),new sy.Alias(c.anchor);else c={anchor:null,node:null},a.set(e,c);if(t?.startsWith("!!"))t=oy+t.slice(2);let u=iy(e,t,i.tags);if(!u){if(e&&typeof e.toJSON==="function")e=e.toJSON();if(!e||typeof e!=="object"){let f=new Na.Scalar(e);if(c)c.node=f;return f}u=e instanceof Map?i[at.MAP]:(Symbol.iterator in Object(e))?i[at.SEQ]:i[at.MAP]}if(o)o(u),delete r.onTagObj;let l=u?.createNode?u.createNode(r.schema,e,r):typeof u?.nodeClass?.from==="function"?u.nodeClass.from(r.schema,e,r):new Na.Scalar(e);if(t)l.tag=t;else if(!u.default)l.tag=u.tag;if(c)c.node=l;return l}cy.createNode=ay});var en=A(function(fy){var ly=Qt(),ke=I(),py=Qr();function Us(e,t,r){let n=r;for(let s=t.length-1;s>=0;--s){let o=t[s];if(typeof o==="number"&&Number.isInteger(o)&&o>=0){let i=[];i[o]=n,n=i}else n=new Map([[o,n]])}return ly.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Ra=(e)=>e==null||typeof e==="object"&&!!e[Symbol.iterator]().next().done;class Ca extends py.NodeBase{constructor(e,t){super(e);Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(e)t.schema=e;if(t.items=t.items.map((r)=>ke.isNode(r)||ke.isPair(r)?r.clone(e):r),this.range)t.range=this.range.slice();return t}addIn(e,t){if(Ra(e))this.add(t);else{let[r,...n]=e,s=this.get(r,!0);if(ke.isCollection(s))s.addIn(n,t);else if(s===void 0&&this.schema)this.set(r,Us(this.schema,n,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let n=this.get(t,!0);if(ke.isCollection(n))return n.deleteIn(r);else throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...n]=e,s=this.get(r,!0);if(n.length===0)return!t&&ke.isScalar(s)?s.value:s;else return ke.isCollection(s)?s.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every((t)=>{if(!ke.isPair(t))return!1;let r=t.value;return r==null||e&&ke.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let n=this.get(t,!0);return ke.isCollection(n)?n.hasIn(r):!1}setIn(e,t){let[r,...n]=e;if(n.length===0)this.set(r,t);else{let s=this.get(r,!0);if(ke.isCollection(s))s.setIn(n,t);else if(s===void 0&&this.schema)this.set(r,Us(this.schema,n,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}}fy.Collection=Ca;fy.collectionFromPath=Us;fy.isEmptyPath=Ra});var Xt=A(function(wy){var gy=(e)=>e.replace(/^(?!$)(?: $)?/gm,"#");function Zs(e,t){if(/^\n+$/.test(e))return e.substring(1);return t?e.replace(/^(?! *$)/gm,t):e}var yy=(e,t,r)=>e.endsWith(`
5
- `)?Zs(r,t):r.includes(`
3
+ var Uy=Object.defineProperty;var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Zy=(e)=>e;function Gy(e,t){this[e]=Zy.bind(null,t)}var wl=(e,t)=>{for(var n in t)Uy(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Gy.bind(t,n)})};var Oe=import.meta.require;var N=P(function(Yy){var Fo=Symbol.for("yaml.alias"),_l=Symbol.for("yaml.document"),Nr=Symbol.for("yaml.map"),kl=Symbol.for("yaml.pair"),Ko=Symbol.for("yaml.scalar"),zr=Symbol.for("yaml.seq"),Je=Symbol.for("yaml.node.type"),qy=(e)=>!!e&&typeof e==="object"&&e[Je]===Fo,By=(e)=>!!e&&typeof e==="object"&&e[Je]===_l,Hy=(e)=>!!e&&typeof e==="object"&&e[Je]===Nr,Fy=(e)=>!!e&&typeof e==="object"&&e[Je]===kl,xl=(e)=>!!e&&typeof e==="object"&&e[Je]===Ko,Ky=(e)=>!!e&&typeof e==="object"&&e[Je]===zr;function Sl(e){if(e&&typeof e==="object")switch(e[Je]){case Nr:case zr:return!0}return!1}function Wy(e){if(e&&typeof e==="object")switch(e[Je]){case Fo:case Nr:case Ko:case zr:return!0}return!1}var Vy=(e)=>(xl(e)||Sl(e))&&!!e.anchor;Yy.ALIAS=Fo;Yy.DOC=_l;Yy.MAP=Nr;Yy.NODE_TYPE=Je;Yy.PAIR=kl;Yy.SCALAR=Ko;Yy.SEQ=zr;Yy.hasAnchor=Vy;Yy.isAlias=qy;Yy.isCollection=Sl;Yy.isDocument=By;Yy.isMap=Hy;Yy.isNode=Wy;Yy.isPair=Fy;Yy.isScalar=xl;Yy.isSeq=Ky});var An=P(function(hb){var V=N(),he=Symbol("break visit"),Al=Symbol("skip children"),Le=Symbol("remove node");function Dr(e,t){let n=$l(t);if(V.isDocument(e)){if(Ft(null,e.contents,n,Object.freeze([e]))===Le)e.contents=null}else Ft(null,e,n,Object.freeze([]))}Dr.BREAK=he;Dr.SKIP=Al;Dr.REMOVE=Le;function Ft(e,t,n,r){let i=Pl(e,t,n,r);if(V.isNode(i)||V.isPair(i))return Tl(e,r,i),Ft(e,i,n,r);if(typeof i!=="symbol"){if(V.isCollection(t)){r=Object.freeze(r.concat(t));for(let o=0;o<t.items.length;++o){let s=Ft(o,t.items[o],n,r);if(typeof s==="number")o=s-1;else if(s===he)return he;else if(s===Le)t.items.splice(o,1),o-=1}}else if(V.isPair(t)){r=Object.freeze(r.concat(t));let o=Ft("key",t.key,n,r);if(o===he)return he;else if(o===Le)t.key=null;let s=Ft("value",t.value,n,r);if(s===he)return he;else if(s===Le)t.value=null}}return i}async function Lr(e,t){let n=$l(t);if(V.isDocument(e)){if(await Kt(null,e.contents,n,Object.freeze([e]))===Le)e.contents=null}else await Kt(null,e,n,Object.freeze([]))}Lr.BREAK=he;Lr.SKIP=Al;Lr.REMOVE=Le;async function Kt(e,t,n,r){let i=await Pl(e,t,n,r);if(V.isNode(i)||V.isPair(i))return Tl(e,r,i),Kt(e,i,n,r);if(typeof i!=="symbol"){if(V.isCollection(t)){r=Object.freeze(r.concat(t));for(let o=0;o<t.items.length;++o){let s=await Kt(o,t.items[o],n,r);if(typeof s==="number")o=s-1;else if(s===he)return he;else if(s===Le)t.items.splice(o,1),o-=1}}else if(V.isPair(t)){r=Object.freeze(r.concat(t));let o=await Kt("key",t.key,n,r);if(o===he)return he;else if(o===Le)t.key=null;let s=await Kt("value",t.value,n,r);if(s===he)return he;else if(s===Le)t.value=null}}return i}function $l(e){if(typeof e==="object"&&(e.Collection||e.Node||e.Value))return Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e);return e}function Pl(e,t,n,r){if(typeof n==="function")return n(e,t,r);if(V.isMap(t))return n.Map?.(e,t,r);if(V.isSeq(t))return n.Seq?.(e,t,r);if(V.isPair(t))return n.Pair?.(e,t,r);if(V.isScalar(t))return n.Scalar?.(e,t,r);if(V.isAlias(t))return n.Alias?.(e,t,r);return}function Tl(e,t,n){let r=t[t.length-1];if(V.isCollection(r))r.items[e]=n;else if(V.isPair(r))if(e==="key")r.key=n;else r.value=n;else if(V.isDocument(r))r.contents=n;else{let i=V.isAlias(r)?"alias":"scalar";throw Error(`Cannot replace node with ${i} parent`)}}hb.visit=Dr;hb.visitAsync=Lr});var Wo=P(function(bb){var El=N(),gb=An(),vb={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},yb=(e)=>e.replace(/[!,[\]{}]/g,(t)=>vb[t]);class xe{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},xe.defaultYaml,e),this.tags=Object.assign({},xe.defaultTags,t)}clone(){let e=new xe(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new xe(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:xe.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},xe.defaultTags);break}return e}add(e,t){if(this.atNextDocument)this.yaml={explicit:xe.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},xe.defaultTags),this.atNextDocument=!1;let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2){if(t(0,"%TAG directive should contain exactly two parts"),n.length<2)return!1}let[i,o]=n;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=n;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;else{let o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);if(o==="!"||o==="!!")return t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null;if(e[e.length-1]!==">")t("Verbatim tags must end with a >");return o}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);if(!r)t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(o){return t(String(o)),null}if(n==="!")return e;return t(`Could not resolve tag: ${e}`),null}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+yb(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&El.isNode(e.contents)){let i={};gb.visit(e.contents,(o,s)=>{if(El.isNode(s)&&s.tag)i[s.tag]=!0}),r=Object.keys(i)}else r=[];for(let[i,o]of n){if(i==="!!"&&o==="tag:yaml.org,2002:")continue;if(!e||r.some((s)=>s.startsWith(o)))t.push(`%TAG ${i} ${o}`)}return t.join(`
4
+ `)}}xe.defaultYaml={explicit:!1,version:"1.2"};xe.defaultTags={"!!":"tag:yaml.org,2002:"};bb.Directives=xe});var jr=P(function(Sb){var Ol=N(),_b=An();function kb(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(n)}return!0}function Cl(e){let t=new Set;return _b.visit(e,{Value(n,r){if(r.anchor)t.add(r.anchor)}}),t}function Rl(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function xb(e,t){let n=[],r=new Map,i=null;return{onAnchor:(o)=>{n.push(o),i??(i=Cl(e));let s=Rl(t,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s==="object"&&s.anchor&&(Ol.isScalar(s.node)||Ol.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}Sb.anchorIsValid=kb;Sb.anchorNames=Cl;Sb.createNodeAnchors=xb;Sb.findNewAnchor=Rl});var Vo=P(function(Eb){function $n(e,t,n,r){if(r&&typeof r==="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=$n(e,r,String(i),s);if(a===void 0)delete r[i];else if(a!==s)r[i]=a}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=$n(e,r,i,o);if(s===void 0)r.delete(i);else if(s!==o)r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=$n(e,r,i,i);if(o===void 0)r.delete(i);else if(o!==i)r.delete(i),r.add(o)}else for(let[i,o]of Object.entries(r)){let s=$n(e,r,i,o);if(s===void 0)delete r[i];else if(s!==o)r[i]=s}return e.call(t,n,r)}Eb.applyReviver=$n});var ct=P(function(Rb){var Cb=N();function Il(e,t,n){if(Array.isArray(e))return e.map((r,i)=>Il(r,String(i),n));if(e&&typeof e.toJSON==="function"){if(!n||!Cb.hasAnchor(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=(o)=>{r.res=o,delete n.onCreate};let i=e.toJSON(t,n);if(n.onCreate)n.onCreate(i);return i}if(typeof e==="bigint"&&!n?.keep)return Number(e);return e}Rb.toJS=Il});var Mr=P(function(Db){var Nb=Vo(),Nl=N(),zb=ct();class zl{constructor(e){Object.defineProperty(this,Nl.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)e.range=this.range.slice();return e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Nl.isDocument(e))throw TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==="number"?n:100},s=zb.toJS(this,"",o);if(typeof r==="function")for(let{count:a,res:c}of o.anchors.values())r(c,a);return typeof i==="function"?Nb.applyReviver(i,{"":s},"",s):s}}Db.NodeBase=zl});var Pn=P(function(Gb){var jb=jr(),Mb=An(),Wt=N(),Ub=Mr(),Zb=ct();class Dl extends Ub.NodeBase{constructor(e){super(Wt.ALIAS);this.source=e,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let n;if(t?.aliasResolveCache)n=t.aliasResolveCache;else if(n=[],Mb.visit(e,{Node:(i,o)=>{if(Wt.isAlias(o)||Wt.hasAnchor(o))n.push(o)}}),t)t.aliasResolveCache=n;let r=void 0;for(let i of n){if(i===this)break;if(i.anchor===this.source)r=i}if(r&&t){let{anchors:i,doc:o,maxAliasCount:s}=t,a=i.get(r);if(!a)Zb.toJS(r,null,t),a=i.get(r);if(a?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(s>=0){if(a.count+=1,a.aliasCount===0)a.aliasCount=Ur(o,r,i);if(a.count*a.aliasCount>s)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(r)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(jb.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(i)}if(e.implicitKey)return`${r} `}return r}}function Ur(e,t,n){if(Wt.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Wt.isCollection(t)){let r=0;for(let i of t.items){let o=Ur(e,i,n);if(o>r)r=o}return r}else if(Wt.isPair(t)){let r=Ur(e,t.key,n),i=Ur(e,t.value,n);return Math.max(r,i)}return 1}Gb.Alias=Dl});var W=P(function(Wb){var Bb=N(),Hb=Mr(),Fb=ct(),Kb=(e)=>!e||typeof e!=="function"&&typeof e!=="object";class At extends Hb.NodeBase{constructor(e){super(Bb.SCALAR);this.value=e}toJSON(e,t){return t?.keep?this.value:Fb.toJS(this.value,e,t)}toString(){return String(this.value)}}At.BLOCK_FOLDED="BLOCK_FOLDED";At.BLOCK_LITERAL="BLOCK_LITERAL";At.PLAIN="PLAIN";At.QUOTE_DOUBLE="QUOTE_DOUBLE";At.QUOTE_SINGLE="QUOTE_SINGLE";Wb.Scalar=At;Wb.isScalarValue=Kb});var Tn=P(function(tw){var Jb=Pn(),$t=N(),Ll=W(),Qb="tag:yaml.org,2002:";function Xb(e,t,n){if(t){let r=n.filter((o)=>o.tag===t),i=r.find((o)=>!o.format)??r[0];if(!i)throw Error(`Tag ${t} not found`);return i}return n.find((r)=>r.identify?.(e)&&!r.format)}function ew(e,t,n){if($t.isDocument(e))e=e.contents;if($t.isNode(e))return e;if($t.isPair(e)){let p=n.schema[$t.MAP].createNode?.(n.schema,null,n);return p.items.push(e),p}if(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)e=e.valueOf();let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,c=void 0;if(r&&e&&typeof e==="object")if(c=a.get(e),c)return c.anchor??(c.anchor=i(e)),new Jb.Alias(c.anchor);else c={anchor:null,node:null},a.set(e,c);if(t?.startsWith("!!"))t=Qb+t.slice(2);let l=Xb(e,t,s.tags);if(!l){if(e&&typeof e.toJSON==="function")e=e.toJSON();if(!e||typeof e!=="object"){let p=new Ll.Scalar(e);if(c)c.node=p;return p}l=e instanceof Map?s[$t.MAP]:(Symbol.iterator in Object(e))?s[$t.SEQ]:s[$t.MAP]}if(o)o(l),delete n.onTagObj;let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==="function"?l.nodeClass.from(n.schema,e,n):new Ll.Scalar(e);if(t)u.tag=t;else if(!l.default)u.tag=l.tag;if(c)c.node=u;return u}tw.createNode=ew});var Zr=P(function(ow){var rw=Tn(),je=N(),iw=Mr();function Yo(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){let o=t[i];if(typeof o==="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return rw.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var jl=(e)=>e==null||typeof e==="object"&&!!e[Symbol.iterator]().next().done;class Ml extends iw.NodeBase{constructor(e,t){super(e);Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(e)t.schema=e;if(t.items=t.items.map((n)=>je.isNode(n)||je.isPair(n)?n.clone(e):n),this.range)t.range=this.range.slice();return t}addIn(e,t){if(jl(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(je.isCollection(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Yo(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(je.isCollection(r))return r.deleteIn(n);else throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);if(r.length===0)return!t&&je.isScalar(i)?i.value:i;else return je.isCollection(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every((t)=>{if(!je.isPair(t))return!1;let n=t.value;return n==null||e&&je.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return je.isCollection(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let i=this.get(n,!0);if(je.isCollection(i))i.setIn(r,t);else if(i===void 0&&this.schema)this.set(n,Yo(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}}ow.Collection=Ml;ow.collectionFromPath=Yo;ow.isEmptyPath=jl});var En=P(function(pw){var lw=(e)=>e.replace(/^(?!$)(?: $)?/gm,"#");function Jo(e,t){if(/^\n+$/.test(e))return e.substring(1);return t?e.replace(/^(?! *$)/gm,t):e}var uw=(e,t,n)=>e.endsWith(`
5
+ `)?Jo(n,t):n.includes(`
6
6
  `)?`
7
- `+Zs(r,t):(e.endsWith(" ")?"":" ")+r;wy.indentComment=Zs;wy.lineComment=yy;wy.stringifyComment=gy});var La=A(function(xy){function ky(e,t,r="flow",{indentAtStart:n,lineWidth:s=80,minContentWidth:o=20,onFold:i,onOverflow:a}={}){if(!s||s<0)return e;if(s<o)o=0;let c=Math.max(1+o,1+s-t.length);if(e.length<=c)return e;let u=[],l={},f=s-t.length;if(typeof n==="number")if(n>s-Math.max(2,o))u.push(0);else f=s-n;let p=void 0,d=void 0,h=!1,m=-1,g=-1,_=-1;if(r==="block"){if(m=za(e,m,t.length),m!==-1)f=m+c}for(let x;x=e[m+=1];){if(r==="quoted"&&x==="\\"){switch(g=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}_=m}if(x===`
8
- `){if(r==="block")m=za(e,m,t.length);f=m+t.length+c,p=void 0}else{if(x===" "&&d&&d!==" "&&d!==`
9
- `&&d!=="\t"){let b=e[m+1];if(b&&b!==" "&&b!==`
10
- `&&b!=="\t")p=m}if(m>=f)if(p)u.push(p),f=p+c,p=void 0;else if(r==="quoted"){while(d===" "||d==="\t")d=x,x=e[m+=1],h=!0;let b=m>_+1?m-2:g-1;if(l[b])return e;u.push(b),l[b]=!0,f=b+c,p=void 0}else h=!0}d=x}if(h&&a)a();if(u.length===0)return e;if(i)i();let S=e.slice(0,u[0]);for(let x=0;x<u.length;++x){let b=u[x],v=u[x+1]||e.length;if(b===0)S=`
11
- ${t}${e.slice(0,v)}`;else{if(r==="quoted"&&l[b])S+=`${e[b]}\\`;S+=`
12
- ${t}${e.slice(b+1,v)}`}}return S}function za(e,t,r){let n=t,s=t+1,o=e[s];while(o===" "||o==="\t")if(t<s+r)o=e[++t];else{do o=e[++t];while(o&&o!==`
13
- `);n=t,s=t+1,o=e[s]}return n}xy.FOLD_BLOCK="block";xy.FOLD_FLOW="flow";xy.FOLD_QUOTED="quoted";xy.foldFlowLines=ky});var tr=A(function(Iy){var me=H(),Ke=La(),rn=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),nn=(e)=>/^(%|---|\.\.\.)/m.test(e);function Ey(e,t,r){if(!t||t<0)return!1;let n=t-r,s=e.length;if(s<=n)return!1;for(let o=0,i=0;o<s;++o)if(e[o]===`
14
- `){if(o-i>n)return!0;if(i=o+1,s-i<=n)return!1}return!0}function er(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=t,s=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(nn(e)?" ":""),i="",a=0;for(let c=0,u=r[c];u;u=r[++c]){if(u===" "&&r[c+1]==="\\"&&r[c+2]==="n")i+=r.slice(a,c)+"\\ ",c+=1,a=c,u="\\";if(u==="\\")switch(r[c+1]){case"u":{i+=r.slice(a,c);let l=r.substr(c+2,4);switch(l){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:if(l.substr(0,2)==="00")i+="\\x"+l.substr(2);else i+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<s)c+=1;else{i+=r.slice(a,c)+`
15
-
16
- `;while(r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"')i+=`
17
- `,c+=2;if(i+=o,r[c+2]===" ")i+="\\";c+=1,a=c+1}break;default:c+=1}}return i=a?i+r.slice(a):r,n?i:Ke.foldFlowLines(i,o,Ke.FOLD_QUOTED,rn(t,!1))}function Ms(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
18
- `)||/[ \t]\n|\n[ \t]/.test(e))return er(e,t);let r=t.indent||(nn(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
19
- ${r}`)+"'";return t.implicitKey?n:Ke.foldFlowLines(n,r,Ke.FOLD_FLOW,rn(t,!1))}function Et(e,t){let{singleQuote:r}=t.options,n;if(r===!1)n=er;else{let s=e.includes('"'),o=e.includes("'");if(s&&!o)n=Ms;else if(o&&!s)n=er;else n=r?Ms:er}return n(e,t)}var qs;try{qs=new RegExp(`(^|(?<!
7
+ `+Jo(n,t):(e.endsWith(" ")?"":" ")+n;pw.indentComment=Jo;pw.lineComment=uw;pw.stringifyComment=lw});var Zl=P(function(gw){function mw(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return e;if(i<o)o=0;let c=Math.max(1+o,1+i-t.length);if(e.length<=c)return e;let l=[],u={},p=i-t.length;if(typeof r==="number")if(r>i-Math.max(2,o))l.push(0);else p=i-r;let d=void 0,h=void 0,f=!1,m=-1,g=-1,w=-1;if(n==="block"){if(m=Ul(e,m,t.length),m!==-1)p=m+c}for(let _;_=e[m+=1];){if(n==="quoted"&&_==="\\"){switch(g=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}w=m}if(_===`
8
+ `){if(n==="block")m=Ul(e,m,t.length);p=m+t.length+c,d=void 0}else{if(_===" "&&h&&h!==" "&&h!==`
9
+ `&&h!=="\t"){let b=e[m+1];if(b&&b!==" "&&b!==`
10
+ `&&b!=="\t")d=m}if(m>=p)if(d)l.push(d),p=d+c,d=void 0;else if(n==="quoted"){while(h===" "||h==="\t")h=_,_=e[m+=1],f=!0;let b=m>w+1?m-2:g-1;if(u[b])return e;l.push(b),u[b]=!0,p=b+c,d=void 0}else f=!0}h=_}if(f&&a)a();if(l.length===0)return e;if(s)s();let x=e.slice(0,l[0]);for(let _=0;_<l.length;++_){let b=l[_],k=l[_+1]||e.length;if(b===0)x=`
11
+ ${t}${e.slice(0,k)}`;else{if(n==="quoted"&&u[b])x+=`${e[b]}\\`;x+=`
12
+ ${t}${e.slice(b+1,k)}`}}return x}function Ul(e,t,n){let r=t,i=t+1,o=e[i];while(o===" "||o==="\t")if(t<i+n)o=e[++t];else{do o=e[++t];while(o&&o!==`
13
+ `);r=t,i=t+1,o=e[i]}return r}gw.FOLD_BLOCK="block";gw.FOLD_FLOW="flow";gw.FOLD_QUOTED="quoted";gw.foldFlowLines=mw});var Cn=P(function(Sw){var Ce=W(),lt=Zl(),qr=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Br=(e)=>/^(%|---|\.\.\.)/m.test(e);function _w(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(e[o]===`
14
+ `){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function On(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(Br(e)?" ":""),s="",a=0;for(let c=0,l=n[c];l;l=n[++c]){if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n")s+=n.slice(a,c)+"\\ ",c+=1,a=c,l="\\";if(l==="\\")switch(n[c+1]){case"u":{s+=n.slice(a,c);let u=n.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:if(u.substr(0,2)==="00")s+="\\x"+u.substr(2);else s+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{s+=n.slice(a,c)+`
15
+
16
+ `;while(n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"')s+=`
17
+ `,c+=2;if(s+=o,n[c+2]===" ")s+="\\";c+=1,a=c+1}break;default:c+=1}}return s=a?s+n.slice(a):n,r?s:lt.foldFlowLines(s,o,lt.FOLD_QUOTED,qr(t,!1))}function Qo(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
18
+ `)||/[ \t]\n|\n[ \t]/.test(e))return On(e,t);let n=t.indent||(Br(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
19
+ ${n}`)+"'";return t.implicitKey?r:lt.foldFlowLines(r,n,lt.FOLD_FLOW,qr(t,!1))}function Vt(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=On;else{let i=e.includes('"'),o=e.includes("'");if(i&&!o)r=Qo;else if(o&&!i)r=On;else r=n?Qo:On}return r(e,t)}var Xo;try{Xo=new RegExp(`(^|(?<!
20
20
  ))
21
21
  +(?!
22
- |$)`,"g")}catch{qs=/\n+(?!\n|$)/g}function tn({comment:e,type:t,value:r},n,s,o){let{blockQuote:i,commentString:a,lineWidth:c}=n.options;if(!i||/\n[\t ]+$/.test(r))return Et(r,n);let u=n.indent||(n.forceBlockIndent||nn(r)?" ":""),l=i==="literal"?!0:i==="folded"||t===me.Scalar.BLOCK_FOLDED?!1:t===me.Scalar.BLOCK_LITERAL?!0:!Ey(r,c,u.length);if(!r)return l?`|
22
+ |$)`,"g")}catch{Xo=/\n+(?!\n|$)/g}function Gr({comment:e,type:t,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=r.options;if(!s||/\n[\t ]+$/.test(n))return Vt(n,r);let l=r.indent||(r.forceBlockIndent||Br(n)?" ":""),u=s==="literal"?!0:s==="folded"||t===Ce.Scalar.BLOCK_FOLDED?!1:t===Ce.Scalar.BLOCK_LITERAL?!0:!_w(n,c,l.length);if(!n)return u?`|
23
23
  `:`>
24
- `;let f,p;for(p=r.length;p>0;--p){let v=r[p-1];if(v!==`
25
- `&&v!=="\t"&&v!==" ")break}let d=r.substring(p),h=d.indexOf(`
26
- `);if(h===-1)f="-";else if(r===d||h!==d.length-1){if(f="+",o)o()}else f="";if(d){if(r=r.slice(0,-d.length),d[d.length-1]===`
27
- `)d=d.slice(0,-1);d=d.replace(qs,`$&${u}`)}let m=!1,g,_=-1;for(g=0;g<r.length;++g){let v=r[g];if(v===" ")m=!0;else if(v===`
28
- `)_=g;else break}let S=r.substring(0,_<g?_+1:g);if(S)r=r.substring(S.length),S=S.replace(/\n+/g,`$&${u}`);let b=(m?u?"2":"1":"")+f;if(e){if(b+=" "+a(e.replace(/ ?[\r\n]+/g," ")),s)s()}if(!l){let v=r.replace(/\n+/g,`
29
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),k=!1,T=rn(n,!0);if(i!=="folded"&&t!==me.Scalar.BLOCK_FOLDED)T.onOverflow=()=>{k=!0};let P=Ke.foldFlowLines(`${S}${v}${d}`,u,Ke.FOLD_BLOCK,T);if(!k)return`>${b}
30
- ${u}${P}`}return r=r.replace(/\n+/g,`$&${u}`),`|${b}
31
- ${u}${S}${r}${d}`}function Ty(e,t,r,n){let{type:s,value:o}=e,{actualString:i,implicitKey:a,indent:c,indentStep:u,inFlow:l}=t;if(a&&o.includes(`
32
- `)||l&&/[[\]{},]/.test(o))return Et(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||l||!o.includes(`
33
- `)?Et(o,t):tn(e,t,r,n);if(!a&&!l&&s!==me.Scalar.PLAIN&&o.includes(`
34
- `))return tn(e,t,r,n);if(nn(o)){if(c==="")return t.forceBlockIndent=!0,tn(e,t,r,n);else if(a&&c===u)return Et(o,t)}let f=o.replace(/\n+/g,`$&
35
- ${c}`);if(i){let p=(m)=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:d,tags:h}=t.doc.schema;if(h.some(p)||d?.some(p))return Et(o,t)}return a?f:Ke.foldFlowLines(f,c,Ke.FOLD_FLOW,rn(t,!1))}function Oy(e,t,r,n){let{implicitKey:s,inFlow:o}=t,i=typeof e.value==="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;if(a!==me.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value))a=me.Scalar.QUOTE_DOUBLE}let c=(l)=>{switch(l){case me.Scalar.BLOCK_FOLDED:case me.Scalar.BLOCK_LITERAL:return s||o?Et(i.value,t):tn(i,t,r,n);case me.Scalar.QUOTE_DOUBLE:return er(i.value,t);case me.Scalar.QUOTE_SINGLE:return Ms(i.value,t);case me.Scalar.PLAIN:return Ty(i,t,r,n);default:return null}},u=c(a);if(u===null){let{defaultKeyType:l,defaultStringType:f}=t.options,p=s&&l||f;if(u=c(p),u===null)throw Error(`Unsupported default string type ${p}`)}return u}Iy.stringifyString=Oy});var rr=A(function(Zy){var Ry=Jr(),Fe=I(),Cy=Xt(),zy=tr();function Ly(e,t){let r=Object.assign({blockQuote:!0,commentString:Cy.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent==="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Dy(e,t){if(t.tag){let s=e.filter((o)=>o.tag===t.tag);if(s.length>0)return s.find((o)=>o.format===t.format)??s[0]}let r=void 0,n;if(Fe.isScalar(t)){n=t.value;let s=e.filter((o)=>o.identify?.(n));if(s.length>1){let o=s.filter((i)=>i.test);if(o.length>0)s=o}r=s.find((o)=>o.format===t.format)??s.find((o)=>!o.format)}else n=t,r=e.find((s)=>s.nodeClass&&n instanceof s.nodeClass);if(!r){let s=n?.constructor?.name??(n===null?"null":typeof n);throw Error(`Tag not resolved for ${s} value`)}return r}function jy(e,t,{anchors:r,doc:n}){if(!n.directives)return"";let s=[],o=(Fe.isScalar(e)||Fe.isCollection(e))&&e.anchor;if(o&&Ry.anchorIsValid(o))r.add(o),s.push(`&${o}`);let i=e.tag??(t.default?null:t.tag);if(i)s.push(n.directives.tagString(i));return s.join(" ")}function Uy(e,t,r,n){if(Fe.isPair(e))return e.toString(t,r,n);if(Fe.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(t.resolvedAliases)t.resolvedAliases.add(e);else t.resolvedAliases=new Set([e]);e=e.resolve(t.doc)}}let s=void 0,o=Fe.isNode(e)?e:t.doc.createNode(e,{onTagObj:(c)=>s=c});s??(s=Dy(t.doc.schema.tags,o));let i=jy(o,s,t);if(i.length>0)t.indentAtStart=(t.indentAtStart??0)+i.length+1;let a=typeof s.stringify==="function"?s.stringify(o,t,r,n):Fe.isScalar(o)?zy.stringifyString(o,t,r,n):o.toString(t,r,n);if(!i)return a;return Fe.isScalar(o)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
36
- ${t.indent}${a}`}Zy.createStringifyContext=Ly;Zy.stringify=Uy});var Ua=A(function(Ky){var Le=I(),Da=H(),ja=rr(),nr=Xt();function By({key:e,value:t},r,n,s){let{allNullValues:o,doc:i,indent:a,indentStep:c,options:{commentString:u,indentSeq:l,simpleKeys:f}}=r,p=Le.isNode(e)&&e.comment||null;if(f){if(p)throw Error("With simple keys, key nodes cannot have comments");if(Le.isCollection(e)||!Le.isNode(e)&&typeof e==="object")throw Error("With simple keys, collection cannot be used as a key value")}let d=!f&&(!e||p&&t==null&&!r.inFlow||Le.isCollection(e)||(Le.isScalar(e)?e.type===Da.Scalar.BLOCK_FOLDED||e.type===Da.Scalar.BLOCK_LITERAL:typeof e==="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!d&&(f||!o),indent:a+c});let h=!1,m=!1,g=ja.stringify(e,r,()=>h=!0,()=>m=!0);if(!d&&!r.inFlow&&g.length>1024){if(f)throw Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(r.inFlow){if(o||t==null){if(h&&n)n();return g===""?"?":d?`? ${g}`:g}}else if(o&&!f||t==null&&d){if(g=`? ${g}`,p&&!h)g+=nr.lineComment(g,r.indent,u(p));else if(m&&s)s();return g}if(h)p=null;if(d){if(p)g+=nr.lineComment(g,r.indent,u(p));g=`? ${g}
37
- ${a}:`}else if(g=`${g}:`,p)g+=nr.lineComment(g,r.indent,u(p));let _,S,x;if(Le.isNode(t))_=!!t.spaceBefore,S=t.commentBefore,x=t.comment;else if(_=!1,S=null,x=null,t&&typeof t==="object")t=i.createNode(t);if(r.implicitKey=!1,!d&&!p&&Le.isScalar(t))r.indentAtStart=g.length+1;if(m=!1,!l&&c.length>=2&&!r.inFlow&&!d&&Le.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor)r.indent=r.indent.substring(2);let b=!1,v=ja.stringify(t,r,()=>b=!0,()=>m=!0),k=" ";if(p||_||S){if(k=_?`
38
- `:"",S){let T=u(S);k+=`
39
- ${nr.indentComment(T,r.indent)}`}if(v===""&&!r.inFlow){if(k===`
40
- `&&x)k=`
41
-
42
- `}else k+=`
43
- ${r.indent}`}else if(!d&&Le.isCollection(t)){let T=v[0],P=v.indexOf(`
44
- `),K=P!==-1,ae=r.inFlow??t.flow??t.items.length===0;if(K||!ae){let Ce=!1;if(K&&(T==="&"||T==="!")){let G=v.indexOf(" ");if(T==="&"&&G!==-1&&G<P&&v[G+1]==="!")G=v.indexOf(" ",G+1);if(G===-1||P<G)Ce=!0}if(!Ce)k=`
45
- ${r.indent}`}}else if(v===""||v[0]===`
46
- `)k="";if(g+=k+v,r.inFlow){if(b&&n)n()}else if(x&&!b)g+=nr.lineComment(g,r.indent,u(x));else if(m&&s)s();return g}Ky.stringifyPair=By});var Bs=A(function(Wy){var Za=he("process");function Gy(e,...t){if(e==="debug")console.log(...t)}function Hy(e,t){if(e==="debug"||e==="warn")if(typeof Za.emitWarning==="function")Za.emitWarning(t);else console.warn(t)}Wy.debug=Gy;Wy.warn=Hy});var cn=A(function(Qy){var an=I(),Ma=H(),sn="<<",on={identify:(e)=>e===sn||typeof e==="symbol"&&e.description===sn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ma.Scalar(Symbol(sn)),{addToJSMap:qa}),stringify:()=>sn},Jy=(e,t)=>(on.identify(t)||an.isScalar(t)&&(!t.type||t.type===Ma.Scalar.PLAIN)&&on.identify(t.value))&&e?.doc.schema.tags.some((r)=>r.tag===on.tag&&r.default);function qa(e,t,r){let n=Ba(e,r);if(an.isSeq(n))for(let s of n.items)Ks(e,t,s);else if(Array.isArray(n))for(let s of n)Ks(e,t,s);else Ks(e,t,n)}function Ks(e,t,r){let n=Ba(e,r);if(!an.isMap(n))throw Error("Merge sources must be maps or map aliases");let s=n.toJSON(null,e,Map);for(let[o,i]of s)if(t instanceof Map){if(!t.has(o))t.set(o,i)}else if(t instanceof Set)t.add(o);else if(!Object.prototype.hasOwnProperty.call(t,o))Object.defineProperty(t,o,{value:i,writable:!0,enumerable:!0,configurable:!0});return t}function Ba(e,t){return e&&an.isAlias(t)?t.resolve(e.doc,e):t}Qy.addMergeToJSMap=qa;Qy.isMergeKey=Jy;Qy.merge=on});var Gs=A(function(iw){var rw=Bs(),Ka=cn(),nw=rr(),Fa=I(),Fs=Be();function sw(e,t,{key:r,value:n}){if(Fa.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,n);else if(Ka.isMergeKey(e,r))Ka.addMergeToJSMap(e,t,n);else{let s=Fs.toJS(r,"",e);if(t instanceof Map)t.set(s,Fs.toJS(n,s,e));else if(t instanceof Set)t.add(s);else{let o=ow(r,s,e),i=Fs.toJS(n,o,e);if(o in t)Object.defineProperty(t,o,{value:i,writable:!0,enumerable:!0,configurable:!0});else t[o]=i}}return t}function ow(e,t,r){if(t===null)return"";if(typeof t!=="object")return String(t);if(Fa.isNode(e)&&r?.doc){let n=nw.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let s=e.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(s);if(o.length>40)o=o.substring(0,36)+'..."';rw.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return s}return JSON.stringify(t)}iw.addPairToJSMap=sw});var Ge=A(function(pw){var Ga=Qt(),cw=Ua(),uw=Gs(),un=I();function lw(e,t,r){let n=Ga.createNode(e,void 0,r),s=Ga.createNode(t,void 0,r);return new ln(n,s)}class ln{constructor(e,t=null){Object.defineProperty(this,un.NODE_TYPE,{value:un.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;if(un.isNode(t))t=t.clone(e);if(un.isNode(r))r=r.clone(e);return new ln(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return uw.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?cw.stringifyPair(this,e,t,r):JSON.stringify(this)}}pw.Pair=ln;pw.createPair=lw});var Hs=A(function(yw){var ct=I(),Ha=rr(),pn=Xt();function hw(e,t,r){return(t.inFlow??e.flow?gw:mw)(e,t,r)}function mw({comment:e,items:t},r,{blockItemPrefix:n,flowChars:s,itemIndent:o,onChompKeep:i,onComment:a}){let{indent:c,options:{commentString:u}}=r,l=Object.assign({},r,{indent:o,type:null}),f=!1,p=[];for(let h=0;h<t.length;++h){let m=t[h],g=null;if(ct.isNode(m)){if(!f&&m.spaceBefore)p.push("");if(fn(r,p,m.commentBefore,f),m.comment)g=m.comment}else if(ct.isPair(m)){let S=ct.isNode(m.key)?m.key:null;if(S){if(!f&&S.spaceBefore)p.push("");fn(r,p,S.commentBefore,f)}}f=!1;let _=Ha.stringify(m,l,()=>g=null,()=>f=!0);if(g)_+=pn.lineComment(_,o,u(g));if(f&&g)f=!1;p.push(n+_)}let d;if(p.length===0)d=s.start+s.end;else{d=p[0];for(let h=1;h<p.length;++h){let m=p[h];d+=m?`
24
+ `;let p,d;for(d=n.length;d>0;--d){let k=n[d-1];if(k!==`
25
+ `&&k!=="\t"&&k!==" ")break}let h=n.substring(d),f=h.indexOf(`
26
+ `);if(f===-1)p="-";else if(n===h||f!==h.length-1){if(p="+",o)o()}else p="";if(h){if(n=n.slice(0,-h.length),h[h.length-1]===`
27
+ `)h=h.slice(0,-1);h=h.replace(Xo,`$&${l}`)}let m=!1,g,w=-1;for(g=0;g<n.length;++g){let k=n[g];if(k===" ")m=!0;else if(k===`
28
+ `)w=g;else break}let x=n.substring(0,w<g?w+1:g);if(x)n=n.substring(x.length),x=x.replace(/\n+/g,`$&${l}`);let b=(m?l?"2":"1":"")+p;if(e){if(b+=" "+a(e.replace(/ ?[\r\n]+/g," ")),i)i()}if(!u){let k=n.replace(/\n+/g,`
29
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),S=!1,O=qr(r,!0);if(s!=="folded"&&t!==Ce.Scalar.BLOCK_FOLDED)O.onOverflow=()=>{S=!0};let A=lt.foldFlowLines(`${x}${k}${h}`,l,lt.FOLD_BLOCK,O);if(!S)return`>${b}
30
+ ${l}${A}`}return n=n.replace(/\n+/g,`$&${l}`),`|${b}
31
+ ${l}${x}${n}${h}`}function kw(e,t,n,r){let{type:i,value:o}=e,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=t;if(a&&o.includes(`
32
+ `)||u&&/[[\]{},]/.test(o))return Vt(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
33
+ `)?Vt(o,t):Gr(e,t,n,r);if(!a&&!u&&i!==Ce.Scalar.PLAIN&&o.includes(`
34
+ `))return Gr(e,t,n,r);if(Br(o)){if(c==="")return t.forceBlockIndent=!0,Gr(e,t,n,r);else if(a&&c===l)return Vt(o,t)}let p=o.replace(/\n+/g,`$&
35
+ ${c}`);if(s){let d=(m)=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(p),{compat:h,tags:f}=t.doc.schema;if(f.some(d)||h?.some(d))return Vt(o,t)}return a?p:lt.foldFlowLines(p,c,lt.FOLD_FLOW,qr(t,!1))}function xw(e,t,n,r){let{implicitKey:i,inFlow:o}=t,s=typeof e.value==="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;if(a!==Ce.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value))a=Ce.Scalar.QUOTE_DOUBLE}let c=(u)=>{switch(u){case Ce.Scalar.BLOCK_FOLDED:case Ce.Scalar.BLOCK_LITERAL:return i||o?Vt(s.value,t):Gr(s,t,n,r);case Ce.Scalar.QUOTE_DOUBLE:return On(s.value,t);case Ce.Scalar.QUOTE_SINGLE:return Qo(s.value,t);case Ce.Scalar.PLAIN:return kw(s,t,n,r);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:p}=t.options,d=i&&u||p;if(l=c(d),l===null)throw Error(`Unsupported default string type ${d}`)}return l}Sw.stringifyString=xw});var Rn=P(function(Iw){var $w=jr(),ut=N(),Pw=En(),Tw=Cn();function Ew(e,t){let n=Object.assign({blockQuote:!0,commentString:Pw.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent==="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Ow(e,t){if(t.tag){let i=e.filter((o)=>o.tag===t.tag);if(i.length>0)return i.find((o)=>o.format===t.format)??i[0]}let n=void 0,r;if(ut.isScalar(t)){r=t.value;let i=e.filter((o)=>o.identify?.(r));if(i.length>1){let o=i.filter((s)=>s.test);if(o.length>0)i=o}n=i.find((o)=>o.format===t.format)??i.find((o)=>!o.format)}else r=t,n=e.find((i)=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw Error(`Tag not resolved for ${i} value`)}return n}function Cw(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(ut.isScalar(e)||ut.isCollection(e))&&e.anchor;if(o&&$w.anchorIsValid(o))n.add(o),i.push(`&${o}`);let s=e.tag??(t.default?null:t.tag);if(s)i.push(r.directives.tagString(s));return i.join(" ")}function Rw(e,t,n,r){if(ut.isPair(e))return e.toString(t,n,r);if(ut.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(t.resolvedAliases)t.resolvedAliases.add(e);else t.resolvedAliases=new Set([e]);e=e.resolve(t.doc)}}let i=void 0,o=ut.isNode(e)?e:t.doc.createNode(e,{onTagObj:(c)=>i=c});i??(i=Ow(t.doc.schema.tags,o));let s=Cw(o,i,t);if(s.length>0)t.indentAtStart=(t.indentAtStart??0)+s.length+1;let a=typeof i.stringify==="function"?i.stringify(o,t,n,r):ut.isScalar(o)?Tw.stringifyString(o,t,n,r):o.toString(t,n,r);if(!s)return a;return ut.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
36
+ ${t.indent}${a}`}Iw.createStringifyContext=Ew;Iw.stringify=Rw});var Bl=P(function(Lw){var Qe=N(),Gl=W(),ql=Rn(),In=En();function Dw({key:e,value:t},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:p}}=n,d=Qe.isNode(e)&&e.comment||null;if(p){if(d)throw Error("With simple keys, key nodes cannot have comments");if(Qe.isCollection(e)||!Qe.isNode(e)&&typeof e==="object")throw Error("With simple keys, collection cannot be used as a key value")}let h=!p&&(!e||d&&t==null&&!n.inFlow||Qe.isCollection(e)||(Qe.isScalar(e)?e.type===Gl.Scalar.BLOCK_FOLDED||e.type===Gl.Scalar.BLOCK_LITERAL:typeof e==="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(p||!o),indent:a+c});let f=!1,m=!1,g=ql.stringify(e,n,()=>f=!0,()=>m=!0);if(!h&&!n.inFlow&&g.length>1024){if(p)throw Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(o||t==null){if(f&&r)r();return g===""?"?":h?`? ${g}`:g}}else if(o&&!p||t==null&&h){if(g=`? ${g}`,d&&!f)g+=In.lineComment(g,n.indent,l(d));else if(m&&i)i();return g}if(f)d=null;if(h){if(d)g+=In.lineComment(g,n.indent,l(d));g=`? ${g}
37
+ ${a}:`}else if(g=`${g}:`,d)g+=In.lineComment(g,n.indent,l(d));let w,x,_;if(Qe.isNode(t))w=!!t.spaceBefore,x=t.commentBefore,_=t.comment;else if(w=!1,x=null,_=null,t&&typeof t==="object")t=s.createNode(t);if(n.implicitKey=!1,!h&&!d&&Qe.isScalar(t))n.indentAtStart=g.length+1;if(m=!1,!u&&c.length>=2&&!n.inFlow&&!h&&Qe.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor)n.indent=n.indent.substring(2);let b=!1,k=ql.stringify(t,n,()=>b=!0,()=>m=!0),S=" ";if(d||w||x){if(S=w?`
38
+ `:"",x){let O=l(x);S+=`
39
+ ${In.indentComment(O,n.indent)}`}if(k===""&&!n.inFlow){if(S===`
40
+ `&&_)S=`
41
+
42
+ `}else S+=`
43
+ ${n.indent}`}else if(!h&&Qe.isCollection(t)){let O=k[0],A=k.indexOf(`
44
+ `),L=A!==-1,ae=n.inFlow??t.flow??t.items.length===0;if(L||!ae){let ke=!1;if(L&&(O==="&"||O==="!")){let B=k.indexOf(" ");if(O==="&"&&B!==-1&&B<A&&k[B+1]==="!")B=k.indexOf(" ",B+1);if(B===-1||A<B)ke=!0}if(!ke)S=`
45
+ ${n.indent}`}}else if(k===""||k[0]===`
46
+ `)S="";if(g+=S+k,n.inFlow){if(b&&r)r()}else if(_&&!b)g+=In.lineComment(g,n.indent,l(_));else if(m&&i)i();return g}Lw.stringifyPair=Dw});var es=P(function(Zw){var Hl=Oe("process");function Mw(e,...t){if(e==="debug")console.log(...t)}function Uw(e,t){if(e==="debug"||e==="warn")if(typeof Hl.emitWarning==="function")Hl.emitWarning(t);else console.warn(t)}Zw.debug=Mw;Zw.warn=Uw});var Wr=P(function(Hw){var Kr=N(),Fl=W(),Hr="<<",Fr={identify:(e)=>e===Hr||typeof e==="symbol"&&e.description===Hr,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Fl.Scalar(Symbol(Hr)),{addToJSMap:Kl}),stringify:()=>Hr},Bw=(e,t)=>(Fr.identify(t)||Kr.isScalar(t)&&(!t.type||t.type===Fl.Scalar.PLAIN)&&Fr.identify(t.value))&&e?.doc.schema.tags.some((n)=>n.tag===Fr.tag&&n.default);function Kl(e,t,n){let r=Wl(e,n);if(Kr.isSeq(r))for(let i of r.items)ts(e,t,i);else if(Array.isArray(r))for(let i of r)ts(e,t,i);else ts(e,t,r)}function ts(e,t,n){let r=Wl(e,n);if(!Kr.isMap(r))throw Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,e,Map);for(let[o,s]of i)if(t instanceof Map){if(!t.has(o))t.set(o,s)}else if(t instanceof Set)t.add(o);else if(!Object.prototype.hasOwnProperty.call(t,o))Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function Wl(e,t){return e&&Kr.isAlias(t)?t.resolve(e.doc,e):t}Hw.addMergeToJSMap=Kl;Hw.isMergeKey=Bw;Hw.merge=Fr});var rs=P(function(Xw){var Vw=es(),Vl=Wr(),Yw=Rn(),Yl=N(),ns=ct();function Jw(e,t,{key:n,value:r}){if(Yl.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Vl.isMergeKey(e,n))Vl.addMergeToJSMap(e,t,r);else{let i=ns.toJS(n,"",e);if(t instanceof Map)t.set(i,ns.toJS(r,i,e));else if(t instanceof Set)t.add(i);else{let o=Qw(n,i,e),s=ns.toJS(r,o,e);if(o in t)Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});else t[o]=s}}return t}function Qw(e,t,n){if(t===null)return"";if(typeof t!=="object")return String(t);if(Yl.isNode(e)&&n?.doc){let r=Yw.createStringifyContext(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=e.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);if(o.length>40)o=o.substring(0,36)+'..."';Vw.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}Xw.addPairToJSMap=Jw});var pt=P(function(i0){var Jl=Tn(),t0=Bl(),n0=rs(),Vr=N();function r0(e,t,n){let r=Jl.createNode(e,void 0,n),i=Jl.createNode(t,void 0,n);return new Yr(r,i)}class Yr{constructor(e,t=null){Object.defineProperty(this,Vr.NODE_TYPE,{value:Vr.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;if(Vr.isNode(t))t=t.clone(e);if(Vr.isNode(n))n=n.clone(e);return new Yr(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return n0.addPairToJSMap(t,n,this)}toString(e,t,n){return e?.doc?t0.stringifyPair(this,e,t,n):JSON.stringify(this)}}i0.Pair=Yr;i0.createPair=r0});var is=P(function(u0){var Pt=N(),Ql=Rn(),Jr=En();function a0(e,t,n){return(t.inFlow??e.flow?l0:c0)(e,t,n)}function c0({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:o,type:null}),p=!1,d=[];for(let f=0;f<t.length;++f){let m=t[f],g=null;if(Pt.isNode(m)){if(!p&&m.spaceBefore)d.push("");if(Qr(n,d,m.commentBefore,p),m.comment)g=m.comment}else if(Pt.isPair(m)){let x=Pt.isNode(m.key)?m.key:null;if(x){if(!p&&x.spaceBefore)d.push("");Qr(n,d,x.commentBefore,p)}}p=!1;let w=Ql.stringify(m,u,()=>g=null,()=>p=!0);if(g)w+=Jr.lineComment(w,o,l(g));if(p&&g)p=!1;d.push(r+w)}let h;if(d.length===0)h=i.start+i.end;else{h=d[0];for(let f=1;f<d.length;++f){let m=d[f];h+=m?`
47
47
  ${c}${m}`:`
48
- `}}if(e){if(d+=`
49
- `+pn.indentComment(u(e),c),a)a()}else if(f&&i)i();return d}function gw({items:e},t,{flowChars:r,itemIndent:n}){let{indent:s,indentStep:o,flowCollectionPadding:i,options:{commentString:a}}=t;n+=o;let c=Object.assign({},t,{indent:n,inFlow:!0,type:null}),u=!1,l=0,f=[];for(let h=0;h<e.length;++h){let m=e[h],g=null;if(ct.isNode(m)){if(m.spaceBefore)f.push("");if(fn(t,f,m.commentBefore,!1),m.comment)g=m.comment}else if(ct.isPair(m)){let S=ct.isNode(m.key)?m.key:null;if(S){if(S.spaceBefore)f.push("");if(fn(t,f,S.commentBefore,!1),S.comment)u=!0}let x=ct.isNode(m.value)?m.value:null;if(x){if(x.comment)g=x.comment;if(x.commentBefore)u=!0}else if(m.value==null&&S?.comment)g=S.comment}if(g)u=!0;let _=Ha.stringify(m,c,()=>g=null);if(u||(u=f.length>l||_.includes(`
50
- `)),h<e.length-1)_+=",";else if(t.options.trailingComma){if(t.options.lineWidth>0)u||(u=f.reduce((S,x)=>S+x.length+2,2)+(_.length+2)>t.options.lineWidth);if(u)_+=","}if(g)_+=pn.lineComment(_,n,a(g));f.push(_),l=f.length}let{start:p,end:d}=r;if(f.length===0)return p+d;else{if(!u){let h=f.reduce((m,g)=>m+g.length+2,2);u=t.options.lineWidth>0&&h>t.options.lineWidth}if(u){let h=p;for(let m of f)h+=m?`
51
- ${o}${s}${m}`:`
52
- `;return`${h}
53
- ${s}${d}`}else return`${p}${i}${f.join(" ")}${i}${d}`}}function fn({indent:e,options:{commentString:t}},r,n,s){if(n&&s)n=n.replace(/^\n+/,"");if(n){let o=pn.indentComment(t(n),e);r.push(o.trimStart())}}yw.stringifyCollection=hw});var We=A(function(xw){var bw=Hs(),_w=Gs(),vw=en(),He=I(),dn=Ge(),kw=H();function sr(e,t){let r=He.isScalar(t)?t.value:t;for(let n of e)if(He.isPair(n)){if(n.key===t||n.key===r)return n;if(He.isScalar(n.key)&&n.key.value===r)return n}return}class Wa extends vw.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(He.MAP,e);this.items=[]}static from(e,t,r){let{keepUndefined:n,replacer:s}=r,o=new this(e),i=(a,c)=>{if(typeof s==="function")c=s.call(t,a,c);else if(Array.isArray(s)&&!s.includes(a))return;if(c!==void 0||n)o.items.push(dn.createPair(a,c,r))};if(t instanceof Map)for(let[a,c]of t)i(a,c);else if(t&&typeof t==="object")for(let a of Object.keys(t))i(a,t[a]);if(typeof e.sortMapEntries==="function")o.items.sort(e.sortMapEntries);return o}add(e,t){let r;if(He.isPair(e))r=e;else if(!e||typeof e!=="object"||!("key"in e))r=new dn.Pair(e,e?.value);else r=new dn.Pair(e.key,e.value);let n=sr(this.items,r.key),s=this.schema?.sortMapEntries;if(n){if(!t)throw Error(`Key ${r.key} already set`);if(He.isScalar(n.value)&&kw.isScalarValue(r.value))n.value.value=r.value;else n.value=r.value}else if(s){let o=this.items.findIndex((i)=>s(r,i)<0);if(o===-1)this.items.push(r);else this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let t=sr(this.items,e);if(!t)return!1;return this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){let n=sr(this.items,e)?.value;return(!t&&He.isScalar(n)?n.value:n)??void 0}has(e){return!!sr(this.items,e)}set(e,t){this.add(new dn.Pair(e,t),!0)}toJSON(e,t,r){let n=r?new r:t?.mapAsMap?new Map:{};if(t?.onCreate)t.onCreate(n);for(let s of this.items)_w.addPairToJSMap(t,n,s);return n}toString(e,t,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!He.isPair(n))throw Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);if(!e.allNullValues&&this.hasAllNullValues(!1))e=Object.assign({},e,{allNullValues:!0});return bw.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}}xw.YAMLMap=Wa;xw.findPair=sr});var Tt=A(function(Ew){var $w=I(),Va=We(),Pw={collection:"map",default:!0,nodeClass:Va.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){if(!$w.isMap(e))t("Expected a mapping for this tag");return e},createNode:(e,t,r)=>Va.YAMLMap.from(e,t,r)};Ew.map=Pw});var Ve=A(function(zw){var Ow=Qt(),Iw=Hs(),Nw=en(),mn=I(),Rw=H(),Cw=Be();class Ya extends Nw.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(mn.SEQ,e);this.items=[]}add(e){this.items.push(e)}delete(e){let t=hn(e);if(typeof t!=="number")return!1;return this.items.splice(t,1).length>0}get(e,t){let r=hn(e);if(typeof r!=="number")return;let n=this.items[r];return!t&&mn.isScalar(n)?n.value:n}has(e){let t=hn(e);return typeof t==="number"&&t<this.items.length}set(e,t){let r=hn(e);if(typeof r!=="number")throw Error(`Expected a valid index, not ${e}.`);let n=this.items[r];if(mn.isScalar(n)&&Rw.isScalarValue(t))n.value=t;else this.items[r]=t}toJSON(e,t){let r=[];if(t?.onCreate)t.onCreate(r);let n=0;for(let s of this.items)r.push(Cw.toJS(s,String(n++),t));return r}toString(e,t,r){if(!e)return JSON.stringify(this);return Iw.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t})}static from(e,t,r){let{replacer:n}=r,s=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let i of t){if(typeof n==="function"){let a=t instanceof Set?i:String(o++);i=n.call(t,a,i)}s.items.push(Ow.createNode(i,void 0,r))}}return s}}function hn(e){let t=mn.isScalar(e)?e.value:e;if(t&&typeof t==="string")t=Number(t);return typeof t==="number"&&Number.isInteger(t)&&t>=0?t:null}zw.YAMLSeq=Ya});var Ot=A(function(Uw){var Dw=I(),Ja=Ve(),jw={collection:"seq",default:!0,nodeClass:Ja.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){if(!Dw.isSeq(e))t("Expected a sequence for this tag");return e},createNode:(e,t,r)=>Ja.YAMLSeq.from(e,t,r)};Uw.seq=jw});var or=A(function(Bw){var Mw=tr(),qw={identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify(e,t,r,n){return t=Object.assign({actualString:!0},t),Mw.stringifyString(e,t,r,n)}};Bw.string=qw});var gn=A(function(Fw){var Qa=H(),Xa={identify:(e)=>e==null,createNode:()=>new Qa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Qa.Scalar(null),stringify:({source:e},t)=>typeof e==="string"&&Xa.test.test(e)?e:t.options.nullStr};Fw.nullTag=Xa});var Ws=A(function(Ww){var Hw=H(),ec={identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(e)=>new Hw.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&ec.test.test(e)){let n=e[0]==="t"||e[0]==="T";if(t===n)return e}return t?r.options.trueStr:r.options.falseStr}};Ww.boolTag=ec});var It=A(function(Jw){function Yw({format:e,minFractionDigits:t,tag:r,value:n}){if(typeof n==="bigint")return String(n);let s=typeof n==="number"?n:Number(n);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let i=o.indexOf(".");if(i<0)i=o.length,o+=".";let a=t-(o.length-i-1);while(a-- >0)o+="0"}return o}Jw.stringifyNumber=Yw});var Ys=A(function(nb){var Xw=H(),Vs=It(),eb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Vs.stringifyNumber},tb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Vs.stringifyNumber(e)}},rb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Xw.Scalar(parseFloat(e)),r=e.indexOf(".");if(r!==-1&&e[e.length-1]==="0")t.minFractionDigits=e.length-r-1;return t},stringify:Vs.stringifyNumber};nb.float=rb;nb.floatExp=tb;nb.floatNaN=eb});var Qs=A(function(lb){var tc=It(),yn=(e)=>typeof e==="bigint"||Number.isInteger(e),Js=(e,t,r,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),r);function rc(e,t,r){let{value:n}=e;if(yn(n)&&n>=0)return r+n.toString(t);return tc.stringifyNumber(e)}var ab={identify:(e)=>yn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>Js(e,2,8,r),stringify:(e)=>rc(e,8,"0o")},cb={identify:yn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>Js(e,0,10,r),stringify:tc.stringifyNumber},ub={identify:(e)=>yn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>Js(e,2,16,r),stringify:(e)=>rc(e,16,"0x")};lb.int=cb;lb.intHex=ub;lb.intOct=ab});var nc=A(function(_b){var hb=Tt(),mb=gn(),gb=Ot(),yb=or(),wb=Ws(),Xs=Ys(),eo=Qs(),bb=[hb.map,gb.seq,yb.string,mb.nullTag,wb.boolTag,eo.intOct,eo.int,eo.intHex,Xs.floatNaN,Xs.floatExp,Xs.float];_b.schema=bb});var oc=A(function(Eb){var kb=H(),xb=Tt(),Sb=Ot();function sc(e){return typeof e==="bigint"||Number.isInteger(e)}var wn=({value:e})=>JSON.stringify(e),Ab=[{identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify:wn},{identify:(e)=>e==null,createNode:()=>new kb.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:wn},{identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(e)=>e==="true",stringify:wn},{identify:sc,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>sc(e)?e.toString():JSON.stringify(e)},{identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(e)=>parseFloat(e),stringify:wn}],$b={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Pb=[xb.map,Sb.seq].concat(Ab,$b);Eb.schema=Pb});var ro=A(function(Nb){var ir=he("buffer"),to=H(),Ob=tr(),Ib={identify:(e)=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof ir.Buffer==="function")return ir.Buffer.from(e,"base64");else if(typeof atob==="function"){let r=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let s=0;s<r.length;++s)n[s]=r.charCodeAt(s);return n}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},n,s,o){if(!r)return"";let i=r,a;if(typeof ir.Buffer==="function")a=i instanceof ir.Buffer?i.toString("base64"):ir.Buffer.from(i.buffer).toString("base64");else if(typeof btoa==="function"){let c="";for(let u=0;u<i.length;++u)c+=String.fromCharCode(i[u]);a=btoa(c)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=to.Scalar.BLOCK_LITERAL),t!==to.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),u=Math.ceil(a.length/c),l=Array(u);for(let f=0,p=0;f<u;++f,p+=c)l[f]=a.substr(p,c);a=l.join(t===to.Scalar.BLOCK_LITERAL?`
54
- `:" ")}return Ob.stringifyString({comment:e,type:t,value:a},n,s,o)}};Nb.binary=Ib});var _n=A(function(Db){var bn=I(),no=Ge(),Cb=H(),zb=Ve();function ic(e,t){if(bn.isSeq(e))for(let r=0;r<e.items.length;++r){let n=e.items[r];if(bn.isPair(n))continue;else if(bn.isMap(n)){if(n.items.length>1)t("Each pair must have its own sequence indicator");let s=n.items[0]||new no.Pair(new Cb.Scalar(null));if(n.commentBefore)s.key.commentBefore=s.key.commentBefore?`${n.commentBefore}
55
- ${s.key.commentBefore}`:n.commentBefore;if(n.comment){let o=s.value??s.key;o.comment=o.comment?`${n.comment}
56
- ${o.comment}`:n.comment}n=s}e.items[r]=bn.isPair(n)?n:new no.Pair(n)}else t("Expected a sequence for this tag");return e}function ac(e,t,r){let{replacer:n}=r,s=new zb.YAMLSeq(e);s.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let i of t){if(typeof n==="function")i=n.call(t,String(o++),i);let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let u=Object.keys(i);if(u.length===1)a=u[0],c=i[a];else throw TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=i;s.items.push(no.createPair(a,c,r))}return s}var Lb={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ic,createNode:ac};Db.createPairs=ac;Db.pairs=Lb;Db.resolvePairs=ic});var oo=A(function(Bb){var cc=I(),so=Be(),ar=We(),Mb=Ve(),uc=_n();class ut extends Mb.YAMLSeq{constructor(){super();this.add=ar.YAMLMap.prototype.add.bind(this),this.delete=ar.YAMLMap.prototype.delete.bind(this),this.get=ar.YAMLMap.prototype.get.bind(this),this.has=ar.YAMLMap.prototype.has.bind(this),this.set=ar.YAMLMap.prototype.set.bind(this),this.tag=ut.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;if(t?.onCreate)t.onCreate(r);for(let n of this.items){let s,o;if(cc.isPair(n))s=so.toJS(n.key,"",t),o=so.toJS(n.value,s,t);else s=so.toJS(n,"",t);if(r.has(s))throw Error("Ordered maps must not include duplicate keys");r.set(s,o)}return r}static from(e,t,r){let n=uc.createPairs(e,t,r),s=new this;return s.items=n.items,s}}ut.tag="tag:yaml.org,2002:omap";var qb={collection:"seq",identify:(e)=>e instanceof Map,nodeClass:ut,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=uc.resolvePairs(e,t),n=[];for(let{key:s}of r.items)if(cc.isScalar(s))if(n.includes(s.value))t(`Ordered maps must not include duplicate keys: ${s.value}`);else n.push(s.value);return Object.assign(new ut,r)},createNode:(e,t,r)=>ut.from(e,t,r)};Bb.YAMLOMap=ut;Bb.omap=qb});var hc=A(function(Gb){var lc=H();function pc({value:e,source:t},r){if(t&&(e?fc:dc).test.test(t))return t;return e?r.options.trueStr:r.options.falseStr}var fc={identify:(e)=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new lc.Scalar(!0),stringify:pc},dc={identify:(e)=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new lc.Scalar(!1),stringify:pc};Gb.falseTag=dc;Gb.trueTag=fc});var mc=A(function(Xb){var Vb=H(),io=It(),Yb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:io.stringifyNumber},Jb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():io.stringifyNumber(e)}},Qb={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Vb.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let n=e.substring(r+1).replace(/_/g,"");if(n[n.length-1]==="0")t.minFractionDigits=n.length}return t},stringify:io.stringifyNumber};Xb.float=Qb;Xb.floatExp=Jb;Xb.floatNaN=Yb});var yc=A(function(a_){var gc=It(),cr=(e)=>typeof e==="bigint"||Number.isInteger(e);function vn(e,t,r,{intAsBigInt:n}){let s=e[0];if(s==="-"||s==="+")t+=1;if(e=e.substring(t).replace(/_/g,""),n){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let i=BigInt(e);return s==="-"?BigInt(-1)*i:i}let o=parseInt(e,r);return s==="-"?-1*o:o}function ao(e,t,r){let{value:n}=e;if(cr(n)){let s=n.toString(t);return n<0?"-"+r+s.substr(1):r+s}return gc.stringifyNumber(e)}var n_={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>vn(e,2,2,r),stringify:(e)=>ao(e,2,"0b")},s_={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>vn(e,1,8,r),stringify:(e)=>ao(e,8,"0")},o_={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>vn(e,0,10,r),stringify:gc.stringifyNumber},i_={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>vn(e,2,16,r),stringify:(e)=>ao(e,16,"0x")};a_.int=o_;a_.intBin=n_;a_.intHex=i_;a_.intOct=s_});var co=A(function(d_){var Sn=I(),kn=Ge(),xn=We();class lt extends xn.YAMLMap{constructor(e){super(e);this.tag=lt.tag}add(e){let t;if(Sn.isPair(e))t=e;else if(e&&typeof e==="object"&&"key"in e&&"value"in e&&e.value===null)t=new kn.Pair(e.key,null);else t=new kn.Pair(e,null);if(!xn.findPair(this.items,t.key))this.items.push(t)}get(e,t){let r=xn.findPair(this.items,e);return!t&&Sn.isPair(r)?Sn.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=xn.findPair(this.items,e);if(r&&!t)this.items.splice(this.items.indexOf(r),1);else if(!r&&t)this.items.push(new kn.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);else throw Error("Set items must all have null values")}static from(e,t,r){let{replacer:n}=r,s=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t){if(typeof n==="function")o=n.call(t,o,o);s.items.push(kn.createPair(o,null,r))}return s}}lt.tag="tag:yaml.org,2002:set";var f_={collection:"map",identify:(e)=>e instanceof Set,nodeClass:lt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>lt.from(e,t,r),resolve(e,t){if(Sn.isMap(e))if(e.hasAllNullValues(!0))return Object.assign(new lt,e);else t("Set items must all have null values");else t("Expected a mapping for this tag");return e}};d_.YAMLSet=lt;d_.set=f_});var lo=A(function(b_){var g_=It();function uo(e,t){let r=e[0],n=r==="-"||r==="+"?e.substring(1):e,s=(i)=>t?BigInt(i):Number(i),o=n.replace(/_/g,"").split(":").reduce((i,a)=>i*s(60)+s(a),s(0));return r==="-"?s(-1)*o:o}function wc(e){let{value:t}=e,r=(i)=>i;if(typeof t==="bigint")r=(i)=>BigInt(i);else if(isNaN(t)||!isFinite(t))return g_.stringifyNumber(e);let n="";if(t<0)n="-",t*=r(-1);let s=r(60),o=[t%s];if(t<60)o.unshift(0);else if(t=(t-o[0])/s,o.unshift(t%s),t>=60)t=(t-o[0])/s,o.unshift(t);return n+o.map((i)=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var y_={identify:(e)=>typeof e==="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>uo(e,r),stringify:wc},w_={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(e)=>uo(e,!1),stringify:wc},bc={identify:(e)=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(bc.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,s,o,i,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,u=Date.UTC(r,n-1,s,o||0,i||0,a||0,c),l=t[8];if(l&&l!=="Z"){let f=uo(l,!1);if(Math.abs(f)<30)f*=60;u-=60000*f}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};b_.floatTime=w_;b_.intTime=y_;b_.timestamp=bc});var vc=A(function(R_){var x_=Tt(),S_=gn(),A_=Ot(),$_=or(),P_=ro(),_c=hc(),po=mc(),An=yc(),E_=cn(),T_=oo(),O_=_n(),I_=co(),fo=lo(),N_=[x_.map,A_.seq,$_.string,S_.nullTag,_c.trueTag,_c.falseTag,An.intBin,An.intOct,An.int,An.intHex,po.floatNaN,po.floatExp,po.float,P_.binary,E_.merge,T_.omap,O_.pairs,I_.set,fo.intTime,fo.floatTime,fo.timestamp];R_.schema=N_});var Ic=A(function(q_){var Ac=Tt(),z_=gn(),$c=Ot(),L_=or(),D_=Ws(),ho=Ys(),mo=Qs(),j_=nc(),U_=oc(),Pc=ro(),ur=cn(),Ec=oo(),Tc=_n(),kc=vc(),Oc=co(),$n=lo(),xc=new Map([["core",j_.schema],["failsafe",[Ac.map,$c.seq,L_.string]],["json",U_.schema],["yaml11",kc.schema],["yaml-1.1",kc.schema]]),Sc={binary:Pc.binary,bool:D_.boolTag,float:ho.float,floatExp:ho.floatExp,floatNaN:ho.floatNaN,floatTime:$n.floatTime,int:mo.int,intHex:mo.intHex,intOct:mo.intOct,intTime:$n.intTime,map:Ac.map,merge:ur.merge,null:z_.nullTag,omap:Ec.omap,pairs:Tc.pairs,seq:$c.seq,set:Oc.set,timestamp:$n.timestamp},Z_={"tag:yaml.org,2002:binary":Pc.binary,"tag:yaml.org,2002:merge":ur.merge,"tag:yaml.org,2002:omap":Ec.omap,"tag:yaml.org,2002:pairs":Tc.pairs,"tag:yaml.org,2002:set":Oc.set,"tag:yaml.org,2002:timestamp":$n.timestamp};function M_(e,t,r){let n=xc.get(t);if(n&&!e)return r&&!n.includes(ur.merge)?n.concat(ur.merge):n.slice();let s=n;if(!s)if(Array.isArray(e))s=[];else{let o=Array.from(xc.keys()).filter((i)=>i!=="yaml11").map((i)=>JSON.stringify(i)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)s=s.concat(o);else if(typeof e==="function")s=e(s.slice());if(r)s=s.concat(ur.merge);return s.reduce((o,i)=>{let a=typeof i==="string"?Sc[i]:i;if(!a){let c=JSON.stringify(i),u=Object.keys(Sc).map((l)=>JSON.stringify(l)).join(", ");throw Error(`Unknown custom tag ${c}; use one of ${u}`)}if(!o.includes(a))o.push(a);return o},[])}q_.coreKnownTags=Z_;q_.getTags=M_});var wo=A(function(V_){var go=I(),F_=Tt(),G_=Ot(),H_=or(),Pn=Ic(),W_=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class yo{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:n,schema:s,sortMapEntries:o,toStringDefaults:i}){this.compat=Array.isArray(e)?Pn.getTags(e,"compat"):e?Pn.getTags(null,e):null,this.name=typeof s==="string"&&s||"core",this.knownTags=n?Pn.coreKnownTags:{},this.tags=Pn.getTags(t,this.name,r),this.toStringOptions=i??null,Object.defineProperty(this,go.MAP,{value:F_.map}),Object.defineProperty(this,go.SCALAR,{value:H_.string}),Object.defineProperty(this,go.SEQ,{value:G_.seq}),this.sortMapEntries=typeof o==="function"?o:o===!0?W_:null}clone(){let e=Object.create(yo.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}V_.Schema=yo});var Nc=A(function(X_){var J_=I(),bo=rr(),lr=Xt();function Q_(e,t){let r=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);if(c)r.push(c),n=!0;else if(e.directives.docStart)n=!0}if(n)r.push("---");let s=bo.createStringifyContext(e,t),{commentString:o}=s.options;if(e.commentBefore){if(r.length!==1)r.unshift("");let c=o(e.commentBefore);r.unshift(lr.indentComment(c,""))}let i=!1,a=null;if(e.contents){if(J_.isNode(e.contents)){if(e.contents.spaceBefore&&n)r.push("");if(e.contents.commentBefore){let l=o(e.contents.commentBefore);r.push(lr.indentComment(l,""))}s.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>i=!0,u=bo.stringify(e.contents,s,()=>a=null,c);if(a)u+=lr.lineComment(u,"",o(a));if((u[0]==="|"||u[0]===">")&&r[r.length-1]==="---")r[r.length-1]=`--- ${u}`;else r.push(u)}else r.push(bo.stringify(e.contents,s));if(e.directives?.docEnd)if(e.comment){let c=o(e.comment);if(c.includes(`
57
- `))r.push("..."),r.push(lr.indentComment(c,""));else r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;if(c&&i)c=c.replace(/^\n+/,"");if(c){if((!i||a)&&r[r.length-1]!=="")r.push("");r.push(lr.indentComment(o(c),""))}}return r.join(`
48
+ `}}if(e){if(h+=`
49
+ `+Jr.indentComment(l(e),c),a)a()}else if(p&&s)s();return h}function l0({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=t;r+=o;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,p=[];for(let f=0;f<e.length;++f){let m=e[f],g=null;if(Pt.isNode(m)){if(m.spaceBefore)p.push("");if(Qr(t,p,m.commentBefore,!1),m.comment)g=m.comment}else if(Pt.isPair(m)){let x=Pt.isNode(m.key)?m.key:null;if(x){if(x.spaceBefore)p.push("");if(Qr(t,p,x.commentBefore,!1),x.comment)l=!0}let _=Pt.isNode(m.value)?m.value:null;if(_){if(_.comment)g=_.comment;if(_.commentBefore)l=!0}else if(m.value==null&&x?.comment)g=x.comment}if(g)l=!0;let w=Ql.stringify(m,c,()=>g=null);if(l||(l=p.length>u||w.includes(`
50
+ `)),f<e.length-1)w+=",";else if(t.options.trailingComma){if(t.options.lineWidth>0)l||(l=p.reduce((x,_)=>x+_.length+2,2)+(w.length+2)>t.options.lineWidth);if(l)w+=","}if(g)w+=Jr.lineComment(w,r,a(g));p.push(w),u=p.length}let{start:d,end:h}=n;if(p.length===0)return d+h;else{if(!l){let f=p.reduce((m,g)=>m+g.length+2,2);l=t.options.lineWidth>0&&f>t.options.lineWidth}if(l){let f=d;for(let m of p)f+=m?`
51
+ ${o}${i}${m}`:`
52
+ `;return`${f}
53
+ ${i}${h}`}else return`${d}${s}${p.join(" ")}${s}${h}`}}function Qr({indent:e,options:{commentString:t}},n,r,i){if(r&&i)r=r.replace(/^\n+/,"");if(r){let o=Jr.indentComment(t(r),e);n.push(o.trimStart())}}u0.stringifyCollection=a0});var ht=P(function(g0){var d0=is(),h0=rs(),f0=Zr(),dt=N(),Xr=pt(),m0=W();function Nn(e,t){let n=dt.isScalar(t)?t.value:t;for(let r of e)if(dt.isPair(r)){if(r.key===t||r.key===n)return r;if(dt.isScalar(r.key)&&r.key.value===n)return r}return}class Xl extends f0.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(dt.MAP,e);this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),s=(a,c)=>{if(typeof i==="function")c=i.call(t,a,c);else if(Array.isArray(i)&&!i.includes(a))return;if(c!==void 0||r)o.items.push(Xr.createPair(a,c,n))};if(t instanceof Map)for(let[a,c]of t)s(a,c);else if(t&&typeof t==="object")for(let a of Object.keys(t))s(a,t[a]);if(typeof e.sortMapEntries==="function")o.items.sort(e.sortMapEntries);return o}add(e,t){let n;if(dt.isPair(e))n=e;else if(!e||typeof e!=="object"||!("key"in e))n=new Xr.Pair(e,e?.value);else n=new Xr.Pair(e.key,e.value);let r=Nn(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);if(dt.isScalar(r.value)&&m0.isScalarValue(n.value))r.value.value=n.value;else r.value=n.value}else if(i){let o=this.items.findIndex((s)=>i(n,s)<0);if(o===-1)this.items.push(n);else this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=Nn(this.items,e);if(!t)return!1;return this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){let r=Nn(this.items,e)?.value;return(!t&&dt.isScalar(r)?r.value:r)??void 0}has(e){return!!Nn(this.items,e)}set(e,t){this.add(new Xr.Pair(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};if(t?.onCreate)t.onCreate(r);for(let i of this.items)h0.addPairToJSMap(t,r,i);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let r of this.items)if(!dt.isPair(r))throw Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);if(!e.allNullValues&&this.hasAllNullValues(!1))e=Object.assign({},e,{allNullValues:!0});return d0.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}g0.YAMLMap=Xl;g0.findPair=Nn});var Yt=P(function(_0){var b0=N(),eu=ht(),w0={collection:"map",default:!0,nodeClass:eu.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){if(!b0.isMap(e))t("Expected a mapping for this tag");return e},createNode:(e,t,n)=>eu.YAMLMap.from(e,t,n)};_0.map=w0});var ft=P(function(T0){var x0=Tn(),S0=is(),A0=Zr(),ti=N(),$0=W(),P0=ct();class tu extends A0.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ti.SEQ,e);this.items=[]}add(e){this.items.push(e)}delete(e){let t=ei(e);if(typeof t!=="number")return!1;return this.items.splice(t,1).length>0}get(e,t){let n=ei(e);if(typeof n!=="number")return;let r=this.items[n];return!t&&ti.isScalar(r)?r.value:r}has(e){let t=ei(e);return typeof t==="number"&&t<this.items.length}set(e,t){let n=ei(e);if(typeof n!=="number")throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];if(ti.isScalar(r)&&$0.isScalarValue(t))r.value=t;else this.items[n]=t}toJSON(e,t){let n=[];if(t?.onCreate)t.onCreate(n);let r=0;for(let i of this.items)n.push(P0.toJS(i,String(r++),t));return n}toString(e,t,n){if(!e)return JSON.stringify(this);return S0.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t})}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let s of t){if(typeof r==="function"){let a=t instanceof Set?s:String(o++);s=r.call(t,a,s)}i.items.push(x0.createNode(s,void 0,n))}}return i}}function ei(e){let t=ti.isScalar(e)?e.value:e;if(t&&typeof t==="string")t=Number(t);return typeof t==="number"&&Number.isInteger(t)&&t>=0?t:null}T0.YAMLSeq=tu});var Jt=P(function(R0){var O0=N(),nu=ft(),C0={collection:"seq",default:!0,nodeClass:nu.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){if(!O0.isSeq(e))t("Expected a sequence for this tag");return e},createNode:(e,t,n)=>nu.YAMLSeq.from(e,t,n)};R0.seq=C0});var zn=P(function(D0){var N0=Cn(),z0={identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),N0.stringifyString(e,t,n,r)}};D0.string=z0});var ni=P(function(j0){var ru=W(),iu={identify:(e)=>e==null,createNode:()=>new ru.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ru.Scalar(null),stringify:({source:e},t)=>typeof e==="string"&&iu.test.test(e)?e:t.options.nullStr};j0.nullTag=iu});var os=P(function(Z0){var U0=W(),ou={identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(e)=>new U0.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&ou.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};Z0.boolTag=ou});var Qt=P(function(B0){function q0({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==="bigint")return String(r);let i=typeof r==="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");if(s<0)s=o.length,o+=".";let a=t-(o.length-s-1);while(a-- >0)o+="0"}return o}B0.stringifyNumber=q0});var as=P(function(Y0){var F0=W(),ss=Qt(),K0={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ss.stringifyNumber},W0={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ss.stringifyNumber(e)}},V0={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new F0.Scalar(parseFloat(e)),n=e.indexOf(".");if(n!==-1&&e[e.length-1]==="0")t.minFractionDigits=e.length-n-1;return t},stringify:ss.stringifyNumber};Y0.float=V0;Y0.floatExp=W0;Y0.floatNaN=K0});var ls=P(function(r_){var su=Qt(),ri=(e)=>typeof e==="bigint"||Number.isInteger(e),cs=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function au(e,t,n){let{value:r}=e;if(ri(r)&&r>=0)return n+r.toString(t);return su.stringifyNumber(e)}var e_={identify:(e)=>ri(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>cs(e,2,8,n),stringify:(e)=>au(e,8,"0o")},t_={identify:ri,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>cs(e,0,10,n),stringify:su.stringifyNumber},n_={identify:(e)=>ri(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>cs(e,2,16,n),stringify:(e)=>au(e,16,"0x")};r_.int=t_;r_.intHex=n_;r_.intOct=e_});var cu=P(function(h_){var a_=Yt(),c_=ni(),l_=Jt(),u_=zn(),p_=os(),us=as(),ps=ls(),d_=[a_.map,l_.seq,u_.string,c_.nullTag,p_.boolTag,ps.intOct,ps.int,ps.intHex,us.floatNaN,us.floatExp,us.float];h_.schema=d_});var uu=P(function(__){var m_=W(),g_=Yt(),v_=Jt();function lu(e){return typeof e==="bigint"||Number.isInteger(e)}var ii=({value:e})=>JSON.stringify(e),y_=[{identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify:ii},{identify:(e)=>e==null,createNode:()=>new m_.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ii},{identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(e)=>e==="true",stringify:ii},{identify:lu,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>lu(e)?e.toString():JSON.stringify(e)},{identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(e)=>parseFloat(e),stringify:ii}],b_={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},w_=[g_.map,v_.seq].concat(y_,b_);__.schema=w_});var hs=P(function(A_){var Dn=Oe("buffer"),ds=W(),x_=Cn(),S_={identify:(e)=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Dn.Buffer==="function")return Dn.Buffer.from(e,"base64");else if(typeof atob==="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,i,o){if(!n)return"";let s=n,a;if(typeof Dn.Buffer==="function")a=s instanceof Dn.Buffer?s.toString("base64"):Dn.Buffer.from(s.buffer).toString("base64");else if(typeof btoa==="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=ds.Scalar.BLOCK_LITERAL),t!==ds.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/c),u=Array(l);for(let p=0,d=0;p<l;++p,d+=c)u[p]=a.substr(d,c);a=u.join(t===ds.Scalar.BLOCK_LITERAL?`
54
+ `:" ")}return x_.stringifyString({comment:e,type:t,value:a},r,i,o)}};A_.binary=S_});var si=P(function(O_){var oi=N(),fs=pt(),P_=W(),T_=ft();function pu(e,t){if(oi.isSeq(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(oi.isPair(r))continue;else if(oi.isMap(r)){if(r.items.length>1)t("Each pair must have its own sequence indicator");let i=r.items[0]||new fs.Pair(new P_.Scalar(null));if(r.commentBefore)i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
55
+ ${i.key.commentBefore}`:r.commentBefore;if(r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
56
+ ${o.comment}`:r.comment}r=i}e.items[n]=oi.isPair(r)?r:new fs.Pair(r)}else t("Expected a sequence for this tag");return e}function du(e,t,n){let{replacer:r}=n,i=new T_.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){if(typeof r==="function")s=r.call(t,String(o++),s);let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(fs.createPair(a,c,n))}return i}var E_={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:pu,createNode:du};O_.createPairs=du;O_.pairs=E_;O_.resolvePairs=pu});var gs=P(function(D_){var hu=N(),ms=ct(),Ln=ht(),N_=ft(),fu=si();class Tt extends N_.YAMLSeq{constructor(){super();this.add=Ln.YAMLMap.prototype.add.bind(this),this.delete=Ln.YAMLMap.prototype.delete.bind(this),this.get=Ln.YAMLMap.prototype.get.bind(this),this.has=Ln.YAMLMap.prototype.has.bind(this),this.set=Ln.YAMLMap.prototype.set.bind(this),this.tag=Tt.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;if(t?.onCreate)t.onCreate(n);for(let r of this.items){let i,o;if(hu.isPair(r))i=ms.toJS(r.key,"",t),o=ms.toJS(r.value,i,t);else i=ms.toJS(r,"",t);if(n.has(i))throw Error("Ordered maps must not include duplicate keys");n.set(i,o)}return n}static from(e,t,n){let r=fu.createPairs(e,t,n),i=new this;return i.items=r.items,i}}Tt.tag="tag:yaml.org,2002:omap";var z_={collection:"seq",identify:(e)=>e instanceof Map,nodeClass:Tt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=fu.resolvePairs(e,t),r=[];for(let{key:i}of n.items)if(hu.isScalar(i))if(r.includes(i.value))t(`Ordered maps must not include duplicate keys: ${i.value}`);else r.push(i.value);return Object.assign(new Tt,n)},createNode:(e,t,n)=>Tt.from(e,t,n)};D_.YAMLOMap=Tt;D_.omap=z_});var bu=P(function(M_){var mu=W();function gu({value:e,source:t},n){if(t&&(e?vu:yu).test.test(t))return t;return e?n.options.trueStr:n.options.falseStr}var vu={identify:(e)=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new mu.Scalar(!0),stringify:gu},yu={identify:(e)=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new mu.Scalar(!1),stringify:gu};M_.falseTag=yu;M_.trueTag=vu});var wu=P(function(F_){var G_=W(),vs=Qt(),q_={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:vs.stringifyNumber},B_={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():vs.stringifyNumber(e)}},H_={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new G_.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");if(r[r.length-1]==="0")t.minFractionDigits=r.length}return t},stringify:vs.stringifyNumber};F_.float=H_;F_.floatExp=B_;F_.floatNaN=q_});var ku=P(function(ek){var _u=Qt(),jn=(e)=>typeof e==="bigint"||Number.isInteger(e);function ai(e,t,n,{intAsBigInt:r}){let i=e[0];if(i==="-"||i==="+")t+=1;if(e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return i==="-"?BigInt(-1)*s:s}let o=parseInt(e,n);return i==="-"?-1*o:o}function ys(e,t,n){let{value:r}=e;if(jn(r)){let i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return _u.stringifyNumber(e)}var Y_={identify:jn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>ai(e,2,2,n),stringify:(e)=>ys(e,2,"0b")},J_={identify:jn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>ai(e,1,8,n),stringify:(e)=>ys(e,8,"0")},Q_={identify:jn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>ai(e,0,10,n),stringify:_u.stringifyNumber},X_={identify:jn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>ai(e,2,16,n),stringify:(e)=>ys(e,16,"0x")};ek.int=Q_;ek.intBin=Y_;ek.intHex=X_;ek.intOct=J_});var bs=P(function(sk){var ui=N(),ci=pt(),li=ht();class Et extends li.YAMLMap{constructor(e){super(e);this.tag=Et.tag}add(e){let t;if(ui.isPair(e))t=e;else if(e&&typeof e==="object"&&"key"in e&&"value"in e&&e.value===null)t=new ci.Pair(e.key,null);else t=new ci.Pair(e,null);if(!li.findPair(this.items,t.key))this.items.push(t)}get(e,t){let n=li.findPair(this.items,e);return!t&&ui.isPair(n)?ui.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=li.findPair(this.items,e);if(n&&!t)this.items.splice(this.items.indexOf(n),1);else if(!n&&t)this.items.push(new ci.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);else throw Error("Set items must all have null values")}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t){if(typeof r==="function")o=r.call(t,o,o);i.items.push(ci.createPair(o,null,n))}return i}}Et.tag="tag:yaml.org,2002:set";var ok={collection:"map",identify:(e)=>e instanceof Set,nodeClass:Et,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Et.from(e,t,n),resolve(e,t){if(ui.isMap(e))if(e.hasAllNullValues(!0))return Object.assign(new Et,e);else t("Set items must all have null values");else t("Expected a mapping for this tag");return e}};sk.YAMLSet=Et;sk.set=ok});var _s=P(function(dk){var lk=Qt();function ws(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=(s)=>t?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function xu(e){let{value:t}=e,n=(s)=>s;if(typeof t==="bigint")n=(s)=>BigInt(s);else if(isNaN(t)||!isFinite(t))return lk.stringifyNumber(e);let r="";if(t<0)r="-",t*=n(-1);let i=n(60),o=[t%i];if(t<60)o.unshift(0);else if(t=(t-o[0])/i,o.unshift(t%i),t>=60)t=(t-o[0])/i,o.unshift(t);return r+o.map((s)=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var uk={identify:(e)=>typeof e==="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>ws(e,n),stringify:xu},pk={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(e)=>ws(e,!1),stringify:xu},Su={identify:(e)=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Su.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,c),u=t[8];if(u&&u!=="Z"){let p=ws(u,!1);if(Math.abs(p)<30)p*=60;l-=60000*p}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};dk.floatTime=pk;dk.intTime=uk;dk.timestamp=Su});var $u=P(function($k){var gk=Yt(),vk=ni(),yk=Jt(),bk=zn(),wk=hs(),Au=bu(),ks=wu(),pi=ku(),_k=Wr(),kk=gs(),xk=si(),Sk=bs(),xs=_s(),Ak=[gk.map,yk.seq,bk.string,vk.nullTag,Au.trueTag,Au.falseTag,pi.intBin,pi.intOct,pi.int,pi.intHex,ks.floatNaN,ks.floatExp,ks.float,wk.binary,_k.merge,kk.omap,xk.pairs,Sk.set,xs.intTime,xs.floatTime,xs.timestamp];$k.schema=Ak});var Du=P(function(zk){var Ou=Yt(),Tk=ni(),Cu=Jt(),Ek=zn(),Ok=os(),Ss=as(),As=ls(),Ck=cu(),Rk=uu(),Ru=hs(),Mn=Wr(),Iu=gs(),Nu=si(),Pu=$u(),zu=bs(),di=_s(),Tu=new Map([["core",Ck.schema],["failsafe",[Ou.map,Cu.seq,Ek.string]],["json",Rk.schema],["yaml11",Pu.schema],["yaml-1.1",Pu.schema]]),Eu={binary:Ru.binary,bool:Ok.boolTag,float:Ss.float,floatExp:Ss.floatExp,floatNaN:Ss.floatNaN,floatTime:di.floatTime,int:As.int,intHex:As.intHex,intOct:As.intOct,intTime:di.intTime,map:Ou.map,merge:Mn.merge,null:Tk.nullTag,omap:Iu.omap,pairs:Nu.pairs,seq:Cu.seq,set:zu.set,timestamp:di.timestamp},Ik={"tag:yaml.org,2002:binary":Ru.binary,"tag:yaml.org,2002:merge":Mn.merge,"tag:yaml.org,2002:omap":Iu.omap,"tag:yaml.org,2002:pairs":Nu.pairs,"tag:yaml.org,2002:set":zu.set,"tag:yaml.org,2002:timestamp":di.timestamp};function Nk(e,t,n){let r=Tu.get(t);if(r&&!e)return n&&!r.includes(Mn.merge)?r.concat(Mn.merge):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let o=Array.from(Tu.keys()).filter((s)=>s!=="yaml11").map((s)=>JSON.stringify(s)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)i=i.concat(o);else if(typeof e==="function")i=e(i.slice());if(n)i=i.concat(Mn.merge);return i.reduce((o,s)=>{let a=typeof s==="string"?Eu[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Eu).map((u)=>JSON.stringify(u)).join(", ");throw Error(`Unknown custom tag ${c}; use one of ${l}`)}if(!o.includes(a))o.push(a);return o},[])}zk.coreKnownTags=Ik;zk.getTags=Nk});var Ts=P(function(Gk){var $s=N(),jk=Yt(),Mk=Jt(),Uk=zn(),hi=Du(),Zk=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class Ps{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?hi.getTags(e,"compat"):e?hi.getTags(null,e):null,this.name=typeof i==="string"&&i||"core",this.knownTags=r?hi.coreKnownTags:{},this.tags=hi.getTags(t,this.name,n),this.toStringOptions=s??null,Object.defineProperty(this,$s.MAP,{value:jk.map}),Object.defineProperty(this,$s.SCALAR,{value:Uk.string}),Object.defineProperty(this,$s.SEQ,{value:Mk.seq}),this.sortMapEntries=typeof o==="function"?o:o===!0?Zk:null}clone(){let e=Object.create(Ps.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}Gk.Schema=Ps});var Lu=P(function(Fk){var Bk=N(),Es=Rn(),Un=En();function Hk(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);if(c)n.push(c),r=!0;else if(e.directives.docStart)r=!0}if(r)n.push("---");let i=Es.createStringifyContext(e,t),{commentString:o}=i.options;if(e.commentBefore){if(n.length!==1)n.unshift("");let c=o(e.commentBefore);n.unshift(Un.indentComment(c,""))}let s=!1,a=null;if(e.contents){if(Bk.isNode(e.contents)){if(e.contents.spaceBefore&&r)n.push("");if(e.contents.commentBefore){let u=o(e.contents.commentBefore);n.push(Un.indentComment(u,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>s=!0,l=Es.stringify(e.contents,i,()=>a=null,c);if(a)l+=Un.lineComment(l,"",o(a));if((l[0]==="|"||l[0]===">")&&n[n.length-1]==="---")n[n.length-1]=`--- ${l}`;else n.push(l)}else n.push(Es.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let c=o(e.comment);if(c.includes(`
57
+ `))n.push("..."),n.push(Un.indentComment(c,""));else n.push(`... ${c}`)}else n.push("...");else{let c=e.comment;if(c&&s)c=c.replace(/^\n+/,"");if(c){if((!s||a)&&n[n.length-1]!=="")n.push("");n.push(Un.indentComment(o(c),""))}}return n.join(`
58
58
  `)+`
59
- `}X_.stringifyDocument=Q_});var pr=A(function(cv){var tv=Jt(),Nt=en(),ue=I(),rv=Ge(),nv=Be(),sv=wo(),ov=Nc(),_o=Jr(),iv=js(),av=Qt(),vo=Ds();class ko{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ue.NODE_TYPE,{value:ue.DOC});let n=null;if(typeof t==="function"||Array.isArray(t))n=t;else if(r===void 0&&t)r=t,t=void 0;let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:o}=s;if(r?._directives){if(this.directives=r._directives.atDocument(),this.directives.yaml.explicit)o=this.directives.yaml.version}else this.directives=new vo.Directives({version:o});this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(ko.prototype,{[ue.NODE_TYPE]:{value:ue.DOC}});if(e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives)e.directives=this.directives.clone();if(e.schema=this.schema.clone(),e.contents=ue.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range)e.range=this.range.slice();return e}add(e){if(Rt(this.contents))this.contents.add(e)}addIn(e,t){if(Rt(this.contents))this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=_o.anchorNames(this);e.anchor=!t||r.has(t)?_o.findNewAnchor(t||"a",r):t}return new tv.Alias(e.anchor)}createNode(e,t,r){let n=void 0;if(typeof t==="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let m=(_)=>typeof _==="number"||_ instanceof String||_ instanceof Number,g=t.filter(m).map(String);if(g.length>0)t=t.concat(g);n=t}else if(r===void 0&&t)r=t,t=void 0;let{aliasDuplicateObjects:s,anchorPrefix:o,flow:i,keepUndefined:a,onTagObj:c,tag:u}=r??{},{onAnchor:l,setAnchors:f,sourceObjects:p}=_o.createNodeAnchors(this,o||"a"),d={aliasDuplicateObjects:s??!0,keepUndefined:a??!1,onAnchor:l,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:p},h=av.createNode(e,u,d);if(i&&ue.isCollection(h))h.flow=!0;return f(),h}createPair(e,t,r={}){let n=this.createNode(e,null,r),s=this.createNode(t,null,r);return new rv.Pair(n,s)}delete(e){return Rt(this.contents)?this.contents.delete(e):!1}deleteIn(e){if(Nt.isEmptyPath(e)){if(this.contents==null)return!1;return this.contents=null,!0}return Rt(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return ue.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){if(Nt.isEmptyPath(e))return!t&&ue.isScalar(this.contents)?this.contents.value:this.contents;return ue.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return ue.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){if(Nt.isEmptyPath(e))return this.contents!==void 0;return ue.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){if(this.contents==null)this.contents=Nt.collectionFromPath(this.schema,[e],t);else if(Rt(this.contents))this.contents.set(e,t)}setIn(e,t){if(Nt.isEmptyPath(e))this.contents=t;else if(this.contents==null)this.contents=Nt.collectionFromPath(this.schema,Array.from(e),t);else if(Rt(this.contents))this.contents.setIn(e,t)}setSchema(e,t={}){if(typeof e==="number")e=String(e);let r;switch(e){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new vo.Directives({version:"1.1"});r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=e;else this.directives=new vo.Directives({version:e});r={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;r=null;break;default:{let n=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(r)this.schema=new sv.Schema(Object.assign(r,t));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:r,maxAliasCount:n,onAnchor:s,reviver:o}={}){let i={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n==="number"?n:100},a=nv.toJS(this.contents,t??"",i);if(typeof s==="function")for(let{count:c,res:u}of i.anchors.values())s(u,c);return typeof o==="function"?iv.applyReviver(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return ov.stringifyDocument(this,e)}}function Rt(e){if(ue.isCollection(e))return!0;throw Error("Expected a YAML collection as document contents")}cv.Document=ko});var fr=A(function(pv){class En extends Error{constructor(e,t,r,n){super();this.name=e,this.code=r,this.message=n,this.pos=t}}class Rc extends En{constructor(e,t,r){super("YAMLParseError",e,t,r)}}class Cc extends En{constructor(e,t,r){super("YAMLWarning",e,t,r)}}var lv=(e,t)=>(r)=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map((a)=>t.linePos(a));let{line:n,col:s}=r.linePos[0];r.message+=` at line ${n}, column ${s}`;let o=s-1,i=e.substring(t.lineStarts[n-1],t.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&i.length>80){let a=Math.min(o-39,i.length-79);i="\u2026"+i.substring(a),o-=a-1}if(i.length>80)i=i.substring(0,79)+"\u2026";if(n>1&&/^ *$/.test(i.substring(0,o))){let a=e.substring(t.lineStarts[n-2],t.lineStarts[n-1]);if(a.length>80)a=a.substring(0,79)+`\u2026
60
- `;i=a+i}if(/[^ ]/.test(i)){let a=1,c=r.linePos[1];if(c?.line===n&&c.col>s)a=Math.max(1,Math.min(c.col-s,80-o));let u=" ".repeat(o)+"^".repeat(a);r.message+=`:
61
-
62
- ${i}
63
- ${u}
64
- `}};pv.YAMLError=En;pv.YAMLParseError=Rc;pv.YAMLWarning=Cc;pv.prettifyError=lv});var dr=A(function(yv){function gv(e,{flow:t,indicator:r,next:n,offset:s,onError:o,parentIndent:i,startOnNewline:a}){let c=!1,u=a,l=a,f="",p="",d=!1,h=!1,m=null,g=null,_=null,S=null,x=null,b=null,v=null;for(let P of e){if(h){if(P.type!=="space"&&P.type!=="newline"&&P.type!=="comma")o(P.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");h=!1}if(m){if(u&&P.type!=="comment"&&P.type!=="newline")o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation");m=null}switch(P.type){case"space":if(!t&&(r!=="doc-start"||n?.type!=="flow-collection")&&P.source.includes("\t"))m=P;l=!0;break;case"comment":{if(!l)o(P,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let K=P.source.substring(1)||" ";if(!f)f=K;else f+=p+K;p="",u=!1;break}case"newline":if(u){if(f)f+=P.source;else if(!b||r!=="seq-item-ind")c=!0}else p+=P.source;if(u=!0,d=!0,g||_)S=P;l=!0;break;case"anchor":if(g)o(P,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(P.source.endsWith(":"))o(P.offset+P.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);g=P,v??(v=P.offset),u=!1,l=!1,h=!0;break;case"tag":{if(_)o(P,"MULTIPLE_TAGS","A node can have at most one tag");_=P,v??(v=P.offset),u=!1,l=!1,h=!0;break}case r:if(g||_)o(P,"BAD_PROP_ORDER",`Anchors and tags must be after the ${P.source} indicator`);if(b)o(P,"UNEXPECTED_TOKEN",`Unexpected ${P.source} in ${t??"collection"}`);b=P,u=r==="seq-item-ind"||r==="explicit-key-ind",l=!1;break;case"comma":if(t){if(x)o(P,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`);x=P,u=!1,l=!1;break}default:o(P,"UNEXPECTED_TOKEN",`Unexpected ${P.type} token`),u=!1,l=!1}}let k=e[e.length-1],T=k?k.offset+k.source.length:s;if(h&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!==""))o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(m&&(u&&m.indent<=i||n?.type==="block-map"||n?.type==="block-seq"))o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:x,found:b,spaceBefore:c,comment:f,hasNewline:d,anchor:g,tag:_,newlineAfterProp:S,end:T,start:v??T}}yv.resolveProps=gv});var Tn=A(function(bv){function xo(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
65
- `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(xo(t.key)||xo(t.value))return!0}return!1;default:return!0}}bv.containsNewline=xo});var So=A(function(xv){var vv=Tn();function kv(e,t,r){if(t?.type==="flow-collection"){let n=t.end[0];if(n.indent===e&&(n.source==="]"||n.source==="}")&&vv.containsNewline(t))r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}xv.flowIndentCheck=kv});var Ao=A(function($v){var zc=I();function Av(e,t,r){let{uniqueKeys:n}=e.options;if(n===!1)return!1;let s=typeof n==="function"?n:(o,i)=>o===i||zc.isScalar(o)&&zc.isScalar(i)&&o.value===i.value;return t.some((o)=>s(o.key,r))}$v.mapIncludes=Av});var Zc=A(function(Nv){var Lc=Ge(),Ev=We(),Dc=dr(),Tv=Tn(),jc=So(),Ov=Ao(),Uc="All mapping items must start at the same column";function Iv({composeNode:e,composeEmptyNode:t},r,n,s,o){let a=new(o?.nodeClass??Ev.YAMLMap)(r.schema);if(r.atRoot)r.atRoot=!1;let c=n.offset,u=null;for(let l of n.items){let{start:f,key:p,sep:d,value:h}=l,m=Dc.resolveProps(f,{indicator:"explicit-key-ind",next:p??d?.[0],offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0}),g=!m.found;if(g){if(p){if(p.type==="block-seq")s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in p&&p.indent!==n.indent)s(c,"BAD_INDENT",Uc)}if(!m.anchor&&!m.tag&&!d){if(u=m.end,m.comment)if(a.comment)a.comment+=`
66
- `+m.comment;else a.comment=m.comment;continue}if(m.newlineAfterProp||Tv.containsNewline(p))s(p??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(m.found?.indent!==n.indent)s(c,"BAD_INDENT",Uc);r.atKey=!0;let _=m.end,S=p?e(r,p,m,s):t(r,_,f,null,m,s);if(r.schema.compat)jc.flowIndentCheck(n.indent,p,s);if(r.atKey=!1,Ov.mapIncludes(r,a.items,S))s(_,"DUPLICATE_KEY","Map keys must be unique");let x=Dc.resolveProps(d??[],{indicator:"map-value-ind",next:h,offset:S.range[2],onError:s,parentIndent:n.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=x.end,x.found){if(g){if(h?.type==="block-map"&&!x.hasNewline)s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(r.options.strict&&m.start<x.found.offset-1024)s(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let b=h?e(r,h,x,s):t(r,c,d,null,x,s);if(r.schema.compat)jc.flowIndentCheck(n.indent,h,s);c=b.range[2];let v=new Lc.Pair(S,b);if(r.options.keepSourceTokens)v.srcToken=l;a.items.push(v)}else{if(g)s(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(x.comment)if(S.comment)S.comment+=`
67
- `+x.comment;else S.comment=x.comment;let b=new Lc.Pair(S);if(r.options.keepSourceTokens)b.srcToken=l;a.items.push(b)}}if(u&&u<c)s(u,"IMPOSSIBLE","Map comment with trailing content");return a.range=[n.offset,c,u??c],a}Nv.resolveBlockMap=Iv});var Mc=A(function(jv){var Cv=Ve(),zv=dr(),Lv=So();function Dv({composeNode:e,composeEmptyNode:t},r,n,s,o){let a=new(o?.nodeClass??Cv.YAMLSeq)(r.schema);if(r.atRoot)r.atRoot=!1;if(r.atKey)r.atKey=!1;let c=n.offset,u=null;for(let{start:l,value:f}of n.items){let p=zv.resolveProps(l,{indicator:"seq-item-ind",next:f,offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||f)if(f?.type==="block-seq")s(p.end,"BAD_INDENT","All sequence items must start at the same column");else s(c,"MISSING_CHAR","Sequence item without - indicator");else{if(u=p.end,p.comment)a.comment=p.comment;continue}let d=f?e(r,f,p,s):t(r,p.end,l,null,p,s);if(r.schema.compat)Lv.flowIndentCheck(n.indent,f,s);c=d.range[2],a.items.push(d)}return a.range=[n.offset,c,u??c],a}jv.resolveBlockSeq=Dv});var Ct=A(function(Mv){function Zv(e,t,r,n){let s="";if(e){let o=!1,i="";for(let a of e){let{source:c,type:u}=a;switch(u){case"space":o=!0;break;case"comment":{if(r&&!o)n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let l=c.substring(1)||" ";if(!s)s=l;else s+=i+l;i="";break}case"newline":if(s)i+=c;o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}t+=c.length}}return{comment:s,offset:t}}Mv.resolveEnd=Zv});var Kc=A(function(Yv){var Bv=I(),Kv=Ge(),qc=We(),Fv=Ve(),Gv=Ct(),Bc=dr(),Hv=Tn(),Wv=Ao(),$o="Block collections are not allowed within flow collections",Po=(e)=>e&&(e.type==="block-map"||e.type==="block-seq");function Vv({composeNode:e,composeEmptyNode:t},r,n,s,o){let i=n.start.source==="{",a=i?"flow map":"flow sequence",u=new(o?.nodeClass??(i?qc.YAMLMap:Fv.YAMLSeq))(r.schema);u.flow=!0;let l=r.atRoot;if(l)r.atRoot=!1;if(r.atKey)r.atKey=!1;let f=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){let _=n.items[g],{start:S,key:x,sep:b,value:v}=_,k=Bc.resolveProps(S,{flow:a,indicator:"explicit-key-ind",next:x??b?.[0],offset:f,onError:s,parentIndent:n.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!b&&!v){if(g===0&&k.comma)s(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(g<n.items.length-1)s(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`);if(k.comment)if(u.comment)u.comment+=`
68
- `+k.comment;else u.comment=k.comment;f=k.end;continue}if(!i&&r.options.strict&&Hv.containsNewline(x))s(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0){if(k.comma)s(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`)}else{if(!k.comma)s(k.start,"MISSING_CHAR",`Missing , between ${a} items`);if(k.comment){let T="";e:for(let P of S)switch(P.type){case"comma":case"space":break;case"comment":T=P.source.substring(1);break e;default:break e}if(T){let P=u.items[u.items.length-1];if(Bv.isPair(P))P=P.value??P.key;if(P.comment)P.comment+=`
69
- `+T;else P.comment=T;k.comment=k.comment.substring(T.length+1)}}}if(!i&&!b&&!k.found){let T=v?e(r,v,k,s):t(r,k.end,b,null,k,s);if(u.items.push(T),f=T.range[2],Po(v))s(T.range,"BLOCK_IN_FLOW",$o)}else{r.atKey=!0;let T=k.end,P=x?e(r,x,k,s):t(r,T,S,null,k,s);if(Po(x))s(P.range,"BLOCK_IN_FLOW",$o);r.atKey=!1;let K=Bc.resolveProps(b??[],{flow:a,indicator:"map-value-ind",next:v,offset:P.range[2],onError:s,parentIndent:n.indent,startOnNewline:!1});if(K.found){if(!i&&!k.found&&r.options.strict){if(b)for(let G of b){if(G===K.found)break;if(G.type==="newline"){s(G,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(k.start<K.found.offset-1024)s(K.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(v)if("source"in v&&v.source?.[0]===":")s(v,"MISSING_CHAR",`Missing space after : in ${a}`);else s(K.start,"MISSING_CHAR",`Missing , or : between ${a} items`);let ae=v?e(r,v,K,s):K.found?t(r,K.end,b,null,K,s):null;if(ae){if(Po(v))s(ae.range,"BLOCK_IN_FLOW",$o)}else if(K.comment)if(P.comment)P.comment+=`
70
- `+K.comment;else P.comment=K.comment;let Ce=new Kv.Pair(P,ae);if(r.options.keepSourceTokens)Ce.srcToken=_;if(i){let G=u;if(Wv.mapIncludes(r,G.items,P))s(T,"DUPLICATE_KEY","Map keys must be unique");G.items.push(Ce)}else{let G=new qc.YAMLMap(r.schema);G.flow=!0,G.items.push(Ce);let Gr=(ae??P).range;G.range=[P.range[0],Gr[1],Gr[2]],u.items.push(G)}f=ae?ae.range[2]:K.end}}let p=i?"}":"]",[d,...h]=n.end,m=f;if(d?.source===p)m=d.offset+d.source.length;else{let g=a[0].toUpperCase()+a.substring(1),_=l?`${g} must end with a ${p}`:`${g} in block collection must be sufficiently indented and end with a ${p}`;if(s(f,l?"MISSING_CHAR":"BAD_INDENT",_),d&&d.source.length!==1)h.unshift(d)}if(h.length>0){let g=Gv.resolveEnd(h,m,r.options.strict,s);if(g.comment)if(u.comment)u.comment+=`
71
- `+g.comment;else u.comment=g.comment;u.range=[n.offset,m,g.offset]}else u.range=[n.offset,m,m];return u}Yv.resolveFlowCollection=Vv});var Fc=A(function(ik){var Qv=I(),Xv=H(),ek=We(),tk=Ve(),rk=Zc(),nk=Mc(),sk=Kc();function Eo(e,t,r,n,s,o){let i=r.type==="block-map"?rk.resolveBlockMap(e,t,r,n,o):r.type==="block-seq"?nk.resolveBlockSeq(e,t,r,n,o):sk.resolveFlowCollection(e,t,r,n,o),a=i.constructor;if(s==="!"||s===a.tagName)return i.tag=a.tagName,i;if(s)i.tag=s;return i}function ok(e,t,r,n,s){let o=n.tag,i=!o?null:t.directives.tagName(o.source,(p)=>s(o,"TAG_RESOLVE_FAILED",p));if(r.type==="block-seq"){let{anchor:p,newlineAfterProp:d}=n,h=p&&o?p.offset>o.offset?p:o:p??o;if(h&&(!d||d.offset<h.offset))s(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!i||i==="!"||i===ek.YAMLMap.tagName&&a==="map"||i===tk.YAMLSeq.tagName&&a==="seq")return Eo(e,t,r,s,i);let c=t.schema.tags.find((p)=>p.tag===i&&p.collection===a);if(!c){let p=t.schema.knownTags[i];if(p?.collection===a)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else{if(p)s(o,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0);else s(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0);return Eo(e,t,r,s,i)}}let u=Eo(e,t,r,s,i,c),l=c.resolve?.(u,(p)=>s(o,"TAG_RESOLVE_FAILED",p),t.options)??u,f=Qv.isNode(l)?l:new Xv.Scalar(l);if(f.range=u.range,f.tag=i,c?.format)f.format=c.format;return f}ik.composeCollection=ok});var Oo=A(function(pk){var To=H();function ck(e,t,r){let n=t.offset,s=uk(t,e.options.strict,r);if(!s)return{value:"",type:null,comment:"",range:[n,n,n]};let o=s.mode===">"?To.Scalar.BLOCK_FOLDED:To.Scalar.BLOCK_LITERAL,i=t.source?lk(t.source):[],a=i.length;for(let m=i.length-1;m>=0;--m){let g=i[m][1];if(g===""||g==="\r")a=m;else break}if(a===0){let m=s.chomp==="+"&&i.length>0?`
72
- `.repeat(Math.max(1,i.length-1)):"",g=n+s.length;if(t.source)g+=t.source.length;return{value:m,type:o,comment:s.comment,range:[n,g,g]}}let c=t.indent+s.indent,u=t.offset+s.length,l=0;for(let m=0;m<a;++m){let[g,_]=i[m];if(_===""||_==="\r"){if(s.indent===0&&g.length>c)c=g.length}else{if(g.length<c)r(u+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(s.indent===0)c=g.length;if(l=m,c===0&&!e.atRoot)r(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=g.length+_.length+1}for(let m=i.length-1;m>=a;--m)if(i[m][0].length>c)a=m+1;let f="",p="",d=!1;for(let m=0;m<l;++m)f+=i[m][0].slice(c)+`
73
- `;for(let m=l;m<a;++m){let[g,_]=i[m];u+=g.length+_.length+1;let S=_[_.length-1]==="\r";if(S)_=_.slice(0,-1);if(_&&g.length<c){let b=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;r(u-_.length-(S?2:1),"BAD_INDENT",b),g=""}if(o===To.Scalar.BLOCK_LITERAL)f+=p+g.slice(c)+_,p=`
74
- `;else if(g.length>c||_[0]==="\t"){if(p===" ")p=`
75
- `;else if(!d&&p===`
76
- `)p=`
77
-
78
- `;f+=p+g.slice(c)+_,p=`
79
- `,d=!0}else if(_==="")if(p===`
80
- `)f+=`
81
- `;else p=`
82
- `;else f+=p+_,p=" ",d=!1}switch(s.chomp){case"-":break;case"+":for(let m=a;m<i.length;++m)f+=`
83
- `+i[m][0].slice(c);if(f[f.length-1]!==`
84
- `)f+=`
85
- `;break;default:f+=`
86
- `}let h=n+s.length+t.source.length;return{value:f,type:o,comment:s.comment,range:[n,h,h]}}function uk({offset:e,props:t},r,n){if(t[0].type!=="block-scalar-header")return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=t[0],o=s[0],i=0,a="",c=-1;for(let p=1;p<s.length;++p){let d=s[p];if(!a&&(d==="-"||d==="+"))a=d;else{let h=Number(d);if(!i&&h)i=h;else if(c===-1)c=e+p}}if(c!==-1)n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let u=!1,l="",f=s.length;for(let p=1;p<t.length;++p){let d=t[p];switch(d.type){case"space":u=!0;case"newline":f+=d.source.length;break;case"comment":if(r&&!u)n(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");f+=d.source.length,l=d.source.substring(1);break;case"error":n(d,"UNEXPECTED_TOKEN",d.message),f+=d.source.length;break;default:{let h=`Unexpected token in block scalar header: ${d.type}`;n(d,"UNEXPECTED_TOKEN",h);let m=d.source;if(m&&typeof m==="string")f+=m.length}}}return{mode:o,indent:i,chomp:a,comment:l,length:f}}function lk(e){let t=e.split(/\n( *)/),r=t[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let i=1;i<t.length;i+=2)o.push([t[i],t[i+1]]);return o}pk.resolveBlockScalar=ck});var No=A(function(vk){var Io=H(),dk=Ct();function hk(e,t,r){let{offset:n,type:s,source:o,end:i}=e,a,c,u=(p,d,h)=>r(n+p,d,h);switch(s){case"scalar":a=Io.Scalar.PLAIN,c=mk(o,u);break;case"single-quoted-scalar":a=Io.Scalar.QUOTE_SINGLE,c=gk(o,u);break;case"double-quoted-scalar":a=Io.Scalar.QUOTE_DOUBLE,c=yk(o,u);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let l=n+o.length,f=dk.resolveEnd(i,l,t,r);return{value:c,type:a,comment:f.comment,range:[n,l,f.offset]}}function mk(e,t){let r="";switch(e[0]){case"\t":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}if(r)t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`);return Gc(e)}function gk(e,t){if(e[e.length-1]!=="'"||e.length===1)t(e.length,"MISSING_CHAR","Missing closing 'quote");return Gc(e.slice(1,-1)).replace(/''/g,"'")}function Gc(e){let t=/(.*?)\r?\n/sy,r=t.exec(e);if(!r)return e;let n,s;try{n=new RegExp("(?<![ \t])[ \t]+$"),s=new RegExp("^[ \t]+|(?<![ \t])[ \t]+$","g")}catch{n=/[ \t]+$/,s=/^[ \t]+|[ \t]+$/g}let o=r[1].replace(n,""),i=" ",a=t.lastIndex;while(r=t.exec(e)){let u=r[1].replace(s,"");if(u==="")if(i===`
87
- `)o+=i;else i=`
88
- `;else o+=i+u,i=" ";a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+i+(r?.[1]??"")}function yk(e,t){let r="";for(let n=1;n<e.length-1;++n){let s=e[n];if(s==="\r"&&e[n+1]===`
89
- `)continue;if(s===`
90
- `){let{fold:o,offset:i}=wk(e,n);r+=o,n=i}else if(s==="\\"){let o=e[++n],i=bk[o];if(i)r+=i;else if(o===`
91
- `){o=e[n+1];while(o===" "||o==="\t")o=e[++n+1]}else if(o==="\r"&&e[n+1]===`
92
- `){o=e[++n+1];while(o===" "||o==="\t")o=e[++n+1]}else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=_k(e,n+1,a,t),n+=a}else{let a=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(s===" "||s==="\t"){let o=n,i=e[n+1];while(i===" "||i==="\t")i=e[++n+1];if(i!==`
93
- `&&!(i==="\r"&&e[n+2]===`
94
- `))r+=n>o?e.slice(o,n+1):s}else r+=s}if(e[e.length-1]!=='"'||e.length===1)t(e.length,"MISSING_CHAR",'Missing closing "quote');return r}function wk(e,t){let r="",n=e[t+1];while(n===" "||n==="\t"||n===`
95
- `||n==="\r"){if(n==="\r"&&e[t+2]!==`
96
- `)break;if(n===`
97
- `)r+=`
98
- `;t+=1,n=e[t+1]}if(!r)r=" ";return{fold:r,offset:t}}var bk={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
99
- `,r:"\r",t:"\t",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function _k(e,t,r,n){let s=e.substr(t,r),i=s.length===r&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(i)}catch{let a=e.substr(t-2,r+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}vk.resolveFlowScalar=hk});var Wc=A(function(Ek){var pt=I(),Hc=H(),xk=Oo(),Sk=No();function Ak(e,t,r,n){let{value:s,type:o,comment:i,range:a}=t.type==="block-scalar"?xk.resolveBlockScalar(e,t,n):Sk.resolveFlowScalar(t,e.options.strict,n),c=r?e.directives.tagName(r.source,(f)=>n(r,"TAG_RESOLVE_FAILED",f)):null,u;if(e.options.stringKeys&&e.atKey)u=e.schema[pt.SCALAR];else if(c)u=$k(e.schema,s,c,r,n);else if(t.type==="scalar")u=Pk(e,s,t,n);else u=e.schema[pt.SCALAR];let l;try{let f=u.resolve(s,(p)=>n(r??t,"TAG_RESOLVE_FAILED",p),e.options);l=pt.isScalar(f)?f:new Hc.Scalar(f)}catch(f){let p=f instanceof Error?f.message:String(f);n(r??t,"TAG_RESOLVE_FAILED",p),l=new Hc.Scalar(s)}if(l.range=a,l.source=s,o)l.type=o;if(c)l.tag=c;if(u.format)l.format=u.format;if(i)l.comment=i;return l}function $k(e,t,r,n,s){if(r==="!")return e[pt.SCALAR];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let i=e.knownTags[r];if(i&&!i.collection)return e.tags.push(Object.assign({},i,{default:!1,test:void 0})),i;return s(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[pt.SCALAR]}function Pk({atKey:e,directives:t,schema:r},n,s,o){let i=r.tags.find((a)=>(a.default===!0||e&&a.default==="key")&&a.test?.test(n))||r[pt.SCALAR];if(r.compat){let a=r.compat.find((c)=>c.default&&c.test?.test(n))??r[pt.SCALAR];if(i.tag!==a.tag){let c=t.tagString(i.tag),u=t.tagString(a.tag),l=`Value may be parsed as either ${c} or ${u}`;o(s,"TAG_RESOLVE_FAILED",l,!0)}}return i}Ek.composeScalar=Ak});var Vc=A(function(Ik){function Ok(e,t,r){if(t){r??(r=t.length);for(let n=r-1;n>=0;--n){let s=t[n];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}s=t[++n];while(s?.type==="space")e+=s.source.length,s=t[++n];break}}return e}Ik.emptyScalarPosition=Ok});var Qc=A(function(Zk){var Rk=Jt(),Ck=I(),zk=Fc(),Yc=Wc(),Lk=Ct(),Dk=Vc(),jk={composeNode:Jc,composeEmptyNode:Ro};function Jc(e,t,r,n){let s=e.atKey,{spaceBefore:o,comment:i,anchor:a,tag:c}=r,u,l=!0;switch(t.type){case"alias":if(u=Uk(e,t,n),a||c)n(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(u=Yc.composeScalar(e,t,c,n),a)u.anchor=a.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(u=zk.composeCollection(jk,e,t,r,n),a)u.anchor=a.source.substring(1)}catch(f){let p=f instanceof Error?f.message:String(f);n(t,"RESOURCE_EXHAUSTION",p)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;n(t,"UNEXPECTED_TOKEN",f),l=!1}}if(u??(u=Ro(e,t.offset,void 0,null,r,n)),a&&u.anchor==="")n(a,"BAD_ALIAS","Anchor cannot be an empty string");if(s&&e.options.stringKeys&&(!Ck.isScalar(u)||typeof u.value!=="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str"))n(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(o)u.spaceBefore=!0;if(i)if(t.type==="scalar"&&t.source==="")u.comment=i;else u.commentBefore=i;if(e.options.keepSourceTokens&&l)u.srcToken=t;return u}function Ro(e,t,r,n,{spaceBefore:s,comment:o,anchor:i,tag:a,end:c},u){let l={type:"scalar",offset:Dk.emptyScalarPosition(t,r,n),indent:-1,source:""},f=Yc.composeScalar(e,l,a,u);if(i){if(f.anchor=i.source.substring(1),f.anchor==="")u(i,"BAD_ALIAS","Anchor cannot be an empty string")}if(s)f.spaceBefore=!0;if(o)f.comment=o,f.range[2]=c;return f}function Uk({options:e},{offset:t,source:r,end:n},s){let o=new Rk.Alias(r.substring(1));if(o.source==="")s(t,"BAD_ALIAS","Alias cannot be an empty string");if(o.source.endsWith(":"))s(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=t+r.length,a=Lk.resolveEnd(n,i,e.strict,s);if(o.range=[t,i,a.offset],a.comment)o.comment=a.comment;return o}Zk.composeEmptyNode=Ro;Zk.composeNode=Jc});var eu=A(function(Hk){var Bk=pr(),Xc=Qc(),Kk=Ct(),Fk=dr();function Gk(e,t,{offset:r,start:n,value:s,end:o},i){let a=Object.assign({_directives:t},e),c=new Bk.Document(void 0,a),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},l=Fk.resolveProps(n,{indicator:"doc-start",next:s??o?.[0],offset:r,onError:i,parentIndent:0,startOnNewline:!0});if(l.found){if(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!l.hasNewline)i(l.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}c.contents=s?Xc.composeNode(u,s,l,i):Xc.composeEmptyNode(u,l.end,n,null,l,i);let f=c.contents.range[2],p=Kk.resolveEnd(o,f,!1,i);if(p.comment)c.comment=p.comment;return c.range=[r,f,p.offset],c}Hk.composeDoc=Gk});var Co=A(function(ex){var Vk=he("process"),Yk=Ds(),Jk=pr(),hr=fr(),tu=I(),Qk=eu(),Xk=Ct();function mr(e){if(typeof e==="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r==="string"?r.length:1)]}function ru(e){let t="",r=!1,n=!1;for(let s=0;s<e.length;++s){let o=e[s];switch(o[0]){case"#":t+=(t===""?"":n?`
59
+ `}Fk.stringifyDocument=Hk});var Zn=P(function(tx){var Wk=Pn(),Xt=Zr(),Se=N(),Vk=pt(),Yk=ct(),Jk=Ts(),Qk=Lu(),Os=jr(),Xk=Vo(),ex=Tn(),Cs=Wo();class Rs{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Se.NODE_TYPE,{value:Se.DOC});let r=null;if(typeof t==="function"||Array.isArray(t))r=t;else if(n===void 0&&t)n=t,t=void 0;let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:o}=i;if(n?._directives){if(this.directives=n._directives.atDocument(),this.directives.yaml.explicit)o=this.directives.yaml.version}else this.directives=new Cs.Directives({version:o});this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let e=Object.create(Rs.prototype,{[Se.NODE_TYPE]:{value:Se.DOC}});if(e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives)e.directives=this.directives.clone();if(e.schema=this.schema.clone(),e.contents=Se.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range)e.range=this.range.slice();return e}add(e){if(en(this.contents))this.contents.add(e)}addIn(e,t){if(en(this.contents))this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Os.anchorNames(this);e.anchor=!t||n.has(t)?Os.findNewAnchor(t||"a",n):t}return new Wk.Alias(e.anchor)}createNode(e,t,n){let r=void 0;if(typeof t==="function")e=t.call({"":e},"",e),r=t;else if(Array.isArray(t)){let m=(w)=>typeof w==="number"||w instanceof String||w instanceof Number,g=t.filter(m).map(String);if(g.length>0)t=t.concat(g);r=t}else if(n===void 0&&t)n=t,t=void 0;let{aliasDuplicateObjects:i,anchorPrefix:o,flow:s,keepUndefined:a,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:p,sourceObjects:d}=Os.createNodeAnchors(this,o||"a"),h={aliasDuplicateObjects:i??!0,keepUndefined:a??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:d},f=ex.createNode(e,l,h);if(s&&Se.isCollection(f))f.flow=!0;return p(),f}createPair(e,t,n={}){let r=this.createNode(e,null,n),i=this.createNode(t,null,n);return new Vk.Pair(r,i)}delete(e){return en(this.contents)?this.contents.delete(e):!1}deleteIn(e){if(Xt.isEmptyPath(e)){if(this.contents==null)return!1;return this.contents=null,!0}return en(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Se.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){if(Xt.isEmptyPath(e))return!t&&Se.isScalar(this.contents)?this.contents.value:this.contents;return Se.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Se.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){if(Xt.isEmptyPath(e))return this.contents!==void 0;return Se.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){if(this.contents==null)this.contents=Xt.collectionFromPath(this.schema,[e],t);else if(en(this.contents))this.contents.set(e,t)}setIn(e,t){if(Xt.isEmptyPath(e))this.contents=t;else if(this.contents==null)this.contents=Xt.collectionFromPath(this.schema,Array.from(e),t);else if(en(this.contents))this.contents.setIn(e,t)}setSchema(e,t={}){if(typeof e==="number")e=String(e);let n;switch(e){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new Cs.Directives({version:"1.1"});n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=e;else this.directives=new Cs.Directives({version:e});n={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;n=null;break;default:{let r=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Jk.Schema(Object.assign(n,t));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==="number"?r:100},a=Yk.toJS(this.contents,t??"",s);if(typeof i==="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o==="function"?Xk.applyReviver(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return Qk.stringifyDocument(this,e)}}function en(e){if(Se.isCollection(e))return!0;throw Error("Expected a YAML collection as document contents")}tx.Document=Rs});var Gn=P(function(ix){class fi extends Error{constructor(e,t,n,r){super();this.name=e,this.code=n,this.message=r,this.pos=t}}class ju extends fi{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class Mu extends fi{constructor(e,t,n){super("YAMLWarning",e,t,n)}}var rx=(e,t)=>(n)=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map((a)=>t.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80)s=s.substring(0,79)+"\u2026";if(r>1&&/^ *$/.test(s.substring(0,o))){let a=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);if(a.length>80)a=a.substring(0,79)+`\u2026
60
+ `;s=a+s}if(/[^ ]/.test(s)){let a=1,c=n.linePos[1];if(c?.line===r&&c.col>i)a=Math.max(1,Math.min(c.col-i,80-o));let l=" ".repeat(o)+"^".repeat(a);n.message+=`:
61
+
62
+ ${s}
63
+ ${l}
64
+ `}};ix.YAMLError=fi;ix.YAMLParseError=ju;ix.YAMLWarning=Mu;ix.prettifyError=rx});var qn=P(function(ux){function lx(e,{flow:t,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,p="",d="",h=!1,f=!1,m=null,g=null,w=null,x=null,_=null,b=null,k=null;for(let A of e){if(f){if(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma")o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");f=!1}if(m){if(l&&A.type!=="comment"&&A.type!=="newline")o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation");m=null}switch(A.type){case"space":if(!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&A.source.includes("\t"))m=A;u=!0;break;case"comment":{if(!u)o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=A.source.substring(1)||" ";if(!p)p=L;else p+=d+L;d="",l=!1;break}case"newline":if(l){if(p)p+=A.source;else if(!b||n!=="seq-item-ind")c=!0}else d+=A.source;if(l=!0,h=!0,g||w)x=A;u=!0;break;case"anchor":if(g)o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(A.source.endsWith(":"))o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);g=A,k??(k=A.offset),l=!1,u=!1,f=!0;break;case"tag":{if(w)o(A,"MULTIPLE_TAGS","A node can have at most one tag");w=A,k??(k=A.offset),l=!1,u=!1,f=!0;break}case n:if(g||w)o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`);if(b)o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${t??"collection"}`);b=A,l=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(t){if(_)o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`);_=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}}let S=e[e.length-1],O=S?S.offset+S.source.length:i;if(f&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!==""))o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(m&&(l&&m.indent<=s||r?.type==="block-map"||r?.type==="block-seq"))o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:_,found:b,spaceBefore:c,comment:p,hasNewline:h,anchor:g,tag:w,newlineAfterProp:x,end:O,start:k??O}}ux.resolveProps=lx});var mi=P(function(dx){function Is(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
65
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(Is(t.key)||Is(t.value))return!0}return!1;default:return!0}}dx.containsNewline=Is});var Ns=P(function(gx){var fx=mi();function mx(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];if(r.indent===e&&(r.source==="]"||r.source==="}")&&fx.containsNewline(t))n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}gx.flowIndentCheck=mx});var zs=P(function(bx){var Uu=N();function yx(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==="function"?r:(o,s)=>o===s||Uu.isScalar(o)&&Uu.isScalar(s)&&o.value===s.value;return t.some((o)=>i(o.key,n))}bx.mapIncludes=yx});var Hu=P(function(Ax){var Zu=pt(),_x=ht(),Gu=qn(),kx=mi(),qu=Ns(),xx=zs(),Bu="All mapping items must start at the same column";function Sx({composeNode:e,composeEmptyNode:t},n,r,i,o){let a=new(o?.nodeClass??_x.YAMLMap)(n.schema);if(n.atRoot)n.atRoot=!1;let c=r.offset,l=null;for(let u of r.items){let{start:p,key:d,sep:h,value:f}=u,m=Gu.resolveProps(p,{indicator:"explicit-key-ind",next:d??h?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!m.found;if(g){if(d){if(d.type==="block-seq")i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in d&&d.indent!==r.indent)i(c,"BAD_INDENT",Bu)}if(!m.anchor&&!m.tag&&!h){if(l=m.end,m.comment)if(a.comment)a.comment+=`
66
+ `+m.comment;else a.comment=m.comment;continue}if(m.newlineAfterProp||kx.containsNewline(d))i(d??p[p.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(m.found?.indent!==r.indent)i(c,"BAD_INDENT",Bu);n.atKey=!0;let w=m.end,x=d?e(n,d,m,i):t(n,w,p,null,m,i);if(n.schema.compat)qu.flowIndentCheck(r.indent,d,i);if(n.atKey=!1,xx.mapIncludes(n,a.items,x))i(w,"DUPLICATE_KEY","Map keys must be unique");let _=Gu.resolveProps(h??[],{indicator:"map-value-ind",next:f,offset:x.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=_.end,_.found){if(g){if(f?.type==="block-map"&&!_.hasNewline)i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(n.options.strict&&m.start<_.found.offset-1024)i(x.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let b=f?e(n,f,_,i):t(n,c,h,null,_,i);if(n.schema.compat)qu.flowIndentCheck(r.indent,f,i);c=b.range[2];let k=new Zu.Pair(x,b);if(n.options.keepSourceTokens)k.srcToken=u;a.items.push(k)}else{if(g)i(x.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(_.comment)if(x.comment)x.comment+=`
67
+ `+_.comment;else x.comment=_.comment;let b=new Zu.Pair(x);if(n.options.keepSourceTokens)b.srcToken=u;a.items.push(b)}}if(l&&l<c)i(l,"IMPOSSIBLE","Map comment with trailing content");return a.range=[r.offset,c,l??c],a}Ax.resolveBlockMap=Sx});var Fu=P(function(Cx){var Px=ft(),Tx=qn(),Ex=Ns();function Ox({composeNode:e,composeEmptyNode:t},n,r,i,o){let a=new(o?.nodeClass??Px.YAMLSeq)(n.schema);if(n.atRoot)n.atRoot=!1;if(n.atKey)n.atKey=!1;let c=r.offset,l=null;for(let{start:u,value:p}of r.items){let d=Tx.resolveProps(u,{indicator:"seq-item-ind",next:p,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||p)if(p?.type==="block-seq")i(d.end,"BAD_INDENT","All sequence items must start at the same column");else i(c,"MISSING_CHAR","Sequence item without - indicator");else{if(l=d.end,d.comment)a.comment=d.comment;continue}let h=p?e(n,p,d,i):t(n,d.end,u,null,d,i);if(n.schema.compat)Ex.flowIndentCheck(r.indent,p,i);c=h.range[2],a.items.push(h)}return a.range=[r.offset,c,l??c],a}Cx.resolveBlockSeq=Ox});var tn=P(function(Nx){function Ix(e,t,n,r){let i="";if(e){let o=!1,s="";for(let a of e){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{if(n&&!o)r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";if(!i)i=u;else i+=s+u;s="";break}case"newline":if(i)s+=c;o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:i,offset:t}}Nx.resolveEnd=Ix});var Vu=P(function(qx){var Dx=N(),Lx=pt(),Ku=ht(),jx=ft(),Mx=tn(),Wu=qn(),Ux=mi(),Zx=zs(),Ds="Block collections are not allowed within flow collections",Ls=(e)=>e&&(e.type==="block-map"||e.type==="block-seq");function Gx({composeNode:e,composeEmptyNode:t},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",l=new(o?.nodeClass??(s?Ku.YAMLMap:jx.YAMLSeq))(n.schema);l.flow=!0;let u=n.atRoot;if(u)n.atRoot=!1;if(n.atKey)n.atKey=!1;let p=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let w=r.items[g],{start:x,key:_,sep:b,value:k}=w,S=Wu.resolveProps(x,{flow:a,indicator:"explicit-key-ind",next:_??b?.[0],offset:p,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!S.found){if(!S.anchor&&!S.tag&&!b&&!k){if(g===0&&S.comma)i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(g<r.items.length-1)i(S.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`);if(S.comment)if(l.comment)l.comment+=`
68
+ `+S.comment;else l.comment=S.comment;p=S.end;continue}if(!s&&n.options.strict&&Ux.containsNewline(_))i(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0){if(S.comma)i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`)}else{if(!S.comma)i(S.start,"MISSING_CHAR",`Missing , between ${a} items`);if(S.comment){let O="";e:for(let A of x)switch(A.type){case"comma":case"space":break;case"comment":O=A.source.substring(1);break e;default:break e}if(O){let A=l.items[l.items.length-1];if(Dx.isPair(A))A=A.value??A.key;if(A.comment)A.comment+=`
69
+ `+O;else A.comment=O;S.comment=S.comment.substring(O.length+1)}}}if(!s&&!b&&!S.found){let O=k?e(n,k,S,i):t(n,S.end,b,null,S,i);if(l.items.push(O),p=O.range[2],Ls(k))i(O.range,"BLOCK_IN_FLOW",Ds)}else{n.atKey=!0;let O=S.end,A=_?e(n,_,S,i):t(n,O,x,null,S,i);if(Ls(_))i(A.range,"BLOCK_IN_FLOW",Ds);n.atKey=!1;let L=Wu.resolveProps(b??[],{flow:a,indicator:"map-value-ind",next:k,offset:A.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(L.found){if(!s&&!S.found&&n.options.strict){if(b)for(let B of b){if(B===L.found)break;if(B.type==="newline"){i(B,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(S.start<L.found.offset-1024)i(L.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(k)if("source"in k&&k.source?.[0]===":")i(k,"MISSING_CHAR",`Missing space after : in ${a}`);else i(L.start,"MISSING_CHAR",`Missing , or : between ${a} items`);let ae=k?e(n,k,L,i):L.found?t(n,L.end,b,null,L,i):null;if(ae){if(Ls(k))i(ae.range,"BLOCK_IN_FLOW",Ds)}else if(L.comment)if(A.comment)A.comment+=`
70
+ `+L.comment;else A.comment=L.comment;let ke=new Lx.Pair(A,ae);if(n.options.keepSourceTokens)ke.srcToken=w;if(s){let B=l;if(Zx.mapIncludes(n,B.items,A))i(O,"DUPLICATE_KEY","Map keys must be unique");B.items.push(ke)}else{let B=new Ku.YAMLMap(n.schema);B.flow=!0,B.items.push(ke);let St=(ae??A).range;B.range=[A.range[0],St[1],St[2]],l.items.push(B)}p=ae?ae.range[2]:L.end}}let d=s?"}":"]",[h,...f]=r.end,m=p;if(h?.source===d)m=h.offset+h.source.length;else{let g=a[0].toUpperCase()+a.substring(1),w=u?`${g} must end with a ${d}`:`${g} in block collection must be sufficiently indented and end with a ${d}`;if(i(p,u?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1)f.unshift(h)}if(f.length>0){let g=Mx.resolveEnd(f,m,n.options.strict,i);if(g.comment)if(l.comment)l.comment+=`
71
+ `+g.comment;else l.comment=g.comment;l.range=[r.offset,m,g.offset]}else l.range=[r.offset,m,m];return l}qx.resolveFlowCollection=Gx});var Yu=P(function(Xx){var Hx=N(),Fx=W(),Kx=ht(),Wx=ft(),Vx=Hu(),Yx=Fu(),Jx=Vu();function js(e,t,n,r,i,o){let s=n.type==="block-map"?Vx.resolveBlockMap(e,t,n,r,o):n.type==="block-seq"?Yx.resolveBlockSeq(e,t,n,r,o):Jx.resolveFlowCollection(e,t,n,r,o),a=s.constructor;if(i==="!"||i===a.tagName)return s.tag=a.tagName,s;if(i)s.tag=i;return s}function Qx(e,t,n,r,i){let o=r.tag,s=!o?null:t.directives.tagName(o.source,(d)=>i(o,"TAG_RESOLVE_FAILED",d));if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=r,f=d&&o?d.offset>o.offset?d:o:d??o;if(f&&(!h||h.offset<f.offset))i(f,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===Kx.YAMLMap.tagName&&a==="map"||s===Wx.YAMLSeq.tagName&&a==="seq")return js(e,t,n,i,s);let c=t.schema.tags.find((d)=>d.tag===s&&d.collection===a);if(!c){let d=t.schema.knownTags[s];if(d?.collection===a)t.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else{if(d)i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0);else i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0);return js(e,t,n,i,s)}}let l=js(e,t,n,i,s,c),u=c.resolve?.(l,(d)=>i(o,"TAG_RESOLVE_FAILED",d),t.options)??l,p=Hx.isNode(u)?u:new Fx.Scalar(u);if(p.range=l.range,p.tag=s,c?.format)p.format=c.format;return p}Xx.composeCollection=Qx});var Us=P(function(iS){var Ms=W();function tS(e,t,n){let r=t.offset,i=nS(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?Ms.Scalar.BLOCK_FOLDED:Ms.Scalar.BLOCK_LITERAL,s=t.source?rS(t.source):[],a=s.length;for(let m=s.length-1;m>=0;--m){let g=s[m][1];if(g===""||g==="\r")a=m;else break}if(a===0){let m=i.chomp==="+"&&s.length>0?`
72
+ `.repeat(Math.max(1,s.length-1)):"",g=r+i.length;if(t.source)g+=t.source.length;return{value:m,type:o,comment:i.comment,range:[r,g,g]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let m=0;m<a;++m){let[g,w]=s[m];if(w===""||w==="\r"){if(i.indent===0&&g.length>c)c=g.length}else{if(g.length<c)n(l+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(i.indent===0)c=g.length;if(u=m,c===0&&!e.atRoot)n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=g.length+w.length+1}for(let m=s.length-1;m>=a;--m)if(s[m][0].length>c)a=m+1;let p="",d="",h=!1;for(let m=0;m<u;++m)p+=s[m][0].slice(c)+`
73
+ `;for(let m=u;m<a;++m){let[g,w]=s[m];l+=g.length+w.length+1;let x=w[w.length-1]==="\r";if(x)w=w.slice(0,-1);if(w&&g.length<c){let b=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-w.length-(x?2:1),"BAD_INDENT",b),g=""}if(o===Ms.Scalar.BLOCK_LITERAL)p+=d+g.slice(c)+w,d=`
74
+ `;else if(g.length>c||w[0]==="\t"){if(d===" ")d=`
75
+ `;else if(!h&&d===`
76
+ `)d=`
77
+
78
+ `;p+=d+g.slice(c)+w,d=`
79
+ `,h=!0}else if(w==="")if(d===`
80
+ `)p+=`
81
+ `;else d=`
82
+ `;else p+=d+w,d=" ",h=!1}switch(i.chomp){case"-":break;case"+":for(let m=a;m<s.length;++m)p+=`
83
+ `+s[m][0].slice(c);if(p[p.length-1]!==`
84
+ `)p+=`
85
+ `;break;default:p+=`
86
+ `}let f=r+i.length+t.source.length;return{value:p,type:o,comment:i.comment,range:[r,f,f]}}function nS({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],o=i[0],s=0,a="",c=-1;for(let d=1;d<i.length;++d){let h=i[d];if(!a&&(h==="-"||h==="+"))a=h;else{let f=Number(h);if(!s&&f)s=f;else if(c===-1)c=e+d}}if(c!==-1)r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",p=i.length;for(let d=1;d<t.length;++d){let h=t[d];switch(h.type){case"space":l=!0;case"newline":p+=h.source.length;break;case"comment":if(n&&!l)r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");p+=h.source.length,u=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),p+=h.source.length;break;default:{let f=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",f);let m=h.source;if(m&&typeof m==="string")p+=m.length}}}return{mode:o,indent:s,chomp:a,comment:u,length:p}}function rS(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<t.length;s+=2)o.push([t[s],t[s+1]]);return o}iS.resolveBlockScalar=tS});var Gs=P(function(fS){var Zs=W(),sS=tn();function aS(e,t,n){let{offset:r,type:i,source:o,end:s}=e,a,c,l=(d,h,f)=>n(r+d,h,f);switch(i){case"scalar":a=Zs.Scalar.PLAIN,c=cS(o,l);break;case"single-quoted-scalar":a=Zs.Scalar.QUOTE_SINGLE,c=lS(o,l);break;case"double-quoted-scalar":a=Zs.Scalar.QUOTE_DOUBLE,c=uS(o,l);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let u=r+o.length,p=sS.resolveEnd(s,u,t,n);return{value:c,type:a,comment:p.comment,range:[r,u,p.offset]}}function cS(e,t){let n="";switch(e[0]){case"\t":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}if(n)t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`);return Ju(e)}function lS(e,t){if(e[e.length-1]!=="'"||e.length===1)t(e.length,"MISSING_CHAR","Missing closing 'quote");return Ju(e.slice(1,-1)).replace(/''/g,"'")}function Ju(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=new RegExp("(?<![ \t])[ \t]+$"),i=new RegExp("^[ \t]+|(?<![ \t])[ \t]+$","g")}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let o=n[1].replace(r,""),s=" ",a=t.lastIndex;while(n=t.exec(e)){let l=n[1].replace(i,"");if(l==="")if(s===`
87
+ `)o+=s;else s=`
88
+ `;else o+=s+l,s=" ";a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,n=c.exec(e),o+s+(n?.[1]??"")}function uS(e,t){let n="";for(let r=1;r<e.length-1;++r){let i=e[r];if(i==="\r"&&e[r+1]===`
89
+ `)continue;if(i===`
90
+ `){let{fold:o,offset:s}=pS(e,r);n+=o,r=s}else if(i==="\\"){let o=e[++r],s=dS[o];if(s)n+=s;else if(o===`
91
+ `){o=e[r+1];while(o===" "||o==="\t")o=e[++r+1]}else if(o==="\r"&&e[r+1]===`
92
+ `){o=e[++r+1];while(o===" "||o==="\t")o=e[++r+1]}else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=hS(e,r+1,a,t),r+=a}else{let a=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i==="\t"){let o=r,s=e[r+1];while(s===" "||s==="\t")s=e[++r+1];if(s!==`
93
+ `&&!(s==="\r"&&e[r+2]===`
94
+ `))n+=r>o?e.slice(o,r+1):i}else n+=i}if(e[e.length-1]!=='"'||e.length===1)t(e.length,"MISSING_CHAR",'Missing closing "quote');return n}function pS(e,t){let n="",r=e[t+1];while(r===" "||r==="\t"||r===`
95
+ `||r==="\r"){if(r==="\r"&&e[t+2]!==`
96
+ `)break;if(r===`
97
+ `)n+=`
98
+ `;t+=1,r=e[t+1]}if(!n)n=" ";return{fold:n,offset:t}}var dS={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
99
+ `,r:"\r",t:"\t",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function hS(e,t,n,r){let i=e.substr(t,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}fS.resolveFlowScalar=aS});var Xu=P(function(_S){var Ot=N(),Qu=W(),gS=Us(),vS=Gs();function yS(e,t,n,r){let{value:i,type:o,comment:s,range:a}=t.type==="block-scalar"?gS.resolveBlockScalar(e,t,r):vS.resolveFlowScalar(t,e.options.strict,r),c=n?e.directives.tagName(n.source,(p)=>r(n,"TAG_RESOLVE_FAILED",p)):null,l;if(e.options.stringKeys&&e.atKey)l=e.schema[Ot.SCALAR];else if(c)l=bS(e.schema,i,c,n,r);else if(t.type==="scalar")l=wS(e,i,t,r);else l=e.schema[Ot.SCALAR];let u;try{let p=l.resolve(i,(d)=>r(n??t,"TAG_RESOLVE_FAILED",d),e.options);u=Ot.isScalar(p)?p:new Qu.Scalar(p)}catch(p){let d=p instanceof Error?p.message:String(p);r(n??t,"TAG_RESOLVE_FAILED",d),u=new Qu.Scalar(i)}if(u.range=a,u.source=i,o)u.type=o;if(c)u.tag=c;if(l.format)u.format=l.format;if(s)u.comment=s;return u}function bS(e,t,n,r,i){if(n==="!")return e[Ot.SCALAR];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let s=e.knownTags[n];if(s&&!s.collection)return e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s;return i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Ot.SCALAR]}function wS({atKey:e,directives:t,schema:n},r,i,o){let s=n.tags.find((a)=>(a.default===!0||e&&a.default==="key")&&a.test?.test(r))||n[Ot.SCALAR];if(n.compat){let a=n.compat.find((c)=>c.default&&c.test?.test(r))??n[Ot.SCALAR];if(s.tag!==a.tag){let c=t.tagString(s.tag),l=t.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}_S.composeScalar=yS});var ep=P(function(SS){function xS(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}i=t[++r];while(i?.type==="space")e+=i.source.length,i=t[++r];break}}return e}SS.emptyScalarPosition=xS});var rp=P(function(IS){var $S=Pn(),PS=N(),TS=Yu(),tp=Xu(),ES=tn(),OS=ep(),CS={composeNode:np,composeEmptyNode:qs};function np(e,t,n,r){let i=e.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=n,l,u=!0;switch(t.type){case"alias":if(l=RS(e,t,r),a||c)r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(l=tp.composeScalar(e,t,c,r),a)l.anchor=a.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(l=TS.composeCollection(CS,e,t,n,r),a)l.anchor=a.source.substring(1)}catch(p){let d=p instanceof Error?p.message:String(p);r(t,"RESOURCE_EXHAUSTION",d)}break;default:{let p=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",p),u=!1}}if(l??(l=qs(e,t.offset,void 0,null,n,r)),a&&l.anchor==="")r(a,"BAD_ALIAS","Anchor cannot be an empty string");if(i&&e.options.stringKeys&&(!PS.isScalar(l)||typeof l.value!=="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str"))r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(o)l.spaceBefore=!0;if(s)if(t.type==="scalar"&&t.source==="")l.comment=s;else l.commentBefore=s;if(e.options.keepSourceTokens&&u)l.srcToken=t;return l}function qs(e,t,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:OS.emptyScalarPosition(t,n,r),indent:-1,source:""},p=tp.composeScalar(e,u,a,l);if(s){if(p.anchor=s.source.substring(1),p.anchor==="")l(s,"BAD_ALIAS","Anchor cannot be an empty string")}if(i)p.spaceBefore=!0;if(o)p.comment=o,p.range[2]=c;return p}function RS({options:e},{offset:t,source:n,end:r},i){let o=new $S.Alias(n.substring(1));if(o.source==="")i(t,"BAD_ALIAS","Alias cannot be an empty string");if(o.source.endsWith(":"))i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=t+n.length,a=ES.resolveEnd(r,s,e.strict,i);if(o.range=[t,s,a.offset],a.comment)o.comment=a.comment;return o}IS.composeEmptyNode=qs;IS.composeNode=np});var op=P(function(US){var DS=Zn(),ip=rp(),LS=tn(),jS=qn();function MS(e,t,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:t},e),c=new DS.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=jS.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});if(u.found){if(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline)s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}c.contents=i?ip.composeNode(l,i,u,s):ip.composeEmptyNode(l,u.end,r,null,u,s);let p=c.contents.range[2],d=LS.resolveEnd(o,p,!1,s);if(d.comment)c.comment=d.comment;return c.range=[n,p,d.offset],c}US.composeDoc=MS});var Bs=P(function(KS){var GS=Oe("process"),qS=Wo(),BS=Zn(),Bn=Gn(),sp=N(),HS=op(),FS=tn();function Hn(e){if(typeof e==="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==="string"?n.length:1)]}function ap(e){let t="",n=!1,r=!1;for(let i=0;i<e.length;++i){let o=e[i];switch(o[0]){case"#":t+=(t===""?"":r?`
100
100
 
101
101
  `:`
102
- `)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":if(e[s+1]?.[0]!=="#")s+=1;r=!1;break;default:if(!r)n=!0;r=!1}}return{comment:t,afterEmptyLine:n}}class nu{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,n,s)=>{let o=mr(t);if(s)this.warnings.push(new hr.YAMLWarning(o,r,n));else this.errors.push(new hr.YAMLParseError(o,r,n))},this.directives=new Yk.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:n}=ru(this.prelude);if(r){let s=e.contents;if(t)e.comment=e.comment?`${e.comment}
103
- ${r}`:r;else if(n||e.directives.docStart||!s)e.commentBefore=r;else if(tu.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];if(tu.isPair(o))o=o.key;let i=o.commentBefore;o.commentBefore=i?`${r}
104
- ${i}`:r}else{let o=s.commentBefore;s.commentBefore=o?`${r}
105
- ${o}`:r}}if(t){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ru(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(t,r)}*next(e){if(Vk.env.LOG_STREAM)console.dir(e,{depth:null});switch(e.type){case"directive":this.directives.add(e.source,(t,r,n)=>{let s=mr(e);s[0]+=t,this.onError(s,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Qk.composeDoc(this.options,this.directives,e,this.onError);if(this.atDirectives&&!t.directives.docStart)this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(t,!1),this.doc)yield this.doc;this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new hr.YAMLParseError(mr(e),"UNEXPECTED_TOKEN",t);if(this.atDirectives||!this.doc)this.errors.push(r);else this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){this.errors.push(new hr.YAMLParseError(mr(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=Xk.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
106
- ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new hr.YAMLParseError(mr(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new Jk.Document(void 0,r);if(this.atDirectives)this.onError(t,"MISSING_CHAR","Missing directives-end indicator line");n.range=[0,t,t],this.decorate(n,!1),yield n}}}ex.Composer=nu});var iu=A(function(ux){var rx=Oo(),nx=No(),sx=fr(),su=tr();function ox(e,t=!0,r){if(e){let n=(s,o,i)=>{let a=typeof s==="number"?s:Array.isArray(s)?s[0]:s.offset;if(r)r(a,o,i);else throw new sx.YAMLParseError([a,a+1],o,i)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return nx.resolveFlowScalar(e,t,n);case"block-scalar":return rx.resolveBlockScalar({options:{strict:t}},e,n)}}return null}function ix(e,t){let{implicitKey:r=!1,indent:n,inFlow:s=!1,offset:o=-1,type:i="PLAIN"}=t,a=su.stringifyString({type:i,value:e},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:n,source:`
107
- `}];switch(a[0]){case"|":case">":{let u=a.indexOf(`
108
- `),l=a.substring(0,u),f=a.substring(u+1)+`
109
- `,p=[{type:"block-scalar-header",offset:o,indent:n,source:l}];if(!ou(p,c))p.push({type:"newline",offset:-1,indent:n,source:`
110
- `});return{type:"block-scalar",offset:o,indent:n,props:p,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function ax(e,t,r={}){let{afterKey:n=!1,implicitKey:s=!1,inFlow:o=!1,type:i}=r,a="indent"in e?e.indent:null;if(n&&typeof a==="number")a+=2;if(!i)switch(e.type){case"single-quoted-scalar":i="QUOTE_SINGLE";break;case"double-quoted-scalar":i="QUOTE_DOUBLE";break;case"block-scalar":{let u=e.props[0];if(u.type!=="block-scalar-header")throw Error("Invalid block scalar header");i=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:i="PLAIN"}let c=su.stringifyString({type:i,value:t},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":cx(e,c);break;case'"':zo(e,c,"double-quoted-scalar");break;case"'":zo(e,c,"single-quoted-scalar");break;default:zo(e,c,"scalar")}}function cx(e,t){let r=t.indexOf(`
111
- `),n=t.substring(0,r),s=t.substring(r+1)+`
112
- `;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw Error("Invalid block scalar header");o.source=n,e.source=s}else{let{offset:o}=e,i="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:i,source:n}];if(!ou(a,"end"in e?e.end:void 0))a.push({type:"newline",offset:-1,indent:i,source:`
113
- `});for(let c of Object.keys(e))if(c!=="type"&&c!=="offset")delete e[c];Object.assign(e,{type:"block-scalar",indent:i,props:a,source:s})}}function ou(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function zo(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let n=e.props.slice(1),s=t.length;if(e.props[0].type==="block-scalar-header")s-=e.props[0].source.length;for(let o of n)o.offset+=s;delete e.props,Object.assign(e,{type:r,source:t,end:n});break}case"block-map":case"block-seq":{let s={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
114
- `};delete e.items,Object.assign(e,{type:r,source:t,end:[s]});break}default:{let n="indent"in e?e.indent:-1,s="end"in e&&Array.isArray(e.end)?e.end.filter((o)=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))if(o!=="type"&&o!=="offset")delete e[o];Object.assign(e,{type:r,indent:n,source:t,end:s})}}}ux.createScalarToken=ix;ux.resolveAsScalar=ox;ux.setScalarValue=ax});var au=A(function(hx){var dx=(e)=>("type"in e)?In(e):On(e);function In(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=In(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=On(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=On(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=On(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function On({start:e,key:t,sep:r,value:n}){let s="";for(let o of e)s+=o.source;if(t)s+=In(t);if(r)for(let o of r)s+=o.source;if(n)s+=In(n);return s}hx.stringify=dx});var lu=A(function(yx){var Lo=Symbol("break visit"),gx=Symbol("skip children"),cu=Symbol("remove item");function ft(e,t){if("type"in e&&e.type==="document")e={start:e.start,value:e.value};uu(Object.freeze([]),e,t)}ft.BREAK=Lo;ft.SKIP=gx;ft.REMOVE=cu;ft.itemAtPath=(e,t)=>{let r=e;for(let[n,s]of t){let o=r?.[n];if(o&&"items"in o)r=o.items[s];else return}return r};ft.parentCollection=(e,t)=>{let r=ft.itemAtPath(e,t.slice(0,-1)),n=t[t.length-1][0],s=r?.[n];if(s&&"items"in s)return s;throw Error("Parent collection not found")};function uu(e,t,r){let n=r(t,e);if(typeof n==="symbol")return n;for(let s of["key","value"]){let o=t[s];if(o&&"items"in o){for(let i=0;i<o.items.length;++i){let a=uu(Object.freeze(e.concat([[s,i]])),o.items[i],r);if(typeof a==="number")i=a-1;else if(a===Lo)return Lo;else if(a===cu)o.items.splice(i,1),i-=1}if(typeof n==="function"&&s==="key")n=n(t,e)}}return typeof n==="function"?n(t,e):n}yx.visit=ft});var Nn=A(function(Ax){var Do=iu(),bx=au(),_x=lu(),jo="\uFEFF",Uo="\x02",Zo="\x18",Mo="\x1F",vx=(e)=>!!e&&("items"in e),kx=(e)=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function xx(e){switch(e){case jo:return"<BOM>";case Uo:return"<DOC>";case Zo:return"<FLOW_END>";case Mo:return"<SCALAR>";default:return JSON.stringify(e)}}function Sx(e){switch(e){case jo:return"byte-order-mark";case Uo:return"doc-mode";case Zo:return"flow-error-end";case Mo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
102
+ `)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":if(e[i+1]?.[0]!=="#")i+=1;n=!1;break;default:if(!n)r=!0;n=!1}}return{comment:t,afterEmptyLine:r}}class cp{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,r,i)=>{let o=Hn(t);if(i)this.warnings.push(new Bn.YAMLWarning(o,n,r));else this.errors.push(new Bn.YAMLParseError(o,n,r))},this.directives=new qS.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=ap(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
103
+ ${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(sp.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];if(sp.isPair(o))o=o.key;let s=o.commentBefore;o.commentBefore=s?`${n}
104
+ ${s}`:n}else{let o=i.commentBefore;i.commentBefore=o?`${n}
105
+ ${o}`:n}}if(t){for(let i=0;i<this.errors.length;++i)e.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)e.warnings.push(this.warnings[i])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ap(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let r of e)yield*this.next(r);yield*this.end(t,n)}*next(e){if(GS.env.LOG_STREAM)console.dir(e,{depth:null});switch(e.type){case"directive":this.directives.add(e.source,(t,n,r)=>{let i=Hn(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=HS.composeDoc(this.options,this.directives,e,this.onError);if(this.atDirectives&&!t.directives.docStart)this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(t,!1),this.doc)yield this.doc;this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Bn.YAMLParseError(Hn(e),"UNEXPECTED_TOKEN",t);if(this.atDirectives||!this.doc)this.errors.push(n);else this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){this.errors.push(new Bn.YAMLParseError(Hn(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=FS.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
106
+ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Bn.YAMLParseError(Hn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),r=new BS.Document(void 0,n);if(this.atDirectives)this.onError(t,"MISSING_CHAR","Missing directives-end indicator line");r.range=[0,t,t],this.decorate(r,!1),yield r}}}KS.Composer=cp});var pp=P(function(n1){var VS=Us(),YS=Gs(),JS=Gn(),lp=Cn();function QS(e,t=!0,n){if(e){let r=(i,o,s)=>{let a=typeof i==="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,o,s);else throw new JS.YAMLParseError([a,a+1],o,s)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return YS.resolveFlowScalar(e,t,r);case"block-scalar":return VS.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function XS(e,t){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=t,a=lp.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:r,source:`
107
+ `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
108
+ `),u=a.substring(0,l),p=a.substring(l+1)+`
109
+ `,d=[{type:"block-scalar-header",offset:o,indent:r,source:u}];if(!up(d,c))d.push({type:"newline",offset:-1,indent:r,source:`
110
+ `});return{type:"block-scalar",offset:o,indent:r,props:d,source:p}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:c};default:return{type:"scalar",offset:o,indent:r,source:a,end:c}}}function e1(e,t,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in e?e.indent:null;if(r&&typeof a==="number")a+=2;if(!s)switch(e.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=lp.stringifyString({type:s,value:t},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":t1(e,c);break;case'"':Hs(e,c,"double-quoted-scalar");break;case"'":Hs(e,c,"single-quoted-scalar");break;default:Hs(e,c,"scalar")}}function t1(e,t){let n=t.indexOf(`
111
+ `),r=t.substring(0,n),i=t.substring(n+1)+`
112
+ `;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw Error("Invalid block scalar header");o.source=r,e.source=i}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];if(!up(a,"end"in e?e.end:void 0))a.push({type:"newline",offset:-1,indent:s,source:`
113
+ `});for(let c of Object.keys(e))if(c!=="type"&&c!=="offset")delete e[c];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:i})}}function up(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function Hs(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),i=t.length;if(e.props[0].type==="block-scalar-header")i-=e.props[0].source.length;for(let o of r)o.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
114
+ `};delete e.items,Object.assign(e,{type:n,source:t,end:[i]});break}default:{let r="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter((o)=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))if(o!=="type"&&o!=="offset")delete e[o];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}n1.createScalarToken=XS;n1.resolveAsScalar=QS;n1.setScalarValue=e1});var dp=P(function(a1){var s1=(e)=>("type"in e)?vi(e):gi(e);function vi(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=vi(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=gi(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=gi(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=gi(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function gi({start:e,key:t,sep:n,value:r}){let i="";for(let o of e)i+=o.source;if(t)i+=vi(t);if(n)for(let o of n)i+=o.source;if(r)i+=vi(r);return i}a1.stringify=s1});var mp=P(function(u1){var Fs=Symbol("break visit"),l1=Symbol("skip children"),hp=Symbol("remove item");function Ct(e,t){if("type"in e&&e.type==="document")e={start:e.start,value:e.value};fp(Object.freeze([]),e,t)}Ct.BREAK=Fs;Ct.SKIP=l1;Ct.REMOVE=hp;Ct.itemAtPath=(e,t)=>{let n=e;for(let[r,i]of t){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};Ct.parentCollection=(e,t)=>{let n=Ct.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw Error("Parent collection not found")};function fp(e,t,n){let r=n(t,e);if(typeof r==="symbol")return r;for(let i of["key","value"]){let o=t[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=fp(Object.freeze(e.concat([[i,s]])),o.items[s],n);if(typeof a==="number")s=a-1;else if(a===Fs)return Fs;else if(a===hp)o.items.splice(s,1),s-=1}if(typeof r==="function"&&i==="key")r=r(t,e)}}return typeof r==="function"?r(t,e):r}u1.visit=Ct});var yi=P(function(y1){var Ks=pp(),d1=dp(),h1=mp(),Ws="\uFEFF",Vs="\x02",Ys="\x18",Js="\x1F",f1=(e)=>!!e&&("items"in e),m1=(e)=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function g1(e){switch(e){case Ws:return"<BOM>";case Vs:return"<DOC>";case Ys:return"<FLOW_END>";case Js:return"<SCALAR>";default:return JSON.stringify(e)}}function v1(e){switch(e){case Ws:return"byte-order-mark";case Vs:return"doc-mode";case Ys:return"flow-error-end";case Js:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
115
115
  `:case`\r
116
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Ax.createScalarToken=Do.createScalarToken;Ax.resolveAsScalar=Do.resolveAsScalar;Ax.setScalarValue=Do.setScalarValue;Ax.stringify=bx.stringify;Ax.visit=_x.visit;Ax.BOM=jo;Ax.DOCUMENT=Uo;Ax.FLOW_END=Zo;Ax.SCALAR=Mo;Ax.isCollection=vx;Ax.isScalar=kx;Ax.prettyToken=xx;Ax.tokenType=Sx});var Bo=A(function(Mx){var gr=Nn();function ge(e){switch(e){case void 0:case" ":case`
117
- `:case"\r":case"\t":return!0;default:return!1}}var pu=new Set("0123456789ABCDEFabcdef"),Ux=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Rn=new Set(",[]{}"),Zx=new Set(` ,[]{}
118
- \r `),qo=(e)=>!e||Zx.has(e);class fu{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let r=this.next??"stream";while(r&&(t||this.hasChars(1)))r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];while(t===" "||t==="\t")t=this.buffer[++e];if(!t||t==="#"||t===`
116
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}y1.createScalarToken=Ks.createScalarToken;y1.resolveAsScalar=Ks.resolveAsScalar;y1.setScalarValue=Ks.setScalarValue;y1.stringify=d1.stringify;y1.visit=h1.visit;y1.BOM=Ws;y1.DOCUMENT=Vs;y1.FLOW_END=Ys;y1.SCALAR=Js;y1.isCollection=f1;y1.isScalar=m1;y1.prettyToken=g1;y1.tokenType=v1});var Xs=P(function(N1){var Fn=yi();function Re(e){switch(e){case void 0:case" ":case`
117
+ `:case"\r":case"\t":return!0;default:return!1}}var gp=new Set("0123456789ABCDEFabcdef"),R1=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),bi=new Set(",[]{}"),I1=new Set(` ,[]{}
118
+ \r `),Qs=(e)=>!e||I1.has(e);class vp{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";while(n&&(t||this.hasChars(1)))n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];while(t===" "||t==="\t")t=this.buffer[++e];if(!t||t==="#"||t===`
119
119
  `)return!0;if(t==="\r")return this.buffer[e+1]===`
120
- `;return!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;while(t===" ")t=this.buffer[++r+e];if(t==="\r"){let n=this.buffer[r+e+1];if(n===`
121
- `||!n&&!this.atEnd)return e+r+1}return t===`
122
- `||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&ge(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;if(typeof e!=="number"||e!==-1&&e<this.pos)e=this.buffer.indexOf(`
123
- `,this.pos),this.lineEndPos=e;if(e===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[e-1]==="\r")e-=1;return this.buffer.substring(this.pos,e)}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===gr.BOM)yield*this.pushCount(1),e=e.substring(1);if(e[0]==="%"){let t=e.length,r=e.indexOf("#");while(r!==-1){let s=e[r-1];if(s===" "||s==="\t"){t=r-1;break}else r=e.indexOf("#",r+1)}while(!0){let s=e[t-1];if(s===" "||s==="\t")t-=1;else break}let n=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield gr.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&ge(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ge(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ge(t)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(qo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,r=-1;do{if(e=yield*this.pushNewline(),e>0)t=yield*this.pushSpaces(!1),this.indentValue=r=t;else t=0;t+=yield*this.pushSpaces(!0)}while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if(r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&ge(n[3])){if(!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield gr.FLOW_END,yield*this.parseLineStart()}let s=0;while(n[s]===",")s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),n[s]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(qo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ge(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")while(t!==-1&&this.buffer[t+1]==="'")t=this.buffer.indexOf("'",t+2);else while(t!==-1){let s=0;while(this.buffer[t-1-s]==="\\")s+=1;if(s%2===0)break;t=this.buffer.indexOf('"',t+1)}let r=this.buffer.substring(0,t),n=r.indexOf(`
124
- `,this.pos);if(n!==-1){while(n!==-1){let s=this.continueScalar(n+1);if(s===-1)break;n=r.indexOf(`
125
- `,s)}if(n!==-1)t=n-(r[n-1]==="\r"?2:1)}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;while(!0){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil((t)=>ge(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":t+=1;break;case`
126
- `:e=s,t=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
127
- `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=t;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
128
- `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;r=this.buffer[n];while(r===" ")r=this.buffer[++n];if(r==="\t"){while(r==="\t"||r===" "||r==="\r"||r===`
129
- `)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];if(o==="\r")o=this.buffer[--s];let i=s;while(o===" ")o=this.buffer[--s];if(o===`
130
- `&&s>=this.pos&&s+1+t>i)e=s;else break}while(!0);return yield gr.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,r=this.pos-1,n;while(n=this.buffer[++r])if(n===":"){let s=this.buffer[r+1];if(ge(s)||e&&Rn.has(s))break;t=r}else if(ge(n)){let s=this.buffer[r+1];if(n==="\r")if(s===`
131
- `)r+=1,n=`
132
- `,s=this.buffer[r+1];else t=r;if(s==="#"||e&&Rn.has(s))break;if(n===`
133
- `){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&Rn.has(n))break;t=r}if(!n&&!this.atEnd)return this.setNext("plain-scalar");return yield gr.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc"}*pushCount(e){if(e>0)return yield this.buffer.substr(this.pos,e),this.pos+=e,e;return 0}*pushToIndex(e,t){let r=this.buffer.slice(this.pos,e);if(r)return yield r,this.pos+=r.length,r.length;else if(t)yield"";return 0}*pushIndicators(){let e=0;e:while(!0){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(qo),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,r=this.charAt(1);if(ge(r)||t&&Rn.has(r)){if(!t)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];while(!ge(t)&&t!==">")t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];while(t)if(Ux.has(t))t=this.buffer[++e];else if(t==="%"&&pu.has(this.buffer[e+1])&&pu.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];if(e===`
120
+ `;return!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;while(t===" ")t=this.buffer[++n+e];if(t==="\r"){let r=this.buffer[n+e+1];if(r===`
121
+ `||!r&&!this.atEnd)return e+n+1}return t===`
122
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Re(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;if(typeof e!=="number"||e!==-1&&e<this.pos)e=this.buffer.indexOf(`
123
+ `,this.pos),this.lineEndPos=e;if(e===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[e-1]==="\r")e-=1;return this.buffer.substring(this.pos,e)}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Fn.BOM)yield*this.pushCount(1),e=e.substring(1);if(e[0]==="%"){let t=e.length,n=e.indexOf("#");while(n!==-1){let i=e[n-1];if(i===" "||i==="\t"){t=n-1;break}else n=e.indexOf("#",n+1)}while(!0){let i=e[t-1];if(i===" "||i==="\t")t-=1;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield Fn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&Re(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Re(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Re(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Qs),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do{if(e=yield*this.pushNewline(),e>0)t=yield*this.pushSpaces(!1),this.indentValue=n=t;else t=0;t+=yield*this.pushSpaces(!0)}while(e+t>0);let r=this.getLine();if(r===null)return this.setNext("flow");if(n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&Re(r[3])){if(!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Fn.FLOW_END,yield*this.parseLineStart()}let i=0;while(r[i]===",")i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Qs),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||Re(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")while(t!==-1&&this.buffer[t+1]==="'")t=this.buffer.indexOf("'",t+2);else while(t!==-1){let i=0;while(this.buffer[t-1-i]==="\\")i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
124
+ `,this.pos);if(r!==-1){while(r!==-1){let i=this.continueScalar(r+1);if(i===-1)break;r=n.indexOf(`
125
+ `,i)}if(r!==-1)t=r-(n[r-1]==="\r"?2:1)}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;while(!0){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil((t)=>Re(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
126
+ `:e=i,t=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
127
+ `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=t;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
128
+ `,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;n=this.buffer[r];while(n===" ")n=this.buffer[++r];if(n==="\t"){while(n==="\t"||n===" "||n==="\r"||n===`
129
+ `)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];if(o==="\r")o=this.buffer[--i];let s=i;while(o===" ")o=this.buffer[--i];if(o===`
130
+ `&&i>=this.pos&&i+1+t>s)e=i;else break}while(!0);return yield Fn.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;while(r=this.buffer[++n])if(r===":"){let i=this.buffer[n+1];if(Re(i)||e&&bi.has(i))break;t=n}else if(Re(r)){let i=this.buffer[n+1];if(r==="\r")if(i===`
131
+ `)n+=1,r=`
132
+ `,i=this.buffer[n+1];else t=n;if(i==="#"||e&&bi.has(i))break;if(r===`
133
+ `){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&bi.has(r))break;t=n}if(!r&&!this.atEnd)return this.setNext("plain-scalar");return yield Fn.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc"}*pushCount(e){if(e>0)return yield this.buffer.substr(this.pos,e),this.pos+=e,e;return 0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);if(n)return yield n,this.pos+=n.length,n.length;else if(t)yield"";return 0}*pushIndicators(){let e=0;e:while(!0){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Qs),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,n=this.charAt(1);if(Re(n)||t&&bi.has(n)){if(!t)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];while(!Re(t)&&t!==">")t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];while(t)if(R1.has(t))t=this.buffer[++e];else if(t==="%"&&gp.has(this.buffer[e+1])&&gp.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];if(e===`
134
134
  `)return yield*this.pushCount(1);else if(e==="\r"&&this.charAt(1)===`
135
- `)return yield*this.pushCount(2);else return 0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r==="\t");let n=t-this.pos;if(n>0)yield this.buffer.substr(this.pos,n),this.pos=t;return n}*pushUntil(e){let t=this.pos,r=this.buffer[t];while(!e(r))r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}Mx.Lexer=fu});var Ko=A(function(Bx){class du{constructor(){this.lineStarts=[],this.addNewLine=(e)=>this.lineStarts.push(e),this.linePos=(e)=>{let t=0,r=this.lineStarts.length;while(t<r){let s=t+r>>1;if(this.lineStarts[s]<e)t=s+1;else r=s}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let n=this.lineStarts[t-1];return{line:t,col:e-n+1}}}}Bx.LineCounter=du});var Fo=A(function(Hx){var Fx=he("process"),hu=Nn(),Gx=Bo();function Ye(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function mu(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function yu(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Cn(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function zt(e){if(e.length===0)return[];let t=e.length;e:while(--t>=0)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}while(e[++t]?.type==="space");return e.splice(t,e.length)}function zn(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function gu(e){if(e.start.type==="flow-seq-start"){for(let t of e.items)if(t.sep&&!t.value&&!Ye(t.start,"explicit-key-ind")&&!Ye(t.sep,"map-value-ind")){if(t.key)t.value=t.key;if(delete t.key,yu(t.value))if(t.value.end)zn(t.value.end,t.sep);else t.value.end=t.sep;else zn(t.start,t.sep);delete t.sep}}}class wu{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Gx.Lexer,this.onNewLine=e}*parse(e,t=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let r of this.lexer.lex(e,t))yield*this.next(r);if(!t)yield*this.end()}*next(e){if(this.source=e,Fx.env.LOG_TOKENS)console.log("|",hu.prettyToken(e));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=hu.tokenType(e);if(!t){let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}else if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+e.length);break;case"space":if(this.atNewLine&&e[0]===" ")this.indent+=e.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=e.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let r=this.peek(1);if(t.type==="block-scalar")t.indent="indent"in r?r.indent:0;else if(t.type==="flow-collection"&&r.type==="document")t.indent=0;if(t.type==="flow-collection")gu(t);switch(r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];if(n.value)r.items.push({start:[],value:t});else n.value=t;break}case"flow-collection":{let n=r.items[r.items.length-1];if(!n||n.value)r.items.push({start:[],key:t,sep:[]});else if(n.sep)n.value=t;else Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];if(n&&!n.sep&&!n.value&&n.start.length>0&&mu(n.start)===-1&&(t.indent===0||n.start.every((s)=>s.type!=="comment"||s.indent<t.indent))){if(r.type==="document")r.end=n.start;else r.items.push({start:n.start});t.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")e.start.push(this.sourceToken);this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{if(mu(e.start)!==-1)yield*this.pop(),yield*this.step();else e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);if(t)this.stack.push(t);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Cn(this.peek(2)),r=zt(t),n;if(e.end)n=e.end,n.push(this.sourceToken),delete e.end;else n=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
135
+ `)return yield*this.pushCount(2);else return 0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n==="\t");let r=t-this.pos;if(r>0)yield this.buffer.substr(this.pos,r),this.pos=t;return r}*pushUntil(e){let t=this.pos,n=this.buffer[t];while(!e(n))n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}N1.Lexer=vp});var ea=P(function(D1){class yp{constructor(){this.lineStarts=[],this.addNewLine=(e)=>this.lineStarts.push(e),this.linePos=(e)=>{let t=0,n=this.lineStarts.length;while(t<n){let i=t+n>>1;if(this.lineStarts[i]<e)t=i+1;else n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}}D1.LineCounter=yp});var ta=P(function(U1){var j1=Oe("process"),bp=yi(),M1=Xs();function mt(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function wp(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function kp(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function wi(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function nn(e){if(e.length===0)return[];let t=e.length;e:while(--t>=0)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}while(e[++t]?.type==="space");return e.splice(t,e.length)}function _i(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function _p(e){if(e.start.type==="flow-seq-start"){for(let t of e.items)if(t.sep&&!t.value&&!mt(t.start,"explicit-key-ind")&&!mt(t.sep,"map-value-ind")){if(t.key)t.value=t.key;if(delete t.key,kp(t.value))if(t.value.end)_i(t.value.end,t.sep);else t.value.end=t.sep;else _i(t.start,t.sep);delete t.sep}}}class xp{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new M1.Lexer,this.onNewLine=e}*parse(e,t=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);if(!t)yield*this.end()}*next(e){if(this.source=e,j1.env.LOG_TOKENS)console.log("|",bp.prettyToken(e));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=bp.tokenType(e);if(!t){let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}else if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+e.length);break;case"space":if(this.atNewLine&&e[0]===" ")this.indent+=e.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=e.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);if(t.type==="block-scalar")t.indent="indent"in n?n.indent:0;else if(t.type==="flow-collection"&&n.type==="document")t.indent=0;if(t.type==="flow-collection")_p(t);switch(n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=t;else{Object.assign(r,{key:t,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=n.items[n.items.length-1];if(r.value)n.items.push({start:[],value:t});else r.value=t;break}case"flow-collection":{let r=n.items[n.items.length-1];if(!r||r.value)n.items.push({start:[],key:t,sep:[]});else if(r.sep)r.value=t;else Object.assign(r,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let r=t.items[t.items.length-1];if(r&&!r.sep&&!r.value&&r.start.length>0&&wp(r.start)===-1&&(t.indent===0||r.start.every((i)=>i.type!=="comment"||i.indent<t.indent))){if(n.type==="document")n.end=r.start;else n.items.push({start:r.start});t.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")e.start.push(this.sourceToken);this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{if(wp(e.start)!==-1)yield*this.pop(),yield*this.step();else e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);if(t)this.stack.push(t);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=wi(this.peek(2)),n=nn(t),r;if(e.end)r=e.end,r.push(this.sourceToken),delete e.end;else r=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
136
136
  `)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
137
- `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){zn(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",s=[];if(n&&t.sep&&!t.value){let o=[];for(let i=0;i<t.sep.length;++i){let a=t.sep[i];switch(a.type){case"newline":o.push(i);break;case"space":break;case"comment":if(a.indent>e.indent)o.length=0;break;default:o.length=0}}if(o.length>=2)s=t.sep.splice(o[1])}switch(this.type){case"anchor":case"tag":if(n||t.value)s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0;else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"explicit-key-ind":if(!t.sep&&!t.explicitKey)t.start.push(this.sourceToken),t.explicitKey=!0;else if(n||t.value)s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(!t.sep)if(Ye(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=zt(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ye(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(yu(t.key)&&!Ye(t.sep,"newline")){let o=zt(t.start),{key:i,sep:a}=t;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:i,sep:a}]})}else if(s.length>0)t.sep=t.sep.concat(s,this.sourceToken);else t.sep.push(this.sourceToken);else if(!t.sep)Object.assign(t,{key:null,sep:[this.sourceToken]});else if(t.value||n)e.items.push({start:s,key:null,sep:[this.sourceToken]});else if(Ye(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else t.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);if(n||t.value)e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0;else if(t.sep)this.stack.push(o);else Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0;return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!Ye(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(r)e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){zn(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;if(t.value||Ye(t.start,"seq-item-ind"))e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!t||t.sep)e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return;case"map-value-ind":if(!t||t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!t||t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);if(!t||t.value)e.items.push({start:[],key:n,sep:[]});else if(t.sep)this.stack.push(n);else Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);if(r)this.stack.push(r);else yield*this.pop(),yield*this.step()}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=Cn(r),s=zt(n);gu(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
137
+ `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;if((Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment")n?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){_i(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&t.sep&&!t.value){let o=[];for(let s=0;s<t.sep.length;++s){let a=t.sep[s];switch(a.type){case"newline":o.push(s);break;case"space":break;case"comment":if(a.indent>e.indent)o.length=0;break;default:o.length=0}}if(o.length>=2)i=t.sep.splice(o[1])}switch(this.type){case"anchor":case"tag":if(r||t.value)i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0;else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"explicit-key-ind":if(!t.sep&&!t.explicitKey)t.start.push(this.sourceToken),t.explicitKey=!0;else if(r||t.value)i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(!t.sep)if(mt(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=nn(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(mt(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(kp(t.key)&&!mt(t.sep,"newline")){let o=nn(t.start),{key:s,sep:a}=t;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:a}]})}else if(i.length>0)t.sep=t.sep.concat(i,this.sourceToken);else t.sep.push(this.sourceToken);else if(!t.sep)Object.assign(t,{key:null,sep:[this.sourceToken]});else if(t.value||r)e.items.push({start:i,key:null,sep:[this.sourceToken]});else if(mt(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else t.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);if(r||t.value)e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0;else if(t.sep)this.stack.push(o);else Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0;return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!mt(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(n)e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;if((Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment")n?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){_i(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;if(t.value||mt(t.start,"seq-item-ind"))e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!t||t.sep)e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return;case"map-value-ind":if(!t||t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!t||t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);if(!t||t.value)e.items.push({start:[],key:r,sep:[]});else if(t.sep)this.stack.push(r);else Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);if(n)this.stack.push(n);else yield*this.pop(),yield*this.step()}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=wi(n),i=nn(r);_p(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
138
138
  `)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
139
- `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Cn(e),r=zt(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Cn(e),r=zt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((r)=>r.type==="newline"||r.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}Hx.Parser=wu});var xu=A(function(rS){var bu=Co(),Vx=pr(),yr=fr(),Yx=Bs(),Jx=I(),Qx=Ko(),_u=Fo();function vu(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Qx.LineCounter||null,prettyErrors:t}}function Xx(e,t={}){let{lineCounter:r,prettyErrors:n}=vu(t),s=new _u.Parser(r?.addNewLine),o=new bu.Composer(t),i=Array.from(o.compose(s.parse(e)));if(n&&r)for(let a of i)a.errors.forEach(yr.prettifyError(e,r)),a.warnings.forEach(yr.prettifyError(e,r));if(i.length>0)return i;return Object.assign([],{empty:!0},o.streamInfo())}function ku(e,t={}){let{lineCounter:r,prettyErrors:n}=vu(t),s=new _u.Parser(r?.addNewLine),o=new bu.Composer(t),i=null;for(let a of o.compose(s.parse(e),!0,e.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new yr.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(n&&r)i.errors.forEach(yr.prettifyError(e,r)),i.warnings.forEach(yr.prettifyError(e,r));return i}function eS(e,t,r){let n=void 0;if(typeof t==="function")n=t;else if(r===void 0&&t&&typeof t==="object")r=t;let s=ku(e,r);if(!s)return null;if(s.warnings.forEach((o)=>Yx.warn(s.options.logLevel,o)),s.errors.length>0)if(s.options.logLevel!=="silent")throw s.errors[0];else s.errors=[];return s.toJS(Object.assign({reviver:n},r))}function tS(e,t,r){let n=null;if(typeof t==="function"||Array.isArray(t))n=t;else if(r===void 0&&t)r=t;if(typeof r==="string")r=r.length;if(typeof r==="number"){let s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(e===void 0){let{keepUndefined:s}=r??t??{};if(!s)return}if(Jx.isDocument(e)&&!n)return e.toString(r);return new Vx.Document(e,n,r).toString(r)}rS.parse=eS;rS.parseAllDocuments=Xx;rS.parseDocument=ku;rS.stringify=tS});var ea={};ma(ea,{default:()=>rP});var ta={};ma(ta,{default:()=>sP});class y extends Error{reason;fix;constructor(e,t){super(e);this.reason=e;this.fix=t;this.name="TapsterError"}}class D extends y{status;constructor(e,t,r){super(e,t);this.status=r;this.name="GitHubError"}}import{existsSync as be,readdirSync as lm,readFileSync as Wt}from"fs";import{mkdir as TP,readFile as As,writeFile as $s}from"fs/promises";import{basename as Ps,join as q}from"path";var aS=Co(),cS=pr(),uS=wo(),Go=fr(),lS=Jt(),Je=I(),pS=Ge(),fS=H(),dS=We(),hS=Ve(),_O=Nn(),mS=Bo(),gS=Ko(),yS=Fo(),Ln=xu(),Su=Vt();var wS=aS.Composer,bS=cS.Document,_S=uS.Schema,{YAMLError:vS,YAMLParseError:kS,YAMLWarning:xS}=Go,SS=lS.Alias,{isAlias:AS,isCollection:$S,isDocument:PS,isMap:ye,isNode:ES,isPair:TS,isScalar:OS,isSeq:dt}=Je,IS=pS.Pair,NS=fS.Scalar,RS=dS.YAMLMap,CS=hS.YAMLSeq;var zS=mS.Lexer,LS=gS.LineCounter,DS=yS.Parser,{parse:X,parseAllDocuments:jS,parseDocument:Qe,stringify:US}=Ln,{visit:ZS,visitAsync:MS}=Su;function br(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function Wo(e,t="|"){return e.map((r)=>Jo(r)).join(t)}function _r(e,t){if(typeof t==="bigint")return t.toString();return t}class Au{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function vr(e){return new Au(e)}function $u(e){return e===null||e===void 0}function Dn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Pu(e,t){let r=e/t,n=Math.round(r),s=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<s)return 0;return r-n}function le(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function kr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function De(e){return kr(e._zod.def)??e._zod.def.shape}function Eu(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return le(this,t,n),n},enumerable:!0,configurable:!0})}function Tu(e,t,r){if(t in e)le(e,t,r);else e[t]=r}function ht(e,t,r,n){let s=De(t);for(let o of r){let i=Object.getOwnPropertyDescriptor(s,o);if(!i.enumerable)continue;if(i.get)Eu(e,o,()=>{let a=t._zod.def.shape[o];return n?n(a,o):a});else Tu(e,o,n?n(i.value,o):i.value)}}function qS(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Eu(e,r,()=>t[r]);else Tu(e,r,n.value)}}function re(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ou(e){return JSON.stringify(e)}function Iu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Vo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Lt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Nu=vr(()=>{if(Y.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function mt(e){if(Lt(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(Lt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Yo(e){if(mt(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 Ru=new Set(["string","number","symbol"]);function et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xe(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function E(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 Jo(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Cu(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var jn=(()=>({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]}))(),Qo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function BS(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 o={};return ht(o,e,Un(e,t)),xe(e,re(r,{shape:o,checks:[]}))}function Un(e,t){let r=De(e),n=[];for(let s of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,s)?.enumerable)throw Error(`Unrecognized key: "${String(s)}"`);if(t[s])n.push(s)}return n}function KS(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 o=new Set(Un(e,t)),i={};return ht(i,e,Reflect.ownKeys(De(e)).filter((a)=>!o.has(a))),xe(e,re(r,{shape:i,checks:[]}))}function FS(e,t){if(!mt(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=De(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return xe(e,re(e._zod.def,{shape:zu(e,t)}))}function zu(e,t){let r={};return ht(r,e,Reflect.ownKeys(De(e))),qS(r,t),r}function GS(e,t){if(!mt(t))throw Error("Invalid input to safeExtend: expected a plain object");return xe(e,re(e._zod.def,{shape:zu(e,t)}))}function HS(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ht(r,e,Reflect.ownKeys(De(e))),ht(r,t,Reflect.ownKeys(De(t)));let n=re(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return xe(e,n)}function Lu(e,t,r,n="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Un(t,r)):void 0,c={};return ht(c,t,Reflect.ownKeys(De(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),xe(t,re(t._zod.def,{shape:c,checks:[]}))}function WS(e,t,r){let n=r?new Set(Un(t,r)):void 0,s={};return ht(s,t,Reflect.ownKeys(De(t)),(o,i)=>n&&!n.has(i)?o:new e({type:"nonoptional",innerType:o})),xe(t,re(t._zod.def,{shape:s}))}function pe(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 Du(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 Se(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function wr(e){return typeof e==="string"?e:e?.message}function Xo(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let s=n.maximum??n.length??n.size;if(s>=0)t.push([s,r])}return t}function Zn(e,t,r){var n;for(let s=t;s<e.length;s++)(n=e[s]).schema??(n.schema=r)}function Ae(e,t,r){var n;let s=e.inst?._zod?.traits;if(s?.has("$ZodType"))if(s.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:wr(e.inst?._zod.def?.error?.(e))??wr(o?.(e))??wr(t?.error?.(e))??wr(r.customError?.(e))??wr(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var VS=/[\uD800-\uDBFF]/;function Mn(e){let t=e.length;if(!VS.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function qn(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ju(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function gt(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Uu(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else YS(e,r,n.value)}}function je(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Bn(e,t,r){return je(e,t,r,!1)}function Zu(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return je(this,r,n(this))},set(s){je(this,r,s)}})}return t}function YS(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:je(this,t,r.bind(this))},set(n){je(this,t,n)}})}function JS(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Ho,Xe=!1,QS={configurable:!0,get(){Xe=!0;return}};function N(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ho!==e._zod){Ho=void 0;return}Ho=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,QS);let s=Xe;Xe=!1;try{let o=r(this);if(Xe)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o});return Xe=Xe||s,o}catch(o){throw delete this[t],Xe=Xe||s,o}},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s})}})}function XS(e,t,r,n){let s=JS(e,t);if(!s)return;Object.defineProperty(s,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,o),o.value=r(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:o})}})}var e0="~constantCatch";function Mu(e){let t=()=>e;return t[e0]=!0,t}var qu;var ei={value:void 0,enumerable:!1},Bu="captureStackTrace"in Error?Error:null;function t0(e){let t=Bu;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Bu=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function w(e,t,r,n){let s={};function o(p){this.def=p,this.constr=f,this.traits=new Set}o.prototype=s;let i=r,a=i&&new WeakSet;function c(p,d){if(!p._zod){ei.value=new o(d);try{Object.defineProperty(p,"_zod",ei)}finally{ei.value=void 0}}else if(p._zod.traits.has(e))return;if(p._zod.traits.add(e),t(p,d),a){let m=Object.getPrototypeOf(p),g=p._zod.constr.prototype,_=m;while(_&&_!==g)_=Object.getPrototypeOf(_);let S=_??m;if(!a.has(S))a.add(S),Uu(S,i)}let h=f.prototype;for(let m in h){if(!Object.prototype.hasOwnProperty.call(h,m))continue;if(!(m in p))p[m]=h[m].bind(p)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(p){let d=n?.Parent?t0(l):this;c(d,p);let h=d._zod.deferred;if(h){for(let g of h)g();d._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;if(m)m(d);return d}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:(p)=>{if(n?.Parent&&p instanceof n.Parent)return!0;return p?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class $e extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(qu=globalThis).__zod_globalConfig??(qu.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function ne(e){if(e)Object.assign(Y,e);return Y}function r0(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,_r,2)),e.message}function n0(e){this._zod.message=e}var s0={get:r0,set:n0,enumerable:!0,configurable:!0},ri={value:void 0,enumerable:!1},Ku=new WeakSet([Object.prototype,Error.prototype]),Fu=(e,t)=>{e.name="$ZodError",ri.value=t,Object.defineProperty(e,"issues",ri),ri.value=void 0,Object.defineProperty(e,"message",s0);let r=Object.getPrototypeOf(e);if(!Ku.has(r))Ku.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Gu=w("$ZodError",Fu),AO=w("$ZodError",Fu,void 0,{Parent:Error});function o0(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Hu(e,t=(r)=>r.message){let r={},n=[];for(let s of e.issues)if(s.path.length>0)o0(r,s.path[0],()=>[]).push(t(s));else n.push(t(s));return{formErrors:n,fieldErrors:r}}function Wu(e,t=(r)=>r.message){let r={_errors:[]},n=(s,o=[])=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a},[...o,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...o,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...o,...i.path]);else{let a=[...o,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;while(u<a.length){let l=a[u],f=u===a.length-1;if(l==="_errors"){if(f)c._errors.push(t(i));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[l];if(f)p._errors.push(t(i));c=p,u++}}}};return n(e),r}function Kn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Fn=(e)=>{let t=(r,n,s,o)=>{let i=s?{...s,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $e;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map((u)=>Ae(u,i,ne())));throw Vo(c,o?.callee??t),c}return a.value};return t};var Gn=(e)=>{let t=async(r,n,s,o)=>{let i=s?{...s,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map((u)=>Ae(u,i,ne())));throw Vo(c,o?.callee??t),c}return a.value};return t};var Hn=(e)=>(t,r,n)=>{let s=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new $e;return o.issues.length?Vu(e,o.issues,s):{success:!0,data:o.value}};function Vu(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((s)=>Ae(s,r,ne()))),t=void 0,r=void 0;return n},set error(s){n=s,t=void 0,r=void 0}}}var Wn=(e)=>async(t,r,n)=>{let s=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)o=await o;return o.issues.length?Vu(e,o.issues,s):{success:!0,data:o.value}};var i0=Symbol.for("zod.compile.invalid"),a0=Symbol.for("zod.compile.fallback"),ni=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==i0)return!0;if(n.definite===!0&&r===void 0)return!1}return c0(e,t,r)};function c0(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},s=e._zod.bag.fallbackRun,o;if(s)n[a0]=!0,o=s({value:t,issues:[]},n);else o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)throw new $e;return o.issues.length===0}var si=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length===0},Yu=(e)=>{let t=Fn(e),r=(n,s,o,i)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return t(n,s,a,Kn(r,i))};return r};var Ju=(e)=>{let t=Fn(e),r=(n,s,o,i)=>t(n,s,o,Kn(r,i));return r};var Qu=(e)=>{let t=Gn(e),r=async(n,s,o,i)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await t(n,s,a,Kn(r,i))};return r};var Xu=(e)=>{let t=Gn(e),r=async(n,s,o,i)=>await t(n,s,o,Kn(r,i));return r};var el=(e)=>(t,r,n)=>{let s=n?{...n,direction:"backward"}:{direction:"backward"};return Hn(e)(t,r,s)};var tl=(e)=>(t,r,n)=>Hn(e)(t,r,n);var rl=(e)=>async(t,r,n)=>{let s=n?{...n,direction:"backward"}:{direction:"backward"};return Wn(e)(t,r,s)};var nl=(e)=>async(t,r,n)=>Wn(e)(t,r,n);var sl=/^[cC][0-9a-z]{6,}$/,ol=/^[0-9a-z]+$/,il=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,al=/^[0-9a-vA-V]{20}$/,cl=/^[A-Za-z0-9]{27}$/,ul=/^[a-zA-Z0-9_-]{21}$/;function ll(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var pl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var fl=/^([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})$/,ii=(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 dl=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var u0="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function hl(){return new RegExp(u0,"u")}var ml=/^(?:(?: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])$/,gl=/^(([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 yl=/^((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])$/,wl=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_l=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var vl=/^https?$/,kl=/^\+[1-9]\d{6,14}$/;var xl="(?:(?:\\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])))";function l0(e){return new RegExp(`^${e}$`)}var Sl=l0(xl);function oi(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}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Al(e){return new RegExp(`^${oi(e)}$`)}function $l(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${oi({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${oi({precision:e.precision})}`:r;return new RegExp(`^${xl}T(?:${n})$`)}var Pl=/^[\s\S]{0,}$/;var ai=/^-?\d+$/,Sr=/^-?\d+(?:\.\d+)?$/,El=/^(?:true|false)$/i;var Tl=/^[^A-Z]*$/,Ol=/^[^a-z]*$/;var V=w("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var ci=(e)=>{let t=e.value;return!$u(t)&&t.length!==void 0},Vn={number:"number",bigint:"bigint",object:"date"},ui=w("$ZodCheckLessThan",(e,t)=>{V.init(e,t);let r=Vn[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Vn[typeof n.value]??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})}}),li=w("$ZodCheckGreaterThan",(e,t)=>{V.init(e,t);let r=Vn[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Vn[typeof n.value]??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})}}),Il=w("$ZodCheckMultipleOf",(e,t)=>{V.init(e,t),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"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Pu(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})}}),Nl=w("$ZodCheckNumberFormat",(e,t)=>{V.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[s,o]=jn[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,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:a,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(a<s)i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort});if(a>o)i.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});var Rl=w("$ZodCheckMaxLength",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=ci),e._zod.check=(n)=>{let s=n.value,o=s.length;if((typeof s==="string"&&o>t.maximum?Mn(s):o)<=t.maximum)return;let a=qn(s);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Cl=w("$ZodCheckMinLength",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=ci),e._zod.check=(n)=>{let s=n.value,o=s.length;if((typeof s==="string"&&o>=t.minimum&&o<t.minimum*2?Mn(s):o)>=t.minimum)return;let a=qn(s);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),zl=w("$ZodCheckLengthEquals",(e,t)=>{var r;V.init(e,t),(r=e._zod.def).when??(r.when=ci),e._zod.check=(n)=>{let s=n.value,o=s.length,i=typeof s==="string"&&o>=t.length&&o<=t.length*2?Mn(s):o;if(i===t.length)return;let a=qn(s),c=i>t.length;n.issues.push({origin:a,...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})}}),$r=w("$ZodCheckStringFormat",(e,t)=>{var r,n;if(V.init(e,t),t.pattern)(r=e._zod).check??(r.check=(s)=>{if(t.pattern.lastIndex=0,t.pattern.test(s.value))return;s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Ll=w("$ZodCheckRegex",(e,t)=>{$r.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})}}),Dl=w("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Tl),$r.init(e,t)}),jl=w("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ol),$r.init(e,t)}),Ul=w("$ZodCheckIncludes",(e,t)=>{V.init(e,t);let r=et(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(s)=>{if(s.value.includes(t.includes,t.position))return;s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Zl=w("$ZodCheckStartsWith",(e,t)=>{V.init(e,t);let r=new RegExp(`^${et(t.prefix)}.*`);t.pattern??(t.pattern=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})}}),Ml=w("$ZodCheckEndsWith",(e,t)=>{V.init(e,t);let r=new RegExp(`.*${et(t.suffix)}$`);t.pattern??(t.pattern=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 ql=w("$ZodCheckOverwrite",(e,t)=>{V.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class pi{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
140
- `).filter((o)=>o),n=Math.min(...r.map((o)=>o.length-o.trimStart().length)),s=r.map((o)=>o.slice(n)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of s)this.content.push(o)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
139
+ `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=wi(e),n=nn(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=wi(e),n=nn(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((n)=>n.type==="newline"||n.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}U1.Parser=xp});var Tp=P(function(V1){var Sp=Bs(),G1=Zn(),Kn=Gn(),q1=es(),B1=N(),H1=ea(),Ap=ta();function $p(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new H1.LineCounter||null,prettyErrors:t}}function F1(e,t={}){let{lineCounter:n,prettyErrors:r}=$p(t),i=new Ap.Parser(n?.addNewLine),o=new Sp.Composer(t),s=Array.from(o.compose(i.parse(e)));if(r&&n)for(let a of s)a.errors.forEach(Kn.prettifyError(e,n)),a.warnings.forEach(Kn.prettifyError(e,n));if(s.length>0)return s;return Object.assign([],{empty:!0},o.streamInfo())}function Pp(e,t={}){let{lineCounter:n,prettyErrors:r}=$p(t),i=new Ap.Parser(n?.addNewLine),o=new Sp.Composer(t),s=null;for(let a of o.compose(i.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Kn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(r&&n)s.errors.forEach(Kn.prettifyError(e,n)),s.warnings.forEach(Kn.prettifyError(e,n));return s}function K1(e,t,n){let r=void 0;if(typeof t==="function")r=t;else if(n===void 0&&t&&typeof t==="object")n=t;let i=Pp(e,n);if(!i)return null;if(i.warnings.forEach((o)=>q1.warn(i.options.logLevel,o)),i.errors.length>0)if(i.options.logLevel!=="silent")throw i.errors[0];else i.errors=[];return i.toJS(Object.assign({reviver:r},n))}function W1(e,t,n){let r=null;if(typeof t==="function"||Array.isArray(t))r=t;else if(n===void 0&&t)n=t;if(typeof n==="string")n=n.length;if(typeof n==="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}if(B1.isDocument(e)&&!r)return e.toString(n);return new G1.Document(e,r,n).toString(n)}V1.parse=K1;V1.parseAllDocuments=F1;V1.parseDocument=Pp;V1.stringify=W1});var Cc={};wl(Cc,{default:()=>WT});var Rc={};wl(Rc,{default:()=>YT});class v extends Error{reason;fix;constructor(e,t){super(e);this.reason=e;this.fix=t;this.name="TapsterError"}}class R extends v{status;constructor(e,t,n){super(e,t);this.status=n;this.name="GitHubError"}}import{existsSync as xt,readdirSync as vv,readFileSync as hv}from"fs";import{basename as bo,join as ee}from"path";var eA=Bs(),tA=Zn(),nA=Ts(),na=Gn(),rA=Pn(),gt=N(),iA=pt(),oA=W(),sA=ht(),aA=ft(),kR=yi(),cA=Xs(),lA=ea(),uA=ta(),ki=Tp(),Ep=An();var pA=eA.Composer,dA=tA.Document,hA=nA.Schema,{YAMLError:fA,YAMLParseError:mA,YAMLWarning:gA}=na,vA=rA.Alias,{isAlias:yA,isCollection:bA,isDocument:wA,isMap:Ie,isNode:_A,isPair:kA,isScalar:xA,isSeq:Rt}=gt,SA=iA.Pair,AA=oA.Scalar,$A=sA.YAMLMap,PA=aA.YAMLSeq;var TA=cA.Lexer,EA=lA.LineCounter,OA=uA.Parser,{parse:ie,parseAllDocuments:CA,parseDocument:vt,stringify:RA}=ki,{visit:IA,visitAsync:NA}=Ep;function Vn(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function ia(e,t="|"){return e.map((n)=>aa(n)).join(t)}function Yn(e,t){if(typeof t==="bigint")return t.toString();return t}class Op{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Jn(e){return new Op(e)}function Cp(e){return e===null||e===void 0}function xi(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Rp(e,t){let n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<i)return 0;return n-r}function ge(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Qn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Xe(e){return Qn(e._zod.def)??e._zod.def.shape}function Ip(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return ge(this,t,r),r},enumerable:!0,configurable:!0})}function Np(e,t,n){if(t in e)ge(e,t,n);else e[t]=n}function It(e,t,n,r){let i=Xe(t);for(let o of n){let s=Object.getOwnPropertyDescriptor(i,o);if(!s.enumerable)continue;if(s.get)Ip(e,o,()=>{let a=t._zod.def.shape[o];return r?r(a,o):a});else Np(e,o,r?r(s.value,o):s.value)}}function zA(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)Ip(e,n,()=>t[n]);else Np(e,n,r.value)}}function ve(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function zp(e){return JSON.stringify(e)}function Dp(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var oa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function rn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Lp=Jn(()=>{if(ce.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Nt(e){if(rn(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(rn(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function sa(e){if(Nt(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 jp=new Set(["string","number","symbol"]);function bt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function T(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 aa(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Mp(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Si=(()=>({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]}))(),ca={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function DA(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o={};return It(o,e,Ai(e,t)),Me(e,ve(n,{shape:o,checks:[]}))}function Ai(e,t){let n=Xe(e),r=[];for(let i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw Error(`Unrecognized key: "${String(i)}"`);if(t[i])r.push(i)}return r}function LA(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(Ai(e,t)),s={};return It(s,e,Reflect.ownKeys(Xe(e)).filter((a)=>!o.has(a))),Me(e,ve(n,{shape:s,checks:[]}))}function jA(e,t){if(!Nt(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let i=Xe(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Me(e,ve(e._zod.def,{shape:Up(e,t)}))}function Up(e,t){let n={};return It(n,e,Reflect.ownKeys(Xe(e))),zA(n,t),n}function MA(e,t){if(!Nt(t))throw Error("Invalid input to safeExtend: expected a plain object");return Me(e,ve(e._zod.def,{shape:Up(e,t)}))}function UA(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};It(n,e,Reflect.ownKeys(Xe(e))),It(n,t,Reflect.ownKeys(Xe(t)));let r=ve(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Me(e,r)}function Zp(e,t,n,r="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ai(t,n)):void 0,c={};return It(c,t,Reflect.ownKeys(Xe(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),Me(t,ve(t._zod.def,{shape:c,checks:[]}))}function ZA(e,t,n){let r=n?new Set(Ai(t,n)):void 0,i={};return It(i,t,Reflect.ownKeys(Xe(t)),(o,s)=>r&&!r.has(s)?o:new e({type:"nonoptional",innerType:o})),Me(t,ve(t._zod.def,{shape:i}))}function Ae(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Gp(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Ue(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Wn(e){return typeof e==="string"?e:e?.message}function la(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let i=r.maximum??r.length??r.size;if(i>=0)t.push([i,n])}return t}function $i(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ze(e,t,n){var r;let i=e.inst?._zod?.traits;if(i?.has("$ZodType"))if(i.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Wn(e.inst?._zod.def?.error?.(e))??Wn(o?.(e))??Wn(t?.error?.(e))??Wn(n.customError?.(e))??Wn(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,t?.reportInput)a.input=e.input;return a}var GA=/[\uD800-\uDBFF]/;function Pi(e){let t=e.length;if(!GA.test(e))return t;let n=t;for(let r=0;r<t-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)n--,r++;return n}function Ti(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function qp(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function zt(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function Bp(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else qA(e,n,r.value)}}function et(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ei(e,t,n){return et(e,t,n,!1)}function Hp(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return et(this,n,r(this))},set(i){et(this,n,i)}})}return t}function qA(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:et(this,t,n.bind(this))},set(r){et(this,t,r)}})}function BA(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var ra,yt=!1,HA={configurable:!0,get(){yt=!0;return}};function D(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&ra!==e._zod){ra=void 0;return}ra=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,HA);let i=yt;yt=!1;try{let o=n(this);if(yt)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o});return yt=yt||i,o}catch(o){throw delete this[t],yt=yt||i,o}},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i})}})}function FA(e,t,n,r){let i=BA(e,t);if(!i)return;Object.defineProperty(i,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:o})}})}var KA="~constantCatch";function Fp(e){let t=()=>e;return t[KA]=!0,t}var Kp;var ua={value:void 0,enumerable:!1},Wp="captureStackTrace"in Error?Error:null;function WA(e){let t=Wp;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Wp=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function y(e,t,n,r){let i={};function o(d){this.def=d,this.constr=p,this.traits=new Set}o.prototype=i;let s=n,a=s&&new WeakSet;function c(d,h){if(!d._zod){ua.value=new o(h);try{Object.defineProperty(d,"_zod",ua)}finally{ua.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,h),a){let m=Object.getPrototypeOf(d),g=d._zod.constr.prototype,w=m;while(w&&w!==g)w=Object.getPrototypeOf(w);let x=w??m;if(!a.has(x))a.add(x),Bp(x,s)}let f=p.prototype;for(let m in f){if(!Object.prototype.hasOwnProperty.call(f,m))continue;if(!(m in d))d[m]=f[m].bind(d)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function p(d){let h=r?.Parent?WA(u):this;c(h,d);let f=h._zod.deferred;if(f){for(let g of f)g();h._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;if(m)m(h);return h}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:(d)=>{if(r?.Parent&&d instanceof r.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class Ge extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Xn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Kp=globalThis).__zod_globalConfig??(Kp.__zod_globalConfig={});var ce=globalThis.__zod_globalConfig;function ye(e){if(e)Object.assign(ce,e);return ce}function VA(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Yn,2)),e.message}function YA(e){this._zod.message=e}var JA={get:VA,set:YA,enumerable:!0,configurable:!0},da={value:void 0,enumerable:!1},Vp=new WeakSet([Object.prototype,Error.prototype]),Yp=(e,t)=>{e.name="$ZodError",da.value=t,Object.defineProperty(e,"issues",da),da.value=void 0,Object.defineProperty(e,"message",JA);let n=Object.getPrototypeOf(e);if(!Vp.has(n))Vp.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},Jp=y("$ZodError",Yp),PR=y("$ZodError",Yp,void 0,{Parent:Error});function QA(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function Qp(e,t=(n)=>n.message){let n={},r=[];for(let i of e.issues)if(i.path.length>0)QA(n,i.path[0],()=>[]).push(t(i));else r.push(t(i));return{formErrors:r,fieldErrors:n}}function Xp(e,t=(n)=>n.message){let n={_errors:[]},r=(i,o=[])=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,l=0;while(l<a.length){let u=a[l],p=l===a.length-1;if(u==="_errors"){if(p)c._errors.push(t(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=c[u];if(p)d._errors.push(t(s));c=d,l++}}}};return r(e),n}function Oi(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ci=(e)=>{let t=(n,r,i,o)=>{let s=i?{...i,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new Ge;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map((l)=>Ze(l,s,ye())));throw oa(c,o?.callee??t),c}return a.value};return t};var Ri=(e)=>{let t=async(n,r,i,o)=>{let s=i?{...i,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map((l)=>Ze(l,s,ye())));throw oa(c,o?.callee??t),c}return a.value};return t};var Ii=(e)=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new Ge;return o.issues.length?ed(e,o.issues,i):{success:!0,data:o.value}};function ed(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((i)=>Ze(i,n,ye()))),t=void 0,n=void 0;return r},set error(i){r=i,t=void 0,n=void 0}}}var Ni=(e)=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)o=await o;return o.issues.length?ed(e,o.issues,i):{success:!0,data:o.value}};var XA=Symbol.for("zod.compile.invalid"),e$=Symbol.for("zod.compile.fallback"),ha=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==XA)return!0;if(r.definite===!0&&n===void 0)return!1}return t$(e,t,n)};function t$(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,o;if(i)r[e$]=!0,o=i({value:t,issues:[]},r);else o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)throw new Ge;return o.issues.length===0}var fa=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)i=await i;return i.issues.length===0},td=(e)=>{let t=Ci(e),n=(r,i,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return t(r,i,a,Oi(n,s))};return n};var nd=(e)=>{let t=Ci(e),n=(r,i,o,s)=>t(r,i,o,Oi(n,s));return n};var rd=(e)=>{let t=Ri(e),n=async(r,i,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await t(r,i,a,Oi(n,s))};return n};var id=(e)=>{let t=Ri(e),n=async(r,i,o,s)=>await t(r,i,o,Oi(n,s));return n};var od=(e)=>(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Ii(e)(t,n,i)};var sd=(e)=>(t,n,r)=>Ii(e)(t,n,r);var ad=(e)=>async(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Ni(e)(t,n,i)};var cd=(e)=>async(t,n,r)=>Ni(e)(t,n,r);var ld=/^[cC][0-9a-z]{6,}$/,ud=/^[0-9a-z]+$/,pd=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,dd=/^[0-9a-vA-V]{20}$/,hd=/^[A-Za-z0-9]{27}$/,fd=/^[a-zA-Z0-9_-]{21}$/;function md(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var gd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var vd=/^([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})$/,ga=(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 yd=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var n$="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function bd(){return new RegExp(n$,"u")}var wd=/^(?:(?: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])$/,_d=/^(([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 kd=/^((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])$/,xd=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ad=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var $d=/^https?$/,Pd=/^\+[1-9]\d{6,14}$/;var Td="(?:(?:\\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])))";function r$(e){return new RegExp(`^${e}$`)}var Ed=r$(Td);function ma(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}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Od(e){return new RegExp(`^${ma(e)}$`)}function Cd(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${ma({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${ma({precision:e.precision})}`:n;return new RegExp(`^${Td}T(?:${r})$`)}var Rd=/^[\s\S]{0,}$/;var va=/^-?\d+$/,er=/^-?\d+(?:\.\d+)?$/,Id=/^(?:true|false)$/i;var Nd=/^[^A-Z]*$/,zd=/^[^a-z]*$/;var te=y("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var ya=(e)=>{let t=e.value;return!Cp(t)&&t.length!==void 0},zi={number:"number",bigint:"bigint",object:"date"},ba=y("$ZodCheckLessThan",(e,t)=>{te.init(e,t);let n=zi[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:zi[typeof r.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wa=y("$ZodCheckGreaterThan",(e,t)=>{te.init(e,t);let n=zi[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:zi[typeof r.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dd=y("$ZodCheckMultipleOf",(e,t)=>{te.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Rp(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ld=y("$ZodCheckNumberFormat",(e,t)=>{te.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[i,o]=Si[t.format];e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(a<i)s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort});if(a>o)s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});var jd=y("$ZodCheckMaxLength",(e,t)=>{var n;te.init(e,t),(n=e._zod.def).when??(n.when=ya),e._zod.check=(r)=>{let i=r.value,o=i.length;if((typeof i==="string"&&o>t.maximum?Pi(i):o)<=t.maximum)return;let a=Ti(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Md=y("$ZodCheckMinLength",(e,t)=>{var n;te.init(e,t),(n=e._zod.def).when??(n.when=ya),e._zod.check=(r)=>{let i=r.value,o=i.length;if((typeof i==="string"&&o>=t.minimum&&o<t.minimum*2?Pi(i):o)>=t.minimum)return;let a=Ti(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ud=y("$ZodCheckLengthEquals",(e,t)=>{var n;te.init(e,t),(n=e._zod.def).when??(n.when=ya),e._zod.check=(r)=>{let i=r.value,o=i.length,s=typeof i==="string"&&o>=t.length&&o<=t.length*2?Pi(i):o;if(s===t.length)return;let a=Ti(i),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),nr=y("$ZodCheckStringFormat",(e,t)=>{var n,r;if(te.init(e,t),t.pattern)(n=e._zod).check??(n.check=(i)=>{if(t.pattern.lastIndex=0,t.pattern.test(i.value))return;i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),Zd=y("$ZodCheckRegex",(e,t)=>{nr.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Gd=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Nd),nr.init(e,t)}),qd=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zd),nr.init(e,t)}),Bd=y("$ZodCheckIncludes",(e,t)=>{te.init(e,t);let n=bt(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=(i)=>{if(i.value.includes(t.includes,t.position))return;i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Hd=y("$ZodCheckStartsWith",(e,t)=>{te.init(e,t);let n=new RegExp(`^${bt(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Fd=y("$ZodCheckEndsWith",(e,t)=>{te.init(e,t);let n=new RegExp(`.*${bt(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var Kd=y("$ZodCheckOverwrite",(e,t)=>{te.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class _a{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
140
+ `).filter((o)=>o),r=Math.min(...n.map((o)=>o.length-o.trimStart().length)),i=n.map((o)=>o.slice(r)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of i)this.content.push(o)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
141
141
  ${t.join(`
142
142
  `)}
143
- };`)(...Object.values(this.closed))}}var Kl={major:4,minor:6,patch:7};var L=w("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Kl;let n=e._zod.def.checks,s=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let o of s)for(let i of o._zod.onattach)i(e);if(s.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,c,u)=>{if(a.memo)return a;let l=pe(a),f;for(let p of c){if(p._zod.def.when){if(Du(a))continue;if(!p._zod.def.when(a))continue}else if(l)continue;let d=a.issues.length,h=p._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new $e;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,a.issues.length===d)return;if(Zn(a.issues,d,e),!l)l=pe(a,d)});else{if(a.issues.length===d)continue;if(Zn(a.issues,d,e),!l)l=pe(a,d)}}if(f)return f.then(()=>a);return a},i=(a,c,u)=>{if(pe(a))return a.aborted=!0,a;let l=o(c,s,u);if(l instanceof Promise){if(u.async===!1)throw new $e;return l.then((f)=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>i(f,a,c));return i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new $e;return u.then((l)=>o(l,s,c))}return o(u,s,c)}}},{get "~standard"(){return Bn(this,"~standard",di(this))},set "~standard"(e){je(this,"~standard",e)}}),sp=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Ae(r,t,ne()))}:{value:e.value};async function p0(e,t){let r={async:!0};return sp(await e._zod.run({value:t,issues:[]},r),r)}function di(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return sp(n,r)}catch(n){}return p0(e,t)},vendor:"zod",version:1}}var Xn=w("$ZodString",(e,t)=>{L.init(e,t),e._zod.pattern=t.pattern??Pl,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(s){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),j=w("$ZodStringFormat",(e,t)=>{$r.init(e,t),Xn.init(e,t)}),op=w("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=fl),j.init(e,t)}),ip=w("$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=ii(n))}else t.pattern??(t.pattern=ii());j.init(e,t)}),ap=w("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=dl),j.init(e,t)}),cp=1,Jn=2;function up(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function f0(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return up(e)||Jn;return d0(e,t)}function d0(e,t){if(!t.normalize&&t.protocol?.source===vl.source&&!/^https?:\/\//i.test(e))return cp;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Jn}return new URL(e)}catch{return Jn}}var h0=/[\t\n\r]/g;function Fl(e){return e.replace(h0,"")}function m0(e,t){return t.lastIndex=0,t.test(e.hostname)}function g0(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var lp=w("$ZodURL",(e,t)=>{j.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),s=f0(n,t);if(s===cp){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(s===Jn){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(s===!0){r.value=Fl(n);return}if(t.hostname&&!m0(s,t.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&&!g0(s,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?s.href:Fl(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),pp=w("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=hl()),j.init(e,t)}),fp=w("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?ul:ll(t.length)),j.init(e,t)}),dp=w("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=sl),j.init(e,t)}),hp=w("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ol),j.init(e,t)}),mp=w("$ZodULID",(e,t)=>{t.pattern??(t.pattern=il),j.init(e,t)}),gp=w("$ZodXID",(e,t)=>{t.pattern??(t.pattern=al),j.init(e,t)}),yp=w("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=cl),j.init(e,t)}),wp=w("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$l(t)),j.init(e,t)}),bp=w("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Sl),j.init(e,t)}),_p=w("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Al(t)),j.init(e,t)}),vp=w("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pl),j.init(e,t)}),kp=w("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ml),j.init(e,t)}),y0=/^[0-9a-fA-F:.]+$/;function xp(e){if(!y0.test(e))return!1;return up(`http://[${e}]`)}var Sp=w("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=gl),j.init(e,t),e._zod.check=(r)=>{if(!xp(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Ap=w("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=yl),j.init(e,t)});function w0(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let s=Number(n);if(`${s}`!==n)return!1;if(s<0||s>128)return!1;return xp(r)}var $p=w("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wl),j.init(e,t),e._zod.check=(r)=>{if(!w0(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Pp(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 hi=/^[0-9a-zA-Z+/]*={0,2}$/,Ep=w("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=hi),j.init(e,t),e._zod.check=(r)=>{if(Pp(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),es=/^[A-Za-z0-9_-]*$/;function b0(e){if(!es.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Pp(r)}var Tp=w("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=es),j.init(e,t),e._zod.check=(r)=>{if(b0(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Op=w("$ZodE164",(e,t)=>{t.pattern??(t.pattern=kl),j.init(e,t)});function _0(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let s=JSON.parse(atob(n));if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(t&&(!("alg"in s)||s.alg!==t))return!1;return!0}catch{return!1}}var Ip=w("$ZodJWT",(e,t)=>{j.init(e,t),e._zod.check=(r)=>{if(_0(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var mi=w("$ZodNumber",(e,t)=>{L.init(e,t),e._zod.pattern=Sr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let s=r.value;if(typeof s==="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let o=typeof s==="number"?Number.isNaN(s)?"NaN":!Number.isFinite(s)?String(s):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),r}}),Np=w("$ZodNumberFormat",(e,t)=>{Nl.init(e,t),mi.init(e,t)}),Rp=w("$ZodBoolean",(e,t)=>{L.init(e,t),e._zod.pattern=El,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(o){}let s=r.value;if(typeof s==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}});var Cp=w("$ZodUnknown",(e,t)=>{L.init(e,t),e._zod.parse=(r)=>r}),zp=w("$ZodNever",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function v0(e,t){let r=Xo(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((o)=>o[0])),s=e._zod.parse;e._zod.parse=(o,i)=>{let a=t(o.value);if(a>n&&!i?.skipChecks&&i?.direction!=="backward"){for(let[c,u]of Xo(e._zod.def.checks))if(a>c&&u._zod.def.when(o)){let l=o.issues.length;return u._zod.check(o),o.issues[l].continue=!1,Zn(o.issues,l,e),o}}return s(o,i)}}var k0=(e)=>Array.isArray(e)?e.length:-1;function Gl(e,t,r){if(e.issues.length)t.issues.push(...Se(r,e.issues));t.value[r]=e.value}var Lp=w("$ZodArray",(e,t)=>{L.init(e,t);let r=Y.memoizer;r?.attach(e),e._zod.parse=(n,s)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=r?r.alloc(e,n,Array(o.length),s):Array(o.length);let i=[],a=s?.abortEarly;for(let c=0;c<o.length;c++){let u=o[c],l=t.element._zod.run({value:u,issues:[]},s);if(l instanceof Promise)i.push(l.then((f)=>Gl(f,n,c)));else if(Gl(l,n,c),a&&l.issues.length!==0&&pe(l))break}if(i.length)return Promise.all(i).then(()=>n);return n},v0(e,k0)});function Qn(e,t,r,n,s,o){let i=r in n,a=o==="optional";if(!i&&a&&s==="optional")return;if(e.issues.length){if(s!==void 0&&a&&!i)return;t.issues.push(...Se(r,e.issues))}if(!i&&s===void 0){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||s==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var x0=[];function Dp(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:x0,s=n.length?[...t,...n]:t;for(let i of s)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let o=Cu(e.shape);return{...e,allKeys:s,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function jp(e,t,r,n,s,o,i){let a=[],c=s.keySet,u=s.catchall._zod,l=u.def.type,{optin:f,optout:p}=u,d=0;for(let h in t){if(i&&r.issues.length!==d){if(pe(r,d))break;d=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){if(l==="never")a.push(h);continue}if(l==="never"){a.push(h);continue}let m=u.run({value:t[h],issues:[]},n);if(m instanceof Promise)e.push(m.then((g)=>Qn(g,r,h,t,f,p)));else Qn(m,r,h,t,f,p)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var S0=w("$ZodObject",(e,t)=>{L.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let s=vr(()=>Dp(t));N(e,"propValues",(u)=>{let l=u.def.shape,f={};for(let p in l){let d=l[p]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,p))le(f,p,new Set);for(let h of d.values)f[p].add(h);if(d.optin!==void 0)f[p].add(void 0)}}return f});let o=Lt,i=t.catchall,a,c=Y.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=s.value);let f=u.value;if(!o(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let p=[],d=a.shape,h=l?.abortEarly,m=u.issues.length;for(let g of a.allKeys){if(h&&u.issues.length!==m){if(pe(u,m))break;m=u.issues.length}if(g==="__proto__")continue;let _=d[g],S=_._zod.optin,x=_._zod.optout,b=_._zod.run({value:f[g],issues:[]},l);if(b instanceof Promise)p.push(b.then((v)=>Qn(v,u,g,f,S,x)));else Qn(b,u,g,f,S,x)}if(!i)return p.length?Promise.all(p).then(()=>u):u;return jp(p,f,u,l,s.value,e,h===!0)}}),Up=w("$ZodObjectJIT",(e,t)=>{S0.init(e,t);let r=e._zod.parse,n=vr(()=>Dp(t)),s=Y.memoizer,o=(d)=>{let h=n.value,m=h.symbolKeys,g=new pi(["payload","ctx"],{shape:d,inst:e,memo:s,syms:m}),_=(v)=>`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`,S=(v,k)=>`
144
- let ${v}_ab = false;
145
- for (let i = 0; i < ${v}.issues.length; i++) {
146
- const iss = ${v}.issues[i];
147
- iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
143
+ };`)(...Object.values(this.closed))}}var Vd={major:4,minor:6,patch:7};var Z=y("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Vd;let r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let o of i)for(let s of o._zod.onattach)s(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,c,l)=>{if(a.memo)return a;let u=Ae(a),p;for(let d of c){if(d._zod.def.when){if(Gp(a))continue;if(!d._zod.def.when(a))continue}else if(u)continue;let h=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&l?.async===!1)throw new Ge;if(p||f instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await f,a.issues.length===h)return;if($i(a.issues,h,e),!u)u=Ae(a,h)});else{if(a.issues.length===h)continue;if($i(a.issues,h,e),!u)u=Ae(a,h)}}if(p)return p.then(()=>a);return a},s=(a,c,l)=>{if(Ae(a))return a.aborted=!0,a;let u=o(c,i,l);if(u instanceof Promise){if(l.async===!1)throw new Ge;return u.then((p)=>e._zod.parse(p,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((p)=>s(p,a,c));return s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new Ge;return l.then((u)=>o(u,i,c))}return o(l,i,c)}}},{get "~standard"(){return Ei(this,"~standard",xa(this))},set "~standard"(e){et(this,"~standard",e)}}),lh=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>Ze(n,t,ye()))}:{value:e.value};async function i$(e,t){let n={async:!0};return lh(await e._zod.run({value:t,issues:[]},n),n)}function xa(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return lh(r,n)}catch(r){}return i$(e,t)},vendor:"zod",version:1}}var Mi=y("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=t.pattern??Rd,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),G=y("$ZodStringFormat",(e,t)=>{nr.init(e,t),Mi.init(e,t)}),uh=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=vd),G.init(e,t)}),ph=y("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ga(r))}else t.pattern??(t.pattern=ga());G.init(e,t)}),dh=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=yd),G.init(e,t)}),hh=1,Li=2;function fh(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function o$(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return fh(e)||Li;return s$(e,t)}function s$(e,t){if(!t.normalize&&t.protocol?.source===$d.source&&!/^https?:\/\//i.test(e))return hh;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Li}return new URL(e)}catch{return Li}}var a$=/[\t\n\r]/g;function Yd(e){return e.replace(a$,"")}function c$(e,t){return t.lastIndex=0,t.test(e.hostname)}function l$(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var mh=y("$ZodURL",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),i=o$(r,t);if(i===hh){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(i===Li){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Yd(r);return}if(t.hostname&&!c$(i,t.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort});if(t.protocol&&!l$(i,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?i.href:Yd(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),gh=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=bd()),G.init(e,t)}),vh=y("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?fd:md(t.length)),G.init(e,t)}),yh=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ld),G.init(e,t)}),bh=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ud),G.init(e,t)}),wh=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=pd),G.init(e,t)}),_h=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=dd),G.init(e,t)}),kh=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hd),G.init(e,t)}),xh=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Cd(t)),G.init(e,t)}),Sh=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ed),G.init(e,t)}),Ah=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Od(t)),G.init(e,t)}),$h=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gd),G.init(e,t)}),Ph=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wd),G.init(e,t)}),u$=/^[0-9a-fA-F:.]+$/;function Th(e){if(!u$.test(e))return!1;return fh(`http://[${e}]`)}var Eh=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_d),G.init(e,t),e._zod.check=(n)=>{if(!Th(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var Oh=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kd),G.init(e,t)});function p$(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);if(`${i}`!==r)return!1;if(i<0||i>128)return!1;return Th(n)}var Ch=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=xd),G.init(e,t),e._zod.check=(n)=>{if(!p$(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Rh(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 Sa=/^[0-9a-zA-Z+/]*={0,2}$/,Ih=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Sa),G.init(e,t),e._zod.check=(n)=>{if(Rh(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Ui=/^[A-Za-z0-9_-]*$/;function d$(e){if(!Ui.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Rh(n)}var Nh=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ui),G.init(e,t),e._zod.check=(n)=>{if(d$(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),zh=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Pd),G.init(e,t)});function h$(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));if("typ"in i&&i?.typ!=="JWT")return!1;if(!i.alg)return!1;if(t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}var Dh=y("$ZodJWT",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{if(h$(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var Aa=y("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=er,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let i=n.value;if(typeof i==="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;let o=typeof i==="number"?Number.isNaN(i)?"NaN":!Number.isFinite(i)?String(i):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),Lh=y("$ZodNumberFormat",(e,t)=>{Ld.init(e,t),Aa.init(e,t)}),jh=y("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=Id,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(o){}let i=n.value;if(typeof i==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}});var Mh=y("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=(n)=>n}),Uh=y("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function f$(e,t){let n=la(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map((o)=>o[0])),i=e._zod.parse;e._zod.parse=(o,s)=>{let a=t(o.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,l]of la(e._zod.def.checks))if(a>c&&l._zod.def.when(o)){let u=o.issues.length;return l._zod.check(o),o.issues[u].continue=!1,$i(o.issues,u,e),o}}return i(o,s)}}var m$=(e)=>Array.isArray(e)?e.length:-1;function Jd(e,t,n){if(e.issues.length)t.issues.push(...Ue(n,e.issues));t.value[n]=e.value}var Zh=y("$ZodArray",(e,t)=>{Z.init(e,t);let n=ce.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);let s=[],a=i?.abortEarly;for(let c=0;c<o.length;c++){let l=o[c],u=t.element._zod.run({value:l,issues:[]},i);if(u instanceof Promise)s.push(u.then((p)=>Jd(p,r,c)));else if(Jd(u,r,c),a&&u.issues.length!==0&&Ae(u))break}if(s.length)return Promise.all(s).then(()=>r);return r},f$(e,m$)});function ji(e,t,n,r,i,o){let s=n in r,a=o==="optional";if(!s&&a&&i==="optional")return;if(e.issues.length){if(i!==void 0&&a&&!s)return;t.issues.push(...Ue(n,e.issues))}if(!s&&i===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(s||i==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var g$=[];function Gh(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:g$,i=r.length?[...t,...r]:t;for(let s of i)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let o=Mp(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function qh(e,t,n,r,i,o,s){let a=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,{optin:p,optout:d}=l,h=0;for(let f in t){if(s&&n.issues.length!==h){if(Ae(n,h))break;h=n.issues.length}if(c.has(f))continue;if(f==="__proto__"){if(u==="never")a.push(f);continue}if(u==="never"){a.push(f);continue}let m=l.run({value:t[f],issues:[]},r);if(m instanceof Promise)e.push(m.then((g)=>ji(g,n,f,t,p,d)));else ji(m,n,f,t,p,d)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var v$=y("$ZodObject",(e,t)=>{Z.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let l=()=>{let u={...r};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=r,Object.defineProperty(t,"shape",{get:l})}let i=Jn(()=>Gh(t));D(e,"propValues",(l)=>{let u=l.def.shape,p={};for(let d in u){let h=u[d]._zod;if(h.values){if(!Object.prototype.hasOwnProperty.call(p,d))ge(p,d,new Set);for(let f of h.values)p[d].add(f);if(h.optin!==void 0)p[d].add(void 0)}}return p});let o=rn,s=t.catchall,a,c=ce.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=i.value);let p=l.value;if(!o(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let d=[],h=a.shape,f=u?.abortEarly,m=l.issues.length;for(let g of a.allKeys){if(f&&l.issues.length!==m){if(Ae(l,m))break;m=l.issues.length}if(g==="__proto__")continue;let w=h[g],x=w._zod.optin,_=w._zod.optout,b=w._zod.run({value:p[g],issues:[]},u);if(b instanceof Promise)d.push(b.then((k)=>ji(k,l,g,p,x,_)));else ji(b,l,g,p,x,_)}if(!s)return d.length?Promise.all(d).then(()=>l):l;return qh(d,p,l,u,i.value,e,f===!0)}}),Bh=y("$ZodObjectJIT",(e,t)=>{v$.init(e,t);let n=e._zod.parse,r=Jn(()=>Gh(t)),i=ce.memoizer,o=(h)=>{let f=r.value,m=f.symbolKeys,g=new _a(["payload","ctx"],{shape:h,inst:e,memo:i,syms:m}),w=(k)=>`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`,x=(k,S)=>`
144
+ let ${k}_ab = false;
145
+ for (let i = 0; i < ${k}.issues.length; i++) {
146
+ const iss = ${k}.issues[i];
147
+ iss.path = iss.path ? [${S}, ...iss.path] : [${S}];
148
148
  payload.issues.push(iss);
149
- if (iss.continue !== true) ${v}_ab = true;
149
+ if (iss.continue !== true) ${k}_ab = true;
150
150
  }
151
- if (${v}_ab && ctx && ctx.abortEarly) {
151
+ if (${k}_ab && ctx && ctx.abortEarly) {
152
152
  payload.value = newResult;
153
153
  return payload;
154
- }`;g.write("const input = payload.value;");let x=Object.create(null),b=0;for(let v of h.allKeys)x[v]=`key_${b++}`;g.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let v of h.allKeys){if(v==="__proto__")continue;let k=x[v],T=typeof v==="symbol"?`syms[${m.indexOf(v)}]`:Ou(v),P=`${T} in input`,K=d[v],ae=K?._zod?.optin,Ce=ae!==void 0,G=K?._zod?.optout==="optional";if(g.write(`const ${k} = ${_(T)};`),Ce&&G){let Gr=ae==="optional"?`${k}_present`:`${k}.value !== undefined || ${k}_present`;g.write(`
155
- const ${k}_present = ${P};
156
- if (!${k}.issues.length || ${k}_present) {
157
- if (${k}.issues.length) {${S(k,T)}
154
+ }`;g.write("const input = payload.value;");let _=Object.create(null),b=0;for(let k of f.allKeys)_[k]=`key_${b++}`;g.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let k of f.allKeys){if(k==="__proto__")continue;let S=_[k],O=typeof k==="symbol"?`syms[${m.indexOf(k)}]`:zp(k),A=`${O} in input`,L=h[k],ae=L?._zod?.optin,ke=ae!==void 0,B=L?._zod?.optout==="optional";if(g.write(`const ${S} = ${w(O)};`),ke&&B){let St=ae==="optional"?`${S}_present`:`${S}.value !== undefined || ${S}_present`;g.write(`
155
+ const ${S}_present = ${A};
156
+ if (!${S}.issues.length || ${S}_present) {
157
+ if (${S}.issues.length) {${x(S,O)}
158
158
  }
159
159
 
160
- if (${Gr}) {
161
- newResult[${T}] = ${k}.value;
160
+ if (${St}) {
161
+ newResult[${O}] = ${S}.value;
162
162
  }
163
163
  }
164
164
 
165
- `)}else if(!Ce)g.write(`
166
- const ${k}_present = ${P};
167
- if (${k}.issues.length) {${S(k,T)}
165
+ `)}else if(!ke)g.write(`
166
+ const ${S}_present = ${A};
167
+ if (${S}.issues.length) {${x(S,O)}
168
168
  }
169
- if (!${k}_present && !${k}.issues.length) {
169
+ if (!${S}_present && !${S}.issues.length) {
170
170
  payload.issues.push({
171
171
  code: "invalid_type",
172
172
  expected: "nonoptional",
173
173
  input: undefined,
174
- path: [${T}]
174
+ path: [${O}]
175
175
  });
176
176
  if (ctx && ctx.abortEarly) {
177
177
  payload.value = newResult;
@@ -179,21 +179,21 @@ ${t.join(`
179
179
  }
180
180
  }
181
181
 
182
- if (${k}_present) {
183
- newResult[${T}] = ${k}.value;
182
+ if (${S}_present) {
183
+ newResult[${O}] = ${S}.value;
184
184
  }
185
185
 
186
186
  `);else if(g.write(`
187
- if (${k}.issues.length) {${S(k,T)}
187
+ if (${S}.issues.length) {${x(S,O)}
188
188
  }
189
- `),ae==="defaulted")g.write(`newResult[${T}] = ${k}.value;`);else g.write(`
190
- if (${k}.value !== undefined || ${P}) {
191
- newResult[${T}] = ${k}.value;
189
+ `),ae==="defaulted")g.write(`newResult[${O}] = ${S}.value;`);else g.write(`
190
+ if (${S}.value !== undefined || ${A}) {
191
+ newResult[${O}] = ${S}.value;
192
192
  }
193
- `)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},i,a=Lt,c=!Y.jitless,l=c&&Nu.value,f=t.catchall,p;e._zod.parse=(d,h)=>{p??(p=n.value);let m=d.value;if(!a(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;if(c&&l&&h?.async===!1&&h.jitless!==!0){if(!i)i=o(t.shape);if(d=i(d,h),!f)return d;return jp([],m,d,h,p,e,h?.abortEarly===!0)}return r(d,h)}});function Hl(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let s=e.filter((o)=>!pe(o));if(s.length===1)return t.value=s[0].value,s[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((o)=>o.issues.map((i)=>Ae(i,n,ne())))}),t}var gi=w("$ZodUnion",(e,t)=>{L.init(e,t),N(e,"optin",(n)=>n.def.options.some((s)=>s._zod.optin==="defaulted")?"defaulted":n.def.options.some((s)=>s._zod.optin!==void 0)?"optional":void 0),N(e,"optout",(n)=>n.def.options.some((s)=>s._zod.optout==="optional")?"optional":void 0),N(e,"values",(n)=>{if(n.def.options.every((s)=>s._zod.values))return new Set(n.def.options.flatMap((s)=>Array.from(s._zod.values)));return}),N(e,"pattern",(n)=>{if(n.def.options.every((s)=>s._zod.pattern)){let s=n.def.options.map((o)=>o._zod.pattern);return new RegExp(`^(${s.map((o)=>Dn(o.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,s)=>{if(r)return r(n,s);let o=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},s);if(c instanceof Promise)i.push(c),o=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!o)return Hl(i,n,e,s);return Promise.all(i).then((a)=>Hl(a,n,e,s))}});function A0(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let s of n)if(t.has(s)){if(s!==void 0)throw Error(`Duplicate discriminator value "${String(s)}"`);t.set(s,null)}else t.set(s,r)}return t}var Zp=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gi.init(e,t);let r=e._zod.parse;N(e,"propValues",(s)=>{let o={},i=0;for(let a of s.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${s.def.options.indexOf(a)}"`);if(c[s.def.discriminator]?.has(void 0))i++;for(let[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(o,u))le(o,u,new Set);for(let f of l)o[u].add(f)}}if(!s.def.unionFallback&&i>1)o[s.def.discriminator]?.delete(void 0);return o}),t.options.forEach((s,o)=>{let i=kr(s._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let n=vr(()=>A0(t));e._zod.parse=(s,o)=>{let i=s.value;if(!Lt(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;let a=i?.[t.discriminator],c=n.value.get(a);if(c&&(a!==void 0||o.direction!=="backward"))return c._zod.run(s,o);if(t.unionFallback||o.direction==="backward")return r(s,o);return s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((u)=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),s}}),Mp=w("$ZodIntersection",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let s=r.value,o=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);if(o instanceof Promise||i instanceof Promise)return Promise.all([o,i]).then(([c,u])=>Wl(r,c,u));return Wl(r,o,i)}});function fi(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(mt(e)&&mt(t)){let r=Object.keys(t),n=Object.keys(e).filter((o)=>r.indexOf(o)!==-1),s={...e,...t};if(Object.prototype.hasOwnProperty.call(s,"__proto__"))delete s.__proto__;for(let o of n){if(o==="__proto__")continue;let i=fi(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}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 s=e[n],o=t[n],i=fi(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Wl(e,t,r){let n=new Map,s,o=new Map,i=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)s??(s=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);if(!o.has(p))o.set(p,u);f=[p]}else return!1;for(let p of f){if(!n.has(p))n.set(p,{});n.get(p)[l]=!0}return!0};for(let u of t.issues)if(!i(u,"l"))e.issues.push(u);for(let u of r.issues)if(!i(u,"r"))e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=s?a.filter((l)=>s.keys.includes(l)):[];if(u.length)e.issues.push({...s,keys:u});for(let l of a)if(!u.includes(l)&&o.has(l))e.issues.push(o.get(l))}let c=fi(t.value,r.value);if(!c.valid){if(pe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var qp=w("$ZodTuple",(e,t)=>{L.init(e,t);let r=t.items,n=Y.memoizer;n?.attach(e),e._zod.parse=(s,o)=>{let i=s.value;if(!Array.isArray(i))return s.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),s;s.value=n?n.alloc(e,s,[],o):[];let a=[],c=Vl(r,"optin"),u=Vl(r,"optout");if(!t.rest){if(i.length<c)return s.issues.push({code:"too_small",minimum:c,inclusive:!0,input:i,inst:e,origin:"array"}),s;if(i.length>r.length)s.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:e,origin:"array"})}let l=Array(r.length),f=t.rest?o?.abortEarly:void 0,p=!1;for(let d=0;d<r.length;d++){let h=r[d]._zod.run({value:i[d],issues:[]},o);if(h instanceof Promise)a.push(h.then((m)=>{l[d]=m}));else if(l[d]=h,f&&!p&&h.issues.length)p=pe(h)}if(t.rest&&!p){let d=r.length-1,h=i.slice(r.length),m=s.issues.length;for(let g of h){if(f&&s.issues.length!==m){if(pe(s,m))break;m=s.issues.length}d++;let _=t.rest._zod.run({value:g,issues:[]},o);if(_ instanceof Promise)a.push(_.then((S)=>Yl(S,s,d)));else Yl(_,s,d)}}if(a.length)return Promise.all(a).then(()=>Jl(l,s,r,i,u));return Jl(l,s,r,i,u)}});function Vl(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Yl(e,t,r){if(e.issues.length)t.issues.push(...Se(r,e.issues));t.value[r]=e.value}function Jl(e,t,r,n,s){for(let o=0;o<r.length;o++){let i=e[o],a=o<n.length;if(!a&&o>=s&&r[o]._zod.optin==="optional"){t.value.length=o;break}if(i.issues.length){if(!a&&o>=s){t.value.length=o;break}t.issues.push(...Se(o,i.issues))}t.value[o]=i.value}for(let o=t.value.length-1;o>=n.length;o--)if(r[o]._zod.optout==="optional"&&t.value[o]===void 0)t.value.length=o;else break;return t}var Bp=w("$ZodRecord",(e,t)=>{L.init(e,t);let r=Y.memoizer;r?.attach(e),e._zod.parse=(n,s)=>{let o=n.value;if(!mt(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},s):{};let c=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},s);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((h)=>Ae(h,s,ne())),input:l,path:[l],inst:e});continue}let p=f.value;if(p==="__proto__")continue;let d=t.valueType._zod.run({value:o[l],issues:[]},s);if(d instanceof Promise)i.push(d.then((h)=>{if(h.issues.length)n.issues.push(...Se(l,h.issues));n.value[p]=h.value}));else{if(d.issues.length)n.issues.push(...Se(l,d.issues));n.value[p]=d.value}}let u;for(let l in o)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=o[l]}else u=u??[],u.push(l);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},s):{};let c;for(let u of Reflect.ownKeys(o)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},s);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Sr.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},s);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length===0)l=h}if(l.issues.length){if(t.mode==="loose")n.value[u]=o[u];else if(a)c=c??[],c.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((h)=>Ae(h,s,ne())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let d=t.valueType._zod.run({value:o[u],issues:[]},s);if(d instanceof Promise)i.push(d.then((h)=>{if(h.issues.length)n.issues.push(...Se(u,h.issues));n.value[p]=h.value}));else{if(d.issues.length)n.issues.push(...Se(u,d.issues));n.value[p]=d.value}}if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c,continue:!0})}if(i.length)return Promise.all(i).then(()=>n);return n}});var Kp=w("$ZodEnum",(e,t)=>{L.init(e,t);let r=br(t.entries),n=new Set(r);e._zod.values=n,N(e,"pattern",(s)=>{let o=br(s.def.entries).filter((i)=>Ru.has(typeof i));return new RegExp(o.length?`^(${o.map((i)=>et(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(s,o)=>{let i=s.value;if(n.has(i))return s;return s.issues.push({code:"invalid_value",values:r,input:i,inst:e}),s}}),Fp=w("$ZodLiteral",(e,t)=>{L.init(e,t);let r=new Set(t.values);e._zod.values=r,N(e,"pattern",(n)=>{let s=n.def.values;return new RegExp(s.length?`^(${s.map((o)=>typeof o==="string"?et(o):o?et(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let o=n.value;if(r.has(o))return n;return n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}});var Gp=w("$ZodTransform",(e,t)=>{L.init(e,t),e._zod.optin="optional",Y.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xr(e.constructor.name);let s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then((i)=>(r.value=i,r));if(s instanceof Promise)throw new $e;return r.value=s,r}});function Ql(e,t){return e.value=t.issues.length?void 0:t.value,e}var yi=w("$ZodOptional",(e,t)=>{L.init(e,t),N(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",N(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),N(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Dn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let s=t.innerType._zod.run({value:r.value,issues:[]},n);if(s instanceof Promise)return s.then((o)=>Ql(r,o));return Ql(r,s)}return t.innerType._zod.run(r,n)}}),Hp=w("$ZodExactOptional",(e,t)=>{yi.init(e,t),N(e,"values",(r)=>r.def.innerType._zod.values),N(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Wp=w("$ZodNullable",(e,t)=>{L.init(e,t),N(e,"optin",(r)=>r.def.innerType._zod.optin),N(e,"optout",(r)=>r.def.innerType._zod.optout),N(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Dn(n.source)}|null)$`):void 0}),N(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Vp=w("$ZodDefault",(e,t)=>{L.init(e,t),e._zod.optin="defaulted",N(e,"values",(r)=>r.def.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 s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((o)=>Xl(o,t));return Xl(s,t)}});function Xl(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Yp=w("$ZodPrefault",(e,t)=>{L.init(e,t),e._zod.optin="defaulted",N(e,"values",(r)=>r.def.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)}}),Jp=w("$ZodNonOptional",(e,t)=>{L.init(e,t),N(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((s)=>s!==void 0)):void 0}),e._zod.parse=(r,n)=>{let s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((o)=>ep(o,e));return ep(s,e)}});function ep(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}function tp(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((s)=>Ae(s,n,ne()))},input:e.value}),e}var Qp=w("$ZodCatch",(e,t)=>{L.init(e,t),N(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),N(e,"optout",(r)=>r.def.innerType._zod.optout),N(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let s=t.innerType._zod.run({value:r.value,issues:[]},n);if(s instanceof Promise)return s.then((o)=>tp(r,o,t,n));return tp(r,s,t,n)}});var wi=w("$ZodPipe",(e,t)=>{L.init(e,t),N(e,"values",(r)=>r.def.in._zod.values),N(e,"optin",(r)=>r.def.in._zod.optin),N(e,"optout",(r)=>r.def.out._zod.optout),N(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Yn(i,t.in,n));return Yn(o,t.in,n)}let s=t.in._zod.run(r,n);if(s instanceof Promise)return s.then((o)=>Yn(o,t.out,n));return Yn(s,t.out,n)}});function Yn(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Xp=w("$ZodPreprocess",(e,t)=>{wi.init(e,t)}),ef=w("$ZodReadonly",(e,t)=>{L.init(e,t),N(e,"propValues",(r)=>r.def.innerType._zod.propValues),N(e,"values",(r)=>r.def.innerType._zod.values),N(e,"optin",(r)=>r.def.innerType?._zod?.optin),N(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then(rp);return rp(s)}});function rp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var tf=w("$ZodCustom",(e,t)=>{V.init(e,t),L.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then((o)=>np(o,r,n,e));np(s,r,n,e);return}});function np(e,t,r,n){if(!e){let s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)s.params=n._zod.def.params;t.issues.push(gt(s))}}class nf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var _i="~memo",rf=[];function sf(e){return e!==null&&typeof e==="object"}function bi(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var of=new WeakMap,Pr=0,ns=1,Er=2;function ss(e,t,r){let n=of.get(e);if(n!==void 0)return n?Er:Pr;if(t.has(e))return Er;t.add(e);let s=Pr,o=(l)=>{if(s!==Er&&l?._zod){let f=ss(l,t,r);if(f>s)s=f}},i=(l,f)=>{let p=Pr;for(let d of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,d);if(f&&!h.enumerable)continue;let m=h.get?ns:h.value?._zod?ss(h.value,t,r):Pr;if(m>p)p=m}return p},a=(l)=>{if(l>s)s=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=kr(c);a(l?i(l,!0):ns),o(c.catchall);break}case"array":o(c.element);break;case"tuple":for(let l of c.items)o(l);o(c.rest);break;case"record":case"map":o(c.keyType),o(c.valueType);break;case"set":o(c.valueType);break;case"union":for(let l of c.options)o(l);break;case"intersection":o(c.left),o(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(c.innerType);break;case"pipe":o(c.in),o(c.out);break;case"function":o(c.input),o(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?ss(l,t,!1):ns);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let p=f.value;if(!p||typeof p!=="object")continue;if(p._zod)o(p);else if(Array.isArray(p))for(let d of p)o(d)}}return t.delete(e),$0(e,s)}function $0(e,t){if(t!==ns)of.set(e,t===Er);return t}function P0(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var ts,rs=[],E0={alloc(e,t,r){let n=ts;if(!n)return r;ts=void 0;let s={value:r,issues:null};return n.set(t.value,s),rs.push(s),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(s,o)=>{if(o.direction!=="backward"&&T0(o,s.value))throw new nf;return r(s,o)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,s,o;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let _=ss(e,new Set,!1);if(_===Pr){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(c,u)}if(_===Er||n)r=!0;else n=!0}let l=c.value;if(!sf(l))return i(c,u);let f=u[_i];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[_i]=f;let p;if(s===u)p=o;else p=P0(f,e),s=u,o=p;let d=p.get(l);if(d){if(c.value=d.value,d.issues){if(d.issues.length)c.issues.push(...bi(d.issues))}else c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return c}ts=p;let h=rs.length,m=i(c,u);ts=void 0;let g=rs.length>h?rs.pop():void 0;if(m instanceof Promise)return m.then((_)=>{if(g)g.issues=_.issues.length?bi(_.issues):rf;return _});if(g)g.issues=m.issues.length?bi(m.issues):rf;return m};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function af(){return E0}function T0(e,t){let r=e[_i]?.backEdges;return r!==void 0&&sf(t)&&r.has(t)}var O0=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function s(o,i){if(o==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return n[o]??o}return(o)=>{switch(o.code){case"invalid_type":{let i=s(o.expected),a=ju(o.input),c=s(a,o.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${Jo(o.values[0])}`;return`Invalid option: expected one of ${Wo(o.values,"|")}`;case"too_big":{let i=o.exact?"exactly ":o.inclusive?"<=":"<",a=t(o.origin);if(a)return`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.exact?"exactly ":o.inclusive?">=":">",a=t(o.origin);if(a)return`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`;return`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Wo(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0)return`Invalid discriminator value. Expected ${o.options.map((a)=>`'${a}'`).join(" | ")}`;if(o.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function vi(){return{localeError:O0()}}var cf;class uf{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 I0(){return new uf}(cf=globalThis).__zod_globalRegistry??(cf.__zod_globalRegistry=I0());var yt=globalThis.__zod_globalRegistry;function lf(e){if(e.checks)e.checks=[...e.checks];return e}function pf(e,t){return new e(lf({type:"string",...E(t)}))}function ff(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function df(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function hf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function mf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function gf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function yf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function ki(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function wf(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function bf(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function _f(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function vf(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function kf(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function xf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function Sf(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function Af(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function $f(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function Pf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function Ef(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function Tf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function Of(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function If(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function Nf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}function Rf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function Cf(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function zf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function Lf(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function Df(e,t){return new e(lf({type:"number",checks:[],...E(t)}))}function jf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}function Uf(e,t){return new e({type:"boolean",...E(t)})}function Zf(e){return new e({type:"unknown"})}function Mf(e,t){return new e({type:"never",...E(t)})}function os(e,t){return new ui({check:"less_than",...E(t),value:e,inclusive:!1})}function Tr(e,t){return new ui({check:"less_than",...E(t),value:e,inclusive:!0})}function is(e,t){return new li({check:"greater_than",...E(t),value:e,inclusive:!1})}function Or(e,t){return new li({check:"greater_than",...E(t),value:e,inclusive:!0})}function as(e,t){return new Il({check:"multiple_of",...E(t),value:e})}function cs(e,t){return new Rl({check:"max_length",...E(t),maximum:e})}function Dt(e,t){return new Cl({check:"min_length",...E(t),minimum:e})}function us(e,t){return new zl({check:"length_equals",...E(t),length:e})}function xi(e,t){return new Ll({check:"string_format",format:"regex",...E(t),pattern:e})}function Si(e){return new Dl({check:"string_format",format:"lowercase",...E(e)})}function Ai(e){return new jl({check:"string_format",format:"uppercase",...E(e)})}function $i(e,t){return new Ul({check:"string_format",format:"includes",...E(t),includes:e})}function Pi(e,t){return new Zl({check:"string_format",format:"starts_with",...E(t),prefix:e})}function Ei(e,t){return new Ml({check:"string_format",format:"ends_with",...E(t),suffix:e})}function tt(e){return new ql({check:"overwrite",tx:e})}function Ti(e){return tt((t)=>t.normalize(e))}function Oi(){return tt((e)=>e.trim())}function Ii(){return tt((e)=>e.toLowerCase())}function Ni(){return tt((e)=>e.toUpperCase())}function Ri(){return tt((e)=>Iu(e))}function qf(e,t,r){return new e({type:"array",element:t,...E(r)})}function Bf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...E(r)})}function Kf(e,t){let r=N0((n)=>(n.addIssue=(s)=>{if(typeof s==="string")n.issues.push(gt(s,n.value,r._zod.def));else{let o=s;if(o.fatal)o.continue=!1;if(o.code??(o.code="custom"),!("input"in o))o.input=n.value;o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push(gt(o))}},e(n.value,n)),t);return r}function N0(e,t){let r=new V({check:"custom",...E(t)});return r._zod.check=e,r}function Ir(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))le(e,n,r[n]);return e}function zi(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??yt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ue(e,t,r,n,s){let o=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:s}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw Error(s);return Object.assign(r,o),!0}function Z(e,t,r={path:[],schemaPath:[]}){var n;let s=e._zod.def,o=t.seen.get(e);if(o){if(o.count++,r.schemaPath.includes(e))o.cycle=r.path;return o.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,d=t.processors[s.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);d(e,t,p,l)}let f=e._zod.parent;if(f){if(!i.ref)i.ref=f;Z(f,t,l),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Ir(i.schema,c);if(t.io==="input"&&J(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 Ff(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Li(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let s=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(i[0])?.id,p=e.external.uri??((h)=>h);if(f)return{ref:p(f)};let d=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=d,{defId:d,ref:`${p("__shared")}#/${a}/${Ff(d)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Ff(l)}},o=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=s(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
193
+ `)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},s,a=rn,c=!ce.jitless,u=c&&Lp.value,p=t.catchall,d;e._zod.parse=(h,f)=>{d??(d=r.value);let m=h.value;if(!a(m))return h.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),h;if(c&&u&&f?.async===!1&&f.jitless!==!0){if(!s)s=o(t.shape);if(h=s(h,f),!p)return h;return qh([],m,h,f,d,e,f?.abortEarly===!0)}return n(h,f)}});function Qd(e,t,n,r){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter((o)=>!Ae(o));if(i.length===1)return t.value=i[0].value,i[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((o)=>o.issues.map((s)=>Ze(s,r,ye())))}),t}var $a=y("$ZodUnion",(e,t)=>{Z.init(e,t),D(e,"optin",(r)=>r.def.options.some((i)=>i._zod.optin==="defaulted")?"defaulted":r.def.options.some((i)=>i._zod.optin!==void 0)?"optional":void 0),D(e,"optout",(r)=>r.def.options.some((i)=>i._zod.optout==="optional")?"optional":void 0),D(e,"values",(r)=>{if(r.def.options.every((i)=>i._zod.values))return new Set(r.def.options.flatMap((i)=>Array.from(i._zod.values)));return}),D(e,"pattern",(r)=>{if(r.def.options.every((i)=>i._zod.pattern)){let i=r.def.options.map((o)=>o._zod.pattern);return new RegExp(`^(${i.map((o)=>xi(o.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},i);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!o)return Qd(s,r,e,i);return Promise.all(s).then((a)=>Qd(a,r,e,i))}});function y$(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let i of r)if(t.has(i)){if(i!==void 0)throw Error(`Duplicate discriminator value "${String(i)}"`);t.set(i,null)}else t.set(i,n)}return t}var Hh=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,$a.init(e,t);let n=e._zod.parse;D(e,"propValues",(i)=>{let o={},s=0;for(let a of i.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${i.def.options.indexOf(a)}"`);if(c[i.def.discriminator]?.has(void 0))s++;for(let[l,u]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(o,l))ge(o,l,new Set);for(let p of u)o[l].add(p)}}if(!i.def.unionFallback&&s>1)o[i.def.discriminator]?.delete(void 0);return o}),t.options.forEach((i,o)=>{let s=Qn(i._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let r=Jn(()=>y$(t));e._zod.parse=(i,o)=>{let s=i.value;if(!rn(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;let a=s?.[t.discriminator],c=r.value.get(a);if(c&&(a!==void 0||o.direction!=="backward"))return c._zod.run(i,o);if(t.unionFallback||o.direction==="backward")return n(i,o);return i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter((l)=>r.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),i}}),Fh=y("$ZodIntersection",(e,t)=>{Z.init(e,t),e._zod.parse=(n,r)=>{let i=n.value,o=t.left._zod.run({value:i,issues:[]},r),s=t.right._zod.run({value:i,issues:[]},r);if(o instanceof Promise||s instanceof Promise)return Promise.all([o,s]).then(([c,l])=>Xd(n,c,l));return Xd(n,o,s)}});function ka(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(Nt(e)&&Nt(t)){let n=Object.keys(t),r=Object.keys(e).filter((o)=>n.indexOf(o)!==-1),i={...e,...t};if(Object.prototype.hasOwnProperty.call(i,"__proto__"))delete i.__proto__;for(let o of r){if(o==="__proto__")continue;let s=ka(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t[r],s=ka(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Xd(e,t,n){let r=new Map,i,o=new Map,s=(l,u)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)i??(i=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let d=String(l.path[0]);if(!o.has(d))o.set(d,l);p=[d]}else return!1;for(let d of p){if(!r.has(d))r.set(d,{});r.get(d)[u]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of n.issues)if(!s(l,"r"))e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=i?a.filter((u)=>i.keys.includes(u)):[];if(l.length)e.issues.push({...i,keys:l});for(let u of a)if(!l.includes(u)&&o.has(u))e.issues.push(o.get(u))}let c=ka(t.value,n.value);if(!c.valid){if(Ae(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Kh=y("$ZodTuple",(e,t)=>{Z.init(e,t);let n=t.items,r=ce.memoizer;r?.attach(e),e._zod.parse=(i,o)=>{let s=i.value;if(!Array.isArray(s))return i.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],o):[];let a=[],c=eh(n,"optin"),l=eh(n,"optout");if(!t.rest){if(s.length<c)return i.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),i;if(s.length>n.length)i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=Array(n.length),p=t.rest?o?.abortEarly:void 0,d=!1;for(let h=0;h<n.length;h++){let f=n[h]._zod.run({value:s[h],issues:[]},o);if(f instanceof Promise)a.push(f.then((m)=>{u[h]=m}));else if(u[h]=f,p&&!d&&f.issues.length)d=Ae(f)}if(t.rest&&!d){let h=n.length-1,f=s.slice(n.length),m=i.issues.length;for(let g of f){if(p&&i.issues.length!==m){if(Ae(i,m))break;m=i.issues.length}h++;let w=t.rest._zod.run({value:g,issues:[]},o);if(w instanceof Promise)a.push(w.then((x)=>th(x,i,h)));else th(w,i,h)}}if(a.length)return Promise.all(a).then(()=>nh(u,i,n,s,l));return nh(u,i,n,s,l)}});function eh(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function th(e,t,n){if(e.issues.length)t.issues.push(...Ue(n,e.issues));t.value[n]=e.value}function nh(e,t,n,r,i){for(let o=0;o<n.length;o++){let s=e[o],a=o<r.length;if(!a&&o>=i&&n[o]._zod.optin==="optional"){t.value.length=o;break}if(s.issues.length){if(!a&&o>=i){t.value.length=o;break}t.issues.push(...Ue(o,s.issues))}t.value[o]=s.value}for(let o=t.value.length-1;o>=r.length;o--)if(n[o]._zod.optout==="optional"&&t.value[o]===void 0)t.value.length=o;else break;return t}var Wh=y("$ZodRecord",(e,t)=>{Z.init(e,t);let n=ce.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let o=r.value;if(!Nt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let p=t.keyType._zod.run({value:u,issues:[]},i);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((f)=>Ze(f,i,ye())),input:u,path:[u],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let h=t.valueType._zod.run({value:o[u],issues:[]},i);if(h instanceof Promise)s.push(h.then((f)=>{if(f.issues.length)r.issues.push(...Ue(u,f.issues));r.value[d]=f.value}));else{if(h.issues.length)r.issues.push(...Ue(u,h.issues));r.value[d]=h.value}}let l;for(let u in o)if(!c.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;r.value[u]=o[u]}else l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let l of Reflect.ownKeys(o)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},i);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&er.test(l)&&u.issues.length){let f=t.keyType._zod.run({value:Number(l),issues:[]},i);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)u=f}if(u.issues.length){if(t.mode==="loose")r.value[l]=o[l];else if(a)c=c??[],c.push(l);else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((f)=>Ze(f,i,ye())),input:l,path:[l],inst:e});continue}let d=u.value;if(d==="__proto__")continue;let h=t.valueType._zod.run({value:o[l],issues:[]},i);if(h instanceof Promise)s.push(h.then((f)=>{if(f.issues.length)r.issues.push(...Ue(l,f.issues));r.value[d]=f.value}));else{if(h.issues.length)r.issues.push(...Ue(l,h.issues));r.value[d]=h.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}});var Vh=y("$ZodEnum",(e,t)=>{Z.init(e,t);let n=Vn(t.entries),r=new Set(n);e._zod.values=r,D(e,"pattern",(i)=>{let o=Vn(i.def.entries).filter((s)=>jp.has(typeof s));return new RegExp(o.length?`^(${o.map((s)=>bt(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,o)=>{let s=i.value;if(r.has(s))return i;return i.issues.push({code:"invalid_value",values:n,input:s,inst:e}),i}}),Yh=y("$ZodLiteral",(e,t)=>{Z.init(e,t);let n=new Set(t.values);e._zod.values=n,D(e,"pattern",(r)=>{let i=r.def.values;return new RegExp(i.length?`^(${i.map((o)=>typeof o==="string"?bt(o):o?bt(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{let o=r.value;if(n.has(o))return r;return r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}});var Jh=y("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.optin="optional",ce.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Xn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then((s)=>(n.value=s,n));if(i instanceof Promise)throw new Ge;return n.value=i,n}});function rh(e,t){return e.value=t.issues.length?void 0:t.value,e}var Pa=y("$ZodOptional",(e,t)=>{Z.init(e,t),D(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",D(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),D(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${xi(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let i=t.innerType._zod.run({value:n.value,issues:[]},r);if(i instanceof Promise)return i.then((o)=>rh(n,o));return rh(n,i)}return t.innerType._zod.run(n,r)}}),Qh=y("$ZodExactOptional",(e,t)=>{Pa.init(e,t),D(e,"values",(n)=>n.def.innerType._zod.values),D(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Xh=y("$ZodNullable",(e,t)=>{Z.init(e,t),D(e,"optin",(n)=>n.def.innerType._zod.optin),D(e,"optout",(n)=>n.def.innerType._zod.optout),D(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${xi(r.source)}|null)$`):void 0}),D(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),ef=y("$ZodDefault",(e,t)=>{Z.init(e,t),e._zod.optin="defaulted",D(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>ih(o,t));return ih(i,t)}});function ih(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var tf=y("$ZodPrefault",(e,t)=>{Z.init(e,t),e._zod.optin="defaulted",D(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,r)}}),nf=y("$ZodNonOptional",(e,t)=>{Z.init(e,t),D(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter((i)=>i!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>oh(o,e));return oh(i,e)}});function oh(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}function sh(e,t,n,r){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((i)=>Ze(i,r,ye()))},input:e.value}),e}var rf=y("$ZodCatch",(e,t)=>{Z.init(e,t),D(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),D(e,"optout",(n)=>n.def.innerType._zod.optout),D(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let i=t.innerType._zod.run({value:n.value,issues:[]},r);if(i instanceof Promise)return i.then((o)=>sh(n,o,t,r));return sh(n,i,t,r)}});var Ta=y("$ZodPipe",(e,t)=>{Z.init(e,t),D(e,"values",(n)=>n.def.in._zod.values),D(e,"optin",(n)=>n.def.in._zod.optin),D(e,"optout",(n)=>n.def.out._zod.optout),D(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let o=t.out._zod.run(n,r);if(o instanceof Promise)return o.then((s)=>Di(s,t.in,r));return Di(o,t.in,r)}let i=t.in._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>Di(o,t.out,r));return Di(i,t.out,r)}});function Di(e,t,n){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var of=y("$ZodPreprocess",(e,t)=>{Ta.init(e,t)}),sf=y("$ZodReadonly",(e,t)=>{Z.init(e,t),D(e,"propValues",(n)=>n.def.innerType._zod.propValues),D(e,"values",(n)=>n.def.innerType._zod.values),D(e,"optin",(n)=>n.def.innerType?._zod?.optin),D(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then(ah);return ah(i)}});function ah(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var af=y("$ZodCustom",(e,t)=>{te.init(e,t),Z.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then((o)=>ch(o,n,r,e));ch(i,n,r,e);return}});function ch(e,t,n,r){if(!e){let i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)i.params=r._zod.def.params;t.issues.push(zt(i))}}class lf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Oa="~memo",cf=[];function uf(e){return e!==null&&typeof e==="object"}function Ea(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var pf=new WeakMap,rr=0,qi=1,ir=2;function Bi(e,t,n){let r=pf.get(e);if(r!==void 0)return r?ir:rr;if(t.has(e))return ir;t.add(e);let i=rr,o=(u)=>{if(i!==ir&&u?._zod){let p=Bi(u,t,n);if(p>i)i=p}},s=(u,p)=>{let d=rr;for(let h of Reflect.ownKeys(u)){let f=Object.getOwnPropertyDescriptor(u,h);if(p&&!f.enumerable)continue;let m=f.get?qi:f.value?._zod?Bi(f.value,t,n):rr;if(m>d)d=m}return d},a=(u)=>{if(u>i)i=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Qn(c);a(u?s(u,!0):qi),o(c.catchall);break}case"array":o(c.element);break;case"tuple":for(let u of c.items)o(u);o(c.rest);break;case"record":case"map":o(c.keyType),o(c.valueType);break;case"set":o(c.valueType);break;case"union":for(let u of c.options)o(u);break;case"intersection":o(c.left),o(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(c.innerType);break;case"pipe":o(c.in),o(c.out);break;case"function":o(c.input),o(c.output);break;case"lazy":{let u=c._cachedInner??(n?e._zod.innerType:void 0);a(u?Bi(u,t,!1):qi);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let p=Object.getOwnPropertyDescriptor(c,u);if(!p||p.get)continue;let d=p.value;if(!d||typeof d!=="object")continue;if(d._zod)o(d);else if(Array.isArray(d))for(let h of d)o(h)}}return t.delete(e),b$(e,i)}function b$(e,t){if(t!==qi)pf.set(e,t===ir);return t}function w$(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var Zi,Gi=[],_$={alloc(e,t,n){let r=Zi;if(!r)return n;Zi=void 0;let i={value:n,issues:null};return r.set(t.value,i),Gi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(i,o)=>{if(o.direction!=="backward"&&k$(o,i.value))throw new lf;return n(i,o)};if(e._zod.parse=r,e._zod.run===n)e._zod.run=r})},attach(e){var t;let n,r=!1,i,o;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(n===void 0){let w=Bi(e,new Set,!1);if(w===rr){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(w===ir||r)n=!0;else r=!0}let u=c.value;if(!uf(u))return s(c,l);let p=l[Oa];if(!p)p={buckets:new WeakMap,backEdges:void 0},l[Oa]=p;let d;if(i===l)d=o;else d=w$(p,e),i=l,o=d;let h=d.get(u);if(h){if(c.value=h.value,h.issues){if(h.issues.length)c.issues.push(...Ea(h.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(h.value);return c}Zi=d;let f=Gi.length,m=s(c,l);Zi=void 0;let g=Gi.length>f?Gi.pop():void 0;if(m instanceof Promise)return m.then((w)=>{if(g)g.issues=w.issues.length?Ea(w.issues):cf;return w});if(g)g.issues=m.issues.length?Ea(m.issues):cf;return m};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function df(){return _$}function k$(e,t){let n=e[Oa]?.backEdges;return n!==void 0&&uf(t)&&n.has(t)}var x$=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(o,s){if(o==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[o]??o}return(o)=>{switch(o.code){case"invalid_type":{let s=i(o.expected),a=qp(o.input),c=i(a,o.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${aa(o.values[0])}`;return`Invalid option: expected one of ${ia(o.values,"|")}`;case"too_big":{let s=o.exact?"exactly ":o.inclusive?"<=":"<",a=t(o.origin);if(a)return`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.exact?"exactly ":o.inclusive?">=":">",a=t(o.origin);if(a)return`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${a.unit}`;return`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${n[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${ia(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0)return`Invalid discriminator value. Expected ${o.options.map((a)=>`'${a}'`).join(" | ")}`;if(o.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Ca(){return{localeError:x$()}}var hf;class ff{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.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 n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function S$(){return new ff}(hf=globalThis).__zod_globalRegistry??(hf.__zod_globalRegistry=S$());var Dt=globalThis.__zod_globalRegistry;function mf(e){if(e.checks)e.checks=[...e.checks];return e}function gf(e,t){return new e(mf({type:"string",...T(t)}))}function vf(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...T(t)})}function yf(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...T(t)})}function bf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...T(t)})}function wf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(t)})}function _f(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(t)})}function kf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(t)})}function Ra(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...T(t)})}function xf(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...T(t)})}function Sf(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(t)})}function Af(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...T(t)})}function $f(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(t)})}function Pf(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...T(t)})}function Tf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...T(t)})}function Ef(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(t)})}function Of(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(t)})}function Cf(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(t)})}function Rf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(t)})}function If(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(t)})}function Nf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...T(t)})}function zf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...T(t)})}function Df(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...T(t)})}function Lf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...T(t)})}function jf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(t)})}function Mf(e,t){return new e({type:"string",format:"date",check:"string_format",...T(t)})}function Uf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...T(t)})}function Zf(e,t){return new e({type:"string",format:"duration",check:"string_format",...T(t)})}function Gf(e,t){return new e(mf({type:"number",checks:[],...T(t)}))}function qf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...T(t)})}function Bf(e,t){return new e({type:"boolean",...T(t)})}function Hf(e){return new e({type:"unknown"})}function Ff(e,t){return new e({type:"never",...T(t)})}function Hi(e,t){return new ba({check:"less_than",...T(t),value:e,inclusive:!1})}function or(e,t){return new ba({check:"less_than",...T(t),value:e,inclusive:!0})}function Fi(e,t){return new wa({check:"greater_than",...T(t),value:e,inclusive:!1})}function sr(e,t){return new wa({check:"greater_than",...T(t),value:e,inclusive:!0})}function Ki(e,t){return new Dd({check:"multiple_of",...T(t),value:e})}function Wi(e,t){return new jd({check:"max_length",...T(t),maximum:e})}function on(e,t){return new Md({check:"min_length",...T(t),minimum:e})}function Vi(e,t){return new Ud({check:"length_equals",...T(t),length:e})}function Ia(e,t){return new Zd({check:"string_format",format:"regex",...T(t),pattern:e})}function Na(e){return new Gd({check:"string_format",format:"lowercase",...T(e)})}function za(e){return new qd({check:"string_format",format:"uppercase",...T(e)})}function Da(e,t){return new Bd({check:"string_format",format:"includes",...T(t),includes:e})}function La(e,t){return new Hd({check:"string_format",format:"starts_with",...T(t),prefix:e})}function ja(e,t){return new Fd({check:"string_format",format:"ends_with",...T(t),suffix:e})}function wt(e){return new Kd({check:"overwrite",tx:e})}function Ma(e){return wt((t)=>t.normalize(e))}function Ua(){return wt((e)=>e.trim())}function Za(){return wt((e)=>e.toLowerCase())}function Ga(){return wt((e)=>e.toUpperCase())}function qa(){return wt((e)=>Dp(e))}function Kf(e,t,n){return new e({type:"array",element:t,...T(n)})}function Wf(e,t,n){return new e({type:"custom",check:"custom",fn:t,...T(n)})}function Vf(e,t){let n=A$((r)=>(r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(zt(i,r.value,n._zod.def));else{let o=i;if(o.fatal)o.continue=!1;if(o.code??(o.code="custom"),!("input"in o))o.input=r.value;o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(zt(o))}},e(r.value,r)),t);return n}function A$(e,t){let n=new te({check:"custom",...T(t)});return n._zod.check=e,n}function ar(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))ge(e,r,n[r]);return e}function lr(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??Dt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Q(e,t,n,r,i){let o=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw Error(i);return Object.assign(n,o),!0}function U(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,o=t.seen.get(e);if(o){if(o.count++,n.schemaPath.includes(e))o.cycle=n.path;return o.schema}let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let d=s.schema,h=t.processors[i.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);h(e,t,d,u)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;U(p,t,u),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)ar(s.schema,c);if(t.io==="input"&&le(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Yf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ur(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let i=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,d=e.external.uri??((f)=>f);if(p)return{ref:d(p)};let h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${d("__shared")}#/${a}/${Yf(h)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+Yf(u)}},o=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=i(s);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let p in u)delete u[p];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
194
194
 
195
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){o(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1){if(e.reused==="ref")o(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Wf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;Wf(n);let s=Object.keys(n);if(s.length!==1||s[0]!=="type")return;let o=n.type;for(let i of Array.isArray(o)?o:[o]){if(typeof i!=="string")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Vf=new Set(["type","properties","required","additionalProperties"]),Gf=["oneOf","anyOf"];function Hf(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ci(e){let t=[];for(let o of e){if(typeof o!=="object"||o.type!=="object")return null;for(let i in o)if(!Vf.has(i))return null;t.push(o)}let r={},n=new Set;for(let o of t){for(let i in o.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??Hf(u);if(l===null||l===void 0)continue;if(!a.some((f)=>JSON.stringify(f)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:Ci(a)??{allOf:a};le(r,i,c)}for(let i of o.required??[])n.add(i)}let s={type:"object",properties:r};if(n.size)s.required=[...n];if(t.every((o)=>o.additionalProperties===!1))s.additionalProperties=!1;else{let o=[];for(let i of t){let a=Hf(i);if(a&&!o.some((c)=>JSON.stringify(c)===JSON.stringify(a)))o.push(a)}if(o.length===1)s.additionalProperties=o[0];else if(o.length>1)s.additionalProperties={allOf:o}}return s}function R0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let s of Vf)if(s in e)return;let r=t.filter((s)=>Gf.some((o)=>Array.isArray(s[o]))),n=null;if(!r.length)n=Ci(t);else{let s=r[0],o=Gf.find((c)=>Array.isArray(s[c]));if(Object.keys(s).length!==1)return;let i=t.filter((c)=>c!==s),a=s[o].map((c)=>Ci([...i,c]));if(a.some((c)=>!c))return;n={[o]:a}}if(!n)return;delete e.allOf,Ir(e,n)}function Di(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){n(f);let d=e.seen.get(f),h=d.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else Ir(u,h);if(Ir(u,l),a._zod.parent===f)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(!(g in l))delete u[g]}if(h.$ref&&d.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in d.def&&JSON.stringify(u[g])===JSON.stringify(d.def[g]))delete u[g]}}let p=a._zod.parent;if(p&&p!==f){n(p);let d=e.seen.get(p);if(d?.schema.$ref){if(u.$ref=d.schema.$ref,d.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in d.def&&JSON.stringify(u[h])===JSON.stringify(d.def[h]))delete u[h]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Wf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=a.get(l);if(f)f.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])R0(u)}}let s={};if(e.target==="draft-2020-12")s.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")s.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")s.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");s.$id=e.external.uri(a)}Ir(s,r.defId?r.schema:r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;if(o!==void 0&&s.id===o)delete s.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;le(i,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")s.$defs=i;else s.definitions=i;try{let a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Nr(t,"input",e.processors),output:Nr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function J(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 J(n.element,r);if(n.type==="set")return J(n.valueType,r);if(n.type==="lazy")return J(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"||n.type==="catch")return J(n.innerType,r);if(n.type==="intersection")return J(n.left,r)||J(n.right,r);if(n.type==="record"||n.type==="map")return J(n.keyType,r)||J(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return J(n.in,r)||J(n.out,r)}if(n.type==="object"){for(let s in n.shape)if(J(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(let s of n.options)if(J(s,r))return!0;return!1}if(n.type==="tuple"){for(let s of n.items)if(J(s,r))return!0;if(n.rest&&J(n.rest,r))return!0;return!1}return!1}var Yf=(e,t={})=>(r)=>{let n=zi({...r,processors:t});return Z(e,n),Li(n,e),Di(n,e)},Nr=(e,t,r={})=>(n)=>{let{libraryOptions:s,target:o}=n??{},i=zi({...s??{},target:o,io:t,processors:r});return Z(e,i),Li(i,e),Di(i,e)};var jt=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ut=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Jf=(e,t)=>{jt(e,"minimum",t),Ut(e,"maximum",t)},td=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},rd=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},nd=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},sd=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Qf=(e,t)=>jt(e,"minimum",t.minimum),Xf=(e,t)=>Ut(e,"maximum",t.maximum),ed=(e)=>(t,r)=>{sd(t,r.format);let[n,s]=e[r.format];jt(t,"minimum",n),Ut(t,"maximum",s)},C0={greater_than:(e,t)=>jt(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ut(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>td(e,t.value),number_format:ed(jn),bigint_format:ed(Qo),min_length:Qf,max_length:Xf,length_equals:(e,t)=>Jf(e,t.length),min_size:Qf,max_size:Xf,size_equals:(e,t)=>Jf(e,t.size),string_format:(e,t)=>{if(sd(e,t.format),t.pattern)rd(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>nd(e,t.mime)};function se(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let o of n)C0[o._zod.def.check]?.(t,o._zod.def);let s=e._zod.bag;if(s.minimum!==void 0)jt(t,"minimum",s.minimum);if(s.exclusiveMinimum!==void 0)jt(t,"exclusiveMinimum",s.exclusiveMinimum);if(s.maximum!==void 0)Ut(t,"maximum",s.maximum);if(s.exclusiveMaximum!==void 0)Ut(t,"exclusiveMaximum",s.exclusiveMaximum);if(s.multipleOf!==void 0)td(t,s.multipleOf);if(s.format!==void 0){if(t.format??(t.format=s.format),s.format.includes("int"))t.isInt=!0}if(s.mime)nd(t,s.mime);for(let o of s.patterns??[])rd(t,o);return t}var z0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},L0=new Map([[hi,bl],[es,_l]]),od=(e)=>L0.get(e)??e,id=(e,t,r,n)=>{let s=r;s.type="string";let{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=se(e);if(typeof o==="number")s.minLength=o;if(typeof i==="number")s.maxLength=i;if(a){if(s.format=z0[a]??a,s.format==="")delete s.format;if(a==="time"||l)delete s.format}if(u)s.contentEncoding=u;if(c&&c.size>0){let f=[...c].map(od);if(f.length===1)s.pattern=f[0].source;else if(f.length>1)s.allOf=[...f.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},ad=(e,t,r,n)=>{let s=r,{minimum:o,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=se(e);s.type=l?"integer":"number";let f=typeof u==="number"&&u>=(o??Number.NEGATIVE_INFINITY),p=typeof c==="number"&&c<=(i??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)s.minimum=u,s.exclusiveMinimum=!0;else s.exclusiveMinimum=u;else if(typeof o==="number")s.minimum=o;if(p)if(d)s.maximum=c,s.exclusiveMaximum=!0;else s.exclusiveMaximum=c;else if(typeof i==="number")s.maximum=i;if(a){let h=new Set;for(let _ of a)if(Number.isFinite(_)&&_!==0)h.add(Math.abs(_));else Ue(e,t,s,n,`A multipleOf divisor of ${_} cannot be represented in JSON Schema`);let[m,...g]=h;if(m!==void 0)s.multipleOf=m;if(g.length)s.allOf=[...s.allOf??[],...g.map((_)=>({multipleOf:_}))]}},cd=(e,t,r,n)=>{r.type="boolean"};var ud=(e,t,r,n)=>{r.not={}};var ld=(e,t,r,n)=>{};var pd=(e,t,r,n)=>{let s=e._zod.def,o=br(s.entries);if(o.length===0){r.not={};return}if(o.every((i)=>typeof i==="number"))r.type="number";if(o.every((i)=>typeof i==="string"))r.type="string";r.enum=o},fd=(e,t,r,n)=>{let s=e._zod.def;if(s.values.length===0){r.not={};return}let o=[];for(let i of s.values)if(i===void 0){if(Ue(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(Ue(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(i))}else o.push(i);if(o.length===0);else if(o.length===1){let i=o[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(o.every((i)=>typeof i==="number"))r.type="number";if(o.every((i)=>typeof i==="string"))r.type="string";if(o.every((i)=>typeof i==="boolean"))r.type="boolean";if(o.every((i)=>i===null))r.type="null";r.enum=o}};var dd=(e,t,r,n)=>{Ue(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var hd=(e,t,r,n)=>{Ue(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var md=(e,t,r,n)=>{let s=r,o=e._zod.def,{minimum:i,maximum:a}=se(e);if(typeof i==="number")s.minItems=i;if(typeof a==="number")s.maxItems=a;s.type="array",s.items=Z(o.element,t,{...n,path:[...n.path,"items"]})};function Rr(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Rr(t.out);if(t.type==="catch")return Rr(t.innerType);return e._zod.optin}var gd=(e,t,r,n)=>{let s=r,o=e._zod.def,i=o.shape;if(Object.getOwnPropertySymbols(i).length&&Ue(e,t,s,n,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(let u in i)le(s.properties,u,Z(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=o.shape[u];if(t.io==="input"?Rr(l)===void 0:l._zod.optout===void 0)c.push(u)}if(c.length>0)s.required=c;if(o.catchall?._zod.def.type==="never")s.additionalProperties=!1;else if(!o.catchall){if(t.io==="output")s.additionalProperties=!1}else if(o.catchall)s.additionalProperties=Z(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},yd=(e,t,r,n)=>{let s=e._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>Z(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));if(o)r.oneOf=i;else r.anyOf=i},wd=(e,t,r,n)=>{let s=e._zod.def,o=Z(s.left,t,{...n,path:[...n.path,"allOf",0]}),i=Z(s.right,t,{...n,path:[...n.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)},bd=(e,t,r,n)=>{let s=r,o=e._zod.def;s.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((m,g)=>Z(m,t,{...n,path:[...n.path,i,g]})),u=o.rest?Z(o.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;while(l>0){let m=o.items[l-1];if(!(t.io==="input"?Rr(m)!==void 0:m._zod.optout==="optional"))break;l--}let f=o.items.length,p=!o.rest;if(t.target==="draft-2020-12"){if(s.prefixItems=c,p)s.items=!1;else if(u)s.items=u;if(l>0)s.minItems=l;if(p)s.maxItems=f}else if(t.target==="openapi-3.0"){if(s.items={anyOf:c},u)s.items.anyOf.push(u);if(l>0)s.minItems=l;if(p)s.maxItems=f}else{if(s.items=c,p)s.additionalItems=!1;else if(u)s.additionalItems=u;if(l>0)s.minItems=l;if(p)s.maxItems=f}let{minimum:d,maximum:h}=se(e);if(typeof d==="number")s.minItems=d;if(typeof h==="number")s.maxItems=h};function ji(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let m=ji(e,h,r);return m===h?t:m}for(let h of["anyOf","oneOf"]){let m=t[h];if(!Array.isArray(m))continue;let g=m.map((_)=>ji(e,_,r));if(g.some((_,S)=>_!==m[S]))t={...t,[h]:g}}let n=Array.isArray(t.type)?t.type:[t.type],s=!n.includes("string")&&n.some((h)=>h==="number"||h==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!s&&!o?.some((h)=>typeof h==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,id:p,...d}=t;if(d.enum)d.enum=d.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof d.const==="number")d.const=String(d.const);if(!s)return d;if(d.type="string",!o)d.pattern=(n.includes("number")?Sr:ai).source;return d}var Ui=new WeakMap;function D0(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Ui.get(e)??[]){let s=e.seen.get(n),o=(s?.def??s?.schema)?.propertyNames;if(!o||o===!0||r.has(o))continue;let i=ji(t,o,new Set);if(i!==o)r.set(o,i)}if(!r.size)return;for(let n of e.seen.values())for(let s of[n.schema,n.def]){let o=s&&r.get(s.propertyNames);if(o)s.propertyNames=o}}var _d=(e,t,r,n)=>{let s=r,o=e._zod.def;s.type="object";let i=o.keyType,a=se(i).patterns;if(o.mode==="loose"&&a&&a.size>0){let l=Z(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});s.patternProperties={};for(let f of a)le(s.patternProperties,od(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){s.propertyNames=Z(o.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Ui.get(t);if(!l)l=[],Ui.set(t,l),t.deferred.push(()=>D0(t));l.push(e)}s.additionalProperties=Z(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&Rr(o.valueType)!==void 0;if(c&&!o.partial&&!u){let l=[...c].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)s.required=l.map(String)}},vd=(e,t,r,n)=>{let s=e._zod.def,o=Z(s.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=s.innerType,r.nullable=!0;else r.anyOf=[o,{type:"null"}]},kd=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType},Zi=Symbol();function xd(e,t,r,n,s){let o=!1,i=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return o=!0,null});if(!o)return JSON.parse(i);return Ue(t,r,n,s,"BigInt defaults cannot be represented in JSON Schema"),Zi}var Sd=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType;let i=xd(s.defaultValue,e,t,r,n);if(i!==Zi)r.default=i},Ad=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);if(o.ref=s.innerType,t.io!=="input")return;let i=xd(s.defaultValue,e,t,r,n);if(i!==Zi)r._prefault=i},$d=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{Ue(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Pd=(e,t,r,n)=>{let s=e._zod.def,o=s.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?o?s.out:s.in:s.out;Z(i,t,n);let a=t.seen.get(e);a.ref=i},Ed=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType,r.readOnly=!0};var Mi=(e,t,r,n)=>{let s=e._zod.def;Z(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType};var Td=new WeakSet([Object.prototype,Error.prototype]);function ls(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var F0=(e,t)=>{Gu.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Td.has(r))return;Td.add(r),ls(r,"format",(n)=>(s)=>Wu(n,s)),ls(r,"flatten",(n)=>(s)=>Hu(n,s)),ls(r,"addIssue",(n)=>(s)=>{n.issues.push(s),n.message=JSON.stringify(n.issues,_r,2)}),ls(r,"addIssues",(n)=>(s)=>{n.issues.push(...s),n.message=JSON.stringify(n.issues,_r,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var oe=w("ZodError",F0,void 0,{Parent:Error});var Od=Fn(oe),Id=Gn(oe),Nd=Hn(oe),Rd=Wn(oe),Cd=Yu(oe),zd=Ju(oe),Ld=Qu(oe),Dd=Xu(oe),jd=el(oe),Ud=tl(oe),Zd=rl(oe),Md=nl(oe);function H0(){if(!Y.localeError)ne(vi())}function Cr(){if(!Y.memoizer)ne({memoizer:af()})}var U=w("ZodType",(e,t)=>(H0(),L.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(re(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return xe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(FA(e,t))},superRefine(e,t){return this.check(GA(e,t))},overwrite(e){return this.check(tt(e))},optional(){return Bd(this)},exactOptional(){return NA(this)},nullable(){return Kd(this)},nullish(){return Bd(Kd(this))},nonoptional(e){return jA(this,e)},array(){return Pe(this)},or(e){return Jd([this,e])},and(e){return PA(this,e)},transform(e){return Fd(this,Xd(e))},default(e){return zA(this,e)},prefault(e){return DA(this,e)},catch(e){return ZA(this,e)},pipe(e){return Fd(this,e)},readonly(){return BA(this)},describe(e){let t=this.clone();return yt.add(t,{description:e}),t},meta(...e){if(e.length===0)return yt.get(this);let t=this.clone();return yt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Bn(this,"~standard",{...di(this),jsonSchema:{input:Nr(this,"input"),output:Nr(this,"output")}})},set "~standard"(e){je(this,"~standard",e)},parse:function e(t,r){return Od(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Id(this,t,r,{callee:e})},safeParse(e,t){return Nd(this,e,t)},async safeParseAsync(e,t){return Rd(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){je(this,"spa",e)},validate(e,t){return ni(this,e,t)},validateAsync(e,t){return si(this,e,t)},encode:function e(t,r){return Cd(this,t,r,{callee:e})},decode:function e(t,r){return zd(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Ld(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Dd(this,t,r,{callee:e})},safeEncode(e,t){return jd(this,e,t)},safeDecode(e,t){return Ud(this,e,t)},async safeEncodeAsync(e,t){return Zd(this,e,t)},async safeDecodeAsync(e,t){return Md(this,e,t)},toJSONSchema(e){return Yf(this,{})(e)},get description(){return yt.get(this)?.description},get _def(){return this._zod.def}}),Gd=w("_ZodString",(e,t)=>{Xn.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>id(e,r,n,s)},Zu({format:(e)=>se(e).format??null,minLength:(e)=>se(e).minimum??null,maxLength:(e)=>se(e).maximum??null},{regex(...e){return this.check(xi(...e))},includes(...e){return this.check($i(...e))},startsWith(...e){return this.check(Pi(...e))},endsWith(...e){return this.check(Ei(...e))},min(...e){return this.check(Dt(...e))},max(...e){return this.check(cs(...e))},length(...e){return this.check(us(...e))},nonempty(...e){return this.check(Dt(1,...e))},lowercase(e){return this.check(Si(e))},uppercase(e){return this.check(Ai(e))},trim(){return this.check(Oi())},normalize(...e){return this.check(Ti(...e))},toLowerCase(){return this.check(Ii())},toUpperCase(){return this.check(Ni())},slugify(){return this.check(Ri())}})),W0=w("ZodString",(e,t)=>{Xn.init(e,t),Gd.init(e,t)},{email(e){return this.check(ff(X0,e))},url(e){return this.check(ki(Hd,e))},jwt(e){return this.check(Nf(mA,e))},emoji(e){return this.check(wf(tA,e))},guid(e){return this.check(df(eA,e))},uuid(e){return this.check(hf(ps,e))},uuidv4(e){return this.check(mf(ps,e))},uuidv6(e){return this.check(gf(ps,e))},uuidv7(e){return this.check(yf(ps,e))},nanoid(e){return this.check(bf(rA,e))},cuid(e){return this.check(_f(nA,e))},cuid2(e){return this.check(vf(sA,e))},ulid(e){return this.check(kf(oA,e))},base64(e){return this.check(Tf(fA,e))},base64url(e){return this.check(Of(dA,e))},xid(e){return this.check(xf(iA,e))},ksuid(e){return this.check(Sf(aA,e))},ipv4(e){return this.check(Af(cA,e))},ipv6(e){return this.check($f(uA,e))},cidrv4(e){return this.check(Pf(lA,e))},cidrv6(e){return this.check(Ef(pA,e))},e164(e){return this.check(If(hA,e))},datetime(e){return this.check(Rf(V0,e))},date(e){return this.check(Cf(Y0,e))},time(e){return this.check(zf(J0,e))},duration(e){return this.check(Lf(Q0,e))}});function z(e){return pf(W0,e)}var M=w("ZodStringFormat",(e,t)=>{j.init(e,t),Gd.init(e,t)}),V0=w("ZodISODateTime",(e,t)=>{wp.init(e,t),M.init(e,t)}),Y0=w("ZodISODate",(e,t)=>{bp.init(e,t),M.init(e,t)}),J0=w("ZodISOTime",(e,t)=>{_p.init(e,t),M.init(e,t)}),Q0=w("ZodISODuration",(e,t)=>{vp.init(e,t),M.init(e,t)}),X0=w("ZodEmail",(e,t)=>{ap.init(e,t),M.init(e,t)});var eA=w("ZodGUID",(e,t)=>{op.init(e,t),M.init(e,t)});var ps=w("ZodUUID",(e,t)=>{ip.init(e,t),M.init(e,t)});var Hd=w("ZodURL",(e,t)=>{lp.init(e,t),M.init(e,t)});function Wd(e){return ki(Hd,e)}var tA=w("ZodEmoji",(e,t)=>{pp.init(e,t),M.init(e,t)});var rA=w("ZodNanoID",(e,t)=>{fp.init(e,t),M.init(e,t)});var nA=w("ZodCUID",(e,t)=>{dp.init(e,t),M.init(e,t)});var sA=w("ZodCUID2",(e,t)=>{hp.init(e,t),M.init(e,t)});var oA=w("ZodULID",(e,t)=>{mp.init(e,t),M.init(e,t)});var iA=w("ZodXID",(e,t)=>{gp.init(e,t),M.init(e,t)});var aA=w("ZodKSUID",(e,t)=>{yp.init(e,t),M.init(e,t)});var cA=w("ZodIPv4",(e,t)=>{kp.init(e,t),M.init(e,t)});var uA=w("ZodIPv6",(e,t)=>{Sp.init(e,t),M.init(e,t)});var lA=w("ZodCIDRv4",(e,t)=>{Ap.init(e,t),M.init(e,t)});var pA=w("ZodCIDRv6",(e,t)=>{$p.init(e,t),M.init(e,t)});var fA=w("ZodBase64",(e,t)=>{Ep.init(e,t),M.init(e,t)});var dA=w("ZodBase64URL",(e,t)=>{Tp.init(e,t),M.init(e,t)});var hA=w("ZodE164",(e,t)=>{Op.init(e,t),M.init(e,t)});var mA=w("ZodJWT",(e,t)=>{Ip.init(e,t),M.init(e,t)});var Vd=w("ZodNumber",(e,t)=>{mi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ad(e,r,n,s),e.isFinite=!0},Zu({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=se(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=se(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=se(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>se(e).format??null},{gt(e,t){return this.check(is(e,t))},gte(e,t){return this.check(Or(e,t))},min(e,t){return this.check(Or(e,t))},lt(e,t){return this.check(os(e,t))},lte(e,t){return this.check(Tr(e,t))},max(e,t){return this.check(Tr(e,t))},int(e){return this.check(qd(e))},safe(e){return this.check(qd(e))},positive(e){return this.check(is(0,e))},nonnegative(e){return this.check(Or(0,e))},negative(e){return this.check(os(0,e))},nonpositive(e){return this.check(Tr(0,e))},multipleOf(e,t){return this.check(as(e,t))},step(e,t){return this.check(as(e,t))},finite(){return this}}));function gA(e){return Df(Vd,e)}var yA=w("ZodNumberFormat",(e,t)=>{Np.init(e,t),Vd.init(e,t)});function qd(e){return jf(yA,e)}var wA=w("ZodBoolean",(e,t)=>{Rp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>cd(e,r,n,s)});function fs(e){return Uf(wA,e)}var bA=w("ZodUnknown",(e,t)=>{Cp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ld(e,r,n,s)});function Bi(){return Zf(bA)}var _A=w("ZodNever",(e,t)=>{zp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ud(e,r,n,s)});function vA(e){return Mf(_A,e)}var kA=w("ZodArray",(e,t)=>{Cr(),Lp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>md(e,r,n,s),e.element=t.element},{min(e,t){return this.check(Dt(e,t))},nonempty(e){return this.check(Dt(1,e))},max(e,t){return this.check(cs(e,t))},length(e,t){return this.check(us(e,t))},unwrap(){return this.element}});function Pe(e,t){return qf(kA,e,t)}var xA=w("ZodObject",(e,t)=>{Cr(),Up.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>gd(e,r,n,s),XS(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Zt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(re(this._zod.def,{catchall:e}))},passthrough(){return this.clone(re(this._zod.def,{catchall:Bi()}))},loose(){return this.clone(re(this._zod.def,{catchall:Bi()}))},strict(){return this.clone(re(this._zod.def,{catchall:vA()}))},strip(){return this.clone(re(this._zod.def,{catchall:void 0}))},extend(e){return FS(this,e)},safeExtend(e){return GS(this,e)},merge(e){return HS(this,e)},pick(e){return BS(this,e)},omit(e){return KS(this,e)},partial(...e){return Lu(Wi,this,e[0])},exactPartial(...e){return Lu(eh,this,e[0],"exactPartial")},required(...e){return WS(th,this,e[0])}});function ie(e,t){let r={type:"object",shape:e??{},...E(t)};return new xA(r)}var Yd=w("ZodUnion",(e,t)=>{gi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>yd(e,r,n,s),e.options=t.options});function Jd(e,t){return new Yd({type:"union",options:e,...E(t)})}var SA=w("ZodDiscriminatedUnion",(e,t)=>{Yd.init(e,t),Zp.init(e,t)});function AA(e,t,r){return new SA({type:"union",options:t,discriminator:e,...E(r)})}var $A=w("ZodIntersection",(e,t)=>{Mp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>wd(e,r,n,s)});function PA(e,t){return new $A({type:"intersection",left:e,right:t})}var EA=w("ZodTuple",(e,t)=>{Cr(),qp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>bd(e,r,n,s)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new Wi({type:"optional",innerType:t}))})}});function Gi(e,t,r){let n=t instanceof L,s=n?r:t;return new EA({type:"tuple",items:e,rest:n?t:null,...E(s)})}var Ki=w("ZodRecord",(e,t)=>{Cr(),Bp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>_d(e,r,n,s),e.keyType=t.keyType,e.valueType=t.valueType});function Hi(e,t,r){if(!t||!t._zod)return new Ki({type:"record",keyType:z(),valueType:e,...E(t)});return new Ki({type:"record",keyType:e,valueType:t,...E(r)})}function TA(e,t,r){return new Ki({type:"record",keyType:e,valueType:t,...E(r),partial:!0})}var Fi=w("ZodEnum",(e,t)=>{Kp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,s,o)=>pd(e,n,s,o),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{let o={};for(let i of n)if(r.has(i))o[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Fi({...t,checks:[],...E(s),entries:o})},e.exclude=(n,s)=>{let o={...t.entries};for(let i of n)if(r.has(i))delete o[i];else throw Error(`Key ${i} not found in enum`);return new Fi({...t,checks:[],...E(s),entries:o})}});function Zt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Fi({type:"enum",entries:r,...E(t)})}var OA=w("ZodLiteral",(e,t)=>{Fp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>fd(e,r,n,s),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 Qd(e,t){return new OA({type:"literal",values:Array.isArray(e)?e:[e],...E(t)})}var IA=w("ZodTransform",(e,t)=>{Cr(),Gp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>hd(e,r,n,s),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xr(e.constructor.name);r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(gt(o,r.value,t));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(gt(i))}};let s=t.transform(r.value,r);if(s instanceof Promise)return s.then((o)=>(r.value=o,r));return r.value=s,r}});function Xd(e){return new IA({type:"transform",transform:e})}var Wi=w("ZodOptional",(e,t)=>{yi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Mi(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Bd(e){return new Wi({type:"optional",innerType:e})}var eh=w("ZodExactOptional",(e,t)=>{Hp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Mi(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function NA(e){return new eh({type:"optional",innerType:e})}var RA=w("ZodNullable",(e,t)=>{Wp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>vd(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function Kd(e){return new RA({type:"nullable",innerType:e})}var CA=w("ZodDefault",(e,t)=>{Vp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Sd(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zA(e,t){return new CA({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Yo(t)}})}var LA=w("ZodPrefault",(e,t)=>{Yp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ad(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function DA(e,t){return new LA({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Yo(t)}})}var th=w("ZodNonOptional",(e,t)=>{Jp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>kd(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function jA(e,t){return new th({type:"nonoptional",innerType:e,...E(t)})}var UA=w("ZodCatch",(e,t)=>{Qp.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>$d(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ZA(e,t){return new UA({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Mu(t)})}var rh=w("ZodPipe",(e,t)=>{wi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Pd(e,r,n,s),e.in=t.in,e.out=t.out});function Fd(e,t){return new rh({type:"pipe",in:e,out:t})}var MA=w("ZodPreprocess",(e,t)=>{rh.init(e,t),Xp.init(e,t)}),qA=w("ZodReadonly",(e,t)=>{ef.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ed(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});function BA(e){return new qA({type:"readonly",innerType:e})}var KA=w("ZodCustom",(e,t)=>{tf.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,n,s)=>dd(e,r,n,s)});function FA(e,t={}){return Bf(KA,e,t)}function GA(e,t){return Kf(e,t)}function HA(e,t){return new MA({type:"pipe",in:Xd(e),out:t})}var VA=["iOS","iPhone","macOS"];function Ze(e,t){let r=[];if(e==="")return["it is empty"];if(/^\s/.test(e)||/\s$/.test(e))r.push("it has leading or trailing spaces");if(/command ?line/i.test(e))r.push('it should say "command-line"');if(/^(?:the|an?)(?=\s)/i.test(e))r.push("it starts with an article");if(/^[a-z]/.test(e)&&!VA.includes(e.split(/\s+/)[0]))r.push("it starts with a lowercase letter");if(new RegExp(`^${t.replaceAll("-","").split("").join("[\\s\\-]?")}\\b`,"i").test(e))r.push("it starts with the package name");let n=/\b(macOS|Mac(?: ?OS(?: ?X)?)?|OS ?X)(?! virtual machines?)\b/i.exec(e);if(n&&n[1]!=="MAC")r.push("it names the platform");if(/\.$/.test(e)&&!e.endsWith("etc."))r.push("it ends with a full stop");if(/\p{So}/u.test(e))r.push("it contains a symbol or emoji");if([...e].length>80)r.push("it is longer than 80 characters");return r}var oh=["darwin-universal","darwin-arm64","darwin-amd64","linux-arm64","linux-amd64","windows-amd64","windows-arm64"];var hs=/^[a-z0-9][a-z0-9-]*$/,YA=["com.apple.security.cs.allow-jit","com.apple.security.cs.allow-unsigned-executable-memory","com.apple.security.cs.disable-executable-page-protection","com.apple.security.cs.allow-dyld-environment-variables","com.apple.security.cs.disable-library-validation"],wt=z().regex(/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/).refine((e)=>!e.split("/").includes(".."),"must stay inside the archive"),nh=z().regex(/^[A-Za-z0-9.-]+$/),ih={uninstall:ie({launchctl:Pe(nh).optional(),quit:Pe(nh).optional()}).strict().optional(),zap:ie({trash:Pe(z().regex(/^~\/[A-Za-z0-9 ._\/-]+$/))}).strict().optional(),caveats:z().min(1).max(2000).optional()},ah={name:z().regex(hs),repo:z().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/),workflow:z().regex(/^[A-Za-z0-9._-]+\.ya?ml$/).default("release.yml"),assets:TA(Zt(oh),z().regex(/^[A-Za-z0-9._{}-]+$/)),description:z().min(1).max(200).optional(),homepage:Wd().optional(),license:z().regex(/^[A-Za-z0-9.+-]+$/).optional(),attestation:Zt(["auto","off"]).default("auto"),protection:Zt(["on","off","dependabot"]).default("on")},JA=ie({...ah,kind:Zt(["go","bun"]),binaries:Pe(wt).min(1),completions:ie({bash:wt.optional(),zsh:wt.optional(),fish:wt.optional()}).strict().optional(),scoop:fs().default(!1),entitlements:Pe(Zt(YA)).default([]),cask:ie(ih).strict().default({}),linux:fs().default(!1)}).strict(),ds=/^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$/,Me=gA().int().min(0).max(5000),QA=Jd([fs(),z().regex(/^[A-Za-z0-9._*{}-]+$/),Pe(z().regex(/^[A-Za-z0-9._*{}-]+$/))]),XA=ie({...ah,kind:Qd("app"),app:z().regex(/^[A-Za-z0-9 ._-]+\.app$/),bundle_id:z().regex(ds),carry:Hi(z().regex(/^[A-Za-z0-9._-]+$/),z().regex(/^sha256:[0-9a-f]{64}$/)).default({}),dmg:ie({name:z().regex(/^[A-Za-z0-9._{}-]+\.dmg$/),volume:z().regex(/^[A-Za-z0-9 ._-]{1,27}$/).optional(),volume_icon:wt.optional(),layout:ie({window:Gi([Me,Me,Me,Me]),icon_size:Me,app:Gi([Me,Me]),applications:Gi([Me,Me])}).strict().optional()}).strict(),sparkle:ie({key:z().regex(/^[a-z0-9]+$/),feed:z().regex(/^[A-Za-z0-9._-]+\.xml$/).default("appcast.xml"),public_key:z().regex(/^[A-Za-z0-9+/]{43}=$/),next_key:z().regex(/^[a-z0-9]+$/).optional(),next_public_key:z().regex(/^[A-Za-z0-9+/]{43}=$/).optional()}).strict().optional(),code:Hi(wt,ie({identifier:z().regex(ds).optional(),entitlements:Hi(z().regex(/^[A-Za-z0-9.-]+$/),QA).optional()}).strict()).default({}),cask:ie({...ih,binaries:Pe(wt).optional(),auto_updates:fs().optional()}).strict().default({})}).strict(),ch=HA((e)=>e&&typeof e==="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"go"}:e,AA("kind",[JA,XA])),e$=ie({version:Qd(1),tap:z().regex(/^[A-Za-z0-9-]+\/[a-z0-9-]+$/),linux:ie({maintainer:z().regex(/^[A-Za-z0-9 .'-]+ <[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}>$/),url:Wd({protocol:/^https$/}).regex(/^https:\/\/[A-Za-z0-9.-]+(\/[A-Za-z0-9._-]+)*$/).optional()}).strict().optional(),packages:Pe(ch)}).strict(),fe=(e)=>e.kind==="app",uh=(e)=>fe(e)||Object.keys(e.assets).some((t)=>t.startsWith("darwin")),sh=(e)=>e.map((t)=>`${t.path.join(".")||"(root)"}: ${t.message}`).join("; ");function t$(e,t,r){if(fe(e))n$(e);if(e.repo.split("/")[0].toLowerCase()!==r.toLowerCase())throw new y(`${e.name}: ${e.repo} is not owned by ${r}`,"tapster publishes only repositories of the hub's owner.");let n=e.description===void 0?[]:Ze(e.description,e.name);if(n.length)throw new y(`${e.name}: Homebrew rejects the description because ${n.join(" and ")}`,"Rewrite description in tapster.yml.");let s=Object.entries(e.assets);if(s.length===0)throw new y(`${e.name}: assets is empty`,"Map at least one platform to an asset name.");for(let[o,i]of s){if(i.replaceAll("{version}","").includes("{")||i.replaceAll("{version}","").includes("}"))throw new y(`${e.name}: ${i} uses a placeholder other than {version}`,"Only {version} is replaced in asset names.");if(o.startsWith("darwin")&&!i.endsWith(".tar.gz"))throw new y(`${e.name}: the ${o} asset must be a .tar.gz`,"Pack macOS builds as tar.gz; tapster reads them itself.")}if(fe(e)||!e.linux)return;if(!Object.keys(e.assets).some((o)=>o.startsWith("linux-")))throw new y(`${e.name}: linux needs a Linux asset`,"Map linux-amd64 or linux-arm64, or remove linux: true.");if(!t.linux)throw new y(`${e.name} ships Linux packages, but tapster.yml names no linux.maintainer`,'Add linux: { maintainer: "Name <address>" } at the top of tapster.yml.')}function r$(e){let t=new Map,r=(i,a)=>t.has(i)||t.set(i,a);for(let[i,a]of e)if(e.filter(([u,l])=>u!==i&&l.name===a.name).length)r(i,new y(`package ${a.name} is listed twice`,"Keep one entry per package."));let n=e.flatMap(([i,a])=>(fe(a)?a.cask.binaries??[]:a.binaries).map((c)=>({i,p:a,id:c.split("/").pop()})));for(let i of n)for(let a of n){if(i.i===a.i||i.id!==a.id||i.p.name===a.p.name)continue;r(i.i,new y(`${i.p.name} and ${a.p.name} both ship a binary named ${i.id}`,"Signed tools are identified by name, so each name may belong to one package."))}let s=(i,a)=>{let c=i.toLowerCase(),u=a.toLowerCase();return c===u||c.startsWith(`${u}.`)||u.startsWith(`${c}.`)},o=e.filter((i)=>fe(i[1]));for(let[i,a]of o){for(let[c,u]of o)if(i!==c&&s(a.bundle_id,u.bundle_id))r(i,new y(`${a.name} and ${u.name} have overlapping bundle ids`,"Each app needs its own bundle id, not one inside another."));for(let c of n){let u=c.id.toLowerCase();if(u!==a.bundle_id.toLowerCase()&&!u.startsWith(`${a.bundle_id.toLowerCase()}.`))continue;let l=new y(`the binary ${c.id} would carry ${a.name}'s identity`,"Rename the binary.");r(i,l),r(c.i,l)}}return t}function bt(e,t){let r;try{r=X(e)}catch{throw new y("tapster.yml is not valid YAML","Fix the YAML syntax; tapster doctor shows the line.")}let n=e$.extend({packages:Pe(Bi())}).safeParse(r);if(!n.success)throw new y(`tapster.yml is invalid: ${sh(n.error.issues)}`,"Fix the listed fields.");let{packages:s,...o}=n.data,i=new Map,a=(l)=>{let f=l&&typeof l==="object"&&"repo"in l?l.repo:void 0;return typeof f==="string"?f:null},c=(l,f)=>{let p=l&&typeof l==="object"&&"name"in l?l.name:void 0;return typeof p==="string"&&hs.test(p)?p:`packages[${f}]`},u=[];for(let[l,f]of s.entries()){let p=ch.safeParse(f);if(!p.success){i.set(l,{name:c(f,l),repo:a(f),reason:`${c(f,l)} is invalid: ${sh(p.error.issues)}`,fix:"Fix the listed fields in tapster.yml."});continue}let d=p.data;try{t$(d,o,t),u.push([l,d])}catch(h){if(!(h instanceof y))throw h;i.set(l,{name:d.name,repo:d.repo,reason:h.reason,fix:h.fix})}}for(let[l,f]of r$(u)){let p=u.find(([d])=>d===l)[1];i.set(l,{name:p.name,repo:p.repo,reason:f.reason,fix:f.fix})}return{config:{...o,packages:u.filter(([l])=>!i.has(l)).map(([,l])=>l)},invalid:[...i.entries()].sort(([l],[f])=>l-f).map(([,l])=>l)}}function n$(e){if(Object.keys(e.assets).filter((r)=>r.startsWith("darwin")).length!==1||Object.keys(e.assets).length!==1)throw new y(`${e.name}: an app needs exactly one darwin asset and nothing else`,"Map one of darwin-arm64, darwin-amd64 or darwin-universal to the app archive.");if(e.dmg.volume??=e.app.replace(/\.app$/,"").slice(0,27),e.sparkle&&e.sparkle.next_key===void 0!==(e.sparkle.next_public_key===void 0))throw new y(`${e.name}: a rotation needs both sparkle.next_key and next_public_key`,"Set both, or neither.");for(let[r,n]of Object.entries(e.code))if(n.identifier&&!n.identifier.startsWith(`${e.bundle_id}.`))throw new y(`${e.name}: the identifier for ${r} is outside ${e.bundle_id}`,`Use an identifier that starts with ${e.bundle_id}.`)}function lh(e,t){let[r,n]=t.split("/");return e.linux?.url??`https://${r.toLowerCase()}.github.io/${n}`}import{spawn as z$}from"child_process";import{existsSync as L$}from"fs";import*as fh from"os";function zr(e){if(e===null||e===void 0)return"";else if(typeof e==="string"||e instanceof String)return e;return JSON.stringify(e)}function dh(e,t,r){let n=new hh(e,t,r);process.stdout.write(n.toString()+fh.EOL)}var ph="::";class hh{constructor(e,t,r){if(!e)e="missing.command";this.command=e,this.properties=t,this.message=r}toString(){let e=ph+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=!0;for(let r in this.properties)if(this.properties.hasOwnProperty(r)){let n=this.properties[r];if(n){if(t)t=!1;else e+=",";e+=`${r}=${o$(n)}`}}}return e+=`${ph}${s$(this.message)}`,e}}function s$(e){return zr(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function o$(e){return zr(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}var nN=he("net"),sN=he("tls"),a$=he("http"),oN=he("https"),c$=he("events"),iN=he("assert"),u$=he("util");function ms(e){var t=this;t.options=e||{},t.proxyOptions=t.options.proxy||{},t.maxSockets=t.options.maxSockets||a$.Agent.defaultMaxSockets,t.requests=[],t.sockets=[],t.on("free",function(n,s,o,i){var a=mh(s,o,i);for(var c=0,u=t.requests.length;c<u;++c){var l=t.requests[c];if(l.host===a.host&&l.port===a.port){t.requests.splice(c,1),l.request.onSocket(n);return}}n.destroy(),t.removeSocket(n)})}u$.inherits(ms,c$.EventEmitter);ms.prototype.addRequest=function(t,r,n,s){var o=this,i=gh({request:t},o.options,mh(r,n,s));if(o.sockets.length>=this.maxSockets){o.requests.push(i);return}o.createSocket(i,function(a){a.on("free",c),a.on("close",u),a.on("agentRemove",u),t.onSocket(a);function c(){o.emit("free",a,i)}function u(l){o.removeSocket(a),a.removeListener("free",c),a.removeListener("close",u),a.removeListener("agentRemove",u)}})};ms.prototype.createSocket=function(t,r){var n=this,s={};n.sockets.push(s);var o=gh({},n.proxyOptions,{method:"CONNECT",path:t.host+":"+t.port,agent:!1,headers:{host:t.host+":"+t.port}});if(t.localAddress)o.localAddress=t.localAddress;if(o.proxyAuth)o.headers=o.headers||{},o.headers["Proxy-Authorization"]="Basic "+new Buffer(o.proxyAuth).toString("base64");_t("making CONNECT request");var i=n.request(o);i.useChunkedEncodingByDefault=!1,i.once("response",a),i.once("upgrade",c),i.once("connect",u),i.once("error",l),i.end();function a(f){f.upgrade=!0}function c(f,p,d){process.nextTick(function(){u(f,p,d)})}function u(f,p,d){if(i.removeAllListeners(),p.removeAllListeners(),f.statusCode!==200){_t("tunneling socket could not be established, statusCode=%d",f.statusCode),p.destroy();var h=Error("tunneling socket could not be established, statusCode="+f.statusCode);h.code="ECONNRESET",t.request.emit("error",h),n.removeSocket(s);return}if(d.length>0){_t("got illegal response body from proxy"),p.destroy();var h=Error("got illegal response body from proxy");h.code="ECONNRESET",t.request.emit("error",h),n.removeSocket(s);return}return _t("tunneling connection has established"),n.sockets[n.sockets.indexOf(s)]=p,r(p)}function l(f){i.removeAllListeners(),_t(`tunneling socket could not be established, cause=%s
196
- `,f.message,f.stack);var p=Error("tunneling socket could not be established, cause="+f.message);p.code="ECONNRESET",t.request.emit("error",p),n.removeSocket(s)}};ms.prototype.removeSocket=function(t){var r=this.sockets.indexOf(t);if(r===-1)return;this.sockets.splice(r,1);var n=this.requests.shift();if(n)this.createSocket(n,function(s){n.request.onSocket(s)})};function mh(e,t,r){if(typeof e==="string")return{host:e,port:t,localAddress:r};return e}function gh(e){for(var t=1,r=arguments.length;t<r;++t){var n=arguments[t];if(typeof n==="object"){var s=Object.keys(n);for(var o=0,i=s.length;o<i;++o){var a=s[o];if(n[a]!==void 0)e[a]=n[a]}}}return e}var _t;if(process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG))_t=function(){var e=Array.prototype.slice.call(arguments);if(typeof e[0]==="string")e[0]="TUNNEL: "+e[0];else e.unshift("TUNNEL:");console.error.apply(console,e)};else _t=function(){};var Ee;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(Ee||(Ee={}));var yh;(function(e){e.Accept="accept",e.ContentType="content-type"})(yh||(yh={}));var wh;(function(e){e.ApplicationJson="application/json"})(wh||(wh={}));var fN=[Ee.MovedPermanently,Ee.ResourceMoved,Ee.SeeOther,Ee.TemporaryRedirect,Ee.PermanentRedirect],dN=[Ee.BadGateway,Ee.ServiceUnavailable,Ee.GatewayTimeout];import{EOL as p$}from"os";import{constants as bh,promises as f$}from"fs";var Yi=function(e,t,r,n){function s(o){return o instanceof r?o:new r(function(i){i(o)})}return new(r||(r=Promise))(function(o,i){function a(l){try{u(n.next(l))}catch(f){i(f)}}function c(l){try{u(n.throw(l))}catch(f){i(f)}}function u(l){l.done?o(l.value):s(l.value).then(a,c)}u((n=n.apply(e,t||[])).next())})},{access:d$,appendFile:h$,writeFile:m$}=f$,_h="GITHUB_STEP_SUMMARY";class vh{constructor(){this._buffer=""}filePath(){return Yi(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let e=process.env[_h];if(!e)throw Error(`Unable to find environment variable for $${_h}. Check if your runtime environment supports job summaries.`);try{yield d$(e,bh.R_OK|bh.W_OK)}catch(t){throw Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}return this._filePath=e,this._filePath})}wrap(e,t,r={}){let n=Object.entries(r).map(([s,o])=>` ${s}="${o}"`).join("");if(!t)return`<${e}${n}>`;return`<${e}${n}>${t}</${e}>`}write(e){return Yi(this,void 0,void 0,function*(){let t=!!(e===null||e===void 0?void 0:e.overwrite),r=yield this.filePath();return yield(t?m$:h$)(r,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Yi(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(e,t=!1){return this._buffer+=e,t?this.addEOL():this}addEOL(){return this.addRaw(p$)}addCodeBlock(e,t){let r=Object.assign({},t&&{lang:t}),n=this.wrap("pre",this.wrap("code",e),r);return this.addRaw(n).addEOL()}addList(e,t=!1){let r=t?"ol":"ul",n=e.map((o)=>this.wrap("li",o)).join(""),s=this.wrap(r,n);return this.addRaw(s).addEOL()}addTable(e){let t=e.map((n)=>{let s=n.map((o)=>{if(typeof o==="string")return this.wrap("td",o);let{header:i,data:a,colspan:c,rowspan:u}=o,l=i?"th":"td",f=Object.assign(Object.assign({},c&&{colspan:c}),u&&{rowspan:u});return this.wrap(l,a,f)}).join("");return this.wrap("tr",s)}).join(""),r=this.wrap("table",t);return this.addRaw(r).addEOL()}addDetails(e,t){let r=this.wrap("details",this.wrap("summary",e)+t);return this.addRaw(r).addEOL()}addImage(e,t,r){let{width:n,height:s}=r||{},o=Object.assign(Object.assign({},n&&{width:n}),s&&{height:s}),i=this.wrap("img",null,Object.assign({src:e,alt:t},o));return this.addRaw(i).addEOL()}addHeading(e,t){let r=`h${t}`,n=["h1","h2","h3","h4","h5","h6"].includes(r)?r:"h1",s=this.wrap(n,e);return this.addRaw(s).addEOL()}addSeparator(){let e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){let e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,t){let r=Object.assign({},t&&{cite:t}),n=this.wrap("blockquote",e,r);return this.addRaw(n).addEOL()}addLink(e,t){let r=this.wrap("a",e,{href:t});return this.addRaw(r).addEOL()}}var AN=new vh;import xh from"os";import*as gs from"fs";var{chmod:g$,copyFile:y$,lstat:w$,mkdir:b$,open:EN,readdir:_$,rename:v$,rm:k$,rmdir:TN,stat:x$,symlink:S$,unlink:A$}=gs.promises,$$=process.platform==="win32";var ON=gs.constants.O_RDONLY;var zN=process.platform==="win32";var ZN=xh.platform(),MN=xh.arch();var Sh;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(Sh||(Sh={}));function Vi(e){dh("add-mask",{},e)}var Ah=4,Ji=new Set;function C$(e){if(e.length<Ah)return[];let t=new Set,r=(s)=>{if(s.length>=Ah)t.add(s)};r(e);let n=Buffer.from(e,"utf8");r(n.toString("base64")),r(n.toString("hex")),r(n.toString("hex").toUpperCase()),r(encodeURIComponent(e));for(let s of e.split(/\r?\n/))r(s.trim());return[...t]}function Mt(e){for(let t of C$(e)){if(Ji.has(t))continue;if(Ji.add(t),process.env.GITHUB_ACTIONS==="true")Vi(t)}}function ys(e){let t=e;for(let r of[...Ji].sort((n,s)=>s.length-n.length))t=t.split(r).join("***");return t}var ws={codesign:"/usr/bin/codesign",security:"/usr/bin/security",xcrun:"/usr/bin/xcrun",openssl:"/usr/bin/openssl",ditto:"/usr/bin/ditto",git:"/usr/bin/git",hdiutil:"/usr/bin/hdiutil",xattr:"/usr/bin/xattr",plutil:"/usr/bin/plutil",spctl:"/usr/sbin/spctl",gpg:"/usr/bin/gpg",gpgconf:"/usr/bin/gpgconf",rpm:"/usr/bin/rpm",rpmsign:"/usr/bin/rpmsign",rpm2archive:"/usr/bin/rpm2archive","dpkg-deb":"/usr/bin/dpkg-deb",createrepo_c:"/usr/bin/createrepo_c","apt-ftparchive":"/usr/bin/apt-ftparchive"},D$=["/opt/homebrew/bin/gh","/usr/local/bin/gh","/usr/bin/gh"];function j$(e={}){return{PATH:"/usr/bin:/bin",HOME:process.env.HOME??"/tmp",TMPDIR:process.env.RUNNER_TEMP??process.env.TMPDIR??"/tmp",...e}}function U$(e,t=5){return ys(e).split(/\r?\n/).filter((r)=>r.trim()!==""&&!/keychain/i.test(r)).slice(-t).join(" | ")}function $h(e=D$){let t=e.find((r)=>L$(r));if(!t)throw new y("gh is not installed on this runner","Use a GitHub-hosted runner image, which ships gh.");return t}function Te(e,t,r={}){return C(ws[e],e,t,r)}function C(e,t,r,n={}){return new Promise((s,o)=>{let i=z$(e,r,{env:j$(n.env),cwd:n.cwd,shell:!1,stdio:["pipe","pipe","pipe"]}),a=[],c=[],u=0,l=null,f=(h)=>{l??=h,i.kill("SIGKILL")},p=n.timeoutMs?setTimeout(()=>f(new y(`${t} did not finish in time`,"Re-run the workflow; if it happens again, check the input it read.")),n.timeoutMs):null,d=(h)=>(m)=>{if(u+=m.length,n.maxOutput&&u>n.maxOutput)f(new y(`${t} wrote more output than tapster reads`,"Check the input it read."));else h.push(m)};i.stdout.on("data",d(a)),i.stderr.on("data",d(c)),i.on("error",()=>o(new y(`${t} could not start`,`Check that ${e} exists on this runner.`))),i.on("close",(h)=>{if(p)clearTimeout(p);if(l){o(l);return}let m=Buffer.concat(a),g={code:h??-1,stdout:m.toString("utf8"),stderr:Buffer.concat(c).toString("utf8"),bytes:m};if(g.code!==0&&!n.allowFail){o(new y(`${t} exited with ${g.code}`,U$(g.stderr)||"No error output."));return}s(g)}),i.stdin.end(n.stdin??"")})}var Z$=1048576,Ph=32,M$=1e5,O=(e)=>new y(`an Info.plist ${e}`,"Rebuild the app; tapster reads XML and binary property lists.");function Eh(e){if(e.length>Z$)throw O("is larger than 1 MiB");if(e.subarray(0,8).toString("latin1")==="bplist00")return G$(e);if(e[0]===254||e[0]===255||e[0]===0)throw O("is not UTF-8");let t=e.toString("utf8").replace(/^\ufeff/,""),r=/^\s*<\?xml[^>]*\bencoding\s*=\s*["']([^"']*)["']/.exec(t)?.[1];if(r!==void 0&&!/^utf-?8$/i.test(r))throw O(`declares the encoding ${r}, not UTF-8`);return F$(t)}var q$={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};function B$(e){return e.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-z]+);/g,(t,r)=>{if(r.startsWith("#x"))return String.fromCodePoint(Number.parseInt(r.slice(2),16));if(r.startsWith("#"))return String.fromCodePoint(Number.parseInt(r.slice(1),10));let n=q$[r];if(n===void 0)throw O(`uses an unknown entity ${t}`);return n})}function K$(e){let t=[],r=0;while(r<e.length)if(e.startsWith("<!--",r)){let n=e.indexOf("-->",r+4);if(n===-1)throw O("has an unclosed comment");r=n+3}else if(e.startsWith("<![CDATA[",r)){let n=e.indexOf("]]>",r+9);if(n===-1)throw O("has an unclosed CDATA section");t.push({kind:"text",text:e.slice(r+9,n)}),r=n+3}else if(e.startsWith("<?",r)||e.startsWith("<!",r)){let n=e.indexOf(">",r);if(n===-1)throw O("is not valid XML");r=n+1}else if(e[r]==="<"){let n=e.indexOf(">",r);if(n===-1)throw O("is not valid XML");let s=e.slice(r+1,n).trim(),o=/^(\/)?([A-Za-z]+)(?:\s[^/]*)?(\/)?$/.exec(s);if(!o)throw O("has a tag tapster does not read");t.push({kind:o[1]?"close":o[3]?"empty":"open",name:o[2]}),r=n+1}else{let n=e.indexOf("<",r),s=e.slice(r,n===-1?e.length:n);t.push({kind:"text",text:B$(s)}),r=n===-1?e.length:n}return t}function F$(e){let t=K$(e).filter((l)=>!(l.kind==="text"&&l.text.trim()==="")),r=0,n=()=>t[r++],s=()=>t[r],o=(l)=>{let f="";for(;;){let p=n();if(!p)throw O(`has an unclosed <${l}>`);if(p.kind==="text")f+=p.text;else if(p.kind==="close"&&p.name===l)return f;else throw O(`has markup inside <${l}>`)}},i=(l)=>{if(l>Ph)throw O("is nested too deeply");let f=n();if(!f||f.kind==="text"||f.kind==="close")throw O("is missing a value");if(f.kind==="empty"){if(f.name==="true")return!0;if(f.name==="false")return!1;if(f.name==="string")return"";if(f.name==="dict")return{};if(f.name==="array")return[];if(f.name==="data")return Buffer.alloc(0);throw O(`has an unknown <${f.name}/>`)}switch(f.name){case"string":return o("string");case"integer":{let p=o("integer").trim();if(!/^[+-]?\d{1,15}$/.test(p))throw O("has an integer tapster does not read");return Number(p)}case"real":{let p=Number(o("real").trim());if(!Number.isFinite(p))throw O("has an invalid real");return p}case"date":{let p=new Date(o("date").trim());if(Number.isNaN(p.getTime()))throw O("has an invalid date");return p}case"data":return Buffer.from(o("data").replace(/\s+/g,""),"base64");case"array":{let p=[];for(;;){let d=s();if(d?.kind==="close"&&d.name==="array")return r++,p;p.push(i(l+1))}}case"dict":{let p={};for(;;){let d=n();if(d?.kind==="close"&&d.name==="dict")return p;if(d?.kind!=="open"||d.name!=="key")throw O("has a dict entry without a key");let h=o("key");if(Object.hasOwn(p,h))throw O(`lists the key ${h} twice`);Object.defineProperty(p,h,{value:i(l+1),enumerable:!0,writable:!0,configurable:!0})}}default:throw O(`has an unknown <${f.name}>`)}},a=n();if(!a||a.kind!=="open"||a.name!=="plist")throw O("does not start with <plist>");let c=i(1),u=n();if(!u||u.kind!=="close"||u.name!=="plist"||r!==t.length)throw O("has content after its value");return c}function G$(e){if(e.length<40)throw O("is truncated");let t=e.subarray(e.length-32),r=t[6],n=t[7],s=Number(t.readBigUInt64BE(8)),o=Number(t.readBigUInt64BE(16)),i=Number(t.readBigUInt64BE(24));if(![1,2,4,8].includes(r)||![1,2,4,8].includes(n))throw O("has a damaged trailer");if(s<1||o>=s||i<8||i+s*r>e.length-32)throw O("has a damaged offset table");let a=(p,d)=>{if(p+d>e.length-32)throw O("is truncated");let h=d===8?e.readBigUInt64BE(p):BigInt(e.readUIntBE(p,d));if(h>BigInt(Number.MAX_SAFE_INTEGER))throw O("has a number tapster does not read");return Number(h)},c=(p)=>{if(p>=s)throw O("has a reference outside its objects");let d=a(i+p*r,r);if(d<8||d>=i)throw O("has an object outside its body");return d},u=new Set,l=0,f=(p,d)=>{if(d>Ph)throw O("is nested too deeply");if(++l>M$)throw O("has too many objects");if(u.has(p))throw O("refers to itself");u.add(p);try{let h=c(p),m=e[h],g=m>>4,_=m&15,S=()=>{if(_!==15)return[_,h+1];let x=e[h+1];if(x>>4!==1)throw O("has a damaged length");let b=1<<(x&15);return[a(h+2,b),h+2+b]};switch(g){case 0:if(m===8)return!1;if(m===9)return!0;throw O("has an object tapster does not read");case 1:{let x=1<<_;if(x===8){if(h+9>e.length-32)throw O("is truncated");let b=e.readBigInt64BE(h+1);if(b>BigInt(Number.MAX_SAFE_INTEGER)||b<BigInt(Number.MIN_SAFE_INTEGER))throw O("has a number tapster does not read");return Number(b)}if(x>8)throw O("has a number tapster does not read");return a(h+1,x)}case 2:{if(_===2)return e.readFloatBE(h+1);if(_===3)return e.readDoubleBE(h+1);throw O("has a real tapster does not read")}case 3:if(m!==51)throw O("has a damaged date");return new Date((978307200+e.readDoubleBE(h+1))*1000);case 4:{let[x,b]=S();if(b+x>i)throw O("is truncated");return Buffer.from(e.subarray(b,b+x))}case 5:{let[x,b]=S();if(b+x>i)throw O("is truncated");return e.subarray(b,b+x).toString("latin1")}case 6:{let[x,b]=S();if(b+x*2>i)throw O("is truncated");let v=Buffer.from(e.subarray(b,b+x*2));return v.swap16(),v.toString("utf16le")}case 10:{let[x,b]=S();if(b+x*n>i)throw O("is truncated");return Array.from({length:x},(v,k)=>f(a(b+k*n,n),d+1))}case 13:{let[x,b]=S();if(b+2*x*n>i)throw O("is truncated");let v={};for(let k=0;k<x;k++){let T=f(a(b+k*n,n),d+1);if(typeof T!=="string")throw O("has a dict key that is not a string");if(Object.hasOwn(v,T))throw O(`lists the key ${T} twice`);Object.defineProperty(v,T,{value:f(a(b+(x+k)*n,n),d+1),enumerable:!0,writable:!0,configurable:!0})}return v}default:throw O("has an object tapster does not read")}}finally{u.delete(p)}};return f(o,1)}var bs=[{actor_id:5,actor_type:"RepositoryRole",bypass_mode:"always"}],H$={actor_id:null,actor_type:"DeployKey",bypass_mode:"always"},Ih={name:"tapster tags",target:"tag",enforcement:"active",bypass_actors:bs,conditions:{ref_name:{include:["~ALL"],exclude:[]}},rules:[{type:"creation"},{type:"update"},{type:"deletion"}]},Nh={name:"tapster branches",target:"branch",enforcement:"active",bypass_actors:bs,conditions:{ref_name:{include:["~ALL"],exclude:[]}},rules:[{type:"creation"},{type:"update"},{type:"deletion"},{type:"non_fast_forward"}]},Rh="refs/heads/dependabot/**";function W$(e,t=!1){let r=e?[...bs,H$]:bs,n={ref_name:{include:["~ALL"],exclude:t?[Rh]:[]}};return[{...Ih,bypass_actors:r},{...Nh,bypass_actors:r,conditions:n}]}function Th(e,t){if(t==="app")return e.current_user_can_bypass!=="never";return(e.bypass_actors??[]).some((r)=>!(r.actor_type==="DeployKey"||r.actor_type==="RepositoryRole"&&r.actor_id===5))}async function Oh(e,t,r,n,s,o){let i;try{i=await e.json("GET",`/repos/${t}/rulesets?targets=${r}`)}catch(d){if(d instanceof D&&(d.status===403||d.status===404))return{problems:["GitHub offers no rulesets on this repository; private repositories need a paid plan for them"],ok:!1};throw d}let a=await Promise.all(i.filter((d)=>d.target===r&&d.enforcement==="active").map((d)=>e.json("GET",`/repos/${t}/rulesets/${d.id}`)));if(a.length===0)return{problems:[`no active ${r} ruleset protects every ${r}`],ok:!1};let c=r==="branch"&&o?[Rh]:[],u=a.filter((d)=>(d.conditions?.ref_name?.include??[]).includes("~ALL")&&(d.conditions?.ref_name?.exclude??[]).every((h)=>c.includes(h)));if(u.length===0)return{problems:[`no active ${r} ruleset covers every ${r} (~ALL) without exclusions`],ok:!1};let l=u.filter((d)=>Th(d,s)).map((d)=>`the App or another actor can bypass ${d.name}`),f=new Set(u.filter((d)=>!Th(d,s)).flatMap((d)=>(d.rules??[]).map((h)=>h.type))),p=n.filter((d)=>!f.has(d));if(p.length)l.push(`the ${r} rulesets do not restrict ${p.join(", ")}`);return{problems:l,ok:l.length===0}}async function Ch(e,t,r,n,s=!1){let o=await Oh(e,t,"tag",Ih.rules.map((a)=>a.type),n,!1),i=await Oh(e,t,"branch",Nh.rules.map((a)=>a.type),n,s);if(i.ok){let a=new Set((await e.json("GET",`/repos/${t}/rules/branches/${encodeURIComponent(r)}`)).map((c)=>c.type));if(!["update","deletion","non_fast_forward"].every((c)=>a.has(c)))i.problems.push("GitHub does not enforce rulesets on this repository; private repositories need a paid plan for them")}return{tag:o.problems,branch:i.problems}}async function Qi(e,t,r,n,s=!1){let o=await Ch(e,t,r,n,s);return[...o.tag,...o.branch]}async function zh(e,t,r,n=!1,s=!1){let o=await Ch(e,t,r,"admin",s);if(o.tag.concat(o.branch).some((l)=>l.includes("offers no rulesets")))return"unavailable";let i=await e.json("GET",`/repos/${t}/rulesets`),a=n||s;if(o.tag.length+o.branch.length===0&&!a)return"exists";let[c,u]=W$(n,s);try{for(let[l,f]of[[c,o.tag],[u,o.branch]]){if(f.length===0&&!a)continue;let p=i.find((d)=>d.name===l.name);if(p)await e.json("PUT",`/repos/${t}/rulesets/${p.id}`,l);else await e.json("POST",`/repos/${t}/rulesets`,l)}}catch(l){if(l instanceof D&&(l.status===403||l.status===422))return"unavailable";throw l}return(await Qi(e,t,r,"admin",s)).length===0?"created":"unavailable"}import{createPrivateKey as dP}from"crypto";import{spawn as hP}from"child_process";import{existsSync as Bh,readFileSync as mP}from"fs";import{readFile as gP,writeFile as jr}from"fs/promises";import{delimiter as sa,join as Ne}from"path";var V$={401:"Your GitHub sign-in was rejected; run gh auth login again.",403:"Your account may not do this here; check that you own the repository, then run gh auth refresh to renew the sign-in.",404:"Not found, or your gh sign-in cannot see it; check the name and run gh auth status.",409:"GitHub reported a conflict; run the command again.",422:"GitHub rejected the request."},Y$={401:"The credential was rejected; rotate it with tapster init --rotate.",403:"Access denied: check the App's permissions and that it is installed on this repository.",404:"Not found. The App may not be installed on this repository.",409:"GitHub reported a conflict; the next run retries.",422:"GitHub rejected the request."};function Xi(e){try{return new URL(e).pathname}catch{return"(url)"}}class Oe{token;fetchImpl;sleep;who;constructor(e,t=fetch,r=(s)=>new Promise((o)=>setTimeout(o,s)),n="app"){this.token=e;this.fetchImpl=t;this.sleep=r;this.who=n}async request(e,t,r={}){let n=t.startsWith("https://")?t:`https://api.github.com${t}`,s={Accept:r.accept??"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":"tapster"};if(r.auth!==!1)s.Authorization=`Bearer ${this.token}`;if(r.contentType)s["Content-Type"]=r.contentType;else if(r.body!==void 0)s["Content-Type"]="application/json";let o=r.raw??(r.body!==void 0?JSON.stringify(r.body):void 0);for(let i=0;;i++){let a;try{a=await this.fetchImpl(n,{method:e,headers:s,body:o,redirect:"manual"})}catch{if(i<4){await this.sleep(1000*2**i);continue}throw new D(`GitHub ${e} ${Xi(n)}: network error`,"GitHub did not answer; the next run retries.",0)}if((a.status>=500||a.status===429)&&i<4){await this.sleep(1000*2**i);continue}if(a.status>=400){await a.body?.cancel();let c=this.who==="user"?V$:Y$;throw new D(`GitHub ${e} ${Xi(n)} returned ${a.status}`,c[a.status]??(this.who==="user"?"Try again in a moment.":"The next run retries."),a.status)}return a}}async json(e,t,r){let n=await this.request(e,t,r===void 0?{}:{body:r});for(let s=0;n.status>=300&&n.status<400;s++){let o=n.headers.get("location"),i=null;try{i=o?new URL(o):null}catch{i=null}if(s>=3||!i||i.protocol!=="https:"||i.host!=="api.github.com")throw new D(`GitHub ${e} ${Xi(t)} moved somewhere tapster does not follow`,"Update the repository name in tapster.yml.",n.status);n=await this.request(e,i.toString(),r===void 0?{}:{body:r})}if(n.status===204)return;return await n.json()}async listReleases(e){let t=[];for(let r=1;r<=10;r++){let n=await this.json("GET",`/repos/${e}/releases?per_page=100&page=${r}`);if(t.push(...n),n.length<100)break}return t}getRelease=(e,t)=>this.json("GET",`/repos/${e}/releases/${t}`);getRepo=(e)=>this.json("GET",`/repos/${e}`);async downloadAsset(e,t){let r=await this.request("GET",`/repos/${e}/releases/assets/${t}`,{accept:"application/octet-stream"});if(r.status>=300&&r.status<400){let n=r.headers.get("location");if(!n)throw new D(`GitHub sent a redirect without a location for asset ${t}`,"The next run retries.",r.status);let s=await this.request("GET",n,{auth:!1,accept:"application/octet-stream"});return Buffer.from(await s.arrayBuffer())}return Buffer.from(await r.arrayBuffer())}async uploadAsset(e,t,r){let n=e.upload_url.replace(/\{.*\}$/,"");return await(await this.request("POST",`${n}?name=${encodeURIComponent(t)}`,{raw:r,contentType:"application/octet-stream"})).json()}deleteAsset=(e,t)=>this.request("DELETE",`/repos/${e}/releases/assets/${t}`).then(()=>{return});renameAsset=(e,t,r)=>this.json("PATCH",`/repos/${e}/releases/assets/${t}`,{name:r});updateRelease=(e,t,r,n)=>this.json("PATCH",`/repos/${e}/releases/${t}`,{...n,tag_name:r})}import{createSign as J$}from"crypto";var Lh=(e)=>Buffer.from(e).toString("base64url");function qt(e,t,r=Date.now()){let n=Math.floor(r/1000)-60,s=Lh(JSON.stringify({alg:"RS256",typ:"JWT"})),o=Lh(JSON.stringify({iat:n,exp:n+540,iss:e})),i=J$("RSA-SHA256").update(`${s}.${o}`).sign(t).toString("base64url"),a=`${s}.${o}.${i}`;return Mt(a),a}var Dh=`- name: Ring the tapster hub
195
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1){if(e.reused==="ref")o(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Xf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!=="object")return;Xf(r);let i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;let o=r.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!=="string")return;if(!n.includes(s))n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var em=new Set(["type","properties","required","additionalProperties"]),Jf=["oneOf","anyOf"];function Qf(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ba(e){let t=[];for(let o of e){if(typeof o!=="object"||o.type!=="object")return null;for(let s in o)if(!em.has(s))return null;t.push(o)}let n={},r=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let l of t){let u=l.properties?.[s]??Qf(l);if(u===null||u===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:Ba(a)??{allOf:a};ge(n,s,c)}for(let s of o.required??[])r.add(s)}let i={type:"object",properties:n};if(r.size)i.required=[...r];if(t.every((o)=>o.additionalProperties===!1))i.additionalProperties=!1;else{let o=[];for(let s of t){let a=Qf(s);if(a&&!o.some((c)=>JSON.stringify(c)===JSON.stringify(a)))o.push(a)}if(o.length===1)i.additionalProperties=o[0];else if(o.length>1)i.additionalProperties={allOf:o}}return i}function $$(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let i of em)if(i in e)return;let n=t.filter((i)=>Jf.some((o)=>Array.isArray(i[o]))),r=null;if(!n.length)r=Ba(t);else{let i=n[0],o=Jf.find((c)=>Array.isArray(i[c]));if(Object.keys(i).length!==1)return;let s=t.filter((c)=>c!==i),a=i[o].map((c)=>Ba([...s,c]));if(a.some((c)=>!c))return;r={[o]:a}}if(!r)return;delete e.allOf,ar(e,r)}function pr(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},p=c.ref;if(c.ref=null,p){r(p);let h=e.seen.get(p),f=h.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(f);else ar(l,f);if(ar(l,u),a._zod.parent===p)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(!(g in u))delete l[g]}if(f.$ref&&h.def)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(g in h.def&&JSON.stringify(l[g])===JSON.stringify(h.def[g]))delete l[g]}}let d=a._zod.parent;if(d&&d!==p){r(d);let h=e.seen.get(d);if(h?.schema.$ref){if(l.$ref=h.schema.$ref,h.def)for(let f in l){if(f==="$ref"||f==="allOf")continue;if(f in h.def&&JSON.stringify(l[f])===JSON.stringify(h.def[f]))delete l[f]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Xf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let p=a.get(u);if(p)p.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])$$(l)}}let i={};if(e.target==="draft-2020-12")i.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")i.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")i.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}ar(i,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;if(o!==void 0&&i.id===o)delete i.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;ge(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")i.$defs=s;else i.definitions=s;try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:cr(t,"input",e.processors),output:cr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function le(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return le(r.element,n);if(r.type==="set")return le(r.valueType,n);if(r.type==="lazy")return le(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return le(r.innerType,n);if(r.type==="intersection")return le(r.left,n)||le(r.right,n);if(r.type==="record"||r.type==="map")return le(r.keyType,n)||le(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return le(r.in,n)||le(r.out,n)}if(r.type==="object"){for(let i in r.shape)if(le(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(let i of r.options)if(le(i,n))return!0;return!1}if(r.type==="tuple"){for(let i of r.items)if(le(i,n))return!0;if(r.rest&&le(r.rest,n))return!0;return!1}return!1}var tm=(e,t={})=>(n)=>{let r=lr({...n,processors:t});return U(e,r),ur(r,e),pr(r,e)},cr=(e,t,n={})=>(r)=>{let{libraryOptions:i,target:o}=r??{},s=lr({...i??{},target:o,io:t,processors:n});return U(e,s),ur(s,e),pr(s,e)};var sn=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},an=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},nm=(e,t)=>{sn(e,"minimum",t),an(e,"maximum",t)},am=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},cm=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},lm=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},um=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},rm=(e,t)=>sn(e,"minimum",t.minimum),im=(e,t)=>an(e,"maximum",t.maximum),om=(e)=>(t,n)=>{um(t,n.format);let[r,i]=e[n.format];sn(t,"minimum",r),an(t,"maximum",i)},P$={greater_than:(e,t)=>sn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>an(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>am(e,t.value),number_format:om(Si),bigint_format:om(ca),min_length:rm,max_length:im,length_equals:(e,t)=>nm(e,t.length),min_size:rm,max_size:im,size_equals:(e,t)=>nm(e,t.size),string_format:(e,t)=>{if(um(e,t.format),t.pattern)cm(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>lm(e,t.mime)};function fe(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let o of r)P$[o._zod.def.check]?.(t,o._zod.def);let i=e._zod.bag;if(i.minimum!==void 0)sn(t,"minimum",i.minimum);if(i.exclusiveMinimum!==void 0)sn(t,"exclusiveMinimum",i.exclusiveMinimum);if(i.maximum!==void 0)an(t,"maximum",i.maximum);if(i.exclusiveMaximum!==void 0)an(t,"exclusiveMaximum",i.exclusiveMaximum);if(i.multipleOf!==void 0)am(t,i.multipleOf);if(i.format!==void 0){if(t.format??(t.format=i.format),i.format.includes("int"))t.isInt=!0}if(i.mime)lm(t,i.mime);for(let o of i.patterns??[])cm(t,o);return t}var T$={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},E$=new Map([[Sa,Sd],[Ui,Ad]]),pm=(e)=>E$.get(e)??e,Ka=(e,t,n,r)=>{let i=n;i.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=fe(e);if(typeof o==="number")i.minLength=o;if(typeof s==="number")i.maxLength=s;if(a){if(i.format=T$[a]??a,i.format==="")delete i.format;if(a==="time"||u)delete i.format}if(l)i.contentEncoding=l;if(c&&c.size>0){let p=[...c].map(pm);if(p.length===1)i.pattern=p[0].source;else if(p.length>1)i.allOf=[...p.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},Wa=(e,t,n,r)=>{let i=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=fe(e);i.type=u?"integer":"number";let p=typeof l==="number"&&l>=(o??Number.NEGATIVE_INFINITY),d=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(h)i.minimum=l,i.exclusiveMinimum=!0;else i.exclusiveMinimum=l;else if(typeof o==="number")i.minimum=o;if(d)if(h)i.maximum=c,i.exclusiveMaximum=!0;else i.exclusiveMaximum=c;else if(typeof s==="number")i.maximum=s;if(a){let f=new Set;for(let w of a)if(Number.isFinite(w)&&w!==0)f.add(Math.abs(w));else Q(e,t,i,r,`A multipleOf divisor of ${w} cannot be represented in JSON Schema`);let[m,...g]=f;if(m!==void 0)i.multipleOf=m;if(g.length)i.allOf=[...i.allOf??[],...g.map((w)=>({multipleOf:w}))]}},Va=(e,t,n,r)=>{n.type="boolean"},dm=(e,t,n,r)=>{Q(e,t,n,r,"BigInt cannot be represented in JSON Schema")},hm=(e,t,n,r)=>{Q(e,t,n,r,"Symbols cannot be represented in JSON Schema")},fm=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},mm=(e,t,n,r)=>{Q(e,t,n,r,"Undefined cannot be represented in JSON Schema")},gm=(e,t,n,r)=>{Q(e,t,n,r,"Void cannot be represented in JSON Schema")},Ya=(e,t,n,r)=>{n.not={}},vm=(e,t,n,r)=>{},Ja=(e,t,n,r)=>{},ym=(e,t,n,r)=>{Q(e,t,n,r,"Date cannot be represented in JSON Schema")},Qa=(e,t,n,r)=>{let i=e._zod.def,o=Vn(i.entries);if(o.length===0){n.not={};return}if(o.every((s)=>typeof s==="number"))n.type="number";if(o.every((s)=>typeof s==="string"))n.type="string";n.enum=o},Xa=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let o=[];for(let s of i.values)if(s===void 0){if(Q(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Q(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length===0);else if(o.length===1){let s=o[0];if(n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[s];else n.const=s}else{if(o.every((s)=>typeof s==="number"))n.type="number";if(o.every((s)=>typeof s==="string"))n.type="string";if(o.every((s)=>typeof s==="boolean"))n.type="boolean";if(o.every((s)=>s===null))n.type="null";n.enum=o}},bm=(e,t,n,r)=>{Q(e,t,n,r,"NaN cannot be represented in JSON Schema")},wm=(e,t,n,r)=>{let i=n,o=e._zod.pattern;if(!o)throw Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},_m=(e,t,n,r)=>{let i=n;i.type="string",i.format="binary",i.contentEncoding="binary";let{minimum:o,maximum:s,mime:a}=fe(e);if(o!==void 0)i.minLength=o;if(s!==void 0)i.maxLength=s;if(!a)return;if(a.length===0)i.not={};else if(a.length===1)i.contentMediaType=a[0];else i.anyOf=a.map((c)=>({contentMediaType:c}))},km=(e,t,n,r)=>{n.type="boolean"},ec=(e,t,n,r)=>{Q(e,t,n,r,"Custom types cannot be represented in JSON Schema")},xm=(e,t,n,r)=>{Q(e,t,n,r,"Function types cannot be represented in JSON Schema")},tc=(e,t,n,r)=>{Q(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Sm=(e,t,n,r)=>{Q(e,t,n,r,"Map cannot be represented in JSON Schema")},Am=(e,t,n,r)=>{Q(e,t,n,r,"Set cannot be represented in JSON Schema")},nc=(e,t,n,r)=>{let i=n,o=e._zod.def,{minimum:s,maximum:a}=fe(e);if(typeof s==="number")i.minItems=s;if(typeof a==="number")i.maxItems=a;i.type="array",i.items=U(o.element,t,{...r,path:[...r.path,"items"]})};function dr(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return dr(t.out);if(t.type==="catch")return dr(t.innerType);return e._zod.optin}var rc=(e,t,n,r)=>{let i=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&Q(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(let l in s)ge(i.properties,l,U(s[l],t,{...r,path:[...r.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=o.shape[l];if(t.io==="input"?dr(u)===void 0:u._zod.optout===void 0)c.push(l)}if(c.length>0)i.required=c;if(o.catchall?._zod.def.type==="never")i.additionalProperties=!1;else if(!o.catchall){if(t.io==="output")i.additionalProperties=!1}else if(o.catchall)i.additionalProperties=U(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},ic=(e,t,n,r)=>{let i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,c)=>U(a,t,{...r,path:[...r.path,o?"oneOf":"anyOf",c]}));if(o)n.oneOf=s;else n.anyOf=s},oc=(e,t,n,r)=>{let i=e._zod.def,o=U(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=U(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},sc=(e,t,n,r)=>{let i=n,o=e._zod.def;i.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((m,g)=>U(m,t,{...r,path:[...r.path,s,g]})),l=o.rest?U(o.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,u=o.items.length;while(u>0){let m=o.items[u-1];if(!(t.io==="input"?dr(m)!==void 0:m._zod.optout==="optional"))break;u--}let p=o.items.length,d=!o.rest;if(t.target==="draft-2020-12"){if(i.prefixItems=c,d)i.items=!1;else if(l)i.items=l;if(u>0)i.minItems=u;if(d)i.maxItems=p}else if(t.target==="openapi-3.0"){if(i.items={anyOf:c},l)i.items.anyOf.push(l);if(u>0)i.minItems=u;if(d)i.maxItems=p}else{if(i.items=c,d)i.additionalItems=!1;else if(l)i.additionalItems=l;if(u>0)i.minItems=u;if(d)i.maxItems=p}let{minimum:h,maximum:f}=fe(e);if(typeof h==="number")i.minItems=h;if(typeof f==="number")i.maxItems=f};function Ha(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let f=e.get(t)?.def;if(!f)return t;let m=Ha(e,f,n);return m===f?t:m}for(let f of["anyOf","oneOf"]){let m=t[f];if(!Array.isArray(m))continue;let g=m.map((w)=>Ha(e,w,n));if(g.some((w,x)=>w!==m[x]))t={...t,[f]:g}}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes("string")&&r.some((f)=>f==="number"||f==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!i&&!o?.some((f)=>typeof f==="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:p,id:d,...h}=t;if(h.enum)h.enum=h.enum.map((f)=>typeof f==="number"?String(f):f);else if(typeof h.const==="number")h.const=String(h.const);if(!i)return h;if(h.type="string",!o)h.pattern=(r.includes("number")?er:va).source;return h}var Fa=new WeakMap;function O$(e){let t=new Map;for(let r of e.seen.values())if(r.def&&!t.has(r.schema))t.set(r.schema,r);let n=new Map;for(let r of Fa.get(e)??[]){let i=e.seen.get(r),o=(i?.def??i?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let s=Ha(t,o,new Set);if(s!==o)n.set(o,s)}if(!n.size)return;for(let r of e.seen.values())for(let i of[r.schema,r.def]){let o=i&&n.get(i.propertyNames);if(o)i.propertyNames=o}}var ac=(e,t,n,r)=>{let i=n,o=e._zod.def;i.type="object";let s=o.keyType,a=fe(s).patterns;if(o.mode==="loose"&&a&&a.size>0){let u=U(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(let p of a)ge(i.patternProperties,pm(p).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){i.propertyNames=U(o.keyType,t,{...r,path:[...r.path,"propertyNames"]});let u=Fa.get(t);if(!u)u=[],Fa.set(t,u),t.deferred.push(()=>O$(t));u.push(e)}i.additionalProperties=U(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&dr(o.valueType)!==void 0;if(c&&!o.partial&&!l){let u=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(u.length>0)i.required=u.map(String)}},cc=(e,t,n,r)=>{let i=e._zod.def,o=U(i.innerType,t,r),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=i.innerType,n.nullable=!0;else n.anyOf=[o,{type:"null"}]},lc=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},uc=Symbol();function $m(e,t,n,r,i){let o=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return o=!0,null});if(!o)return JSON.parse(s);return Q(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),uc}var pc=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType;let s=$m(i.defaultValue,e,t,n,r);if(s!==uc)n.default=s},dc=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let o=t.seen.get(e);if(o.ref=i.innerType,t.io!=="input")return;let s=$m(i.defaultValue,e,t,n,r);if(s!==uc)n._prefault=s},hc=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{Q(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},fc=(e,t,n,r)=>{let i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?i.out:i.in:i.out;U(s,t,r);let a=t.seen.get(e);a.ref=s},mc=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType,n.readOnly=!0},Pm=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},Yi=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},Tm=(e,t,n,r)=>{let i=e._zod.innerType;U(i,t,r);let o=t.seen.get(e);o.ref=i},sm={string:Ka,number:Wa,boolean:Va,bigint:dm,symbol:hm,null:fm,undefined:mm,void:gm,never:Ya,any:vm,unknown:Ja,date:ym,enum:Qa,literal:Xa,nan:bm,template_literal:wm,file:_m,success:km,custom:ec,function:xm,transform:tc,map:Sm,set:Am,array:nc,object:rc,union:ic,intersection:oc,tuple:sc,record:ac,nullable:cc,nonoptional:lc,default:pc,prefault:dc,catch:hc,pipe:fc,readonly:mc,promise:Pm,optional:Yi,lazy:Tm};function Em(e,t){if("_idmap"in e){let r=e,i=lr({...t,processors:sm}),o={};for(let c of r._idmap.entries()){let[l,u]=c;U(u,i)}let s={},a={registry:r,uri:t?.uri,defs:o};i.external=a;for(let c of r._idmap.entries()){let[l,u]=c;ur(i,u),ge(s,l,pr(i,u))}if(Object.keys(o).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let n=lr({...t,processors:sm});return U(e,n),ur(n,e),pr(n,e)}var Om=new WeakSet([Object.prototype,Error.prototype]);function Qi(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var M$=(e,t)=>{Jp.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(Om.has(n))return;Om.add(n),Qi(n,"format",(r)=>(i)=>Xp(r,i)),Qi(n,"flatten",(r)=>(i)=>Qp(r,i)),Qi(n,"addIssue",(r)=>(i)=>{r.issues.push(i),r.message=JSON.stringify(r.issues,Yn,2)}),Qi(n,"addIssues",(r)=>(i)=>{r.issues.push(...i),r.message=JSON.stringify(r.issues,Yn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var be=y("ZodError",M$,void 0,{Parent:Error});var Cm=Ci(be),Rm=Ri(be),Im=Ii(be),Nm=Ni(be),zm=td(be),Dm=nd(be),Lm=rd(be),jm=id(be),Mm=od(be),Um=sd(be),Zm=ad(be),Gm=cd(be);function Z$(){if(!ce.localeError)ye(Ca())}function hr(){if(!ce.memoizer)ye({memoizer:df()})}var q=y("ZodType",(e,t)=>(Z$(),Z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ve(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Me(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(jP(e,t))},superRefine(e,t){return this.check(MP(e,t))},overwrite(e){return this.check(wt(e))},optional(){return Bm(this)},exactOptional(){return AP(this)},nullable(){return Hm(this)},nullish(){return Bm(Hm(this))},nonoptional(e){return CP(this,e)},array(){return ue(this)},or(e){return Qm([this,e])},and(e){return wP(this,e)},transform(e){return Fm(this,Xm(e))},default(e){return TP(this,e)},prefault(e){return OP(this,e)},catch(e){return IP(this,e)},pipe(e){return Fm(this,e)},readonly(){return DP(this)},describe(e){let t=this.clone();return Dt.add(t,{description:e}),t},meta(...e){if(e.length===0)return Dt.get(this);let t=this.clone();return Dt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Ei(this,"~standard",{...xa(this),jsonSchema:{input:cr(this,"input"),output:cr(this,"output")}})},set "~standard"(e){et(this,"~standard",e)},parse:function e(t,n){return Cm(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Rm(this,t,n,{callee:e})},safeParse(e,t){return Im(this,e,t)},async safeParseAsync(e,t){return Nm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){et(this,"spa",e)},validate(e,t){return ha(this,e,t)},validateAsync(e,t){return fa(this,e,t)},encode:function e(t,n){return zm(this,t,n,{callee:e})},decode:function e(t,n){return Dm(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Lm(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await jm(this,t,n,{callee:e})},safeEncode(e,t){return Mm(this,e,t)},safeDecode(e,t){return Um(this,e,t)},async safeEncodeAsync(e,t){return Zm(this,e,t)},async safeDecodeAsync(e,t){return Gm(this,e,t)},toJSONSchema(e){return tm(this,{})(e)},get description(){return Dt.get(this)?.description},get _def(){return this._zod.def}}),Km=y("_ZodString",(e,t)=>{Mi.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ka(e,n,r,i)},Hp({format:(e)=>fe(e).format??null,minLength:(e)=>fe(e).minimum??null,maxLength:(e)=>fe(e).maximum??null},{regex(...e){return this.check(Ia(...e))},includes(...e){return this.check(Da(...e))},startsWith(...e){return this.check(La(...e))},endsWith(...e){return this.check(ja(...e))},min(...e){return this.check(on(...e))},max(...e){return this.check(Wi(...e))},length(...e){return this.check(Vi(...e))},nonempty(...e){return this.check(on(1,...e))},lowercase(e){return this.check(Na(e))},uppercase(e){return this.check(za(e))},trim(){return this.check(Ua())},normalize(...e){return this.check(Ma(...e))},toLowerCase(){return this.check(Za())},toUpperCase(){return this.check(Ga())},slugify(){return this.check(qa())}})),G$=y("ZodString",(e,t)=>{Mi.init(e,t),Km.init(e,t)},{email(e){return this.check(vf(K$,e))},url(e){return this.check(Ra(Wm,e))},jwt(e){return this.check(Lf(lP,e))},emoji(e){return this.check(xf(V$,e))},guid(e){return this.check(yf(W$,e))},uuid(e){return this.check(bf(Xi,e))},uuidv4(e){return this.check(wf(Xi,e))},uuidv6(e){return this.check(_f(Xi,e))},uuidv7(e){return this.check(kf(Xi,e))},nanoid(e){return this.check(Sf(Y$,e))},cuid(e){return this.check(Af(J$,e))},cuid2(e){return this.check($f(Q$,e))},ulid(e){return this.check(Pf(X$,e))},base64(e){return this.check(Nf(sP,e))},base64url(e){return this.check(zf(aP,e))},xid(e){return this.check(Tf(eP,e))},ksuid(e){return this.check(Ef(tP,e))},ipv4(e){return this.check(Of(nP,e))},ipv6(e){return this.check(Cf(rP,e))},cidrv4(e){return this.check(Rf(iP,e))},cidrv6(e){return this.check(If(oP,e))},e164(e){return this.check(Df(cP,e))},datetime(e){return this.check(jf(q$,e))},date(e){return this.check(Mf(B$,e))},time(e){return this.check(Uf(H$,e))},duration(e){return this.check(Zf(F$,e))}});function E(e){return gf(G$,e)}var H=y("ZodStringFormat",(e,t)=>{G.init(e,t),Km.init(e,t)}),q$=y("ZodISODateTime",(e,t)=>{xh.init(e,t),H.init(e,t)}),B$=y("ZodISODate",(e,t)=>{Sh.init(e,t),H.init(e,t)}),H$=y("ZodISOTime",(e,t)=>{Ah.init(e,t),H.init(e,t)}),F$=y("ZodISODuration",(e,t)=>{$h.init(e,t),H.init(e,t)}),K$=y("ZodEmail",(e,t)=>{dh.init(e,t),H.init(e,t)});var W$=y("ZodGUID",(e,t)=>{uh.init(e,t),H.init(e,t)});var Xi=y("ZodUUID",(e,t)=>{ph.init(e,t),H.init(e,t)});var Wm=y("ZodURL",(e,t)=>{mh.init(e,t),H.init(e,t)});function Vm(e){return Ra(Wm,e)}var V$=y("ZodEmoji",(e,t)=>{gh.init(e,t),H.init(e,t)});var Y$=y("ZodNanoID",(e,t)=>{vh.init(e,t),H.init(e,t)});var J$=y("ZodCUID",(e,t)=>{yh.init(e,t),H.init(e,t)});var Q$=y("ZodCUID2",(e,t)=>{bh.init(e,t),H.init(e,t)});var X$=y("ZodULID",(e,t)=>{wh.init(e,t),H.init(e,t)});var eP=y("ZodXID",(e,t)=>{_h.init(e,t),H.init(e,t)});var tP=y("ZodKSUID",(e,t)=>{kh.init(e,t),H.init(e,t)});var nP=y("ZodIPv4",(e,t)=>{Ph.init(e,t),H.init(e,t)});var rP=y("ZodIPv6",(e,t)=>{Eh.init(e,t),H.init(e,t)});var iP=y("ZodCIDRv4",(e,t)=>{Oh.init(e,t),H.init(e,t)});var oP=y("ZodCIDRv6",(e,t)=>{Ch.init(e,t),H.init(e,t)});var sP=y("ZodBase64",(e,t)=>{Ih.init(e,t),H.init(e,t)});var aP=y("ZodBase64URL",(e,t)=>{Nh.init(e,t),H.init(e,t)});var cP=y("ZodE164",(e,t)=>{zh.init(e,t),H.init(e,t)});var lP=y("ZodJWT",(e,t)=>{Dh.init(e,t),H.init(e,t)});var Ym=y("ZodNumber",(e,t)=>{Aa.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Wa(e,n,r,i),e.isFinite=!0},Hp({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=fe(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=fe(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=fe(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>fe(e).format??null},{gt(e,t){return this.check(Fi(e,t))},gte(e,t){return this.check(sr(e,t))},min(e,t){return this.check(sr(e,t))},lt(e,t){return this.check(Hi(e,t))},lte(e,t){return this.check(or(e,t))},max(e,t){return this.check(or(e,t))},int(e){return this.check(qm(e))},safe(e){return this.check(qm(e))},positive(e){return this.check(Fi(0,e))},nonnegative(e){return this.check(sr(0,e))},negative(e){return this.check(Hi(0,e))},nonpositive(e){return this.check(or(0,e))},multipleOf(e,t){return this.check(Ki(e,t))},step(e,t){return this.check(Ki(e,t))},finite(){return this}}));function bc(e){return Gf(Ym,e)}var uP=y("ZodNumberFormat",(e,t)=>{Lh.init(e,t),Ym.init(e,t)});function qm(e){return qf(uP,e)}var pP=y("ZodBoolean",(e,t)=>{jh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Va(e,n,r,i)});function tt(e){return Bf(pP,e)}var dP=y("ZodUnknown",(e,t)=>{Mh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ja(e,n,r,i)});function gc(){return Hf(dP)}var hP=y("ZodNever",(e,t)=>{Uh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ya(e,n,r,i)});function fP(e){return Ff(hP,e)}var mP=y("ZodArray",(e,t)=>{hr(),Zh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>nc(e,n,r,i),e.element=t.element},{min(e,t){return this.check(on(e,t))},nonempty(e){return this.check(on(1,e))},max(e,t){return this.check(Wi(e,t))},length(e,t){return this.check(Vi(e,t))},unwrap(){return this.element}});function ue(e,t){return Kf(mP,e,t)}var gP=y("ZodObject",(e,t)=>{hr(),Bh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>rc(e,n,r,i),FA(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return Lt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ve(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ve(this._zod.def,{catchall:gc()}))},loose(){return this.clone(ve(this._zod.def,{catchall:gc()}))},strict(){return this.clone(ve(this._zod.def,{catchall:fP()}))},strip(){return this.clone(ve(this._zod.def,{catchall:void 0}))},extend(e){return jA(this,e)},safeExtend(e){return MA(this,e)},merge(e){return UA(this,e)},pick(e){return DA(this,e)},omit(e){return LA(this,e)},partial(...e){return Zp(kc,this,e[0])},exactPartial(...e){return Zp(eg,this,e[0],"exactPartial")},required(...e){return ZA(tg,this,e[0])}});function z(e,t){let n={type:"object",shape:e??{},...T(t)};return new gP(n)}var Jm=y("ZodUnion",(e,t)=>{$a.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ic(e,n,r,i),e.options=t.options});function Qm(e,t){return new Jm({type:"union",options:e,...T(t)})}var vP=y("ZodDiscriminatedUnion",(e,t)=>{Jm.init(e,t),Hh.init(e,t)});function yP(e,t,n){return new vP({type:"union",options:t,discriminator:e,...T(n)})}var bP=y("ZodIntersection",(e,t)=>{Fh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>oc(e,n,r,i)});function wP(e,t){return new bP({type:"intersection",left:e,right:t})}var _P=y("ZodTuple",(e,t)=>{hr(),Kh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>sc(e,n,r,i)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new kc({type:"optional",innerType:t}))})}});function wc(e,t,n){let r=t instanceof Z,i=r?n:t;return new _P({type:"tuple",items:e,rest:r?t:null,...T(i)})}var vc=y("ZodRecord",(e,t)=>{hr(),Wh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ac(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function eo(e,t,n){if(!t||!t._zod)return new vc({type:"record",keyType:E(),valueType:e,...T(t)});return new vc({type:"record",keyType:e,valueType:t,...T(n)})}function kP(e,t,n){return new vc({type:"record",keyType:e,valueType:t,...T(n),partial:!0})}var yc=y("ZodEnum",(e,t)=>{Vh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Qa(e,r,i,o),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{let o={};for(let s of r)if(n.has(s))o[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new yc({...t,checks:[],...T(i),entries:o})},e.exclude=(r,i)=>{let o={...t.entries};for(let s of r)if(n.has(s))delete o[s];else throw Error(`Key ${s} not found in enum`);return new yc({...t,checks:[],...T(i),entries:o})}});function Lt(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new yc({type:"enum",entries:n,...T(t)})}var xP=y("ZodLiteral",(e,t)=>{Yh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Xa(e,n,r,i),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 _c(e,t){return new xP({type:"literal",values:Array.isArray(e)?e:[e],...T(t)})}var SP=y("ZodTransform",(e,t)=>{hr(),Jh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>tc(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Xn(e.constructor.name);n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(zt(o,n.value,t));else{let s=o;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=e),n.issues.push(zt(s))}};let i=t.transform(n.value,n);if(i instanceof Promise)return i.then((o)=>(n.value=o,n));return n.value=i,n}});function Xm(e){return new SP({type:"transform",transform:e})}var kc=y("ZodOptional",(e,t)=>{Pa.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Yi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Bm(e){return new kc({type:"optional",innerType:e})}var eg=y("ZodExactOptional",(e,t)=>{Qh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Yi(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function AP(e){return new eg({type:"optional",innerType:e})}var $P=y("ZodNullable",(e,t)=>{Xh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>cc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Hm(e){return new $P({type:"nullable",innerType:e})}var PP=y("ZodDefault",(e,t)=>{ef.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>pc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function TP(e,t){return new PP({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():sa(t)}})}var EP=y("ZodPrefault",(e,t)=>{tf.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>dc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function OP(e,t){return new EP({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():sa(t)}})}var tg=y("ZodNonOptional",(e,t)=>{nf.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>lc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function CP(e,t){return new tg({type:"nonoptional",innerType:e,...T(t)})}var RP=y("ZodCatch",(e,t)=>{rf.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>hc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function IP(e,t){return new RP({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Fp(t)})}var ng=y("ZodPipe",(e,t)=>{Ta.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>fc(e,n,r,i),e.in=t.in,e.out=t.out});function Fm(e,t){return new ng({type:"pipe",in:e,out:t})}var NP=y("ZodPreprocess",(e,t)=>{ng.init(e,t),of.init(e,t)}),zP=y("ZodReadonly",(e,t)=>{sf.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>mc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function DP(e){return new zP({type:"readonly",innerType:e})}var LP=y("ZodCustom",(e,t)=>{af.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ec(e,n,r,i)});function jP(e,t={}){return Wf(LP,e,t)}function MP(e,t){return Vf(e,t)}function UP(e,t){return new NP({type:"pipe",in:Xm(e),out:t})}var ZP=["iOS","iPhone","macOS"];function ln(e,t){let n=[];if(e==="")return["it is empty"];if(/^\s/.test(e)||/\s$/.test(e))n.push("it has leading or trailing spaces");if(/command ?line/i.test(e))n.push('it should say "command-line"');if(/^(?:the|an?)(?=\s)/i.test(e))n.push("it starts with an article");if(/^[a-z]/.test(e)&&!ZP.includes(e.split(/\s+/)[0]))n.push("it starts with a lowercase letter");if(new RegExp(`^${t.replaceAll("-","").split("").join("[\\s\\-]?")}\\b`,"i").test(e))n.push("it starts with the package name");let r=/\b(macOS|Mac(?: ?OS(?: ?X)?)?|OS ?X)(?! virtual machines?)\b/i.exec(e);if(r&&r[1]!=="MAC")n.push("it names the platform");if(/\.$/.test(e)&&!e.endsWith("etc."))n.push("it ends with a full stop");if(/\p{So}/u.test(e))n.push("it contains a symbol or emoji");if([...e].length>80)n.push("it is longer than 80 characters");return n}var og=["darwin-universal","darwin-arm64","darwin-amd64","linux-arm64","linux-amd64","windows-amd64","windows-arm64"],xc=/^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*))?$/,un=/^[a-z0-9][a-z0-9-]*$/,GP=["com.apple.security.cs.allow-jit","com.apple.security.cs.allow-unsigned-executable-memory","com.apple.security.cs.disable-executable-page-protection","com.apple.security.cs.allow-dyld-environment-variables","com.apple.security.cs.disable-library-validation"],jt=E().regex(/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/).refine((e)=>!e.split("/").includes(".."),"must stay inside the archive"),rg=E().regex(/^[A-Za-z0-9.-]+$/),sg={uninstall:z({launchctl:ue(rg).optional(),quit:ue(rg).optional()}).strict().optional(),zap:z({trash:ue(E().regex(/^~\/[A-Za-z0-9 ._\/-]+$/))}).strict().optional(),caveats:E().min(1).max(2000).optional()},ag={name:E().regex(un),repo:E().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/),workflow:E().regex(/^[A-Za-z0-9._-]+\.ya?ml$/).default("release.yml"),assets:kP(Lt(og),E().regex(/^[A-Za-z0-9._{}-]+$/)),description:E().min(1).max(200).optional(),homepage:Vm().optional(),license:E().regex(/^[A-Za-z0-9.+-]+$/).optional(),attestation:Lt(["auto","off"]).default("auto"),protection:Lt(["on","off","dependabot"]).default("on")},qP=z({...ag,kind:Lt(["go","bun"]),binaries:ue(jt).min(1),completions:z({bash:jt.optional(),zsh:jt.optional(),fish:jt.optional()}).strict().optional(),scoop:tt().default(!1),entitlements:ue(Lt(GP)).default([]),cask:z(sg).strict().default({}),linux:tt().default(!1)}).strict(),to=/^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$/,nt=bc().int().min(0).max(5000),BP=Qm([tt(),E().regex(/^[A-Za-z0-9._*{}-]+$/),ue(E().regex(/^[A-Za-z0-9._*{}-]+$/))]),HP=z({...ag,kind:_c("app"),app:E().regex(/^[A-Za-z0-9 ._-]+\.app$/),bundle_id:E().regex(to),carry:eo(E().regex(/^[A-Za-z0-9._-]+$/),E().regex(/^sha256:[0-9a-f]{64}$/)).default({}),dmg:z({name:E().regex(/^[A-Za-z0-9._{}-]+\.dmg$/),volume:E().regex(/^[A-Za-z0-9 ._-]{1,27}$/).optional(),volume_icon:jt.optional(),layout:z({window:wc([nt,nt,nt,nt]),icon_size:nt,app:wc([nt,nt]),applications:wc([nt,nt])}).strict().optional()}).strict(),sparkle:z({key:E().regex(/^[a-z0-9]+$/),feed:E().regex(/^[A-Za-z0-9._-]+\.xml$/).default("appcast.xml"),public_key:E().regex(/^[A-Za-z0-9+/]{43}=$/),next_key:E().regex(/^[a-z0-9]+$/).optional(),next_public_key:E().regex(/^[A-Za-z0-9+/]{43}=$/).optional()}).strict().optional(),code:eo(jt,z({identifier:E().regex(to).optional(),entitlements:eo(E().regex(/^[A-Za-z0-9.-]+$/),BP).optional()}).strict()).default({}),cask:z({...sg,binaries:ue(jt).optional(),auto_updates:tt().optional()}).strict().default({})}).strict(),cg=UP((e)=>e&&typeof e==="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"go"}:e,yP("kind",[qP,HP])),FP=z({version:_c(1),tap:E().regex(/^[A-Za-z0-9-]+\/[a-z0-9-]+$/),linux:z({maintainer:E().regex(/^[A-Za-z0-9 .'-]+ <[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}>$/),url:Vm({protocol:/^https$/}).regex(/^https:\/\/[A-Za-z0-9.-]+(\/[A-Za-z0-9._-]+)*$/).optional()}).strict().optional(),packages:ue(cg)}).strict(),Y=(e)=>e.kind==="app",no=(e)=>Y(e)||Object.keys(e.assets).some((t)=>t.startsWith("darwin")),ig=(e)=>e.map((t)=>`${t.path.join(".")||"(root)"}: ${t.message}`).join("; ");function KP(e,t,n){if(Y(e))VP(e);if(e.repo.split("/")[0].toLowerCase()!==n.toLowerCase())throw new v(`${e.name}: ${e.repo} is not owned by ${n}`,"tapster publishes only repositories of the hub's owner.");let r=e.description===void 0?[]:ln(e.description,e.name);if(r.length)throw new v(`${e.name}: Homebrew rejects the description because ${r.join(" and ")}`,"Rewrite description in tapster.yml.");let i=Object.entries(e.assets);if(i.length===0)throw new v(`${e.name}: assets is empty`,"Map at least one platform to an asset name.");for(let[o,s]of i){if(s.replaceAll("{version}","").includes("{")||s.replaceAll("{version}","").includes("}"))throw new v(`${e.name}: ${s} uses a placeholder other than {version}`,"Only {version} is replaced in asset names.");if(o.startsWith("darwin")&&!s.endsWith(".tar.gz"))throw new v(`${e.name}: the ${o} asset must be a .tar.gz`,"Pack macOS builds as tar.gz; tapster reads them itself.")}if(Y(e)&&/[{}]/.test(e.dmg.name.replaceAll("{version}","")))throw new v(`${e.name}: ${e.dmg.name} uses a placeholder other than {version}`,"Only {version} is replaced in dmg.name.");if(!Y(e)&&e.scoop&&!Object.keys(e.assets).some((o)=>o.startsWith("windows-")))throw new v(`${e.name}: scoop needs a Windows asset`,"Map windows-amd64 or windows-arm64. Otherwise remove scoop: true.");if(Y(e)||!e.linux)return;if(!Object.keys(e.assets).some((o)=>o.startsWith("linux-")))throw new v(`${e.name}: linux needs a Linux asset`,"Map linux-amd64 or linux-arm64. Otherwise remove linux: true.");if(!t.linux)throw new v(`${e.name} ships Linux packages, but tapster.yml names no linux.maintainer`,'Add linux: { maintainer: "Name <address>" } at the top of tapster.yml.')}function WP(e){let t=new Map,n=(s,a)=>t.has(s)||t.set(s,a);for(let[s,a]of e)if(e.filter(([l,u])=>l!==s&&u.name===a.name).length)n(s,new v(`package ${a.name} is listed twice`,"Keep one entry per package."));let r=e.flatMap(([s,a])=>(Y(a)?a.cask.binaries??[]:a.binaries).map((c)=>({i:s,p:a,id:c.split("/").pop()})));for(let s of r)for(let a of r){if(s.i===a.i||s.id!==a.id||s.p.name===a.p.name)continue;n(s.i,new v(`${s.p.name} and ${a.p.name} both ship a binary named ${s.id}`,"Signed tools are identified by name, so each name may belong to one package."))}let i=(s,a)=>{let c=s.toLowerCase(),l=a.toLowerCase();return c===l||c.startsWith(`${l}.`)||l.startsWith(`${c}.`)},o=e.filter((s)=>Y(s[1]));for(let[s,a]of o){for(let[c,l]of o)if(s!==c&&i(a.bundle_id,l.bundle_id))n(s,new v(`${a.name} and ${l.name} have overlapping bundle ids`,"Each app needs its own bundle id, not one inside another."));for(let c of r){let l=c.id.toLowerCase();if(l!==a.bundle_id.toLowerCase()&&!l.startsWith(`${a.bundle_id.toLowerCase()}.`))continue;let u=new v(`the binary ${c.id} would carry ${a.name}'s identity`,"Rename the binary.");n(s,u),n(c.i,u)}}return t}function ne(e,t){let n;try{n=ie(e)}catch(u){let p=u.linePos?.[0]?.line;throw new v(`tapster.yml is not valid YAML${p?` at line ${p}`:""}`,"Fix the YAML syntax there.")}let r=FP.extend({packages:ue(gc())}).safeParse(n);if(!r.success)throw new v(`tapster.yml is invalid: ${ig(r.error.issues)}`,"Fix the listed fields.");let{packages:i,...o}=r.data,s=new Map,a=(u)=>{let p=u&&typeof u==="object"&&"repo"in u?u.repo:void 0;return typeof p==="string"?p:null},c=(u,p)=>{let d=u&&typeof u==="object"&&"name"in u?u.name:void 0;return typeof d==="string"&&un.test(d)?d:`packages[${p}]`},l=[];for(let[u,p]of i.entries()){let d=cg.safeParse(p);if(!d.success){s.set(u,{name:c(p,u),repo:a(p),reason:`${c(p,u)} is invalid: ${ig(d.error.issues)}`,fix:"Fix the listed fields in tapster.yml."});continue}let h=d.data;try{KP(h,o,t),l.push([u,h])}catch(f){if(!(f instanceof v))throw f;s.set(u,{name:h.name,repo:h.repo,reason:f.reason,fix:f.fix})}}for(let[u,p]of WP(l)){let d=l.find(([h])=>h===u)[1];s.set(u,{name:d.name,repo:d.repo,reason:p.reason,fix:p.fix})}return{config:{...o,packages:l.filter(([u])=>!s.has(u)).map(([,u])=>u)},invalid:[...s.entries()].sort(([u],[p])=>u-p).map(([,u])=>u)}}function VP(e){if(Object.keys(e.assets).filter((n)=>n.startsWith("darwin")).length!==1||Object.keys(e.assets).length!==1)throw new v(`${e.name}: an app needs exactly one darwin asset and nothing else`,"Map one of darwin-arm64, darwin-amd64 or darwin-universal to the app archive.");if(e.dmg.volume??=e.app.replace(/\.app$/,"").slice(0,27),e.sparkle&&e.sparkle.next_key===void 0!==(e.sparkle.next_public_key===void 0))throw new v(`${e.name}: a rotation needs both sparkle.next_key and next_public_key`,"Set both or neither.");for(let[n,r]of Object.entries(e.code))if(r.identifier&&!r.identifier.startsWith(`${e.bundle_id}.`))throw new v(`${e.name}: the identifier for ${n} is outside ${e.bundle_id}`,`Use an identifier that starts with ${e.bundle_id}.`)}function ro(e){let t=xc.exec(e);if(!t)return null;return{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),pre:t[4]??null}}function Sc(e,t){for(let i of["major","minor","patch"])if(e[i]!==t[i])return e[i]-t[i];if(e.pre===t.pre)return 0;if(e.pre===null)return 1;if(t.pre===null)return-1;let n=e.pre.split("."),r=t.pre.split(".");for(let i=0;i<Math.max(n.length,r.length);i++){let o=n[i],s=r[i];if(o===void 0)return-1;if(s===void 0)return 1;let a=/^\d+$/.test(o),c=/^\d+$/.test(s);if(a&&c&&Number(o)!==Number(s))return Number(o)-Number(s);if(a!==c)return a?-1:1;if(o!==s)return o<s?-1:1}return 0}function lg(e,t){let[n,r]=t.split("/");return e.linux?.url??`https://${n.toLowerCase()}.github.io/${r}`}import{spawn as PT}from"child_process";import{existsSync as TT}from"fs";import*as pg from"os";function fr(e){if(e===null||e===void 0)return"";else if(typeof e==="string"||e instanceof String)return e;return JSON.stringify(e)}function dg(e,t,n){let r=new hg(e,t,n);process.stdout.write(r.toString()+pg.EOL)}var ug="::";class hg{constructor(e,t,n){if(!e)e="missing.command";this.command=e,this.properties=t,this.message=n}toString(){let e=ug+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=!0;for(let n in this.properties)if(this.properties.hasOwnProperty(n)){let r=this.properties[n];if(r){if(t)t=!1;else e+=",";e+=`${n}=${JP(r)}`}}}return e+=`${ug}${YP(this.message)}`,e}}function YP(e){return fr(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function JP(e){return fr(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}var JN=Oe("net"),QN=Oe("tls"),XP=Oe("http"),XN=Oe("https"),eT=Oe("events"),ez=Oe("assert"),tT=Oe("util");function io(e){var t=this;t.options=e||{},t.proxyOptions=t.options.proxy||{},t.maxSockets=t.options.maxSockets||XP.Agent.defaultMaxSockets,t.requests=[],t.sockets=[],t.on("free",function(r,i,o,s){var a=fg(i,o,s);for(var c=0,l=t.requests.length;c<l;++c){var u=t.requests[c];if(u.host===a.host&&u.port===a.port){t.requests.splice(c,1),u.request.onSocket(r);return}}r.destroy(),t.removeSocket(r)})}tT.inherits(io,eT.EventEmitter);io.prototype.addRequest=function(t,n,r,i){var o=this,s=mg({request:t},o.options,fg(n,r,i));if(o.sockets.length>=this.maxSockets){o.requests.push(s);return}o.createSocket(s,function(a){a.on("free",c),a.on("close",l),a.on("agentRemove",l),t.onSocket(a);function c(){o.emit("free",a,s)}function l(u){o.removeSocket(a),a.removeListener("free",c),a.removeListener("close",l),a.removeListener("agentRemove",l)}})};io.prototype.createSocket=function(t,n){var r=this,i={};r.sockets.push(i);var o=mg({},r.proxyOptions,{method:"CONNECT",path:t.host+":"+t.port,agent:!1,headers:{host:t.host+":"+t.port}});if(t.localAddress)o.localAddress=t.localAddress;if(o.proxyAuth)o.headers=o.headers||{},o.headers["Proxy-Authorization"]="Basic "+new Buffer(o.proxyAuth).toString("base64");Mt("making CONNECT request");var s=r.request(o);s.useChunkedEncodingByDefault=!1,s.once("response",a),s.once("upgrade",c),s.once("connect",l),s.once("error",u),s.end();function a(p){p.upgrade=!0}function c(p,d,h){process.nextTick(function(){l(p,d,h)})}function l(p,d,h){if(s.removeAllListeners(),d.removeAllListeners(),p.statusCode!==200){Mt("tunneling socket could not be established, statusCode=%d",p.statusCode),d.destroy();var f=Error("tunneling socket could not be established, statusCode="+p.statusCode);f.code="ECONNRESET",t.request.emit("error",f),r.removeSocket(i);return}if(h.length>0){Mt("got illegal response body from proxy"),d.destroy();var f=Error("got illegal response body from proxy");f.code="ECONNRESET",t.request.emit("error",f),r.removeSocket(i);return}return Mt("tunneling connection has established"),r.sockets[r.sockets.indexOf(i)]=d,n(d)}function u(p){s.removeAllListeners(),Mt(`tunneling socket could not be established, cause=%s
196
+ `,p.message,p.stack);var d=Error("tunneling socket could not be established, cause="+p.message);d.code="ECONNRESET",t.request.emit("error",d),r.removeSocket(i)}};io.prototype.removeSocket=function(t){var n=this.sockets.indexOf(t);if(n===-1)return;this.sockets.splice(n,1);var r=this.requests.shift();if(r)this.createSocket(r,function(i){r.request.onSocket(i)})};function fg(e,t,n){if(typeof e==="string")return{host:e,port:t,localAddress:n};return e}function mg(e){for(var t=1,n=arguments.length;t<n;++t){var r=arguments[t];if(typeof r==="object"){var i=Object.keys(r);for(var o=0,s=i.length;o<s;++o){var a=i[o];if(r[a]!==void 0)e[a]=r[a]}}}return e}var Mt;if(process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG))Mt=function(){var e=Array.prototype.slice.call(arguments);if(typeof e[0]==="string")e[0]="TUNNEL: "+e[0];else e.unshift("TUNNEL:");console.error.apply(console,e)};else Mt=function(){};var qe;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(qe||(qe={}));var gg;(function(e){e.Accept="accept",e.ContentType="content-type"})(gg||(gg={}));var vg;(function(e){e.ApplicationJson="application/json"})(vg||(vg={}));var sz=[qe.MovedPermanently,qe.ResourceMoved,qe.SeeOther,qe.TemporaryRedirect,qe.PermanentRedirect],az=[qe.BadGateway,qe.ServiceUnavailable,qe.GatewayTimeout];import{EOL as rT}from"os";import{constants as yg,promises as iT}from"fs";var $c=function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(p){s(p)}}function c(u){try{l(r.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})},{access:oT,appendFile:sT,writeFile:aT}=iT,bg="GITHUB_STEP_SUMMARY";class wg{constructor(){this._buffer=""}filePath(){return $c(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let e=process.env[bg];if(!e)throw Error(`Unable to find environment variable for $${bg}. Check if your runtime environment supports job summaries.`);try{yield oT(e,yg.R_OK|yg.W_OK)}catch(t){throw Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}return this._filePath=e,this._filePath})}wrap(e,t,n={}){let r=Object.entries(n).map(([i,o])=>` ${i}="${o}"`).join("");if(!t)return`<${e}${r}>`;return`<${e}${r}>${t}</${e}>`}write(e){return $c(this,void 0,void 0,function*(){let t=!!(e===null||e===void 0?void 0:e.overwrite),n=yield this.filePath();return yield(t?aT:sT)(n,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return $c(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(e,t=!1){return this._buffer+=e,t?this.addEOL():this}addEOL(){return this.addRaw(rT)}addCodeBlock(e,t){let n=Object.assign({},t&&{lang:t}),r=this.wrap("pre",this.wrap("code",e),n);return this.addRaw(r).addEOL()}addList(e,t=!1){let n=t?"ol":"ul",r=e.map((o)=>this.wrap("li",o)).join(""),i=this.wrap(n,r);return this.addRaw(i).addEOL()}addTable(e){let t=e.map((r)=>{let i=r.map((o)=>{if(typeof o==="string")return this.wrap("td",o);let{header:s,data:a,colspan:c,rowspan:l}=o,u=s?"th":"td",p=Object.assign(Object.assign({},c&&{colspan:c}),l&&{rowspan:l});return this.wrap(u,a,p)}).join("");return this.wrap("tr",i)}).join(""),n=this.wrap("table",t);return this.addRaw(n).addEOL()}addDetails(e,t){let n=this.wrap("details",this.wrap("summary",e)+t);return this.addRaw(n).addEOL()}addImage(e,t,n){let{width:r,height:i}=n||{},o=Object.assign(Object.assign({},r&&{width:r}),i&&{height:i}),s=this.wrap("img",null,Object.assign({src:e,alt:t},o));return this.addRaw(s).addEOL()}addHeading(e,t){let n=`h${t}`,r=["h1","h2","h3","h4","h5","h6"].includes(n)?n:"h1",i=this.wrap(r,e);return this.addRaw(i).addEOL()}addSeparator(){let e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){let e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,t){let n=Object.assign({},t&&{cite:t}),r=this.wrap("blockquote",e,n);return this.addRaw(r).addEOL()}addLink(e,t){let n=this.wrap("a",e,{href:t});return this.addRaw(n).addEOL()}}var bz=new wg;import kg from"os";import*as oo from"fs";var{chmod:cT,copyFile:lT,lstat:uT,mkdir:pT,open:kz,readdir:dT,rename:hT,rm:fT,rmdir:xz,stat:mT,symlink:gT,unlink:vT}=oo.promises,yT=process.platform==="win32";var Sz=oo.constants.O_RDONLY;var Ez=process.platform==="win32";var Nz=kg.platform(),zz=kg.arch();var xg;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(xg||(xg={}));function Ac(e){dg("add-mask",{},e)}var Sg=4;var Pc=new Set;function $T(e){if(e.length<Sg)return[];let t=new Set,n=(i)=>{if(i.length>=Sg)t.add(i)};n(e);let r=Buffer.from(e,"utf8");n(r.toString("base64")),n(r.toString("hex")),n(r.toString("hex").toUpperCase()),n(encodeURIComponent(e));for(let i of e.split(/\r?\n/))n(i.trim());return[...t]}function pn(e){for(let t of $T(e)){if(Pc.has(t))continue;if(Pc.add(t),process.env.GITHUB_ACTIONS==="true")Ac(t)}}function dn(e){let t=e;for(let n of[...Pc].sort((r,i)=>i.length-r.length))t=t.split(n).join("***");return t}var hn={codesign:"/usr/bin/codesign",security:"/usr/bin/security",xcrun:"/usr/bin/xcrun",openssl:"/usr/bin/openssl",ditto:"/usr/bin/ditto",git:"/usr/bin/git",hdiutil:"/usr/bin/hdiutil",xattr:"/usr/bin/xattr",plutil:"/usr/bin/plutil",spctl:"/usr/sbin/spctl",gpg:"/usr/bin/gpg",gpgconf:"/usr/bin/gpgconf",rpm:"/usr/bin/rpm",rpmsign:"/usr/bin/rpmsign",rpm2archive:"/usr/bin/rpm2archive","dpkg-deb":"/usr/bin/dpkg-deb",createrepo_c:"/usr/bin/createrepo_c","apt-ftparchive":"/usr/bin/apt-ftparchive"},ET=["/opt/homebrew/bin/gh","/usr/local/bin/gh","/usr/bin/gh"];function OT(e={}){return{PATH:"/usr/bin:/bin",HOME:process.env.HOME??"/tmp",TMPDIR:process.env.RUNNER_TEMP??process.env.TMPDIR??"/tmp",...e}}function CT(e,t=5){return dn(e).split(/\r?\n/).filter((n)=>n.trim()!==""&&!/keychain/i.test(n)).slice(-t).join(" | ")}function Ag(e=ET){let t=e.find((n)=>TT(n));if(!t)throw new v("gh is not installed on this runner","Use a GitHub-hosted runner image, which ships gh.");return t}function $e(e,t,n={}){return j(hn[e],e,t,n)}function j(e,t,n,r={}){return new Promise((i,o)=>{let s=PT(e,n,{env:OT(r.env),cwd:r.cwd,shell:!1,stdio:["pipe","pipe","pipe"]}),a=[],c=[],l=0,u=null,p=(f)=>{u??=f,s.kill("SIGKILL")},d=r.timeoutMs?setTimeout(()=>p(new v(`${t} did not finish in time`,"Re-run the workflow; if it happens again, check the input it read.")),r.timeoutMs):null,h=(f)=>(m)=>{if(l+=m.length,r.maxOutput&&l>r.maxOutput)p(new v(`${t} wrote more output than tapster reads`,"Check the input it read."));else f.push(m)};s.stdout.on("data",h(a)),s.stderr.on("data",h(c)),s.on("error",()=>o(new v(`${t} could not start`,`Check that ${e} exists on this runner.`))),s.on("close",(f)=>{if(d)clearTimeout(d);if(u){o(u);return}let m=Buffer.concat(a),g={code:f??-1,stdout:m.toString("utf8"),stderr:Buffer.concat(c).toString("utf8"),bytes:m};if(g.code!==0&&!r.allowFail){o(new v(`${t} exited with ${g.code}`,CT(g.stderr)||"No error output."));return}i(g)}),s.stdin.end(r.stdin??"")})}var RT=1048576,$g=32,IT=1e5,C=(e)=>new v(`an Info.plist ${e}`,"Rebuild the app; tapster reads XML and binary property lists.");function Pg(e){if(e.length>RT)throw C("is larger than 1 MiB");if(e.subarray(0,8).toString("latin1")==="bplist00")return jT(e);if(e[0]===254||e[0]===255||e[0]===0)throw C("is not UTF-8");let t=e.toString("utf8").replace(/^\ufeff/,""),n=/^\s*<\?xml[^>]*\bencoding\s*=\s*["']([^"']*)["']/.exec(t)?.[1];if(n!==void 0&&!/^utf-?8$/i.test(n))throw C(`declares the encoding ${n}, not UTF-8`);return LT(t)}var NT={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};function zT(e){return e.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-z]+);/g,(t,n)=>{if(n.startsWith("#x"))return String.fromCodePoint(Number.parseInt(n.slice(2),16));if(n.startsWith("#"))return String.fromCodePoint(Number.parseInt(n.slice(1),10));let r=NT[n];if(r===void 0)throw C(`uses an unknown entity ${t}`);return r})}function DT(e){let t=[],n=0;while(n<e.length)if(e.startsWith("<!--",n)){let r=e.indexOf("-->",n+4);if(r===-1)throw C("has an unclosed comment");n=r+3}else if(e.startsWith("<![CDATA[",n)){let r=e.indexOf("]]>",n+9);if(r===-1)throw C("has an unclosed CDATA section");t.push({kind:"text",text:e.slice(n+9,r)}),n=r+3}else if(e.startsWith("<?",n)||e.startsWith("<!",n)){let r=e.indexOf(">",n);if(r===-1)throw C("is not valid XML");n=r+1}else if(e[n]==="<"){let r=e.indexOf(">",n);if(r===-1)throw C("is not valid XML");let i=e.slice(n+1,r).trim(),o=/^(\/)?([A-Za-z]+)(?:\s[^/]*)?(\/)?$/.exec(i);if(!o)throw C("has a tag tapster does not read");t.push({kind:o[1]?"close":o[3]?"empty":"open",name:o[2]}),n=r+1}else{let r=e.indexOf("<",n),i=e.slice(n,r===-1?e.length:r);t.push({kind:"text",text:zT(i)}),n=r===-1?e.length:r}return t}function LT(e){let t=DT(e).filter((u)=>!(u.kind==="text"&&u.text.trim()==="")),n=0,r=()=>t[n++],i=()=>t[n],o=(u)=>{let p="";for(;;){let d=r();if(!d)throw C(`has an unclosed <${u}>`);if(d.kind==="text")p+=d.text;else if(d.kind==="close"&&d.name===u)return p;else throw C(`has markup inside <${u}>`)}},s=(u)=>{if(u>$g)throw C("is nested too deeply");let p=r();if(!p||p.kind==="text"||p.kind==="close")throw C("is missing a value");if(p.kind==="empty"){if(p.name==="true")return!0;if(p.name==="false")return!1;if(p.name==="string")return"";if(p.name==="dict")return{};if(p.name==="array")return[];if(p.name==="data")return Buffer.alloc(0);throw C(`has an unknown <${p.name}/>`)}switch(p.name){case"string":return o("string");case"integer":{let d=o("integer").trim();if(!/^[+-]?\d{1,15}$/.test(d))throw C("has an integer tapster does not read");return Number(d)}case"real":{let d=Number(o("real").trim());if(!Number.isFinite(d))throw C("has an invalid real");return d}case"date":{let d=new Date(o("date").trim());if(Number.isNaN(d.getTime()))throw C("has an invalid date");return d}case"data":return Buffer.from(o("data").replace(/\s+/g,""),"base64");case"array":{let d=[];for(;;){let h=i();if(h?.kind==="close"&&h.name==="array")return n++,d;d.push(s(u+1))}}case"dict":{let d={};for(;;){let h=r();if(h?.kind==="close"&&h.name==="dict")return d;if(h?.kind!=="open"||h.name!=="key")throw C("has a dict entry without a key");let f=o("key");if(Object.hasOwn(d,f))throw C(`lists the key ${f} twice`);Object.defineProperty(d,f,{value:s(u+1),enumerable:!0,writable:!0,configurable:!0})}}default:throw C(`has an unknown <${p.name}>`)}},a=r();if(!a||a.kind!=="open"||a.name!=="plist")throw C("does not start with <plist>");let c=s(1),l=r();if(!l||l.kind!=="close"||l.name!=="plist"||n!==t.length)throw C("has content after its value");return c}function jT(e){if(e.length<40)throw C("is truncated");let t=e.subarray(e.length-32),n=t[6],r=t[7],i=Number(t.readBigUInt64BE(8)),o=Number(t.readBigUInt64BE(16)),s=Number(t.readBigUInt64BE(24));if(![1,2,4,8].includes(n)||![1,2,4,8].includes(r))throw C("has a damaged trailer");if(i<1||o>=i||s<8||s+i*n>e.length-32)throw C("has a damaged offset table");let a=(d,h)=>{if(d+h>e.length-32)throw C("is truncated");let f=h===8?e.readBigUInt64BE(d):BigInt(e.readUIntBE(d,h));if(f>BigInt(Number.MAX_SAFE_INTEGER))throw C("has a number tapster does not read");return Number(f)},c=(d)=>{if(d>=i)throw C("has a reference outside its objects");let h=a(s+d*n,n);if(h<8||h>=s)throw C("has an object outside its body");return h},l=new Set,u=0,p=(d,h)=>{if(h>$g)throw C("is nested too deeply");if(++u>IT)throw C("has too many objects");if(l.has(d))throw C("refers to itself");l.add(d);try{let f=c(d),m=e[f],g=m>>4,w=m&15,x=()=>{if(w!==15)return[w,f+1];let _=e[f+1];if(_>>4!==1)throw C("has a damaged length");let b=1<<(_&15);return[a(f+2,b),f+2+b]};switch(g){case 0:if(m===8)return!1;if(m===9)return!0;throw C("has an object tapster does not read");case 1:{let _=1<<w;if(_===8){if(f+9>e.length-32)throw C("is truncated");let b=e.readBigInt64BE(f+1);if(b>BigInt(Number.MAX_SAFE_INTEGER)||b<BigInt(Number.MIN_SAFE_INTEGER))throw C("has a number tapster does not read");return Number(b)}if(_>8)throw C("has a number tapster does not read");return a(f+1,_)}case 2:{if(w===2)return e.readFloatBE(f+1);if(w===3)return e.readDoubleBE(f+1);throw C("has a real tapster does not read")}case 3:if(m!==51)throw C("has a damaged date");return new Date((978307200+e.readDoubleBE(f+1))*1000);case 4:{let[_,b]=x();if(b+_>s)throw C("is truncated");return Buffer.from(e.subarray(b,b+_))}case 5:{let[_,b]=x();if(b+_>s)throw C("is truncated");return e.subarray(b,b+_).toString("latin1")}case 6:{let[_,b]=x();if(b+_*2>s)throw C("is truncated");let k=Buffer.from(e.subarray(b,b+_*2));return k.swap16(),k.toString("utf16le")}case 10:{let[_,b]=x();if(b+_*r>s)throw C("is truncated");return Array.from({length:_},(k,S)=>p(a(b+S*r,r),h+1))}case 13:{let[_,b]=x();if(b+2*_*r>s)throw C("is truncated");let k={};for(let S=0;S<_;S++){let O=p(a(b+S*r,r),h+1);if(typeof O!=="string")throw C("has a dict key that is not a string");if(Object.hasOwn(k,O))throw C(`lists the key ${O} twice`);Object.defineProperty(k,O,{value:p(a(b+(_+S)*r,r),h+1),enumerable:!0,writable:!0,configurable:!0})}return k}default:throw C("has an object tapster does not read")}}finally{l.delete(d)}};return p(o,1)}var so=[{actor_id:5,actor_type:"RepositoryRole",bypass_mode:"always"}],MT={actor_id:null,actor_type:"DeployKey",bypass_mode:"always"},Tc={name:"tapster tags",target:"tag",enforcement:"active",bypass_actors:so,conditions:{ref_name:{include:["~ALL"],exclude:[]}},rules:[{type:"creation"},{type:"update"},{type:"deletion"}]},Ec={name:"tapster branches",target:"branch",enforcement:"active",bypass_actors:so,conditions:{ref_name:{include:["~ALL"],exclude:[]}},rules:[{type:"creation"},{type:"update"},{type:"deletion"},{type:"non_fast_forward"}]},ao="refs/heads/dependabot/**";function UT(e,t=!1){let n=e?[...so,MT]:so,r={ref_name:{include:["~ALL"],exclude:t?[ao]:[]}};return[{...Tc,bypass_actors:n},{...Ec,bypass_actors:n,conditions:r}]}function Tg(e,t){if(t==="app")return e.current_user_can_bypass!=="never";return(e.bypass_actors??[]).some((n)=>!(n.actor_type==="DeployKey"||n.actor_type==="RepositoryRole"&&n.actor_id===5))}async function Eg(e,t,n,r,i,o){let s;try{s=await e.json("GET",`/repos/${t}/rulesets?targets=${n}`)}catch(h){if(h instanceof R&&(h.status===403||h.status===404))return{problems:["GitHub offers no rulesets on this repository; private repositories need a paid plan for them"],ok:!1};throw h}let a=await Promise.all(s.filter((h)=>h.target===n&&h.enforcement==="active").map((h)=>e.json("GET",`/repos/${t}/rulesets/${h.id}`)));if(a.length===0)return{problems:[`no active ${n} ruleset protects every ${n}`],ok:!1};let c=n==="branch"&&o?[ao]:[],l=a.filter((h)=>(h.conditions?.ref_name?.include??[]).includes("~ALL")&&(h.conditions?.ref_name?.exclude??[]).every((f)=>c.includes(f)));if(l.length===0)return{problems:[`no active ${n} ruleset covers every ${n} (~ALL) without exclusions`],ok:!1};let u=l.filter((h)=>Tg(h,i)).map((h)=>`the App or another actor can bypass ${h.name}`),p=new Set(l.filter((h)=>!Tg(h,i)).flatMap((h)=>(h.rules??[]).map((f)=>f.type))),d=r.filter((h)=>!p.has(h));if(d.length)u.push(`the ${n} rulesets do not restrict ${d.join(", ")}`);return{problems:u,ok:u.length===0}}async function Og(e,t,n,r,i=!1){let o=await Eg(e,t,"tag",Tc.rules.map((a)=>a.type),r,!1),s=await Eg(e,t,"branch",Ec.rules.map((a)=>a.type),r,i);if(s.ok){let a=new Set((await e.json("GET",`/repos/${t}/rules/branches/${encodeURIComponent(n)}`)).map((c)=>c.type));if(!["update","deletion","non_fast_forward"].every((c)=>a.has(c)))s.problems.push("GitHub does not enforce rulesets on this repository; private repositories need a paid plan for them")}return{tag:o.problems,branch:s.problems}}async function mr(e,t,n,r,i=!1){let o=await Og(e,t,n,r,i);return[...o.tag,...o.branch]}async function Cg(e,t,n,r=!1,i=!1){let o;try{o=await e.json("GET",`/repos/${t}/rulesets`)}catch(f){if(f instanceof R&&(f.status===403||f.status===404))return{status:"unavailable",deployKeys:r,dependabot:i};throw f}let s=await Promise.all(o.filter((f)=>f.name===Tc.name||f.name===Ec.name).map((f)=>e.json("GET",`/repos/${t}/rulesets/${f.id}`))),a=r||s.some((f)=>(f.bypass_actors??[]).some((m)=>m.actor_type==="DeployKey")),c=i||s.some((f)=>(f.conditions?.ref_name?.exclude??[]).includes(ao)),l=(f)=>({status:f,deployKeys:a,dependabot:c}),u=await Og(e,t,n,"admin",c);if(u.tag.concat(u.branch).some((f)=>f.includes("offers no rulesets")))return l("unavailable");let p=a!==s.some((f)=>(f.bypass_actors??[]).some((m)=>m.actor_type==="DeployKey"))||c!==s.some((f)=>(f.conditions?.ref_name?.exclude??[]).includes(ao));if(u.tag.length+u.branch.length===0&&!p)return l("exists");let[d,h]=UT(a,c);try{for(let[f,m]of[[d,u.tag],[h,u.branch]]){if(m.length===0&&!p)continue;let g=o.find((w)=>w.name===f.name);if(g)await e.json("PUT",`/repos/${t}/rulesets/${g.id}`,f);else await e.json("POST",`/repos/${t}/rulesets`,f)}}catch(f){if(f instanceof R&&(f.status===403||f.status===422))return l("unavailable");throw f}return l((await mr(e,t,n,"admin",c)).length===0?"created":"unavailable")}import{createPrivateKey as mE}from"crypto";import{spawn as gE}from"child_process";import{existsSync as Wg,readFileSync as vE}from"fs";import{writeFile as yr}from"fs/promises";import{delimiter as Mc,join as Ke}from"path";var ZT={401:"Your GitHub sign-in was rejected; run gh auth login again.",403:"Your account may not do this here; check that you own the repository, then run gh auth refresh to renew the sign-in.",404:"Not found or not visible to your gh sign-in; check the name and run gh auth status.",409:"GitHub reported a conflict; run the command again.",422:"GitHub rejected the request."},GT={401:"The credential was rejected; rotate it with tapster init --rotate.",403:"Access denied: check the App's permissions and that it is installed on this repository.",404:"Not found. The App may not be installed on this repository.",409:"GitHub reported a conflict; the next run retries.",422:"GitHub rejected the request."};function Oc(e){try{return new URL(e).pathname}catch{return"(url)"}}class pe{token;fetchImpl;sleep;who;constructor(e,t=fetch,n=(i)=>new Promise((o)=>setTimeout(o,i)),r="app"){this.token=e;this.fetchImpl=t;this.sleep=n;this.who=r}async request(e,t,n={}){let r=t.startsWith("https://")?t:`https://api.github.com${t}`,i={Accept:n.accept??"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":"tapster"};if(n.auth!==!1)i.Authorization=`Bearer ${this.token}`;if(n.contentType)i["Content-Type"]=n.contentType;else if(n.body!==void 0)i["Content-Type"]="application/json";let o=n.raw??(n.body!==void 0?JSON.stringify(n.body):void 0);for(let s=0;;s++){let a;try{a=await this.fetchImpl(r,{method:e,headers:i,body:o,redirect:"manual"})}catch{if(s<4){await this.sleep(1000*2**s);continue}throw new R(`GitHub ${e} ${Oc(r)}: network error`,"GitHub did not answer; the next run retries.",0)}if((a.status>=500||a.status===429)&&s<4){await this.sleep(1000*2**s);continue}if(a.status>=400){await a.body?.cancel();let c=this.who==="user"?ZT:GT;throw new R(`GitHub ${e} ${Oc(r)} returned ${a.status}`,c[a.status]??(this.who==="user"?"Try again in a moment.":"The next run retries."),a.status)}return a}}async json(e,t,n){let r=await this.request(e,t,n===void 0?{}:{body:n});for(let i=0;r.status>=300&&r.status<400;i++){let o=r.headers.get("location"),s=null;try{s=o?new URL(o):null}catch{s=null}if(i>=3||!s||s.protocol!=="https:"||s.host!=="api.github.com")throw new R(`GitHub ${e} ${Oc(t)} moved somewhere tapster does not follow`,"Update the repository name in tapster.yml.",r.status);r=await this.request(e,s.toString(),n===void 0?{}:{body:n})}if(r.status===204)return;return await r.json()}async listReleases(e){let t=[];for(let n=1;n<=10;n++){let r=await this.json("GET",`/repos/${e}/releases?per_page=100&page=${n}`);if(t.push(...r),r.length<100)break}return t}getRelease=(e,t)=>this.json("GET",`/repos/${e}/releases/${t}`);getRepo=(e)=>this.json("GET",`/repos/${e}`);async downloadAsset(e,t){let n=await this.request("GET",`/repos/${e}/releases/assets/${t}`,{accept:"application/octet-stream"});if(n.status>=300&&n.status<400){let r=n.headers.get("location");if(!r)throw new R(`GitHub sent a redirect without a location for asset ${t}`,"The next run retries.",n.status);let i=await this.request("GET",r,{auth:!1,accept:"application/octet-stream"});return Buffer.from(await i.arrayBuffer())}return Buffer.from(await n.arrayBuffer())}async uploadAsset(e,t,n){let r=e.upload_url.replace(/\{.*\}$/,"");return await(await this.request("POST",`${r}?name=${encodeURIComponent(t)}`,{raw:n,contentType:"application/octet-stream"})).json()}deleteAsset=(e,t)=>this.request("DELETE",`/repos/${e}/releases/assets/${t}`).then(()=>{return});renameAsset=(e,t,n)=>this.json("PATCH",`/repos/${e}/releases/assets/${t}`,{name:n});updateRelease=(e,t,n,r)=>this.json("PATCH",`/repos/${e}/releases/${t}`,{...r,tag_name:n})}import{createSign as qT}from"crypto";var Rg=(e)=>Buffer.from(e).toString("base64url");function Be(e,t,n=Date.now()){let r=Math.floor(n/1000)-60,i=Rg(JSON.stringify({alg:"RS256",typ:"JWT"})),o=Rg(JSON.stringify({iat:r,exp:r+540,iss:e})),s=qT("RSA-SHA256").update(`${i}.${o}`).sign(t).toString("base64url"),a=`${i}.${o}.${s}`;return pn(a),a}async function Ig(e,t,n,r){let i=new pe(Be(e,t),r),o;try{o=await i.json("GET",`/users/${n}/installation`)}catch(c){if(c instanceof R&&c.status===404)return null;throw c}let{token:s}=await i.json("POST",`/app/installations/${o.id}/access_tokens`,{permissions:{metadata:"read"}});pn(s);let a=new pe(s,r);try{let c=[];for(let l=1;l<=10;l++){let u=await a.json("GET",`/installation/repositories?per_page=100&page=${l}`);if(c.push(...u.repositories.map((p)=>p.full_name)),u.repositories.length<100)return c}throw new v("the App is installed on more than 1000 repositories","Install it only on the projects tapster.yml lists.")}finally{await a.request("DELETE","/installation/token").catch(()=>{return})}}var Ng=`- name: Ring the tapster hub
197
197
  if: \${{ vars.TAPSTER_DOORBELL != '' }}
198
198
  continue-on-error: true
199
199
  env: { DOORBELL: "\${{ vars.TAPSTER_DOORBELL }}" }
@@ -202,7 +202,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
202
202
  token=$(curl -fsS -G --data-urlencode "audience=$DOORBELL" -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r .value)
203
203
  echo "::add-mask::$token"
204
204
  curl -fsS -X POST -H "Authorization: Bearer $token" "$DOORBELL"
205
- `;var jh=`{
205
+ `;var zg=`{
206
206
  "lockfileVersion": 2,
207
207
  "configVersion": 1,
208
208
  "workspaces": {
@@ -396,7 +396,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
396
396
  "youch-core": ["youch-core@0.3.3", "", { "dependencies": { "@poppinss/exception": "^1.2.2", "error-stack-parser-es": "^1.0.5" } }, "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA=="],
397
397
  }
398
398
  }
399
- `;var Uh={private:!0,devDependencies:{wrangler:"4.151.1"}};var rP=`export class DoorbellError extends Error {
399
+ `;var Dg={private:!0,devDependencies:{wrangler:"4.151.1"}};var WT=`export class DoorbellError extends Error {
400
400
  constructor(
401
401
  readonly status: 401 | 409 | 502,
402
402
  readonly reason: string,
@@ -492,7 +492,7 @@ export async function verifyOidc(token: string, origin: string, ownerId: string,
492
492
  if (!(exp >= now - SKEW) || !(nbf <= now + SKEW) || !(iat <= now + SKEW) || !(exp - iat <= 3600)) throw refuse("token time is off");
493
493
  return c;
494
494
  }
495
- `;var sP=`import { DoorbellError, type KeySource, jwksSource, verifyOidc } from "./jwt";
495
+ `;var YT=`import { DoorbellError, type KeySource, jwksSource, verifyOidc } from "./jwt";
496
496
 
497
497
  export type Env = { APP_ID: string; INSTALLATION_ID: string; HUB: string; HUB_ID: string; OWNER_ID: string; INTERVAL?: string; APP_KEY: string };
498
498
 
@@ -598,13 +598,116 @@ export default {
598
598
  ctx.waitUntil(tick(env, boundFetch, Math.floor(Date.now() / 1000), (line) => console.log(line)));
599
599
  },
600
600
  };
601
- `;import{randomBytes as oP}from"crypto";import{createServer as iP}from"http";function vt(e){console.log(` ${e}`),C(process.platform==="darwin"?"/usr/bin/open":"/usr/bin/xdg-open","open",[e],{allowFail:!0}).catch(()=>{return})}async function _s(e,t){let r=oP(16).toString("hex"),n=await new Promise((o,i)=>{let a=iP((c,u)=>{let l=new URL(c.url??"/","http://127.0.0.1");if(l.pathname==="/start"){let f=JSON.stringify(e(`http://127.0.0.1:${a.address().port}/callback`)).replaceAll('"',"&quot;");u.writeHead(200,{"content-type":"text/html"}),u.end(`<form id="f" method="post" action="https://github.com/settings/apps/new?state=${r}"><input type="hidden" name="manifest" value="${f}"></form><script>document.getElementById("f").submit()</script>`);return}if(l.pathname==="/callback"){if(u.writeHead(200,{"content-type":"text/plain"}),u.end("tapster: the App was created. You can close this tab."),a.close(),l.searchParams.get("state")!==r)i(new y("the App creation answer did not match","Run tapster init again."));else o(l.searchParams.get("code")??"");return}u.writeHead(404).end()});a.listen(0,"127.0.0.1",()=>{let c=a.address().port;console.log(`Opening GitHub to create ${t}. Click "Create GitHub App".`),vt(`http://127.0.0.1:${c}/start`)})}),s=await fetch(`https://api.github.com/app-manifests/${n}/conversions`,{method:"POST",headers:{Accept:"application/vnd.github+json"}});if(!s.ok)throw new y(`GitHub did not convert the App (status ${s.status})`,"Run tapster init again within an hour of creating the App.");return await s.json()}var Lr=()=>({HOME:process.env.HOME??"/tmp",...process.env.GH_CONFIG_DIR?{GH_CONFIG_DIR:process.env.GH_CONFIG_DIR}:{},GH_PROMPT_DISABLED:"1"});function Dr(e){try{return $h(e)}catch{throw new y("the GitHub CLI (gh) is not installed","Install it (brew install gh, or see https://cli.github.com), sign in with gh auth login, then run this again.")}}async function Bt(){let e=await C(Dr(),"gh",["auth","token"],{env:Lr(),allowFail:!0}),t=e.stdout.trim();if(e.code!==0||!t)throw new y("gh is not signed in","Run gh auth login, then try again.");return new Oe(t,fetch,void 0,"user")}async function Kt(e=process.cwd()){let t=(await Te("git",["-C",e,"remote","get-url","origin"],{allowFail:!0})).stdout.trim(),r=/github\.com[:/]([A-Za-z0-9-]+\/[A-Za-z0-9._-]+?)(?:\.git)?$/.exec(t);if(!r)throw new y("this folder is not a clone of a GitHub repository","Run tapster inside a clone (git remote origin on github.com).");return r[1]}async function ee(e,t,r,n="tapster"){await C(Dr(),"gh",["secret","set",t,"--env",n,"--repo",e],{env:Lr(),stdin:r})}async function Ie(e,t,r){await C(Dr(),"gh",["variable","set",t,"--env","tapster","--repo",e,"--body",r],{env:Lr()})}async function vs(e,t,r){await C(Dr(),"gh",["variable","set",t,"--repo",e,"--body",r],{env:Lr()})}async function Zh(e,t,r="tapster"){await C(Dr(),"gh",["secret","delete",t,"--env",r,"--repo",e],{env:Lr()})}async function ks(e,t={}){let{timeoutMs:r=600000,intervalMs:n=3000,sleep:s=(a)=>new Promise((c)=>setTimeout(c,a)),now:o=Date.now}=t,i=o()+r;for(;;){let a=await e();if(a!==null)return a;if(o()+n>i)return null;await s(n)}}import{createInterface as aP}from"readline";function te(e,t=!1){return new Promise((r)=>{let n=aP({input:process.stdin,output:process.stdout,terminal:!0});if(t)n._writeToOutput=(s)=>{if(s.includes(e))process.stdout.write(e)};n.question(e,(s)=>{if(n.close(),t)process.stdout.write(`
602
- `);r(s.trim())})})}import{mkdtempSync as cP,rmSync as uP}from"fs";import{tmpdir as lP}from"os";import{join as pP}from"path";var ra=new Set;function Ft(e){let t=cP(pP(lP(),e));return ra.add(t),t}function rt(e){uP(e,{recursive:!0,force:!0}),ra.delete(e)}function fP(){for(let e of[...ra])rt(e)}process.on("SIGINT",()=>{fP(),process.exit(130)});function na(e){if(Number.isInteger(e)&&e>=5&&e<60&&60%e===0)return`7-59/${e} * * * *`;if(e===60)return"7 * * * *";let t=e/60;if(Number.isInteger(t)&&t>1&&t<=24&&24%t===0)return`7 */${t} * * *`;throw new y(`${e} minutes is not an interval tapster can schedule`,"Use 5, 10, 15, 20 or 30 minutes, or 60 minutes times a divisor of 24.")}function Gt(e){let t=X(e)?.on?.schedule?.[0]?.cron;if(!t)return null;let r=/^7-59\/(\d+) \* \* \* \*$/.exec(t)??null;if(r)return Number(r[1]);if(t==="7 * * * *")return 60;let n=/^7 \*\/(\d+) \* \* \*$/.exec(t);return n?Number(n[1])*60:null}function Mh(e){if(e<60)return`*/${e} * * * *`;return e===60?"0 * * * *":`0 */${e/60} * * *`}var qh=(e)=>e.default,Zr=(e)=>Dh.trimEnd().split(`
601
+ `;import{randomBytes as eE}from"crypto";var fn="data:image/webp;base64,UklGRowIAABXRUJQVlA4WAoAAAAQAAAAXwAAXwAAQUxQSPUAAAARd6C2kaQ2+x7vCYnIICICUE9IY/s3w78ZkGLbVh2dZmbmVpD6MjIiCTEQCX+UMflABQ1TlBDm5F0TH6r+FtAV0f8JUPhr6ctZgp16el3x80tL/O0qVsEZsHMdw1sZ8m8jampQP6Jm2LuQ0wWnuRaoGngvMCX5kjxDb0ifrEdpwirq1LE6azmDb7VpBwNaakTLzGjlBa25ov05Wsf+PexonRXtb0FrzmjlES0zoKXatIMcbevUsTprmrCK0ifrUfJYG5KmJF+SqqS9wOmC01wLqMa5U/iU4ivSWzH+NqJUcITOteLml8m9XSn+a+nLJdGpp9cVDgBWUDggcAcAAJAgAJ0BKmAAYAA+UR6NRKOhoRY9tXQ4BQS1AzgGCB/ee/5/8jPwz+bO5P5nkZD2ds843bX+Yj9kf2Z93z0U+gB0iPoAdKF+7v7Ye2RWO+UP077gbq9qQdr/7Thr+EWT3fpuZ8LGkp0APFRz2/VPsD/rf1s/SAQZ5oTHtl5+vGqupge+ws2FsPRaD62UdfItG+n1jDbxzytDaxkYsfS4x8lyBJig6aGlb22hCpshcpjipYUza1imkCH7/l2ZjIFhBOTUiHjNyQuxrYQXfSzMNW1qzW+dlsu1I6MDyqqn7zU4iamwVEUEZv5FyU7p6Vd3Pt5gooS7O2sYSecahovpLIhR64hfvZcljfG+tM8AAP70trGbK//s2rvZwfoB//09wZcz+Cfcx4XrAXrpQJ6C6jE5BgpOcnxZ94NNLPUOQ4HzkpZyLh3++badZ9IidhzLX4r2n8RmqVxYLMZCsUfCsBh4gaG52xAAJ4KN2H4DdWmH2DbIYA3oQzXK9Osexvr9qYEMv8qPWnBnq8nAuaL7WKQ187LR/6cONyjd9mVdTUP16wap5lgEINV1rSgcICC0OkPfqub61tJlCjn8uh0cXVNKOSx8W9AeuB9dFZSMBJa++eYv+YTIYyGHTpI04pjOpIDq3AOqPYESwBhWE9A42ImX8x6VtXYVOmwv8lW41Vgj09tdrrcZW1DZvWWGvOoIuk/rgKYrNbIx3qS48b+WBGqI50gCeoBcvIxNGUXBgfHz5rvFiKgBBT9jJzd8QC104TXXDX3YslDeVhutM/CEVJ7qO9mLcA0YwRhtkjMiOen7bo9hTRao1/KGhCsS/e4tYJMdRJjNYKsZ+Kp540o7pJM7zIhx5E+BN2oZjElAPt8O6koCFZsFT8W+Y2SvoBneW9Vk9O/6mQz4bmauo8KWSyQNUCGAIWMsE7iWA+kt4RsWAl+gw0V+01q5W5TI4PA2Kx8juMUKTsPInerJyWvSZcNxVLwG3+5dbicBchRRlYSKukU2Jp4ZVDe7I2fnLJ+UIOEomr9p+CBlPQARIxKHmaXm5V9a0+m7Cw/kpNojQus6JnAg86e/ianKAk5BhIisTy0pyIjUrBya7MJDsZH/v/DaPm7QFNK9hgzybPRJEY6KuL7bwQHVQ0jcboqu/tQvI+mhsDNz2K2tNCNOcMCA8HWf+pwu0GaQgSajBefemZ6reFjnoc1LBgmrFHFyyflxua7ool5jW9/r9hjxKVxHxs3o3F5Kc+vV/mdHDj50DHL+9duz30i+Jf82JCXGMbp7+FjGKhzcGyarYjXbiPFFl1Be4iW8OEVyWe7H241eXMl/qp5y5Q8B2dBYymhibQNm5UPgyzuM155RLLPrnrnc3xSPFbqv9fl7j5bSrdzwBZ8DjnI0dcr5UDCNGGZkglw5FB2rgioiB7jYrrnPfGrfuvrsAH0GodU+o0erjag24oZX6Sam8/LPLY8EiCVWAQMG6r5sTCO/idTDXTuMcAkBgzVgphSyUmDTduYey7e2NtCgoWS5wdflZstX4FceW4AVoWWuAOU+xs1jI9C7yCqQ+IMHeJjmB1qFaBGy4z14f5Y7tK6u57xfo7bCBu61laMUi+5mBj4Ba3kuu6YrskddXtCDx9z9cvgNTjJDgKdfDk/df4MCI49ZGVmOeTQ0Z9tt09gfxHuqiGCGmKYZzmeaA7dy2dHc8VbIAbfp0JKwq3RDugIs0J6AdPhFmM84ci3/NV0xDACfDfZcd8t3is54tH+5YGhIGswMHwYGo8VAHM8p+ORY7zU0zJdhF1/y8xEsp/hNm7ukLLZZN9qKY7OAX9uQCc0Ww0j8lEJMgBsUlMy8r7gBif1ipeFRE//+P9zTMtS9Qonr/60Dp8R3/quzj4Jslgk92itTQdNH3iPVCLA2aJT1L8cKf3ft1LyBsKJI4RPDrV9i5v+Ym9+CltyZq3JKlFVgAfrb3dawijRMdvj1x1y73VR6gzLFjyVv/sOtb6b+6K2JGHmnVIRmaw51s8qg9s1KxNdYetYQfGuG/0+M4ZqdGRzuDFTnoNmUz2QPjkXnF3cyguivLl3y+Lm+BmR5j1Ya1Uj0govN2frgHKjQjvWj5wwZFPFbyruAplSrHUAJQNqXZK6RQSpUOSi6JOGoXak2pTlPbQWayU3Ktn4HKXn0jW/HJxX7y9aHwuukGIVKGOzEVBTiB5HQ4hxfL+DZsNeViPXYmYJcQwZc01C/kXkVBxWpOy9Trs66Tr6k5aHmVSdHO8adOlCg2wEgbzREaX+7VfDTl0nI2YIN8w6KkwupCrkbBsPrWtkCYBeuEGFmKeZnf7KhveiRPinbtnmNAPcln00zDbiLs2Lbe6G0BMvfZIoORkHFoAzgqMYpHtMB1Vwrm+QYFcoOcQumhppN8dnidf78TWLer4Zf9DfMfVIyuMon+1lbhH5hDoSNQ/ChJH4bArnAZL9ODY8B/r4neoNTwEuZHNzVoqV/hRvSZYzs9bvRFMFdllnZXDFpCFvyJ8jdJ1PspW7B9XIilKsDMBmPs0BL3rPoQErXAAAA",co="data:image/webp;base64,UklGRqQeAABXRUJQVlA4WAoAAAAQAAAAZwEAZwEAQUxQSJgDAAARCjqybbuNqweiGkj0jbyUOvIbuQgxC1GnzGRYmAFTRsiRcQCs4jQ4gs45CPkYKateQAfzIJxvcd69ETEBdGN4ezzN8vV297Hc256opey4zrPp+HZofgxvvcg2X2zPpcqLW912O12VvjfrKpVuGk2W323vVuGoY4LfC9vbC2F3PFjYnq/SCUGytQBkErjualZaEOqMLosyC0WJXBW+tXB8K05K9xaQmrrnyY0HJZ+4Jc4tMDV2SGLBmbgiKiw8i8gJk9ICVOmAuQXpvG3xxsJU41Y9/miBKmzRGw9Wtubaw5UtyTxgpRULD1ltwdKDVhonHrbSMPXA1UZlHrrSoGsPXjbmjYcvG/LYA5iNiD8iSOImbCyEtQFzC+J5bRMLY9YUlTjSqJ7CArmoJbFQTmqILZjj6nI0aWVPPJxZ1Q2eWFHqAa2VhHtEqVTx1kL6bQWRBXV0WYYquejKw5qXzHClFwQlrpTnJRbYyXlbZPGsBx7acs4CW3pG4MHNU7+jS04V6CpOjCy8R8cm+OKxJb7k2Hd86ZHbHuBykCJMD1YI04MSYUryloe4kC8wRsMMY0JuMKbkF4zRhB7kchtlMkaZTlE2zVAmOcp0jbL1FmXcoWz3EWVSokz3KFM/+H/w/+D/wf+D/wf/D/4f/D/4f/D/4P/B/4P/B/8P/h/8P/j/vz8VZVqiTAVlskPZjijjGmXrHGWaoUymKJuOUaa3USYhysR8wRgNNxhTMsOYkC8wRsNbGBOSJcKUJFcI04MUYXpwG2FywO/4Uh5d4kuOTfDFYyN8jY6xQFfBk7+jS04F6OIpLrClPPMBtuQcbpFFc3aCrOS8oMSV8jzOcKW88ApXvIQZqoQXR6iKLuNbTL1lheEeUSpVMEWUstobPNFU/ARPrIo5mpSVx2iKq2OCpYR1FkgqWGtU4kijejjBEU3dcxTNWf8GQ8oGxh8RJHET+BhBNM18gx+apl6jh6a5GXaETV4gR9nsJW6ETRfUCJuvmFG2MUOMsJ3XeKFp6xu00LT38UekCE2b4w1ONGbL5yiZs/2TEiFK48KowEcR0ZEJOhK6M86RoTGd+uQGFXxinJvuEaEpXRy+xcNboaOjDAsS0eFXsxIFOqNxfJBsEcAkMF34YNH3VNiZwe9FfyuEpltHk+X3/qXCkenk2+mq7E+6SoWdfutFtvnSd6jy4pb5MQxvj6dZvt7uPpb7vqCl7LjOs+n4dmjcCFZQOCDmGgAAcJcAnQEqaAFoAT5tNpdIpCMiJCSTCSiADYllbvGALXqNzACijUqXk0Wm07e87qnWF6f+984PYvmk9K+b//r+rP9QewR+svT38zfnJf8D9pPfJ/efUW/uP/A61L0C/259PP2bv7Z/3PSV1QExq6YwCPafC5D75RP1Yx6HiO+79g+wl0uRn7uwevJYFxyd1XE1Edf/cXmY5/8ym/s587lniL9JNao71PqB5+xWOr/uWkKE+nwMaqRAi7A0ipKx5/+u2Hm94uGHewwoqtCl0y05kqKuh83e7SfxJbG0Aj/Wy7LpU++ISqGq4Do0GbhDXrBmB85VuaoIiAP1xOB3XymwbUtosSjGUIBbz9zuHaLckWg3/bi+f9df6XMS16utmeYrmibH/G01byjmU6uYJOKo2ibNUDw5lbSFjYNXmZrdpchl4MVzaapq4/8Aa65QcN/S12ZpsHAQZFy9IvroCMnlngOHbk/2xf3IqwNxAB3JJhybP8SxKWzK4oYeoR8HPZnFv85VWoRdnFoAd1VELS2Uz/sF+MyS+XWWqagqRmDTMj8knJ5kVayI43AYXdS2UVfc5bcmYM454t7d9GX/B4tUtAKq8YSgjhp/1wTaUSlufJssPKqJkle6MTpbsbP6ADWsxN0VHpk6mhBsDFoLTzfZaR5cx4TNMzUDrM9BIbfwWYgHfwXvyp+laVH8Af2JQQXSfM0GZi53BDDwRRcLHZVJ7eMbygvSEWE2sMwon162McjwZ5wHCajEFotQGwigvo+3s7rOhKCFimFUvAZkzJHrUbrnkYXBEaxPtsE+ASgr2oNVJkDSkroX7zNrPeIPgPNnKfs2kDE8qRY++QoEc0Uhqe7hYXpT4SiLkuzIj5d4WTGaAQ0nkn0GuE1TV84efp2GHE8vjisdShkoYq/0U+S1Kk08ACZssJSN7Of/50d0R9AfuVQSef+33m4Ggr/jNhD4Jq+N2RYtYW8lFWLYZhxGdwB+uCoREi7HpgZB51XX3Teg1QcPU5hBl6XkmYQbFP62076Wgw/vUvWx35HxVkXd17dPFIytFirK7p7J+b+4//9FPp5hvlifDzunBXZV6UxFVnGySwZTAnWf6YjLzzCD0TeWAhKmHIjfj/45O/uCJ05Rp9Ow9JUzXX4clTMVLf0kTC1EN5BWljFNkrXBiFyMsEtcEa1BFIit57H7zNONlSaHKB7zbc05sq8s7qSZ2LU1ayQfw/LHEq+NgVG7UEvKtJ5i4QhBlRrFWFC2KA+bfgOVReky7NYoEHgQMS33+noHkwXN38QCQUMYuwALRfsZjSKSl4SDhQ2KbQKBVLtzP64UAeqV3/N3O32i2afo5124BGF73Wc4ZFDz/kWllmg5bNgdVK6RcRKY/BcYHruFe8oq5E9Q0oGqcbcQkLE45PqaHhUAD+shNP/pwFo3HcEwxwzY6FGD1EbFcGTryelZTiIMB3iKfN0oBt4D3WgOaWGXxTYh3H3B1svg3BvHEbpcI7q4mZKX+F5lI5dm4nlM2RyXN33s1yriZiX6fXmOlwio9Lk8M2WT1JufZW2pfSSNIH8Idf1Qssd07F57ZR0Kie3JL84fZ0sTByIIPeKFf1Rg9RG0XPF+CqSZ+vJWsN/VGDT4urQA/u244/8Uj99f5OJR//m9/+WX9zeOEa228N0vEHIkUYZkO5PJm3LqbXtSkDp1LloVr821s3WOuX3voNznIz6pyRXgvbAVCQgC72kaMYHB1AMMlJ14VTDI+sW/uc7TmLba9sZTWI0YjqQg9Gk87qQ7c+9mMi9G645ag1md/EUDuiPQvLdprf0NgjCFtrT4XTn9LPQZEgftBILDARKHFHhHR93d3/5WxNAP3WLcrPQgGWoG7HWC+b426FhKlFESSokD+JQnAwxe83twiAmyR1KGzbDtCMmXJ5ou4FPHKE3dyfVicNPjvmfSYE1RY8lbDtPOwXwR3H/vEz4qGZEJseRlSs6KFoaYXqunYQ3/0fl6D2bVgm1V9Ivg/U0FqvKC4DyDNfg4FjUQqniJxcHXP6T3HbDi+mfLLs4BmE26EMVmDt8+0ifq1fki0v+gx6kBrIONSniKvLZq2Hee+9zHCXLxzpX74+G6oPgOVBzadQFk8vq9YYkGiWBRrBcAx8+n8TQEM7UTZhXxbiR7b3YPMadt/NHRRRDucAm0X2rPL6BHrg96eG8uzdSAyv4Edpt5LOGC8Uf2/nb6wtFuuJ61j6EXv5cF+p2wMxxzkjGHvkXq0wXHRouJFW/J8Cay2b4OwZAHLcohBRifhKW9l6S4WpkSAh4sv2pdGAv2uH4jZ+j658zNHNH7WQvPbvoFjt1H7eBRvSk5CgIzhn/HFH0bXKBZps1UYrRwtDwLAknGRbiuyNxM6azWXZtTfnhGhFlymgwPNDkfZZhRpA28zoBtVmMmvbjicAQtqXGRHpd6ByNZCuWhccLG8fvggZv+Go3MF85oEjI122B6cJ6A4jmG1Nzildm8XvV/c4r6XPQIFgw3QcJQrWRm3yGk29sdvb5zM8dlOFzl0w2ang1qFSG7AbZF+dmerMNDphPBSXoK68D4WtFMJQUuXIk3W5zj/cc/e8OKT6cg0JsQYD5+YlKdOUYPZJS+UjV3UMZhbUwAFJ3Y5zlXE+mqL4Qd0WuzZPROUGytTFgiCA8f61BCYiJWFQirIiKd9kznI3If2Gw682KJfAMPrYYBklLX81Rzwmt9CnaG8f9QLQW+cfE56LYRKfR4fVKxHkPfDXGBEOOUCII7SSnKeqpYlODK2csgjCdiWwkTr1Or4XSFuAW02fS3fct3MCi685wSGCjhDbgythwxZAvsXMKq93fAA3sR6g1w+Xft841GjLX0UDFVJ1uhBTYcjRGENIO8mKM5zhqbD5zrTcF1JDrVOsDgE0zHZKMlumzFynx4jbyZF7dIzZreVgIv8vDQWnBpSK2FcT5yG2Yp/p2U4RMrbG4nE5ZlVHvP2KGl12KisXVe1OOGB/dr37hxCre2iopacuE9d2iLQmU9EQ+BDuD0mWDm3xIfG3uVJAq1GDt/lqx4ei/JA02jlhS75a41lV56Yg/PjdoROL2XfS+TOY8Q9A4D8WG73oiLy5smCLhEzvCjDE4a/eTgbWj5CP/nCSgvZq+N/+8mAzl8NFdbzt3VO6jd2fAZ5F+tncPlmk04NWevzzKI5fbyyrPe67d7Cgv+Pr/dlgIIlacBLzcE/2BCes8lGxnof7j6xkeXHXTUs+YKRlJGq1etQ9e5USMv/eHDCBJAbVQ/PUUyS/e+2Hm6aOdm44YlHxtBUmlf89JauKNYcDSW1HT7SmtTV0D2PIEFR/0CMA8DWK8IxfvQPqNcr/i9/cn8RNekoRp+YDgZlhhwCKuYnv11E+7R/C2xgeOwhUwX+X5DXb3fg20z9OGgwXR4I0iC9NbOmwXeIBqCur/evL9bqrycvEqaS22mTqxg4mWYyJNdU3d5ZolwseCB/9iCLmHAwn/q1+qMDlWrsT5TwLjYmQsjqeWzXZ59OShVaHrJV5CDLyeAkBChkwYAW6YzGn2Ca5tTJh9Q8Ez1U/F1iyGxe7z6xm/CN3jP/Vb+NTO7KYXo1KWyFz6A7pCWj1XeG3XDe+w+6gWBye7U3jjAVAlE91goZ4MdkT21XR45+bWjFvozNmoU8pUm/u48M3IQubdYnoCgNaOhWYPuF5e5iOJMTT0pXFpU05y1JRTm8FtyH6opFNCA34+jl/X67jxkGPiOYf41F70Wi5B5Af3mf6/0GMVqCLtX96qnPe+4R5tP2buUz8jtJLxs36oTazYPSSrC+z7jHwQ0Ek3/TNkPeN53TgdfKzn2PsGQqwjWLjQwNY79FtmjzpfiV3+mMWlc9o5Vyj6qbxcg7pQP3u40jaB7iOf6EzB7e7ehIfnhzBUcbwIdej0Quek5/MnT5sRLA72Opd3HliZLljRmc2EFo/o8W4coXVaYSh1L9JDGEafGJ2MKGywwln2RMfKEZmorTeZzq/AA64leofH2knVdnrIlVyhdL4sgZR7CweKekREo1dHiL/efhmxrmT97J3MjfTHbjAa3+mr2QnYGb0/N8YGbe55csrr/ZTZkwQ0n10nfGYPOkEZAEAyHvYz+V0I46bq1TWWddBhq/MJLU/Exl/14oPvdjI28QuZyiuPn6Bteyzm8UkKhETz9mefl32jM1EsGgT2Njk0Lc+2ItNs39EoaQdh42VAaaHzy6AI0Fg9EAXwXmQwTdBDwC1Vy+k5oyFZUWMPVmBuLqFGlZCK8cYVGUp3hq9wNo9dMgbYWorC7iPMB2+eYNQ+NTSkkZZ4Dr2tE7TbEViNggxc4fkIiRKd/6prcQ+ycE3l9kJgufJ1dlQ4ahhFQzl6NYTk4BGpxTecseDaNqH1U/gsUhkSJZq4M5Az44Qy6YsZ6BWuFvoo5jtsfQNUvFsfUsOqGC72EGlvPvYiJ9W7/EGA2xeisch5LZn+6Qjdk6o1aX6ttNmzX+5aHY/vL52PWdpegrm+bXnnxrhtp5KqY4H7jQbfWKO+aClmbTE/8iL2zU61pEd9jFXk8icHRB4OZO5TvWhj1MgoORytZKT2ZrmA61Qw5jRYK3iYqeOeMkHQz/F7JzSbj2QeJV/uvPhBkjh5C/sfA++4UN3AUdxtS3eaN7CgY2jV2KpH65KvhiveXkkiG7SoqdDSlHNnKK/3HoNtGp1YwboQ8W1z0DOhkwNebHh7RGfwsGqpmnyNPZg4K1chsEdW51VpU6txPpxrjRTYMaYM0ejNofpIUB7Cr7kk9KO5/DZBMn3E6I3HonL4SC/gSNEhovtxZ46qHOVme5z0p87Xnlsp9L45FCBz/AJCTEJ2RytoHRXtmxrRpPBrB2Nawg9ceRE4/cqmMj0MYMxYDWlq/U7hdb6tq4AfEhOLtwLaVEM8h+6qMtz9JGb9FLruC+dX1rftXshZUvNec6hq6iDdPzgAAH3YmgUw9B34eZiHClFQm9OJtp8IQaKaGfV+HFFNYZc7nNTyC4LVMqNCa7PvGy3VbYjWPtNIhsAo1aZkFi4e+aa56UcC4XTW+usgxo31BJs8pTD3FCa3s2un+IG06/AJunrXYeMmEo8wm5L4X8agp49iigav2YGB/FAzmAjgWPxa16KXUx7i0Efc1GFrLJ8eK0ZPzMGRvbfssmOwjh36198MD7ZZZDjSBtB4uV+knbkL4BEsu28RBYxZczPv45c6lwJnhemk3PpYgr5IucEh38P8ILuEHpsKfqhSDeUM/87Ld1xHwzsJDjRxZHJ2OQWRnfKU7w7e3Tp3cvL7hIN0SX1OFZjrRKzUAvVXXq//qq8TXWfubhw+fDR5sxqtanbdut3qmnp7lIy2OGCfS40IJbXZySjLkQFMG87oI5Fhs6UpBPPgg3GyWPQ2/qbqwTi9D5X1uAU4uEwoIUm6ULMrj9FXotlq2Vm7LRABY7WFkcgtV5eOh2tTDy1C7UJBQNoPb9L8hQfYpZoh41Rmebqym3p1GiuofIPmcacqWdq3kiyvQBkMTD6QSYEJAEat0kne6w+1etUlrhUwhPoiUNroG4Blfdc6jpoohobETPZPMj0+morn8BC/reVLacxr902N/eGVQTkknBCMJWwgpnSwk78qkCyWAD10fO+pI8NulWb0QG5TZZfx97pkRhELPV87Kp0E/Uzjon8iK6Hy4F33SGNd9dCLvNrYQ/LV7tzb7H7y0wEBnVHfP98ecnLXWih5dGvuns3OaqHAs4OyWQx1zS+9ZMxni7lAD/hK7GDOmemySF2orKWmmwE1aGEt7DD+Fws/1IkgdG8XYt1fz3S6MgTf4yRFZvCHNfNHlmdyha8hypZT1+76zwc8kPtdUNGZHuwvJ2+mBxtWvfU7z857mcn52CpQUwCSJeA4a1DOYtq0W2/YktKZozrAA+ZWhte76U4J8LkN3ZhB4ZK2YoxHlgO6DPOfTClsaE42hM+GkHC6CsEEuABCs68aNilKdsM048xuEh2AuX/+LWehsL3DnKJfPjqcsod2cdEQPCArWS/UX/3OXgwANBi9smGJAqlSAqxFaLYgfmPdUsYR6G4IWWabfX/1PlVyYowyl+2Zit9s8pUGKnwVvo0x4GTBB6fohn1PO4U3NqK5r3ORCi0Iml3w7JCOlbdwazGHC9BP6uHJA2EHSLCUVS2vtRfuyMFF3Y2Td0EN0xQ3HBLGtJfQDJ4OEyBW3DxRe+jWFz/FgOyoyMegiRh+IV02bptyTgprfj8TASylp87G1nIVzqrLqZTYCxZHNPa0fTFss9L0CaCO35GPvV53HaeUZplvwOQZ9MRs80miIxlc2NHU1TWlWGKfqpbUpldSnVvcKaV6EAqBmvCpIb88NFbKclbeWZkrVSTwAfsG0zzpV1Xfy/6lmRrT4aBmhIEJPnFJMB2dQdZ571m3pvqloVClhUo0+RyntJuGkTWgEmMcrZCI7PtsTxXli9xzAa4OJIDXPmuJKqd2PoyZ9du86z/MbcKUm9F/JOWmO54zs9SNxBPK5uzVbn3Z7BSsPZOnbEb38+j/tRLCe0K9tpgEuLxNtZICCjQvCw0/GWL8wGV1p0UdEFyMV+FISXlG4HzxZxD14IxdncU0tOx7CXHLmYtEHWqyDARYMS5oQ5zAc0QCbXQjQcYSizHmm04qUmPHE//1Ine9gS9OnrMpGBJ/TSgsm6p6rmqlrIr1Qldu5xCBoKVoUWdZu1nSZ2dFp86oyQIQ9cCjr+JSl3jyySxD2k6pr01tkkibk1uxdkKQC3c3tgP2pUDy2lZknkYnBQRtN3RJqR0OqLQHk8b16I0eJhetI54O+utB0/03zpCk1T1LGf4XZe7LVVSUbhzX+UgfSGAss0FhNuTRp5nCpExulVswcCBTi5wDz3UGKMy1deBXoB95ZGIuXNb+x3RDLoJXIaZJ+1SbThtN56kmr0MjIKzncpZRPJ0vhFkhDqRgI7w/7WnPOxa3TQZzdUsTnllf80c/A2xdfWiYwI6v110fl4RrC/P1HFRFTOnKmSzdh+4ig3sUo7Hn9qwtjtoJajNFMyWdxtnbtLp4nolH+GKWHv7Ebi0Sxj4rqyhazDfrmVaUScvHvVCyF6+ftjzV5EElFMWUV+lQ0ixeP/R/n6Cl5MJ7uh2vciXOki+0Fc4Jt/HkrvWety06soCdg67yRyPJtGGk5PT0umfsf6KLCsA6xzNl6Uaygy+odr1tN/+zUkpsH+5gqHt5TI615FTmn/DBP+WJK/3Noy/uS9adMghMSy2maPG1xxEioYZkUgihi6aw+aDS65m4gU/gu+PPn15LbXcPOjmw2V2IghGeP2Z26/A0fnFlkj9WnAPD0LOL+iQNi4KlHSUYM7X8TpKMvBa159loQ2mQKk/1oIPfYcO5dWxwP6w38MHtv9Q6FrW/fzXgIOZGM+1ctu6QiS1GDevnwDiBPpNTfjQ5l3tt4WDxbJ1hyLW4/EXX6vVy+g4bhXqjVpk70k+5opGyzXg9nu3nClgScIhd1Q3SKwhYYSuIhpIsOXh3Z7OE7vV5+satxmDxLtAPUZ/t0LykWGojE9rAKMZEruBqjDHLl4l7z2ZEbBokv3tlwt1q/XP79NQpUpYsrhr3xIJvskZ4yz0olaJ9ABtKf+9LmuWKQ2iccN4LDMYLobykpVZfxXgJvbMfmzJosZ+wvKFQK4zlJAroQ8hywt4raFsCxrDK1lg046X8nUYiPO4k3rm4j3wS4V7fjX+AJY/ErEsaHwyacTo/uYRrxPYsN6GvM9ZO4cJ70kAtjk6+AF+Ch4F0JQpdJ3RX0oMHevLPH0fvqN2zDpEJFh+JrnTIeokmdcSlWzmgffw6UoIbzMiCBr2NB5LTUICNFuUfqdGF+HqORK1zf+PWEhaS4H4c3lY2ciFZ6R6KnbZ69fW3q0+/ut9EnHuCqFjP+9NscRieJ6gLWsHjwc6plBdN8qGEvbzkHAYMA4at29GvTSICnRcfqEvR+dyt/CjRG39ZbweM/8bu+MNOJUpKqz1NXhbRKgI1i4LMqTC1M/JQGBX3BXkXzKJw9TI8QeZpRGmttYkjOGJcGp3dML13H0Yu7uIY9GvsVlsIuAUN4c9BAMtvPstmfKNwPVXdoQVoqQmmDcXtw+oiW45KpszAQRM0BMh8wJHPvK21zEIJvyNzeppRE5tJ+LjZ3uLmfX6bVIkuYhmXa/tW86wCCUW5jvpkkGCm6F/G5ToabUoAJ+RXjIUM0bi/dF7H4OVbtDLyXqbpAw8XhDJGarT5HCsjPVWJ5x3F6NR9RTkWL0rcBAxqDlqakYhnVWnlLMkhppDW8qdCr+soPebafKd+ZQir2TpGhiHa7wiBbQAXDxE/8APNjjwXRPu8uRtMAY8nnIrcAZHNNyqqeOdv7Py4e/Pq9Ga5gq2evXUaThB5q0lWdcNXJQlQ++gljAGLUXxx4KaDFreOMWC3KLJsjbd7j+QY2lh5NUlFMvHfas1dK7hP7fU60xomDs90k7WhzeUruFQC00lUfilioyygNyoT+yhQ1t6CMRNxqfk+XRNwbSRQOnyKiS8dTNoKwk20B4mq4s21X9vJWIfV8KEfRAMIwRyx5zAgsnTsoCn+jQkpD0Y/j22uGfwS7SjZAoRNOU8yv8sgezkZ49CgiAFcdWuBGSH9PCU5N6GON3RtfmnLJIwA4LnxviRGak9yMid04i5t0PVpVF5vBG0WiHQLdjCA9Ui5cDlG3mCc0U/WRdo4pE/eHGpp9V+LQMs89HVGleEYwRVXhR7jPaRiABl5x/f5yInJCz+pF+bRoKuKXbrgdaoprJX2v1QNlYJ5hjKDGTxZ7I71sQb3XbejtP7Uzc9dqwJlqVR1BCJ+OhD+yRRqKpIXyn+bnky2+JO1XRag7Uc9qqFsErYddHYrTQ2+MiXGnTDqWmdWpQ8pSvQvRMmiGqS8GdQBm+TzivYwbETUhImusk6zgz1qpLCgI3uhdx2L2BPfPQJJ4teknHLrRxG8xJk1+TuYEIE/tjjXlxPF1q191ghe4IeBMLXZbrQ5oyGQ8x3pi5FO3YGkSQ1Prr86aQf0gQycLBo+/hqnm0JRzCtkWiA7up0/pAZ/mkJQ8ktMVQJDfC79y1YfoTdkHb9o/FP5D6GilMHIBK/r+DFCk5STDhklv+4ebu1KaJ9VIdfM0cneqLIlQFoBVx1GrOXlDUlqS+lz9eGvIA4Pu711k6Dq8QAAAAA==";var Pe=(e)=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");var JT=`
602
+ :root {
603
+ --page: #f6f5f3; --paper: #ffffff; --ink: #1c1b19; --muted: #6f6b64; --line: #e4e2de; --code: #f3f2ef;
604
+ --orange: #f2891f; --link: #b9560a; --wax: #c8392f; --navy: #26315f;
605
+ --button: #f2891f; --button-hover: #f79a3c; --button-fg: #1c1b19;
606
+ --see: #1f8a55; --see-bg: #e6f6ec; --wait: #8a5a0a; --wait-bg: #fdf4e3; --keys: #2f4bb0; --keys-bg: #edf1fd;
607
+ --warn: #b3261e; --warn-bg: #fdeeec; --note: #6f6b64; --note-bg: #f3f2ef;
608
+ --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
609
+ --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
610
+ color-scheme: light dark;
611
+ }
612
+ @media (prefers-color-scheme: dark) {
613
+ :root {
614
+ --page: #1c1b19; --paper: #252421; --ink: #faf9f7; --muted: #9c9890; --line: #3a3834; --code: #2d2b28;
615
+ --link: #ffb066; --navy: #8a9be6;
616
+ --see: #6fd3a0; --see-bg: #12301f; --wait: #f2b860; --wait-bg: #2e2412; --keys: #9db0ff; --keys-bg: #1d2340;
617
+ --warn: #ff8d84; --warn-bg: #3a1b18; --note: #9c9890; --note-bg: #2d2b28;
618
+ }
619
+ }
620
+ * { box-sizing: border-box; }
621
+ html { -webkit-text-size-adjust: 100%; }
622
+ body { margin: 0; background: var(--page); color: var(--ink); font: 400 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
623
+ a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
624
+ a:hover { text-decoration-thickness: 2px; }
625
+ h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
626
+ h1 { font-size: 2rem; font-weight: 750; margin: 0 0 1rem; }
627
+ h2 { font-size: 1.45rem; font-weight: 750; margin: 2.6rem 0 0.7rem; }
628
+ h3 { font-size: 1.12rem; font-weight: 700; margin: 1.9rem 0 0.4rem; }
629
+ p, ul, ol, dl, table { margin: 0 0 1rem; }
630
+ li { margin: 0.25rem 0; }
631
+ strong { font-weight: 700; }
632
+ code { font: 0.86em/1.5 var(--mono); background: var(--code); border: 1px solid var(--line); border-radius: 5px; padding: 0.06em 0.32em; overflow-wrap: anywhere; }
633
+ pre { background: var(--code); border: 1px solid var(--line); border-left: 3px solid var(--navy); border-radius: 4px; padding: 0.95rem 1.1rem; overflow-x: auto; margin: 0 0 1.2rem; }
634
+ pre code { background: none; border: 0; padding: 0; font-size: 0.85rem; }
635
+ table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
636
+ th, td { border-bottom: 1px solid var(--line); padding: 0.5rem 0.6rem; text-align: left; vertical-align: top; }
637
+ th { font-weight: 700; }
638
+ .callout { border-left: 3px solid var(--note); background: var(--note-bg); border-radius: 0 6px 6px 0; padding: 0.8rem 1.1rem; margin: 0 0 1.2rem; }
639
+ .callout > :last-child { margin-bottom: 0; }
640
+ .callout .label { display: block; font-weight: 700; font-size: 0.92rem; color: var(--note); margin-bottom: 0.25rem; }
641
+ .callout.see { border-color: var(--see); background: var(--see-bg); } .callout.see .label { color: var(--see); }
642
+ .callout.wait { border-color: var(--wait); background: var(--wait-bg); } .callout.wait .label { color: var(--wait); }
643
+ .callout.keys { border-color: var(--keys); background: var(--keys-bg); } .callout.keys .label { color: var(--keys); }
644
+ .callout.warn { border-color: var(--warn); background: var(--warn-bg); } .callout.warn .label { color: var(--warn); }
645
+ .callout pre { background: var(--paper); }
646
+ .button { display: inline-block; background: var(--button); color: var(--button-fg); font: 650 1rem/1.2 var(--sans); padding: 0.85rem 1.4rem; border: 0; border-radius: 999px; text-decoration: none; cursor: pointer; }
647
+ .button:hover { background: var(--button-hover); }
648
+ .button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--orange) 55%, transparent); outline-offset: 2px; }
649
+ .brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
650
+ .brand img { border-radius: 22%; }
651
+ `;function Lg(e,t,n,r=`<link rel="icon" href="${fn}">`){return`<!doctype html>
652
+ <html lang="en">
653
+ <head>
654
+ <meta charset="utf-8">
655
+ <meta name="viewport" content="width=device-width, initial-scale=1">
656
+ <title>${Pe(e)}</title>
657
+ ${n?`<meta name="description" content="${Pe(n)}">
658
+ `:""}${r}
659
+ <style>${JT}${t}</style>
660
+ </head>`}var QT=`
661
+ body { padding: 7vh 16px 48px; }
662
+ .card { max-width: 580px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 2rem 2rem 1.4rem; box-shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 14px 36px rgb(20 20 30 / 7%); }
663
+ .card .brand { margin-bottom: 1.6rem; }
664
+ .status { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 1rem; }
665
+ .hero { display: block; width: 168px; height: 168px; margin: 0 0 1rem; border-radius: 22%; }
666
+ .status.fail { background: var(--warn-bg); color: var(--warn); }
667
+ h1 { font-size: 1.6rem; }
668
+ .lead { font-size: 1.05rem; }
669
+ .facts { margin: 1.4rem 0 1.6rem; }
670
+ .facts dt { font-size: 0.95rem; font-weight: 700; color: var(--ink); margin-top: 1.2rem; }
671
+ .facts dd { margin: 0.3rem 0 0; }
672
+ .facts ul { padding-left: 1.1rem; margin: 0; }
673
+ ol.next { padding-left: 1.3rem; }
674
+ .local { margin: 1.6rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
675
+ @media (max-width: 520px) { body { padding-top: 16px; } .card { padding: 1.4rem 1.2rem 1.1rem; } }
676
+ `,XT='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" aria-hidden="true"><path d="M7 7l10 10M17 7L7 17"/></svg>';function Ic(e,t,n){let r=n==="ok"?`<img class="hero" src="${co}" width="168" height="168" alt="">
677
+ `:n?`<div class="status fail">${XT}</div>
678
+ `:"";return`${Lg(`${e} \xB7 tapster`,QT)}
679
+ <body>
680
+ <main class="card">
681
+ <span class="brand"><img src="${fn}" width="34" height="34" alt="">tapster</span>
682
+ ${r}<h1>${Pe(e)}</h1>
683
+ ${t}
684
+ </main>
685
+ </body>
686
+ </html>
687
+ `}function jg(e){return Ic(e.title,`<p class="lead">${Pe(e.lead)}</p>
688
+ <dl class="facts">
689
+ <dt>What it may do</dt>
690
+ <dd><ul>${e.permissions.map((t)=>`<li>${Pe(t)}</li>`).join("")}<li>Nothing else. It has no webhook and receives no events.</li></ul></dd>
691
+ <dt>Where its key goes</dt>
692
+ <dd>${Pe(e.key)}</dd>
693
+ </dl>
694
+ <form method="post" action="${Pe(e.action)}">
695
+ <input type="hidden" name="manifest" value="${Pe(e.manifest)}">
696
+ <button class="button" type="submit">Continue to GitHub</button>
697
+ </form>
698
+ <p class="local">This page comes from tapster on your computer (127.0.0.1). The button sends GitHub only this App's description: its name, these permissions and the address to return to. GitHub shows it to you again; click <strong>Create GitHub App</strong> there.</p>`)}function Mg(e){return Ic(e.title,`<p class="lead">Back in your terminal, tapster takes it from here:</p>
699
+ <ol class="next">${e.next.map((t)=>`<li>${Pe(t)}</li>`).join("")}</ol>
700
+ <p class="local">You can close this tab.</p>`,"ok")}function Nc(e){return Ic("Nothing was set up",`<p class="lead">${Pe(e.reason)}</p>
701
+ <p>Run <code>${Pe(e.again)}</code> again in your terminal. It continues where it stopped.</p>
702
+ <p class="local">You can close this tab.</p>`,"fail")}function Ut(e){console.log(` ${e}`),j(process.platform==="darwin"?"/usr/bin/open":"/usr/bin/xdg-open","open",[e],{allowFail:!0}).catch(()=>{return})}var tE={"contents:write":"Contents, read and write: publish releases and their files in the repositories you install it on. Your rulesets keep it from creating or moving branches and tags.","attestations:read":"Attestations, read: check that each file was built by the project's own workflow.","metadata:read":"Metadata, read: every GitHub App has this. It sees the names of the repositories you install it on.","actions:write":"Actions, read and write, on the hub only: start the tapster workflow and turn it back on when GitHub pauses it."};function zc(e){let t=e.default_permissions??{};return Object.entries(t).map(([n,r])=>{let i=tE[`${n}:${r}`];if(!i)throw new v(`the App asks for ${n}: ${r}, which tapster cannot explain`,"Report this at https://github.com/doguyilmaz/tapster/issues.");return i})}var nE={"content-type":"text/html; charset=utf-8","content-security-policy":"default-src 'none'; style-src 'unsafe-inline'; img-src data:; form-action https://github.com; base-uri 'none'; frame-ancestors 'none'","cache-control":"no-store","referrer-policy":"no-referrer","x-content-type-options":"nosniff"};function rE(e){let t=`http://127.0.0.1:${e.port}`,n=!1,r=(i,o=200)=>new Response(i,{status:o,headers:nE});return(i)=>{if(i.headers.get("host")!==`127.0.0.1:${e.port}`)return new Response("Forbidden",{status:403});let o=new URL(i.url);if(o.pathname==="/start"){let a=e.manifest(`${t}/callback`);return r(jg({...e.copy,permissions:zc(a),action:`https://github.com/settings/apps/new?state=${e.state}`,manifest:JSON.stringify(a)}))}if(o.pathname!=="/callback")return new Response("Not found",{status:404});if(n)return r(Nc({reason:"This App was already handled.",again:e.copy.again}),409);let s=o.searchParams.get("code");if(o.searchParams.get("state")!==e.state||!s||!/^[A-Za-z0-9_-]{1,128}$/.test(s))return r(Nc({reason:"This answer did not belong to the App this terminal started, so tapster ignored it.",again:e.copy.again}),400);return n=!0,e.settle({code:s}),r(Mg({title:e.copy.done,next:e.copy.next}))}}function iE(e,t){let n=e.owner?.login??"nobody";if(n.toLowerCase()!==t.toLowerCase())throw new v(`the new App belongs to ${n}, not ${t}`,"tapster stored nothing. Create the App from your own account, then run this again.")}async function lo(e,t,n){let r=eE(16).toString("hex"),i=()=>{},o=new Promise((p)=>i=p),s=()=>new Response(null,{status:503}),a=Bun.serve({hostname:"127.0.0.1",port:0,fetch:(p)=>s(p)});s=rE({manifest:e,copy:t,state:r,port:a.port,settle:i}),console.log(`Opening GitHub to create ${t.what}. Read the page, then click "Continue to GitHub" and "Create GitHub App".`),Ut(`http://127.0.0.1:${a.port}/start`),console.log("tapster waits up to 30 minutes until GitHub sends you back. If no page opened, open the address above. Ctrl+C stops it.");let c="If GitHub created the App anyway, delete it at https://github.com/settings/apps first, because its name would block a new one.",l=setTimeout(()=>i({error:new v("no App was created within 30 minutes",`${c} Then run ${t.again} again.`)}),1800000),u=await o;if(clearTimeout(l),setTimeout(()=>a.stop(),1000),"error"in u)throw u.error;return Dc(u.code,n,`${c} Then run ${t.again} again.`)}async function Dc(e,t,n,r=fetch){let i=await r(`https://api.github.com/app-manifests/${e}/conversions`,{method:"POST",headers:{Accept:"application/vnd.github+json"}});if(!i.ok)throw new v(`GitHub did not hand over the new App (status ${i.status})`,n);let o=await i.json();return iE(o,t),o}var Ug=()=>({HOME:process.env.HOME??"/tmp",...process.env.GH_CONFIG_DIR?{GH_CONFIG_DIR:process.env.GH_CONFIG_DIR}:{},GH_PROMPT_DISABLED:"1"});function Zg(e){try{return Ag(e)}catch{throw new v("the GitHub CLI (gh) is not installed","Install it (brew install gh or see https://cli.github.com), sign in with gh auth login, then run this again.")}}async function _t(){let e=await j(Zg(),"gh",["auth","token"],{env:Ug(),allowFail:!0}),t=e.stdout.trim();if(e.code!==0||!t)throw new v("gh is not signed in","Run gh auth login, then try again.");return new pe(t,fetch,void 0,"user")}async function He(e=process.cwd()){let t=(await $e("git",["-C",e,"remote","get-url","origin"],{allowFail:!0})).stdout.trim(),n=/github\.com[:/]([A-Za-z0-9-]+\/[A-Za-z0-9._-]+?)(?:\.git)?$/.exec(t);if(!n)throw new v("this folder is not a clone of a GitHub repository","Run tapster inside a clone (git remote origin on github.com).");return n[1]}var uo=async(e,t)=>{await j(Zg(),"gh",e,{env:Ug(),stdin:t})};var X=(e,t,n,r="tapster")=>uo(["secret","set",t,"--env",r,"--repo",e],n),ze=(e,t,n)=>uo(["variable","set",t,"--env","tapster","--repo",e,"--body",n]),po=(e,t,n)=>uo(["variable","set",t,"--repo",e,"--body",n]),Gg=(e,t,n="tapster")=>uo(["secret","delete",t,"--env",n,"--repo",e]);async function Zt(e,t,n){try{return(await e.json("GET",`/repos/${t}/environments/tapster/${n}?per_page=100`))[n]??[]}catch(r){if(r instanceof R&&r.status===404)throw new v(`${t} has no tapster environment yet`,"Run tapster init in a clone of the hub first.");throw r}}import{lstatSync as Hg,readFileSync as oE}from"fs";import{mkdir as sE,readFile as aE,writeFile as cE}from"fs/promises";import{join as qg}from"path";function mn(e,t=process.env.HOME??""){let n=e.trim();if(n=n.length>1&&(n[0]==="'"||n[0]==='"')&&n.at(-1)===n[0]?n.slice(1,-1):n.replace(/\\(.)/g,"$1"),!n)throw new v("no path was given","Type the path or drag the file into the terminal.");return n.replace(/^~(?=\/|$)/,t)}async function gn(e,t){try{return await aE(e)}catch(n){let r=n.code;if(r==="ENOENT")throw new v(`${e} does not exist`,`Check the path of ${t}.`);if(r==="EISDIR")throw new v(`${e} is a folder`,`Give the path of ${t} itself.`);throw new v(`${e} cannot be read`,`Check that you can open ${t}.`)}}function Lc(e,t=1048576){try{let n=Hg(e);if(!n.isFile()||n.size>t)return null;return oE(e)}catch{return null}}var oe=(e,t=1048576)=>Lc(e,t)?.toString("utf8")??null;function gr(e,t,n=1048576){let r=oe(e,n);if(r===null)throw new v(`${t} is not a regular file tapster can read`,"Replace a link or a very large file with the file itself, then try again.");return r}var Bg=(e)=>{try{return Hg(e)}catch{return null}};async function vr(e,t,n){let r=t.split("/"),i=e;for(let a of r.slice(0,-1)){i=qg(i,a);let c=Bg(i);if(c&&!c.isDirectory())throw new v(`${t} would be written through a link or a file`,"Replace the link with a real folder, then try again.");if(!c)await sE(i)}let o=qg(e,t),s=Bg(o);if(s&&!s.isFile())throw new v(`${t} is not a regular file`,"Replace the link with the file itself, then try again.");await cE(o,n)}async function ho(e,t={}){let{timeoutMs:n=600000,intervalMs:r=3000,sleep:i=(a)=>new Promise((c)=>setTimeout(c,a)),now:o=Date.now}=t,s=o()+n;for(;;){let a=await e();if(a!==null)return a;if(o()+r>s)return null;await i(r)}}import{createInterface as lE}from"readline";function me(e,t=!1){return new Promise((n)=>{let r=lE({input:process.stdin,output:process.stdout,terminal:!0});if(t)r._writeToOutput=(i)=>{if(i.includes(e))process.stdout.write(e)};r.question(e,(i)=>{if(r.close(),t)process.stdout.write(`
703
+ `);n(i.trim())})})}import{mkdtempSync as uE,rmSync as pE}from"fs";import{tmpdir as dE}from"os";import{join as hE}from"path";var jc=new Set;function kt(e){let t=uE(hE(dE(),e));return jc.add(t),t}function Fe(e){pE(e,{recursive:!0,force:!0}),jc.delete(e)}function fE(){for(let e of[...jc])Fe(e)}process.on("SIGINT",()=>{fE(),process.exit(130)});function fo(e){if(Number.isInteger(e)&&e>=5&&e<60&&60%e===0)return`7-59/${e} * * * *`;if(e===60)return"7 * * * *";let t=e/60;if(Number.isInteger(t)&&t>1&&t<=24&&24%t===0)return`7 */${t} * * *`;throw new v(`${e} minutes is not an interval tapster can schedule`,"Use 5, 6, 10, 12, 15, 20 or 30 minutes. Longer intervals must be 60 minutes times a divisor of 24.")}function rt(e){let t=ie(e)?.on?.schedule?.[0]?.cron;if(!t)return null;let n=/^7-59\/(\d+) \* \* \* \*$/.exec(t)??null;if(n)return Number(n[1]);if(t==="7 * * * *")return 60;let r=/^7 \*\/(\d+) \* \* \*$/.exec(t);return r?Number(r[1])*60:null}function Fg(e){if(e<60)return`*/${e} * * * *`;return e===60?"0 * * * *":`0 */${e/60} * * *`}var Kg=(e)=>e.default,wr=(e)=>Ng.trimEnd().split(`
603
704
  `).map((t)=>`${" ".repeat(e)}${t}`).join(`
604
- `);function yP(e,t,r){return{name:`tapster-doorbell-${e}-${t.split("/")[1].replace(/^homebrew-/,"")}`.toLowerCase().slice(0,34),url:`https://github.com/${t}`,redirect_url:r,public:!1,default_permissions:{actions:"write",metadata:"read"},default_events:[],hook_attributes:{url:"https://example.com/tapster-has-no-webhook",active:!1}}}function wP(e){for(let r of["APP_ID","INSTALLATION_ID","HUB_ID","OWNER_ID","INTERVAL"])if(!/^[0-9]+$/.test(e[r]))throw new y(`${r} must be a number`,"Run tapster init --doorbell again.");if(!/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/.test(e.HUB))throw new y("the hub name is not owner/repo","Run it in the hub clone.");let t={crons:[Mh(Number(e.INTERVAL))]};return`${JSON.stringify({name:"tapster-doorbell",main:"worker.ts",compatibility_date:"2026-10-01",workers_dev:!0,vars:e,triggers:t},null,2)}
605
- `}function bP(e){for(let t of e.split(`
606
- `)){let r;try{r=JSON.parse(t)}catch{continue}if(r.type!=="deploy"||!Array.isArray(r.targets))continue;for(let n of r.targets)if(typeof n==="string"&&/^https:\/\/[a-z0-9-]+\.[a-z0-9-]+\.workers\.dev\/?$/.test(n))return new URL(n).origin}return null}var _P=(e)=>({PATH:e,BUN_BE_BUN:"1"});function Kh(e){let t=(r)=>e.variables.some((n)=>n.name===r);if(t("TAPSTER_DOORBELL"))return"done";return t("TAPSTER_DOORBELL_APP_ID")&&t("TAPSTER_DOORBELL_APP_SLUG")?"resume":"new"}var Ur="Run tapster init --doorbell again; it continues with the App it already created.";async function Fh(e,t){console.log(`Open the doorbell App's settings, scroll to "Private keys" and click "Generate a private key":`),vt(`https://github.com/settings/apps/${t}`);let r=(await te("Path of the downloaded .pem file: ")).replace(/^~(?=\/)/,process.env.HOME??"~"),n=await gP(r,"utf8");return await new Oe(qt(e,n)).json("GET","/app").catch(()=>{throw new y("that key does not belong to the doorbell App",`Generate the key on https://github.com/settings/apps/${t}.`)}),console.log(`Once tapster is done, delete ${r} and every older key on that page.`),n}function vP(){for(let e of(process.env.PATH??"").split(sa))if(e&&Bh(Ne(e,"node")))return Ne(e,"node");throw new y("Wrangler needs Node.js, which is not on PATH","Install Node.js 20 or newer, then run this again.")}async function Gh(){let e=Ft("tapster-doorbell-");await jr(Ne(e,"package.json"),`${JSON.stringify(Uh,null,2)}
607
- `),await jr(Ne(e,"bun.lock"),jh),await C(process.execPath,"bun",["install","--frozen-lockfile","--ignore-scripts"],{cwd:e,env:_P(process.env.PATH??"")});let t=vP(),r=Ne(e,"node_modules","wrangler","bin","wrangler.js"),n=Object.fromEntries(["CLOUDFLARE_API_TOKEN","CLOUDFLARE_ACCOUNT_ID"].flatMap((o)=>process.env[o]?[[o,process.env[o]]]:[])),s={PATH:`${Ne(t,"..")}${sa}/usr/bin${sa}/bin`,WRANGLER_SEND_METRICS:"false",...n};return{dir:e,run(o,i={}){if(i.interactive)return new Promise((a)=>{hP(t,[r,...o],{cwd:e,stdio:"inherit",env:{HOME:process.env.HOME??"",...s,...i.env}}).on("close",(u)=>a({code:u??1,stdout:""}))});return C(t,"wrangler",[r,...o],{cwd:e,env:{...s,...i.env},stdin:i.stdin,allowFail:!0})}}}async function Hh(e){if((await e.run(["whoami"])).code===0)return;if(console.log("Sign in to Cloudflare in the browser that opens."),(await e.run(["login"],{interactive:!0})).code!==0)throw new y("Wrangler could not sign in to Cloudflare","Run tapster init --doorbell again.")}async function Wh(e,t,r){let n=new Oe(qt(e,t));console.log(`Waiting until the App is installed on ${r} (only that repository); tapster continues by itself.`);let s=await ks(()=>n.json("GET",`/repos/${r}/installation`).then((o)=>o.id,()=>null));if(s!==null)return s;throw new y(`the doorbell App was not installed on ${r} within 10 minutes`,`Install it on ${r}, then ${Ur.charAt(0).toLowerCase()}${Ur.slice(1)}`)}async function Vh(e,t,r,n,s,o,i){let a=(await t.json("GET",`/users/${r.split("/")[0]}`)).id,c=(await t.getRepo(r)).id;await jr(Ne(e.dir,"worker.ts"),qh(ta)),await jr(Ne(e.dir,"jwt.ts"),qh(ea)),await jr(Ne(e.dir,"wrangler.jsonc"),wP({APP_ID:n,INSTALLATION_ID:String(i),HUB:r,HUB_ID:String(c),OWNER_ID:String(a),INTERVAL:String(o)}));let u=Ne(e.dir,"out.ndjson");if((await e.run(["deploy"],{env:{WRANGLER_OUTPUT_FILE_PATH:u}})).code!==0)throw new y("Wrangler could not deploy the doorbell",`${Ur} Wrangler's own message is above.`);let f=bP(Bh(u)?mP(u,"utf8"):"");if(!f)throw new y("the doorbell has no workers.dev address",`Create your workers.dev subdomain in the Cloudflare dashboard (Workers & Pages). ${Ur}`);let p=dP(s).export({type:"pkcs8",format:"pem"}).toString();if((await e.run(["secret","put","APP_KEY"],{stdin:p})).code!==0)throw new y("Wrangler could not store the doorbell key",Ur);return await Ie(r,"TAPSTER_DOORBELL_EVERY",String(o)),f}async function Yh(e,t,r,n,s){let o=await e.json("GET",`/repos/${t}/environments/tapster/variables`),i=Kh(o);if(i==="done")throw new y("the hub already has a doorbell","Run tapster init --rotate doorbell to replace its key. To start over, delete the App and the TAPSTER_DOORBELL variables.");let a=await Gh();try{await Hh(a);let[c]=t.split("/"),u,l;if(i==="resume")u=o.variables.find((p)=>p.name==="TAPSTER_DOORBELL_APP_ID").value,console.log("Continuing with the doorbell App created earlier."),l=await Fh(u,o.variables.find((p)=>p.name==="TAPSTER_DOORBELL_APP_SLUG").value);else{let p=await _s((d)=>yP(c,t,d),"the doorbell App");u=String(p.id),l=p.pem,await Ie(t,"TAPSTER_DOORBELL_APP_ID",u),await Ie(t,"TAPSTER_DOORBELL_APP_SLUG",p.slug),vt(`https://github.com/apps/${p.slug}/installations/new`)}let f=await Vh(a,e,t,u,l,s,await Wh(u,l,t));for(let p of r.packages)await n(p.repo,"TAPSTER_DOORBELL",f);await Ie(t,"TAPSTER_DOORBELL",f),console.log(`The doorbell answers at ${f}. Projects ring it after opening a draft.`)}finally{rt(a.dir)}}async function Jh(e,t,r){let n=await e.json("GET",`/repos/${t}/environments/tapster/variables`);if(Kh(n)!=="done")throw new y("the hub has no working doorbell yet","Run tapster init --doorbell.");let s=n.variables.find((a)=>a.name==="TAPSTER_DOORBELL_APP_ID").value,o=await Fh(s,n.variables.find((a)=>a.name==="TAPSTER_DOORBELL_APP_SLUG").value),i=await Gh();try{await Hh(i),await Vh(i,e,t,s,o,r,await Wh(s,o,t))}finally{rt(i.dir)}console.log(`Deployed the doorbell again with the new key; it starts the hub every ${r} minutes. Now delete every other key on the App's settings page.`)}var Re={"actions/checkout":{tag:"v7.0.1",sha:"3d3c42e5aac5ba805825da76410c181273ba90b1"},"actions/attest-build-provenance":{tag:"v4.2.2",sha:"4d101475d8b20a2381f78447822ac1eab6504dd8"},"oven-sh/setup-bun":{tag:"v2.2.0",sha:"0c5077e51419868618aeaa5fe8019c62421857d6"},"actions/upload-artifact":{tag:"v7.0.1",sha:"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a"},"actions/download-artifact":{tag:"v8.0.1",sha:"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c"},"actions/upload-pages-artifact":{tag:"v5.0.0",sha:"fc324d3547104276b827a68afc52ff2a11cc49c9"},"actions/deploy-pages":{tag:"v5.0.1",sha:"368f82528645a54fb793d4d04e342629a3f51346"}};var Qh=`name: release
705
+ `);function yE(e,t,n){return{name:`tapster-doorbell-${e}-${t.split("/")[1].replace(/^homebrew-/,"")}`.toLowerCase().slice(0,34),url:`https://github.com/${t}`,redirect_url:n,public:!1,default_permissions:{actions:"write",metadata:"read"},default_events:[],hook_attributes:{url:"https://example.com/tapster-has-no-webhook",active:!1}}}function bE(e){for(let n of["APP_ID","INSTALLATION_ID","HUB_ID","OWNER_ID","INTERVAL"])if(!/^[0-9]+$/.test(e[n]))throw new v(`${n} must be a number`,"Run tapster init --doorbell again.");if(!/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/.test(e.HUB))throw new v("the hub name is not owner/repo","Run it in the hub clone.");let t={crons:[Fg(Number(e.INTERVAL))]};return`${JSON.stringify({name:"tapster-doorbell",main:"worker.ts",compatibility_date:"2026-10-01",workers_dev:!0,vars:e,triggers:t},null,2)}
706
+ `}function wE(e){for(let t of e.split(`
707
+ `)){let n;try{n=JSON.parse(t)}catch{continue}if(n.type!=="deploy"||!Array.isArray(n.targets))continue;for(let r of n.targets)if(typeof r==="string"&&/^https:\/\/[a-z0-9-]+\.[a-z0-9-]+\.workers\.dev\/?$/.test(r))return new URL(r).origin}return null}function _E(e){let t=`${e.stdout}
708
+ ${e.stderr??""}`.split(`
709
+ `).map((r)=>r.trim()).filter(Boolean),n=t.filter((r)=>/\[ERROR\]/.test(r));return(n.length?n:t).slice(-2).join(" / ")||"no output"}var kE=(e)=>({PATH:e,BUN_BE_BUN:"1"});function Vg(e){let t=(n)=>e.variables.some((r)=>r.name===n);if(t("TAPSTER_DOORBELL"))return"done";return t("TAPSTER_DOORBELL_APP_ID")&&t("TAPSTER_DOORBELL_APP_SLUG")?"resume":"new"}var br="Run tapster init --doorbell again; it continues with the App it already created.";async function Yg(e,t){console.log(`Open the doorbell App's settings, scroll to "Private keys" and click "Generate a private key":`),Ut(`https://github.com/settings/apps/${t}`);let n=mn(await me("Path of the downloaded .pem file (drag it here): ")),r=(await gn(n,"the .pem file")).toString("utf8");return await new pe(Be(e,r)).json("GET","/app").catch(()=>{throw new v("that key does not belong to the doorbell App",`Generate the key on https://github.com/settings/apps/${t}.`)}),console.log(`Once tapster is done, delete ${n} and every older key on that page.`),r}function xE(){for(let e of(process.env.PATH??"").split(Mc))if(e&&Wg(Ke(e,"node")))return Ke(e,"node");throw new v("Wrangler needs Node.js, which is not on PATH","Install Node.js 20 or newer, then run this again.")}async function Jg(){let e=kt("tapster-doorbell-");await yr(Ke(e,"package.json"),`${JSON.stringify(Dg,null,2)}
710
+ `),await yr(Ke(e,"bun.lock"),zg),await j(process.execPath,"bun",["install","--frozen-lockfile","--ignore-scripts"],{cwd:e,env:kE(process.env.PATH??"")});let t=xE(),n=Ke(e,"node_modules","wrangler","bin","wrangler.js"),r=Object.fromEntries(["CLOUDFLARE_API_TOKEN","CLOUDFLARE_ACCOUNT_ID"].flatMap((o)=>process.env[o]?[[o,process.env[o]]]:[])),i={PATH:`${Ke(t,"..")}${Mc}/usr/bin${Mc}/bin`,WRANGLER_SEND_METRICS:"false",...r};return{dir:e,run(o,s={}){if(s.interactive)return new Promise((a)=>{gE(t,[n,...o],{cwd:e,stdio:"inherit",env:{HOME:process.env.HOME??"",...i,...s.env}}).on("close",(l)=>a({code:l??1,stdout:""}))});return j(t,"wrangler",[n,...o],{cwd:e,env:{...i,...s.env},stdin:s.stdin,allowFail:!0})}}}async function Qg(e){if((await e.run(["whoami"])).code===0)return;if(console.log("Sign in to Cloudflare in the browser that opens."),(await e.run(["login"],{interactive:!0})).code!==0)throw new v("Wrangler could not sign in to Cloudflare","Run tapster init --doorbell again.")}async function Xg(e,t,n){let r=new pe(Be(e,t));console.log(`Waiting until the App is installed on ${n} (only that repository); tapster continues by itself.`);let i=await ho(()=>r.json("GET",`/repos/${n}/installation`).then((o)=>o.id,()=>null));if(i!==null)return i;throw new v(`the doorbell App was not installed on ${n} within 10 minutes`,`Install it on ${n}, then ${br.charAt(0).toLowerCase()}${br.slice(1)}`)}async function ev(e,t,n,r,i,o,s){let a=(await t.json("GET",`/users/${n.split("/")[0]}`)).id,c=(await t.getRepo(n)).id;await yr(Ke(e.dir,"worker.ts"),Kg(Rc)),await yr(Ke(e.dir,"jwt.ts"),Kg(Cc)),await yr(Ke(e.dir,"wrangler.jsonc"),bE({APP_ID:r,INSTALLATION_ID:String(s),HUB:n,HUB_ID:String(c),OWNER_ID:String(a),INTERVAL:String(o)}));let l=Ke(e.dir,"out.ndjson"),u=await e.run(["deploy"],{env:{WRANGLER_OUTPUT_FILE_PATH:l}});if(u.code!==0)throw new v(`Wrangler could not deploy the doorbell: ${_E(u)}`,br);let p=wE(Wg(l)?vE(l,"utf8"):"");if(!p)throw new v("the doorbell has no workers.dev address",`Create your workers.dev subdomain in the Cloudflare dashboard (Workers & Pages). ${br}`);let d=mE(i).export({type:"pkcs8",format:"pem"}).toString();if((await e.run(["secret","put","APP_KEY"],{stdin:d})).code!==0)throw new v("Wrangler could not store the doorbell key",br);return await ze(n,"TAPSTER_DOORBELL_EVERY",String(o)),p}async function tv(e,t,n,r,i){let o={variables:(await Zt(e,t,"variables")).map((c)=>({name:c.name,value:c.value??""}))},s=Vg(o);if(s==="done")throw new v("the hub already has a doorbell","Run tapster init --rotate doorbell to replace its key. To start over, delete the App and the TAPSTER_DOORBELL variables.");let a=await Jg();try{await Qg(a);let[c]=t.split("/"),l,u;if(s==="resume")l=o.variables.find((d)=>d.name==="TAPSTER_DOORBELL_APP_ID").value,console.log("Continuing with the doorbell App created earlier."),u=await Yg(l,o.variables.find((d)=>d.name==="TAPSTER_DOORBELL_APP_SLUG").value);else{let d=await lo((h)=>yE(c,t,h),{what:"the doorbell App",title:"Create the doorbell App",lead:`GitHub asks you to confirm a second private App. The doorbell uses it only to start ${t}'s workflow when a project releases.`,key:"GitHub hands the App's private key to tapster in your terminal, once. tapster stores it as a secret of the doorbell Worker in your Cloudflare account. It goes nowhere else and no one else receives it.",done:"The doorbell App is created",next:["tapster opens the App's install page in a new tab.",`There, choose "Only select repositories" and pick ${t}, only that one.`,'Click "Install". tapster notices within seconds and deploys the Worker.'],again:"tapster init --doorbell"},c);l=String(d.id),u=d.pem,await ze(t,"TAPSTER_DOORBELL_APP_ID",l),await ze(t,"TAPSTER_DOORBELL_APP_SLUG",d.slug),Ut(`https://github.com/apps/${d.slug}/installations/new`)}let p=await ev(a,e,t,l,u,i,await Xg(l,u,t));for(let d of n.packages)await r(d.repo,"TAPSTER_DOORBELL",p);await ze(t,"TAPSTER_DOORBELL",p),console.log(`The doorbell answers at ${p}. Projects ring it after opening a draft.`)}finally{Fe(a.dir)}}async function nv(e,t,n){let r=await e.json("GET",`/repos/${t}/environments/tapster/variables`);if(Vg(r)!=="done")throw new v("the hub has no working doorbell yet","Run tapster init --doorbell.");let i=r.variables.find((a)=>a.name==="TAPSTER_DOORBELL_APP_ID").value,o=await Yg(i,r.variables.find((a)=>a.name==="TAPSTER_DOORBELL_APP_SLUG").value),s=await Jg();try{await Qg(s),await ev(s,e,t,i,o,n,await Xg(i,o,t))}finally{Fe(s.dir)}console.log(`Deployed the doorbell again with the new key; it starts the hub every ${n} minutes. Now delete every other key on the App's settings page.`)}var We={"actions/checkout":{tag:"v7.0.1",sha:"3d3c42e5aac5ba805825da76410c181273ba90b1"},"actions/attest-build-provenance":{tag:"v4.2.2",sha:"4d101475d8b20a2381f78447822ac1eab6504dd8"},"oven-sh/setup-bun":{tag:"v2.2.0",sha:"0c5077e51419868618aeaa5fe8019c62421857d6"},"actions/upload-artifact":{tag:"v7.0.1",sha:"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a"},"actions/download-artifact":{tag:"v8.0.1",sha:"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c"},"actions/upload-pages-artifact":{tag:"v5.0.0",sha:"fc324d3547104276b827a68afc52ff2a11cc49c9"},"actions/deploy-pages":{tag:"v5.0.1",sha:"368f82528645a54fb793d4d04e342629a3f51346"}};var rv=`name: release
608
711
  on:
609
712
  push:
610
713
  tags: ["v[0-9]+.[0-9]+.[0-9]+"]
@@ -657,7 +760,7 @@ __CARRY__
657
760
  env: { GH_TOKEN: "\${{ github.token }}", TAG: "\${{ github.ref_name }}" }
658
761
  run: gh release create "$TAG" dist/* --draft --verify-tag --generate-notes --title "$TAG"
659
762
  __RING__
660
- `;var Xh=`name: release
763
+ `;var Uc=`name: release
661
764
  on:
662
765
  push:
663
766
  tags: ["v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*"]
@@ -708,28 +811,34 @@ jobs:
708
811
  env: { GH_TOKEN: "\${{ github.token }}", TAG: "\${{ github.ref_name }}" }
709
812
  run: gh release create "$TAG" dist/*.tar.gz dist/*.zip dist/checksums.txt --draft --verify-tag --generate-notes --title "$TAG" $( [ "\${TAG#*-}" != "$TAG" ] && echo --prerelease )
710
813
  __RING__
711
- `;function Ss(e){if(!/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/.test(e))throw new y(`${e} is not a repository name`,"Name the hub as owner/repo, for example you/homebrew-tap.");return e}function em(e,t){let r=(s)=>s.replace(/^\.\//,"");if(typeof e.bin==="string")return{bin:(e.name??t).replace(/^@[^/]+\//,""),entry:r(e.bin)};let n=Object.entries(e.bin??{})[0];return n?{bin:n[0],entry:r(n[1])}:null}var AP=[["darwin-arm64","darwin_arm64.tar.gz"],["darwin-amd64","darwin_amd64.tar.gz"],["linux-arm64","linux_arm64.tar.gz"],["linux-amd64","linux_amd64.tar.gz"],["windows-amd64","windows_amd64.zip"]];function oa(e,t,r,n,s,o){return[` - name: ${e}`,` repo: ${t}`,` kind: ${r}`,` binaries: [${n.join(", ")}]`," assets:",...s.map(([i,a])=>` ${i}: "${a}"`),` scoop: ${o}`].join(`
712
- `)}var tm=(e,t,r)=>oa(e,t,"bun",[r],AP.map(([n,s])=>[n,`${r}_{version}_${s}`]),!0),xs={darwin_all:"darwin-universal",darwin_universal:"darwin-universal",darwin_arm64:"darwin-arm64",darwin_amd64:"darwin-amd64",linux_arm64:"linux-arm64",linux_amd64:"linux-amd64",windows_amd64:"windows-amd64",windows_arm64:"windows-arm64"};function ia(e,t,r,n,s){if(!s)return{entry:null,reason:"the project has its own release workflow and no release yet; run tapster add again after the first draft"};let o=[];for(let i of s.assets){let a=Object.keys(xs).find((c)=>i.includes(c));if(a&&!o.some(([c])=>c===xs[a]))o.push([xs[a],i.replaceAll(s.version,"{version}")])}if(o.length===0)return{entry:null,reason:"the latest release has no archives tapster recognizes"};return{entry:oa(e,t,r,n,o,o.some(([i,a])=>i.startsWith("windows")&&a.endsWith(".zip"))),reason:null}}function rm(e,t,r,n){let s=(r?X(r):null)??{},o=s.project_name??e,i=[...new Set((s.builds??[]).map((d)=>d.binary??o))],a=i.length?i:[o];if(n)return ia(e,t,"go",a,n);if((s.archives??[]).some((d)=>d.name_template!==void 0))return{entry:null,reason:"GoReleaser names the archives with its own template; run tapster add again after the first draft"};let c=(s.archives??[]).some((d)=>(d.format_overrides??[]).some((h)=>h.goos==="windows"&&(h.format==="zip"||h.formats?.includes("zip")))),u=s.builds?.[0]?.goos??["linux","darwin","windows"],l=s.builds?.[0]?.goarch??["amd64","arm64"],f=[],p=s.universal_binaries?.[0];for(let d of u)for(let h of l){let m=xs[`${d}_${h}`];if(!m||d==="darwin"&&p?.replace)continue;f.push([m,`${o}_{version}_${d}_${h}.${d==="windows"&&c?"zip":"tar.gz"}`])}if(p&&u.includes("darwin"))f.unshift(["darwin-universal",`${o}_{version}_darwin_all.tar.gz`]);return{entry:oa(e,t,"go",a,f,c&&u.includes("windows")),reason:null}}function $P(e,t,r){let n=Qe(e);if((n.toJS().packages??[]).some((u)=>u?.name===r))throw new y(`${r} is already in the hub's tapster.yml`,"Edit its entry there instead.");let o=n.get("packages",!0);if(!dt(o))throw new y("the hub's tapster.yml has no packages list","Add packages: [] to it.");let[i,a]=o.range??[0,0];if(o.flow&&o.items.length===0)return`${e.slice(0,i).replace(/[ \t]+$/,"")}
713
- ${t}${e.slice(a)}`;if(!o.flow){let u=e.slice(0,a);return`${u}${u.endsWith(`
814
+ `;function go(e){if(!/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/.test(e))throw new v(`${e} is not a repository name`,"Name the hub as owner/repo, for example you/homebrew-tap.");return e}function vo(e,t){let n=(i)=>i.replace(/^\.\//,"");if(typeof e.bin==="string")return{bin:(e.name??t).replace(/^@[^/]+\//,""),entry:n(e.bin)};let r=Object.entries(e.bin??{})[0];return r?{bin:r[0],entry:n(r[1])}:null}var PE=[["darwin-arm64","darwin_arm64.tar.gz"],["darwin-amd64","darwin_amd64.tar.gz"],["linux-arm64","linux_arm64.tar.gz"],["linux-amd64","linux_amd64.tar.gz"],["windows-amd64","windows_amd64.zip"]];function Gc(e,t,n,r,i,o){return[` - name: ${e}`,` repo: ${t}`,` kind: ${n}`,` binaries: [${r.join(", ")}]`," assets:",...i.map(([s,a])=>` ${s}: "${a}"`),` scoop: ${o}`].join(`
815
+ `)}var iv=(e,t,n)=>Gc(e,t,"bun",[n],PE.map(([r,i])=>[r,`${n}_{version}_${i}`]),!0),mo={darwin_all:"darwin-universal",darwin_universal:"darwin-universal",darwin_arm64:"darwin-arm64",darwin_amd64:"darwin-amd64",linux_arm64:"linux-arm64",linux_amd64:"linux-amd64",windows_amd64:"windows-amd64",windows_arm64:"windows-arm64"};function qc(e,t,n,r,i){if(!i)return{entry:null,reason:"the project has its own release workflow and no release yet; run tapster add again after the first draft"};let o=[];for(let s of i.assets){let a=Object.keys(mo).find((c)=>s.includes(c));if(a&&!o.some(([c])=>c===mo[a]))o.push([mo[a],s.replaceAll(i.version,"{version}")])}if(o.length===0)return{entry:null,reason:"the latest release has no archives tapster recognizes"};return{entry:Gc(e,t,n,r,o,o.some(([s,a])=>s.startsWith("windows")&&a.endsWith(".zip"))),reason:null}}function ov(e,t,n,r){let i=(n?ie(n):null)??{},o=i.project_name??e,s=[...new Set((i.builds??[]).map((h)=>h.binary??o))],a=s.length?s:[o];if(r)return qc(e,t,"go",a,r);if((i.archives??[]).some((h)=>h.name_template!==void 0))return{entry:null,reason:"GoReleaser names the archives with its own template; run tapster add again after the first draft"};let c=(i.archives??[]).some((h)=>(h.format_overrides??[]).some((f)=>f.goos==="windows"&&(f.format==="zip"||f.formats?.includes("zip")))),l=i.builds?.[0]?.goos??["linux","darwin","windows"],u=i.builds?.[0]?.goarch??["amd64","arm64"],p=[],d=i.universal_binaries?.[0];for(let h of l)for(let f of u){let m=mo[`${h}_${f}`];if(!m||h==="darwin"&&d?.replace)continue;p.push([m,`${o}_{version}_${h}_${f}.${h==="windows"&&c?"zip":"tar.gz"}`])}if(d&&l.includes("darwin"))p.unshift(["darwin-universal",`${o}_{version}_darwin_all.tar.gz`]);return{entry:Gc(e,t,"go",a,p,c&&l.includes("windows")),reason:null}}var Zc=(e)=>e.replace(/([[{])\s+/g,"$1").replace(/\s+([\]}])/g,"$1");function _r(e,t){let n=new Map;for(let r of e.split(`
816
+ `))n.set(Zc(r),[...n.get(Zc(r))??[],r]);return t.split(`
817
+ `).map((r)=>n.get(Zc(r))?.shift()??r).join(`
818
+ `)}function TE(e,t,n){let r=vt(e);if((r.toJS().packages??[]).some((l)=>l?.name===n))throw new v(`${n} is already in the hub's tapster.yml`,"Edit its entry there instead.");let o=r.get("packages",!0);if(!Rt(o))throw new v("the hub's tapster.yml has no packages list","Add packages: [] to it.");let[s,a]=o.range??[0,0];if(o.flow&&o.items.length===0)return`${e.slice(0,s).replace(/[ \t]+$/,"")}
819
+ ${t}${e.slice(a)}`;if(!o.flow){let l=e.slice(0,a);return`${l}${l.endsWith(`
714
820
  `)?"":`
715
821
  `}${t}
716
- ${e.slice(a)}`}let c=Qe(t).contents;if(!dt(c)||c.items.length!==1)throw new y("the entry is not one package","Report this as a tapster bug.");return o.flow=!1,o.items.push(c.items[0]),n.toString()}function nm(e,t){if(!e||Ze(e,t).length===0)return null;let r=e.trim().replace(/^(?:the|an?)\s+/i,"").replace(/command ?line/gi,"command-line").replace(/\.$/,"");return r=r.charAt(0).toUpperCase()+r.slice(1),Ze(r,t).length===0?r:null}var PP=(e,t,r)=>`https://github.com/apps/${e}/installations/new/permissions?suggested_target_id=${t}&repository_ids[]=${r}`;function sm(e){return[" # in the job that decides the version, on the default branch:"," environment: release"," steps:",` - uses: actions/checkout@${e.sha} # ${e.tag}`,' with: { ssh-key: "${{ secrets.TAPSTER_TAG_KEY }}" }'," # ... compute VERSION ..."," - name: Push the release tag",' run: git tag "v$VERSION" && git push origin "v$VERSION"'].join(`
717
- `)}async function EP(e,t){try{let r=await e.json("GET",`/repos/${t}/contents/tapster.yml?ref=main`);return{text:Buffer.from(r.content,"base64").toString("utf8"),sha:r.sha}}catch(r){if(r instanceof D&&r.status===404)throw new y(`${t} has no tapster.yml on main`,"Run tapster init in a clone of the hub and push it first.");throw r}}async function om(e,t,r,n,s){if(!hs.test(r))throw new y(`${r} is not a valid package name`,"Use lowercase letters, digits and dashes.");let{text:o,sha:i}=await EP(e,t),a=$P(o,s,r),{invalid:c}=bt(a,t.split("/")[0]),u=c.find((h)=>h.name===r);if(u)throw new y(`the hub would refuse this entry: ${u.reason}`,u.fix);let l=`tapster-add-${r}`,f=(await e.json("GET",`/repos/${t}/git/ref/heads/main`)).object.sha;try{await e.json("POST",`/repos/${t}/git/refs`,{ref:`refs/heads/${l}`,sha:f})}catch(h){if(h instanceof D&&h.status===422)throw new y(`the hub already has a branch ${l}`,`Merge or delete it on ${t}, then run tapster add again.`);throw h}await e.json("PUT",`/repos/${t}/contents/tapster.yml`,{message:`Add ${r}`,content:Buffer.from(a).toString("base64"),sha:i,branch:l});let p=[`tapster add prepared this entry for ${n}:`,"","```yaml",s,"```","",`Merge it to let the hub publish ${n}.`].join(`
718
- `);return(await e.json("POST",`/repos/${t}/pulls`,{title:`Add ${r}`,head:l,base:"main",body:p})).html_url}async function im(e,t,r){let s=(await e.json("GET",`/repos/${t}/environments/tapster/variables`)).variables.find((a)=>a.name==="TAPSTER_APP_SLUG")?.value;if(!s)throw new y("the hub has no App yet","Run tapster init in a clone of the hub first.");let o=await e.getRepo(r),i=await e.json("GET",`/users/${r.split("/")[0]}`);return`- open this page and choose Install, unless the hub's App already reaches ${r}; the project is preselected (keep "Only select repositories"):
719
- ${PP(s,i.id,o.id)}`}function OP(e){let t=Qe(e),r=[];t.setIn(["release","draft"],!0),r.push("release.draft: true; the tapster hub publishes after signing"),t.setIn(["checksum","name_template"],"checksums.txt"),r.push("checksum.name_template: checksums.txt; the hub reads this name");for(let n of["notarize","homebrew_casks","brews","scoops"])if(t.has(n))t.delete(n),r.push(`removed ${n}; the hub does this now`);return{text:t.toString(),notes:r}}var pm=(e)=>e.value,fm="Ring the tapster hub";function IP(e,t,r){let n=Qe(e),s=[],o=n.get("jobs");if(!ye(o))throw new y("the release workflow has no jobs","Add the GoReleaser job first.");for(let i of o.items){let a=i.value.get("steps");if(!dt(a))continue;let c=a.items.findIndex((g)=>ye(g)&&String(g.get("uses")??"").startsWith("goreleaser/goreleaser-action"));if(c===-1)continue;let l=a.items[c].get("env");if(ye(l))for(let g of[...l.items]){let _=String(g.key.value??g.key);if(/^(MACOS_|HOMEBREW_TAP_)/.test(_))l.delete(_),s.push(`removed ${_} from the GoReleaser step`)}let f=a.items.some((g)=>ye(g)&&String(g.get("uses")??"").startsWith("actions/attest-build-provenance@")),p=pm(i),d=p.get("permissions"),h=n.get("permissions"),m=d??h;if(m!=="write-all"){let g=ye(m)?m.toJSON():{};p.set("permissions",n.createNode({...g,contents:"write","id-token":"write",attestations:"write"}))}if(f)s.push("the attestation step is already there; permissions checked");else{let g=n.createNode({name:"Attest the archives for tapster",uses:`actions/attest-build-provenance@${t}`,if:"${{ !github.event.repository.private }}",with:{"subject-checksums":"dist/checksums.txt"}});g.get("uses",!0).comment=` ${r}`,a.items.splice(c+1,0,g),s.push(`added the attestation step (actions/attest-build-provenance ${r}) and its permissions`)}if(!a.items.some((g)=>ye(g)&&g.get("name")===fm))a.items.push(n.createNode(X(Zr(0))[0])),s.push("added the step that rings the hub's doorbell after the draft is open");return{text:n.toString(),notes:s}}throw new y("no GoReleaser step found in the release workflow","tapster add edits the job that runs goreleaser/goreleaser-action.")}function NP(e){let t;try{t=Qe(e)}catch{return null}let r=t.get("jobs");if(!ye(r))return null;for(let n of r.items){let s=pm(n).get("steps");if(!dt(s))continue;if(!s.items.some((i)=>ye(i)&&/gh release create[^\n]*--draft/.test(String(i.get("run")??""))))continue;if(s.items.some((i)=>ye(i)&&i.get("name")===fm))return e;return s.items.push(t.createNode(X(Zr(0))[0])),t.toString()}return null}function RP(e,t,r){return Xh.replaceAll("__CHECKOUT_SHA__",r["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",r["actions/checkout"].tag).replaceAll("__SETUP_BUN_SHA__",r["oven-sh/setup-bun"].sha).replaceAll("__SETUP_BUN_TAG__",r["oven-sh/setup-bun"].tag).replaceAll("__UPLOAD_SHA__",r["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",r["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",r["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",r["actions/download-artifact"].tag).replaceAll("__ATTEST_SHA__",r["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",r["actions/attest-build-provenance"].tag).replaceAll("__NAME__",e).replaceAll("__ENTRY__",t).replace(`__RING__
720
- `,`${Zr(6)}
721
- `)}var CP=new Set([".git",".build","build","dist","DerivedData","node_modules","Pods","Carthage"]),Ht=(e)=>typeof e==="string"&&!e.includes("$(")?e:null,am=(e)=>typeof e==="string"?/\/releases\/latest\/download\/([A-Za-z0-9._-]+\.xml)$/.exec(e)?.[1]??null:null;function dm(e,t=0){if(t>5)return[];let r=[];for(let n of lm(e,{withFileTypes:!0})){if(n.isSymbolicLink()||CP.has(n.name)||n.name.endsWith(".app")||n.name.endsWith(".xcodeproj"))continue;if(n.isDirectory())r.push(...dm(q(e,n.name),t+1));else if(n.name==="Info.plist")r.push(q(e,n.name))}return r}function zP(e){let t=be(q(e,"Makefile"))?Wt(q(e,"Makefile"),"utf8"):"";return{build:/^app:/m.test(t)?"make app":null,appPath:/^APP\s*:?=\s*([^\s].*?\.app)\s*$/m.exec(t)?.[1]??null}}function LP(e){let t=lm(e);if(!t.some((s)=>s==="project.yml"||s==="Package.swift"||s.endsWith(".xcodeproj")))return null;let r=zP(e);if(be(q(e,"project.yml"))){let s=X(Wt(q(e,"project.yml"),"utf8"));for(let[o,i]of Object.entries(s?.targets??{})){if(i.type!=="application")continue;let a=i.info?.properties??{},c=am(a.SUFeedURL);if(!c)continue;let u={...s.settings?.base??{},...i.settings?.base??{}};return{name:Ht(u.PRODUCT_NAME)??o,bundleId:Ht(u.PRODUCT_BUNDLE_IDENTIFIER),feed:c,publicKey:Ht(a.SUPublicEDKey),universal:String(u.ARCHS??"").includes("x86_64"),...r}}}let n=t.find((s)=>s.endsWith(".xcodeproj"));for(let s of dm(e)){let o;try{o=Eh(Wt(s))}catch{continue}let i=am(o.SUFeedURL);if(!i)continue;let a=n&&be(q(e,n,"project.pbxproj"))?Wt(q(e,n,"project.pbxproj"),"utf8"):"",c=/PRODUCT_BUNDLE_IDENTIFIER = "?([A-Za-z0-9.-]+)"?;/.exec(a)?.[1]??null;return{name:Ht(o.CFBundleName)??(n?Ps(n,".xcodeproj"):Ps(e)),bundleId:Ht(o.CFBundleIdentifier)??c,feed:i,publicKey:Ht(o.SUPublicEDKey),universal:/ARCHS = [^;]*x86_64/.test(a),...r}}return null}function DP(e,t,r){let n={...r,name:r.appPath?Ps(r.appPath,".app"):r.name};return[` - name: ${e}`,` repo: ${t}`," kind: app",` app: ${n.name}.app`,` bundle_id: ${n.bundleId&&ds.test(n.bundleId)?n.bundleId:"<bundle id>"}`," assets:",` ${n.universal?"darwin-universal":"darwin-arm64"}: "${n.name}-{version}.app.tar.gz"`," dmg:",` name: "${n.name}-{version}.dmg"`," sparkle:",` key: ${e.replace(/[^a-z0-9]/g,"")}`,...n.feed==="appcast.xml"?[]:[` feed: ${n.feed}`],` public_key: "${n.publicKey??"<SUPublicEDKey>"}"`].join(`
722
- `)}function jP(e,t){if(/[\r\n]/.test(e.build))throw new y("the build command must be one line","Wrap several steps in a make target or a script.");if(!/^[A-Za-z0-9 ._\/-]+\.app$/.test(e.appPath))throw new y(`${e.appPath} is not a path to an .app`,"Pass the path the build writes the app to.");if(!/^macos-[0-9a-z.-]+$/.test(e.runner))throw new y(`${e.runner} is not a macOS runner`,"Use a runner like macos-15.");let r=e.carry.map((n)=>{let[s,o]=n.split(":");if(!s||!o||!/^[A-Za-z0-9._\/-]+$/.test(s)||!/^[A-Za-z0-9._-]+$/.test(o))throw new y(`${n} is not <path>:<asset name>`,"Name each carried file as path:name.");return` cp "${s}" "dist/${o}"`});return Qh.replaceAll("__CHECKOUT_SHA__",t["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",t["actions/checkout"].tag).replaceAll("__UPLOAD_SHA__",t["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",t["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",t["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",t["actions/download-artifact"].tag).replaceAll("__ATTEST_SHA__",t["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",t["actions/attest-build-provenance"].tag).replaceAll("__RUNNER__",e.runner).replaceAll("__BUILD__",e.build).replaceAll("__APP_PATH__",e.appPath).replaceAll("__APP_NAME__",Ps(e.appPath,".app")).replace(`__CARRY__
723
- `,r.map((n)=>`${n}
822
+ ${e.slice(a)}`}let c=vt(t).contents;if(!Rt(c)||c.items.length!==1)throw new v("the entry is not one package","Report this as a tapster bug.");return o.flow=!1,o.items.push(c.items[0]),_r(e,r.toString())}function EE(e,t){if(!e||ln(e,t).length===0)return null;let n=e.trim().replace(/^(?:the|an?)\s+/i,"").replace(/command ?line/gi,"command-line").replace(/\.$/,"");return n=n.charAt(0).toUpperCase()+n.slice(1),ln(n,t).length===0?n:null}function sv(e,t){let n=e;if(t.kind==="go"&&t.workflow!=="release.yml")n+=`
823
+ workflow: ${t.workflow}`;if(t.dependabot)n+=`
824
+ protection: dependabot`;return n}function av(e,t){if(!e)return{line:"- the repository has no description, which Homebrew needs; set one on GitHub or add description: to the hub entry before the first release"};let n=ln(e,t);if(!n.length)return{};let r=EE(e,t);if(!r)return{line:`- Homebrew would reject the repository's description (${n.join(" and ")}); add description: to the hub entry before the first release`};return{line:`- Homebrew would reject the repository's description (${n.join(" and ")}); the entry says "${r}" instead`,add:` description: ${JSON.stringify(r)}`}}var yo=(e)=>e.filter((t)=>/^(HOMEBREW_TAP_|MACOS_)/.test(t)),OE=(e,t,n)=>`https://github.com/apps/${e}/installations/new/permissions?suggested_target_id=${t}&repository_ids[]=${n}`;function cv(e){return[" # in the job that decides the version, on the default branch:"," environment: release"," steps:",` - uses: actions/checkout@${e.sha} # ${e.tag}`,' with: { ssh-key: "${{ secrets.TAPSTER_TAG_KEY }}" }'," # ... compute VERSION ..."," - name: Push the release tag",' run: git tag "v$VERSION" && git push origin "v$VERSION"'].join(`
825
+ `)}async function CE(e,t){try{let n=await e.json("GET",`/repos/${t}/contents/tapster.yml?ref=main`);return{text:Buffer.from(n.content,"base64").toString("utf8"),sha:n.sha}}catch(n){if(n instanceof R&&n.status===404)throw new v(`${t} has no tapster.yml on main`,"Run tapster init in a clone of the hub and push it first.");throw n}}async function lv(e,t,n,r,i){if(!un.test(n))throw new v(`${n} is not a valid package name`,"Use lowercase letters, digits and dashes.");let{text:o,sha:s}=await CE(e,t),a=TE(o,i,n),{invalid:c}=ne(a,t.split("/")[0]),l=c.find((f)=>f.name===n);if(l)throw new v(`the hub would refuse this entry: ${l.reason}`,l.fix);let u=`tapster-add-${n}`,p=(await e.json("GET",`/repos/${t}/git/ref/heads/main`)).object.sha;try{await e.json("POST",`/repos/${t}/git/refs`,{ref:`refs/heads/${u}`,sha:p})}catch(f){if(f instanceof R&&f.status===422)throw new v(`the hub already has a branch ${u}`,`Merge or delete it on ${t}, then run tapster add again.`);throw f}await e.json("PUT",`/repos/${t}/contents/tapster.yml`,{message:`Add ${n}`,content:Buffer.from(a).toString("base64"),sha:s,branch:u});let d=[`tapster add prepared this entry for ${r}:`,"","```yaml",i,"```","",`Merge it to let the hub publish ${r}.`].join(`
826
+ `);return(await e.json("POST",`/repos/${t}/pulls`,{title:`Add ${n}`,head:u,base:"main",body:d})).html_url}async function kr(e,t){let n=await Zt(e,t,"variables"),r=n.find((i)=>i.name==="TAPSTER_APP_SLUG")?.value;if(!r)throw new v(`${t} has no App yet`,"Run tapster init in a clone of the hub first.");return{slug:r,apple:n.some((i)=>i.name==="TAPSTER_TEAM_ID")}}function uv(e){let t=e.split(`
827
+ `).filter((r)=>!/^ {6}darwin-[a-z0-9]+: /.test(r)),n=t.findIndex((r)=>/^ {4}assets:\s*$/.test(r));if(n>=0&&!/^ {6}\S/.test(t[n+1]??""))return null;return t.join(`
828
+ `)}async function pv(e,t,n){let r=await e.getRepo(n),i=await e.json("GET",`/users/${n.split("/")[0]}`);return OE(t,i.id,r.id)}var dv=(e,t)=>`- open this page and choose Install, unless the hub's App already reaches ${e}; the project is preselected (keep "Only select repositories"):
829
+ ${t}`;function RE(e){let t=vt(e),n=[];t.setIn(["release","draft"],!0),n.push("release.draft: true; the tapster hub publishes after signing"),t.setIn(["checksum","name_template"],"checksums.txt"),n.push("checksum.name_template: checksums.txt; the hub reads this name");for(let r of["notarize","homebrew_casks","brews","scoops"])if(t.has(r))t.delete(r),n.push(`removed ${r}; the hub does this now`);return{text:_r(e,t.toString()),notes:n}}var yv=(e)=>e.value,bv="Ring the tapster hub";function IE(e,t,n){let r=vt(e),i=[],o=r.get("jobs");if(!Ie(o))throw new v("the release workflow has no jobs","Add the GoReleaser job first.");for(let s of o.items){let a=s.value.get("steps");if(!Rt(a))continue;let c=a.items.findIndex((g)=>Ie(g)&&String(g.get("uses")??"").startsWith("goreleaser/goreleaser-action"));if(c===-1)continue;let u=a.items[c].get("env");if(Ie(u))for(let g of[...u.items]){let w=String(g.key.value??g.key);if(/^(MACOS_|HOMEBREW_TAP_)/.test(w))u.delete(w),i.push(`removed ${w} from the GoReleaser step`)}let p=a.items.some((g)=>Ie(g)&&String(g.get("uses")??"").startsWith("actions/attest-build-provenance@")),d=yv(s),h=d.get("permissions"),f=r.get("permissions"),m=h??f;if(m!=="write-all"){let g=Ie(m)?m.toJSON():{};d.set("permissions",r.createNode({...g,contents:"write","id-token":"write",attestations:"write"}))}if(p)i.push("the attestation step is already there; permissions checked");else{let g=r.createNode({name:"Attest the archives for tapster",uses:`actions/attest-build-provenance@${t}`,if:"${{ !github.event.repository.private }}",with:{"subject-checksums":"dist/checksums.txt"}});g.get("uses",!0).comment=` ${n}`,a.items.splice(c+1,0,g),i.push(`added the attestation step (actions/attest-build-provenance ${n}) and its permissions`)}if(!a.items.some((g)=>Ie(g)&&g.get("name")===bv))a.items.push(r.createNode(ie(wr(0))[0])),i.push("added the step that rings the hub's doorbell after the draft is open");return{text:_r(e,r.toString()),notes:i}}throw new v("no GoReleaser step found in the release workflow","tapster add edits the job that runs goreleaser/goreleaser-action.")}function NE(e){let t;try{t=vt(e)}catch{return null}let n=t.get("jobs");if(!Ie(n))return null;for(let r of n.items){let i=yv(r).get("steps");if(!Rt(i))continue;if(!i.items.some((s)=>Ie(s)&&/gh release create[^\n]*--draft/.test(String(s.get("run")??""))))continue;if(i.items.some((s)=>Ie(s)&&s.get("name")===bv))return e;return i.items.push(t.createNode(ie(wr(0))[0])),_r(e,t.toString())}return null}function zE(e,t,n,r=!0){return(r?Uc:Uc.replaceAll("darwin-arm64 darwin-x64 ","")).replaceAll("__CHECKOUT_SHA__",n["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",n["actions/checkout"].tag).replaceAll("__SETUP_BUN_SHA__",n["oven-sh/setup-bun"].sha).replaceAll("__SETUP_BUN_TAG__",n["oven-sh/setup-bun"].tag).replaceAll("__UPLOAD_SHA__",n["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",n["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",n["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",n["actions/download-artifact"].tag).replaceAll("__ATTEST_SHA__",n["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",n["actions/attest-build-provenance"].tag).replaceAll("__NAME__",e).replaceAll("__ENTRY__",t).replace(`__RING__
830
+ `,`${wr(6)}
831
+ `)}var DE=new Set([".git",".build","build","dist","DerivedData","node_modules","Pods","Carthage"]),vn=(e)=>typeof e==="string"&&!e.includes("$(")?e:null,fv=(e)=>typeof e==="string"?/\/releases\/latest\/download\/([A-Za-z0-9._-]+\.xml)$/.exec(e)?.[1]??null:null;function wv(e,t=0){if(t>5)return[];let n=[];for(let r of vv(e,{withFileTypes:!0})){if(r.isSymbolicLink()||DE.has(r.name)||r.name.endsWith(".app")||r.name.endsWith(".xcodeproj"))continue;if(r.isDirectory())n.push(...wv(ee(e,r.name),t+1));else if(r.name==="Info.plist")n.push(ee(e,r.name))}return n}function LE(e){let t=oe(ee(e,"Makefile"))??"";return{build:/^app:/m.test(t)?"make app":null,appPath:/^APP\s*:?=\s*([^\s].*?\.app)\s*$/m.exec(t)?.[1]??null}}function Bc(e){let t=vv(e);if(!t.some((o)=>o==="project.yml"||o==="Package.swift"||o.endsWith(".xcodeproj")))return null;let n=LE(e),r=oe(ee(e,"project.yml"));if(r!==null){let o=ie(r);for(let[s,a]of Object.entries(o?.targets??{})){if(a.type!=="application")continue;let c=a.info?.properties??{},l=fv(c.SUFeedURL);if(!l)continue;let u={...o.settings?.base??{},...a.settings?.base??{}};return{name:vn(u.PRODUCT_NAME)??s,bundleId:vn(u.PRODUCT_BUNDLE_IDENTIFIER),feed:l,publicKey:vn(c.SUPublicEDKey),universal:String(u.ARCHS??"").includes("x86_64"),...n}}}let i=t.find((o)=>o.endsWith(".xcodeproj"));for(let o of wv(e)){let s;try{let u=Lc(o);if(!u)continue;s=Pg(u)}catch{continue}let a=fv(s.SUFeedURL);if(!a)continue;let c=i&&oe(ee(e,i,"project.pbxproj"),16777216)||"",l=/PRODUCT_BUNDLE_IDENTIFIER = "?([A-Za-z0-9.-]+)"?;/.exec(c)?.[1]??null;return{name:vn(s.CFBundleName)??(i?bo(i,".xcodeproj"):bo(e)),bundleId:vn(s.CFBundleIdentifier)??l,feed:a,publicKey:vn(s.SUPublicEDKey),universal:/ARCHS = [^;]*x86_64/.test(c),...n}}return null}function jE(e,t,n){let r={...n,name:n.appPath?bo(n.appPath,".app"):n.name};return[` - name: ${e}`,` repo: ${t}`," kind: app",` app: ${r.name}.app`,` bundle_id: ${r.bundleId&&to.test(r.bundleId)?r.bundleId:"<bundle id>"}`," assets:",` ${r.universal?"darwin-universal":"darwin-arm64"}: "${r.name}-{version}.app.tar.gz"`," dmg:",` name: "${r.name}-{version}.dmg"`," sparkle:",` key: ${e.replace(/[^a-z0-9]/g,"")}`,...r.feed==="appcast.xml"?[]:[` feed: ${r.feed}`],` public_key: "${r.publicKey??"<SUPublicEDKey>"}"`].join(`
832
+ `)}function ME(e,t){if(/[\r\n]/.test(e.build))throw new v("the build command must be one line","Wrap several steps in a make target or a script.");if(!/^[A-Za-z0-9 ._\/-]+\.app$/.test(e.appPath))throw new v(`${e.appPath} is not a path to an .app`,"Pass the path the build writes the app to.");if(!/^macos-[0-9a-z.-]+$/.test(e.runner))throw new v(`${e.runner} is not a macOS runner`,"Use a runner like macos-15.");let n=e.carry.map((r)=>{let[i,o]=r.split(":");if(!i||!o||!/^[A-Za-z0-9._\/-]+$/.test(i)||!/^[A-Za-z0-9._-]+$/.test(o))throw new v(`${r} is not <path>:<asset name>`,"Name each carried file as path:name.");return` cp "${i}" "dist/${o}"`});return rv.replaceAll("__CHECKOUT_SHA__",t["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",t["actions/checkout"].tag).replaceAll("__UPLOAD_SHA__",t["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",t["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",t["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",t["actions/download-artifact"].tag).replaceAll("__ATTEST_SHA__",t["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",t["actions/attest-build-provenance"].tag).replaceAll("__RUNNER__",e.runner).replaceAll("__BUILD__",e.build).replaceAll("__APP_PATH__",e.appPath).replaceAll("__APP_NAME__",bo(e.appPath,".app")).replace(`__CARRY__
833
+ `,n.map((r)=>`${r}
724
834
  `).join("")).replace(`__RING__
725
- `,`${Zr(6)}
726
- `)}async function UP(e,t,r=!1,n=!1){let s=(await e.getRepo(t)).default_branch,o=await zh(e,t,s,r,n);if(o==="exists")return`- ${t} is already protected: only an admin can create, move or delete its branches and tags`;if(o==="created")return`- protected ${t}: only you can create, move or delete branches and tags; workflows and Apps, the hub's included, cannot. Push release tags yourself; GitHub then notes "Bypassed rule violations", which is your admin right at work.${n?" Branches named dependabot/... stay open, so Dependabot can open pull requests; the hub accepts that only with protection: dependabot in its entry.":""}`;return`- GitHub does not enforce rulesets on ${t} (private repositories need a paid plan for them), so a stolen App key could tag code the hub would sign. Make it public, use a paid plan, or set protection: off for this package in the hub's tapster.yml to accept that; until then the hub refuses it.`}function ZP(e){let t={hub:null,force:!1,workflow:"release.yml",autoTag:!1,dependabot:!1};for(let r=0;r<e.length;r++){let n=e[r];if(n==="--force")t.force=!0;else if(n==="--auto-tag")t.autoTag=!0;else if(n==="--allow-dependabot")t.dependabot=!0;else if(n==="--hub"&&e[r+1])t.hub=Ss(e[++r]);else if(n==="--workflow"&&e[r+1]&&/^[A-Za-z0-9._-]+\.ya?ml$/.test(e[r+1]))t.workflow=e[++r];else throw new y(`unknown option ${n}`,"Run tapster add --help for the options.")}return t}async function cm(e,t,r,n){let s=q(e,".github/workflows",t);if(be(s)&&!n){let o=NP(await As(s,"utf8"));if(o===null)throw new y(`.github/workflows/${t} already exists`,"Move it aside and run tapster add again. To replace it, run tapster add --force.");return await $s(s,o),`- kept .github/workflows/${t}; it rings the hub after opening the draft`}return await TP(q(e,".github/workflows"),{recursive:!0}),await $s(s,r),`- wrote .github/workflows/${t} (build, attest, draft, ring the hub)`}async function MP(e,t,r,n){let s=LP(e);if(s){let i=s.build??'echo "Set the build command in .github/workflows/release.yml" && exit 1',a=s.appPath??`build/${s.name}.app`,c=[await cm(e,"release.yml",jP({build:i,appPath:a,runner:"macos-15",carry:[]},Re),n.force)];if(!s.build||!s.appPath)c.push("- set the build command and the app path in that file; the build must sign the app ad hoc");return c.push("- the app must set SURequireSignedFeed and SUVerifyUpdateBeforeExtraction to true and stamp both version keys with the tag"),c.push(`- store the Sparkle key in the hub with tapster init --sparkle ${r.replace(/[^a-z0-9]/g,"")} (add --new to create one)`),{kind:"app",entry:DP(r,t,s),reason:null,notes:c,goreleaser:null}}let o=[".goreleaser.yaml",".goreleaser.yml"].find((i)=>be(q(e,i)));if(o&&be(q(e,"go.mod"))){let i=OP(await As(q(e,o),"utf8"));await $s(q(e,o),i.text);let a=q(e,".github/workflows",n.workflow);if(!be(a))throw new y(`no .github/workflows/${n.workflow} found`,"Name the workflow that runs GoReleaser with --workflow.");let c=IP(await As(a,"utf8"),Re["actions/attest-build-provenance"].sha,Re["actions/attest-build-provenance"].tag);return await $s(a,c.text),{kind:"go",entry:null,reason:null,notes:[...i.notes,...c.notes].map((u)=>`- ${u}`),goreleaser:i.text}}if(be(q(e,"package.json"))&&(be(q(e,"bun.lock"))||be(q(e,"bun.lockb")))){let i=em(JSON.parse(await As(q(e,"package.json"),"utf8")),r);if(!i)throw new y("package.json has no bin entry","Add the CLI entry file to bin in package.json.");let a=await cm(e,"release.yml",RP(i.bin,i.entry,Re),n.force),c=a.startsWith("- kept");return{kind:"bun",entry:c?null:tm(r,t,i.bin),reason:null,notes:[a],goreleaser:null,bin:c?i.bin:null}}throw new y("this project is not a GoReleaser-based Go CLI, a Bun CLI or an app with a Sparkle feed","tapster add supports those three.")}async function qP(e,t){let r=(await Te("git",["-C",e,"config","--get","tapster.hub"],{allowFail:!0})).stdout.trim(),n=t??(r?Ss(r):Ss(await te("Which hub publishes this project (owner/repo)? ")));if(n!==r)await Te("git",["-C",e,"config","tapster.hub",n]);return n}async function BP(e,t,r){let n=await e.json("GET",`/repos/${t}/keys`);if(n.some((a)=>a.title==="tapster tags"))return'- the tag key already exists; to replace it, delete the deploy key "tapster tags" and run this again';try{await e.json("PUT",`/repos/${t}/environments/release`,{deployment_branch_policy:{protected_branches:!1,custom_branch_policies:!0}})}catch(a){if(a instanceof D&&[403,404,422].includes(a.status))throw new y(`GitHub refused environments on ${t}`,"Automatic tags keep their key in an environment, which private repositories get with GitHub Pro. Make the project public or upgrade.");throw a}if(!(await e.json("GET",`/repos/${t}/environments/release/deployment-branch-policies`)).branch_policies.some((a)=>a.name===r))await e.json("POST",`/repos/${t}/environments/release/deployment-branch-policies`,{name:r,type:"branch"});let o=Ft("tapster-tag-");try{await C("/usr/bin/ssh-keygen","ssh-keygen",["-q","-t","ed25519","-N","","-C",`tapster tags for ${t}`,"-f",q(o,"key")]),await ee(t,"TAPSTER_TAG_KEY",Wt(q(o,"key"),"utf8"),"release"),await e.json("POST",`/repos/${t}/keys`,{title:"tapster tags",key:Wt(q(o,"key.pub"),"utf8").trim(),read_only:!1})}finally{rt(o)}let i=n.filter((a)=>!a.read_only).map((a)=>a.title);return[`- automatic tags: a deploy key for ${t} lives in its "release" environment, which only ${r} may use, and the rulesets let deploy keys tag.`,...i.length?[` Every deploy key with write access can now tag too: ${i.join(", ")}. Remove the ones you do not need in the repository settings.`]:[]," Push tags from your release workflow like this:",sm(Re["actions/checkout"])].join(`
727
- `)}async function KP(e,t){try{return(await e.json("GET",`/repos/${t}/environments/tapster/variables/TAPSTER_DOORBELL`)).value}catch(r){if(r instanceof D&&r.status===404)return null;throw r}}async function um(e,t){let n=(await e.listReleases(t)).filter((s)=>/^v\d/.test(s.tag_name)).sort((s,o)=>o.created_at.localeCompare(s.created_at))[0];return n?{assets:n.assets.map((s)=>s.name),version:n.tag_name.slice(1)}:null}async function hm(e){let t=ZP(e),r=process.cwd(),n=await Kt(r),s=n.split("/")[1].toLowerCase().replace(/[^a-z0-9-]/g,"-"),o=await MP(r,n,s,t);for(let d of o.notes)console.log(d);let i=await Bt(),a=await qP(r,t.hub),c=(await i.getRepo(n)).default_branch;if(console.log(await UP(i,n,t.autoTag,t.dependabot)),!t.dependabot&&[".github/dependabot.yml",".github/dependabot.yaml"].some((d)=>be(q(r,d))))console.log("- Dependabot cannot open pull requests here now: GitHub does not let personal repositories exempt it from the rules."),console.log(" To keep it, run tapster add --allow-dependabot. Branches named dependabot/... then stay open to anything with write access, the hub's App included, so a stolen App key could run your workflows on its own code there.");if(t.autoTag)console.log(await BP(i,n,c));let{entry:u,reason:l}=o;if(o.kind==="go")({entry:u,reason:l}=rm(s,n,o.goreleaser,await um(i,n)));if(o.kind==="bun"&&o.bin)({entry:u,reason:l}=ia(s,n,"bun",[o.bin],await um(i,n)));if(u&&t.dependabot)u=`${u}
728
- protection: dependabot`;let f=(await i.getRepo(n)).description;if(u&&Ze(f??s,s).length){let d=nm(f,s);if(d)u=`${u}
729
- description: ${JSON.stringify(d)}`,console.log(`- Homebrew would reject the repository's description (${Ze(f??s,s).join(" and ")}); the entry says "${d}" instead`);else console.log(`- Homebrew would reject the repository's description (${Ze(f??s,s).join(" and ")}); add description: to the hub entry before the first release`)}if(u)try{console.log(`- proposed the hub entry in ${await om(i,a,s,n,u)}; merge it to start publishing`)}catch(d){if(!(d instanceof y))throw d;console.log(`- the hub entry was not proposed: ${d.reason}. ${d.fix}
730
- The entry for ${a}'s tapster.yml:
731
- ${u}`)}else console.log(`- no hub entry yet: ${l}`);let p=await KP(i,a);if(p)await vs(n,"TAPSTER_DOORBELL",p),console.log("- the release workflow rings the hub's doorbell, so the hub publishes right after the draft opens");console.log(await im(i,a,n)),console.log(`
732
- Review the changes with git diff, commit and push them, then push a tag to release.`)}async function aa(e,t,r,n){try{let s=await e.json("GET",`/repos/${t}/contents/${r}?ref=${n}`);return Buffer.from(s.content,"base64").toString("utf8")}catch(s){if(s instanceof D&&s.status===404)return null;throw s}}var nt={version:"1.0.0",sha:"61cd09df0198386185ff0c57598ed63f809e35d1"};var Es=`name: tapster
835
+ `,`${wr(6)}
836
+ `)}async function UE(e,t,n=!1,r=!1){let i=(await e.getRepo(t)).default_branch,o=await Cg(e,t,i,n,r),s=[o.deployKeys&&!n?"--auto-tag":"",o.dependabot&&!r?"--allow-dependabot":""].filter(Boolean),a=s.length?` It keeps what an earlier ${s.join(" and ")} opened.`:"";if(o.status==="exists")return`- ${t} is already protected: only an admin can create, move or delete its branches and tags.${a}`;if(o.status==="created")return`- protected ${t}: only you can create, move or delete branches and tags; workflows and Apps, the hub's included, cannot. Push release tags yourself; GitHub then notes "Bypassed rule violations", which is your admin right at work.${o.dependabot?" Branches named dependabot/... stay open, so Dependabot can open pull requests; the hub accepts that only with protection: dependabot in its entry.":""}${a}`;return`- GitHub does not enforce rulesets on ${t} (private repositories need a paid plan for them). A stolen App key could tag code the hub would sign. Make it public or use a paid plan. To accept the risk, set protection: off for this package in the hub's tapster.yml; until then the hub refuses it.`}function Hc(e){let t={hub:null,force:!1,workflow:"release.yml",autoTag:!1,dependabot:!1};for(let n=0;n<e.length;n++){let r=e[n];if(r==="--force")t.force=!0;else if(r==="--auto-tag")t.autoTag=!0;else if(r==="--allow-dependabot")t.dependabot=!0;else if(r==="--hub"&&e[n+1])t.hub=go(e[++n]);else if(r==="--workflow"&&e[n+1]&&/^[A-Za-z0-9._-]+\.ya?ml$/.test(e[n+1]))t.workflow=e[++n];else throw new v(`unknown option ${r}`,"Run tapster add --help for the options.")}return t}async function mv(e,t,n,r){let i=ee(e,".github/workflows",t);if(xt(i)&&!r){let o=NE(gr(i,`.github/workflows/${t}`));if(o===null)throw new v(`.github/workflows/${t} already exists`,"Move it aside and run tapster add again. To replace it, run tapster add --force.");return await vr(e,`.github/workflows/${t}`,o),`- kept .github/workflows/${t}; it rings the hub after opening the draft`}return await vr(e,`.github/workflows/${t}`,n),`- wrote .github/workflows/${t} (build, attest, draft, ring the hub)`}async function ZE(e,t,n,r,i=!0){let o=Bc(e);if(o&&!i)throw new v("the hub has no Apple credentials, which a Mac app needs","Run tapster init --rotate certificate and tapster init --rotate notary in the hub clone, then tapster add again.");if(o){let a=o.build??'echo "Set the build command in .github/workflows/release.yml" && exit 1',c=o.appPath??`build/${o.name}.app`,l=[await mv(e,"release.yml",ME({build:a,appPath:c,runner:"macos-15",carry:[]},We),r.force)];if(!o.build||!o.appPath)l.push("- set the build command and the app path in that file; the build must sign the app ad hoc");return l.push("- the app must set SURequireSignedFeed and SUVerifyUpdateBeforeExtraction to true and stamp both version keys with the tag"),l.push(`- store the Sparkle key in the hub with tapster init --sparkle ${n.replace(/[^a-z0-9]/g,"")} (add --new to create one)`),{kind:"app",entry:jE(n,t,o),reason:null,notes:l,goreleaser:null,files:[".github/workflows/release.yml"]}}let s=[".goreleaser.yaml",".goreleaser.yml"].find((a)=>xt(ee(e,a)));if(s&&xt(ee(e,"go.mod"))){let a=RE(gr(ee(e,s),s));await vr(e,s,a.text);let c=ee(e,".github/workflows",r.workflow);if(!xt(c))throw new v(`no .github/workflows/${r.workflow} found`,"Name the workflow that runs GoReleaser with --workflow.");let l=IE(gr(c,`.github/workflows/${r.workflow}`),We["actions/attest-build-provenance"].sha,We["actions/attest-build-provenance"].tag);return await vr(e,`.github/workflows/${r.workflow}`,l.text),{kind:"go",entry:null,reason:null,notes:[...a.notes,...l.notes].map((u)=>`- ${u}`),goreleaser:a.text,files:[s,`.github/workflows/${r.workflow}`]}}if(xt(ee(e,"package.json"))&&(xt(ee(e,"bun.lock"))||xt(ee(e,"bun.lockb")))){let a;try{a=JSON.parse(gr(ee(e,"package.json"),"package.json"))}catch(p){if(p instanceof v)throw p;throw new v("package.json is not valid JSON","Fix package.json, then try again.")}let c=vo(a,n);if(!c)throw new v("package.json has no bin entry","Add the CLI entry file to bin in package.json.");let l=await mv(e,"release.yml",zE(c.bin,c.entry,We,i),r.force),u=l.startsWith("- kept");return{kind:"bun",entry:u?null:iv(n,t,c.bin),reason:null,notes:[l],goreleaser:null,bin:u?c.bin:null,files:[".github/workflows/release.yml"]}}throw new v("this project is not a GoReleaser-based Go CLI, a Bun CLI or an app with a Sparkle feed","tapster add supports those three.")}async function GE(e,t){let n=(await $e("git",["-C",e,"config","--get","tapster.hub"],{allowFail:!0})).stdout.trim(),r=t??(n?go(n):go(await me("Which hub publishes this project (owner/repo)? ")));return{hub:r,remember:async()=>void(r!==n&&await $e("git",["-C",e,"config","tapster.hub",r]))}}async function qE(e,t,n){let r=await e.json("GET",`/repos/${t}/keys`);if(r.some((a)=>a.title==="tapster tags"))return'- the tag key already exists; to replace it, delete the deploy key "tapster tags" and run this again';try{await e.json("PUT",`/repos/${t}/environments/release`,{deployment_branch_policy:{protected_branches:!1,custom_branch_policies:!0}})}catch(a){if(a instanceof R&&[403,404,422].includes(a.status))throw new v(`GitHub refused environments on ${t}`,"Automatic tags keep their key in an environment, which private repositories get with GitHub Pro. Make the project public or upgrade.");throw a}if(!(await e.json("GET",`/repos/${t}/environments/release/deployment-branch-policies`)).branch_policies.some((a)=>a.name===n))await e.json("POST",`/repos/${t}/environments/release/deployment-branch-policies`,{name:n,type:"branch"});let o=kt("tapster-tag-");try{await j("/usr/bin/ssh-keygen","ssh-keygen",["-q","-t","ed25519","-N","","-C",`tapster tags for ${t}`,"-f",ee(o,"key")]),await X(t,"TAPSTER_TAG_KEY",hv(ee(o,"key"),"utf8"),"release"),await e.json("POST",`/repos/${t}/keys`,{title:"tapster tags",key:hv(ee(o,"key.pub"),"utf8").trim(),read_only:!1})}finally{Fe(o)}let s=r.filter((a)=>!a.read_only).map((a)=>a.title);return[`- automatic tags: a deploy key for ${t} lives in its "release" environment, which only ${n} may use. The rulesets let deploy keys tag.`,...s.length?[` Every deploy key with write access can now tag too: ${s.join(", ")}. Remove the ones you do not need in the repository settings.`]:[]," Push tags from your release workflow like this:",cv(We["actions/checkout"])].join(`
837
+ `)}async function BE(e,t){try{return(await e.json("GET",`/repos/${t}/environments/tapster/variables/TAPSTER_DOORBELL`)).value}catch(n){if(n instanceof R&&n.status===404)return null;throw n}}async function gv(e,t){let r=(await e.listReleases(t)).filter((i)=>/^v\d/.test(i.tag_name)).sort((i,o)=>o.created_at.localeCompare(i.created_at))[0];return r?{assets:r.assets.map((i)=>i.name),version:r.tag_name.slice(1)}:null}async function Fc(e,t,n,r,i,o,s){let a=wo(n),{slug:c,apple:l}=i,u=await ZE(t,n,a,o,l);for(let x of u.notes)s(x);let p=await e.getRepo(n);if(s(await UE(e,n,o.autoTag,o.dependabot)),!o.dependabot&&[".github/dependabot.yml",".github/dependabot.yaml"].some((x)=>xt(ee(t,x))))s("- Dependabot cannot open pull requests here now: GitHub does not let personal repositories exempt it from the rules."),s(" To keep it, run tapster add --allow-dependabot. Branches named dependabot/... then stay open to anything with write access, the hub's App included, so a stolen App key could run your workflows on its own code there.");if(o.autoTag)s(await qE(e,n,p.default_branch));let{entry:d,reason:h}=u;if(u.kind==="go")({entry:d,reason:h}=ov(a,n,u.goreleaser,await gv(e,n)));if(u.kind==="bun"&&u.bin)({entry:d,reason:h}=qc(a,n,"bun",[u.bin],await gv(e,n)));if(d&&!l){if(d=uv(d),d)s("- the hub has no Apple credentials, so the entry leaves out the macOS builds");else h="the hub has no Apple credentials and the project builds only for macOS; run tapster init --rotate certificate and tapster init --rotate notary in the hub, then tapster add again";if(u.kind==="go"||u.bin)s(` Remove the macOS builds from ${u.kind==="go"?"the GoReleaser builds (goos: darwin)":".github/workflows/release.yml"} too: the hub refuses macOS code it cannot sign.`)}let f=null;if(d){d=sv(d,{kind:u.kind,workflow:o.workflow,dependabot:o.dependabot});let x=av(p.description,a);if(x.line)s(x.line);if(x.add)d=`${d}
838
+ ${x.add}`;try{f=await lv(e,r,a,n,d),s(`- proposed the hub entry in ${f}; merge it to start publishing`)}catch(_){if(!(_ instanceof v))throw _;if(s(`- the hub entry was not proposed: ${_.reason}. ${_.fix}
839
+ The entry for ${r}'s tapster.yml:
840
+ ${d}`),o.dependabot&&_.reason.includes("is already in"))s(" Its existing entry needs protection: dependabot, or the hub refuses the project.")}}else s(`- no hub entry yet: ${h}`);let m=await BE(e,r);if(m)await po(n,"TAPSTER_DOORBELL",m),s("- the release workflow rings the hub's doorbell, so the hub publishes right after the draft opens");let g=await e.json("GET",`/repos/${n}/actions/secrets?per_page=100`).then((x)=>yo(x.secrets.map((_)=>_.name)),()=>[]);if(g.length)s(`- ${n} still holds release secrets that the hub replaces: ${g.join(", ")}. Delete them once the hub has published a release: gh secret delete <name> --repo ${n}`);let w=await pv(e,c,n);return s(dv(n,w)),{pr:f,entry:d,installUrl:w,files:u.files,kind:u.kind}}var wo=(e)=>e.split("/")[1].toLowerCase().replace(/[^a-z0-9-]/g,"-");async function _v(e){let t=Hc(e),n=process.cwd(),r=await He(n),i=await _t(),{hub:o,remember:s}=await GE(n,t.hub),a=await kr(i,o);await s(),await Fc(i,n,r,o,a,t,(c)=>console.log(c)),console.log(`
841
+ Review the changes with git diff, commit and push them, then push a tag to release.`)}async function de(e,t,n,r){try{let i=await e.json("GET",`/repos/${t}/contents/${n}?ref=${r}`);return Buffer.from(i.content,"base64").toString("utf8")}catch(i){if(i instanceof R&&i.status===404)return null;throw i}}async function Kc(e,t,n,r){for(let i=0;i<5;i++){let s=(await e.json("GET",`/repos/${t}/git/ref/heads/main`)).object.sha,a=await e.json("GET",`/repos/${t}/git/commits/${s}`),c=await r((p)=>de(e,t,p,s));if(c.length===0)return"unchanged";let l=await e.json("POST",`/repos/${t}/git/trees`,{base_tree:a.tree.sha,tree:c.map((p)=>({path:p.path,mode:"100644",type:"blob",...p.content===null?{sha:null}:{content:p.content}}))}),u=await e.json("POST",`/repos/${t}/git/commits`,{message:n,tree:l.sha,parents:[s]});try{return await e.json("PATCH",`/repos/${t}/git/refs/heads/main`,{sha:u.sha,force:!1}),"committed"}catch(p){if(p instanceof R&&p.status===422)continue;throw p}}throw new v("the hub's main branch kept moving","The next run retries.")}var se={version:"1.1.0",sha:"94f641318261803138c0610f1e867a85f80bc21e"};var _o=`name: tapster
733
842
  on:
734
843
  schedule:
735
844
  - cron: "__CRON__"
@@ -751,12 +860,14 @@ jobs:
751
860
  check:
752
861
  runs-on: ubuntu-24.04
753
862
  environment: { name: tapster, deployment: false }
754
- permissions: { contents: read }
863
+ permissions: { contents: read, issues: read }
755
864
  outputs:
756
865
  work: \${{ steps.check.outputs.work }}
757
866
  macos: \${{ steps.check.outputs.macos }}
758
867
  render: \${{ steps.check.outputs.render }}
759
868
  linux: \${{ steps.check.outputs.linux }}
869
+ findings: \${{ steps.check.outputs.findings }}
870
+ report: \${{ steps.check.outputs.report }}
760
871
  steps:
761
872
  - name: Check out the hub
762
873
  uses: actions/checkout@__CHECKOUT_SHA__ # __CHECKOUT_TAG__
@@ -771,6 +882,17 @@ jobs:
771
882
  GITHUB_TOKEN: \${{ github.token }}
772
883
  TAPSTER_TEAM_ID: \${{ vars.TAPSTER_TEAM_ID }}
773
884
  TAPSTER_CERT_EXPIRES: \${{ vars.TAPSTER_CERT_EXPIRES }}
885
+ report:
886
+ needs: check
887
+ if: \${{ !cancelled() && (needs.check.outputs.report == 'true' || (needs.check.result == 'failure' && needs.check.outputs.findings == '')) }}
888
+ runs-on: ubuntu-24.04
889
+ permissions: { issues: write }
890
+ steps:
891
+ - name: Update the hub's health issue
892
+ uses: doguyilmaz/tapster@__TAPSTER_SHA__ # __TAPSTER_TAG__
893
+ with: { mode: report, template: 2, findings: "\${{ needs.check.outputs.findings }}", check: "\${{ needs.check.result }}" }
894
+ env:
895
+ GITHUB_TOKEN: \${{ github.token }}
774
896
  sign:
775
897
  needs: check
776
898
  if: \${{ !cancelled() && needs.check.outputs.work != '[]' && needs.check.outputs.work != '' }}
@@ -919,8 +1041,7 @@ jobs:
919
1041
  - name: Deploy the Linux repositories
920
1042
  id: deploy
921
1043
  uses: actions/deploy-pages@__PAGES_DEPLOY_SHA__ # __PAGES_DEPLOY_TAG__
922
- `;import{createHash as uE,createPrivateKey as lE,createPublicKey as pE}from"crypto";import{existsSync as ot,readFileSync as Fr}from"fs";import{mkdir as jm,writeFile as da}from"fs/promises";import{join as de}from"path";import{createHash as GP,createPrivateKey as HP,createPublicKey as mm,sign as WP,verify as VP}from"crypto";var kt=2n**255n-19n,ca=2n**252n+27742317777372353535851937790883648493n,F=(e,t=kt)=>(e%t+t)%t,ua=(e,t)=>{let r=1n,n=F(e);for(let s=t;s>0n;s>>=1n){if(s&1n)r=r*n%kt;n=n*n%kt}return r},Is=(e)=>ua(e,kt-2n),wm=F(-121665n*Is(121666n));function gm([e,t,r,n],[s,o,i,a]){let c=F((t-e)*(o-s)),u=F((t+e)*(o+s)),l=F(2n*n*a*wm),f=F(2n*r*i),p=u-c,d=f-l,h=f+l,m=u+c;return[F(p*d),F(h*m),F(d*h),F(p*m)]}function bm(e,t){let r=[0n,1n,1n,0n],n=t;for(let s=e;s>0n;s>>=1n){if(s&1n)r=gm(r,n);n=gm(n,n)}return r}var _m=(()=>{let e=F(4n*Is(5n)),t=F(e*e-1n),r=F(wm*e*e+1n),n=ua(F(t*Is(r)),(kt+3n)/8n);if(F(n*n*r-t)!==0n)n=F(n*ua(2n,(kt-1n)/4n));if(n&1n)n=kt-n;return[n,e,1n,F(n*e)]})(),Os=(e)=>e.reduceRight((t,r)=>t<<8n|BigInt(r),0n);function vm(e){let t=Buffer.alloc(32),r=e;for(let n=0;n<32;n++)t[n]=Number(r&255n),r>>=8n;return t}function km([e,t,r]){let n=Is(r),s=F(e*n),o=F(t*n);return vm(o|(s&1n)<<255n)}var ym=(...e)=>GP("sha512").update(Buffer.concat(e)).digest();function YP(e,t,r){let n=Os(e.subarray(0,32)),s=F(Os(ym(e.subarray(32,64),r)),ca),o=km(bm(s,_m)),i=F(Os(ym(o,t,r)),ca);return Buffer.concat([o,vm(F(s+i*n,ca))])}var JP=Buffer.from("302e020100300506032b657004220420","hex"),QP=Buffer.from("302a300506032b6570032100","hex"),Ts=(e)=>new y(`the Sparkle key ${e}`,"Store the text that generate_keys -x writes, with tapster init --sparkle <label>.");function xm(e){let t=e.trim();if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw Ts("is not base64");let r=Buffer.from(t,"base64");Mt(r.toString("hex"));let n,s;if(r.length===32){let i=HP({key:Buffer.concat([JP,r]),format:"der",type:"pkcs8"}),a=mm(i).export({format:"der",type:"spki"});n=a.subarray(a.length-32),s=(c)=>WP(null,c,i)}else if(r.length===96){let i=r.subarray(0,64);if(Mt(i.toString("base64")),n=Buffer.from(r.subarray(64)),!km(bm(Os(i.subarray(0,32)),_m)).equals(n))throw Ts("is damaged: its two halves do not match");s=(a)=>YP(i,n,a)}else throw Ts(`decodes to ${r.length} bytes, not 32 or 96`);let o=mm({key:Buffer.concat([QP,n]),format:"der",type:"spki"});return{publicKey:n.toString("base64"),sign(i){let a=s(i);if(!VP(null,i,o,a))throw Ts("produced a signature that does not verify");return a}}}function Sm(e,t=""){try{let n=JSON.parse(e);if(typeof n.id==="string"&&typeof n.status==="string")return{id:n.id,status:n.status}}catch{}if(/HTTP status code: 401\b/.test(t))throw new y("Apple rejected the notary key (HTTP 401)","Store the App Store Connect key, its Key ID and the Issuer ID again with tapster init --rotate notary. The draft is untouched.");let r=t.split(`
923
- `).find((n)=>n.trim()!=="");if(r)throw new y(`notarytool failed: ${ys(r.trim()).slice(0,300)}`,"The draft is untouched; the next run tries again.");throw new y("notarytool returned output tapster could not read","Re-run the workflow; if it repeats, check the App Store Connect key.")}var Am=`# __TAP__
1044
+ `;var kv=`# __TAP__
924
1045
 
925
1046
  \`\`\`sh
926
1047
  brew tap __TAP__
@@ -945,8 +1066,16 @@ scoop install __OWNER__/<name>
945
1066
  | \`.tapster/state.json\` | the releases tapster published |
946
1067
 
947
1068
  Releases are signed and published by the \`tapster\` workflow; change the projects, not these files.
948
- `;import{generateKeyPairSync as eE}from"crypto";import{existsSync as tE}from"fs";function $m(){let{privateKey:e,publicKey:t}=eE("ed25519"),r=e.export({format:"der",type:"pkcs8"}).subarray(-32),n=t.export({format:"der",type:"spki"}).subarray(-32);return{seed:r.toString("base64"),publicKey:n.toString("base64")}}var rE=/^[A-Za-z0-9 .:/@_+=()-]+$/;function qr(e){for(let t of[e.service,e.account,e.label,...e.comment===void 0?[]:[e.comment]])if(!rE.test(t))throw new y(`"${t}" cannot name a keychain item`,"Use letters, digits and simple punctuation.")}function nE(e,t){qr(e);let r=e.comment===void 0?"":` -j "${e.comment}"`,n=`add-generic-password -s "${e.service}" -a "${e.account}" -l "${e.label}" -D "private key"${r} -T "" -X ${Buffer.from(t).toString("hex")}
949
- `;if(n.length>4000)throw new y("the key is too long for one security command","tapster stores large keys through the Security API instead.");return n}var sE=`ObjC.import("Security");
1069
+ `;var J=".github/workflows/tapster.yml";function Te(e){let t=e.packages.filter(Y).flatMap((n)=>n.sparkle?[n.sparkle.key,...n.sparkle.next_key?[n.sparkle.next_key]:[]]:[]);return[...new Set(t)]}function xv(e){let t=e.map((n)=>`SPARKLE_KEY_${n.toUpperCase()}: "\${{ secrets.SPARKLE_KEY_${n.toUpperCase()} }}"`);return t.length?`{ ${t.join(", ")} }`:"{}"}function Wc(e,t,n,r=[],i=10){return e.replaceAll("__CRON__",fo(i)).replaceAll("__SPARKLE_ENV__",xv(r)).replaceAll("__CHECKOUT_SHA__",t["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",t["actions/checkout"].tag).replaceAll("__ATTEST_SHA__",t["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",t["actions/attest-build-provenance"].tag).replaceAll("__UPLOAD_SHA__",t["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",t["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",t["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",t["actions/download-artifact"].tag).replaceAll("__PAGES_UPLOAD_SHA__",t["actions/upload-pages-artifact"].sha).replaceAll("__PAGES_UPLOAD_TAG__",t["actions/upload-pages-artifact"].tag).replaceAll("__PAGES_DEPLOY_SHA__",t["actions/deploy-pages"].sha).replaceAll("__PAGES_DEPLOY_TAG__",t["actions/deploy-pages"].tag).replaceAll("__TAPSTER_SHA__",n.sha).replaceAll("__TAPSTER_TAG__",n.tag)}async function KE(e,t,n){if(n===null){if(t.sha)return{sha:t.sha,tag:`v${t.version}`};throw new v("this tapster was built from a checkout, so it does not know which tapster the hub should run","Pass --tapster <commit> with a full commit SHA from tapster's main or use a released tapster.")}if(!/^[0-9a-f]{40}$/.test(n))throw new v(`${n} is not a full commit SHA`,"Pass all 40 characters of the commit.");let r=await e.json("GET",`/repos/doguyilmaz/tapster/compare/${n}...main`);if(r.status!=="ahead"&&r.status!=="identical")throw new v(`${n} is not on tapster's main`,"Pin a commit that is on main.");return{sha:n,tag:"main"}}var Gt=/doguyilmaz\/tapster@([0-9a-f]{40}) # (\S+)/;function WE(e,t){let n=(o)=>`${o[2]} (${o[1].slice(0,7)})`,r=Gt.exec(t),i=e===null?null:Gt.exec(e);if(!i)return`tapster ${n(r)}`;return i[1]===r[1]&&i[2]===r[2]?`tapster ${n(i)}, unchanged`:`tapster ${n(i)} -> ${n(r)}`}function Vc(e,t,n){if(e===null)return"missing";let r=Gt.exec(e),i=n??t.sha;if(!r)return"other";if(r[1]===i)return"current";if(n!==null||!t.sha)return"other";let o=ro(r[2]),s=ro(`v${t.version}`);if(!o||!s)return"other";let a=Sc(o,s);return a<0?"older":a>0?"newer":"other"}function ko(e,t){let n=/(\n\s+with: \{ mode: sparkle(?:, template: \d+)? \}\n\s+env: ).*\n/;if(!n.test(e))throw new v("the hub workflow has no sparkle step","Run tapster init --workflow to rewrite it from the template.");return e.replace(n,(r,i)=>`${i}${xv(t)}
1070
+ `)}function VE(e,t,n){if(e===t)return[];let r=[`The hub looks for new drafts every ${e} minutes; change it with tapster init --workflow --every <minutes>.`];if(t!==null)r.push("If the hub has a doorbell, run tapster init --rotate doorbell after you push, so it keeps the same schedule.");if(n.isPrivate&&e>=60&&n.every===null)r.push("GitHub bills every run of a private hub as at least one minute: every 10 minutes would use about 4,300 of the 2,000 free minutes a month. The doorbell (tapster init --doorbell) still publishes right after each release.");return r}async function Yc(e,t,n,r,i){let o=await KE(e,se,r),s=t===null?null:rt(t),a=i.every??s??(i.isPrivate?60:10),c=Wc(_o,We,o,n,a);return{file:{path:J,content:c,before:t},change:WE(t,c),notes:VE(a,s,i)}}function xo(e){let[t,n]=e.split("/"),r=`${t}/${n.replace(/^homebrew-/,"")}`;return[{path:"tapster.yml",content:`version: 1
1071
+ tap: ${r}
1072
+ packages: []
1073
+ `,before:null},{path:".tapster/state.json",content:`${JSON.stringify({version:1,packages:{}},null,2)}
1074
+ `,before:null},{path:"README.md",content:kv.replaceAll("__TAP__",r).replaceAll("__OWNER__",t).replaceAll("__HUB__",e),before:null}]}async function So(e,t,n,r,i){let o=[],s=[];for(let u of xo(t))if(await n(u.path)===null)o.push(u);else s.push(u.path);let a=await n("tapster.yml"),c=a===null?[]:Te(ne(a,t.split("/")[0]).config),l=await Yc(e,await n(J),c,r,i);return o.push(l.file),{files:o,kept:s,change:l.change,notes:l.notes}}var F=(e,t)=>({name:e,ok:!0,fix:"",...t?{note:t}:{}}),M=(e,t)=>({name:e,ok:!1,fix:t});function YE(e){let n=ie(e)?.on,r=n&&typeof n==="object"&&!Array.isArray(n)?Object.keys(n):[];return r.length>0&&r.every((i)=>i==="schedule"||i==="workflow_dispatch")?F("the hub workflow runs only on schedule and manual dispatch"):M("the hub workflow runs only on schedule and manual dispatch","Other triggers (pull_request_target, issue_comment, workflow_run) would reach the credentials. Restore .github/workflows/tapster.yml with tapster init.")}function JE(e){let n=(i)=>{let o;try{o=ie(i)}catch{return!0}let s=o?.jobs;if(!s||typeof s!=="object")return!1;return Object.values(s).some((a)=>{let c=a?.environment,l=typeof c==="object"&&c!==null?c.name:c;return typeof l==="string"&&(l.trim().toLowerCase()==="tapster"||l.includes("${{"))})},r=Object.entries(e).filter(([,i])=>n(i)).map(([i])=>i);return r.length===0?F("no other workflow uses the tapster environment"):M("no other workflow uses the tapster environment",`Remove the tapster environment from ${r.join(", ")}.`)}function QE(e,t,n){let i=Te(e),o=i.filter((a)=>!t.includes(`SPARKLE_KEY_${a.toUpperCase()}`));if(o.length)return M("every Sparkle key is stored and passed to the sparkle step",o.map((a)=>`Run tapster init --sparkle ${a}.`).join(" "));let s=i.filter((a)=>!n.includes(`SPARKLE_KEY_${a.toUpperCase()}: "\${{ secrets.SPARKLE_KEY_${a.toUpperCase()} }}"`));if(s.length)return M("every Sparkle key is stored and passed to the sparkle step",`The workflow does not pass ${s.map((a)=>`SPARKLE_KEY_${a.toUpperCase()}`).join(", ")}. Run tapster init --workflow.`);return F("every Sparkle key is stored and passed to the sparkle step")}function XE(e,t){let r=Object.entries(t).filter(([,i])=>i!==e).map(([i])=>i);return r.length?M("every project rings the hub's doorbell",r.map((i)=>`gh variable set TAPSTER_DOORBELL --repo ${i} --body ${e}`).join("; ")):F("every project rings the hub's doorbell")}function eO(e,t,n,r){if(!n.includes("TAPSTER_LINUX_KEY"))return M("the Linux repositories can be signed and deployed","Run tapster init --linux to make and store the signing key.");if(!r)return M("the Linux repositories can be signed and deployed","Turn on GitHub Pages for the hub; tapster init --linux does it.");if(r.build_type!=="workflow")return M("the Linux repositories can be signed and deployed","Set the hub's Pages source to GitHub Actions; tapster init --linux does it.");let o=r.html_url.replace(/\/$/,"");if(o!==lg(e,t))return M("the Linux repositories can be signed and deployed",`Pages serves ${o}; set linux.url in tapster.yml to it.`);return F("the Linux repositories can be signed and deployed")}var Sv=["MACOS_SIGN_P12","MACOS_SIGN_PASSWORD","MACOS_NOTARY_KEY","MACOS_NOTARY_KEY_ID","MACOS_NOTARY_ISSUER_ID"],tO=[...Sv,"TAPSTER_APP_PRIVATE_KEY"];function nO(e,t,n){let i=e?.packages.some(no)??!1,o=[...["TAPSTER_APP_PRIVATE_KEY",...i?Sv:[]].filter((a)=>!t.includes(a)),...["TAPSTER_APP_ID","TAPSTER_APP_SLUG",...i?["TAPSTER_TEAM_ID"]:[]].filter((a)=>!n.includes(a))];if(o.length===0)return F("the credentials this hub needs are stored");let s=[...o.some((a)=>a.startsWith("TAPSTER_APP"))?["tapster init"]:[],...o.some((a)=>a.startsWith("MACOS_SIGN")||a==="TAPSTER_TEAM_ID")?["tapster init --rotate certificate"]:[],...o.some((a)=>a.startsWith("MACOS_NOTARY"))?["tapster init --rotate notary"]:[]];return M("the credentials this hub needs are stored",`Missing: ${o.join(", ")}. Run ${s.join(" and ")}.`)}function rO(e,t){let r=Gt.exec(e);if(!r)return M("the hub workflow is tapster's template","The workflow does not pin tapster. Run tapster init --workflow.");if(r[1]!==t.sha)return F("the hub workflow is tapster's template",`the hub runs tapster ${r[2]} (${r[1].slice(0,7)}) and this is tapster ${t.version}; tapster init --workflow moves the hub to this one. The tapster that wrote the workflow checks it byte for byte`);let i=[...e.matchAll(/SPARKLE_KEY_([A-Z0-9]+): "/g)].map((s)=>s[1].toLowerCase());return Wc(_o,We,{sha:r[1],tag:r[2]},i,rt(e)??10)===e?F("the hub workflow is tapster's template"):M("the hub workflow is tapster's template","The workflow differs from the template; hand edits can reach the credentials. Run tapster init --workflow and review the diff.")}function Jc(e){return e.some((r)=>r.enforcement==="active"&&r.target==="branch"&&(r.conditions?.ref_name?.include??[]).some((i)=>i==="~DEFAULT_BRANCH"||i==="~ALL"||i==="refs/heads/main")&&(r.conditions?.ref_name?.exclude??[]).length===0&&["deletion","non_fast_forward"].every((i)=>(r.rules??[]).some((o)=>o.type===i))&&(r.bypass_actors??[]).every((i)=>i.actor_type==="RepositoryRole"&&i.actor_id===5))?F("main cannot be deleted or force-pushed, by anyone"):M("main cannot be deleted or force-pushed, by anyone",'Run tapster init to restore the ruleset "tapster main" (active, deletion and force pushes blocked, no one else may bypass).')}function Qc(e,t){return e.allowed_actions==="selected"&&e.sha_pinning_required===!0&&t?.verified_allowed===!1&&(t.patterns_allowed??[]).every((i)=>i==="doguyilmaz/tapster@*")?F("the hub runs only GitHub's and tapster's actions, pinned by commit"):M("the hub runs only GitHub's and tapster's actions, pinned by commit","Run tapster init to restore the hub's Actions policy.")}function iO(e,t,n){let i=e.map((a)=>a.login).filter((a)=>a.toLowerCase()!==n.toLowerCase()),o=t.filter((a)=>!a.read_only).map((a)=>a.title);if(i.length===0&&o.length===0)return F("only you can change the hub");let s=[...i.length?[`collaborators ${i.join(", ")} can push to main and change what the hub signs`]:[],...o.length?[`deploy keys ${o.join(", ")} can push too`]:[]];return M("only you can change the hub",`${s.join("; ")}. Remove them in the hub's settings unless you trust them with your signing keys.`)}function oO(e,t){if(e===String(t))return F("the doorbell keeps the workflow's schedule");return M("the doorbell keeps the workflow's schedule",`The doorbell starts the hub every ${e??"10"} minutes and the workflow every ${t}. Run tapster init --rotate doorbell to move the doorbell to the workflow's schedule.`)}function sO(e,t,n){if(e.some((o)=>(o.event==="schedule"||o.event==="workflow_dispatch")&&t-Date.parse(o.created_at)<86400000))return F("the hub ran in the last day");return M("the hub ran in the last day",n?"Neither GitHub's schedule nor the doorbell started a run. Check the doorbell's logs with wrangler tail and the workflow in the Actions tab.":"GitHub's schedule did not start a run; it is best effort. tapster init --doorbell adds a second clock that starts the hub on time.")}async function it(e,t,n){try{let r=await e.json("GET",t);return(n?r[n]:r)??[]}catch(r){if(r instanceof R&&r.status===404)return[];throw r}}async function aO(e,t,n,r,i){let o=[],s=await e.json("GET",`/repos/${t}/environments/tapster`).catch(()=>null);if(!s)return[M("the tapster environment exists","Run tapster init.")];let a=await e.json("GET",`/repos/${t}/environments/tapster/deployment-branch-policies`);o.push(s.deployment_branch_policy?.custom_branch_policies&&a.branch_policies.length===1&&a.branch_policies[0].name==="main"&&(a.branch_policies[0].type??"branch")==="branch"?F("only main may open the tapster environment"):M("only main may open the tapster environment","Run tapster init to restore the branch rule."));let c=(await it(e,`/repos/${t}/environments/tapster/secrets?per_page=100`,"secrets")).map((b)=>b.name),l=await it(e,`/repos/${t}/environments/tapster/variables?per_page=100`,"variables");o.push(nO(r,c,l.map((b)=>b.name)));let u=l.find((b)=>b.name==="TAPSTER_CERT_EXPIRES")?.value;if(u&&Date.parse(`${u}T00:00:00Z`)-Date.now()<2592000000)o.push(M("the Developer ID certificate is valid for 30 more days",`It expires on ${u}. Renew it at developer.apple.com, then run tapster init --rotate certificate.`));if(r&&Te(r).length)o.push(QE(r,c,i));if(r?.packages.some((b)=>!Y(b)&&b.linux)){let b=await e.json("GET",`/repos/${t}/pages`).catch(()=>null);if(o.push(eO(r,t,c,b)),c.includes("TAPSTER_LINUX_KEY_PREVIOUS"))o.push(F("the Linux key rotation is running","the previous Linux key still signs; once apt and dnf users have the new key, run tapster init --rotate linux --finish"))}let p=await it(e,`/repos/${t}/actions/variables?per_page=100`,"variables"),d=[...l,...p].map((b)=>b.name).filter((b)=>tO.includes(b)||/^SPARKLE_KEY_/.test(b)||b.startsWith("TAPSTER_LINUX_KEY"));o.push(d.length?M("credentials are secrets, not variables",`Variables are readable by anyone with access; delete ${d.join(", ")} and store them with tapster init --rotate.`):F("credentials are secrets, not variables"));let h=l.find((b)=>b.name==="TAPSTER_DOORBELL")?.value;if(h&&r){let b={};for(let k of r.packages)b[k.repo]=await e.json("GET",`/repos/${k.repo}/actions/variables/TAPSTER_DOORBELL`).then((S)=>S.value).catch(()=>null);o.push(XE(h,b)),o.push(oO(l.find((k)=>k.name==="TAPSTER_DOORBELL_EVERY")?.value,rt(i)??10))}let f=await e.json("GET",`/repos/${t}/actions/permissions/workflow`);o.push(f.default_workflow_permissions==="read"?F("the default workflow token is read-only"):M("the default workflow token is read-only","Run tapster init."));let m=await Promise.all((await it(e,`/repos/${t}/rulesets`)).map((b)=>e.json("GET",`/repos/${t}/rulesets/${b.id}`)));o.push(Jc(m));let g=await e.json("GET",`/repos/${t}/actions/permissions`),w=g.allowed_actions==="selected"?await e.json("GET",`/repos/${t}/actions/permissions/selected-actions`):null;o.push(Qc(g,w)),o.push(iO(await it(e,`/repos/${t}/collaborators?affiliation=direct&per_page=100`),await it(e,`/repos/${t}/keys?per_page=100`),n));let x=await e.json("GET",`/repos/${t}/actions/workflows/tapster.yml`).catch(()=>null);o.push(x?.state==="active"?F("the hub workflow is enabled"):M("the hub workflow is enabled","Enable the tapster workflow in the hub's Actions tab (GitHub pauses it after 60 days without activity; the doorbell turns it back on)."));let _=await it(e,`/repos/${t}/actions/workflows/tapster.yml/runs?per_page=30`,"workflow_runs");o.push(sO(_,Date.now(),Boolean(h)));for(let b of r?.packages??[]){let k=await e.getRepo(b.repo).catch((A)=>A instanceof R?null:Promise.reject(A));if(!k){o.push(M(`${b.repo} exists`,"Fix the repo field in tapster.yml."));continue}if(k.private)o.push(F(`${b.repo} is published by the hub`,`${b.repo} is private: the hub publishes its releases, but Homebrew, Scoop, apt and dnf users can only install from public projects`));if(b.protection==="off")o.push(F(`${b.repo} is protected`,`protection is off for ${b.name}: a stolen App key could tag code there that the hub would sign`));else{let A=await mr(e,b.repo,k.default_branch,"admin",b.protection==="dependabot"),L=b.protection==="dependabot"?`branches named dependabot/... are open on ${b.repo}, so a stolen App key could run its workflows on code of its own there`:void 0;o.push(A.length?M(`${b.repo} is protected`,`${A.join("; ")}. Run tapster add in a clone of ${b.repo}.`):F(`${b.repo} is protected`,L))}let S=(await it(e,`/repos/${b.repo}/actions/secrets?per_page=100`,"secrets")).map((A)=>A.name),O=yo(S);o.push(O.length?M(`${b.repo} holds no release secrets`,`Delete ${O.join(", ")}: gh secret delete <name> --repo ${b.repo}`):F(`${b.repo} holds no release secrets`))}return o}async function cO(e,t,n){let i=(await e.json("GET",`/repos/${t}/environments/tapster/variables`).catch(()=>null))?.variables.find((o)=>o.name==="TAPSTER_APP_SLUG")?.value;if(!i||n.length===0)return null;return`note: the App must be installed on ${n.join(", ")} and not on ${t}; GitHub shows its repositories only to the App itself, so check them at https://github.com/apps/${i}/installations/new (the hub's check job also reports both)`}function lO(e,t){if(e===null)return{checks:[M("tapster.yml is valid","Run tapster init.")],config:null};try{let{config:n,invalid:r}=ne(e,t);if(r.length===0)return{checks:[F("tapster.yml is valid")],config:n};return{checks:r.map((i)=>M(`${i.name} in tapster.yml is valid`,`${i.reason}. ${i.fix}`)),config:n}}catch(n){return{checks:[M("tapster.yml is valid",n instanceof v?`${n.reason}. ${n.fix}`:"Run tapster init.")],config:null}}}async function uO(e,t){let n=(await it(e,`/repos/${t}/contents/.github/workflows?ref=main`)).filter((i)=>i.type==="file").map((i)=>i.name),r={};for(let i of n)r[i]=await de(e,t,`.github/workflows/${i}`,"main")??"";return{config:await de(e,t,"tapster.yml","main"),flows:r}}async function xr(e,t){let n=t.split("/")[0],r=await uO(e,t),i=[],o=lO(r.config,n),s=o.config;i.push(...o.checks);let a=r.flows["tapster.yml"];if(a)i.push(YE(a),rO(a,se));else i.push(M("the hub workflow exists","Run tapster init, commit and push."));let{"tapster.yml":c,...l}=r.flows;return i.push(JE(l)),i.push(...await aO(e,t,n,s,a??"")),{checks:i,note:await cO(e,t,s?.packages.map((u)=>u.repo)??[])}}async function Av(e){let t=await He(process.cwd()),n=await _t();console.log(`Checking ${t} as it is on GitHub's main branch.`);let{checks:r,note:i}=await xr(n,t);for(let o of r)if(console.log(o.ok?`ok ${o.name}`:`fix ${o.name}
1075
+ ${o.fix}`),o.note)console.log(` note: ${o.note}`);if(i)console.log(i);return r.every((o)=>o.ok)?0:1}import{createHash as NO,createPrivateKey as zO,createPublicKey as DO}from"crypto";import{existsSync as yn,readFileSync as Or}from"fs";import{mkdir as Hv,writeFile as al}from"fs/promises";import{join as Ee}from"path";import{createHash as pO,createPrivateKey as dO,createPublicKey as $v,sign as hO,verify as fO}from"crypto";var qt=2n**255n-19n,Xc=2n**252n+27742317777372353535851937790883648493n,K=(e,t=qt)=>(e%t+t)%t,el=(e,t)=>{let n=1n,r=K(e);for(let i=t;i>0n;i>>=1n){if(i&1n)n=n*r%qt;r=r*r%qt}return n},Po=(e)=>el(e,qt-2n),Ev=K(-121665n*Po(121666n));function Pv([e,t,n,r],[i,o,s,a]){let c=K((t-e)*(o-i)),l=K((t+e)*(o+i)),u=K(2n*r*a*Ev),p=K(2n*n*s),d=l-c,h=p-u,f=p+u,m=l+c;return[K(d*h),K(f*m),K(h*f),K(d*m)]}function Ov(e,t){let n=[0n,1n,1n,0n],r=t;for(let i=e;i>0n;i>>=1n){if(i&1n)n=Pv(n,r);r=Pv(r,r)}return n}var Cv=(()=>{let e=K(4n*Po(5n)),t=K(e*e-1n),n=K(Ev*e*e+1n),r=el(K(t*Po(n)),(qt+3n)/8n);if(K(r*r*n-t)!==0n)r=K(r*el(2n,(qt-1n)/4n));if(r&1n)r=qt-r;return[r,e,1n,K(r*e)]})(),$o=(e)=>e.reduceRight((t,n)=>t<<8n|BigInt(n),0n);function Rv(e){let t=Buffer.alloc(32),n=e;for(let r=0;r<32;r++)t[r]=Number(n&255n),n>>=8n;return t}function Iv([e,t,n]){let r=Po(n),i=K(e*r),o=K(t*r);return Rv(o|(i&1n)<<255n)}var Tv=(...e)=>pO("sha512").update(Buffer.concat(e)).digest();function mO(e,t,n){let r=$o(e.subarray(0,32)),i=K($o(Tv(e.subarray(32,64),n)),Xc),o=Iv(Ov(i,Cv)),s=K($o(Tv(o,t,n)),Xc);return Buffer.concat([o,Rv(K(i+s*r,Xc))])}var gO=Buffer.from("302e020100300506032b657004220420","hex"),vO=Buffer.from("302a300506032b6570032100","hex"),Ao=(e)=>new v(`the Sparkle key ${e}`,"Store the app's Sparkle key again with tapster init --sparkle <label> --account <keychain account>.");function To(e){let t=e.trim();if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw Ao("is not base64");let n=Buffer.from(t,"base64");pn(n.toString("hex"));let r,i;if(n.length===32){let s=dO({key:Buffer.concat([gO,n]),format:"der",type:"pkcs8"}),a=$v(s).export({format:"der",type:"spki"});r=a.subarray(a.length-32),i=(c)=>hO(null,c,s)}else if(n.length===96){let s=n.subarray(0,64);if(pn(s.toString("base64")),r=Buffer.from(n.subarray(64)),!Iv(Ov($o(s.subarray(0,32)),Cv)).equals(r))throw Ao("is damaged: its two halves do not match");i=(a)=>mO(s,r,a)}else throw Ao(`decodes to ${n.length} bytes, not 32 or 96`);let o=$v({key:Buffer.concat([vO,r]),format:"der",type:"spki"});return{publicKey:r.toString("base64"),sign(s){let a=i(s);if(!fO(null,s,o,a))throw Ao("produced a signature that does not verify");return a}}}function Eo(e,t,n){return{name:`tapster-${e}-${t.split("/")[1].replace(/^homebrew-/,"")}`.toLowerCase().slice(0,34),url:`https://github.com/${t}`,redirect_url:n,public:!1,default_permissions:{contents:"write",attestations:"read",metadata:"read"},default_events:[],hook_attributes:{url:"https://example.com/tapster-has-no-webhook",active:!1}}}async function Sr(e,t){await ze(e,"TAPSTER_APP_ID",String(t.id)),await ze(e,"TAPSTER_APP_SLUG",t.slug),await X(e,"TAPSTER_APP_PRIVATE_KEY",t.pem)}async function Oo(e,t,n,r,i=new pe(Be(e,t))){let o;try{o=(await i.json("GET",`/users/${n}/installation`)).id}catch(a){if(a instanceof R&&a.status===404)return{id:null,onHub:!1};throw a}let s=await i.json("GET",`/repos/${r}/installation`).then(()=>!0,(a)=>a instanceof R&&a.status===404?!1:Promise.reject(a));return{id:o,onHub:s}}import{existsSync as yO}from"fs";import{writeFile as bO}from"fs/promises";import{join as wO}from"path";var tl=65536,nl=8192;function _O(e){return/(?:^|[,/]\s*)OU=([A-Z0-9]{10})(?:[,/]|$)/.exec(e)?.[1]??null}function kO(e,t,n=Date.now()){let r=/(?:^|,)CN=((?:[^,\\]|\\.)*)/.exec(e)?.[1]??"";if(!r.startsWith("Developer ID Application:"))throw new v(`the certificate is "${r||"unnamed"}", not a Developer ID Application certificate`,"Create a Developer ID Application certificate at developer.apple.com, export it with its key from Keychain Access as .p12, then run this again.");let i=_O(e);if(!i)throw new v("the certificate has no team ID","Export the Developer ID Application certificate from Keychain Access.");let o=Date.parse(t);if(Number.isNaN(o))throw new v("the certificate's expiry date cannot be read","Export the certificate again from Keychain Access.");let s=new Date(o).toISOString().slice(0,10);if(o<n)throw new v(`the certificate expired on ${s}`,"Create a new Developer ID Application certificate at developer.apple.com.");return{team:i,expires:s,name:r.replace(/\\(.)/g,"$1")}}function xO(e,t){if(/mac verify error|invalid password/i.test(e.stdout))throw new v("the .p12 could not be opened with that password","Check the password you set when exporting it or export it again.");if(/unsupported/i.test(e.stdout))throw new v("this system's openssl cannot read the .p12","Run this on macOS or export the certificate again from Keychain Access.");if(!/certificate bag/i.test(e.stdout))throw new v("the .p12 holds no certificate","Export the Developer ID Application certificate from My Certificates in Keychain Access.");if(!/key ?bag/i.test(e.stdout))throw new v("the .p12 holds the certificate but not its private key","Export it from My Certificates in Keychain Access on the Mac that holds the key.");if(t.code!==0||!t.stdout.includes("BEGIN CERTIFICATE"))throw new v("the .p12 could not be read","Export it again from My Certificates in Keychain Access.")}async function Co(e,t,n=Date.now()){if(e.length===0||e.length>tl)throw new v("that file is not a .p12 certificate","Export the Developer ID Application certificate from Keychain Access as .p12.");let r=t===""?"pass:":"env:TAPSTER_P12",i=(p)=>$e("openssl",["pkcs12",...p,"-passin",r],{env:{TAPSTER_P12:t},stdin:e,allowFail:!0}),o=[],s=await i(["-info","-noout"]);if(/unsupported/i.test(s.stderr))o=["-legacy"],s=await i([...o,"-info","-noout"]);let a=await i([...o,"-nokeys","-clcerts"]);xO({code:s.code,stdout:`${s.stdout}
1076
+ ${s.stderr}`},a);let c=await $e("openssl",["x509","-noout","-subject","-enddate","-nameopt","RFC2253"],{stdin:a.stdout}),l=/^subject=\s*(.*)$/m.exec(c.stdout)?.[1]?.trim()??"",u=/^notAfter=(.*)$/m.exec(c.stdout)?.[1]?.trim()??"";return kO(l,u,n)}async function Ro(e,t,n,r){await X(e,"MACOS_SIGN_P12",Buffer.from(t).toString("base64")),await X(e,"MACOS_SIGN_PASSWORD",n),await ze(e,"TAPSTER_TEAM_ID",r.team),await ze(e,"TAPSTER_CERT_EXPIRES",r.expires)}var SO=(e,t,n)=>["notarytool","history","--key",e,"--key-id",t,"--issuer",n,"--output-format","json"];function AO(e){if(/HTTP status code: 401\b/.test(e))return new v("Apple rejected the notary key (HTTP 401)","Check the .p8 file, the Key ID and the Issuer ID in App Store Connect, then run this again.");if(/HTTP status code: 403\b/.test(e))return new v("Apple refused the notary key (HTTP 403)","Accept the latest agreements in App Store Connect and check that the key has Developer access, then run this again.");let t=e.split(`
1077
+ `).find((r)=>r.trim()!=="")?.trim()??"no message",n=/unable to find utility|notarytool.*not found/i.test(e);return new v(`notarytool could not check the key: ${dn(t).slice(0,300)}`,n?"Install Xcode or its command line tools (xcode-select --install), then run this again.":"Check your connection and the key in App Store Connect, then run this again.")}function rl(e){if(e.length===0||e.length>nl||!Buffer.from(e).toString("utf8").includes("BEGIN PRIVATE KEY"))throw new v("that file is not an App Store Connect key","Download the .p8 from App Store Connect, Users and Access, Integrations.")}function il(e){let t=e.trim();if(!/^[A-Z0-9]{10}$/.test(t))throw new v(`${t||"an empty Key ID"} is not a Key ID`,"Copy the 10-character Key ID next to the key in App Store Connect.");return t}function Io(e,t,n){rl(e);let r=il(t),i=n.trim().toLowerCase();if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(i))throw new v("that is not an Issuer ID","Copy the Issuer ID shown above the key list in App Store Connect.");return{p8:e,keyId:r,issuer:i}}async function No(e){if(process.platform!=="darwin"||!yO(hn.xcrun))return!1;let t=kt("tapster-notary-");try{let n=wO(t,`AuthKey_${e.keyId}.p8`);await bO(n,e.p8,{mode:384});let r=await j(hn.xcrun,"xcrun",SO(n,e.keyId,e.issuer),{allowFail:!0});if(r.code!==0)throw AO(r.stderr);return!0}finally{Fe(t)}}async function zo(e,t){await X(e,"MACOS_NOTARY_KEY",Buffer.from(t.p8).toString("base64")),await X(e,"MACOS_NOTARY_KEY_ID",t.keyId),await X(e,"MACOS_NOTARY_ISSUER_ID",t.issuer)}import{generateKeyPairSync as $O}from"crypto";import{existsSync as PO}from"fs";function Nv(){let{privateKey:e,publicKey:t}=$O("ed25519"),n=e.export({format:"der",type:"pkcs8"}).subarray(-32),r=t.export({format:"der",type:"spki"}).subarray(-32);return{seed:n.toString("base64"),publicKey:r.toString("base64")}}var TO=/^[A-Za-z0-9 .:/@_+=()-]+$/;function $r(e){for(let t of[e.service,e.account,e.label,...e.comment===void 0?[]:[e.comment]])if(!TO.test(t))throw new v(`"${t}" cannot name a keychain item`,"Use letters, digits and simple punctuation.")}function EO(e,t){$r(e);let n=e.comment===void 0?"":` -j "${e.comment}"`,r=`add-generic-password -s "${e.service}" -a "${e.account}" -l "${e.label}" -D "private key"${n} -T "" -X ${Buffer.from(t).toString("hex")}
1078
+ `;if(r.length>4000)throw new v("the key is too long for one security command","tapster stores large keys through the Security API instead.");return r}var OO=`ObjC.import("Security");
950
1079
  ObjC.import("Foundation");
951
1080
  function run(argv) {
952
1081
  const k = (ref) => ObjC.castRefToObject(ref);
@@ -961,22 +1090,334 @@ function run(argv) {
961
1090
  q.setObjectForKey($(argv[2]), k($.kSecAttrLabel));
962
1091
  q.setObjectForKey($.NSFileHandle.fileHandleWithStandardInput.readDataToEndOfFile, k($.kSecValueData));
963
1092
  return String($.SecItemAdd(q, null));
964
- }`;function oE(e){return qr(e),["-l","JavaScript","-e",sE,e.service,e.account,e.label]}function iE(e){return qr(e),["store","--label",e.label,"service",e.service,"account",e.account]}var Mr="/usr/bin/security",Pm="/usr/bin/osascript",Ns="/usr/bin/secret-tool",aE={kind:"keychain",exists:async(e)=>(await C(Mr,"security",["find-generic-password","-s",e.service,"-a",e.account],{allowFail:!0})).code===0,async save(e,t){let r=null;try{r=nE(e,t)}catch(s){if(!(s instanceof y)||!s.reason.includes("too long"))throw s}if(r!==null){let s=await C(Mr,"security",["-i"],{stdin:r,allowFail:!0});if(s.code===0&&!/error|returned/i.test(s.stderr))return;throw new y("the login keychain refused the key","Unlock the login keychain and run this again.")}let n=await C(Pm,"osascript",oE(e),{stdin:t,allowFail:!0});if(n.code!==0||n.stdout.trim()!=="0")throw new y(`the login keychain refused the key (status ${n.stdout.trim()||n.code})`,"Unlock the login keychain and run this again.")},async read(e){let t=await C(Mr,"security",["find-generic-password","-s",e.service,"-a",e.account,"-w"],{allowFail:!0});return t.code===0?t.stdout.replace(/\n$/,""):null},async remove(e){await C(Mr,"security",["delete-generic-password","-s",e.service,"-a",e.account],{allowFail:!0})}},Em={kind:"secret-service",exists:async(e)=>await Em.read(e)!==null,async save(e,t){if((await C(Ns,"secret-tool",iE(e),{stdin:t,allowFail:!0})).code!==0)throw new y("the Secret Service refused the key","Unlock your keyring (GNOME Keyring or KWallet) and run this again.")},async read(e){qr(e);let t=await C(Ns,"secret-tool",["lookup","service",e.service,"account",e.account],{allowFail:!0});return t.code===0&&t.stdout!==""?t.stdout:null},async remove(e){qr(e),await C(Ns,"secret-tool",["clear","service",e.service,"account",e.account],{allowFail:!0})}};function la(e=process.platform,t=tE){if(e==="darwin")return t(Mr)&&t(Pm)?aE:null;if(e==="linux")return t(Ns)?Em:null;return null}async function Tm(e,t){let r=await e.read(t);if(r!==null||!await e.exists(t))return r;throw new y("the previous key is in your keychain, but tapster could not read it","Choose Allow when macOS asks, and run this where you can see that question (not over SSH). Nothing was changed.")}function pa(e){let t=la();if(t)return t;throw new y(`tapster keeps a copy of ${e} in your keychain, and this system has none it can use`,"Run this on macOS, or on Linux with secret-tool (libsecret-tools) installed, so the key is never kept only in GitHub, which never gives secrets back.")}import{readFile as cE}from"fs/promises";function Rs(e,t=process.env.HOME??""){let r=e.trim();if(r=r.length>1&&(r[0]==="'"||r[0]==='"')&&r.at(-1)===r[0]?r.slice(1,-1):r.replace(/\\(.)/g,"$1"),!r)throw new y("no path was given","Type the path, or drag the file into the terminal.");return r.replace(/^~(?=\/|$)/,t)}async function Cs(e,t){try{return await cE(e)}catch(r){let n=r.code;if(n==="ENOENT")throw new y(`${e} does not exist`,`Check the path of ${t}.`);if(n==="EISDIR")throw new y(`${e} is a folder`,`Give the path of ${t} itself.`);throw new y(`${e} cannot be read`,`Check that you can open ${t}.`)}}function fE(e,t,r){return{name:`tapster-${e}-${t.split("/")[1].replace(/^homebrew-/,"")}`.toLowerCase().slice(0,34),url:`https://github.com/${t}`,redirect_url:r,public:!1,default_permissions:{contents:"write",attestations:"read",metadata:"read"},default_events:[],hook_attributes:{url:"https://example.com/tapster-has-no-webhook",active:!1}}}function dE(e){return/(?:^|[,/]\s*)OU=([A-Z0-9]{10})(?:[,/]|$)/.exec(e)?.[1]??null}function hE(e,t,r=Date.now()){let n=/(?:^|,)CN=((?:[^,\\]|\\.)*)/.exec(e)?.[1]??"";if(!n.startsWith("Developer ID Application:"))throw new y(`the certificate is "${n||"unnamed"}", not a Developer ID Application certificate`,"Create a Developer ID Application certificate at developer.apple.com, export it with its key from Keychain Access as .p12, then run this again.");let s=dE(e);if(!s)throw new y("the certificate has no team ID","Export the Developer ID Application certificate from Keychain Access.");let o=Date.parse(t);if(Number.isNaN(o))throw new y("the certificate's expiry date cannot be read","Export the certificate again from Keychain Access.");let i=new Date(o).toISOString().slice(0,10);if(o<r)throw new y(`the certificate expired on ${i}`,"Create a new Developer ID Application certificate at developer.apple.com.");return{team:s,expires:i}}function mE(e,t){let r=new Set(e.vars),n=new Set(e.secrets),s=["protect"];if(!(r.has("TAPSTER_APP_ID")&&r.has("TAPSTER_APP_SLUG")))s.push("app");else if(!n.has("TAPSTER_APP_PRIVATE_KEY"))s.push("app-key");if(t&&!(r.has("TAPSTER_TEAM_ID")&&n.has("MACOS_SIGN_P12")&&n.has("MACOS_SIGN_PASSWORD")))s.push("certificate");if(t&&!["MACOS_NOTARY_KEY","MACOS_NOTARY_KEY_ID","MACOS_NOTARY_ISSUER_ID"].every((o)=>n.has(o)))s.push("notary");return s.push("files"),s}var gE=(e,t,r)=>["notarytool","history","--key",e,"--key-id",t,"--issuer",r,"--output-format","json"];function yE(e,t){if(!(e instanceof D)||!t||![403,404,422].includes(e.status))return e;return new y("GitHub refused environments on this private hub","Environments and their secrets need a public hub or GitHub Pro. Make the hub public or upgrade at https://github.com/settings/billing, then run tapster init again.")}function xt(e){let t=e.packages.filter(fe).flatMap((r)=>r.sparkle?[r.sparkle.key,...r.sparkle.next_key?[r.sparkle.next_key]:[]]:[]);return[...new Set(t)]}function Um(e){let t=e.map((r)=>`SPARKLE_KEY_${r.toUpperCase()}: "\${{ secrets.SPARKLE_KEY_${r.toUpperCase()} }}"`);return t.length?`{ ${t.join(", ")} }`:"{}"}function wE(e,t,r){let n=[];for(let s of e.packages.filter(fe)){let o=s.sparkle?.key===t?s.sparkle.public_key:s.sparkle?.next_key===t?s.sparkle.next_public_key:void 0;if(o===void 0)continue;if(o!==r)throw new y(`${s.name} pins ${o} for ${t}, but this key's public half is ${r}`,"Pick the keychain account of the key the app ships with or fix tapster.yml.");n.push(s.name)}if(n.length===0)throw new y(`no package in tapster.yml uses the Sparkle key ${t}`,"Add the package with its sparkle section first.");return n}function ha(e,t,r,n=[],s=10){return e.replaceAll("__CRON__",na(s)).replaceAll("__SPARKLE_ENV__",Um(n)).replaceAll("__CHECKOUT_SHA__",t["actions/checkout"].sha).replaceAll("__CHECKOUT_TAG__",t["actions/checkout"].tag).replaceAll("__ATTEST_SHA__",t["actions/attest-build-provenance"].sha).replaceAll("__ATTEST_TAG__",t["actions/attest-build-provenance"].tag).replaceAll("__UPLOAD_SHA__",t["actions/upload-artifact"].sha).replaceAll("__UPLOAD_TAG__",t["actions/upload-artifact"].tag).replaceAll("__DOWNLOAD_SHA__",t["actions/download-artifact"].sha).replaceAll("__DOWNLOAD_TAG__",t["actions/download-artifact"].tag).replaceAll("__PAGES_UPLOAD_SHA__",t["actions/upload-pages-artifact"].sha).replaceAll("__PAGES_UPLOAD_TAG__",t["actions/upload-pages-artifact"].tag).replaceAll("__PAGES_DEPLOY_SHA__",t["actions/deploy-pages"].sha).replaceAll("__PAGES_DEPLOY_TAG__",t["actions/deploy-pages"].tag).replaceAll("__TAPSTER_SHA__",r.sha).replaceAll("__TAPSTER_TAG__",r.tag)}async function Zm(e,t,r,n,s){let o=new Oe(qt(e,t));console.log("Waiting until the App is installed; tapster continues by itself once you choose Install.");let i=await ks(()=>o.json("GET",`/users/${r}/installation`).then((c)=>c.id,()=>null));if(i===null){console.log(`The App is not installed yet. Install it at https://github.com/apps/${s}/installations/new; tapster add links there for each project too.`);return}if(await o.json("GET",`/repos/${n}/installation`).then(()=>!0,()=>!1))console.log(`The App is installed on ${n}; remove ${n} from it at https://github.com/settings/installations/${i}, or the hub refuses to run.`)}async function bE(e,t){console.log("GitHub creates a private App for your hub; it lets the hub publish your projects' releases. Confirm it on the page that opens.");let r=await _s((n)=>fE(e,t,n),"your tapster App");await Ie(t,"TAPSTER_APP_ID",String(r.id)),await Ie(t,"TAPSTER_APP_SLUG",r.slug),await ee(t,"TAPSTER_APP_PRIVATE_KEY",r.pem),console.log('Stored the App and its key in the hub. Now install it: choose "Only select repositories" and pick the projects tapster should publish.'),console.log(`Never pick ${t}: the App can write to every repository it is installed on, and the hub holds your signing keys. tapster add can also install it on a project later.`),vt(`https://github.com/apps/${r.slug}/installations/new`),await Zm(String(r.id),r.pem,e,t,r.slug)}function _E(e){let t;try{t=lE(e)}catch{throw new y("that file is not a private key","Use the .pem file GitHub downloaded when you generated the key.")}if(t.asymmetricKeyType!=="rsa")throw new y("that file is not a GitHub App key","Use the .pem file GitHub downloaded when you generated the key.");let r=pE(t).export({type:"spki",format:"der"});return`SHA256:${uE("sha256").update(r).digest("base64")}`}async function Om(e,t){let r=await e.json("GET",`/repos/${t}/environments/tapster/variables`),n=r.variables.find((c)=>c.name==="TAPSTER_APP_ID")?.value,s=r.variables.find((c)=>c.name==="TAPSTER_APP_SLUG")?.value;if(!n||!s)throw new y("the hub has no App yet","Run tapster init first.");console.log(`Open the App's settings, scroll to "Private keys" and click "Generate a private key":`),vt(`https://github.com/settings/apps/${s}`);let o=Rs(await te("Path of the downloaded .pem file (drag it here): ")),i=(await Cs(o,"the .pem file")).toString("utf8"),a=_E(i);await new Oe(qt(n,i)).json("GET","/app").catch(()=>{throw new y("that key does not belong to the hub's App",`Generate the key on https://github.com/settings/apps/${s}.`)}),await ee(t,"TAPSTER_APP_PRIVATE_KEY",i),console.log(`Stored the new key (${a}).`),await Zm(n,i,t.split("/")[0],t,s),console.log(`Now delete every other key on that page so the old one stops working. Then delete ${o}.`)}async function Im(e){console.log("Apple certificate: a Developer ID Application certificate exported as .p12. In Keychain Access, open My Certificates,"),console.log('right-click "Developer ID Application: ...", choose Export and save it as .p12 with a password. Create one at'),console.log("https://developer.apple.com/account/resources/certificates if you have none. It stays in your hub's secrets only.");let t=Rs(await te(".p12 file (drag it here): ")),r=await Cs(t,"the .p12 file"),n=await te(".p12 password: ",!0),s=await Te("openssl",["pkcs12","-in",t,"-passin","env:TAPSTER_P12","-nokeys","-clcerts"],{env:{TAPSTER_P12:n},allowFail:!0});if(s.code!==0||!s.stdout.includes("BEGIN CERTIFICATE"))throw new y("the .p12 could not be opened with that password","Check the password you set when exporting it, or export it again.");let o=await Te("openssl",["x509","-noout","-subject","-enddate","-nameopt","RFC2253"],{stdin:s.stdout}),i=/^subject=\s*(.*)$/m.exec(o.stdout)?.[1]?.trim()??"",a=/^notAfter=(.*)$/m.exec(o.stdout)?.[1]?.trim()??"",{team:c,expires:u}=hE(i,a);await ee(e,"MACOS_SIGN_P12",r.toString("base64")),await ee(e,"MACOS_SIGN_PASSWORD",n),await Ie(e,"TAPSTER_TEAM_ID",c),await Ie(e,"TAPSTER_CERT_EXPIRES",u),console.log(`Certificate stored for team ${c}; it expires on ${u}, and the hub warns 30 days before.`)}async function vE(e,t,r){if(process.platform!=="darwin"||!ot(ws.xcrun)){console.log("Not on macOS, so the key is checked at the first release instead.");return}let n=await C(ws.xcrun,"xcrun",gE(e,t,r),{allowFail:!0});if(n.code!==0)Sm("",n.stderr);console.log("Apple accepted the key.")}async function Nm(e){console.log("Notarization key: an App Store Connect API key. In App Store Connect open Users and Access, Integrations,"),console.log("App Store Connect API, Team Keys; create a key with Developer access and download AuthKey_<id>.p8 (Apple offers"),console.log("the download once). The Key ID is in the list and the Issuer ID above it. It stays in your hub's secrets only.");let t=Rs(await te(".p8 file (drag it here): ")),r=await Cs(t,"the .p8 file");if(!r.toString("utf8").includes("BEGIN PRIVATE KEY"))throw new y("that file is not an App Store Connect key","Download the .p8 from App Store Connect, Users and Access, Integrations.");let n=await te("Key ID: ");if(!/^[A-Z0-9]{10}$/.test(n))throw new y(`${n||"an empty Key ID"} is not a Key ID`,"Copy the 10-character Key ID next to the key in App Store Connect.");let s=(await te("Issuer ID: ")).toLowerCase();if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(s))throw new y("that is not an Issuer ID","Copy the Issuer ID shown above the key list in App Store Connect.");await vE(t,n,s),await ee(e,"MACOS_NOTARY_KEY",r.toString("base64")),await ee(e,"MACOS_NOTARY_KEY_ID",n),await ee(e,"MACOS_NOTARY_ISSUER_ID",s),console.log(`Notarization key stored. You may delete ${t} once you keep a backup.`)}var fa={name:"tapster main",target:"branch",enforcement:"active",bypass_actors:[],conditions:{ref_name:{include:["~DEFAULT_BRANCH"],exclude:[]}},rules:[{type:"deletion"},{type:"non_fast_forward"}]};async function kE(e,t,r){try{await e.json("PUT",`/repos/${t}/environments/tapster`,{deployment_branch_policy:{protected_branches:!1,custom_branch_policies:!0}})}catch(o){throw yE(o,r)}let n=await e.json("GET",`/repos/${t}/environments/tapster/deployment-branch-policies`);for(let o of n.branch_policies.filter((i)=>i.name!=="main"))await e.json("DELETE",`/repos/${t}/environments/tapster/deployment-branch-policies/${o.id}`);if(!n.branch_policies.some((o)=>o.name==="main"))await e.json("POST",`/repos/${t}/environments/tapster/deployment-branch-policies`,{name:"main",type:"branch"});await e.json("PUT",`/repos/${t}/actions/permissions/workflow`,{default_workflow_permissions:"read",can_approve_pull_request_reviews:!1}),await e.json("PUT",`/repos/${t}/actions/permissions`,{enabled:!0,allowed_actions:"selected",sha_pinning_required:!0}),await e.json("PUT",`/repos/${t}/actions/permissions/selected-actions`,{github_owned_allowed:!0,verified_allowed:!1,patterns_allowed:["doguyilmaz/tapster@*"]});let s=(await e.json("GET",`/repos/${t}/rulesets`)).find((o)=>o.name===fa.name);if(s)await e.json("PUT",`/repos/${t}/rulesets/${s.id}`,fa);else await e.json("POST",`/repos/${t}/rulesets`,fa)}async function xE(e,t,r){if(r===null){if(t.sha)return{sha:t.sha,tag:`v${t.version}`};throw new y("this tapster was built from a checkout, so it does not know which tapster the hub should run","Pass --tapster <commit> with a full commit SHA from tapster's main, or use a released tapster.")}if(!/^[0-9a-f]{40}$/.test(r))throw new y(`${r} is not a full commit SHA`,"Pass all 40 characters of the commit.");let n=await e.json("GET",`/repos/doguyilmaz/tapster/compare/${r}...main`);if(n.status!=="ahead"&&n.status!=="identical")throw new y(`${r} is not on tapster's main`,"Pin a commit that is on main.");return{sha:r,tag:"main"}}var Rm=/doguyilmaz\/tapster@([0-9a-f]{40}) # (\S+)/;function SE(e,t){let r=(o)=>`${o[2]} (${o[1].slice(0,7)})`,n=Rm.exec(t),s=e===null?null:Rm.exec(e);if(!s)return`tapster ${r(n)}`;return s[1]===n[1]&&s[2]===n[2]?`tapster ${r(s)}, unchanged`:`tapster ${r(s)} -> ${r(n)}`}function AE(e,t){let r=/(\n\s+with: \{ mode: sparkle(?:, template: \d+)? \}\n\s+env: ).*\n/;if(!r.test(e))throw new y("the hub workflow has no sparkle step","Run tapster init --workflow to rewrite it from the template.");return e.replace(r,(n,s)=>`${s}${Um(t)}
965
- `)}function Kr(e,t){let r=de(e,"tapster.yml");if(!ot(r))throw new y("tapster.yml is missing","Run tapster init in the hub first.");let{config:n,invalid:s}=bt(Fr(r,"utf8"),t.split("/")[0]);for(let o of s)console.log(`note: ${o.name} in tapster.yml is invalid and left out: ${o.reason}`);return n}function $E(e,t){let r=de(e,"tapster.yml");return ot(r)?xt(bt(Fr(r,"utf8"),t).config):[]}var st=".github/workflows/tapster.yml";async function Mm(e,t,r,n,s){let o=await xE(e,nt,n),i=ot(de(t,st))?Fr(de(t,st),"utf8"):null,a=i===null?null:Gt(i),c=s.every??a??(s.isPrivate?60:10),u=ha(Es,Re,o,r,c);if(await jm(de(t,".github/workflows"),{recursive:!0}),await da(de(t,st),u),console.log(`wrote ${st} from the template, ${SE(i,u)}; hand edits in it are replaced`),c===a)return;if(console.log(`The hub looks for new drafts every ${c} minutes; change it with tapster init --workflow --every <minutes>.`),a!==null)console.log("If the hub has a doorbell, run tapster init --rotate doorbell after you push, so it keeps the same schedule.");if(s.isPrivate&&c>=60&&s.every===null)console.log("GitHub bills every run of a private hub as at least one minute: every 10 minutes would use about 4,300 of the 2,000 free minutes a month. The doorbell (tapster init --doorbell) still publishes right after each release.")}async function qm(e,t){let r=de(e,st);if(!ot(r))throw new y(`${st} is missing`,"Run tapster init --workflow first.");await da(r,AE(Fr(r,"utf8"),t)),console.log(`updated the sparkle step in ${st}`)}async function PE(e,t,r,n,s){if(!/^[a-z0-9]+$/.test(n))throw new y(`${n} is not a valid label`,"Use lowercase letters and digits, as in sparkle.key.");let o=Kr(t,r),i=await Te("security",["find-generic-password","-s","https://sparkle-project.org","-a",s,"-w"],{allowFail:!0});if(i.code!==0)throw new y(`the login keychain has no Sparkle key for the account ${s}`,"Pass the account generate_keys used with --account (ed25519 by default).");let a=i.stdout.trim(),c=xm(a),u=wE(o,n,c.publicKey);if(console.log(`The key ${c.publicKey} signs updates for ${u.join(", ")}.`),console.log("If it is lost, installed copies can never update again; if it leaks, anyone can sign updates for them."),await te("Do you keep an offline backup of this key? Type yes to store it in the hub: ")!=="yes")throw new y("no offline backup confirmed","Back the key up first (generate_keys -x exports it), then run this again.");await ee(r,`SPARKLE_KEY_${n.toUpperCase()}`,a),console.log(`Stored SPARKLE_KEY_${n.toUpperCase()}.`),await qm(t,xt(o)),console.log("Review and commit the workflow change, then push.")}async function EE(e,t,r){if(!/^[a-z0-9]+$/.test(r))throw new y(`${r} is not a valid label`,"Use lowercase letters and digits, as in sparkle.key.");let n=Kr(e,t),s=n.packages.filter(fe).filter((c)=>c.sparkle?.key===r||c.sparkle?.next_key===r);if(s.length)throw new y(`${s.map((c)=>c.name).join(", ")} already sign with the Sparkle key ${r}`,"A new key needs a new label. To change an app's key, follow the Sparkle key change in the README.");let o=pa("the Sparkle key"),i={service:"https://sparkle-project.org",account:r,label:"Private key for signing Sparkle updates"};if(await o.exists(i))throw new y(`your keychain already has a Sparkle key for the account ${r}`,`Store that one with tapster init --sparkle ${r} --account ${r}, or pick another label.`);let a=$m();if(await o.save({...i,comment:`Public key (SUPublicEDKey value) for this key is: ${a.publicKey}`},a.seed),console.log(`Saved a new Sparkle key in your ${o.kind==="keychain"?"login keychain":"keyring"} under the account ${r}; Sparkle's own tools find it there, and macOS asks you before any app reads it.`),console.log(`Its public key is ${a.publicKey}. Put it in the app as SUPublicEDKey and in tapster.yml as sparkle.public_key.`),console.log("If this key is lost, installed copies can never update again. Keep an offline copy too, for example in your password manager:"),console.log(o.kind==="keychain"?` security find-generic-password -s https://sparkle-project.org -a ${r} -w (macOS asks you first)`:` secret-tool lookup service https://sparkle-project.org account ${r}`),await te("Type yes once you keep an offline copy, to store the key in the hub: ")!=="yes"){console.log(`Not stored in the hub yet. Once you keep a copy, run tapster init --sparkle ${r} --account ${r}.`);return}await ee(t,`SPARKLE_KEY_${r.toUpperCase()}`,a.seed),console.log(`Stored SPARKLE_KEY_${r.toUpperCase()} in the hub.`),await qm(e,[...new Set([...xt(n),r])]),console.log("Review and commit the workflow change, then push.")}async function Cm(e,t,r){let n={...t,account:`${t.account} pending`,label:`${t.label} (pending)`};await e.remove(n),await e.save(n,r),await e.remove(t),await e.save(t,r),await e.remove(n)}var Br=(e,t=!1)=>({service:"tapster-linux-key",account:t?`${e} previous`:e,label:`tapster Linux key for ${e}${t?" (previous)":""}`});async function TE(e,t){if((await e.json("GET",`/repos/${t}/environments/tapster/secrets`)).secrets.map((n)=>n.name).includes("TAPSTER_LINUX_KEY_PREVIOUS"))await Zh(t,"TAPSTER_LINUX_KEY_PREVIOUS");await la()?.remove(Br(t,!0)),console.log("The previous Linux key no longer signs; apt and dnf trust only the new one from the next run.")}function OE(e,t){if(e.includes("TAPSTER_LINUX_KEY")&&!t)throw new y("the hub already has a Linux signing key","Replacing it makes every apt and dnf user fetch the new key. To do that, run tapster init --rotate linux.")}async function zm(e,t,r,n){let s=Kr(t,r),o=(await e.json("GET",`/repos/${r}/environments/tapster/secrets`)).secrets.map((l)=>l.name);OE(o,n);let i=pa("the Linux signing key"),a=["/opt/homebrew/bin/gpg","/usr/local/bin/gpg","/usr/bin/gpg"].find((l)=>ot(l));if(!a)throw new y("gpg is not installed","Install it with brew install gnupg, then run this again.");await e.json("POST",`/repos/${r}/pages`,{build_type:"workflow"}).catch(async(l)=>{if(!(l instanceof D)||l.status!==409)throw new y("GitHub Pages could not be turned on for the hub","A private hub needs a paid plan for Pages; make the hub public or turn Pages on by hand with GitHub Actions as the source.");await e.json("PUT",`/repos/${r}/pages`,{build_type:"workflow"})}),console.log("GitHub Pages serves the hub from GitHub Actions.");let c=Ft("tl-"),u={GNUPGHOME:c};try{await C(a,"gpg",["--batch","--pinentry-mode","loopback","--passphrase","","--quick-gen-key",`${r.split("/")[0]} tapster (${r})`,"rsa4096","sign","never"],{env:u});let l=(await C(a,"gpg",["--batch","--armor","--export-secret-keys"],{env:u})).stdout,f=(await C(a,"gpg",["--batch","--with-colons","--list-secret-keys"],{env:u})).stdout.split(`
966
- `).find((h)=>h.startsWith("fpr:"))?.split(":")[9],p=null;if(n){if(i.kind==="keychain")console.log("macOS asks whether tapster may read the previous key from your keychain; choose Allow.");p=await Tm(i,Br(r))}let d={...Br(r),account:`${r} new`,label:`tapster Linux key for ${r} (new)`};if(await i.remove(d),await i.save(d,l),await ee(r,"TAPSTER_LINUX_KEY",l),p)await ee(r,"TAPSTER_LINUX_KEY_PREVIOUS",p);if(p)await Cm(i,Br(r,!0),p);if(await Cm(i,Br(r),l),await i.remove(d),console.log(`Stored the Linux key (fingerprint ${f}) in the hub and in your ${i.kind==="keychain"?"login keychain":"keyring"} as "tapster-linux-key".`),p)console.log("The previous key keeps signing next to the new one, so apt and dnf users can fetch the new key. Once they have, run tapster init --rotate linux --finish.");else if(n)console.log("The previous key is not in your keychain, so apt and dnf users must fetch the new key before they can update.")}finally{await C(de(a,"..","gpgconf"),"gpgconf",["--kill","all"],{env:u,allowFail:!0}).catch(()=>{return}),rt(c)}if(!s.packages.some((l)=>!fe(l)&&l.linux))console.log("No package sets linux: true yet; add it to the CLI packages that should ship to apt and dnf.")}async function IE(e,t,r,n,s){let[o,i]=r.split("/"),a=`${o}/${i.replace(/^homebrew-/,"")}`,c=async(u,l)=>{if(ot(de(t,u)))return;await jm(de(t,u,".."),{recursive:!0}),await da(de(t,u),l),console.log(`wrote ${u}`)};await c("tapster.yml",`version: 1
967
- tap: ${a}
968
- packages: []
969
- `),await c(".tapster/state.json",`${JSON.stringify({version:1,packages:{}},null,2)}
970
- `),await c("README.md",Am.replaceAll("__TAP__",a).replaceAll("__OWNER__",o).replaceAll("__HUB__",r)),await Mm(e,t,$E(t,o),n,s)}async function NE(e){let t=(await te(e)).toLowerCase();return t===""||t==="y"||t==="yes"}async function RE(e,t){let r=async(n)=>{try{return((await e.json("GET",`/repos/${t}/environments/tapster/${n}?per_page=100`))[n]??[]).map((o)=>o.name)}catch(s){if(s instanceof D&&s.status===404)return[];throw s}};return{vars:await r("variables"),secrets:await r("secrets"),private:(await e.getRepo(t)).private}}function Lm(e,t){let r=e.indexOf(t);if(r<0)return{value:null,rest:e};return{value:e[r+1]??"",rest:e.filter((n,s)=>s!==r&&s!==r+1)}}var CE="Run tapster init --help for the options.";function zE(e){let[t,r,n,s]=e;if(e.length===0)return{kind:"setup"};if(t==="--rotate"&&e.length===2&&["app","certificate","notary","doorbell","linux"].includes(r??""))return{kind:"rotate",what:r};if(t==="--rotate"&&r==="linux"&&n==="--finish"&&e.length===3)return{kind:"rotate",what:"linux-finish"};if(t==="--doorbell"&&e.length===1)return{kind:"doorbell"};if(t==="--linux"&&e.length===1)return{kind:"linux"};if(t==="--workflow"&&e.length===1)return{kind:"workflow"};if(t==="--sparkle"&&r&&!r.startsWith("-")){if(e.length===2)return{kind:"sparkle",label:r,account:"ed25519"};if(n==="--new"&&e.length===3)return{kind:"sparkle-new",label:r};if(n==="--account"&&s&&e.length===4)return{kind:"sparkle",label:r,account:s}}throw new y(`unknown option ${e.join(" ")}`,CE)}function Dm(e){let t=de(e,st);return ot(t)&&Gt(Fr(t,"utf8"))||10}async function Bm(e){let t=Lm(e,"--tapster"),r=Lm(t.rest,"--every"),n=t.value,s=r.value===null?null:Number(r.value),o=zE(r.rest);if(s!==null)na(s);if((n!==null||s!==null)&&o.kind!=="setup"&&o.kind!=="workflow")throw new y("--tapster and --every go only with tapster init or init --workflow","Those are the commands that write the workflow.");let i=process.cwd(),a=await Kt(i),c=await Bt();if(o.kind==="rotate"){if(o.what==="app")return Om(c,a);if(o.what==="certificate")return Im(a);if(o.what==="notary")return Nm(a);if(o.what==="doorbell")return Jh(c,a,Dm(i));if(o.what==="linux-finish")return TE(c,a);return zm(c,i,a,!0)}if(o.kind==="doorbell")return Yh(c,a,Kr(i,a),vs,Dm(i));if(o.kind==="linux")return zm(c,i,a,!1);if(o.kind==="sparkle-new")return EE(i,a,o.label);if(o.kind==="sparkle")return PE(c,i,a,o.label,o.account);if(o.kind==="workflow")return Mm(c,i,xt(Kr(i,a)),n,{every:s,isPrivate:(await c.getRepo(a)).private});let u=await RE(c,a),f=u.vars.includes("TAPSTER_TEAM_ID")||u.secrets.includes("MACOS_NOTARY_KEY")||await NE("Will this hub sign software for macOS (Mac apps or CLI tools with macOS builds)? [Y/n] "),p=mE(u,f),d=["app","certificate","notary"].filter((h)=>!p.includes(h)&&(h==="app"||f));if(d.length)console.log(`Already done: ${d.join(", ")}. To redo one, run tapster init --rotate <name>.`);for(let h of p){if(h==="protect")await kE(c,a,u.private);if(h==="app")await bE(a.split("/")[0],a);if(h==="app-key")await Om(c,a);if(h==="certificate")await Im(a);if(h==="notary")await Nm(a);if(h==="files")await IE(c,i,a,n,{every:s,isPrivate:u.private})}if(!f)console.log("Skipped the Apple credentials. Add them later with tapster init --rotate certificate and tapster init --rotate notary.");console.log(`
971
- Done. Review and commit the new files, push, then run tapster add in each project.`)}var B=(e,t)=>({name:e,ok:!0,fix:"",...t?{note:t}:{}}),R=(e,t)=>({name:e,ok:!1,fix:t});function LE(e){let r=X(e)?.on,n=r&&typeof r==="object"&&!Array.isArray(r)?Object.keys(r):[];return n.length>0&&n.every((s)=>s==="schedule"||s==="workflow_dispatch")?B("the hub workflow runs only on schedule and manual dispatch"):R("the hub workflow runs only on schedule and manual dispatch","Other triggers (pull_request_target, issue_comment, workflow_run) would reach the credentials. Restore .github/workflows/tapster.yml with tapster init.")}function DE(e){let r=(s)=>{let o;try{o=X(s)}catch{return!0}let i=o?.jobs;if(!i||typeof i!=="object")return!1;return Object.values(i).some((a)=>{let c=a?.environment,u=typeof c==="object"&&c!==null?c.name:c;return typeof u==="string"&&(u.trim().toLowerCase()==="tapster"||u.includes("${{"))})},n=Object.entries(e).filter(([,s])=>r(s)).map(([s])=>s);return n.length===0?B("no other workflow uses the tapster environment"):R("no other workflow uses the tapster environment",`Remove the tapster environment from ${n.join(", ")}.`)}function jE(e,t,r){let s=xt(e),o=s.filter((a)=>!t.includes(`SPARKLE_KEY_${a.toUpperCase()}`));if(o.length)return R("every Sparkle key is stored and passed to the sparkle step",o.map((a)=>`Run tapster init --sparkle ${a}.`).join(" "));let i=s.filter((a)=>!r.includes(`SPARKLE_KEY_${a.toUpperCase()}: "\${{ secrets.SPARKLE_KEY_${a.toUpperCase()} }}"`));if(i.length)return R("every Sparkle key is stored and passed to the sparkle step",`The workflow does not pass ${i.map((a)=>`SPARKLE_KEY_${a.toUpperCase()}`).join(", ")}. Run tapster init --workflow.`);return B("every Sparkle key is stored and passed to the sparkle step")}function UE(e,t){let n=Object.entries(t).filter(([,s])=>s!==e).map(([s])=>s);return n.length?R("every project rings the hub's doorbell",n.map((s)=>`gh variable set TAPSTER_DOORBELL --repo ${s} --body ${e}`).join("; ")):B("every project rings the hub's doorbell")}function ZE(e,t,r,n){if(!r.includes("TAPSTER_LINUX_KEY"))return R("the Linux repositories can be signed and deployed","Run tapster init --linux to make and store the signing key.");if(!n)return R("the Linux repositories can be signed and deployed","Turn on GitHub Pages for the hub; tapster init --linux does it.");if(n.build_type!=="workflow")return R("the Linux repositories can be signed and deployed","Set the hub's Pages source to GitHub Actions; tapster init --linux does it.");let o=n.html_url.replace(/\/$/,"");if(o!==lh(e,t))return R("the Linux repositories can be signed and deployed",`Pages serves ${o}; set linux.url in tapster.yml to it.`);return B("the Linux repositories can be signed and deployed")}var Km=["MACOS_SIGN_P12","MACOS_SIGN_PASSWORD","MACOS_NOTARY_KEY","MACOS_NOTARY_KEY_ID","MACOS_NOTARY_ISSUER_ID"],ME=[...Km,"TAPSTER_APP_PRIVATE_KEY"];function qE(e,t,r){let s=e?.packages.some(uh)??!1,o=[...["TAPSTER_APP_PRIVATE_KEY",...s?Km:[]].filter((a)=>!t.includes(a)),...["TAPSTER_APP_ID","TAPSTER_APP_SLUG",...s?["TAPSTER_TEAM_ID"]:[]].filter((a)=>!r.includes(a))];if(o.length===0)return B("the credentials this hub needs are stored");let i=[...o.some((a)=>a.startsWith("TAPSTER_APP"))?["tapster init"]:[],...o.some((a)=>a.startsWith("MACOS_SIGN")||a==="TAPSTER_TEAM_ID")?["tapster init --rotate certificate"]:[],...o.some((a)=>a.startsWith("MACOS_NOTARY"))?["tapster init --rotate notary"]:[]];return R("the credentials this hub needs are stored",`Missing: ${o.join(", ")}. Run ${i.join(" and ")}.`)}var BE=/doguyilmaz\/tapster@([0-9a-f]{40}) # (\S+)/;function KE(e,t){let n=BE.exec(e);if(!n)return R("the hub workflow is tapster's template","The workflow does not pin tapster. Run tapster init --workflow.");if(n[1]!==t.sha)return B("the hub workflow is tapster's template",`the hub runs tapster ${n[2]} (${n[1].slice(0,7)}) and this is tapster ${t.version}; tapster init --workflow moves the hub to this one, and the tapster that wrote the workflow checks it byte for byte`);let s=[...e.matchAll(/SPARKLE_KEY_([A-Z0-9]+): "/g)].map((i)=>i[1].toLowerCase());return ha(Es,Re,{sha:n[1],tag:n[2]},s,Gt(e)??10)===e?B("the hub workflow is tapster's template"):R("the hub workflow is tapster's template","The workflow differs from the template; hand edits can reach the credentials. Run tapster init --workflow and review the diff.")}function FE(e){return e.some((n)=>n.enforcement==="active"&&n.target==="branch"&&(n.conditions?.ref_name?.include??[]).some((s)=>s==="~DEFAULT_BRANCH"||s==="~ALL"||s==="refs/heads/main")&&(n.conditions?.ref_name?.exclude??[]).length===0&&["deletion","non_fast_forward"].every((s)=>(n.rules??[]).some((o)=>o.type===s))&&(n.bypass_actors??[]).every((s)=>s.actor_type==="RepositoryRole"&&s.actor_id===5))?B("main cannot be deleted or force-pushed, by anyone"):R("main cannot be deleted or force-pushed, by anyone",'Run tapster init to restore the ruleset "tapster main" (active, deletion and force pushes blocked, no one else may bypass).')}function GE(e,t){return e.allowed_actions==="selected"&&e.sha_pinning_required===!0&&t?.verified_allowed===!1&&(t.patterns_allowed??[]).every((s)=>s==="doguyilmaz/tapster@*")?B("the hub runs only GitHub's and tapster's actions, pinned by commit"):R("the hub runs only GitHub's and tapster's actions, pinned by commit","Run tapster init to restore the hub's Actions policy.")}function HE(e,t,r){let s=e.map((a)=>a.login).filter((a)=>a.toLowerCase()!==r.toLowerCase()),o=t.filter((a)=>!a.read_only).map((a)=>a.title);if(s.length===0&&o.length===0)return B("only you can change the hub");let i=[...s.length?[`collaborators ${s.join(", ")} can push to main and change what the hub signs`]:[],...o.length?[`deploy keys ${o.join(", ")} can push too`]:[]];return R("only you can change the hub",`${i.join("; ")}. Remove them in the hub's settings unless you trust them with your signing keys.`)}function WE(e,t){if(e===String(t))return B("the doorbell keeps the workflow's schedule");return R("the doorbell keeps the workflow's schedule",`The doorbell starts the hub every ${e??"10"} minutes and the workflow every ${t}. Run tapster init --rotate doorbell to move the doorbell to the workflow's schedule.`)}function VE(e,t,r){if(e.some((o)=>(o.event==="schedule"||o.event==="workflow_dispatch")&&t-Date.parse(o.created_at)<86400000))return B("the hub ran in the last day");return R("the hub ran in the last day",r?"Neither GitHub's schedule nor the doorbell started a run. Check the doorbell's logs with wrangler tail and the workflow in the Actions tab.":"GitHub's schedule did not start a run; it is best effort. tapster init --doorbell adds a second clock that starts the hub on time.")}async function qe(e,t,r){try{let n=await e.json("GET",t);return(r?n[r]:n)??[]}catch(n){if(n instanceof D&&n.status===404)return[];throw n}}async function YE(e,t,r,n,s){let o=[],i=await e.json("GET",`/repos/${t}/environments/tapster`).catch(()=>null);if(!i)return[R("the tapster environment exists","Run tapster init.")];let a=await e.json("GET",`/repos/${t}/environments/tapster/deployment-branch-policies`);o.push(i.deployment_branch_policy?.custom_branch_policies&&a.branch_policies.length===1&&a.branch_policies[0].name==="main"&&(a.branch_policies[0].type??"branch")==="branch"?B("only main may open the tapster environment"):R("only main may open the tapster environment","Run tapster init to restore the branch rule."));let c=(await qe(e,`/repos/${t}/environments/tapster/secrets?per_page=100`,"secrets")).map((b)=>b.name),u=await qe(e,`/repos/${t}/environments/tapster/variables?per_page=100`,"variables");o.push(qE(n,c,u.map((b)=>b.name)));let l=u.find((b)=>b.name==="TAPSTER_CERT_EXPIRES")?.value;if(l&&Date.parse(`${l}T00:00:00Z`)-Date.now()<2592000000)o.push(R("the Developer ID certificate is valid for 30 more days",`It expires on ${l}. Renew it at developer.apple.com, then run tapster init --rotate certificate.`));if(n&&xt(n).length)o.push(jE(n,c,s));if(n?.packages.some((b)=>!fe(b)&&b.linux)){let b=await e.json("GET",`/repos/${t}/pages`).catch(()=>null);if(o.push(ZE(n,t,c,b)),c.includes("TAPSTER_LINUX_KEY_PREVIOUS"))o.push(B("the Linux key rotation is running","the previous Linux key still signs; once apt and dnf users have the new key, run tapster init --rotate linux --finish"))}let f=await qe(e,`/repos/${t}/actions/variables?per_page=100`,"variables"),p=[...u,...f].map((b)=>b.name).filter((b)=>ME.includes(b)||/^SPARKLE_KEY_/.test(b)||b.startsWith("TAPSTER_LINUX_KEY"));o.push(p.length?R("credentials are secrets, not variables",`Variables are readable by anyone with access; delete ${p.join(", ")} and store them with tapster init --rotate.`):B("credentials are secrets, not variables"));let d=u.find((b)=>b.name==="TAPSTER_DOORBELL")?.value;if(d&&n){let b={};for(let v of n.packages)b[v.repo]=await e.json("GET",`/repos/${v.repo}/actions/variables/TAPSTER_DOORBELL`).then((k)=>k.value).catch(()=>null);o.push(UE(d,b)),o.push(WE(u.find((v)=>v.name==="TAPSTER_DOORBELL_EVERY")?.value,Gt(s)??10))}let h=await e.json("GET",`/repos/${t}/actions/permissions/workflow`);o.push(h.default_workflow_permissions==="read"?B("the default workflow token is read-only"):R("the default workflow token is read-only","Run tapster init."));let m=await Promise.all((await qe(e,`/repos/${t}/rulesets`)).map((b)=>e.json("GET",`/repos/${t}/rulesets/${b.id}`)));o.push(FE(m));let g=await e.json("GET",`/repos/${t}/actions/permissions`),_=g.allowed_actions==="selected"?await e.json("GET",`/repos/${t}/actions/permissions/selected-actions`):null;o.push(GE(g,_)),o.push(HE(await qe(e,`/repos/${t}/collaborators?affiliation=direct&per_page=100`),await qe(e,`/repos/${t}/keys?per_page=100`),r));let S=await e.json("GET",`/repos/${t}/actions/workflows/tapster.yml`).catch(()=>null);o.push(S?.state==="active"?B("the hub workflow is enabled"):R("the hub workflow is enabled","Enable the tapster workflow in the hub's Actions tab (GitHub pauses it after 60 days without activity; the doorbell turns it back on)."));let x=await qe(e,`/repos/${t}/actions/workflows/tapster.yml/runs?per_page=30`,"workflow_runs");o.push(VE(x,Date.now(),Boolean(d)));for(let b of n?.packages??[]){let v=await e.getRepo(b.repo).catch((T)=>T instanceof D?null:Promise.reject(T));if(!v){o.push(R(`${b.repo} exists`,"Fix the repo field in tapster.yml."));continue}if(v.private)o.push(B(`${b.repo} is published by the hub`,`${b.repo} is private: the hub publishes its releases, but Homebrew, Scoop, apt and dnf users can only install from public projects`));if(b.protection==="off")o.push(B(`${b.repo} is protected`,`protection is off for ${b.name}: a stolen App key could tag code there that the hub would sign`));else{let T=await Qi(e,b.repo,v.default_branch,"admin",b.protection==="dependabot"),P=b.protection==="dependabot"?`branches named dependabot/... are open on ${b.repo}, so a stolen App key could run its workflows on code of its own there`:void 0;o.push(T.length?R(`${b.repo} is protected`,`${T.join("; ")}. Run tapster add in a clone of ${b.repo}.`):B(`${b.repo} is protected`,P))}let k=(await qe(e,`/repos/${b.repo}/actions/secrets?per_page=100`,"secrets")).map((T)=>T.name).filter((T)=>/^(HOMEBREW_TAP_|MACOS_)/.test(T));o.push(k.length?R(`${b.repo} holds no release secrets`,`Delete ${k.join(", ")}: gh secret delete <name> --repo ${b.repo}`):B(`${b.repo} holds no release secrets`))}return o}async function JE(e,t,r){let s=(await e.json("GET",`/repos/${t}/environments/tapster/variables`).catch(()=>null))?.variables.find((o)=>o.name==="TAPSTER_APP_SLUG")?.value;if(!s||r.length===0)return null;return`note the App must be installed on ${r.join(", ")} and not on ${t}; GitHub shows its repositories only to the App itself, so check them at https://github.com/apps/${s}/installations/new (the hub's check job also reports both)`}function QE(e,t){if(e===null)return{checks:[R("tapster.yml is valid","Run tapster init.")],config:null};try{let{config:r,invalid:n}=bt(e,t);if(n.length===0)return{checks:[B("tapster.yml is valid")],config:r};return{checks:n.map((s)=>R(`${s.name} in tapster.yml is valid`,`${s.reason}. ${s.fix}`)),config:r}}catch(r){return{checks:[R("tapster.yml is valid",r instanceof y?`${r.reason}. ${r.fix}`:"Run tapster init.")],config:null}}}async function XE(e,t){let r=(await qe(e,`/repos/${t}/contents/.github/workflows?ref=main`)).filter((s)=>s.type==="file").map((s)=>s.name),n={};for(let s of r)n[s]=await aa(e,t,`.github/workflows/${s}`,"main")??"";return{config:await aa(e,t,"tapster.yml","main"),flows:n}}async function Fm(e){let t=await Kt(process.cwd()),r=t.split("/")[0],n=await Bt();console.log(`Checking ${t} as it is on GitHub's main branch.`);let s=await XE(n,t),o=[],i=QE(s.config,r),a=i.config;o.push(...i.checks);let c=s.flows["tapster.yml"];if(c)o.push(LE(c),KE(c,nt));else o.push(R("the hub workflow exists","Run tapster init, commit and push."));let{"tapster.yml":u,...l}=s.flows;o.push(DE(l)),o.push(...await YE(n,t,r,a,c??""));for(let p of o)if(console.log(p.ok?`ok ${p.name}`:`fix ${p.name}
972
- ${p.fix}`),p.note)console.log(` note: ${p.note}`);let f=await JE(n,t,a?.packages.map((p)=>p.repo)??[]);if(f)console.log(f);return o.every((p)=>p.ok)?0:1}var eT=`tapster: publish your projects' releases from one Homebrew tap
1093
+ }`;function CO(e){return $r(e),["-l","JavaScript","-e",OO,e.service,e.account,e.label]}function RO(e){return $r(e),["store","--label",e.label,"service",e.service,"account",e.account]}var Ar="/usr/bin/security",zv="/usr/bin/osascript",Do="/usr/bin/secret-tool",IO={kind:"keychain",exists:async(e)=>(await j(Ar,"security",["find-generic-password","-s",e.service,"-a",e.account],{allowFail:!0})).code===0,async save(e,t){let n=null;try{n=EO(e,t)}catch(i){if(!(i instanceof v)||!i.reason.includes("too long"))throw i}if(n!==null){let i=await j(Ar,"security",["-i"],{stdin:n,allowFail:!0});if(i.code===0&&!/error|returned/i.test(i.stderr))return;throw new v("the login keychain refused the key","Unlock the login keychain and run this again.")}let r=await j(zv,"osascript",CO(e),{stdin:t,allowFail:!0});if(r.code!==0||r.stdout.trim()!=="0")throw new v(`the login keychain refused the key (status ${r.stdout.trim()||r.code})`,"Unlock the login keychain and run this again.")},async read(e){let t=await j(Ar,"security",["find-generic-password","-s",e.service,"-a",e.account,"-w"],{allowFail:!0});return t.code===0?t.stdout.replace(/\n$/,""):null},async remove(e){await j(Ar,"security",["delete-generic-password","-s",e.service,"-a",e.account],{allowFail:!0})}},Dv={kind:"secret-service",exists:async(e)=>await Dv.read(e)!==null,async save(e,t){if((await j(Do,"secret-tool",RO(e),{stdin:t,allowFail:!0})).code!==0)throw new v("the Secret Service refused the key","Unlock your keyring (GNOME Keyring or KWallet) and run this again.")},async read(e){$r(e);let t=await j(Do,"secret-tool",["lookup","service",e.service,"account",e.account],{allowFail:!0});return t.code===0&&t.stdout!==""?t.stdout:null},async remove(e){$r(e),await j(Do,"secret-tool",["clear","service",e.service,"account",e.account],{allowFail:!0})}};function ol(e=process.platform,t=PO){if(e==="darwin")return t(Ar)&&t(zv)?IO:null;if(e==="linux")return t(Do)?Dv:null;return null}async function Lv(e,t){let n=await e.read(t);if(n!==null||!await e.exists(t))return n;throw new v("the previous key is in your keychain, but tapster could not read it","Choose Allow when macOS asks. Run this where you can see that question (not over SSH). Nothing was changed.")}function Pr(e){let t=ol();if(t)return t;throw new v(`tapster keeps a copy of ${e} in your keychain, but this system has none it can use`,"Run this on macOS or on Linux with secret-tool (libsecret-tools) installed. The key must never live only in GitHub, which never gives secrets back.")}function LO(e,t){let n=new Set(e.vars),r=new Set(e.secrets),i=[];if(!(n.has("TAPSTER_APP_ID")&&n.has("TAPSTER_APP_SLUG")))i.push("app");else if(!r.has("TAPSTER_APP_PRIVATE_KEY"))i.push("app-key");if(t&&!(n.has("TAPSTER_TEAM_ID")&&r.has("MACOS_SIGN_P12")&&r.has("MACOS_SIGN_PASSWORD")))i.push("certificate");if(t&&!["MACOS_NOTARY_KEY","MACOS_NOTARY_KEY_ID","MACOS_NOTARY_ISSUER_ID"].every((o)=>r.has(o)))i.push("notary");return i.push("files"),i}var Fv=(e)=>e.trim().toLowerCase()==="yes";function jO(e,t){return["app","certificate","notary"].filter((n)=>!e.includes(n)&&(n==="app"?!e.includes("app-key"):t))}function MO(e,t){if(!(e instanceof R)||!t||![403,404,422].includes(e.status))return e;return new v("GitHub refused environments on this private hub","Environments and their secrets need a public hub or GitHub Pro. Make the hub public or upgrade at https://github.com/settings/billing, then run tapster init again.")}function cl(e,t,n){let r=[];for(let i of e.packages.filter(Y)){let o=i.sparkle?.key===t?i.sparkle.public_key:i.sparkle?.next_key===t?i.sparkle.next_public_key:void 0;if(o===void 0)continue;if(o!==n)throw new v(`${i.name} pins ${o} for ${t}, but this key's public half is ${n}`,"Pick the keychain account of the key the app ships with or fix tapster.yml.");r.push(i.name)}if(r.length===0)throw new v(`no package in tapster.yml uses the Sparkle key ${t}`,"Add the package with its sparkle section first.");return r}async function Kv(e,t,n,r,i){console.log("Waiting up to 10 minutes until the App is installed; tapster continues by itself once you choose Install.");let o=await ho(async()=>{let s=await Oo(e,t,n,r).catch(()=>null);return s?.id?s:null});if(o===null){console.log(`The App is not installed yet. Install it at https://github.com/apps/${i}/installations/new; tapster add links there for each project too.`);return}if(o.onHub)console.log(`The App is installed on ${r}. Remove ${r} from it at https://github.com/settings/installations/${o.id}; the hub refuses to run until you do.`)}async function UO(e,t){console.log("GitHub creates a private App for your hub; it lets the hub publish your projects' releases. Confirm it on the page that opens.");let n=await lo((r)=>Eo(e,t,r),{what:"your tapster App",title:"Create your tapster App",lead:`GitHub asks you to confirm a private App on your account. ${t} uses it to publish the releases of the projects you install it on.`,key:`GitHub hands the App's private key to tapster in your terminal, once. tapster stores it as a secret of the tapster environment in ${t}. It goes nowhere else and no one else receives it.`,done:"Your tapster App is created",next:[`tapster stores the App's ID and key in ${t} and opens the App's install page in a new tab.`,`There, choose "Only select repositories" and pick the projects tapster should publish. Never pick ${t}: it holds your signing keys.`,'Click "Install". tapster notices within seconds and continues.'],again:"tapster init"},e);await Sr(t,n),console.log('Stored the App and its key in the hub. Now install it: choose "Only select repositories" and pick the projects tapster should publish.'),console.log(`Never pick ${t}: the App can write to every repository it is installed on. The hub holds your signing keys. tapster add can also install it on a project later.`),Ut(`https://github.com/apps/${n.slug}/installations/new`),await Kv(String(n.id),n.pem,e,t,n.slug)}function ZO(e){let t;try{t=zO(e)}catch{throw new v("that file is not a private key","Use the .pem file GitHub downloaded when you generated the key.")}if(t.asymmetricKeyType!=="rsa")throw new v("that file is not a GitHub App key","Use the .pem file GitHub downloaded when you generated the key.");let n=DO(t).export({type:"spki",format:"der"});return`SHA256:${NO("sha256").update(n).digest("base64")}`}async function jv(e,t){let n=await e.json("GET",`/repos/${t}/environments/tapster/variables`),r=n.variables.find((c)=>c.name==="TAPSTER_APP_ID")?.value,i=n.variables.find((c)=>c.name==="TAPSTER_APP_SLUG")?.value;if(!r||!i)throw new v("the hub has no App yet","Run tapster init first.");console.log(`Open the App's settings, scroll to "Private keys" and click "Generate a private key":`),Ut(`https://github.com/settings/apps/${i}`);let o=mn(await me("Path of the downloaded .pem file (drag it here): ")),s=(await gn(o,"the .pem file")).toString("utf8"),a=ZO(s);await new pe(Be(r,s)).json("GET","/app").catch(()=>{throw new v("that key does not belong to the hub's App",`Generate the key on https://github.com/settings/apps/${i}.`)}),await X(t,"TAPSTER_APP_PRIVATE_KEY",s),console.log(`Stored the new key (${a}).`),await Kv(r,s,t.split("/")[0],t,i),console.log(`Now delete every other key on that page so the old one stops working. Then delete ${o}.`)}async function Mv(e){console.log("Apple certificate: a Developer ID Application certificate exported as .p12. In Keychain Access, open My Certificates,"),console.log('right-click "Developer ID Application: ...", choose Export and save it as .p12 with a password. Create one at'),console.log("https://developer.apple.com/account/resources/certificates if you have none. It stays in your hub's secrets only.");let t=mn(await me(".p12 file (drag it here): ")),n=await gn(t,"the .p12 file"),r=await me(".p12 password: ",!0),i=await Co(n,r);await Ro(e,n,r,i),console.log(`Certificate stored for team ${i.team}. It expires on ${i.expires}; the hub warns 30 days before.`)}async function Uv(e){console.log("Notarization key: an App Store Connect API key. In App Store Connect open Users and Access, Integrations,"),console.log("App Store Connect API, Team Keys; create a key with Developer access and download AuthKey_<id>.p8 (Apple offers"),console.log("the download once). The Key ID is in the list and the Issuer ID above it. It stays in your hub's secrets only.");let t=mn(await me(".p8 file (drag it here): ")),n=await gn(t,"the .p8 file");rl(n);let r=il(await me("Key ID: ")),i=Io(n,r,await me("Issuer ID: "));console.log(await No(i)?"Apple accepted the key.":"Not on macOS, so the key is checked at the first release instead."),await zo(e,i),console.log(`Notarization key stored. You may delete ${t} once you keep a backup.`)}var sl={name:"tapster main",target:"branch",enforcement:"active",bypass_actors:[],conditions:{ref_name:{include:["~DEFAULT_BRANCH"],exclude:[]}},rules:[{type:"deletion"},{type:"non_fast_forward"}]};async function ll(e,t,n){try{await e.json("PUT",`/repos/${t}/environments/tapster`,{deployment_branch_policy:{protected_branches:!1,custom_branch_policies:!0}})}catch(o){throw MO(o,n)}let r=await e.json("GET",`/repos/${t}/environments/tapster/deployment-branch-policies`);for(let o of r.branch_policies.filter((s)=>s.name!=="main"))await e.json("DELETE",`/repos/${t}/environments/tapster/deployment-branch-policies/${o.id}`);if(!r.branch_policies.some((o)=>o.name==="main"))await e.json("POST",`/repos/${t}/environments/tapster/deployment-branch-policies`,{name:"main",type:"branch"});await e.json("PUT",`/repos/${t}/actions/permissions/workflow`,{default_workflow_permissions:"read",can_approve_pull_request_reviews:!1}),await e.json("PUT",`/repos/${t}/actions/permissions`,{enabled:!0,allowed_actions:"selected",sha_pinning_required:!0}),await e.json("PUT",`/repos/${t}/actions/permissions/selected-actions`,{github_owned_allowed:!0,verified_allowed:!1,patterns_allowed:["doguyilmaz/tapster@*"]});let i=(await e.json("GET",`/repos/${t}/rulesets`)).find((o)=>o.name===sl.name);if(i)await e.json("PUT",`/repos/${t}/rulesets/${i.id}`,sl);else await e.json("POST",`/repos/${t}/rulesets`,sl)}function Er(e,t){let n=Ee(e,"tapster.yml");if(!yn(n))throw new v("tapster.yml is missing","Run tapster init in the hub first.");let{config:r,invalid:i}=ne(Or(n,"utf8"),t.split("/")[0]);for(let o of i)console.log(`note: ${o.name} in tapster.yml is invalid and left out: ${o.reason}`);return r}async function GO(e,t,n,r,i){let o=yn(Ee(t,J))?Or(Ee(t,J),"utf8"):null,s=await Yc(e,o,n,r,i);await Hv(Ee(t,".github/workflows"),{recursive:!0}),await al(Ee(t,J),s.file.content),console.log(`wrote ${J} from the template, ${s.change}; hand edits in it are replaced`);for(let a of s.notes)console.log(a)}async function Wv(e,t){let n=Ee(e,J);if(!yn(n))throw new v(`${J} is missing`,"Run tapster init --workflow first.");await al(n,ko(Or(n,"utf8"),t)),console.log(`updated the sparkle step in ${J}`)}async function qO(e,t,n,r,i){if(!/^[a-z0-9]+$/.test(r))throw new v(`${r} is not a valid label`,"Use lowercase letters and digits, as in sparkle.key.");let o=Er(t,n);console.log("macOS asks whether tapster may read the Sparkle key from your keychain; choose Allow.");let s=await $e("security",["find-generic-password","-s","https://sparkle-project.org","-a",i,"-w"],{allowFail:!0});if(s.code!==0)throw new v(`the login keychain has no Sparkle key for the account ${i}`,"Pass the account generate_keys used with --account (ed25519 by default).");let a=s.stdout.trim(),c=To(a),l=cl(o,r,c.publicKey);console.log(`The key ${c.publicKey} signs updates for ${l.join(", ")}.`),console.log("If it is lost, installed copies can never update again; if it leaks, anyone can sign updates for them.");let u=await me("Do you keep an offline backup of this key? Type yes to store it in the hub: ");if(!Fv(u))throw new v("no offline backup confirmed","Back the key up first (generate_keys -x exports it), then run this again.");await X(n,`SPARKLE_KEY_${r.toUpperCase()}`,a),console.log(`Stored SPARKLE_KEY_${r.toUpperCase()}.`),await Wv(t,Te(o)),console.log("Review and commit the workflow change, then push.")}async function BO(e,t,n){if(!/^[a-z0-9]+$/.test(n))throw new v(`${n} is not a valid label`,"Use lowercase letters and digits, as in sparkle.key.");let r=Er(e,t),i=r.packages.filter(Y).filter((c)=>c.sparkle?.key===n||c.sparkle?.next_key===n);if(i.length)throw new v(`${i.map((c)=>c.name).join(", ")} already sign with the Sparkle key ${n}`,"A new key needs a new label. To change an app's key, follow Rotate a Sparkle key in the tapster docs (Mac apps with Sparkle).");let o=Pr("the Sparkle key"),s={service:"https://sparkle-project.org",account:n,label:"Private key for signing Sparkle updates"};if(await o.exists(s))throw new v(`your keychain already has a Sparkle key for the account ${n}`,`Store that one with tapster init --sparkle ${n} --account ${n} or pick another label.`);let a=Nv();if(await o.save({...s,comment:`Public key (SUPublicEDKey value) for this key is: ${a.publicKey}`},a.seed),console.log(`Saved a new Sparkle key in your ${o.kind==="keychain"?"login keychain":"keyring"} under the account ${n}. Sparkle's own tools find it there. macOS asks you before any app reads it.`),console.log(`Its public key is ${a.publicKey}. Put it in the app as SUPublicEDKey and in tapster.yml as sparkle.public_key.`),console.log("If this key is lost, installed copies can never update again. Keep an offline copy too, for example in your password manager:"),console.log(o.kind==="keychain"?` security find-generic-password -s https://sparkle-project.org -a ${n} -w (macOS asks you first)`:` secret-tool lookup service https://sparkle-project.org account ${n}`),!Fv(await me("Type yes once you keep an offline copy, to store the key in the hub: "))){console.log(`Not stored in the hub yet. Once you keep a copy, run tapster init --sparkle ${n} --account ${n}.`);return}await X(t,`SPARKLE_KEY_${n.toUpperCase()}`,a.seed),console.log(`Stored SPARKLE_KEY_${n.toUpperCase()} in the hub.`),await Wv(e,[...new Set([...Te(r),n])]),console.log("Review and commit the workflow change, then push.")}async function Zv(e,t,n){let r={...t,account:`${t.account} pending`,label:`${t.label} (pending)`};await e.remove(r),await e.save(r,n),await e.remove(t),await e.save(t,n),await e.remove(r)}var Tr=(e,t=!1)=>({service:"tapster-linux-key",account:t?`${e} previous`:e,label:`tapster Linux key for ${e}${t?" (previous)":""}`});async function HO(e,t){let n=(await Zt(e,t,"secrets")).map((r)=>r.name);if(await ol()?.remove(Tr(t,!0)),!n.includes("TAPSTER_LINUX_KEY_PREVIOUS")){console.log("No Linux key rotation is running, so there is nothing to finish.");return}await Gg(t,"TAPSTER_LINUX_KEY_PREVIOUS"),console.log("The previous Linux key no longer signs; apt and dnf trust only the new one from the next run.")}function FO(e,t){if(e.includes("TAPSTER_LINUX_KEY")&&!t)throw new v("the hub already has a Linux signing key","Replacing it makes every apt and dnf user fetch the new key. To do that, run tapster init --rotate linux.")}async function Gv(e,t,n,r){let i=Er(t,n),o=(await Zt(e,n,"secrets")).map((u)=>u.name);FO(o,r);let s=Pr("the Linux signing key"),a=["/opt/homebrew/bin/gpg","/usr/local/bin/gpg","/usr/bin/gpg"].find((u)=>yn(u));if(!a)throw new v("gpg is not installed","Install it with brew install gnupg, then run this again.");await e.json("POST",`/repos/${n}/pages`,{build_type:"workflow"}).catch(async(u)=>{if(!(u instanceof R)||u.status!==409)throw new v("GitHub Pages could not be turned on for the hub","A private hub needs a paid plan for Pages; make the hub public or turn Pages on by hand with GitHub Actions as the source.");await e.json("PUT",`/repos/${n}/pages`,{build_type:"workflow"})}),console.log("GitHub Pages serves the hub from GitHub Actions.");let c=kt("tl-"),l={GNUPGHOME:c};try{await j(a,"gpg",["--batch","--pinentry-mode","loopback","--passphrase","","--quick-gen-key",`${n.split("/")[0]} tapster (${n})`,"rsa4096","sign","never"],{env:l});let u=(await j(a,"gpg",["--batch","--armor","--export-secret-keys"],{env:l})).stdout,p=(await j(a,"gpg",["--batch","--with-colons","--list-secret-keys"],{env:l})).stdout.split(`
1094
+ `).find((f)=>f.startsWith("fpr:"))?.split(":")[9],d=null;if(r){if(s.kind==="keychain")console.log("macOS asks whether tapster may read the previous key from your keychain; choose Allow.");d=await Lv(s,Tr(n))}let h={...Tr(n),account:`${n} new`,label:`tapster Linux key for ${n} (new)`};if(await s.remove(h),await s.save(h,u),await X(n,"TAPSTER_LINUX_KEY",u),d)await X(n,"TAPSTER_LINUX_KEY_PREVIOUS",d);if(d)await Zv(s,Tr(n,!0),d);if(await Zv(s,Tr(n),u),await s.remove(h),console.log(`Stored the Linux key (fingerprint ${p}) in the hub and in your ${s.kind==="keychain"?"login keychain":"keyring"} as "tapster-linux-key".`),d)console.log("The previous key keeps signing next to the new one, so apt and dnf users can fetch the new key. Once they have, run tapster init --rotate linux --finish.");else if(r)console.log("The previous key is not in your keychain, so apt and dnf users must fetch the new key before they can update.")}finally{await j(Ee(a,"..","gpgconf"),"gpgconf",["--kill","all"],{env:l,allowFail:!0}).catch(()=>{return}),Fe(c)}if(!i.packages.some((u)=>!Y(u)&&u.linux))console.log("No package sets linux: true yet; add it to the CLI packages that should ship to apt and dnf.")}async function KO(e,t,n,r,i){let s=await So(e,n,async(a)=>yn(Ee(t,a))?Or(Ee(t,a),"utf8"):null,r,i);for(let a of s.files)await Hv(Ee(t,a.path,".."),{recursive:!0}),await al(Ee(t,a.path),a.content),console.log(a.path===J?`wrote ${J} from the template, ${s.change}; hand edits in it are replaced`:`wrote ${a.path}`);for(let a of s.notes)console.log(a)}async function WO(e){let t=(await me(e)).toLowerCase();return t===""||t==="y"||t==="yes"}async function VO(e,t){let n=async(r)=>{try{return((await e.json("GET",`/repos/${t}/environments/tapster/${r}?per_page=100`))[r]??[]).map((o)=>o.name)}catch(i){if(i instanceof R&&i.status===404)return[];throw i}};return{vars:await n("variables"),secrets:await n("secrets"),private:(await e.getRepo(t)).private}}function qv(e,t){let n=e.indexOf(t);if(n<0)return{value:null,rest:e};return{value:e[n+1]??"",rest:e.filter((r,i)=>i!==n&&i!==n+1)}}var YO="Run tapster init --help for the options.";function JO(e){let[t,n,r,i]=e;if(e.length===0)return{kind:"setup"};if(t==="--rotate"&&e.length===2&&["app","certificate","notary","doorbell","linux"].includes(n??""))return{kind:"rotate",what:n};if(t==="--rotate"&&n==="linux"&&r==="--finish"&&e.length===3)return{kind:"rotate",what:"linux-finish"};if(t==="--doorbell"&&e.length===1)return{kind:"doorbell"};if(t==="--linux"&&e.length===1)return{kind:"linux"};if(t==="--workflow"&&e.length===1)return{kind:"workflow"};if(t==="--sparkle"&&n&&!n.startsWith("-")){if(e.length===2)return{kind:"sparkle",label:n,account:"ed25519"};if(r==="--new"&&e.length===3)return{kind:"sparkle-new",label:n};if(r==="--account"&&i&&e.length===4)return{kind:"sparkle",label:n,account:i}}throw new v(`unknown option ${e.join(" ")}`,YO)}function Bv(e){let t=Ee(e,J);return yn(t)&&rt(Or(t,"utf8"))||10}async function Vv(e){let t=qv(e,"--tapster"),n=qv(t.rest,"--every"),r=t.value,i=n.value===null?null:Number(n.value),o=JO(n.rest);if(i!==null)fo(i);if((r!==null||i!==null)&&o.kind!=="setup"&&o.kind!=="workflow")throw new v("--tapster and --every go only with tapster init or init --workflow","Those are the commands that write the workflow.");let s=process.cwd(),a=await He(s),c=await _t();if(o.kind==="rotate"){if(o.what==="app")return jv(c,a);if(o.what==="certificate")return Mv(a);if(o.what==="notary")return Uv(a);if(o.what==="doorbell")return nv(c,a,Bv(s));if(o.what==="linux-finish")return HO(c,a);return Gv(c,s,a,!0)}if(o.kind==="doorbell")return tv(c,a,Er(s,a),po,Bv(s));if(o.kind==="linux")return Gv(c,s,a,!1);if(o.kind==="sparkle-new")return BO(s,a,o.label);if(o.kind==="sparkle")return qO(c,s,a,o.label,o.account);if(o.kind==="workflow")return GO(c,s,Te(Er(s,a)),r,{every:i,isPrivate:(await c.getRepo(a)).private});let l=await VO(c,a);await ll(c,a,l.private);let p=l.vars.includes("TAPSTER_TEAM_ID")||l.secrets.includes("MACOS_NOTARY_KEY")||await WO("Will this hub sign software for macOS (Mac apps or CLI tools with macOS builds)? [Y/n] "),d=LO(l,p),h=jO(d,p);if(h.length)console.log(`Already done: ${h.join(", ")}. To redo one, run tapster init --rotate <name>.`);for(let f of d){if(f==="app")await UO(a.split("/")[0],a);if(f==="app-key")await jv(c,a);if(f==="certificate")await Mv(a);if(f==="notary")await Uv(a);if(f==="files")await KO(c,s,a,r,{every:i,isPrivate:l.private})}if(!p)console.log("Skipped the Apple credentials. Add them later with tapster init --rotate certificate and tapster init --rotate notary.");console.log(`
1095
+ Done. Review and commit the new files, push, then run tapster add in each project.`)}import{homedir as Z2}from"os";import{randomBytes as a2}from"crypto";var QO=/^(\.tapster|Casks|bucket)\//;async function ul(e,t,n){let r=encodeURIComponent("refs/heads/main"),[i]=await e.json("GET",`/repos/${t}/activity?ref=${r}&actor=${n}&per_page=1`);if(!i)return[`GitHub shows no push by ${n} to main`];let o=i.after.slice(0,7),s=(await e.json("GET",`/repos/${t}/git/ref/heads/main`)).object.sha,a=await e.json("GET",`/repos/${t}/compare/${i.after}...${s}`);if(a.status==="identical")return[];if(a.status!=="ahead")return[`main no longer contains your last push (${o})`];let c=a.files??[];if(c.length>=300)return[`more files changed after your last push (${o}) than GitHub lists`];return c.filter((l)=>!QO.test(l.filename)).map((l)=>`${l.filename} changed after your last push (${o})`)}import{randomBytes as pl}from"crypto";var Yv=async()=>'var Ge,S,qt,ft,re,Gt,Kt,Yt,pt,Ve,Se,Jt,mt,dt,ht,Zn,Fe={},Le=[],Qn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ue=Array.isArray;function te(e,n){for(var s in n)e[s]=n[s];return e}function vt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function es(e,n,s){var o,i,a,r={};for(a in n)a=="key"?o=n[a]:a=="ref"?i=n[a]:r[a]=n[a];if(arguments.length>2&&(r.children=arguments.length>3?Ge.call(arguments,2):s),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)r[a]===void 0&&(r[a]=e.defaultProps[a]);return je(e,r,o,i,null)}function je(e,n,s,o,i){var a={type:e,props:n,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++qt:i,__i:-1,__u:0};return i==null&&S.vnode!=null&&S.vnode(a),a}function C(e){return e.children}function me(e,n){this.props=e,this.context=n}function ue(e,n){if(n==null)return e.__?ue(e.__,e.__i+1):null;for(var s;n<e.__k.length;n++)if((s=e.__k[n])!=null&&s.__e!=null)return s.__e;return typeof e.type=="function"?ue(e):null}function ts(e){if(e.__P&&e.__d){var n=e.__v,s=n.__e,o=[],i=[],a=te({},n);a.__v=n.__v+1,S.vnode&&S.vnode(a),bt(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[s]:null,o,s==null?ue(n):s,!!(32&n.__u),i),a.__v=n.__v,a.__.__k[a.__i]=a,tn(o,a,i),n.__e=n.__=null,a.__e!=s&&Xt(a)}}function Xt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),Xt(e)}function Ut(e){(!e.__d&&(e.__d=!0)&&re.push(e)&&!Be.__r++||Gt!=S.debounceRendering)&&((Gt=S.debounceRendering)||Kt)(Be)}function Be(){try{for(var e,n=1;re.length;)re.length>n&&re.sort(Yt),e=re.shift(),n=re.length,ts(e)}finally{re.length=Be.__r=0}}function Zt(e,n,s,o,i,a,r,c,p,u,h){var f,l,d,_,T,g,k=o&&o.__k||Le,y=n.length;for(p=ns(s,n,k,p,y),f=0;f<y;f++)(d=s.__k[f])!=null&&(l=d.__i!=-1&&k[d.__i]||Fe,d.__i=f,g=bt(e,d,l,i,a,r,c,p,u,h),_=d.__e,d.ref&&l.ref!=d.ref&&(l.ref&&yt(l.ref,null,d),h.push(d.ref,d.__c||_,d)),T==null&&_!=null&&(T=_),4&d.__u?(p=Qt(d,p,e),l.__e&&(l.__e=null)):typeof d.type=="function"&&g!==void 0?p=g:_&&(p=_.nextSibling),d.__u&=-7);return s.__e=T,p}function ns(e,n,s,o,i){var a,r,c,p,u,h=s.length,f=h,l=0;for(e.__k=Array(i),a=0;a<i;a++)(r=n[a])!=null&&typeof r!="boolean"&&typeof r!="function"?(typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?r=e.__k[a]=je(null,r,null,null,null):Ue(r)?r=e.__k[a]=je(C,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?r=e.__k[a]=je(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):e.__k[a]=r,p=a+l,r.__=e,r.__b=e.__b+1,c=null,(u=r.__i=ss(r,s,p,f))!=-1&&(f--,(c=s[u])&&(c.__u|=2)),c==null||c.__v==null?(u==-1&&(i>h?l--:i<h&&l++),typeof r.type!="function"&&(r.__u|=4)):u!=p&&(u==p-1?l--:u==p+1?l++:(u>p?l--:l++,r.__u|=4))):e.__k[a]=null;if(f)for(a=0;a<h;a++)(c=s[a])!=null&&(2&c.__u)==0&&(c.__e==o&&(o=ue(c)),sn(c,c));return o}function Qt(e,n,s){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,n=Qt(o[i],n,s));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=ue(e)),n=s.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function ss(e,n,s,o){var i,a,r,{key:c,type:p}=e,u=n[s],h=u!=null&&(2&u.__u)==0;if(u===null&&c==null||h&&c==u.key&&p==u.type)return s;if(o>(h?1:0)){for(i=s-1,a=s+1;i>=0||a<n.length;)if((u=n[r=i>=0?i--:a++])!=null&&(2&u.__u)==0&&c==u.key&&p==u.type)return r}return-1}function Wt(e,n,s){n[0]=="-"?e.setProperty(n,s==null?"":s):e[n]=s==null?"":typeof s!="number"||Qn.test(n)?s:s+"px"}function Re(e,n,s,o,i){var a,r;e:if(n=="style")if(typeof s=="string")e.style.cssText=s;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(n in o)s&&n in s||Wt(e.style,n,"");if(s)for(n in s)o&&s[n]==o[n]||Wt(e.style,n,s[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(Jt,"$1")),r=n.toLowerCase(),n=r in e||n=="onFocusOut"||n=="onFocusIn"?r.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=s,s?o?s[Se]=o[Se]:(s[Se]=mt,e.addEventListener(n,a?ht:dt,a)):e.removeEventListener(n,a?ht:dt,a);else{if(i=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=s==null?"":s;break e}catch(c){}typeof s=="function"||(s==null||s===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&s==1?"":s))}}function zt(e){return function(n){if(this.l){var s=this.l[n.type+e];if(n[Ve]==null)n[Ve]=mt++;else if(n[Ve]<s[Se])return;return s(S.event?S.event(n):n)}}}function bt(e,n,s,o,i,a,r,c,p,u){var h,f,l,d,_,T,g,k,y,H,b,w,B,ee,ae,xe,K=n.type;if(n.constructor!==void 0)return null;128&s.__u&&(p=!!(32&s.__u),a=[c=n.__e=s.__e]),(h=S.__b)&&h(n);e:if(typeof K=="function"){f=r.length;try{if(y=n.props,H=K.prototype&&K.prototype.render,b=(h=K.contextType)&&o[h.__c],w=h?b?b.props.value:h.__:o,s.__c?k=(l=n.__c=s.__c).__=l.__E:(H?n.__c=l=new K(y,w):(n.__c=l=new me(y,w),l.constructor=K,l.render=as),b&&b.sub(l),l.state||(l.state={}),l.__n=o,d=l.__d=!0,l.__h=[],l._sb=[]),H&&l.__s==null&&(l.__s=l.state),H&&K.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=te({},l.__s)),te(l.__s,K.getDerivedStateFromProps(y,l.__s))),_=l.props,T=l.state,l.__v=n,d)H&&K.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),H&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(H&&K.getDerivedStateFromProps==null&&y!==_&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(y,w),n.__v==s.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(y,l.__s,w)===!1){n.__v!=s.__v&&(l.props=y,l.state=l.__s,l.__d=!1),n.__e=s.__e,n.__k=s.__k,n.__k.some(function(X){X&&(X.__=n)}),Le.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&r.push(l),c=ue(s);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(y,l.__s,w),H&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(_,T,g)})}if(l.context=w,l.props=y,l.__P=e,l.__e=!1,B=S.__r,ee=0,H)l.state=l.__s,l.__d=!1,B&&B(n),h=l.render(l.props,l.state,l.context),Le.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,B&&B(n),h=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++ee<25);l.state=l.__s,l.getChildContext!=null&&(o=te(te({},o),l.getChildContext())),H&&!d&&l.getSnapshotBeforeUpdate!=null&&(g=l.getSnapshotBeforeUpdate(_,T)),ae=h!=null&&h.type===C&&h.key==null?nn(h.props.children):h,c=Zt(e,Ue(ae)?ae:[ae],n,s,o,i,a,r,c,p,u),l.base=n.__e,n.__u&=-161,l.__h.length&&r.push(l),k&&(l.__E=l.__=null)}catch(X){if(r.length=f,n.__v=null,p||a!=null){if(X.then){for(n.__u|=p?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;a!=null&&(a[a.indexOf(c)]=null),n.__e=c}else if(a!=null)for(xe=a.length;xe--;)vt(a[xe])}else n.__e=s.__e;n.__k==null&&(n.__k=s.__k||[]),X.then||en(n),S.__e(X,n,s)}}else a==null&&n.__v==s.__v?(n.__k=s.__k,n.__e=s.__e):c=n.__e=os(s.__e,n,s,o,i,a,r,p,u);return(h=S.diffed)&&h(n),128&n.__u?void 0:c}function en(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(en))}function tn(e,n,s){for(var o=0;o<s.length;o++)yt(s[o],s[++o],s[++o]);S.__c&&S.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){S.__e(a,i.__v)}})}function nn(e){return typeof e!="object"||e==null||e.__b>0?e:Ue(e)?e.map(nn):e.constructor!==void 0?null:te({},e)}function os(e,n,s,o,i,a,r,c,p){var u,h,f,l,d,_,T,g=s.props||Fe,{props:k,type:y}=n;if(y=="svg"?i="http://www.w3.org/2000/svg":y=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(u=0;u<a.length;u++)if((d=a[u])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,a[u]=null;break}}if(e==null){if(y==null)return document.createTextNode(k);e=document.createElementNS(i,y,k.is&&k),c&&(S.__m&&S.__m(n,a),c=!1),a=null}if(y==null)g===k||c&&e.data==k||(e.data=k);else{if(a=y=="textarea"&&k.defaultValue!=null?null:a&&Ge.call(e.childNodes),!c&&a!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||(u in k)||u=="value"&&("defaultValue"in k)||u=="checked"&&("defaultChecked"in k)||Re(e,u,null,d,i);for(u in k)d=k[u],u=="children"?l=d:u=="dangerouslySetInnerHTML"?h=d:u=="value"?_=d:u=="checked"?T=d:c&&typeof d!="function"||g[u]===d||Re(e,u,d,g[u],i);if(h)c||f&&(h.__html==f.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(f&&(e.innerHTML=""),Zt(n.type=="template"?e.content:e,Ue(l)?l:[l],n,s,o,y=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,r,a?a[0]:s.__k&&ue(s,0),c,p),a!=null)for(u=a.length;u--;)vt(a[u]);c&&y!="textarea"||(u="value",y=="progress"&&_==null?e.removeAttribute("value"):_!=null&&(_!==e[u]||y=="progress"&&!_||y=="option"&&_!=g[u])&&Re(e,u,_,g[u],i),u="checked",T!=null&&T!=e[u]&&Re(e,u,T,g[u],i))}return e}function yt(e,n,s){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&n==null||(e.__u=e(n))}else e.current=n}catch(i){S.__e(i,s)}}function sn(e,n,s){var o,i;if(S.unmount&&S.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||yt(o,null,n)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){S.__e(a,n)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&sn(o[i],n,s||typeof e.type!="function");s||vt(e.__e),e.__c=e.__=e.__e=void 0}function as(e,n,s){return this.constructor(e,s)}function on(e,n,s){var o,i,a,r;n==document&&(n=document.documentElement),S.__&&S.__(e,n),i=(o=typeof s=="function")?null:s&&s.__k||n.__k,a=[],r=[],bt(n,e=(!o&&s||n).__k=es(C,null,[e]),i||Fe,Fe,n.namespaceURI,!o&&s?[s]:i?null:n.firstChild?Ge.call(n.childNodes):null,a,!o&&s?s:i?i.__e:n.firstChild,o,r),tn(a,e,r),e.props.children=null}Ge=Le.slice,S={__e:function(e,n,s,o){for(var i,a,r;n=n.__;)if((i=n.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),r=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),r=i.__d),r)return i.__E=i}catch(c){e=c}throw e}},qt=0,ft=function(e){return e!=null&&e.constructor===void 0},me.prototype.setState=function(e,n){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=te({},this.state),typeof e=="function"&&(e=e(te({},s),this.props)),e&&te(s,e),e!=null&&this.__v&&(n&&this._sb.push(n),Ut(this))},me.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ut(this))},me.prototype.render=C,re=[],Kt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yt=function(e,n){return e.__v.__b-n.__v.__b},Be.__r=0,pt=Math.random().toString(8),Ve="__d"+pt,Se="__a"+pt,Jt=/(PointerCapture)$|Capture$/i,mt=0,dt=zt(!1),ht=zt(!0),Zn=0;var Ce,I,_t,an,ze=0,fn=[],M=S,{__b:rn,__r:ln,diffed:cn,__c:un,unmount:pn,__:dn}=M;function wt(e,n){M.__h&&M.__h(I,e,ze||n),ze=0;var s=I.__H||(I.__H={__:[],__h:[]});return e>=s.__.length&&s.__.push({}),s.__[e]}function m(e){return ze=1,is(vn,e)}function is(e,n,s){var o=wt(Ce++,2);if(o.t=e,!o.__c&&(o.__=[s?s(n):vn(void 0,n),function(c){var p=o.__N?o.__N[0]:o.__[0],u=o.t(p,c);p!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=I,!I.__f)){var i=function(c,p,u){if(!o.__c.__H)return!0;var h=!1,f=o.__c.props!==c;if(o.__c.__H.__.some(function(d){if(d.__N){h=!0;var _=d.__[0];d.__=d.__N,d.__N=void 0,_!==d.__[0]&&(f=!0)}}),a){var l=a.call(this,c,p,u);return h?l||f:l}return!h||f};I.__f=!0;var a=I.shouldComponentUpdate,r=I.componentWillUpdate;I.componentWillUpdate=function(c,p,u){if(this.__e){var h=a;a=void 0,i(c,p,u),a=h}r&&r.call(this,c,p,u)},I.shouldComponentUpdate=i}return o.__N||o.__}function U(e,n){var s=wt(Ce++,3);!M.__s&&mn(s.__H,n)&&(s.__=e,s.u=n,I.__H.__h.push(s))}function Te(e){return ze=5,qe(function(){return{current:e}},[])}function qe(e,n){var s=wt(Ce++,7);return mn(s.__H,n)&&(s.__=e(),s.__H=n,s.__h=e),s.__}function rs(){for(var e;e=fn.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(We),n.__h.some(gt),n.__h=[]}catch(s){n.__h=[],M.__e(s,e.__v)}}}M.__b=function(e){I=null,rn&&rn(e)},M.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),dn&&dn(e,n)},M.__r=function(e){ln&&ln(e),Ce=0;var n=(I=e.__c).__H;n&&(_t===I?(n.__h=[],I.__h=[],n.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(n.__h.some(We),n.__h.some(gt),n.__h=[],Ce=0)),_t=I},M.diffed=function(e){cn&&cn(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(fn.push(n)!==1&&an===M.requestAnimationFrame||((an=M.requestAnimationFrame)||ls)(rs)),n.__H.__.some(function(s){s.u&&(s.__H=s.u,s.u=void 0)})),_t=I=null},M.__c=function(e,n){n.some(function(s){try{s.__h.some(We),s.__h=s.__h.filter(function(o){return!o.__||gt(o)})}catch(o){n.some(function(i){i.__h&&(i.__h=[])}),n=[],M.__e(o,s.__v)}}),un&&un(e,n)},M.unmount=function(e){pn&&pn(e);var n,s=e.__c;s&&s.__H&&(s.__H.__.some(function(o){try{We(o)}catch(i){n=i}}),s.__H=void 0,n&&M.__e(n,s.__v))};var hn=typeof requestAnimationFrame=="function";function ls(e){var n,s=function(){clearTimeout(o),hn&&cancelAnimationFrame(n),setTimeout(e)},o=setTimeout(s,35);hn&&(n=requestAnimationFrame(s))}function We(e){var n=I,s=e.__c;typeof s=="function"&&(e.__c=void 0,s()),I=n}function gt(e){var n=I;e.__c=e.__(),I=n}function mn(e,n){return!e||e.length!==n.length||n.some(function(s,o){return s!==e[o]})}function vn(e,n){return typeof n=="function"?n(e):n}var cs=Symbol.for("preact-signals");function Xe(){if(!(ne>1)){var e,n=!1;(function(){var i=Ye;Ye=void 0;while(i!==void 0){var a=i.S;if(a.v===i.v){for(var r=a.t;r!==void 0;r=r.x)if(r.i===i.i)r.i=a.i}i=i.o}})();while(He!==void 0){var s=He;He=void 0,Ke++;while(s!==void 0){var o=s.u;if(s.u=void 0,s.f&=-3,!(8&s.f)&&yn(s))try{s.c()}catch(i){if(!n)e=i,n=!0}s=o}}if(Ke=0,ne--,n)throw e}else ne--}function xt(e){if(ne>0)return e();kt=++us,ne++;try{return e()}finally{Xe()}}var Ae,P=void 0;function Pe(e){var n=P,s=Ae;P=void 0,Ae=void 0;try{return e()}finally{P=n,Ae=s}}var He=void 0,ne=0,Ke=0,us=0,kt=0,Ye=void 0,Je=0;function bn(e){if(P!==void 0){var n=e.n;if(n===void 0||n.t!==P){if(n={i:0,S:e,p:P.s,n:void 0,t:P,e:void 0,x:void 0,r:n},P.s!==void 0)P.s.n=n;if(P.s=n,e.n=n,32&P.f)e.S(n);return n}else if(n.i===-1){if(n.i=0,n.n!==void 0){if(n.n.p=n.p,n.p!==void 0)n.p.n=n.n;n.p=P.s,n.n=void 0,P.s.n=n,P.s=n}return n}}}function O(e,n){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=n==null?void 0:n.watched,this.Z=n==null?void 0:n.unwatched,this.name=n==null?void 0:n.name}O.prototype.brand=cs;O.prototype.h=function(){return!0};O.prototype.S=function(e){var n=this,s=this.t;if(s!==e&&e.e===void 0)if(e.x=s,this.t=e,s!==void 0)s.e=e;else Pe(function(){var o;(o=n.W)==null||o.call(n)})};O.prototype.U=function(e){var n=this;if(this.t!==void 0){var{e:s,x:o}=e;if(s!==void 0)s.x=o,e.e=void 0;if(o!==void 0)o.e=s,e.x=void 0;if(e===this.t){if(this.t=o,o===void 0)Pe(function(){var i;(i=n.Z)==null||i.call(n)})}}};O.prototype.subscribe=function(e){var n=this;return de(function(){var s=n.value;Pe(function(){return e(s)})},{name:"sub"})};O.prototype.valueOf=function(){return this.value};O.prototype.toString=function(){return this.value+""};O.prototype.toJSON=function(){return this.value};O.prototype.peek=function(){var e=this;return Pe(function(){return e.value})};Object.defineProperty(O.prototype,"value",{get:function(){var e=bn(this);if(e!==void 0)e.i=this.i;return this.v},set:function(e){if(e!==this.v){if(Ke>100)throw Error("Cycle detected");(function(s){if(ne!==0&&Ke===0){if(s.l!==kt)s.l=kt,Ye={S:s,v:s.v,i:s.i,o:Ye}}})(this),this.v=e,this.i++,Je++,ne++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{Xe()}}}});function E(e,n){return new O(e,n)}function yn(e){for(var n=e.s;n!==void 0;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function _n(e){for(var n=e.s;n!==void 0;n=n.n){var s=n.S.n;if(s!==void 0)n.r=s;if(n.S.n=n,n.i=-1,n.n===void 0){e.s=n;break}}}function gn(e){var n=e.s,s=void 0;while(n!==void 0){var o=n.p;if(n.i===-1){if(n.S.U(n),o!==void 0)o.n=n.n;if(n.n!==void 0)n.n.p=o}else s=n;if(n.S.n=n.r,n.r!==void 0)n.r=void 0;n=o}e.s=s}function pe(e,n){O.call(this,void 0,n),this.x=e,this.s=void 0,this.g=Je-1,this.f=4}pe.prototype=new O;pe.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32)return!0;if(this.f&=-5,this.g===Je)return!0;if(this.g=Je,this.f|=1,this.i>0&&!yn(this))return this.f&=-2,!0;var e=P;try{_n(this),P=this;var n=this.x();if(16&this.f||this.v!==n||this.i===0)this.v=n,this.f&=-17,this.i++}catch(s){this.v=s,this.f|=16,this.i++}return P=e,gn(this),this.f&=-2,!0};pe.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var n=this.s;n!==void 0;n=n.n)n.S.S(n)}O.prototype.S.call(this,e)};pe.prototype.U=function(e){if(this.t!==void 0){if(O.prototype.U.call(this,e),this.t===void 0){this.f&=-33;for(var n=this.s;n!==void 0;n=n.n)n.S.U(n)}}};pe.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(pe.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var e=bn(this);if(this.h(),e!==void 0)e.i=this.i;if(16&this.f)throw this.v;return this.v}});function Ze(e,n){return new pe(e,n)}function wn(e){var n=e.m;if(e.m=void 0,typeof n=="function"){ne++;var s=P;P=void 0;try{n()}catch(o){throw e.f&=-2,e.f|=8,St(e),o}finally{P=s,Xe()}}}function St(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,wn(e)}function ps(e){if(P!==this)throw Error("Out-of-order effect");if(gn(this),P=e,this.f&=-2,8&this.f)St(this);Xe()}function ve(e,n){if(this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n==null?void 0:n.name,Ae)Ae.push(this)}ve.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(this.x===void 0)return;var n=this.x();if(typeof n=="function")this.m=n}finally{e()}};ve.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,wn(this),_n(this),ne++;var e=P;return P=this,ps.bind(this,e)};ve.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=He,He=this};ve.prototype.d=function(){if(this.f|=8,!(1&this.f))St(this)};ve.prototype.dispose=function(){this.d()};function de(e,n){var s=new ve(e,n);try{s.c()}catch(i){throw s.d(),i}var o=s.d.bind(s);return o[Symbol.dispose]=o,o}var kn,et,Qe,ds=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var xn=[];de(function(){kn=this.N})();function be(e,n){S[e]=n.bind(null,S[e]||function(){})}function Ne(e){if(Qe){var n=Qe;Qe=void 0,n()}Qe=e&&e.S()}function Sn(e){var n=this,s=e.data,o=fs(s);o.name="ReactiveDom",o.value=s;var i=qe(function(){var c=n,p=n.__v;while(p=p.__)if(p.__c){p.__c.__$f|=4;break}var u=Ze(function(){var d=o.value.value;return d===0?0:d===!0?"":d||""}),h=Ze(function(){return!Array.isArray(u.value)&&!ft(u.value)}),f=de(function(){if(this.N=Cn,h.value){var d=u.value;if(c.__v&&c.__v.__e&&c.__v.__e.nodeType===3)c.__v.__e.data=d}}),l=n.__$u.d;return n.__$u.d=function(){f(),l.call(this)},[h,u]},[]),a=i[0],r=i[1];return a.value?r.peek():r.value}Sn.displayName="ReactiveTextNode";Object.defineProperties(O.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Sn},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});be("__b",function(e,n){if(Ne(),et=void 0,typeof n.type=="string"){var s,o=n.props;for(var i in o)if(i!=="children"){var a=o[i];if(a instanceof O){if(!s)n.__np=s={};s[i]=a,o[i]=a.peek()}}}e(n)});be("__r",function(e,n){if(e(n),n.type!==C){Ne();var s,o=n.__c;if(o){if(o.__$f&=-2,(s=o.__$u)===void 0)o.__$u=s=function(i,a){var r;return de(function(){r=this},{name:a}),r.c=i,r}(function(i){return function(){var a;if(ds)(a=this.y)==null||a.call(this);i.__$f|=1,i.setState({})}}(o),typeof n.type=="function"?n.type.displayName||n.type.name:"")}et=o,Ne(s)}});be("__e",function(e,n,s,o){Ne(),et=void 0,e(n,s,o)});be("diffed",function(e,n){Ne(),et=void 0;var s;if(typeof n.type=="string"&&(s=n.__e)){var{__np:o,props:i}=n,a=s.U;if(a)for(var r in a){var c=a[r];if(!(c===void 0||o&&(r in o)))c.d(),a[r]=void 0}if(o){if(!a)a={},s.U=a;for(var p in o){var u=a[p],h=o[p];if(u===void 0)u=hs(s,p,h,i),a[p]=u;else u.o(h,i)}}}e(n)});function hs(e,n,s,o){var i=n in e&&e.ownerSVGElement===void 0,a=E(s);return{o:function(r,c){a.value=r,o=c},d:de(function(){this.N=Cn;var r=a.value.value;if(o[n]!==r)if(o[n]=r,i)e[n]=r;else if(r!=null&&(r!==!1||n[4]==="-"))e.setAttribute(n,r);else e.removeAttribute(n)})}}be("unmount",function(e,n){if(typeof n.type=="string"){var s=n.__e;if(s){var o=s.U;if(o){s.U=void 0;for(var i in o){var a=o[i];if(a)a.d()}}}var r=n.__np;if(r){var c=n.props;for(var p in r)c[p]=r[p]}n.__np=void 0}else{var u=n.__c;if(u){u.__$f|=8;var h=u.__$u;if(h)u.__$u=void 0,h.d()}}e(n)});be("__h",function(e,n,s,o){if(o<3)n.__$f|=2;e(n,s,o)});me.prototype.shouldComponentUpdate=function(e,n){if(this.__R)return!0;var s=this.__$u,o=s&&s.s!==void 0;for(var i in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(o||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var r in e)if(r!=="__source"&&e[r]!==this.props[r])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function fs(e,n){return qe(function(){return E(e,n)},[])}var ms=function(e){queueMicrotask(function(){queueMicrotask(e)})};function vs(){xt(function(){var e;while(e=xn.shift())kn.call(e)})}function Cn(){if(xn.push(this)===1)(S.requestAnimationFrame||ms)(vs)}class se extends Error{problem;status;constructor(e,n){super(e.reason);this.problem=e;this.status=n}}var Ct={get:()=>{try{return sessionStorage.getItem("tapster.session")}catch{return null}},set:(e)=>{try{if(e===null)sessionStorage.removeItem("tapster.session");else sessionStorage.setItem("tapster.session",e)}catch{return}}},$e=Ct.get(),Tn=()=>{},An=()=>$e!==null,Hn=(e)=>{Tn=e};async function Pn(e){let n=await fetch("/api/claim",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:e})}),s=await n.json().catch(()=>({}));if(!n.ok||!s.token)throw new se(s.error??{reason:"the link did not work",fix:"Press Enter in the terminal that runs tapster setup for a fresh link."},n.status);$e=s.token,Ct.set($e)}async function Nn(e,n,s){let o={authorization:`Bearer ${$e??""}`},i;if(s instanceof FormData)i=s;else if(s!==void 0)o["content-type"]="application/json",i=JSON.stringify(s);let a;try{a=await fetch(n,{method:e,headers:o,body:i})}catch{throw new se({reason:"tapster setup is not answering",fix:"Check that tapster setup still runs in your terminal. If it stopped, start it again with bunx @doguyilmaz/tapster setup."},0)}let r=await a.json().catch(()=>null);if(a.status===401)$e=null,Ct.set(null),Tn();if(!a.ok||r===null)throw new se(r?.error??{reason:`tapster setup answered ${a.status}`,fix:"Reload the page and try again."},a.status);return r}var Z=(e)=>Nn("GET",e),A=(e,n)=>Nn("POST",e,n??{});var $n="tapster.hub",Tt=(e)=>{try{return localStorage.getItem(e)}catch{return null}},nt=(e,n)=>{try{if(n===null)localStorage.removeItem(e);else localStorage.setItem(e,n)}catch{return}},In=Tt,he=E(location.pathname),Me=E(null),oe=E(null),Ie=E(null),At=E(null),V=E(Tt($n)),le=E(null),tt=E(!1),_e=E(null),ye=E(null);function ce(e,n=!1){if(n)history.replaceState(null,"",e);else history.pushState(null,"",e);he.value=location.pathname,window.scrollTo({top:0})}addEventListener("popstate",()=>{he.value=location.pathname});function Y(e,n){ye.value={tone:e,text:n},setTimeout(()=>{if(ye.value?.text===n)ye.value=null},5000)}var R=(e)=>e instanceof se?e.problem:{reason:"something went wrong",fix:"Reload the page and try again."};async function st(){try{oe.value=await Z("/api/account"),Ie.value=null}catch(e){Ie.value=R(e)}}async function En(){let e=await Z("/api/hubs");At.value=e.hubs}function ot(e){if(e!==V.value)Q.value=null;if(V.value=e,nt($n,e),le.value=null,_e.value=null,e)W()}async function W(){let e=V.value;if(!e)return;tt.value=!0;try{let n=await Z(`/api/hub?hub=${encodeURIComponent(e)}`);if(V.value===e)le.value=n,_e.value=null}catch(n){if(V.value===e)_e.value=R(n)}finally{tt.value=!1}}var Mn=(e)=>`tapster.mac.${e}`,Ee=E({});function Dn(e){return Ee.value[e]??(Tt(Mn(e))||null)}function Ht(e,n){nt(Mn(e),n),Ee.value={...Ee.value,[e]:n}}var De=E(null),Q=E(null);function at(e){let n=Me.value?.home;if(!n)return e;return e===n?"~":e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}var bs=0;function t(e,n,s,o,i,a){n||(n={});var r,c,p=n;if("ref"in p)for(c in p={},n)c=="ref"?r=n[c]:p[c]=n[c];var u={type:e,props:p,key:s,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--bs,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(r=e.defaultProps))for(c in r)p[c]===void 0&&(p[c]=r[c]);return S.vnode&&S.vnode(u),u}var ys={check:t("path",{d:"M20 6 9 17l-5-5"},void 0,!1,void 0,this),x:t("path",{d:"M18 6 6 18M6 6l12 12"},void 0,!1,void 0,this),alert:t("path",{d:"M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"},void 0,!1,void 0,this),info:t(C,{children:[t("circle",{cx:"12",cy:"12",r:"10"},void 0,!1,void 0,this),t("path",{d:"M12 16v-4M12 8h.01"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),lock:t(C,{children:[t("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2"},void 0,!1,void 0,this),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),copy:t(C,{children:[t("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"},void 0,!1,void 0,this),t("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),external:t("path",{d:"M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"},void 0,!1,void 0,this),file:t("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6"},void 0,!1,void 0,this),folder:t("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9L9.6 3.9A2 2 0 0 0 7.9 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z"},void 0,!1,void 0,this),refresh:t("path",{d:"M21 12a9 9 0 1 1-3-6.7L21 8M21 3v5h-5"},void 0,!1,void 0,this),loader:t("path",{d:"M21 12a9 9 0 1 1-6.2-8.6"},void 0,!1,void 0,this),down:t("path",{d:"m6 9 6 6 6-6"},void 0,!1,void 0,this),right:t("path",{d:"m9 18 6-6-6-6"},void 0,!1,void 0,this),arrow:t("path",{d:"M5 12h14M12 5l7 7-7 7"},void 0,!1,void 0,this),eye:t(C,{children:[t("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"},void 0,!1,void 0,this),t("circle",{cx:"12",cy:"12",r:"3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),play:t("path",{d:"M7 4v16l13-8z"},void 0,!1,void 0,this),shield:t("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"},void 0,!1,void 0,this),pr:t(C,{children:[t("circle",{cx:"18",cy:"18",r:"3"},void 0,!1,void 0,this),t("circle",{cx:"6",cy:"6",r:"3"},void 0,!1,void 0,this),t("path",{d:"M13 6h3a2 2 0 0 1 2 2v7M6 9v12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),package:t("path",{d:"M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4a2 2 0 0 0 1-1.7zM3.3 7 12 12l8.7-5M12 22V12"},void 0,!1,void 0,this),upload:t("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12"},void 0,!1,void 0,this),key:t(C,{children:[t("circle",{cx:"7.5",cy:"15.5",r:"5.5"},void 0,!1,void 0,this),t("path",{d:"m21 2-9.6 9.6M15.5 7.5l3 3L22 7l-3-3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),power:t("path",{d:"M18.4 6.6a9 9 0 1 1-12.8 0M12 2v10"},void 0,!1,void 0,this),plus:t("path",{d:"M12 5v14M5 12h14"},void 0,!1,void 0,this),circle:t("circle",{cx:"12",cy:"12",r:"9"},void 0,!1,void 0,this),git:t(C,{children:[t("circle",{cx:"12",cy:"12",r:"3"},void 0,!1,void 0,this),t("path",{d:"M12 3v6M12 15v6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};function v({name:e,spin:n,label:s}){return t("svg",{class:`icon${n?" spin":""}`,viewBox:"0 0 24 24","aria-hidden":s?void 0:"true",role:s?"img":void 0,"aria-label":s,children:ys[e]},void 0,!1,void 0,this)}function j({label:e="Working"}){return t(v,{name:"loader",spin:!0,label:e},void 0,!1,void 0,this)}var _s={keys:"lock",ok:"check",warn:"alert",error:"alert",info:"info"};function x({tone:e="info",title:n,children:s}){return t("div",{class:`note ${e}`,role:e==="error"?"alert":void 0,children:[t(v,{name:_s[e]},void 0,!1,void 0,this),t("div",{children:[n&&t("strong",{children:n},void 0,!1,void 0,this),s]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function N({problem:e}){if(!e)return null;let n=e.reason.charAt(0).toUpperCase()+e.reason.slice(1);return t(x,{tone:"error",title:`${n}.`,children:t("span",{children:e.fix},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function F({tone:e,children:n}){return t("span",{class:`badge${e?` ${e}`:""}`,children:n},void 0,!1,void 0,this)}function Pt({text:e,label:n="Copy"}){let[s,o]=m(!1);return t("button",{type:"button",class:"btn secondary small",onClick:async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),1600)}catch{o(!1)}},children:[t(v,{name:s?"check":"copy"},void 0,!1,void 0,this),s?"Copied":n]},void 0,!0,void 0,this)}function z({text:e}){return t("div",{class:"cmd",children:[t("code",{children:e},void 0,!1,void 0,this),t(Pt,{text:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function q({href:e,children:n,class:s="btn secondary"}){return t("a",{class:s,href:e,target:"_blank",rel:"noopener noreferrer",children:[n,t(v,{name:"external"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Nt(e){let[n,s]=m(!1),o=(i)=>e.onFile(i&&i[0]?i[0]:null);return t("div",{class:"field",children:[t("span",{class:"label",id:`${e.name}-label`,children:e.label},void 0,!1,void 0,this),t("label",{class:`drop${n?" over":""}${e.file?" has":""}`,onDragOver:(i)=>{i.preventDefault(),s(!0)},onDragLeave:()=>s(!1),onDrop:(i)=>{i.preventDefault(),s(!1),o(i.dataTransfer?.files??null)},children:[t("input",{type:"file",name:e.name,accept:e.accept,"aria-labelledby":`${e.name}-label`,onChange:(i)=>o(i.currentTarget.files)},void 0,!1,void 0,this),t(v,{name:e.file?"check":"upload"},void 0,!1,void 0,this),t("span",{children:e.file?t(C,{children:[t("strong",{class:"mono",children:e.file.name},void 0,!1,void 0,this),t("span",{class:"muted small",children:[" (",Math.max(1,Math.round(e.file.size/1024))," KB). Drop or choose another file to replace it."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):t(C,{children:[t("strong",{children:"Drop the file here"},void 0,!1,void 0,this)," ",t("span",{class:"muted",children:"or click to choose it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("span",{class:"hint",children:e.hint},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function $t({name:e,label:n,hint:s,autoComplete:o="current-password"}){let[i,a]=m(!1);return t("div",{class:"field",children:[t("label",{for:e,children:n},void 0,!1,void 0,this),t("div",{class:"with-toggle",children:[t("input",{class:"input",id:e,name:e,type:i?"text":"password",autoComplete:o,spellcheck:!1,autoCapitalize:"off",autoCorrect:"off"},void 0,!1,void 0,this),t("button",{type:"button",class:"btn quiet small",onClick:()=>a(!i),"aria-pressed":i,children:i?"Hide":"Show"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s&&t("span",{class:"hint",children:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ge({name:e,label:n,hint:s,value:o,placeholder:i,mono:a,autoComplete:r="off",onInput:c}){return t("div",{class:"field",children:[t("label",{for:e,children:n},void 0,!1,void 0,this),t("input",{class:`input${a?" mono":""}`,id:e,name:e,value:o,placeholder:i,autoComplete:r,spellcheck:!1,autoCapitalize:"off",autoCorrect:"off",onInput:c?(p)=>c(p.currentTarget.value):void 0},void 0,!1,void 0,this),s&&t("span",{class:"hint",children:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function L({busy:e,children:n,...s}){return t("button",{...s,disabled:e||s.disabled,"aria-busy":e,children:[e&&t(j,{},void 0,!1,void 0,this),n]},void 0,!0,void 0,this)}function It({text:e}){return t("div",{class:"gate",children:t("div",{class:"row muted",role:"status",children:[t(j,{},void 0,!1,void 0,this),t("span",{children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function we({title:e,children:n}){return t(C,{children:[t("div",{class:"stripe"},void 0,!1,void 0,this),t("div",{class:"gate",children:t("div",{class:"card",children:[t("img",{class:"mascot",src:"/logo.webp",alt:"",width:"112",height:"112"},void 0,!1,void 0,this),t("h1",{class:"title",children:e},void 0,!1,void 0,this),n]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function On({problem:e}){return t(we,{title:e?"This link did not open tapster setup":"Open tapster setup from your terminal",children:[e&&t(N,{problem:e},void 0,!1,void 0,this),t("p",{class:"lead",children:"Each link from the terminal works once, so a copy of it in your history or someone else\'s hands is worthless. To get a fresh one, press Enter in the terminal where tapster setup runs."},void 0,!1,void 0,this),t("p",{class:"muted",children:"If tapster setup is not running, start it again:"},void 0,!1,void 0,this),t(z,{text:"bunx @doguyilmaz/tapster setup"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rn(){return t(we,{title:"tapster setup stopped",children:[t("p",{class:"lead",children:"Everything you did is stored on GitHub. To continue later, start it again; it picks up where you left off."},void 0,!1,void 0,this),t(z,{text:"bunx @doguyilmaz/tapster setup"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Vn(){let e=oe.value;U(()=>{let o=3000,i=0,a=async()=>{if(!document.hidden)await st();o=Math.min(o*1.4,15000),i=window.setTimeout(a,o)};return i=window.setTimeout(a,o),()=>clearTimeout(i)},[]);let n=t("p",{class:"row muted small",children:[t(j,{},void 0,!1,void 0,this)," tapster checks again by itself every few seconds."]},void 0,!0,void 0,this);if(Ie.value)return t(we,{title:"tapster could not reach GitHub",children:[t(N,{problem:Ie.value},void 0,!1,void 0,this),n]},void 0,!0,void 0,this);if(e?.state==="no-gh")return t(we,{title:"Install the GitHub CLI",children:[t("p",{class:"lead",children:"tapster talks to GitHub through the GitHub CLI, so your sign-in stays with it and tapster never sees a password."},void 0,!1,void 0,this),t(z,{text:"brew install gh"},void 0,!1,void 0,this),t("p",{class:"muted small",children:["Not on a Mac? See ",t("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",children:"cli.github.com"},void 0,!1,void 0,this),". Then sign in:"]},void 0,!0,void 0,this),t(z,{text:"gh auth login"},void 0,!1,void 0,this),n]},void 0,!0,void 0,this);if(e?.state==="signed-out")return t(we,{title:"Sign in to GitHub",children:[t("p",{class:"lead",children:"Run this in a terminal and follow its steps. tapster uses that sign-in to set up your hub; it never sees your password."},void 0,!1,void 0,this),t(z,{text:"gh auth login"},void 0,!1,void 0,this),n]},void 0,!0,void 0,this);let s=e?.state==="ok"?e.missing:[];return t(we,{title:"Allow gh to change workflows",children:[t("p",{class:"lead",children:["Your GitHub CLI sign-in lacks ",s.join(" and "),". tapster needs it to write the hub\'s workflow file."]},void 0,!0,void 0,this),t(z,{text:`gh auth refresh -s ${s.join(",")}`},void 0,!1,void 0,this),t(x,{tone:"keys",children:t("span",{children:"The sign-in stays in the GitHub CLI on this computer. tapster asks it for a token each time and keeps nothing."},void 0,!1,void 0,this)},void 0,!1,void 0,this),n]},void 0,!0,void 0,this)}var jn=(e)=>{let n=new Date(e),s=Math.round((Date.now()-n.getTime())/60000);if(s<1)return"just now";if(s<60)return`${s} min ago`;if(s<2880)return`${Math.round(s/60)} h ago`;return n.toLocaleDateString()},gs=new Set(["the tapster environment exists","only main may open the tapster environment","main cannot be deleted or force-pushed, by anyone","the hub runs only GitHub\'s and tapster\'s actions, pinned by commit","the default workflow token is read-only"]),ws=new Set(["the hub workflow exists","the hub workflow is tapster\'s template","the hub workflow runs only on schedule and manual dispatch","tapster.yml is valid"]);function ks({name:e,fix:n,hub:s,onFixed:o}){let[i,a]=m(!1),[r,c]=m(null);if(gs.has(e))return t("span",{class:"stack tight",children:[t("span",{class:"row",children:t(L,{busy:i,class:"btn secondary small",onClick:async()=>{a(!0),c(null);try{await A("/api/hub/protect",{hub:s}),await W(),o()}catch(u){c(R(u))}finally{a(!1)}},children:[t(v,{name:"shield"},void 0,!1,void 0,this),"Restore the protection"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t(N,{problem:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let p=ws.has(e)&&!(e==="tapster.yml is valid"&&n!=="Run tapster init.")?"files":e==="the credentials this hub needs are stored"?null:void 0;if(p===void 0)return null;return t("span",{class:"row",children:t("button",{type:"button",class:"btn secondary small",onClick:()=>{De.value=p,ce("/setup")},children:["Fix it in Setup",t(v,{name:"arrow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Et=(e)=>e.charAt(0).toUpperCase()+e.slice(1),xs={success:{tone:"ok",text:"Done"},failure:{tone:"error",text:"Failed"},cancelled:{text:"Cancelled"},skipped:{text:"Skipped"}};function Fn(){let e=le.value,[n,s]=m(null),[o,i]=m(null),[a,r]=m(!1),[c,p]=m(!1),u=async()=>{if(!e)return;r(!0),i(null);try{s(await Z(`/api/hub/health?hub=${encodeURIComponent(e.name)}`))}catch(d){i(R(d))}finally{r(!1)}};if(U(()=>{u()},[e?.name]),!e)return null;let h=n?.checks.filter((d)=>!d.ok)??[],f=n?.checks.filter((d)=>d.ok)??[],l=async()=>{p(!0);try{await A("/api/hub/run",{hub:e.name}),Y("ok","The hub run started. It shows up below in a few seconds."),setTimeout(()=>void u(),4000)}catch(d){i(R(d))}finally{p(!1)}};return t("div",{class:"stack",style:"gap: 1.5rem; max-width: 900px",children:[t("div",{class:"spread",children:[t("div",{class:"stack tight",children:[t("p",{class:"eyebrow",children:"Health"},void 0,!1,void 0,this),t("h1",{class:"title",children:n?h.length?`${h.length} ${h.length===1?"thing needs":"things need"} you`:`${e.name} is healthy`:`Checking ${e.name}`},void 0,!1,void 0,this),t("p",{class:"lead",children:"The same checks as tapster doctor, run against the hub as it is on GitHub\'s main branch."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("div",{class:"row",children:[t("button",{type:"button",class:"btn secondary",onClick:()=>void u(),disabled:a,children:[t(v,{name:"refresh",spin:a},void 0,!1,void 0,this),"Check again"]},void 0,!0,void 0,this),t(L,{busy:c,class:"btn primary",onClick:l,children:[t(v,{name:"play"},void 0,!1,void 0,this),"Run the hub now"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t(N,{problem:o},void 0,!1,void 0,this),e.issue&&t(x,{tone:"warn",title:`The hub opened issue #${e.issue.number}: tapster: the hub needs attention`,children:[t("span",{children:["Updated ",jn(e.issue.updated),". It closes itself once everything is fine."]},void 0,!0,void 0,this),t("details",{children:[t("summary",{class:"small",children:"Show what it says"},void 0,!1,void 0,this),t("pre",{class:"block",style:"white-space: pre-wrap; margin-top: 0.5rem",children:e.issue.body.replace(/<!--[\\s\\S]*?-->/g,"").trim()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t(q,{href:e.issue.url,class:"btn secondary small",children:"Open the issue"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&!n&&t("p",{class:"row muted",role:"status",children:[t(j,{},void 0,!1,void 0,this)," Running the checks"]},void 0,!0,void 0,this),n&&t("div",{class:"card list",children:[...h,...f].map((d)=>t("div",{class:"item",style:"grid-template-columns: auto minmax(0, 1fr); align-items: start",children:[t("span",{class:d.ok?"ok":"bad",style:`color: var(--${d.ok?"green":"wax"}); padding-top: 0.15rem`,children:t(v,{name:d.ok?"check":"alert",label:d.ok?"ok":"needs a fix"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("div",{class:"stack tight",style:"gap: 0.2rem",children:[t("span",{style:"font-weight: 550",children:Et(d.name)},void 0,!1,void 0,this),!d.ok&&t("span",{class:"muted small",children:d.fix},void 0,!1,void 0,this),!d.ok&&t(ks,{name:d.name,fix:d.fix,hub:e.name,onFixed:()=>void u()},void 0,!1,void 0,this),d.note&&t("span",{class:"faint small",children:[Et(d.note),"."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},d.name,!0,void 0,this))},void 0,!1,void 0,this),n?.note&&t("p",{class:"muted small",children:[Et(n.note.replace(/^note: /,"")),"."]},void 0,!0,void 0,this),n&&t("section",{class:"stack tight",children:[t("h2",{class:"section-title",children:"Recent hub runs"},void 0,!1,void 0,this),n.runs.length?t("div",{class:"card list",children:n.runs.map((d)=>{let _=d.status==="completed"?xs[d.conclusion??""]??{text:d.conclusion??"Done"}:{tone:"warn",text:d.status==="queued"?"Queued":"Running"};return t("div",{class:"item",children:[t("span",{class:"stack tight",style:"gap: 0.1rem",children:[t("span",{children:d.event==="schedule"?"On schedule":d.event==="workflow_dispatch"?"Started by hand or the doorbell":d.event},void 0,!1,void 0,this),t("span",{class:"faint small",children:jn(d.created)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("span",{class:"row",children:[t(F,{tone:_.tone,children:_.text},void 0,!1,void 0,this),t(q,{href:d.url,class:"btn quiet small",children:"Log"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},d.id,!0,void 0,this)})},void 0,!1,void 0,this):t("p",{class:"muted",children:"No runs yet. The workflow starts once the hub files are on main."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ln({onChosen:e,onCancel:n}){let[s,o]=m(null),[i,a]=m("homebrew-tap"),[r,c]=m("public"),[p,u]=m(!1),h=oe.value?.state==="ok"?oe.value.login:"you";U(()=>{En().catch((g)=>o(R(g)))},[]);let f=At.value,l=Me.value?.here.hub??null,d=f?.some((g)=>g.name.toLowerCase()===`${h}/${i}`.toLowerCase())??!1,_=/^homebrew-[A-Za-z0-9._-]{1,80}$/.test(i),T=async(g)=>{g.preventDefault(),u(!0),o(null);try{let k=await A("/api/hubs",{name:i,private:r==="private"});e(k.hub)}catch(k){o(R(k))}finally{u(!1)}};return t("div",{class:"stack",style:"gap: 2rem; max-width: 860px",children:[t("div",{class:"hello",children:[t("div",{class:"stack tight",children:[t("h1",{class:"title",children:"Choose your hub"},void 0,!1,void 0,this),t("p",{class:"lead",children:["Your hub is your Homebrew tap: a repository whose name starts with ",t("code",{children:"homebrew-"},void 0,!1,void 0,this),". tapster turns it into the one place that signs, notarizes and publishes the releases of all your projects."]},void 0,!0,void 0,this),n&&t("p",{children:t("button",{type:"button",class:"btn quiet",onClick:n,children:"Keep the current hub"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("img",{src:"/courier.webp",alt:"The tapster octopus courier with sealed parcels",width:"220",height:"220"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t(N,{problem:s},void 0,!1,void 0,this),t("section",{class:"stack tight","aria-labelledby":"yours",children:[t("h2",{id:"yours",class:"section-title",children:"Your taps"},void 0,!1,void 0,this),f===null&&!s&&t("p",{class:"row muted",children:[t(j,{},void 0,!1,void 0,this)," Looking for repositories named homebrew-\u2026 on your account"]},void 0,!0,void 0,this),f?.length===0&&t("p",{class:"muted",children:"You have no repository named homebrew-\u2026 yet. Create one below."},void 0,!1,void 0,this),t("div",{class:"choices",children:f?.map((g)=>t("button",{type:"button",class:"choice",onClick:()=>e(g.name),children:[t(v,{name:"package"},void 0,!1,void 0,this),t("span",{class:"grow",children:[t("span",{class:"mono",children:g.name},void 0,!1,void 0,this),t("span",{class:"muted small",children:g.tapster?"Already a tapster hub":"A tap without tapster yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g.name===l&&t(F,{tone:"next",children:"This folder"},void 0,!1,void 0,this),t(F,{tone:g.private?"warn":void 0,children:g.private?"Private":"Public"},void 0,!1,void 0,this),t(v,{name:"right"},void 0,!1,void 0,this)]},g.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("section",{class:"card pad stack","aria-labelledby":"new",children:[t("h2",{id:"new",class:"section-title",children:"Or create a new tap"},void 0,!1,void 0,this),t("form",{class:"stack",onSubmit:T,children:[t("div",{class:"field",children:[t("label",{for:"tap-name",children:"Repository name"},void 0,!1,void 0,this),t("div",{class:"row",style:"flex-wrap: nowrap",children:[t("span",{class:"mono muted",children:[h,"/"]},void 0,!0,void 0,this),t("input",{class:"input mono",id:"tap-name",value:i,onInput:(g)=>a(g.currentTarget.value.trim()),spellcheck:!1,autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("span",{class:"hint",children:["Users install with ",t("code",{children:["brew install ",h,"/",i.replace(/^homebrew-/,"")||"tap","/<name>"]},void 0,!0,void 0,this),"."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("fieldset",{class:"stack tight",style:"border: 0; padding: 0; margin: 0",children:[t("legend",{class:"label",style:"font-weight: 600; font-size: 0.92rem; margin-bottom: 0.4rem",children:"Visibility"},void 0,!1,void 0,this),t("label",{class:"switch",children:[t("input",{type:"radio",name:"visibility",checked:r==="public",onChange:()=>c("public")},void 0,!1,void 0,this),t("span",{children:[t("strong",{children:"Public (recommended)"},void 0,!1,void 0,this),t("span",{children:"GitHub gives public repositories free macOS runners, which signing needs. It also gives them the protected environment that holds your keys."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("label",{class:"switch",children:[t("input",{type:"radio",name:"visibility",checked:r==="private",onChange:()=>c("private")},void 0,!1,void 0,this),t("span",{children:[t("strong",{children:"Private"},void 0,!1,void 0,this),t("span",{children:"Needs GitHub Pro for the protected environment. Every run uses your plan\'s Actions minutes. Users can only install from public projects."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d&&t(x,{tone:"warn",children:"You already have this repository. Pick it from the list above."},void 0,!1,void 0,this),t("div",{class:"row",children:[t(L,{busy:p,class:"btn primary",type:"submit",disabled:!_||d,children:["Create ",h,"/",i]},void 0,!0,void 0,this),!_&&t("span",{class:"muted small",children:"The name must start with homebrew-."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Mt(e,n=Date.now()){let s=Date.parse(`${e}T00:00:00Z`);return!Number.isNaN(s)&&s-n<2592000000}function Dt(e,n){if(e.apple.needed)return!0;return n===null?null:n==="yes"}function Bn(e,n,s=Date.now()){let o=Dt(e,n),i=e.protect.checks.filter((c)=>c.ok).length,a=[{id:"protect",name:"Protect the hub",done:e.protect.done,status:e.protect.done?"All protections are on":i?`${i} of ${e.protect.checks.length} protections on`:"Not protected yet",open:"Not protected yet"},{id:"app",name:"Create the GitHub App",done:Boolean(e.app.id&&e.app.slug&&e.app.key),attention:Boolean(e.app.id&&!e.app.key),status:e.app.id&&!e.app.key?"The App\'s private key is missing":e.app.slug?e.app.slug:"Not created yet",open:"Not created yet"},{id:"macos",name:"macOS or not",done:o===!0,skipped:o===!1,status:o===!0?"Signs macOS software":o===!1?"No macOS builds":"Your answer",open:"Your answer"},{id:"certificate",name:"Apple certificate",done:Boolean(e.apple.certificate&&e.apple.certificateStored),skipped:o===!1,attention:Boolean(e.apple.certificate&&Mt(e.apple.certificate.expires,s)),status:o===!1?"Not needed":e.apple.certificate?`Team ${e.apple.certificate.team}, expires ${e.apple.certificate.expires}`:"Not stored yet",open:"Not stored yet"},{id:"notary",name:"Notarization key",done:e.apple.notary,skipped:o===!1,status:o===!1?"Not needed":e.apple.notary?"Stored":"Not stored yet",open:"Not stored yet"},{id:"files",name:"Hub files",done:e.files.config&&e.files.state&&e.files.workflow!=="missing",attention:e.files.workflow==="older"||e.files.workflow==="other",status:e.files.workflow==="missing"?"Not written yet":e.files.workflow==="older"?`Runs ${e.files.pinned}; update available`:e.files.workflow==="other"?`Runs ${e.files.pinned??"a workflow tapster did not write"}; review it`:e.files.workflow==="newer"?`Runs ${e.files.pinned}, newer than this tapster`:`Runs ${e.files.pinned}`,open:"Not written yet"},{id:"project",name:"Your projects",done:e.packages.length>0,status:e.packages.length?`${e.packages.length} in the hub`:"None yet",open:"None yet"}],r=!1;return a.map((c)=>{let p;if(c.skipped)p="skipped";else if(c.attention)p="attention";else if(c.done)p="done";else if(!r)p="now",r=!0;else p="later";return{id:c.id,name:c.name,state:p,status:c.status}})}var Gn=(e)=>(e.find((n)=>n.state==="now"||n.state==="attention")??e[e.length-1]).id;function it(e,n){let s=e.split(`\n`),o=n.split(`\n`),i=s.length,a=o.length;if(i*a>4000000)return[...s.map((h)=>({kind:"del",text:h})),...o.map((h)=>({kind:"add",text:h}))];let r=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let h=i-1;h>=0;h--)for(let f=a-1;f>=0;f--)r[h][f]=s[h]===o[f]?r[h+1][f+1]+1:Math.max(r[h+1][f],r[h][f+1]);let c=[],p=0,u=0;while(p<i&&u<a)if(s[p]===o[u])c.push({kind:"ctx",text:s[p]}),p++,u++;else if(r[p+1][u]>=r[p][u+1])c.push({kind:"del",text:s[p++]});else c.push({kind:"add",text:o[u++]});while(p<i)c.push({kind:"del",text:s[p++]});while(u<a)c.push({kind:"add",text:o[u++]});return c}function rt(e,n=3){let s=e.map((a,r)=>a.kind!=="ctx"||e.slice(Math.max(0,r-n),r+n+1).some((c)=>c.kind!=="ctx")),o=[],i=0;if(e.forEach((a,r)=>{if(s[r]){if(i)o.push({kind:"gap",text:`${i} unchanged lines`});i=0,o.push(a)}else i++}),i)o.push({kind:"gap",text:`${i} unchanged lines`});return o}var Ss=(e)=>{let n=Math.min(...e.filter((s)=>s.trim()).map((s)=>/^ */.exec(s)[0].length));return e.map((s)=>s.slice(n)).join(`\n`).trimEnd()};function Un(e){let n=[];for(let s of e){let[o="",...i]=s.split(`\n`),a=o.trim().replace(/^- /,"");if(!a||/^proposed the hub entry in |^open this page and choose Install/.test(a))continue;let r=n.at(-1),c;if(o.startsWith(" ")&&r&&r.block===null)c=r,c.text+=`${/[.:;!?]$/.test(c.text)?"":"."} ${a}`;else c={text:/^[a-z]+[._]/.test(a)?a:a.charAt(0).toUpperCase()+a.slice(1),block:null},n.push(c);let p=0;while(p<i.length&&!c.text.endsWith(":"))c.text+=` ${i[p++].trim()}`;if(p<i.length)c.block=Ss(i.slice(p))}return n}var Wn="tapster.roots",zn={go:"Go with GoReleaser",bun:"Bun",app:"Mac app with Sparkle"};function Cs(){try{let e=JSON.parse(In(Wn)??"[]");return Array.isArray(e)?e.filter((n)=>typeof n==="string").slice(0,10):[]}catch{return[]}}function Ot({p:e,onOpen:n}){return t("div",{class:"item",children:[t("button",{type:"button",class:"link",onClick:()=>n(e),disabled:!e.kind,children:[t("span",{class:"name",children:e.repo},void 0,!1,void 0,this),t("span",{class:"path",children:at(e.path)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("span",{class:"row",children:[e.kind?t(F,{children:zn[e.kind]},void 0,!1,void 0,this):t("span",{class:"muted small",children:e.why},void 0,!1,void 0,this),e.inHub?t(F,{tone:"ok",children:"In the hub"},void 0,!1,void 0,this):e.proposed?t(q,{href:e.proposed,class:"btn secondary small",children:"Merge the entry"},void 0,!1,void 0,this):e.kind?t("button",{type:"button",class:"btn secondary small",onClick:()=>n(e),children:["Add",t(v,{name:"arrow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function qn(){let e=le.value,[n,s]=m(null),[o,i]=m(null),[a,r]=m(Cs()),[c,p]=m(""),[u,h]=m(!1),[f,l]=m(null),[d,_]=m(!1),T=async(w=a)=>{if(!e)return;_(!0),i(null);try{s(await A("/api/projects/scan",{hub:e.name,extra:w}))}catch(B){i(R(B))}finally{_(!1)}};if(U(()=>{T()},[e?.name]),!e)return null;let g=(w)=>{w.preventDefault();let B=c.trim().replace(/^[\'"]|[\'"]$/g,"");if(!B)return;let ee=[B,...a.filter((ae)=>ae!==B)].slice(0,10);r(ee),nt(Wn,JSON.stringify(ee)),p(""),T(ee)},k=n?.projects??[],y=k.filter((w)=>w.kind&&!w.inHub),H=k.filter((w)=>w.inHub),b=k.filter((w)=>!w.kind&&!w.inHub);return t("div",{class:"stack",style:"gap: 1.5rem",children:[t("div",{class:"spread",children:[t("div",{class:"stack tight",children:[t("p",{class:"eyebrow",children:"Projects on this computer"},void 0,!1,void 0,this),t("h1",{class:"title",children:["Add your projects to ",e.name]},void 0,!0,void 0,this),t("p",{class:"lead",children:["tapster looks for clones of your own repositories here. It reads each clone\'s ",t("code",{children:".git/config"},void 0,!1,void 0,this)," and checks which build files exist. Nothing leaves this computer."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("button",{type:"button",class:"btn secondary",onClick:()=>void T(),disabled:d,children:[t(v,{name:"refresh",spin:d},void 0,!1,void 0,this),"Look again"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("form",{class:"row",onSubmit:g,style:"flex-wrap: nowrap",children:[t("label",{class:"sr",for:"folder",children:"A folder to look in"},void 0,!1,void 0,this),t("input",{id:"folder",class:"input mono",placeholder:"A folder, such as /Users/you/Documents/code",value:c,onInput:(w)=>p(w.currentTarget.value),spellcheck:!1,autoComplete:"off"},void 0,!1,void 0,this),t("button",{class:"btn secondary",type:"submit",children:[t(v,{name:"folder"},void 0,!1,void 0,this),"Look there too"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t(N,{problem:o},void 0,!1,void 0,this),d&&!n&&t("p",{class:"row muted",role:"status",children:[t(j,{},void 0,!1,void 0,this)," Looking through your folders"]},void 0,!0,void 0,this),n&&t(C,{children:[t("section",{class:"stack tight","aria-labelledby":"ready",children:[t("h2",{id:"ready",class:"section-title",children:["Ready to add (",y.length,")"]},void 0,!0,void 0,this),y.length?t("div",{class:"card list",children:y.map((w)=>t(Ot,{p:w,onOpen:l},w.path,!1,void 0,this))},void 0,!1,void 0,this):t("p",{class:"muted",children:[k.length?"Every supported clone here is in the hub already.":"No clone of your repositories turned up."," If a project lives elsewhere, add its folder above."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.length>0&&t("section",{class:"stack tight","aria-labelledby":"in-hub",children:[t("h2",{id:"in-hub",class:"section-title",children:["In the hub (",H.length,")"]},void 0,!0,void 0,this),t("div",{class:"card list",children:H.map((w)=>t(Ot,{p:w,onOpen:l},w.path,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b.length>0&&t("section",{class:"stack tight",children:[t("button",{type:"button",class:"btn quiet",onClick:()=>h(!u),"aria-expanded":u,style:"justify-self: start",children:[t(v,{name:u?"down":"right"},void 0,!1,void 0,this),b.length," other ",b.length===1?"clone":"clones"," tapster cannot publish yet"]},void 0,!0,void 0,this),u&&t("div",{class:"card list",children:b.map((w)=>t(Ot,{p:w,onOpen:l},w.path,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("p",{class:"faint small",children:["Looked in ",n.roots.map(at).join(", "),n.truncated?"; it stopped early because there were many folders":"",". ",n.others?`${n.others} ${n.others===1?"clone belongs":"clones belong"} to other owners and ${n.others===1?"is":"are"} not listed.`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),f&&t(As,{p:f,hubName:e.name,onClose:()=>l(null),onAdded:()=>void T()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rt({checked:e,onChange:n,title:s,children:o}){return t("label",{class:"switch",children:[t("input",{type:"checkbox",checked:e,onChange:(i)=>n(i.currentTarget.checked)},void 0,!1,void 0,this),t("span",{children:[t("strong",{children:s},void 0,!1,void 0,this),t("span",{children:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ts({view:e}){return t("div",{class:"stack tight files",children:e.files.map((n)=>{let s=n.before===null?null:rt(it(n.before,n.after??""));return t("details",{class:"file",open:!0,children:[t("summary",{children:[t(v,{name:"file"},void 0,!1,void 0,this),t("code",{children:n.path},void 0,!1,void 0,this),t(F,{tone:n.before===null?"next":n.after===null?"error":"warn",children:n.before===null?"New":n.after===null?"Removed":"Changed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("pre",{class:"block diff",children:s?s.map((o,i)=>t("span",{class:o.kind==="gap"?"hunk":o.kind,children:[o.kind==="add"?"+ ":o.kind==="del"?"- ":o.kind==="gap"?"@ ":" ",o.text,`\n`]},i,!0,void 0,this)):n.after},void 0,!1,void 0,this)]},n.path,!0,void 0,this)})},void 0,!1,void 0,this)}function As({p:e,hubName:n,onClose:s,onAdded:o}){let i=Te(null);U(()=>{let D=document.activeElement;i.current?.querySelector("button")?.focus();let G=(ie)=>{if(ie.key!=="Tab"||!i.current)return;let ct=[...i.current.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), summary, [tabindex]:not([tabindex=\'-1\'])")],Oe=ct[0],ut=ct[ct.length-1];if(!Oe||!ut)return;if(!i.current.contains(document.activeElement))ie.preventDefault(),Oe.focus();else if(ie.shiftKey&&document.activeElement===Oe)ie.preventDefault(),ut.focus();else if(!ie.shiftKey&&document.activeElement===ut)ie.preventDefault(),Oe.focus()};return addEventListener("keydown",G),()=>{removeEventListener("keydown",G),D?.focus()}},[]);let[a,r]=m(null),[c,p]=m(null),[u,h]=m("release.yml"),[f,l]=m(!1),[d,_]=m(!1),[T,g]=m(!1),[k,y]=m(null),[H,b]=m(null),[w,B]=m(null),[ee,ae]=m(!1),[xe,K]=m(!1);U(()=>{A("/api/projects/inspect",{hub:n,path:e.path}).then((G)=>{if(r(G),_(G.dependabot),G.workflow)h(G.workflow)},(G)=>p(R(G)));let D=(G)=>G.key==="Escape"&&s();return addEventListener("keydown",D),()=>removeEventListener("keydown",D)},[e.path]);let X=async(D,G)=>{y(D),p(null);try{await G()}catch(ie){p(R(ie))}finally{y(null)}},Xn=()=>X("add",async()=>{let D=await A("/api/projects/add",{hub:n,path:e.path,options:{workflow:u,autoTag:f,dependabot:d,force:T}});b(D),B(await A("/api/projects/diff",{path:e.path,files:D.files})),o(),W()}),Lt=a?.dirty??[],Bt=a?.kind==="go"&&a.workflows.length===0;return t(C,{children:[t("div",{class:"sheet-back",onClick:s},void 0,!1,void 0,this),t("div",{class:"sheet",role:"dialog","aria-modal":"true","aria-labelledby":"sheet-title",ref:i,children:[t("div",{class:"sheet-head",children:[t("div",{class:"stack tight",style:"flex: 1; min-width: 0; gap: 0.1rem",children:[t("h2",{id:"sheet-title",class:"section-title mono",style:"font-size: 1.05rem; overflow-wrap: anywhere",children:e.repo},void 0,!1,void 0,this),t("span",{class:"faint small",style:"overflow-wrap: anywhere",children:at(e.path)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("button",{type:"button",class:"btn quiet small",onClick:s,"aria-label":"Close",children:t(v,{name:"x"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("div",{class:"sheet-body",children:[!a&&!c&&t("p",{class:"row muted",role:"status",children:[t(j,{},void 0,!1,void 0,this)," Reading the clone and its repository"]},void 0,!0,void 0,this),t(N,{problem:c},void 0,!1,void 0,this),a&&!H&&t(C,{children:[t("dl",{class:"facts",children:[t("dt",{children:"Kind"},void 0,!1,void 0,this),t("dd",{children:zn[a.kind]},void 0,!1,void 0,this),t("dt",{children:"Branch"},void 0,!1,void 0,this),t("dd",{class:"mono",children:a.branch},void 0,!1,void 0,this),t("dt",{children:"Repository"},void 0,!1,void 0,this),t("dd",{children:[a.private?"Private":"Public",", ",a.protected?"protected by tapster\'s rulesets":"not protected yet"]},void 0,!0,void 0,this),t("dt",{children:"Hub"},void 0,!1,void 0,this),t("dd",{children:a.inHub?"Already in the hub":a.proposed?"Proposed, waiting for you to merge":"Not in the hub yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a.proposed&&t(x,{tone:"info",title:"The hub entry is waiting for you",children:[t("span",{children:"Merge the pull request to let the hub publish this project."},void 0,!1,void 0,this),t(q,{href:a.proposed,class:"btn secondary small",children:"Review the pull request"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a.branch!==a.defaultBranch&&t(x,{tone:"warn",title:`This clone is on ${a.branch}, not ${a.defaultBranch}`,children:t("span",{children:["tapster changes the files on ",a.branch,". Releases use the workflow on ",a.defaultBranch,", so the change counts once it is merged there."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Lt.length>0&&t(x,{tone:"warn",title:"Uncommitted changes in files tapster edits",children:t("span",{children:[Lt.join(", "),". Commit or stash them first, so tapster\'s changes stay apart from yours."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),a.private&&t(x,{tone:"warn",title:"This repository is private",children:t("span",{children:"The hub can publish it, but Homebrew, Scoop, apt and dnf users can only install from public projects. Its rulesets need a paid plan; without them the hub refuses it unless you accept the risk with protection: off."},void 0,!1,void 0,this)},void 0,!1,void 0,this),!a.apple&&t(x,{tone:"info",title:"The hub has no Apple credentials",children:"tapster leaves the macOS builds out of this project\'s entry."},void 0,!1,void 0,this),t("div",{class:"stack tight",children:[t("h3",{class:"section-title",children:"Options"},void 0,!1,void 0,this),a.kind==="go"&&(Bt?t(x,{tone:"error",title:"No workflow runs GoReleaser",children:t("span",{children:"tapster edits the workflow that runs goreleaser/goreleaser-action. Add one to .github/workflows first."},void 0,!1,void 0,this)},void 0,!1,void 0,this):t("div",{class:"field",children:[t("label",{for:"workflow",children:"The workflow that runs GoReleaser"},void 0,!1,void 0,this),t("select",{id:"workflow",class:"input",value:u,onChange:(D)=>h(D.currentTarget.value),children:a.workflows.map((D)=>t("option",{value:D,children:[".github/workflows/",D]},D,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)),a.kind!=="go"&&a.releaseFlow==="other"&&t(Rt,{checked:T,onChange:g,title:"Replace the existing release workflow",children:".github/workflows/release.yml exists and tapster does not recognize it. Without this, tapster only adds the step that rings the hub, if the workflow opens a draft release."},void 0,!1,void 0,this),t(Rt,{checked:f,onChange:l,title:"Let the release workflow push tags",children:"For workflows that decide the version and tag by themselves. tapster adds a deploy key that only the default branch\'s release environment can use; the rulesets let deploy keys tag."},void 0,!1,void 0,this),t(Rt,{checked:d,onChange:_,title:"Keep Dependabot\'s pull requests",children:[a.dependabot?"This clone uses Dependabot. ":"","Branches named dependabot/... stay open to anything with write access, the hub\'s App included, so a stolen App key could run your workflows on its own code there."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("div",{class:"stack tight",children:[t("h3",{class:"section-title",children:"What tapster does"},void 0,!1,void 0,this),t("ul",{class:"checks",children:[t("li",{children:[t(v,{name:"right"},void 0,!1,void 0,this),t("span",{children:[a.kind==="go"?`Edits .goreleaser.yaml and .github/workflows/${u}: drafts instead of releases, an attestation step and the step that rings the hub.`:"Writes .github/workflows/release.yml: build, attest, open a draft and ring the hub."," You review and commit these in the next step."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("li",{children:[t(v,{name:"right"},void 0,!1,void 0,this),t("span",{children:["Protects ",a.repo,": only you can create, move or delete branches and tags."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("li",{children:[t(v,{name:"right"},void 0,!1,void 0,this),t("span",{children:["Proposes the project\'s entry to ",n," as a pull request."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),f&&t("li",{children:[t(v,{name:"right"},void 0,!1,void 0,this),t("span",{children:\'Adds the deploy key "tapster tags" and a release environment.\'},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("div",{class:"row",children:t(L,{busy:k==="add",class:"btn primary",onClick:Xn,disabled:Bt,children:a.inHub?"Update the project":`Add to ${n}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&t(C,{children:[t(x,{tone:"ok",title:`tapster prepared ${e.repo}`},void 0,!1,void 0,this),t("ul",{class:"checks small",children:Un(H.lines).map((D,G)=>t("li",{children:[t(v,{name:"right"},void 0,!1,void 0,this),t("span",{class:"stack tight",style:"min-width: 0",children:[t("span",{class:"muted",style:"overflow-wrap: anywhere",children:D.text},void 0,!1,void 0,this),D.block&&t("pre",{class:"block",children:D.block},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},G,!0,void 0,this))},void 0,!1,void 0,this),t("section",{class:"stack tight",children:[t("h3",{class:"section-title",children:"1. Review and commit the changes"},void 0,!1,void 0,this),w?t(Ts,{view:w},void 0,!1,void 0,this):t(j,{},void 0,!1,void 0,this),t("div",{class:"row",children:[ee?t(F,{tone:"ok",children:"Committed"},void 0,!1,void 0,this):t(L,{busy:k==="commit",class:"btn primary",onClick:()=>X("commit",async()=>{await A("/api/projects/commit",{path:e.path,files:H.files}),ae(!0)}),children:"Commit these files"},void 0,!1,void 0,this),ee&&(xe?t(F,{tone:"ok",children:"Pushed"},void 0,!1,void 0,this):t(L,{busy:k==="push",class:"btn primary",onClick:()=>X("push",async()=>{await A("/api/projects/push",{path:e.path}),K(!0),Y("ok",`Pushed ${e.repo}.`)}),children:"Push"},void 0,!1,void 0,this))]},void 0,!0,void 0,this),t("p",{class:"muted small",children:"tapster commits only these files, in your own git setup: your hooks and commit signing apply."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("section",{class:"stack tight",children:[t("h3",{class:"section-title",children:"2. Merge the hub entry"},void 0,!1,void 0,this),H.pr?t(C,{children:[t("p",{class:"muted",children:"GitHub shows you the exact change to the hub\'s tapster.yml. Merge it to start publishing."},void 0,!1,void 0,this),t("div",{class:"row",children:t(q,{href:H.pr,class:"btn secondary",children:[t(v,{name:"pr"},void 0,!1,void 0,this),"Review and merge on GitHub"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):t("p",{class:"muted",children:"No pull request this time; the notes above say why."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("section",{class:"stack tight",children:[t("h3",{class:"section-title",children:"3. Let the hub reach it"},void 0,!1,void 0,this),t("p",{class:"muted",children:["Unless the App already reaches ",e.repo,\', install it there. GitHub preselects the project; keep "Only select repositories".\']},void 0,!0,void 0,this),t("div",{class:"row",children:t(q,{href:H.installUrl,class:"btn secondary",children:["Install the App on ",e.repo.split("/")[1]]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("section",{class:"stack tight",children:[t("h3",{class:"section-title",children:"4. Release"},void 0,!1,void 0,this),t("p",{class:"muted",children:"Push a version tag. The project\'s workflow opens a draft; the hub signs and publishes it on its next run."},void 0,!1,void 0,this),t(z,{text:`git -C ${JSON.stringify(e.path)} tag v1.0.0 && git -C ${JSON.stringify(e.path)} push origin v1.0.0`},void 0,!1,void 0,this),t("p",{class:"faint small",children:"Use your next version instead of v1.0.0."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Hs({stop:e,index:n}){if(e.state==="done")return t("span",{class:"dot",children:t(v,{name:"check"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.state==="attention")return t("span",{class:"dot",children:t(v,{name:"alert"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.state==="skipped")return t("span",{class:"dot",children:"\u2013"},void 0,!1,void 0,this);return t("span",{class:"dot",children:n+1},void 0,!1,void 0,this)}function J({title:e,lead:n,children:s}){return t("div",{class:"panel-head",children:[t("div",{class:"spread",children:[t("h2",{class:"title",children:e},void 0,!1,void 0,this),s]},void 0,!0,void 0,this),t("p",{class:"lead",children:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Vt({text:e}){return t("div",{class:"row",children:[t("span",{class:"seal","aria-hidden":"true",children:t(v,{name:"check"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("strong",{children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function fe(){let[e,n]=m(!1),[s,o]=m(null);return[e,s,async(a)=>{n(!0),o(null);try{await a()}catch(r){o(R(r))}finally{n(!1)}}]}var Kn=[["A tapster environment that only main can open","Your keys go into it, so a workflow on another branch never sees them."],["main cannot be deleted or force-pushed","By anyone, you included, so the hub\'s history stays as you pushed it."],["Only GitHub\'s and tapster\'s actions, pinned by commit","No other code runs next to your keys."],["A read-only default token","Workflows get write access only where the template asks for it."]];function Ps({h:e}){let[n,s,o]=fe();return t("div",{class:"panel",children:[t(J,{title:"Protect the hub",lead:"These settings keep a stolen key or a stray workflow away from your signing keys. You can run this again at any time; it only restores what is missing."},void 0,!1,void 0,this),t("ul",{class:"checks",children:e.protect.checks.map((i,a)=>t("li",{children:[t("span",{class:i.ok?"ok":"no",children:t(v,{name:i.ok?"check":"circle",label:i.ok?"on":"off"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("span",{class:"stack tight",style:"gap: 0.1rem",children:[t("span",{children:Kn[a]?.[0]??i.label},void 0,!1,void 0,this),t("span",{class:"muted small",children:Kn[a]?.[1]},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},i.label,!0,void 0,this))},void 0,!1,void 0,this),e.protect.others.length>0&&t(x,{tone:"warn",title:"These workflows stop running once the hub is protected",children:[t("span",{children:"They use actions from others or actions not pinned by commit. The hub does not need them. Their commits would make the hub refuse to run. You can remove them in Hub files."},void 0,!1,void 0,this),t("ul",{class:"log",children:e.protect.others.map((i)=>t("li",{children:[t("code",{children:[".github/workflows/",i.file]},void 0,!0,void 0,this),": ",i.actions.slice(0,3).join(", ")]},i.file,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t(N,{problem:s},void 0,!1,void 0,this),e.protect.done?t(Vt,{text:`${e.name} is protected`},void 0,!1,void 0,this):t("div",{class:"row",children:t(L,{busy:n,class:"btn primary",onClick:()=>o(async()=>{await A("/api/hub/protect",{hub:e.name}),await W(),Y("ok",`${e.name} is protected.`)}),children:[t(v,{name:"shield"},void 0,!1,void 0,this),e.protect.checks.some((i)=>i.ok)?"Restore the protection":`Protect ${e.name}`]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ns({h:e,slug:n}){let[s,o]=m(e.app.installed);U(()=>{if(!e.app.installed)return;let a=0,r=4000,c=async()=>{if(!document.hidden)try{let p=await Z(`/api/hub/installation?hub=${encodeURIComponent(e.name)}`);o(p),r=p.id!==null&&!p.onHub?30000:4000}catch{r=Math.min(r*2,30000)}a=window.setTimeout(c,r)};return a=window.setTimeout(c,500),()=>clearTimeout(a)},[e.name,Boolean(e.app.installed)]);let i=`https://github.com/apps/${n}/installations/new`;return t("div",{class:"stack tight",children:[t("h3",{class:"section-title",children:"Install it on your projects"},void 0,!1,void 0,this),t("p",{class:"muted",children:["On GitHub, choose ",t("strong",{children:"Only select repositories"},void 0,!1,void 0,this)," and pick the projects the hub should publish. Never pick ",e.name,": the App can write to every repository it is installed on. The hub holds your signing keys. You can also install it per project later, from Projects."]},void 0,!0,void 0,this),s?.checked&&s.onHub&&t(x,{tone:"error",title:`The App is installed on ${e.name}`,children:[t("span",{children:["Remove ",e.name," from it; the hub refuses to run until you do."]},void 0,!0,void 0,this),t(q,{href:`https://github.com/settings/installations/${s.id}`,class:"btn secondary small",children:"Open the installation"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s?.checked&&!s.onHub&&s.id!==null&&t(x,{tone:"ok",title:"The App is installed",children:t("span",{children:s.repos.length?`It reaches ${s.repos.join(", ")}.`:"It reaches no repository yet."},void 0,!1,void 0,this)},void 0,!1,void 0,this),s?.checked&&s.id===null&&t("p",{class:"row muted small",children:[t(j,{},void 0,!1,void 0,this)," Not installed yet. This updates by itself once you click Install on GitHub."]},void 0,!0,void 0,this),!s&&t("p",{class:"muted small",children:"GitHub shows an App\'s repositories only to the App itself. Each hub run reports a project the App cannot reach."},void 0,!1,void 0,this),t("div",{class:"row",children:[t(q,{href:i,class:s?.id?"btn secondary":"btn primary",children:s?.id?"Change its repositories":"Install the App"},void 0,!1,void 0,this),t(q,{href:`https://github.com/settings/apps/${n}`,class:"btn quiet",children:"App settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $s({h:e,what:n,onGo:s}){return t("div",{class:"panel",children:[t(J,{title:n,lead:`This step stores a key in ${e.name}\'s tapster environment. Protect the hub first, so only workflows on main can open it.`},void 0,!1,void 0,this),t(x,{tone:"info",title:"Protect the hub first",children:t("span",{children:"Then come back here."},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("div",{class:"row",children:t("button",{type:"button",class:"btn primary",onClick:s,children:[t(v,{name:"shield"},void 0,!1,void 0,this),"Go to Protect the hub"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Yn({h:e}){let[n,s]=m(null),[o,i]=m(null),[a,r,c]=fe(),p=Q.value,u=Boolean(e.app.id&&e.app.slug&&e.app.key);if(U(()=>{if(u||e.app.id||e.app.held||p?.kind==="unstored")return;A("/api/hub/app",{hub:e.name}).then(s,(h)=>i(R(h)))},[e.name,u,p?.kind]),(p?.kind==="unstored"||e.app.held)&&!u)return t("div",{class:"panel",children:[t(J,{title:"Store the App\'s key",lead:"GitHub created the App and handed its key to this setup, but storing it in the hub failed. The key is still in memory here, so try again."},void 0,!1,void 0,this),p?.kind==="unstored"&&t(N,{problem:p.problem},void 0,!1,void 0,this),t(N,{problem:r},void 0,!1,void 0,this),t("div",{class:"row",children:t(L,{busy:a,class:"btn primary",onClick:()=>c(async()=>{await A("/api/hub/app/store",{hub:e.name}),await W(),Q.value={kind:"created"}}),children:"Store the key again"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("p",{class:"muted small",children:"If this setup stops first, the key is gone. Then delete the App at github.com/settings/apps and create it again here."},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.app.id&&!e.app.key)return t("div",{class:"panel",children:[t(J,{title:"The App\'s key is missing",lead:`The hub knows its App (${e.app.slug??e.app.id}), but its private key is not stored. Generate a new key on GitHub and store it from a clone of the hub:`},void 0,!1,void 0,this),t(z,{text:"bunx @doguyilmaz/tapster init --rotate app"},void 0,!1,void 0,this),t(q,{href:`https://github.com/settings/apps/${e.app.slug??""}`,children:"Open the App on GitHub"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(u)return t("div",{class:"panel",children:[t(J,{title:"The GitHub App",lead:"The hub uses this private App to write releases to the projects you install it on. It cannot touch anything else."},void 0,!1,void 0,this),p?.kind==="created"&&t(x,{tone:"ok",title:"GitHub created the App and tapster stored its key in the hub."},void 0,!1,void 0,this),t("dl",{class:"facts",children:[t("dt",{children:"App"},void 0,!1,void 0,this),t("dd",{class:"mono",children:e.app.slug},void 0,!1,void 0,this),t("dt",{children:"Key"},void 0,!1,void 0,this),t("dd",{children:["A secret of the tapster environment in ",e.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t(Ns,{h:e,slug:e.app.slug},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return t("div",{class:"panel",children:[t(J,{title:"Create the GitHub App",lead:`${e.name} needs a GitHub App to write releases to your projects. GitHub creates it on your account after you confirm.`},void 0,!1,void 0,this),p?.kind==="failed"&&t(N,{problem:p.problem},void 0,!1,void 0,this),p?.kind==="unknown"&&t(x,{tone:"warn",title:"That answer from GitHub did not belong to this setup",children:"Start the App again below; nothing was stored."},void 0,!1,void 0,this),n&&t("div",{class:"stack tight",children:[t("h3",{class:"section-title",children:"It asks for"},void 0,!1,void 0,this),t("ul",{class:"checks",children:n.permissions.map((h)=>t("li",{children:[t(v,{name:"right"},void 0,!1,void 0,this),t("span",{children:h},void 0,!1,void 0,this)]},h,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t(x,{tone:"keys",title:"Where its key goes",children:t("span",{children:["GitHub hands the App\'s private key to tapster on this computer, once. tapster stores it as a secret of the tapster environment in ",e.name,". It goes nowhere else."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t(N,{problem:o},void 0,!1,void 0,this),n?t("form",{method:"post",action:n.action,class:"stack tight",children:[t("input",{type:"hidden",name:"manifest",value:n.manifest},void 0,!1,void 0,this),t("div",{class:"row",children:t("button",{class:"btn primary",type:"submit",children:["Continue to GitHub",t(v,{name:"arrow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t("p",{class:"muted small",children:["GitHub shows the App ",t("code",{children:n.name},void 0,!1,void 0,this),". Click ",t("strong",{children:"Create GitHub App"},void 0,!1,void 0,this)," there and GitHub brings you back here."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):!o&&t("p",{class:"row muted",children:[t(j,{},void 0,!1,void 0,this)," Preparing the App"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Is({h:e,choice:n}){let s=Dt(e,n);return t("div",{class:"panel",children:[t(J,{title:"Will this hub sign macOS software?",lead:"Mac apps and command line tools with macOS builds must be signed and notarized by Apple. That needs an Apple Developer Program membership and two files from Apple."},void 0,!1,void 0,this),e.apple.needed?t(x,{tone:"ok",title:"Yes",children:t("span",{children:e.apple.certificate||e.apple.notary?"The hub already holds Apple credentials.":"tapster.yml lists packages with macOS code."},void 0,!1,void 0,this)},void 0,!1,void 0,this):t("div",{class:"choices",children:[t("button",{type:"button",class:"choice","aria-pressed":s===!0,onClick:()=>Ht(e.name,"yes"),children:[t(v,{name:s===!0?"check":"circle"},void 0,!1,void 0,this),t("span",{class:"grow",children:[t("strong",{children:"Yes, sign macOS software"},void 0,!1,void 0,this),t("span",{class:"muted small",children:"Next: your Developer ID certificate and a notarization key."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("button",{type:"button",class:"choice","aria-pressed":s===!1,onClick:()=>Ht(e.name,"no"),children:[t(v,{name:s===!1?"check":"circle"},void 0,!1,void 0,this),t("span",{class:"grow",children:[t("strong",{children:"No, only Linux and Windows"},void 0,!1,void 0,this),t("span",{class:"muted small",children:"The hub leaves macOS builds out. You can add Apple credentials later, here."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function jt(e){history.pushState(null,"",`/setup?saved=${encodeURIComponent(e)}`),setTimeout(()=>history.replaceState(null,"","/setup"),1500)}function Es({h:e}){let[n,s]=m(null),[o,i]=m(!1),[a,r,c]=fe(),p=e.apple.certificate,u=!p||!e.apple.certificateStored||o,h=(f)=>{f.preventDefault();let l=f.currentTarget;c(async()=>{if(!n)throw new se({reason:"no .p12 file is chosen",fix:"Drop the .p12 you exported from Keychain Access."},0);let d=new FormData(l);d.delete("username"),d.set("hub",e.name),d.set("p12",n);let _=await A("/api/hub/certificate",d);jt("certificate"),i(!1),s(null),await W(),Y("ok",`Certificate stored for team ${_.team}. It expires on ${_.expires}.`)})};return t("div",{class:"panel",children:[t(J,{title:"Apple certificate",lead:"A Developer ID Application certificate, exported with its private key as a .p12 file. The hub signs your macOS code with it."},void 0,!1,void 0,this),p&&e.apple.certificateStored&&t(C,{children:[t("dl",{class:"facts",children:[t("dt",{children:"Team"},void 0,!1,void 0,this),t("dd",{class:"mono",children:p.team},void 0,!1,void 0,this),t("dt",{children:"Expires"},void 0,!1,void 0,this),t("dd",{children:[p.expires," ",Mt(p.expires)&&t(F,{tone:"error",children:"Renew it soon"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!o&&t("div",{class:"row",children:[t("button",{type:"button",class:"btn secondary",onClick:()=>i(!0),children:"Replace the certificate"},void 0,!1,void 0,this),t("span",{class:"muted small",children:"For a renewal or a new team."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),u&&t(C,{children:[t("details",{class:"card pad",open:!p,children:[t("summary",{children:t("strong",{children:"How to get the .p12"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("ol",{class:"stack tight",style:"margin: 0.8rem 0 0; padding-left: 1.2rem",children:[t("li",{children:["No certificate yet? Create a ",t("strong",{children:"Developer ID Application"},void 0,!1,void 0,this)," certificate at"," ",t("a",{href:"https://developer.apple.com/account/resources/certificates",target:"_blank",rel:"noopener noreferrer",children:"developer.apple.com"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),t("li",{children:["In Keychain Access, open ",t("strong",{children:"My Certificates"},void 0,!1,void 0,this),", right-click ",t("strong",{children:"Developer ID Application: \u2026"},void 0,!1,void 0,this)," and choose ",t("strong",{children:"Export"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),t("li",{children:"Save it as .p12 with a password. Your password manager can make one."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("form",{class:"secret",onSubmit:h,autoComplete:"on",children:[t(ge,{name:"username",label:"Name in your password manager",value:`${e.name}: Developer ID certificate`,autoComplete:"username",hint:"Your password manager saves the .p12 password under this name, so it can fill it in next time."},void 0,!1,void 0,this),t(Nt,{name:"p12",accept:".p12,application/x-pkcs12",label:"The .p12 file",file:n,onFile:s,hint:"It stays in memory on this computer until tapster stores it in the hub."},void 0,!1,void 0,this),t($t,{name:"password",label:"Its password",hint:"The password you set when exporting it."},void 0,!1,void 0,this),t(x,{tone:"keys",title:"Where it goes",children:t("span",{children:["tapster opens the file with your password on this computer to check it is a Developer ID Application certificate that has not expired. Then the file and its password become secrets of the tapster environment in ",e.name,". Keep your own backup: GitHub never shows a secret again."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t(N,{problem:r},void 0,!1,void 0,this),t("div",{class:"row",children:[t(L,{busy:a,class:"btn primary",type:"submit",children:"Check and store"},void 0,!1,void 0,this),o&&t("button",{type:"button",class:"btn quiet",onClick:()=>i(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ms({h:e}){let[n,s]=m(null),[o,i]=m(!1),[a,r,c]=fe(),p=!e.apple.notary||o,u=(h)=>{h.preventDefault();let f=h.currentTarget;c(async()=>{if(!n)throw new se({reason:"no .p8 file is chosen",fix:"Drop the AuthKey_\u2026.p8 you downloaded from App Store Connect."},0);let l=new FormData(f);l.set("hub",e.name),l.set("p8",n);let d=await A("/api/hub/notary",l);jt("notary"),i(!1),s(null),await W(),Y("ok",d.checked?"Apple accepted the key and tapster stored it.":"Key stored. Apple checks it at the first release.")})};return t("div",{class:"panel",children:[t(J,{title:"Notarization key",lead:"An App Store Connect API key. The hub sends your signed code to Apple with it; Apple notarizes it."},void 0,!1,void 0,this),e.apple.notary&&!o&&t(C,{children:[t(Vt,{text:"The notarization key is stored"},void 0,!1,void 0,this),t("div",{class:"row",children:t("button",{type:"button",class:"btn secondary",onClick:()=>i(!0),children:"Replace the key"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p&&t(C,{children:[t("details",{class:"card pad",open:!e.apple.notary,children:[t("summary",{children:t("strong",{children:"How to get the key"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("ol",{class:"stack tight",style:"margin: 0.8rem 0 0; padding-left: 1.2rem",children:[t("li",{children:["In"," ",t("a",{href:"https://appstoreconnect.apple.com/access/integrations/api",target:"_blank",rel:"noopener noreferrer",children:"App Store Connect"},void 0,!1,void 0,this),", open ",t("strong",{children:"Users and Access"},void 0,!1,void 0,this),", ",t("strong",{children:"Integrations"},void 0,!1,void 0,this),", ",t("strong",{children:"App Store Connect API"},void 0,!1,void 0,this),", ",t("strong",{children:"Team Keys"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),t("li",{children:["Create a key with ",t("strong",{children:"Developer"},void 0,!1,void 0,this)," access and download ",t("code",{children:"AuthKey_\u2026.p8"},void 0,!1,void 0,this),". Apple offers the download once."]},void 0,!0,void 0,this),t("li",{children:"The Key ID is in the list; the Issuer ID is above it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("form",{class:"secret",onSubmit:u,autoComplete:"off",children:[t(Nt,{name:"p8",accept:".p8",label:"The .p8 file",file:n,onFile:s,hint:"It stays in memory on this computer until tapster stores it in the hub."},void 0,!1,void 0,this),t("div",{class:"grid2",children:[t(ge,{name:"keyId",label:"Key ID",mono:!0,placeholder:"ABCDE12345"},void 0,!1,void 0,this),t(ge,{name:"issuerId",label:"Issuer ID",mono:!0,placeholder:"00000000-0000-0000-0000-000000000000"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t(x,{tone:"keys",title:"Where it goes",children:t("span",{children:["On a Mac, tapster asks Apple whether the key works before storing it. The key and its two IDs become secrets of the tapster environment in ",e.name,"."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),t(N,{problem:r},void 0,!1,void 0,this),t("div",{class:"row",children:[t(L,{busy:a,class:"btn primary",type:"submit",children:"Check with Apple and store"},void 0,!1,void 0,this),o&&t("button",{type:"button",class:"btn quiet",onClick:()=>i(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Ds=[5,10,15,20,30,60,120,180,360];function Os({f:e}){let n=e.change==="create"?"next":e.change==="update"?"warn":e.change==="remove"?"error":void 0,s={create:"New",update:"Changes",same:"Unchanged",remove:"Removed"}[e.change],o=e.change==="update"&&e.before!==null?rt(it(e.before,e.content)):null;return t("details",{class:"file",children:[t("summary",{children:[t(v,{name:"file"},void 0,!1,void 0,this),t("code",{children:e.path},void 0,!1,void 0,this),t(F,{tone:n,children:s},void 0,!1,void 0,this),t(v,{name:"down"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("pre",{class:"block diff",children:o?o.map((i,a)=>t("span",{class:i.kind==="gap"?"hunk":i.kind,children:[i.kind==="add"?"+ ":i.kind==="del"?"- ":i.kind==="gap"?"@ ":" ",i.text,`\n`]},a,!0,void 0,this)):e.change==="remove"?e.before:e.content},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rs({h:e}){let[n,s]=m(e.files.every),[o,i]=m([]),[a,r]=m(!1),[c,p]=m(null),[u,h,f]=fe(),[l,d,_]=fe(),[T,g]=m(!1),k=e.protect.others.map((b)=>b.file);U(()=>{f(async()=>p(await A("/api/hub/files/preview",{hub:e.name,every:n,remove:o,readme:a})))},[e.name,n,o.join(","),a]);let y=c?.files.filter((b)=>b.change!=="same")??[],H=()=>_(async()=>{let b=await A("/api/hub/files",{hub:e.name,every:n,remove:o,readme:a});g(!0),await W(),p(await A("/api/hub/files/preview",{hub:e.name,every:n,remove:[],readme:!1})),i([]),r(!1),Y("ok",b.result==="committed"?`Wrote the hub files to ${e.name}.`:"The hub files were already up to date.")});return t("div",{class:"panel",children:[t(J,{title:"Hub files",lead:"The hub\'s settings, its record of published releases, a README for your users and the workflow that does the work. tapster writes them to main in one commit."},void 0,!1,void 0,this),t("div",{class:"grid2",children:t("div",{class:"field",children:[t("label",{for:"every",children:"Look for new releases every"},void 0,!1,void 0,this),t("select",{id:"every",class:"input",value:String(n??(e.private?60:10)),onChange:(b)=>s(Number(b.currentTarget.value)),children:Ds.map((b)=>t("option",{value:b,children:b<60?`${b} minutes`:b===60?"hour":`${b/60} hours`},b,!1,void 0,this))},void 0,!1,void 0,this),t("span",{class:"hint",children:e.private?"A private hub bills every run as at least one minute; hourly keeps a hub within the free minutes.":"Public hubs run for free. The doorbell can start the hub right after each release."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),e.files.workflow==="newer"&&t(x,{tone:"warn",title:`The hub runs ${e.files.pinned}, newer than this tapster`,children:t("span",{children:["tapster keeps the hub\'s workflow, so it does not move the hub back. To change the workflow, run the latest: ",t("code",{children:"bunx @doguyilmaz/tapster@latest setup"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),k.length>0&&t("div",{class:"stack tight",children:[t("h3",{class:"section-title",children:"The tap\'s old workflows"},void 0,!1,void 0,this),k.map((b)=>t("label",{class:"switch",children:[t("input",{type:"checkbox",checked:o.includes(b),onChange:(w)=>i(w.currentTarget.checked?[...o,b]:o.filter((B)=>B!==b))},void 0,!1,void 0,this),t("span",{children:[t("strong",{children:["Remove .github/workflows/",b]},void 0,!0,void 0,this),t("span",{children:"It stops running once the hub is protected. Its commits would make the hub refuse to run."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},b,!0,void 0,this))]},void 0,!0,void 0,this),(c?.readme||a)&&t("label",{class:"switch",children:[t("input",{type:"checkbox",checked:a,onChange:(b)=>r(b.currentTarget.checked)},void 0,!1,void 0,this),t("span",{children:[t("strong",{children:"Replace README.md with tapster\'s"},void 0,!1,void 0,this),t("span",{children:"It tells your users how to install from the hub, including brew trust, which Homebrew asks for before it loads casks from a tap. Your current README goes away; the diff below shows both."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),u&&!c&&t("p",{class:"row muted",children:[t(j,{},void 0,!1,void 0,this)," Comparing with ",e.name]},void 0,!0,void 0,this),t(N,{problem:h},void 0,!1,void 0,this),c&&t("div",{class:"stack tight files",children:[t("div",{class:"spread",children:[t("h3",{class:"section-title",children:y.length?`${y.length} ${y.length===1?"change":"changes"} for main`:"main is up to date"},void 0,!1,void 0,this),t("span",{class:"muted small",children:["Workflow: ",c.pin]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),c.files.map((b)=>t(Os,{f:b},b.path,!1,void 0,this)),c.kept.length>0&&t("p",{class:"muted small",children:["Kept as they are: ",c.kept.join(", "),"."]},void 0,!0,void 0,this),c.notes.filter((b)=>!b.startsWith("The hub looks for new drafts every")).map((b)=>t("p",{class:"muted small",children:b},b,!1,void 0,this))]},void 0,!0,void 0,this),c&&c.foreign.length>0&&t(x,{tone:"error",title:"main changed in ways only you may change it",children:[t("ul",{class:"log",children:c.foreign.map((b)=>t("li",{children:b},b,!1,void 0,this))},void 0,!1,void 0,this),t("span",{children:"Review those commits on GitHub and revert what you did not make. tapster writes nothing to main until then, because a write from you would mark them as reviewed."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t(N,{problem:d},void 0,!1,void 0,this),T&&t(x,{tone:"info",title:"Have a clone of the hub on this computer?",children:t("span",{children:["Run ",t("code",{children:"git pull"},void 0,!1,void 0,this)," in it, so it has the new files."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),c&&y.length>0&&c.foreign.length===0&&t("div",{class:"row",children:t(L,{busy:l,class:"btn primary",onClick:H,children:["Write ",y.length===1?"the change":`the ${y.length} changes`," to main"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),c&&y.length===0&&t(Vt,{text:"The hub files are up to date"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Vs({h:e}){return t("div",{class:"panel",children:[t(J,{title:e.packages.length?"Your projects":"Add your first project",lead:"tapster finds the projects cloned on this computer and adds them to the hub: it prepares the release workflow, protects the repository and proposes the hub entry."},void 0,!1,void 0,this),e.packages.length>0&&t("div",{class:"card list",children:e.packages.map((n)=>t("div",{class:"item",children:[t("span",{children:[t("span",{class:"name",children:n.name},void 0,!1,void 0,this),t("span",{class:"path",children:[" ",n.repo]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t(F,{children:n.kind==="app"?"Mac app":n.kind==="bun"?"Bun":"Go"},void 0,!1,void 0,this)]},n.name,!0,void 0,this))},void 0,!1,void 0,this),e.invalid.length>0&&t(x,{tone:"warn",title:"The hub leaves these entries out",children:t("ul",{class:"log",children:e.invalid.map((n)=>t("li",{children:[t("code",{children:n.name},void 0,!1,void 0,this),": ",n.reason]},n.name,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("div",{class:"row",children:t("button",{type:"button",class:"btn primary",onClick:()=>ce("/projects"),children:[e.packages.length?"Add more projects":"Find my projects",t(v,{name:"arrow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function js({h:e,label:n}){let[s,o]=m("ed25519"),[i,a]=m(null),[r,c]=m(!1),[p,u,h]=fe();if(!i)return t("form",{class:"card pad stack tight",onSubmit:(l)=>{l.preventDefault(),h(async()=>a(await A("/api/hub/sparkle/read",{hub:e.name,label:n,account:s})))},children:[t("strong",{children:["Sparkle key ",t("code",{children:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("p",{class:"muted small",children:"tapster reads it from your login keychain, where Sparkle\'s generate_keys keeps it. macOS asks you first; choose Allow."},void 0,!1,void 0,this),t("div",{class:"row",style:"flex-wrap: nowrap; align-items: end",children:[t(ge,{name:`account-${n}`,label:"Keychain account",value:s,mono:!0,onInput:o},void 0,!1,void 0,this),t(L,{busy:p,class:"btn primary",type:"submit",children:[t(v,{name:"key"},void 0,!1,void 0,this),"Read it from my keychain"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t(N,{problem:u},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let f=(l)=>{l.preventDefault();let d=String(new FormData(l.currentTarget).get("password")??"");h(async()=>{await A("/api/hub/sparkle/store",{hub:e.name,label:n,pasted:d}),jt(`sparkle-${n}`),await W(),Y("ok",`Stored the Sparkle key ${n} in the hub.`)})};return t("div",{class:"card pad stack tight",children:[t("strong",{children:["Sparkle key ",t("code",{children:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("p",{class:"muted small",children:["It signs updates for ",i.users.join(", "),". Its public key, ",t("code",{children:i.publicKey},void 0,!1,void 0,this),", matches tapster.yml."]},void 0,!0,void 0,this),t("div",{class:"cmd",children:[t("code",{children:r?i.key:"\u2022".repeat(32)},void 0,!1,void 0,this),t("button",{type:"button",class:"btn quiet small",onClick:()=>c(!r),"aria-pressed":r,children:r?"Hide":"Show"},void 0,!1,void 0,this),t(Pt,{text:i.key},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t(x,{tone:"keys",title:"Keep a copy outside your Mac",children:t("span",{children:"If this key is lost, installed copies of the app can never update again. Paste it below: your password manager offers to save it when you store the key. tapster checks that the pasted key is the right one."},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("form",{class:"secret",onSubmit:f,autoComplete:"on",children:[t(ge,{name:"username",label:"Name in your password manager",value:`${e.name}: Sparkle key ${n}`,autoComplete:"username"},void 0,!1,void 0,this),t($t,{name:"password",label:"Paste the key",hint:"The key from the box above, pasted as it is."},void 0,!1,void 0,this),t(N,{problem:u},void 0,!1,void 0,this),t("div",{class:"row",children:t(L,{busy:p,class:"btn primary",type:"submit",children:"Store in the hub"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Fs({h:e}){let n=e.name.split("/")[1],s=e.extras.sparkle.filter((o)=>!o.stored);return t("div",{class:"panel",children:[t(J,{title:"Optional extras",lead:"The hub works without these. The doorbell and the apt and dnf key run in a terminal for now, in a clone of the hub, because they need Wrangler or gpg on your computer."},void 0,!1,void 0,this),t(z,{text:`gh repo clone ${e.name} && cd ${n}`},void 0,!1,void 0,this),t("section",{class:"stack tight",children:[t("div",{class:"spread",children:[t("h3",{class:"section-title",children:"Faster releases: the doorbell"},void 0,!1,void 0,this),t(F,{tone:e.extras.doorbell?"ok":void 0,children:e.extras.doorbell?"On":"Off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("p",{class:"muted",children:"A small Worker on your own Cloudflare account starts the hub as soon as a project opens its draft, instead of at the next scheduled run. Wrangler asks you to sign in to Cloudflare in your browser."},void 0,!1,void 0,this),!e.extras.doorbell&&t(z,{text:"bunx @doguyilmaz/tapster init --doorbell"},void 0,!1,void 0,this),t("a",{href:"https://tapster.doguyilmaz.com/guides/doorbell/",target:"_blank",rel:"noopener noreferrer",class:"small",children:"Read the doorbell guide"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("section",{class:"stack tight",children:[t("div",{class:"spread",children:[t("h3",{class:"section-title",children:"apt and dnf repositories"},void 0,!1,void 0,this),t(F,{tone:e.extras.linux.stored?"ok":e.extras.linux.wanted?"warn":void 0,children:e.extras.linux.stored?"Key stored":e.extras.linux.wanted?"Key missing":"Off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("p",{class:"muted",children:e.extras.linux.wanted&&!e.extras.linux.stored?"tapster.yml asks for Linux packages, but the hub has no key to sign them yet.":"Linux users install your command line tools with apt and dnf from the hub\'s GitHub Pages. tapster makes the signing key with gpg and keeps a copy in your keychain."},void 0,!1,void 0,this),!e.extras.linux.stored&&t(z,{text:"bunx @doguyilmaz/tapster init --linux"},void 0,!1,void 0,this),t("a",{href:"https://tapster.doguyilmaz.com/guides/linux/",target:"_blank",rel:"noopener noreferrer",class:"small",children:"Read the apt and dnf guide"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.extras.sparkle.length>0&&t("section",{class:"stack tight",children:[t("div",{class:"spread",children:[t("h3",{class:"section-title",children:"Sparkle keys"},void 0,!1,void 0,this),t(F,{tone:s.length?"warn":"ok",children:s.length?`${s.length} missing`:"All stored"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("p",{class:"muted",children:"Each Mac app signs its update feed with a Sparkle key. tapster keeps it in your keychain and in the hub."},void 0,!1,void 0,this),s[0]&&t(js,{h:e,label:s[0].label},s[0].label,!1,void 0,this),s.length>1&&t("p",{class:"muted small",children:["Then: ",s.slice(1).map((o)=>o.label).join(", "),". One key at a time, so your password manager saves each under its own name."]},void 0,!0,void 0,this),t("p",{class:"faint small",children:["No key yet? Make one in a terminal with ",t("code",{children:"bunx @doguyilmaz/tapster init --sparkle <label> --new"},void 0,!1,void 0,this),"; see the"," ",t("a",{href:"https://tapster.doguyilmaz.com/guides/sparkle/",target:"_blank",rel:"noopener noreferrer",children:"Sparkle guide"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ls({h:e}){return t("div",{class:"card pad row",style:"gap: 1.25rem; flex-wrap: nowrap",children:[t("img",{src:"/courier.webp",alt:"",width:"96",height:"96",style:"border-radius: 20%; flex: none"},void 0,!1,void 0,this),t("div",{class:"stack tight",children:[t("h2",{class:"section-title",style:"font-size: 1.15rem",children:[e.name," is ready"]},void 0,!0,void 0,this),t("p",{class:"muted",children:"Push a version tag in a project and the hub signs and publishes it on its next run. Health shows how the hub is doing."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Jn(){let e=le.value,[n,s]=m(()=>{let l=De.value;return De.value=null,l}),o=Te(null);if(Ee.value,_e.value)return t("div",{class:"stack",style:"max-width: 640px",children:[t(N,{problem:_e.value},void 0,!1,void 0,this),t("div",{class:"row",children:t("button",{type:"button",class:"btn secondary",onClick:()=>void W(),children:[t(v,{name:"refresh"},void 0,!1,void 0,this),"Try again"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(!e||e.name!==V.value)return t("p",{class:"row muted",role:"status",children:[t(j,{},void 0,!1,void 0,this)," Reading ",V.value," from GitHub"]},void 0,!0,void 0,this);let i=Dn(e.name),a=Bn(e,i),r=n??(Q.value?.kind==="created"?"app":Gn(a)),c=a.filter((l)=>l.state==="done"||l.state==="skipped").length,p=a.find((l)=>l.state==="now"||l.state==="attention"),u=(l)=>{if(s(l),window.matchMedia("(max-width: 900px)").matches)o.current?.scrollIntoView({behavior:"smooth",block:"start"})},h=(l,d)=>e.protect.environment?d:t($s,{h:e,what:l,onGo:()=>u("protect")},void 0,!1,void 0,this),f={extras:t(Fs,{h:e},void 0,!1,void 0,this),protect:t(Ps,{h:e},void 0,!1,void 0,this),app:e.app.id||e.app.held||Q.value?.kind==="unstored"?t(Yn,{h:e},void 0,!1,void 0,this):h("Create the GitHub App",t(Yn,{h:e},void 0,!1,void 0,this)),macos:t(Is,{h:e,choice:i},void 0,!1,void 0,this),certificate:h("Apple certificate",t(Es,{h:e},void 0,!1,void 0,this)),notary:h("Notarization key",t(Ms,{h:e},void 0,!1,void 0,this)),files:t(Rs,{h:e},void 0,!1,void 0,this),project:t(Vs,{h:e},void 0,!1,void 0,this)};return t("div",{class:"stack",style:"gap: 1.5rem",children:[t("div",{class:"spread",children:[t("div",{class:"stack tight",children:[t("p",{class:"eyebrow",children:[c," of ",a.length," done",p?`. Next: ${p.name}`:"",tt.value&&t(j,{label:"Checking GitHub"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("h1",{class:"title",children:p?`Set up ${e.name}`:`${e.name} is set up`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t(q,{href:e.url,class:"btn quiet",children:[e.name," on GitHub"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t("div",{class:"progress","aria-hidden":"true",children:t("span",{style:`width: ${c/a.length*100}%`},void 0,!1,void 0,this)},void 0,!1,void 0,this),!p&&t(Ls,{h:e},void 0,!1,void 0,this),e.empty&&t(x,{tone:"info",title:`${e.name} has no commits yet`,children:"tapster gives it a first commit when it writes the hub files."},void 0,!1,void 0,this),t("div",{class:"setup",children:[t("ol",{class:"route","aria-label":"Setup steps",children:[a.map((l,d)=>t("li",{class:`${l.state}${l.id===r?" open":""}`,children:t("button",{type:"button",onClick:()=>u(l.id),"aria-current":l.id===r?"step":void 0,"aria-label":`${l.name}: ${l.status}${l.state==="now"?", next":l.state==="attention"?", needs you":""}`,children:[t(Hs,{stop:l,index:d},void 0,!1,void 0,this),t("span",{children:[t("span",{class:"stop-name",children:l.name},void 0,!1,void 0,this),t("span",{class:"stop-state",children:l.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},l.id,!1,void 0,this)),t("li",{class:`extra${r==="extras"?" open":""}`,children:t("button",{type:"button",onClick:()=>u("extras"),"aria-current":r==="extras"?"step":void 0,children:[t("span",{class:"dot",children:t(v,{name:"plus"},void 0,!1,void 0,this)},void 0,!1,void 0,this),t("span",{children:[t("span",{class:"stop-name",children:"Optional extras"},void 0,!1,void 0,this),t("span",{class:"stop-state",children:"Doorbell, apt and dnf, Sparkle"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("div",{class:"card pad stack",ref:o,style:"gap: 1.5rem",children:[f[r],(()=>{let l=a.findIndex((T)=>T.id===r),d=a[l],_=a.slice(l+1).find((T)=>T.state!=="done"&&T.state!=="skipped");if(!d||d.state!=="done"&&d.state!=="skipped"||!_)return null;return t("div",{class:"row",style:"border-top: 1px solid var(--line); padding-top: 1.25rem",children:t("button",{type:"button",class:"btn primary",onClick:()=>u(_.id),children:["Continue: ",_.name,t(v,{name:"arrow"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)})()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var ke=E({kind:"claiming"}),lt=E(!1);function Bs(){let e=new URLSearchParams(location.search),n=e.get("app");if(!n)return;let s=e.get("hub");if(s&&s!==V.value)ot(s);let o={reason:e.get("reason")??"the App could not be created",fix:e.get("fix")??"Try again."};if(n==="created")Q.value={kind:"created"};else if(n==="failed"||n==="unstored")Q.value={kind:n,problem:o};else Q.value={kind:"unknown"};history.replaceState(null,"",location.pathname)}async function Gs(){let e=/^#c=([0-9a-f]{32})$/.exec(location.hash)?.[1];if(location.hash)history.replaceState(null,"",location.pathname+location.search);if(e)try{await Pn(e)}catch(n){ke.value={kind:"failed",problem:R(n)};return}if(!An()){ke.value={kind:"no-session"};return}if(Bs(),ke.value={kind:"ready"},Z("/api/session").then((n)=>{if(Me.value=n,!V.value&&n.here.hub)ot(n.here.hub)}),await st(),V.value)W()}Hn(()=>{ke.value={kind:"no-session"}});async function Us(){try{await A("/api/quit")}catch{return}ke.value={kind:"stopped"}}function Ft({to:e,children:n}){let s=he.value===e||e==="/setup"&&he.value==="/";return t("a",{href:e,"aria-current":s?"page":void 0,onClick:(o)=>{o.preventDefault(),ce(e)},children:n},void 0,!1,void 0,this)}function Ws(){let e=oe.value;return t("header",{class:"top",children:[t("div",{class:"stripe"},void 0,!1,void 0,this),t("div",{class:"bar",children:[t("a",{class:"brand",href:"/setup",onClick:(n)=>{n.preventDefault(),ce("/setup")},children:[t("img",{src:"/logo.webp",alt:"",width:"28",height:"28"},void 0,!1,void 0,this),"tapster ",t("small",{children:"setup"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),V.value&&t("nav",{class:"nav","aria-label":"Sections",children:[t(Ft,{to:"/setup",children:"Setup"},void 0,!1,void 0,this),t(Ft,{to:"/projects",children:"Projects"},void 0,!1,void 0,this),t(Ft,{to:"/health",children:"Health"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t("div",{class:"end",children:[V.value&&t("button",{type:"button",class:"picker",onClick:()=>lt.value=!0,"aria-label":`Hub: ${V.value}. Choose another hub`,children:[t(v,{name:"package"},void 0,!1,void 0,this),t("span",{children:V.value},void 0,!1,void 0,this),t(v,{name:"down"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e?.state==="ok"&&t("span",{class:"who",children:["@",e.login]},void 0,!0,void 0,this),t("button",{type:"button",class:"btn quiet small",onClick:Us,title:"Stop tapster setup",children:[t(v,{name:"power"},void 0,!1,void 0,this),"Close"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function zs(){let e=ye.value;if(!e)return null;return t("div",{class:"toast",role:"status",onClick:()=>ye.value=null,children:t(x,{tone:e.tone==="ok"?"ok":"error",children:t("span",{children:e.text},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function qs(){if(!V.value||lt.value)return t(Ln,{onChosen:(e)=>{lt.value=!1,ot(e),ce("/setup",!0)},onCancel:V.value?()=>lt.value=!1:null},void 0,!1,void 0,this);if(he.value==="/projects")return t(qn,{},void 0,!1,void 0,this);if(he.value==="/health")return t(Fn,{},void 0,!1,void 0,this);return t(Jn,{},void 0,!1,void 0,this)}function Ks(){let e=ke.value;if(e.kind==="claiming")return t(It,{text:"Opening tapster setup"},void 0,!1,void 0,this);if(e.kind==="stopped")return t(Rn,{},void 0,!1,void 0,this);if(e.kind==="no-session"||e.kind==="failed")return t(On,{problem:e.kind==="failed"?e.problem:null},void 0,!1,void 0,this);let n=oe.value;if(!n)return t(It,{text:"Checking your GitHub sign-in"},void 0,!1,void 0,this);if(n.state!=="ok"||n.missing.length)return t(Vn,{},void 0,!1,void 0,this);return t(C,{children:[t(Ws,{},void 0,!1,void 0,this),t("main",{id:"main",children:t(qs,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),t(zs,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}on(t(Ks,{},void 0,!1,void 0,this),document.getElementById("app"));Gs().catch((e)=>Y("error",R(e).reason));\n';import{timingSafeEqual as XO}from"crypto";var e2="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; form-action 'self' https://github.com; frame-ancestors 'none'; base-uri 'none'",t2={"content-security-policy":e2,"x-content-type-options":"nosniff","referrer-policy":"no-referrer","cache-control":"no-store","cross-origin-opener-policy":"same-origin","cross-origin-resource-policy":"same-origin"};function Ve(e,t,n,r={}){return new Response(e,{status:t,headers:{...t2,...n?{"content-type":n}:{},...r}})}var ot=(e,t=200)=>Ve(JSON.stringify(e),t,"application/json; charset=utf-8");function Jv(e){if(e instanceof R)return{status:502,body:{error:{reason:e.reason,fix:e.fix}}};if(e instanceof v)return{status:400,body:{error:{reason:e.reason,fix:e.fix}}};return{status:500,body:{error:{reason:"tapster hit an unexpected error",fix:"The terminal that runs tapster setup shows the details. Try again; if it repeats, open an issue at https://github.com/doguyilmaz/tapster/issues."}}}}function Qv(e,t){return e===`127.0.0.1:${t}`||e===`localhost:${t}`}function Xv(e,t){let n=/^Bearer ([0-9a-f]{64})$/.exec(e??"")?.[1];if(!n)return!1;let r=Buffer.from(n),i=Buffer.from(t);return r.length===i.length&&XO(r,i)}var ey=`:root {
1096
+ --page: #f3f4f6;
1097
+ --paper: #ffffff;
1098
+ --raised: #fafafb;
1099
+ --ink: #16171b;
1100
+ --muted: #5c606c;
1101
+ --faint: #6e7280;
1102
+ --line: #e1e3e8;
1103
+ --line-strong: #cdd0d7;
1104
+ --orange: #f2891f;
1105
+ --orange-hover: #f79a3c;
1106
+ --orange-ink: #1c1206;
1107
+ --orange-soft: #fdf0e1;
1108
+ --link: #a84d06;
1109
+ --navy: #26315f;
1110
+ --navy-soft: #e9ecf6;
1111
+ --wax: #c8392f;
1112
+ --wax-soft: #fbeceb;
1113
+ --green: #18794a;
1114
+ --green-soft: #e5f4ec;
1115
+ --amber: #8a5a00;
1116
+ --amber-soft: #fbf2df;
1117
+ --code: #f1f2f5;
1118
+ --focus: color-mix(in srgb, var(--orange) 60%, transparent);
1119
+ --shadow: 0 1px 2px rgb(20 22 30 / 0.05), 0 8px 24px -12px rgb(20 22 30 / 0.18);
1120
+ --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
1121
+ --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
1122
+ --radius: 12px;
1123
+ color-scheme: light dark;
1124
+ }
973
1125
 
1126
+ @media (prefers-color-scheme: dark) {
1127
+ :root {
1128
+ --page: #111217;
1129
+ --paper: #191b22;
1130
+ --raised: #1e2028;
1131
+ --ink: #eceef3;
1132
+ --muted: #a3a8b5;
1133
+ --faint: #8f94a3;
1134
+ --line: #2a2d37;
1135
+ --line-strong: #3a3e4a;
1136
+ --orange-soft: #33220f;
1137
+ --link: #ffae63;
1138
+ --navy: #93a3ea;
1139
+ --navy-soft: #1d2236;
1140
+ --wax: #ff8b80;
1141
+ --wax-soft: #3a1b19;
1142
+ --green: #69d29d;
1143
+ --green-soft: #12291d;
1144
+ --amber: #f2c063;
1145
+ --amber-soft: #2e2410;
1146
+ --code: #22252e;
1147
+ --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px -14px rgb(0 0 0 / 0.6);
1148
+ }
1149
+ }
1150
+
1151
+ * { box-sizing: border-box; }
1152
+ html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
1153
+ body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
1154
+ a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
1155
+ a:hover { text-decoration-thickness: 2px; }
1156
+ h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.2; }
1157
+ p { margin: 0; }
1158
+ code, .mono { font-family: var(--mono); font-size: 0.88em; }
1159
+ :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
1160
+ button, input, select { font: inherit; color: inherit; }
1161
+ .noscript { padding: 2rem; }
1162
+ .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
1163
+
1164
+ /* shell */
1165
+ .stripe { height: 4px; background: repeating-linear-gradient(-45deg, var(--wax) 0 10px, transparent 10px 15px, var(--navy) 15px 25px, transparent 25px 30px); }
1166
+ .top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
1167
+ .bar { max-width: 1180px; margin: 0 auto; padding: 0.7rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
1168
+ .brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1.02rem; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
1169
+ .brand img { width: 28px; height: 28px; border-radius: 22%; }
1170
+ .brand small { font-weight: 500; color: var(--muted); font-size: 0.9rem; letter-spacing: 0; }
1171
+ .nav { display: flex; gap: 0.25rem; margin-left: 0.5rem; }
1172
+ .nav a { color: var(--muted); text-decoration: none; padding: 0.4rem 0.75rem; border-radius: 8px; font-weight: 550; }
1173
+ .nav a:hover { color: var(--ink); background: var(--raised); }
1174
+ .nav a[aria-current="page"] { color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
1175
+ .bar .end { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
1176
+ .who { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
1177
+ .picker { display: inline-flex; align-items: center; gap: 0.45rem; border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 0.35rem 0.65rem; cursor: pointer; font-family: var(--mono); font-size: 0.86rem; max-width: 260px; }
1178
+ .picker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1179
+ .picker:hover { border-color: var(--line-strong); }
1180
+ main { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
1181
+
1182
+ /* type */
1183
+ .eyebrow { color: var(--muted); font-size: 0.86rem; font-weight: 550; }
1184
+ .title { font-size: 1.65rem; font-weight: 700; }
1185
+ .lead { color: var(--muted); font-size: 1rem; max-width: 62ch; }
1186
+ .muted { color: var(--muted); }
1187
+ .faint { color: var(--faint); }
1188
+ .small { font-size: 0.88rem; }
1189
+
1190
+ /* buttons */
1191
+ .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; border: 1px solid transparent; border-radius: 10px; padding: 0.6rem 1.05rem; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
1192
+ .btn.primary { background: var(--orange); color: var(--orange-ink); }
1193
+ .btn.primary:hover { background: var(--orange-hover); }
1194
+ .btn.secondary { background: var(--paper); border-color: var(--line-strong); color: var(--ink); }
1195
+ .btn.secondary:hover { border-color: var(--faint); }
1196
+ .btn.quiet { background: none; color: var(--link); padding: 0.4rem 0.5rem; }
1197
+ .btn.quiet:hover { background: var(--raised); }
1198
+ .btn.danger { background: var(--wax); color: #fff; }
1199
+ .btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
1200
+ .btn.small { padding: 0.38rem 0.7rem; font-size: 0.88rem; border-radius: 8px; }
1201
+ .row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
1202
+ .stack { display: grid; gap: 1rem; }
1203
+ .stack.tight { gap: 0.5rem; }
1204
+ .spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
1205
+
1206
+ /* icons */
1207
+ .icon { width: 1.1em; height: 1.1em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
1208
+ .spin { animation: spin 0.9s linear infinite; }
1209
+ @keyframes spin { to { transform: rotate(360deg); } }
1210
+
1211
+ /* cards and notes */
1212
+ .card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
1213
+ .card.pad { padding: 1.5rem; }
1214
+ .note { display: flex; gap: 0.7rem; align-items: flex-start; border-radius: 10px; padding: 0.8rem 1rem; background: var(--raised); border: 1px solid var(--line); font-size: 0.93rem; }
1215
+ .note .icon { margin-top: 0.18rem; }
1216
+ .note > div { display: grid; gap: 0.25rem; min-width: 0; }
1217
+ .note strong { font-weight: 650; }
1218
+ .note.keys { background: var(--navy-soft); border-color: color-mix(in srgb, var(--navy) 25%, transparent); }
1219
+ .note.keys .icon { color: var(--navy); }
1220
+ .note.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
1221
+ .note.ok .icon { color: var(--green); }
1222
+ .note.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 28%, transparent); }
1223
+ .note.warn .icon { color: var(--amber); }
1224
+ .note.error { background: var(--wax-soft); border-color: color-mix(in srgb, var(--wax) 30%, transparent); }
1225
+ .note.error .icon { color: var(--wax); }
1226
+ .badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; font-weight: 600; padding: 0.14rem 0.5rem; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
1227
+ .badge.ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
1228
+ .badge.warn { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
1229
+ .badge.error { background: var(--wax-soft); color: var(--wax); border-color: transparent; }
1230
+ .badge.next { background: var(--orange-soft); color: var(--link); border-color: transparent; }
1231
+
1232
+ /* command rows */
1233
+ .cmd { display: flex; align-items: center; gap: 0.5rem; background: var(--code); border: 1px solid var(--line); border-radius: 9px; padding: 0.45rem 0.45rem 0.45rem 0.8rem; font-family: var(--mono); font-size: 0.86rem; min-width: 0; }
1234
+ .cmd code { flex: 1; overflow-x: auto; white-space: nowrap; font-size: inherit; }
1235
+ .cmd .btn { flex: none; }
1236
+ pre.block { margin: 0; background: var(--code); border: 1px solid var(--line); border-radius: 9px; padding: 0.8rem 1rem; overflow: auto; font: 0.82rem/1.55 var(--mono); max-height: 26rem; }
1237
+
1238
+ /* forms */
1239
+ form.secret { display: grid; gap: 1rem; }
1240
+ .field { display: grid; gap: 0.35rem; }
1241
+ .field > label, .field > .label { font-weight: 600; font-size: 0.92rem; }
1242
+ .field .hint { color: var(--muted); font-size: 0.86rem; }
1243
+ .input { width: 100%; border: 1px solid var(--line-strong); background: var(--paper); border-radius: 9px; padding: 0.55rem 0.75rem; min-width: 0; }
1244
+ .input:hover { border-color: var(--faint); }
1245
+ .input:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--orange); }
1246
+ .input.mono { font-family: var(--mono); font-size: 0.88rem; }
1247
+ .with-toggle { position: relative; }
1248
+ .with-toggle .input { padding-right: 4.6rem; }
1249
+ .with-toggle button { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); }
1250
+ .drop { position: relative; display: flex; align-items: center; gap: 0.9rem; border: 1.5px dashed var(--line-strong); border-radius: 11px; padding: 0.95rem 1rem; background: var(--raised); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
1251
+ .drop:hover, .drop.over { border-color: var(--orange); background: var(--orange-soft); }
1252
+ .drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
1253
+ .drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
1254
+ .drop .icon { width: 1.6rem; height: 1.6rem; color: var(--muted); }
1255
+ .drop.has { border-style: solid; border-color: color-mix(in srgb, var(--green) 45%, transparent); background: var(--green-soft); }
1256
+ .drop.has .icon { color: var(--green); }
1257
+ .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
1258
+ .switch { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; }
1259
+ .switch input { margin-top: 0.25rem; accent-color: var(--orange); width: 1.05rem; height: 1.05rem; flex: none; }
1260
+ .switch strong { display: block; font-weight: 600; }
1261
+ .switch span { color: var(--muted); font-size: 0.88rem; }
1262
+ select.input { appearance: auto; }
1263
+
1264
+ /* setup route */
1265
+ .setup { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 2rem; align-items: start; }
1266
+ .route { position: sticky; top: 5.5rem; list-style: none; margin: 0; padding: 0; }
1267
+ .route li { position: relative; }
1268
+ .route li.extra { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--line); }
1269
+ .route li.extra::before, .route li:has(+ li.extra)::before { display: none; }
1270
+ .route li:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: -6px; width: 2px; background: var(--line); }
1271
+ .route li.done:not(:last-child)::before { background: color-mix(in srgb, var(--green) 45%, var(--line)); }
1272
+ .route button { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 0.75rem; align-items: start; width: 100%; text-align: left; padding: 0.45rem 0.6rem 0.9rem 0; background: none; border: 0; cursor: pointer; border-radius: 10px; }
1273
+ .route button:hover .stop-name { color: var(--link); }
1274
+ .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--line-strong); color: var(--faint); font-size: 0.8rem; font-weight: 700; }
1275
+ .done .dot { background: var(--green); border-color: var(--green); color: #fff; }
1276
+ .now .dot { border-color: var(--orange); color: var(--link); box-shadow: 0 0 0 4px var(--orange-soft); }
1277
+ .skipped .dot { border-style: dashed; }
1278
+ .attention .dot { border-color: var(--wax); color: var(--wax); }
1279
+ .stop-name { display: block; font-weight: 600; line-height: 1.3; padding-top: 0.25rem; }
1280
+ .stop-state { display: block; color: var(--muted); font-size: 0.84rem; }
1281
+ .route li.open .stop-name { color: var(--ink); }
1282
+ .now .stop-state { color: var(--link); font-weight: 550; }
1283
+ .attention .stop-state { color: var(--wax); font-weight: 550; }
1284
+ .eyebrow .icon { margin-left: 0.4rem; vertical-align: -0.15em; }
1285
+ .route li.open button { background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); padding-left: 0; }
1286
+ .panel { display: grid; gap: 1.4rem; }
1287
+ .panel-head { display: grid; gap: 0.45rem; }
1288
+ .facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.45rem 1.25rem; margin: 0; }
1289
+ .facts dt { color: var(--muted); }
1290
+ .facts dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
1291
+ .checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
1292
+ .checks li { display: flex; gap: 0.6rem; align-items: flex-start; }
1293
+ .checks .icon { margin-top: 0.2rem; }
1294
+ .checks .ok { color: var(--green); }
1295
+ .checks .no { color: var(--faint); }
1296
+ .checks .bad { color: var(--wax); }
1297
+ .section-title { font-size: 0.95rem; font-weight: 650; }
1298
+ .seal { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ee6b56, #c8392f 60%, #8f2019); color: #ffe0d8; box-shadow: 0 6px 14px -6px rgb(143 32 25 / 0.6); }
1299
+ .seal .icon { width: 26px; height: 26px; stroke-width: 3; }
1300
+ .progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
1301
+ .progress span { display: block; height: 100%; background: var(--green); border-radius: inherit; transition: width 0.3s; }
1302
+
1303
+ /* lists */
1304
+ .list { display: grid; }
1305
+ .item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 0.95rem 1.1rem; border-top: 1px solid var(--line); }
1306
+ .item:first-child { border-top: 0; }
1307
+ .item > .badge { justify-self: start; }
1308
+ .item .name { font-family: var(--mono); font-weight: 600; font-size: 0.93rem; overflow-wrap: anywhere; }
1309
+ .item .path { color: var(--faint); font-size: 0.83rem; overflow-wrap: anywhere; }
1310
+ .item button.link { all: unset; cursor: pointer; display: grid; gap: 0.15rem; min-width: 0; }
1311
+ .item button.link:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
1312
+ .item:hover .name { color: var(--link); }
1313
+ .files .file { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
1314
+ .files summary { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.9rem; cursor: pointer; list-style: none; }
1315
+ .files summary::-webkit-details-marker { display: none; }
1316
+ .files summary code { flex: 1; }
1317
+ .files .file pre { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; }
1318
+ .diff .add { background: var(--green-soft); color: var(--green); display: block; }
1319
+ .diff .del { background: var(--wax-soft); color: var(--wax); display: block; }
1320
+ .diff .ctx { display: block; color: var(--muted); }
1321
+ .diff .hunk { display: block; color: var(--navy); }
1322
+ .log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; font-size: 0.92rem; }
1323
+ .log li { white-space: pre-wrap; overflow-wrap: anywhere; }
1324
+
1325
+ /* sheet */
1326
+ .sheet-back { position: fixed; inset: 0; background: rgb(10 12 18 / 0.45); z-index: 40; animation: fade 0.15s ease-out; }
1327
+ .sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--page); z-index: 41; overflow-y: auto; box-shadow: -20px 0 50px -20px rgb(0 0 0 / 0.35); animation: slide 0.2s ease-out; }
1328
+ .sheet-head { position: sticky; top: 0; background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 1rem 1.4rem; display: flex; align-items: center; gap: 1rem; z-index: 1; }
1329
+ .sheet-body { padding: 1.4rem; display: grid; gap: 1.25rem; }
1330
+ .sheet-body > *, .panel > *, .stack > * { min-width: 0; }
1331
+ @keyframes fade { from { opacity: 0; } }
1332
+ @keyframes slide { from { transform: translateX(24px); opacity: 0; } }
1333
+
1334
+ /* gates */
1335
+ .gate { min-height: calc(100vh - 4px); display: grid; place-items: center; padding: 1.5rem; }
1336
+ .gate .card { max-width: 560px; width: 100%; padding: 2rem; display: grid; gap: 1.1rem; }
1337
+ .gate img.mascot { width: 112px; height: 112px; border-radius: 24%; }
1338
+ .hello { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 2rem; align-items: center; }
1339
+ .hello img { width: 220px; height: 220px; border-radius: 22%; box-shadow: var(--shadow); }
1340
+ .choices { display: grid; gap: 0.6rem; }
1341
+ .choice { display: flex; align-items: center; gap: 0.9rem; padding: 0.95rem 1.1rem; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); cursor: pointer; text-align: left; width: 100%; }
1342
+ .choice:hover { border-color: var(--orange); }
1343
+ .choice .grow { flex: 1; min-width: 0; display: grid; gap: 0.1rem; }
1344
+ .toast { cursor: pointer; position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 50; max-width: min(560px, calc(100vw - 2rem)); animation: rise 0.2s ease-out; }
1345
+ @keyframes rise { from { transform: translate(-50%, 10px); opacity: 0; } }
1346
+
1347
+ @media (max-width: 900px) {
1348
+ .setup { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
1349
+ .route { position: static; display: flex; overflow-x: auto; gap: 0.25rem; padding-bottom: 0.25rem; }
1350
+ .route li:not(:last-child)::before { display: none; }
1351
+ .route li.extra { margin: 0; padding: 0 0 0 0.25rem; border-top: 0; border-left: 1px dashed var(--line); }
1352
+ .route li { flex: none; }
1353
+ .route button { grid-template-columns: 28px auto; padding: 0.4rem 0.7rem 0.4rem 0.4rem; align-items: center; }
1354
+ .route .stop-state { display: none; }
1355
+ .route .stop-name { padding: 0; font-size: 0.88rem; }
1356
+ .dot { width: 28px; height: 28px; }
1357
+ .hello { grid-template-columns: minmax(0, 1fr); }
1358
+ .hello img { width: 140px; height: 140px; }
1359
+ }
1360
+
1361
+ @media (max-width: 640px) {
1362
+ .bar { flex-wrap: wrap; gap: 0.6rem; padding: 0.6rem 1rem; }
1363
+ .bar .end { order: 2; width: 100%; margin: 0; justify-content: space-between; }
1364
+ .picker { flex: 1; max-width: none; }
1365
+ .nav { order: 3; width: 100%; margin: 0; }
1366
+ .who { display: none; }
1367
+ main { padding: 1.25rem 1rem 3rem; }
1368
+ .card.pad { padding: 1.1rem; }
1369
+ .grid2 { grid-template-columns: minmax(0, 1fr); }
1370
+ .item { grid-template-columns: minmax(0, 1fr); }
1371
+ .facts { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
1372
+ .facts dd { margin-bottom: 0.5rem; }
1373
+ .title { font-size: 1.4rem; }
1374
+ }
1375
+
1376
+ @media (prefers-reduced-motion: reduce) {
1377
+ *, *::before, *::after { animation: none !important; transition: none !important; }
1378
+ }
1379
+ `;var r2=600000,i2=new Set(["/","/setup","/projects","/health"]),ty=(e)=>Buffer.from(e.slice(e.indexOf(",")+1),"base64"),ny={"/logo.webp":ty(fn),"/courier.webp":ty(co)},o2=`<!doctype html>
1380
+ <html lang="en">
1381
+ <head>
1382
+ <meta charset="utf-8">
1383
+ <meta name="viewport" content="width=device-width, initial-scale=1">
1384
+ <meta name="color-scheme" content="light dark">
1385
+ <title>tapster setup</title>
1386
+ <link rel="icon" href="/logo.webp">
1387
+ <link rel="stylesheet" href="/app.css">
1388
+ <script type="module" src="/app.js"></script>
1389
+ </head>
1390
+ <body>
1391
+ <div id="app"></div>
1392
+ <noscript><p class="noscript">tapster setup needs JavaScript. The same steps work in a terminal: tapster init and tapster add.</p></noscript>
1393
+ </body>
1394
+ </html>
1395
+ `;function Lo(e,t){let n={deps:e,port:t,token:pl(32).toString("hex"),codes:new Map,claimed:new Set,pending:new Map,apps:new Map,sparkle:new Map,touched:Date.now(),login:null,link:()=>{let r=pl(16).toString("hex");return n.codes.set(r,Date.now()+r2),`http://127.0.0.1:${n.port}/#c=${r}`}};return n}async function re(e,t){let n;try{n=await e.json()}catch{throw new v("the request was not JSON","Reload the page and try again.")}let r=t.safeParse(n);if(!r.success)throw new v("the request did not have the expected fields","Reload the page and try again.");return r.data}function s2(e,t){if(typeof t!=="string"||!/^[0-9a-f]{32}$/.test(t))return ot({error:{reason:"this link is not a tapster setup link",fix:"Press Enter in the terminal that runs tapster setup for a fresh link."}},400);if(e.claimed.has(t))return e.token=pl(32).toString("hex"),e.codes.clear(),e.deps.log("tapster setup: the same link was opened twice, so tapster ended every session for safety."),e.deps.log(`Open this fresh link in your browser: ${e.link()}`),ot({error:{reason:"this link was already used",fix:"tapster ended every session for safety. Open the fresh link the terminal printed."}},409);let n=e.codes.get(t);if(n===void 0||n<Date.now())return ot({error:{reason:"this link has expired",fix:"Press Enter in the terminal that runs tapster setup for a fresh link."}},410);return e.codes.delete(t),e.claimed.add(t),e.touched=Date.now(),ot({token:e.token})}function ry(e,t,n){return async(r)=>{if(!Qv(r.headers.get("host"),e.port))return Ve("Misdirected request",421,"text/plain; charset=utf-8");let i=new URL(r.url),o=i.pathname;if(r.method==="GET"&&i2.has(o))return Ve(o2,200,"text/html; charset=utf-8");if(r.method==="GET"&&o==="/app.css")return Ve(ey,200,"text/css; charset=utf-8");if(r.method==="GET"&&o==="/app.js")return Ve(await Yv(),200,"text/javascript; charset=utf-8");if(r.method==="GET"&&ny[o])return Ve(new Uint8Array(ny[o]),200,"image/webp");if(r.method==="GET"&&o==="/app/callback")return n({s:e,req:r,url:i});if(r.method==="POST"&&o==="/api/claim"){let a=await r.json().catch(()=>null);return s2(e,a?.code)}if(!o.startsWith("/api/"))return Ve("Not found",404,"text/plain; charset=utf-8");if(!Xv(r.headers.get("authorization"),e.token))return ot({error:{reason:"this page is not signed in to tapster setup",fix:"Press Enter in the terminal that runs tapster setup for a fresh link."}},401);e.touched=Date.now();let s=t[`${r.method} ${o}`];if(!s)return ot({error:{reason:"unknown request",fix:"Reload the page."}},404);try{return ot(await s({s:e,req:r,url:i})??{})}catch(a){let c=Jv(a);if(c.status===500)e.deps.log(`tapster setup: ${r.method} ${o} failed: ${dn(a instanceof Error?`${a.name}: ${a.message}`:"unknown error")}`);return ot(c.body,c.status)}}}var c2=/^[A-Za-z0-9-]+\/homebrew-[A-Za-z0-9._-]+$/,l2="tapster: the hub needs attention";async function u2(e){let t;try{t=await e.deps.github()}catch(s){if(s instanceof v&&/not installed/.test(s.reason))return{state:"no-gh"};return{state:"signed-out"}}let n;try{n=await t.request("GET","/user")}catch(s){if(s instanceof R&&s.status===401)return{state:"signed-out"};throw s}let r=await n.json();e.login=r.login;let i=n.headers.get("x-oauth-scopes"),o=i===null?null:i.split(",").map((s)=>s.trim());return{state:"ok",login:r.login,missing:o===null?[]:["repo","workflow"].filter((s)=>!o.includes(s))}}async function Ye(e){let t=await e.deps.github();return e.login??=(await t.json("GET","/user")).login,{gh:t,login:e.login}}function st(e,t){if(typeof e!=="string"||!c2.test(e))throw new v("that is not a hub name","A hub is one of your repositories whose name starts with homebrew-, such as you/homebrew-tap.");if(e.split("/")[0].toLowerCase()!==t.toLowerCase())throw new v(`${e} does not belong to ${t}`,"tapster serves repositories of your own account.");return e}async function we(e,t){let{gh:n,login:r}=await Ye(e.s);return{gh:n,hub:st(t,r),login:r}}var dl=async(e)=>{try{return await e}catch(t){if(t instanceof R&&t.status===404)return null;throw t}},iy=async(e,t)=>{try{return(await e.json("GET",`/repos/${t}/git/ref/heads/main`)).object.sha}catch(n){if(n instanceof R&&(n.status===404||n.status===409))return null;throw n}};async function hl(e,t){let n=[];for(let i=1;i<=5;i++){let o=await e.json("GET",`/user/repos?affiliation=owner&sort=updated&per_page=100&page=${i}`);if(n.push(...o),o.length<100)break}let r=n.filter((i)=>i.name.startsWith("homebrew-")&&i.owner.login.toLowerCase()===t.toLowerCase());return Promise.all(r.map(async(i)=>({name:i.full_name,private:i.private,url:i.html_url,tapster:await dl(e.json("GET",`/repos/${i.full_name}/environments/tapster`))!==null})))}function p2(e){let t=[];for(let[n,r]of Object.entries(e)){if(n==="tapster.yml")continue;let i;try{i=ie(r)}catch{t.push({file:n,actions:["(the file is not valid YAML)"]});continue}let o=i?.jobs??{},a=Object.values(o).flatMap((c)=>[c?.uses,...(c?.steps??[]).map((l)=>l?.uses)]).filter((c)=>typeof c==="string").filter((c)=>{if(c.startsWith("./"))return!1;let[l,u]=c.split("@"),p=(l??"").split("/")[0].toLowerCase();return!(p==="actions"||p==="github"||(l??"").toLowerCase()==="doguyilmaz/tapster")||!/^[0-9a-f]{40}$/.test(u??"")});if(a.length)t.push({file:n,actions:[...new Set(a)]})}return t}async function fl(e,t,n){let r=await t.json("GET",`/repos/${n}`),o=await iy(t,n)===null,s=await dl(t.json("GET",`/repos/${n}/environments/tapster`)),a=async(I)=>s?(await t.json("GET",`/repos/${n}/environments/tapster/${I}?per_page=100`))[I]??[]:[],[c,l,u,p,d,h]=await Promise.all([a("variables"),a("secrets"),s?t.json("GET",`/repos/${n}/environments/tapster/deployment-branch-policies`):Promise.resolve({branch_policies:[]}),t.json("GET",`/repos/${n}/rulesets`).catch(()=>[]),t.json("GET",`/repos/${n}/actions/permissions`),t.json("GET",`/repos/${n}/actions/permissions/workflow`)]),f=await Promise.all(p.map((I)=>t.json("GET",`/repos/${n}/rulesets/${I.id}`))),m=d.allowed_actions==="selected"?await t.json("GET",`/repos/${n}/actions/permissions/selected-actions`):null,g=(I)=>o?Promise.resolve(null):de(t,n,I,"main"),[w,x,_,b,k]=await Promise.all([g("tapster.yml"),g(".tapster/state.json"),g("README.md"),g(J),o?Promise.resolve([]):t.json("GET",`/repos/${n}/contents/.github/workflows?ref=main`).catch(()=>[])]),S={};for(let I of k.filter((Ht)=>Ht.type==="file"&&/\.ya?ml$/.test(Ht.name)))S[I.name]=await g(`.github/workflows/${I.name}`)??"";let O=(I)=>I.map((Ht)=>Ht.name),A=(I)=>c.find((Ht)=>Ht.name===I)?.value??null,L=w===null?null:(()=>{try{return ne(w,n.split("/")[0])}catch{return null}})(),ae=Boolean(s?.deployment_branch_policy?.custom_branch_policies)&&u.branch_policies.length===1&&u.branch_policies[0].name==="main",ke=[{label:"a tapster environment that only main may open",ok:ae},{label:"main cannot be deleted or force-pushed",ok:Jc(f).ok},{label:"workflows run only GitHub's and tapster's actions, pinned by commit",ok:Qc(d,m).ok},{label:"the workflows' default token is read-only",ok:h.default_workflow_permissions==="read"}],B=A("TAPSTER_APP_ID"),St=e.apps.get(n),jy=L?.config.packages.some(no)??!1,My=Boolean(A("TAPSTER_TEAM_ID"))||O(l).includes("MACOS_NOTARY_KEY"),Ho=b?Gt.exec(b):null,Sn=(await t.json("GET",`/repos/${n}/issues?state=open&creator=${encodeURIComponent("github-actions[bot]")}&per_page=100`).catch(()=>[])).find((I)=>I.title===l2&&I.user?.login==="github-actions[bot]");return{name:n,url:r.html_url,private:r.private,empty:o,protect:{done:ke.every((I)=>I.ok),environment:ae,checks:ke,others:p2(S)},app:{id:B,slug:A("TAPSTER_APP_SLUG"),key:O(l).includes("TAPSTER_APP_PRIVATE_KEY"),held:Boolean(St),installed:St?await oy(e,n):null},apple:{needed:My||jy?!0:null,certificate:A("TAPSTER_TEAM_ID")?{team:A("TAPSTER_TEAM_ID"),expires:A("TAPSTER_CERT_EXPIRES")??""}:null,certificateStored:["MACOS_SIGN_P12","MACOS_SIGN_PASSWORD"].every((I)=>O(l).includes(I)),notary:["MACOS_NOTARY_KEY","MACOS_NOTARY_KEY_ID","MACOS_NOTARY_ISSUER_ID"].every((I)=>O(l).includes(I))},files:{config:w!==null,state:x!==null,readme:_!==null,workflow:Vc(b,se,e.deps.pin),pinned:Ho?`${Ho[2]} (${Ho[1].slice(0,7)})`:null,every:b?rt(b):null},packages:(L?.config.packages??[]).map((I)=>({name:I.name,repo:I.repo,kind:Y(I)?"app":I.kind})),invalid:(L?.invalid??[]).map((I)=>({name:I.name,reason:I.reason})),issue:Sn?{url:Sn.html_url,number:Sn.number,updated:Sn.updated_at,body:Sn.body??""}:null,extras:{doorbell:A("TAPSTER_DOORBELL")!==null,linux:{wanted:L?.config.packages.some((I)=>!Y(I)&&I.linux)??!1,stored:O(l).includes("TAPSTER_LINUX_KEY")},sparkle:(L?Te(L.config):[]).map((I)=>({label:I,stored:O(l).includes(`SPARKLE_KEY_${I.toUpperCase()}`)}))}}}async function oy(e,t){let n=e.apps.get(t);if(!n)return{checked:!1,id:null,onHub:!1,repos:[]};let r=t.split("/")[0],i=await Oo(n.id,n.pem,r,t,new pe(Be(n.id,n.pem),e.deps.fetch)),o=i.id===null?[]:await Ig(n.id,n.pem,r,e.deps.fetch)??[];return{checked:!0,id:i.id,onHub:i.onHub,repos:o}}async function bn(e,t){let n=await dl(e.json("GET",`/repos/${t}/environments/tapster`)),r=n?await e.json("GET",`/repos/${t}/environments/tapster/deployment-branch-policies`):{branch_policies:[]};if(!(Boolean(n?.deployment_branch_policy?.custom_branch_policies)&&r.branch_policies.length===1&&r.branch_policies[0].name==="main"&&(r.branch_policies[0].type??"branch")==="branch"))throw new v(`${t}'s tapster environment is not locked to main`,"Protect the hub first: keys go into that environment only once workflows on other branches cannot open it.")}async function sy(e,t,n){let i=(await ul(e,t,n).catch((o)=>{if(o instanceof R&&o.status===404)return[];throw o})).filter((o)=>!o.startsWith("GitHub shows no push by"));if(i.length)throw new v(`main changed in ways only you may change it: ${i.join("; ")}`,"Review those commits on GitHub and revert what you did not make. tapster writes nothing to main until then, because a write from you would mark them as reviewed.")}var jo=z({hub:E()}).strict();async function d2(e){let{hub:t}=await re(e.req,jo),{gh:n}=await we(e,t),r=await n.json("GET",`/repos/${t}`);return await ll(n,t,r.private),{done:!0}}async function h2(e){let{hub:t}=await re(e.req,jo),{gh:n,login:r}=await we(e,t);await bn(n,t);let i=a2(16).toString("hex");for(let[s,a]of e.s.pending)if(Date.now()-a.at>3600000)e.s.pending.delete(s);e.s.pending.set(i,{hub:t,owner:r,at:Date.now()});let o=Eo(r,t,`http://127.0.0.1:${e.s.port}/app/callback`);return{action:`https://github.com/settings/apps/new?state=${i}`,manifest:JSON.stringify(o),permissions:zc(o),name:o.name}}async function ay(e){let t=(s)=>new Response(null,{status:303,headers:{location:`/setup?${new URLSearchParams(s)}`,"cache-control":"no-store","referrer-policy":"no-referrer"}}),n=e.url.searchParams.get("state")??"",r=e.url.searchParams.get("code")??"",i=e.s.pending.get(n);if(!i||!/^[A-Za-z0-9_-]{1,128}$/.test(r))return t({app:"unknown"});e.s.pending.delete(n);let o;try{o=await Dc(r,i.owner,"If GitHub created the App anyway, delete it at https://github.com/settings/apps first, because its name would block a new one. Then create it again.",e.s.deps.fetch)}catch(s){let a=s instanceof v?s:new v("GitHub did not hand over the new App","Try again from Setup.");return t({app:"failed",hub:i.hub,reason:a.reason,fix:a.fix})}e.s.apps.set(i.hub,{id:String(o.id),pem:o.pem,slug:o.slug});try{return await bn(await e.s.deps.github(),i.hub),await Sr(i.hub,o),t({app:"created",hub:i.hub})}catch(s){let a=s instanceof v?s:new v("the App's key could not be stored","Try again.");return t({app:"unstored",hub:i.hub,reason:a.reason,fix:a.fix})}}async function f2(e){let{hub:t}=await re(e.req,jo),{gh:n}=await we(e,t);await bn(n,t);let r=e.s.apps.get(t);if(!r)throw new v("this setup no longer holds the App's key","GitHub hands the key over only once. Delete the App at https://github.com/settings/apps, then create it again here.");return await Sr(t,{id:Number(r.id),slug:r.slug,pem:r.pem}),{stored:!0}}async function m2(e){let{hub:t}=await we(e,e.url.searchParams.get("hub"));return oy(e.s,t)}var cy=(e,t,n)=>{let r=e.get(t);if(!(r instanceof File)||r.size===0)throw new v(`no ${t} file was attached`,"Choose the file and try again.");if(r.size>n)throw new v(`that ${t} file is too large`,"Choose the file Apple or Keychain Access gave you.");return r.arrayBuffer().then((i)=>new Uint8Array(i))};async function ly(e){try{return await e.req.formData()}catch{throw new v("the form could not be read","Reload the page and try again.")}}async function g2(e){let t=await ly(e),{gh:n,hub:r}=await we(e,t.get("hub"));await bn(n,r);let i=await cy(t,"p12",tl),o=String(t.get("password")??""),s=await Co(i,o);return await Ro(r,i,o,s),s}async function v2(e){let t=await ly(e),{gh:n,hub:r}=await we(e,t.get("hub"));await bn(n,r);let i=Io(await cy(t,"p8",nl),String(t.get("keyId")??""),String(t.get("issuerId")??"")),o=await e.s.deps.notary(i);return await zo(r,i),{checked:o}}var uy=z({hub:E(),every:bc().int().nullable(),remove:ue(E()).max(20),readme:tt()}).strict();async function py(e,t,n,r,i,o,s){let a=await t.json("GET",`/repos/${n}`),c=await So(t,n,s,e.s.deps.pin,{every:r,isPrivate:a.private}),l=Vc(await s(J),se,e.s.deps.pin)==="newer",u=[];for(let f of c.files.filter((m)=>!(l&&m.path===J)))u.push({path:f.path,content:f.content,before:f.before,change:f.before===null?"create":f.before===f.content?"same":"update"});let p=xo(n).find((f)=>f.path==="README.md"),d=c.kept.includes("README.md")?await s("README.md"):null;if(o&&d!==null&&d!==p.content)u.push({path:"README.md",content:p.content,before:d,change:"update"});let h=i.filter((f)=>/^[A-Za-z0-9._-]+\.ya?ml$/.test(f)&&f!=="tapster.yml");for(let f of h){let m=await s(`.github/workflows/${f}`);if(m!==null)u.push({path:`.github/workflows/${f}`,content:"",before:m,change:"remove"})}return{files:u,kept:c.kept,pin:l?"kept: the hub runs a newer tapster than this one":c.change,notes:l?[]:c.notes,foreign:[],readme:d!==null&&d!==p.content}}async function y2(e){let t=await re(e.req,uy),{gh:n,hub:r,login:i}=await we(e,t.hub),o=await py(e,n,r,t.every,t.remove,t.readme,(a)=>de(n,r,a,"main")),s=await ul(n,r,i).catch(()=>[]);return{...o,foreign:s.filter((a)=>!a.startsWith("GitHub shows no push by"))}}async function b2(e){let t=await re(e.req,uy),{gh:n,hub:r,login:i}=await we(e,t.hub);if(await iy(n,r)===null){let s=xo(r).find((a)=>a.path==="README.md");if(await n.json("PUT",`/repos/${r}/contents/README.md`,{message:"Start the tap",content:Buffer.from(s.content).toString("base64"),branch:"main"}),(await n.json("GET",`/repos/${r}`)).default_branch!=="main")await n.json("PATCH",`/repos/${r}`,{default_branch:"main"})}return await sy(n,r,i),{result:await Kc(n,r,"Set up tapster",async(s)=>(await py(e,n,r,t.every,t.remove,t.readme,s)).files.filter((c)=>c.change!=="same").map((c)=>({path:c.path,content:c.change==="remove"?null:c.content})))}}async function w2(e){let t=await re(e.req,z({name:E().regex(/^homebrew-[A-Za-z0-9._-]{1,80}$/),private:tt()}).strict()),{gh:n,login:r}=await Ye(e.s);try{return{hub:(await n.json("POST","/user/repos",{name:t.name,private:t.private,auto_init:!1,description:"Homebrew tap, published by tapster"})).full_name}}catch(i){if(i instanceof R&&i.status===422)throw new v(`${r}/${t.name} already exists`,"Pick it from the list instead.");throw i}}var _2=z({hub:E(),label:E().regex(/^[a-z0-9]{1,40}$/),account:E().regex(/^[A-Za-z0-9 ._@-]{1,64}$/)}).strict();async function dy(e,t,n){let r=await de(e,t,"tapster.yml","main"),i=r===null?null:ne(r,t.split("/")[0]).config;if(!i||!Te(i).includes(n))throw new v(`no app in ${t}'s tapster.yml signs with the Sparkle key ${n}`,"Add the app with its sparkle section first.");return i}async function k2(e){let t=await re(e.req,_2),{gh:n,hub:r}=await we(e,t.hub),i=await dy(n,r,t.label),o=await e.s.deps.keychain(t.account);if(o===null)throw new v(`your keychain gave no Sparkle key for the account ${t.account}`,"Choose Allow when macOS asks. generate_keys uses the account ed25519 unless you passed --account.");let s=To(o),a=cl(i,t.label,s.publicKey);return e.s.sparkle.set(`${r} ${t.label}`,{seed:o.trim(),at:Date.now()}),{publicKey:s.publicKey,users:a,key:o.trim()}}async function x2(e){let t=await re(e.req,z({hub:E(),label:E().regex(/^[a-z0-9]{1,40}$/),pasted:E().max(400)}).strict()),{gh:n,hub:r,login:i}=await we(e,t.hub),o=e.s.sparkle.get(`${r} ${t.label}`);if(!o||Date.now()-o.at>1800000)throw new v("read the key from your keychain first","Click Read it from my keychain again.");if(t.pasted.trim()!==o.seed)throw new v("that is not the key shown above","Paste the key itself, so the copy your password manager keeps is the right one.");let s=await dy(n,r,t.label);await bn(n,r),await sy(n,r,i),await X(r,`SPARKLE_KEY_${t.label.toUpperCase()}`,o.seed);let a=await Kc(n,r,`Pass the Sparkle key ${t.label} to the hub workflow`,async(c)=>{let l=await c(J);if(l===null)return[];let u=ko(l,Te(s));return u===l?[]:[{path:J,content:u}]});return e.s.sparkle.delete(`${r} ${t.label}`),{stored:!0,workflow:a}}async function S2(e){let{gh:t,hub:n}=await we(e,e.url.searchParams.get("hub")),[{checks:r,note:i},o]=await Promise.all([xr(t,n),t.json("GET",`/repos/${n}/actions/workflows/tapster.yml/runs?per_page=8`).catch(()=>({workflow_runs:[]}))]);return{checks:r,note:i,runs:o.workflow_runs.map((s)=>({id:s.id,url:s.html_url,event:s.event,status:s.status,conclusion:s.conclusion,created:s.created_at}))}}async function A2(e){let{hub:t}=await re(e.req,jo),{gh:n}=await we(e,t);return await n.json("POST",`/repos/${t}/actions/workflows/tapster.yml/dispatches`,{ref:"main"}),{started:!0}}var hy={"GET /api/account":(e)=>u2(e.s),"GET /api/hubs":async(e)=>{let{gh:t,login:n}=await Ye(e.s);return{hubs:await hl(t,n)}},"POST /api/hubs":w2,"GET /api/hub":async(e)=>{let{gh:t,hub:n}=await we(e,e.url.searchParams.get("hub"));return fl(e.s,t,n)},"POST /api/hub/protect":d2,"POST /api/hub/app":h2,"POST /api/hub/app/store":f2,"GET /api/hub/installation":m2,"POST /api/hub/certificate":g2,"POST /api/hub/notary":v2,"POST /api/hub/files/preview":y2,"POST /api/hub/files":b2,"GET /api/hub/health":S2,"POST /api/hub/run":A2,"POST /api/hub/sparkle/read":k2,"POST /api/hub/sparkle/store":x2};import{existsSync as qo,lstatSync as yy,readdirSync as wy}from"fs";import{isAbsolute as yl,join as De,normalize as _y,resolve as ky}from"path";import{lstatSync as ml,readdirSync as $2,realpathSync as vy}from"fs";import{dirname as P2,join as Bt,resolve as Mo,sep as fy}from"path";var T2=new Set(["node_modules","Library","Applications","Pictures","Music","Movies","Documents","Desktop","Downloads","Public","vendor","Pods","DerivedData","build","dist","target","out"]),E2=["Developer","Projects","projects","code","Code","src","dev","git","GitHub","repos","workspace","work"];var O2=(e)=>{try{return ml(e).isFile()}catch{return!1}};function gl(e){let t=/\[remote "origin"\]([\s\S]*?)(?=\n\s*\[|$)/.exec(e)?.[1]??"",n=/^\s*url\s*=\s*(\S+)\s*$/m.exec(t)?.[1]??"";return/^(?:https:\/\/github\.com\/|git@github\.com:|ssh:\/\/git@github\.com\/)([A-Za-z0-9-]+\/[A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(n)?.[1]??null}function vl(e,t){let n=(r)=>t.includes(r)&&O2(Bt(e,r));if(t.some((r)=>r==="project.yml"||r==="Package.swift"||r.endsWith(".xcodeproj")))return{kind:"app",why:null};if(n("go.mod"))return n(".goreleaser.yaml")||n(".goreleaser.yml")?{kind:"go",why:null}:{kind:null,why:"a Go project without GoReleaser"};if(n("package.json")){if(!n("bun.lock")&&!n("bun.lockb"))return{kind:null,why:"a JavaScript project without Bun"};let r=null;try{r=JSON.parse(oe(Bt(e,"package.json"))??"{}").bin}catch{r=null}return r?{kind:"bun",why:null}:{kind:null,why:"a Bun project without a command (no bin in package.json)"}}return{kind:null,why:"no build that tapster knows"}}function Uo(e,t){return[t,P2(t),...E2.map((n)=>Bt(e,n))].filter((n)=>Zo(n,e)&&n!==Mo(e))}var my=(e,t)=>e===t||e.startsWith(t.endsWith(fy)?t:`${t}${fy}`),gy=(e)=>{try{return vy(e)}catch{return Mo(e)}};function Zo(e,t){return my(Mo(e),Mo(t))||my(gy(e),gy(t))}function Go(e,t={}){let n=t.depth??3,r=t.maxDirs??4000,i=t.deadline??Date.now()+3000,o=new Set,s=[],a=0,c=!1,l=(u,p)=>{if(a>=r||Date.now()>i){c=!0;return}let d;try{d=vy(u)}catch{return}if(o.has(d))return;o.add(d),a++;let h;try{h=$2(d)}catch{return}if(h.includes(".git")){let f=null;try{f=ml(Bt(d,".git"))}catch{f=null}let m=f?.isDirectory()?oe(Bt(d,".git","config"),65536):null,g=m?gl(m):null;if(g)s.push({path:u,repo:g,owner:g.split("/")[0],inHub:!1,proposed:null,...vl(d,h)});return}if(p>=n)return;for(let f of h){if(f.startsWith(".")||T2.has(f))continue;try{if(!ml(Bt(d,f)).isDirectory())continue}catch{continue}l(Bt(u,f),p+1)}};for(let u of e)l(u,0);return{found:s,truncated:c}}var by="Release through the tapster hub";function Cr(e,t){if(typeof e!=="string"||!yl(e))throw new v("that is not a full folder path","Give the folder's full path, such as /Users/you/Developer/my-tool.");let n=ky(_y(e));if(!Zo(n,t))throw new v(`${n} is outside your home folder`,"tapster reads clones inside your home folder only.");let r;try{r=yy(n)}catch{throw new v(`${n} does not exist`,"Check the path.")}if(!r.isDirectory())throw new v(`${n} is not a folder`,"Give the folder of the clone.");if(!qo(De(n,".git"))||!yy(De(n,".git")).isDirectory())throw new v(`${n} is not a git clone`,"Give the top folder of a clone, the one that holds .git.");return n}function Rr(e,t){let n=gl(oe(De(e,".git","config"),65536)??"");if(!n)throw new v("this clone's origin is not a GitHub repository","tapster adds clones whose origin is on github.com.");if(n.split("/")[0].toLowerCase()!==t.toLowerCase())throw new v(`${n} does not belong to ${t}`,"tapster publishes repositories of your own account.");return n}async function wn(e,t,n={}){let r=n.user?{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND??"ssh -o BatchMode=yes"}:{GIT_TERMINAL_PROMPT:"0"};return j(hn.git,"git",["-C",e,...t],{env:r,allowFail:!0,timeoutMs:n.timeoutMs??20000,maxOutput:4194304})}async function xy(e,t){let n=await wn(e,["cat-file","-p",`HEAD:${t}`]);return n.code===0?n.stdout:null}function C2(e){let t=oe(De(e,".git","HEAD"),4096)?.trim()??"";return/^ref: refs\/heads\/(.+)$/.exec(t)?.[1]??"a detached HEAD"}async function R2(e,t){let n=[];for(let r of t){let i=oe(De(e,r));if(i!==null&&i!==await xy(e,r))n.push(r)}return n}var Sy={hub:E()};async function I2(e){let t=await re(e.req,z({hub:E(),extra:ue(E()).max(10)}).strict()),{gh:n,login:r}=await Ye(e.s),i=st(t.hub,r),o=t.extra.map((m)=>ky(m)).filter((m)=>yl(m)&&Zo(m,e.s.deps.home)&&qo(m)),s=[...new Set([...o,...Uo(e.s.deps.home,e.s.deps.cwd)])].filter((m)=>qo(m)),{found:a,truncated:c}=Go(s),l=await de(n,i,"tapster.yml","main").catch(()=>null),u=new Set(l?ne(l,r).config.packages.map((m)=>m.repo.toLowerCase()):[]),p=await n.json("GET",`/repos/${i}/pulls?state=open&per_page=100`).catch(()=>[]),d=new Map(p.filter((m)=>m.head?.ref?.startsWith("tapster-add-")).map((m)=>[m.head.ref.slice(12),m.html_url])),h=a.filter((m)=>m.owner.toLowerCase()===r.toLowerCase()&&m.repo.toLowerCase()!==i.toLowerCase());return{projects:[...new Map(h.map((m)=>[m.path,m])).values()].map(({owner:m,...g})=>({...g,inHub:u.has(g.repo.toLowerCase()),proposed:d.get(wo(g.repo))??null})).sort((m,g)=>Number(g.kind!==null)-Number(m.kind!==null)||m.repo.localeCompare(g.repo)),roots:s,others:a.length-h.length,truncated:c}}function N2(e){let t=De(e,".github","workflows"),n;try{n=wy(t).filter((r)=>/^[A-Za-z0-9._-]+\.ya?ml$/.test(r))}catch{return[]}return n.filter((r)=>(oe(De(t,r))??"").includes("goreleaser/goreleaser-action")).sort()}async function z2(e){let t=await re(e.req,z({...Sy,path:E()}).strict()),{gh:n,login:r}=await Ye(e.s),i=st(t.hub,r),o=Cr(t.path,e.s.deps.home),s=Rr(o,r),a=wo(s),c=wy(o),{kind:l,why:u}=vl(o,c);if(l==="app"&&!Bc(o))l=null,u="an Xcode project without a Sparkle feed (SUFeedURL ending in /releases/latest/download/<name>.xml)";if(l==="bun"){let k=oe(De(o,"package.json")),S=null;try{S=k?JSON.parse(k):null}catch{S=null}if(!S||!vo(S,a))l=null,u="package.json has no bin entry, so there is no command to publish"}if(l===null)throw new v(`tapster cannot publish ${s} yet: it is ${u}`,"tapster publishes GoReleaser Go tools, Bun command line tools and Mac apps that update with Sparkle.");let p=l==="go"?N2(o):[],d=oe(De(o,".github","workflows","release.yml")),h=await R2(o,[".github/workflows/release.yml",".goreleaser.yaml",".goreleaser.yml",...p.map((k)=>`.github/workflows/${k}`)]),f=C2(o),[m,g,w]=await Promise.all([n.getRepo(s),kr(n,i).catch(()=>null),de(n,i,"tapster.yml","main").catch(()=>null)]),x=await mr(n,s,m.default_branch,"admin").catch(()=>["unknown"]),_=await n.json("GET",`/repos/${i}/pulls?state=open&head=${encodeURIComponent(`${r}:tapster-add-${a}`)}`).catch(()=>[]),b=w?ne(w,r).config.packages.some((k)=>k.repo.toLowerCase()===s.toLowerCase()):!1;if(!g)throw new v(`${i} has no App yet`,"Finish the hub's setup first.");return{path:o,repo:s,name:a,kind:l,branch:f,defaultBranch:m.default_branch,dirty:[...new Set(h)],workflows:p,workflow:p.includes("release.yml")?"release.yml":p[0]??null,releaseFlow:d===null?"missing":d.includes("Ring the tapster hub")?"ours":"other",dependabot:[".github/dependabot.yml",".github/dependabot.yaml"].some((k)=>qo(De(o,k))),private:m.private,protected:x.length===0,inHub:b,proposed:_[0]?.html_url??null,apple:g.apple}}var D2=z({...Sy,path:E(),options:z({workflow:E().regex(/^[A-Za-z0-9._-]+\.ya?ml$/),autoTag:tt(),dependabot:tt(),force:tt()}).strict()}).strict();async function L2(e){let t=await re(e.req,D2),{gh:n,login:r}=await Ye(e.s),i=st(t.hub,r),o=Cr(t.path,e.s.deps.home),s=Rr(o,r),a=t.options,c=Hc([...a.force?["--force"]:[],...a.autoTag?["--auto-tag"]:[],...a.dependabot?["--allow-dependabot"]:[],"--workflow",a.workflow]),l=await kr(n,i);await wn(o,["config","tapster.hub",i],{user:!0});let u=[],p=await Fc(n,o,s,i,l,c,(d)=>u.push(d));return{lines:u,pr:p.pr,entry:p.entry,installUrl:p.installUrl,files:p.files}}function Ay(e){for(let t of e)if(yl(t)||_y(t).startsWith("..")||!/^[A-Za-z0-9._/-]+$/.test(t))throw new v(`${t} is not a file of this clone`,"Reload the page and try again.");return e}var $y=z({path:E(),files:ue(E()).min(1).max(10)}).strict();async function j2(e){let t=await re(e.req,$y),{login:n}=await Ye(e.s),r=Cr(t.path,e.s.deps.home);Rr(r,n);let i=[];for(let o of Ay(t.files))i.push({path:o,before:await xy(r,o),after:oe(De(r,o))});return{files:i}}async function M2(e){let t=await re(e.req,$y),{login:n}=await Ye(e.s),r=Cr(t.path,e.s.deps.home);Rr(r,n);let i=Ay(t.files),o=await wn(r,["add","--",...i],{user:!0});if(o.code!==0)throw new v("git could not stage the files",o.stderr.trim().split(`
1396
+ `).at(-1)??"Run git status in the clone.");let s=await wn(r,["commit","-m",by,"--",...i],{user:!0,timeoutMs:60000});if(s.code!==0){let a=`${s.stdout}
1397
+ ${s.stderr}`;if(/nothing to commit|no changes added/i.test(a))return{committed:!1};throw new v("git could not commit",`${a.trim().split(`
1398
+ `).at(-1)??""} Commit in a terminal: git commit -m "${by}" -- ${i.join(" ")}`)}return{committed:!0}}async function U2(e){let t=await re(e.req,z({path:E()}).strict()),{login:n}=await Ye(e.s),r=Cr(t.path,e.s.deps.home);Rr(r,n);let o=(await wn(r,["rev-parse","--abbrev-ref","--symbolic-full-name","@{u}"])).code===0?["push"]:["push","--set-upstream","origin","HEAD"];if((await wn(r,o,{user:!0,timeoutMs:90000}).catch((a)=>{if(a instanceof v)return{code:1,stdout:"",stderr:a.reason};throw a})).code!==0)throw new v("git could not push without asking for a password or passphrase",`Push from a terminal in ${r}: git ${o.join(" ")}`);return{pushed:!0}}var Py={"POST /api/projects/scan":I2,"POST /api/projects/inspect":z2,"POST /api/projects/add":L2,"POST /api/projects/diff":j2,"POST /api/projects/commit":M2,"POST /api/projects/push":U2};var Ir=8277,G2=7200000;function q2(e){let t={open:!0,port:null,pin:null};for(let n=0;n<e.length;n++){let r=e[n],i=e[n+1];if(r==="--no-open")t.open=!1;else if(r==="--port"&&i&&/^\d{2,5}$/.test(i)&&Number(i)>=1024&&Number(i)<=65535)t.port=Number(e[++n]);else if(r==="--tapster"&&i&&/^[0-9a-f]{40}$/.test(i))t.pin=e[++n];else throw new v(`unknown option ${r}`,"Run tapster setup --help for the options.")}return t}function B2(e,t){return{...hy,...Py,"GET /api/session":async()=>{let n=await He(e.deps.cwd).catch(()=>null),r=n!==null&&/\/homebrew-/.test(n);return{version:se.version,dev:se.sha===null&&e.deps.pin===null,platform:process.platform,home:e.deps.home,here:{hub:r?n:null,repo:r?null:n,path:e.deps.cwd}}},"POST /api/quit":async()=>(setTimeout(t,200),{stopping:!0})}}function H2(e){let t=process.platform==="darwin"?"/usr/bin/open":"/usr/bin/xdg-open";j(t,"open",[e],{allowFail:!0}).catch(()=>{return})}function bl(e){let t=null;return{async github(){if(t&&Date.now()-t.at<60000)return t.gh;let n=await _t();return t={gh:n,at:Date.now()},n},fetch,home:Z2(),cwd:process.cwd(),pin:e,log:(n)=>console.log(n),open:H2,notary:No,keychain:(n)=>Pr("the Sparkle key").read({service:"https://sparkle-project.org",account:n,label:"Private key for signing Sparkle updates"})}}function Ty(e,t){return Bun.serve({hostname:"127.0.0.1",port:e,fetch:t,development:!1,error:()=>Ve("tapster setup hit an unexpected error. The terminal that runs it may say more.",500,"text/plain; charset=utf-8"),maxRequestBodySize:1048576,idleTimeout:120})}async function Ey(e,t){let n=q2(e);if(process.platform==="win32")throw new v("tapster setup runs on macOS and Linux","Run it on a Mac or a Linux computer; the hub itself serves Windows users through Scoop.");let r=t??bl(n.pin),i=async()=>new Response(null,{status:503}),o;try{o=Ty(n.port??Ir,(d)=>i(d))}catch{if(n.port!==null)throw new v(`port ${n.port} is in use`,"Pick another one with --port or close the program that uses it.");o=Ty(0,(d)=>i(d)),r.log(`Port ${Ir} is in use (another tapster setup may be open), so this one uses ${o.port}. Password managers save entries per address, so they may not offer the ones saved on ${Ir}.`)}let s=()=>{},a=new Promise((d)=>s=d),c=Lo(r,o.port),l=()=>{clearInterval(u),process.stdin.pause(),o.stop(),s()};i=ry(c,B2(c,l),(d)=>ay(d));let u=setInterval(()=>{if(Date.now()-c.touched>G2)r.log("tapster setup stopped after two hours without use. Run it again to continue; everything you did is on GitHub."),l()},60000),p=()=>{let d=c.link();if(r.log(`
1399
+ ${d}
1400
+ `),n.open)r.open(d)};if(r.log(`tapster setup runs on this computer at http://127.0.0.1:${o.port}. Your keys go from here to your own GitHub account only.`),r.log(n.open?"It opens in your browser now. If it does not, open this link (it works once):":"Open this link in your browser (it works once):"),p(),r.log("Press Enter for a fresh link, for example after closing the tab. Ctrl+C stops tapster setup."),process.stdin.isTTY)process.stdin.setEncoding("utf8"),process.stdin.on("data",(d)=>{if(d.includes(`
1401
+ `))p()}),process.stdin.resume();await a,r.log("tapster setup stopped.")}import{createInterface as J2}from"readline";var F2=z({tag:E().regex(xc),releaseId:bc().int().positive(),checksums:E().regex(/^[0-9a-f]{64}$/),status:Lt(["publishing","published"]),app:z({macos:E().regex(/^[a-z_]+$/),identifiers:ue(E().regex(/^[A-Za-z0-9.-]+$/))}).strict().optional()}).strict(),K2=z({version:_c(1),packages:eo(E().regex(un),ue(F2))}).strict(),W2=()=>({version:1,packages:{}}),Oy=()=>new v(".tapster/state.json is damaged","Restore it from the hub's git history.");function Cy(e){if(e===null)return W2();let t;try{t=JSON.parse(e)}catch{throw Oy()}let n=K2.safeParse(t);if(!n.success)throw Oy();return n.data}function Ry(e){let t=new RegExp("<!-- tapster -->\\s*([\\s\\S]*?)<!-- /tapster -->").exec(e??"")?.[1];return t?t.replace(/^>\s*/,"").replace(/\*\*/g,"").trim():null}function V2(e,t=Date.now()){let n=Date.parse(`${e}T00:00:00Z`);return!Number.isNaN(n)&&n-t<2592000000}function Y2(e,t){if(e.apple.needed)return!0;return t===null?null:t==="yes"}function Iy(e,t,n=Date.now()){let r=Y2(e,t),i=e.protect.checks.filter((a)=>a.ok).length,o=[{id:"protect",name:"Protect the hub",done:e.protect.done,status:e.protect.done?"All protections are on":i?`${i} of ${e.protect.checks.length} protections on`:"Not protected yet",open:"Not protected yet"},{id:"app",name:"Create the GitHub App",done:Boolean(e.app.id&&e.app.slug&&e.app.key),attention:Boolean(e.app.id&&!e.app.key),status:e.app.id&&!e.app.key?"The App's private key is missing":e.app.slug?e.app.slug:"Not created yet",open:"Not created yet"},{id:"macos",name:"macOS or not",done:r===!0,skipped:r===!1,status:r===!0?"Signs macOS software":r===!1?"No macOS builds":"Your answer",open:"Your answer"},{id:"certificate",name:"Apple certificate",done:Boolean(e.apple.certificate&&e.apple.certificateStored),skipped:r===!1,attention:Boolean(e.apple.certificate&&V2(e.apple.certificate.expires,n)),status:r===!1?"Not needed":e.apple.certificate?`Team ${e.apple.certificate.team}, expires ${e.apple.certificate.expires}`:"Not stored yet",open:"Not stored yet"},{id:"notary",name:"Notarization key",done:e.apple.notary,skipped:r===!1,status:r===!1?"Not needed":e.apple.notary?"Stored":"Not stored yet",open:"Not stored yet"},{id:"files",name:"Hub files",done:e.files.config&&e.files.state&&e.files.workflow!=="missing",attention:e.files.workflow==="older"||e.files.workflow==="other",status:e.files.workflow==="missing"?"Not written yet":e.files.workflow==="older"?`Runs ${e.files.pinned}; update available`:e.files.workflow==="other"?`Runs ${e.files.pinned??"a workflow tapster did not write"}; review it`:e.files.workflow==="newer"?`Runs ${e.files.pinned}, newer than this tapster`:`Runs ${e.files.pinned}`,open:"Not written yet"},{id:"project",name:"Your projects",done:e.packages.length>0,status:e.packages.length?`${e.packages.length} in the hub`:"None yet",open:"None yet"}],s=!1;return o.map((a)=>{let c;if(a.skipped)c="skipped";else if(a.attention)c="attention";else if(a.done)c="done";else if(!s)c="now",s=!0;else c="later";return{id:a.id,name:a.name,state:c,status:a.status}})}var Ny=["2025-11-25","2025-06-18","2025-03-26","2024-11-05"],Q2=`tapster turns the user's Homebrew tap into a release hub that signs, notarizes and publishes the releases of their projects.
1402
+ These tools read the hub and the projects through the user's GitHub CLI sign-in and can start a hub run. They cannot set up a hub: creating the GitHub App needs the user's click and the Apple files live on their computer. For setup, tell the user to run "bunx @doguyilmaz/tapster setup", which opens a local page that walks through it. In a project, "bunx @doguyilmaz/tapster add" does the same from a terminal. Docs: https://tapster.doguyilmaz.com/`,_n={hub:E().optional().describe("The hub as owner/homebrew-name. Leave it out to use the hub of the current folder or the user's only hub.")};async function kn(e,t){let n=await e.gh(),r=(await n.json("GET","/user")).login;if(typeof t==="string"&&t)return{gh:n,hub:st(t,r),login:r};let i=(u)=>u&&u.split("/")[0].toLowerCase()===r.toLowerCase()&&/\/homebrew-/.test(u)?u:null,o=i((await $e("git",["-C",e.deps.cwd,"config","--get","tapster.hub"],{allowFail:!0})).stdout.trim());if(o)return{gh:n,hub:st(o,r),login:r};let s=i(await He(e.deps.cwd).catch(()=>null));if(s)return{gh:n,hub:st(s,r),login:r};let a=await hl(n,r),c=a.filter((u)=>u.tapster),l=c.length===1?c[0]:a.length===1?a[0]:null;if(l)return{gh:n,hub:l.name,login:r};throw new v("there is no single hub to read",a.length?`Pass hub as one of: ${a.map((u)=>u.name).join(", ")}.`:"The user has no repository named homebrew-...; they can create one with bunx @doguyilmaz/tapster setup.")}var zy=[{name:"hub_status",title:"Hub setup status",description:"Where the hub's setup stands: each step with its state, the projects it publishes, entries it refuses and the open health issue.",input:z(_n),readOnly:!0,async run(e,t){let{gh:n,hub:r}=await kn(t,e.hub),i=await fl(Lo(t.deps,0),n,r);return{hub:r,steps:Iy(i,null).map((o)=>({step:o.name,state:o.state,status:o.status})),projects:i.packages,refused:i.invalid,healthIssue:i.issue?{url:i.issue.url,updated:i.issue.updated,body:i.issue.body}:null,extras:i.extras}}},{name:"doctor",title:"Check the hub",description:"Run tapster doctor: every setting the hub's security depends on, each with the fix when it fails.",input:z(_n),readOnly:!0,async run(e,t){let{gh:n,hub:r}=await kn(t,e.hub),{checks:i,note:o}=await xr(n,r);return{hub:r,problems:i.filter((s)=>!s.ok),passed:i.filter((s)=>s.ok).map((s)=>s.name),note:o}}},{name:"hub_runs",title:"Recent hub runs",description:"The hub workflow's latest runs with their result and a link to each log.",input:z(_n),readOnly:!0,async run(e,t){let{gh:n,hub:r}=await kn(t,e.hub),i=await n.json("GET",`/repos/${r}/actions/workflows/tapster.yml/runs?per_page=10`);return{hub:r,runs:i.workflow_runs.map((o)=>({started:o.created_at,by:o.event,status:o.status,result:o.conclusion,log:o.html_url}))}}},{name:"release_status",title:"A project's releases",description:"A project's latest releases and drafts, what the hub wrote on a draft it will not publish and what the hub has published.",input:z({..._n,repo:E().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/).describe("The project as owner/name.")}),readOnly:!0,async run(e,t){let{gh:n,hub:r,login:i}=await kn(t,e.hub),o=String(e.repo),s=(await n.listReleases(o)).slice(0,8),a=await de(n,r,"tapster.yml","main"),c=a?ne(a,i).config.packages.find((u)=>u.repo.toLowerCase()===o.toLowerCase()):void 0,l=Cy(await de(n,r,".tapster/state.json","main"));return{hub:r,repo:o,inHub:c?c.name:null,releases:s.map((u)=>({tag:u.tag_name,draft:u.draft,published:u.published_at,files:u.assets.length,hubNote:Ry(u.body)})),publishedByHub:c?(l.packages[c.name]??[]).map((u)=>({tag:u.tag,status:u.status})):[]}}},{name:"local_projects",title:"Projects on this computer",description:"Clones of the user's own repositories on this computer, the kind tapster recognizes and whether the hub publishes them.",input:z(_n),readOnly:!0,async run(e,t){let{gh:n,hub:r,login:i}=await kn(t,e.hub),o=await de(n,r,"tapster.yml","main"),s=new Set(o?ne(o,i).config.packages.map((l)=>l.repo.toLowerCase()):[]),{found:a,truncated:c}=Go(Uo(t.deps.home,t.deps.cwd).filter(Boolean));return{hub:r,projects:a.filter((l)=>l.owner.toLowerCase()===i.toLowerCase()).map((l)=>({repo:l.repo,path:l.path,kind:l.kind,notSupported:l.why,inHub:s.has(l.repo.toLowerCase())})),truncated:c,next:"To add one, the user runs bunx @doguyilmaz/tapster setup (Projects) or bunx @doguyilmaz/tapster add in its folder."}}},{name:"run_hub",title:"Start the hub",description:"Start a hub run now instead of waiting for its schedule. The hub then publishes the drafts that are ready.",input:z(_n),readOnly:!1,async run(e,t){let{gh:n,hub:r}=await kn(t,e.hub);return await n.json("POST",`/repos/${r}/actions/workflows/tapster.yml/dispatches`,{ref:"main"}),{hub:r,started:!0,runs:`https://github.com/${r}/actions/workflows/tapster.yml`}}}],xn=(e,t)=>({jsonrpc:"2.0",id:e,result:t}),Bo=(e,t,n)=>({jsonrpc:"2.0",id:e??null,error:{code:t,message:n}});async function X2(e,t){if(e===null||typeof e!=="object"||Array.isArray(e))return Bo(null,-32600,"invalid request: send one JSON-RPC object per line");if(e.id===void 0||e.id===null)return null;if(e.method==="initialize"){let n=String(e.params?.protocolVersion??"");return xn(e.id,{protocolVersion:Ny.includes(n)?n:Ny[0],capabilities:{tools:{listChanged:!1}},serverInfo:{name:"tapster",title:"tapster",version:se.version},instructions:Q2})}if(e.method==="ping")return xn(e.id,{});if(e.method==="tools/list")return xn(e.id,{tools:zy.map((n)=>({name:n.name,title:n.title,description:n.description,inputSchema:Em(n.input),annotations:{readOnlyHint:n.readOnly,openWorldHint:!0}}))});if(e.method==="tools/call"){let n=zy.find((i)=>i.name===e.params?.name);if(!n)return Bo(e.id,-32602,`unknown tool ${String(e.params?.name)}`);let r=n.input.safeParse(e.params?.arguments??{});if(!r.success)return xn(e.id,{content:[{type:"text",text:`Invalid arguments: ${r.error.issues.map((i)=>`${i.path.join(".")}: ${i.message}`).join("; ")}`}],isError:!0});try{let i=await n.run(r.data,t);return xn(e.id,{content:[{type:"text",text:JSON.stringify(i,null,2)}],structuredContent:i})}catch(i){let o=i instanceof v?`${i.reason}. ${i.fix}`:"tapster hit an unexpected error. Try again; if it repeats, the user can run the same check in a terminal.";return xn(e.id,{content:[{type:"text",text:o}],isError:!0})}}return Bo(e.id,-32601,`unknown method ${String(e.method)}`)}async function eC(e,t=process.stdin,n=(r)=>process.stdout.write(`${r}
1403
+ `)){let r=J2({input:t,crlfDelay:1/0});for await(let i of r){if(!i.trim())continue;let o;try{o=JSON.parse(i)}catch{n(JSON.stringify(Bo(null,-32700,"parse error")));continue}let s=await X2(o,e);if(s)n(JSON.stringify(s))}}async function Dy(e){if(e.length)throw new v(`unknown option ${e.join(" ")}`,"tapster mcp takes no options.");let t={...bl(null),log:(n)=>process.stderr.write(`${n}
1404
+ `)};await eC({deps:t,gh:()=>t.github()})}var tC=`tapster: publish your projects' releases from one Homebrew tap
1405
+
1406
+ tapster setup open the setup in your browser: the hub, your projects and their health
974
1407
  tapster init set up this hub clone; run it again to finish or repair the setup
975
1408
  tapster add prepare this project clone and propose it to the hub
976
1409
  tapster doctor check the hub's setup and name the fix for each finding
1410
+ tapster mcp serve tapster's tools to an AI assistant over MCP (stdio)
977
1411
  tapster --version show this tapster and the commit it pins hubs to
978
1412
 
979
- Run tapster <command> --help for the options: Sparkle and Linux keys, the doorbell, rotations and more.`,Gm={init:`tapster init: set up the hub in this clone; every step can run again and skips what is done
1413
+ Run tapster <command> --help for the options: Sparkle and Linux keys, the doorbell, rotations and more.`,Ly={setup:`tapster setup: set up the hub and add your projects in your browser
1414
+
1415
+ tapster setup [--no-open] [--port <port>] [--tapster <commit>]
1416
+ --no-open print the link instead of opening the browser
1417
+ --port listen on this port instead of ${Ir}
1418
+ --tapster pin the hub workflow to this commit (for a tapster built from a checkout)
1419
+
1420
+ The page runs on this computer only and works until you stop tapster setup with Ctrl+C.`,init:`tapster init: set up the hub in this clone; every step can run again and skips what is done
980
1421
 
981
1422
  tapster init [--every <minutes>] [--tapster <commit>]
982
1423
  tapster init --rotate app|certificate|notary|doorbell|linux
@@ -997,5 +1438,10 @@ Run tapster <command> --help for the options: Sparkle and Linux keys, the doorbe
997
1438
  --allow-dependabot leave branches named dependabot/... open so Dependabot can open pull requests
998
1439
  --force replace an existing release workflow`,doctor:`tapster doctor: check the hub's setup on GitHub and name the command that fixes each finding
999
1440
 
1000
- tapster doctor`},[_e,...St]=process.argv.slice(2);try{if(_e==="--version"||_e==="-v")console.log(`tapster ${nt.version} (${nt.sha?nt.sha.slice(0,12):"built from a checkout; init --workflow needs --tapster <commit>"})`);else if(_e&&Gm[_e]&&(St[0]==="--help"||St[0]==="-h"))console.log(Gm[_e]);else if(_e==="init")await Bm(St);else if(_e==="add")await hm(St);else if(_e==="doctor"){if(St.length)throw new y(`unknown option ${St.join(" ")}`,"tapster doctor takes no options.");process.exitCode=await Fm(St)}else console.log(eT),process.exitCode=_e&&_e!=="help"&&_e!=="--help"?1:0}catch(e){console.error(e instanceof y?`tapster: ${e.reason}
1441
+ tapster doctor`,mcp:`tapster mcp: serve tapster's tools to an AI assistant over MCP, on stdin and stdout
1442
+
1443
+ claude mcp add tapster -- bunx @doguyilmaz/tapster mcp
1444
+
1445
+ The tools read the hub, its runs, a project's releases and the projects on this computer. One of them starts a hub run.
1446
+ They use your GitHub CLI sign-in and never touch your keys.`},[_e,...at]=process.argv.slice(2);try{if(_e==="--version"||_e==="-v")console.log(`tapster ${se.version} (${se.sha?se.sha.slice(0,12):"built from a checkout; init --workflow needs --tapster <commit>"})`);else if(_e&&Ly[_e]&&(at[0]==="--help"||at[0]==="-h"))console.log(Ly[_e]);else if(_e==="setup")await Ey(at);else if(_e==="mcp")await Dy(at);else if(_e==="init")await Vv(at);else if(_e==="add")await _v(at);else if(_e==="doctor"){if(at.length)throw new v(`unknown option ${at.join(" ")}`,"tapster doctor takes no options.");process.exitCode=await Av(at)}else console.log(tC),process.exitCode=_e&&_e!=="help"&&_e!=="--help"?1:0}catch(e){console.error(e instanceof v?`tapster: ${e.reason}
1001
1447
  ${e.fix}`:"tapster: unexpected error"),process.exitCode=1}