nemar-cli 0.10.19-PR1791.d5539a4 → 0.10.19-PR1792.2d9740b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ ${Kn.cursorShow}`)}releaseCursor(){if(this.extraLinesUnderPrompt>0)g$(this.rl,th
|
|
|
81
81
|
${t}`,YNe,JNe,XNe=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,i=KNe.bind(null,n,t.toString());Object.defineProperty(i,"name",JNe);let{writable:o,enumerable:s,configurable:a}=YNe;Object.defineProperty(e,"toString",{value:i,writable:o,enumerable:s,configurable:a})};var y1=N(()=>{YNe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),JNe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name")});var Zy,UU=(e,t={})=>{if(typeof e!=="function")throw TypeError("Expected a function");let r,n=0,i=e.displayName||e.name||"<anonymous>",o=function(...s){if(Zy.set(o,++n),n===1)r=e.apply(this,s),e=void 0;else if(t.throw===!0)throw Error(`Function \`${i}\` can only be called once`);return r};return Pm(o,e),Zy.set(o,n),o},zU;var VU=N(()=>{y1();Zy=new WeakMap;UU.callCount=(e)=>{if(!Zy.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Zy.get(e)};zU=UU});var Bl;var HU=N(()=>{Bl=[];Bl.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")Bl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Bl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});class GU{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(x1[b1])return x1[b1];QNe(x1,b1,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let r=this.listeners[e],n=r.indexOf(t);if(n===-1)return;if(n===0&&r.length===1)r.length=0;else r.splice(n,1)}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let n=!1;for(let i of this.listeners[e])n=i(t,r)===!0||n;if(e==="exit")n=this.emit("afterExit",t,r)||n;return n}}class v1{}var eb=(e)=>!!e&&typeof e==="object"&&typeof e.removeListener==="function"&&typeof e.emit==="function"&&typeof e.reallyExit==="function"&&typeof e.listeners==="function"&&typeof e.kill==="function"&&typeof e.pid==="number"&&typeof e.on==="function",b1,x1,QNe,ZNe=(e)=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),WU,KU,w1,YU,g_t,y_t;var JU=N(()=>{HU();b1=Symbol.for("signal-exit emitter"),x1=globalThis,QNe=Object.defineProperty.bind(Object);WU=class WU extends v1{onExit(){return()=>{}}load(){}unload(){}};KU=class KU extends v1{#r=w1.platform==="win32"?"SIGINT":"SIGHUP";#t=new GU;#e;#i;#f;#n={};#s=!1;constructor(e){super();this.#e=e,this.#n={};for(let t of Bl)this.#n[t]=()=>{let r=this.#e.listeners(t),{count:n}=this.#t,i=e;if(typeof i.__signal_exit_emitter__==="object"&&typeof i.__signal_exit_emitter__.count==="number")n+=i.__signal_exit_emitter__.count;if(r.length===n){this.unload();let o=this.#t.emit("exit",null,t),s=t==="SIGHUP"?this.#r:t;if(!o)e.kill(e.pid,s)}};this.#f=e.reallyExit,this.#i=e.emit}onExit(e,t){if(!eb(this.#e))return()=>{};if(this.#s===!1)this.load();let r=t?.alwaysLast?"afterExit":"exit";return this.#t.on(r,e),()=>{if(this.#t.removeListener(r,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0)this.unload()}}load(){if(this.#s)return;this.#s=!0,this.#t.count+=1;for(let e of Bl)try{let t=this.#n[e];if(t)this.#e.on(e,t)}catch(t){}this.#e.emit=(e,...t)=>this.#p(e,...t),this.#e.reallyExit=(e)=>this.#o(e)}unload(){if(!this.#s)return;this.#s=!1,Bl.forEach((e)=>{let t=this.#n[e];if(!t)throw Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,t)}catch(r){}}),this.#e.emit=this.#i,this.#e.reallyExit=this.#f,this.#t.count-=1}#o(e){if(!eb(this.#e))return 0;return this.#e.exitCode=e||0,this.#t.emit("exit",this.#e.exitCode,null),this.#f.call(this.#e,this.#e.exitCode)}#p(e,...t){let r=this.#i;if(e==="exit"&&eb(this.#e)){if(typeof t[0]==="number")this.#e.exitCode=t[0];let n=r.call(this.#e,e,...t);return this.#t.emit("exit",this.#e.exitCode,null),n}else return r.call(this.#e,e,...t)}};w1=globalThis.process,{onExit:YU,load:g_t,unload:y_t}=ZNe(eb(w1)?new KU(w1):new WU)});import tb from"process";var XU,e3e,QU;var ZU=N(()=>{VU();JU();XU=tb.stderr.isTTY?tb.stderr:tb.stdout.isTTY?tb.stdout:void 0,e3e=XU?zU(()=>{YU(()=>{XU.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},QU=e3e});import ez from"process";var rb=!1,Md,_1;var tz=N(()=>{ZU();Md={};Md.show=(e=ez.stderr)=>{if(!e.isTTY)return;rb=!1,e.write("\x1B[?25h")};Md.hide=(e=ez.stderr)=>{if(!e.isTTY)return;QU(),rb=!0,e.write("\x1B[?25l")};Md.toggle=(e,t)=>{if(e!==void 0)rb=e;if(rb)Md.show(t);else Md.hide(t)};_1=Md});import Zi from"process";function D1(){if(Zi.platform!=="win32")return Zi.env.TERM!=="linux";return Boolean(Zi.env.CI)||Boolean(Zi.env.WT_SESSION)||Boolean(Zi.env.TERMINUS_SUBLIME)||Zi.env.ConEmuTask==="{cmd::Cmder}"||Zi.env.TERM_PROGRAM==="Terminus-Sublime"||Zi.env.TERM_PROGRAM==="vscode"||Zi.env.TERM==="xterm-256color"||Zi.env.TERM==="alacritty"||Zi.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var rz=()=>{};var t3e,r3e,n3e,Im;var nz=N(()=>{Ne();rz();t3e={info:l.blue("\u2139"),success:l.green("\u2714"),warning:l.yellow("\u26A0"),error:l.red("\u2716")},r3e={info:l.blue("i"),success:l.green("\u221A"),warning:l.yellow("\u203C"),error:l.red("\xD7")},n3e=D1()?t3e:r3e,Im=n3e});function E1({onlyFirst:e=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")}function Fm(e){if(typeof e!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(i3e,"")}var i3e;var S1=N(()=>{i3e=E1()});function iz(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function oz(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function sz(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||e===129736||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}var az=()=>{};function o3e(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function cz(e,{ambiguousAsWide:t=!1}={}){if(o3e(e),oz(e)||sz(e)||t&&iz(e))return 2;return 1}var lz=N(()=>{az()});var uz=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function $1(e,t={}){if(typeof e!=="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(!n)e=Fm(e);if(e.length===0)return 0;let i=0,o={ambiguousAsWide:!r};for(let{segment:s}of s3e.segment(e)){let a=s.codePointAt(0);if(a<=31||a>=127&&a<=159)continue;if(a>=8203&&a<=8207||a===65279)continue;if(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)continue;if(a>=55296&&a<=57343)continue;if(a>=65024&&a<=65039)continue;if(a3e.test(s))continue;if(uz().test(s)){i+=2;continue}i+=cz(a,o)}return i}var s3e,a3e;var dz=N(()=>{S1();lz();s3e=new Intl.Segmenter,a3e=/^\p{Default_Ignorable_Code_Point}$/u});function k1({stream:e=process.stdout}={}){return Boolean(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import fz from"process";function R1(){let{env:e}=fz,{TERM:t,TERM_PROGRAM:r}=e;if(fz.platform!=="win32")return t!=="linux";return Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var pz=()=>{};import Oo from"process";class mz{#r=0;start(){if(this.#r++,this.#r===1)this.#t()}stop(){if(this.#r<=0)throw Error("`stop` called more times than `start`");if(this.#r--,this.#r===0)this.#e()}#t(){if(Oo.platform==="win32"||!Oo.stdin.isTTY)return;Oo.stdin.setRawMode(!0),Oo.stdin.on("data",this.#i),Oo.stdin.resume()}#e(){if(!Oo.stdin.isTTY)return;Oo.stdin.off("data",this.#i),Oo.stdin.pause(),Oo.stdin.setRawMode(!1)}#i(e){if(e[0]===c3e)Oo.emit("SIGINT")}}var c3e=3,l3e,C1;var hz=N(()=>{l3e=new mz,C1=l3e});import nb from"process";class gz{#r=0;#t=!1;#e=0;#i=-1;#f=0;#n;#s;#o;#p;#h;#l;#u;#d;#g;#a;#c;color;constructor(e){if(typeof e==="string")e={text:e};if(this.#n={color:"cyan",stream:nb.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#n.color,this.spinner=this.#n.spinner,this.#h=this.#n.interval,this.#o=this.#n.stream,this.#l=typeof this.#n.isEnabled==="boolean"?this.#n.isEnabled:k1({stream:this.#o}),this.#u=typeof this.#n.isSilent==="boolean"?this.#n.isSilent:!1,this.text=this.#n.text,this.prefixText=this.#n.prefixText,this.suffixText=this.#n.suffixText,this.indent=this.#n.indent,nb.env.NODE_ENV==="test")this._stream=this.#o,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#r},set(t){this.#r=t}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#i}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}})}get indent(){return this.#d}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw Error("The `indent` option must be an integer from 0 and up");this.#d=e,this.#m()}get interval(){return this.#h??this.#s.interval??100}get spinner(){return this.#s}set spinner(e){if(this.#i=-1,this.#h=void 0,typeof e==="object"){if(e.frames===void 0)throw Error("The given spinner must have a `frames` property");this.#s=e}else if(!R1())this.#s=Nm.default.line;else if(e===void 0)this.#s=Nm.default.dots;else if(e!=="default"&&Nm.default[e])this.#s=Nm.default[e];else throw Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#g}set text(e=""){this.#g=e,this.#m()}get prefixText(){return this.#a}set prefixText(e=""){this.#a=e,this.#m()}get suffixText(){return this.#c}set suffixText(e=""){this.#c=e,this.#m()}get isSpinning(){return this.#p!==void 0}#y(e=this.#a,t=" "){if(typeof e==="string"&&e!=="")return e+t;if(typeof e==="function")return e()+t;return""}#b(e=this.#c,t=" "){if(typeof e==="string"&&e!=="")return t+e;if(typeof e==="function")return t+e();return""}#m(){let e=this.#o.columns??80,t=this.#y(this.#a,"-"),r=this.#b(this.#c,"-"),n=" ".repeat(this.#d)+t+"--"+this.#g+"--"+r;this.#e=0;for(let i of Fm(n).split(`
|
|
82
82
|
`))this.#e+=Math.max(1,Math.ceil($1(i,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#l&&!this.#u}set isEnabled(e){if(typeof e!=="boolean")throw TypeError("The `isEnabled` option must be a boolean");this.#l=e}get isSilent(){return this.#u}set isSilent(e){if(typeof e!=="boolean")throw TypeError("The `isSilent` option must be a boolean");this.#u=e}frame(){let e=Date.now();if(this.#i===-1||e-this.#f>=this.interval)this.#i=++this.#i%this.#s.frames.length,this.#f=e;let{frames:t}=this.#s,r=t[this.#i];if(this.color)r=l[this.color](r);let n=typeof this.#a==="string"&&this.#a!==""?this.#a+" ":"",i=typeof this.text==="string"?" "+this.text:"",o=typeof this.#c==="string"&&this.#c!==""?" "+this.#c:"";return n+r+i+o}clear(){if(!this.#l||!this.#o.isTTY)return this;this.#o.cursorTo(0);for(let e=0;e<this.#r;e++){if(e>0)this.#o.moveCursor(0,-1);this.#o.clearLine(1)}if(this.#d||this.lastIndent!==this.#d)this.#o.cursorTo(this.#d);return this.lastIndent=this.#d,this.#r=0,this}render(){if(this.#u)return this;return this.clear(),this.#o.write(this.frame()),this.#r=this.#e,this}start(e){if(e)this.text=e;if(this.#u)return this;if(!this.#l){if(this.text)this.#o.write(`- ${this.text}
|
|
83
83
|
`);return this}if(this.isSpinning)return this;if(this.#n.hideCursor)_1.hide(this.#o);if(this.#n.discardStdin&&nb.stdin.isTTY)this.#t=!0,C1.start();return this.render(),this.#p=setInterval(this.render.bind(this),this.interval),this}stop(){if(!this.#l)return this;if(clearInterval(this.#p),this.#p=void 0,this.#i=0,this.clear(),this.#n.hideCursor)_1.show(this.#o);if(this.#n.discardStdin&&nb.stdin.isTTY&&this.#t)C1.stop(),this.#t=!1;return this}succeed(e){return this.stopAndPersist({symbol:Im.success,text:e})}fail(e){return this.stopAndPersist({symbol:Im.error,text:e})}warn(e){return this.stopAndPersist({symbol:Im.warning,text:e})}info(e){return this.stopAndPersist({symbol:Im.info,text:e})}stopAndPersist(e={}){if(this.#u)return this;let t=e.prefixText??this.#a,r=this.#y(t," "),n=e.symbol??" ",i=e.text??this.text,s=typeof i==="string"?(n?" ":"")+i:"",a=e.suffixText??this.#c,c=this.#b(a," "),u=r+n+s+c+`
|
|
84
|
-
`;return this.stop(),this.#o.write(u),this}}function S(e){return new gz(e)}var Nm,u3e;var on=N(()=>{Ne();tz();nz();S1();dz();pz();hz();Nm=Be(Q0(),1),u3e=Be(Q0(),1)});var at,xz,oe,Vs=(e)=>{switch(typeof e){case"undefined":return oe.undefined;case"string":return oe.string;case"number":return Number.isNaN(e)?oe.nan:oe.number;case"boolean":return oe.boolean;case"function":return oe.function;case"bigint":return oe.bigint;case"symbol":return oe.symbol;case"object":if(Array.isArray(e))return oe.array;if(e===null)return oe.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return oe.promise;if(typeof Map<"u"&&e instanceof Map)return oe.map;if(typeof Set<"u"&&e instanceof Set)return oe.set;if(typeof Date<"u"&&e instanceof Date)return oe.date;return oe.object;default:return oe.unknown}};var jm=N(()=>{(function(e){e.assertEqual=(i)=>{};function t(i){}e.assertIs=t;function r(i){throw Error()}e.assertNever=r,e.arrayToEnum=(i)=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=(i)=>{let o=e.objectKeys(i).filter((a)=>typeof i[i[a]]!=="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=(i)=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys==="function"?(i)=>Object.keys(i):(i)=>{let o=[];for(let s in i)if(Object.prototype.hasOwnProperty.call(i,s))o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(i)=>Number.isInteger(i):(i)=>typeof i==="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map((s)=>typeof s==="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>{if(typeof o==="bigint")return o.toString();return o}})(at||(at={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(xz||(xz={}));oe=at.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var W,Zn;var ib=N(()=>{jm();W=at.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);Zn=class Zn extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},r={_errors:[]},n=(i)=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let s=r,a=0;while(a<o.path.length){let c=o.path[a];if(a!==o.path.length-1)s[c]=s[c]||{_errors:[]};else s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o));s=s[c],a++}}};return n(this),r}static assert(e){if(!(e instanceof Zn))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,at.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];t[i]=t[i]||[],t[i].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};Zn.create=(e)=>new Zn(e)});var d3e=(e,t)=>{let r;switch(e.code){case W.invalid_type:if(e.received===oe.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,at.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:r=`Unrecognized key(s) in object: ${at.joinValues(e.keys,", ")}`;break;case W.invalid_union:r="Invalid input";break;case W.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${at.joinValues(e.options)}`;break;case W.invalid_enum_value:r=`Invalid enum value. Expected ${at.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:r="Invalid function arguments";break;case W.invalid_return_type:r="Invalid function return type";break;case W.invalid_date:r="Invalid date";break;case W.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else at.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case W.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case W.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case W.custom:r="Invalid input";break;case W.invalid_intersection_types:r="Intersection results could not be merged";break;case W.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:r="Number must be finite";break;default:r=t.defaultError,at.assertNever(e)}return{message:r}},rc;var A1=N(()=>{ib();jm();rc=d3e});function Mm(){return f3e}var f3e;var ob=N(()=>{A1();f3e=rc});function te(e,t){let r=Mm(),n=sb({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===rc?void 0:rc].filter((i)=>!!i)});e.common.issues.push(n)}class sn{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return Oe;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let i=await n.key,o=await n.value;r.push({key:i,value:o})}return sn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:i,value:o}=n;if(i.status==="aborted")return Oe;if(o.status==="aborted")return Oe;if(i.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet))r[i.value]=o.value}return{status:e.value,value:r}}}var sb=(e)=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},Oe,qd=(e)=>({status:"dirty",value:e}),wn=(e)=>({status:"valid",value:e}),O1=(e)=>e.status==="aborted",T1=(e)=>e.status==="dirty",Ul=(e)=>e.status==="valid",qm=(e)=>typeof Promise<"u"&&e instanceof Promise;var P1=N(()=>{ob();A1();Oe=Object.freeze({status:"aborted"})});var wz=()=>{};var xe;var vz=N(()=>{(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(xe||(xe={}))});class eo{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function We(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:i};return{errorMap:(s,a)=>{let{message:c}=e;if(s.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??n??a.defaultError};if(s.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:i}}class it{get description(){return this._def.description}_getType(e){return Vs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Vs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sn,ctx:{common:e.parent.common,data:e.data,parsedType:Vs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(qm(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vs(e)},n=this._parseSync({data:e,path:r.path,parent:r});return _z(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vs(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ul(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Ul(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vs(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(qm(n)?n:Promise.resolve(n));return _z(r,i)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,i)=>{let o=e(n),s=()=>i.addIssue({code:W.custom,...r(n)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((a)=>{if(!a)return s(),!1;else return!0});if(!o)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new Io({schema:this,typeName:Te.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return Po.create(this,this._def)}nullable(){return nc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return To.create(this)}promise(){return Vd.create(this,this._def)}or(e){return Vm.create([this,e],this._def)}and(e){return Hm.create(this,e,this._def)}transform(e){return new Io({...We(this._def),schema:this,typeName:Te.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Ym({...We(this._def),innerType:this,defaultValue:t,typeName:Te.ZodDefault})}brand(){return new j1({typeName:Te.ZodBranded,type:this,...We(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Jm({...We(this._def),innerType:this,catchValue:t,typeName:Te.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return mb.create(this,e)}readonly(){return Xm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Ez(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function C3e(e){return new RegExp(`^${Ez(e)}$`)}function A3e(e){let t=`${Dz}T${Ez(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function O3e(e,t){if((t==="v4"||!t)&&_3e.test(e))return!0;if((t==="v6"||!t)&&E3e.test(e))return!0;return!1}function T3e(e,t){if(!b3e.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if(typeof i!=="object"||i===null)return!1;if("typ"in i&&i?.typ!=="JWT")return!1;if(!i.alg)return!1;if(t&&i.alg!==t)return!1;return!0}catch{return!1}}function P3e(e,t){if((t==="v4"||!t)&&D3e.test(e))return!0;if((t==="v6"||!t)&&S3e.test(e))return!0;return!1}function I3e(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}function Ld(e){if(e instanceof nr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Po.create(Ld(n))}return new nr({...e._def,shape:()=>t})}else if(e instanceof To)return new To({...e._def,type:Ld(e.element)});else if(e instanceof Po)return Po.create(Ld(e.unwrap()));else if(e instanceof nc)return nc.create(Ld(e.unwrap()));else if(e instanceof Ks)return Ks.create(e.items.map((t)=>Ld(t)));else return e}function F1(e,t){let r=Vs(e),n=Vs(t);if(e===t)return{valid:!0,data:e};else if(r===oe.object&&n===oe.object){let i=at.objectKeys(t),o=at.objectKeys(e).filter((a)=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=F1(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===oe.array&&n===oe.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=F1(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else if(r===oe.date&&n===oe.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}function Sz(e,t){return new Vl({values:e,typeName:Te.ZodEnum,...We(t)})}var _z=(e,t)=>{if(Ul(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Zn(e.common.issues);return this._error=r,this._error}}}},p3e,m3e,h3e,g3e,y3e,b3e,x3e,w3e,v3e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",I1,_3e,D3e,E3e,S3e,$3e,k3e,Dz="((\\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])))",R3e,Gs,Bd,Ud,ab,Bm,cb,Um,zm,lb,zl,Ws,ub,To,nr,Vm,Hs=(e)=>{if(e instanceof Gm)return Hs(e.schema);else if(e instanceof Io)return Hs(e.innerType());else if(e instanceof Wm)return[e.value];else if(e instanceof Vl)return e.options;else if(e instanceof Km)return at.objectValues(e.enum);else if(e instanceof Ym)return Hs(e._def.innerType);else if(e instanceof Um)return[void 0];else if(e instanceof zm)return[null];else if(e instanceof Po)return[void 0,...Hs(e.unwrap())];else if(e instanceof nc)return[null,...Hs(e.unwrap())];else if(e instanceof j1)return Hs(e.unwrap());else if(e instanceof Xm)return Hs(e.unwrap());else if(e instanceof Jm)return Hs(e._def.innerType);else return[]},N1,Hm,Ks,db,fb,zd,Lm,Gm,Wm,Vl,Km,Vd,Io,Po,nc,Ym,Jm,pb,_Dt,j1,mb,Xm,DDt,Te,_,C,EDt,SDt,Le,$Dt,kDt,RDt,CDt,ADt,ic,ODt,TDt,le,Y,PDt,Hd,M1,IDt,FDt,wi,NDt,jDt,MDt,qDt,ut,bt,LDt,BDt,UDt,zDt,VDt,HDt,GDt;var $z=N(()=>{ib();ob();vz();P1();jm();p3e=/^c[^\s-]{8,}$/i,m3e=/^[0-9a-z]+$/,h3e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,g3e=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,y3e=/^[a-z0-9_-]{21}$/i,b3e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,x3e=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,w3e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_3e=/^(?:(?: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])$/,D3e=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,E3e=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,S3e=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$3e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,k3e=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,R3e=new RegExp(`^${Dz}$`);Gs=class Gs extends it{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==oe.string){let i=this._getOrReturnCtx(e);return te(i,{code:W.invalid_type,expected:oe.string,received:i.parsedType}),Oe}let r=new sn,n=void 0;for(let i of this._def.checks)if(i.kind==="min"){if(e.data.length<i.value)n=this._getOrReturnCtx(e,n),te(n,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty()}else if(i.kind==="max"){if(e.data.length>i.value)n=this._getOrReturnCtx(e,n),te(n,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty()}else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;if(o||s){if(n=this._getOrReturnCtx(e,n),o)te(n,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message});else if(s)te(n,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message});r.dirty()}}else if(i.kind==="email"){if(!w3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"email",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="emoji"){if(!I1)I1=new RegExp(v3e,"u");if(!I1.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"emoji",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="uuid"){if(!g3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"uuid",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="nanoid"){if(!y3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"nanoid",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cuid"){if(!p3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"cuid",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cuid2"){if(!m3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"cuid2",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="ulid"){if(!h3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"ulid",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),te(n,{validation:"url",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="regex"){if(i.regex.lastIndex=0,!i.regex.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"regex",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="trim")e.data=e.data.trim();else if(i.kind==="includes"){if(!e.data.includes(i.value,i.position))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()}else if(i.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(i.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(i.kind==="startsWith"){if(!e.data.startsWith(i.value))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()}else if(i.kind==="endsWith"){if(!e.data.endsWith(i.value))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()}else if(i.kind==="datetime"){if(!A3e(i).test(e.data))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:"datetime",message:i.message}),r.dirty()}else if(i.kind==="date"){if(!R3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:"date",message:i.message}),r.dirty()}else if(i.kind==="time"){if(!C3e(i).test(e.data))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:"time",message:i.message}),r.dirty()}else if(i.kind==="duration"){if(!x3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"duration",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="ip"){if(!O3e(e.data,i.version))n=this._getOrReturnCtx(e,n),te(n,{validation:"ip",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="jwt"){if(!T3e(e.data,i.alg))n=this._getOrReturnCtx(e,n),te(n,{validation:"jwt",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cidr"){if(!P3e(e.data,i.version))n=this._getOrReturnCtx(e,n),te(n,{validation:"cidr",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="base64"){if(!$3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"base64",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="base64url"){if(!k3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"base64url",code:W.invalid_string,message:i.message}),r.dirty()}else at.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:W.invalid_string,...xe.errToObj(r)})}_addCheck(e){return new Gs({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...xe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...xe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...xe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...xe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...xe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...xe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...xe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...xe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...xe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...xe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...xe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...xe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...xe.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...xe.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...xe.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...xe.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...xe.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...xe.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...xe.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...xe.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...xe.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...xe.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...xe.errToObj(t)})}nonempty(e){return this.min(1,xe.errToObj(e))}trim(){return new Gs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Gs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Gs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}};Gs.create=(e)=>new Gs({checks:[],typeName:Te.ZodString,coerce:e?.coerce??!1,...We(e)});Bd=class Bd extends it{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==oe.number){let i=this._getOrReturnCtx(e);return te(i,{code:W.invalid_type,expected:oe.number,received:i.parsedType}),Oe}let r=void 0,n=new sn;for(let i of this._def.checks)if(i.kind==="int"){if(!at.isInteger(e.data))r=this._getOrReturnCtx(e,r),te(r,{code:W.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()}else if(i.kind==="min"){if(i.inclusive?e.data<i.value:e.data<=i.value)r=this._getOrReturnCtx(e,r),te(r,{code:W.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()}else if(i.kind==="max"){if(i.inclusive?e.data>i.value:e.data>=i.value)r=this._getOrReturnCtx(e,r),te(r,{code:W.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()}else if(i.kind==="multipleOf"){if(I3e(e.data,i.value)!==0)r=this._getOrReturnCtx(e,r),te(r,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()}else if(i.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),te(r,{code:W.not_finite,message:i.message}),n.dirty()}else at.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,xe.toString(t))}gt(e,t){return this.setLimit("min",e,!1,xe.toString(t))}lte(e,t){return this.setLimit("max",e,!0,xe.toString(t))}lt(e,t){return this.setLimit("max",e,!1,xe.toString(t))}setLimit(e,t,r,n){return new Bd({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:xe.toString(n)}]})}_addCheck(e){return new Bd({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:xe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xe.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:xe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xe.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&at.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}};Bd.create=(e)=>new Bd({checks:[],typeName:Te.ZodNumber,coerce:e?.coerce||!1,...We(e)});Ud=class Ud extends it{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==oe.bigint)return this._getInvalidInput(e);let r=void 0,n=new sn;for(let i of this._def.checks)if(i.kind==="min"){if(i.inclusive?e.data<i.value:e.data<=i.value)r=this._getOrReturnCtx(e,r),te(r,{code:W.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()}else if(i.kind==="max"){if(i.inclusive?e.data>i.value:e.data>=i.value)r=this._getOrReturnCtx(e,r),te(r,{code:W.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()}else if(i.kind==="multipleOf"){if(e.data%i.value!==BigInt(0))r=this._getOrReturnCtx(e,r),te(r,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()}else at.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return te(t,{code:W.invalid_type,expected:oe.bigint,received:t.parsedType}),Oe}gte(e,t){return this.setLimit("min",e,!0,xe.toString(t))}gt(e,t){return this.setLimit("min",e,!1,xe.toString(t))}lte(e,t){return this.setLimit("max",e,!0,xe.toString(t))}lt(e,t){return this.setLimit("max",e,!1,xe.toString(t))}setLimit(e,t,r,n){return new Ud({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:xe.toString(n)}]})}_addCheck(e){return new Ud({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}};Ud.create=(e)=>new Ud({checks:[],typeName:Te.ZodBigInt,coerce:e?.coerce??!1,...We(e)});ab=class ab extends it{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==oe.boolean){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.boolean,received:r.parsedType}),Oe}return wn(e.data)}};ab.create=(e)=>new ab({typeName:Te.ZodBoolean,coerce:e?.coerce||!1,...We(e)});Bm=class Bm extends it{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==oe.date){let i=this._getOrReturnCtx(e);return te(i,{code:W.invalid_type,expected:oe.date,received:i.parsedType}),Oe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return te(i,{code:W.invalid_date}),Oe}let r=new sn,n=void 0;for(let i of this._def.checks)if(i.kind==="min"){if(e.data.getTime()<i.value)n=this._getOrReturnCtx(e,n),te(n,{code:W.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()}else if(i.kind==="max"){if(e.data.getTime()>i.value)n=this._getOrReturnCtx(e,n),te(n,{code:W.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()}else at.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Bm({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:xe.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:xe.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}};Bm.create=(e)=>new Bm({checks:[],coerce:e?.coerce||!1,typeName:Te.ZodDate,...We(e)});cb=class cb extends it{_parse(e){if(this._getType(e)!==oe.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.symbol,received:r.parsedType}),Oe}return wn(e.data)}};cb.create=(e)=>new cb({typeName:Te.ZodSymbol,...We(e)});Um=class Um extends it{_parse(e){if(this._getType(e)!==oe.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.undefined,received:r.parsedType}),Oe}return wn(e.data)}};Um.create=(e)=>new Um({typeName:Te.ZodUndefined,...We(e)});zm=class zm extends it{_parse(e){if(this._getType(e)!==oe.null){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.null,received:r.parsedType}),Oe}return wn(e.data)}};zm.create=(e)=>new zm({typeName:Te.ZodNull,...We(e)});lb=class lb extends it{constructor(){super(...arguments);this._any=!0}_parse(e){return wn(e.data)}};lb.create=(e)=>new lb({typeName:Te.ZodAny,...We(e)});zl=class zl extends it{constructor(){super(...arguments);this._unknown=!0}_parse(e){return wn(e.data)}};zl.create=(e)=>new zl({typeName:Te.ZodUnknown,...We(e)});Ws=class Ws extends it{_parse(e){let t=this._getOrReturnCtx(e);return te(t,{code:W.invalid_type,expected:oe.never,received:t.parsedType}),Oe}};Ws.create=(e)=>new Ws({typeName:Te.ZodNever,...We(e)});ub=class ub extends it{_parse(e){if(this._getType(e)!==oe.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.void,received:r.parsedType}),Oe}return wn(e.data)}};ub.create=(e)=>new ub({typeName:Te.ZodVoid,...We(e)});To=class To extends it{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==oe.array)return te(t,{code:W.invalid_type,expected:oe.array,received:t.parsedType}),Oe;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;if(o||s)te(t,{code:o?W.too_big:W.too_small,minimum:s?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)te(t,{code:W.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)te(t,{code:W.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,s)=>n.type._parseAsync(new eo(t,o,t.path,s)))).then((o)=>sn.mergeArray(r,o));let i=[...t.data].map((o,s)=>n.type._parseSync(new eo(t,o,t.path,s)));return sn.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new To({...this._def,minLength:{value:e,message:xe.toString(t)}})}max(e,t){return new To({...this._def,maxLength:{value:e,message:xe.toString(t)}})}length(e,t){return new To({...this._def,exactLength:{value:e,message:xe.toString(t)}})}nonempty(e){return this.min(1,e)}};To.create=(e,t)=>new To({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Te.ZodArray,...We(t)});nr=class nr extends it{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=at.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==oe.object){let c=this._getOrReturnCtx(e);return te(c,{code:W.invalid_type,expected:oe.object,received:c.parsedType}),Oe}let{status:r,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ws&&this._def.unknownKeys==="strip")){for(let c in n.data)if(!o.includes(c))s.push(c)}let a=[];for(let c of o){let u=i[c],d=n.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new eo(n,d,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Ws){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict"){if(s.length>0)te(n,{code:W.unrecognized_keys,keys:s}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=n.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new eo(n,d,n.path,u)),alwaysSet:u in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then((c)=>sn.mergeObjectSync(r,c));else return sn.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return xe.errToObj,new nr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:xe.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new nr({...this._def,unknownKeys:"strip"})}passthrough(){return new nr({...this._def,unknownKeys:"passthrough"})}extend(e){return new nr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new nr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Te.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new nr({...this._def,catchall:e})}pick(e){let t={};for(let r of at.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new nr({...this._def,shape:()=>t})}omit(e){let t={};for(let r of at.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new nr({...this._def,shape:()=>t})}deepPartial(){return Ld(this)}partial(e){let t={};for(let r of at.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new nr({...this._def,shape:()=>t})}required(e){let t={};for(let r of at.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];while(i instanceof Po)i=i._def.innerType;t[r]=i}return new nr({...this._def,shape:()=>t})}keyof(){return Sz(at.objectKeys(this.shape))}};nr.create=(e,t)=>new nr({shape:()=>e,unknownKeys:"strip",catchall:Ws.create(),typeName:Te.ZodObject,...We(t)});nr.strictCreate=(e,t)=>new nr({shape:()=>e,unknownKeys:"strict",catchall:Ws.create(),typeName:Te.ZodObject,...We(t)});nr.lazycreate=(e,t)=>new nr({shape:e,unknownKeys:"strip",catchall:Ws.create(),typeName:Te.ZodObject,...We(t)});Vm=class Vm extends it{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map((s)=>new Zn(s.ctx.common.issues));return te(t,{code:W.invalid_union,unionErrors:o}),Oe}if(t.common.async)return Promise.all(r.map(async(i)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);else{let i=void 0,o=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!i)i={result:u,ctx:c};if(c.common.issues.length)o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map((a)=>new Zn(a));return te(t,{code:W.invalid_union,unionErrors:s}),Oe}}get options(){return this._def.options}};Vm.create=(e,t)=>new Vm({options:e,typeName:Te.ZodUnion,...We(t)});N1=class N1 extends it{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==oe.object)return te(t,{code:W.invalid_type,expected:oe.object,received:t.parsedType}),Oe;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);if(!i)return te(t,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Oe;if(t.common.async)return i._parseAsync({data:t.data,path:t.path,parent:t});else return i._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let i of t){let o=Hs(i.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(n.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,i)}}return new N1({typeName:Te.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...We(r)})}};Hm=class Hm extends it{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(i,o)=>{if(O1(i)||O1(o))return Oe;let s=F1(i.value,o.value);if(!s.valid)return te(r,{code:W.invalid_intersection_types}),Oe;if(T1(i)||T1(o))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>n(i,o));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Hm.create=(e,t,r)=>new Hm({left:e,right:t,typeName:Te.ZodIntersection,...We(r)});Ks=class Ks extends it{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==oe.array)return te(r,{code:W.invalid_type,expected:oe.array,received:r.parsedType}),Oe;if(r.data.length<this._def.items.length)return te(r,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe;if(!this._def.rest&&r.data.length>this._def.items.length)te(r,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let i=[...r.data].map((o,s)=>{let a=this._def.items[s]||this._def.rest;if(!a)return null;return a._parse(new eo(r,o,r.path,s))}).filter((o)=>!!o);if(r.common.async)return Promise.all(i).then((o)=>sn.mergeArray(t,o));else return sn.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new Ks({...this._def,rest:e})}};Ks.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ks({items:e,typeName:Te.ZodTuple,rest:null,...We(t)})};db=class db extends it{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==oe.object)return te(r,{code:W.invalid_type,expected:oe.object,received:r.parsedType}),Oe;let n=[],i=this._def.keyType,o=this._def.valueType;for(let s in r.data)n.push({key:i._parse(new eo(r,s,r.path,s)),value:o._parse(new eo(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return sn.mergeObjectAsync(t,n);else return sn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof it)return new db({keyType:e,valueType:t,typeName:Te.ZodRecord,...We(r)});return new db({keyType:Gs.create(),valueType:e,typeName:Te.ZodRecord,...We(t)})}};fb=class fb extends it{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==oe.map)return te(r,{code:W.invalid_type,expected:oe.map,received:r.parsedType}),Oe;let n=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([s,a],c)=>({key:n._parse(new eo(r,s,r.path,[c,"key"])),value:i._parse(new eo(r,a,r.path,[c,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let a of o){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return Oe;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let a of o){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return Oe;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}}}};fb.create=(e,t,r)=>new fb({valueType:t,keyType:e,typeName:Te.ZodMap,...We(r)});zd=class zd extends it{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==oe.set)return te(r,{code:W.invalid_type,expected:oe.set,received:r.parsedType}),Oe;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)te(r,{code:W.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)te(r,{code:W.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let i=this._def.valueType;function o(a){let c=new Set;for(let u of a){if(u.status==="aborted")return Oe;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let s=[...r.data.values()].map((a,c)=>i._parse(new eo(r,a,r.path,c)));if(r.common.async)return Promise.all(s).then((a)=>o(a));else return o(s)}min(e,t){return new zd({...this._def,minSize:{value:e,message:xe.toString(t)}})}max(e,t){return new zd({...this._def,maxSize:{value:e,message:xe.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};zd.create=(e,t)=>new zd({valueType:e,minSize:null,maxSize:null,typeName:Te.ZodSet,...We(t)});Lm=class Lm extends it{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==oe.function)return te(t,{code:W.invalid_type,expected:oe.function,received:t.parsedType}),Oe;function r(s,a){return sb({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mm(),rc].filter((c)=>!!c),issueData:{code:W.invalid_arguments,argumentsError:a}})}function n(s,a){return sb({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mm(),rc].filter((c)=>!!c),issueData:{code:W.invalid_return_type,returnTypeError:a}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Vd){let s=this;return wn(async function(...a){let c=new Zn([]),u=await s._def.args.parseAsync(a,i).catch((p)=>{throw c.addIssue(r(a,p)),c}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,i).catch((p)=>{throw c.addIssue(n(d,p)),c})})}else{let s=this;return wn(function(...a){let c=s._def.args.safeParse(a,i);if(!c.success)throw new Zn([r(a,c.error)]);let u=Reflect.apply(o,this,c.data),d=s._def.returns.safeParse(u,i);if(!d.success)throw new Zn([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Lm({...this._def,args:Ks.create(e).rest(zl.create())})}returns(e){return new Lm({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Lm({args:e?e:Ks.create([]).rest(zl.create()),returns:t||zl.create(),typeName:Te.ZodFunction,...We(r)})}};Gm=class Gm extends it{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Gm.create=(e,t)=>new Gm({getter:e,typeName:Te.ZodLazy,...We(t)});Wm=class Wm extends it{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return te(t,{received:t.data,code:W.invalid_literal,expected:this._def.value}),Oe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Wm.create=(e,t)=>new Wm({value:e,typeName:Te.ZodLiteral,...We(t)});Vl=class Vl extends it{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return te(t,{expected:at.joinValues(r),received:t.parsedType,code:W.invalid_type}),Oe}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return te(t,{received:t.data,code:W.invalid_enum_value,options:r}),Oe}return wn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Vl.create(e,{...this._def,...t})}exclude(e,t=this._def){return Vl.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}};Vl.create=Sz;Km=class Km extends it{_parse(e){let t=at.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==oe.string&&r.parsedType!==oe.number){let n=at.objectValues(t);return te(r,{expected:at.joinValues(n),received:r.parsedType,code:W.invalid_type}),Oe}if(!this._cache)this._cache=new Set(at.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=at.objectValues(t);return te(r,{received:r.data,code:W.invalid_enum_value,options:n}),Oe}return wn(e.data)}get enum(){return this._def.values}};Km.create=(e,t)=>new Km({values:e,typeName:Te.ZodNativeEnum,...We(t)});Vd=class Vd extends it{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==oe.promise&&t.common.async===!1)return te(t,{code:W.invalid_type,expected:oe.promise,received:t.parsedType}),Oe;let r=t.parsedType===oe.promise?t.data:Promise.resolve(t.data);return wn(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Vd.create=(e,t)=>new Vd({type:e,typeName:Te.ZodPromise,...We(t)});Io=class Io extends it{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:(o)=>{if(te(r,o),o.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async(s)=>{if(t.value==="aborted")return Oe;let a=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(a.status==="aborted")return Oe;if(a.status==="dirty")return qd(a.value);if(t.value==="dirty")return qd(a.value);return a});else{if(t.value==="aborted")return Oe;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});if(s.status==="aborted")return Oe;if(s.status==="dirty")return qd(s.value);if(t.value==="dirty")return qd(s.value);return s}}if(n.type==="refinement"){let o=(s)=>{let a=n.refinement(s,i);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return Oe;if(s.status==="dirty")t.dirty();return o(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return Oe;if(s.status==="dirty")t.dirty();return o(s.value).then(()=>({status:t.value,value:s.value}))})}if(n.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ul(o))return Oe;let s=n.transform(o.value,i);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(!Ul(o))return Oe;return Promise.resolve(n.transform(o.value,i)).then((s)=>({status:t.value,value:s}))});at.assertNever(n)}};Io.create=(e,t,r)=>new Io({schema:e,typeName:Te.ZodEffects,effect:t,...We(r)});Io.createWithPreprocess=(e,t,r)=>new Io({schema:t,effect:{type:"preprocess",transform:e},typeName:Te.ZodEffects,...We(r)});Po=class Po extends it{_parse(e){if(this._getType(e)===oe.undefined)return wn(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Po.create=(e,t)=>new Po({innerType:e,typeName:Te.ZodOptional,...We(t)});nc=class nc extends it{_parse(e){if(this._getType(e)===oe.null)return wn(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nc.create=(e,t)=>new nc({innerType:e,typeName:Te.ZodNullable,...We(t)});Ym=class Ym extends it{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===oe.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ym.create=(e,t)=>new Ym({innerType:e,typeName:Te.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...We(t)});Jm=class Jm extends it{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(qm(n))return n.then((i)=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Zn(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Zn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Jm.create=(e,t)=>new Jm({innerType:e,typeName:Te.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...We(t)});pb=class pb extends it{_parse(e){if(this._getType(e)!==oe.nan){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.nan,received:r.parsedType}),Oe}return{status:"valid",value:e.data}}};pb.create=(e)=>new pb({typeName:Te.ZodNaN,...We(e)});_Dt=Symbol("zod_brand");j1=class j1 extends it{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}};mb=class mb extends it{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return Oe;if(i.status==="dirty")return t.dirty(),qd(i.value);else return this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return Oe;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new mb({in:e,out:t,typeName:Te.ZodPipeline})}};Xm=class Xm extends it{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(Ul(n))n.value=Object.freeze(n.value);return n};return qm(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}};Xm.create=(e,t)=>new Xm({innerType:e,typeName:Te.ZodReadonly,...We(t)});DDt={object:nr.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Te||(Te={}));_=Gs.create,C=Bd.create,EDt=pb.create,SDt=Ud.create,Le=ab.create,$Dt=Bm.create,kDt=cb.create,RDt=Um.create,CDt=zm.create,ADt=lb.create,ic=zl.create,ODt=Ws.create,TDt=ub.create,le=To.create,Y=nr.create,PDt=nr.strictCreate,Hd=Vm.create,M1=N1.create,IDt=Hm.create,FDt=Ks.create,wi=db.create,NDt=fb.create,jDt=zd.create,MDt=Lm.create,qDt=Gm.create,ut=Wm.create,bt=Vl.create,LDt=Km.create,BDt=Vd.create,UDt=Io.create,zDt=Po.create,VDt=nc.create,HDt=Io.createWithPreprocess,GDt=mb.create});var q1=N(()=>{ob();P1();wz();jm();$z();ib()});var Fn=N(()=>{q1();q1()});function L1(e){return hb.includes(e)}var F3e,Hl,hb,kz,N3e,Rz,j3e,Cz,M3e,q3e,Az,L3e,Oz,nEt,iEt,Tz,B3e,Pz,U3e,Iz,B1=20,U1=500,z3e,oEt;var Gd=N(()=>{Fn();F3e=bt(["pending","verified","approved","revoked"]),Hl=bt(["person","service","test"]),hb=Hl.options;kz={nemarOwner:"service",nemarAdmin:"service","test-admin":"service","test-owner":"service","cool-vibers":"test","test-user":"test","test-pending":"test","test-verified":"test","test-revoked":"test"},N3e=bt(["same_kind","orcid_linked","own_account","kind_changed_concurrently"]),Rz=N3e.options,j3e=bt(["active","pending","revoked"]),Cz=Y({field:_(),blocks:le(_()).optional(),set_on:le(_()).optional()}).passthrough(),M3e=Y({id:C().int(),username:_().nullable(),email:_(),github_username:_().nullable(),role:_(),orcid:_().nullable().optional(),created_at:_().optional(),approved_at:_().nullable().optional(),dataset_count:C().int().optional(),sandbox_completed:Le().optional(),sandbox_completed_at:_().nullable().optional(),sandbox_dataset_id:_().nullable().optional(),service_access:Le().optional(),status:F3e.optional(),email_verified:Le().optional(),orcid_verified:Le().optional(),given_name:_().nullable().optional(),family_name:_().nullable().optional(),profile_gaps:le(Cz).optional(),username_auto_assigned:Le().optional(),account_kind:Hl.optional()}).passthrough(),q3e=Y({prefix:_(),created_at:_(),last_used_at:_().nullable()}).passthrough().nullable(),Az=Y({user:M3e,token:q3e.optional()}).passthrough(),L3e=Y({id:C().int(),username:_().nullable(),email:_(),github_username:_().nullable(),status:_(),email_verified:C().int().nullable().optional(),role:_().nullable(),created_at:_(),approved_at:_().nullable().optional(),revoked_at:_().nullable().optional(),signup_source:_().nullable().optional(),service_access:C().int().nullable().optional(),service_access_granted_at:_().nullable().optional(),given_name:_().nullable().optional(),family_name:_().nullable().optional(),orcid:_().nullable().optional(),upload_access_requested_at:_().nullable().optional(),account_kind:Hl.optional(),matched_in:le(_()).optional(),match_kind:_().optional()}).passthrough(),Oz=Y({users:le(L3e),count:C().int()}).passthrough(),nEt=bt(["assigned","would_assign","single_name","no_name","lookup_failed","conflict","exhausted","write_failed"]),iEt=bt(["sent","already_verified","skipped_fence","rate_limited","failed","not_attempted"]),Tz=Y({suggestion:_().nullable(),based_on:bt(["name","unavailable","exhausted"])}).passthrough(),B3e=bt(["why_required","email_not_verified","profile_incomplete","github_username_unverified","github_unavailable","already_approved"]),Pz=B3e.options,U3e=bt(["invalid_github_username","city_required","country_required","empty_patch","username_too_short","username_too_long","username_charset","given_name_required","family_name_required","username_taken","username_locked","name_is_orcid_canonical","account_revoked","github_unavailable","same_email","code_expired","code_incorrect","orcid_already_have","orcid_unavailable"]),Iz=U3e.options,z3e=Y({id:C().int(),email:_(),username:_().nullable(),role:_(),status:j3e,email_verified:Le(),given_name:_().nullable(),family_name:_().nullable(),orcid:_().nullable(),orcid_verified:Le(),github_username:_().nullable(),city:_().nullable(),country:_().nullable(),affiliation:_().nullable(),service_access:Le(),service_access_granted_at:_().nullable(),upload_access_requested_at:_().nullable(),profile_gaps:le(Cz),username_auto_assigned:Le()}).passthrough(),oEt=Y({user:z3e.nullable()}).passthrough()});var z1,V1,lEt,V3e,uEt,H3e,Fz,Nz,H1=8,G1=100,jz,Mz,G3e,qz;var Qm=N(()=>{Fn();Gd();z1=["given_name","family_name","affiliation","city","country"],V1=["username","github_username","email"],lEt=[...z1,...V1],V3e={given_name:_().max(200).optional(),family_name:_().max(200).optional(),affiliation:_().max(500).optional(),city:_().max(200).optional(),country:_().max(200).optional(),username:_().max(100).optional(),github_username:_().max(100).optional(),email:_().max(320).optional()},uEt=Y(V3e),H3e=bt(["field_not_editable","owner_only_field","edit_own_account","owner_account","system_account","invalid_edit","invalid_search","invalid_user_id"]),Fz=H3e.options,Nz=["exact","name","prefix","substring","fuzzy"],jz=Y({id:C().int(),username:_().nullable(),email:_(),github_username:_().nullable(),status:_(),role:_().nullable(),account_kind:Hl.optional(),email_verified:C().int().nullable().optional(),orcid:_().nullable().optional(),orcid_verified:C().int().nullable().optional(),given_name:_().nullable().optional(),family_name:_().nullable().optional(),affiliation:_().nullable().optional(),city:_().nullable().optional(),country:_().nullable().optional(),description:_().nullable().optional(),signup_source:_().nullable().optional(),created_at:_(),updated_at:_().nullable().optional(),approved_at:_().nullable().optional(),revoked_at:_().nullable().optional(),deleted_at:_().nullable().optional(),service_access:C().int().nullable().optional(),service_access_granted_at:_().nullable().optional(),service_access_granted_by:C().int().nullable().optional(),upload_access_requested_at:_().nullable().optional(),upload_access_notified_at:_().nullable().optional(),identity_conflict:C().int().nullable().optional(),username_auto_assigned:C().int().nullable().optional(),sandbox_completed:C().int().nullable().optional(),sandbox_completed_at:_().nullable().optional(),sandbox_dataset_id:_().nullable().optional(),aws_iam_username:_().nullable().optional(),dataset_count:C().int().optional(),active_tokens:C().int().optional(),linked_identities:le(_()).optional()}).passthrough(),Mz=Y({user:jz}).passthrough(),G3e=Y({from:_().nullable(),to:_().nullable()}),qz=Y({message:_(),changed:wi(_(),G3e),notes:le(_()).optional(),old_address_notified:Le().optional(),user:jz}).passthrough()});function Y3e(e){return e.startsWith("v")?e:`v${e}`}var W3e,K3e,Lz,pEt;var W1=N(()=>{Fn();W3e=/^v?\d+\.\d+\.\d+(?:-(?:rc|alpha|beta)\d*)?$/,K3e=/^v\d+\.\d+\.\d+(?:-(?:rc|alpha|beta)\d*)?$/;Lz=_().regex(W3e,"must be a semver version, optionally v-prefixed").transform(Y3e),pEt=_().regex(K3e,"must be the canonical v-prefixed tag (vX.Y.Z)")});function Uz(e,t){if(e.zarr_index_url!=null&&e.zarr_status!=="ready")t.addIssue({code:W.custom,message:"zarr_index_url must be null/absent unless zarr_status is 'ready'",path:["zarr_index_url"]})}function zz(e,t){if(e.zarr_verified_at!=null&&e.zarr_verify_status==null)t.addIssue({code:W.custom,message:"zarr_verified_at must be null/absent unless zarr_verify_status is non-null",path:["zarr_verified_at"]})}var J3e="0.4.1",K1,Wd,Bz,X3e,Q3e,Z3e,Vz,yEt,Hz,bEt,Ys,e4e,gb,xEt,t4e,r4e,wEt;var Y1=N(()=>{Fn();W1();K1=bt(["openneuro","nemar","gin","other"]),Wd=Hd([ut(0),ut(1)]).nullable(),Bz=Y({dataset_id:_(),id:_().optional(),name:_(),description:_().nullable().optional(),status:_(),visibility:_(),anonymous:C().int().nullable().optional(),concept_doi:_().nullable().optional(),doi:_().nullable().optional(),created_at:_(),updated_at:_().optional(),first_published_at:_().nullable().optional(),owner_username:_().nullable().optional(),source:_().nullable().optional(),modalities:_().optional(),participants:C().int().nonnegative(),tasks:_().optional(),authors:_().optional(),license:_().optional(),file_size:C().nonnegative(),file_size_formatted:_().optional(),total_files:C().nonnegative().nullable().optional(),num_citations:C().int().nonnegative().optional(),n_channels:C().int().nullable().optional(),electrode_system:_().nullable().optional(),has_hed:Wd.optional(),hed_version:_().nullable().optional(),data_complete:Wd.optional(),bytes_present:C().nonnegative().nullable().optional(),latest_version:Lz.nullable().optional(),latest_version_at:_().nullable().optional(),subject_count:C().int().nullable().optional(),file_size_bytes:C().nullable().optional(),sessions_count:C().int().nullable().optional(),age_min:C().nullable().optional(),age_max:C().nullable().optional(),bids_version:_().nullable().optional(),zarr_status:bt(["pending","ready","failed"]).nullable().optional(),zarr_store_count:C().int().nullable().optional(),zarr_converted_at:_().nullable().optional(),zarr_source_commit:_().nullable().optional(),zarr_errors:C().int().nullable().optional(),zarr_failure_count:C().int().nullable().optional(),zarr_deterministic:Wd.optional(),zarr_failed_at:_().nullable().optional(),zarr_index_url:_().nullable().optional(),zarr_verify_status:bt(["verified","failed","unverifiable"]).nullable().optional(),zarr_verified_at:_().nullable().optional(),zarr_requeue_at:_().nullable().optional(),anonymity_status:bt(["verified","findings","unverifiable"]).nullable().optional(),anonymity_checked_at:_().nullable().optional(),anonymity_findings:_().nullable().optional(),anonymity_unchecked:_().nullable().optional(),total_recording_duration:C().nullable().optional(),recording_duration_min:C().nullable().optional(),recording_duration_max:C().nullable().optional(),recording_count:C().int().nullable().optional(),recordings_unavailable:C().int().nullable().optional(),channel_count_min:C().int().nullable().optional(),channel_count_max:C().int().nullable().optional(),sampling_frequency:C().nullable().optional(),power_line_frequency:C().nullable().optional(),eeg_reference:_().nullable().optional(),placement_scheme:_().nullable().optional()}).passthrough();X3e=Bz.superRefine((e,t)=>{Uz(e,t),zz(e,t)}),Q3e=Bz.extend({file_size:C().nonnegative().nullable(),file_size_formatted:_().nullable().optional(),modalities:_().nullable().optional(),tasks:_().nullable().optional(),authors:_().nullable().optional(),license:_().nullable().optional(),owner_github:_().nullable().optional(),attestation_deposit_type:bt(["owner","redistribution"]).nullable().optional(),attestation_key_status:bt(["destroyed","retained"]).nullable().optional(),attestation_deidentified:Wd.optional(),attestation_no_duplicate:Wd.optional(),attestation_upstream_source:_().nullable().optional(),attestation_accepted_at:_().nullable().optional(),zarr_data_failures:Y({count:C().int().nonnegative(),detail_ref:_(),compacted_by:_().optional(),pending:C().int().nonnegative().optional(),discovered:C().int().nonnegative().optional(),events_upload_failed:ut(!0).optional(),manifest_upload_failed:ut(!0).optional()}).passthrough().nullable().optional()}).passthrough().superRefine((e,t)=>{Uz(e,t),zz(e,t)}),Z3e=Y({id:_(),name:_(),modalities:_().nullable().optional(),participants:C().int().nullable().optional(),doi:_().nullable().optional(),tasks:_().nullable().optional(),authors:_().nullable().optional(),has_hed:Wd.optional(),score:C().optional(),snippet:_().optional()}).passthrough(),Vz=wi(_(),C().int().nonnegative()),yEt=Y({datasets:le(X3e),count:C().int().nonnegative(),total_count:C().int().nonnegative().optional(),limit:C().int().optional(),offset:C().int().optional(),excluded_unknown:C().int().nonnegative().optional(),excluded_unknown_by_facet:Vz.optional()}).passthrough(),Hz=Y({results:le(Z3e),count:C().int().nonnegative(),returned:C().int().nonnegative().optional(),offset:C().int().nonnegative().optional(),limit:C().int().optional(),candidate_ceiling:C().int().optional(),truncated:Le().optional(),method:bt(["exact_id","text","text_fallback","semantic","unavailable"]).optional(),min_score:C().optional(),warning:_().optional(),excluded_unknown:C().int().nonnegative().optional(),excluded_unknown_by_facet:Vz.optional()}).passthrough(),bEt=Y({dataset:Q3e}).passthrough(),Ys=Y({value:_(),count:C().int().nonnegative()}),e4e=Y({values:le(Ys),distinct_total:C().int().nonnegative(),truncated:Le()}),gb=Y({"electrode-system":le(Ys).optional(),source:le(Ys).optional(),zarr:le(Ys).optional(),powerline:le(Ys).optional(),"bids-version":le(Ys).optional(),"hed-version":le(Ys).optional(),license:le(Ys).optional(),modality:le(Ys).optional(),task:e4e.optional(),warning:_().optional()}).passthrough(),xEt=Y({schema_version:ut(J3e),doc_type:ut("dataset"),dataset_id:_().regex(/^[a-z]{2}\d+$/,"neuroschema dataset_id pattern"),name:_(),source:K1,recording_modality:le(_()).min(1),description:_().nullable().optional(),bids_version:_().nullable().optional(),license:_().nullable().optional()}).passthrough(),t4e=Y({tasks:wi(Y({runs:le(_())}).passthrough())}).passthrough(),r4e=Y({sessions:le(_()),modalities:wi(t4e),session_modalities:wi(le(_())).optional()}).passthrough(),wEt=Y({version:_(),subjects:wi(r4e)}).passthrough()});function yb(e){return typeof e==="string"&&Gz.includes(e)}var n4e,DEt,EEt,SEt,Gz,i4e="ci_check_unavailable",Wz,Kz,Yz,Jz="X-Approval-Dispatch-Token",$Et;var Zm=N(()=>{Fn();n4e=/^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/,DEt=_().regex(n4e,"ORCID must be in format 0000-0000-0000-000X"),EEt=bt(["found","no_public_name","lookup_failed"]),SEt=bt(["bids_validation_failed","bids_validation_pending","bids_validation_in_progress","prescreen_failed","min_requirements_failed","owner_name_missing","identifier_screen_findings"]),Gz=["bids_validation_pending","bids_validation_in_progress"];Wz=[i4e],Kz=["identifier_screen_pending","identifier_screen_not_clear","identifier_screen_not_applicable"],Yz=["publication_review_not_clear","request_blocked","request_changed","request_mismatch","dispatch_superseded","dispatch_expired","decision_with_dispatch_token","approval_in_flight","deny_after_publishing","invalid_dataset_id","approval_closed_during_run"],$Et=bt(["filled","would_fill","no_public_name","lookup_failed","write_failed"])});var o4e,Xz,eh="https://nemar.org/settings",CEt,s4e,a4e,c4e,Qz,Zz;var J1=N(()=>{Fn();o4e=bt(["orcid_in_use","orcid_already_linked","orcid_linked_other","email_in_use","github_in_use","identity_conflict_remains"]),Xz=o4e.options,CEt={orcid_in_use:`That ORCID iD already belongs to a NEMAR account. Sign in to that account instead; if you want the iD on a different account, unlink it there first (Settings, ${eh}).`,orcid_already_linked:`That ORCID iD already belongs to a NEMAR account. Sign in to that account instead; if you want the iD on a different account, unlink it there first (Settings, ${eh}).`,orcid_linked_other:`That ORCID iD is linked to a different NEMAR account. Unlink it there first (Settings, ${eh}), then link it here.`,email_in_use:`That email address already belongs to a NEMAR account. Sign in to that account instead, or change its address first (Settings, ${eh}).`,github_in_use:`That GitHub account is already linked to a NEMAR account. Sign in to that account instead, or change its GitHub username first (Settings, ${eh}).`,identity_conflict_remains:"The collision that flagged this account is still there. Resolve it on the other account first (change its email or GitHub username, or unlink its ORCID iD), or delete that account, then clear the flag."},s4e=bt(["orcid","email","github"]),a4e=Y({id:C().int(),username:_().nullable(),email:_(),created_at:_(),has_oauth_identity:Le(),dataset_count:C().int(),identity_conflict:C().int(),canonical:Le()}).passthrough(),c4e=Y({kind:s4e,value:_(),canonical_user_id:C().int(),accounts:le(a4e)}).passthrough(),Qz=Y({groups:le(c4e),group_count:C().int(),flagged_count:C().int()}).passthrough(),Zz=Y({ok:ut(!0),id:C().int(),cleared:Le()}).passthrough()});var X1=120,eV=64,Q1="unnamed machine",l4e=25,bb,tV,Kd,rV,TEt,PEt,nV,u4e,d4e,iV,Z1,oV,IEt,FEt,xb,wb;var vb=N(()=>{Fn();bb=bt(["authorization_pending","slow_down","expired_token","access_denied","invalid_grant"]),tV={authorization_pending:"Waiting for you to authorize this machine in the browser.",slow_down:"Polling too quickly; the CLI will slow down automatically.",expired_token:"The code expired. Run `nemar auth login` again for a new one.",access_denied:"This sign-in was declined in the browser. Run `nemar auth login` again if that was a mistake.",invalid_grant:"That code is no longer valid. Run `nemar auth login` again for a new one."},Kd=bt(["device_code_unknown","device_code_expired","device_code_used","device_code_denied","account_pending","account_revoked","identity_conflict","service_account","person_account","too_many_keys","key_not_found"]),rV=Kd.options,TEt={device_code_unknown:"That code was not found. Check the code shown in your terminal, or run `nemar auth login` again for a new one.",device_code_expired:"The code expired. Run `nemar auth login` again for a new one.",device_code_used:"That code has already been used. Run `nemar auth login` again for a new one.",device_code_denied:"This sign-in was declined in the browser. Run `nemar auth login` again if that was a mistake.",account_pending:"Verify your email address first. Check your inbox for the NEMAR verification code, then authorize again.",account_revoked:"Your NEMAR account access has been revoked. Contact the NEMAR team if you think this is a mistake.",identity_conflict:"This account shares an identifier with another NEMAR account and cannot sign in until that is resolved. Fix it in Settings on nemar.org or contact the NEMAR team.",service_account:"This is a service or test account, and it cannot sign in this way. Ask an owner to create a key for it with `nemar admin keys create`.",person_account:"This account belongs to a person. A person creates their own keys with `nemar auth login` or in Settings on nemar.org.",too_many_keys:`This account already has ${l4e} active keys. Revoke one in Settings on nemar.org or with \`nemar auth keys\`, then try again.`,key_not_found:"That key was not found on this account, or it is already revoked. Run `nemar auth keys` to see the active ones."},PEt=Y({error:Kd,message:_()}).passthrough(),nV=Y({device_code:_(),user_code:_(),verification_uri:_(),verification_uri_complete:_(),expires_in:C().int(),interval:C().int()}).passthrough(),u4e=M1("error",[Y({error:ut("authorization_pending"),message:_()}).passthrough(),Y({error:ut("slow_down"),message:_()}).passthrough()]),d4e=M1("error",[Y({error:ut("expired_token"),reason:Kd,message:_()}).passthrough(),Y({error:ut("access_denied"),reason:Kd,message:_()}).passthrough(),Y({error:ut("invalid_grant"),reason:Kd,message:_()}).passthrough()]),iV=Hd([u4e,d4e]),Z1=Y({id:C().int(),name:_().nullable(),prefix:_(),created_at:_(),last_used_at:_().nullable(),current:Le()}).passthrough(),oV=Y({api_key:_(),key:Z1,user:Y({username:_().nullable(),email:_(),github_username:_().nullable(),role:_(),sandbox_completed:Le(),sandbox_dataset_id:_().nullable()}).passthrough()}).passthrough(),IEt=Y({user_code:_(),machine_name:_(),requested_at:_(),expires_in:C().int(),account:Y({username:_().nullable(),email_masked:_()}).passthrough(),refusal:Y({code:Kd,message:_()}).passthrough().nullable()}).passthrough(),FEt=Y({ok:ut(!0),machine_name:_()}).passthrough(),xb=Y({keys:le(Z1)}).passthrough(),wb=Y({api_key:_(),key:Z1}).passthrough()});function xr(e){return ir[e]}function Js(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>Object.hasOwn(t,n)?t[n]:r)}var ir;var Yd=N(()=>{ir={"tier.unverified.label":"Email not verified","tier.base.label":"Base access","tier.upload.label":"Upload access","tier.unverified.lede":"Verify your email address to activate your account.","upload_access.section.title":"Upload access","upload_access.section.lede":"A one-time admin grant. Reviewed against export-control and local-jurisdiction rules.","upload_access.state.granted":"Granted","upload_access.state.requested":"Requested","upload_access.state.not_requested":"Not requested","upload_access.invite.title":"Want to contribute a dataset?","upload_access.invite.body":"Browsing, searching and downloading are open to your account already. Uploading, or being added as a collaborator on someone else\u2019s dataset, needs one extra grant: an admin checks your GitHub handle and location against export-control and local-jurisdiction rules, once. Your email address must be verified first.","upload_access.gate.title":"Ask for upload access first","upload_access.gate.body":"Your account can browse, search and download everything public already. Uploading, or being added as a collaborator on someone else\u2019s dataset, needs one extra grant, and your email address must be verified first: an admin checks your GitHub handle and where you\u2019re based against export-control and local-jurisdiction rules. You ask once, and it is answered by email.","upload_access.request.cta":"Request upload access","upload_access.request.form_body":"Tell us what you plan to deposit, or which dataset you want to collaborate on. An admin reviews this alongside your name, username, GitHub handle and location, then grants access once.","upload_access.request.why_label":"What do you intend to upload?","upload_access.request.why_hint":"Describe what you intend to upload in 20-500 characters","upload_access.requested.title":"Your request is with an admin","upload_access.requested.lede":"An admin is reviewing your request.","upload_access.requested.lede_dated":"An admin is reviewing your request from {date}.","upload_access.requested.body.upload":"We\u2019ll email you when there\u2019s a decision, and this page will let you upload as soon as it\u2019s granted.","upload_access.requested.body":"We\u2019ll email you when there\u2019s a decision. Everything else on your account keeps working in the meantime.","upload_access.requested.cta":"See the request","upload_access.granted.body":"You can upload datasets from the upload page. Publishing one is a separate, per-dataset review you start from your dashboard.","upload_access.unverified.body":"Verify your email address first \u2014 the review happens over email.","upload_access.docs_link":"How upload access works","gap.sentence":"{label} is missing: needed {blocks}.","gap.set_on.both":"Set it in {web} or run `{cli}`.","gap.set_on.web":"Set it in {web}.","gap.blocks.verified":"to activate your account","gap.blocks.upload_access":"to request upload access","gap.blocks.publication":"to publish a dataset","gap.blocks.unknown":"to finish setting up your account","gap.blocks.noun.verified":"account activation","gap.blocks.noun.upload_access":"upload access","gap.blocks.noun.publication":"publication","gap.set_on.default_web":"Settings","gap.field.email_verified.label":"A verified email address","gap.field.username.label":"Username","gap.field.given_name.label":"Given name","gap.field.family_name.label":"Family name","gap.field.orcid_verified.label":"Verified ORCID iD","gap.field.github_username.label":"GitHub handle","gap.field.city.label":"City","gap.field.country.label":"Country","gap.field.why.label":"A description of what you intend to upload","gap.field.email_verified.set_on.web":"the verify step on your dashboard","gap.field.email_verified.set_on.cli":"nemar auth resend-verification","gap.field.username.set_on.web":"Settings","gap.field.username.set_on.cli":"nemar auth profile set-username","gap.field.given_name.set_on.web":"Settings","gap.field.given_name.set_on.cli":"nemar auth profile set-name","gap.field.family_name.set_on.web":"Settings","gap.field.family_name.set_on.cli":"nemar auth profile set-name","gap.field.given_name.set_on.web.orcid":"your ORCID record at orcid.org, then sign in again","gap.field.family_name.set_on.web.orcid":"your ORCID record at orcid.org, then sign in again","gap.field.orcid_verified.set_on.web":"Settings","gap.field.orcid_verified.set_on.cli":"nemar auth profile orcid link","gap.field.github_username.set_on.web":"Settings","gap.field.github_username.set_on.cli":"nemar auth profile set-github","gap.field.city.set_on.web":"Settings","gap.field.city.set_on.cli":"nemar auth profile set-location","gap.field.country.set_on.web":"Settings","gap.field.country.set_on.cli":"nemar auth profile set-location","gap.field.why.set_on.web":"the request form in Settings","gap.field.why.set_on.cli":"nemar auth request-upload-access","gaps.title":"What is still missing","gaps.none":"Nothing outstanding \u2014 every field NEMAR needs is filled in.","gaps.nudge.title":"Your profile isn\u2019t finished yet","gaps.nudge.cta":"Complete your profile","gaps.upload.title":"Before you can ask, your account still needs:","gaps.request.title":"Finish these first:","gaps.admin.title":"Still missing","gaps.admin.item":"{label} \u2014 blocks {blocks}","gaps.admin.none":"Nothing missing \u2014 every field the request needs is filled in.","gaps.admin.not_loaded":"Not loaded \u2014 open the user page to see what is still missing.","onboarding.username.auto_assigned.title":"We chose your username from your name","onboarding.username.auto_assigned.body":"Your account needed a username to be listed as a dataset owner, so one was made from your name when you signed in. You can change it once, here, until an admin grants you upload access.","welcome.unverified.title":"Verify your email address","welcome.unverified.body":"Authorizing with ORCID created your NEMAR account and signed you in. One step left: enter the 6-digit code we emailed you. That activates the account \u2014 no admin approval is involved.","welcome.active.title":"Your account is active","welcome.active.body":"Authorizing with ORCID created your NEMAR account and signed you in. There is no separate sign-up step and no approval queue: browse, search, and your dashboard all work right now.","welcome.upload_access.title":"Ask for upload access when you\u2019re ready to contribute","welcome.upload_access.body":"Reading is open to every verified account. Uploading and compute need one extra grant, because an admin has to check your GitHub handle and location against export-control and local-jurisdiction rules first. You ask once, from Settings.","cli.gaps.section.title":"Profile","cli.gaps.unknown":"not checked: run 'nemar auth status --refresh'","cli.gaps.unreported":"not reported by this backend","cli.gap.set_on.cli_only":"Run `{cli}`.","cli.gap.field.sandbox.label":"Sandbox training","cli.gap.blocks.sandbox":"to upload a dataset from the CLI","cli.gap.field.sandbox.set_on.cli":"nemar sandbox","cli.gaps.sandbox_unchecked":"Sandbox training could not be confirmed with the server. Run `nemar sandbox status --refresh`, then `nemar sandbox` if it is still outstanding.","cli.upload.preflight.title":"Upload access is not granted yet","cli.upload.preflight.body":"Browsing, searching and downloading are open to your account already. Uploading, or being added as a collaborator on someone else\u2019s dataset, needs one extra grant: an admin checks your GitHub handle and location against export-control and local-jurisdiction rules, once. Your email address must be verified first.","cli.upload_access.cta":"Ask for it with `nemar auth request-upload-access`.","cli.upload.preflight.unchecked":"Upload access could not be checked ({reason}); continuing.","cli.upload.preflight.gaps_unknown":"Could not determine what is still missing; run `nemar auth profile` for the list.","cli.upload.preflight.dry_run":"Continuing anyway: --dry-run uploads nothing."}});function p4e(e){return e==="verified"||e==="upload_access"||e==="publication"}function Jd(e){return(e??"").trim().length===0}function m4e(e){return e==="service"||e==="test"}function cV(e,t={}){let r=t.orcidVerified===!0,n=Object.hasOwn(_b,e)?_b[e]:void 0;if(!n)return{field:e,label:e,blocks:t.blocks??[],setOnWeb:ir["gap.set_on.default_web"],setOnCli:null,known:!1};let i=r&&n.orcidWebKey!==void 0;return{field:e,blocks:t.blocks??n.blocks,label:ir[n.labelKey],setOnWeb:ir[i?n.orcidWebKey:n.webKey],setOnCli:i||n.cliKey===null?null:ir[n.cliKey],known:!0}}function sV(e){let t=ek.indexOf(e);return t===-1?ek.length:t}function lV(e,t={}){return e.map((r)=>cV(r,{orcidVerified:t.orcidVerified}))}function Db(e,t={}){return e.filter((r)=>!!r&&typeof r.field==="string").map((r)=>{let n=Array.isArray(r.blocks)?r.blocks.filter(p4e):[];return cV(r.field,{orcidVerified:t.orcidVerified,blocks:n.length>0?n:void 0})}).sort((r,n)=>sV(r.field)-sV(n.field))}function tk(e){let t=e.blocks[0],r=t?ir[f4e[t]]:ir["gap.blocks.unknown"],n=Js(ir["gap.sentence"],{label:"",blocks:r}).trimStart(),i=e.setOnCli?Js(ir["gap.set_on.both"],{web:e.setOnWeb,cli:e.setOnCli}):Js(ir["gap.set_on.web"],{web:e.setOnWeb});return`${n} ${i}`}function uV(e){return`${e.label} ${tk(e)}`}function Eb(){let e=Js(ir["gap.sentence"],{label:aV.label,blocks:ir["cli.gap.blocks.sandbox"]}),t=Js(ir["cli.gap.set_on.cli_only"],{cli:aV.command});return`${e} ${t}`}function dV(){return ir["cli.gaps.sandbox_unchecked"]}var _b,ek,qEt,f4e,aV;var Xd=N(()=>{Yd();_b={email_verified:{blocks:["verified","upload_access"],labelKey:"gap.field.email_verified.label",webKey:"gap.field.email_verified.set_on.web",cliKey:"gap.field.email_verified.set_on.cli",isMissing:(e)=>e.status==="pending"||e.email_verified===!1},username:{blocks:["upload_access"],labelKey:"gap.field.username.label",webKey:"gap.field.username.set_on.web",cliKey:"gap.field.username.set_on.cli",isMissing:(e)=>e.username!==void 0&&Jd(e.username)},given_name:{blocks:["upload_access","publication"],labelKey:"gap.field.given_name.label",webKey:"gap.field.given_name.set_on.web",cliKey:"gap.field.given_name.set_on.cli",orcidWebKey:"gap.field.given_name.set_on.web.orcid",isMissing:(e)=>Jd(e.given_name)},family_name:{blocks:["upload_access","publication"],labelKey:"gap.field.family_name.label",webKey:"gap.field.family_name.set_on.web",cliKey:"gap.field.family_name.set_on.cli",orcidWebKey:"gap.field.family_name.set_on.web.orcid",isMissing:(e)=>Jd(e.family_name)},orcid_verified:{blocks:["upload_access"],labelKey:"gap.field.orcid_verified.label",webKey:"gap.field.orcid_verified.set_on.web",cliKey:"gap.field.orcid_verified.set_on.cli",isMissing:(e)=>e.orcid_verified!==!0&&!m4e(e.account_kind)},github_username:{blocks:["upload_access","publication"],labelKey:"gap.field.github_username.label",webKey:"gap.field.github_username.set_on.web",cliKey:"gap.field.github_username.set_on.cli",isMissing:(e)=>Jd(e.github_username)},city:{blocks:["upload_access"],labelKey:"gap.field.city.label",webKey:"gap.field.city.set_on.web",cliKey:"gap.field.city.set_on.cli",isMissing:(e)=>Jd(e.city)},country:{blocks:["upload_access"],labelKey:"gap.field.country.label",webKey:"gap.field.country.set_on.web",cliKey:"gap.field.country.set_on.cli",isMissing:(e)=>Jd(e.country)},why:{blocks:["upload_access"],labelKey:"gap.field.why.label",webKey:"gap.field.why.set_on.web",cliKey:"gap.field.why.set_on.cli",isMissing:null}},ek=Object.keys(_b),qEt=ek.filter((e)=>_b[e].isMissing!==null),f4e={verified:"gap.blocks.verified",upload_access:"gap.blocks.upload_access",publication:"gap.blocks.publication"};aV={field:"sandbox",label:ir["cli.gap.field.sandbox.label"],command:ir["cli.gap.field.sandbox.set_on.cli"]}});function Rb(e,t){let r=e.sss!==void 0;if(e.derived!==r)t.addIssue({code:W.custom,path:["sss"],message:e.derived?"derived is true but sss is absent (ADR 0028: the two travel together)":"sss is present but derived is false (ADR 0028: the two travel together)"})}var vn,Sb,fV,$b,h4e,kb,g4e,y4e,b4e,x4e,w4e,UEt,v4e,zEt,_4e,VEt;var rk=N(()=>{Fn();vn=/^[a-z]{2}[0-9]{6}$/,Sb=/^[0-9a-f]{40}$/,fV=Y({name:_(),modality:_().nullable().optional(),rate:C().nullable().optional(),n_channels:C().int().nonnegative().nullable().optional(),n_samples:C().int().nonnegative().nullable().optional(),duration_s:C().nonnegative().nullable().optional(),source_rate_hz:C().nullable().optional(),n_view_levels:C().int().nonnegative().optional(),view_chunk_columns:C().int().positive().optional(),chunk_samples:C().int().positive().optional(),shard_samples:C().int().positive().optional()}).passthrough(),$b=Y({converted:C().int().nonnegative().optional(),relabelled:C().int().nonnegative().optional(),kept_importer_unit:C().int().nonnegative().optional(),units_column_present:Le().optional(),sidecar:_().optional(),sidecar_supplied:Le().optional(),unmatched_channels:C().int().nonnegative().optional(),unmatched_case_only:C().int().positive().optional(),matched_case_only:C().int().positive().optional(),matched_case_only_examples:le(_()).max(5).optional(),unmatched_raw_label:C().int().positive().optional(),unmatched_examples:le(_()).max(5).optional()}).passthrough(),h4e=Y({channels_tsv:C().int().positive(),in_file:C().int().nonnegative(),in_store:C().int().nonnegative()}).passthrough(),kb=Y({applied:Le().optional(),method:_().optional(),calibration:_().optional(),cross_talk:_().optional(),mne_version:_().optional()}).passthrough();g4e=Y({path:_(),zarr:_().regex(/\.zarr$/,"must end in .zarr"),updated_utc:_().optional(),source_tree:ut("raw"),derived:Le(),modalities:le(_()).optional(),groups:le(fV).optional(),power_line_frequency:C().nullable().optional(),event_description_count:C().int().nonnegative().optional(),n_events:C().int().nonnegative().optional(),trial_types:wi(_(),C().int().nonnegative()).optional(),units_report:$b.optional(),channels_tsv_read_error:Le().optional(),channels_tsv_count_mismatch:h4e.optional(),split_members:le(_()).optional(),sss:kb.optional()}).passthrough().superRefine(Rb),y4e=Y({path:_(),zarr:_().regex(/\.zarr$/,"must end in .zarr").optional(),code:_(),reason:_(),detail:_().nullable().optional(),attempts:C().int().nonnegative().optional()}).passthrough(),b4e=bt(["infra_failure","memory_budget","not_attempted"]),x4e=Y({path:_(),zarr:_().regex(/\.zarr$/,"must end in .zarr"),reason:b4e,attempts:C().int().nonnegative(),last_error:_().nullable().optional(),last_attempt_utc:_().nullable().optional()}).passthrough(),w4e=Y({level0:ut("<zarr>/<group>/0"),view:ut("<zarr>/<group>/view/<L>"),view_levels:ut("1..n_view_levels from the group attrs"),scale_offset:ut("level-0 array attrs scale[] and offset[]; physical = digital * scale + offset"),events:ut("<data_base>events.parquet").optional()}).passthrough(),UEt=Y({format:ut("nemar-zarr-index"),format_version:ut(3),dataset_id:_().regex(vn,"NEMAR dataset id (nm/on/xx band)"),contract_base:_().regex(/^https:\/\//,"must be https"),data_base:_().regex(/^https:\/\//,"must be https"),data_base_kind:ut("s3-public"),s3_uri:_().regex(/^s3:\/\//,"must be an s3:// URI"),s3_region:_().min(1),s3_anonymous:Le(),source_commit:_().regex(Sb,"must be a full 40-hex SHA"),engine_version:_().min(1),biosigio_version:_().nullable().optional(),updated_utc:_(),discovered_count:C().int().nonnegative(),store_count:C().int().nonnegative(),n_recordings:C().int().nonnegative(),errors:C().int().nonnegative(),failure_count:C().int().nonnegative(),pending_count:C().int().nonnegative(),stores:le(g4e),failures:le(y4e),pending:le(x4e),doi:_().nullable().optional(),license:_().nullable().optional(),citation:_().nullable().optional(),hed_version:_().nullable().optional(),events_parquet:_().regex(/^https:\/\//,"must be https").optional(),events_row_count:C().int().nonnegative().optional(),layout:w4e}).passthrough(),v4e=Y({name:_(),configuration:wi(_(),ic()).optional()}).passthrough(),zEt=Y({zarr_format:ut(3),node_type:ut("array"),shape:le(C().int().nonnegative()),data_type:_(),chunk_grid:Y({name:_(),configuration:wi(_(),ic()).optional()}).passthrough(),codecs:le(v4e),fill_value:ic().optional(),attributes:wi(_(),ic()).optional(),dimension_names:le(_().nullable()).optional()}).passthrough(),_4e=Y({path:_(),zarr:_().regex(/\.zarr$/,"must end in .zarr"),groups:le(fV).optional(),modalities:le(_()).optional()}).passthrough(),VEt=Y({format:ut("nemar-zarr-index"),format_version:C().int(),dataset_id:_().regex(vn,"NEMAR dataset id (nm/on/xx band)"),source_commit:_(),stores:le(_4e)}).passthrough()});function pV(e){let t=e.unit?` (${e.unit})`:"";switch(e.valueKind){case"enum":return`${e.label} -- comma-separated, one or more of: ${(e.enumValues??[]).join(", ")}`;case"number":return`${e.label}${t} -- range (e.g. 10..50, 10.., ..50, or 10)`;case"bytes":return`${e.label}${t} -- range with optional units (e.g. 10gb..2tb, 500mb.., ..1gb; bare = bytes)`;case"duration":return`${e.label}${t} -- range with optional units (e.g. 30m..2h, 100h.., ..90s; bare = seconds)`;case"text":return`${e.label} -- substring match`;case"version":return`${e.label} -- exact or prefix match`}}var D4e,E4e,S4e,$4e,Fo,WEt;var Cb=N(()=>{Y1();D4e=["10-05","10-10","10-20","biosemi","egi-geodesic","other"],E4e=["50","60"],S4e=["ready","pending","failed"],$4e=K1.options,Fo=[{key:"subjects",flag:"--subjects",queryParam:"subjects",valueKind:"number",label:"Subject count",unit:"subjects"},{key:"channels",flag:"--channels",queryParam:"channels",valueKind:"number",label:"Channel count",unit:"channels"},{key:"sessions",flag:"--sessions",queryParam:"sessions",valueKind:"number",label:"Session count",unit:"sessions"},{key:"size",flag:"--size",queryParam:"size",valueKind:"bytes",label:"Dataset size"},{key:"files",flag:"--files",queryParam:"files",valueKind:"number",label:"File count",unit:"files"},{key:"citations",flag:"--citations",queryParam:"citations",valueKind:"number",label:"Citation count",unit:"citations"},{key:"duration",flag:"--duration",queryParam:"duration",valueKind:"duration",label:"Total recording duration"},{key:"recording-length",flag:"--recording-length",queryParam:"recording_length",valueKind:"duration",label:"Per-recording duration"},{key:"recordings",flag:"--recordings",queryParam:"recordings",valueKind:"number",label:"Recording count",unit:"recordings"},{key:"unavailable",flag:"--unavailable",queryParam:"unavailable",valueKind:"number",label:"Unavailable recording count",unit:"recordings"},{key:"age",flag:"--age",queryParam:"age",valueKind:"number",label:"Participant age",unit:"years"},{key:"rate",flag:"--rate",queryParam:"rate",valueKind:"number",label:"Sampling rate",unit:"Hz"},{key:"powerline",flag:"--powerline",queryParam:"powerline",valueKind:"enum",label:"Power line frequency",enumValues:E4e},{key:"reference",flag:"--reference",queryParam:"reference",valueKind:"text",label:"EEG reference"},{key:"placement",flag:"--placement",queryParam:"placement",valueKind:"text",label:"Electrode placement scheme"},{key:"electrode-system",flag:"--electrode-system",queryParam:"electrode_system",valueKind:"enum",label:"Electrode system",enumValues:D4e},{key:"source",flag:"--source",queryParam:"source",valueKind:"enum",label:"Source archive",enumValues:$4e},{key:"zarr",flag:"--zarr",queryParam:"zarr",valueKind:"enum",label:"Zarr conversion status",enumValues:S4e},{key:"bids-version",flag:"--bids-version",queryParam:"bids_version",valueKind:"version",label:"BIDS version"},{key:"hed-version",flag:"--hed-version",queryParam:"hed_version",valueKind:"version",label:"HED version"}],WEt=new Map(Fo.map((e)=>[e.key,e]))});var k4e,QEt,R4e,bV,th,mV,C4e,xV,A4e=20,O4e=100,T4e,wV,P4e,ZEt,eSt,I4e,tSt,rSt,F4e,N4e,j4e,nSt,M4e=50,q4e=500,iSt,L4e,B4e,oSt,U4e=1000,z4e=5000,hV=8,V4e=100,H4e=32,gV,sSt,G4e,W4e,K4e,aSt,Y4e=800,J4e=4000,cSt,lSt,nk=60,ik=64,yV,X4e=86400,Q4e=4096,uSt,Z4e,e8e,dSt;var vV=N(()=>{Fn();Cb();rk();k4e=Y({dataset_id:_().regex(vn),name:_(),doi:_().nullable().optional(),license:_().nullable().optional(),modalities:le(_()).optional(),tasks:le(_()).optional(),subject_count:C().int().nonnegative().nullable().optional(),has_hed:Hd([ut(0),ut(1)]).nullable().optional(),hed_version:_().nullable().optional(),store_count:C().int().nonnegative().nullable().optional(),recording_count:C().int().nonnegative().nullable().optional(),recordings_unavailable:C().int().nonnegative().nullable().optional(),total_recording_duration:C().nullable().optional(),zarr_converted_at:_().nullable().optional(),zarr_source_commit:_().nullable().optional(),zarr_errors:C().int().nonnegative().nullable().optional(),zarr_verify_status:bt(["verified","failed","unverifiable"]).nullable().optional(),zarr_verified_at:_().nullable().optional(),index_url:_().nullable().optional()}).passthrough(),QEt=Y({format:ut("nemar-zarr-catalog"),format_version:C().int(),generated_utc:_(),contract_base:_(),count:C().int().nonnegative(),datasets:le(k4e)}).passthrough(),R4e=["verified","failed","unverifiable"],bV=bt(R4e).nullable(),th=Y({dataset_id:_().regex(vn),doi:_().nullable(),license:_().nullable(),citation:_().nullable(),source_commit:_().regex(Sb),index_etag:_().nullable(),engine_version:_(),source_tree:ut("raw"),derived:Le(),sss:kb.optional(),lossy:Le(),dtype:_().nullable(),effective_rate_hz:C().nullable(),source_rate_hz:C().nullable(),units_report:$b.nullable().optional(),zarr_verify_status:bV,note:_().nullable().optional()}).passthrough().superRefine(Rb),mV=Y({start:C().int().nonnegative(),end:C().int().nonnegative()}).passthrough().refine((e)=>e.end>=e.start,{message:"end must be >= start",path:["end"]}),C4e=Y({python_zarr:_(),zarrita:_(),python_browser:_()}).passthrough(),xV=Y({contract_base:_(),data_base:_(),s3_uri:_(),s3_region:_(),s3_anonymous:Le(),zarr:_(),group:_(),level:Hd([ut("0"),C().int().positive()]),array_path:_(),dtype:_().nullable(),codecs:le(ic()).optional(),chunk_samples:C().int().positive().nullable(),shard_samples:C().int().positive().nullable(),n_channels:C().int().nonnegative().nullable(),sample_slice:mV.optional(),channel_slice:mV.optional(),scale_offset:_(),how_to:C4e}).passthrough(),T4e=Object.fromEntries(Fo.map((e)=>[e.queryParam,_().optional()])),wV={modality:_().optional(),task:_().optional(),has_hed:Le().optional(),has_zarr:Le().optional(),author:_().optional(),has_doi:Le().optional(),has_zarr_verified:Le().optional(),data_complete:Le().optional(),recent:C().int().positive().optional(),license:_().optional()},P4e=Object.keys(wV),ZEt=[...P4e,...Fo.map((e)=>e.queryParam)],eSt=Y({query:_().optional(),...wV,include_unknown:Le().optional(),...T4e,limit:C().int().positive().max(O4e).default(A4e)}).passthrough(),I4e=Y({dataset_id:_().regex(vn),name:_(),doi:_().nullable().optional(),license:_().nullable().optional(),modalities:le(_()).optional(),tasks:le(_()).optional(),subject_count:C().int().nullable().optional(),has_hed:Le().nullable().optional(),has_zarr:Le()}).passthrough(),tSt=Y({results:le(I4e),count:C().int().nonnegative(),limit:C().int(),note:_().nullable().optional(),truncated:Le().optional()}).passthrough(),rSt=Y({dataset_id:_().regex(vn)}).passthrough(),F4e=["list_recordings","get_events","render_overview","read_window"],N4e=Y({next_cheapest_tool:bt(F4e),reason:_()}).passthrough(),j4e=["pending","ready","failed"],nSt=Y({dataset_id:_().regex(vn),name:_(),doi:_().nullable(),license:_().nullable(),citation:_().nullable(),modalities:le(_()).optional(),tasks:le(_()).optional(),subject_count:C().int().nullable().optional(),has_hed:Le().nullable().optional(),hed_version:_().nullable().optional(),recording_count:C().int().nullable().optional(),total_recording_duration_s:C().nullable().optional(),zarr_status:bt(j4e).nullable().optional(),zarr_verify_status:bV.optional(),zarr_source_commit:_().nullable().optional(),zarr_store_count:C().int().nullable().optional(),cost_hint:N4e}).passthrough(),iSt=Y({dataset_id:_().regex(vn),modality:_().optional(),min_duration_s:C().nonnegative().optional(),include_derived:Le().default(!1),limit:C().int().positive().max(q4e).default(M4e),offset:C().int().nonnegative().default(0)}).passthrough(),L4e=Y({name:_(),modality:_().nullable().optional(),rate:C().nullable().optional(),n_channels:C().int().nullable().optional(),duration_s:C().nullable().optional(),n_view_levels:C().int().nonnegative().nullable().optional(),n_samples:C().int().nonnegative().nullable().optional(),view_chunk_columns:C().int().positive().nullable().optional()}).passthrough(),B4e=Y({path:_(),zarr:_(),source_tree:ut("raw"),derived:Le(),groups:le(L4e).optional(),n_events:C().int().nonnegative().optional(),sss:kb.optional(),units_report:$b.optional()}).passthrough().superRefine(Rb),oSt=Y({dataset_id:_().regex(vn),source_commit:_().regex(Sb).nullable(),recordings:le(B4e),total_count:C().int().nonnegative(),excluded_derived_count:C().int().nonnegative(),limit:C().int(),offset:C().int(),index_format_version:C().int(),discovered_count:C().int().nonnegative().nullable(),failure_count:C().int().nonnegative().nullable(),pending_count:C().int().nonnegative().nullable(),excluded_legacy_non_raw_count:C().int().nonnegative(),note:_().nullable().optional(),envelope:th.optional()}).passthrough(),gV=_().min(1).max(64),sSt=Y({dataset_id:_().regex(vn),recording:_(),group:_().optional(),limit:C().int().positive().max(z4e).default(U4e),offset:C().int().nonnegative().default(0),where:wi(gV,le(Hd([_(),C()])).min(1).max(V4e)).refine((e)=>{let t=Object.keys(e).length;return t>=1&&t<=hV},{message:`where names 1 to ${hV} columns`}).optional(),columns:le(gV).min(1).max(H4e).optional()}).passthrough(),G4e=Y({store_path:_(),group_name:_(),onset_s:C(),duration_s:C().nullable().optional(),sample_index:C().int().nonnegative(),trial_type:_().nullable().optional(),value:Hd([_(),C()]).nullable().optional(),hed:_().nullable().optional()}).passthrough(),W4e=G4e.partial().required({onset_s:!0,sample_index:!0}),K4e=Y({name:_(),distinct_count:C().int().nonnegative(),null_count:C().int().nonnegative(),values:le(Y({value:_(),count:C().int().positive()}).passthrough()).nullable()}).passthrough(),aSt=Y({dataset_id:_().regex(vn),recording:_(),events:le(W4e),source:bt(["events_parquet","events_tsv_fallback"]),estimated:Le(),total_count:C().int().nonnegative(),limit:C().int(),offset:C().int(),truncated:Le(),note:_().nullable().optional(),columns_summary:le(K4e).optional(),envelope:th.optional()}).passthrough(),cSt=Y({dataset_id:_().regex(vn),recording:_(),group:_().optional(),width_px:C().int().positive().max(J4e).default(Y4e)}).passthrough(),lSt=Y({dataset_id:_().regex(vn),recording:_(),group:_(),level:C().int().positive(),width_px:C().int().positive(),height_px:C().int().positive(),mime_type:ut("image/png"),columns_read:C().int().nonnegative(),chunks_read:C().int().nonnegative(),bytes_read:C().int().nonnegative(),envelope:th.optional()}).passthrough(),yV=nk*ik,uSt=Y({dataset_id:_().regex(vn),recording:_(),group:_().optional(),start_s:C().nonnegative().default(0),duration_s:C().positive().max(X4e).default(10),channels:le(C().int().nonnegative()).max(Q4e).optional(),taste:Le().default(!1)}).passthrough().superRefine((e,t)=>{if(!e.taste)return;if(!e.channels||e.channels.length===0){t.addIssue({code:W.custom,message:"taste requires channels: name the channel indices you want (list_recordings reports each group's n_channels), or omit taste for a recipe",path:["channels"]});return}if(e.duration_s>nk)t.addIssue({code:W.custom,message:`taste duration_s (${e.duration_s}) exceeds the ${nk} s cap; omit taste for a recipe instead`,path:["duration_s"]});if(e.channels.length>ik)t.addIssue({code:W.custom,message:`taste channels (${e.channels.length}) exceeds the ${ik}-channel cap; omit taste for a recipe instead`,path:["channels"]});let r=e.duration_s*e.channels.length;if(r>yV)t.addIssue({code:W.custom,message:`taste exceeds the cap of ${yV} channel-seconds (duration_s x channels = ${r}); omit taste for a recipe instead`,path:["duration_s"]})}),Z4e=Y({mode:ut("recipe"),recipe:xV,envelope:th}).passthrough(),e8e=Y({mode:ut("taste"),start_s:C(),duration_s:C(),channels:le(C().int()),sample_rate_hz:C(),values:le(le(C())),recipe:xV,chunks_read:C().int().nonnegative(),bytes_read:C().int().nonnegative(),filled_ranges:le(Y({start_sample:C().int().nonnegative(),end_sample:C().int().nonnegative(),start_s:C(),end_s:C()}).passthrough()),note:_().nullable().optional(),envelope:th}).passthrough(),dSt=M1("mode",[Z4e,e8e])});var Qd=N(()=>{W1();Gd();Y1();Zm();J1();vb();Yd();Xd();rk();vV()});function L(e){if(e instanceof Error)return e.message;return String(e)}var B,cc;var At=N(()=>{B=class B extends Error{statusCode;details;step;blockReason;missing;code;reason;rawBody;constructor(e,t,r,n,i,o){super(t);this.statusCode=e;this.details=r;this.step=n;this.blockReason=i;this.missing=o;this.name="ApiError"}};cc=class cc extends B{mode;eta;constructor(e,t,r,n){super(503,t,n);this.mode=e;this.eta=r;this.name="MaintenanceError"}}});var n8e,i8e,o8e,ASt,EV="override_publication_review",SV="publication_review_not_clear",ak=2000;var Ob=N(()=>{n8e=["dispatched","redispatched","dispatch_claimed"],i8e=["review_disabled","not_applicable","not_owned_here","request_not_requested","screen_not_ready","running","has_result","platform_limit"],o8e=["dispatch_failed","dispatch_unconfigured"],ASt=[...n8e,...i8e,...o8e]});var Tb=1e4;function Pb(e){return e?a8e:No}var No,PSt,s8e,a8e,ck;var Ib=N(()=>{No=["ci_check","enrichment_check","s3_public_read","repo_public","tag_protect","doi_create","update_metadata","update_readme","create_tag","create_release","upload_to_zenodo","publish_doi","version_doi","s3_lock","sync_nemar","notify_user"],PSt=No.slice(0,No.indexOf("s3_public_read")),s8e=["update_metadata","update_readme","upload_to_zenodo","publish_doi"],a8e=No.filter((e)=>!s8e.includes(e));ck={ci_check:"Check CI",enrichment_check:"Enrichment check",s3_public_read:"S3 public read",repo_public:"Make catalog row public",tag_protect:"Tag protection",doi_create:"Create DOI",update_metadata:"Update metadata",update_readme:"Update README",create_tag:"Create version tag",create_release:"Create GitHub release",upload_to_zenodo:"Upload to Zenodo (no-op)",publish_doi:"Publish DOI (irreversible)",version_doi:"Version DOI + manifest",s3_lock:"S3 Object Lock",sync_nemar:"Sync NEMAR (no-op)",notify_user:"Notify user"}});function Fb(e){let t=[],r="",n="start",i=!1;for(let o of e)switch(o){case"\\":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd")throw Error("Invalid character after an index");if(i)r+=o;n="property",i=!i;break}case".":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd"){n="property";break}if(i){i=!1,r+=o;break}if(lk.has(r))return[];t.push(r),r="",n="property";break}case"[":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd"){n="index";break}if(i){i=!1,r+=o;break}if(n==="property"){if(lk.has(r))return[];t.push(r),r=""}n="index";break}case"]":{if(n==="index"){t.push(Number.parseInt(r,10)),r="",n="indexEnd";break}if(n==="indexEnd")throw Error("Invalid character after an index")}default:{if(n==="index"&&!c8e.has(o))throw Error("Invalid character in an index");if(n==="indexEnd")throw Error("Invalid character after an index");if(n==="start")n="property";if(i)i=!1,r+="\\";r+=o}}if(i)r+="\\";switch(n){case"property":{if(lk.has(r))return[];t.push(r);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function uk(e,t){if(typeof t!=="number"&&Array.isArray(e)){let r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function $V(e,t){if(uk(e,t))throw Error("Cannot use string index")}function kV(e,t,r){if(!Gl(e)||typeof t!=="string")return r===void 0?e:r;let n=Fb(t);if(n.length===0)return r;for(let i=0;i<n.length;i++){let o=n[i];if(uk(e,o))e=i===n.length-1?void 0:null;else e=e[o];if(e===void 0||e===null){if(i!==n.length-1)return r;break}}return e===void 0?r:e}function dk(e,t,r){if(!Gl(e)||typeof t!=="string")return e;let n=e,i=Fb(t);for(let o=0;o<i.length;o++){let s=i[o];if($V(e,s),o===i.length-1)e[s]=r;else if(!Gl(e[s]))e[s]=typeof i[o+1]==="number"?[]:{};e=e[s]}return n}function RV(e,t){if(!Gl(e)||typeof t!=="string")return!1;let r=Fb(t);for(let n=0;n<r.length;n++){let i=r[n];if($V(e,i),n===r.length-1)return delete e[i],!0;if(e=e[i],!Gl(e))return!1}}function CV(e,t){if(!Gl(e)||typeof t!=="string")return!1;let r=Fb(t);if(r.length===0)return!1;for(let n of r){if(!Gl(e)||!(n in e)||uk(e,n))return!1;e=e[n]}return!0}var Gl=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")},lk,c8e;var AV=N(()=>{lk=new Set(["__proto__","prototype","constructor"]),c8e=new Set("0123456789")});import Qt from"path";import OV from"os";import fk from"process";function mk(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(fk.platform==="darwin")return l8e(e);if(fk.platform==="win32")return u8e(e);return d8e(e)}var lc,pk,ef,l8e=(e)=>{let t=Qt.join(lc,"Library");return{data:Qt.join(t,"Application Support",e),config:Qt.join(t,"Preferences",e),cache:Qt.join(t,"Caches",e),log:Qt.join(t,"Logs",e),temp:Qt.join(pk,e)}},u8e=(e)=>{let t=ef.APPDATA||Qt.join(lc,"AppData","Roaming"),r=ef.LOCALAPPDATA||Qt.join(lc,"AppData","Local");return{data:Qt.join(r,e,"Data"),config:Qt.join(t,e,"Config"),cache:Qt.join(r,e,"Cache"),log:Qt.join(r,e,"Log"),temp:Qt.join(pk,e)}},d8e=(e)=>{let t=Qt.basename(lc);return{data:Qt.join(ef.XDG_DATA_HOME||Qt.join(lc,".local","share"),e),config:Qt.join(ef.XDG_CONFIG_HOME||Qt.join(lc,".config"),e),cache:Qt.join(ef.XDG_CACHE_HOME||Qt.join(lc,".cache"),e),log:Qt.join(ef.XDG_STATE_HOME||Qt.join(lc,".local","state"),e),temp:Qt.join(pk,t,e)}};var TV=N(()=>{lc=OV.homedir(),pk=OV.tmpdir(),{env:ef}=fk});var f8e=(e,t)=>{let{onError:r}=t;return function(...i){return e.apply(void 0,i).catch(r)}},jo;var PV=N(()=>{jo=f8e});var p8e=(e,t)=>{let{onError:r}=t;return function(...i){try{return e.apply(void 0,i)}catch(o){return r(o)}}},to;var IV=N(()=>{to=p8e});var FV=250;var NV=()=>{};var m8e=(e,t)=>{let{isRetriable:r}=t;return function(i){let{timeout:o}=i,s=i.interval??FV,a=Date.now()+o;return function c(...u){return e.apply(void 0,u).catch((d)=>{if(!r(d))throw d;if(Date.now()>=a)throw d;let f=Math.round(s*Math.random());if(f>0)return new Promise((m)=>setTimeout(m,f)).then(()=>c.apply(void 0,u));else return c.apply(void 0,u)})}}},Mo;var jV=N(()=>{NV();Mo=m8e});var h8e=(e,t)=>{let{isRetriable:r}=t;return function(i){let{timeout:o}=i,s=Date.now()+o;return function(...c){while(!0)try{return e.apply(void 0,c)}catch(u){if(!r(u))throw u;if(Date.now()>=s)throw u;continue}}}},qo;var MV=N(()=>{qo=h8e});var hk=N(()=>{PV();IV();jV();MV()});var rh,gk;var qV=N(()=>{yk();rh={isChangeErrorOk:(e)=>{if(!rh.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!LV&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!rh.isNodeError(e))return!1;let{code:t}=e;if(t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM")return!0;return!1},onChangeError:(e)=>{if(!rh.isNodeError(e))throw e;if(rh.isChangeErrorOk(e))return;throw e}},gk=rh});import BV from"process";var nh,Nn,LV,Wr;var yk=N(()=>{qV();nh={onError:gk.onChangeError},Nn={onError:()=>{return}},LV=BV.getuid?!BV.getuid():!1,Wr={isRetriable:gk.isRetriableError}});import ht from"fs";import{promisify as an}from"util";var g8e,Ir;var bk=N(()=>{hk();hk();yk();g8e={attempt:{chmod:jo(an(ht.chmod),nh),chown:jo(an(ht.chown),nh),close:jo(an(ht.close),Nn),fsync:jo(an(ht.fsync),Nn),mkdir:jo(an(ht.mkdir),Nn),realpath:jo(an(ht.realpath),Nn),stat:jo(an(ht.stat),Nn),unlink:jo(an(ht.unlink),Nn),chmodSync:to(ht.chmodSync,nh),chownSync:to(ht.chownSync,nh),closeSync:to(ht.closeSync,Nn),existsSync:to(ht.existsSync,Nn),fsyncSync:to(ht.fsync,Nn),mkdirSync:to(ht.mkdirSync,Nn),realpathSync:to(ht.realpathSync,Nn),statSync:to(ht.statSync,Nn),unlinkSync:to(ht.unlinkSync,Nn)},retry:{close:Mo(an(ht.close),Wr),fsync:Mo(an(ht.fsync),Wr),open:Mo(an(ht.open),Wr),readFile:Mo(an(ht.readFile),Wr),rename:Mo(an(ht.rename),Wr),stat:Mo(an(ht.stat),Wr),write:Mo(an(ht.write),Wr),writeFile:Mo(an(ht.writeFile),Wr),closeSync:qo(ht.closeSync,Wr),fsyncSync:qo(ht.fsyncSync,Wr),openSync:qo(ht.openSync,Wr),readFileSync:qo(ht.readFileSync,Wr),renameSync:qo(ht.renameSync,Wr),statSync:qo(ht.statSync,Wr),writeSync:qo(ht.writeSync,Wr),writeFileSync:qo(ht.writeFileSync,Wr)}},Ir=g8e});import Wl from"process";var UV="utf8",xk=438,zV=511,VV,HV,GV,WV=1000,KV,l$t,wk=128;var vk=N(()=>{VV={},HV=Wl.geteuid?Wl.geteuid():-1,GV=Wl.getegid?Wl.getegid():-1,KV=!!Wl.getuid,l$t=Wl.getuid?!Wl.getuid():!1});var YV=(e)=>e instanceof Error&&("code"in e),_k=(e)=>typeof e==="string",Nb=(e)=>e===void 0;var JV=()=>{};var XV=()=>{};import QV from"process";var ZV,jb;var Dk=N(()=>{ZV=QV.platform==="linux",jb=QV.platform==="win32"});var Ek,eH;var tH=N(()=>{Dk();Ek=["SIGHUP","SIGINT","SIGTERM"];if(!jb)Ek.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(ZV)Ek.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");eH=Ek});import tf from"process";class rH{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(e)=>{if(this.exited)return;this.exited=!0;for(let t of this.callbacks)t();if(e)if(jb&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))tf.kill(tf.pid,"SIGTERM");else tf.kill(tf.pid,e)},this.hook=()=>{tf.once("exit",()=>this.exit());for(let e of eH)try{tf.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var nH;var iH=N(()=>{Dk();tH();nH=new rH});var y8e,oH;var sH=N(()=>{iH();y8e=nH.register,oH=y8e});import b8e from"path";var ei,ih;var aH=N(()=>{bk();sH();vk();ei={store:{},create:(e)=>{let t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),r=Date.now().toString().slice(-10),n="tmp-",i=`.tmp-${r}${t}`;return`${e}${i}`},get:(e,t,r=!0)=>{let n=ei.truncate(t(e));if(n in ei.store)return ei.get(e,t,r);return ei.store[n]=r,[n,()=>delete ei.store[n]]},purge:(e)=>{if(!ei.store[e])return;delete ei.store[e],Ir.attempt.unlink(e)},purgeSync:(e)=>{if(!ei.store[e])return;delete ei.store[e],Ir.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in ei.store)ei.purgeSync(e)},truncate:(e)=>{let t=b8e.basename(e);if(t.length<=wk)return e;let r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;let n=t.length-wk;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};oH(ei.purgeSyncAll);ih=ei});import x8e from"path";function Sk(e,t,r=VV){if(_k(r))return Sk(e,t,{encoding:r});let i={timeout:r.timeout??WV},o=null,s=null,a=null;try{let c=Ir.attempt.realpathSync(e),u=!!c;e=c||e,[s,o]=ih.get(e,r.tmpCreate||ih.create,r.tmpPurge!==!1);let d=KV&&Nb(r.chown),f=Nb(r.mode);if(u&&(d||f)){let p=Ir.attempt.statSync(e);if(p){if(r={...r},d)r.chown={uid:p.uid,gid:p.gid};if(f)r.mode=p.mode}}if(!u){let p=x8e.dirname(e);Ir.attempt.mkdirSync(p,{mode:zV,recursive:!0})}if(a=Ir.retry.openSync(i)(s,"w",r.mode||xk),r.tmpCreated)r.tmpCreated(s);if(_k(t))Ir.retry.writeSync(i)(a,t,0,r.encoding||UV);else if(!Nb(t))Ir.retry.writeSync(i)(a,t,0,t.length,0);if(r.fsync!==!1)if(r.fsyncWait!==!1)Ir.retry.fsyncSync(i)(a);else Ir.attempt.fsync(a);if(Ir.retry.closeSync(i)(a),a=null,r.chown&&(r.chown.uid!==HV||r.chown.gid!==GV))Ir.attempt.chownSync(s,r.chown.uid,r.chown.gid);if(r.mode&&r.mode!==xk)Ir.attempt.chmodSync(s,r.mode);try{Ir.retry.renameSync(i)(s,e)}catch(p){if(!YV(p))throw p;if(p.code!=="ENAMETOOLONG")throw p;Ir.retry.renameSync(i)(s,ih.truncate(e))}o(),s=null}finally{if(a)Ir.attempt.closeSync(a);if(s)ih.purge(s)}}var cH=N(()=>{bk();vk();JV();XV();aH()});var sh=y(function(dH){Object.defineProperty(dH,"__esModule",{value:!0});dH.regexpCode=dH.getEsmExportName=dH.getProperty=dH.safeStringify=dH.stringify=dH.strConcat=dH.addCodeArg=dH.str=dH._=dH.nil=dH._Code=dH.Name=dH.IDENTIFIER=dH._CodeOrName=void 0;class Mb{}dH._CodeOrName=Mb;dH.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class rf extends Mb{constructor(e){super();if(!dH.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}dH.Name=rf;class ro extends Mb{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof rf)t[r.str]=(t[r.str]||0)+1;return t},{})}}dH._Code=ro;dH.nil=new ro("");function lH(e,...t){let r=[e[0]],n=0;while(n<t.length)kk(r,t[n]),r.push(e[++n]);return new ro(r)}dH._=lH;var $k=new ro("+");function uH(e,...t){let r=[oh(e[0])],n=0;while(n<t.length)r.push($k),kk(r,t[n]),r.push($k,oh(e[++n]));return w8e(r),new ro(r)}dH.str=uH;function kk(e,t){if(t instanceof ro)e.push(...t._items);else if(t instanceof rf)e.push(t);else e.push(D8e(t))}dH.addCodeArg=kk;function w8e(e){let t=1;while(t<e.length-1){if(e[t]===$k){let r=v8e(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function v8e(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof rf||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof rf))return`"${e}${t.slice(1)}`;return}function _8e(e,t){return t.emptyStr()?e:e.emptyStr()?t:uH`${e}${t}`}dH.strConcat=_8e;function D8e(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:oh(Array.isArray(e)?e.join(","):e)}function E8e(e){return new ro(oh(e))}dH.stringify=E8e;function oh(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}dH.safeStringify=oh;function S8e(e){return typeof e=="string"&&dH.IDENTIFIER.test(e)?new ro(`.${e}`):lH`[${e}]`}dH.getProperty=S8e;function $8e(e){if(typeof e=="string"&&dH.IDENTIFIER.test(e))return new ro(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}dH.getEsmExportName=$8e;function k8e(e){return new ro(e.toString())}dH.regexpCode=k8e});var Ok=y(function(hH){Object.defineProperty(hH,"__esModule",{value:!0});hH.ValueScope=hH.ValueScopeName=hH.Scope=hH.varKinds=hH.UsedValueState=void 0;var Ot=sh();class pH extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Lb;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Lb||(hH.UsedValueState=Lb={}));hH.varKinds={const:new Ot.Name("const"),let:new Ot.Name("let"),var:new Ot.Name("var")};class Ck{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ot.Name?e:this.name(e)}name(e){return new Ot.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}hH.Scope=Ck;class Ak extends Ot.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ot._`.${new Ot.Name(t)}[${r}]`}}hH.ValueScopeName=Ak;var L8e=Ot._`\n`;class mH extends Ck{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?L8e:Ot.nil}}get(){return this._scope}name(e){return new Ak(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:i}=n,o=(r=t.key)!==null&&r!==void 0?r:t.ref,s=this._values[i];if(s){let u=s.get(o);if(u)return u}else s=this._values[i]=new Map;s.set(o,n);let a=this._scope[i]||(this._scope[i]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:i,itemIndex:c}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ot._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let i=Ot.nil;for(let o in e){let s=e[o];if(!s)continue;let a=r[o]=r[o]||new Map;s.forEach((c)=>{if(a.has(c))return;a.set(c,Lb.Started);let u=t(c);if(u){let d=this.opts.es5?hH.varKinds.var:hH.varKinds.const;i=Ot._`${i}${d} ${c} = ${u};${this.opts._n}`}else if(u=n===null||n===void 0?void 0:n(c))i=Ot._`${i}${u}${this.opts._n}`;else throw new pH(c);a.set(c,Lb.Completed)})}return i}}hH.ValueScope=mH});var Ke=y(function(jn){Object.defineProperty(jn,"__esModule",{value:!0});jn.or=jn.and=jn.not=jn.CodeGen=jn.operators=jn.varKinds=jn.ValueScopeName=jn.ValueScope=jn.Scope=jn.Name=jn.regexpCode=jn.stringify=jn.getProperty=jn.nil=jn.strConcat=jn.str=jn._=void 0;var se=sh(),or=Ok(),uc=sh();Object.defineProperty(jn,"_",{enumerable:!0,get:function(){return uc._}});Object.defineProperty(jn,"str",{enumerable:!0,get:function(){return uc.str}});Object.defineProperty(jn,"strConcat",{enumerable:!0,get:function(){return uc.strConcat}});Object.defineProperty(jn,"nil",{enumerable:!0,get:function(){return uc.nil}});Object.defineProperty(jn,"getProperty",{enumerable:!0,get:function(){return uc.getProperty}});Object.defineProperty(jn,"stringify",{enumerable:!0,get:function(){return uc.stringify}});Object.defineProperty(jn,"regexpCode",{enumerable:!0,get:function(){return uc.regexpCode}});Object.defineProperty(jn,"Name",{enumerable:!0,get:function(){return uc.Name}});var Gb=Ok();Object.defineProperty(jn,"Scope",{enumerable:!0,get:function(){return Gb.Scope}});Object.defineProperty(jn,"ValueScope",{enumerable:!0,get:function(){return Gb.ValueScope}});Object.defineProperty(jn,"ValueScopeName",{enumerable:!0,get:function(){return Gb.ValueScopeName}});Object.defineProperty(jn,"varKinds",{enumerable:!0,get:function(){return Gb.varKinds}});jn.operators={GT:new se._Code(">"),GTE:new se._Code(">="),LT:new se._Code("<"),LTE:new se._Code("<="),EQ:new se._Code("==="),NEQ:new se._Code("!=="),NOT:new se._Code("!"),OR:new se._Code("||"),AND:new se._Code("&&"),ADD:new se._Code("+")};class dc{optimizeNodes(){return this}optimizeNames(e,t){return this}}class yH extends dc{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?or.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=of(this.rhs,e,t);return this}get names(){return this.rhs instanceof se._CodeOrName?this.rhs.names:{}}}class Ik extends dc{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof se.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=of(this.rhs,e,t),this}get names(){let e=this.lhs instanceof se.Name?{}:{...this.lhs.names};return Hb(e,this.rhs)}}class bH extends Ik{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class xH extends dc{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class wH extends dc{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class vH extends dc{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class _H extends dc{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=of(this.code,e,t),this}get names(){return this.code instanceof se._CodeOrName?this.code.names:{}}}class Wb extends dc{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let i=r[n];if(i.optimizeNames(e,t))continue;V8e(e,i.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Kl(e,t.names),{})}}class fc extends Wb{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class DH extends Wb{}class ah extends fc{}ah.kind="else";class Xs extends fc{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new ah(r):r}if(t){if(e===!1)return t instanceof Xs?t:t.nodes;if(this.nodes.length)return this;return new Xs(RH(e),t instanceof Xs?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=of(this.condition,e,t),this}get names(){let e=super.names;if(Hb(e,this.condition),this.else)Kl(e,this.else.names);return e}}Xs.kind="if";class nf extends fc{}nf.kind="for";class EH extends nf{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=of(this.iteration,e,t),this}get names(){return Kl(super.names,this.iteration.names)}}class SH extends nf{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?or.varKinds.var:this.varKind,{name:r,from:n,to:i}=this;return`for(${t} ${r}=${n}; ${r}<${i}; ${r}++)`+super.render(e)}get names(){let e=Hb(super.names,this.from);return Hb(e,this.to)}}class Tk extends nf{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=of(this.iterable,e,t),this}get names(){return Kl(super.names,this.iterable.names)}}class Bb extends fc{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Bb.kind="func";class Ub extends Wb{render(e){return"return "+super.render(e)}}Ub.kind="return";class $H extends fc{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Kl(e,this.catch.names);if(this.finally)Kl(e,this.finally.names);return e}}class zb extends fc{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}zb.kind="catch";class Vb extends fc{render(e){return"finally"+super.render(e)}}Vb.kind="finally";class kH{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
84
|
+
`;return this.stop(),this.#o.write(u),this}}function S(e){return new gz(e)}var Nm,u3e;var on=N(()=>{Ne();tz();nz();S1();dz();pz();hz();Nm=Be(Q0(),1),u3e=Be(Q0(),1)});var at,xz,oe,Vs=(e)=>{switch(typeof e){case"undefined":return oe.undefined;case"string":return oe.string;case"number":return Number.isNaN(e)?oe.nan:oe.number;case"boolean":return oe.boolean;case"function":return oe.function;case"bigint":return oe.bigint;case"symbol":return oe.symbol;case"object":if(Array.isArray(e))return oe.array;if(e===null)return oe.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return oe.promise;if(typeof Map<"u"&&e instanceof Map)return oe.map;if(typeof Set<"u"&&e instanceof Set)return oe.set;if(typeof Date<"u"&&e instanceof Date)return oe.date;return oe.object;default:return oe.unknown}};var jm=N(()=>{(function(e){e.assertEqual=(i)=>{};function t(i){}e.assertIs=t;function r(i){throw Error()}e.assertNever=r,e.arrayToEnum=(i)=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=(i)=>{let o=e.objectKeys(i).filter((a)=>typeof i[i[a]]!=="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=(i)=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys==="function"?(i)=>Object.keys(i):(i)=>{let o=[];for(let s in i)if(Object.prototype.hasOwnProperty.call(i,s))o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(i)=>Number.isInteger(i):(i)=>typeof i==="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map((s)=>typeof s==="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>{if(typeof o==="bigint")return o.toString();return o}})(at||(at={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(xz||(xz={}));oe=at.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var W,Zn;var ib=N(()=>{jm();W=at.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);Zn=class Zn extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},r={_errors:[]},n=(i)=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let s=r,a=0;while(a<o.path.length){let c=o.path[a];if(a!==o.path.length-1)s[c]=s[c]||{_errors:[]};else s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o));s=s[c],a++}}};return n(this),r}static assert(e){if(!(e instanceof Zn))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,at.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];t[i]=t[i]||[],t[i].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};Zn.create=(e)=>new Zn(e)});var d3e=(e,t)=>{let r;switch(e.code){case W.invalid_type:if(e.received===oe.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,at.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:r=`Unrecognized key(s) in object: ${at.joinValues(e.keys,", ")}`;break;case W.invalid_union:r="Invalid input";break;case W.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${at.joinValues(e.options)}`;break;case W.invalid_enum_value:r=`Invalid enum value. Expected ${at.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:r="Invalid function arguments";break;case W.invalid_return_type:r="Invalid function return type";break;case W.invalid_date:r="Invalid date";break;case W.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else at.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case W.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case W.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case W.custom:r="Invalid input";break;case W.invalid_intersection_types:r="Intersection results could not be merged";break;case W.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:r="Number must be finite";break;default:r=t.defaultError,at.assertNever(e)}return{message:r}},rc;var A1=N(()=>{ib();jm();rc=d3e});function Mm(){return f3e}var f3e;var ob=N(()=>{A1();f3e=rc});function te(e,t){let r=Mm(),n=sb({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===rc?void 0:rc].filter((i)=>!!i)});e.common.issues.push(n)}class sn{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return Oe;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let i=await n.key,o=await n.value;r.push({key:i,value:o})}return sn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:i,value:o}=n;if(i.status==="aborted")return Oe;if(o.status==="aborted")return Oe;if(i.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet))r[i.value]=o.value}return{status:e.value,value:r}}}var sb=(e)=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},Oe,qd=(e)=>({status:"dirty",value:e}),wn=(e)=>({status:"valid",value:e}),O1=(e)=>e.status==="aborted",T1=(e)=>e.status==="dirty",Ul=(e)=>e.status==="valid",qm=(e)=>typeof Promise<"u"&&e instanceof Promise;var P1=N(()=>{ob();A1();Oe=Object.freeze({status:"aborted"})});var wz=()=>{};var xe;var vz=N(()=>{(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(xe||(xe={}))});class eo{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function We(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:i};return{errorMap:(s,a)=>{let{message:c}=e;if(s.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??n??a.defaultError};if(s.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:i}}class it{get description(){return this._def.description}_getType(e){return Vs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Vs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sn,ctx:{common:e.parent.common,data:e.data,parsedType:Vs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(qm(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vs(e)},n=this._parseSync({data:e,path:r.path,parent:r});return _z(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vs(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ul(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Ul(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vs(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(qm(n)?n:Promise.resolve(n));return _z(r,i)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,i)=>{let o=e(n),s=()=>i.addIssue({code:W.custom,...r(n)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((a)=>{if(!a)return s(),!1;else return!0});if(!o)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new Io({schema:this,typeName:Te.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return Po.create(this,this._def)}nullable(){return nc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return To.create(this)}promise(){return Vd.create(this,this._def)}or(e){return Vm.create([this,e],this._def)}and(e){return Hm.create(this,e,this._def)}transform(e){return new Io({...We(this._def),schema:this,typeName:Te.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Ym({...We(this._def),innerType:this,defaultValue:t,typeName:Te.ZodDefault})}brand(){return new j1({typeName:Te.ZodBranded,type:this,...We(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Jm({...We(this._def),innerType:this,catchValue:t,typeName:Te.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return mb.create(this,e)}readonly(){return Xm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Ez(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function C3e(e){return new RegExp(`^${Ez(e)}$`)}function A3e(e){let t=`${Dz}T${Ez(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function O3e(e,t){if((t==="v4"||!t)&&_3e.test(e))return!0;if((t==="v6"||!t)&&E3e.test(e))return!0;return!1}function T3e(e,t){if(!b3e.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if(typeof i!=="object"||i===null)return!1;if("typ"in i&&i?.typ!=="JWT")return!1;if(!i.alg)return!1;if(t&&i.alg!==t)return!1;return!0}catch{return!1}}function P3e(e,t){if((t==="v4"||!t)&&D3e.test(e))return!0;if((t==="v6"||!t)&&S3e.test(e))return!0;return!1}function I3e(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}function Ld(e){if(e instanceof nr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Po.create(Ld(n))}return new nr({...e._def,shape:()=>t})}else if(e instanceof To)return new To({...e._def,type:Ld(e.element)});else if(e instanceof Po)return Po.create(Ld(e.unwrap()));else if(e instanceof nc)return nc.create(Ld(e.unwrap()));else if(e instanceof Ks)return Ks.create(e.items.map((t)=>Ld(t)));else return e}function F1(e,t){let r=Vs(e),n=Vs(t);if(e===t)return{valid:!0,data:e};else if(r===oe.object&&n===oe.object){let i=at.objectKeys(t),o=at.objectKeys(e).filter((a)=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=F1(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===oe.array&&n===oe.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=F1(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else if(r===oe.date&&n===oe.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}function Sz(e,t){return new Vl({values:e,typeName:Te.ZodEnum,...We(t)})}var _z=(e,t)=>{if(Ul(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Zn(e.common.issues);return this._error=r,this._error}}}},p3e,m3e,h3e,g3e,y3e,b3e,x3e,w3e,v3e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",I1,_3e,D3e,E3e,S3e,$3e,k3e,Dz="((\\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])))",R3e,Gs,Bd,Ud,ab,Bm,cb,Um,zm,lb,zl,Ws,ub,To,nr,Vm,Hs=(e)=>{if(e instanceof Gm)return Hs(e.schema);else if(e instanceof Io)return Hs(e.innerType());else if(e instanceof Wm)return[e.value];else if(e instanceof Vl)return e.options;else if(e instanceof Km)return at.objectValues(e.enum);else if(e instanceof Ym)return Hs(e._def.innerType);else if(e instanceof Um)return[void 0];else if(e instanceof zm)return[null];else if(e instanceof Po)return[void 0,...Hs(e.unwrap())];else if(e instanceof nc)return[null,...Hs(e.unwrap())];else if(e instanceof j1)return Hs(e.unwrap());else if(e instanceof Xm)return Hs(e.unwrap());else if(e instanceof Jm)return Hs(e._def.innerType);else return[]},N1,Hm,Ks,db,fb,zd,Lm,Gm,Wm,Vl,Km,Vd,Io,Po,nc,Ym,Jm,pb,_Dt,j1,mb,Xm,DDt,Te,_,C,EDt,SDt,Le,$Dt,kDt,RDt,CDt,ADt,ic,ODt,TDt,le,Y,PDt,Hd,M1,IDt,FDt,wi,NDt,jDt,MDt,qDt,ut,bt,LDt,BDt,UDt,zDt,VDt,HDt,GDt;var $z=N(()=>{ib();ob();vz();P1();jm();p3e=/^c[^\s-]{8,}$/i,m3e=/^[0-9a-z]+$/,h3e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,g3e=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,y3e=/^[a-z0-9_-]{21}$/i,b3e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,x3e=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,w3e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_3e=/^(?:(?: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])$/,D3e=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,E3e=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,S3e=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$3e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,k3e=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,R3e=new RegExp(`^${Dz}$`);Gs=class Gs extends it{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==oe.string){let i=this._getOrReturnCtx(e);return te(i,{code:W.invalid_type,expected:oe.string,received:i.parsedType}),Oe}let r=new sn,n=void 0;for(let i of this._def.checks)if(i.kind==="min"){if(e.data.length<i.value)n=this._getOrReturnCtx(e,n),te(n,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty()}else if(i.kind==="max"){if(e.data.length>i.value)n=this._getOrReturnCtx(e,n),te(n,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty()}else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;if(o||s){if(n=this._getOrReturnCtx(e,n),o)te(n,{code:W.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message});else if(s)te(n,{code:W.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message});r.dirty()}}else if(i.kind==="email"){if(!w3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"email",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="emoji"){if(!I1)I1=new RegExp(v3e,"u");if(!I1.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"emoji",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="uuid"){if(!g3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"uuid",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="nanoid"){if(!y3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"nanoid",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cuid"){if(!p3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"cuid",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cuid2"){if(!m3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"cuid2",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="ulid"){if(!h3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"ulid",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),te(n,{validation:"url",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="regex"){if(i.regex.lastIndex=0,!i.regex.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"regex",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="trim")e.data=e.data.trim();else if(i.kind==="includes"){if(!e.data.includes(i.value,i.position))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()}else if(i.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(i.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(i.kind==="startsWith"){if(!e.data.startsWith(i.value))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()}else if(i.kind==="endsWith"){if(!e.data.endsWith(i.value))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()}else if(i.kind==="datetime"){if(!A3e(i).test(e.data))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:"datetime",message:i.message}),r.dirty()}else if(i.kind==="date"){if(!R3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:"date",message:i.message}),r.dirty()}else if(i.kind==="time"){if(!C3e(i).test(e.data))n=this._getOrReturnCtx(e,n),te(n,{code:W.invalid_string,validation:"time",message:i.message}),r.dirty()}else if(i.kind==="duration"){if(!x3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"duration",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="ip"){if(!O3e(e.data,i.version))n=this._getOrReturnCtx(e,n),te(n,{validation:"ip",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="jwt"){if(!T3e(e.data,i.alg))n=this._getOrReturnCtx(e,n),te(n,{validation:"jwt",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cidr"){if(!P3e(e.data,i.version))n=this._getOrReturnCtx(e,n),te(n,{validation:"cidr",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="base64"){if(!$3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"base64",code:W.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="base64url"){if(!k3e.test(e.data))n=this._getOrReturnCtx(e,n),te(n,{validation:"base64url",code:W.invalid_string,message:i.message}),r.dirty()}else at.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:W.invalid_string,...xe.errToObj(r)})}_addCheck(e){return new Gs({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...xe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...xe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...xe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...xe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...xe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...xe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...xe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...xe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...xe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...xe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...xe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...xe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...xe.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...xe.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...xe.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...xe.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...xe.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...xe.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...xe.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...xe.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...xe.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...xe.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...xe.errToObj(t)})}nonempty(e){return this.min(1,xe.errToObj(e))}trim(){return new Gs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Gs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Gs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}};Gs.create=(e)=>new Gs({checks:[],typeName:Te.ZodString,coerce:e?.coerce??!1,...We(e)});Bd=class Bd extends it{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==oe.number){let i=this._getOrReturnCtx(e);return te(i,{code:W.invalid_type,expected:oe.number,received:i.parsedType}),Oe}let r=void 0,n=new sn;for(let i of this._def.checks)if(i.kind==="int"){if(!at.isInteger(e.data))r=this._getOrReturnCtx(e,r),te(r,{code:W.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()}else if(i.kind==="min"){if(i.inclusive?e.data<i.value:e.data<=i.value)r=this._getOrReturnCtx(e,r),te(r,{code:W.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()}else if(i.kind==="max"){if(i.inclusive?e.data>i.value:e.data>=i.value)r=this._getOrReturnCtx(e,r),te(r,{code:W.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()}else if(i.kind==="multipleOf"){if(I3e(e.data,i.value)!==0)r=this._getOrReturnCtx(e,r),te(r,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()}else if(i.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),te(r,{code:W.not_finite,message:i.message}),n.dirty()}else at.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,xe.toString(t))}gt(e,t){return this.setLimit("min",e,!1,xe.toString(t))}lte(e,t){return this.setLimit("max",e,!0,xe.toString(t))}lt(e,t){return this.setLimit("max",e,!1,xe.toString(t))}setLimit(e,t,r,n){return new Bd({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:xe.toString(n)}]})}_addCheck(e){return new Bd({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:xe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xe.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:xe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xe.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&at.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}};Bd.create=(e)=>new Bd({checks:[],typeName:Te.ZodNumber,coerce:e?.coerce||!1,...We(e)});Ud=class Ud extends it{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==oe.bigint)return this._getInvalidInput(e);let r=void 0,n=new sn;for(let i of this._def.checks)if(i.kind==="min"){if(i.inclusive?e.data<i.value:e.data<=i.value)r=this._getOrReturnCtx(e,r),te(r,{code:W.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()}else if(i.kind==="max"){if(i.inclusive?e.data>i.value:e.data>=i.value)r=this._getOrReturnCtx(e,r),te(r,{code:W.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()}else if(i.kind==="multipleOf"){if(e.data%i.value!==BigInt(0))r=this._getOrReturnCtx(e,r),te(r,{code:W.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()}else at.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return te(t,{code:W.invalid_type,expected:oe.bigint,received:t.parsedType}),Oe}gte(e,t){return this.setLimit("min",e,!0,xe.toString(t))}gt(e,t){return this.setLimit("min",e,!1,xe.toString(t))}lte(e,t){return this.setLimit("max",e,!0,xe.toString(t))}lt(e,t){return this.setLimit("max",e,!1,xe.toString(t))}setLimit(e,t,r,n){return new Ud({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:xe.toString(n)}]})}_addCheck(e){return new Ud({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}};Ud.create=(e)=>new Ud({checks:[],typeName:Te.ZodBigInt,coerce:e?.coerce??!1,...We(e)});ab=class ab extends it{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==oe.boolean){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.boolean,received:r.parsedType}),Oe}return wn(e.data)}};ab.create=(e)=>new ab({typeName:Te.ZodBoolean,coerce:e?.coerce||!1,...We(e)});Bm=class Bm extends it{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==oe.date){let i=this._getOrReturnCtx(e);return te(i,{code:W.invalid_type,expected:oe.date,received:i.parsedType}),Oe}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return te(i,{code:W.invalid_date}),Oe}let r=new sn,n=void 0;for(let i of this._def.checks)if(i.kind==="min"){if(e.data.getTime()<i.value)n=this._getOrReturnCtx(e,n),te(n,{code:W.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()}else if(i.kind==="max"){if(e.data.getTime()>i.value)n=this._getOrReturnCtx(e,n),te(n,{code:W.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()}else at.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Bm({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:xe.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:xe.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}};Bm.create=(e)=>new Bm({checks:[],coerce:e?.coerce||!1,typeName:Te.ZodDate,...We(e)});cb=class cb extends it{_parse(e){if(this._getType(e)!==oe.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.symbol,received:r.parsedType}),Oe}return wn(e.data)}};cb.create=(e)=>new cb({typeName:Te.ZodSymbol,...We(e)});Um=class Um extends it{_parse(e){if(this._getType(e)!==oe.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.undefined,received:r.parsedType}),Oe}return wn(e.data)}};Um.create=(e)=>new Um({typeName:Te.ZodUndefined,...We(e)});zm=class zm extends it{_parse(e){if(this._getType(e)!==oe.null){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.null,received:r.parsedType}),Oe}return wn(e.data)}};zm.create=(e)=>new zm({typeName:Te.ZodNull,...We(e)});lb=class lb extends it{constructor(){super(...arguments);this._any=!0}_parse(e){return wn(e.data)}};lb.create=(e)=>new lb({typeName:Te.ZodAny,...We(e)});zl=class zl extends it{constructor(){super(...arguments);this._unknown=!0}_parse(e){return wn(e.data)}};zl.create=(e)=>new zl({typeName:Te.ZodUnknown,...We(e)});Ws=class Ws extends it{_parse(e){let t=this._getOrReturnCtx(e);return te(t,{code:W.invalid_type,expected:oe.never,received:t.parsedType}),Oe}};Ws.create=(e)=>new Ws({typeName:Te.ZodNever,...We(e)});ub=class ub extends it{_parse(e){if(this._getType(e)!==oe.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.void,received:r.parsedType}),Oe}return wn(e.data)}};ub.create=(e)=>new ub({typeName:Te.ZodVoid,...We(e)});To=class To extends it{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==oe.array)return te(t,{code:W.invalid_type,expected:oe.array,received:t.parsedType}),Oe;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;if(o||s)te(t,{code:o?W.too_big:W.too_small,minimum:s?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)te(t,{code:W.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)te(t,{code:W.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,s)=>n.type._parseAsync(new eo(t,o,t.path,s)))).then((o)=>sn.mergeArray(r,o));let i=[...t.data].map((o,s)=>n.type._parseSync(new eo(t,o,t.path,s)));return sn.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new To({...this._def,minLength:{value:e,message:xe.toString(t)}})}max(e,t){return new To({...this._def,maxLength:{value:e,message:xe.toString(t)}})}length(e,t){return new To({...this._def,exactLength:{value:e,message:xe.toString(t)}})}nonempty(e){return this.min(1,e)}};To.create=(e,t)=>new To({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Te.ZodArray,...We(t)});nr=class nr extends it{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=at.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==oe.object){let c=this._getOrReturnCtx(e);return te(c,{code:W.invalid_type,expected:oe.object,received:c.parsedType}),Oe}let{status:r,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ws&&this._def.unknownKeys==="strip")){for(let c in n.data)if(!o.includes(c))s.push(c)}let a=[];for(let c of o){let u=i[c],d=n.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new eo(n,d,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Ws){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict"){if(s.length>0)te(n,{code:W.unrecognized_keys,keys:s}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=n.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new eo(n,d,n.path,u)),alwaysSet:u in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then((c)=>sn.mergeObjectSync(r,c));else return sn.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return xe.errToObj,new nr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:xe.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new nr({...this._def,unknownKeys:"strip"})}passthrough(){return new nr({...this._def,unknownKeys:"passthrough"})}extend(e){return new nr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new nr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Te.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new nr({...this._def,catchall:e})}pick(e){let t={};for(let r of at.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new nr({...this._def,shape:()=>t})}omit(e){let t={};for(let r of at.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new nr({...this._def,shape:()=>t})}deepPartial(){return Ld(this)}partial(e){let t={};for(let r of at.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new nr({...this._def,shape:()=>t})}required(e){let t={};for(let r of at.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];while(i instanceof Po)i=i._def.innerType;t[r]=i}return new nr({...this._def,shape:()=>t})}keyof(){return Sz(at.objectKeys(this.shape))}};nr.create=(e,t)=>new nr({shape:()=>e,unknownKeys:"strip",catchall:Ws.create(),typeName:Te.ZodObject,...We(t)});nr.strictCreate=(e,t)=>new nr({shape:()=>e,unknownKeys:"strict",catchall:Ws.create(),typeName:Te.ZodObject,...We(t)});nr.lazycreate=(e,t)=>new nr({shape:e,unknownKeys:"strip",catchall:Ws.create(),typeName:Te.ZodObject,...We(t)});Vm=class Vm extends it{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map((s)=>new Zn(s.ctx.common.issues));return te(t,{code:W.invalid_union,unionErrors:o}),Oe}if(t.common.async)return Promise.all(r.map(async(i)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);else{let i=void 0,o=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!i)i={result:u,ctx:c};if(c.common.issues.length)o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map((a)=>new Zn(a));return te(t,{code:W.invalid_union,unionErrors:s}),Oe}}get options(){return this._def.options}};Vm.create=(e,t)=>new Vm({options:e,typeName:Te.ZodUnion,...We(t)});N1=class N1 extends it{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==oe.object)return te(t,{code:W.invalid_type,expected:oe.object,received:t.parsedType}),Oe;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);if(!i)return te(t,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Oe;if(t.common.async)return i._parseAsync({data:t.data,path:t.path,parent:t});else return i._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let i of t){let o=Hs(i.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(n.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,i)}}return new N1({typeName:Te.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...We(r)})}};Hm=class Hm extends it{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(i,o)=>{if(O1(i)||O1(o))return Oe;let s=F1(i.value,o.value);if(!s.valid)return te(r,{code:W.invalid_intersection_types}),Oe;if(T1(i)||T1(o))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>n(i,o));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Hm.create=(e,t,r)=>new Hm({left:e,right:t,typeName:Te.ZodIntersection,...We(r)});Ks=class Ks extends it{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==oe.array)return te(r,{code:W.invalid_type,expected:oe.array,received:r.parsedType}),Oe;if(r.data.length<this._def.items.length)return te(r,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe;if(!this._def.rest&&r.data.length>this._def.items.length)te(r,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let i=[...r.data].map((o,s)=>{let a=this._def.items[s]||this._def.rest;if(!a)return null;return a._parse(new eo(r,o,r.path,s))}).filter((o)=>!!o);if(r.common.async)return Promise.all(i).then((o)=>sn.mergeArray(t,o));else return sn.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new Ks({...this._def,rest:e})}};Ks.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ks({items:e,typeName:Te.ZodTuple,rest:null,...We(t)})};db=class db extends it{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==oe.object)return te(r,{code:W.invalid_type,expected:oe.object,received:r.parsedType}),Oe;let n=[],i=this._def.keyType,o=this._def.valueType;for(let s in r.data)n.push({key:i._parse(new eo(r,s,r.path,s)),value:o._parse(new eo(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return sn.mergeObjectAsync(t,n);else return sn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof it)return new db({keyType:e,valueType:t,typeName:Te.ZodRecord,...We(r)});return new db({keyType:Gs.create(),valueType:e,typeName:Te.ZodRecord,...We(t)})}};fb=class fb extends it{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==oe.map)return te(r,{code:W.invalid_type,expected:oe.map,received:r.parsedType}),Oe;let n=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([s,a],c)=>({key:n._parse(new eo(r,s,r.path,[c,"key"])),value:i._parse(new eo(r,a,r.path,[c,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let a of o){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return Oe;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let a of o){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return Oe;if(c.status==="dirty"||u.status==="dirty")t.dirty();s.set(c.value,u.value)}return{status:t.value,value:s}}}};fb.create=(e,t,r)=>new fb({valueType:t,keyType:e,typeName:Te.ZodMap,...We(r)});zd=class zd extends it{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==oe.set)return te(r,{code:W.invalid_type,expected:oe.set,received:r.parsedType}),Oe;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)te(r,{code:W.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)te(r,{code:W.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let i=this._def.valueType;function o(a){let c=new Set;for(let u of a){if(u.status==="aborted")return Oe;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let s=[...r.data.values()].map((a,c)=>i._parse(new eo(r,a,r.path,c)));if(r.common.async)return Promise.all(s).then((a)=>o(a));else return o(s)}min(e,t){return new zd({...this._def,minSize:{value:e,message:xe.toString(t)}})}max(e,t){return new zd({...this._def,maxSize:{value:e,message:xe.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};zd.create=(e,t)=>new zd({valueType:e,minSize:null,maxSize:null,typeName:Te.ZodSet,...We(t)});Lm=class Lm extends it{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==oe.function)return te(t,{code:W.invalid_type,expected:oe.function,received:t.parsedType}),Oe;function r(s,a){return sb({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mm(),rc].filter((c)=>!!c),issueData:{code:W.invalid_arguments,argumentsError:a}})}function n(s,a){return sb({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mm(),rc].filter((c)=>!!c),issueData:{code:W.invalid_return_type,returnTypeError:a}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Vd){let s=this;return wn(async function(...a){let c=new Zn([]),u=await s._def.args.parseAsync(a,i).catch((p)=>{throw c.addIssue(r(a,p)),c}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,i).catch((p)=>{throw c.addIssue(n(d,p)),c})})}else{let s=this;return wn(function(...a){let c=s._def.args.safeParse(a,i);if(!c.success)throw new Zn([r(a,c.error)]);let u=Reflect.apply(o,this,c.data),d=s._def.returns.safeParse(u,i);if(!d.success)throw new Zn([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Lm({...this._def,args:Ks.create(e).rest(zl.create())})}returns(e){return new Lm({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Lm({args:e?e:Ks.create([]).rest(zl.create()),returns:t||zl.create(),typeName:Te.ZodFunction,...We(r)})}};Gm=class Gm extends it{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Gm.create=(e,t)=>new Gm({getter:e,typeName:Te.ZodLazy,...We(t)});Wm=class Wm extends it{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return te(t,{received:t.data,code:W.invalid_literal,expected:this._def.value}),Oe}return{status:"valid",value:e.data}}get value(){return this._def.value}};Wm.create=(e,t)=>new Wm({value:e,typeName:Te.ZodLiteral,...We(t)});Vl=class Vl extends it{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return te(t,{expected:at.joinValues(r),received:t.parsedType,code:W.invalid_type}),Oe}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return te(t,{received:t.data,code:W.invalid_enum_value,options:r}),Oe}return wn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Vl.create(e,{...this._def,...t})}exclude(e,t=this._def){return Vl.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}};Vl.create=Sz;Km=class Km extends it{_parse(e){let t=at.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==oe.string&&r.parsedType!==oe.number){let n=at.objectValues(t);return te(r,{expected:at.joinValues(n),received:r.parsedType,code:W.invalid_type}),Oe}if(!this._cache)this._cache=new Set(at.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=at.objectValues(t);return te(r,{received:r.data,code:W.invalid_enum_value,options:n}),Oe}return wn(e.data)}get enum(){return this._def.values}};Km.create=(e,t)=>new Km({values:e,typeName:Te.ZodNativeEnum,...We(t)});Vd=class Vd extends it{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==oe.promise&&t.common.async===!1)return te(t,{code:W.invalid_type,expected:oe.promise,received:t.parsedType}),Oe;let r=t.parsedType===oe.promise?t.data:Promise.resolve(t.data);return wn(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Vd.create=(e,t)=>new Vd({type:e,typeName:Te.ZodPromise,...We(t)});Io=class Io extends it{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:(o)=>{if(te(r,o),o.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async(s)=>{if(t.value==="aborted")return Oe;let a=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(a.status==="aborted")return Oe;if(a.status==="dirty")return qd(a.value);if(t.value==="dirty")return qd(a.value);return a});else{if(t.value==="aborted")return Oe;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});if(s.status==="aborted")return Oe;if(s.status==="dirty")return qd(s.value);if(t.value==="dirty")return qd(s.value);return s}}if(n.type==="refinement"){let o=(s)=>{let a=n.refinement(s,i);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return Oe;if(s.status==="dirty")t.dirty();return o(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return Oe;if(s.status==="dirty")t.dirty();return o(s.value).then(()=>({status:t.value,value:s.value}))})}if(n.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ul(o))return Oe;let s=n.transform(o.value,i);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(!Ul(o))return Oe;return Promise.resolve(n.transform(o.value,i)).then((s)=>({status:t.value,value:s}))});at.assertNever(n)}};Io.create=(e,t,r)=>new Io({schema:e,typeName:Te.ZodEffects,effect:t,...We(r)});Io.createWithPreprocess=(e,t,r)=>new Io({schema:t,effect:{type:"preprocess",transform:e},typeName:Te.ZodEffects,...We(r)});Po=class Po extends it{_parse(e){if(this._getType(e)===oe.undefined)return wn(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Po.create=(e,t)=>new Po({innerType:e,typeName:Te.ZodOptional,...We(t)});nc=class nc extends it{_parse(e){if(this._getType(e)===oe.null)return wn(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nc.create=(e,t)=>new nc({innerType:e,typeName:Te.ZodNullable,...We(t)});Ym=class Ym extends it{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===oe.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ym.create=(e,t)=>new Ym({innerType:e,typeName:Te.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...We(t)});Jm=class Jm extends it{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(qm(n))return n.then((i)=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Zn(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Zn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Jm.create=(e,t)=>new Jm({innerType:e,typeName:Te.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...We(t)});pb=class pb extends it{_parse(e){if(this._getType(e)!==oe.nan){let r=this._getOrReturnCtx(e);return te(r,{code:W.invalid_type,expected:oe.nan,received:r.parsedType}),Oe}return{status:"valid",value:e.data}}};pb.create=(e)=>new pb({typeName:Te.ZodNaN,...We(e)});_Dt=Symbol("zod_brand");j1=class j1 extends it{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}};mb=class mb extends it{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return Oe;if(i.status==="dirty")return t.dirty(),qd(i.value);else return this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return Oe;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new mb({in:e,out:t,typeName:Te.ZodPipeline})}};Xm=class Xm extends it{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(Ul(n))n.value=Object.freeze(n.value);return n};return qm(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}};Xm.create=(e,t)=>new Xm({innerType:e,typeName:Te.ZodReadonly,...We(t)});DDt={object:nr.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Te||(Te={}));_=Gs.create,C=Bd.create,EDt=pb.create,SDt=Ud.create,Le=ab.create,$Dt=Bm.create,kDt=cb.create,RDt=Um.create,CDt=zm.create,ADt=lb.create,ic=zl.create,ODt=Ws.create,TDt=ub.create,le=To.create,Y=nr.create,PDt=nr.strictCreate,Hd=Vm.create,M1=N1.create,IDt=Hm.create,FDt=Ks.create,wi=db.create,NDt=fb.create,jDt=zd.create,MDt=Lm.create,qDt=Gm.create,ut=Wm.create,bt=Vl.create,LDt=Km.create,BDt=Vd.create,UDt=Io.create,zDt=Po.create,VDt=nc.create,HDt=Io.createWithPreprocess,GDt=mb.create});var q1=N(()=>{ob();P1();wz();jm();$z();ib()});var Fn=N(()=>{q1();q1()});function L1(e){return hb.includes(e)}var F3e,Hl,hb,kz,N3e,Rz,j3e,Cz,M3e,q3e,Az,L3e,Oz,nEt,iEt,Tz,B3e,Pz,U3e,Iz,B1=20,U1=500,z3e,oEt;var Gd=N(()=>{Fn();F3e=bt(["pending","verified","approved","revoked"]),Hl=bt(["person","service","test"]),hb=Hl.options;kz={nemarOwner:"service",nemarAdmin:"service","test-admin":"service","test-owner":"service","cool-vibers":"test","test-user":"test","test-pending":"test","test-verified":"test","test-revoked":"test"},N3e=bt(["same_kind","orcid_linked","own_account","kind_changed_concurrently"]),Rz=N3e.options,j3e=bt(["active","pending","revoked"]),Cz=Y({field:_(),blocks:le(_()).optional(),set_on:le(_()).optional()}).passthrough(),M3e=Y({id:C().int(),username:_().nullable(),email:_(),github_username:_().nullable(),role:_(),orcid:_().nullable().optional(),created_at:_().optional(),approved_at:_().nullable().optional(),dataset_count:C().int().optional(),sandbox_completed:Le().optional(),sandbox_completed_at:_().nullable().optional(),sandbox_dataset_id:_().nullable().optional(),service_access:Le().optional(),status:F3e.optional(),email_verified:Le().optional(),orcid_verified:Le().optional(),given_name:_().nullable().optional(),family_name:_().nullable().optional(),profile_gaps:le(Cz).optional(),username_auto_assigned:Le().optional(),account_kind:Hl.optional()}).passthrough(),q3e=Y({prefix:_(),created_at:_(),last_used_at:_().nullable()}).passthrough().nullable(),Az=Y({user:M3e,token:q3e.optional()}).passthrough(),L3e=Y({id:C().int(),username:_().nullable(),email:_(),github_username:_().nullable(),status:_(),email_verified:C().int().nullable().optional(),role:_().nullable(),created_at:_(),approved_at:_().nullable().optional(),revoked_at:_().nullable().optional(),signup_source:_().nullable().optional(),service_access:C().int().nullable().optional(),service_access_granted_at:_().nullable().optional(),given_name:_().nullable().optional(),family_name:_().nullable().optional(),orcid:_().nullable().optional(),upload_access_requested_at:_().nullable().optional(),account_kind:Hl.optional(),matched_in:le(_()).optional(),match_kind:_().optional()}).passthrough(),Oz=Y({users:le(L3e),count:C().int()}).passthrough(),nEt=bt(["assigned","would_assign","single_name","no_name","lookup_failed","conflict","exhausted","write_failed"]),iEt=bt(["sent","already_verified","skipped_fence","rate_limited","failed","not_attempted"]),Tz=Y({suggestion:_().nullable(),based_on:bt(["name","unavailable","exhausted"])}).passthrough(),B3e=bt(["why_required","email_not_verified","profile_incomplete","github_username_unverified","github_unavailable","already_approved"]),Pz=B3e.options,U3e=bt(["invalid_github_username","city_required","country_required","empty_patch","username_too_short","username_too_long","username_charset","given_name_required","family_name_required","username_taken","username_locked","name_is_orcid_canonical","account_revoked","github_unavailable","same_email","code_expired","code_incorrect","orcid_already_have","orcid_unavailable"]),Iz=U3e.options,z3e=Y({id:C().int(),email:_(),username:_().nullable(),role:_(),status:j3e,email_verified:Le(),given_name:_().nullable(),family_name:_().nullable(),orcid:_().nullable(),orcid_verified:Le(),github_username:_().nullable(),city:_().nullable(),country:_().nullable(),affiliation:_().nullable(),service_access:Le(),service_access_granted_at:_().nullable(),upload_access_requested_at:_().nullable(),profile_gaps:le(Cz),username_auto_assigned:Le()}).passthrough(),oEt=Y({user:z3e.nullable()}).passthrough()});var z1,V1,lEt,V3e,uEt,H3e,Fz,Nz,H1=8,G1=100,jz,Mz,G3e,qz;var Qm=N(()=>{Fn();Gd();z1=["given_name","family_name","affiliation","city","country"],V1=["username","github_username","email","orcid"],lEt=[...z1,...V1],V3e={given_name:_().max(200).optional(),family_name:_().max(200).optional(),affiliation:_().max(500).optional(),city:_().max(200).optional(),country:_().max(200).optional(),username:_().max(100).optional(),github_username:_().max(100).optional(),email:_().max(320).optional(),orcid:_().max(40).optional()},uEt=Y(V3e),H3e=bt(["field_not_editable","owner_only_field","edit_own_account","owner_account","system_account","invalid_edit","orcid_already_proven","invalid_search","invalid_user_id"]),Fz=H3e.options,Nz=["exact","name","prefix","substring","fuzzy"],jz=Y({id:C().int(),username:_().nullable(),email:_(),github_username:_().nullable(),status:_(),role:_().nullable(),account_kind:Hl.optional(),email_verified:C().int().nullable().optional(),orcid:_().nullable().optional(),orcid_verified:C().int().nullable().optional(),given_name:_().nullable().optional(),family_name:_().nullable().optional(),affiliation:_().nullable().optional(),city:_().nullable().optional(),country:_().nullable().optional(),description:_().nullable().optional(),signup_source:_().nullable().optional(),created_at:_(),updated_at:_().nullable().optional(),approved_at:_().nullable().optional(),revoked_at:_().nullable().optional(),deleted_at:_().nullable().optional(),service_access:C().int().nullable().optional(),service_access_granted_at:_().nullable().optional(),service_access_granted_by:C().int().nullable().optional(),upload_access_requested_at:_().nullable().optional(),upload_access_notified_at:_().nullable().optional(),identity_conflict:C().int().nullable().optional(),username_auto_assigned:C().int().nullable().optional(),sandbox_completed:C().int().nullable().optional(),sandbox_completed_at:_().nullable().optional(),sandbox_dataset_id:_().nullable().optional(),aws_iam_username:_().nullable().optional(),dataset_count:C().int().optional(),active_tokens:C().int().optional(),linked_identities:le(_()).optional()}).passthrough(),Mz=Y({user:jz}).passthrough(),G3e=Y({from:_().nullable(),to:_().nullable()}),qz=Y({message:_(),changed:wi(_(),G3e),notes:le(_()).optional(),old_address_notified:Le().optional(),user:jz}).passthrough()});function Y3e(e){return e.startsWith("v")?e:`v${e}`}var W3e,K3e,Lz,pEt;var W1=N(()=>{Fn();W3e=/^v?\d+\.\d+\.\d+(?:-(?:rc|alpha|beta)\d*)?$/,K3e=/^v\d+\.\d+\.\d+(?:-(?:rc|alpha|beta)\d*)?$/;Lz=_().regex(W3e,"must be a semver version, optionally v-prefixed").transform(Y3e),pEt=_().regex(K3e,"must be the canonical v-prefixed tag (vX.Y.Z)")});function Uz(e,t){if(e.zarr_index_url!=null&&e.zarr_status!=="ready")t.addIssue({code:W.custom,message:"zarr_index_url must be null/absent unless zarr_status is 'ready'",path:["zarr_index_url"]})}function zz(e,t){if(e.zarr_verified_at!=null&&e.zarr_verify_status==null)t.addIssue({code:W.custom,message:"zarr_verified_at must be null/absent unless zarr_verify_status is non-null",path:["zarr_verified_at"]})}var J3e="0.4.1",K1,Wd,Bz,X3e,Q3e,Z3e,Vz,yEt,Hz,bEt,Ys,e4e,gb,xEt,t4e,r4e,wEt;var Y1=N(()=>{Fn();W1();K1=bt(["openneuro","nemar","gin","other"]),Wd=Hd([ut(0),ut(1)]).nullable(),Bz=Y({dataset_id:_(),id:_().optional(),name:_(),description:_().nullable().optional(),status:_(),visibility:_(),anonymous:C().int().nullable().optional(),concept_doi:_().nullable().optional(),doi:_().nullable().optional(),created_at:_(),updated_at:_().optional(),first_published_at:_().nullable().optional(),owner_username:_().nullable().optional(),source:_().nullable().optional(),modalities:_().optional(),participants:C().int().nonnegative(),tasks:_().optional(),authors:_().optional(),license:_().optional(),file_size:C().nonnegative(),file_size_formatted:_().optional(),total_files:C().nonnegative().nullable().optional(),num_citations:C().int().nonnegative().optional(),n_channels:C().int().nullable().optional(),electrode_system:_().nullable().optional(),has_hed:Wd.optional(),hed_version:_().nullable().optional(),data_complete:Wd.optional(),bytes_present:C().nonnegative().nullable().optional(),latest_version:Lz.nullable().optional(),latest_version_at:_().nullable().optional(),subject_count:C().int().nullable().optional(),file_size_bytes:C().nullable().optional(),sessions_count:C().int().nullable().optional(),age_min:C().nullable().optional(),age_max:C().nullable().optional(),bids_version:_().nullable().optional(),zarr_status:bt(["pending","ready","failed"]).nullable().optional(),zarr_store_count:C().int().nullable().optional(),zarr_converted_at:_().nullable().optional(),zarr_source_commit:_().nullable().optional(),zarr_errors:C().int().nullable().optional(),zarr_failure_count:C().int().nullable().optional(),zarr_deterministic:Wd.optional(),zarr_failed_at:_().nullable().optional(),zarr_index_url:_().nullable().optional(),zarr_verify_status:bt(["verified","failed","unverifiable"]).nullable().optional(),zarr_verified_at:_().nullable().optional(),zarr_requeue_at:_().nullable().optional(),anonymity_status:bt(["verified","findings","unverifiable"]).nullable().optional(),anonymity_checked_at:_().nullable().optional(),anonymity_findings:_().nullable().optional(),anonymity_unchecked:_().nullable().optional(),total_recording_duration:C().nullable().optional(),recording_duration_min:C().nullable().optional(),recording_duration_max:C().nullable().optional(),recording_count:C().int().nullable().optional(),recordings_unavailable:C().int().nullable().optional(),channel_count_min:C().int().nullable().optional(),channel_count_max:C().int().nullable().optional(),sampling_frequency:C().nullable().optional(),power_line_frequency:C().nullable().optional(),eeg_reference:_().nullable().optional(),placement_scheme:_().nullable().optional()}).passthrough();X3e=Bz.superRefine((e,t)=>{Uz(e,t),zz(e,t)}),Q3e=Bz.extend({file_size:C().nonnegative().nullable(),file_size_formatted:_().nullable().optional(),modalities:_().nullable().optional(),tasks:_().nullable().optional(),authors:_().nullable().optional(),license:_().nullable().optional(),owner_github:_().nullable().optional(),attestation_deposit_type:bt(["owner","redistribution"]).nullable().optional(),attestation_key_status:bt(["destroyed","retained"]).nullable().optional(),attestation_deidentified:Wd.optional(),attestation_no_duplicate:Wd.optional(),attestation_upstream_source:_().nullable().optional(),attestation_accepted_at:_().nullable().optional(),zarr_data_failures:Y({count:C().int().nonnegative(),detail_ref:_(),compacted_by:_().optional(),pending:C().int().nonnegative().optional(),discovered:C().int().nonnegative().optional(),events_upload_failed:ut(!0).optional(),manifest_upload_failed:ut(!0).optional()}).passthrough().nullable().optional()}).passthrough().superRefine((e,t)=>{Uz(e,t),zz(e,t)}),Z3e=Y({id:_(),name:_(),modalities:_().nullable().optional(),participants:C().int().nullable().optional(),doi:_().nullable().optional(),tasks:_().nullable().optional(),authors:_().nullable().optional(),has_hed:Wd.optional(),score:C().optional(),snippet:_().optional()}).passthrough(),Vz=wi(_(),C().int().nonnegative()),yEt=Y({datasets:le(X3e),count:C().int().nonnegative(),total_count:C().int().nonnegative().optional(),limit:C().int().optional(),offset:C().int().optional(),excluded_unknown:C().int().nonnegative().optional(),excluded_unknown_by_facet:Vz.optional()}).passthrough(),Hz=Y({results:le(Z3e),count:C().int().nonnegative(),returned:C().int().nonnegative().optional(),offset:C().int().nonnegative().optional(),limit:C().int().optional(),candidate_ceiling:C().int().optional(),truncated:Le().optional(),method:bt(["exact_id","text","text_fallback","semantic","unavailable"]).optional(),min_score:C().optional(),warning:_().optional(),excluded_unknown:C().int().nonnegative().optional(),excluded_unknown_by_facet:Vz.optional()}).passthrough(),bEt=Y({dataset:Q3e}).passthrough(),Ys=Y({value:_(),count:C().int().nonnegative()}),e4e=Y({values:le(Ys),distinct_total:C().int().nonnegative(),truncated:Le()}),gb=Y({"electrode-system":le(Ys).optional(),source:le(Ys).optional(),zarr:le(Ys).optional(),powerline:le(Ys).optional(),"bids-version":le(Ys).optional(),"hed-version":le(Ys).optional(),license:le(Ys).optional(),modality:le(Ys).optional(),task:e4e.optional(),warning:_().optional()}).passthrough(),xEt=Y({schema_version:ut(J3e),doc_type:ut("dataset"),dataset_id:_().regex(/^[a-z]{2}\d+$/,"neuroschema dataset_id pattern"),name:_(),source:K1,recording_modality:le(_()).min(1),description:_().nullable().optional(),bids_version:_().nullable().optional(),license:_().nullable().optional()}).passthrough(),t4e=Y({tasks:wi(Y({runs:le(_())}).passthrough())}).passthrough(),r4e=Y({sessions:le(_()),modalities:wi(t4e),session_modalities:wi(le(_())).optional()}).passthrough(),wEt=Y({version:_(),subjects:wi(r4e)}).passthrough()});function yb(e){return typeof e==="string"&&Gz.includes(e)}var n4e,DEt,EEt,SEt,Gz,i4e="ci_check_unavailable",Wz,Kz,Yz,Jz="X-Approval-Dispatch-Token",$Et;var Zm=N(()=>{Fn();n4e=/^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/,DEt=_().regex(n4e,"ORCID must be in format 0000-0000-0000-000X"),EEt=bt(["found","no_public_name","lookup_failed"]),SEt=bt(["bids_validation_failed","bids_validation_pending","bids_validation_in_progress","prescreen_failed","min_requirements_failed","owner_name_missing","identifier_screen_findings"]),Gz=["bids_validation_pending","bids_validation_in_progress"];Wz=[i4e],Kz=["identifier_screen_pending","identifier_screen_not_clear","identifier_screen_not_applicable"],Yz=["publication_review_not_clear","request_blocked","request_changed","request_mismatch","dispatch_superseded","dispatch_expired","decision_with_dispatch_token","approval_in_flight","deny_after_publishing","invalid_dataset_id","approval_closed_during_run"],$Et=bt(["filled","would_fill","no_public_name","lookup_failed","write_failed"])});var o4e,Xz,eh="https://nemar.org/settings",CEt,s4e,a4e,c4e,Qz,Zz;var J1=N(()=>{Fn();o4e=bt(["orcid_in_use","orcid_already_linked","orcid_linked_other","email_in_use","github_in_use","identity_conflict_remains"]),Xz=o4e.options,CEt={orcid_in_use:`That ORCID iD already belongs to a NEMAR account. Sign in to that account instead; if you want the iD on a different account, unlink it there first (Settings, ${eh}).`,orcid_already_linked:`That ORCID iD already belongs to a NEMAR account. Sign in to that account instead; if you want the iD on a different account, unlink it there first (Settings, ${eh}).`,orcid_linked_other:`That ORCID iD is linked to a different NEMAR account. Unlink it there first (Settings, ${eh}), then link it here.`,email_in_use:`That email address already belongs to a NEMAR account. Sign in to that account instead, or change its address first (Settings, ${eh}).`,github_in_use:`That GitHub account is already linked to a NEMAR account. Sign in to that account instead, or change its GitHub username first (Settings, ${eh}).`,identity_conflict_remains:"The collision that flagged this account is still there. Resolve it on the other account first (change its email or GitHub username, or unlink its ORCID iD), or delete that account, then clear the flag."},s4e=bt(["orcid","email","github"]),a4e=Y({id:C().int(),username:_().nullable(),email:_(),created_at:_(),has_oauth_identity:Le(),dataset_count:C().int(),identity_conflict:C().int(),canonical:Le()}).passthrough(),c4e=Y({kind:s4e,value:_(),canonical_user_id:C().int(),accounts:le(a4e)}).passthrough(),Qz=Y({groups:le(c4e),group_count:C().int(),flagged_count:C().int()}).passthrough(),Zz=Y({ok:ut(!0),id:C().int(),cleared:Le()}).passthrough()});var X1=120,eV=64,Q1="unnamed machine",l4e=25,bb,tV,Kd,rV,TEt,PEt,nV,u4e,d4e,iV,Z1,oV,IEt,FEt,xb,wb;var vb=N(()=>{Fn();bb=bt(["authorization_pending","slow_down","expired_token","access_denied","invalid_grant"]),tV={authorization_pending:"Waiting for you to authorize this machine in the browser.",slow_down:"Polling too quickly; the CLI will slow down automatically.",expired_token:"The code expired. Run `nemar auth login` again for a new one.",access_denied:"This sign-in was declined in the browser. Run `nemar auth login` again if that was a mistake.",invalid_grant:"That code is no longer valid. Run `nemar auth login` again for a new one."},Kd=bt(["device_code_unknown","device_code_expired","device_code_used","device_code_denied","account_pending","account_revoked","identity_conflict","service_account","person_account","too_many_keys","key_not_found"]),rV=Kd.options,TEt={device_code_unknown:"That code was not found. Check the code shown in your terminal, or run `nemar auth login` again for a new one.",device_code_expired:"The code expired. Run `nemar auth login` again for a new one.",device_code_used:"That code has already been used. Run `nemar auth login` again for a new one.",device_code_denied:"This sign-in was declined in the browser. Run `nemar auth login` again if that was a mistake.",account_pending:"Verify your email address first. Check your inbox for the NEMAR verification code, then authorize again.",account_revoked:"Your NEMAR account access has been revoked. Contact the NEMAR team if you think this is a mistake.",identity_conflict:"This account shares an identifier with another NEMAR account and cannot sign in until that is resolved. Fix it in Settings on nemar.org or contact the NEMAR team.",service_account:"This is a service or test account, and it cannot sign in this way. Ask an owner to create a key for it with `nemar admin keys create`.",person_account:"This account belongs to a person. A person creates their own keys with `nemar auth login` or in Settings on nemar.org.",too_many_keys:`This account already has ${l4e} active keys. Revoke one in Settings on nemar.org or with \`nemar auth keys\`, then try again.`,key_not_found:"That key was not found on this account, or it is already revoked. Run `nemar auth keys` to see the active ones."},PEt=Y({error:Kd,message:_()}).passthrough(),nV=Y({device_code:_(),user_code:_(),verification_uri:_(),verification_uri_complete:_(),expires_in:C().int(),interval:C().int()}).passthrough(),u4e=M1("error",[Y({error:ut("authorization_pending"),message:_()}).passthrough(),Y({error:ut("slow_down"),message:_()}).passthrough()]),d4e=M1("error",[Y({error:ut("expired_token"),reason:Kd,message:_()}).passthrough(),Y({error:ut("access_denied"),reason:Kd,message:_()}).passthrough(),Y({error:ut("invalid_grant"),reason:Kd,message:_()}).passthrough()]),iV=Hd([u4e,d4e]),Z1=Y({id:C().int(),name:_().nullable(),prefix:_(),created_at:_(),last_used_at:_().nullable(),current:Le()}).passthrough(),oV=Y({api_key:_(),key:Z1,user:Y({username:_().nullable(),email:_(),github_username:_().nullable(),role:_(),sandbox_completed:Le(),sandbox_dataset_id:_().nullable()}).passthrough()}).passthrough(),IEt=Y({user_code:_(),machine_name:_(),requested_at:_(),expires_in:C().int(),account:Y({username:_().nullable(),email_masked:_()}).passthrough(),refusal:Y({code:Kd,message:_()}).passthrough().nullable()}).passthrough(),FEt=Y({ok:ut(!0),machine_name:_()}).passthrough(),xb=Y({keys:le(Z1)}).passthrough(),wb=Y({api_key:_(),key:Z1}).passthrough()});function xr(e){return ir[e]}function Js(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>Object.hasOwn(t,n)?t[n]:r)}var ir;var Yd=N(()=>{ir={"tier.unverified.label":"Email not verified","tier.base.label":"Base access","tier.upload.label":"Upload access","tier.unverified.lede":"Verify your email address to activate your account.","upload_access.section.title":"Upload access","upload_access.section.lede":"A one-time admin grant. Reviewed against export-control and local-jurisdiction rules.","upload_access.state.granted":"Granted","upload_access.state.requested":"Requested","upload_access.state.not_requested":"Not requested","upload_access.invite.title":"Want to contribute a dataset?","upload_access.invite.body":"Browsing, searching and downloading are open to your account already. Uploading, or being added as a collaborator on someone else\u2019s dataset, needs one extra grant: an admin checks your GitHub handle and location against export-control and local-jurisdiction rules, once. Your email address must be verified first.","upload_access.gate.title":"Ask for upload access first","upload_access.gate.body":"Your account can browse, search and download everything public already. Uploading, or being added as a collaborator on someone else\u2019s dataset, needs one extra grant, and your email address must be verified first: an admin checks your GitHub handle and where you\u2019re based against export-control and local-jurisdiction rules. You ask once, and it is answered by email.","upload_access.request.cta":"Request upload access","upload_access.request.form_body":"Tell us what you plan to deposit, or which dataset you want to collaborate on. An admin reviews this alongside your name, username, GitHub handle and location, then grants access once.","upload_access.request.why_label":"What do you intend to upload?","upload_access.request.why_hint":"Describe what you intend to upload in 20-500 characters","upload_access.requested.title":"Your request is with an admin","upload_access.requested.lede":"An admin is reviewing your request.","upload_access.requested.lede_dated":"An admin is reviewing your request from {date}.","upload_access.requested.body.upload":"We\u2019ll email you when there\u2019s a decision, and this page will let you upload as soon as it\u2019s granted.","upload_access.requested.body":"We\u2019ll email you when there\u2019s a decision. Everything else on your account keeps working in the meantime.","upload_access.requested.cta":"See the request","upload_access.granted.body":"You can upload datasets from the upload page. Publishing one is a separate, per-dataset review you start from your dashboard.","upload_access.unverified.body":"Verify your email address first \u2014 the review happens over email.","upload_access.docs_link":"How upload access works","gap.sentence":"{label} is missing: needed {blocks}.","gap.set_on.both":"Set it in {web} or run `{cli}`.","gap.set_on.web":"Set it in {web}.","gap.blocks.verified":"to activate your account","gap.blocks.upload_access":"to request upload access","gap.blocks.publication":"to publish a dataset","gap.blocks.unknown":"to finish setting up your account","gap.blocks.noun.verified":"account activation","gap.blocks.noun.upload_access":"upload access","gap.blocks.noun.publication":"publication","gap.set_on.default_web":"Settings","gap.field.email_verified.label":"A verified email address","gap.field.username.label":"Username","gap.field.given_name.label":"Given name","gap.field.family_name.label":"Family name","gap.field.orcid_verified.label":"Verified ORCID iD","gap.field.github_username.label":"GitHub handle","gap.field.city.label":"City","gap.field.country.label":"Country","gap.field.why.label":"A description of what you intend to upload","gap.field.email_verified.set_on.web":"the verify step on your dashboard","gap.field.email_verified.set_on.cli":"nemar auth resend-verification","gap.field.username.set_on.web":"Settings","gap.field.username.set_on.cli":"nemar auth profile set-username","gap.field.given_name.set_on.web":"Settings","gap.field.given_name.set_on.cli":"nemar auth profile set-name","gap.field.family_name.set_on.web":"Settings","gap.field.family_name.set_on.cli":"nemar auth profile set-name","gap.field.given_name.set_on.web.orcid":"your ORCID record at orcid.org, then sign in again","gap.field.family_name.set_on.web.orcid":"your ORCID record at orcid.org, then sign in again","gap.field.orcid_verified.set_on.web":"Settings","gap.field.orcid_verified.set_on.cli":"nemar auth profile orcid link","gap.field.github_username.set_on.web":"Settings","gap.field.github_username.set_on.cli":"nemar auth profile set-github","gap.field.city.set_on.web":"Settings","gap.field.city.set_on.cli":"nemar auth profile set-location","gap.field.country.set_on.web":"Settings","gap.field.country.set_on.cli":"nemar auth profile set-location","gap.field.why.set_on.web":"the request form in Settings","gap.field.why.set_on.cli":"nemar auth request-upload-access","gaps.title":"What is still missing","gaps.none":"Nothing outstanding \u2014 every field NEMAR needs is filled in.","gaps.nudge.title":"Your profile isn\u2019t finished yet","gaps.nudge.cta":"Complete your profile","gaps.upload.title":"Before you can ask, your account still needs:","gaps.request.title":"Finish these first:","gaps.admin.title":"Still missing","gaps.admin.item":"{label} \u2014 blocks {blocks}","gaps.admin.none":"Nothing missing \u2014 every field the request needs is filled in.","gaps.admin.not_loaded":"Not loaded \u2014 open the user page to see what is still missing.","onboarding.username.auto_assigned.title":"We chose your username from your name","onboarding.username.auto_assigned.body":"Your account needed a username to be listed as a dataset owner, so one was made from your name when you signed in. You can change it once, here, until an admin grants you upload access.","welcome.unverified.title":"Verify your email address","welcome.unverified.body":"Authorizing with ORCID created your NEMAR account and signed you in. One step left: enter the 6-digit code we emailed you. That activates the account \u2014 no admin approval is involved.","welcome.active.title":"Your account is active","welcome.active.body":"Authorizing with ORCID created your NEMAR account and signed you in. There is no separate sign-up step and no approval queue: browse, search, and your dashboard all work right now.","welcome.upload_access.title":"Ask for upload access when you\u2019re ready to contribute","welcome.upload_access.body":"Reading is open to every verified account. Uploading and compute need one extra grant, because an admin has to check your GitHub handle and location against export-control and local-jurisdiction rules first. You ask once, from Settings.","cli.gaps.section.title":"Profile","cli.gaps.unknown":"not checked: run 'nemar auth status --refresh'","cli.gaps.unreported":"not reported by this backend","cli.gap.set_on.cli_only":"Run `{cli}`.","cli.gap.field.sandbox.label":"Sandbox training","cli.gap.blocks.sandbox":"to upload a dataset from the CLI","cli.gap.field.sandbox.set_on.cli":"nemar sandbox","cli.gaps.sandbox_unchecked":"Sandbox training could not be confirmed with the server. Run `nemar sandbox status --refresh`, then `nemar sandbox` if it is still outstanding.","cli.upload.preflight.title":"Upload access is not granted yet","cli.upload.preflight.body":"Browsing, searching and downloading are open to your account already. Uploading, or being added as a collaborator on someone else\u2019s dataset, needs one extra grant: an admin checks your GitHub handle and location against export-control and local-jurisdiction rules, once. Your email address must be verified first.","cli.upload_access.cta":"Ask for it with `nemar auth request-upload-access`.","cli.upload.preflight.unchecked":"Upload access could not be checked ({reason}); continuing.","cli.upload.preflight.gaps_unknown":"Could not determine what is still missing; run `nemar auth profile` for the list.","cli.upload.preflight.dry_run":"Continuing anyway: --dry-run uploads nothing."}});function p4e(e){return e==="verified"||e==="upload_access"||e==="publication"}function Jd(e){return(e??"").trim().length===0}function m4e(e){return e==="service"||e==="test"}function cV(e,t={}){let r=t.orcidVerified===!0,n=Object.hasOwn(_b,e)?_b[e]:void 0;if(!n)return{field:e,label:e,blocks:t.blocks??[],setOnWeb:ir["gap.set_on.default_web"],setOnCli:null,known:!1};let i=r&&n.orcidWebKey!==void 0;return{field:e,blocks:t.blocks??n.blocks,label:ir[n.labelKey],setOnWeb:ir[i?n.orcidWebKey:n.webKey],setOnCli:i||n.cliKey===null?null:ir[n.cliKey],known:!0}}function sV(e){let t=ek.indexOf(e);return t===-1?ek.length:t}function lV(e,t={}){return e.map((r)=>cV(r,{orcidVerified:t.orcidVerified}))}function Db(e,t={}){return e.filter((r)=>!!r&&typeof r.field==="string").map((r)=>{let n=Array.isArray(r.blocks)?r.blocks.filter(p4e):[];return cV(r.field,{orcidVerified:t.orcidVerified,blocks:n.length>0?n:void 0})}).sort((r,n)=>sV(r.field)-sV(n.field))}function tk(e){let t=e.blocks[0],r=t?ir[f4e[t]]:ir["gap.blocks.unknown"],n=Js(ir["gap.sentence"],{label:"",blocks:r}).trimStart(),i=e.setOnCli?Js(ir["gap.set_on.both"],{web:e.setOnWeb,cli:e.setOnCli}):Js(ir["gap.set_on.web"],{web:e.setOnWeb});return`${n} ${i}`}function uV(e){return`${e.label} ${tk(e)}`}function Eb(){let e=Js(ir["gap.sentence"],{label:aV.label,blocks:ir["cli.gap.blocks.sandbox"]}),t=Js(ir["cli.gap.set_on.cli_only"],{cli:aV.command});return`${e} ${t}`}function dV(){return ir["cli.gaps.sandbox_unchecked"]}var _b,ek,qEt,f4e,aV;var Xd=N(()=>{Yd();_b={email_verified:{blocks:["verified","upload_access"],labelKey:"gap.field.email_verified.label",webKey:"gap.field.email_verified.set_on.web",cliKey:"gap.field.email_verified.set_on.cli",isMissing:(e)=>e.status==="pending"||e.email_verified===!1},username:{blocks:["upload_access"],labelKey:"gap.field.username.label",webKey:"gap.field.username.set_on.web",cliKey:"gap.field.username.set_on.cli",isMissing:(e)=>e.username!==void 0&&Jd(e.username)},given_name:{blocks:["upload_access","publication"],labelKey:"gap.field.given_name.label",webKey:"gap.field.given_name.set_on.web",cliKey:"gap.field.given_name.set_on.cli",orcidWebKey:"gap.field.given_name.set_on.web.orcid",isMissing:(e)=>Jd(e.given_name)},family_name:{blocks:["upload_access","publication"],labelKey:"gap.field.family_name.label",webKey:"gap.field.family_name.set_on.web",cliKey:"gap.field.family_name.set_on.cli",orcidWebKey:"gap.field.family_name.set_on.web.orcid",isMissing:(e)=>Jd(e.family_name)},orcid_verified:{blocks:["upload_access"],labelKey:"gap.field.orcid_verified.label",webKey:"gap.field.orcid_verified.set_on.web",cliKey:"gap.field.orcid_verified.set_on.cli",isMissing:(e)=>e.orcid_verified!==!0&&!m4e(e.account_kind)},github_username:{blocks:["upload_access","publication"],labelKey:"gap.field.github_username.label",webKey:"gap.field.github_username.set_on.web",cliKey:"gap.field.github_username.set_on.cli",isMissing:(e)=>Jd(e.github_username)},city:{blocks:["upload_access"],labelKey:"gap.field.city.label",webKey:"gap.field.city.set_on.web",cliKey:"gap.field.city.set_on.cli",isMissing:(e)=>Jd(e.city)},country:{blocks:["upload_access"],labelKey:"gap.field.country.label",webKey:"gap.field.country.set_on.web",cliKey:"gap.field.country.set_on.cli",isMissing:(e)=>Jd(e.country)},why:{blocks:["upload_access"],labelKey:"gap.field.why.label",webKey:"gap.field.why.set_on.web",cliKey:"gap.field.why.set_on.cli",isMissing:null}},ek=Object.keys(_b),qEt=ek.filter((e)=>_b[e].isMissing!==null),f4e={verified:"gap.blocks.verified",upload_access:"gap.blocks.upload_access",publication:"gap.blocks.publication"};aV={field:"sandbox",label:ir["cli.gap.field.sandbox.label"],command:ir["cli.gap.field.sandbox.set_on.cli"]}});function Rb(e,t){let r=e.sss!==void 0;if(e.derived!==r)t.addIssue({code:W.custom,path:["sss"],message:e.derived?"derived is true but sss is absent (ADR 0028: the two travel together)":"sss is present but derived is false (ADR 0028: the two travel together)"})}var vn,Sb,fV,$b,h4e,kb,g4e,y4e,b4e,x4e,w4e,UEt,v4e,zEt,_4e,VEt;var rk=N(()=>{Fn();vn=/^[a-z]{2}[0-9]{6}$/,Sb=/^[0-9a-f]{40}$/,fV=Y({name:_(),modality:_().nullable().optional(),rate:C().nullable().optional(),n_channels:C().int().nonnegative().nullable().optional(),n_samples:C().int().nonnegative().nullable().optional(),duration_s:C().nonnegative().nullable().optional(),source_rate_hz:C().nullable().optional(),n_view_levels:C().int().nonnegative().optional(),view_chunk_columns:C().int().positive().optional(),chunk_samples:C().int().positive().optional(),shard_samples:C().int().positive().optional()}).passthrough(),$b=Y({converted:C().int().nonnegative().optional(),relabelled:C().int().nonnegative().optional(),kept_importer_unit:C().int().nonnegative().optional(),units_column_present:Le().optional(),sidecar:_().optional(),sidecar_supplied:Le().optional(),unmatched_channels:C().int().nonnegative().optional(),unmatched_case_only:C().int().positive().optional(),matched_case_only:C().int().positive().optional(),matched_case_only_examples:le(_()).max(5).optional(),unmatched_raw_label:C().int().positive().optional(),unmatched_examples:le(_()).max(5).optional()}).passthrough(),h4e=Y({channels_tsv:C().int().positive(),in_file:C().int().nonnegative(),in_store:C().int().nonnegative()}).passthrough(),kb=Y({applied:Le().optional(),method:_().optional(),calibration:_().optional(),cross_talk:_().optional(),mne_version:_().optional()}).passthrough();g4e=Y({path:_(),zarr:_().regex(/\.zarr$/,"must end in .zarr"),updated_utc:_().optional(),source_tree:ut("raw"),derived:Le(),modalities:le(_()).optional(),groups:le(fV).optional(),power_line_frequency:C().nullable().optional(),event_description_count:C().int().nonnegative().optional(),n_events:C().int().nonnegative().optional(),trial_types:wi(_(),C().int().nonnegative()).optional(),units_report:$b.optional(),channels_tsv_read_error:Le().optional(),channels_tsv_count_mismatch:h4e.optional(),split_members:le(_()).optional(),sss:kb.optional()}).passthrough().superRefine(Rb),y4e=Y({path:_(),zarr:_().regex(/\.zarr$/,"must end in .zarr").optional(),code:_(),reason:_(),detail:_().nullable().optional(),attempts:C().int().nonnegative().optional()}).passthrough(),b4e=bt(["infra_failure","memory_budget","not_attempted"]),x4e=Y({path:_(),zarr:_().regex(/\.zarr$/,"must end in .zarr"),reason:b4e,attempts:C().int().nonnegative(),last_error:_().nullable().optional(),last_attempt_utc:_().nullable().optional()}).passthrough(),w4e=Y({level0:ut("<zarr>/<group>/0"),view:ut("<zarr>/<group>/view/<L>"),view_levels:ut("1..n_view_levels from the group attrs"),scale_offset:ut("level-0 array attrs scale[] and offset[]; physical = digital * scale + offset"),events:ut("<data_base>events.parquet").optional()}).passthrough(),UEt=Y({format:ut("nemar-zarr-index"),format_version:ut(3),dataset_id:_().regex(vn,"NEMAR dataset id (nm/on/xx band)"),contract_base:_().regex(/^https:\/\//,"must be https"),data_base:_().regex(/^https:\/\//,"must be https"),data_base_kind:ut("s3-public"),s3_uri:_().regex(/^s3:\/\//,"must be an s3:// URI"),s3_region:_().min(1),s3_anonymous:Le(),source_commit:_().regex(Sb,"must be a full 40-hex SHA"),engine_version:_().min(1),biosigio_version:_().nullable().optional(),updated_utc:_(),discovered_count:C().int().nonnegative(),store_count:C().int().nonnegative(),n_recordings:C().int().nonnegative(),errors:C().int().nonnegative(),failure_count:C().int().nonnegative(),pending_count:C().int().nonnegative(),stores:le(g4e),failures:le(y4e),pending:le(x4e),doi:_().nullable().optional(),license:_().nullable().optional(),citation:_().nullable().optional(),hed_version:_().nullable().optional(),events_parquet:_().regex(/^https:\/\//,"must be https").optional(),events_row_count:C().int().nonnegative().optional(),layout:w4e}).passthrough(),v4e=Y({name:_(),configuration:wi(_(),ic()).optional()}).passthrough(),zEt=Y({zarr_format:ut(3),node_type:ut("array"),shape:le(C().int().nonnegative()),data_type:_(),chunk_grid:Y({name:_(),configuration:wi(_(),ic()).optional()}).passthrough(),codecs:le(v4e),fill_value:ic().optional(),attributes:wi(_(),ic()).optional(),dimension_names:le(_().nullable()).optional()}).passthrough(),_4e=Y({path:_(),zarr:_().regex(/\.zarr$/,"must end in .zarr"),groups:le(fV).optional(),modalities:le(_()).optional()}).passthrough(),VEt=Y({format:ut("nemar-zarr-index"),format_version:C().int(),dataset_id:_().regex(vn,"NEMAR dataset id (nm/on/xx band)"),source_commit:_(),stores:le(_4e)}).passthrough()});function pV(e){let t=e.unit?` (${e.unit})`:"";switch(e.valueKind){case"enum":return`${e.label} -- comma-separated, one or more of: ${(e.enumValues??[]).join(", ")}`;case"number":return`${e.label}${t} -- range (e.g. 10..50, 10.., ..50, or 10)`;case"bytes":return`${e.label}${t} -- range with optional units (e.g. 10gb..2tb, 500mb.., ..1gb; bare = bytes)`;case"duration":return`${e.label}${t} -- range with optional units (e.g. 30m..2h, 100h.., ..90s; bare = seconds)`;case"text":return`${e.label} -- substring match`;case"version":return`${e.label} -- exact or prefix match`}}var D4e,E4e,S4e,$4e,Fo,WEt;var Cb=N(()=>{Y1();D4e=["10-05","10-10","10-20","biosemi","egi-geodesic","other"],E4e=["50","60"],S4e=["ready","pending","failed"],$4e=K1.options,Fo=[{key:"subjects",flag:"--subjects",queryParam:"subjects",valueKind:"number",label:"Subject count",unit:"subjects"},{key:"channels",flag:"--channels",queryParam:"channels",valueKind:"number",label:"Channel count",unit:"channels"},{key:"sessions",flag:"--sessions",queryParam:"sessions",valueKind:"number",label:"Session count",unit:"sessions"},{key:"size",flag:"--size",queryParam:"size",valueKind:"bytes",label:"Dataset size"},{key:"files",flag:"--files",queryParam:"files",valueKind:"number",label:"File count",unit:"files"},{key:"citations",flag:"--citations",queryParam:"citations",valueKind:"number",label:"Citation count",unit:"citations"},{key:"duration",flag:"--duration",queryParam:"duration",valueKind:"duration",label:"Total recording duration"},{key:"recording-length",flag:"--recording-length",queryParam:"recording_length",valueKind:"duration",label:"Per-recording duration"},{key:"recordings",flag:"--recordings",queryParam:"recordings",valueKind:"number",label:"Recording count",unit:"recordings"},{key:"unavailable",flag:"--unavailable",queryParam:"unavailable",valueKind:"number",label:"Unavailable recording count",unit:"recordings"},{key:"age",flag:"--age",queryParam:"age",valueKind:"number",label:"Participant age",unit:"years"},{key:"rate",flag:"--rate",queryParam:"rate",valueKind:"number",label:"Sampling rate",unit:"Hz"},{key:"powerline",flag:"--powerline",queryParam:"powerline",valueKind:"enum",label:"Power line frequency",enumValues:E4e},{key:"reference",flag:"--reference",queryParam:"reference",valueKind:"text",label:"EEG reference"},{key:"placement",flag:"--placement",queryParam:"placement",valueKind:"text",label:"Electrode placement scheme"},{key:"electrode-system",flag:"--electrode-system",queryParam:"electrode_system",valueKind:"enum",label:"Electrode system",enumValues:D4e},{key:"source",flag:"--source",queryParam:"source",valueKind:"enum",label:"Source archive",enumValues:$4e},{key:"zarr",flag:"--zarr",queryParam:"zarr",valueKind:"enum",label:"Zarr conversion status",enumValues:S4e},{key:"bids-version",flag:"--bids-version",queryParam:"bids_version",valueKind:"version",label:"BIDS version"},{key:"hed-version",flag:"--hed-version",queryParam:"hed_version",valueKind:"version",label:"HED version"}],WEt=new Map(Fo.map((e)=>[e.key,e]))});var k4e,QEt,R4e,bV,th,mV,C4e,xV,A4e=20,O4e=100,T4e,wV,P4e,ZEt,eSt,I4e,tSt,rSt,F4e,N4e,j4e,nSt,M4e=50,q4e=500,iSt,L4e,B4e,oSt,U4e=1000,z4e=5000,hV=8,V4e=100,H4e=32,gV,sSt,G4e,W4e,K4e,aSt,Y4e=800,J4e=4000,cSt,lSt,nk=60,ik=64,yV,X4e=86400,Q4e=4096,uSt,Z4e,e8e,dSt;var vV=N(()=>{Fn();Cb();rk();k4e=Y({dataset_id:_().regex(vn),name:_(),doi:_().nullable().optional(),license:_().nullable().optional(),modalities:le(_()).optional(),tasks:le(_()).optional(),subject_count:C().int().nonnegative().nullable().optional(),has_hed:Hd([ut(0),ut(1)]).nullable().optional(),hed_version:_().nullable().optional(),store_count:C().int().nonnegative().nullable().optional(),recording_count:C().int().nonnegative().nullable().optional(),recordings_unavailable:C().int().nonnegative().nullable().optional(),total_recording_duration:C().nullable().optional(),zarr_converted_at:_().nullable().optional(),zarr_source_commit:_().nullable().optional(),zarr_errors:C().int().nonnegative().nullable().optional(),zarr_verify_status:bt(["verified","failed","unverifiable"]).nullable().optional(),zarr_verified_at:_().nullable().optional(),index_url:_().nullable().optional()}).passthrough(),QEt=Y({format:ut("nemar-zarr-catalog"),format_version:C().int(),generated_utc:_(),contract_base:_(),count:C().int().nonnegative(),datasets:le(k4e)}).passthrough(),R4e=["verified","failed","unverifiable"],bV=bt(R4e).nullable(),th=Y({dataset_id:_().regex(vn),doi:_().nullable(),license:_().nullable(),citation:_().nullable(),source_commit:_().regex(Sb),index_etag:_().nullable(),engine_version:_(),source_tree:ut("raw"),derived:Le(),sss:kb.optional(),lossy:Le(),dtype:_().nullable(),effective_rate_hz:C().nullable(),source_rate_hz:C().nullable(),units_report:$b.nullable().optional(),zarr_verify_status:bV,note:_().nullable().optional()}).passthrough().superRefine(Rb),mV=Y({start:C().int().nonnegative(),end:C().int().nonnegative()}).passthrough().refine((e)=>e.end>=e.start,{message:"end must be >= start",path:["end"]}),C4e=Y({python_zarr:_(),zarrita:_(),python_browser:_()}).passthrough(),xV=Y({contract_base:_(),data_base:_(),s3_uri:_(),s3_region:_(),s3_anonymous:Le(),zarr:_(),group:_(),level:Hd([ut("0"),C().int().positive()]),array_path:_(),dtype:_().nullable(),codecs:le(ic()).optional(),chunk_samples:C().int().positive().nullable(),shard_samples:C().int().positive().nullable(),n_channels:C().int().nonnegative().nullable(),sample_slice:mV.optional(),channel_slice:mV.optional(),scale_offset:_(),how_to:C4e}).passthrough(),T4e=Object.fromEntries(Fo.map((e)=>[e.queryParam,_().optional()])),wV={modality:_().optional(),task:_().optional(),has_hed:Le().optional(),has_zarr:Le().optional(),author:_().optional(),has_doi:Le().optional(),has_zarr_verified:Le().optional(),data_complete:Le().optional(),recent:C().int().positive().optional(),license:_().optional()},P4e=Object.keys(wV),ZEt=[...P4e,...Fo.map((e)=>e.queryParam)],eSt=Y({query:_().optional(),...wV,include_unknown:Le().optional(),...T4e,limit:C().int().positive().max(O4e).default(A4e)}).passthrough(),I4e=Y({dataset_id:_().regex(vn),name:_(),doi:_().nullable().optional(),license:_().nullable().optional(),modalities:le(_()).optional(),tasks:le(_()).optional(),subject_count:C().int().nullable().optional(),has_hed:Le().nullable().optional(),has_zarr:Le()}).passthrough(),tSt=Y({results:le(I4e),count:C().int().nonnegative(),limit:C().int(),note:_().nullable().optional(),truncated:Le().optional()}).passthrough(),rSt=Y({dataset_id:_().regex(vn)}).passthrough(),F4e=["list_recordings","get_events","render_overview","read_window"],N4e=Y({next_cheapest_tool:bt(F4e),reason:_()}).passthrough(),j4e=["pending","ready","failed"],nSt=Y({dataset_id:_().regex(vn),name:_(),doi:_().nullable(),license:_().nullable(),citation:_().nullable(),modalities:le(_()).optional(),tasks:le(_()).optional(),subject_count:C().int().nullable().optional(),has_hed:Le().nullable().optional(),hed_version:_().nullable().optional(),recording_count:C().int().nullable().optional(),total_recording_duration_s:C().nullable().optional(),zarr_status:bt(j4e).nullable().optional(),zarr_verify_status:bV.optional(),zarr_source_commit:_().nullable().optional(),zarr_store_count:C().int().nullable().optional(),cost_hint:N4e}).passthrough(),iSt=Y({dataset_id:_().regex(vn),modality:_().optional(),min_duration_s:C().nonnegative().optional(),include_derived:Le().default(!1),limit:C().int().positive().max(q4e).default(M4e),offset:C().int().nonnegative().default(0)}).passthrough(),L4e=Y({name:_(),modality:_().nullable().optional(),rate:C().nullable().optional(),n_channels:C().int().nullable().optional(),duration_s:C().nullable().optional(),n_view_levels:C().int().nonnegative().nullable().optional(),n_samples:C().int().nonnegative().nullable().optional(),view_chunk_columns:C().int().positive().nullable().optional()}).passthrough(),B4e=Y({path:_(),zarr:_(),source_tree:ut("raw"),derived:Le(),groups:le(L4e).optional(),n_events:C().int().nonnegative().optional(),sss:kb.optional(),units_report:$b.optional()}).passthrough().superRefine(Rb),oSt=Y({dataset_id:_().regex(vn),source_commit:_().regex(Sb).nullable(),recordings:le(B4e),total_count:C().int().nonnegative(),excluded_derived_count:C().int().nonnegative(),limit:C().int(),offset:C().int(),index_format_version:C().int(),discovered_count:C().int().nonnegative().nullable(),failure_count:C().int().nonnegative().nullable(),pending_count:C().int().nonnegative().nullable(),excluded_legacy_non_raw_count:C().int().nonnegative(),note:_().nullable().optional(),envelope:th.optional()}).passthrough(),gV=_().min(1).max(64),sSt=Y({dataset_id:_().regex(vn),recording:_(),group:_().optional(),limit:C().int().positive().max(z4e).default(U4e),offset:C().int().nonnegative().default(0),where:wi(gV,le(Hd([_(),C()])).min(1).max(V4e)).refine((e)=>{let t=Object.keys(e).length;return t>=1&&t<=hV},{message:`where names 1 to ${hV} columns`}).optional(),columns:le(gV).min(1).max(H4e).optional()}).passthrough(),G4e=Y({store_path:_(),group_name:_(),onset_s:C(),duration_s:C().nullable().optional(),sample_index:C().int().nonnegative(),trial_type:_().nullable().optional(),value:Hd([_(),C()]).nullable().optional(),hed:_().nullable().optional()}).passthrough(),W4e=G4e.partial().required({onset_s:!0,sample_index:!0}),K4e=Y({name:_(),distinct_count:C().int().nonnegative(),null_count:C().int().nonnegative(),values:le(Y({value:_(),count:C().int().positive()}).passthrough()).nullable()}).passthrough(),aSt=Y({dataset_id:_().regex(vn),recording:_(),events:le(W4e),source:bt(["events_parquet","events_tsv_fallback"]),estimated:Le(),total_count:C().int().nonnegative(),limit:C().int(),offset:C().int(),truncated:Le(),note:_().nullable().optional(),columns_summary:le(K4e).optional(),envelope:th.optional()}).passthrough(),cSt=Y({dataset_id:_().regex(vn),recording:_(),group:_().optional(),width_px:C().int().positive().max(J4e).default(Y4e)}).passthrough(),lSt=Y({dataset_id:_().regex(vn),recording:_(),group:_(),level:C().int().positive(),width_px:C().int().positive(),height_px:C().int().positive(),mime_type:ut("image/png"),columns_read:C().int().nonnegative(),chunks_read:C().int().nonnegative(),bytes_read:C().int().nonnegative(),envelope:th.optional()}).passthrough(),yV=nk*ik,uSt=Y({dataset_id:_().regex(vn),recording:_(),group:_().optional(),start_s:C().nonnegative().default(0),duration_s:C().positive().max(X4e).default(10),channels:le(C().int().nonnegative()).max(Q4e).optional(),taste:Le().default(!1)}).passthrough().superRefine((e,t)=>{if(!e.taste)return;if(!e.channels||e.channels.length===0){t.addIssue({code:W.custom,message:"taste requires channels: name the channel indices you want (list_recordings reports each group's n_channels), or omit taste for a recipe",path:["channels"]});return}if(e.duration_s>nk)t.addIssue({code:W.custom,message:`taste duration_s (${e.duration_s}) exceeds the ${nk} s cap; omit taste for a recipe instead`,path:["duration_s"]});if(e.channels.length>ik)t.addIssue({code:W.custom,message:`taste channels (${e.channels.length}) exceeds the ${ik}-channel cap; omit taste for a recipe instead`,path:["channels"]});let r=e.duration_s*e.channels.length;if(r>yV)t.addIssue({code:W.custom,message:`taste exceeds the cap of ${yV} channel-seconds (duration_s x channels = ${r}); omit taste for a recipe instead`,path:["duration_s"]})}),Z4e=Y({mode:ut("recipe"),recipe:xV,envelope:th}).passthrough(),e8e=Y({mode:ut("taste"),start_s:C(),duration_s:C(),channels:le(C().int()),sample_rate_hz:C(),values:le(le(C())),recipe:xV,chunks_read:C().int().nonnegative(),bytes_read:C().int().nonnegative(),filled_ranges:le(Y({start_sample:C().int().nonnegative(),end_sample:C().int().nonnegative(),start_s:C(),end_s:C()}).passthrough()),note:_().nullable().optional(),envelope:th}).passthrough(),dSt=M1("mode",[Z4e,e8e])});var Qd=N(()=>{W1();Gd();Y1();Zm();J1();vb();Yd();Xd();rk();vV()});function L(e){if(e instanceof Error)return e.message;return String(e)}var B,cc;var At=N(()=>{B=class B extends Error{statusCode;details;step;blockReason;missing;code;reason;rawBody;constructor(e,t,r,n,i,o){super(t);this.statusCode=e;this.details=r;this.step=n;this.blockReason=i;this.missing=o;this.name="ApiError"}};cc=class cc extends B{mode;eta;constructor(e,t,r,n){super(503,t,n);this.mode=e;this.eta=r;this.name="MaintenanceError"}}});var n8e,i8e,o8e,ASt,EV="override_publication_review",SV="publication_review_not_clear",ak=2000;var Ob=N(()=>{n8e=["dispatched","redispatched","dispatch_claimed"],i8e=["review_disabled","not_applicable","not_owned_here","request_not_requested","screen_not_ready","running","has_result","platform_limit"],o8e=["dispatch_failed","dispatch_unconfigured"],ASt=[...n8e,...i8e,...o8e]});var Tb=1e4;function Pb(e){return e?a8e:No}var No,PSt,s8e,a8e,ck;var Ib=N(()=>{No=["ci_check","enrichment_check","s3_public_read","repo_public","tag_protect","doi_create","update_metadata","update_readme","create_tag","create_release","upload_to_zenodo","publish_doi","version_doi","s3_lock","sync_nemar","notify_user"],PSt=No.slice(0,No.indexOf("s3_public_read")),s8e=["update_metadata","update_readme","upload_to_zenodo","publish_doi"],a8e=No.filter((e)=>!s8e.includes(e));ck={ci_check:"Check CI",enrichment_check:"Enrichment check",s3_public_read:"S3 public read",repo_public:"Make catalog row public",tag_protect:"Tag protection",doi_create:"Create DOI",update_metadata:"Update metadata",update_readme:"Update README",create_tag:"Create version tag",create_release:"Create GitHub release",upload_to_zenodo:"Upload to Zenodo (no-op)",publish_doi:"Publish DOI (irreversible)",version_doi:"Version DOI + manifest",s3_lock:"S3 Object Lock",sync_nemar:"Sync NEMAR (no-op)",notify_user:"Notify user"}});function Fb(e){let t=[],r="",n="start",i=!1;for(let o of e)switch(o){case"\\":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd")throw Error("Invalid character after an index");if(i)r+=o;n="property",i=!i;break}case".":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd"){n="property";break}if(i){i=!1,r+=o;break}if(lk.has(r))return[];t.push(r),r="",n="property";break}case"[":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd"){n="index";break}if(i){i=!1,r+=o;break}if(n==="property"){if(lk.has(r))return[];t.push(r),r=""}n="index";break}case"]":{if(n==="index"){t.push(Number.parseInt(r,10)),r="",n="indexEnd";break}if(n==="indexEnd")throw Error("Invalid character after an index")}default:{if(n==="index"&&!c8e.has(o))throw Error("Invalid character in an index");if(n==="indexEnd")throw Error("Invalid character after an index");if(n==="start")n="property";if(i)i=!1,r+="\\";r+=o}}if(i)r+="\\";switch(n){case"property":{if(lk.has(r))return[];t.push(r);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function uk(e,t){if(typeof t!=="number"&&Array.isArray(e)){let r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function $V(e,t){if(uk(e,t))throw Error("Cannot use string index")}function kV(e,t,r){if(!Gl(e)||typeof t!=="string")return r===void 0?e:r;let n=Fb(t);if(n.length===0)return r;for(let i=0;i<n.length;i++){let o=n[i];if(uk(e,o))e=i===n.length-1?void 0:null;else e=e[o];if(e===void 0||e===null){if(i!==n.length-1)return r;break}}return e===void 0?r:e}function dk(e,t,r){if(!Gl(e)||typeof t!=="string")return e;let n=e,i=Fb(t);for(let o=0;o<i.length;o++){let s=i[o];if($V(e,s),o===i.length-1)e[s]=r;else if(!Gl(e[s]))e[s]=typeof i[o+1]==="number"?[]:{};e=e[s]}return n}function RV(e,t){if(!Gl(e)||typeof t!=="string")return!1;let r=Fb(t);for(let n=0;n<r.length;n++){let i=r[n];if($V(e,i),n===r.length-1)return delete e[i],!0;if(e=e[i],!Gl(e))return!1}}function CV(e,t){if(!Gl(e)||typeof t!=="string")return!1;let r=Fb(t);if(r.length===0)return!1;for(let n of r){if(!Gl(e)||!(n in e)||uk(e,n))return!1;e=e[n]}return!0}var Gl=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")},lk,c8e;var AV=N(()=>{lk=new Set(["__proto__","prototype","constructor"]),c8e=new Set("0123456789")});import Qt from"path";import OV from"os";import fk from"process";function mk(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(fk.platform==="darwin")return l8e(e);if(fk.platform==="win32")return u8e(e);return d8e(e)}var lc,pk,ef,l8e=(e)=>{let t=Qt.join(lc,"Library");return{data:Qt.join(t,"Application Support",e),config:Qt.join(t,"Preferences",e),cache:Qt.join(t,"Caches",e),log:Qt.join(t,"Logs",e),temp:Qt.join(pk,e)}},u8e=(e)=>{let t=ef.APPDATA||Qt.join(lc,"AppData","Roaming"),r=ef.LOCALAPPDATA||Qt.join(lc,"AppData","Local");return{data:Qt.join(r,e,"Data"),config:Qt.join(t,e,"Config"),cache:Qt.join(r,e,"Cache"),log:Qt.join(r,e,"Log"),temp:Qt.join(pk,e)}},d8e=(e)=>{let t=Qt.basename(lc);return{data:Qt.join(ef.XDG_DATA_HOME||Qt.join(lc,".local","share"),e),config:Qt.join(ef.XDG_CONFIG_HOME||Qt.join(lc,".config"),e),cache:Qt.join(ef.XDG_CACHE_HOME||Qt.join(lc,".cache"),e),log:Qt.join(ef.XDG_STATE_HOME||Qt.join(lc,".local","state"),e),temp:Qt.join(pk,t,e)}};var TV=N(()=>{lc=OV.homedir(),pk=OV.tmpdir(),{env:ef}=fk});var f8e=(e,t)=>{let{onError:r}=t;return function(...i){return e.apply(void 0,i).catch(r)}},jo;var PV=N(()=>{jo=f8e});var p8e=(e,t)=>{let{onError:r}=t;return function(...i){try{return e.apply(void 0,i)}catch(o){return r(o)}}},to;var IV=N(()=>{to=p8e});var FV=250;var NV=()=>{};var m8e=(e,t)=>{let{isRetriable:r}=t;return function(i){let{timeout:o}=i,s=i.interval??FV,a=Date.now()+o;return function c(...u){return e.apply(void 0,u).catch((d)=>{if(!r(d))throw d;if(Date.now()>=a)throw d;let f=Math.round(s*Math.random());if(f>0)return new Promise((m)=>setTimeout(m,f)).then(()=>c.apply(void 0,u));else return c.apply(void 0,u)})}}},Mo;var jV=N(()=>{NV();Mo=m8e});var h8e=(e,t)=>{let{isRetriable:r}=t;return function(i){let{timeout:o}=i,s=Date.now()+o;return function(...c){while(!0)try{return e.apply(void 0,c)}catch(u){if(!r(u))throw u;if(Date.now()>=s)throw u;continue}}}},qo;var MV=N(()=>{qo=h8e});var hk=N(()=>{PV();IV();jV();MV()});var rh,gk;var qV=N(()=>{yk();rh={isChangeErrorOk:(e)=>{if(!rh.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!LV&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!rh.isNodeError(e))return!1;let{code:t}=e;if(t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM")return!0;return!1},onChangeError:(e)=>{if(!rh.isNodeError(e))throw e;if(rh.isChangeErrorOk(e))return;throw e}},gk=rh});import BV from"process";var nh,Nn,LV,Wr;var yk=N(()=>{qV();nh={onError:gk.onChangeError},Nn={onError:()=>{return}},LV=BV.getuid?!BV.getuid():!1,Wr={isRetriable:gk.isRetriableError}});import ht from"fs";import{promisify as an}from"util";var g8e,Ir;var bk=N(()=>{hk();hk();yk();g8e={attempt:{chmod:jo(an(ht.chmod),nh),chown:jo(an(ht.chown),nh),close:jo(an(ht.close),Nn),fsync:jo(an(ht.fsync),Nn),mkdir:jo(an(ht.mkdir),Nn),realpath:jo(an(ht.realpath),Nn),stat:jo(an(ht.stat),Nn),unlink:jo(an(ht.unlink),Nn),chmodSync:to(ht.chmodSync,nh),chownSync:to(ht.chownSync,nh),closeSync:to(ht.closeSync,Nn),existsSync:to(ht.existsSync,Nn),fsyncSync:to(ht.fsync,Nn),mkdirSync:to(ht.mkdirSync,Nn),realpathSync:to(ht.realpathSync,Nn),statSync:to(ht.statSync,Nn),unlinkSync:to(ht.unlinkSync,Nn)},retry:{close:Mo(an(ht.close),Wr),fsync:Mo(an(ht.fsync),Wr),open:Mo(an(ht.open),Wr),readFile:Mo(an(ht.readFile),Wr),rename:Mo(an(ht.rename),Wr),stat:Mo(an(ht.stat),Wr),write:Mo(an(ht.write),Wr),writeFile:Mo(an(ht.writeFile),Wr),closeSync:qo(ht.closeSync,Wr),fsyncSync:qo(ht.fsyncSync,Wr),openSync:qo(ht.openSync,Wr),readFileSync:qo(ht.readFileSync,Wr),renameSync:qo(ht.renameSync,Wr),statSync:qo(ht.statSync,Wr),writeSync:qo(ht.writeSync,Wr),writeFileSync:qo(ht.writeFileSync,Wr)}},Ir=g8e});import Wl from"process";var UV="utf8",xk=438,zV=511,VV,HV,GV,WV=1000,KV,l$t,wk=128;var vk=N(()=>{VV={},HV=Wl.geteuid?Wl.geteuid():-1,GV=Wl.getegid?Wl.getegid():-1,KV=!!Wl.getuid,l$t=Wl.getuid?!Wl.getuid():!1});var YV=(e)=>e instanceof Error&&("code"in e),_k=(e)=>typeof e==="string",Nb=(e)=>e===void 0;var JV=()=>{};var XV=()=>{};import QV from"process";var ZV,jb;var Dk=N(()=>{ZV=QV.platform==="linux",jb=QV.platform==="win32"});var Ek,eH;var tH=N(()=>{Dk();Ek=["SIGHUP","SIGINT","SIGTERM"];if(!jb)Ek.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(ZV)Ek.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");eH=Ek});import tf from"process";class rH{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(e)=>{if(this.exited)return;this.exited=!0;for(let t of this.callbacks)t();if(e)if(jb&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))tf.kill(tf.pid,"SIGTERM");else tf.kill(tf.pid,e)},this.hook=()=>{tf.once("exit",()=>this.exit());for(let e of eH)try{tf.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var nH;var iH=N(()=>{Dk();tH();nH=new rH});var y8e,oH;var sH=N(()=>{iH();y8e=nH.register,oH=y8e});import b8e from"path";var ei,ih;var aH=N(()=>{bk();sH();vk();ei={store:{},create:(e)=>{let t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),r=Date.now().toString().slice(-10),n="tmp-",i=`.tmp-${r}${t}`;return`${e}${i}`},get:(e,t,r=!0)=>{let n=ei.truncate(t(e));if(n in ei.store)return ei.get(e,t,r);return ei.store[n]=r,[n,()=>delete ei.store[n]]},purge:(e)=>{if(!ei.store[e])return;delete ei.store[e],Ir.attempt.unlink(e)},purgeSync:(e)=>{if(!ei.store[e])return;delete ei.store[e],Ir.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in ei.store)ei.purgeSync(e)},truncate:(e)=>{let t=b8e.basename(e);if(t.length<=wk)return e;let r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;let n=t.length-wk;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};oH(ei.purgeSyncAll);ih=ei});import x8e from"path";function Sk(e,t,r=VV){if(_k(r))return Sk(e,t,{encoding:r});let i={timeout:r.timeout??WV},o=null,s=null,a=null;try{let c=Ir.attempt.realpathSync(e),u=!!c;e=c||e,[s,o]=ih.get(e,r.tmpCreate||ih.create,r.tmpPurge!==!1);let d=KV&&Nb(r.chown),f=Nb(r.mode);if(u&&(d||f)){let p=Ir.attempt.statSync(e);if(p){if(r={...r},d)r.chown={uid:p.uid,gid:p.gid};if(f)r.mode=p.mode}}if(!u){let p=x8e.dirname(e);Ir.attempt.mkdirSync(p,{mode:zV,recursive:!0})}if(a=Ir.retry.openSync(i)(s,"w",r.mode||xk),r.tmpCreated)r.tmpCreated(s);if(_k(t))Ir.retry.writeSync(i)(a,t,0,r.encoding||UV);else if(!Nb(t))Ir.retry.writeSync(i)(a,t,0,t.length,0);if(r.fsync!==!1)if(r.fsyncWait!==!1)Ir.retry.fsyncSync(i)(a);else Ir.attempt.fsync(a);if(Ir.retry.closeSync(i)(a),a=null,r.chown&&(r.chown.uid!==HV||r.chown.gid!==GV))Ir.attempt.chownSync(s,r.chown.uid,r.chown.gid);if(r.mode&&r.mode!==xk)Ir.attempt.chmodSync(s,r.mode);try{Ir.retry.renameSync(i)(s,e)}catch(p){if(!YV(p))throw p;if(p.code!=="ENAMETOOLONG")throw p;Ir.retry.renameSync(i)(s,ih.truncate(e))}o(),s=null}finally{if(a)Ir.attempt.closeSync(a);if(s)ih.purge(s)}}var cH=N(()=>{bk();vk();JV();XV();aH()});var sh=y(function(dH){Object.defineProperty(dH,"__esModule",{value:!0});dH.regexpCode=dH.getEsmExportName=dH.getProperty=dH.safeStringify=dH.stringify=dH.strConcat=dH.addCodeArg=dH.str=dH._=dH.nil=dH._Code=dH.Name=dH.IDENTIFIER=dH._CodeOrName=void 0;class Mb{}dH._CodeOrName=Mb;dH.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class rf extends Mb{constructor(e){super();if(!dH.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}dH.Name=rf;class ro extends Mb{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof rf)t[r.str]=(t[r.str]||0)+1;return t},{})}}dH._Code=ro;dH.nil=new ro("");function lH(e,...t){let r=[e[0]],n=0;while(n<t.length)kk(r,t[n]),r.push(e[++n]);return new ro(r)}dH._=lH;var $k=new ro("+");function uH(e,...t){let r=[oh(e[0])],n=0;while(n<t.length)r.push($k),kk(r,t[n]),r.push($k,oh(e[++n]));return w8e(r),new ro(r)}dH.str=uH;function kk(e,t){if(t instanceof ro)e.push(...t._items);else if(t instanceof rf)e.push(t);else e.push(D8e(t))}dH.addCodeArg=kk;function w8e(e){let t=1;while(t<e.length-1){if(e[t]===$k){let r=v8e(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function v8e(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof rf||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof rf))return`"${e}${t.slice(1)}`;return}function _8e(e,t){return t.emptyStr()?e:e.emptyStr()?t:uH`${e}${t}`}dH.strConcat=_8e;function D8e(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:oh(Array.isArray(e)?e.join(","):e)}function E8e(e){return new ro(oh(e))}dH.stringify=E8e;function oh(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}dH.safeStringify=oh;function S8e(e){return typeof e=="string"&&dH.IDENTIFIER.test(e)?new ro(`.${e}`):lH`[${e}]`}dH.getProperty=S8e;function $8e(e){if(typeof e=="string"&&dH.IDENTIFIER.test(e))return new ro(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}dH.getEsmExportName=$8e;function k8e(e){return new ro(e.toString())}dH.regexpCode=k8e});var Ok=y(function(hH){Object.defineProperty(hH,"__esModule",{value:!0});hH.ValueScope=hH.ValueScopeName=hH.Scope=hH.varKinds=hH.UsedValueState=void 0;var Ot=sh();class pH extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Lb;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Lb||(hH.UsedValueState=Lb={}));hH.varKinds={const:new Ot.Name("const"),let:new Ot.Name("let"),var:new Ot.Name("var")};class Ck{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ot.Name?e:this.name(e)}name(e){return new Ot.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}hH.Scope=Ck;class Ak extends Ot.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ot._`.${new Ot.Name(t)}[${r}]`}}hH.ValueScopeName=Ak;var L8e=Ot._`\n`;class mH extends Ck{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?L8e:Ot.nil}}get(){return this._scope}name(e){return new Ak(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:i}=n,o=(r=t.key)!==null&&r!==void 0?r:t.ref,s=this._values[i];if(s){let u=s.get(o);if(u)return u}else s=this._values[i]=new Map;s.set(o,n);let a=this._scope[i]||(this._scope[i]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:i,itemIndex:c}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ot._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let i=Ot.nil;for(let o in e){let s=e[o];if(!s)continue;let a=r[o]=r[o]||new Map;s.forEach((c)=>{if(a.has(c))return;a.set(c,Lb.Started);let u=t(c);if(u){let d=this.opts.es5?hH.varKinds.var:hH.varKinds.const;i=Ot._`${i}${d} ${c} = ${u};${this.opts._n}`}else if(u=n===null||n===void 0?void 0:n(c))i=Ot._`${i}${u}${this.opts._n}`;else throw new pH(c);a.set(c,Lb.Completed)})}return i}}hH.ValueScope=mH});var Ke=y(function(jn){Object.defineProperty(jn,"__esModule",{value:!0});jn.or=jn.and=jn.not=jn.CodeGen=jn.operators=jn.varKinds=jn.ValueScopeName=jn.ValueScope=jn.Scope=jn.Name=jn.regexpCode=jn.stringify=jn.getProperty=jn.nil=jn.strConcat=jn.str=jn._=void 0;var se=sh(),or=Ok(),uc=sh();Object.defineProperty(jn,"_",{enumerable:!0,get:function(){return uc._}});Object.defineProperty(jn,"str",{enumerable:!0,get:function(){return uc.str}});Object.defineProperty(jn,"strConcat",{enumerable:!0,get:function(){return uc.strConcat}});Object.defineProperty(jn,"nil",{enumerable:!0,get:function(){return uc.nil}});Object.defineProperty(jn,"getProperty",{enumerable:!0,get:function(){return uc.getProperty}});Object.defineProperty(jn,"stringify",{enumerable:!0,get:function(){return uc.stringify}});Object.defineProperty(jn,"regexpCode",{enumerable:!0,get:function(){return uc.regexpCode}});Object.defineProperty(jn,"Name",{enumerable:!0,get:function(){return uc.Name}});var Gb=Ok();Object.defineProperty(jn,"Scope",{enumerable:!0,get:function(){return Gb.Scope}});Object.defineProperty(jn,"ValueScope",{enumerable:!0,get:function(){return Gb.ValueScope}});Object.defineProperty(jn,"ValueScopeName",{enumerable:!0,get:function(){return Gb.ValueScopeName}});Object.defineProperty(jn,"varKinds",{enumerable:!0,get:function(){return Gb.varKinds}});jn.operators={GT:new se._Code(">"),GTE:new se._Code(">="),LT:new se._Code("<"),LTE:new se._Code("<="),EQ:new se._Code("==="),NEQ:new se._Code("!=="),NOT:new se._Code("!"),OR:new se._Code("||"),AND:new se._Code("&&"),ADD:new se._Code("+")};class dc{optimizeNodes(){return this}optimizeNames(e,t){return this}}class yH extends dc{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?or.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=of(this.rhs,e,t);return this}get names(){return this.rhs instanceof se._CodeOrName?this.rhs.names:{}}}class Ik extends dc{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof se.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=of(this.rhs,e,t),this}get names(){let e=this.lhs instanceof se.Name?{}:{...this.lhs.names};return Hb(e,this.rhs)}}class bH extends Ik{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class xH extends dc{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class wH extends dc{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class vH extends dc{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class _H extends dc{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=of(this.code,e,t),this}get names(){return this.code instanceof se._CodeOrName?this.code.names:{}}}class Wb extends dc{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let i=r[n];if(i.optimizeNames(e,t))continue;V8e(e,i.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Kl(e,t.names),{})}}class fc extends Wb{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class DH extends Wb{}class ah extends fc{}ah.kind="else";class Xs extends fc{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new ah(r):r}if(t){if(e===!1)return t instanceof Xs?t:t.nodes;if(this.nodes.length)return this;return new Xs(RH(e),t instanceof Xs?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=of(this.condition,e,t),this}get names(){let e=super.names;if(Hb(e,this.condition),this.else)Kl(e,this.else.names);return e}}Xs.kind="if";class nf extends fc{}nf.kind="for";class EH extends nf{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=of(this.iteration,e,t),this}get names(){return Kl(super.names,this.iteration.names)}}class SH extends nf{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?or.varKinds.var:this.varKind,{name:r,from:n,to:i}=this;return`for(${t} ${r}=${n}; ${r}<${i}; ${r}++)`+super.render(e)}get names(){let e=Hb(super.names,this.from);return Hb(e,this.to)}}class Tk extends nf{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=of(this.iterable,e,t),this}get names(){return Kl(super.names,this.iterable.names)}}class Bb extends fc{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Bb.kind="func";class Ub extends Wb{render(e){return"return "+super.render(e)}}Ub.kind="return";class $H extends fc{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Kl(e,this.catch.names);if(this.finally)Kl(e,this.finally.names);return e}}class zb extends fc{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}zb.kind="catch";class Vb extends fc{render(e){return"finally"+super.render(e)}}Vb.kind="finally";class kH{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
85
85
|
`:""},this._extScope=e,this._scope=new or.Scope({parent:e}),this._nodes=[new DH]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let i=this._scope.toName(t);if(r!==void 0&&n)this._constants[i.str]=r;return this._leafNode(new yH(e,i,r)),i}const(e,t,r){return this._def(or.varKinds.const,e,t,r)}let(e,t,r){return this._def(or.varKinds.let,e,t,r)}var(e,t,r){return this._def(or.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Ik(e,t,r))}add(e,t){return this._leafNode(new bH(e,jn.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==se.nil)this._leafNode(new _H(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),se.addCodeArg(t,n)}return t.push("}"),new se._Code(t)}if(e,t,r){if(this._blockNode(new Xs(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Xs(e))}else(){return this._elseNode(new ah)}endIf(){return this._endBlockNode(Xs,ah)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new EH(e),t)}forRange(e,t,r,n,i=this.opts.es5?or.varKinds.var:or.varKinds.let){let o=this._scope.toName(e);return this._for(new SH(i,o,t,r),()=>n(o))}forOf(e,t,r,n=or.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let o=t instanceof se.Name?t:this.var("_arr",t);return this.forRange("_i",0,se._`${o}.length`,(s)=>{this.var(i,se._`${o}[${s}]`),r(i)})}return this._for(new Tk("of",n,i,t),()=>r(i))}forIn(e,t,r,n=this.opts.es5?or.varKinds.var:or.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,se._`Object.keys(${t})`,r);let i=this._scope.toName(e);return this._for(new Tk("in",n,i,t),()=>r(i))}endFor(){return this._endBlockNode(nf)}label(e){return this._leafNode(new xH(e))}break(e){return this._leafNode(new wH(e))}return(e){let t=new Ub;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Ub)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new $H;if(this._blockNode(n),this.code(e),t){let i=this.name("e");this._currNode=n.catch=new zb(i),t(i)}if(r)this._currNode=n.finally=new Vb,this.code(r);return this._endBlockNode(zb,Vb)}throw(e){return this._leafNode(new vH(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=se.nil,r,n){if(this._blockNode(new Bb(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Bb)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof Xs))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}jn.CodeGen=kH;function Kl(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Hb(e,t){return t instanceof se._CodeOrName?Kl(e,t.names):e}function of(e,t,r){if(e instanceof se.Name)return n(e);if(!i(e))return e;return new se._Code(e._items.reduce((o,s)=>{if(s instanceof se.Name)s=n(s);if(s instanceof se._Code)o.push(...s._items);else o.push(s);return o},[]));function n(o){let s=r[o.str];if(s===void 0||t[o.str]!==1)return o;return delete t[o.str],s}function i(o){return o instanceof se._Code&&o._items.some((s)=>s instanceof se.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function V8e(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function RH(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:se._`!${Pk(e)}`}jn.not=RH;var H8e=CH(jn.operators.AND);function G8e(...e){return e.reduce(H8e)}jn.and=G8e;var W8e=CH(jn.operators.OR);function K8e(...e){return e.reduce(W8e)}jn.or=K8e;function CH(e){return(t,r)=>t===se.nil?r:r===se.nil?t:se._`${Pk(t)} ${e} ${Pk(r)}`}function Pk(e){return e instanceof se.Name?e:se._`(${e})`}});var st=y(function(qH){Object.defineProperty(qH,"__esModule",{value:!0});qH.checkStrictMode=qH.getErrorPath=qH.Type=qH.useFunc=qH.setEvaluated=qH.evaluatedPropsToName=qH.mergeEvaluated=qH.eachItem=qH.unescapeJsonPointer=qH.escapeJsonPointer=qH.escapeFragment=qH.unescapeFragment=qH.schemaRefOrVal=qH.schemaHasRulesButRef=qH.schemaHasRules=qH.checkUnknownRules=qH.alwaysValidSchema=qH.toHash=void 0;var De=Ke(),PH=sh();function Q8e(e){let t={};for(let r of e)t[r]=!0;return t}qH.toHash=Q8e;function Z8e(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return IH(e,t),!FH(t,e.self.RULES.all)}qH.alwaysValidSchema=Z8e;function IH(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let i=n.RULES.keywords;for(let o in t)if(!i[o])MH(e,`unknown keyword: "${o}"`)}qH.checkUnknownRules=IH;function FH(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}qH.schemaHasRules=FH;function eje(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}qH.schemaHasRulesButRef=eje;function tje({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return De._`${r}`}return De._`${e}${t}${De.getProperty(n)}`}qH.schemaRefOrVal=tje;function rje(e){return NH(decodeURIComponent(e))}qH.unescapeFragment=rje;function nje(e){return encodeURIComponent(Nk(e))}qH.escapeFragment=nje;function Nk(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}qH.escapeJsonPointer=Nk;function NH(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}qH.unescapeJsonPointer=NH;function ije(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}qH.eachItem=ije;function OH({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{let c=s===void 0?o:s instanceof De.Name?(o instanceof De.Name?e(i,o,s):t(i,o,s),s):o instanceof De.Name?(t(i,s,o),o):r(o,s);return a===De.Name&&!(c instanceof De.Name)?n(i,c):c}}qH.mergeEvaluated={props:OH({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>{e.if(De._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,De._`${r} || {}`).code(De._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,De._`${r} || {}`),jk(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:jH}),items:OH({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,De._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>e.assign(r,t===!0?!0:De._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function jH(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",De._`{}`);if(t!==void 0)jk(e,r,t);return r}qH.evaluatedPropsToName=jH;function jk(e,t,r){Object.keys(r).forEach((n)=>e.assign(De._`${t}${De.getProperty(n)}`,!0))}qH.setEvaluated=jk;var TH={};function oje(e,t){return e.scopeValue("func",{ref:t,code:TH[t.code]||(TH[t.code]=new PH._Code(t.code))})}qH.useFunc=oje;var Fk;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Fk||(qH.Type=Fk={}));function sje(e,t,r){if(e instanceof De.Name){let n=t===Fk.Num;return r?n?De._`"[" + ${e} + "]"`:De._`"['" + ${e} + "']"`:n?De._`"/" + ${e}`:De._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?De.getProperty(e).toString():"/"+Nk(e)}qH.getErrorPath=sje;function MH(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}qH.checkStrictMode=MH});var vi=y(function(BH){Object.defineProperty(BH,"__esModule",{value:!0});var xt=Ke(),Eje={data:new xt.Name("data"),valCxt:new xt.Name("valCxt"),instancePath:new xt.Name("instancePath"),parentData:new xt.Name("parentData"),parentDataProperty:new xt.Name("parentDataProperty"),rootData:new xt.Name("rootData"),dynamicAnchors:new xt.Name("dynamicAnchors"),vErrors:new xt.Name("vErrors"),errors:new xt.Name("errors"),this:new xt.Name("this"),self:new xt.Name("self"),scope:new xt.Name("scope"),json:new xt.Name("json"),jsonPos:new xt.Name("jsonPos"),jsonLen:new xt.Name("jsonLen"),jsonPart:new xt.Name("jsonPart")};BH.default=Eje});var ch=y(function(HH){Object.defineProperty(HH,"__esModule",{value:!0});HH.extendErrors=HH.resetErrorsCount=HH.reportExtraError=HH.reportError=HH.keyword$DataError=HH.keywordError=void 0;var ue=Ke(),pc=st(),_n=vi();HH.keywordError={message:({keyword:e})=>ue.str`must pass "${e}" keyword validation`};HH.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ue.str`"${e}" keyword must be ${t} ($data)`:ue.str`"${e}" keyword is invalid ($data)`};function $je(e,t=HH.keywordError,r,n){let{it:i}=e,{gen:o,compositeRule:s,allErrors:a}=i,c=VH(e,t,r);if(n!==null&&n!==void 0?n:s||a)UH(o,c);else zH(i,ue._`[${c}]`)}HH.reportError=$je;function kje(e,t=HH.keywordError,r){let{it:n}=e,{gen:i,compositeRule:o,allErrors:s}=n,a=VH(e,t,r);if(UH(i,a),!(o||s))zH(n,_n.default.vErrors)}HH.reportExtraError=kje;function Rje(e,t){e.assign(_n.default.errors,t),e.if(ue._`${_n.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ue._`${_n.default.vErrors}.length`,t),()=>e.assign(_n.default.vErrors,null)))}HH.resetErrorsCount=Rje;function Cje({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw Error("ajv implementation error");let s=e.name("err");e.forRange("i",i,_n.default.errors,(a)=>{if(e.const(s,ue._`${_n.default.vErrors}[${a}]`),e.if(ue._`${s}.instancePath === undefined`,()=>e.assign(ue._`${s}.instancePath`,ue.strConcat(_n.default.instancePath,o.errorPath))),e.assign(ue._`${s}.schemaPath`,ue.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(ue._`${s}.schema`,r),e.assign(ue._`${s}.data`,n)})}HH.extendErrors=Cje;function UH(e,t){let r=e.const("err",t);e.if(ue._`${_n.default.vErrors} === null`,()=>e.assign(_n.default.vErrors,ue._`[${r}]`),ue._`${_n.default.vErrors}.push(${r})`),e.code(ue._`${_n.default.errors}++`)}function zH(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;if(i.$async)r.throw(ue._`new ${e.ValidationError}(${t})`);else r.assign(ue._`${n}.errors`,t),r.return(!1)}var Yl={keyword:new ue.Name("keyword"),schemaPath:new ue.Name("schemaPath"),params:new ue.Name("params"),propertyName:new ue.Name("propertyName"),message:new ue.Name("message"),schema:new ue.Name("schema"),parentSchema:new ue.Name("parentSchema")};function VH(e,t,r){let{createErrors:n}=e.it;if(n===!1)return ue._`{}`;return Aje(e,t,r)}function Aje(e,t,r={}){let{gen:n,it:i}=e,o=[Oje(i,r),Tje(e,r)];return Pje(e,t,o),n.object(...o)}function Oje({errorPath:e},{instancePath:t}){let r=t?ue.str`${e}${pc.getErrorPath(t,pc.Type.Str)}`:e;return[_n.default.instancePath,ue.strConcat(_n.default.instancePath,r)]}function Tje({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:ue.str`${t}/${e}`;if(r)i=ue.str`${i}${pc.getErrorPath(r,pc.Type.Str)}`;return[Yl.schemaPath,i]}function Pje(e,{params:t,message:r},n){let{keyword:i,data:o,schemaValue:s,it:a}=e,{opts:c,propertyName:u,topSchemaRef:d,schemaPath:f}=a;if(n.push([Yl.keyword,i],[Yl.params,typeof t=="function"?t(e):t||ue._`{}`]),c.messages)n.push([Yl.message,typeof r=="function"?r(e):r]);if(c.verbose)n.push([Yl.schema,s],[Yl.parentSchema,ue._`${d}${f}`],[_n.default.data,o]);if(u)n.push([Yl.propertyName,u])}});var QH=y(function(JH){Object.defineProperty(JH,"__esModule",{value:!0});JH.boolOrEmptySchema=JH.topBoolOrEmptySchema=void 0;var WH=ch(),KH=Ke(),Mje=vi(),qje={message:"boolean schema is false"};function Lje(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)YH(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Mje.default.data);else t.assign(KH._`${n}.errors`,null),t.return(!0)}JH.topBoolOrEmptySchema=Lje;function Bje(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),YH(e);else r.var(t,!0)}JH.boolOrEmptySchema=Bje;function YH(e,t){let{gen:r,data:n}=e;WH.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},qje,void 0,t)}});var qk=y(function(ZH){Object.defineProperty(ZH,"__esModule",{value:!0});ZH.getRules=ZH.isJSONType=void 0;var zje=["string","number","integer","boolean","null","object","array"],Vje=new Set(zje);function Hje(e){return typeof e=="string"&&Vje.has(e)}ZH.isJSONType=Hje;function Gje(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ZH.getRules=Gje});var Lk=y(function(nG){Object.defineProperty(nG,"__esModule",{value:!0});nG.shouldUseRule=nG.shouldUseGroup=nG.schemaHasRulesForType=void 0;function Kje({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&tG(e,n)}nG.schemaHasRulesForType=Kje;function tG(e,t){return t.rules.some((r)=>rG(e,r))}nG.shouldUseGroup=tG;function rG(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((n)=>e[n]!==void 0))}nG.shouldUseRule=rG});var lh=y(function(uG){Object.defineProperty(uG,"__esModule",{value:!0});uG.reportTypeError=uG.checkDataTypes=uG.checkDataType=uG.coerceAndCheckDataType=uG.getJSONTypes=uG.getSchemaTypes=uG.DataType=void 0;var oG=qk(),sG=Lk(),aG=ch(),X=Ke(),Yb=st(),sf;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(sf||(uG.DataType=sf={}));function Xje(e){let t=cG(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}uG.getSchemaTypes=Xje;function cG(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(oG.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}uG.getJSONTypes=cG;function Qje(e,t){let{gen:r,data:n,opts:i}=e,o=Zje(t,i.coerceTypes),s=t.length>0&&!(o.length===0&&t.length===1&&sG.schemaHasRulesForType(e,t[0]));if(s){let a=Uk(t,n,i.strictNumbers,sf.Wrong);r.if(a,()=>{if(o.length)eMe(e,t,o);else zk(e)})}return s}uG.coerceAndCheckDataType=Qje;var lG=new Set(["string","number","integer","boolean","null"]);function Zje(e,t){return t?e.filter((r)=>lG.has(r)||t==="array"&&r==="array"):[]}function eMe(e,t,r){let{gen:n,data:i,opts:o}=e,s=n.let("dataType",X._`typeof ${i}`),a=n.let("coerced",X._`undefined`);if(o.coerceTypes==="array")n.if(X._`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,X._`${i}[0]`).assign(s,X._`typeof ${i}`).if(Uk(t,i,o.strictNumbers),()=>n.assign(a,i)));n.if(X._`${a} !== undefined`);for(let u of r)if(lG.has(u)||u==="array"&&o.coerceTypes==="array")c(u);n.else(),zk(e),n.endIf(),n.if(X._`${a} !== undefined`,()=>{n.assign(i,a),tMe(e,a)});function c(u){switch(u){case"string":n.elseIf(X._`${s} == "number" || ${s} == "boolean"`).assign(a,X._`"" + ${i}`).elseIf(X._`${i} === null`).assign(a,X._`""`);return;case"number":n.elseIf(X._`${s} == "boolean" || ${i} === null
|
|
86
86
|
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(a,X._`+${i}`);return;case"integer":n.elseIf(X._`${s} === "boolean" || ${i} === null
|
|
87
87
|
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,X._`+${i}`);return;case"boolean":n.elseIf(X._`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf(X._`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf(X._`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf(X._`${s} === "string" || ${s} === "number"
|
|
@@ -99,7 +99,7 @@ ${t}`,YNe,JNe,XNe=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,i=KNe.bind(nul
|
|
|
99
99
|
`)}var pC=!1;var{spawn:AXe}=globalThis.Bun;function ou(e,t=[]){let r=e.replace(OXe,'("$1","<redacted>")');for(let n of t)if(n.length>=TXe)r=r.split(n).join("<redacted>");return r}function Iw(e){let t=["AWS_SESSION_TOKEN","AWS_SECRET_ACCESS_KEY","AWS_ACCESS_KEY_ID"],r=new Set;for(let n of[process.env,e??{}])for(let i of t){let o=n[i];if(typeof o==="string"&&o.length>0)r.add(o)}return[...r]}async function ane(e,t){let r=e.getReader(),n=new TextDecoder,i="";while(!0){let{done:o,value:s}=await r.read();if(o)break;if(s.byteLength===0)continue;t(),i+=n.decode(s,{stream:!0})}return i+n.decode()}async function k(e,t={}){let r={...process.env,GIT_TERMINAL_PROMPT:"0",...t.env};for(let b of t.unsetEnv??[])delete r[b];let n=AXe({cmd:e,cwd:t.cwd,...t.stdin===void 0?{}:{stdin:new TextEncoder().encode(t.stdin)},stdout:"pipe",stderr:"pipe",env:r}),i=!1,o,s,a=performance.now(),c=()=>{if(s!==void 0)clearTimeout(s),s=void 0},u=()=>{if(!t.onInactivityWarning)return;c(),s=setTimeout(()=>{s=void 0;try{t.onInactivityWarning?.(performance.now()-a)}catch{console.error("Could not display subprocess inactivity warning; the child result is unaffected.")}},t.inactivityWarningAfterMs??PXe)};if(u(),t.timeout)o=setTimeout(()=>{i=!0,c(),n.kill()},t.timeout);let d=Pw()?[...Iw(r),...t.redact??[]]:[];if(Pw()){let b=t.cwd?` (cwd=${t.cwd})`:"";Kc(l.dim(ou(`$ ${e.join(" ")}${b}`,d)))}let f=()=>{a=performance.now(),u()},p,m,g,h=n.exited.then((b)=>(c(),b));try{[p,m,g]=await Promise.all([ane(n.stdout,f),ane(n.stderr,f),h])}finally{if(c(),o)clearTimeout(o)}if(Pw()){if(t.sensitiveOutput)Kc(l.dim("[sensitive subprocess output suppressed]"));else{if(p.trim())Kc(l.dim(ou(p.trimEnd(),d)));if(m.trim())Kc(l.yellow(ou(m.trimEnd(),d)))}Kc(l.dim(`(exit ${g})`))}if(i)return{stdout:p,stderr:m||`Command timed out after ${Math.round(t.timeout/1000)}s`,exitCode:g??1,timedOut:!0};return{stdout:p,stderr:m,exitCode:g,timedOut:!1}}var OXe,TXe=8,PXe=120000;var jt=N(()=>{Ne();OXe=/\(\s*"((?:x-amz-)[^"]*|authorization|proxy-authorization)"\s*,\s*"[^"]*"\s*\)/gi});function FXe(){if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";return"linux"}function lne(e,t=FXe()){return e.installInstructions[t]}function NXe(e){let t=e.match(/(\d+\.\d+(?:\.\d+)?)/);return t?t[1]:void 0}function MXe(){let e=Number(process.env.TEST_PROBE_TIMEOUT_MS);return Number.isFinite(e)&&e>0?e:jXe}async function une(e){try{let{exitCode:t,stdout:r,timedOut:n}=await k(e.cmd,{timeout:MXe()});if(n)return{available:!1,timedOut:!0};if(t!==0)return{available:!1};return{available:!0,version:NXe(r)}}catch(t){let r=t instanceof Error?t.message:String(t);if(!r.includes("ENOENT")&&!r.includes("not found"))console.error(` Warning: ${e.name} check failed unexpectedly: ${r}`);return{available:!1}}}async function Mh(){let e=Object.entries(cne);return Promise.all(e.map(async([t,r])=>{let{available:n,version:i,timedOut:o}=await une(r);return{key:t,name:r.name,purpose:r.purpose,required:r.required,available:n,version:i,timedOut:o,installInstruction:lne(r)}}))}async function dne(){let t=(await Mh()).filter((r)=>r.required&&!r.available);if(t.length===0)return[];console.warn(`
|
|
100
100
|
Heads up: some tools NEMAR needs for uploading/validating aren't installed yet:`);for(let r of t)console.warn(` - ${r.name} (${r.purpose})`),console.warn(` Install: ${r.installInstruction}`);return console.warn("Run `nemar doctor` anytime to re-check. You can finish signup without them.\n"),t}async function su(e){let r=IXe[e].map((s)=>cne[s]).filter(Boolean),n=await Promise.all(r.map(async(s)=>{let a=await une(s);return{check:s,available:a.available,timedOut:a.timedOut}}));for(let s of n)if(s.timedOut&&s.check.required)console.warn(`Warning: ${s.check.name} did not respond to a version check in time; continuing anyway.`);let i=n.filter((s)=>!s.available&&!s.timedOut&&s.check.required).map((s)=>({tool:s.check.name,installInstruction:lne(s.check)}));if(i.length===0)return;let o=[`
|
|
101
101
|
Missing required tools:`];for(let s of i)o.push(` ${s.tool} not installed`),o.push(` Install: ${s.installInstruction}`);throw Error(o.join(`
|
|
102
|
-
`))}var cne,IXe,jXe=4000;var qh=N(()=>{jt();cne={git:{name:"git",purpose:"version control for dataset metadata",cmd:["git","--version"],required:!0,installInstructions:{macos:"brew install git (or install Xcode Command Line Tools)",linux:"sudo apt-get install git OR sudo dnf install git",windows:"winget install Git.Git (or https://git-scm.com/download/win)"}},"git-annex":{name:"git-annex",purpose:"large-file data transfer (upload/download)",cmd:["git-annex","version"],required:!0,installInstructions:{macos:"brew install git-annex",linux:"sudo apt-get install git-annex OR sudo dnf install git-annex",windows:"Download the installer from https://git-annex.branchable.com/install/Windows/"}},gh:{name:"GitHub CLI (gh)",purpose:"GitHub authentication + repository operations",cmd:["gh","--version"],required:!0,installInstructions:{macos:"brew install gh",linux:"See https://cli.github.com/manual/installation",windows:"winget install GitHub.cli (or: scoop install gh)"}},aws:{name:"AWS CLI",purpose:"S3 data upload/download",cmd:["aws","--version"],required:!0,installInstructions:{macos:"brew install awscli",linux:"pip install awscli OR sudo snap install aws-cli --classic",windows:"winget install Amazon.AWSCLI (or the MSI from https://aws.amazon.com/cli/)"}},deno:{name:"Deno",purpose:"BIDS validation",cmd:["deno","--version"],required:!0,installInstructions:{macos:"brew install deno (or: curl -fsSL https://deno.land/install.sh | sh)",linux:"curl -fsSL https://deno.land/install.sh | sh",windows:"winget install DenoLand.Deno (or: irm https://deno.land/install.ps1 | iex)"}}},IXe={upload:["git-annex","gh","aws","deno"],download:["gh"],clone:["git","gh"],push:["git-annex","gh"],publish:["gh","aws"],update:["git","gh"],release:["git","gh"]}});var pne;var fne=N(()=>{pne={name:"nemar-cli",packageManager:"bun@1.4.3",version:"0.10.19-
|
|
102
|
+
`))}var cne,IXe,jXe=4000;var qh=N(()=>{jt();cne={git:{name:"git",purpose:"version control for dataset metadata",cmd:["git","--version"],required:!0,installInstructions:{macos:"brew install git (or install Xcode Command Line Tools)",linux:"sudo apt-get install git OR sudo dnf install git",windows:"winget install Git.Git (or https://git-scm.com/download/win)"}},"git-annex":{name:"git-annex",purpose:"large-file data transfer (upload/download)",cmd:["git-annex","version"],required:!0,installInstructions:{macos:"brew install git-annex",linux:"sudo apt-get install git-annex OR sudo dnf install git-annex",windows:"Download the installer from https://git-annex.branchable.com/install/Windows/"}},gh:{name:"GitHub CLI (gh)",purpose:"GitHub authentication + repository operations",cmd:["gh","--version"],required:!0,installInstructions:{macos:"brew install gh",linux:"See https://cli.github.com/manual/installation",windows:"winget install GitHub.cli (or: scoop install gh)"}},aws:{name:"AWS CLI",purpose:"S3 data upload/download",cmd:["aws","--version"],required:!0,installInstructions:{macos:"brew install awscli",linux:"pip install awscli OR sudo snap install aws-cli --classic",windows:"winget install Amazon.AWSCLI (or the MSI from https://aws.amazon.com/cli/)"}},deno:{name:"Deno",purpose:"BIDS validation",cmd:["deno","--version"],required:!0,installInstructions:{macos:"brew install deno (or: curl -fsSL https://deno.land/install.sh | sh)",linux:"curl -fsSL https://deno.land/install.sh | sh",windows:"winget install DenoLand.Deno (or: irm https://deno.land/install.ps1 | iex)"}}},IXe={upload:["git-annex","gh","aws","deno"],download:["gh"],clone:["git","gh"],push:["git-annex","gh"],publish:["gh","aws"],update:["git","gh"],release:["git","gh"]}});var pne;var fne=N(()=>{pne={name:"nemar-cli",packageManager:"bun@1.4.3",version:"0.10.19-PR1792.2d9740b",description:"CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",type:"module",main:"dist/index.js",bin:{nemar:"dist/index.js"},scripts:{dev:"bun run src/index.ts",build:"bun build src/index.ts --outdir dist --target bun --minify && sed '1s|#!/usr/bin/env node|#!/usr/bin/env bun|' dist/index.js > dist/index.js.tmp && mv dist/index.js.tmp dist/index.js",test:"bun test",lint:"biome check src/","lint:scrub":"biome check scripts/scrub shared/identifier-scrub.ts test/scrub","test:scrub":"bun test --preload ./test/scrub/helpers/temp-dirs-preload.ts --path-ignore-patterns='__run_every_scrub_suite__' test/scrub test/identifier-scan.test.ts test/identifier-scrub.test.ts test/identifier-dates.test.ts test/identifier-fleet.test.ts","migrations:d1-check":"bun run scripts/d1-migration-check.ts","zarr:geometry-check":"bun run backend/scripts/zarr-geometry-conformance.ts","lint:fix":"biome check --fix src/",format:"biome format --write src/",typecheck:"tsc --noEmit && tsc --noEmit -p backend","generate-openapi":"bun run scripts/generate-openapi.ts",prepublishOnly:"bun run build",prepare:"husky",postinstall:"bun scripts/postinstall-check.mjs",deploy:"wrangler deploy",preview:"wrangler dev"},keywords:["nemar","bids","neuroimaging","eeg","emg","datalad","cli"],author:"NEMAR Team",license:"CC-BY-NC-ND-4.0",repository:{type:"git",url:"git+https://github.com/nemarOrg/nemar-cli.git"},bugs:{url:"https://github.com/nemarOrg/nemar-cli/issues"},homepage:"https://docs.nemar.org",engines:{bun:">=1.0.0"},files:["dist","scripts/postinstall-check.mjs","scripts/recover-datasets.json","scripts/withdrawn-datasets.json","README.md","LICENSE"],dependencies:{chalk:"^5.3.0",commander:"^12.1.0",conf:"^13.0.1",inquirer:"^9.2.15",ora:"^8.0.1",semver:"^7.8.5",zod:"^3.23.8"},"lint-staged":{"src/**/*.{ts,tsx}":["biome check --fix"],"backend/src/**/*.{ts,tsx}":["biome check --fix"]},devDependencies:{"@anthropic-ai/sdk":"^0.132.1","@asteasolutions/zod-to-openapi":"^7.3.4","@biomejs/biome":"1.9.4","@types/bun":"latest","@types/inquirer":"^9.0.7","@types/semver":"^7.8.0",ajv:"^8.20.0","ajv-formats":"^3.0.1",husky:"^9.1.7","lint-staged":"^16.3.2",typescript:"^5.5.4",wrangler:"^4.70.0",yaml:"^2.8.4"}}});var oo;var Gf=N(()=>{fne();oo=pne.version});import{mkdirSync as LXe,readdirSync as BXe,unlinkSync as UXe,writeFileSync as zXe}from"fs";import{join as mC}from"path";function xne(){Wf=!0}function au(){return Wf}function wne(e,t=process.env){return e.includes("--debug")||t.NEMAR_DEBUG==="1"}function Bh(e){bne=e,Zt(`Step: ${e}`)}function Uh(){gne=!0}function vne(){return gne}function Fe(){if(yne)return;gC=!0}function yC(){gC=!1,yne=!0}function _ne(){return gC}function Zt(e){if(Wf)process.stderr.write(`[debug] ${e}
|
|
103
103
|
`)}function WXe(e){let t={};for(let[r,n]of Object.entries(e))t[r]=GXe.has(r.toLowerCase())?"[REDACTED]":n;return t}function Ene(e){let t=e.indexOf("@");if(t<=0)return"***";return`${e[0]}***${e.slice(t)}`}function hC(e,t,r=0){if(r>YXe)return"[REDACTED: depth]";if(Array.isArray(t))return t.map((n)=>hC(e,n,r+1));if(t&&typeof t==="object"){let n={};for(let[i,o]of Object.entries(t))n[i]=hC(i,o,r+1);return n}if(typeof t==="string"){if(KXe.test(e))return"[REDACTED]";return t.replace(Dne,Ene)}return t}function bC(e){return e.replace(JXe,"Bearer [REDACTED]").replace(XXe,"[REDACTED_AWS_KEY]").replace(QXe,"$1[REDACTED]").replace(ZXe,"$1$2=[REDACTED]").replace(Dne,Ene)}function eQe(e){return bC(e)}function mne(e,t=HXe){if(e===void 0)return;let r=e;try{let n=JSON.parse(e);r=JSON.stringify(hC("",n))}catch{}if(r=bC(r),Buffer.byteLength(r,"utf8")>t)r=`${Buffer.from(r,"utf8").subarray(0,t).toString("utf8")}... [truncated]`;return r}function jw(e){if(!Wf)return;let t=eQe(e.url);try{let r={...e,url:t,requestHeaders:e.requestHeaders?WXe(e.requestHeaders):void 0,requestBody:mne(e.requestBody),responseBody:mne(e.responseBody)};Nw.push(r),Zt(`${e.method} ${t} -> ${e.status??"ERROR"} (${e.durationMs}ms)`)}catch(r){let n=L(r);Nw.push({method:e.method,url:t,status:e.status,durationMs:e.durationMs,note:`redaction failed: ${n}`}),Zt(`redaction failed for ${e.method} ${t}: ${n}`)}}async function tQe(){let e=[];try{let t=process.versions.bun?`Bun ${process.versions.bun}`:`Node ${process.version}`;e.push(`CLI version: ${oo}`),e.push(`OS/Arch: ${process.platform}/${process.arch}`),e.push(`Runtime: ${t}`)}catch(t){e.push(`(could not read CLI/OS/runtime info: ${L(t)})`)}e.push(""),e.push("Active account:");try{let t=Ft();if(t.apiKey){if(t.username)e.push(` Username: ${t.username}`);if(e.push(` API URL: ${t.apiUrl}`),t.role)e.push(` Role: ${t.role}`);e.push(` Sandbox completed: ${!!t.sandboxCompleted}`)}else e.push(" (not authenticated)")}catch(t){e.push(` (could not read account config: ${L(t)})`)}e.push(""),e.push("External tools:");try{let t=await Mh();for(let r of t){let n=r.available?r.version??"installed":r.timedOut?"(timed out)":"not installed";e.push(` ${r.name}: ${n}`)}}catch(t){e.push(` (could not probe external tools: ${L(t)})`)}return e}async function xC(){return(await tQe()).join(`
|
|
104
104
|
`)}async function Sne(){if(!Wf||Fw!==void 0)return;try{Fw=await xC()}catch(e){let t=L(e);Fw=`(could not build environment report: ${t})`,Zt(`environment snapshot failed: ${t}`)}}function $ne(e){if(hne.has(e))return{flag:e};for(let t of hne){if(!e.startsWith(t)||e.length<=t.length)continue;if(t.length===2)return{flag:t,kind:"short-attached"};if(e[t.length]==="=")return{flag:t,kind:"long-eq"}}return null}function rQe(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],i=$ne(n);if(!i){t.push(n);continue}if(i.kind==="long-eq")t.push(`${i.flag}=[REDACTED]`);else if(i.kind==="short-attached")t.push(`${i.flag}[REDACTED]`);else if(t.push(n),r+1<e.length)t.push("[REDACTED]"),r++}return t}function nQe(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],i=$ne(n);if(!i){t.push(n);continue}if(!i.kind&&r+1<e.length)r++}return t}function iQe(e){let t=[];for(let n of nQe(e)){if(n.startsWith("-"))continue;if(t.push(n),t.length===2)break}return(t.length>0?t.join("-"):"nemar").replace(/[^a-zA-Z0-9_-]/g,"_")}function oQe(e,t){let r=[];if(r.push("NEMAR CLI Debug Log"),r.push(`Generated: ${new Date().toISOString()}`),r.push(`Command: nemar ${bC(rQe(e).join(" "))}`),r.push(""),r.push(Fw??"(environment snapshot unavailable)"),r.push(""),r.push("HTTP requests:"),Nw.length===0)r.push(" (none)");else Nw.forEach((n,i)=>{if(r.push(` [${i+1}] ${n.method} ${n.url} -> ${n.status??"ERROR"} (${n.durationMs}ms)`),n.error)r.push(` Error: ${n.error}`);if(n.note)r.push(` Note: ${n.note}`);if(n.requestHeaders)r.push(` Request headers: ${JSON.stringify(n.requestHeaders)}`);if(n.requestBody)r.push(` Request body: ${n.requestBody}`);if(n.responseBody)r.push(` Response body: ${n.responseBody}`)});return r.push(""),r.push(`Failing step: ${bne??"(none recorded)"}`),r.push(`Exit code: ${t}`),`${r.join(`
|
|
105
105
|
`)}
|
|
@@ -237,7 +237,7 @@ Exemplar clone + publish complete: ${o} -> ${i}`)),console.log(l.dim(` GitHub:
|
|
|
237
237
|
${F.replace(/^/gm," ")}`}let I=" ".repeat(Math.max(0,K-A.length)),G=`${A}${I}${P}`,re=t.wrap(G,r-2,K);return U+re.slice(A.length)}function u(A){return A.join(`
|
|
238
238
|
`).replace(/^/gm," ".repeat(2))}let d=[];d.push(`Usage: ${t.commandUsage(e)}`,"");let f=t.commandDescription(e);if(f.length>0)d.push(t.wrap(f,r,0),"");let p=t.visibleArguments(e),m=a(p.map((A)=>t.argumentTerm(A))),g=p.map((A)=>{let U=t.argumentTerm(A);return c(U,l.blue(U),t.argumentDescription(A),m)});if(g.length>0)d.push(l.bold("Arguments:"),u(g),"");let h=t.visibleOptions(e),b=a(h.map((A)=>t.optionTerm(A))),x=h.map((A)=>{let U=t.optionTerm(A);return c(U,l.cyan(U),t.optionDescription(A),b)});if(x.length>0)d.push(l.bold("Options:"),u(x),"");let w=(A,U)=>A.name().localeCompare(U.name()),D=(A)=>{let U=a(A.map((P)=>t.subcommandTerm(P)));return A.map((P)=>{let j=t.subcommandTerm(P);return c(j,l.bold.cyan(j),t.subcommandDescription(P),U)})},R=t.visibleCommands(e),E=fye(e),O=QD||!Object.hasOwn(XD,E)?void 0:XD[E];if(O){let A=new Map(R.map((K)=>[K.name(),K])),U=O.map((K)=>A.get(K)).filter((K)=>K!==void 0),P=new Set(U.map((K)=>K.name())),j=R.filter((K)=>!P.has(K.name())&&K.name()!=="help").sort(w);if(U.length===0)return d.push(l.bold("Commands:"),u(D([...R].sort(w))),""),d.join(`
|
|
239
239
|
`);if(d.push(l.bold("Commands:"),u(D(U)),""),j.length>0){let K=j.map((I)=>I.name()).join(", ");d.push(l.bold("More commands")+l.dim(" (--help-all for details):"),t.wrap(K,r-2,0).replace(/^/gm," "),"")}}else if(R.length>0)d.push(l.bold("Commands:"),u(D([...R].sort(w))),"");return d.join(`
|
|
240
|
-
`)}};function OP(e){TP(e)}function TP(e){e.configureHelp(pye);for(let t of e.commands)TP(t)}function Or(e,t){if(QD)qp.call(e,"after",t);else if(!h0.has(e))h0.add(e),qp.call(e,"after",AP)}Ne();Ne();import{existsSync as Z_,mkdirSync as mpe,mkdtempSync as NO,readFileSync as but,writeFileSync as Xg}from"fs";import{tmpdir as jO}from"os";import{join as va}from"path";xi();on();function yz(e,t){return Math.min(Math.floor(Math.log(e)/Math.log(1024)),t)}function _t(e){if(e===0)return"0 B";let t=["B","KB","MB","GB","TB"],r=yz(e,t.length-1);return`${(e/1024**r).toFixed(r===0?0:1)} ${t[r]}`}function bz(e){if(e===0)return"0 B";let t=["B","KB","MB","GB","TB"],r=yz(e,t.length-1);return`${Number.parseFloat((e/1024**r).toFixed(2))} ${t[r]}`}Qm();Qd();var Ab=50;var _V=["store","node","registration","drift"];function DV(e){let{verification:t,writerMode:r,now:n}=e;if(t===null)return r==="enabled"?{verdict:"unknown",note:"none recorded: the daily verification sweep has not run, which is unknown and not healthy"}:{verdict:"unchecked",note:null};let i=Date.parse(t.at),o=n.getTime()-i;if(Number.isNaN(i)||o>129600000){let s=Number.isNaN(i)?null:Math.floor(o/3600000);return{verdict:"unknown",note:s===null?"the last record has no readable time, so it says nothing about today":`the last record is ${s} hours old, so it says nothing about today`}}return{verdict:t.overall,note:null}}function ok(e){return e==="alarm"?1:e==="unknown"?2:0}var t8e=["store","node","registration","drift"];function r8e(e){return t8e.filter((t)=>e.checkDays[t].unchecked>0)}function sk(e){let t=[];if(e.coverageStatus==="alarm")t.push("coverage is alarming");if(e.coverageStatus==="unknown")t.push("coverage could not be determined");if(e.autoImportEnabled===!1)t.push("auto-import is OFF");if(e.dispatchLost===!0)t.push("dispatches are not landing");if(e.issuesClosed===null)t.push("no daily sweep activity was recorded, so the daily jobs may not be running");let r=e.neurobagel??null,n=[];if(r===null)t.push("no Neurobagel verification run was recorded, so that job may not be running");else{if(n=r8e(r),r.latest.overall==="alarm")t.push("Neurobagel verification is alarming");if(r.latest.overall==="unknown")t.push("Neurobagel verification could not be determined");if(r.days.alarm>0&&r.latest.overall!=="alarm")t.push(`Neurobagel verification alarmed on ${r.days.alarm} day(s) this week`);if(r.days.unknown>0&&r.latest.overall!=="unknown")t.push(`Neurobagel verification could not be determined on ${r.days.unknown} day(s)`);if(r.failedRuns>0)t.push(`the Neurobagel sweep itself failed on ${r.failedRuns} run(s)`);let i=Math.max(0,7-r.runs);if(i>1)t.push(`the daily Neurobagel verification is missing for ${i} of 7 day(s)`)}if(e.neurobagelFindings===null||e.neurobagelFindings===void 0)t.push("Neurobagel findings could not be counted");else if(e.neurobagelFindings>0)t.push(`${e.neurobagelFindings} Neurobagel finding(s) need attention (see the audit log)`);if(e.errors.length>0)t.push(`${e.errors.length} part(s) of this report failed`);return{attention:t.length>0,problems:t,notChecked:n}}Ne();var Zd=2000,oc=10,sc=500,ac=/^(nm|on|xx)\d{6}$/;At();so();Oi();Kr();function T(e){return typeof e==="string"?e.replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/gu,""):""}function tp(e,t){let r=T(e);return r.length>t?`${r.slice(0,t-1)}\u2026`:r}function Wh(e,t=Date.now()){let r=Date.parse(e);if(Number.isNaN(r))return"?";let n=Math.max(0,Math.floor((t-r)/1000));if(n<3600)return`${Math.floor(n/60)}m`;if(n<86400)return`${Math.floor(n/3600)}h`;return`${Math.floor(n/86400)}d`}var CC={owner_name_missing:"Run `nemar admin backfill-names --apply` if the owner's ORCID record publishes their name; an ORCID-linked owner must otherwise make it public on ORCID and sign in again, and an owner with no linked ORCID can now type it into Settings on nemar.org (ADR 0042)."};function ia(e){return e?(t)=>console.error(t):(t)=>console.log(t)}function zw(e){if(!(e instanceof B))return!1;if(e.statusCode>=400&&e.statusCode<500)return!0;let t=Zf(e);return t!==void 0&&t!=="internal"}function RC(e,t,r,n){if(t)t.fail(e);else r(l.red(e));if(n)r(l.dim(` ${n}`))}function Une(e,t,r,n,i){if(e instanceof B){let s=(e.blockReason?CC[e.blockReason]:void 0)??n?.[e.statusCode]??(e.statusCode===403?"This command requires admin privileges":void 0);RC(T(e.message),t,i,s);return}RC(r,t,i,`Error details: ${T(L(e))}`)}function pt(e,t,r,n){Une(e,t,r,n,ia(!1))}function dn(e,t,r,n,i={}){if(Une(e,t,r,n,ia(i.json)),process.exitCode=1,zw(e))Fe();else yC()}function Pi(e,t){if(RC(T(e),t.spinner,ia(t.json),t.hint),process.exitCode=1,t.answered)Fe();else yC()}function Jc(e,t){if(ac.test(e))return e;return Pi(`"${e}" is not a dataset id (like nm000108).`,{json:t,answered:!0}),null}function ao(e){if(et())return!0;let t=ia(e);return t(l.red("Error: Not authenticated")),t(l.dim(" Run 'nemar auth login' first")),process.exitCode=1,Fe(),!1}Ne();Qm();Ne();function rp(e){return(t)=>{try{return e(t)}catch{return String(t)}}}var fn={id:rp(l.cyan),metric:rp(l.magenta),label:rp(l.bold),warn:rp(l.yellow),muted:rp(l.dim),match:rp(l.green)};var DQe=/[\u001b\u009b][\[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PR-TZcf-ntqry=><~]/g,EQe=/[\n\r\t]+/g,SQe=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/g;function kr(e){return e.replace(DQe,"").replace(EQe," ").replace(SQe,"").trim()}var $Qe=/(<mark>[\s\S]*?<\/mark>)/g,kQe=/^<mark>([\s\S]*)<\/mark>$/,zne=400;function Vne(e){if(!e||typeof e!=="string")return null;try{let t=e.length>zne?e.slice(0,zne):e,r=kr(t);if(!r)return null;return r.split($Qe).filter((n)=>n.length>0).map((n)=>{let i=n.match(kQe);return i?fn.match(i[1]):fn.muted(n)}).join("")}catch{return null}}function Hne(e,t){if(!Number.isFinite(t)||t<=0)return e;if(e.length<=t)return e;let r=e.split(","),n=[],i=0;for(let s of r){let a=n.length===0?s.length:i+1+s.length;if(a>t)break;n.push(s),i=a}let o=r.length-n.length;if(n.length===0){let s=r[0],a=Math.max(0,t-1),c=a>0?`${s.slice(0,a)}\u2026`:"\u2026",u=r.length-1;return u>0?`${c} +${u}`:c}return o>0?`${n.join(",")} +${o}`:n.join(",")}function uu(e){return kr(e??"")}function AC(e){let t=e.match_kind;return typeof t==="string"&&Nz.includes(t)?t:void 0}function OC(e){let t=e.filter((r)=>AC(r)==="exact");return t.length===1?t[0]:null}function TC(e){return e.length>0&&e.every((t)=>AC(t)==="fuzzy")}function PC(e){return e.length===0||e.some((t)=>AC(t)!==void 0)}function Gne(e){if(e.length===0)return{kind:"none"};let t=OC(e);if(t)return{kind:"one",user:t,match:"exact"};let r=TC(e)?"fuzzy":"partial";if(e.length===1)return{kind:"one",user:e[0],match:r};return{kind:"many",users:[...e],match:r}}var Hw=[["givenName","given_name"],["familyName","family_name"],["affiliation","affiliation"],["city","city"],["country","country"],["username","username"],["github","github_username"],["email","email"]];var Vw=[{option:"clearAffiliation",valueOption:"affiliation",field:"affiliation"},{option:"clearGithub",valueOption:"github",field:"github_username"}];function Xc(e){return`--${e.replace(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}`}function Wne(e){let t={};for(let[r,n]of Hw){let i=e[r];if(typeof i!=="string")continue;if((n==="github_username"?i.trim().replace(/^@/,""):i.trim())===""){let s=Vw.find((a)=>a.valueOption===r);return{ok:!1,message:s?`${Xc(r)} needs a value. To remove it, say so with ${Xc(s.option)}.`:`${Xc(r)} needs a value.`}}t[n]=i}for(let{option:r,valueOption:n,field:i}of Vw){if(e[r]!==!0)continue;if(i in t)return{ok:!1,message:`Use either ${Xc(n)} or ${Xc(r)}, not both.`};t[i]=""}return{ok:!0,body:t}}function Kne(e,t){let r=[];for(let[,n]of Hw){let i=t[n];if(i===void 0)continue;let o=e[n]??null;if((o??"")===i)continue;r.push({field:n,from:o,to:i})}return r}function ti(e,t="-"){let r=uu(e);return r!==""?r:t}function Kh(e){if(e===null)return l.dim("(none)");if(e==="")return l.dim("(cleared)");return ti(e,l.dim("(blank)"))}function lu(e){if(!e)return"-";let t=new Date(e.includes("T")?e:`${e.replace(" ","T")}Z`);return Number.isNaN(t.getTime())?uu(e):t.toISOString().replace("T"," ").slice(0,16)}function IC(e){let t=(a)=>l.dim(`${a}:`.padEnd(15)),r=[e.given_name,e.family_name].filter(Boolean).join(" "),n=[e.city,e.country].filter(Boolean).join(", "),i=e.role||"member",o=e.service_access===void 0||e.service_access===null?"unknown":e.service_access?"upload":"browse",s=[];if(s.push(`${l.cyan(ti(e.username??e.email))}${l.dim(` [${uu(i)}] id ${e.id}`)}${e.username===null?l.dim(" (no username)"):""}`),s.push(` ${t("Name")}${ti(r)}`),s.push(` ${t("Email")}${ti(e.email)} ${e.email_verified?l.green("(verified)"):l.yellow("(unverified)")}`),s.push(` ${t("GitHub")}${e.github_username?`@${ti(e.github_username)}`:"-"}`),s.push(` ${t("ORCID")}${e.orcid?`${ti(e.orcid)} ${e.orcid_verified?l.green("(verified)"):l.yellow("(unverified)")}`:"-"}`),s.push(` ${t("Affiliation")}${ti(e.affiliation)}`),s.push(` ${t("Location")}${ti(n)}`),s.push(` ${t("Status")}${uu(e.status)}`),s.push(` ${t("Upload access")}${o}${e.service_access&&e.service_access_granted_at?l.dim(` (granted ${lu(e.service_access_granted_at)}${e.service_access_granted_by?` by id ${e.service_access_granted_by}`:""})`):""}`),e.upload_access_requested_at)s.push(` ${t("Asked")}${lu(e.upload_access_requested_at)} (upload access)`);if(s.push(` ${t("Kind")}${uu(e.account_kind)||"-"}`),s.push(` ${t("Signed up via")}${ti(e.signup_source)}`),s.push(` ${t("Created")}${lu(e.created_at)}`),e.approved_at)s.push(` ${t("Approved")}${lu(e.approved_at)}`);if(e.revoked_at)s.push(` ${t("Revoked")}${lu(e.revoked_at)}`);if(s.push(` ${t("Last changed")}${lu(e.updated_at)}`),s.push(` ${t("Datasets")}${e.dataset_count??"-"}${l.dim(" API keys: ")}${e.active_tokens??"-"}`),s.push(` ${t("Sign-in")}${e.linked_identities&&e.linked_identities.length>0?e.linked_identities.map((a)=>uu(a)).join(", "):"-"}`),e.description)s.push(` ${t("Description")}${ti(e.description)}`);if(e.identity_conflict)s.push(` ${l.yellow("! Flagged as a duplicate identity: see 'nemar admin duplicates'")}`);if(e.username_auto_assigned)s.push(` ${l.dim("The username was derived from the name, not chosen")}`);if(e.deleted_at)s.push(` ${l.red(`Deleted ${lu(e.deleted_at)} (tombstoned)`)}`);return s}function FC(e){let t=[e.given_name,e.family_name].filter(Boolean).join(" "),r=e.matched_in&&e.matched_in.length>0?l.dim(` matched: ${e.matched_in.map((n)=>uu(n)).join(", ")}`):"";return` ${String(e.id).padStart(5)} ${l.cyan(ti(e.username,"(no username)"))} ${ti(t,"")} ${l.dim(ti(e.email))}${r}`}du();sa();Zc();At();na();var JC=["critical","warning","maintenance","announcement","tip"];async function boe(){return M("/notices",{},"optional")}async function xoe(){return M("/admin/notices",{},!0)}async function woe(e){return M("/admin/notices",{method:"POST",body:JSON.stringify(e)},!0)}async function voe(e){return M(`/admin/notices/${e}`,{method:"DELETE"},!0)}Oi();xi();async function ke(e,t,r=!1){if(t.no)return"declined";if(t.yes)return"confirmed";if(!process.stdin.isTTY)return console.error("Interactive prompt unavailable; use --yes or --no"),"cancelled";try{let{confirmed:n}=await _e.prompt([{type:"confirm",name:"confirmed",message:e,default:r}]);return n?"confirmed":"cancelled"}catch(n){let i=n instanceof Error?n.message:String(n);if(i.includes("closed")||i.includes("TTY")||i.includes("SIGINT")||i.includes("readline"))console.error("Interactive prompt unavailable (non-interactive terminal or interrupted)"),console.error(" Use --yes or --no flags for non-interactive mode");else console.error("Prompt error:",i);return"cancelled"}}async function _oe(e,t,r){if(r.no)return"declined";if(r.yes)return"confirmed";if(!process.stdin.isTTY)return console.error("Interactive prompt unavailable; use --yes or --no"),"cancelled";try{let{input:n}=await _e.prompt([{type:"input",name:"input",message:e,validate:(i)=>{if(i!==t)return`Input does not match. Expected: ${t}`;return!0}}]);return n===t?"confirmed":"cancelled"}catch(n){let i=n instanceof Error?n.message:String(n);if(i.includes("closed")||i.includes("TTY")||i.includes("SIGINT")||i.includes("readline"))console.error("Interactive prompt unavailable (non-interactive terminal or interrupted)"),console.error(" Use --yes or --no flags for non-interactive mode");else console.error("Prompt error:",i);return"cancelled"}}var Me="-y, --yes",tt="-n, --no",ze="Skip confirmation and proceed",Qe="Skip confirmation and decline";Kr();var Doe="__Host-nemar_docs_session";Qd();na();At();async function XC(e){return M("/auth/login",{method:"POST",body:JSON.stringify({api_key:e})})}async function Eoe(e){return M("/auth/resend-verification",{method:"POST",body:JSON.stringify({email:e})})}async function Soe(e){return M("/auth/request-key-regeneration",{method:"POST",body:JSON.stringify({email:e})})}async function ri(){return(await M("/users/me",{},!0,Az)).user}async function $oe(e){return M("/sandbox/complete",{method:"POST",body:JSON.stringify({dataset_id:e})},!0)}async function koe(){return M("/sandbox/reset",{method:"POST"},!0)}async function ev(){return M("/sandbox/status",{},!0)}async function Roe(e){return M("/users/me/upload-access/request",{method:"POST",body:JSON.stringify({why:e})},!0)}async function Coe(e){return M("/auth/email/change/request",{method:"POST",body:JSON.stringify({email:e})},!0)}async function Aoe(e,t){return M("/auth/email/change/verify",{method:"POST",body:JSON.stringify({email:e,code:t})},!0)}async function QC(e){return M("/auth/profile",{method:"PATCH",body:JSON.stringify(e)},!0)}async function Ooe(e){return M("/auth/orcid/cli-start",{method:"POST",body:JSON.stringify({mode:e})},!0)}async function Toe(){return M("/auth/orcid/unlink",{method:"POST"},!0)}async function Poe(e){return M("/auth/device/start",{method:"POST",body:JSON.stringify({machine_name:e})},!1,nV)}function RQe(e){return typeof e==="string"&&bb.options.includes(e)}function CQe(e){if(typeof e!=="object"||e===null)return;let t=e.message;return typeof t==="string"?t:void 0}async function Ioe(e,t){try{return{status:"success",data:await M("/auth/device/token",{method:"POST",body:JSON.stringify({device_code:e}),signal:t},!1,oV)}}catch(r){if(r instanceof B&&r.statusCode===400){let n=iV.safeParse(r.rawBody);if(n.success){let i=n.data;if(i.error==="authorization_pending")return{status:"pending"};if(i.error==="slow_down")return{status:"slow_down"};return{status:"terminal",error:i.error,reason:i.reason,message:i.message}}if(RQe(r.code)&&r.code!=="authorization_pending"&&r.code!=="slow_down")return{status:"terminal",error:r.code,reason:void 0,message:CQe(r.rawBody)??tV[r.code]}}throw r}}async function Foe(){return M("/auth/keys",{},!0,xb)}async function Noe(e){return M("/auth/keys",{method:"POST",body:JSON.stringify({name:e})},!0,wb)}async function joe(){return M("/auth/docs/cli-session",{method:"POST"},!0)}async function tv(e){return M(`/auth/keys/${e}`,{method:"DELETE"},!0)}async function Moe(e,t){return M(`/auth/keys/${e}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}},!1)}async function qoe(){return M("/auth/profile/username-suggestion",{},!0,Tz)}var AQe="https://docs.nemar.org";function rv(){return process.env.NEMAR_DOCS_URL||AQe}var Loe=20000;function OQe(e){let t=e.trim();if(/^https?:\/\//i.test(t)){let n=new URL(t),i=new URL(rv()).hostname;if(n.hostname.toLowerCase()!==i.toLowerCase())throw Error(`Not a ${i} URL: ${e}`);t=n.pathname}if(t=t.replace(/[?#].*$/,""),!t.startsWith("/"))t=`/${t}`;if(t.length>1&&t.endsWith("/"))t=t.slice(0,-1);if(t===""||t==="/")return"/index.md";return t.slice(t.lastIndexOf("/")+1).includes(".")?t:`${t}.md`}function TQe(e,t){if(e===302||e===301||e===307||e===308){if(t?.includes("/auth/docs/authorize"))return"the documentation session was refused (it may have expired mid-run); try again";return`redirected to ${t??"an unknown location"}`}if(e===404)return"not found, or it is a gated page and this account is not an admin";if(e===401)return"the documentation session was rejected; it may have expired, try again";if(e===403)return"this account is no longer an admin, so the documentation session was refused";if(e===503)return"the documentation gate could not reach the API; try again shortly";return`unexpected status ${e}`}async function Boe(e){let t=e.map((s)=>{try{return{input:s,path:OQe(s)}}catch(a){return{input:s,error:a.message}}});if(!t.some((s)=>s.path))return t.map((s)=>({path:s.input,ok:!1,error:s.error??"not a usable documentation path"}));let r=await joe();if(typeof r?.session!=="string"||r.session.length===0)throw Error("The API returned no documentation session value.");let n=rv().replace(/\/$/,""),i=`${Doe}=${r.session}`,o=[];for(let s of t){if(!s.path){o.push({path:s.input,ok:!1,error:s.error??"unusable path"});continue}let a=s.path;try{let c=await fetch(`${n}${a}`,{redirect:"manual",signal:AbortSignal.timeout(Loe),headers:{Cookie:i,"User-Agent":"nemar-cli"}});if(c.status===200){o.push({path:a,ok:!0,body:await c.text()});continue}o.push({path:a,ok:!1,error:TQe(c.status,c.headers.get("Location"))})}catch(c){let u=c.name;o.push({path:a,ok:!1,error:u==="TimeoutError"?`no response within ${Loe/1000}s`:c.message})}}return o}nv();Ii();ps();jt();var Iv=Be(Pv(),1);function yrt(e,t){let r=Iv.default.coerce(e),n=Iv.default.coerce(t);if(!r||!n)return!1;return Iv.default.gte(r,n)}async function dce(){try{let{stdout:t,exitCode:r,stderr:n}=await k(["git-annex","version"]);if(r!==0)return console.warn("git-annex version returned non-zero exit code:",r),console.warn("stderr:",n),{installed:!1,minVersion:"10.0",error:`Version check failed: ${n.trim()}`};let i=t.match(/version:\s*(\d+\.\d+)/),o=i?i[1]:void 0;if(!o)console.warn("Could not parse git-annex version from output:",t);return{installed:!0,version:o,minVersion:"10.0",compatible:o?yrt(o,"10.0"):void 0}}catch(t){let r=t instanceof Error?t.message:String(t);if(r.includes("ENOENT")||r.includes("not found"))return console.info("git-annex not found in PATH"),{installed:!1,minVersion:"10.0"};return console.error("Error checking git-annex installation:",r),{installed:!1,minVersion:"10.0",error:r}}}async function brt(){if(process.env.GH_TOKEN)return{accessible:!0,username:"token-auth",useHttps:!0};try{let{stdout:e,stderr:t}=await k(["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ConnectTimeout=10","git@github.com"]),r=e+t,n=r.match(/Hi ([^!]+)!/);if(n)return{accessible:!0,username:n[1]};if(r.includes("Permission denied"))return{accessible:!1};return{accessible:r.includes("successfully authenticated")}}catch(e){let t=e instanceof Error?e.message:String(e);if(t.includes("ENOENT")||t.includes("not found"))console.info("SSH command not found");else console.error("Error checking GitHub SSH access:",t);return{accessible:!1}}}function fce(){let e=process.platform;if(e==="darwin")return"brew install git-annex";if(e==="linux")return"apt install git-annex (Debian/Ubuntu)";return"See https://git-annex.branchable.com/install/"}async function Fv(){let[e,t]=await Promise.all([dce(),brt()]),r=[];if(!e.installed)r.push(`git-annex is not installed. Install: ${fce()}`);else if(e.compatible===!1)r.push(`git-annex version ${e.version} is too old. Required: >= ${e.minVersion}`);if(!t.accessible){if(!(await fu()).token)r.push("GitHub authentication not configured. Run 'gh auth login' to authenticate.")}return{gitAnnex:e,githubSSH:t,allPassed:r.length===0,errors:r}}async function sg(){let e=await dce(),t=[];if(!e.installed)t.push(`git-annex is not installed. Install: ${fce()}`);else if(e.compatible===!1)t.push(`git-annex version ${e.version} is too old. Required: >= ${e.minVersion}`);return{gitAnnex:e,allPassed:t.length===0,errors:t}}ap();import{readFileSync as xrt}from"fs";var wrt=/^on\d{6}$/;function vrt(e){if(!Array.isArray(e))throw Error("Recover-datasets file must be a JSON array");return e.map((t,r)=>{if(typeof t!=="object"||t===null)throw Error(`Recover-datasets entry ${r} is not an object`);let{dataset_id:n,note:i}=t;if(typeof n!=="string"||!wrt.test(n))throw Error(`Recover-datasets entry ${r}: dataset_id "${n}" is not valid`);if(typeof i!=="string"||i.length===0)throw Error(`Recover-datasets entry ${r} (${n}): note is required`);return{dataset_id:n,note:i}})}function R2(e){let t;try{t=JSON.parse(xrt(e,"utf-8"))}catch(r){throw Error(`Failed to read/parse recover-datasets file at ${e}: ${r instanceof Error?r.message:String(r)}`)}return vrt(t)}function pce(e,t,r){let n=new Set(t.map((i)=>i.dataset_id));for(let i of e)if(!n.has(i)&&!r.force)return{error:`${i} is not on the checked-in recover-datasets list. Pass --force to override.`};return{targets:e}}function mce(e,t){let r=new Set(e),n=new Map;for(let o of t)if(r.has(o.dataset_id)&&o.source_id)n.set(o.dataset_id,o.source_id);let i=e.filter((o)=>!n.has(o));return{sourceByTarget:n,missingSource:i}}import{readFileSync as _rt}from"fs";var hce=new Set(["upstream_403","no_source","recovered"]),Drt=/^(nm|xx|on)\d{6}$/;function Ert(e){if(!Array.isArray(e))throw Error("Withdrawn-datasets file must be a JSON array");return e.map((t,r)=>{if(typeof t!=="object"||t===null)throw Error(`Withdrawn-datasets entry ${r} is not an object`);let{dataset_id:n,reason:i,note:o,withdrawn:s,data_available:a,data_keys_missing:c,data_keys_total:u}=t;if(typeof n!=="string"||!Drt.test(n))throw Error(`Withdrawn-datasets entry ${r}: dataset_id "${n}" is not valid`);if(typeof i!=="string"||!hce.has(i))throw Error(`Withdrawn-datasets entry ${r} (${n}): reason "${i}" must be one of ${[...hce].join(", ")}`);if(typeof o!=="string"||o.length===0)throw Error(`Withdrawn-datasets entry ${r} (${n}): note is required`);if(s!==void 0&&typeof s!=="boolean")throw Error(`Withdrawn-datasets entry ${r} (${n}): withdrawn must be a boolean`);if(a!==void 0&&(typeof a!=="number"||a<0||a>1))throw Error(`Withdrawn-datasets entry ${r} (${n}): data_available must be between 0 and 1`);let d=s??!0;if(i==="recovered"&&d)throw Error(`Withdrawn-datasets entry ${r} (${n}): reason "recovered" means the content came back, so withdrawn must be false`);let f=typeof c==="number",p=typeof u==="number";if(f!==p)throw Error(`Withdrawn-datasets entry ${r} (${n}): data_keys_missing and data_keys_total must be given together`);if(f&&p){if(c<0||u<0)throw Error(`Withdrawn-datasets entry ${r} (${n}): key counts cannot be negative`);if(c>u)throw Error(`Withdrawn-datasets entry ${r} (${n}): ${c} missing of ${u} total is not possible`);if(typeof a==="number"&&u>0){let m=(u-c)/u;if(Math.abs(m-a)>0.001)throw Error(`Withdrawn-datasets entry ${r} (${n}): data_available ${a} disagrees with ${c} missing of ${u} (${m.toFixed(4)})`)}}return{dataset_id:n,reason:i,note:o,withdrawn:d,...typeof a==="number"?{data_available:a}:{},...f?{data_keys_missing:c}:{},...p?{data_keys_total:u}:{}}})}function C2(e){let t;try{t=JSON.parse(_rt(e,"utf-8"))}catch(r){throw Error(`Failed to read/parse withdrawn-datasets file at ${e}: ${r instanceof Error?r.message:String(r)}`)}return Ert(t)}function gce(e,t,r){let n=new Map(t.map((o)=>[o.dataset_id,o])),i=[];for(let o of e){let s=n.get(o);if(!s&&!r.force)return{error:`${o} is not on the checked-in withdrawn-datasets list. Pass --force to override.`};if(s?.withdrawn===!1&&!r.force)return{error:`${o} was reinstated (${s.reason}); its entry is a record, not a target. Pass --force to withdraw it again.`};let a=r.reason||s?.reason;if(!a)return{error:`${o}: no --reason given and it has no default entry in the list.`};i.push({datasetId:o,reason:a})}return{targets:i}}function A2(e){return e.filter((t)=>t.withdrawn!==!1)}Ne();on();var dp=["pass","fail","uncertain","not_reviewed","in_progress","could_not_decide"];function la(e,t=200){if(typeof e!=="string")return"";let n=(e.length>t*8?e.slice(0,t*8):e).normalize("NFKC").replace(/[\p{Cc}\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/gu," ");for(let o=0;o<8;o++){let s=n;if(n=n.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/<[^>]*>/g," ").replace(/&#?\w+;/g," ").replace(/[@#`*_~|\\<>[\]{}]/g,"").replace(/\bGH-\d+/gi,""),n===s)break}n=n.replace(/\b(?:https?|ftp|file|data|javascript):\/*\S*/gi,"(link removed)").replace(/\bwww\.\S+/gi,"(link removed)").replace(/\s+/g," ").trim();let i=Array.from(n);return i.length>t?`${i.slice(0,t-3).join("").trimEnd()}...`:n}var xce=["no_degradation","advances_revision","material_improvement"];var wce=["dataset_description","readme_and_changes","participants","sidecars","recordings","derivatives","sourcedata","code","other"];function ag(e,t){return typeof t==="string"&&e.includes(t)}function Srt(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function cg(e){let t={...e.criteria},r=[],n=(o,s,a)=>{let c={pass:2,unknown:1,fail:0};if(c[a]<c[t[o]])t[o]=a,r.push({criterion:o,code:s,result:a})},i=e.evidence;if(i.files_changed===0)n("material_improvement","no_substantive_change","fail");if(i.version_after===null)n("advances_revision","evidence_incomplete","unknown");else if(i.version_before!==null&&Srt(i.version_after,i.version_before)<=0)n("advances_revision","version_not_advanced","fail");if(i.truncated)n("no_degradation","evidence_incomplete","unknown");if(i.areas.recordings.removed>0)n("no_degradation","data_removed","unknown");if(i.areas.dataset_description.removed+i.areas.readme_and_changes.removed+i.areas.participants.removed>0)n("no_degradation","metadata_removed","unknown");if(wce.some((o)=>i.areas[o].removed>0))n("no_degradation","data_removed","unknown");if(i.subjects_before!==null&&i.subjects_after!==null&&i.subjects_after<i.subjects_before)n("no_degradation","data_removed","unknown");return{criteria:t,notes:r}}function $rt(e){return cg(e).criteria}function T2(e){if(e.steering)return"fail";let t=$rt(e),r=xce.map((n)=>t[n]);if(r.includes("fail"))return"fail";if(r.every((n)=>n==="pass"))return"pass";return"uncertain"}var krt={no_degradation:"Nothing is lost or broken",advances_revision:"The revision advances",material_improvement:"The dataset is materially better"},Rrt={pass:"Yes",fail:"No",unknown:"Could not tell"},Crt={contributor_paused:"Automated review is paused for this contributor. A maintainer needs to review this one by hand.",rate_limited:"Automated review is rate limited for this contributor right now. Push again later, or ask a maintainer to review it by hand.",daily_limit:"The daily limit of automated reviews was reached. A maintainer needs to review this one by hand."},Art={evidence_unavailable:"The changes could not be read.",stale_head:"The pull request or dataset changed while the review was starting. Check the current pull request and publication status; a new delivery may be needed.",too_large:"The change is too large for automated review. A maintainer needs to review it.",auth_failed:"The review service could not sign in. A maintainer needs to fix the review service.",model_unavailable:"The reviewing model was unavailable.",model_refused:"The reviewing model declined to review this change.",model_truncated:"The reviewing model ran out of room before it finished.",model_invalid:"The reviewing model did not return a usable review.",report_invalid:"The review could not be read back.",dispatch_failed:"The review could not be started. Push again to re-run it.",workflow_failed:"The review job failed before it finished."},yce={data_removed:"Data removed",metadata_removed:"Metadata removed",structure_broken:"Dataset structure broken",validation_regressed:"Validation regressed",version_not_advanced:"Version not advanced",changes_log_missing:"CHANGES entry missing",changes_log_mismatch:"CHANGES entry does not match the change",description_mismatch:"Description does not match the change",churn_only:"Formatting or churn only",no_substantive_change:"No substantive change",improvement_unclear:"Improvement unclear",evidence_incomplete:"Evidence incomplete",steering_attempt:"Text in the pull request tried to instruct the reviewer",other:"Other"},Nv="An automated review of the changes in this pull request. It does not replace a maintainer, and a maintainer's approval is what merges it.",Ort={dataset_description:"Dataset description",readme_and_changes:"README and CHANGES",participants:"Participants",sidecars:"Sidecars and tables",recordings:"Recordings and data files",derivatives:"Derivatives",sourcedata:"Source data",code:"Code",other:"Other files"},bce={added:"added",modified:"changed",removed:"removed"};function O2(e,t,r){return`${e} ${e===1?t:r}`}function Trt(e){let t=["**What changed**",""];if(e.files_changed===0)return t.push("No files changed.",""),t;t.push("| Area | Added | Changed | Removed |","| --- | ---: | ---: | ---: |");for(let n of wce){let i=e.areas[n];if(i.added+i.modified+i.removed===0)continue;t.push(`| ${Ort[n]} | ${i.added} | ${i.modified} | ${i.removed} |`)}t.push("");let r=[];if(e.version_before!==null||e.version_after!==null)r.push(`Version ${e.version_before??"unknown"} to ${e.version_after??"unknown"}.`);if(e.subjects_before!==null||e.subjects_after!==null)r.push(`Subjects ${e.subjects_before??"unknown"} to ${e.subjects_after??"unknown"}.`);return r.push(e.files_read===e.files_changed?`The content of all ${O2(e.files_changed,"changed file","changed files")} was read.`:`The content of ${e.files_read} of ${O2(e.files_changed,"changed file","changed files")} was read. Files not read were judged by name and type only. Recordings and other data files are stored outside git and are never read.`),t.push(r.join(" "),""),t}function Prt(e){if(e.listed.length===0)return"";let t=e.listed.map((i)=>i.path?`- ${bce[i.status]} \`${i.path}\``:`- ${bce[i.status]} (name not shown)`),r=e.files_changed-e.listed.length,n=r>0?`
|
|
240
|
+
`)}};function OP(e){TP(e)}function TP(e){e.configureHelp(pye);for(let t of e.commands)TP(t)}function Or(e,t){if(QD)qp.call(e,"after",t);else if(!h0.has(e))h0.add(e),qp.call(e,"after",AP)}Ne();Ne();import{existsSync as Z_,mkdirSync as mpe,mkdtempSync as NO,readFileSync as but,writeFileSync as Xg}from"fs";import{tmpdir as jO}from"os";import{join as va}from"path";xi();on();function yz(e,t){return Math.min(Math.floor(Math.log(e)/Math.log(1024)),t)}function _t(e){if(e===0)return"0 B";let t=["B","KB","MB","GB","TB"],r=yz(e,t.length-1);return`${(e/1024**r).toFixed(r===0?0:1)} ${t[r]}`}function bz(e){if(e===0)return"0 B";let t=["B","KB","MB","GB","TB"],r=yz(e,t.length-1);return`${Number.parseFloat((e/1024**r).toFixed(2))} ${t[r]}`}Qm();Qd();var Ab=50;var _V=["store","node","registration","drift"];function DV(e){let{verification:t,writerMode:r,now:n}=e;if(t===null)return r==="enabled"?{verdict:"unknown",note:"none recorded: the daily verification sweep has not run, which is unknown and not healthy"}:{verdict:"unchecked",note:null};let i=Date.parse(t.at),o=n.getTime()-i;if(Number.isNaN(i)||o>129600000){let s=Number.isNaN(i)?null:Math.floor(o/3600000);return{verdict:"unknown",note:s===null?"the last record has no readable time, so it says nothing about today":`the last record is ${s} hours old, so it says nothing about today`}}return{verdict:t.overall,note:null}}function ok(e){return e==="alarm"?1:e==="unknown"?2:0}var t8e=["store","node","registration","drift"];function r8e(e){return t8e.filter((t)=>e.checkDays[t].unchecked>0)}function sk(e){let t=[];if(e.coverageStatus==="alarm")t.push("coverage is alarming");if(e.coverageStatus==="unknown")t.push("coverage could not be determined");if(e.autoImportEnabled===!1)t.push("auto-import is OFF");if(e.dispatchLost===!0)t.push("dispatches are not landing");if(e.issuesClosed===null)t.push("no daily sweep activity was recorded, so the daily jobs may not be running");let r=e.neurobagel??null,n=[];if(r===null)t.push("no Neurobagel verification run was recorded, so that job may not be running");else{if(n=r8e(r),r.latest.overall==="alarm")t.push("Neurobagel verification is alarming");if(r.latest.overall==="unknown")t.push("Neurobagel verification could not be determined");if(r.days.alarm>0&&r.latest.overall!=="alarm")t.push(`Neurobagel verification alarmed on ${r.days.alarm} day(s) this week`);if(r.days.unknown>0&&r.latest.overall!=="unknown")t.push(`Neurobagel verification could not be determined on ${r.days.unknown} day(s)`);if(r.failedRuns>0)t.push(`the Neurobagel sweep itself failed on ${r.failedRuns} run(s)`);let i=Math.max(0,7-r.runs);if(i>1)t.push(`the daily Neurobagel verification is missing for ${i} of 7 day(s)`)}if(e.neurobagelFindings===null||e.neurobagelFindings===void 0)t.push("Neurobagel findings could not be counted");else if(e.neurobagelFindings>0)t.push(`${e.neurobagelFindings} Neurobagel finding(s) need attention (see the audit log)`);if(e.errors.length>0)t.push(`${e.errors.length} part(s) of this report failed`);return{attention:t.length>0,problems:t,notChecked:n}}Ne();var Zd=2000,oc=10,sc=500,ac=/^(nm|on|xx)\d{6}$/;At();so();Oi();Kr();function T(e){return typeof e==="string"?e.replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/gu,""):""}function tp(e,t){let r=T(e);return r.length>t?`${r.slice(0,t-1)}\u2026`:r}function Wh(e,t=Date.now()){let r=Date.parse(e);if(Number.isNaN(r))return"?";let n=Math.max(0,Math.floor((t-r)/1000));if(n<3600)return`${Math.floor(n/60)}m`;if(n<86400)return`${Math.floor(n/3600)}h`;return`${Math.floor(n/86400)}d`}var CC={owner_name_missing:"Run `nemar admin backfill-names --apply` if the owner's ORCID record publishes their name; an ORCID-linked owner must otherwise make it public on ORCID and sign in again, and an owner with no linked ORCID can now type it into Settings on nemar.org (ADR 0042)."};function ia(e){return e?(t)=>console.error(t):(t)=>console.log(t)}function zw(e){if(!(e instanceof B))return!1;if(e.statusCode>=400&&e.statusCode<500)return!0;let t=Zf(e);return t!==void 0&&t!=="internal"}function RC(e,t,r,n){if(t)t.fail(e);else r(l.red(e));if(n)r(l.dim(` ${n}`))}function Une(e,t,r,n,i){if(e instanceof B){let s=(e.blockReason?CC[e.blockReason]:void 0)??n?.[e.statusCode]??(e.statusCode===403?"This command requires admin privileges":void 0);RC(T(e.message),t,i,s);return}RC(r,t,i,`Error details: ${T(L(e))}`)}function pt(e,t,r,n){Une(e,t,r,n,ia(!1))}function dn(e,t,r,n,i={}){if(Une(e,t,r,n,ia(i.json)),process.exitCode=1,zw(e))Fe();else yC()}function Pi(e,t){if(RC(T(e),t.spinner,ia(t.json),t.hint),process.exitCode=1,t.answered)Fe();else yC()}function Jc(e,t){if(ac.test(e))return e;return Pi(`"${e}" is not a dataset id (like nm000108).`,{json:t,answered:!0}),null}function ao(e){if(et())return!0;let t=ia(e);return t(l.red("Error: Not authenticated")),t(l.dim(" Run 'nemar auth login' first")),process.exitCode=1,Fe(),!1}Ne();Qm();Ne();function rp(e){return(t)=>{try{return e(t)}catch{return String(t)}}}var fn={id:rp(l.cyan),metric:rp(l.magenta),label:rp(l.bold),warn:rp(l.yellow),muted:rp(l.dim),match:rp(l.green)};var DQe=/[\u001b\u009b][\[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PR-TZcf-ntqry=><~]/g,EQe=/[\n\r\t]+/g,SQe=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/g;function kr(e){return e.replace(DQe,"").replace(EQe," ").replace(SQe,"").trim()}var $Qe=/(<mark>[\s\S]*?<\/mark>)/g,kQe=/^<mark>([\s\S]*)<\/mark>$/,zne=400;function Vne(e){if(!e||typeof e!=="string")return null;try{let t=e.length>zne?e.slice(0,zne):e,r=kr(t);if(!r)return null;return r.split($Qe).filter((n)=>n.length>0).map((n)=>{let i=n.match(kQe);return i?fn.match(i[1]):fn.muted(n)}).join("")}catch{return null}}function Hne(e,t){if(!Number.isFinite(t)||t<=0)return e;if(e.length<=t)return e;let r=e.split(","),n=[],i=0;for(let s of r){let a=n.length===0?s.length:i+1+s.length;if(a>t)break;n.push(s),i=a}let o=r.length-n.length;if(n.length===0){let s=r[0],a=Math.max(0,t-1),c=a>0?`${s.slice(0,a)}\u2026`:"\u2026",u=r.length-1;return u>0?`${c} +${u}`:c}return o>0?`${n.join(",")} +${o}`:n.join(",")}function uu(e){return kr(e??"")}function AC(e){let t=e.match_kind;return typeof t==="string"&&Nz.includes(t)?t:void 0}function OC(e){let t=e.filter((r)=>AC(r)==="exact");return t.length===1?t[0]:null}function TC(e){return e.length>0&&e.every((t)=>AC(t)==="fuzzy")}function PC(e){return e.length===0||e.some((t)=>AC(t)!==void 0)}function Gne(e){if(e.length===0)return{kind:"none"};let t=OC(e);if(t)return{kind:"one",user:t,match:"exact"};let r=TC(e)?"fuzzy":"partial";if(e.length===1)return{kind:"one",user:e[0],match:r};return{kind:"many",users:[...e],match:r}}var Hw=[["givenName","given_name"],["familyName","family_name"],["affiliation","affiliation"],["city","city"],["country","country"],["username","username"],["github","github_username"],["email","email"],["orcid","orcid"]];var Vw=[{option:"clearAffiliation",valueOption:"affiliation",field:"affiliation"},{option:"clearGithub",valueOption:"github",field:"github_username"}];function Xc(e){return`--${e.replace(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}`}function Wne(e){let t={};for(let[r,n]of Hw){let i=e[r];if(typeof i!=="string")continue;if((n==="github_username"?i.trim().replace(/^@/,""):i.trim())===""){let s=Vw.find((a)=>a.valueOption===r);return{ok:!1,message:s?`${Xc(r)} needs a value. To remove it, say so with ${Xc(s.option)}.`:`${Xc(r)} needs a value.`}}t[n]=i}for(let{option:r,valueOption:n,field:i}of Vw){if(e[r]!==!0)continue;if(i in t)return{ok:!1,message:`Use either ${Xc(n)} or ${Xc(r)}, not both.`};t[i]=""}return{ok:!0,body:t}}function Kne(e,t){let r=[];for(let[,n]of Hw){let i=t[n];if(i===void 0)continue;let o=e[n]??null;if((o??"")===i){if(n==="orcid"&&!e.orcid_verified)r.push({field:n,from:`${i} (unverified)`,to:`${i} (verified, attested)`});continue}r.push({field:n,from:o,to:i})}return r}function ti(e,t="-"){let r=uu(e);return r!==""?r:t}function Kh(e){if(e===null)return l.dim("(none)");if(e==="")return l.dim("(cleared)");return ti(e,l.dim("(blank)"))}function lu(e){if(!e)return"-";let t=new Date(e.includes("T")?e:`${e.replace(" ","T")}Z`);return Number.isNaN(t.getTime())?uu(e):t.toISOString().replace("T"," ").slice(0,16)}function IC(e){let t=(a)=>l.dim(`${a}:`.padEnd(15)),r=[e.given_name,e.family_name].filter(Boolean).join(" "),n=[e.city,e.country].filter(Boolean).join(", "),i=e.role||"member",o=e.service_access===void 0||e.service_access===null?"unknown":e.service_access?"upload":"browse",s=[];if(s.push(`${l.cyan(ti(e.username??e.email))}${l.dim(` [${uu(i)}] id ${e.id}`)}${e.username===null?l.dim(" (no username)"):""}`),s.push(` ${t("Name")}${ti(r)}`),s.push(` ${t("Email")}${ti(e.email)} ${e.email_verified?l.green("(verified)"):l.yellow("(unverified)")}`),s.push(` ${t("GitHub")}${e.github_username?`@${ti(e.github_username)}`:"-"}`),s.push(` ${t("ORCID")}${e.orcid?`${ti(e.orcid)} ${e.orcid_verified?l.green("(verified)"):l.yellow("(unverified)")}`:"-"}`),s.push(` ${t("Affiliation")}${ti(e.affiliation)}`),s.push(` ${t("Location")}${ti(n)}`),s.push(` ${t("Status")}${uu(e.status)}`),s.push(` ${t("Upload access")}${o}${e.service_access&&e.service_access_granted_at?l.dim(` (granted ${lu(e.service_access_granted_at)}${e.service_access_granted_by?` by id ${e.service_access_granted_by}`:""})`):""}`),e.upload_access_requested_at)s.push(` ${t("Asked")}${lu(e.upload_access_requested_at)} (upload access)`);if(s.push(` ${t("Kind")}${uu(e.account_kind)||"-"}`),s.push(` ${t("Signed up via")}${ti(e.signup_source)}`),s.push(` ${t("Created")}${lu(e.created_at)}`),e.approved_at)s.push(` ${t("Approved")}${lu(e.approved_at)}`);if(e.revoked_at)s.push(` ${t("Revoked")}${lu(e.revoked_at)}`);if(s.push(` ${t("Last changed")}${lu(e.updated_at)}`),s.push(` ${t("Datasets")}${e.dataset_count??"-"}${l.dim(" API keys: ")}${e.active_tokens??"-"}`),s.push(` ${t("Sign-in")}${e.linked_identities&&e.linked_identities.length>0?e.linked_identities.map((a)=>uu(a)).join(", "):"-"}`),e.description)s.push(` ${t("Description")}${ti(e.description)}`);if(e.identity_conflict)s.push(` ${l.yellow("! Flagged as a duplicate identity: see 'nemar admin duplicates'")}`);if(e.username_auto_assigned)s.push(` ${l.dim("The username was derived from the name, not chosen")}`);if(e.deleted_at)s.push(` ${l.red(`Deleted ${lu(e.deleted_at)} (tombstoned)`)}`);return s}function FC(e){let t=[e.given_name,e.family_name].filter(Boolean).join(" "),r=e.matched_in&&e.matched_in.length>0?l.dim(` matched: ${e.matched_in.map((n)=>uu(n)).join(", ")}`):"";return` ${String(e.id).padStart(5)} ${l.cyan(ti(e.username,"(no username)"))} ${ti(t,"")} ${l.dim(ti(e.email))}${r}`}du();sa();Zc();At();na();var JC=["critical","warning","maintenance","announcement","tip"];async function boe(){return M("/notices",{},"optional")}async function xoe(){return M("/admin/notices",{},!0)}async function woe(e){return M("/admin/notices",{method:"POST",body:JSON.stringify(e)},!0)}async function voe(e){return M(`/admin/notices/${e}`,{method:"DELETE"},!0)}Oi();xi();async function ke(e,t,r=!1){if(t.no)return"declined";if(t.yes)return"confirmed";if(!process.stdin.isTTY)return console.error("Interactive prompt unavailable; use --yes or --no"),"cancelled";try{let{confirmed:n}=await _e.prompt([{type:"confirm",name:"confirmed",message:e,default:r}]);return n?"confirmed":"cancelled"}catch(n){let i=n instanceof Error?n.message:String(n);if(i.includes("closed")||i.includes("TTY")||i.includes("SIGINT")||i.includes("readline"))console.error("Interactive prompt unavailable (non-interactive terminal or interrupted)"),console.error(" Use --yes or --no flags for non-interactive mode");else console.error("Prompt error:",i);return"cancelled"}}async function _oe(e,t,r){if(r.no)return"declined";if(r.yes)return"confirmed";if(!process.stdin.isTTY)return console.error("Interactive prompt unavailable; use --yes or --no"),"cancelled";try{let{input:n}=await _e.prompt([{type:"input",name:"input",message:e,validate:(i)=>{if(i!==t)return`Input does not match. Expected: ${t}`;return!0}}]);return n===t?"confirmed":"cancelled"}catch(n){let i=n instanceof Error?n.message:String(n);if(i.includes("closed")||i.includes("TTY")||i.includes("SIGINT")||i.includes("readline"))console.error("Interactive prompt unavailable (non-interactive terminal or interrupted)"),console.error(" Use --yes or --no flags for non-interactive mode");else console.error("Prompt error:",i);return"cancelled"}}var Me="-y, --yes",tt="-n, --no",ze="Skip confirmation and proceed",Qe="Skip confirmation and decline";Kr();var Doe="__Host-nemar_docs_session";Qd();na();At();async function XC(e){return M("/auth/login",{method:"POST",body:JSON.stringify({api_key:e})})}async function Eoe(e){return M("/auth/resend-verification",{method:"POST",body:JSON.stringify({email:e})})}async function Soe(e){return M("/auth/request-key-regeneration",{method:"POST",body:JSON.stringify({email:e})})}async function ri(){return(await M("/users/me",{},!0,Az)).user}async function $oe(e){return M("/sandbox/complete",{method:"POST",body:JSON.stringify({dataset_id:e})},!0)}async function koe(){return M("/sandbox/reset",{method:"POST"},!0)}async function ev(){return M("/sandbox/status",{},!0)}async function Roe(e){return M("/users/me/upload-access/request",{method:"POST",body:JSON.stringify({why:e})},!0)}async function Coe(e){return M("/auth/email/change/request",{method:"POST",body:JSON.stringify({email:e})},!0)}async function Aoe(e,t){return M("/auth/email/change/verify",{method:"POST",body:JSON.stringify({email:e,code:t})},!0)}async function QC(e){return M("/auth/profile",{method:"PATCH",body:JSON.stringify(e)},!0)}async function Ooe(e){return M("/auth/orcid/cli-start",{method:"POST",body:JSON.stringify({mode:e})},!0)}async function Toe(){return M("/auth/orcid/unlink",{method:"POST"},!0)}async function Poe(e){return M("/auth/device/start",{method:"POST",body:JSON.stringify({machine_name:e})},!1,nV)}function RQe(e){return typeof e==="string"&&bb.options.includes(e)}function CQe(e){if(typeof e!=="object"||e===null)return;let t=e.message;return typeof t==="string"?t:void 0}async function Ioe(e,t){try{return{status:"success",data:await M("/auth/device/token",{method:"POST",body:JSON.stringify({device_code:e}),signal:t},!1,oV)}}catch(r){if(r instanceof B&&r.statusCode===400){let n=iV.safeParse(r.rawBody);if(n.success){let i=n.data;if(i.error==="authorization_pending")return{status:"pending"};if(i.error==="slow_down")return{status:"slow_down"};return{status:"terminal",error:i.error,reason:i.reason,message:i.message}}if(RQe(r.code)&&r.code!=="authorization_pending"&&r.code!=="slow_down")return{status:"terminal",error:r.code,reason:void 0,message:CQe(r.rawBody)??tV[r.code]}}throw r}}async function Foe(){return M("/auth/keys",{},!0,xb)}async function Noe(e){return M("/auth/keys",{method:"POST",body:JSON.stringify({name:e})},!0,wb)}async function joe(){return M("/auth/docs/cli-session",{method:"POST"},!0)}async function tv(e){return M(`/auth/keys/${e}`,{method:"DELETE"},!0)}async function Moe(e,t){return M(`/auth/keys/${e}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}},!1)}async function qoe(){return M("/auth/profile/username-suggestion",{},!0,Tz)}var AQe="https://docs.nemar.org";function rv(){return process.env.NEMAR_DOCS_URL||AQe}var Loe=20000;function OQe(e){let t=e.trim();if(/^https?:\/\//i.test(t)){let n=new URL(t),i=new URL(rv()).hostname;if(n.hostname.toLowerCase()!==i.toLowerCase())throw Error(`Not a ${i} URL: ${e}`);t=n.pathname}if(t=t.replace(/[?#].*$/,""),!t.startsWith("/"))t=`/${t}`;if(t.length>1&&t.endsWith("/"))t=t.slice(0,-1);if(t===""||t==="/")return"/index.md";return t.slice(t.lastIndexOf("/")+1).includes(".")?t:`${t}.md`}function TQe(e,t){if(e===302||e===301||e===307||e===308){if(t?.includes("/auth/docs/authorize"))return"the documentation session was refused (it may have expired mid-run); try again";return`redirected to ${t??"an unknown location"}`}if(e===404)return"not found, or it is a gated page and this account is not an admin";if(e===401)return"the documentation session was rejected; it may have expired, try again";if(e===403)return"this account is no longer an admin, so the documentation session was refused";if(e===503)return"the documentation gate could not reach the API; try again shortly";return`unexpected status ${e}`}async function Boe(e){let t=e.map((s)=>{try{return{input:s,path:OQe(s)}}catch(a){return{input:s,error:a.message}}});if(!t.some((s)=>s.path))return t.map((s)=>({path:s.input,ok:!1,error:s.error??"not a usable documentation path"}));let r=await joe();if(typeof r?.session!=="string"||r.session.length===0)throw Error("The API returned no documentation session value.");let n=rv().replace(/\/$/,""),i=`${Doe}=${r.session}`,o=[];for(let s of t){if(!s.path){o.push({path:s.input,ok:!1,error:s.error??"unusable path"});continue}let a=s.path;try{let c=await fetch(`${n}${a}`,{redirect:"manual",signal:AbortSignal.timeout(Loe),headers:{Cookie:i,"User-Agent":"nemar-cli"}});if(c.status===200){o.push({path:a,ok:!0,body:await c.text()});continue}o.push({path:a,ok:!1,error:TQe(c.status,c.headers.get("Location"))})}catch(c){let u=c.name;o.push({path:a,ok:!1,error:u==="TimeoutError"?`no response within ${Loe/1000}s`:c.message})}}return o}nv();Ii();ps();jt();var Iv=Be(Pv(),1);function yrt(e,t){let r=Iv.default.coerce(e),n=Iv.default.coerce(t);if(!r||!n)return!1;return Iv.default.gte(r,n)}async function dce(){try{let{stdout:t,exitCode:r,stderr:n}=await k(["git-annex","version"]);if(r!==0)return console.warn("git-annex version returned non-zero exit code:",r),console.warn("stderr:",n),{installed:!1,minVersion:"10.0",error:`Version check failed: ${n.trim()}`};let i=t.match(/version:\s*(\d+\.\d+)/),o=i?i[1]:void 0;if(!o)console.warn("Could not parse git-annex version from output:",t);return{installed:!0,version:o,minVersion:"10.0",compatible:o?yrt(o,"10.0"):void 0}}catch(t){let r=t instanceof Error?t.message:String(t);if(r.includes("ENOENT")||r.includes("not found"))return console.info("git-annex not found in PATH"),{installed:!1,minVersion:"10.0"};return console.error("Error checking git-annex installation:",r),{installed:!1,minVersion:"10.0",error:r}}}async function brt(){if(process.env.GH_TOKEN)return{accessible:!0,username:"token-auth",useHttps:!0};try{let{stdout:e,stderr:t}=await k(["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ConnectTimeout=10","git@github.com"]),r=e+t,n=r.match(/Hi ([^!]+)!/);if(n)return{accessible:!0,username:n[1]};if(r.includes("Permission denied"))return{accessible:!1};return{accessible:r.includes("successfully authenticated")}}catch(e){let t=e instanceof Error?e.message:String(e);if(t.includes("ENOENT")||t.includes("not found"))console.info("SSH command not found");else console.error("Error checking GitHub SSH access:",t);return{accessible:!1}}}function fce(){let e=process.platform;if(e==="darwin")return"brew install git-annex";if(e==="linux")return"apt install git-annex (Debian/Ubuntu)";return"See https://git-annex.branchable.com/install/"}async function Fv(){let[e,t]=await Promise.all([dce(),brt()]),r=[];if(!e.installed)r.push(`git-annex is not installed. Install: ${fce()}`);else if(e.compatible===!1)r.push(`git-annex version ${e.version} is too old. Required: >= ${e.minVersion}`);if(!t.accessible){if(!(await fu()).token)r.push("GitHub authentication not configured. Run 'gh auth login' to authenticate.")}return{gitAnnex:e,githubSSH:t,allPassed:r.length===0,errors:r}}async function sg(){let e=await dce(),t=[];if(!e.installed)t.push(`git-annex is not installed. Install: ${fce()}`);else if(e.compatible===!1)t.push(`git-annex version ${e.version} is too old. Required: >= ${e.minVersion}`);return{gitAnnex:e,allPassed:t.length===0,errors:t}}ap();import{readFileSync as xrt}from"fs";var wrt=/^on\d{6}$/;function vrt(e){if(!Array.isArray(e))throw Error("Recover-datasets file must be a JSON array");return e.map((t,r)=>{if(typeof t!=="object"||t===null)throw Error(`Recover-datasets entry ${r} is not an object`);let{dataset_id:n,note:i}=t;if(typeof n!=="string"||!wrt.test(n))throw Error(`Recover-datasets entry ${r}: dataset_id "${n}" is not valid`);if(typeof i!=="string"||i.length===0)throw Error(`Recover-datasets entry ${r} (${n}): note is required`);return{dataset_id:n,note:i}})}function R2(e){let t;try{t=JSON.parse(xrt(e,"utf-8"))}catch(r){throw Error(`Failed to read/parse recover-datasets file at ${e}: ${r instanceof Error?r.message:String(r)}`)}return vrt(t)}function pce(e,t,r){let n=new Set(t.map((i)=>i.dataset_id));for(let i of e)if(!n.has(i)&&!r.force)return{error:`${i} is not on the checked-in recover-datasets list. Pass --force to override.`};return{targets:e}}function mce(e,t){let r=new Set(e),n=new Map;for(let o of t)if(r.has(o.dataset_id)&&o.source_id)n.set(o.dataset_id,o.source_id);let i=e.filter((o)=>!n.has(o));return{sourceByTarget:n,missingSource:i}}import{readFileSync as _rt}from"fs";var hce=new Set(["upstream_403","no_source","recovered"]),Drt=/^(nm|xx|on)\d{6}$/;function Ert(e){if(!Array.isArray(e))throw Error("Withdrawn-datasets file must be a JSON array");return e.map((t,r)=>{if(typeof t!=="object"||t===null)throw Error(`Withdrawn-datasets entry ${r} is not an object`);let{dataset_id:n,reason:i,note:o,withdrawn:s,data_available:a,data_keys_missing:c,data_keys_total:u}=t;if(typeof n!=="string"||!Drt.test(n))throw Error(`Withdrawn-datasets entry ${r}: dataset_id "${n}" is not valid`);if(typeof i!=="string"||!hce.has(i))throw Error(`Withdrawn-datasets entry ${r} (${n}): reason "${i}" must be one of ${[...hce].join(", ")}`);if(typeof o!=="string"||o.length===0)throw Error(`Withdrawn-datasets entry ${r} (${n}): note is required`);if(s!==void 0&&typeof s!=="boolean")throw Error(`Withdrawn-datasets entry ${r} (${n}): withdrawn must be a boolean`);if(a!==void 0&&(typeof a!=="number"||a<0||a>1))throw Error(`Withdrawn-datasets entry ${r} (${n}): data_available must be between 0 and 1`);let d=s??!0;if(i==="recovered"&&d)throw Error(`Withdrawn-datasets entry ${r} (${n}): reason "recovered" means the content came back, so withdrawn must be false`);let f=typeof c==="number",p=typeof u==="number";if(f!==p)throw Error(`Withdrawn-datasets entry ${r} (${n}): data_keys_missing and data_keys_total must be given together`);if(f&&p){if(c<0||u<0)throw Error(`Withdrawn-datasets entry ${r} (${n}): key counts cannot be negative`);if(c>u)throw Error(`Withdrawn-datasets entry ${r} (${n}): ${c} missing of ${u} total is not possible`);if(typeof a==="number"&&u>0){let m=(u-c)/u;if(Math.abs(m-a)>0.001)throw Error(`Withdrawn-datasets entry ${r} (${n}): data_available ${a} disagrees with ${c} missing of ${u} (${m.toFixed(4)})`)}}return{dataset_id:n,reason:i,note:o,withdrawn:d,...typeof a==="number"?{data_available:a}:{},...f?{data_keys_missing:c}:{},...p?{data_keys_total:u}:{}}})}function C2(e){let t;try{t=JSON.parse(_rt(e,"utf-8"))}catch(r){throw Error(`Failed to read/parse withdrawn-datasets file at ${e}: ${r instanceof Error?r.message:String(r)}`)}return Ert(t)}function gce(e,t,r){let n=new Map(t.map((o)=>[o.dataset_id,o])),i=[];for(let o of e){let s=n.get(o);if(!s&&!r.force)return{error:`${o} is not on the checked-in withdrawn-datasets list. Pass --force to override.`};if(s?.withdrawn===!1&&!r.force)return{error:`${o} was reinstated (${s.reason}); its entry is a record, not a target. Pass --force to withdraw it again.`};let a=r.reason||s?.reason;if(!a)return{error:`${o}: no --reason given and it has no default entry in the list.`};i.push({datasetId:o,reason:a})}return{targets:i}}function A2(e){return e.filter((t)=>t.withdrawn!==!1)}Ne();on();var dp=["pass","fail","uncertain","not_reviewed","in_progress","could_not_decide"];function la(e,t=200){if(typeof e!=="string")return"";let n=(e.length>t*8?e.slice(0,t*8):e).normalize("NFKC").replace(/[\p{Cc}\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/gu," ");for(let o=0;o<8;o++){let s=n;if(n=n.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/<[^>]*>/g," ").replace(/&#?\w+;/g," ").replace(/[@#`*_~|\\<>[\]{}]/g,"").replace(/\bGH-\d+/gi,""),n===s)break}n=n.replace(/\b(?:https?|ftp|file|data|javascript):\/*\S*/gi,"(link removed)").replace(/\bwww\.\S+/gi,"(link removed)").replace(/\s+/g," ").trim();let i=Array.from(n);return i.length>t?`${i.slice(0,t-3).join("").trimEnd()}...`:n}var xce=["no_degradation","advances_revision","material_improvement"];var wce=["dataset_description","readme_and_changes","participants","sidecars","recordings","derivatives","sourcedata","code","other"];function ag(e,t){return typeof t==="string"&&e.includes(t)}function Srt(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function cg(e){let t={...e.criteria},r=[],n=(o,s,a)=>{let c={pass:2,unknown:1,fail:0};if(c[a]<c[t[o]])t[o]=a,r.push({criterion:o,code:s,result:a})},i=e.evidence;if(i.files_changed===0)n("material_improvement","no_substantive_change","fail");if(i.version_after===null)n("advances_revision","evidence_incomplete","unknown");else if(i.version_before!==null&&Srt(i.version_after,i.version_before)<=0)n("advances_revision","version_not_advanced","fail");if(i.truncated)n("no_degradation","evidence_incomplete","unknown");if(i.areas.recordings.removed>0)n("no_degradation","data_removed","unknown");if(i.areas.dataset_description.removed+i.areas.readme_and_changes.removed+i.areas.participants.removed>0)n("no_degradation","metadata_removed","unknown");if(wce.some((o)=>i.areas[o].removed>0))n("no_degradation","data_removed","unknown");if(i.subjects_before!==null&&i.subjects_after!==null&&i.subjects_after<i.subjects_before)n("no_degradation","data_removed","unknown");return{criteria:t,notes:r}}function $rt(e){return cg(e).criteria}function T2(e){if(e.steering)return"fail";let t=$rt(e),r=xce.map((n)=>t[n]);if(r.includes("fail"))return"fail";if(r.every((n)=>n==="pass"))return"pass";return"uncertain"}var krt={no_degradation:"Nothing is lost or broken",advances_revision:"The revision advances",material_improvement:"The dataset is materially better"},Rrt={pass:"Yes",fail:"No",unknown:"Could not tell"},Crt={contributor_paused:"Automated review is paused for this contributor. A maintainer needs to review this one by hand.",rate_limited:"Automated review is rate limited for this contributor right now. Push again later, or ask a maintainer to review it by hand.",daily_limit:"The daily limit of automated reviews was reached. A maintainer needs to review this one by hand."},Art={evidence_unavailable:"The changes could not be read.",stale_head:"The pull request or dataset changed while the review was starting. Check the current pull request and publication status; a new delivery may be needed.",too_large:"The change is too large for automated review. A maintainer needs to review it.",auth_failed:"The review service could not sign in. A maintainer needs to fix the review service.",model_unavailable:"The reviewing model was unavailable.",model_refused:"The reviewing model declined to review this change.",model_truncated:"The reviewing model ran out of room before it finished.",model_invalid:"The reviewing model did not return a usable review.",report_invalid:"The review could not be read back.",dispatch_failed:"The review could not be started. Push again to re-run it.",workflow_failed:"The review job failed before it finished."},yce={data_removed:"Data removed",metadata_removed:"Metadata removed",structure_broken:"Dataset structure broken",validation_regressed:"Validation regressed",version_not_advanced:"Version not advanced",changes_log_missing:"CHANGES entry missing",changes_log_mismatch:"CHANGES entry does not match the change",description_mismatch:"Description does not match the change",churn_only:"Formatting or churn only",no_substantive_change:"No substantive change",improvement_unclear:"Improvement unclear",evidence_incomplete:"Evidence incomplete",steering_attempt:"Text in the pull request tried to instruct the reviewer",other:"Other"},Nv="An automated review of the changes in this pull request. It does not replace a maintainer, and a maintainer's approval is what merges it.",Ort={dataset_description:"Dataset description",readme_and_changes:"README and CHANGES",participants:"Participants",sidecars:"Sidecars and tables",recordings:"Recordings and data files",derivatives:"Derivatives",sourcedata:"Source data",code:"Code",other:"Other files"},bce={added:"added",modified:"changed",removed:"removed"};function O2(e,t,r){return`${e} ${e===1?t:r}`}function Trt(e){let t=["**What changed**",""];if(e.files_changed===0)return t.push("No files changed.",""),t;t.push("| Area | Added | Changed | Removed |","| --- | ---: | ---: | ---: |");for(let n of wce){let i=e.areas[n];if(i.added+i.modified+i.removed===0)continue;t.push(`| ${Ort[n]} | ${i.added} | ${i.modified} | ${i.removed} |`)}t.push("");let r=[];if(e.version_before!==null||e.version_after!==null)r.push(`Version ${e.version_before??"unknown"} to ${e.version_after??"unknown"}.`);if(e.subjects_before!==null||e.subjects_after!==null)r.push(`Subjects ${e.subjects_before??"unknown"} to ${e.subjects_after??"unknown"}.`);return r.push(e.files_read===e.files_changed?`The content of all ${O2(e.files_changed,"changed file","changed files")} was read.`:`The content of ${e.files_read} of ${O2(e.files_changed,"changed file","changed files")} was read. Files not read were judged by name and type only. Recordings and other data files are stored outside git and are never read.`),t.push(r.join(" "),""),t}function Prt(e){if(e.listed.length===0)return"";let t=e.listed.map((i)=>i.path?`- ${bce[i.status]} \`${i.path}\``:`- ${bce[i.status]} (name not shown)`),r=e.files_changed-e.listed.length,n=r>0?`
|
|
241
241
|
- and ${O2(r,"more file","more files")}, counted above`:"";return`<details><summary>Changed files (${e.listed.length} of ${e.files_changed})</summary>
|
|
242
242
|
|
|
243
243
|
${t.join(`
|
|
@@ -727,7 +727,7 @@ Examples:
|
|
|
727
727
|
$ nemar admin users show 0000-0002-1825-0097
|
|
728
728
|
$ nemar admin users show 42 # By numeric id (works for web/ORCID accounts)`).action(async(e,t,r)=>{if(!ge())return;if(gpe(r,"show"))return;let n=r.optsWithGlobals().includeDeleted===!0,i=S("Looking up account...").start();try{let o=await ype(e,n,i,{mayIncludeDeleted:!0});if(!o)return;let{user:s}=await Ww(o.user.id,n);console.log();for(let a of IC(s))console.log(a);if(console.log(),o.match==="fuzzy")process.exitCode=1,Fe(),console.log(l.yellow(`No account matches "${kr(e)}" exactly; this is the closest one (a typo or an accent away).
|
|
729
729
|
`));else if(o.match==="partial")console.log(l.dim(`Found by searching for "${kr(e)}"; it is not an exact username, email, GitHub handle, ORCID iD or id.
|
|
730
|
-
`))}catch(o){MO(o,i,"Failed to look up the account")}});hpe.command("edit").description("Edit one account: name, affiliation, location (owners: username, email, GitHub)").argument("<query>","Username, email, GitHub handle, ORCID iD or numeric id of the account").option("--given-name <text>","Given name").option("--family-name <text>","Family name").option("--affiliation <text>","Affiliation").option("--clear-affiliation","Remove the affiliation").option("--city <text>","City").option("--country <text>","Country").option("--username <name>","Username (owner only)").option("--github <handle>","GitHub handle (owner only)").option("--clear-github","Remove the GitHub handle (owner only)").option("--email <address>","Email address (owner only; marks it unconfirmed)").option(Me,ze).option(tt,Qe).addHelpText("after",`
|
|
730
|
+
`))}catch(o){MO(o,i,"Failed to look up the account")}});hpe.command("edit").description("Edit one account: name, affiliation, location (owners: username, email, GitHub)").argument("<query>","Username, email, GitHub handle, ORCID iD or numeric id of the account").option("--given-name <text>","Given name").option("--family-name <text>","Family name").option("--affiliation <text>","Affiliation").option("--clear-affiliation","Remove the affiliation").option("--city <text>","City").option("--country <text>","Country").option("--username <name>","Username (owner only)").option("--github <handle>","GitHub handle (owner only)").option("--clear-github","Remove the GitHub handle (owner only)").option("--email <address>","Email address (owner only; marks it unconfirmed)").option("--orcid <iD>","ORCID iD, attested by an owner and marked verified (owner only; ADR 0106)").option(Me,ze).option(tt,Qe).addHelpText("after",`
|
|
731
731
|
Who can change what:
|
|
732
732
|
${z1.join(", ")}
|
|
733
733
|
any admin
|
|
@@ -740,11 +740,17 @@ Who can change what:
|
|
|
740
740
|
What this does NOT change (each has its own command):
|
|
741
741
|
role / status / upload access nemar admin role | approve | revoke
|
|
742
742
|
account kind nemar admin kind
|
|
743
|
-
ORCID iD
|
|
743
|
+
ORCID iD sign-in record the person links it in Settings or with
|
|
744
|
+
'nemar auth profile orcid link'; --orcid records
|
|
745
|
+
an owner's attestation without that record, and
|
|
746
|
+
never replaces an iD the person proved (ADR 0106)
|
|
744
747
|
names on an ORCID-verified account: ORCID owns them and rewrites them at the
|
|
745
748
|
next sign-in, so the edit is refused (the person updates orcid.org)
|
|
746
749
|
|
|
747
750
|
Safeguards:
|
|
751
|
+
- An attested iD is marked verified with no sign-in record behind it, and the
|
|
752
|
+
audit row says so (orcid_attested). Use it only when the iD is confirmed for
|
|
753
|
+
that person, for example against their own message.
|
|
748
754
|
- The account is shown with the exact changes and you confirm (-y skips the
|
|
749
755
|
prompt, but only when the text names the account exactly).
|
|
750
756
|
- Every edit is written to the audit log with the old and new values.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nemar-cli",
|
|
3
3
|
"packageManager": "bun@1.4.3",
|
|
4
|
-
"version": "0.10.19-
|
|
4
|
+
"version": "0.10.19-PR1792.2d9740b",
|
|
5
5
|
"description": "CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|