nemar-cli 0.10.27-dev.4109 → 0.10.27-dev.4112
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/git-annex-remote-nemar.js +1 -1
- package/dist/index.js +66 -66
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var ZAe=Object.create;var{getPrototypeOf:e2e,defineProperty:sx,getOwnPropertyNames:t2e}=Object;var
|
|
3
|
+
var ZAe=Object.create;var{getPrototypeOf:e2e,defineProperty:sx,getOwnPropertyNames:t2e}=Object;var x3=Object.prototype.hasOwnProperty;function n2e(e){return this[e]}var r2e,o2e,et=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var o=t?r2e??=new WeakMap:o2e??=new WeakMap,s=o.get(e);if(s)return s}n=e!=null?ZAe(e2e(e)):{};let i=t||!e||!e.__esModule||!x3.call(e,"default")?sx(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of t2e(e))if(!x3.call(i,a))sx(i,a,{get:n2e.bind(e,a),enumerable:!0})}if(r)o.set(e,i);return i};var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var s2e=(e)=>e;function i2e(e,t){this[e]=s2e.bind(null,t)}var a2e=(e,t)=>{for(var n in t)sx(e,n,{get:t[n],enumerable:!0,configurable:!0,set:i2e.bind(t,n)})};var z=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var v3=(e,t,n)=>{for(var r in t)sx(e,r,{get:t[r],set:n[r],enumerable:!0,configurable:!0})},Nt=import.meta.require;function u2e(){let e=new Map;for(let[t,n]of Object.entries(wn)){for(let[r,o]of Object.entries(n))wn[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=wn[r],e.set(o[0],o[1]);Object.defineProperty(wn,t,{value:n,enumerable:!1})}return Object.defineProperty(wn,"codes",{value:e,enumerable:!1}),wn.color.close="\x1B[39m",wn.bgColor.close="\x1B[49m",wn.color.ansi=k3(),wn.color.ansi256=E3(),wn.color.ansi16m=S3(),wn.bgColor.ansi=k3(10),wn.bgColor.ansi256=E3(10),wn.bgColor.ansi16m=S3(10),Object.defineProperties(wn,{rgbToAnsi256:{value(t,n,r){if(t===n&&n===r){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[r]=n;if(r.length===3)r=[...r].map((s)=>s+s).join("");let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:(t)=>wn.rgbToAnsi256(...wn.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,r,o;if(t>=232)n=((t-232)*10+8)/255,r=n,o=n;else{t-=16;let a=t%36;n=Math.floor(t/36)/5,r=Math.floor(a/6)/5,o=a%6/5}let s=Math.max(n,r,o)*2;if(s===0)return 30;let i=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(n));if(s===2)i+=60;return i},enumerable:!1},rgbToAnsi:{value:(t,n,r)=>wn.ansi256ToAnsi(wn.rgbToAnsi256(t,n,r)),enumerable:!1},hexToAnsi:{value:(t)=>wn.ansi256ToAnsi(wn.hexToAnsi256(t)),enumerable:!1}}),wn}var k3=(e=0)=>(t)=>`\x1B[${t+e}m`,E3=(e=0)=>(t)=>`\x1B[${38+e};5;${t}m`,S3=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,wn,EFt,c2e,l2e,SFt,d2e,Di;var $3=z(()=>{wn={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},EFt=Object.keys(wn.modifier),c2e=Object.keys(wn.color),l2e=Object.keys(wn.bgColor),SFt=[...c2e,...l2e];d2e=u2e(),Di=d2e});import CC from"process";import f2e from"os";import D3 from"tty";function Bs(e,t=globalThis.Deno?globalThis.Deno.args:CC.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}function p2e(){if("FORCE_COLOR"in _n){if(_n.FORCE_COLOR==="true")return 1;if(_n.FORCE_COLOR==="false")return 0;return _n.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(_n.FORCE_COLOR,10),3)}}function m2e(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function h2e(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=p2e();if(r!==void 0)ix=r;let o=n?ix:r;if(o===0)return 0;if(n){if(Bs("color=16m")||Bs("color=full")||Bs("color=truecolor"))return 3;if(Bs("color=256"))return 2}if("TF_BUILD"in _n&&"AGENT_NAME"in _n)return 1;if(e&&!t&&o===void 0)return 0;let s=o||0;if(_n.TERM==="dumb")return s;if(CC.platform==="win32"){let i=f2e.release().split(".");if(Number(i[0])>=10&&Number(i[2])>=10586)return Number(i[2])>=14931?3:2;return 1}if("CI"in _n){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((i)=>(i in _n)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((i)=>(i in _n))||_n.CI_NAME==="codeship")return 1;return s}if("TEAMCITY_VERSION"in _n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(_n.TEAMCITY_VERSION)?1:0;if(_n.COLORTERM==="truecolor")return 3;if(_n.TERM==="xterm-kitty")return 3;if(_n.TERM==="xterm-ghostty")return 3;if(_n.TERM==="wezterm")return 3;if("TERM_PROGRAM"in _n){let i=Number.parseInt((_n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(_n.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(_n.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(_n.TERM))return 1;if("COLORTERM"in _n)return 1;return s}function R3(e,t={}){let n=h2e(e,{streamIsTTY:e&&e.isTTY,...t});return m2e(n)}var _n,ix,g2e,C3;var A3=z(()=>{({env:_n}=CC);if(Bs("no-color")||Bs("no-colors")||Bs("color=false")||Bs("color=never"))ix=0;else if(Bs("color")||Bs("colors")||Bs("color=true")||Bs("color=always"))ix=1;g2e={stdout:R3({isTTY:D3.isatty(1)}),stderr:R3({isTTY:D3.isatty(2)})},C3=g2e});function O3(e,t,n){let r=e.indexOf(t);if(r===-1)return e;let o=t.length,s=0,i="";do i+=e.slice(s,r)+t+n,s=r+o,r=e.indexOf(t,s);while(r!==-1);return i+=e.slice(s),i}function T3(e,t,n,r){let o=0,s="";do{let i=e[r-1]==="\r";s+=e.slice(o,i?r-1:r)+t+(i?`\r
|
|
4
4
|
`:`
|
|
5
5
|
`)+n,o=r+1,r=e.indexOf(`
|
|
6
|
-
`,o)}while(r!==-1);return s+=e.slice(o),s}function My(e){return b2e(e)}var
|
|
7
|
-
`);if(s!==-1)t=
|
|
6
|
+
`,o)}while(r!==-1);return s+=e.slice(o),s}function My(e){return b2e(e)}var P3,I3,AC,Xp,Fy,N3,Qp,y2e=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let n=P3?P3.level:0;e.level=t.level===void 0?n:t.level},b2e=(e)=>{let t=(...n)=>n.join(" ");return y2e(t,e),Object.setPrototypeOf(t,My.prototype),t},OC=(e,t,n,...r)=>{if(e==="rgb"){if(t==="ansi16m")return Di[n].ansi16m(...r);if(t==="ansi256")return Di[n].ansi256(Di.rgbToAnsi256(...r));return Di[n].ansi(Di.rgbToAnsi(...r))}if(e==="hex")return OC("rgb",t,n,...Di.hexToRgb(...r));return Di[n][e](...r)},w2e,_2e,TC=(e,t,n)=>{let r,o;if(n===void 0)r=e,o=t;else r=n.openAll+e,o=t+n.closeAll;return{open:e,close:t,openAll:r,closeAll:o,parent:n}},ax=(e,t,n)=>{let r=(...o)=>x2e(r,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(r,_2e),r[AC]=e,r[Xp]=t,r[Fy]=n,r},x2e=(e,t)=>{if(e.level<=0||!t)return e[Fy]?"":t;let n=e[Xp];if(n===void 0)return t;let{openAll:r,closeAll:o}=n;if(t.includes("\x1B"))while(n!==void 0)t=O3(t,n.close,n.open),n=n.parent;let s=t.indexOf(`
|
|
7
|
+
`);if(s!==-1)t=T3(t,o,r,s);return r+t+o},v2e,NFt,u;var He=z(()=>{$3();A3();({stdout:P3,stderr:I3}=C3),AC=Symbol("GENERATOR"),Xp=Symbol("STYLER"),Fy=Symbol("IS_EMPTY"),N3=["ansi","ansi","ansi256","ansi16m"],Qp=Object.create(null);Object.setPrototypeOf(My.prototype,Function.prototype);for(let[e,t]of Object.entries(Di))Qp[e]={get(){let n=ax(this,TC(t.open,t.close,this[Xp]),this[Fy]);return Object.defineProperty(this,e,{value:n}),n}};Qp.visible={get(){let e=ax(this,this[Xp],!0);return Object.defineProperty(this,"visible",{value:e}),e}};w2e=["rgb","hex","ansi256"];for(let e of w2e){Qp[e]={get(){let{level:n}=this;return function(...r){let o=TC(OC(e,N3[n],"color",...r),Di.color.close,this[Xp]);return ax(this,o,this[Fy])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);Qp[t]={get(){let{level:n}=this;return function(...r){let o=TC(OC(e,N3[n],"bgColor",...r),Di.bgColor.close,this[Xp]);return ax(this,o,this[Fy])}}}}_2e=Object.defineProperties(()=>{},{...Qp,level:{enumerable:!0,get(){return this[AC].level},set(e){this[AC].level=e}}});Object.defineProperties(My.prototype,Qp);v2e=My(),NFt=My({level:I3?I3.level:0}),u=v2e});var jy=w(function(k2e){class PC extends Error{constructor(e,t,n){super(n);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}class F3 extends PC{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}k2e.CommanderError=PC;k2e.InvalidArgumentError=F3});var cx=w(function(R2e){var{InvalidArgumentError:$2e}=jy();class M3{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t))return[e];return t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new $2e(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(t,n);return t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function D2e(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}R2e.Argument=M3;R2e.humanReadableArgName=D2e});var IC=w(function(T2e){var{humanReadableArgName:O2e}=cx();class j3{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter((r)=>!r._hidden),n=e._getHelpCommand();if(n&&!n._hidden)t.push(n);if(this.sortSubcommands)t.sort((r,o)=>r.name().localeCompare(o.name()));return t}compareOptions(e,t){let n=(r)=>r.short?r.short.replace(/^-/,""):r.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter((r)=>!r.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);if(!r&&!o)t.push(n);else if(n.long&&!o)t.push(e.createOption(n.long,n.description));else if(n.short&&!r)t.push(e.createOption(n.short,n.description))}if(this.sortOptions)t.sort(this.compareOptions);return t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let r=n.options.filter((o)=>!o.hidden);t.push(...r)}if(this.sortOptions)t.sort(this.compareOptions);return t}visibleArguments(e){if(e._argsDescription)e.registeredArguments.forEach((t)=>{t.description=t.description||e._argsDescription[t.name()]||""});if(e.registeredArguments.find((t)=>t.description))return e.registeredArguments;return[]}subcommandTerm(e){let t=e.registeredArguments.map((n)=>O2e(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,r)=>Math.max(n,t.subcommandTerm(r).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,r)=>Math.max(n,t.optionTerm(r).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,r)=>Math.max(n,t.optionTerm(r).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,r)=>Math.max(n,t.argumentTerm(r).length),0)}commandUsage(e){let t=e._name;if(e._aliases[0])t=t+"|"+e._aliases[0];let n="";for(let r=e.parent;r;r=r.parent)n=r.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices)t.push(`choices: ${e.argChoices.map((n)=>JSON.stringify(n)).join(", ")}`);if(e.defaultValue!==void 0){if(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==="boolean")t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(e.presetArg!==void 0&&e.optional)t.push(`preset: ${JSON.stringify(e.presetArg)}`);if(e.envVar!==void 0)t.push(`env: ${e.envVar}`);if(t.length>0)return`${e.description} (${t.join(", ")})`;return e.description}argumentDescription(e){let t=[];if(e.argChoices)t.push(`choices: ${e.argChoices.map((n)=>JSON.stringify(n)).join(", ")}`);if(e.defaultValue!==void 0)t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`);if(t.length>0){let n=`(${t.join(", ")})`;if(e.description)return`${e.description} ${n}`;return n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth||80,o=2,s=2;function i(m,h){if(h){let g=`${m.padEnd(n+2)}${h}`;return t.wrap(g,r-2,n+2)}return m}function a(m){return m.join(`
|
|
8
8
|
`).replace(/^/gm," ".repeat(2))}let c=[`Usage: ${t.commandUsage(e)}`,""],l=t.commandDescription(e);if(l.length>0)c=c.concat([t.wrap(l,r,0),""]);let d=t.visibleArguments(e).map((m)=>i(t.argumentTerm(m),t.argumentDescription(m)));if(d.length>0)c=c.concat(["Arguments:",a(d),""]);let f=t.visibleOptions(e).map((m)=>i(t.optionTerm(m),t.optionDescription(m)));if(f.length>0)c=c.concat(["Options:",a(f),""]);if(this.showGlobalOptions){let m=t.visibleGlobalOptions(e).map((h)=>i(t.optionTerm(h),t.optionDescription(h)));if(m.length>0)c=c.concat(["Global Options:",a(m),""])}let p=t.visibleCommands(e).map((m)=>i(t.subcommandTerm(m),t.subcommandDescription(m)));if(p.length>0)c=c.concat(["Commands:",a(p),""]);return c.join(`
|
|
9
9
|
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,n,r=40){let s=new RegExp(`[\\n][${" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF"}]+`);if(e.match(s))return e;let i=t-n;if(i<r)return e;let a=e.slice(0,n),c=e.slice(n).replace(`\r
|
|
10
10
|
`,`
|
|
11
11
|
`),l=" ".repeat(n),f=`\\s${"\u200B"}`,p=new RegExp(`
|
|
12
12
|
|.{1,${i-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),m=c.match(p)||[];return a+m.map((h,g)=>{if(h===`
|
|
13
13
|
`)return"";return(g>0?l:"")+h.trimEnd()}).join(`
|
|
14
|
-
`)}}T2e.Help=
|
|
14
|
+
`)}}T2e.Help=j3});var NC=w(function(M2e){var{InvalidArgumentError:I2e}=jy();class L3{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=F2e(e);if(this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;if(typeof e==="string")t={[e]:!0};return this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t))return[e];return t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new I2e(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(t,n);return t},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return N2e(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class q3{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach((t)=>{if(t.negate)this.negativeOptions.set(t.attributeName(),t);else this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{if(this.positiveOptions.has(n))this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,o=r!==void 0?r:!1;return t.negate===(o===e)}}function N2e(e){return e.split("-").reduce((t,n)=>t+n[0].toUpperCase()+n.slice(1))}function F2e(e){let t,n,r=e.split(/[ |,]+/);if(r.length>1&&!/^[[<]/.test(r[1]))t=r.shift();if(n=r.shift(),!t&&/^-[^-]$/.test(n))t=n,n=void 0;return{shortFlag:t,longFlag:n}}M2e.Option=L3;M2e.DualOptions=q3});var B3=w(function(U2e){function q2e(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let r=0;r<=e.length;r++)n[r]=[r];for(let r=0;r<=t.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let o=1;o<=e.length;o++){let s=1;if(e[o-1]===t[r-1])s=0;else s=1;if(n[o][r]=Math.min(n[o-1][r]+1,n[o][r-1]+1,n[o-1][r-1]+s),o>1&&r>1&&e[o-1]===t[r-2]&&e[o-2]===t[r-1])n[o][r]=Math.min(n[o][r],n[o-2][r-2]+1)}return n[e.length][t.length]}function B2e(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let n=e.startsWith("--");if(n)e=e.slice(2),t=t.map((i)=>i.slice(2));let r=[],o=3,s=0.4;if(t.forEach((i)=>{if(i.length<=1)return;let a=q2e(e,i),c=Math.max(e.length,i.length);if((c-a)/c>s){if(a<o)o=a,r=[i];else if(a===o)r.push(i)}}),r.sort((i,a)=>i.localeCompare(a)),n)r=r.map((i)=>`--${i}`);if(r.length>1)return`
|
|
15
15
|
(Did you mean one of ${r.join(", ")}?)`;if(r.length===1)return`
|
|
16
|
-
(Did you mean ${r[0]}?)`;return""}U2e.suggestSimilar=B2e});var
|
|
16
|
+
(Did you mean ${r[0]}?)`;return""}U2e.suggestSimilar=B2e});var z3=w(function(J2e){var V2e=Nt("events").EventEmitter,Zp=Nt("child_process"),Sr=Nt("path"),em=Nt("fs"),Qe=Nt("process"),{Argument:z2e,humanReadableArgName:G2e}=cx(),{CommanderError:FC}=jy(),{Help:W2e}=IC(),{Option:U3,DualOptions:K2e}=NC(),{suggestSimilar:H3}=B3();class MC extends V2e{constructor(e){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:(t)=>Qe.stdout.write(t),writeErr:(t)=>Qe.stderr.write(t),getOutHelpWidth:()=>Qe.stdout.isTTY?Qe.stdout.columns:void 0,getErrHelpWidth:()=>Qe.stderr.isTTY?Qe.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,o=n;if(typeof r==="object"&&r!==null)o=r,r=null;o=o||{};let[,s,i]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(s);if(r)a.description(r),a._executableHandler=!0;if(o.isDefault)this._defaultCommandName=a._name;if(a._hidden=!!(o.noHelp||o.hidden),a._executableFile=o.executableFile||null,i)a.arguments(i);if(this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),r)return this;return a}createCommand(e){return new MC(e)}createHelp(){return Object.assign(new W2e,this.configureHelp())}configureHelp(e){if(e===void 0)return this._helpConfiguration;return this._helpConfiguration=e,this}configureOutput(e){if(e===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,e),this}showHelpAfterError(e=!0){if(typeof e!=="string")e=!!e;return this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
17
17
|
- specify the name in Command constructor or using .name()`);if(t=t||{},t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=!0;return this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new z2e(e,t)}argument(e,t,n,r){let o=this.createArgument(e,t);if(typeof n==="function")o.default(r).argParser(n);else o.default(n);return this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach((t)=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,n,r]=e.match(/([^ ]+) *(.*)/),o=t??"display help for command",s=this.createCommand(n);if(s.helpOption(!1),r)s.arguments(r);if(o)s.description(o);return this._addImplicitHelpCommand=!0,this._helpCommand=s,this}addHelpCommand(e,t){if(typeof e!=="object")return this.helpCommand(e,t),this;return this._addImplicitHelpCommand=!0,this._helpCommand=e,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
18
|
-
Expecting one of '${n.join("', '")}'`);if(this._lifeCycleHooks[e])this._lifeCycleHooks[e].push(t);else this._lifeCycleHooks[e]=[t];return this}exitOverride(e){if(e)this._exitCallback=e;else this._exitCallback=(t)=>{if(t.code!=="commander.executeSubCommandAsync")throw t};return this}_exit(e,t,n){if(this._exitCallback)this._exitCallback(new FC(e,t,n));Qe.exit(e)}action(e){let t=(n)=>{let r=this.registeredArguments.length,o=n.slice(0,r);if(this._storeOptionsAsProperties)o[r]=this;else o[r]=this.opts();return o.push(this),e.apply(this,o)};return this._actionHandler=t,this}createOption(e,t){return new
|
|
19
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=(r)=>[r.name()].concat(r.aliases()),n=t(e).find((r)=>this._findCommand(r));if(n){let r=t(this._findCommand(n)).join("|"),o=t(e).join("|");throw Error(`cannot add command '${o}' as already have command '${r}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");if(!this._findOption(o))this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else if(e.defaultValue!==void 0)this.setOptionValueWithSource(n,e.defaultValue,"default");let r=(o,s,i)=>{if(o==null&&e.presetArg!==void 0)o=e.presetArg;let a=this.getOptionValue(n);if(o!==null&&e.parseArg)o=this._callParseArg(e,o,a,s);else if(o!==null&&e.variadic)o=e._concatValue(o,a);if(o==null)if(e.negate)o=!1;else if(e.isBoolean()||e.optional)o=!0;else o="";this.setOptionValueWithSource(n,o,i)};if(this.on("option:"+t,(o)=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;r(o,s,"cli")}),e.envVar)this.on("optionEnv:"+t,(o)=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;r(o,s,"env")});return this}_optionEx(e,t,n,r,o){if(typeof t==="object"&&t instanceof
|
|
18
|
+
Expecting one of '${n.join("', '")}'`);if(this._lifeCycleHooks[e])this._lifeCycleHooks[e].push(t);else this._lifeCycleHooks[e]=[t];return this}exitOverride(e){if(e)this._exitCallback=e;else this._exitCallback=(t)=>{if(t.code!=="commander.executeSubCommandAsync")throw t};return this}_exit(e,t,n){if(this._exitCallback)this._exitCallback(new FC(e,t,n));Qe.exit(e)}action(e){let t=(n)=>{let r=this.registeredArguments.length,o=n.slice(0,r);if(this._storeOptionsAsProperties)o[r]=this;else o[r]=this.opts();return o.push(this),e.apply(this,o)};return this._actionHandler=t,this}createOption(e,t){return new U3(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${r} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
19
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=(r)=>[r.name()].concat(r.aliases()),n=t(e).find((r)=>this._findCommand(r));if(n){let r=t(this._findCommand(n)).join("|"),o=t(e).join("|");throw Error(`cannot add command '${o}' as already have command '${r}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");if(!this._findOption(o))this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else if(e.defaultValue!==void 0)this.setOptionValueWithSource(n,e.defaultValue,"default");let r=(o,s,i)=>{if(o==null&&e.presetArg!==void 0)o=e.presetArg;let a=this.getOptionValue(n);if(o!==null&&e.parseArg)o=this._callParseArg(e,o,a,s);else if(o!==null&&e.variadic)o=e._concatValue(o,a);if(o==null)if(e.negate)o=!1;else if(e.isBoolean()||e.optional)o=!0;else o="";this.setOptionValueWithSource(n,o,i)};if(this.on("option:"+t,(o)=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;r(o,s,"cli")}),e.envVar)this.on("optionEnv:"+t,(o)=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;r(o,s,"env")});return this}_optionEx(e,t,n,r,o){if(typeof t==="object"&&t instanceof U3)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,n);if(s.makeOptionMandatory(!!e.mandatory),typeof r==="function")s.default(o).argParser(r);else if(r instanceof RegExp){let i=r;r=(a,c)=>{let l=i.exec(a);return l?l[0]:c},s.default(o).argParser(r)}else s.default(r);return this.addOption(s)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){if(this._storeOptionsAsProperties)return this[e];return this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){if(this._storeOptionsAsProperties)this[e]=t;else this._optionValues[e]=t;return this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach((n)=>{if(n.getOptionValueSource(e)!==void 0)t=n.getOptionValueSource(e)}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){if(Qe.versions?.electron)t.from="electron";let r=Qe.execArgv??[];if(r.includes("-e")||r.includes("--eval")||r.includes("-p")||r.includes("--print"))t.from="eval"}if(e===void 0)e=Qe.argv;this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":if(Qe.defaultApp)this._scriptPath=e[1],n=e.slice(2);else n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",n}parse(e,t){let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_executeSubCommand(e,t){t=t.slice();let n=!1,r=[".js",".ts",".tsx",".mjs",".cjs"];function o(l,d){let f=Sr.resolve(l,d);if(em.existsSync(f))return f;if(r.includes(Sr.extname(d)))return;let p=r.find((m)=>em.existsSync(`${f}${m}`));if(p)return`${f}${p}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,i=this._executableDir||"";if(this._scriptPath){let l;try{l=em.realpathSync(this._scriptPath)}catch(d){l=this._scriptPath}i=Sr.resolve(Sr.dirname(l),i)}if(i){let l=o(i,s);if(!l&&!e._executableFile&&this._scriptPath){let d=Sr.basename(this._scriptPath,Sr.extname(this._scriptPath));if(d!==this._name)l=o(i,`${d}-${e._name}`)}s=l||s}n=r.includes(Sr.extname(s));let a;if(Qe.platform!=="win32")if(n)t.unshift(s),t=V3(Qe.execArgv).concat(t),a=Zp.spawn(Qe.argv[0],t,{stdio:"inherit"});else a=Zp.spawn(s,t,{stdio:"inherit"});else t.unshift(s),t=V3(Qe.execArgv).concat(t),a=Zp.spawn(Qe.execPath,t,{stdio:"inherit"});if(!a.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((d)=>{Qe.on(d,()=>{if(a.killed===!1&&a.exitCode===null)a.kill(d)})});let c=this._exitCallback;a.on("close",(l)=>{if(l=l??1,!c)Qe.exit(l);else c(new FC(l,"commander.executeSubCommandAsync","(close)"))}),a.on("error",(l)=>{if(l.code==="ENOENT"){let d=i?`searched for local subcommand relative to directory '${i}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${s}' does not exist
|
|
20
20
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
21
21
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
22
22
|
- ${d}`;throw Error(f)}else if(l.code==="EACCES")throw Error(`'${s}' not executable`);if(!c)Qe.exit(1);else{let d=new FC(1,"commander.executeSubCommandAsync","(error)");d.nestedError=l,c(d)}}),this.runningCommand=a}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);if(!r)this.help({error:!0});let o;return o=this._chainOrCallSubCommandHook(o,r,"preSubcommand"),o=this._chainOrCall(o,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),o}_dispatchHelpCommand(e){if(!e)this.help();let t=this._findCommand(e);if(t&&!t._executableHandler)t.help();return this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((e,t)=>{if(e.required&&this.args[t]==null)this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let e=(n,r,o)=>{let s=r;if(r!==null&&n.parseArg){let i=`error: command-argument value '${r}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,r,o,i)}return s};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let o=n.defaultValue;if(n.variadic){if(r<this.args.length){if(o=this.args.slice(r),n.parseArg)o=o.reduce((s,i)=>e(n,i,s),n.defaultValue)}else if(o===void 0)o=[]}else if(r<this.args.length){if(o=this.args[r],n.parseArg)o=e(n,o,n.defaultValue)}t[r]=o}),this.processedArgs=t}_chainOrCall(e,t){if(e&&e.then&&typeof e.then==="function")return e.then(()=>t());return t()}_chainOrCallHooks(e,t){let n=e,r=[];if(this._getCommandAndAncestors().reverse().filter((o)=>o._lifeCycleHooks[t]!==void 0).forEach((o)=>{o._lifeCycleHooks[t].forEach((s)=>{r.push({hookedCommand:o,callback:s})})}),t==="postAction")r.reverse();return r.forEach((o)=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;if(this._lifeCycleHooks[n]!==void 0)this._lifeCycleHooks[n].forEach((o)=>{r=this._chainOrCall(r,()=>o(this,t))});return r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{if(n.unknown.length>0)this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let s;if(s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent)s=this._chainOrCall(s,()=>{this.parent.emit(o,e,t)});return s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(o))r(),this._processArguments(),this.parent.emit(o,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);if(this.listenerCount("command:*"))this.emit("command:*",e,t);else if(this.commands.length)this.unknownCommand();else r(),this._processArguments()}else if(this.commands.length)r(),this.help({error:!0});else r(),this._processArguments()}_findCommand(e){if(!e)return;return this.commands.find((t)=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find((t)=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((e)=>{e.options.forEach((t)=>{if(t.mandatory&&e.getOptionValue(t.attributeName())===void 0)e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter((n)=>{let r=n.attributeName();if(this.getOptionValue(r)===void 0)return!1;return this.getOptionValueSource(r)!=="default"});e.filter((n)=>n.conflictsWith.length>0).forEach((n)=>{let r=e.find((o)=>n.conflictsWith.includes(o.attributeName()));if(r)this._conflictingOption(n,r)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((e)=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t,o=e.slice();function s(a){return a.length>1&&a[0]==="-"}let i=null;while(o.length){let a=o.shift();if(a==="--"){if(r===n)r.push(a);r.push(...o);break}if(i&&!s(a)){this.emit(`option:${i.name()}`,a);continue}if(i=null,s(a)){let c=this._findOption(a);if(c){if(c.required){let l=o.shift();if(l===void 0)this.optionMissingArgument(c);this.emit(`option:${c.name()}`,l)}else if(c.optional){let l=null;if(o.length>0&&!s(o[0]))l=o.shift();this.emit(`option:${c.name()}`,l)}else this.emit(`option:${c.name()}`);i=c.variadic?c:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let c=this._findOption(`-${a[1]}`);if(c){if(c.required||c.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${c.name()}`,a.slice(2));else this.emit(`option:${c.name()}`),o.unshift(`-${a.slice(2)}`);continue}}if(/^--[^=]+=/.test(a)){let c=a.indexOf("="),l=this._findOption(a.slice(0,c));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,a.slice(c+1));continue}}if(s(a))r=n;if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(a)){if(t.push(a),o.length>0)n.push(...o);break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){if(t.push(a),o.length>0)t.push(...o);break}else if(this._defaultCommandName){if(n.push(a),o.length>0)n.push(...o);break}}if(this._passThroughOptions){if(r.push(a),o.length>0)r.push(...o);break}r.push(a)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let r=this.options[n].attributeName();e[r]=r===this._versionOptionName?this._version:this[r]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){if(this._outputConfiguration.outputError(`${e}
|
|
23
23
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
24
24
|
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
25
|
-
`),this.outputHelp({error:!0});let n=t||{},r=n.exitCode||1,o=n.code||"commander.error";this._exit(r,o,e)}_parseOptionsEnv(){this.options.forEach((e)=>{if(e.envVar&&e.envVar in Qe.env){let t=e.attributeName();if(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))if(e.required||e.optional)this.emit(`optionEnv:${e.name()}`,Qe.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new K2e(this.options),t=(n)=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter((n)=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach((n)=>{Object.keys(n.implied).filter((r)=>!t(r)).forEach((r)=>{this.setOptionValueWithSource(r,n.implied[r],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=(s)=>{let i=s.attributeName(),a=this.getOptionValue(i),c=this.options.find((d)=>d.negate&&i===d.attributeName()),l=this.options.find((d)=>!d.negate&&i===d.attributeName());if(c&&(c.presetArg===void 0&&a===!1||c.presetArg!==void 0&&a===c.presetArg))return c;return l||s},r=(s)=>{let i=n(s),a=i.attributeName();if(this.getOptionValueSource(a)==="env")return`environment variable '${i.envVar}'`;return`option '${i.flags}'`},o=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter((i)=>i.long).map((i)=>i.long);r=r.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);t=
|
|
25
|
+
`),this.outputHelp({error:!0});let n=t||{},r=n.exitCode||1,o=n.code||"commander.error";this._exit(r,o,e)}_parseOptionsEnv(){this.options.forEach((e)=>{if(e.envVar&&e.envVar in Qe.env){let t=e.attributeName();if(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))if(e.required||e.optional)this.emit(`optionEnv:${e.name()}`,Qe.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new K2e(this.options),t=(n)=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter((n)=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach((n)=>{Object.keys(n.implied).filter((r)=>!t(r)).forEach((r)=>{this.setOptionValueWithSource(r,n.implied[r],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=(s)=>{let i=s.attributeName(),a=this.getOptionValue(i),c=this.options.find((d)=>d.negate&&i===d.attributeName()),l=this.options.find((d)=>!d.negate&&i===d.attributeName());if(c&&(c.presetArg===void 0&&a===!1||c.presetArg!==void 0&&a===c.presetArg))return c;return l||s},r=(s)=>{let i=n(s),a=i.attributeName();if(this.getOptionValueSource(a)==="env")return`environment variable '${i.envVar}'`;return`option '${i.flags}'`},o=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter((i)=>i.long).map((i)=>i.long);r=r.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);t=H3(e,r)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let r=[];this.createHelp().visibleCommands(this).forEach((o)=>{if(r.push(o.name()),o.alias())r.push(o.alias())}),t=H3(e,r)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
26
26
|
`),this._exit(0,"commander.version",e)}),this}description(e,t){if(e===void 0&&t===void 0)return this._description;if(this._description=e,t)this._argsDescription=t;return this}summary(e){if(e===void 0)return this._summary;return this._summary=e,this}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)t=this.commands[this.commands.length-1];if(e===t._name)throw Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let r=[n.name()].concat(n.aliases()).join("|");throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${r}'`)}return t._aliases.push(e),this}aliases(e){if(e===void 0)return this._aliases;return e.forEach((t)=>this.alias(t)),this}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map((n)=>G2e(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){if(e===void 0)return this._name;return this._name=e,this}nameFromFilename(e){return this._name=Sr.basename(e,Sr.extname(e)),this}executableDir(e){if(e===void 0)return this._executableDir;return this._executableDir=e,this}helpInformation(e){let t=this.createHelp();if(t.helpWidth===void 0)t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},n;if(t.error)n=(r)=>this._outputConfiguration.writeErr(r);else n=(r)=>this._outputConfiguration.writeOut(r);return t.write=e.write||n,t.command=this,t}outputHelp(e){let t;if(typeof e==="function")t=e,e=void 0;let n=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach((o)=>o.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let r=this.helpInformation(n);if(t){if(r=t(r),typeof r!=="string"&&!Buffer.isBuffer(r))throw Error("outputHelp callback must return a string or a Buffer")}if(n.write(r),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",n),this._getCommandAndAncestors().forEach((o)=>o.emit("afterAllHelp",n))}helpOption(e,t){if(typeof e==="boolean"){if(e)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=Qe.exitCode||0;if(t===0&&e&&typeof e!=="function"&&e.error)t=1;this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
27
27
|
Expecting one of '${n.join("', '")}'`);let r=`${e}Help`;return this.on(r,(o)=>{let s;if(typeof t==="function")s=t({error:o.error,command:o.command});else s=t;if(s)o.write(`${s}
|
|
28
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((r)=>t.is(r)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Vq(e){return e.map((t)=>{if(!t.startsWith("--inspect"))return t;let n,r="127.0.0.1",o="9229",s;if((s=t.match(/^(--inspect(-brk)?)$/))!==null)n=s[1];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(n=s[1],/^\d+$/.test(s[3]))o=s[3];else r=s[3];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)n=s[1],r=s[3],o=s[4];if(n&&o!=="0")return`${n}=${r}:${parseInt(o)+1}`;return t})}J2e.Command=MC});var _s={};vq(_s,{default:()=>f4},{default:(s6t)=>f4=s6t});var St,f4,Jt="\x1B[",qy="\x1B]",nm="\x07",ux=";",u4;var By=z(()=>{St=_s;f4=St;u4=process.env.TERM_PROGRAM==="Apple_Terminal";St.cursorTo=(e,t)=>{if(typeof e!=="number")throw TypeError("The `x` argument is required");if(typeof t!=="number")return Jt+(e+1)+"G";return Jt+(t+1)+";"+(e+1)+"H"};St.cursorMove=(e,t)=>{if(typeof e!=="number")throw TypeError("The `x` argument is required");let n="";if(e<0)n+=Jt+-e+"D";else if(e>0)n+=Jt+e+"C";if(t<0)n+=Jt+-t+"A";else if(t>0)n+=Jt+t+"B";return n};St.cursorUp=(e=1)=>Jt+e+"A";St.cursorDown=(e=1)=>Jt+e+"B";St.cursorForward=(e=1)=>Jt+e+"C";St.cursorBackward=(e=1)=>Jt+e+"D";St.cursorLeft=Jt+"G";St.cursorSavePosition=u4?"\x1B7":Jt+"s";St.cursorRestorePosition=u4?"\x1B8":Jt+"u";St.cursorGetPosition=Jt+"6n";St.cursorNextLine=Jt+"E";St.cursorPrevLine=Jt+"F";St.cursorHide=Jt+"?25l";St.cursorShow=Jt+"?25h";St.eraseLines=(e)=>{let t="";for(let n=0;n<e;n++)t+=St.eraseLine+(n<e-1?St.cursorUp():"");if(e)t+=St.cursorLeft;return t};St.eraseEndLine=Jt+"K";St.eraseStartLine=Jt+"1K";St.eraseLine=Jt+"2K";St.eraseDown=Jt+"J";St.eraseUp=Jt+"1J";St.eraseScreen=Jt+"2J";St.scrollUp=Jt+"S";St.scrollDown=Jt+"T";St.clearScreen="\x1Bc";St.clearTerminal=process.platform==="win32"?`${St.eraseScreen}${Jt}0f`:`${St.eraseScreen}${Jt}3J${Jt}H`;St.beep=nm;St.link=(e,t)=>[qy,"8",ux,ux,t,nm,e,qy,"8",ux,ux,nm].join("");St.image=(e,t={})=>{let n=`${qy}1337;File=inline=1`;if(t.width)n+=`;width=${t.width}`;if(t.height)n+=`;height=${t.height}`;if(t.preserveAspectRatio===!1)n+=";preserveAspectRatio=0";return n+":"+e.toString("base64")+nm};St.iTerm={setCwd:(e=process.cwd())=>`${qy}50;CurrentDir=${e}${nm}`,annotation:(e,t={})=>{let n=`${qy}1337;`,r=typeof t.x<"u",o=typeof t.y<"u";if((r||o)&&!(r&&o&&typeof t.length<"u"))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(e=e.replace(/\|/g,""),n+=t.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",t.length>0)n+=(r?[e,t.length,t.x,t.y]:[t.length,e]).join("|");else n+=e;return n+nm}}});var Hs=w(function(i6t,p4){var tOe=Nt("tty"),nOe=tOe?.WriteStream?.prototype?.hasColors?.()??!1,ht=(e,t)=>{if(!nOe)return(o)=>o;let n=`\x1B[${e}m`,r=`\x1B[${t}m`;return(o)=>{let s=o+"",i=s.indexOf(r);if(i===-1)return n+s+r;let a=n,c=0,d=(t===22?r:"")+n;while(i!==-1)a+=s.slice(c,i)+d,c=i+r.length,i=s.indexOf(r,c);return a+=s.slice(c)+r,a}},it={};it.reset=ht(0,0);it.bold=ht(1,22);it.dim=ht(2,22);it.italic=ht(3,23);it.underline=ht(4,24);it.overline=ht(53,55);it.inverse=ht(7,27);it.hidden=ht(8,28);it.strikethrough=ht(9,29);it.black=ht(30,39);it.red=ht(31,39);it.green=ht(32,39);it.yellow=ht(33,39);it.blue=ht(34,39);it.magenta=ht(35,39);it.cyan=ht(36,39);it.white=ht(37,39);it.gray=ht(90,39);it.bgBlack=ht(40,49);it.bgRed=ht(41,49);it.bgGreen=ht(42,49);it.bgYellow=ht(43,49);it.bgBlue=ht(44,49);it.bgMagenta=ht(45,49);it.bgCyan=ht(46,49);it.bgWhite=ht(47,49);it.bgGray=ht(100,49);it.redBright=ht(91,39);it.greenBright=ht(92,39);it.yellowBright=ht(93,39);it.blueBright=ht(94,39);it.magentaBright=ht(95,39);it.cyanBright=ht(96,39);it.whiteBright=ht(97,39);it.bgRedBright=ht(101,49);it.bgGreenBright=ht(102,49);it.bgYellowBright=ht(103,49);it.bgBlueBright=ht(104,49);it.bgMagentaBright=ht(105,49);it.bgCyanBright=ht(106,49);it.bgWhiteBright=ht(107,49);p4.exports=it});import ca from"process";function rOe(){if(ca.platform!=="win32")return ca.env.TERM!=="linux";return Boolean(ca.env.WT_SESSION)||Boolean(ca.env.TERMINUS_SUBLIME)||ca.env.ConEmuTask==="{cmd::Cmder}"||ca.env.TERM_PROGRAM==="Terminus-Sublime"||ca.env.TERM_PROGRAM==="vscode"||ca.env.TERM==="xterm-256color"||ca.env.TERM==="alacritty"||ca.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var m4,h4,oOe,sOe,iOe,aOe,cOe,Wl,c6t;var dx=z(()=>{m4={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},h4={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},oOe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},sOe={...m4,...h4},iOe={...m4,...oOe},aOe=rOe(),cOe=aOe?sOe:iOe,Wl=cOe,c6t=Object.entries(h4)});var Uy=w(function(u6t,b4){function g4(e){return!!e&&(typeof e==="object"||typeof e==="function")&&typeof e.then==="function"}var y4=b4.exports=function(e,t,n="async"){if(typeof t==="string")n=t,t=void 0;return t=t||function(){},function(){var r=arguments,o=this,s=new Promise(function(i,a){var c=!1;let l=function(_){if(c)console.warn("Run-async promise already resolved.");c=!0,i(_)};var d=!1;let f=function(_){if(d)console.warn("Run-async promise already rejected.");d=!0,a(_)};var p=!1,m=!1,h=!1,g=function(){if(h)return console.warn("Run-async async() called outside a valid run-async context, callback will be ignored."),function(){};if(m)console.warn(`Run-async wrapped function (async) returned a promise.
|
|
28
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((r)=>t.is(r)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function V3(e){return e.map((t)=>{if(!t.startsWith("--inspect"))return t;let n,r="127.0.0.1",o="9229",s;if((s=t.match(/^(--inspect(-brk)?)$/))!==null)n=s[1];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(n=s[1],/^\d+$/.test(s[3]))o=s[3];else r=s[3];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)n=s[1],r=s[3],o=s[4];if(n&&o!=="0")return`${n}=${r}:${parseInt(o)+1}`;return t})}J2e.Command=MC});var _s={};v3(_s,{default:()=>f4},{default:(s6t)=>f4=s6t});var St,f4,Jt="\x1B[",qy="\x1B]",nm="\x07",ux=";",u4;var By=z(()=>{St=_s;f4=St;u4=process.env.TERM_PROGRAM==="Apple_Terminal";St.cursorTo=(e,t)=>{if(typeof e!=="number")throw TypeError("The `x` argument is required");if(typeof t!=="number")return Jt+(e+1)+"G";return Jt+(t+1)+";"+(e+1)+"H"};St.cursorMove=(e,t)=>{if(typeof e!=="number")throw TypeError("The `x` argument is required");let n="";if(e<0)n+=Jt+-e+"D";else if(e>0)n+=Jt+e+"C";if(t<0)n+=Jt+-t+"A";else if(t>0)n+=Jt+t+"B";return n};St.cursorUp=(e=1)=>Jt+e+"A";St.cursorDown=(e=1)=>Jt+e+"B";St.cursorForward=(e=1)=>Jt+e+"C";St.cursorBackward=(e=1)=>Jt+e+"D";St.cursorLeft=Jt+"G";St.cursorSavePosition=u4?"\x1B7":Jt+"s";St.cursorRestorePosition=u4?"\x1B8":Jt+"u";St.cursorGetPosition=Jt+"6n";St.cursorNextLine=Jt+"E";St.cursorPrevLine=Jt+"F";St.cursorHide=Jt+"?25l";St.cursorShow=Jt+"?25h";St.eraseLines=(e)=>{let t="";for(let n=0;n<e;n++)t+=St.eraseLine+(n<e-1?St.cursorUp():"");if(e)t+=St.cursorLeft;return t};St.eraseEndLine=Jt+"K";St.eraseStartLine=Jt+"1K";St.eraseLine=Jt+"2K";St.eraseDown=Jt+"J";St.eraseUp=Jt+"1J";St.eraseScreen=Jt+"2J";St.scrollUp=Jt+"S";St.scrollDown=Jt+"T";St.clearScreen="\x1Bc";St.clearTerminal=process.platform==="win32"?`${St.eraseScreen}${Jt}0f`:`${St.eraseScreen}${Jt}3J${Jt}H`;St.beep=nm;St.link=(e,t)=>[qy,"8",ux,ux,t,nm,e,qy,"8",ux,ux,nm].join("");St.image=(e,t={})=>{let n=`${qy}1337;File=inline=1`;if(t.width)n+=`;width=${t.width}`;if(t.height)n+=`;height=${t.height}`;if(t.preserveAspectRatio===!1)n+=";preserveAspectRatio=0";return n+":"+e.toString("base64")+nm};St.iTerm={setCwd:(e=process.cwd())=>`${qy}50;CurrentDir=${e}${nm}`,annotation:(e,t={})=>{let n=`${qy}1337;`,r=typeof t.x<"u",o=typeof t.y<"u";if((r||o)&&!(r&&o&&typeof t.length<"u"))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");if(e=e.replace(/\|/g,""),n+=t.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",t.length>0)n+=(r?[e,t.length,t.x,t.y]:[t.length,e]).join("|");else n+=e;return n+nm}}});var Hs=w(function(i6t,p4){var tOe=Nt("tty"),nOe=tOe?.WriteStream?.prototype?.hasColors?.()??!1,ht=(e,t)=>{if(!nOe)return(o)=>o;let n=`\x1B[${e}m`,r=`\x1B[${t}m`;return(o)=>{let s=o+"",i=s.indexOf(r);if(i===-1)return n+s+r;let a=n,c=0,d=(t===22?r:"")+n;while(i!==-1)a+=s.slice(c,i)+d,c=i+r.length,i=s.indexOf(r,c);return a+=s.slice(c)+r,a}},it={};it.reset=ht(0,0);it.bold=ht(1,22);it.dim=ht(2,22);it.italic=ht(3,23);it.underline=ht(4,24);it.overline=ht(53,55);it.inverse=ht(7,27);it.hidden=ht(8,28);it.strikethrough=ht(9,29);it.black=ht(30,39);it.red=ht(31,39);it.green=ht(32,39);it.yellow=ht(33,39);it.blue=ht(34,39);it.magenta=ht(35,39);it.cyan=ht(36,39);it.white=ht(37,39);it.gray=ht(90,39);it.bgBlack=ht(40,49);it.bgRed=ht(41,49);it.bgGreen=ht(42,49);it.bgYellow=ht(43,49);it.bgBlue=ht(44,49);it.bgMagenta=ht(45,49);it.bgCyan=ht(46,49);it.bgWhite=ht(47,49);it.bgGray=ht(100,49);it.redBright=ht(91,39);it.greenBright=ht(92,39);it.yellowBright=ht(93,39);it.blueBright=ht(94,39);it.magentaBright=ht(95,39);it.cyanBright=ht(96,39);it.whiteBright=ht(97,39);it.bgRedBright=ht(101,49);it.bgGreenBright=ht(102,49);it.bgYellowBright=ht(103,49);it.bgBlueBright=ht(104,49);it.bgMagentaBright=ht(105,49);it.bgCyanBright=ht(106,49);it.bgWhiteBright=ht(107,49);p4.exports=it});import ca from"process";function rOe(){if(ca.platform!=="win32")return ca.env.TERM!=="linux";return Boolean(ca.env.WT_SESSION)||Boolean(ca.env.TERMINUS_SUBLIME)||ca.env.ConEmuTask==="{cmd::Cmder}"||ca.env.TERM_PROGRAM==="Terminus-Sublime"||ca.env.TERM_PROGRAM==="vscode"||ca.env.TERM==="xterm-256color"||ca.env.TERM==="alacritty"||ca.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var m4,h4,oOe,sOe,iOe,aOe,cOe,Wl,c6t;var dx=z(()=>{m4={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},h4={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},oOe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},sOe={...m4,...h4},iOe={...m4,...oOe},aOe=rOe(),cOe=aOe?sOe:iOe,Wl=cOe,c6t=Object.entries(h4)});var Uy=w(function(u6t,b4){function g4(e){return!!e&&(typeof e==="object"||typeof e==="function")&&typeof e.then==="function"}var y4=b4.exports=function(e,t,n="async"){if(typeof t==="string")n=t,t=void 0;return t=t||function(){},function(){var r=arguments,o=this,s=new Promise(function(i,a){var c=!1;let l=function(_){if(c)console.warn("Run-async promise already resolved.");c=!0,i(_)};var d=!1;let f=function(_){if(d)console.warn("Run-async promise already rejected.");d=!0,a(_)};var p=!1,m=!1,h=!1,g=function(){if(h)return console.warn("Run-async async() called outside a valid run-async context, callback will be ignored."),function(){};if(m)console.warn(`Run-async wrapped function (async) returned a promise.
|
|
29
29
|
Calls to async() callback can have unexpected results.`);return p=!0,function(_,x){if(_)f(_);else l(x)}},y;if(o&&n&&Proxy)y=new Proxy(o,{get(_,x){if(x===n){if(x in _)console.warn(`${n} property is been shadowed by run-sync`);return g}return Reflect.get(...arguments)}});else y={[n]:g};var b=e.apply(y,Array.prototype.slice.call(r));if(p){if(g4(b))console.warn("Run-async wrapped function (sync) returned a promise but async() callback must be executed to resolve.")}else if(g4(b))m=!0,b.then(l,f);else l(b);h=!0});return s.then(t.bind(null,null),t),s}};y4.cb=function(e,t){return y4(function(){var n=Array.prototype.slice.call(arguments);if(n.length===e.length-1)n.push(this.async());return e.apply(this,n)},t)}});var Yt=w(function(w4){Object.defineProperty(w4,"__esModule",{value:!0});w4.isFunction=void 0;function lOe(e){return typeof e==="function"}w4.isFunction=lOe});var Kl=w(function(x4){Object.defineProperty(x4,"__esModule",{value:!0});x4.createErrorClass=void 0;function uOe(e){var t=function(r){Error.call(r),r.stack=Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}x4.createErrorClass=uOe});var UC=w(function(k4){Object.defineProperty(k4,"__esModule",{value:!0});k4.UnsubscriptionError=void 0;var dOe=Kl();k4.UnsubscriptionError=dOe.createErrorClass(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
30
30
|
`+n.map(function(r,o){return o+1+") "+r.toString()}).join(`
|
|
31
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}})});var Mc=w(function(S4){Object.defineProperty(S4,"__esModule",{value:!0});S4.arrRemove=void 0;function fOe(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}S4.arrRemove=fOe});var xs=w(function(Ko){var D4=Ko&&Ko.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},R4=Ko&&Ko.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},C4=Ko&&Ko.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.isSubscription=Ko.EMPTY_SUBSCRIPTION=Ko.Subscription=void 0;var Hy=Yt(),HC=UC(),A4=Mc(),VC=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,s;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=D4(i),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(g){t={error:g}}finally{try{if(c&&!c.done&&(n=a.return))n.call(a)}finally{if(t)throw t.error}}else i.remove(this);var d=this.initialTeardown;if(Hy.isFunction(d))try{d()}catch(g){s=g instanceof HC.UnsubscriptionError?g.errors:[g]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=D4(f),m=p.next();!m.done;m=p.next()){var h=m.value;try{O4(h)}catch(g){if(s=s!==null&&s!==void 0?s:[],g instanceof HC.UnsubscriptionError)s=C4(C4([],R4(s)),R4(g.errors));else s.push(g)}}}catch(g){r={error:g}}finally{try{if(m&&!m.done&&(o=p.return))o.call(p)}finally{if(r)throw r.error}}}if(s)throw new HC.UnsubscriptionError(s)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)O4(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;if(n===t)this._parentage=null;else if(Array.isArray(n))A4.arrRemove(n,t)},e.prototype.remove=function(t){var n=this._finalizers;if(n&&A4.arrRemove(n,t),t instanceof e)t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();Ko.Subscription=VC;Ko.EMPTY_SUBSCRIPTION=VC.EMPTY;function pOe(e){return e instanceof VC||e&&"closed"in e&&Hy.isFunction(e.remove)&&Hy.isFunction(e.add)&&Hy.isFunction(e.unsubscribe)}Ko.isSubscription=pOe;function O4(e){if(Hy.isFunction(e))e();else e.unsubscribe()}});var rm=w(function(T4){Object.defineProperty(T4,"__esModule",{value:!0});T4.config=void 0;T4.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}});var zC=w(function(la){var I4=la&&la.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},N4=la&&la.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(la,"__esModule",{value:!0});la.timeoutProvider=void 0;la.timeoutProvider={setTimeout:function(e,t){var n=[];for(var r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=la.timeoutProvider.delegate;if(o===null||o===void 0?void 0:o.setTimeout)return o.setTimeout.apply(o,N4([e,t],I4(n)));return setTimeout.apply(void 0,N4([e,t],I4(n)))},clearTimeout:function(e){var t=la.timeoutProvider.delegate;return((t===null||t===void 0?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0}});var GC=w(function(F4){Object.defineProperty(F4,"__esModule",{value:!0});F4.reportUnhandledError=void 0;var mOe=rm(),hOe=zC();function gOe(e){hOe.timeoutProvider.setTimeout(function(){var t=mOe.config.onUnhandledError;if(t)t(e);else throw e})}F4.reportUnhandledError=gOe});var Vr=w(function(j4){Object.defineProperty(j4,"__esModule",{value:!0});j4.noop=void 0;function yOe(){}j4.noop=yOe});var U4=w(function(q4){Object.defineProperty(q4,"__esModule",{value:!0});q4.createNotification=q4.nextNotification=q4.errorNotification=q4.COMPLETE_NOTIFICATION=void 0;q4.COMPLETE_NOTIFICATION=function(){return fx("C",void 0,void 0)}();function bOe(e){return fx("E",void 0,e)}q4.errorNotification=bOe;function wOe(e){return fx("N",e,void 0)}q4.nextNotification=wOe;function fx(e,t,n){return{kind:e,value:t,error:n}}q4.createNotification=fx});var px=w(function(V4){Object.defineProperty(V4,"__esModule",{value:!0});V4.captureError=V4.errorContext=void 0;var H4=rm(),af=null;function kOe(e){if(H4.config.useDeprecatedSynchronousErrorHandling){var t=!af;if(t)af={errorThrown:!1,error:null};if(e(),t){var n=af,{errorThrown:r,error:o}=n;if(af=null,r)throw o}}else e()}V4.errorContext=kOe;function EOe(e){if(H4.config.useDeprecatedSynchronousErrorHandling&&af)af.errorThrown=!0,af.error=e}V4.captureError=EOe});var om=w(function(Ri){var K4=Ri&&Ri.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Ri,"__esModule",{value:!0});Ri.EMPTY_OBSERVER=Ri.SafeSubscriber=Ri.Subscriber=void 0;var $Oe=Yt(),G4=xs(),YC=rm(),DOe=GC(),W4=Vr(),WC=U4(),ROe=zC(),COe=px(),J4=function(e){K4(t,e);function t(n){var r=e.call(this)||this;if(r.isStopped=!1,n){if(r.destination=n,G4.isSubscription(n))n.add(r)}else r.destination=Ri.EMPTY_OBSERVER;return r}return t.create=function(n,r,o){return new Y4(n,r,o)},t.prototype.next=function(n){if(this.isStopped)JC(WC.nextNotification(n),this);else this._next(n)},t.prototype.error=function(n){if(this.isStopped)JC(WC.errorNotification(n),this);else this.isStopped=!0,this._error(n)},t.prototype.complete=function(){if(this.isStopped)JC(WC.COMPLETE_NOTIFICATION,this);else this.isStopped=!0,this._complete()},t.prototype.unsubscribe=function(){if(!this.closed)this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(G4.Subscription);Ri.Subscriber=J4;var AOe=Function.prototype.bind;function KC(e,t){return AOe.call(e,t)}var OOe=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){mx(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){mx(r)}else mx(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){mx(n)}},e}(),Y4=function(e){K4(t,e);function t(n,r,o){var s=e.call(this)||this,i;if($Oe.isFunction(n)||!n)i={next:n!==null&&n!==void 0?n:void 0,error:r!==null&&r!==void 0?r:void 0,complete:o!==null&&o!==void 0?o:void 0};else{var a;if(s&&YC.config.useDeprecatedNextContext)a=Object.create(n),a.unsubscribe=function(){return s.unsubscribe()},i={next:n.next&&KC(n.next,a),error:n.error&&KC(n.error,a),complete:n.complete&&KC(n.complete,a)};else i=n}return s.destination=new OOe(i),s}return t}(J4);Ri.SafeSubscriber=Y4;function mx(e){if(YC.config.useDeprecatedSynchronousErrorHandling)COe.captureError(e);else DOe.reportUnhandledError(e)}function TOe(e){throw e}function JC(e,t){var n=YC.config.onStoppedNotification;n&&ROe.timeoutProvider.setTimeout(function(){return n(e,t)})}Ri.EMPTY_OBSERVER={closed:!0,next:W4.noop,error:TOe,complete:W4.noop}});var Vy=w(function(X4){Object.defineProperty(X4,"__esModule",{value:!0});X4.observable=void 0;X4.observable=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}()});var zr=w(function(Z4){Object.defineProperty(Z4,"__esModule",{value:!0});Z4.identity=void 0;function POe(e){return e}Z4.identity=POe});var zy=w(function(n8){Object.defineProperty(n8,"__esModule",{value:!0});n8.pipeFromArray=n8.pipe=void 0;var IOe=zr();function NOe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return t8(e)}n8.pipe=NOe;function t8(e){if(e.length===0)return IOe.identity;if(e.length===1)return e[0];return function(n){return e.reduce(function(r,o){return o(r)},n)}}n8.pipeFromArray=t8});var en=w(function(s8){Object.defineProperty(s8,"__esModule",{value:!0});s8.Observable=void 0;var QC=om(),MOe=xs(),jOe=Vy(),LOe=zy(),qOe=rm(),XC=Yt(),BOe=px(),UOe=function(){function e(t){if(t)this._subscribe=t}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,s=VOe(t)?t:new QC.SafeSubscriber(t,n,r);return BOe.errorContext(function(){var i=o,{operator:a,source:c}=i;s.add(a?a.call(s,c):c?o._subscribe(s):o._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=o8(n),new n(function(o,s){var i=new QC.SafeSubscriber({next:function(a){try{t(a)}catch(c){s(c),i.unsubscribe()}},error:s,complete:o});r.subscribe(i)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[jOe.observable]=function(){return this},e.prototype.pipe=function(){var t=[];for(var n=0;n<arguments.length;n++)t[n]=arguments[n];return LOe.pipeFromArray(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=o8(t),new t(function(r,o){var s;n.subscribe(function(i){return s=i},function(i){return o(i)},function(){return r(s)})})},e.create=function(t){return new e(t)},e}();s8.Observable=UOe;function o8(e){var t;return(t=e!==null&&e!==void 0?e:qOe.config.Promise)!==null&&t!==void 0?t:Promise}function HOe(e){return e&&XC.isFunction(e.next)&&XC.isFunction(e.error)&&XC.isFunction(e.complete)}function VOe(e){return e&&e instanceof QC.Subscriber||HOe(e)&&MOe.isSubscription(e)}});var ue=w(function(c8){Object.defineProperty(c8,"__esModule",{value:!0});c8.operate=c8.hasLift=void 0;var zOe=Yt();function a8(e){return zOe.isFunction(e===null||e===void 0?void 0:e.lift)}c8.hasLift=a8;function GOe(e){return function(t){if(a8(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw TypeError("Unable to lift unknown Observable type")}}c8.operate=GOe});var Re=w(function(Jl){var KOe=Jl&&Jl.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Jl,"__esModule",{value:!0});Jl.OperatorSubscriber=Jl.createOperatorSubscriber=void 0;var JOe=om();function YOe(e,t,n,r,o){return new u8(e,t,n,r,o)}Jl.createOperatorSubscriber=YOe;var u8=function(e){KOe(t,e);function t(n,r,o,s,i,a){var c=e.call(this,n)||this;return c.onFinalize=i,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(d){n.error(d)}}:e.prototype._next,c._error=s?function(l){try{s(l)}catch(d){n.error(d)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(l){n.error(l)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(JOe.Subscriber);Jl.OperatorSubscriber=u8});var ZC=w(function(d8){Object.defineProperty(d8,"__esModule",{value:!0});d8.refCount=void 0;var XOe=ue(),QOe=Re();function ZOe(){return XOe.operate(function(e,t){var n=null;e._refCount++;var r=QOe.createOperatorSubscriber(t,void 0,void 0,void 0,function(){if(!e||e._refCount<=0||0<--e._refCount){n=null;return}var o=e._connection,s=n;if(n=null,o&&(!s||o===s))o.unsubscribe();t.unsubscribe()});if(e.subscribe(r),!r.closed)n=e.connect()})}d8.refCount=ZOe});var Gy=w(function(sm){var eTe=sm&&sm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(sm,"__esModule",{value:!0});sm.ConnectableObservable=void 0;var tTe=en(),p8=xs(),nTe=ZC(),rTe=Re(),oTe=ue(),sTe=function(e){eTe(t,e);function t(n,r){var o=e.call(this)||this;if(o.source=n,o.subjectFactory=r,o._subject=null,o._refCount=0,o._connection=null,oTe.hasLift(n))o.lift=n.lift;return o}return t.prototype._subscribe=function(n){return this.getSubject().subscribe(n)},t.prototype.getSubject=function(){var n=this._subject;if(!n||n.isStopped)this._subject=this.subjectFactory();return this._subject},t.prototype._teardown=function(){this._refCount=0;var n=this._connection;this._subject=this._connection=null,n===null||n===void 0||n.unsubscribe()},t.prototype.connect=function(){var n=this,r=this._connection;if(!r){r=this._connection=new p8.Subscription;var o=this.getSubject();if(r.add(this.source.subscribe(rTe.createOperatorSubscriber(o,void 0,function(){n._teardown(),o.complete()},function(s){n._teardown(),o.error(s)},function(){return n._teardown()}))),r.closed)this._connection=null,r=p8.Subscription.EMPTY}return r},t.prototype.refCount=function(){return nTe.refCount()(this)},t}(tTe.Observable);sm.ConnectableObservable=sTe});var h8=w(function(m8){Object.defineProperty(m8,"__esModule",{value:!0});m8.performanceTimestampProvider=void 0;m8.performanceTimestampProvider={now:function(){return(m8.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}});var tA=w(function(Ci){var g8=Ci&&Ci.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},y8=Ci&&Ci.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.animationFrameProvider=void 0;var iTe=xs();Ci.animationFrameProvider={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=Ci.animationFrameProvider.delegate;if(r)t=r.requestAnimationFrame,n=r.cancelAnimationFrame;var o=t(function(s){n=void 0,e(s)});return new iTe.Subscription(function(){return n===null||n===void 0?void 0:n(o)})},requestAnimationFrame:function(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ci.animationFrameProvider.delegate;return((n===null||n===void 0?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,y8([],g8(e)))},cancelAnimationFrame:function(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ci.animationFrameProvider.delegate;return((n===null||n===void 0?void 0:n.cancelAnimationFrame)||cancelAnimationFrame).apply(void 0,y8([],g8(e)))},delegate:void 0}});var v8=w(function(_8){Object.defineProperty(_8,"__esModule",{value:!0});_8.animationFrames=void 0;var aTe=en(),cTe=h8(),b8=tA();function lTe(e){return e?w8(e):uTe}_8.animationFrames=lTe;function w8(e){return new aTe.Observable(function(t){var n=e||cTe.performanceTimestampProvider,r=n.now(),o=0,s=function(){if(!t.closed)o=b8.animationFrameProvider.requestAnimationFrame(function(i){o=0;var a=n.now();t.next({timestamp:e?a:i,elapsed:a-r}),s()})};return s(),function(){if(o)b8.animationFrameProvider.cancelAnimationFrame(o)}})}var uTe=w8()});var nA=w(function(k8){Object.defineProperty(k8,"__esModule",{value:!0});k8.ObjectUnsubscribedError=void 0;var dTe=Kl();k8.ObjectUnsubscribedError=dTe.createErrorClass(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})});var Gr=w(function(ua){var $8=ua&&ua.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),fTe=ua&&ua.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(ua,"__esModule",{value:!0});ua.AnonymousSubject=ua.Subject=void 0;var S8=en(),oA=xs(),pTe=nA(),mTe=Mc(),rA=px(),D8=function(e){$8(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new sA(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new pTe.ObjectUnsubscribedError},t.prototype.next=function(n){var r=this;rA.errorContext(function(){var o,s;if(r._throwIfClosed(),!r.isStopped){if(!r.currentObservers)r.currentObservers=Array.from(r.observers);try{for(var i=fTe(r.currentObservers),a=i.next();!a.done;a=i.next()){var c=a.value;c.next(n)}}catch(l){o={error:l}}finally{try{if(a&&!a.done&&(s=i.return))s.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;rA.errorContext(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;var o=r.observers;while(o.length)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;rA.errorContext(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;var r=n.observers;while(r.length)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,{hasError:s,isStopped:i,observers:a}=o;if(s||i)return oA.EMPTY_SUBSCRIPTION;return this.currentObservers=null,a.push(n),new oA.Subscription(function(){r.currentObservers=null,mTe.arrRemove(a,n)})},t.prototype._checkFinalizedStatuses=function(n){var r=this,{hasError:o,thrownError:s,isStopped:i}=r;if(o)n.error(s);else if(i)n.complete()},t.prototype.asObservable=function(){var n=new S8.Observable;return n.source=this,n},t.create=function(n,r){return new sA(n,r)},t}(S8.Observable);ua.Subject=D8;var sA=function(e){$8(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:oA.EMPTY_SUBSCRIPTION},t}(D8);ua.AnonymousSubject=sA});var iA=w(function(im){var hTe=im&&im.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(im,"__esModule",{value:!0});im.BehaviorSubject=void 0;var gTe=Gr(),yTe=function(e){hTe(t,e);function t(n){var r=e.call(this)||this;return r._value=n,r}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(n){var r=e.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},t.prototype.getValue=function(){var n=this,{hasError:r,thrownError:o,_value:s}=n;if(r)throw o;return this._throwIfClosed(),s},t.prototype.next=function(n){e.prototype.next.call(this,this._value=n)},t}(gTe.Subject);im.BehaviorSubject=yTe});var hx=w(function(R8){Object.defineProperty(R8,"__esModule",{value:!0});R8.dateTimestampProvider=void 0;R8.dateTimestampProvider={now:function(){return(R8.dateTimestampProvider.delegate||Date).now()},delegate:void 0}});var gx=w(function(am){var bTe=am&&am.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(am,"__esModule",{value:!0});am.ReplaySubject=void 0;var wTe=Gr(),_Te=hx(),xTe=function(e){bTe(t,e);function t(n,r,o){if(n===void 0)n=1/0;if(r===void 0)r=1/0;if(o===void 0)o=_Te.dateTimestampProvider;var s=e.call(this)||this;return s._bufferSize=n,s._windowTime=r,s._timestampProvider=o,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,n),s._windowTime=Math.max(1,r),s}return t.prototype.next=function(n){var r=this,{isStopped:o,_buffer:s,_infiniteTimeWindow:i,_timestampProvider:a,_windowTime:c}=r;if(!o)s.push(n),!i&&s.push(a.now()+c);this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();var r=this._innerSubscribe(n),o=this,{_infiniteTimeWindow:s,_buffer:i}=o,a=i.slice();for(var c=0;c<a.length&&!n.closed;c+=s?1:2)n.next(a[c]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,{_bufferSize:r,_timestampProvider:o,_buffer:s,_infiniteTimeWindow:i}=n,a=(i?1:2)*r;if(r<1/0&&a<s.length&&s.splice(0,s.length-a),!i){var c=o.now(),l=0;for(var d=1;d<s.length&&s[d]<=c;d+=2)l=d;l&&s.splice(0,l+1)}},t}(wTe.Subject);am.ReplaySubject=xTe});var yx=w(function(cm){var vTe=cm&&cm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(cm,"__esModule",{value:!0});cm.AsyncSubject=void 0;var kTe=Gr(),ETe=function(e){vTe(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n._value=null,n._hasValue=!1,n._isComplete=!1,n}return t.prototype._checkFinalizedStatuses=function(n){var r=this,{hasError:o,_hasValue:s,_value:i,thrownError:a,isStopped:c,_isComplete:l}=r;if(o)n.error(a);else if(c||l)s&&n.next(i),n.complete()},t.prototype.next=function(n){if(!this.isStopped)this._value=n,this._hasValue=!0},t.prototype.complete=function(){var n=this,{_hasValue:r,_value:o,_isComplete:s}=n;if(!s)this._isComplete=!0,r&&e.prototype.next.call(this,o),e.prototype.complete.call(this)},t}(kTe.Subject);cm.AsyncSubject=ETe});var C8=w(function(lm){var STe=lm&&lm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(lm,"__esModule",{value:!0});lm.Action=void 0;var $Te=xs(),DTe=function(e){STe(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){if(r===void 0)r=0;return this},t}($Te.Subscription);lm.Action=DTe});var T8=w(function(da){var A8=da&&da.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},O8=da&&da.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(da,"__esModule",{value:!0});da.intervalProvider=void 0;da.intervalProvider={setInterval:function(e,t){var n=[];for(var r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=da.intervalProvider.delegate;if(o===null||o===void 0?void 0:o.setInterval)return o.setInterval.apply(o,O8([e,t],A8(n)));return setInterval.apply(void 0,O8([e,t],A8(n)))},clearInterval:function(e){var t=da.intervalProvider.delegate;return((t===null||t===void 0?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0}});var dm=w(function(um){var RTe=um&&um.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(um,"__esModule",{value:!0});um.AsyncAction=void 0;var CTe=C8(),P8=T8(),ATe=Mc(),OTe=function(e){RTe(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o.pending=!1,o}return t.prototype.schedule=function(n,r){var o;if(r===void 0)r=0;if(this.closed)return this;this.state=n;var s=this.id,i=this.scheduler;if(s!=null)this.id=this.recycleAsyncId(i,s,r);return this.pending=!0,this.delay=r,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(i,this.id,r),this},t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;return P8.intervalProvider.setInterval(n.flush.bind(n,this),o)},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0)o=0;if(o!=null&&this.delay===o&&this.pending===!1)return r;if(r!=null)P8.intervalProvider.clearInterval(r);return},t.prototype.execute=function(n,r){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var o=this._execute(n,r);if(o)return o;else if(this.pending===!1&&this.id!=null)this.id=this.recycleAsyncId(this.scheduler,this.id,null)},t.prototype._execute=function(n,r){var o=!1,s;try{this.work(n)}catch(i){o=!0,s=i?i:Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,{id:r,scheduler:o}=n,s=o.actions;if(this.work=this.state=this.scheduler=null,this.pending=!1,ATe.arrRemove(s,this),r!=null)this.id=this.recycleAsyncId(o,r,null);this.delay=null,e.prototype.unsubscribe.call(this)}},t}(CTe.Action);um.AsyncAction=OTe});var M8=w(function(N8){Object.defineProperty(N8,"__esModule",{value:!0});N8.TestTools=N8.Immediate=void 0;var TTe=1,cA,bx={};function I8(e){if(e in bx)return delete bx[e],!0;return!1}N8.Immediate={setImmediate:function(e){var t=TTe++;if(bx[t]=!0,!cA)cA=Promise.resolve();return cA.then(function(){return I8(t)&&e()}),t},clearImmediate:function(e){I8(e)}};N8.TestTools={pending:function(){return Object.keys(bx).length}}});var L8=w(function(fa){var ITe=fa&&fa.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},NTe=fa&&fa.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(fa,"__esModule",{value:!0});fa.immediateProvider=void 0;var j8=M8(),FTe=j8.Immediate.setImmediate,MTe=j8.Immediate.clearImmediate;fa.immediateProvider={setImmediate:function(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=fa.immediateProvider.delegate;return((n===null||n===void 0?void 0:n.setImmediate)||FTe).apply(void 0,NTe([],ITe(e)))},clearImmediate:function(e){var t=fa.immediateProvider.delegate;return((t===null||t===void 0?void 0:t.clearImmediate)||MTe)(e)},delegate:void 0}});var B8=w(function(fm){var jTe=fm&&fm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(fm,"__esModule",{value:!0});fm.AsapAction=void 0;var LTe=dm(),q8=L8(),qTe=function(e){jTe(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o}return t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;if(o!==null&&o>0)return e.prototype.requestAsyncId.call(this,n,r,o);return n.actions.push(this),n._scheduled||(n._scheduled=q8.immediateProvider.setImmediate(n.flush.bind(n,void 0)))},t.prototype.recycleAsyncId=function(n,r,o){var s;if(o===void 0)o=0;if(o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,n,r,o);var i=n.actions;if(r!=null&&((s=i[i.length-1])===null||s===void 0?void 0:s.id)!==r){if(q8.immediateProvider.clearImmediate(r),n._scheduled===r)n._scheduled=void 0}return},t}(LTe.AsyncAction);fm.AsapAction=qTe});var lA=w(function(U8){Object.defineProperty(U8,"__esModule",{value:!0});U8.Scheduler=void 0;var BTe=hx(),UTe=function(){function e(t,n){if(n===void 0)n=e.now;this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){if(n===void 0)n=0;return new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=BTe.dateTimestampProvider.now,e}();U8.Scheduler=UTe});var mm=w(function(pm){var HTe=pm&&pm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(pm,"__esModule",{value:!0});pm.AsyncScheduler=void 0;var V8=lA(),VTe=function(e){HTe(t,e);function t(n,r){if(r===void 0)r=V8.Scheduler.now;var o=e.call(this,n,r)||this;return o.actions=[],o._active=!1,o}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var o;this._active=!0;do if(o=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,o){while(n=r.shift())n.unsubscribe();throw o}},t}(V8.Scheduler);pm.AsyncScheduler=VTe});var z8=w(function(hm){var zTe=hm&&hm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(hm,"__esModule",{value:!0});hm.AsapScheduler=void 0;var GTe=mm(),WTe=function(e){zTe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(n){this._active=!0;var r=this._scheduled;this._scheduled=void 0;var o=this.actions,s;n=n||o.shift();do if(s=n.execute(n.state,n.delay))break;while((n=o[0])&&n.id===r&&o.shift());if(this._active=!1,s){while((n=o[0])&&n.id===r&&o.shift())n.unsubscribe();throw s}},t}(GTe.AsyncScheduler);hm.AsapScheduler=WTe});var J8=w(function(G8){Object.defineProperty(G8,"__esModule",{value:!0});G8.asap=G8.asapScheduler=void 0;var KTe=B8(),JTe=z8();G8.asapScheduler=new JTe.AsapScheduler(KTe.AsapAction);G8.asap=G8.asapScheduler});var Jo=w(function(Y8){Object.defineProperty(Y8,"__esModule",{value:!0});Y8.async=Y8.asyncScheduler=void 0;var YTe=dm(),XTe=mm();Y8.asyncScheduler=new XTe.AsyncScheduler(YTe.AsyncAction);Y8.async=Y8.asyncScheduler});var Z8=w(function(gm){var QTe=gm&&gm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(gm,"__esModule",{value:!0});gm.QueueAction=void 0;var ZTe=dm(),ePe=function(e){QTe(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o}return t.prototype.schedule=function(n,r){if(r===void 0)r=0;if(r>0)return e.prototype.schedule.call(this,n,r);return this.delay=r,this.state=n,this.scheduler.flush(this),this},t.prototype.execute=function(n,r){return r>0||this.closed?e.prototype.execute.call(this,n,r):this._execute(n,r)},t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;if(o!=null&&o>0||o==null&&this.delay>0)return e.prototype.requestAsyncId.call(this,n,r,o);return n.flush(this),0},t}(ZTe.AsyncAction);gm.QueueAction=ePe});var eB=w(function(ym){var tPe=ym&&ym.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(ym,"__esModule",{value:!0});ym.QueueScheduler=void 0;var nPe=mm(),rPe=function(e){tPe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(nPe.AsyncScheduler);ym.QueueScheduler=rPe});var oB=w(function(tB){Object.defineProperty(tB,"__esModule",{value:!0});tB.queue=tB.queueScheduler=void 0;var oPe=Z8(),sPe=eB();tB.queueScheduler=new sPe.QueueScheduler(oPe.QueueAction);tB.queue=tB.queueScheduler});var iB=w(function(bm){var iPe=bm&&bm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(bm,"__esModule",{value:!0});bm.AnimationFrameAction=void 0;var aPe=dm(),sB=tA(),cPe=function(e){iPe(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o}return t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;if(o!==null&&o>0)return e.prototype.requestAsyncId.call(this,n,r,o);return n.actions.push(this),n._scheduled||(n._scheduled=sB.animationFrameProvider.requestAnimationFrame(function(){return n.flush(void 0)}))},t.prototype.recycleAsyncId=function(n,r,o){var s;if(o===void 0)o=0;if(o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,n,r,o);var i=n.actions;if(r!=null&&r===n._scheduled&&((s=i[i.length-1])===null||s===void 0?void 0:s.id)!==r)sB.animationFrameProvider.cancelAnimationFrame(r),n._scheduled=void 0;return},t}(aPe.AsyncAction);bm.AnimationFrameAction=cPe});var aB=w(function(wm){var lPe=wm&&wm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(wm,"__esModule",{value:!0});wm.AnimationFrameScheduler=void 0;var uPe=mm(),dPe=function(e){lPe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(n){this._active=!0;var r;if(n)r=n.id;else r=this._scheduled,this._scheduled=void 0;var o=this.actions,s;n=n||o.shift();do if(s=n.execute(n.state,n.delay))break;while((n=o[0])&&n.id===r&&o.shift());if(this._active=!1,s){while((n=o[0])&&n.id===r&&o.shift())n.unsubscribe();throw s}},t}(uPe.AsyncScheduler);wm.AnimationFrameScheduler=dPe});var dB=w(function(cB){Object.defineProperty(cB,"__esModule",{value:!0});cB.animationFrame=cB.animationFrameScheduler=void 0;var fPe=iB(),pPe=aB();cB.animationFrameScheduler=new pPe.AnimationFrameScheduler(fPe.AnimationFrameAction);cB.animationFrame=cB.animationFrameScheduler});var mB=w(function(Yl){var fB=Yl&&Yl.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Yl,"__esModule",{value:!0});Yl.VirtualAction=Yl.VirtualTimeScheduler=void 0;var mPe=dm(),hPe=xs(),gPe=mm(),yPe=function(e){fB(t,e);function t(n,r){if(n===void 0)n=pB;if(r===void 0)r=1/0;var o=e.call(this,n,function(){return o.frame})||this;return o.maxFrames=r,o.frame=0,o.index=-1,o}return t.prototype.flush=function(){var n=this,{actions:r,maxFrames:o}=n,s,i;while((i=r[0])&&i.delay<=o)if(r.shift(),this.frame=i.delay,s=i.execute(i.state,i.delay))break;if(s){while(i=r.shift())i.unsubscribe();throw s}},t.frameTimeFactor=10,t}(gPe.AsyncScheduler);Yl.VirtualTimeScheduler=yPe;var pB=function(e){fB(t,e);function t(n,r,o){if(o===void 0)o=n.index+=1;var s=e.call(this,n,r)||this;return s.scheduler=n,s.work=r,s.index=o,s.active=!0,s.index=n.index=o,s}return t.prototype.schedule=function(n,r){if(r===void 0)r=0;if(Number.isFinite(r)){if(!this.id)return e.prototype.schedule.call(this,n,r);this.active=!1;var o=new t(this.scheduler,this.work);return this.add(o),o.schedule(n,r)}else return hPe.Subscription.EMPTY},t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;this.delay=n.frame+o;var s=n.actions;return s.push(this),s.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0)o=0;return},t.prototype._execute=function(n,r){if(this.active===!0)return e.prototype._execute.call(this,n,r)},t.sortActions=function(n,r){if(n.delay===r.delay)if(n.index===r.index)return 0;else if(n.index>r.index)return 1;else return-1;else if(n.delay>r.delay)return 1;else return-1},t}(mPe.AsyncAction);Yl.VirtualAction=pB});var Ai=w(function(gB){Object.defineProperty(gB,"__esModule",{value:!0});gB.empty=gB.EMPTY=void 0;var hB=en();gB.EMPTY=new hB.Observable(function(e){return e.complete()});function bPe(e){return e?wPe(e):gB.EMPTY}gB.empty=bPe;function wPe(e){return new hB.Observable(function(t){return e.schedule(function(){return t.complete()})})}});var Wy=w(function(wB){Object.defineProperty(wB,"__esModule",{value:!0});wB.isScheduler=void 0;var _Pe=Yt();function xPe(e){return e&&_Pe.isFunction(e.schedule)}wB.isScheduler=xPe});var Yo=w(function(xB){Object.defineProperty(xB,"__esModule",{value:!0});xB.popNumber=xB.popScheduler=xB.popResultSelector=void 0;var vPe=Yt(),kPe=Wy();function uA(e){return e[e.length-1]}function EPe(e){return vPe.isFunction(uA(e))?e.pop():void 0}xB.popResultSelector=EPe;function SPe(e){return kPe.isScheduler(uA(e))?e.pop():void 0}xB.popScheduler=SPe;function $Pe(e,t){return typeof uA(e)==="number"?e.pop():t}xB.popNumber=$Pe});var wx=w(function(kB){Object.defineProperty(kB,"__esModule",{value:!0});kB.isArrayLike=void 0;kB.isArrayLike=function(e){return e&&typeof e.length==="number"&&typeof e!=="function"}});var dA=w(function(SB){Object.defineProperty(SB,"__esModule",{value:!0});SB.isPromise=void 0;var CPe=Yt();function APe(e){return CPe.isFunction(e===null||e===void 0?void 0:e.then)}SB.isPromise=APe});var fA=w(function(DB){Object.defineProperty(DB,"__esModule",{value:!0});DB.isInteropObservable=void 0;var OPe=Vy(),TPe=Yt();function PPe(e){return TPe.isFunction(e[OPe.observable])}DB.isInteropObservable=PPe});var pA=w(function(CB){Object.defineProperty(CB,"__esModule",{value:!0});CB.isAsyncIterable=void 0;var IPe=Yt();function NPe(e){return Symbol.asyncIterator&&IPe.isFunction(e===null||e===void 0?void 0:e[Symbol.asyncIterator])}CB.isAsyncIterable=NPe});var mA=w(function(OB){Object.defineProperty(OB,"__esModule",{value:!0});OB.createInvalidObservableTypeError=void 0;function FPe(e){return TypeError("You provided "+(e!==null&&typeof e==="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}OB.createInvalidObservableTypeError=FPe});var hA=w(function(IB){Object.defineProperty(IB,"__esModule",{value:!0});IB.iterator=IB.getSymbolIterator=void 0;function PB(){if(typeof Symbol!=="function"||!Symbol.iterator)return"@@iterator";return Symbol.iterator}IB.getSymbolIterator=PB;IB.iterator=PB()});var gA=w(function(FB){Object.defineProperty(FB,"__esModule",{value:!0});FB.isIterable=void 0;var jPe=hA(),LPe=Yt();function qPe(e){return LPe.isFunction(e===null||e===void 0?void 0:e[jPe.iterator])}FB.isIterable=qPe});var _x=w(function(Vs){var BPe=Vs&&Vs.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(d){return c([l,d])}}function c(l){if(r)throw TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(s=l[0]&2?o.return:l[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,l[1])).done)return s;if(o=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if((s=n.trys,!(s=s.length>0&&s[s.length-1]))&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}if(s[2])n.ops.pop();n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},_m=Vs&&Vs.__await||function(e){return this instanceof _m?(this.v=e,this):new _m(e)},UPe=Vs&&Vs.__asyncGenerator||function(e,t,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,s=[];return o={},i("next"),i("throw"),i("return"),o[Symbol.asyncIterator]=function(){return this},o;function i(p){if(r[p])o[p]=function(m){return new Promise(function(h,g){s.push([p,m,h,g])>1||a(p,m)})}}function a(p,m){try{c(r[p](m))}catch(h){f(s[0][3],h)}}function c(p){p.value instanceof _m?Promise.resolve(p.value.v).then(l,d):f(s[0][2],p)}function l(p){a("next",p)}function d(p){a("throw",p)}function f(p,m){if(p(m),s.shift(),s.length)a(s[0][0],s[0][1])}};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.isReadableStreamLike=Vs.readableStreamLikeToAsyncGenerator=void 0;var HPe=Yt();function VPe(e){return UPe(this,arguments,function(){var n,r,o,s;return BPe(this,function(i){switch(i.label){case 0:n=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,_m(n.read())];case 3:if(r=i.sent(),o=r.value,s=r.done,!s)return[3,5];return[4,_m(void 0)];case 4:return[2,i.sent()];case 5:return[4,_m(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}Vs.readableStreamLikeToAsyncGenerator=VPe;function zPe(e){return HPe.isFunction(e===null||e===void 0?void 0:e.getReader)}Vs.isReadableStreamLike=zPe});var at=w(function(xn){var GPe=xn&&xn.__awaiter||function(e,t,n,r){function o(s){return s instanceof n?s:new n(function(i){i(s)})}return new(n||(n=Promise))(function(s,i){function a(d){try{l(r.next(d))}catch(f){i(f)}}function c(d){try{l(r.throw(d))}catch(f){i(f)}}function l(d){d.done?s(d.value):o(d.value).then(a,c)}l((r=r.apply(e,t||[])).next())})},WPe=xn&&xn.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(d){return c([l,d])}}function c(l){if(r)throw TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(s=l[0]&2?o.return:l[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,l[1])).done)return s;if(o=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if((s=n.trys,!(s=s.length>0&&s[s.length-1]))&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}if(s[2])n.ops.pop();n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},KPe=xn&&xn.__asyncValues||function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof yA==="function"?yA(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(i){return new Promise(function(a,c){i=e[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},i)}},yA=xn&&xn.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(xn,"__esModule",{value:!0});xn.fromReadableStreamLike=xn.fromAsyncIterable=xn.fromIterable=xn.fromPromise=xn.fromArrayLike=xn.fromInteropObservable=xn.innerFrom=void 0;var JPe=wx(),YPe=dA(),xm=en(),XPe=fA(),QPe=pA(),ZPe=mA(),eIe=gA(),jB=_x(),tIe=Yt(),nIe=GC(),rIe=Vy();function oIe(e){if(e instanceof xm.Observable)return e;if(e!=null){if(XPe.isInteropObservable(e))return LB(e);if(JPe.isArrayLike(e))return qB(e);if(YPe.isPromise(e))return BB(e);if(QPe.isAsyncIterable(e))return bA(e);if(eIe.isIterable(e))return UB(e);if(jB.isReadableStreamLike(e))return HB(e)}throw ZPe.createInvalidObservableTypeError(e)}xn.innerFrom=oIe;function LB(e){return new xm.Observable(function(t){var n=e[rIe.observable]();if(tIe.isFunction(n.subscribe))return n.subscribe(t);throw TypeError("Provided object does not correctly implement Symbol.observable")})}xn.fromInteropObservable=LB;function qB(e){return new xm.Observable(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}xn.fromArrayLike=qB;function BB(e){return new xm.Observable(function(t){e.then(function(n){if(!t.closed)t.next(n),t.complete()},function(n){return t.error(n)}).then(null,nIe.reportUnhandledError)})}xn.fromPromise=BB;function UB(e){return new xm.Observable(function(t){var n,r;try{for(var o=yA(e),s=o.next();!s.done;s=o.next()){var i=s.value;if(t.next(i),t.closed)return}}catch(a){n={error:a}}finally{try{if(s&&!s.done&&(r=o.return))r.call(o)}finally{if(n)throw n.error}}t.complete()})}xn.fromIterable=UB;function bA(e){return new xm.Observable(function(t){sIe(e,t).catch(function(n){return t.error(n)})})}xn.fromAsyncIterable=bA;function HB(e){return bA(jB.readableStreamLikeToAsyncGenerator(e))}xn.fromReadableStreamLike=HB;function sIe(e,t){var n,r,o,s;return GPe(this,void 0,void 0,function(){var i,a;return WPe(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=KPe(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(i=r.value,t.next(i),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:if(c.trys.push([6,,9,10]),!(r&&!r.done&&(s=n.return)))return[3,8];return[4,s.call(n)];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}});var jc=w(function(VB){Object.defineProperty(VB,"__esModule",{value:!0});VB.executeSchedule=void 0;function iIe(e,t,n,r,o){if(r===void 0)r=0;if(o===void 0)o=!1;var s=t.schedule(function(){if(n(),o)e.add(this.schedule(null,r));else this.unsubscribe()},r);if(e.add(s),!o)return s}VB.executeSchedule=iIe});var Ky=w(function(GB){Object.defineProperty(GB,"__esModule",{value:!0});GB.observeOn=void 0;var wA=jc(),aIe=ue(),cIe=Re();function lIe(e,t){if(t===void 0)t=0;return aIe.operate(function(n,r){n.subscribe(cIe.createOperatorSubscriber(r,function(o){return wA.executeSchedule(r,e,function(){return r.next(o)},t)},function(){return wA.executeSchedule(r,e,function(){return r.complete()},t)},function(o){return wA.executeSchedule(r,e,function(){return r.error(o)},t)}))})}GB.observeOn=lIe});var Jy=w(function(KB){Object.defineProperty(KB,"__esModule",{value:!0});KB.subscribeOn=void 0;var uIe=ue();function dIe(e,t){if(t===void 0)t=0;return uIe.operate(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}KB.subscribeOn=dIe});var QB=w(function(YB){Object.defineProperty(YB,"__esModule",{value:!0});YB.scheduleObservable=void 0;var fIe=at(),pIe=Ky(),mIe=Jy();function hIe(e,t){return fIe.innerFrom(e).pipe(mIe.subscribeOn(t),pIe.observeOn(t))}YB.scheduleObservable=hIe});var t5=w(function(ZB){Object.defineProperty(ZB,"__esModule",{value:!0});ZB.schedulePromise=void 0;var gIe=at(),yIe=Ky(),bIe=Jy();function wIe(e,t){return gIe.innerFrom(e).pipe(bIe.subscribeOn(t),yIe.observeOn(t))}ZB.schedulePromise=wIe});var o5=w(function(n5){Object.defineProperty(n5,"__esModule",{value:!0});n5.scheduleArray=void 0;var _Ie=en();function xIe(e,t){return new _Ie.Observable(function(n){var r=0;return t.schedule(function(){if(r===e.length)n.complete();else if(n.next(e[r++]),!n.closed)this.schedule()})})}n5.scheduleArray=xIe});var _A=w(function(i5){Object.defineProperty(i5,"__esModule",{value:!0});i5.scheduleIterable=void 0;var vIe=en(),kIe=hA(),EIe=Yt(),s5=jc();function SIe(e,t){return new vIe.Observable(function(n){var r;return s5.executeSchedule(n,t,function(){r=e[kIe.iterator](),s5.executeSchedule(n,t,function(){var o,s,i;try{o=r.next(),s=o.value,i=o.done}catch(a){n.error(a);return}if(i)n.complete();else n.next(s)},0,!0)}),function(){return EIe.isFunction(r===null||r===void 0?void 0:r.return)&&r.return()}})}i5.scheduleIterable=SIe});var xA=w(function(l5){Object.defineProperty(l5,"__esModule",{value:!0});l5.scheduleAsyncIterable=void 0;var $Ie=en(),c5=jc();function DIe(e,t){if(!e)throw Error("Iterable cannot be null");return new $Ie.Observable(function(n){c5.executeSchedule(n,t,function(){var r=e[Symbol.asyncIterator]();c5.executeSchedule(n,t,function(){r.next().then(function(o){if(o.done)n.complete();else n.next(o.value)})},0,!0)})})}l5.scheduleAsyncIterable=DIe});var p5=w(function(d5){Object.defineProperty(d5,"__esModule",{value:!0});d5.scheduleReadableStreamLike=void 0;var RIe=xA(),CIe=_x();function AIe(e,t){return RIe.scheduleAsyncIterable(CIe.readableStreamLikeToAsyncGenerator(e),t)}d5.scheduleReadableStreamLike=AIe});var vA=w(function(m5){Object.defineProperty(m5,"__esModule",{value:!0});m5.scheduled=void 0;var OIe=QB(),TIe=t5(),PIe=o5(),IIe=_A(),NIe=xA(),FIe=fA(),MIe=dA(),jIe=wx(),LIe=gA(),qIe=pA(),BIe=mA(),UIe=_x(),HIe=p5();function VIe(e,t){if(e!=null){if(FIe.isInteropObservable(e))return OIe.scheduleObservable(e,t);if(jIe.isArrayLike(e))return PIe.scheduleArray(e,t);if(MIe.isPromise(e))return TIe.schedulePromise(e,t);if(qIe.isAsyncIterable(e))return NIe.scheduleAsyncIterable(e,t);if(LIe.isIterable(e))return IIe.scheduleIterable(e,t);if(UIe.isReadableStreamLike(e))return HIe.scheduleReadableStreamLike(e,t)}throw BIe.createInvalidObservableTypeError(e)}m5.scheduled=VIe});var Lc=w(function(g5){Object.defineProperty(g5,"__esModule",{value:!0});g5.from=void 0;var zIe=vA(),GIe=at();function WIe(e,t){return t?zIe.scheduled(e,t):GIe.innerFrom(e)}g5.from=WIe});var xx=w(function(b5){Object.defineProperty(b5,"__esModule",{value:!0});b5.of=void 0;var KIe=Yo(),JIe=Lc();function YIe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=KIe.popScheduler(e);return JIe.from(e,n)}b5.of=YIe});var kA=w(function(_5){Object.defineProperty(_5,"__esModule",{value:!0});_5.throwError=void 0;var XIe=en(),QIe=Yt();function ZIe(e,t){var n=QIe.isFunction(e)?e:function(){return e},r=function(o){return o.error(n())};return new XIe.Observable(t?function(o){return t.schedule(r,0,o)}:r)}_5.throwError=ZIe});var vx=w(function(E5){Object.defineProperty(E5,"__esModule",{value:!0});E5.observeNotification=E5.Notification=E5.NotificationKind=void 0;var eNe=Ai(),tNe=xx(),nNe=kA(),rNe=Yt(),oNe;(function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"})(oNe=E5.NotificationKind||(E5.NotificationKind={}));var sNe=function(){function e(t,n,r){this.kind=t,this.value=n,this.error=r,this.hasValue=t==="N"}return e.prototype.observe=function(t){return k5(this,t)},e.prototype.do=function(t,n,r){var o=this,{kind:s,value:i,error:a}=o;return s==="N"?t===null||t===void 0?void 0:t(i):s==="E"?n===null||n===void 0?void 0:n(a):r===null||r===void 0?void 0:r()},e.prototype.accept=function(t,n,r){var o;return rNe.isFunction((o=t)===null||o===void 0?void 0:o.next)?this.observe(t):this.do(t,n,r)},e.prototype.toObservable=function(){var t=this,{kind:n,value:r,error:o}=t,s=n==="N"?tNe.of(r):n==="E"?nNe.throwError(function(){return o}):n==="C"?eNe.EMPTY:0;if(!s)throw TypeError("Unexpected notification kind "+n);return s},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();E5.Notification=sNe;function k5(e,t){var n,r,o,s=e,{kind:i,value:a,error:c}=s;if(typeof i!=="string")throw TypeError('Invalid notification, missing "kind"');i==="N"?(n=t.next)===null||n===void 0||n.call(t,a):i==="E"?(r=t.error)===null||r===void 0||r.call(t,c):(o=t.complete)===null||o===void 0||o.call(t)}E5.observeNotification=k5});var C5=w(function(D5){Object.defineProperty(D5,"__esModule",{value:!0});D5.isObservable=void 0;var aNe=en(),$5=Yt();function cNe(e){return!!e&&(e instanceof aNe.Observable||$5.isFunction(e.lift)&&$5.isFunction(e.subscribe))}D5.isObservable=cNe});var Xl=w(function(A5){Object.defineProperty(A5,"__esModule",{value:!0});A5.EmptyError=void 0;var lNe=Kl();A5.EmptyError=lNe.createErrorClass(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})});var I5=w(function(T5){Object.defineProperty(T5,"__esModule",{value:!0});T5.lastValueFrom=void 0;var uNe=Xl();function dNe(e,t){var n=typeof t==="object";return new Promise(function(r,o){var s=!1,i;e.subscribe({next:function(a){i=a,s=!0},error:o,complete:function(){if(s)r(i);else if(n)r(t.defaultValue);else o(new uNe.EmptyError)}})})}T5.lastValueFrom=dNe});var M5=w(function(N5){Object.defineProperty(N5,"__esModule",{value:!0});N5.firstValueFrom=void 0;var fNe=Xl(),pNe=om();function mNe(e,t){var n=typeof t==="object";return new Promise(function(r,o){var s=new pNe.SafeSubscriber({next:function(i){r(i),s.unsubscribe()},error:o,complete:function(){if(n)r(t.defaultValue);else o(new fNe.EmptyError)}});e.subscribe(s)})}N5.firstValueFrom=mNe});var EA=w(function(j5){Object.defineProperty(j5,"__esModule",{value:!0});j5.ArgumentOutOfRangeError=void 0;var hNe=Kl();j5.ArgumentOutOfRangeError=hNe.createErrorClass(function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})});var SA=w(function(q5){Object.defineProperty(q5,"__esModule",{value:!0});q5.NotFoundError=void 0;var gNe=Kl();q5.NotFoundError=gNe.createErrorClass(function(e){return function(n){e(this),this.name="NotFoundError",this.message=n}})});var $A=w(function(U5){Object.defineProperty(U5,"__esModule",{value:!0});U5.SequenceError=void 0;var yNe=Kl();U5.SequenceError=yNe.createErrorClass(function(e){return function(n){e(this),this.name="SequenceError",this.message=n}})});var kx=w(function(V5){Object.defineProperty(V5,"__esModule",{value:!0});V5.isValidDate=void 0;function bNe(e){return e instanceof Date&&!isNaN(e)}V5.isValidDate=bNe});var Ex=w(function(G5){Object.defineProperty(G5,"__esModule",{value:!0});G5.timeout=G5.TimeoutError=void 0;var wNe=Jo(),_Ne=kx(),xNe=ue(),vNe=at(),kNe=Kl(),ENe=Re(),SNe=jc();G5.TimeoutError=kNe.createErrorClass(function(e){return function(n){if(n===void 0)n=null;e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=n}});function $Ne(e,t){var n=_Ne.isValidDate(e)?{first:e}:typeof e==="number"?{each:e}:e,{first:r,each:o,with:s}=n,i=s===void 0?DNe:s,a=n.scheduler,c=a===void 0?t!==null&&t!==void 0?t:wNe.asyncScheduler:a,l=n.meta,d=l===void 0?null:l;if(r==null&&o==null)throw TypeError("No timeout provided.");return xNe.operate(function(f,p){var m,h,g=null,y=0,b=function(_){h=SNe.executeSchedule(p,c,function(){try{m.unsubscribe(),vNe.innerFrom(i({meta:d,lastValue:g,seen:y})).subscribe(p)}catch(x){p.error(x)}},_)};m=f.subscribe(ENe.createOperatorSubscriber(p,function(_){h===null||h===void 0||h.unsubscribe(),y++,p.next(g=_),o>0&&b(o)},void 0,void 0,function(){if(!(h===null||h===void 0?void 0:h.closed))h===null||h===void 0||h.unsubscribe();g=null})),!y&&b(r!=null?typeof r==="number"?r:+r-c.now():o)})}G5.timeout=$Ne;function DNe(e){throw new G5.TimeoutError(e)}});var Ql=w(function(J5){Object.defineProperty(J5,"__esModule",{value:!0});J5.map=void 0;var RNe=ue(),CNe=Re();function ANe(e,t){return RNe.operate(function(n,r){var o=0;n.subscribe(CNe.createOperatorSubscriber(r,function(s){r.next(e.call(t,s,o++))}))})}J5.map=ANe});var eu=w(function(Zl){var ONe=Zl&&Zl.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},TNe=Zl&&Zl.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(Zl,"__esModule",{value:!0});Zl.mapOneOrManyArgs=void 0;var PNe=Ql(),INe=Array.isArray;function NNe(e,t){return INe(t)?e.apply(void 0,TNe([],ONe(t))):e(t)}function FNe(e){return PNe.map(function(t){return NNe(e,t)})}Zl.mapOneOrManyArgs=FNe});var RA=w(function(tu){var MNe=tu&&tu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},X5=tu&&tu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(tu,"__esModule",{value:!0});tu.bindCallbackInternals=void 0;var jNe=Wy(),LNe=en(),qNe=Jy(),BNe=eu(),UNe=Ky(),HNe=yx();function DA(e,t,n,r){if(n)if(jNe.isScheduler(n))r=n;else return function(){var o=[];for(var s=0;s<arguments.length;s++)o[s]=arguments[s];return DA(e,t,r).apply(this,o).pipe(BNe.mapOneOrManyArgs(n))};if(r)return function(){var o=[];for(var s=0;s<arguments.length;s++)o[s]=arguments[s];return DA(e,t).apply(this,o).pipe(qNe.subscribeOn(r),UNe.observeOn(r))};return function(){var o=this,s=[];for(var i=0;i<arguments.length;i++)s[i]=arguments[i];var a=new HNe.AsyncSubject,c=!0;return new LNe.Observable(function(l){var d=a.subscribe(l);if(c){c=!1;var f=!1,p=!1;if(t.apply(o,X5(X5([],MNe(s)),[function(){var m=[];for(var h=0;h<arguments.length;h++)m[h]=arguments[h];if(e){var g=m.shift();if(g!=null){a.error(g);return}}if(a.next(1<m.length?m:m[0]),p=!0,f)a.complete()}])),p)a.complete();f=!0}return d})}}tu.bindCallbackInternals=DA});var eU=w(function(Q5){Object.defineProperty(Q5,"__esModule",{value:!0});Q5.bindCallback=void 0;var VNe=RA();function zNe(e,t,n){return VNe.bindCallbackInternals(!1,e,t,n)}Q5.bindCallback=zNe});var rU=w(function(tU){Object.defineProperty(tU,"__esModule",{value:!0});tU.bindNodeCallback=void 0;var GNe=RA();function WNe(e,t,n){return GNe.bindCallbackInternals(!0,e,t,n)}tU.bindNodeCallback=WNe});var CA=w(function(oU){Object.defineProperty(oU,"__esModule",{value:!0});oU.argsArgArrayOrObject=void 0;var KNe=Array.isArray,{getPrototypeOf:JNe,prototype:YNe,keys:XNe}=Object;function QNe(e){if(e.length===1){var t=e[0];if(KNe(t))return{args:t,keys:null};if(ZNe(t)){var n=XNe(t);return{args:n.map(function(r){return t[r]}),keys:n}}}return{args:e,keys:null}}oU.argsArgArrayOrObject=QNe;function ZNe(e){return e&&typeof e==="object"&&JNe(e)===YNe}});var AA=w(function(iU){Object.defineProperty(iU,"__esModule",{value:!0});iU.createObject=void 0;function eFe(e,t){return e.reduce(function(n,r,o){return n[r]=t[o],n},{})}iU.createObject=eFe});var Sx=w(function(pU){Object.defineProperty(pU,"__esModule",{value:!0});pU.combineLatestInit=pU.combineLatest=void 0;var tFe=en(),nFe=CA(),uU=Lc(),dU=zr(),rFe=eu(),cU=Yo(),oFe=AA(),sFe=Re(),iFe=jc();function aFe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=cU.popScheduler(e),r=cU.popResultSelector(e),o=nFe.argsArgArrayOrObject(e),{args:s,keys:i}=o;if(s.length===0)return uU.from([],n);var a=new tFe.Observable(fU(s,n,i?function(c){return oFe.createObject(i,c)}:dU.identity));return r?a.pipe(rFe.mapOneOrManyArgs(r)):a}pU.combineLatest=aFe;function fU(e,t,n){if(n===void 0)n=dU.identity;return function(r){lU(t,function(){var o=e.length,s=Array(o),i=o,a=o,c=function(d){lU(t,function(){var f=uU.from(e[d],t),p=!1;f.subscribe(sFe.createOperatorSubscriber(r,function(m){if(s[d]=m,!p)p=!0,a--;if(!a)r.next(n(s.slice()))},function(){if(!--i)r.complete()}))},r)};for(var l=0;l<o;l++)c(l)},r)}}pU.combineLatestInit=fU;function lU(e,t,n){if(e)iFe.executeSchedule(n,e,t);else t()}});var $x=w(function(gU){Object.defineProperty(gU,"__esModule",{value:!0});gU.mergeInternals=void 0;var lFe=at(),uFe=jc(),hU=Re();function dFe(e,t,n,r,o,s,i,a){var c=[],l=0,d=0,f=!1,p=function(){if(f&&!c.length&&!l)t.complete()},m=function(g){return l<r?h(g):c.push(g)},h=function(g){s&&t.next(g),l++;var y=!1;lFe.innerFrom(n(g,d++)).subscribe(hU.createOperatorSubscriber(t,function(b){if(o===null||o===void 0||o(b),s)m(b);else t.next(b)},function(){y=!0},void 0,function(){if(y)try{l--;var b=function(){var _=c.shift();if(i)uFe.executeSchedule(t,i,function(){return h(_)});else h(_)};while(c.length&&l<r)b();p()}catch(_){t.error(_)}}))};return e.subscribe(hU.createOperatorSubscriber(t,m,function(){f=!0,p()})),function(){a===null||a===void 0||a()}}gU.mergeInternals=dFe});var qc=w(function(wU){Object.defineProperty(wU,"__esModule",{value:!0});wU.mergeMap=void 0;var fFe=Ql(),pFe=at(),mFe=ue(),hFe=$x(),gFe=Yt();function bU(e,t,n){if(n===void 0)n=1/0;if(gFe.isFunction(t))return bU(function(r,o){return fFe.map(function(s,i){return t(r,s,o,i)})(pFe.innerFrom(e(r,o)))},n);else if(typeof t==="number")n=t;return mFe.operate(function(r,o){return hFe.mergeInternals(r,o,e,n)})}wU.mergeMap=bU});var Yy=w(function(xU){Object.defineProperty(xU,"__esModule",{value:!0});xU.mergeAll=void 0;var yFe=qc(),bFe=zr();function wFe(e){if(e===void 0)e=1/0;return yFe.mergeMap(bFe.identity,e)}xU.mergeAll=wFe});var Dx=w(function(kU){Object.defineProperty(kU,"__esModule",{value:!0});kU.concatAll=void 0;var _Fe=Yy();function xFe(){return _Fe.mergeAll(1)}kU.concatAll=xFe});var Xy=w(function(SU){Object.defineProperty(SU,"__esModule",{value:!0});SU.concat=void 0;var vFe=Dx(),kFe=Yo(),EFe=Lc();function SFe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return vFe.concatAll()(EFe.from(e,kFe.popScheduler(e)))}SU.concat=SFe});var Qy=w(function(DU){Object.defineProperty(DU,"__esModule",{value:!0});DU.defer=void 0;var $Fe=en(),DFe=at();function RFe(e){return new $Fe.Observable(function(t){DFe.innerFrom(e()).subscribe(t)})}DU.defer=RFe});var OU=w(function(CU){Object.defineProperty(CU,"__esModule",{value:!0});CU.connectable=void 0;var CFe=Gr(),AFe=en(),OFe=Qy(),TFe={connector:function(){return new CFe.Subject},resetOnDisconnect:!0};function PFe(e,t){if(t===void 0)t=TFe;var n=null,r=t.connector,o=t.resetOnDisconnect,s=o===void 0?!0:o,i=r(),a=new AFe.Observable(function(c){return i.subscribe(c)});return a.connect=function(){if(!n||n.closed){if(n=OFe.defer(function(){return e}).subscribe(i),s)n.add(function(){return i=r()})}return n},a}CU.connectable=PFe});var IU=w(function(TU){Object.defineProperty(TU,"__esModule",{value:!0});TU.forkJoin=void 0;var IFe=en(),NFe=CA(),FFe=at(),MFe=Yo(),jFe=Re(),LFe=eu(),qFe=AA();function BFe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=MFe.popResultSelector(e),r=NFe.argsArgArrayOrObject(e),{args:o,keys:s}=r,i=new IFe.Observable(function(a){var c=o.length;if(!c){a.complete();return}var l=Array(c),d=c,f=c,p=function(h){var g=!1;FFe.innerFrom(o[h]).subscribe(jFe.createOperatorSubscriber(a,function(y){if(!g)g=!0,f--;l[h]=y},function(){return d--},void 0,function(){if(!d||!g){if(!f)a.next(s?qFe.createObject(s,l):l);a.complete()}}))};for(var m=0;m<c;m++)p(m)});return n?i.pipe(LFe.mapOneOrManyArgs(n)):i}TU.forkJoin=BFe});var FU=w(function(vm){var UFe=vm&&vm.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s};Object.defineProperty(vm,"__esModule",{value:!0});vm.fromEvent=void 0;var HFe=at(),VFe=en(),zFe=qc(),GFe=wx(),cf=Yt(),WFe=eu(),KFe=["addListener","removeListener"],JFe=["addEventListener","removeEventListener"],YFe=["on","off"];function OA(e,t,n,r){if(cf.isFunction(n))r=n,n=void 0;if(r)return OA(e,t,n).pipe(WFe.mapOneOrManyArgs(r));var o=UFe(ZFe(e)?JFe.map(function(a){return function(c){return e[a](t,c,n)}}):XFe(e)?KFe.map(NU(e,t)):QFe(e)?YFe.map(NU(e,t)):[],2),s=o[0],i=o[1];if(!s){if(GFe.isArrayLike(e))return zFe.mergeMap(function(a){return OA(a,t,n)})(HFe.innerFrom(e))}if(!s)throw TypeError("Invalid event target");return new VFe.Observable(function(a){var c=function(){var l=[];for(var d=0;d<arguments.length;d++)l[d]=arguments[d];return a.next(1<l.length?l:l[0])};return s(c),function(){return i(c)}})}vm.fromEvent=OA;function NU(e,t){return function(n){return function(r){return e[n](t,r)}}}function XFe(e){return cf.isFunction(e.addListener)&&cf.isFunction(e.removeListener)}function QFe(e){return cf.isFunction(e.on)&&cf.isFunction(e.off)}function ZFe(e){return cf.isFunction(e.addEventListener)&&cf.isFunction(e.removeEventListener)}});var qU=w(function(jU){Object.defineProperty(jU,"__esModule",{value:!0});jU.fromEventPattern=void 0;var e6e=en(),t6e=Yt(),n6e=eu();function MU(e,t,n){if(n)return MU(e,t).pipe(n6e.mapOneOrManyArgs(n));return new e6e.Observable(function(r){var o=function(){var i=[];for(var a=0;a<arguments.length;a++)i[a]=arguments[a];return r.next(i.length===1?i[0]:i)},s=e(o);return t6e.isFunction(t)?function(){return t(o,s)}:void 0})}jU.fromEventPattern=MU});var UU=w(function(km){var r6e=km&&km.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(d){return c([l,d])}}function c(l){if(r)throw TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(s=l[0]&2?o.return:l[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,l[1])).done)return s;if(o=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if((s=n.trys,!(s=s.length>0&&s[s.length-1]))&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}if(s[2])n.ops.pop();n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Object.defineProperty(km,"__esModule",{value:!0});km.generate=void 0;var BU=zr(),o6e=Wy(),s6e=Qy(),i6e=_A();function a6e(e,t,n,r,o){var s,i,a,c;if(arguments.length===1)s=e,c=s.initialState,t=s.condition,n=s.iterate,i=s.resultSelector,a=i===void 0?BU.identity:i,o=s.scheduler;else if(c=e,!r||o6e.isScheduler(r))a=BU.identity,o=r;else a=r;function l(){var d;return r6e(this,function(f){switch(f.label){case 0:d=c,f.label=1;case 1:if(!(!t||t(d)))return[3,4];return[4,a(d)];case 2:f.sent(),f.label=3;case 3:return d=n(d),[3,1];case 4:return[2]}})}return s6e.defer(o?function(){return i6e.scheduleIterable(l(),o)}:l)}km.generate=a6e});var zU=w(function(HU){Object.defineProperty(HU,"__esModule",{value:!0});HU.iif=void 0;var c6e=Qy();function l6e(e,t,n){return c6e.defer(function(){return e()?t:n})}HU.iif=l6e});var nu=w(function(GU){Object.defineProperty(GU,"__esModule",{value:!0});GU.timer=void 0;var u6e=en(),d6e=Jo(),f6e=Wy(),p6e=kx();function m6e(e,t,n){if(e===void 0)e=0;if(n===void 0)n=d6e.async;var r=-1;if(t!=null)if(f6e.isScheduler(t))n=t;else r=t;return new u6e.Observable(function(o){var s=p6e.isValidDate(e)?+e-n.now():e;if(s<0)s=0;var i=0;return n.schedule(function(){if(!o.closed)if(o.next(i++),0<=r)this.schedule(void 0,r);else o.complete()},s)})}GU.timer=m6e});var TA=w(function(KU){Object.defineProperty(KU,"__esModule",{value:!0});KU.interval=void 0;var h6e=Jo(),g6e=nu();function y6e(e,t){if(e===void 0)e=0;if(t===void 0)t=h6e.asyncScheduler;if(e<0)e=0;return g6e.timer(e,e,t)}KU.interval=y6e});var ZU=w(function(XU){Object.defineProperty(XU,"__esModule",{value:!0});XU.merge=void 0;var b6e=Yy(),w6e=at(),_6e=Ai(),YU=Yo(),x6e=Lc();function v6e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=YU.popScheduler(e),r=YU.popNumber(e,1/0),o=e;return!o.length?_6e.EMPTY:o.length===1?w6e.innerFrom(o[0]):b6e.mergeAll(r)(x6e.from(o,n))}XU.merge=v6e});var PA=w(function(e9){Object.defineProperty(e9,"__esModule",{value:!0});e9.never=e9.NEVER=void 0;var k6e=en(),E6e=Vr();e9.NEVER=new k6e.Observable(E6e.noop);function S6e(){return e9.NEVER}e9.never=S6e});var Em=w(function(r9){Object.defineProperty(r9,"__esModule",{value:!0});r9.argsOrArgArray=void 0;var $6e=Array.isArray;function D6e(e){return e.length===1&&$6e(e[0])?e[0]:e}r9.argsOrArgArray=D6e});var IA=w(function(i9){Object.defineProperty(i9,"__esModule",{value:!0});i9.onErrorResumeNext=void 0;var R6e=en(),C6e=Em(),A6e=Re(),s9=Vr(),O6e=at();function T6e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=C6e.argsOrArgArray(e);return new R6e.Observable(function(r){var o=0,s=function(){if(o<n.length){var i=void 0;try{i=O6e.innerFrom(n[o++])}catch(c){s();return}var a=new A6e.OperatorSubscriber(r,void 0,s9.noop,s9.noop);i.subscribe(a),a.add(s)}else r.complete()};s()})}i9.onErrorResumeNext=T6e});var u9=w(function(c9){Object.defineProperty(c9,"__esModule",{value:!0});c9.pairs=void 0;var P6e=Lc();function I6e(e,t){return P6e.from(Object.entries(e),t)}c9.pairs=I6e});var p9=w(function(d9){Object.defineProperty(d9,"__esModule",{value:!0});d9.not=void 0;function N6e(e,t){return function(n,r){return!e.call(t,n,r)}}d9.not=N6e});var lf=w(function(m9){Object.defineProperty(m9,"__esModule",{value:!0});m9.filter=void 0;var F6e=ue(),M6e=Re();function j6e(e,t){return F6e.operate(function(n,r){var o=0;n.subscribe(M6e.createOperatorSubscriber(r,function(s){return e.call(t,s,o++)&&r.next(s)}))})}m9.filter=j6e});var _9=w(function(b9){Object.defineProperty(b9,"__esModule",{value:!0});b9.partition=void 0;var L6e=p9(),g9=lf(),y9=at();function q6e(e,t,n){return[g9.filter(t,n)(y9.innerFrom(e)),g9.filter(L6e.not(t,n))(y9.innerFrom(e))]}b9.partition=q6e});var NA=w(function(k9){Object.defineProperty(k9,"__esModule",{value:!0});k9.raceInit=k9.race=void 0;var B6e=en(),x9=at(),U6e=Em(),H6e=Re();function V6e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return e=U6e.argsOrArgArray(e),e.length===1?x9.innerFrom(e[0]):new B6e.Observable(v9(e))}k9.race=V6e;function v9(e){return function(t){var n=[],r=function(s){n.push(x9.innerFrom(e[s]).subscribe(H6e.createOperatorSubscriber(t,function(i){if(n){for(var a=0;a<n.length;a++)a!==s&&n[a].unsubscribe();n=null}t.next(i)})))};for(var o=0;n&&!t.closed&&o<e.length;o++)r(o)}}k9.raceInit=v9});var D9=w(function(S9){Object.defineProperty(S9,"__esModule",{value:!0});S9.range=void 0;var G6e=en(),W6e=Ai();function K6e(e,t,n){if(t==null)t=e,e=0;if(t<=0)return W6e.EMPTY;var r=t+e;return new G6e.Observable(n?function(o){var s=e;return n.schedule(function(){if(s<r)o.next(s++),this.schedule();else o.complete()})}:function(o){var s=e;while(s<r&&!o.closed)o.next(s++);o.complete()})}S9.range=K6e});var A9=w(function(R9){Object.defineProperty(R9,"__esModule",{value:!0});R9.using=void 0;var J6e=en(),Y6e=at(),X6e=Ai();function Q6e(e,t){return new J6e.Observable(function(n){var r=e(),o=t(r),s=o?Y6e.innerFrom(o):X6e.EMPTY;return s.subscribe(n),function(){if(r)r.unsubscribe()}})}R9.using=Q6e});var Rx=w(function(ru){var Z6e=ru&&ru.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},eMe=ru&&ru.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(ru,"__esModule",{value:!0});ru.zip=void 0;var tMe=en(),nMe=at(),rMe=Em(),oMe=Ai(),sMe=Re(),iMe=Yo();function aMe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=iMe.popResultSelector(e),r=rMe.argsOrArgArray(e);return r.length?new tMe.Observable(function(o){var s=r.map(function(){return[]}),i=r.map(function(){return!1});o.add(function(){s=i=null});var a=function(l){nMe.innerFrom(r[l]).subscribe(sMe.createOperatorSubscriber(o,function(d){if(s[l].push(d),s.every(function(p){return p.length})){var f=s.map(function(p){return p.shift()});if(o.next(n?n.apply(void 0,eMe([],Z6e(f))):f),s.some(function(p,m){return!p.length&&i[m]}))o.complete()}},function(){i[l]=!0,!s[l].length&&o.complete()}))};for(var c=0;!o.closed&&c<r.length;c++)a(c);return function(){s=i=null}}):oMe.EMPTY}ru.zip=aMe});var T9=w(function(O9){Object.defineProperty(O9,"__esModule",{value:!0})});var FA=w(function(I9){Object.defineProperty(I9,"__esModule",{value:!0});I9.audit=void 0;var cMe=ue(),lMe=at(),P9=Re();function uMe(e){return cMe.operate(function(t,n){var r=!1,o=null,s=null,i=!1,a=function(){if(s===null||s===void 0||s.unsubscribe(),s=null,r){r=!1;var l=o;o=null,n.next(l)}i&&n.complete()},c=function(){s=null,i&&n.complete()};t.subscribe(P9.createOperatorSubscriber(n,function(l){if(r=!0,o=l,!s)lMe.innerFrom(e(l)).subscribe(s=P9.createOperatorSubscriber(n,a,c))},function(){i=!0,(!r||!s||s.closed)&&n.complete()}))})}I9.audit=uMe});var j9=w(function(F9){Object.defineProperty(F9,"__esModule",{value:!0});F9.auditTime=void 0;var dMe=Jo(),fMe=FA(),pMe=nu();function mMe(e,t){if(t===void 0)t=dMe.asyncScheduler;return fMe.audit(function(){return pMe.timer(e,t)})}F9.auditTime=mMe});var U9=w(function(q9){Object.defineProperty(q9,"__esModule",{value:!0});q9.buffer=void 0;var hMe=ue(),gMe=Vr(),L9=Re(),yMe=at();function bMe(e){return hMe.operate(function(t,n){var r=[];return t.subscribe(L9.createOperatorSubscriber(n,function(o){return r.push(o)},function(){n.next(r),n.complete()})),yMe.innerFrom(e).subscribe(L9.createOperatorSubscriber(n,function(){var o=r;r=[],n.next(o)},gMe.noop)),function(){r=null}})}q9.buffer=bMe});var H9=w(function(Sm){var MA=Sm&&Sm.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Sm,"__esModule",{value:!0});Sm.bufferCount=void 0;var wMe=ue(),_Me=Re(),xMe=Mc();function vMe(e,t){if(t===void 0)t=null;return t=t!==null&&t!==void 0?t:e,wMe.operate(function(n,r){var o=[],s=0;n.subscribe(_Me.createOperatorSubscriber(r,function(i){var a,c,l,d,f=null;if(s++%t===0)o.push([]);try{for(var p=MA(o),m=p.next();!m.done;m=p.next()){var h=m.value;if(h.push(i),e<=h.length)f=f!==null&&f!==void 0?f:[],f.push(h)}}catch(b){a={error:b}}finally{try{if(m&&!m.done&&(c=p.return))c.call(p)}finally{if(a)throw a.error}}if(f)try{for(var g=MA(f),y=g.next();!y.done;y=g.next()){var h=y.value;xMe.arrRemove(o,h),r.next(h)}}catch(b){l={error:b}}finally{try{if(y&&!y.done&&(d=g.return))d.call(g)}finally{if(l)throw l.error}}},function(){var i,a;try{for(var c=MA(o),l=c.next();!l.done;l=c.next()){var d=l.value;r.next(d)}}catch(f){i={error:f}}finally{try{if(l&&!l.done&&(a=c.return))a.call(c)}finally{if(i)throw i.error}}r.complete()},void 0,function(){o=null}))})}Sm.bufferCount=vMe});var z9=w(function($m){var kMe=$m&&$m.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty($m,"__esModule",{value:!0});$m.bufferTime=void 0;var EMe=xs(),SMe=ue(),$Me=Re(),DMe=Mc(),RMe=Jo(),CMe=Yo(),V9=jc();function AMe(e){var t,n,r=[];for(var o=1;o<arguments.length;o++)r[o-1]=arguments[o];var s=(t=CMe.popScheduler(r))!==null&&t!==void 0?t:RMe.asyncScheduler,i=(n=r[0])!==null&&n!==void 0?n:null,a=r[1]||1/0;return SMe.operate(function(c,l){var d=[],f=!1,p=function(g){var{buffer:y,subs:b}=g;b.unsubscribe(),DMe.arrRemove(d,g),l.next(y),f&&m()},m=function(){if(d){var g=new EMe.Subscription;l.add(g);var y=[],b={buffer:y,subs:g};d.push(b),V9.executeSchedule(g,s,function(){return p(b)},e)}};if(i!==null&&i>=0)V9.executeSchedule(l,s,m,i,!0);else f=!0;m();var h=$Me.createOperatorSubscriber(l,function(g){var y,b,_=d.slice();try{for(var x=kMe(_),k=x.next();!k.done;k=x.next()){var v=k.value,C=v.buffer;C.push(g),a<=C.length&&p(v)}}catch(T){y={error:T}}finally{try{if(k&&!k.done&&(b=x.return))b.call(x)}finally{if(y)throw y.error}}},function(){while(d===null||d===void 0?void 0:d.length)l.next(d.shift().buffer);h===null||h===void 0||h.unsubscribe(),l.complete(),l.unsubscribe()},void 0,function(){return d=null});c.subscribe(h)})}$m.bufferTime=AMe});var K9=w(function(Dm){var OMe=Dm&&Dm.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Dm,"__esModule",{value:!0});Dm.bufferToggle=void 0;var TMe=xs(),PMe=ue(),G9=at(),jA=Re(),W9=Vr(),IMe=Mc();function NMe(e,t){return PMe.operate(function(n,r){var o=[];G9.innerFrom(e).subscribe(jA.createOperatorSubscriber(r,function(s){var i=[];o.push(i);var a=new TMe.Subscription,c=function(){IMe.arrRemove(o,i),r.next(i),a.unsubscribe()};a.add(G9.innerFrom(t(s)).subscribe(jA.createOperatorSubscriber(r,c,W9.noop)))},W9.noop)),n.subscribe(jA.createOperatorSubscriber(r,function(s){var i,a;try{for(var c=OMe(o),l=c.next();!l.done;l=c.next()){var d=l.value;d.push(s)}}catch(f){i={error:f}}finally{try{if(l&&!l.done&&(a=c.return))a.call(c)}finally{if(i)throw i.error}}},function(){while(o.length>0)r.next(o.shift());r.complete()}))})}Dm.bufferToggle=NMe});var Q9=w(function(Y9){Object.defineProperty(Y9,"__esModule",{value:!0});Y9.bufferWhen=void 0;var FMe=ue(),MMe=Vr(),J9=Re(),jMe=at();function LMe(e){return FMe.operate(function(t,n){var r=null,o=null,s=function(){o===null||o===void 0||o.unsubscribe();var i=r;r=[],i&&n.next(i),jMe.innerFrom(e()).subscribe(o=J9.createOperatorSubscriber(n,s,MMe.noop))};s(),t.subscribe(J9.createOperatorSubscriber(n,function(i){return r===null||r===void 0?void 0:r.push(i)},function(){r&&n.next(r),n.complete()},void 0,function(){return r=o=null}))})}Y9.bufferWhen=LMe});var n7=w(function(e7){Object.defineProperty(e7,"__esModule",{value:!0});e7.catchError=void 0;var qMe=at(),BMe=Re(),UMe=ue();function Z9(e){return UMe.operate(function(t,n){var r=null,o=!1,s;if(r=t.subscribe(BMe.createOperatorSubscriber(n,void 0,void 0,function(i){if(s=qMe.innerFrom(e(i,Z9(e)(t))),r)r.unsubscribe(),r=null,s.subscribe(n);else o=!0})),o)r.unsubscribe(),r=null,s.subscribe(n)})}e7.catchError=Z9});var LA=w(function(r7){Object.defineProperty(r7,"__esModule",{value:!0});r7.scanInternals=void 0;var HMe=Re();function VMe(e,t,n,r,o){return function(s,i){var a=n,c=t,l=0;s.subscribe(HMe.createOperatorSubscriber(i,function(d){var f=l++;c=a?e(c,d,f):(a=!0,d),r&&i.next(c)},o&&function(){a&&i.next(c),i.complete()}))}}r7.scanInternals=VMe});var Rm=w(function(s7){Object.defineProperty(s7,"__esModule",{value:!0});s7.reduce=void 0;var zMe=LA(),GMe=ue();function WMe(e,t){return GMe.operate(zMe.scanInternals(e,t,arguments.length>=2,!1,!0))}s7.reduce=WMe});var qA=w(function(a7){Object.defineProperty(a7,"__esModule",{value:!0});a7.toArray=void 0;var KMe=Rm(),JMe=ue(),YMe=function(e,t){return e.push(t),e};function XMe(){return JMe.operate(function(e,t){KMe.reduce(YMe,[])(e).subscribe(t)})}a7.toArray=XMe});var BA=w(function(l7){Object.defineProperty(l7,"__esModule",{value:!0});l7.joinAllInternals=void 0;var QMe=zr(),ZMe=eu(),eje=zy(),tje=qc(),nje=qA();function rje(e,t){return eje.pipe(nje.toArray(),tje.mergeMap(function(n){return e(n)}),t?ZMe.mapOneOrManyArgs(t):QMe.identity)}l7.joinAllInternals=rje});var UA=w(function(d7){Object.defineProperty(d7,"__esModule",{value:!0});d7.combineLatestAll=void 0;var oje=Sx(),sje=BA();function ije(e){return sje.joinAllInternals(oje.combineLatest,e)}d7.combineLatestAll=ije});var h7=w(function(p7){Object.defineProperty(p7,"__esModule",{value:!0});p7.combineAll=void 0;var aje=UA();p7.combineAll=aje.combineLatestAll});var w7=w(function(ou){var g7=ou&&ou.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},y7=ou&&ou.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(ou,"__esModule",{value:!0});ou.combineLatest=void 0;var cje=Sx(),lje=ue(),uje=Em(),dje=eu(),fje=zy(),pje=Yo();function b7(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=pje.popResultSelector(e);return n?fje.pipe(b7.apply(void 0,y7([],g7(e))),dje.mapOneOrManyArgs(n)):lje.operate(function(r,o){cje.combineLatestInit(y7([r],g7(uje.argsOrArgArray(e))))(o)})}ou.combineLatest=b7});var _7=w(function(su){var mje=su&&su.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},hje=su&&su.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(su,"__esModule",{value:!0});su.combineLatestWith=void 0;var gje=w7();function yje(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return gje.combineLatest.apply(void 0,hje([],mje(e)))}su.combineLatestWith=yje});var HA=w(function(v7){Object.defineProperty(v7,"__esModule",{value:!0});v7.concatMap=void 0;var x7=qc(),bje=Yt();function wje(e,t){return bje.isFunction(t)?x7.mergeMap(e,t,1):x7.mergeMap(e,1)}v7.concatMap=wje});var D7=w(function(S7){Object.defineProperty(S7,"__esModule",{value:!0});S7.concatMapTo=void 0;var E7=HA(),_je=Yt();function xje(e,t){return _je.isFunction(t)?E7.concatMap(function(){return e},t):E7.concatMap(function(){return e})}S7.concatMapTo=xje});var R7=w(function(iu){var vje=iu&&iu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},kje=iu&&iu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(iu,"__esModule",{value:!0});iu.concat=void 0;var Eje=ue(),Sje=Dx(),$je=Yo(),Dje=Lc();function Rje(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=$je.popScheduler(e);return Eje.operate(function(r,o){Sje.concatAll()(Dje.from(kje([r],vje(e)),n)).subscribe(o)})}iu.concat=Rje});var C7=w(function(au){var Cje=au&&au.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},Aje=au&&au.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(au,"__esModule",{value:!0});au.concatWith=void 0;var Oje=R7();function Tje(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return Oje.concat.apply(void 0,Aje([],Cje(e)))}au.concatWith=Tje});var T7=w(function(A7){Object.defineProperty(A7,"__esModule",{value:!0});A7.fromSubscribable=void 0;var Pje=en();function Ije(e){return new Pje.Observable(function(t){return e.subscribe(t)})}A7.fromSubscribable=Ije});var Cx=w(function(P7){Object.defineProperty(P7,"__esModule",{value:!0});P7.connect=void 0;var Nje=Gr(),Fje=at(),Mje=ue(),jje=T7(),Lje={connector:function(){return new Nje.Subject}};function qje(e,t){if(t===void 0)t=Lje;var n=t.connector;return Mje.operate(function(r,o){var s=n();Fje.innerFrom(e(jje.fromSubscribable(s))).subscribe(o),o.add(r.subscribe(s))})}P7.connect=qje});var M7=w(function(N7){Object.defineProperty(N7,"__esModule",{value:!0});N7.count=void 0;var Bje=Rm();function Uje(e){return Bje.reduce(function(t,n,r){return!e||e(n,r)?t+1:t},0)}N7.count=Uje});var B7=w(function(L7){Object.defineProperty(L7,"__esModule",{value:!0});L7.debounce=void 0;var Hje=ue(),Vje=Vr(),j7=Re(),zje=at();function Gje(e){return Hje.operate(function(t,n){var r=!1,o=null,s=null,i=function(){if(s===null||s===void 0||s.unsubscribe(),s=null,r){r=!1;var a=o;o=null,n.next(a)}};t.subscribe(j7.createOperatorSubscriber(n,function(a){s===null||s===void 0||s.unsubscribe(),r=!0,o=a,s=j7.createOperatorSubscriber(n,i,Vje.noop),zje.innerFrom(e(a)).subscribe(s)},function(){i(),n.complete()},void 0,function(){o=s=null}))})}L7.debounce=Gje});var V7=w(function(U7){Object.defineProperty(U7,"__esModule",{value:!0});U7.debounceTime=void 0;var Wje=Jo(),Kje=ue(),Jje=Re();function Yje(e,t){if(t===void 0)t=Wje.asyncScheduler;return Kje.operate(function(n,r){var o=null,s=null,i=null,a=function(){if(o){o.unsubscribe(),o=null;var l=s;s=null,r.next(l)}};function c(){var l=i+e,d=t.now();if(d<l){o=this.schedule(void 0,l-d),r.add(o);return}a()}n.subscribe(Jje.createOperatorSubscriber(r,function(l){if(s=l,i=t.now(),!o)o=t.schedule(c,e),r.add(o)},function(){a(),r.complete()},void 0,function(){s=o=null}))})}U7.debounceTime=Yje});var Zy=w(function(z7){Object.defineProperty(z7,"__esModule",{value:!0});z7.defaultIfEmpty=void 0;var Xje=ue(),Qje=Re();function Zje(e){return Xje.operate(function(t,n){var r=!1;t.subscribe(Qje.createOperatorSubscriber(n,function(o){r=!0,n.next(o)},function(){if(!r)n.next(e);n.complete()}))})}z7.defaultIfEmpty=Zje});var e0=w(function(W7){Object.defineProperty(W7,"__esModule",{value:!0});W7.take=void 0;var eLe=Ai(),tLe=ue(),nLe=Re();function rLe(e){return e<=0?function(){return eLe.EMPTY}:tLe.operate(function(t,n){var r=0;t.subscribe(nLe.createOperatorSubscriber(n,function(o){if(++r<=e){if(n.next(o),e<=r)n.complete()}}))})}W7.take=rLe});var VA=w(function(J7){Object.defineProperty(J7,"__esModule",{value:!0});J7.ignoreElements=void 0;var oLe=ue(),sLe=Re(),iLe=Vr();function aLe(){return oLe.operate(function(e,t){e.subscribe(sLe.createOperatorSubscriber(t,iLe.noop))})}J7.ignoreElements=aLe});var zA=w(function(X7){Object.defineProperty(X7,"__esModule",{value:!0});X7.mapTo=void 0;var cLe=Ql();function lLe(e){return cLe.map(function(){return e})}X7.mapTo=lLe});var GA=w(function(tH){Object.defineProperty(tH,"__esModule",{value:!0});tH.delayWhen=void 0;var uLe=Xy(),Z7=e0(),dLe=VA(),fLe=zA(),pLe=qc(),mLe=at();function eH(e,t){if(t)return function(n){return uLe.concat(t.pipe(Z7.take(1),dLe.ignoreElements()),n.pipe(eH(e)))};return pLe.mergeMap(function(n,r){return mLe.innerFrom(e(n,r)).pipe(Z7.take(1),fLe.mapTo(n))})}tH.delayWhen=eH});var sH=w(function(rH){Object.defineProperty(rH,"__esModule",{value:!0});rH.delay=void 0;var hLe=Jo(),gLe=GA(),yLe=nu();function bLe(e,t){if(t===void 0)t=hLe.asyncScheduler;var n=yLe.timer(e,t);return gLe.delayWhen(function(){return n})}rH.delay=bLe});var cH=w(function(iH){Object.defineProperty(iH,"__esModule",{value:!0});iH.dematerialize=void 0;var wLe=vx(),_Le=ue(),xLe=Re();function vLe(){return _Le.operate(function(e,t){e.subscribe(xLe.createOperatorSubscriber(t,function(n){return wLe.observeNotification(n,t)}))})}iH.dematerialize=vLe});var fH=w(function(uH){Object.defineProperty(uH,"__esModule",{value:!0});uH.distinct=void 0;var kLe=ue(),lH=Re(),ELe=Vr(),SLe=at();function $Le(e,t){return kLe.operate(function(n,r){var o=new Set;n.subscribe(lH.createOperatorSubscriber(r,function(s){var i=e?e(s):s;if(!o.has(i))o.add(i),r.next(s)})),t&&SLe.innerFrom(t).subscribe(lH.createOperatorSubscriber(r,function(){return o.clear()},ELe.noop))})}uH.distinct=$Le});var WA=w(function(pH){Object.defineProperty(pH,"__esModule",{value:!0});pH.distinctUntilChanged=void 0;var DLe=zr(),RLe=ue(),CLe=Re();function ALe(e,t){if(t===void 0)t=DLe.identity;return e=e!==null&&e!==void 0?e:OLe,RLe.operate(function(n,r){var o,s=!0;n.subscribe(CLe.createOperatorSubscriber(r,function(i){var a=t(i);if(s||!e(o,a))s=!1,o=a,r.next(i)}))})}pH.distinctUntilChanged=ALe;function OLe(e,t){return e===t}});var yH=w(function(hH){Object.defineProperty(hH,"__esModule",{value:!0});hH.distinctUntilKeyChanged=void 0;var TLe=WA();function PLe(e,t){return TLe.distinctUntilChanged(function(n,r){return t?t(n[e],r[e]):n[e]===r[e]})}hH.distinctUntilKeyChanged=PLe});var t0=w(function(bH){Object.defineProperty(bH,"__esModule",{value:!0});bH.throwIfEmpty=void 0;var ILe=Xl(),NLe=ue(),FLe=Re();function MLe(e){if(e===void 0)e=jLe;return NLe.operate(function(t,n){var r=!1;t.subscribe(FLe.createOperatorSubscriber(n,function(o){r=!0,n.next(o)},function(){return r?n.complete():n.error(e())}))})}bH.throwIfEmpty=MLe;function jLe(){return new ILe.EmptyError}});var kH=w(function(xH){Object.defineProperty(xH,"__esModule",{value:!0});xH.elementAt=void 0;var _H=EA(),LLe=lf(),qLe=t0(),BLe=Zy(),ULe=e0();function HLe(e,t){if(e<0)throw new _H.ArgumentOutOfRangeError;var n=arguments.length>=2;return function(r){return r.pipe(LLe.filter(function(o,s){return s===e}),ULe.take(1),n?BLe.defaultIfEmpty(t):qLe.throwIfEmpty(function(){return new _H.ArgumentOutOfRangeError}))}}xH.elementAt=HLe});var EH=w(function(cu){var VLe=cu&&cu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},zLe=cu&&cu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(cu,"__esModule",{value:!0});cu.endWith=void 0;var GLe=Xy(),WLe=xx();function KLe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return function(n){return GLe.concat(n,WLe.of.apply(void 0,zLe([],VLe(e))))}}cu.endWith=KLe});var DH=w(function(SH){Object.defineProperty(SH,"__esModule",{value:!0});SH.every=void 0;var JLe=ue(),YLe=Re();function XLe(e,t){return JLe.operate(function(n,r){var o=0;n.subscribe(YLe.createOperatorSubscriber(r,function(s){if(!e.call(t,s,o++,n))r.next(!1),r.complete()},function(){r.next(!0),r.complete()}))})}SH.every=XLe});var KA=w(function(OH){Object.defineProperty(OH,"__esModule",{value:!0});OH.exhaustMap=void 0;var QLe=Ql(),RH=at(),ZLe=ue(),CH=Re();function AH(e,t){if(t)return function(n){return n.pipe(AH(function(r,o){return RH.innerFrom(e(r,o)).pipe(QLe.map(function(s,i){return t(r,s,o,i)}))}))};return ZLe.operate(function(n,r){var o=0,s=null,i=!1;n.subscribe(CH.createOperatorSubscriber(r,function(a){if(!s)s=CH.createOperatorSubscriber(r,void 0,function(){s=null,i&&r.complete()}),RH.innerFrom(e(a,o++)).subscribe(s)},function(){i=!0,!s&&r.complete()}))})}OH.exhaustMap=AH});var JA=w(function(PH){Object.defineProperty(PH,"__esModule",{value:!0});PH.exhaustAll=void 0;var e3e=KA(),t3e=zr();function n3e(){return e3e.exhaustMap(t3e.identity)}PH.exhaustAll=n3e});var MH=w(function(NH){Object.defineProperty(NH,"__esModule",{value:!0});NH.exhaust=void 0;var r3e=JA();NH.exhaust=r3e.exhaustAll});var qH=w(function(jH){Object.defineProperty(jH,"__esModule",{value:!0});jH.expand=void 0;var o3e=ue(),s3e=$x();function i3e(e,t,n){if(t===void 0)t=1/0;return t=(t||0)<1?1/0:t,o3e.operate(function(r,o){return s3e.mergeInternals(r,o,e,t,void 0,!0,n)})}jH.expand=i3e});var HH=w(function(BH){Object.defineProperty(BH,"__esModule",{value:!0});BH.finalize=void 0;var a3e=ue();function c3e(e){return a3e.operate(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}BH.finalize=c3e});var YA=w(function(zH){Object.defineProperty(zH,"__esModule",{value:!0});zH.createFind=zH.find=void 0;var l3e=ue(),u3e=Re();function d3e(e,t){return l3e.operate(VH(e,t,"value"))}zH.find=d3e;function VH(e,t,n){var r=n==="index";return function(o,s){var i=0;o.subscribe(u3e.createOperatorSubscriber(s,function(a){var c=i++;if(e.call(t,a,c,o))s.next(r?c:a),s.complete()},function(){s.next(r?-1:void 0),s.complete()}))}}zH.createFind=VH});var JH=w(function(WH){Object.defineProperty(WH,"__esModule",{value:!0});WH.findIndex=void 0;var p3e=ue(),m3e=YA();function h3e(e,t){return p3e.operate(m3e.createFind(e,t,"index"))}WH.findIndex=h3e});var QH=w(function(YH){Object.defineProperty(YH,"__esModule",{value:!0});YH.first=void 0;var g3e=Xl(),y3e=lf(),b3e=e0(),w3e=Zy(),_3e=t0(),x3e=zr();function v3e(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?y3e.filter(function(o,s){return e(o,s,r)}):x3e.identity,b3e.take(1),n?w3e.defaultIfEmpty(t):_3e.throwIfEmpty(function(){return new g3e.EmptyError}))}}YH.first=v3e});var nV=w(function(eV){Object.defineProperty(eV,"__esModule",{value:!0});eV.groupBy=void 0;var k3e=en(),E3e=at(),S3e=Gr(),$3e=ue(),ZH=Re();function D3e(e,t,n,r){return $3e.operate(function(o,s){var i;if(!t||typeof t==="function")i=t;else n=t.duration,i=t.element,r=t.connector;var a=new Map,c=function(h){a.forEach(h),h(s)},l=function(h){return c(function(g){return g.error(h)})},d=0,f=!1,p=new ZH.OperatorSubscriber(s,function(h){try{var g=e(h),y=a.get(g);if(!y){a.set(g,y=r?r():new S3e.Subject);var b=m(g,y);if(s.next(b),n){var _=ZH.createOperatorSubscriber(y,function(){y.complete(),_===null||_===void 0||_.unsubscribe()},void 0,void 0,function(){return a.delete(g)});p.add(E3e.innerFrom(n(b)).subscribe(_))}}y.next(i?i(h):h)}catch(x){l(x)}},function(){return c(function(h){return h.complete()})},l,function(){return a.clear()},function(){return f=!0,d===0});o.subscribe(p);function m(h,g){var y=new k3e.Observable(function(b){d++;var _=g.subscribe(b);return function(){_.unsubscribe(),--d===0&&f&&p.unsubscribe()}});return y.key=h,y}})}eV.groupBy=D3e});var sV=w(function(rV){Object.defineProperty(rV,"__esModule",{value:!0});rV.isEmpty=void 0;var R3e=ue(),C3e=Re();function A3e(){return R3e.operate(function(e,t){e.subscribe(C3e.createOperatorSubscriber(t,function(){t.next(!1),t.complete()},function(){t.next(!0),t.complete()}))})}rV.isEmpty=A3e});var XA=w(function(Cm){var O3e=Cm&&Cm.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Cm,"__esModule",{value:!0});Cm.takeLast=void 0;var T3e=Ai(),P3e=ue(),I3e=Re();function N3e(e){return e<=0?function(){return T3e.EMPTY}:P3e.operate(function(t,n){var r=[];t.subscribe(I3e.createOperatorSubscriber(n,function(o){r.push(o),e<r.length&&r.shift()},function(){var o,s;try{for(var i=O3e(r),a=i.next();!a.done;a=i.next()){var c=a.value;n.next(c)}}catch(l){o={error:l}}finally{try{if(a&&!a.done&&(s=i.return))s.call(i)}finally{if(o)throw o.error}}n.complete()},void 0,function(){r=null}))})}Cm.takeLast=N3e});var cV=w(function(iV){Object.defineProperty(iV,"__esModule",{value:!0});iV.last=void 0;var F3e=Xl(),M3e=lf(),j3e=XA(),L3e=t0(),q3e=Zy(),B3e=zr();function U3e(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?M3e.filter(function(o,s){return e(o,s,r)}):B3e.identity,j3e.takeLast(1),n?q3e.defaultIfEmpty(t):L3e.throwIfEmpty(function(){return new F3e.EmptyError}))}}iV.last=U3e});var dV=w(function(lV){Object.defineProperty(lV,"__esModule",{value:!0});lV.materialize=void 0;var QA=vx(),H3e=ue(),V3e=Re();function z3e(){return H3e.operate(function(e,t){e.subscribe(V3e.createOperatorSubscriber(t,function(n){t.next(QA.Notification.createNext(n))},function(){t.next(QA.Notification.createComplete()),t.complete()},function(n){t.next(QA.Notification.createError(n)),t.complete()}))})}lV.materialize=z3e});var mV=w(function(fV){Object.defineProperty(fV,"__esModule",{value:!0});fV.max=void 0;var G3e=Rm(),W3e=Yt();function K3e(e){return G3e.reduce(W3e.isFunction(e)?function(t,n){return e(t,n)>0?t:n}:function(t,n){return t>n?t:n})}fV.max=K3e});var yV=w(function(hV){Object.defineProperty(hV,"__esModule",{value:!0});hV.flatMap=void 0;var J3e=qc();hV.flatMap=J3e.mergeMap});var xV=w(function(wV){Object.defineProperty(wV,"__esModule",{value:!0});wV.mergeMapTo=void 0;var bV=qc(),Y3e=Yt();function X3e(e,t,n){if(n===void 0)n=1/0;if(Y3e.isFunction(t))return bV.mergeMap(function(){return e},t,n);if(typeof t==="number")n=t;return bV.mergeMap(function(){return e},n)}wV.mergeMapTo=X3e});var EV=w(function(vV){Object.defineProperty(vV,"__esModule",{value:!0});vV.mergeScan=void 0;var Q3e=ue(),Z3e=$x();function eqe(e,t,n){if(n===void 0)n=1/0;return Q3e.operate(function(r,o){var s=t;return Z3e.mergeInternals(r,o,function(i,a){return e(s,i,a)},n,function(i){s=i},!1,void 0,function(){return s=null})})}vV.mergeScan=eqe});var $V=w(function(lu){var tqe=lu&&lu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},nqe=lu&&lu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(lu,"__esModule",{value:!0});lu.merge=void 0;var rqe=ue(),oqe=Yy(),SV=Yo(),sqe=Lc();function iqe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=SV.popScheduler(e),r=SV.popNumber(e,1/0);return rqe.operate(function(o,s){oqe.mergeAll(r)(sqe.from(nqe([o],tqe(e)),n)).subscribe(s)})}lu.merge=iqe});var DV=w(function(uu){var aqe=uu&&uu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},cqe=uu&&uu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(uu,"__esModule",{value:!0});uu.mergeWith=void 0;var lqe=$V();function uqe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return lqe.merge.apply(void 0,cqe([],aqe(e)))}uu.mergeWith=uqe});var AV=w(function(RV){Object.defineProperty(RV,"__esModule",{value:!0});RV.min=void 0;var dqe=Rm(),fqe=Yt();function pqe(e){return dqe.reduce(fqe.isFunction(e)?function(t,n){return e(t,n)<0?t:n}:function(t,n){return t<n?t:n})}RV.min=pqe});var Ax=w(function(TV){Object.defineProperty(TV,"__esModule",{value:!0});TV.multicast=void 0;var mqe=Gy(),OV=Yt(),hqe=Cx();function gqe(e,t){var n=OV.isFunction(e)?e:function(){return e};if(OV.isFunction(t))return hqe.connect(t,{connector:n});return function(r){return new mqe.ConnectableObservable(r,n)}}TV.multicast=gqe});var NV=w(function(pa){var yqe=pa&&pa.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},bqe=pa&&pa.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(pa,"__esModule",{value:!0});pa.onErrorResumeNext=pa.onErrorResumeNextWith=void 0;var wqe=Em(),_qe=IA();function IV(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=wqe.argsOrArgArray(e);return function(r){return _qe.onErrorResumeNext.apply(void 0,bqe([r],yqe(n)))}}pa.onErrorResumeNextWith=IV;pa.onErrorResumeNext=IV});var jV=w(function(FV){Object.defineProperty(FV,"__esModule",{value:!0});FV.pairwise=void 0;var xqe=ue(),vqe=Re();function kqe(){return xqe.operate(function(e,t){var n,r=!1;e.subscribe(vqe.createOperatorSubscriber(t,function(o){var s=n;n=o,r&&t.next([s,o]),r=!0}))})}FV.pairwise=kqe});var BV=w(function(LV){Object.defineProperty(LV,"__esModule",{value:!0});LV.pluck=void 0;var Eqe=Ql();function Sqe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.length;if(n===0)throw Error("list of properties cannot be empty.");return Eqe.map(function(r){var o=r;for(var s=0;s<n;s++){var i=o===null||o===void 0?void 0:o[e[s]];if(typeof i<"u")o=i;else return}return o})}LV.pluck=Sqe});var VV=w(function(UV){Object.defineProperty(UV,"__esModule",{value:!0});UV.publish=void 0;var $qe=Gr(),Dqe=Ax(),Rqe=Cx();function Cqe(e){return e?function(t){return Rqe.connect(e)(t)}:function(t){return Dqe.multicast(new $qe.Subject)(t)}}UV.publish=Cqe});var WV=w(function(zV){Object.defineProperty(zV,"__esModule",{value:!0});zV.publishBehavior=void 0;var Aqe=iA(),Oqe=Gy();function Tqe(e){return function(t){var n=new Aqe.BehaviorSubject(e);return new Oqe.ConnectableObservable(t,function(){return n})}}zV.publishBehavior=Tqe});var YV=w(function(KV){Object.defineProperty(KV,"__esModule",{value:!0});KV.publishLast=void 0;var Pqe=yx(),Iqe=Gy();function Nqe(){return function(e){var t=new Pqe.AsyncSubject;return new Iqe.ConnectableObservable(e,function(){return t})}}KV.publishLast=Nqe});var ez=w(function(QV){Object.defineProperty(QV,"__esModule",{value:!0});QV.publishReplay=void 0;var Fqe=gx(),Mqe=Ax(),XV=Yt();function jqe(e,t,n,r){if(n&&!XV.isFunction(n))r=n;var o=XV.isFunction(n)?n:void 0;return function(s){return Mqe.multicast(new Fqe.ReplaySubject(e,t,r),o)(s)}}QV.publishReplay=jqe});var tz=w(function(du){var Lqe=du&&du.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},qqe=du&&du.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(du,"__esModule",{value:!0});du.raceWith=void 0;var Bqe=NA(),Uqe=ue(),Hqe=zr();function Vqe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return!e.length?Hqe.identity:Uqe.operate(function(n,r){Bqe.raceInit(qqe([n],Lqe(e)))(r)})}du.raceWith=Vqe});var sz=w(function(rz){Object.defineProperty(rz,"__esModule",{value:!0});rz.repeat=void 0;var zqe=Ai(),Gqe=ue(),nz=Re(),Wqe=at(),Kqe=nu();function Jqe(e){var t,n=1/0,r;if(e!=null)if(typeof e==="object")t=e.count,n=t===void 0?1/0:t,r=e.delay;else n=e;return n<=0?function(){return zqe.EMPTY}:Gqe.operate(function(o,s){var i=0,a,c=function(){if(a===null||a===void 0||a.unsubscribe(),a=null,r!=null){var d=typeof r==="number"?Kqe.timer(r):Wqe.innerFrom(r(i)),f=nz.createOperatorSubscriber(s,function(){f.unsubscribe(),l()});d.subscribe(f)}else l()},l=function(){var d=!1;if(a=o.subscribe(nz.createOperatorSubscriber(s,void 0,function(){if(++i<n)if(a)c();else d=!0;else s.complete()})),d)c()};l()})}rz.repeat=Jqe});var lz=w(function(az){Object.defineProperty(az,"__esModule",{value:!0});az.repeatWhen=void 0;var Yqe=at(),Xqe=Gr(),Qqe=ue(),iz=Re();function Zqe(e){return Qqe.operate(function(t,n){var r,o=!1,s,i=!1,a=!1,c=function(){return a&&i&&(n.complete(),!0)},l=function(){if(!s)s=new Xqe.Subject,Yqe.innerFrom(e(s)).subscribe(iz.createOperatorSubscriber(n,function(){if(r)d();else o=!0},function(){i=!0,c()}));return s},d=function(){if(a=!1,r=t.subscribe(iz.createOperatorSubscriber(n,void 0,function(){a=!0,!c()&&l().next()})),o)r.unsubscribe(),r=null,o=!1,d()};d()})}az.repeatWhen=Zqe});var pz=w(function(dz){Object.defineProperty(dz,"__esModule",{value:!0});dz.retry=void 0;var e4e=ue(),uz=Re(),t4e=zr(),n4e=nu(),r4e=at();function o4e(e){if(e===void 0)e=1/0;var t;if(e&&typeof e==="object")t=e;else t={count:e};var n=t.count,r=n===void 0?1/0:n,o=t.delay,s=t.resetOnSuccess,i=s===void 0?!1:s;return r<=0?t4e.identity:e4e.operate(function(a,c){var l=0,d,f=function(){var p=!1;if(d=a.subscribe(uz.createOperatorSubscriber(c,function(m){if(i)l=0;c.next(m)},void 0,function(m){if(l++<r){var h=function(){if(d)d.unsubscribe(),d=null,f();else p=!0};if(o!=null){var g=typeof o==="number"?n4e.timer(o):r4e.innerFrom(o(m,l)),y=uz.createOperatorSubscriber(c,function(){y.unsubscribe(),h()},function(){c.complete()});g.subscribe(y)}else h()}else c.error(m)})),p)d.unsubscribe(),d=null,f()};f()})}dz.retry=o4e});var yz=w(function(hz){Object.defineProperty(hz,"__esModule",{value:!0});hz.retryWhen=void 0;var s4e=at(),i4e=Gr(),a4e=ue(),mz=Re();function c4e(e){return a4e.operate(function(t,n){var r,o=!1,s,i=function(){if(r=t.subscribe(mz.createOperatorSubscriber(n,void 0,void 0,function(a){if(!s)s=new i4e.Subject,s4e.innerFrom(e(s)).subscribe(mz.createOperatorSubscriber(n,function(){return r?i():o=!0}));if(s)s.next(a)})),o)r.unsubscribe(),r=null,o=!1,i()};i()})}hz.retryWhen=c4e});var ZA=w(function(wz){Object.defineProperty(wz,"__esModule",{value:!0});wz.sample=void 0;var l4e=at(),u4e=ue(),d4e=Vr(),bz=Re();function f4e(e){return u4e.operate(function(t,n){var r=!1,o=null;t.subscribe(bz.createOperatorSubscriber(n,function(s){r=!0,o=s})),l4e.innerFrom(e).subscribe(bz.createOperatorSubscriber(n,function(){if(r){r=!1;var s=o;o=null,n.next(s)}},d4e.noop))})}wz.sample=f4e});var kz=w(function(xz){Object.defineProperty(xz,"__esModule",{value:!0});xz.sampleTime=void 0;var p4e=Jo(),m4e=ZA(),h4e=TA();function g4e(e,t){if(t===void 0)t=p4e.asyncScheduler;return m4e.sample(h4e.interval(e,t))}xz.sampleTime=g4e});var $z=w(function(Ez){Object.defineProperty(Ez,"__esModule",{value:!0});Ez.scan=void 0;var y4e=ue(),b4e=LA();function w4e(e,t){return y4e.operate(b4e.scanInternals(e,t,arguments.length>=2,!0))}Ez.scan=w4e});var Az=w(function(Rz){Object.defineProperty(Rz,"__esModule",{value:!0});Rz.sequenceEqual=void 0;var _4e=ue(),x4e=Re(),v4e=at();function k4e(e,t){if(t===void 0)t=function(n,r){return n===r};return _4e.operate(function(n,r){var o=Dz(),s=Dz(),i=function(c){r.next(c),r.complete()},a=function(c,l){var d=x4e.createOperatorSubscriber(r,function(f){var{buffer:p,complete:m}=l;if(p.length===0)m?i(!1):c.buffer.push(f);else!t(f,p.shift())&&i(!1)},function(){c.complete=!0;var{complete:f,buffer:p}=l;f&&i(p.length===0),d===null||d===void 0||d.unsubscribe()});return d};n.subscribe(a(o,s)),v4e.innerFrom(e).subscribe(a(s,o))})}Rz.sequenceEqual=k4e;function Dz(){return{buffer:[],complete:!1}}});var t2=w(function(fu){var E4e=fu&&fu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},S4e=fu&&fu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(fu,"__esModule",{value:!0});fu.share=void 0;var Oz=at(),$4e=Gr(),Tz=om(),D4e=ue();function R4e(e){if(e===void 0)e={};var t=e.connector,n=t===void 0?function(){return new $4e.Subject}:t,r=e.resetOnError,o=r===void 0?!0:r,s=e.resetOnComplete,i=s===void 0?!0:s,a=e.resetOnRefCountZero,c=a===void 0?!0:a;return function(l){var d,f,p,m=0,h=!1,g=!1,y=function(){f===null||f===void 0||f.unsubscribe(),f=void 0},b=function(){y(),d=p=void 0,h=g=!1},_=function(){var x=d;b(),x===null||x===void 0||x.unsubscribe()};return D4e.operate(function(x,k){if(m++,!g&&!h)y();var v=p=p!==null&&p!==void 0?p:n();if(k.add(function(){if(m--,m===0&&!g&&!h)f=e2(_,c)}),v.subscribe(k),!d&&m>0)d=new Tz.SafeSubscriber({next:function(C){return v.next(C)},error:function(C){g=!0,y(),f=e2(b,o,C),v.error(C)},complete:function(){h=!0,y(),f=e2(b,i),v.complete()}}),Oz.innerFrom(x).subscribe(d)})(l)}}fu.share=R4e;function e2(e,t){var n=[];for(var r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t===!1)return;var o=new Tz.SafeSubscriber({next:function(){o.unsubscribe(),e()}});return Oz.innerFrom(t.apply(void 0,S4e([],E4e(n)))).subscribe(o)}});var Nz=w(function(Pz){Object.defineProperty(Pz,"__esModule",{value:!0});Pz.shareReplay=void 0;var C4e=gx(),A4e=t2();function O4e(e,t,n){var r,o,s,i,a=!1;if(e&&typeof e==="object")r=e.bufferSize,i=r===void 0?1/0:r,o=e.windowTime,t=o===void 0?1/0:o,s=e.refCount,a=s===void 0?!1:s,n=e.scheduler;else i=e!==null&&e!==void 0?e:1/0;return A4e.share({connector:function(){return new C4e.ReplaySubject(i,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}Pz.shareReplay=O4e});var jz=w(function(Fz){Object.defineProperty(Fz,"__esModule",{value:!0});Fz.single=void 0;var T4e=Xl(),P4e=$A(),I4e=SA(),N4e=ue(),F4e=Re();function M4e(e){return N4e.operate(function(t,n){var r=!1,o,s=!1,i=0;t.subscribe(F4e.createOperatorSubscriber(n,function(a){if(s=!0,!e||e(a,i++,t))r&&n.error(new P4e.SequenceError("Too many matching values")),r=!0,o=a},function(){if(r)n.next(o),n.complete();else n.error(s?new I4e.NotFoundError("No matching values"):new T4e.EmptyError)}))})}Fz.single=M4e});var Bz=w(function(Lz){Object.defineProperty(Lz,"__esModule",{value:!0});Lz.skip=void 0;var j4e=lf();function L4e(e){return j4e.filter(function(t,n){return e<=n})}Lz.skip=L4e});var Vz=w(function(Uz){Object.defineProperty(Uz,"__esModule",{value:!0});Uz.skipLast=void 0;var q4e=zr(),B4e=ue(),U4e=Re();function H4e(e){return e<=0?q4e.identity:B4e.operate(function(t,n){var r=Array(e),o=0;return t.subscribe(U4e.createOperatorSubscriber(n,function(s){var i=o++;if(i<e)r[i]=s;else{var a=i%e,c=r[a];r[a]=s,n.next(c)}})),function(){r=null}})}Uz.skipLast=H4e});var Kz=w(function(Gz){Object.defineProperty(Gz,"__esModule",{value:!0});Gz.skipUntil=void 0;var V4e=ue(),zz=Re(),z4e=at(),G4e=Vr();function W4e(e){return V4e.operate(function(t,n){var r=!1,o=zz.createOperatorSubscriber(n,function(){o===null||o===void 0||o.unsubscribe(),r=!0},G4e.noop);z4e.innerFrom(e).subscribe(o),t.subscribe(zz.createOperatorSubscriber(n,function(s){return r&&n.next(s)}))})}Gz.skipUntil=W4e});var Xz=w(function(Jz){Object.defineProperty(Jz,"__esModule",{value:!0});Jz.skipWhile=void 0;var K4e=ue(),J4e=Re();function Y4e(e){return K4e.operate(function(t,n){var r=!1,o=0;t.subscribe(J4e.createOperatorSubscriber(n,function(s){return(r||(r=!e(s,o++)))&&n.next(s)}))})}Jz.skipWhile=Y4e});var tG=w(function(Zz){Object.defineProperty(Zz,"__esModule",{value:!0});Zz.startWith=void 0;var Qz=Xy(),X4e=Yo(),Q4e=ue();function Z4e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=X4e.popScheduler(e);return Q4e.operate(function(r,o){(n?Qz.concat(e,r,n):Qz.concat(e,r)).subscribe(o)})}Zz.startWith=Z4e});var n0=w(function(rG){Object.defineProperty(rG,"__esModule",{value:!0});rG.switchMap=void 0;var e8e=at(),t8e=ue(),nG=Re();function n8e(e,t){return t8e.operate(function(n,r){var o=null,s=0,i=!1,a=function(){return i&&!o&&r.complete()};n.subscribe(nG.createOperatorSubscriber(r,function(c){o===null||o===void 0||o.unsubscribe();var l=0,d=s++;e8e.innerFrom(e(c,d)).subscribe(o=nG.createOperatorSubscriber(r,function(f){return r.next(t?t(c,f,d,l++):f)},function(){o=null,a()}))},function(){i=!0,a()}))})}rG.switchMap=n8e});var aG=w(function(sG){Object.defineProperty(sG,"__esModule",{value:!0});sG.switchAll=void 0;var r8e=n0(),o8e=zr();function s8e(){return r8e.switchMap(o8e.identity)}sG.switchAll=s8e});var dG=w(function(lG){Object.defineProperty(lG,"__esModule",{value:!0});lG.switchMapTo=void 0;var cG=n0(),i8e=Yt();function a8e(e,t){return i8e.isFunction(t)?cG.switchMap(function(){return e},t):cG.switchMap(function(){return e})}lG.switchMapTo=a8e});var mG=w(function(fG){Object.defineProperty(fG,"__esModule",{value:!0});fG.switchScan=void 0;var c8e=n0(),l8e=ue();function u8e(e,t){return l8e.operate(function(n,r){var o=t;return c8e.switchMap(function(s,i){return e(o,s,i)},function(s,i){return o=i,i})(n).subscribe(r),function(){o=null}})}fG.switchScan=u8e});var yG=w(function(hG){Object.defineProperty(hG,"__esModule",{value:!0});hG.takeUntil=void 0;var d8e=ue(),f8e=Re(),p8e=at(),m8e=Vr();function h8e(e){return d8e.operate(function(t,n){p8e.innerFrom(e).subscribe(f8e.createOperatorSubscriber(n,function(){return n.complete()},m8e.noop)),!n.closed&&t.subscribe(n)})}hG.takeUntil=h8e});var _G=w(function(bG){Object.defineProperty(bG,"__esModule",{value:!0});bG.takeWhile=void 0;var g8e=ue(),y8e=Re();function b8e(e,t){if(t===void 0)t=!1;return g8e.operate(function(n,r){var o=0;n.subscribe(y8e.createOperatorSubscriber(r,function(s){var i=e(s,o++);(i||t)&&r.next(s),!i&&r.complete()}))})}bG.takeWhile=b8e});var kG=w(function(xG){Object.defineProperty(xG,"__esModule",{value:!0});xG.tap=void 0;var w8e=Yt(),_8e=ue(),x8e=Re(),v8e=zr();function k8e(e,t,n){var r=w8e.isFunction(e)||t||n?{next:e,error:t,complete:n}:e;return r?_8e.operate(function(o,s){var i;(i=r.subscribe)===null||i===void 0||i.call(r);var a=!0;o.subscribe(x8e.createOperatorSubscriber(s,function(c){var l;(l=r.next)===null||l===void 0||l.call(r,c),s.next(c)},function(){var c;a=!1,(c=r.complete)===null||c===void 0||c.call(r),s.complete()},function(c){var l;a=!1,(l=r.error)===null||l===void 0||l.call(r,c),s.error(c)},function(){var c,l;if(a)(c=r.unsubscribe)===null||c===void 0||c.call(r);(l=r.finalize)===null||l===void 0||l.call(r)}))}):v8e.identity}xG.tap=k8e});var n2=w(function(SG){Object.defineProperty(SG,"__esModule",{value:!0});SG.throttle=void 0;var E8e=ue(),EG=Re(),S8e=at();function $8e(e,t){return E8e.operate(function(n,r){var o=t!==null&&t!==void 0?t:{},s=o.leading,i=s===void 0?!0:s,a=o.trailing,c=a===void 0?!1:a,l=!1,d=null,f=null,p=!1,m=function(){if(f===null||f===void 0||f.unsubscribe(),f=null,c)y(),p&&r.complete()},h=function(){f=null,p&&r.complete()},g=function(b){return f=S8e.innerFrom(e(b)).subscribe(EG.createOperatorSubscriber(r,m,h))},y=function(){if(l){l=!1;var b=d;d=null,r.next(b),!p&&g(b)}};n.subscribe(EG.createOperatorSubscriber(r,function(b){l=!0,d=b,!(f&&!f.closed)&&(i?y():g(b))},function(){p=!0,!(c&&l&&f&&!f.closed)&&r.complete()}))})}SG.throttle=$8e});var CG=w(function(DG){Object.defineProperty(DG,"__esModule",{value:!0});DG.throttleTime=void 0;var D8e=Jo(),R8e=n2(),C8e=nu();function A8e(e,t,n){if(t===void 0)t=D8e.asyncScheduler;var r=C8e.timer(e,t);return R8e.throttle(function(){return r},n)}DG.throttleTime=A8e});var PG=w(function(OG){Object.defineProperty(OG,"__esModule",{value:!0});OG.TimeInterval=OG.timeInterval=void 0;var O8e=Jo(),T8e=ue(),P8e=Re();function I8e(e){if(e===void 0)e=O8e.asyncScheduler;return T8e.operate(function(t,n){var r=e.now();t.subscribe(P8e.createOperatorSubscriber(n,function(o){var s=e.now(),i=s-r;r=s,n.next(new AG(o,i))}))})}OG.timeInterval=I8e;var AG=function(){function e(t,n){this.value=t,this.interval=n}return e}();OG.TimeInterval=AG});var FG=w(function(IG){Object.defineProperty(IG,"__esModule",{value:!0});IG.timeoutWith=void 0;var F8e=Jo(),M8e=kx(),j8e=Ex();function L8e(e,t,n){var r,o,s;if(n=n!==null&&n!==void 0?n:F8e.async,M8e.isValidDate(e))r=e;else if(typeof e==="number")o=e;if(t)s=function(){return t};else throw TypeError("No observable provided to switch to");if(r==null&&o==null)throw TypeError("No timeout provided.");return j8e.timeout({first:r,each:o,scheduler:n,with:s})}IG.timeoutWith=L8e});var LG=w(function(MG){Object.defineProperty(MG,"__esModule",{value:!0});MG.timestamp=void 0;var q8e=hx(),B8e=Ql();function U8e(e){if(e===void 0)e=q8e.dateTimestampProvider;return B8e.map(function(t){return{value:t,timestamp:e.now()}})}MG.timestamp=U8e});var VG=w(function(UG){Object.defineProperty(UG,"__esModule",{value:!0});UG.window=void 0;var qG=Gr(),H8e=ue(),BG=Re(),V8e=Vr(),z8e=at();function G8e(e){return H8e.operate(function(t,n){var r=new qG.Subject;n.next(r.asObservable());var o=function(s){r.error(s),n.error(s)};return t.subscribe(BG.createOperatorSubscriber(n,function(s){return r===null||r===void 0?void 0:r.next(s)},function(){r.complete(),n.complete()},o)),z8e.innerFrom(e).subscribe(BG.createOperatorSubscriber(n,function(){r.complete(),n.next(r=new qG.Subject)},V8e.noop,o)),function(){r===null||r===void 0||r.unsubscribe(),r=null}})}UG.window=G8e});var GG=w(function(Am){var W8e=Am&&Am.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Am,"__esModule",{value:!0});Am.windowCount=void 0;var zG=Gr(),K8e=ue(),J8e=Re();function Y8e(e,t){if(t===void 0)t=0;var n=t>0?t:e;return K8e.operate(function(r,o){var s=[new zG.Subject],i=[],a=0;o.next(s[0].asObservable()),r.subscribe(J8e.createOperatorSubscriber(o,function(c){var l,d;try{for(var f=W8e(s),p=f.next();!p.done;p=f.next()){var m=p.value;m.next(c)}}catch(y){l={error:y}}finally{try{if(p&&!p.done&&(d=f.return))d.call(f)}finally{if(l)throw l.error}}var h=a-e+1;if(h>=0&&h%n===0)s.shift().complete();if(++a%n===0){var g=new zG.Subject;s.push(g),o.next(g.asObservable())}},function(){while(s.length>0)s.shift().complete();o.complete()},function(c){while(s.length>0)s.shift().error(c);o.error(c)},function(){i=null,s=null}))})}Am.windowCount=Y8e});var YG=w(function(KG){Object.defineProperty(KG,"__esModule",{value:!0});KG.windowTime=void 0;var X8e=Gr(),Q8e=Jo(),Z8e=xs(),eBe=ue(),tBe=Re(),nBe=Mc(),rBe=Yo(),WG=jc();function oBe(e){var t,n,r=[];for(var o=1;o<arguments.length;o++)r[o-1]=arguments[o];var s=(t=rBe.popScheduler(r))!==null&&t!==void 0?t:Q8e.asyncScheduler,i=(n=r[0])!==null&&n!==void 0?n:null,a=r[1]||1/0;return eBe.operate(function(c,l){var d=[],f=!1,p=function(y){var{window:b,subs:_}=y;b.complete(),_.unsubscribe(),nBe.arrRemove(d,y),f&&m()},m=function(){if(d){var y=new Z8e.Subscription;l.add(y);var b=new X8e.Subject,_={window:b,subs:y,seen:0};d.push(_),l.next(b.asObservable()),WG.executeSchedule(y,s,function(){return p(_)},e)}};if(i!==null&&i>=0)WG.executeSchedule(l,s,m,i,!0);else f=!0;m();var h=function(y){return d.slice().forEach(y)},g=function(y){h(function(b){var _=b.window;return y(_)}),y(l),l.unsubscribe()};return c.subscribe(tBe.createOperatorSubscriber(l,function(y){h(function(b){b.window.next(y),a<=++b.seen&&p(b)})},function(){return g(function(y){return y.complete()})},function(y){return g(function(b){return b.error(y)})})),function(){d=null}})}KG.windowTime=oBe});var ZG=w(function(Om){var sBe=Om&&Om.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Om,"__esModule",{value:!0});Om.windowToggle=void 0;var iBe=Gr(),aBe=xs(),cBe=ue(),XG=at(),r2=Re(),QG=Vr(),lBe=Mc();function uBe(e,t){return cBe.operate(function(n,r){var o=[],s=function(i){while(0<o.length)o.shift().error(i);r.error(i)};XG.innerFrom(e).subscribe(r2.createOperatorSubscriber(r,function(i){var a=new iBe.Subject;o.push(a);var c=new aBe.Subscription,l=function(){lBe.arrRemove(o,a),a.complete(),c.unsubscribe()},d;try{d=XG.innerFrom(t(i))}catch(f){s(f);return}r.next(a.asObservable()),c.add(d.subscribe(r2.createOperatorSubscriber(r,l,QG.noop,s)))},QG.noop)),n.subscribe(r2.createOperatorSubscriber(r,function(i){var a,c,l=o.slice();try{for(var d=sBe(l),f=d.next();!f.done;f=d.next()){var p=f.value;p.next(i)}}catch(m){a={error:m}}finally{try{if(f&&!f.done&&(c=d.return))c.call(d)}finally{if(a)throw a.error}}},function(){while(0<o.length)o.shift().complete();r.complete()},s,function(){while(0<o.length)o.shift().unsubscribe()}))})}Om.windowToggle=uBe});var rW=w(function(tW){Object.defineProperty(tW,"__esModule",{value:!0});tW.windowWhen=void 0;var dBe=Gr(),fBe=ue(),eW=Re(),pBe=at();function mBe(e){return fBe.operate(function(t,n){var r,o,s=function(a){r.error(a),n.error(a)},i=function(){o===null||o===void 0||o.unsubscribe(),r===null||r===void 0||r.complete(),r=new dBe.Subject,n.next(r.asObservable());var a;try{a=pBe.innerFrom(e())}catch(c){s(c);return}a.subscribe(o=eW.createOperatorSubscriber(n,i,i,s))};i(),t.subscribe(eW.createOperatorSubscriber(n,function(a){return r.next(a)},function(){r.complete(),n.complete()},s,function(){o===null||o===void 0||o.unsubscribe(),r=null}))})}tW.windowWhen=mBe});var aW=w(function(pu){var oW=pu&&pu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},sW=pu&&pu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(pu,"__esModule",{value:!0});pu.withLatestFrom=void 0;var hBe=ue(),iW=Re(),gBe=at(),yBe=zr(),bBe=Vr(),wBe=Yo();function _Be(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=wBe.popResultSelector(e);return hBe.operate(function(r,o){var s=e.length,i=Array(s),a=e.map(function(){return!1}),c=!1,l=function(f){gBe.innerFrom(e[f]).subscribe(iW.createOperatorSubscriber(o,function(p){if(i[f]=p,!c&&!a[f])a[f]=!0,(c=a.every(yBe.identity))&&(a=null)},bBe.noop))};for(var d=0;d<s;d++)l(d);r.subscribe(iW.createOperatorSubscriber(o,function(f){if(c){var p=sW([f],oW(i));o.next(n?n.apply(void 0,sW([],oW(p))):p)}}))})}pu.withLatestFrom=_Be});var uW=w(function(cW){Object.defineProperty(cW,"__esModule",{value:!0});cW.zipAll=void 0;var xBe=Rx(),vBe=BA();function kBe(e){return vBe.joinAllInternals(xBe.zip,e)}cW.zipAll=kBe});var dW=w(function(mu){var EBe=mu&&mu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},SBe=mu&&mu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(mu,"__esModule",{value:!0});mu.zip=void 0;var $Be=Rx(),DBe=ue();function RBe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return DBe.operate(function(n,r){$Be.zip.apply(void 0,SBe([n],EBe(e))).subscribe(r)})}mu.zip=RBe});var fW=w(function(hu){var CBe=hu&&hu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},ABe=hu&&hu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(hu,"__esModule",{value:!0});hu.zipWith=void 0;var OBe=dW();function TBe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return OBe.zip.apply(void 0,ABe([],CBe(e)))}hu.zipWith=TBe});var vs=w(function(E){var PBe=E&&E.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),IBe=E&&E.__exportStar||function(e,t){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n))PBe(t,e,n)};Object.defineProperty(E,"__esModule",{value:!0});E.interval=E.iif=E.generate=E.fromEventPattern=E.fromEvent=E.from=E.forkJoin=E.empty=E.defer=E.connectable=E.concat=E.combineLatest=E.bindNodeCallback=E.bindCallback=E.UnsubscriptionError=E.TimeoutError=E.SequenceError=E.ObjectUnsubscribedError=E.NotFoundError=E.EmptyError=E.ArgumentOutOfRangeError=E.firstValueFrom=E.lastValueFrom=E.isObservable=E.identity=E.noop=E.pipe=E.NotificationKind=E.Notification=E.Subscriber=E.Subscription=E.Scheduler=E.VirtualAction=E.VirtualTimeScheduler=E.animationFrameScheduler=E.animationFrame=E.queueScheduler=E.queue=E.asyncScheduler=E.async=E.asapScheduler=E.asap=E.AsyncSubject=E.ReplaySubject=E.BehaviorSubject=E.Subject=E.animationFrames=E.observable=E.ConnectableObservable=E.Observable=void 0;E.filter=E.expand=E.exhaustMap=E.exhaustAll=E.exhaust=E.every=E.endWith=E.elementAt=E.distinctUntilKeyChanged=E.distinctUntilChanged=E.distinct=E.dematerialize=E.delayWhen=E.delay=E.defaultIfEmpty=E.debounceTime=E.debounce=E.count=E.connect=E.concatWith=E.concatMapTo=E.concatMap=E.concatAll=E.combineLatestWith=E.combineLatestAll=E.combineAll=E.catchError=E.bufferWhen=E.bufferToggle=E.bufferTime=E.bufferCount=E.buffer=E.auditTime=E.audit=E.config=E.NEVER=E.EMPTY=E.scheduled=E.zip=E.using=E.timer=E.throwError=E.range=E.race=E.partition=E.pairs=E.onErrorResumeNext=E.of=E.never=E.merge=void 0;E.switchMap=E.switchAll=E.subscribeOn=E.startWith=E.skipWhile=E.skipUntil=E.skipLast=E.skip=E.single=E.shareReplay=E.share=E.sequenceEqual=E.scan=E.sampleTime=E.sample=E.refCount=E.retryWhen=E.retry=E.repeatWhen=E.repeat=E.reduce=E.raceWith=E.publishReplay=E.publishLast=E.publishBehavior=E.publish=E.pluck=E.pairwise=E.onErrorResumeNextWith=E.observeOn=E.multicast=E.min=E.mergeWith=E.mergeScan=E.mergeMapTo=E.mergeMap=E.flatMap=E.mergeAll=E.max=E.materialize=E.mapTo=E.map=E.last=E.isEmpty=E.ignoreElements=E.groupBy=E.first=E.findIndex=E.find=E.finalize=void 0;E.zipWith=E.zipAll=E.withLatestFrom=E.windowWhen=E.windowToggle=E.windowTime=E.windowCount=E.window=E.toArray=E.timestamp=E.timeoutWith=E.timeout=E.timeInterval=E.throwIfEmpty=E.throttleTime=E.throttle=E.tap=E.takeWhile=E.takeUntil=E.takeLast=E.take=E.switchScan=E.switchMapTo=void 0;var NBe=en();Object.defineProperty(E,"Observable",{enumerable:!0,get:function(){return NBe.Observable}});var FBe=Gy();Object.defineProperty(E,"ConnectableObservable",{enumerable:!0,get:function(){return FBe.ConnectableObservable}});var MBe=Vy();Object.defineProperty(E,"observable",{enumerable:!0,get:function(){return MBe.observable}});var jBe=v8();Object.defineProperty(E,"animationFrames",{enumerable:!0,get:function(){return jBe.animationFrames}});var LBe=Gr();Object.defineProperty(E,"Subject",{enumerable:!0,get:function(){return LBe.Subject}});var qBe=iA();Object.defineProperty(E,"BehaviorSubject",{enumerable:!0,get:function(){return qBe.BehaviorSubject}});var BBe=gx();Object.defineProperty(E,"ReplaySubject",{enumerable:!0,get:function(){return BBe.ReplaySubject}});var UBe=yx();Object.defineProperty(E,"AsyncSubject",{enumerable:!0,get:function(){return UBe.AsyncSubject}});var pW=J8();Object.defineProperty(E,"asap",{enumerable:!0,get:function(){return pW.asap}});Object.defineProperty(E,"asapScheduler",{enumerable:!0,get:function(){return pW.asapScheduler}});var mW=Jo();Object.defineProperty(E,"async",{enumerable:!0,get:function(){return mW.async}});Object.defineProperty(E,"asyncScheduler",{enumerable:!0,get:function(){return mW.asyncScheduler}});var hW=oB();Object.defineProperty(E,"queue",{enumerable:!0,get:function(){return hW.queue}});Object.defineProperty(E,"queueScheduler",{enumerable:!0,get:function(){return hW.queueScheduler}});var gW=dB();Object.defineProperty(E,"animationFrame",{enumerable:!0,get:function(){return gW.animationFrame}});Object.defineProperty(E,"animationFrameScheduler",{enumerable:!0,get:function(){return gW.animationFrameScheduler}});var yW=mB();Object.defineProperty(E,"VirtualTimeScheduler",{enumerable:!0,get:function(){return yW.VirtualTimeScheduler}});Object.defineProperty(E,"VirtualAction",{enumerable:!0,get:function(){return yW.VirtualAction}});var HBe=lA();Object.defineProperty(E,"Scheduler",{enumerable:!0,get:function(){return HBe.Scheduler}});var VBe=xs();Object.defineProperty(E,"Subscription",{enumerable:!0,get:function(){return VBe.Subscription}});var zBe=om();Object.defineProperty(E,"Subscriber",{enumerable:!0,get:function(){return zBe.Subscriber}});var bW=vx();Object.defineProperty(E,"Notification",{enumerable:!0,get:function(){return bW.Notification}});Object.defineProperty(E,"NotificationKind",{enumerable:!0,get:function(){return bW.NotificationKind}});var GBe=zy();Object.defineProperty(E,"pipe",{enumerable:!0,get:function(){return GBe.pipe}});var WBe=Vr();Object.defineProperty(E,"noop",{enumerable:!0,get:function(){return WBe.noop}});var KBe=zr();Object.defineProperty(E,"identity",{enumerable:!0,get:function(){return KBe.identity}});var JBe=C5();Object.defineProperty(E,"isObservable",{enumerable:!0,get:function(){return JBe.isObservable}});var YBe=I5();Object.defineProperty(E,"lastValueFrom",{enumerable:!0,get:function(){return YBe.lastValueFrom}});var XBe=M5();Object.defineProperty(E,"firstValueFrom",{enumerable:!0,get:function(){return XBe.firstValueFrom}});var QBe=EA();Object.defineProperty(E,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return QBe.ArgumentOutOfRangeError}});var ZBe=Xl();Object.defineProperty(E,"EmptyError",{enumerable:!0,get:function(){return ZBe.EmptyError}});var e5e=SA();Object.defineProperty(E,"NotFoundError",{enumerable:!0,get:function(){return e5e.NotFoundError}});var t5e=nA();Object.defineProperty(E,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return t5e.ObjectUnsubscribedError}});var n5e=$A();Object.defineProperty(E,"SequenceError",{enumerable:!0,get:function(){return n5e.SequenceError}});var r5e=Ex();Object.defineProperty(E,"TimeoutError",{enumerable:!0,get:function(){return r5e.TimeoutError}});var o5e=UC();Object.defineProperty(E,"UnsubscriptionError",{enumerable:!0,get:function(){return o5e.UnsubscriptionError}});var s5e=eU();Object.defineProperty(E,"bindCallback",{enumerable:!0,get:function(){return s5e.bindCallback}});var i5e=rU();Object.defineProperty(E,"bindNodeCallback",{enumerable:!0,get:function(){return i5e.bindNodeCallback}});var a5e=Sx();Object.defineProperty(E,"combineLatest",{enumerable:!0,get:function(){return a5e.combineLatest}});var c5e=Xy();Object.defineProperty(E,"concat",{enumerable:!0,get:function(){return c5e.concat}});var l5e=OU();Object.defineProperty(E,"connectable",{enumerable:!0,get:function(){return l5e.connectable}});var u5e=Qy();Object.defineProperty(E,"defer",{enumerable:!0,get:function(){return u5e.defer}});var d5e=Ai();Object.defineProperty(E,"empty",{enumerable:!0,get:function(){return d5e.empty}});var f5e=IU();Object.defineProperty(E,"forkJoin",{enumerable:!0,get:function(){return f5e.forkJoin}});var p5e=Lc();Object.defineProperty(E,"from",{enumerable:!0,get:function(){return p5e.from}});var m5e=FU();Object.defineProperty(E,"fromEvent",{enumerable:!0,get:function(){return m5e.fromEvent}});var h5e=qU();Object.defineProperty(E,"fromEventPattern",{enumerable:!0,get:function(){return h5e.fromEventPattern}});var g5e=UU();Object.defineProperty(E,"generate",{enumerable:!0,get:function(){return g5e.generate}});var y5e=zU();Object.defineProperty(E,"iif",{enumerable:!0,get:function(){return y5e.iif}});var b5e=TA();Object.defineProperty(E,"interval",{enumerable:!0,get:function(){return b5e.interval}});var w5e=ZU();Object.defineProperty(E,"merge",{enumerable:!0,get:function(){return w5e.merge}});var _5e=PA();Object.defineProperty(E,"never",{enumerable:!0,get:function(){return _5e.never}});var x5e=xx();Object.defineProperty(E,"of",{enumerable:!0,get:function(){return x5e.of}});var v5e=IA();Object.defineProperty(E,"onErrorResumeNext",{enumerable:!0,get:function(){return v5e.onErrorResumeNext}});var k5e=u9();Object.defineProperty(E,"pairs",{enumerable:!0,get:function(){return k5e.pairs}});var E5e=_9();Object.defineProperty(E,"partition",{enumerable:!0,get:function(){return E5e.partition}});var S5e=NA();Object.defineProperty(E,"race",{enumerable:!0,get:function(){return S5e.race}});var $5e=D9();Object.defineProperty(E,"range",{enumerable:!0,get:function(){return $5e.range}});var D5e=kA();Object.defineProperty(E,"throwError",{enumerable:!0,get:function(){return D5e.throwError}});var R5e=nu();Object.defineProperty(E,"timer",{enumerable:!0,get:function(){return R5e.timer}});var C5e=A9();Object.defineProperty(E,"using",{enumerable:!0,get:function(){return C5e.using}});var A5e=Rx();Object.defineProperty(E,"zip",{enumerable:!0,get:function(){return A5e.zip}});var O5e=vA();Object.defineProperty(E,"scheduled",{enumerable:!0,get:function(){return O5e.scheduled}});var T5e=Ai();Object.defineProperty(E,"EMPTY",{enumerable:!0,get:function(){return T5e.EMPTY}});var P5e=PA();Object.defineProperty(E,"NEVER",{enumerable:!0,get:function(){return P5e.NEVER}});IBe(T9(),E);var I5e=rm();Object.defineProperty(E,"config",{enumerable:!0,get:function(){return I5e.config}});var N5e=FA();Object.defineProperty(E,"audit",{enumerable:!0,get:function(){return N5e.audit}});var F5e=j9();Object.defineProperty(E,"auditTime",{enumerable:!0,get:function(){return F5e.auditTime}});var M5e=U9();Object.defineProperty(E,"buffer",{enumerable:!0,get:function(){return M5e.buffer}});var j5e=H9();Object.defineProperty(E,"bufferCount",{enumerable:!0,get:function(){return j5e.bufferCount}});var L5e=z9();Object.defineProperty(E,"bufferTime",{enumerable:!0,get:function(){return L5e.bufferTime}});var q5e=K9();Object.defineProperty(E,"bufferToggle",{enumerable:!0,get:function(){return q5e.bufferToggle}});var B5e=Q9();Object.defineProperty(E,"bufferWhen",{enumerable:!0,get:function(){return B5e.bufferWhen}});var U5e=n7();Object.defineProperty(E,"catchError",{enumerable:!0,get:function(){return U5e.catchError}});var H5e=h7();Object.defineProperty(E,"combineAll",{enumerable:!0,get:function(){return H5e.combineAll}});var V5e=UA();Object.defineProperty(E,"combineLatestAll",{enumerable:!0,get:function(){return V5e.combineLatestAll}});var z5e=_7();Object.defineProperty(E,"combineLatestWith",{enumerable:!0,get:function(){return z5e.combineLatestWith}});var G5e=Dx();Object.defineProperty(E,"concatAll",{enumerable:!0,get:function(){return G5e.concatAll}});var W5e=HA();Object.defineProperty(E,"concatMap",{enumerable:!0,get:function(){return W5e.concatMap}});var K5e=D7();Object.defineProperty(E,"concatMapTo",{enumerable:!0,get:function(){return K5e.concatMapTo}});var J5e=C7();Object.defineProperty(E,"concatWith",{enumerable:!0,get:function(){return J5e.concatWith}});var Y5e=Cx();Object.defineProperty(E,"connect",{enumerable:!0,get:function(){return Y5e.connect}});var X5e=M7();Object.defineProperty(E,"count",{enumerable:!0,get:function(){return X5e.count}});var Q5e=B7();Object.defineProperty(E,"debounce",{enumerable:!0,get:function(){return Q5e.debounce}});var Z5e=V7();Object.defineProperty(E,"debounceTime",{enumerable:!0,get:function(){return Z5e.debounceTime}});var eUe=Zy();Object.defineProperty(E,"defaultIfEmpty",{enumerable:!0,get:function(){return eUe.defaultIfEmpty}});var tUe=sH();Object.defineProperty(E,"delay",{enumerable:!0,get:function(){return tUe.delay}});var nUe=GA();Object.defineProperty(E,"delayWhen",{enumerable:!0,get:function(){return nUe.delayWhen}});var rUe=cH();Object.defineProperty(E,"dematerialize",{enumerable:!0,get:function(){return rUe.dematerialize}});var oUe=fH();Object.defineProperty(E,"distinct",{enumerable:!0,get:function(){return oUe.distinct}});var sUe=WA();Object.defineProperty(E,"distinctUntilChanged",{enumerable:!0,get:function(){return sUe.distinctUntilChanged}});var iUe=yH();Object.defineProperty(E,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return iUe.distinctUntilKeyChanged}});var aUe=kH();Object.defineProperty(E,"elementAt",{enumerable:!0,get:function(){return aUe.elementAt}});var cUe=EH();Object.defineProperty(E,"endWith",{enumerable:!0,get:function(){return cUe.endWith}});var lUe=DH();Object.defineProperty(E,"every",{enumerable:!0,get:function(){return lUe.every}});var uUe=MH();Object.defineProperty(E,"exhaust",{enumerable:!0,get:function(){return uUe.exhaust}});var dUe=JA();Object.defineProperty(E,"exhaustAll",{enumerable:!0,get:function(){return dUe.exhaustAll}});var fUe=KA();Object.defineProperty(E,"exhaustMap",{enumerable:!0,get:function(){return fUe.exhaustMap}});var pUe=qH();Object.defineProperty(E,"expand",{enumerable:!0,get:function(){return pUe.expand}});var mUe=lf();Object.defineProperty(E,"filter",{enumerable:!0,get:function(){return mUe.filter}});var hUe=HH();Object.defineProperty(E,"finalize",{enumerable:!0,get:function(){return hUe.finalize}});var gUe=YA();Object.defineProperty(E,"find",{enumerable:!0,get:function(){return gUe.find}});var yUe=JH();Object.defineProperty(E,"findIndex",{enumerable:!0,get:function(){return yUe.findIndex}});var bUe=QH();Object.defineProperty(E,"first",{enumerable:!0,get:function(){return bUe.first}});var wUe=nV();Object.defineProperty(E,"groupBy",{enumerable:!0,get:function(){return wUe.groupBy}});var _Ue=VA();Object.defineProperty(E,"ignoreElements",{enumerable:!0,get:function(){return _Ue.ignoreElements}});var xUe=sV();Object.defineProperty(E,"isEmpty",{enumerable:!0,get:function(){return xUe.isEmpty}});var vUe=cV();Object.defineProperty(E,"last",{enumerable:!0,get:function(){return vUe.last}});var kUe=Ql();Object.defineProperty(E,"map",{enumerable:!0,get:function(){return kUe.map}});var EUe=zA();Object.defineProperty(E,"mapTo",{enumerable:!0,get:function(){return EUe.mapTo}});var SUe=dV();Object.defineProperty(E,"materialize",{enumerable:!0,get:function(){return SUe.materialize}});var $Ue=mV();Object.defineProperty(E,"max",{enumerable:!0,get:function(){return $Ue.max}});var DUe=Yy();Object.defineProperty(E,"mergeAll",{enumerable:!0,get:function(){return DUe.mergeAll}});var RUe=yV();Object.defineProperty(E,"flatMap",{enumerable:!0,get:function(){return RUe.flatMap}});var CUe=qc();Object.defineProperty(E,"mergeMap",{enumerable:!0,get:function(){return CUe.mergeMap}});var AUe=xV();Object.defineProperty(E,"mergeMapTo",{enumerable:!0,get:function(){return AUe.mergeMapTo}});var OUe=EV();Object.defineProperty(E,"mergeScan",{enumerable:!0,get:function(){return OUe.mergeScan}});var TUe=DV();Object.defineProperty(E,"mergeWith",{enumerable:!0,get:function(){return TUe.mergeWith}});var PUe=AV();Object.defineProperty(E,"min",{enumerable:!0,get:function(){return PUe.min}});var IUe=Ax();Object.defineProperty(E,"multicast",{enumerable:!0,get:function(){return IUe.multicast}});var NUe=Ky();Object.defineProperty(E,"observeOn",{enumerable:!0,get:function(){return NUe.observeOn}});var FUe=NV();Object.defineProperty(E,"onErrorResumeNextWith",{enumerable:!0,get:function(){return FUe.onErrorResumeNextWith}});var MUe=jV();Object.defineProperty(E,"pairwise",{enumerable:!0,get:function(){return MUe.pairwise}});var jUe=BV();Object.defineProperty(E,"pluck",{enumerable:!0,get:function(){return jUe.pluck}});var LUe=VV();Object.defineProperty(E,"publish",{enumerable:!0,get:function(){return LUe.publish}});var qUe=WV();Object.defineProperty(E,"publishBehavior",{enumerable:!0,get:function(){return qUe.publishBehavior}});var BUe=YV();Object.defineProperty(E,"publishLast",{enumerable:!0,get:function(){return BUe.publishLast}});var UUe=ez();Object.defineProperty(E,"publishReplay",{enumerable:!0,get:function(){return UUe.publishReplay}});var HUe=tz();Object.defineProperty(E,"raceWith",{enumerable:!0,get:function(){return HUe.raceWith}});var VUe=Rm();Object.defineProperty(E,"reduce",{enumerable:!0,get:function(){return VUe.reduce}});var zUe=sz();Object.defineProperty(E,"repeat",{enumerable:!0,get:function(){return zUe.repeat}});var GUe=lz();Object.defineProperty(E,"repeatWhen",{enumerable:!0,get:function(){return GUe.repeatWhen}});var WUe=pz();Object.defineProperty(E,"retry",{enumerable:!0,get:function(){return WUe.retry}});var KUe=yz();Object.defineProperty(E,"retryWhen",{enumerable:!0,get:function(){return KUe.retryWhen}});var JUe=ZC();Object.defineProperty(E,"refCount",{enumerable:!0,get:function(){return JUe.refCount}});var YUe=ZA();Object.defineProperty(E,"sample",{enumerable:!0,get:function(){return YUe.sample}});var XUe=kz();Object.defineProperty(E,"sampleTime",{enumerable:!0,get:function(){return XUe.sampleTime}});var QUe=$z();Object.defineProperty(E,"scan",{enumerable:!0,get:function(){return QUe.scan}});var ZUe=Az();Object.defineProperty(E,"sequenceEqual",{enumerable:!0,get:function(){return ZUe.sequenceEqual}});var e9e=t2();Object.defineProperty(E,"share",{enumerable:!0,get:function(){return e9e.share}});var t9e=Nz();Object.defineProperty(E,"shareReplay",{enumerable:!0,get:function(){return t9e.shareReplay}});var n9e=jz();Object.defineProperty(E,"single",{enumerable:!0,get:function(){return n9e.single}});var r9e=Bz();Object.defineProperty(E,"skip",{enumerable:!0,get:function(){return r9e.skip}});var o9e=Vz();Object.defineProperty(E,"skipLast",{enumerable:!0,get:function(){return o9e.skipLast}});var s9e=Kz();Object.defineProperty(E,"skipUntil",{enumerable:!0,get:function(){return s9e.skipUntil}});var i9e=Xz();Object.defineProperty(E,"skipWhile",{enumerable:!0,get:function(){return i9e.skipWhile}});var a9e=tG();Object.defineProperty(E,"startWith",{enumerable:!0,get:function(){return a9e.startWith}});var c9e=Jy();Object.defineProperty(E,"subscribeOn",{enumerable:!0,get:function(){return c9e.subscribeOn}});var l9e=aG();Object.defineProperty(E,"switchAll",{enumerable:!0,get:function(){return l9e.switchAll}});var u9e=n0();Object.defineProperty(E,"switchMap",{enumerable:!0,get:function(){return u9e.switchMap}});var d9e=dG();Object.defineProperty(E,"switchMapTo",{enumerable:!0,get:function(){return d9e.switchMapTo}});var f9e=mG();Object.defineProperty(E,"switchScan",{enumerable:!0,get:function(){return f9e.switchScan}});var p9e=e0();Object.defineProperty(E,"take",{enumerable:!0,get:function(){return p9e.take}});var m9e=XA();Object.defineProperty(E,"takeLast",{enumerable:!0,get:function(){return m9e.takeLast}});var h9e=yG();Object.defineProperty(E,"takeUntil",{enumerable:!0,get:function(){return h9e.takeUntil}});var g9e=_G();Object.defineProperty(E,"takeWhile",{enumerable:!0,get:function(){return g9e.takeWhile}});var y9e=kG();Object.defineProperty(E,"tap",{enumerable:!0,get:function(){return y9e.tap}});var b9e=n2();Object.defineProperty(E,"throttle",{enumerable:!0,get:function(){return b9e.throttle}});var w9e=CG();Object.defineProperty(E,"throttleTime",{enumerable:!0,get:function(){return w9e.throttleTime}});var _9e=t0();Object.defineProperty(E,"throwIfEmpty",{enumerable:!0,get:function(){return _9e.throwIfEmpty}});var x9e=PG();Object.defineProperty(E,"timeInterval",{enumerable:!0,get:function(){return x9e.timeInterval}});var v9e=Ex();Object.defineProperty(E,"timeout",{enumerable:!0,get:function(){return v9e.timeout}});var k9e=FG();Object.defineProperty(E,"timeoutWith",{enumerable:!0,get:function(){return k9e.timeoutWith}});var E9e=LG();Object.defineProperty(E,"timestamp",{enumerable:!0,get:function(){return E9e.timestamp}});var S9e=qA();Object.defineProperty(E,"toArray",{enumerable:!0,get:function(){return S9e.toArray}});var $9e=VG();Object.defineProperty(E,"window",{enumerable:!0,get:function(){return $9e.window}});var D9e=GG();Object.defineProperty(E,"windowCount",{enumerable:!0,get:function(){return D9e.windowCount}});var R9e=YG();Object.defineProperty(E,"windowTime",{enumerable:!0,get:function(){return R9e.windowTime}});var C9e=ZG();Object.defineProperty(E,"windowToggle",{enumerable:!0,get:function(){return C9e.windowToggle}});var A9e=rW();Object.defineProperty(E,"windowWhen",{enumerable:!0,get:function(){return A9e.windowWhen}});var O9e=aW();Object.defineProperty(E,"withLatestFrom",{enumerable:!0,get:function(){return O9e.withLatestFrom}});var T9e=uW();Object.defineProperty(E,"zipAll",{enumerable:!0,get:function(){return T9e.zipAll}});var P9e=fW();Object.defineProperty(E,"zipWith",{enumerable:!0,get:function(){return P9e.zipWith}})});function I9e(e,t){return{value:e,key:t||{}}}function Wr(e){let t=An.fromEvent(e.input,"keypress",I9e).pipe(An.takeUntil(An.fromEvent(e,"close"))).pipe(An.filter(({key:n})=>n.name!=="enter"&&n.name!=="return"));return{line:An.fromEvent(e,"line"),keypress:t,normalizedUpKey:t.pipe(An.filter(({key:n})=>n.name==="up"||n.name==="k"||n.name==="p"&&n.ctrl),An.share()),normalizedDownKey:t.pipe(An.filter(({key:n})=>n.name==="down"||n.name==="j"||n.name==="n"&&n.ctrl),An.share()),numberKey:t.pipe(An.filter((n)=>n.value&&"123456789".includes(n.value)),An.map((n)=>Number(n.value)),An.share()),spaceKey:t.pipe(An.filter(({key:n})=>n&&n.name==="space"),An.share()),aKey:t.pipe(An.filter(({key:n})=>n&&n.name==="a"),An.share()),iKey:t.pipe(An.filter(({key:n})=>n&&n.name==="i"),An.share())}}var An;var Bc=z(()=>{An=et(vs(),1)});class ma{constructor(e,t={}){let{isInfinite:n=!0}=t;this.lastIndex=0,this.screen=e,this.isInfinite=n}paginate(e,t,n){n||=7;let r=e.split(`
|
|
31
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}})});var Mc=w(function(S4){Object.defineProperty(S4,"__esModule",{value:!0});S4.arrRemove=void 0;function fOe(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}S4.arrRemove=fOe});var xs=w(function(Ko){var D4=Ko&&Ko.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},R4=Ko&&Ko.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},C4=Ko&&Ko.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.isSubscription=Ko.EMPTY_SUBSCRIPTION=Ko.Subscription=void 0;var Hy=Yt(),HC=UC(),A4=Mc(),VC=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,o,s;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=D4(i),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(g){t={error:g}}finally{try{if(c&&!c.done&&(n=a.return))n.call(a)}finally{if(t)throw t.error}}else i.remove(this);var d=this.initialTeardown;if(Hy.isFunction(d))try{d()}catch(g){s=g instanceof HC.UnsubscriptionError?g.errors:[g]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=D4(f),m=p.next();!m.done;m=p.next()){var h=m.value;try{O4(h)}catch(g){if(s=s!==null&&s!==void 0?s:[],g instanceof HC.UnsubscriptionError)s=C4(C4([],R4(s)),R4(g.errors));else s.push(g)}}}catch(g){r={error:g}}finally{try{if(m&&!m.done&&(o=p.return))o.call(p)}finally{if(r)throw r.error}}}if(s)throw new HC.UnsubscriptionError(s)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)O4(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;if(n===t)this._parentage=null;else if(Array.isArray(n))A4.arrRemove(n,t)},e.prototype.remove=function(t){var n=this._finalizers;if(n&&A4.arrRemove(n,t),t instanceof e)t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();Ko.Subscription=VC;Ko.EMPTY_SUBSCRIPTION=VC.EMPTY;function pOe(e){return e instanceof VC||e&&"closed"in e&&Hy.isFunction(e.remove)&&Hy.isFunction(e.add)&&Hy.isFunction(e.unsubscribe)}Ko.isSubscription=pOe;function O4(e){if(Hy.isFunction(e))e();else e.unsubscribe()}});var rm=w(function(T4){Object.defineProperty(T4,"__esModule",{value:!0});T4.config=void 0;T4.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}});var zC=w(function(la){var I4=la&&la.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},N4=la&&la.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(la,"__esModule",{value:!0});la.timeoutProvider=void 0;la.timeoutProvider={setTimeout:function(e,t){var n=[];for(var r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=la.timeoutProvider.delegate;if(o===null||o===void 0?void 0:o.setTimeout)return o.setTimeout.apply(o,N4([e,t],I4(n)));return setTimeout.apply(void 0,N4([e,t],I4(n)))},clearTimeout:function(e){var t=la.timeoutProvider.delegate;return((t===null||t===void 0?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0}});var GC=w(function(F4){Object.defineProperty(F4,"__esModule",{value:!0});F4.reportUnhandledError=void 0;var mOe=rm(),hOe=zC();function gOe(e){hOe.timeoutProvider.setTimeout(function(){var t=mOe.config.onUnhandledError;if(t)t(e);else throw e})}F4.reportUnhandledError=gOe});var Vr=w(function(j4){Object.defineProperty(j4,"__esModule",{value:!0});j4.noop=void 0;function yOe(){}j4.noop=yOe});var U4=w(function(q4){Object.defineProperty(q4,"__esModule",{value:!0});q4.createNotification=q4.nextNotification=q4.errorNotification=q4.COMPLETE_NOTIFICATION=void 0;q4.COMPLETE_NOTIFICATION=function(){return fx("C",void 0,void 0)}();function bOe(e){return fx("E",void 0,e)}q4.errorNotification=bOe;function wOe(e){return fx("N",e,void 0)}q4.nextNotification=wOe;function fx(e,t,n){return{kind:e,value:t,error:n}}q4.createNotification=fx});var px=w(function(V4){Object.defineProperty(V4,"__esModule",{value:!0});V4.captureError=V4.errorContext=void 0;var H4=rm(),af=null;function kOe(e){if(H4.config.useDeprecatedSynchronousErrorHandling){var t=!af;if(t)af={errorThrown:!1,error:null};if(e(),t){var n=af,{errorThrown:r,error:o}=n;if(af=null,r)throw o}}else e()}V4.errorContext=kOe;function EOe(e){if(H4.config.useDeprecatedSynchronousErrorHandling&&af)af.errorThrown=!0,af.error=e}V4.captureError=EOe});var om=w(function(Ri){var K4=Ri&&Ri.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Ri,"__esModule",{value:!0});Ri.EMPTY_OBSERVER=Ri.SafeSubscriber=Ri.Subscriber=void 0;var $Oe=Yt(),G4=xs(),YC=rm(),DOe=GC(),W4=Vr(),WC=U4(),ROe=zC(),COe=px(),J4=function(e){K4(t,e);function t(n){var r=e.call(this)||this;if(r.isStopped=!1,n){if(r.destination=n,G4.isSubscription(n))n.add(r)}else r.destination=Ri.EMPTY_OBSERVER;return r}return t.create=function(n,r,o){return new Y4(n,r,o)},t.prototype.next=function(n){if(this.isStopped)JC(WC.nextNotification(n),this);else this._next(n)},t.prototype.error=function(n){if(this.isStopped)JC(WC.errorNotification(n),this);else this.isStopped=!0,this._error(n)},t.prototype.complete=function(){if(this.isStopped)JC(WC.COMPLETE_NOTIFICATION,this);else this.isStopped=!0,this._complete()},t.prototype.unsubscribe=function(){if(!this.closed)this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(G4.Subscription);Ri.Subscriber=J4;var AOe=Function.prototype.bind;function KC(e,t){return AOe.call(e,t)}var OOe=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){mx(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){mx(r)}else mx(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){mx(n)}},e}(),Y4=function(e){K4(t,e);function t(n,r,o){var s=e.call(this)||this,i;if($Oe.isFunction(n)||!n)i={next:n!==null&&n!==void 0?n:void 0,error:r!==null&&r!==void 0?r:void 0,complete:o!==null&&o!==void 0?o:void 0};else{var a;if(s&&YC.config.useDeprecatedNextContext)a=Object.create(n),a.unsubscribe=function(){return s.unsubscribe()},i={next:n.next&&KC(n.next,a),error:n.error&&KC(n.error,a),complete:n.complete&&KC(n.complete,a)};else i=n}return s.destination=new OOe(i),s}return t}(J4);Ri.SafeSubscriber=Y4;function mx(e){if(YC.config.useDeprecatedSynchronousErrorHandling)COe.captureError(e);else DOe.reportUnhandledError(e)}function TOe(e){throw e}function JC(e,t){var n=YC.config.onStoppedNotification;n&&ROe.timeoutProvider.setTimeout(function(){return n(e,t)})}Ri.EMPTY_OBSERVER={closed:!0,next:W4.noop,error:TOe,complete:W4.noop}});var Vy=w(function(X4){Object.defineProperty(X4,"__esModule",{value:!0});X4.observable=void 0;X4.observable=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}()});var zr=w(function(Z4){Object.defineProperty(Z4,"__esModule",{value:!0});Z4.identity=void 0;function POe(e){return e}Z4.identity=POe});var zy=w(function(n8){Object.defineProperty(n8,"__esModule",{value:!0});n8.pipeFromArray=n8.pipe=void 0;var IOe=zr();function NOe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return t8(e)}n8.pipe=NOe;function t8(e){if(e.length===0)return IOe.identity;if(e.length===1)return e[0];return function(n){return e.reduce(function(r,o){return o(r)},n)}}n8.pipeFromArray=t8});var en=w(function(s8){Object.defineProperty(s8,"__esModule",{value:!0});s8.Observable=void 0;var QC=om(),MOe=xs(),jOe=Vy(),LOe=zy(),qOe=rm(),XC=Yt(),BOe=px(),UOe=function(){function e(t){if(t)this._subscribe=t}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var o=this,s=VOe(t)?t:new QC.SafeSubscriber(t,n,r);return BOe.errorContext(function(){var i=o,{operator:a,source:c}=i;s.add(a?a.call(s,c):c?o._subscribe(s):o._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=o8(n),new n(function(o,s){var i=new QC.SafeSubscriber({next:function(a){try{t(a)}catch(c){s(c),i.unsubscribe()}},error:s,complete:o});r.subscribe(i)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[jOe.observable]=function(){return this},e.prototype.pipe=function(){var t=[];for(var n=0;n<arguments.length;n++)t[n]=arguments[n];return LOe.pipeFromArray(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=o8(t),new t(function(r,o){var s;n.subscribe(function(i){return s=i},function(i){return o(i)},function(){return r(s)})})},e.create=function(t){return new e(t)},e}();s8.Observable=UOe;function o8(e){var t;return(t=e!==null&&e!==void 0?e:qOe.config.Promise)!==null&&t!==void 0?t:Promise}function HOe(e){return e&&XC.isFunction(e.next)&&XC.isFunction(e.error)&&XC.isFunction(e.complete)}function VOe(e){return e&&e instanceof QC.Subscriber||HOe(e)&&MOe.isSubscription(e)}});var ue=w(function(c8){Object.defineProperty(c8,"__esModule",{value:!0});c8.operate=c8.hasLift=void 0;var zOe=Yt();function a8(e){return zOe.isFunction(e===null||e===void 0?void 0:e.lift)}c8.hasLift=a8;function GOe(e){return function(t){if(a8(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw TypeError("Unable to lift unknown Observable type")}}c8.operate=GOe});var Re=w(function(Jl){var KOe=Jl&&Jl.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Jl,"__esModule",{value:!0});Jl.OperatorSubscriber=Jl.createOperatorSubscriber=void 0;var JOe=om();function YOe(e,t,n,r,o){return new u8(e,t,n,r,o)}Jl.createOperatorSubscriber=YOe;var u8=function(e){KOe(t,e);function t(n,r,o,s,i,a){var c=e.call(this,n)||this;return c.onFinalize=i,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(d){n.error(d)}}:e.prototype._next,c._error=s?function(l){try{s(l)}catch(d){n.error(d)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=o?function(){try{o()}catch(l){n.error(l)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(JOe.Subscriber);Jl.OperatorSubscriber=u8});var ZC=w(function(d8){Object.defineProperty(d8,"__esModule",{value:!0});d8.refCount=void 0;var XOe=ue(),QOe=Re();function ZOe(){return XOe.operate(function(e,t){var n=null;e._refCount++;var r=QOe.createOperatorSubscriber(t,void 0,void 0,void 0,function(){if(!e||e._refCount<=0||0<--e._refCount){n=null;return}var o=e._connection,s=n;if(n=null,o&&(!s||o===s))o.unsubscribe();t.unsubscribe()});if(e.subscribe(r),!r.closed)n=e.connect()})}d8.refCount=ZOe});var Gy=w(function(sm){var eTe=sm&&sm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(sm,"__esModule",{value:!0});sm.ConnectableObservable=void 0;var tTe=en(),p8=xs(),nTe=ZC(),rTe=Re(),oTe=ue(),sTe=function(e){eTe(t,e);function t(n,r){var o=e.call(this)||this;if(o.source=n,o.subjectFactory=r,o._subject=null,o._refCount=0,o._connection=null,oTe.hasLift(n))o.lift=n.lift;return o}return t.prototype._subscribe=function(n){return this.getSubject().subscribe(n)},t.prototype.getSubject=function(){var n=this._subject;if(!n||n.isStopped)this._subject=this.subjectFactory();return this._subject},t.prototype._teardown=function(){this._refCount=0;var n=this._connection;this._subject=this._connection=null,n===null||n===void 0||n.unsubscribe()},t.prototype.connect=function(){var n=this,r=this._connection;if(!r){r=this._connection=new p8.Subscription;var o=this.getSubject();if(r.add(this.source.subscribe(rTe.createOperatorSubscriber(o,void 0,function(){n._teardown(),o.complete()},function(s){n._teardown(),o.error(s)},function(){return n._teardown()}))),r.closed)this._connection=null,r=p8.Subscription.EMPTY}return r},t.prototype.refCount=function(){return nTe.refCount()(this)},t}(tTe.Observable);sm.ConnectableObservable=sTe});var h8=w(function(m8){Object.defineProperty(m8,"__esModule",{value:!0});m8.performanceTimestampProvider=void 0;m8.performanceTimestampProvider={now:function(){return(m8.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}});var tA=w(function(Ci){var g8=Ci&&Ci.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},y8=Ci&&Ci.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.animationFrameProvider=void 0;var iTe=xs();Ci.animationFrameProvider={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=Ci.animationFrameProvider.delegate;if(r)t=r.requestAnimationFrame,n=r.cancelAnimationFrame;var o=t(function(s){n=void 0,e(s)});return new iTe.Subscription(function(){return n===null||n===void 0?void 0:n(o)})},requestAnimationFrame:function(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ci.animationFrameProvider.delegate;return((n===null||n===void 0?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,y8([],g8(e)))},cancelAnimationFrame:function(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ci.animationFrameProvider.delegate;return((n===null||n===void 0?void 0:n.cancelAnimationFrame)||cancelAnimationFrame).apply(void 0,y8([],g8(e)))},delegate:void 0}});var v8=w(function(_8){Object.defineProperty(_8,"__esModule",{value:!0});_8.animationFrames=void 0;var aTe=en(),cTe=h8(),b8=tA();function lTe(e){return e?w8(e):uTe}_8.animationFrames=lTe;function w8(e){return new aTe.Observable(function(t){var n=e||cTe.performanceTimestampProvider,r=n.now(),o=0,s=function(){if(!t.closed)o=b8.animationFrameProvider.requestAnimationFrame(function(i){o=0;var a=n.now();t.next({timestamp:e?a:i,elapsed:a-r}),s()})};return s(),function(){if(o)b8.animationFrameProvider.cancelAnimationFrame(o)}})}var uTe=w8()});var nA=w(function(k8){Object.defineProperty(k8,"__esModule",{value:!0});k8.ObjectUnsubscribedError=void 0;var dTe=Kl();k8.ObjectUnsubscribedError=dTe.createErrorClass(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})});var Gr=w(function(ua){var $8=ua&&ua.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),fTe=ua&&ua.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(ua,"__esModule",{value:!0});ua.AnonymousSubject=ua.Subject=void 0;var S8=en(),oA=xs(),pTe=nA(),mTe=Mc(),rA=px(),D8=function(e){$8(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new sA(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new pTe.ObjectUnsubscribedError},t.prototype.next=function(n){var r=this;rA.errorContext(function(){var o,s;if(r._throwIfClosed(),!r.isStopped){if(!r.currentObservers)r.currentObservers=Array.from(r.observers);try{for(var i=fTe(r.currentObservers),a=i.next();!a.done;a=i.next()){var c=a.value;c.next(n)}}catch(l){o={error:l}}finally{try{if(a&&!a.done&&(s=i.return))s.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(n){var r=this;rA.errorContext(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;var o=r.observers;while(o.length)o.shift().error(n)}})},t.prototype.complete=function(){var n=this;rA.errorContext(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;var r=n.observers;while(r.length)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,o=this,{hasError:s,isStopped:i,observers:a}=o;if(s||i)return oA.EMPTY_SUBSCRIPTION;return this.currentObservers=null,a.push(n),new oA.Subscription(function(){r.currentObservers=null,mTe.arrRemove(a,n)})},t.prototype._checkFinalizedStatuses=function(n){var r=this,{hasError:o,thrownError:s,isStopped:i}=r;if(o)n.error(s);else if(i)n.complete()},t.prototype.asObservable=function(){var n=new S8.Observable;return n.source=this,n},t.create=function(n,r){return new sA(n,r)},t}(S8.Observable);ua.Subject=D8;var sA=function(e){$8(t,e);function t(n,r){var o=e.call(this)||this;return o.destination=n,o.source=r,o}return t.prototype.next=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.next)===null||o===void 0||o.call(r,n)},t.prototype.error=function(n){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.error)===null||o===void 0||o.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,o;return(o=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&o!==void 0?o:oA.EMPTY_SUBSCRIPTION},t}(D8);ua.AnonymousSubject=sA});var iA=w(function(im){var hTe=im&&im.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(im,"__esModule",{value:!0});im.BehaviorSubject=void 0;var gTe=Gr(),yTe=function(e){hTe(t,e);function t(n){var r=e.call(this)||this;return r._value=n,r}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(n){var r=e.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},t.prototype.getValue=function(){var n=this,{hasError:r,thrownError:o,_value:s}=n;if(r)throw o;return this._throwIfClosed(),s},t.prototype.next=function(n){e.prototype.next.call(this,this._value=n)},t}(gTe.Subject);im.BehaviorSubject=yTe});var hx=w(function(R8){Object.defineProperty(R8,"__esModule",{value:!0});R8.dateTimestampProvider=void 0;R8.dateTimestampProvider={now:function(){return(R8.dateTimestampProvider.delegate||Date).now()},delegate:void 0}});var gx=w(function(am){var bTe=am&&am.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(am,"__esModule",{value:!0});am.ReplaySubject=void 0;var wTe=Gr(),_Te=hx(),xTe=function(e){bTe(t,e);function t(n,r,o){if(n===void 0)n=1/0;if(r===void 0)r=1/0;if(o===void 0)o=_Te.dateTimestampProvider;var s=e.call(this)||this;return s._bufferSize=n,s._windowTime=r,s._timestampProvider=o,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,n),s._windowTime=Math.max(1,r),s}return t.prototype.next=function(n){var r=this,{isStopped:o,_buffer:s,_infiniteTimeWindow:i,_timestampProvider:a,_windowTime:c}=r;if(!o)s.push(n),!i&&s.push(a.now()+c);this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();var r=this._innerSubscribe(n),o=this,{_infiniteTimeWindow:s,_buffer:i}=o,a=i.slice();for(var c=0;c<a.length&&!n.closed;c+=s?1:2)n.next(a[c]);return this._checkFinalizedStatuses(n),r},t.prototype._trimBuffer=function(){var n=this,{_bufferSize:r,_timestampProvider:o,_buffer:s,_infiniteTimeWindow:i}=n,a=(i?1:2)*r;if(r<1/0&&a<s.length&&s.splice(0,s.length-a),!i){var c=o.now(),l=0;for(var d=1;d<s.length&&s[d]<=c;d+=2)l=d;l&&s.splice(0,l+1)}},t}(wTe.Subject);am.ReplaySubject=xTe});var yx=w(function(cm){var vTe=cm&&cm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(cm,"__esModule",{value:!0});cm.AsyncSubject=void 0;var kTe=Gr(),ETe=function(e){vTe(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n._value=null,n._hasValue=!1,n._isComplete=!1,n}return t.prototype._checkFinalizedStatuses=function(n){var r=this,{hasError:o,_hasValue:s,_value:i,thrownError:a,isStopped:c,_isComplete:l}=r;if(o)n.error(a);else if(c||l)s&&n.next(i),n.complete()},t.prototype.next=function(n){if(!this.isStopped)this._value=n,this._hasValue=!0},t.prototype.complete=function(){var n=this,{_hasValue:r,_value:o,_isComplete:s}=n;if(!s)this._isComplete=!0,r&&e.prototype.next.call(this,o),e.prototype.complete.call(this)},t}(kTe.Subject);cm.AsyncSubject=ETe});var C8=w(function(lm){var STe=lm&&lm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(lm,"__esModule",{value:!0});lm.Action=void 0;var $Te=xs(),DTe=function(e){STe(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){if(r===void 0)r=0;return this},t}($Te.Subscription);lm.Action=DTe});var T8=w(function(da){var A8=da&&da.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},O8=da&&da.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(da,"__esModule",{value:!0});da.intervalProvider=void 0;da.intervalProvider={setInterval:function(e,t){var n=[];for(var r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=da.intervalProvider.delegate;if(o===null||o===void 0?void 0:o.setInterval)return o.setInterval.apply(o,O8([e,t],A8(n)));return setInterval.apply(void 0,O8([e,t],A8(n)))},clearInterval:function(e){var t=da.intervalProvider.delegate;return((t===null||t===void 0?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0}});var dm=w(function(um){var RTe=um&&um.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(um,"__esModule",{value:!0});um.AsyncAction=void 0;var CTe=C8(),P8=T8(),ATe=Mc(),OTe=function(e){RTe(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o.pending=!1,o}return t.prototype.schedule=function(n,r){var o;if(r===void 0)r=0;if(this.closed)return this;this.state=n;var s=this.id,i=this.scheduler;if(s!=null)this.id=this.recycleAsyncId(i,s,r);return this.pending=!0,this.delay=r,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(i,this.id,r),this},t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;return P8.intervalProvider.setInterval(n.flush.bind(n,this),o)},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0)o=0;if(o!=null&&this.delay===o&&this.pending===!1)return r;if(r!=null)P8.intervalProvider.clearInterval(r);return},t.prototype.execute=function(n,r){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var o=this._execute(n,r);if(o)return o;else if(this.pending===!1&&this.id!=null)this.id=this.recycleAsyncId(this.scheduler,this.id,null)},t.prototype._execute=function(n,r){var o=!1,s;try{this.work(n)}catch(i){o=!0,s=i?i:Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,{id:r,scheduler:o}=n,s=o.actions;if(this.work=this.state=this.scheduler=null,this.pending=!1,ATe.arrRemove(s,this),r!=null)this.id=this.recycleAsyncId(o,r,null);this.delay=null,e.prototype.unsubscribe.call(this)}},t}(CTe.Action);um.AsyncAction=OTe});var M8=w(function(N8){Object.defineProperty(N8,"__esModule",{value:!0});N8.TestTools=N8.Immediate=void 0;var TTe=1,cA,bx={};function I8(e){if(e in bx)return delete bx[e],!0;return!1}N8.Immediate={setImmediate:function(e){var t=TTe++;if(bx[t]=!0,!cA)cA=Promise.resolve();return cA.then(function(){return I8(t)&&e()}),t},clearImmediate:function(e){I8(e)}};N8.TestTools={pending:function(){return Object.keys(bx).length}}});var L8=w(function(fa){var ITe=fa&&fa.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},NTe=fa&&fa.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(fa,"__esModule",{value:!0});fa.immediateProvider=void 0;var j8=M8(),FTe=j8.Immediate.setImmediate,MTe=j8.Immediate.clearImmediate;fa.immediateProvider={setImmediate:function(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=fa.immediateProvider.delegate;return((n===null||n===void 0?void 0:n.setImmediate)||FTe).apply(void 0,NTe([],ITe(e)))},clearImmediate:function(e){var t=fa.immediateProvider.delegate;return((t===null||t===void 0?void 0:t.clearImmediate)||MTe)(e)},delegate:void 0}});var B8=w(function(fm){var jTe=fm&&fm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(fm,"__esModule",{value:!0});fm.AsapAction=void 0;var LTe=dm(),q8=L8(),qTe=function(e){jTe(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o}return t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;if(o!==null&&o>0)return e.prototype.requestAsyncId.call(this,n,r,o);return n.actions.push(this),n._scheduled||(n._scheduled=q8.immediateProvider.setImmediate(n.flush.bind(n,void 0)))},t.prototype.recycleAsyncId=function(n,r,o){var s;if(o===void 0)o=0;if(o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,n,r,o);var i=n.actions;if(r!=null&&((s=i[i.length-1])===null||s===void 0?void 0:s.id)!==r){if(q8.immediateProvider.clearImmediate(r),n._scheduled===r)n._scheduled=void 0}return},t}(LTe.AsyncAction);fm.AsapAction=qTe});var lA=w(function(U8){Object.defineProperty(U8,"__esModule",{value:!0});U8.Scheduler=void 0;var BTe=hx(),UTe=function(){function e(t,n){if(n===void 0)n=e.now;this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){if(n===void 0)n=0;return new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=BTe.dateTimestampProvider.now,e}();U8.Scheduler=UTe});var mm=w(function(pm){var HTe=pm&&pm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(pm,"__esModule",{value:!0});pm.AsyncScheduler=void 0;var V8=lA(),VTe=function(e){HTe(t,e);function t(n,r){if(r===void 0)r=V8.Scheduler.now;var o=e.call(this,n,r)||this;return o.actions=[],o._active=!1,o}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var o;this._active=!0;do if(o=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,o){while(n=r.shift())n.unsubscribe();throw o}},t}(V8.Scheduler);pm.AsyncScheduler=VTe});var z8=w(function(hm){var zTe=hm&&hm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(hm,"__esModule",{value:!0});hm.AsapScheduler=void 0;var GTe=mm(),WTe=function(e){zTe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(n){this._active=!0;var r=this._scheduled;this._scheduled=void 0;var o=this.actions,s;n=n||o.shift();do if(s=n.execute(n.state,n.delay))break;while((n=o[0])&&n.id===r&&o.shift());if(this._active=!1,s){while((n=o[0])&&n.id===r&&o.shift())n.unsubscribe();throw s}},t}(GTe.AsyncScheduler);hm.AsapScheduler=WTe});var J8=w(function(G8){Object.defineProperty(G8,"__esModule",{value:!0});G8.asap=G8.asapScheduler=void 0;var KTe=B8(),JTe=z8();G8.asapScheduler=new JTe.AsapScheduler(KTe.AsapAction);G8.asap=G8.asapScheduler});var Jo=w(function(Y8){Object.defineProperty(Y8,"__esModule",{value:!0});Y8.async=Y8.asyncScheduler=void 0;var YTe=dm(),XTe=mm();Y8.asyncScheduler=new XTe.AsyncScheduler(YTe.AsyncAction);Y8.async=Y8.asyncScheduler});var Z8=w(function(gm){var QTe=gm&&gm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(gm,"__esModule",{value:!0});gm.QueueAction=void 0;var ZTe=dm(),ePe=function(e){QTe(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o}return t.prototype.schedule=function(n,r){if(r===void 0)r=0;if(r>0)return e.prototype.schedule.call(this,n,r);return this.delay=r,this.state=n,this.scheduler.flush(this),this},t.prototype.execute=function(n,r){return r>0||this.closed?e.prototype.execute.call(this,n,r):this._execute(n,r)},t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;if(o!=null&&o>0||o==null&&this.delay>0)return e.prototype.requestAsyncId.call(this,n,r,o);return n.flush(this),0},t}(ZTe.AsyncAction);gm.QueueAction=ePe});var eB=w(function(ym){var tPe=ym&&ym.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(ym,"__esModule",{value:!0});ym.QueueScheduler=void 0;var nPe=mm(),rPe=function(e){tPe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(nPe.AsyncScheduler);ym.QueueScheduler=rPe});var oB=w(function(tB){Object.defineProperty(tB,"__esModule",{value:!0});tB.queue=tB.queueScheduler=void 0;var oPe=Z8(),sPe=eB();tB.queueScheduler=new sPe.QueueScheduler(oPe.QueueAction);tB.queue=tB.queueScheduler});var iB=w(function(bm){var iPe=bm&&bm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(bm,"__esModule",{value:!0});bm.AnimationFrameAction=void 0;var aPe=dm(),sB=tA(),cPe=function(e){iPe(t,e);function t(n,r){var o=e.call(this,n,r)||this;return o.scheduler=n,o.work=r,o}return t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;if(o!==null&&o>0)return e.prototype.requestAsyncId.call(this,n,r,o);return n.actions.push(this),n._scheduled||(n._scheduled=sB.animationFrameProvider.requestAnimationFrame(function(){return n.flush(void 0)}))},t.prototype.recycleAsyncId=function(n,r,o){var s;if(o===void 0)o=0;if(o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,n,r,o);var i=n.actions;if(r!=null&&r===n._scheduled&&((s=i[i.length-1])===null||s===void 0?void 0:s.id)!==r)sB.animationFrameProvider.cancelAnimationFrame(r),n._scheduled=void 0;return},t}(aPe.AsyncAction);bm.AnimationFrameAction=cPe});var aB=w(function(wm){var lPe=wm&&wm.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(wm,"__esModule",{value:!0});wm.AnimationFrameScheduler=void 0;var uPe=mm(),dPe=function(e){lPe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(n){this._active=!0;var r;if(n)r=n.id;else r=this._scheduled,this._scheduled=void 0;var o=this.actions,s;n=n||o.shift();do if(s=n.execute(n.state,n.delay))break;while((n=o[0])&&n.id===r&&o.shift());if(this._active=!1,s){while((n=o[0])&&n.id===r&&o.shift())n.unsubscribe();throw s}},t}(uPe.AsyncScheduler);wm.AnimationFrameScheduler=dPe});var dB=w(function(cB){Object.defineProperty(cB,"__esModule",{value:!0});cB.animationFrame=cB.animationFrameScheduler=void 0;var fPe=iB(),pPe=aB();cB.animationFrameScheduler=new pPe.AnimationFrameScheduler(fPe.AnimationFrameAction);cB.animationFrame=cB.animationFrameScheduler});var mB=w(function(Yl){var fB=Yl&&Yl.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)if(Object.prototype.hasOwnProperty.call(o,s))r[s]=o[s]},e(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Yl,"__esModule",{value:!0});Yl.VirtualAction=Yl.VirtualTimeScheduler=void 0;var mPe=dm(),hPe=xs(),gPe=mm(),yPe=function(e){fB(t,e);function t(n,r){if(n===void 0)n=pB;if(r===void 0)r=1/0;var o=e.call(this,n,function(){return o.frame})||this;return o.maxFrames=r,o.frame=0,o.index=-1,o}return t.prototype.flush=function(){var n=this,{actions:r,maxFrames:o}=n,s,i;while((i=r[0])&&i.delay<=o)if(r.shift(),this.frame=i.delay,s=i.execute(i.state,i.delay))break;if(s){while(i=r.shift())i.unsubscribe();throw s}},t.frameTimeFactor=10,t}(gPe.AsyncScheduler);Yl.VirtualTimeScheduler=yPe;var pB=function(e){fB(t,e);function t(n,r,o){if(o===void 0)o=n.index+=1;var s=e.call(this,n,r)||this;return s.scheduler=n,s.work=r,s.index=o,s.active=!0,s.index=n.index=o,s}return t.prototype.schedule=function(n,r){if(r===void 0)r=0;if(Number.isFinite(r)){if(!this.id)return e.prototype.schedule.call(this,n,r);this.active=!1;var o=new t(this.scheduler,this.work);return this.add(o),o.schedule(n,r)}else return hPe.Subscription.EMPTY},t.prototype.requestAsyncId=function(n,r,o){if(o===void 0)o=0;this.delay=n.frame+o;var s=n.actions;return s.push(this),s.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(n,r,o){if(o===void 0)o=0;return},t.prototype._execute=function(n,r){if(this.active===!0)return e.prototype._execute.call(this,n,r)},t.sortActions=function(n,r){if(n.delay===r.delay)if(n.index===r.index)return 0;else if(n.index>r.index)return 1;else return-1;else if(n.delay>r.delay)return 1;else return-1},t}(mPe.AsyncAction);Yl.VirtualAction=pB});var Ai=w(function(gB){Object.defineProperty(gB,"__esModule",{value:!0});gB.empty=gB.EMPTY=void 0;var hB=en();gB.EMPTY=new hB.Observable(function(e){return e.complete()});function bPe(e){return e?wPe(e):gB.EMPTY}gB.empty=bPe;function wPe(e){return new hB.Observable(function(t){return e.schedule(function(){return t.complete()})})}});var Wy=w(function(wB){Object.defineProperty(wB,"__esModule",{value:!0});wB.isScheduler=void 0;var _Pe=Yt();function xPe(e){return e&&_Pe.isFunction(e.schedule)}wB.isScheduler=xPe});var Yo=w(function(xB){Object.defineProperty(xB,"__esModule",{value:!0});xB.popNumber=xB.popScheduler=xB.popResultSelector=void 0;var vPe=Yt(),kPe=Wy();function uA(e){return e[e.length-1]}function EPe(e){return vPe.isFunction(uA(e))?e.pop():void 0}xB.popResultSelector=EPe;function SPe(e){return kPe.isScheduler(uA(e))?e.pop():void 0}xB.popScheduler=SPe;function $Pe(e,t){return typeof uA(e)==="number"?e.pop():t}xB.popNumber=$Pe});var wx=w(function(kB){Object.defineProperty(kB,"__esModule",{value:!0});kB.isArrayLike=void 0;kB.isArrayLike=function(e){return e&&typeof e.length==="number"&&typeof e!=="function"}});var dA=w(function(SB){Object.defineProperty(SB,"__esModule",{value:!0});SB.isPromise=void 0;var CPe=Yt();function APe(e){return CPe.isFunction(e===null||e===void 0?void 0:e.then)}SB.isPromise=APe});var fA=w(function(DB){Object.defineProperty(DB,"__esModule",{value:!0});DB.isInteropObservable=void 0;var OPe=Vy(),TPe=Yt();function PPe(e){return TPe.isFunction(e[OPe.observable])}DB.isInteropObservable=PPe});var pA=w(function(CB){Object.defineProperty(CB,"__esModule",{value:!0});CB.isAsyncIterable=void 0;var IPe=Yt();function NPe(e){return Symbol.asyncIterator&&IPe.isFunction(e===null||e===void 0?void 0:e[Symbol.asyncIterator])}CB.isAsyncIterable=NPe});var mA=w(function(OB){Object.defineProperty(OB,"__esModule",{value:!0});OB.createInvalidObservableTypeError=void 0;function FPe(e){return TypeError("You provided "+(e!==null&&typeof e==="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}OB.createInvalidObservableTypeError=FPe});var hA=w(function(IB){Object.defineProperty(IB,"__esModule",{value:!0});IB.iterator=IB.getSymbolIterator=void 0;function PB(){if(typeof Symbol!=="function"||!Symbol.iterator)return"@@iterator";return Symbol.iterator}IB.getSymbolIterator=PB;IB.iterator=PB()});var gA=w(function(FB){Object.defineProperty(FB,"__esModule",{value:!0});FB.isIterable=void 0;var jPe=hA(),LPe=Yt();function qPe(e){return LPe.isFunction(e===null||e===void 0?void 0:e[jPe.iterator])}FB.isIterable=qPe});var _x=w(function(Vs){var BPe=Vs&&Vs.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(d){return c([l,d])}}function c(l){if(r)throw TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(s=l[0]&2?o.return:l[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,l[1])).done)return s;if(o=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if((s=n.trys,!(s=s.length>0&&s[s.length-1]))&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}if(s[2])n.ops.pop();n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},_m=Vs&&Vs.__await||function(e){return this instanceof _m?(this.v=e,this):new _m(e)},UPe=Vs&&Vs.__asyncGenerator||function(e,t,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),o,s=[];return o={},i("next"),i("throw"),i("return"),o[Symbol.asyncIterator]=function(){return this},o;function i(p){if(r[p])o[p]=function(m){return new Promise(function(h,g){s.push([p,m,h,g])>1||a(p,m)})}}function a(p,m){try{c(r[p](m))}catch(h){f(s[0][3],h)}}function c(p){p.value instanceof _m?Promise.resolve(p.value.v).then(l,d):f(s[0][2],p)}function l(p){a("next",p)}function d(p){a("throw",p)}function f(p,m){if(p(m),s.shift(),s.length)a(s[0][0],s[0][1])}};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.isReadableStreamLike=Vs.readableStreamLikeToAsyncGenerator=void 0;var HPe=Yt();function VPe(e){return UPe(this,arguments,function(){var n,r,o,s;return BPe(this,function(i){switch(i.label){case 0:n=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,_m(n.read())];case 3:if(r=i.sent(),o=r.value,s=r.done,!s)return[3,5];return[4,_m(void 0)];case 4:return[2,i.sent()];case 5:return[4,_m(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}Vs.readableStreamLikeToAsyncGenerator=VPe;function zPe(e){return HPe.isFunction(e===null||e===void 0?void 0:e.getReader)}Vs.isReadableStreamLike=zPe});var at=w(function(xn){var GPe=xn&&xn.__awaiter||function(e,t,n,r){function o(s){return s instanceof n?s:new n(function(i){i(s)})}return new(n||(n=Promise))(function(s,i){function a(d){try{l(r.next(d))}catch(f){i(f)}}function c(d){try{l(r.throw(d))}catch(f){i(f)}}function l(d){d.done?s(d.value):o(d.value).then(a,c)}l((r=r.apply(e,t||[])).next())})},WPe=xn&&xn.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(d){return c([l,d])}}function c(l){if(r)throw TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(s=l[0]&2?o.return:l[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,l[1])).done)return s;if(o=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if((s=n.trys,!(s=s.length>0&&s[s.length-1]))&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}if(s[2])n.ops.pop();n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},KPe=xn&&xn.__asyncValues||function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof yA==="function"?yA(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(i){return new Promise(function(a,c){i=e[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},i)}},yA=xn&&xn.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(xn,"__esModule",{value:!0});xn.fromReadableStreamLike=xn.fromAsyncIterable=xn.fromIterable=xn.fromPromise=xn.fromArrayLike=xn.fromInteropObservable=xn.innerFrom=void 0;var JPe=wx(),YPe=dA(),xm=en(),XPe=fA(),QPe=pA(),ZPe=mA(),eIe=gA(),jB=_x(),tIe=Yt(),nIe=GC(),rIe=Vy();function oIe(e){if(e instanceof xm.Observable)return e;if(e!=null){if(XPe.isInteropObservable(e))return LB(e);if(JPe.isArrayLike(e))return qB(e);if(YPe.isPromise(e))return BB(e);if(QPe.isAsyncIterable(e))return bA(e);if(eIe.isIterable(e))return UB(e);if(jB.isReadableStreamLike(e))return HB(e)}throw ZPe.createInvalidObservableTypeError(e)}xn.innerFrom=oIe;function LB(e){return new xm.Observable(function(t){var n=e[rIe.observable]();if(tIe.isFunction(n.subscribe))return n.subscribe(t);throw TypeError("Provided object does not correctly implement Symbol.observable")})}xn.fromInteropObservable=LB;function qB(e){return new xm.Observable(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}xn.fromArrayLike=qB;function BB(e){return new xm.Observable(function(t){e.then(function(n){if(!t.closed)t.next(n),t.complete()},function(n){return t.error(n)}).then(null,nIe.reportUnhandledError)})}xn.fromPromise=BB;function UB(e){return new xm.Observable(function(t){var n,r;try{for(var o=yA(e),s=o.next();!s.done;s=o.next()){var i=s.value;if(t.next(i),t.closed)return}}catch(a){n={error:a}}finally{try{if(s&&!s.done&&(r=o.return))r.call(o)}finally{if(n)throw n.error}}t.complete()})}xn.fromIterable=UB;function bA(e){return new xm.Observable(function(t){sIe(e,t).catch(function(n){return t.error(n)})})}xn.fromAsyncIterable=bA;function HB(e){return bA(jB.readableStreamLikeToAsyncGenerator(e))}xn.fromReadableStreamLike=HB;function sIe(e,t){var n,r,o,s;return GPe(this,void 0,void 0,function(){var i,a;return WPe(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=KPe(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(i=r.value,t.next(i),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:if(c.trys.push([6,,9,10]),!(r&&!r.done&&(s=n.return)))return[3,8];return[4,s.call(n)];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}});var jc=w(function(VB){Object.defineProperty(VB,"__esModule",{value:!0});VB.executeSchedule=void 0;function iIe(e,t,n,r,o){if(r===void 0)r=0;if(o===void 0)o=!1;var s=t.schedule(function(){if(n(),o)e.add(this.schedule(null,r));else this.unsubscribe()},r);if(e.add(s),!o)return s}VB.executeSchedule=iIe});var Ky=w(function(GB){Object.defineProperty(GB,"__esModule",{value:!0});GB.observeOn=void 0;var wA=jc(),aIe=ue(),cIe=Re();function lIe(e,t){if(t===void 0)t=0;return aIe.operate(function(n,r){n.subscribe(cIe.createOperatorSubscriber(r,function(o){return wA.executeSchedule(r,e,function(){return r.next(o)},t)},function(){return wA.executeSchedule(r,e,function(){return r.complete()},t)},function(o){return wA.executeSchedule(r,e,function(){return r.error(o)},t)}))})}GB.observeOn=lIe});var Jy=w(function(KB){Object.defineProperty(KB,"__esModule",{value:!0});KB.subscribeOn=void 0;var uIe=ue();function dIe(e,t){if(t===void 0)t=0;return uIe.operate(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}KB.subscribeOn=dIe});var QB=w(function(YB){Object.defineProperty(YB,"__esModule",{value:!0});YB.scheduleObservable=void 0;var fIe=at(),pIe=Ky(),mIe=Jy();function hIe(e,t){return fIe.innerFrom(e).pipe(mIe.subscribeOn(t),pIe.observeOn(t))}YB.scheduleObservable=hIe});var t5=w(function(ZB){Object.defineProperty(ZB,"__esModule",{value:!0});ZB.schedulePromise=void 0;var gIe=at(),yIe=Ky(),bIe=Jy();function wIe(e,t){return gIe.innerFrom(e).pipe(bIe.subscribeOn(t),yIe.observeOn(t))}ZB.schedulePromise=wIe});var o5=w(function(n5){Object.defineProperty(n5,"__esModule",{value:!0});n5.scheduleArray=void 0;var _Ie=en();function xIe(e,t){return new _Ie.Observable(function(n){var r=0;return t.schedule(function(){if(r===e.length)n.complete();else if(n.next(e[r++]),!n.closed)this.schedule()})})}n5.scheduleArray=xIe});var _A=w(function(i5){Object.defineProperty(i5,"__esModule",{value:!0});i5.scheduleIterable=void 0;var vIe=en(),kIe=hA(),EIe=Yt(),s5=jc();function SIe(e,t){return new vIe.Observable(function(n){var r;return s5.executeSchedule(n,t,function(){r=e[kIe.iterator](),s5.executeSchedule(n,t,function(){var o,s,i;try{o=r.next(),s=o.value,i=o.done}catch(a){n.error(a);return}if(i)n.complete();else n.next(s)},0,!0)}),function(){return EIe.isFunction(r===null||r===void 0?void 0:r.return)&&r.return()}})}i5.scheduleIterable=SIe});var xA=w(function(l5){Object.defineProperty(l5,"__esModule",{value:!0});l5.scheduleAsyncIterable=void 0;var $Ie=en(),c5=jc();function DIe(e,t){if(!e)throw Error("Iterable cannot be null");return new $Ie.Observable(function(n){c5.executeSchedule(n,t,function(){var r=e[Symbol.asyncIterator]();c5.executeSchedule(n,t,function(){r.next().then(function(o){if(o.done)n.complete();else n.next(o.value)})},0,!0)})})}l5.scheduleAsyncIterable=DIe});var p5=w(function(d5){Object.defineProperty(d5,"__esModule",{value:!0});d5.scheduleReadableStreamLike=void 0;var RIe=xA(),CIe=_x();function AIe(e,t){return RIe.scheduleAsyncIterable(CIe.readableStreamLikeToAsyncGenerator(e),t)}d5.scheduleReadableStreamLike=AIe});var vA=w(function(m5){Object.defineProperty(m5,"__esModule",{value:!0});m5.scheduled=void 0;var OIe=QB(),TIe=t5(),PIe=o5(),IIe=_A(),NIe=xA(),FIe=fA(),MIe=dA(),jIe=wx(),LIe=gA(),qIe=pA(),BIe=mA(),UIe=_x(),HIe=p5();function VIe(e,t){if(e!=null){if(FIe.isInteropObservable(e))return OIe.scheduleObservable(e,t);if(jIe.isArrayLike(e))return PIe.scheduleArray(e,t);if(MIe.isPromise(e))return TIe.schedulePromise(e,t);if(qIe.isAsyncIterable(e))return NIe.scheduleAsyncIterable(e,t);if(LIe.isIterable(e))return IIe.scheduleIterable(e,t);if(UIe.isReadableStreamLike(e))return HIe.scheduleReadableStreamLike(e,t)}throw BIe.createInvalidObservableTypeError(e)}m5.scheduled=VIe});var Lc=w(function(g5){Object.defineProperty(g5,"__esModule",{value:!0});g5.from=void 0;var zIe=vA(),GIe=at();function WIe(e,t){return t?zIe.scheduled(e,t):GIe.innerFrom(e)}g5.from=WIe});var xx=w(function(b5){Object.defineProperty(b5,"__esModule",{value:!0});b5.of=void 0;var KIe=Yo(),JIe=Lc();function YIe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=KIe.popScheduler(e);return JIe.from(e,n)}b5.of=YIe});var kA=w(function(_5){Object.defineProperty(_5,"__esModule",{value:!0});_5.throwError=void 0;var XIe=en(),QIe=Yt();function ZIe(e,t){var n=QIe.isFunction(e)?e:function(){return e},r=function(o){return o.error(n())};return new XIe.Observable(t?function(o){return t.schedule(r,0,o)}:r)}_5.throwError=ZIe});var vx=w(function(E5){Object.defineProperty(E5,"__esModule",{value:!0});E5.observeNotification=E5.Notification=E5.NotificationKind=void 0;var eNe=Ai(),tNe=xx(),nNe=kA(),rNe=Yt(),oNe;(function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"})(oNe=E5.NotificationKind||(E5.NotificationKind={}));var sNe=function(){function e(t,n,r){this.kind=t,this.value=n,this.error=r,this.hasValue=t==="N"}return e.prototype.observe=function(t){return k5(this,t)},e.prototype.do=function(t,n,r){var o=this,{kind:s,value:i,error:a}=o;return s==="N"?t===null||t===void 0?void 0:t(i):s==="E"?n===null||n===void 0?void 0:n(a):r===null||r===void 0?void 0:r()},e.prototype.accept=function(t,n,r){var o;return rNe.isFunction((o=t)===null||o===void 0?void 0:o.next)?this.observe(t):this.do(t,n,r)},e.prototype.toObservable=function(){var t=this,{kind:n,value:r,error:o}=t,s=n==="N"?tNe.of(r):n==="E"?nNe.throwError(function(){return o}):n==="C"?eNe.EMPTY:0;if(!s)throw TypeError("Unexpected notification kind "+n);return s},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();E5.Notification=sNe;function k5(e,t){var n,r,o,s=e,{kind:i,value:a,error:c}=s;if(typeof i!=="string")throw TypeError('Invalid notification, missing "kind"');i==="N"?(n=t.next)===null||n===void 0||n.call(t,a):i==="E"?(r=t.error)===null||r===void 0||r.call(t,c):(o=t.complete)===null||o===void 0||o.call(t)}E5.observeNotification=k5});var C5=w(function(D5){Object.defineProperty(D5,"__esModule",{value:!0});D5.isObservable=void 0;var aNe=en(),$5=Yt();function cNe(e){return!!e&&(e instanceof aNe.Observable||$5.isFunction(e.lift)&&$5.isFunction(e.subscribe))}D5.isObservable=cNe});var Xl=w(function(A5){Object.defineProperty(A5,"__esModule",{value:!0});A5.EmptyError=void 0;var lNe=Kl();A5.EmptyError=lNe.createErrorClass(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})});var I5=w(function(T5){Object.defineProperty(T5,"__esModule",{value:!0});T5.lastValueFrom=void 0;var uNe=Xl();function dNe(e,t){var n=typeof t==="object";return new Promise(function(r,o){var s=!1,i;e.subscribe({next:function(a){i=a,s=!0},error:o,complete:function(){if(s)r(i);else if(n)r(t.defaultValue);else o(new uNe.EmptyError)}})})}T5.lastValueFrom=dNe});var M5=w(function(N5){Object.defineProperty(N5,"__esModule",{value:!0});N5.firstValueFrom=void 0;var fNe=Xl(),pNe=om();function mNe(e,t){var n=typeof t==="object";return new Promise(function(r,o){var s=new pNe.SafeSubscriber({next:function(i){r(i),s.unsubscribe()},error:o,complete:function(){if(n)r(t.defaultValue);else o(new fNe.EmptyError)}});e.subscribe(s)})}N5.firstValueFrom=mNe});var EA=w(function(j5){Object.defineProperty(j5,"__esModule",{value:!0});j5.ArgumentOutOfRangeError=void 0;var hNe=Kl();j5.ArgumentOutOfRangeError=hNe.createErrorClass(function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})});var SA=w(function(q5){Object.defineProperty(q5,"__esModule",{value:!0});q5.NotFoundError=void 0;var gNe=Kl();q5.NotFoundError=gNe.createErrorClass(function(e){return function(n){e(this),this.name="NotFoundError",this.message=n}})});var $A=w(function(U5){Object.defineProperty(U5,"__esModule",{value:!0});U5.SequenceError=void 0;var yNe=Kl();U5.SequenceError=yNe.createErrorClass(function(e){return function(n){e(this),this.name="SequenceError",this.message=n}})});var kx=w(function(V5){Object.defineProperty(V5,"__esModule",{value:!0});V5.isValidDate=void 0;function bNe(e){return e instanceof Date&&!isNaN(e)}V5.isValidDate=bNe});var Ex=w(function(G5){Object.defineProperty(G5,"__esModule",{value:!0});G5.timeout=G5.TimeoutError=void 0;var wNe=Jo(),_Ne=kx(),xNe=ue(),vNe=at(),kNe=Kl(),ENe=Re(),SNe=jc();G5.TimeoutError=kNe.createErrorClass(function(e){return function(n){if(n===void 0)n=null;e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=n}});function $Ne(e,t){var n=_Ne.isValidDate(e)?{first:e}:typeof e==="number"?{each:e}:e,{first:r,each:o,with:s}=n,i=s===void 0?DNe:s,a=n.scheduler,c=a===void 0?t!==null&&t!==void 0?t:wNe.asyncScheduler:a,l=n.meta,d=l===void 0?null:l;if(r==null&&o==null)throw TypeError("No timeout provided.");return xNe.operate(function(f,p){var m,h,g=null,y=0,b=function(_){h=SNe.executeSchedule(p,c,function(){try{m.unsubscribe(),vNe.innerFrom(i({meta:d,lastValue:g,seen:y})).subscribe(p)}catch(x){p.error(x)}},_)};m=f.subscribe(ENe.createOperatorSubscriber(p,function(_){h===null||h===void 0||h.unsubscribe(),y++,p.next(g=_),o>0&&b(o)},void 0,void 0,function(){if(!(h===null||h===void 0?void 0:h.closed))h===null||h===void 0||h.unsubscribe();g=null})),!y&&b(r!=null?typeof r==="number"?r:+r-c.now():o)})}G5.timeout=$Ne;function DNe(e){throw new G5.TimeoutError(e)}});var Ql=w(function(J5){Object.defineProperty(J5,"__esModule",{value:!0});J5.map=void 0;var RNe=ue(),CNe=Re();function ANe(e,t){return RNe.operate(function(n,r){var o=0;n.subscribe(CNe.createOperatorSubscriber(r,function(s){r.next(e.call(t,s,o++))}))})}J5.map=ANe});var eu=w(function(Zl){var ONe=Zl&&Zl.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},TNe=Zl&&Zl.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(Zl,"__esModule",{value:!0});Zl.mapOneOrManyArgs=void 0;var PNe=Ql(),INe=Array.isArray;function NNe(e,t){return INe(t)?e.apply(void 0,TNe([],ONe(t))):e(t)}function FNe(e){return PNe.map(function(t){return NNe(e,t)})}Zl.mapOneOrManyArgs=FNe});var RA=w(function(tu){var MNe=tu&&tu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},X5=tu&&tu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(tu,"__esModule",{value:!0});tu.bindCallbackInternals=void 0;var jNe=Wy(),LNe=en(),qNe=Jy(),BNe=eu(),UNe=Ky(),HNe=yx();function DA(e,t,n,r){if(n)if(jNe.isScheduler(n))r=n;else return function(){var o=[];for(var s=0;s<arguments.length;s++)o[s]=arguments[s];return DA(e,t,r).apply(this,o).pipe(BNe.mapOneOrManyArgs(n))};if(r)return function(){var o=[];for(var s=0;s<arguments.length;s++)o[s]=arguments[s];return DA(e,t).apply(this,o).pipe(qNe.subscribeOn(r),UNe.observeOn(r))};return function(){var o=this,s=[];for(var i=0;i<arguments.length;i++)s[i]=arguments[i];var a=new HNe.AsyncSubject,c=!0;return new LNe.Observable(function(l){var d=a.subscribe(l);if(c){c=!1;var f=!1,p=!1;if(t.apply(o,X5(X5([],MNe(s)),[function(){var m=[];for(var h=0;h<arguments.length;h++)m[h]=arguments[h];if(e){var g=m.shift();if(g!=null){a.error(g);return}}if(a.next(1<m.length?m:m[0]),p=!0,f)a.complete()}])),p)a.complete();f=!0}return d})}}tu.bindCallbackInternals=DA});var eU=w(function(Q5){Object.defineProperty(Q5,"__esModule",{value:!0});Q5.bindCallback=void 0;var VNe=RA();function zNe(e,t,n){return VNe.bindCallbackInternals(!1,e,t,n)}Q5.bindCallback=zNe});var rU=w(function(tU){Object.defineProperty(tU,"__esModule",{value:!0});tU.bindNodeCallback=void 0;var GNe=RA();function WNe(e,t,n){return GNe.bindCallbackInternals(!0,e,t,n)}tU.bindNodeCallback=WNe});var CA=w(function(oU){Object.defineProperty(oU,"__esModule",{value:!0});oU.argsArgArrayOrObject=void 0;var KNe=Array.isArray,{getPrototypeOf:JNe,prototype:YNe,keys:XNe}=Object;function QNe(e){if(e.length===1){var t=e[0];if(KNe(t))return{args:t,keys:null};if(ZNe(t)){var n=XNe(t);return{args:n.map(function(r){return t[r]}),keys:n}}}return{args:e,keys:null}}oU.argsArgArrayOrObject=QNe;function ZNe(e){return e&&typeof e==="object"&&JNe(e)===YNe}});var AA=w(function(iU){Object.defineProperty(iU,"__esModule",{value:!0});iU.createObject=void 0;function eFe(e,t){return e.reduce(function(n,r,o){return n[r]=t[o],n},{})}iU.createObject=eFe});var Sx=w(function(pU){Object.defineProperty(pU,"__esModule",{value:!0});pU.combineLatestInit=pU.combineLatest=void 0;var tFe=en(),nFe=CA(),uU=Lc(),dU=zr(),rFe=eu(),cU=Yo(),oFe=AA(),sFe=Re(),iFe=jc();function aFe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=cU.popScheduler(e),r=cU.popResultSelector(e),o=nFe.argsArgArrayOrObject(e),{args:s,keys:i}=o;if(s.length===0)return uU.from([],n);var a=new tFe.Observable(fU(s,n,i?function(c){return oFe.createObject(i,c)}:dU.identity));return r?a.pipe(rFe.mapOneOrManyArgs(r)):a}pU.combineLatest=aFe;function fU(e,t,n){if(n===void 0)n=dU.identity;return function(r){lU(t,function(){var o=e.length,s=Array(o),i=o,a=o,c=function(d){lU(t,function(){var f=uU.from(e[d],t),p=!1;f.subscribe(sFe.createOperatorSubscriber(r,function(m){if(s[d]=m,!p)p=!0,a--;if(!a)r.next(n(s.slice()))},function(){if(!--i)r.complete()}))},r)};for(var l=0;l<o;l++)c(l)},r)}}pU.combineLatestInit=fU;function lU(e,t,n){if(e)iFe.executeSchedule(n,e,t);else t()}});var $x=w(function(gU){Object.defineProperty(gU,"__esModule",{value:!0});gU.mergeInternals=void 0;var lFe=at(),uFe=jc(),hU=Re();function dFe(e,t,n,r,o,s,i,a){var c=[],l=0,d=0,f=!1,p=function(){if(f&&!c.length&&!l)t.complete()},m=function(g){return l<r?h(g):c.push(g)},h=function(g){s&&t.next(g),l++;var y=!1;lFe.innerFrom(n(g,d++)).subscribe(hU.createOperatorSubscriber(t,function(b){if(o===null||o===void 0||o(b),s)m(b);else t.next(b)},function(){y=!0},void 0,function(){if(y)try{l--;var b=function(){var _=c.shift();if(i)uFe.executeSchedule(t,i,function(){return h(_)});else h(_)};while(c.length&&l<r)b();p()}catch(_){t.error(_)}}))};return e.subscribe(hU.createOperatorSubscriber(t,m,function(){f=!0,p()})),function(){a===null||a===void 0||a()}}gU.mergeInternals=dFe});var qc=w(function(wU){Object.defineProperty(wU,"__esModule",{value:!0});wU.mergeMap=void 0;var fFe=Ql(),pFe=at(),mFe=ue(),hFe=$x(),gFe=Yt();function bU(e,t,n){if(n===void 0)n=1/0;if(gFe.isFunction(t))return bU(function(r,o){return fFe.map(function(s,i){return t(r,s,o,i)})(pFe.innerFrom(e(r,o)))},n);else if(typeof t==="number")n=t;return mFe.operate(function(r,o){return hFe.mergeInternals(r,o,e,n)})}wU.mergeMap=bU});var Yy=w(function(xU){Object.defineProperty(xU,"__esModule",{value:!0});xU.mergeAll=void 0;var yFe=qc(),bFe=zr();function wFe(e){if(e===void 0)e=1/0;return yFe.mergeMap(bFe.identity,e)}xU.mergeAll=wFe});var Dx=w(function(kU){Object.defineProperty(kU,"__esModule",{value:!0});kU.concatAll=void 0;var _Fe=Yy();function xFe(){return _Fe.mergeAll(1)}kU.concatAll=xFe});var Xy=w(function(SU){Object.defineProperty(SU,"__esModule",{value:!0});SU.concat=void 0;var vFe=Dx(),kFe=Yo(),EFe=Lc();function SFe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return vFe.concatAll()(EFe.from(e,kFe.popScheduler(e)))}SU.concat=SFe});var Qy=w(function(DU){Object.defineProperty(DU,"__esModule",{value:!0});DU.defer=void 0;var $Fe=en(),DFe=at();function RFe(e){return new $Fe.Observable(function(t){DFe.innerFrom(e()).subscribe(t)})}DU.defer=RFe});var OU=w(function(CU){Object.defineProperty(CU,"__esModule",{value:!0});CU.connectable=void 0;var CFe=Gr(),AFe=en(),OFe=Qy(),TFe={connector:function(){return new CFe.Subject},resetOnDisconnect:!0};function PFe(e,t){if(t===void 0)t=TFe;var n=null,r=t.connector,o=t.resetOnDisconnect,s=o===void 0?!0:o,i=r(),a=new AFe.Observable(function(c){return i.subscribe(c)});return a.connect=function(){if(!n||n.closed){if(n=OFe.defer(function(){return e}).subscribe(i),s)n.add(function(){return i=r()})}return n},a}CU.connectable=PFe});var IU=w(function(TU){Object.defineProperty(TU,"__esModule",{value:!0});TU.forkJoin=void 0;var IFe=en(),NFe=CA(),FFe=at(),MFe=Yo(),jFe=Re(),LFe=eu(),qFe=AA();function BFe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=MFe.popResultSelector(e),r=NFe.argsArgArrayOrObject(e),{args:o,keys:s}=r,i=new IFe.Observable(function(a){var c=o.length;if(!c){a.complete();return}var l=Array(c),d=c,f=c,p=function(h){var g=!1;FFe.innerFrom(o[h]).subscribe(jFe.createOperatorSubscriber(a,function(y){if(!g)g=!0,f--;l[h]=y},function(){return d--},void 0,function(){if(!d||!g){if(!f)a.next(s?qFe.createObject(s,l):l);a.complete()}}))};for(var m=0;m<c;m++)p(m)});return n?i.pipe(LFe.mapOneOrManyArgs(n)):i}TU.forkJoin=BFe});var FU=w(function(vm){var UFe=vm&&vm.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s};Object.defineProperty(vm,"__esModule",{value:!0});vm.fromEvent=void 0;var HFe=at(),VFe=en(),zFe=qc(),GFe=wx(),cf=Yt(),WFe=eu(),KFe=["addListener","removeListener"],JFe=["addEventListener","removeEventListener"],YFe=["on","off"];function OA(e,t,n,r){if(cf.isFunction(n))r=n,n=void 0;if(r)return OA(e,t,n).pipe(WFe.mapOneOrManyArgs(r));var o=UFe(ZFe(e)?JFe.map(function(a){return function(c){return e[a](t,c,n)}}):XFe(e)?KFe.map(NU(e,t)):QFe(e)?YFe.map(NU(e,t)):[],2),s=o[0],i=o[1];if(!s){if(GFe.isArrayLike(e))return zFe.mergeMap(function(a){return OA(a,t,n)})(HFe.innerFrom(e))}if(!s)throw TypeError("Invalid event target");return new VFe.Observable(function(a){var c=function(){var l=[];for(var d=0;d<arguments.length;d++)l[d]=arguments[d];return a.next(1<l.length?l:l[0])};return s(c),function(){return i(c)}})}vm.fromEvent=OA;function NU(e,t){return function(n){return function(r){return e[n](t,r)}}}function XFe(e){return cf.isFunction(e.addListener)&&cf.isFunction(e.removeListener)}function QFe(e){return cf.isFunction(e.on)&&cf.isFunction(e.off)}function ZFe(e){return cf.isFunction(e.addEventListener)&&cf.isFunction(e.removeEventListener)}});var qU=w(function(jU){Object.defineProperty(jU,"__esModule",{value:!0});jU.fromEventPattern=void 0;var e6e=en(),t6e=Yt(),n6e=eu();function MU(e,t,n){if(n)return MU(e,t).pipe(n6e.mapOneOrManyArgs(n));return new e6e.Observable(function(r){var o=function(){var i=[];for(var a=0;a<arguments.length;a++)i[a]=arguments[a];return r.next(i.length===1?i[0]:i)},s=e(o);return t6e.isFunction(t)?function(){return t(o,s)}:void 0})}jU.fromEventPattern=MU});var UU=w(function(km){var r6e=km&&km.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(d){return c([l,d])}}function c(l){if(r)throw TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(s=l[0]&2?o.return:l[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,l[1])).done)return s;if(o=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if((s=n.trys,!(s=s.length>0&&s[s.length-1]))&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}if(s[2])n.ops.pop();n.trys.pop();continue}l=t.call(e,n)}catch(d){l=[6,d],o=0}finally{r=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Object.defineProperty(km,"__esModule",{value:!0});km.generate=void 0;var BU=zr(),o6e=Wy(),s6e=Qy(),i6e=_A();function a6e(e,t,n,r,o){var s,i,a,c;if(arguments.length===1)s=e,c=s.initialState,t=s.condition,n=s.iterate,i=s.resultSelector,a=i===void 0?BU.identity:i,o=s.scheduler;else if(c=e,!r||o6e.isScheduler(r))a=BU.identity,o=r;else a=r;function l(){var d;return r6e(this,function(f){switch(f.label){case 0:d=c,f.label=1;case 1:if(!(!t||t(d)))return[3,4];return[4,a(d)];case 2:f.sent(),f.label=3;case 3:return d=n(d),[3,1];case 4:return[2]}})}return s6e.defer(o?function(){return i6e.scheduleIterable(l(),o)}:l)}km.generate=a6e});var zU=w(function(HU){Object.defineProperty(HU,"__esModule",{value:!0});HU.iif=void 0;var c6e=Qy();function l6e(e,t,n){return c6e.defer(function(){return e()?t:n})}HU.iif=l6e});var nu=w(function(GU){Object.defineProperty(GU,"__esModule",{value:!0});GU.timer=void 0;var u6e=en(),d6e=Jo(),f6e=Wy(),p6e=kx();function m6e(e,t,n){if(e===void 0)e=0;if(n===void 0)n=d6e.async;var r=-1;if(t!=null)if(f6e.isScheduler(t))n=t;else r=t;return new u6e.Observable(function(o){var s=p6e.isValidDate(e)?+e-n.now():e;if(s<0)s=0;var i=0;return n.schedule(function(){if(!o.closed)if(o.next(i++),0<=r)this.schedule(void 0,r);else o.complete()},s)})}GU.timer=m6e});var TA=w(function(KU){Object.defineProperty(KU,"__esModule",{value:!0});KU.interval=void 0;var h6e=Jo(),g6e=nu();function y6e(e,t){if(e===void 0)e=0;if(t===void 0)t=h6e.asyncScheduler;if(e<0)e=0;return g6e.timer(e,e,t)}KU.interval=y6e});var ZU=w(function(XU){Object.defineProperty(XU,"__esModule",{value:!0});XU.merge=void 0;var b6e=Yy(),w6e=at(),_6e=Ai(),YU=Yo(),x6e=Lc();function v6e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=YU.popScheduler(e),r=YU.popNumber(e,1/0),o=e;return!o.length?_6e.EMPTY:o.length===1?w6e.innerFrom(o[0]):b6e.mergeAll(r)(x6e.from(o,n))}XU.merge=v6e});var PA=w(function(e9){Object.defineProperty(e9,"__esModule",{value:!0});e9.never=e9.NEVER=void 0;var k6e=en(),E6e=Vr();e9.NEVER=new k6e.Observable(E6e.noop);function S6e(){return e9.NEVER}e9.never=S6e});var Em=w(function(r9){Object.defineProperty(r9,"__esModule",{value:!0});r9.argsOrArgArray=void 0;var $6e=Array.isArray;function D6e(e){return e.length===1&&$6e(e[0])?e[0]:e}r9.argsOrArgArray=D6e});var IA=w(function(i9){Object.defineProperty(i9,"__esModule",{value:!0});i9.onErrorResumeNext=void 0;var R6e=en(),C6e=Em(),A6e=Re(),s9=Vr(),O6e=at();function T6e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=C6e.argsOrArgArray(e);return new R6e.Observable(function(r){var o=0,s=function(){if(o<n.length){var i=void 0;try{i=O6e.innerFrom(n[o++])}catch(c){s();return}var a=new A6e.OperatorSubscriber(r,void 0,s9.noop,s9.noop);i.subscribe(a),a.add(s)}else r.complete()};s()})}i9.onErrorResumeNext=T6e});var u9=w(function(c9){Object.defineProperty(c9,"__esModule",{value:!0});c9.pairs=void 0;var P6e=Lc();function I6e(e,t){return P6e.from(Object.entries(e),t)}c9.pairs=I6e});var p9=w(function(d9){Object.defineProperty(d9,"__esModule",{value:!0});d9.not=void 0;function N6e(e,t){return function(n,r){return!e.call(t,n,r)}}d9.not=N6e});var lf=w(function(m9){Object.defineProperty(m9,"__esModule",{value:!0});m9.filter=void 0;var F6e=ue(),M6e=Re();function j6e(e,t){return F6e.operate(function(n,r){var o=0;n.subscribe(M6e.createOperatorSubscriber(r,function(s){return e.call(t,s,o++)&&r.next(s)}))})}m9.filter=j6e});var _9=w(function(b9){Object.defineProperty(b9,"__esModule",{value:!0});b9.partition=void 0;var L6e=p9(),g9=lf(),y9=at();function q6e(e,t,n){return[g9.filter(t,n)(y9.innerFrom(e)),g9.filter(L6e.not(t,n))(y9.innerFrom(e))]}b9.partition=q6e});var NA=w(function(k9){Object.defineProperty(k9,"__esModule",{value:!0});k9.raceInit=k9.race=void 0;var B6e=en(),x9=at(),U6e=Em(),H6e=Re();function V6e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return e=U6e.argsOrArgArray(e),e.length===1?x9.innerFrom(e[0]):new B6e.Observable(v9(e))}k9.race=V6e;function v9(e){return function(t){var n=[],r=function(s){n.push(x9.innerFrom(e[s]).subscribe(H6e.createOperatorSubscriber(t,function(i){if(n){for(var a=0;a<n.length;a++)a!==s&&n[a].unsubscribe();n=null}t.next(i)})))};for(var o=0;n&&!t.closed&&o<e.length;o++)r(o)}}k9.raceInit=v9});var D9=w(function(S9){Object.defineProperty(S9,"__esModule",{value:!0});S9.range=void 0;var G6e=en(),W6e=Ai();function K6e(e,t,n){if(t==null)t=e,e=0;if(t<=0)return W6e.EMPTY;var r=t+e;return new G6e.Observable(n?function(o){var s=e;return n.schedule(function(){if(s<r)o.next(s++),this.schedule();else o.complete()})}:function(o){var s=e;while(s<r&&!o.closed)o.next(s++);o.complete()})}S9.range=K6e});var A9=w(function(R9){Object.defineProperty(R9,"__esModule",{value:!0});R9.using=void 0;var J6e=en(),Y6e=at(),X6e=Ai();function Q6e(e,t){return new J6e.Observable(function(n){var r=e(),o=t(r),s=o?Y6e.innerFrom(o):X6e.EMPTY;return s.subscribe(n),function(){if(r)r.unsubscribe()}})}R9.using=Q6e});var Rx=w(function(ru){var Z6e=ru&&ru.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},eMe=ru&&ru.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(ru,"__esModule",{value:!0});ru.zip=void 0;var tMe=en(),nMe=at(),rMe=Em(),oMe=Ai(),sMe=Re(),iMe=Yo();function aMe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=iMe.popResultSelector(e),r=rMe.argsOrArgArray(e);return r.length?new tMe.Observable(function(o){var s=r.map(function(){return[]}),i=r.map(function(){return!1});o.add(function(){s=i=null});var a=function(l){nMe.innerFrom(r[l]).subscribe(sMe.createOperatorSubscriber(o,function(d){if(s[l].push(d),s.every(function(p){return p.length})){var f=s.map(function(p){return p.shift()});if(o.next(n?n.apply(void 0,eMe([],Z6e(f))):f),s.some(function(p,m){return!p.length&&i[m]}))o.complete()}},function(){i[l]=!0,!s[l].length&&o.complete()}))};for(var c=0;!o.closed&&c<r.length;c++)a(c);return function(){s=i=null}}):oMe.EMPTY}ru.zip=aMe});var T9=w(function(O9){Object.defineProperty(O9,"__esModule",{value:!0})});var FA=w(function(I9){Object.defineProperty(I9,"__esModule",{value:!0});I9.audit=void 0;var cMe=ue(),lMe=at(),P9=Re();function uMe(e){return cMe.operate(function(t,n){var r=!1,o=null,s=null,i=!1,a=function(){if(s===null||s===void 0||s.unsubscribe(),s=null,r){r=!1;var l=o;o=null,n.next(l)}i&&n.complete()},c=function(){s=null,i&&n.complete()};t.subscribe(P9.createOperatorSubscriber(n,function(l){if(r=!0,o=l,!s)lMe.innerFrom(e(l)).subscribe(s=P9.createOperatorSubscriber(n,a,c))},function(){i=!0,(!r||!s||s.closed)&&n.complete()}))})}I9.audit=uMe});var j9=w(function(F9){Object.defineProperty(F9,"__esModule",{value:!0});F9.auditTime=void 0;var dMe=Jo(),fMe=FA(),pMe=nu();function mMe(e,t){if(t===void 0)t=dMe.asyncScheduler;return fMe.audit(function(){return pMe.timer(e,t)})}F9.auditTime=mMe});var U9=w(function(q9){Object.defineProperty(q9,"__esModule",{value:!0});q9.buffer=void 0;var hMe=ue(),gMe=Vr(),L9=Re(),yMe=at();function bMe(e){return hMe.operate(function(t,n){var r=[];return t.subscribe(L9.createOperatorSubscriber(n,function(o){return r.push(o)},function(){n.next(r),n.complete()})),yMe.innerFrom(e).subscribe(L9.createOperatorSubscriber(n,function(){var o=r;r=[],n.next(o)},gMe.noop)),function(){r=null}})}q9.buffer=bMe});var H9=w(function(Sm){var MA=Sm&&Sm.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Sm,"__esModule",{value:!0});Sm.bufferCount=void 0;var wMe=ue(),_Me=Re(),xMe=Mc();function vMe(e,t){if(t===void 0)t=null;return t=t!==null&&t!==void 0?t:e,wMe.operate(function(n,r){var o=[],s=0;n.subscribe(_Me.createOperatorSubscriber(r,function(i){var a,c,l,d,f=null;if(s++%t===0)o.push([]);try{for(var p=MA(o),m=p.next();!m.done;m=p.next()){var h=m.value;if(h.push(i),e<=h.length)f=f!==null&&f!==void 0?f:[],f.push(h)}}catch(b){a={error:b}}finally{try{if(m&&!m.done&&(c=p.return))c.call(p)}finally{if(a)throw a.error}}if(f)try{for(var g=MA(f),y=g.next();!y.done;y=g.next()){var h=y.value;xMe.arrRemove(o,h),r.next(h)}}catch(b){l={error:b}}finally{try{if(y&&!y.done&&(d=g.return))d.call(g)}finally{if(l)throw l.error}}},function(){var i,a;try{for(var c=MA(o),l=c.next();!l.done;l=c.next()){var d=l.value;r.next(d)}}catch(f){i={error:f}}finally{try{if(l&&!l.done&&(a=c.return))a.call(c)}finally{if(i)throw i.error}}r.complete()},void 0,function(){o=null}))})}Sm.bufferCount=vMe});var z9=w(function($m){var kMe=$m&&$m.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty($m,"__esModule",{value:!0});$m.bufferTime=void 0;var EMe=xs(),SMe=ue(),$Me=Re(),DMe=Mc(),RMe=Jo(),CMe=Yo(),V9=jc();function AMe(e){var t,n,r=[];for(var o=1;o<arguments.length;o++)r[o-1]=arguments[o];var s=(t=CMe.popScheduler(r))!==null&&t!==void 0?t:RMe.asyncScheduler,i=(n=r[0])!==null&&n!==void 0?n:null,a=r[1]||1/0;return SMe.operate(function(c,l){var d=[],f=!1,p=function(g){var{buffer:y,subs:b}=g;b.unsubscribe(),DMe.arrRemove(d,g),l.next(y),f&&m()},m=function(){if(d){var g=new EMe.Subscription;l.add(g);var y=[],b={buffer:y,subs:g};d.push(b),V9.executeSchedule(g,s,function(){return p(b)},e)}};if(i!==null&&i>=0)V9.executeSchedule(l,s,m,i,!0);else f=!0;m();var h=$Me.createOperatorSubscriber(l,function(g){var y,b,_=d.slice();try{for(var x=kMe(_),k=x.next();!k.done;k=x.next()){var v=k.value,C=v.buffer;C.push(g),a<=C.length&&p(v)}}catch(T){y={error:T}}finally{try{if(k&&!k.done&&(b=x.return))b.call(x)}finally{if(y)throw y.error}}},function(){while(d===null||d===void 0?void 0:d.length)l.next(d.shift().buffer);h===null||h===void 0||h.unsubscribe(),l.complete(),l.unsubscribe()},void 0,function(){return d=null});c.subscribe(h)})}$m.bufferTime=AMe});var K9=w(function(Dm){var OMe=Dm&&Dm.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Dm,"__esModule",{value:!0});Dm.bufferToggle=void 0;var TMe=xs(),PMe=ue(),G9=at(),jA=Re(),W9=Vr(),IMe=Mc();function NMe(e,t){return PMe.operate(function(n,r){var o=[];G9.innerFrom(e).subscribe(jA.createOperatorSubscriber(r,function(s){var i=[];o.push(i);var a=new TMe.Subscription,c=function(){IMe.arrRemove(o,i),r.next(i),a.unsubscribe()};a.add(G9.innerFrom(t(s)).subscribe(jA.createOperatorSubscriber(r,c,W9.noop)))},W9.noop)),n.subscribe(jA.createOperatorSubscriber(r,function(s){var i,a;try{for(var c=OMe(o),l=c.next();!l.done;l=c.next()){var d=l.value;d.push(s)}}catch(f){i={error:f}}finally{try{if(l&&!l.done&&(a=c.return))a.call(c)}finally{if(i)throw i.error}}},function(){while(o.length>0)r.next(o.shift());r.complete()}))})}Dm.bufferToggle=NMe});var Q9=w(function(Y9){Object.defineProperty(Y9,"__esModule",{value:!0});Y9.bufferWhen=void 0;var FMe=ue(),MMe=Vr(),J9=Re(),jMe=at();function LMe(e){return FMe.operate(function(t,n){var r=null,o=null,s=function(){o===null||o===void 0||o.unsubscribe();var i=r;r=[],i&&n.next(i),jMe.innerFrom(e()).subscribe(o=J9.createOperatorSubscriber(n,s,MMe.noop))};s(),t.subscribe(J9.createOperatorSubscriber(n,function(i){return r===null||r===void 0?void 0:r.push(i)},function(){r&&n.next(r),n.complete()},void 0,function(){return r=o=null}))})}Y9.bufferWhen=LMe});var n7=w(function(e7){Object.defineProperty(e7,"__esModule",{value:!0});e7.catchError=void 0;var qMe=at(),BMe=Re(),UMe=ue();function Z9(e){return UMe.operate(function(t,n){var r=null,o=!1,s;if(r=t.subscribe(BMe.createOperatorSubscriber(n,void 0,void 0,function(i){if(s=qMe.innerFrom(e(i,Z9(e)(t))),r)r.unsubscribe(),r=null,s.subscribe(n);else o=!0})),o)r.unsubscribe(),r=null,s.subscribe(n)})}e7.catchError=Z9});var LA=w(function(r7){Object.defineProperty(r7,"__esModule",{value:!0});r7.scanInternals=void 0;var HMe=Re();function VMe(e,t,n,r,o){return function(s,i){var a=n,c=t,l=0;s.subscribe(HMe.createOperatorSubscriber(i,function(d){var f=l++;c=a?e(c,d,f):(a=!0,d),r&&i.next(c)},o&&function(){a&&i.next(c),i.complete()}))}}r7.scanInternals=VMe});var Rm=w(function(s7){Object.defineProperty(s7,"__esModule",{value:!0});s7.reduce=void 0;var zMe=LA(),GMe=ue();function WMe(e,t){return GMe.operate(zMe.scanInternals(e,t,arguments.length>=2,!1,!0))}s7.reduce=WMe});var qA=w(function(a7){Object.defineProperty(a7,"__esModule",{value:!0});a7.toArray=void 0;var KMe=Rm(),JMe=ue(),YMe=function(e,t){return e.push(t),e};function XMe(){return JMe.operate(function(e,t){KMe.reduce(YMe,[])(e).subscribe(t)})}a7.toArray=XMe});var BA=w(function(l7){Object.defineProperty(l7,"__esModule",{value:!0});l7.joinAllInternals=void 0;var QMe=zr(),ZMe=eu(),eje=zy(),tje=qc(),nje=qA();function rje(e,t){return eje.pipe(nje.toArray(),tje.mergeMap(function(n){return e(n)}),t?ZMe.mapOneOrManyArgs(t):QMe.identity)}l7.joinAllInternals=rje});var UA=w(function(d7){Object.defineProperty(d7,"__esModule",{value:!0});d7.combineLatestAll=void 0;var oje=Sx(),sje=BA();function ije(e){return sje.joinAllInternals(oje.combineLatest,e)}d7.combineLatestAll=ije});var h7=w(function(p7){Object.defineProperty(p7,"__esModule",{value:!0});p7.combineAll=void 0;var aje=UA();p7.combineAll=aje.combineLatestAll});var w7=w(function(ou){var g7=ou&&ou.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},y7=ou&&ou.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(ou,"__esModule",{value:!0});ou.combineLatest=void 0;var cje=Sx(),lje=ue(),uje=Em(),dje=eu(),fje=zy(),pje=Yo();function b7(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=pje.popResultSelector(e);return n?fje.pipe(b7.apply(void 0,y7([],g7(e))),dje.mapOneOrManyArgs(n)):lje.operate(function(r,o){cje.combineLatestInit(y7([r],g7(uje.argsOrArgArray(e))))(o)})}ou.combineLatest=b7});var _7=w(function(su){var mje=su&&su.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},hje=su&&su.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(su,"__esModule",{value:!0});su.combineLatestWith=void 0;var gje=w7();function yje(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return gje.combineLatest.apply(void 0,hje([],mje(e)))}su.combineLatestWith=yje});var HA=w(function(v7){Object.defineProperty(v7,"__esModule",{value:!0});v7.concatMap=void 0;var x7=qc(),bje=Yt();function wje(e,t){return bje.isFunction(t)?x7.mergeMap(e,t,1):x7.mergeMap(e,1)}v7.concatMap=wje});var D7=w(function(S7){Object.defineProperty(S7,"__esModule",{value:!0});S7.concatMapTo=void 0;var E7=HA(),_je=Yt();function xje(e,t){return _je.isFunction(t)?E7.concatMap(function(){return e},t):E7.concatMap(function(){return e})}S7.concatMapTo=xje});var R7=w(function(iu){var vje=iu&&iu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},kje=iu&&iu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(iu,"__esModule",{value:!0});iu.concat=void 0;var Eje=ue(),Sje=Dx(),$je=Yo(),Dje=Lc();function Rje(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=$je.popScheduler(e);return Eje.operate(function(r,o){Sje.concatAll()(Dje.from(kje([r],vje(e)),n)).subscribe(o)})}iu.concat=Rje});var C7=w(function(au){var Cje=au&&au.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},Aje=au&&au.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(au,"__esModule",{value:!0});au.concatWith=void 0;var Oje=R7();function Tje(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return Oje.concat.apply(void 0,Aje([],Cje(e)))}au.concatWith=Tje});var T7=w(function(A7){Object.defineProperty(A7,"__esModule",{value:!0});A7.fromSubscribable=void 0;var Pje=en();function Ije(e){return new Pje.Observable(function(t){return e.subscribe(t)})}A7.fromSubscribable=Ije});var Cx=w(function(P7){Object.defineProperty(P7,"__esModule",{value:!0});P7.connect=void 0;var Nje=Gr(),Fje=at(),Mje=ue(),jje=T7(),Lje={connector:function(){return new Nje.Subject}};function qje(e,t){if(t===void 0)t=Lje;var n=t.connector;return Mje.operate(function(r,o){var s=n();Fje.innerFrom(e(jje.fromSubscribable(s))).subscribe(o),o.add(r.subscribe(s))})}P7.connect=qje});var M7=w(function(N7){Object.defineProperty(N7,"__esModule",{value:!0});N7.count=void 0;var Bje=Rm();function Uje(e){return Bje.reduce(function(t,n,r){return!e||e(n,r)?t+1:t},0)}N7.count=Uje});var B7=w(function(L7){Object.defineProperty(L7,"__esModule",{value:!0});L7.debounce=void 0;var Hje=ue(),Vje=Vr(),j7=Re(),zje=at();function Gje(e){return Hje.operate(function(t,n){var r=!1,o=null,s=null,i=function(){if(s===null||s===void 0||s.unsubscribe(),s=null,r){r=!1;var a=o;o=null,n.next(a)}};t.subscribe(j7.createOperatorSubscriber(n,function(a){s===null||s===void 0||s.unsubscribe(),r=!0,o=a,s=j7.createOperatorSubscriber(n,i,Vje.noop),zje.innerFrom(e(a)).subscribe(s)},function(){i(),n.complete()},void 0,function(){o=s=null}))})}L7.debounce=Gje});var V7=w(function(U7){Object.defineProperty(U7,"__esModule",{value:!0});U7.debounceTime=void 0;var Wje=Jo(),Kje=ue(),Jje=Re();function Yje(e,t){if(t===void 0)t=Wje.asyncScheduler;return Kje.operate(function(n,r){var o=null,s=null,i=null,a=function(){if(o){o.unsubscribe(),o=null;var l=s;s=null,r.next(l)}};function c(){var l=i+e,d=t.now();if(d<l){o=this.schedule(void 0,l-d),r.add(o);return}a()}n.subscribe(Jje.createOperatorSubscriber(r,function(l){if(s=l,i=t.now(),!o)o=t.schedule(c,e),r.add(o)},function(){a(),r.complete()},void 0,function(){s=o=null}))})}U7.debounceTime=Yje});var Zy=w(function(z7){Object.defineProperty(z7,"__esModule",{value:!0});z7.defaultIfEmpty=void 0;var Xje=ue(),Qje=Re();function Zje(e){return Xje.operate(function(t,n){var r=!1;t.subscribe(Qje.createOperatorSubscriber(n,function(o){r=!0,n.next(o)},function(){if(!r)n.next(e);n.complete()}))})}z7.defaultIfEmpty=Zje});var e0=w(function(W7){Object.defineProperty(W7,"__esModule",{value:!0});W7.take=void 0;var eLe=Ai(),tLe=ue(),nLe=Re();function rLe(e){return e<=0?function(){return eLe.EMPTY}:tLe.operate(function(t,n){var r=0;t.subscribe(nLe.createOperatorSubscriber(n,function(o){if(++r<=e){if(n.next(o),e<=r)n.complete()}}))})}W7.take=rLe});var VA=w(function(J7){Object.defineProperty(J7,"__esModule",{value:!0});J7.ignoreElements=void 0;var oLe=ue(),sLe=Re(),iLe=Vr();function aLe(){return oLe.operate(function(e,t){e.subscribe(sLe.createOperatorSubscriber(t,iLe.noop))})}J7.ignoreElements=aLe});var zA=w(function(X7){Object.defineProperty(X7,"__esModule",{value:!0});X7.mapTo=void 0;var cLe=Ql();function lLe(e){return cLe.map(function(){return e})}X7.mapTo=lLe});var GA=w(function(tH){Object.defineProperty(tH,"__esModule",{value:!0});tH.delayWhen=void 0;var uLe=Xy(),Z7=e0(),dLe=VA(),fLe=zA(),pLe=qc(),mLe=at();function eH(e,t){if(t)return function(n){return uLe.concat(t.pipe(Z7.take(1),dLe.ignoreElements()),n.pipe(eH(e)))};return pLe.mergeMap(function(n,r){return mLe.innerFrom(e(n,r)).pipe(Z7.take(1),fLe.mapTo(n))})}tH.delayWhen=eH});var sH=w(function(rH){Object.defineProperty(rH,"__esModule",{value:!0});rH.delay=void 0;var hLe=Jo(),gLe=GA(),yLe=nu();function bLe(e,t){if(t===void 0)t=hLe.asyncScheduler;var n=yLe.timer(e,t);return gLe.delayWhen(function(){return n})}rH.delay=bLe});var cH=w(function(iH){Object.defineProperty(iH,"__esModule",{value:!0});iH.dematerialize=void 0;var wLe=vx(),_Le=ue(),xLe=Re();function vLe(){return _Le.operate(function(e,t){e.subscribe(xLe.createOperatorSubscriber(t,function(n){return wLe.observeNotification(n,t)}))})}iH.dematerialize=vLe});var fH=w(function(uH){Object.defineProperty(uH,"__esModule",{value:!0});uH.distinct=void 0;var kLe=ue(),lH=Re(),ELe=Vr(),SLe=at();function $Le(e,t){return kLe.operate(function(n,r){var o=new Set;n.subscribe(lH.createOperatorSubscriber(r,function(s){var i=e?e(s):s;if(!o.has(i))o.add(i),r.next(s)})),t&&SLe.innerFrom(t).subscribe(lH.createOperatorSubscriber(r,function(){return o.clear()},ELe.noop))})}uH.distinct=$Le});var WA=w(function(pH){Object.defineProperty(pH,"__esModule",{value:!0});pH.distinctUntilChanged=void 0;var DLe=zr(),RLe=ue(),CLe=Re();function ALe(e,t){if(t===void 0)t=DLe.identity;return e=e!==null&&e!==void 0?e:OLe,RLe.operate(function(n,r){var o,s=!0;n.subscribe(CLe.createOperatorSubscriber(r,function(i){var a=t(i);if(s||!e(o,a))s=!1,o=a,r.next(i)}))})}pH.distinctUntilChanged=ALe;function OLe(e,t){return e===t}});var yH=w(function(hH){Object.defineProperty(hH,"__esModule",{value:!0});hH.distinctUntilKeyChanged=void 0;var TLe=WA();function PLe(e,t){return TLe.distinctUntilChanged(function(n,r){return t?t(n[e],r[e]):n[e]===r[e]})}hH.distinctUntilKeyChanged=PLe});var t0=w(function(bH){Object.defineProperty(bH,"__esModule",{value:!0});bH.throwIfEmpty=void 0;var ILe=Xl(),NLe=ue(),FLe=Re();function MLe(e){if(e===void 0)e=jLe;return NLe.operate(function(t,n){var r=!1;t.subscribe(FLe.createOperatorSubscriber(n,function(o){r=!0,n.next(o)},function(){return r?n.complete():n.error(e())}))})}bH.throwIfEmpty=MLe;function jLe(){return new ILe.EmptyError}});var kH=w(function(xH){Object.defineProperty(xH,"__esModule",{value:!0});xH.elementAt=void 0;var _H=EA(),LLe=lf(),qLe=t0(),BLe=Zy(),ULe=e0();function HLe(e,t){if(e<0)throw new _H.ArgumentOutOfRangeError;var n=arguments.length>=2;return function(r){return r.pipe(LLe.filter(function(o,s){return s===e}),ULe.take(1),n?BLe.defaultIfEmpty(t):qLe.throwIfEmpty(function(){return new _H.ArgumentOutOfRangeError}))}}xH.elementAt=HLe});var EH=w(function(cu){var VLe=cu&&cu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},zLe=cu&&cu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(cu,"__esModule",{value:!0});cu.endWith=void 0;var GLe=Xy(),WLe=xx();function KLe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return function(n){return GLe.concat(n,WLe.of.apply(void 0,zLe([],VLe(e))))}}cu.endWith=KLe});var DH=w(function(SH){Object.defineProperty(SH,"__esModule",{value:!0});SH.every=void 0;var JLe=ue(),YLe=Re();function XLe(e,t){return JLe.operate(function(n,r){var o=0;n.subscribe(YLe.createOperatorSubscriber(r,function(s){if(!e.call(t,s,o++,n))r.next(!1),r.complete()},function(){r.next(!0),r.complete()}))})}SH.every=XLe});var KA=w(function(OH){Object.defineProperty(OH,"__esModule",{value:!0});OH.exhaustMap=void 0;var QLe=Ql(),RH=at(),ZLe=ue(),CH=Re();function AH(e,t){if(t)return function(n){return n.pipe(AH(function(r,o){return RH.innerFrom(e(r,o)).pipe(QLe.map(function(s,i){return t(r,s,o,i)}))}))};return ZLe.operate(function(n,r){var o=0,s=null,i=!1;n.subscribe(CH.createOperatorSubscriber(r,function(a){if(!s)s=CH.createOperatorSubscriber(r,void 0,function(){s=null,i&&r.complete()}),RH.innerFrom(e(a,o++)).subscribe(s)},function(){i=!0,!s&&r.complete()}))})}OH.exhaustMap=AH});var JA=w(function(PH){Object.defineProperty(PH,"__esModule",{value:!0});PH.exhaustAll=void 0;var eqe=KA(),tqe=zr();function nqe(){return eqe.exhaustMap(tqe.identity)}PH.exhaustAll=nqe});var MH=w(function(NH){Object.defineProperty(NH,"__esModule",{value:!0});NH.exhaust=void 0;var rqe=JA();NH.exhaust=rqe.exhaustAll});var qH=w(function(jH){Object.defineProperty(jH,"__esModule",{value:!0});jH.expand=void 0;var oqe=ue(),sqe=$x();function iqe(e,t,n){if(t===void 0)t=1/0;return t=(t||0)<1?1/0:t,oqe.operate(function(r,o){return sqe.mergeInternals(r,o,e,t,void 0,!0,n)})}jH.expand=iqe});var HH=w(function(BH){Object.defineProperty(BH,"__esModule",{value:!0});BH.finalize=void 0;var aqe=ue();function cqe(e){return aqe.operate(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}BH.finalize=cqe});var YA=w(function(zH){Object.defineProperty(zH,"__esModule",{value:!0});zH.createFind=zH.find=void 0;var lqe=ue(),uqe=Re();function dqe(e,t){return lqe.operate(VH(e,t,"value"))}zH.find=dqe;function VH(e,t,n){var r=n==="index";return function(o,s){var i=0;o.subscribe(uqe.createOperatorSubscriber(s,function(a){var c=i++;if(e.call(t,a,c,o))s.next(r?c:a),s.complete()},function(){s.next(r?-1:void 0),s.complete()}))}}zH.createFind=VH});var JH=w(function(WH){Object.defineProperty(WH,"__esModule",{value:!0});WH.findIndex=void 0;var pqe=ue(),mqe=YA();function hqe(e,t){return pqe.operate(mqe.createFind(e,t,"index"))}WH.findIndex=hqe});var QH=w(function(YH){Object.defineProperty(YH,"__esModule",{value:!0});YH.first=void 0;var gqe=Xl(),yqe=lf(),bqe=e0(),wqe=Zy(),_qe=t0(),xqe=zr();function vqe(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?yqe.filter(function(o,s){return e(o,s,r)}):xqe.identity,bqe.take(1),n?wqe.defaultIfEmpty(t):_qe.throwIfEmpty(function(){return new gqe.EmptyError}))}}YH.first=vqe});var nV=w(function(eV){Object.defineProperty(eV,"__esModule",{value:!0});eV.groupBy=void 0;var kqe=en(),Eqe=at(),Sqe=Gr(),$qe=ue(),ZH=Re();function Dqe(e,t,n,r){return $qe.operate(function(o,s){var i;if(!t||typeof t==="function")i=t;else n=t.duration,i=t.element,r=t.connector;var a=new Map,c=function(h){a.forEach(h),h(s)},l=function(h){return c(function(g){return g.error(h)})},d=0,f=!1,p=new ZH.OperatorSubscriber(s,function(h){try{var g=e(h),y=a.get(g);if(!y){a.set(g,y=r?r():new Sqe.Subject);var b=m(g,y);if(s.next(b),n){var _=ZH.createOperatorSubscriber(y,function(){y.complete(),_===null||_===void 0||_.unsubscribe()},void 0,void 0,function(){return a.delete(g)});p.add(Eqe.innerFrom(n(b)).subscribe(_))}}y.next(i?i(h):h)}catch(x){l(x)}},function(){return c(function(h){return h.complete()})},l,function(){return a.clear()},function(){return f=!0,d===0});o.subscribe(p);function m(h,g){var y=new kqe.Observable(function(b){d++;var _=g.subscribe(b);return function(){_.unsubscribe(),--d===0&&f&&p.unsubscribe()}});return y.key=h,y}})}eV.groupBy=Dqe});var sV=w(function(rV){Object.defineProperty(rV,"__esModule",{value:!0});rV.isEmpty=void 0;var Rqe=ue(),Cqe=Re();function Aqe(){return Rqe.operate(function(e,t){e.subscribe(Cqe.createOperatorSubscriber(t,function(){t.next(!1),t.complete()},function(){t.next(!0),t.complete()}))})}rV.isEmpty=Aqe});var XA=w(function(Cm){var Oqe=Cm&&Cm.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Cm,"__esModule",{value:!0});Cm.takeLast=void 0;var Tqe=Ai(),Pqe=ue(),Iqe=Re();function Nqe(e){return e<=0?function(){return Tqe.EMPTY}:Pqe.operate(function(t,n){var r=[];t.subscribe(Iqe.createOperatorSubscriber(n,function(o){r.push(o),e<r.length&&r.shift()},function(){var o,s;try{for(var i=Oqe(r),a=i.next();!a.done;a=i.next()){var c=a.value;n.next(c)}}catch(l){o={error:l}}finally{try{if(a&&!a.done&&(s=i.return))s.call(i)}finally{if(o)throw o.error}}n.complete()},void 0,function(){r=null}))})}Cm.takeLast=Nqe});var cV=w(function(iV){Object.defineProperty(iV,"__esModule",{value:!0});iV.last=void 0;var Fqe=Xl(),Mqe=lf(),jqe=XA(),Lqe=t0(),qqe=Zy(),Bqe=zr();function Uqe(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?Mqe.filter(function(o,s){return e(o,s,r)}):Bqe.identity,jqe.takeLast(1),n?qqe.defaultIfEmpty(t):Lqe.throwIfEmpty(function(){return new Fqe.EmptyError}))}}iV.last=Uqe});var dV=w(function(lV){Object.defineProperty(lV,"__esModule",{value:!0});lV.materialize=void 0;var QA=vx(),Hqe=ue(),Vqe=Re();function zqe(){return Hqe.operate(function(e,t){e.subscribe(Vqe.createOperatorSubscriber(t,function(n){t.next(QA.Notification.createNext(n))},function(){t.next(QA.Notification.createComplete()),t.complete()},function(n){t.next(QA.Notification.createError(n)),t.complete()}))})}lV.materialize=zqe});var mV=w(function(fV){Object.defineProperty(fV,"__esModule",{value:!0});fV.max=void 0;var Gqe=Rm(),Wqe=Yt();function Kqe(e){return Gqe.reduce(Wqe.isFunction(e)?function(t,n){return e(t,n)>0?t:n}:function(t,n){return t>n?t:n})}fV.max=Kqe});var yV=w(function(hV){Object.defineProperty(hV,"__esModule",{value:!0});hV.flatMap=void 0;var Jqe=qc();hV.flatMap=Jqe.mergeMap});var xV=w(function(wV){Object.defineProperty(wV,"__esModule",{value:!0});wV.mergeMapTo=void 0;var bV=qc(),Yqe=Yt();function Xqe(e,t,n){if(n===void 0)n=1/0;if(Yqe.isFunction(t))return bV.mergeMap(function(){return e},t,n);if(typeof t==="number")n=t;return bV.mergeMap(function(){return e},n)}wV.mergeMapTo=Xqe});var EV=w(function(vV){Object.defineProperty(vV,"__esModule",{value:!0});vV.mergeScan=void 0;var Qqe=ue(),Zqe=$x();function e3e(e,t,n){if(n===void 0)n=1/0;return Qqe.operate(function(r,o){var s=t;return Zqe.mergeInternals(r,o,function(i,a){return e(s,i,a)},n,function(i){s=i},!1,void 0,function(){return s=null})})}vV.mergeScan=e3e});var $V=w(function(lu){var t3e=lu&&lu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},n3e=lu&&lu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(lu,"__esModule",{value:!0});lu.merge=void 0;var r3e=ue(),o3e=Yy(),SV=Yo(),s3e=Lc();function i3e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=SV.popScheduler(e),r=SV.popNumber(e,1/0);return r3e.operate(function(o,s){o3e.mergeAll(r)(s3e.from(n3e([o],t3e(e)),n)).subscribe(s)})}lu.merge=i3e});var DV=w(function(uu){var a3e=uu&&uu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},c3e=uu&&uu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(uu,"__esModule",{value:!0});uu.mergeWith=void 0;var l3e=$V();function u3e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return l3e.merge.apply(void 0,c3e([],a3e(e)))}uu.mergeWith=u3e});var AV=w(function(RV){Object.defineProperty(RV,"__esModule",{value:!0});RV.min=void 0;var d3e=Rm(),f3e=Yt();function p3e(e){return d3e.reduce(f3e.isFunction(e)?function(t,n){return e(t,n)<0?t:n}:function(t,n){return t<n?t:n})}RV.min=p3e});var Ax=w(function(TV){Object.defineProperty(TV,"__esModule",{value:!0});TV.multicast=void 0;var m3e=Gy(),OV=Yt(),h3e=Cx();function g3e(e,t){var n=OV.isFunction(e)?e:function(){return e};if(OV.isFunction(t))return h3e.connect(t,{connector:n});return function(r){return new m3e.ConnectableObservable(r,n)}}TV.multicast=g3e});var NV=w(function(pa){var y3e=pa&&pa.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},b3e=pa&&pa.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(pa,"__esModule",{value:!0});pa.onErrorResumeNext=pa.onErrorResumeNextWith=void 0;var w3e=Em(),_3e=IA();function IV(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=w3e.argsOrArgArray(e);return function(r){return _3e.onErrorResumeNext.apply(void 0,b3e([r],y3e(n)))}}pa.onErrorResumeNextWith=IV;pa.onErrorResumeNext=IV});var jV=w(function(FV){Object.defineProperty(FV,"__esModule",{value:!0});FV.pairwise=void 0;var x3e=ue(),v3e=Re();function k3e(){return x3e.operate(function(e,t){var n,r=!1;e.subscribe(v3e.createOperatorSubscriber(t,function(o){var s=n;n=o,r&&t.next([s,o]),r=!0}))})}FV.pairwise=k3e});var BV=w(function(LV){Object.defineProperty(LV,"__esModule",{value:!0});LV.pluck=void 0;var E3e=Ql();function S3e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.length;if(n===0)throw Error("list of properties cannot be empty.");return E3e.map(function(r){var o=r;for(var s=0;s<n;s++){var i=o===null||o===void 0?void 0:o[e[s]];if(typeof i<"u")o=i;else return}return o})}LV.pluck=S3e});var VV=w(function(UV){Object.defineProperty(UV,"__esModule",{value:!0});UV.publish=void 0;var $3e=Gr(),D3e=Ax(),R3e=Cx();function C3e(e){return e?function(t){return R3e.connect(e)(t)}:function(t){return D3e.multicast(new $3e.Subject)(t)}}UV.publish=C3e});var WV=w(function(zV){Object.defineProperty(zV,"__esModule",{value:!0});zV.publishBehavior=void 0;var A3e=iA(),O3e=Gy();function T3e(e){return function(t){var n=new A3e.BehaviorSubject(e);return new O3e.ConnectableObservable(t,function(){return n})}}zV.publishBehavior=T3e});var YV=w(function(KV){Object.defineProperty(KV,"__esModule",{value:!0});KV.publishLast=void 0;var P3e=yx(),I3e=Gy();function N3e(){return function(e){var t=new P3e.AsyncSubject;return new I3e.ConnectableObservable(e,function(){return t})}}KV.publishLast=N3e});var ez=w(function(QV){Object.defineProperty(QV,"__esModule",{value:!0});QV.publishReplay=void 0;var F3e=gx(),M3e=Ax(),XV=Yt();function j3e(e,t,n,r){if(n&&!XV.isFunction(n))r=n;var o=XV.isFunction(n)?n:void 0;return function(s){return M3e.multicast(new F3e.ReplaySubject(e,t,r),o)(s)}}QV.publishReplay=j3e});var tz=w(function(du){var L3e=du&&du.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},q3e=du&&du.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(du,"__esModule",{value:!0});du.raceWith=void 0;var B3e=NA(),U3e=ue(),H3e=zr();function V3e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return!e.length?H3e.identity:U3e.operate(function(n,r){B3e.raceInit(q3e([n],L3e(e)))(r)})}du.raceWith=V3e});var sz=w(function(rz){Object.defineProperty(rz,"__esModule",{value:!0});rz.repeat=void 0;var z3e=Ai(),G3e=ue(),nz=Re(),W3e=at(),K3e=nu();function J3e(e){var t,n=1/0,r;if(e!=null)if(typeof e==="object")t=e.count,n=t===void 0?1/0:t,r=e.delay;else n=e;return n<=0?function(){return z3e.EMPTY}:G3e.operate(function(o,s){var i=0,a,c=function(){if(a===null||a===void 0||a.unsubscribe(),a=null,r!=null){var d=typeof r==="number"?K3e.timer(r):W3e.innerFrom(r(i)),f=nz.createOperatorSubscriber(s,function(){f.unsubscribe(),l()});d.subscribe(f)}else l()},l=function(){var d=!1;if(a=o.subscribe(nz.createOperatorSubscriber(s,void 0,function(){if(++i<n)if(a)c();else d=!0;else s.complete()})),d)c()};l()})}rz.repeat=J3e});var lz=w(function(az){Object.defineProperty(az,"__esModule",{value:!0});az.repeatWhen=void 0;var Y3e=at(),X3e=Gr(),Q3e=ue(),iz=Re();function Z3e(e){return Q3e.operate(function(t,n){var r,o=!1,s,i=!1,a=!1,c=function(){return a&&i&&(n.complete(),!0)},l=function(){if(!s)s=new X3e.Subject,Y3e.innerFrom(e(s)).subscribe(iz.createOperatorSubscriber(n,function(){if(r)d();else o=!0},function(){i=!0,c()}));return s},d=function(){if(a=!1,r=t.subscribe(iz.createOperatorSubscriber(n,void 0,function(){a=!0,!c()&&l().next()})),o)r.unsubscribe(),r=null,o=!1,d()};d()})}az.repeatWhen=Z3e});var pz=w(function(dz){Object.defineProperty(dz,"__esModule",{value:!0});dz.retry=void 0;var e4e=ue(),uz=Re(),t4e=zr(),n4e=nu(),r4e=at();function o4e(e){if(e===void 0)e=1/0;var t;if(e&&typeof e==="object")t=e;else t={count:e};var n=t.count,r=n===void 0?1/0:n,o=t.delay,s=t.resetOnSuccess,i=s===void 0?!1:s;return r<=0?t4e.identity:e4e.operate(function(a,c){var l=0,d,f=function(){var p=!1;if(d=a.subscribe(uz.createOperatorSubscriber(c,function(m){if(i)l=0;c.next(m)},void 0,function(m){if(l++<r){var h=function(){if(d)d.unsubscribe(),d=null,f();else p=!0};if(o!=null){var g=typeof o==="number"?n4e.timer(o):r4e.innerFrom(o(m,l)),y=uz.createOperatorSubscriber(c,function(){y.unsubscribe(),h()},function(){c.complete()});g.subscribe(y)}else h()}else c.error(m)})),p)d.unsubscribe(),d=null,f()};f()})}dz.retry=o4e});var yz=w(function(hz){Object.defineProperty(hz,"__esModule",{value:!0});hz.retryWhen=void 0;var s4e=at(),i4e=Gr(),a4e=ue(),mz=Re();function c4e(e){return a4e.operate(function(t,n){var r,o=!1,s,i=function(){if(r=t.subscribe(mz.createOperatorSubscriber(n,void 0,void 0,function(a){if(!s)s=new i4e.Subject,s4e.innerFrom(e(s)).subscribe(mz.createOperatorSubscriber(n,function(){return r?i():o=!0}));if(s)s.next(a)})),o)r.unsubscribe(),r=null,o=!1,i()};i()})}hz.retryWhen=c4e});var ZA=w(function(wz){Object.defineProperty(wz,"__esModule",{value:!0});wz.sample=void 0;var l4e=at(),u4e=ue(),d4e=Vr(),bz=Re();function f4e(e){return u4e.operate(function(t,n){var r=!1,o=null;t.subscribe(bz.createOperatorSubscriber(n,function(s){r=!0,o=s})),l4e.innerFrom(e).subscribe(bz.createOperatorSubscriber(n,function(){if(r){r=!1;var s=o;o=null,n.next(s)}},d4e.noop))})}wz.sample=f4e});var kz=w(function(xz){Object.defineProperty(xz,"__esModule",{value:!0});xz.sampleTime=void 0;var p4e=Jo(),m4e=ZA(),h4e=TA();function g4e(e,t){if(t===void 0)t=p4e.asyncScheduler;return m4e.sample(h4e.interval(e,t))}xz.sampleTime=g4e});var $z=w(function(Ez){Object.defineProperty(Ez,"__esModule",{value:!0});Ez.scan=void 0;var y4e=ue(),b4e=LA();function w4e(e,t){return y4e.operate(b4e.scanInternals(e,t,arguments.length>=2,!0))}Ez.scan=w4e});var Az=w(function(Rz){Object.defineProperty(Rz,"__esModule",{value:!0});Rz.sequenceEqual=void 0;var _4e=ue(),x4e=Re(),v4e=at();function k4e(e,t){if(t===void 0)t=function(n,r){return n===r};return _4e.operate(function(n,r){var o=Dz(),s=Dz(),i=function(c){r.next(c),r.complete()},a=function(c,l){var d=x4e.createOperatorSubscriber(r,function(f){var{buffer:p,complete:m}=l;if(p.length===0)m?i(!1):c.buffer.push(f);else!t(f,p.shift())&&i(!1)},function(){c.complete=!0;var{complete:f,buffer:p}=l;f&&i(p.length===0),d===null||d===void 0||d.unsubscribe()});return d};n.subscribe(a(o,s)),v4e.innerFrom(e).subscribe(a(s,o))})}Rz.sequenceEqual=k4e;function Dz(){return{buffer:[],complete:!1}}});var t2=w(function(fu){var E4e=fu&&fu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},S4e=fu&&fu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(fu,"__esModule",{value:!0});fu.share=void 0;var Oz=at(),$4e=Gr(),Tz=om(),D4e=ue();function R4e(e){if(e===void 0)e={};var t=e.connector,n=t===void 0?function(){return new $4e.Subject}:t,r=e.resetOnError,o=r===void 0?!0:r,s=e.resetOnComplete,i=s===void 0?!0:s,a=e.resetOnRefCountZero,c=a===void 0?!0:a;return function(l){var d,f,p,m=0,h=!1,g=!1,y=function(){f===null||f===void 0||f.unsubscribe(),f=void 0},b=function(){y(),d=p=void 0,h=g=!1},_=function(){var x=d;b(),x===null||x===void 0||x.unsubscribe()};return D4e.operate(function(x,k){if(m++,!g&&!h)y();var v=p=p!==null&&p!==void 0?p:n();if(k.add(function(){if(m--,m===0&&!g&&!h)f=e2(_,c)}),v.subscribe(k),!d&&m>0)d=new Tz.SafeSubscriber({next:function(C){return v.next(C)},error:function(C){g=!0,y(),f=e2(b,o,C),v.error(C)},complete:function(){h=!0,y(),f=e2(b,i),v.complete()}}),Oz.innerFrom(x).subscribe(d)})(l)}}fu.share=R4e;function e2(e,t){var n=[];for(var r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t===!1)return;var o=new Tz.SafeSubscriber({next:function(){o.unsubscribe(),e()}});return Oz.innerFrom(t.apply(void 0,S4e([],E4e(n)))).subscribe(o)}});var Nz=w(function(Pz){Object.defineProperty(Pz,"__esModule",{value:!0});Pz.shareReplay=void 0;var C4e=gx(),A4e=t2();function O4e(e,t,n){var r,o,s,i,a=!1;if(e&&typeof e==="object")r=e.bufferSize,i=r===void 0?1/0:r,o=e.windowTime,t=o===void 0?1/0:o,s=e.refCount,a=s===void 0?!1:s,n=e.scheduler;else i=e!==null&&e!==void 0?e:1/0;return A4e.share({connector:function(){return new C4e.ReplaySubject(i,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}Pz.shareReplay=O4e});var jz=w(function(Fz){Object.defineProperty(Fz,"__esModule",{value:!0});Fz.single=void 0;var T4e=Xl(),P4e=$A(),I4e=SA(),N4e=ue(),F4e=Re();function M4e(e){return N4e.operate(function(t,n){var r=!1,o,s=!1,i=0;t.subscribe(F4e.createOperatorSubscriber(n,function(a){if(s=!0,!e||e(a,i++,t))r&&n.error(new P4e.SequenceError("Too many matching values")),r=!0,o=a},function(){if(r)n.next(o),n.complete();else n.error(s?new I4e.NotFoundError("No matching values"):new T4e.EmptyError)}))})}Fz.single=M4e});var Bz=w(function(Lz){Object.defineProperty(Lz,"__esModule",{value:!0});Lz.skip=void 0;var j4e=lf();function L4e(e){return j4e.filter(function(t,n){return e<=n})}Lz.skip=L4e});var Vz=w(function(Uz){Object.defineProperty(Uz,"__esModule",{value:!0});Uz.skipLast=void 0;var q4e=zr(),B4e=ue(),U4e=Re();function H4e(e){return e<=0?q4e.identity:B4e.operate(function(t,n){var r=Array(e),o=0;return t.subscribe(U4e.createOperatorSubscriber(n,function(s){var i=o++;if(i<e)r[i]=s;else{var a=i%e,c=r[a];r[a]=s,n.next(c)}})),function(){r=null}})}Uz.skipLast=H4e});var Kz=w(function(Gz){Object.defineProperty(Gz,"__esModule",{value:!0});Gz.skipUntil=void 0;var V4e=ue(),zz=Re(),z4e=at(),G4e=Vr();function W4e(e){return V4e.operate(function(t,n){var r=!1,o=zz.createOperatorSubscriber(n,function(){o===null||o===void 0||o.unsubscribe(),r=!0},G4e.noop);z4e.innerFrom(e).subscribe(o),t.subscribe(zz.createOperatorSubscriber(n,function(s){return r&&n.next(s)}))})}Gz.skipUntil=W4e});var Xz=w(function(Jz){Object.defineProperty(Jz,"__esModule",{value:!0});Jz.skipWhile=void 0;var K4e=ue(),J4e=Re();function Y4e(e){return K4e.operate(function(t,n){var r=!1,o=0;t.subscribe(J4e.createOperatorSubscriber(n,function(s){return(r||(r=!e(s,o++)))&&n.next(s)}))})}Jz.skipWhile=Y4e});var tG=w(function(Zz){Object.defineProperty(Zz,"__esModule",{value:!0});Zz.startWith=void 0;var Qz=Xy(),X4e=Yo(),Q4e=ue();function Z4e(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=X4e.popScheduler(e);return Q4e.operate(function(r,o){(n?Qz.concat(e,r,n):Qz.concat(e,r)).subscribe(o)})}Zz.startWith=Z4e});var n0=w(function(rG){Object.defineProperty(rG,"__esModule",{value:!0});rG.switchMap=void 0;var e8e=at(),t8e=ue(),nG=Re();function n8e(e,t){return t8e.operate(function(n,r){var o=null,s=0,i=!1,a=function(){return i&&!o&&r.complete()};n.subscribe(nG.createOperatorSubscriber(r,function(c){o===null||o===void 0||o.unsubscribe();var l=0,d=s++;e8e.innerFrom(e(c,d)).subscribe(o=nG.createOperatorSubscriber(r,function(f){return r.next(t?t(c,f,d,l++):f)},function(){o=null,a()}))},function(){i=!0,a()}))})}rG.switchMap=n8e});var aG=w(function(sG){Object.defineProperty(sG,"__esModule",{value:!0});sG.switchAll=void 0;var r8e=n0(),o8e=zr();function s8e(){return r8e.switchMap(o8e.identity)}sG.switchAll=s8e});var dG=w(function(lG){Object.defineProperty(lG,"__esModule",{value:!0});lG.switchMapTo=void 0;var cG=n0(),i8e=Yt();function a8e(e,t){return i8e.isFunction(t)?cG.switchMap(function(){return e},t):cG.switchMap(function(){return e})}lG.switchMapTo=a8e});var mG=w(function(fG){Object.defineProperty(fG,"__esModule",{value:!0});fG.switchScan=void 0;var c8e=n0(),l8e=ue();function u8e(e,t){return l8e.operate(function(n,r){var o=t;return c8e.switchMap(function(s,i){return e(o,s,i)},function(s,i){return o=i,i})(n).subscribe(r),function(){o=null}})}fG.switchScan=u8e});var yG=w(function(hG){Object.defineProperty(hG,"__esModule",{value:!0});hG.takeUntil=void 0;var d8e=ue(),f8e=Re(),p8e=at(),m8e=Vr();function h8e(e){return d8e.operate(function(t,n){p8e.innerFrom(e).subscribe(f8e.createOperatorSubscriber(n,function(){return n.complete()},m8e.noop)),!n.closed&&t.subscribe(n)})}hG.takeUntil=h8e});var _G=w(function(bG){Object.defineProperty(bG,"__esModule",{value:!0});bG.takeWhile=void 0;var g8e=ue(),y8e=Re();function b8e(e,t){if(t===void 0)t=!1;return g8e.operate(function(n,r){var o=0;n.subscribe(y8e.createOperatorSubscriber(r,function(s){var i=e(s,o++);(i||t)&&r.next(s),!i&&r.complete()}))})}bG.takeWhile=b8e});var kG=w(function(xG){Object.defineProperty(xG,"__esModule",{value:!0});xG.tap=void 0;var w8e=Yt(),_8e=ue(),x8e=Re(),v8e=zr();function k8e(e,t,n){var r=w8e.isFunction(e)||t||n?{next:e,error:t,complete:n}:e;return r?_8e.operate(function(o,s){var i;(i=r.subscribe)===null||i===void 0||i.call(r);var a=!0;o.subscribe(x8e.createOperatorSubscriber(s,function(c){var l;(l=r.next)===null||l===void 0||l.call(r,c),s.next(c)},function(){var c;a=!1,(c=r.complete)===null||c===void 0||c.call(r),s.complete()},function(c){var l;a=!1,(l=r.error)===null||l===void 0||l.call(r,c),s.error(c)},function(){var c,l;if(a)(c=r.unsubscribe)===null||c===void 0||c.call(r);(l=r.finalize)===null||l===void 0||l.call(r)}))}):v8e.identity}xG.tap=k8e});var n2=w(function(SG){Object.defineProperty(SG,"__esModule",{value:!0});SG.throttle=void 0;var E8e=ue(),EG=Re(),S8e=at();function $8e(e,t){return E8e.operate(function(n,r){var o=t!==null&&t!==void 0?t:{},s=o.leading,i=s===void 0?!0:s,a=o.trailing,c=a===void 0?!1:a,l=!1,d=null,f=null,p=!1,m=function(){if(f===null||f===void 0||f.unsubscribe(),f=null,c)y(),p&&r.complete()},h=function(){f=null,p&&r.complete()},g=function(b){return f=S8e.innerFrom(e(b)).subscribe(EG.createOperatorSubscriber(r,m,h))},y=function(){if(l){l=!1;var b=d;d=null,r.next(b),!p&&g(b)}};n.subscribe(EG.createOperatorSubscriber(r,function(b){l=!0,d=b,!(f&&!f.closed)&&(i?y():g(b))},function(){p=!0,!(c&&l&&f&&!f.closed)&&r.complete()}))})}SG.throttle=$8e});var CG=w(function(DG){Object.defineProperty(DG,"__esModule",{value:!0});DG.throttleTime=void 0;var D8e=Jo(),R8e=n2(),C8e=nu();function A8e(e,t,n){if(t===void 0)t=D8e.asyncScheduler;var r=C8e.timer(e,t);return R8e.throttle(function(){return r},n)}DG.throttleTime=A8e});var PG=w(function(OG){Object.defineProperty(OG,"__esModule",{value:!0});OG.TimeInterval=OG.timeInterval=void 0;var O8e=Jo(),T8e=ue(),P8e=Re();function I8e(e){if(e===void 0)e=O8e.asyncScheduler;return T8e.operate(function(t,n){var r=e.now();t.subscribe(P8e.createOperatorSubscriber(n,function(o){var s=e.now(),i=s-r;r=s,n.next(new AG(o,i))}))})}OG.timeInterval=I8e;var AG=function(){function e(t,n){this.value=t,this.interval=n}return e}();OG.TimeInterval=AG});var FG=w(function(IG){Object.defineProperty(IG,"__esModule",{value:!0});IG.timeoutWith=void 0;var F8e=Jo(),M8e=kx(),j8e=Ex();function L8e(e,t,n){var r,o,s;if(n=n!==null&&n!==void 0?n:F8e.async,M8e.isValidDate(e))r=e;else if(typeof e==="number")o=e;if(t)s=function(){return t};else throw TypeError("No observable provided to switch to");if(r==null&&o==null)throw TypeError("No timeout provided.");return j8e.timeout({first:r,each:o,scheduler:n,with:s})}IG.timeoutWith=L8e});var LG=w(function(MG){Object.defineProperty(MG,"__esModule",{value:!0});MG.timestamp=void 0;var q8e=hx(),B8e=Ql();function U8e(e){if(e===void 0)e=q8e.dateTimestampProvider;return B8e.map(function(t){return{value:t,timestamp:e.now()}})}MG.timestamp=U8e});var VG=w(function(UG){Object.defineProperty(UG,"__esModule",{value:!0});UG.window=void 0;var qG=Gr(),H8e=ue(),BG=Re(),V8e=Vr(),z8e=at();function G8e(e){return H8e.operate(function(t,n){var r=new qG.Subject;n.next(r.asObservable());var o=function(s){r.error(s),n.error(s)};return t.subscribe(BG.createOperatorSubscriber(n,function(s){return r===null||r===void 0?void 0:r.next(s)},function(){r.complete(),n.complete()},o)),z8e.innerFrom(e).subscribe(BG.createOperatorSubscriber(n,function(){r.complete(),n.next(r=new qG.Subject)},V8e.noop,o)),function(){r===null||r===void 0||r.unsubscribe(),r=null}})}UG.window=G8e});var GG=w(function(Am){var W8e=Am&&Am.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Am,"__esModule",{value:!0});Am.windowCount=void 0;var zG=Gr(),K8e=ue(),J8e=Re();function Y8e(e,t){if(t===void 0)t=0;var n=t>0?t:e;return K8e.operate(function(r,o){var s=[new zG.Subject],i=[],a=0;o.next(s[0].asObservable()),r.subscribe(J8e.createOperatorSubscriber(o,function(c){var l,d;try{for(var f=W8e(s),p=f.next();!p.done;p=f.next()){var m=p.value;m.next(c)}}catch(y){l={error:y}}finally{try{if(p&&!p.done&&(d=f.return))d.call(f)}finally{if(l)throw l.error}}var h=a-e+1;if(h>=0&&h%n===0)s.shift().complete();if(++a%n===0){var g=new zG.Subject;s.push(g),o.next(g.asObservable())}},function(){while(s.length>0)s.shift().complete();o.complete()},function(c){while(s.length>0)s.shift().error(c);o.error(c)},function(){i=null,s=null}))})}Am.windowCount=Y8e});var YG=w(function(KG){Object.defineProperty(KG,"__esModule",{value:!0});KG.windowTime=void 0;var X8e=Gr(),Q8e=Jo(),Z8e=xs(),eBe=ue(),tBe=Re(),nBe=Mc(),rBe=Yo(),WG=jc();function oBe(e){var t,n,r=[];for(var o=1;o<arguments.length;o++)r[o-1]=arguments[o];var s=(t=rBe.popScheduler(r))!==null&&t!==void 0?t:Q8e.asyncScheduler,i=(n=r[0])!==null&&n!==void 0?n:null,a=r[1]||1/0;return eBe.operate(function(c,l){var d=[],f=!1,p=function(y){var{window:b,subs:_}=y;b.complete(),_.unsubscribe(),nBe.arrRemove(d,y),f&&m()},m=function(){if(d){var y=new Z8e.Subscription;l.add(y);var b=new X8e.Subject,_={window:b,subs:y,seen:0};d.push(_),l.next(b.asObservable()),WG.executeSchedule(y,s,function(){return p(_)},e)}};if(i!==null&&i>=0)WG.executeSchedule(l,s,m,i,!0);else f=!0;m();var h=function(y){return d.slice().forEach(y)},g=function(y){h(function(b){var _=b.window;return y(_)}),y(l),l.unsubscribe()};return c.subscribe(tBe.createOperatorSubscriber(l,function(y){h(function(b){b.window.next(y),a<=++b.seen&&p(b)})},function(){return g(function(y){return y.complete()})},function(y){return g(function(b){return b.error(y)})})),function(){d=null}})}KG.windowTime=oBe});var ZG=w(function(Om){var sBe=Om&&Om.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Om,"__esModule",{value:!0});Om.windowToggle=void 0;var iBe=Gr(),aBe=xs(),cBe=ue(),XG=at(),r2=Re(),QG=Vr(),lBe=Mc();function uBe(e,t){return cBe.operate(function(n,r){var o=[],s=function(i){while(0<o.length)o.shift().error(i);r.error(i)};XG.innerFrom(e).subscribe(r2.createOperatorSubscriber(r,function(i){var a=new iBe.Subject;o.push(a);var c=new aBe.Subscription,l=function(){lBe.arrRemove(o,a),a.complete(),c.unsubscribe()},d;try{d=XG.innerFrom(t(i))}catch(f){s(f);return}r.next(a.asObservable()),c.add(d.subscribe(r2.createOperatorSubscriber(r,l,QG.noop,s)))},QG.noop)),n.subscribe(r2.createOperatorSubscriber(r,function(i){var a,c,l=o.slice();try{for(var d=sBe(l),f=d.next();!f.done;f=d.next()){var p=f.value;p.next(i)}}catch(m){a={error:m}}finally{try{if(f&&!f.done&&(c=d.return))c.call(d)}finally{if(a)throw a.error}}},function(){while(0<o.length)o.shift().complete();r.complete()},s,function(){while(0<o.length)o.shift().unsubscribe()}))})}Om.windowToggle=uBe});var rW=w(function(tW){Object.defineProperty(tW,"__esModule",{value:!0});tW.windowWhen=void 0;var dBe=Gr(),fBe=ue(),eW=Re(),pBe=at();function mBe(e){return fBe.operate(function(t,n){var r,o,s=function(a){r.error(a),n.error(a)},i=function(){o===null||o===void 0||o.unsubscribe(),r===null||r===void 0||r.complete(),r=new dBe.Subject,n.next(r.asObservable());var a;try{a=pBe.innerFrom(e())}catch(c){s(c);return}a.subscribe(o=eW.createOperatorSubscriber(n,i,i,s))};i(),t.subscribe(eW.createOperatorSubscriber(n,function(a){return r.next(a)},function(){r.complete(),n.complete()},s,function(){o===null||o===void 0||o.unsubscribe(),r=null}))})}tW.windowWhen=mBe});var aW=w(function(pu){var oW=pu&&pu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},sW=pu&&pu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(pu,"__esModule",{value:!0});pu.withLatestFrom=void 0;var hBe=ue(),iW=Re(),gBe=at(),yBe=zr(),bBe=Vr(),wBe=Yo();function _Be(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];var n=wBe.popResultSelector(e);return hBe.operate(function(r,o){var s=e.length,i=Array(s),a=e.map(function(){return!1}),c=!1,l=function(f){gBe.innerFrom(e[f]).subscribe(iW.createOperatorSubscriber(o,function(p){if(i[f]=p,!c&&!a[f])a[f]=!0,(c=a.every(yBe.identity))&&(a=null)},bBe.noop))};for(var d=0;d<s;d++)l(d);r.subscribe(iW.createOperatorSubscriber(o,function(f){if(c){var p=sW([f],oW(i));o.next(n?n.apply(void 0,sW([],oW(p))):p)}}))})}pu.withLatestFrom=_Be});var uW=w(function(cW){Object.defineProperty(cW,"__esModule",{value:!0});cW.zipAll=void 0;var xBe=Rx(),vBe=BA();function kBe(e){return vBe.joinAllInternals(xBe.zip,e)}cW.zipAll=kBe});var dW=w(function(mu){var EBe=mu&&mu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},SBe=mu&&mu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(mu,"__esModule",{value:!0});mu.zip=void 0;var $Be=Rx(),DBe=ue();function RBe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return DBe.operate(function(n,r){$Be.zip.apply(void 0,SBe([n],EBe(e))).subscribe(r)})}mu.zip=RBe});var fW=w(function(hu){var CBe=hu&&hu.__read||function(e,t){var n=typeof Symbol==="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{while((t===void 0||t-- >0)&&!(o=r.next()).done)s.push(o.value)}catch(a){i={error:a}}finally{try{if(o&&!o.done&&(n=r.return))n.call(r)}finally{if(i)throw i.error}}return s},ABe=hu&&hu.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};Object.defineProperty(hu,"__esModule",{value:!0});hu.zipWith=void 0;var OBe=dW();function TBe(){var e=[];for(var t=0;t<arguments.length;t++)e[t]=arguments[t];return OBe.zip.apply(void 0,ABe([],CBe(e)))}hu.zipWith=TBe});var vs=w(function(E){var PBe=E&&E.__createBinding||(Object.create?function(e,t,n,r){if(r===void 0)r=n;Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){if(r===void 0)r=n;e[r]=t[n]}),IBe=E&&E.__exportStar||function(e,t){for(var n in e)if(n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n))PBe(t,e,n)};Object.defineProperty(E,"__esModule",{value:!0});E.interval=E.iif=E.generate=E.fromEventPattern=E.fromEvent=E.from=E.forkJoin=E.empty=E.defer=E.connectable=E.concat=E.combineLatest=E.bindNodeCallback=E.bindCallback=E.UnsubscriptionError=E.TimeoutError=E.SequenceError=E.ObjectUnsubscribedError=E.NotFoundError=E.EmptyError=E.ArgumentOutOfRangeError=E.firstValueFrom=E.lastValueFrom=E.isObservable=E.identity=E.noop=E.pipe=E.NotificationKind=E.Notification=E.Subscriber=E.Subscription=E.Scheduler=E.VirtualAction=E.VirtualTimeScheduler=E.animationFrameScheduler=E.animationFrame=E.queueScheduler=E.queue=E.asyncScheduler=E.async=E.asapScheduler=E.asap=E.AsyncSubject=E.ReplaySubject=E.BehaviorSubject=E.Subject=E.animationFrames=E.observable=E.ConnectableObservable=E.Observable=void 0;E.filter=E.expand=E.exhaustMap=E.exhaustAll=E.exhaust=E.every=E.endWith=E.elementAt=E.distinctUntilKeyChanged=E.distinctUntilChanged=E.distinct=E.dematerialize=E.delayWhen=E.delay=E.defaultIfEmpty=E.debounceTime=E.debounce=E.count=E.connect=E.concatWith=E.concatMapTo=E.concatMap=E.concatAll=E.combineLatestWith=E.combineLatestAll=E.combineAll=E.catchError=E.bufferWhen=E.bufferToggle=E.bufferTime=E.bufferCount=E.buffer=E.auditTime=E.audit=E.config=E.NEVER=E.EMPTY=E.scheduled=E.zip=E.using=E.timer=E.throwError=E.range=E.race=E.partition=E.pairs=E.onErrorResumeNext=E.of=E.never=E.merge=void 0;E.switchMap=E.switchAll=E.subscribeOn=E.startWith=E.skipWhile=E.skipUntil=E.skipLast=E.skip=E.single=E.shareReplay=E.share=E.sequenceEqual=E.scan=E.sampleTime=E.sample=E.refCount=E.retryWhen=E.retry=E.repeatWhen=E.repeat=E.reduce=E.raceWith=E.publishReplay=E.publishLast=E.publishBehavior=E.publish=E.pluck=E.pairwise=E.onErrorResumeNextWith=E.observeOn=E.multicast=E.min=E.mergeWith=E.mergeScan=E.mergeMapTo=E.mergeMap=E.flatMap=E.mergeAll=E.max=E.materialize=E.mapTo=E.map=E.last=E.isEmpty=E.ignoreElements=E.groupBy=E.first=E.findIndex=E.find=E.finalize=void 0;E.zipWith=E.zipAll=E.withLatestFrom=E.windowWhen=E.windowToggle=E.windowTime=E.windowCount=E.window=E.toArray=E.timestamp=E.timeoutWith=E.timeout=E.timeInterval=E.throwIfEmpty=E.throttleTime=E.throttle=E.tap=E.takeWhile=E.takeUntil=E.takeLast=E.take=E.switchScan=E.switchMapTo=void 0;var NBe=en();Object.defineProperty(E,"Observable",{enumerable:!0,get:function(){return NBe.Observable}});var FBe=Gy();Object.defineProperty(E,"ConnectableObservable",{enumerable:!0,get:function(){return FBe.ConnectableObservable}});var MBe=Vy();Object.defineProperty(E,"observable",{enumerable:!0,get:function(){return MBe.observable}});var jBe=v8();Object.defineProperty(E,"animationFrames",{enumerable:!0,get:function(){return jBe.animationFrames}});var LBe=Gr();Object.defineProperty(E,"Subject",{enumerable:!0,get:function(){return LBe.Subject}});var qBe=iA();Object.defineProperty(E,"BehaviorSubject",{enumerable:!0,get:function(){return qBe.BehaviorSubject}});var BBe=gx();Object.defineProperty(E,"ReplaySubject",{enumerable:!0,get:function(){return BBe.ReplaySubject}});var UBe=yx();Object.defineProperty(E,"AsyncSubject",{enumerable:!0,get:function(){return UBe.AsyncSubject}});var pW=J8();Object.defineProperty(E,"asap",{enumerable:!0,get:function(){return pW.asap}});Object.defineProperty(E,"asapScheduler",{enumerable:!0,get:function(){return pW.asapScheduler}});var mW=Jo();Object.defineProperty(E,"async",{enumerable:!0,get:function(){return mW.async}});Object.defineProperty(E,"asyncScheduler",{enumerable:!0,get:function(){return mW.asyncScheduler}});var hW=oB();Object.defineProperty(E,"queue",{enumerable:!0,get:function(){return hW.queue}});Object.defineProperty(E,"queueScheduler",{enumerable:!0,get:function(){return hW.queueScheduler}});var gW=dB();Object.defineProperty(E,"animationFrame",{enumerable:!0,get:function(){return gW.animationFrame}});Object.defineProperty(E,"animationFrameScheduler",{enumerable:!0,get:function(){return gW.animationFrameScheduler}});var yW=mB();Object.defineProperty(E,"VirtualTimeScheduler",{enumerable:!0,get:function(){return yW.VirtualTimeScheduler}});Object.defineProperty(E,"VirtualAction",{enumerable:!0,get:function(){return yW.VirtualAction}});var HBe=lA();Object.defineProperty(E,"Scheduler",{enumerable:!0,get:function(){return HBe.Scheduler}});var VBe=xs();Object.defineProperty(E,"Subscription",{enumerable:!0,get:function(){return VBe.Subscription}});var zBe=om();Object.defineProperty(E,"Subscriber",{enumerable:!0,get:function(){return zBe.Subscriber}});var bW=vx();Object.defineProperty(E,"Notification",{enumerable:!0,get:function(){return bW.Notification}});Object.defineProperty(E,"NotificationKind",{enumerable:!0,get:function(){return bW.NotificationKind}});var GBe=zy();Object.defineProperty(E,"pipe",{enumerable:!0,get:function(){return GBe.pipe}});var WBe=Vr();Object.defineProperty(E,"noop",{enumerable:!0,get:function(){return WBe.noop}});var KBe=zr();Object.defineProperty(E,"identity",{enumerable:!0,get:function(){return KBe.identity}});var JBe=C5();Object.defineProperty(E,"isObservable",{enumerable:!0,get:function(){return JBe.isObservable}});var YBe=I5();Object.defineProperty(E,"lastValueFrom",{enumerable:!0,get:function(){return YBe.lastValueFrom}});var XBe=M5();Object.defineProperty(E,"firstValueFrom",{enumerable:!0,get:function(){return XBe.firstValueFrom}});var QBe=EA();Object.defineProperty(E,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return QBe.ArgumentOutOfRangeError}});var ZBe=Xl();Object.defineProperty(E,"EmptyError",{enumerable:!0,get:function(){return ZBe.EmptyError}});var e5e=SA();Object.defineProperty(E,"NotFoundError",{enumerable:!0,get:function(){return e5e.NotFoundError}});var t5e=nA();Object.defineProperty(E,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return t5e.ObjectUnsubscribedError}});var n5e=$A();Object.defineProperty(E,"SequenceError",{enumerable:!0,get:function(){return n5e.SequenceError}});var r5e=Ex();Object.defineProperty(E,"TimeoutError",{enumerable:!0,get:function(){return r5e.TimeoutError}});var o5e=UC();Object.defineProperty(E,"UnsubscriptionError",{enumerable:!0,get:function(){return o5e.UnsubscriptionError}});var s5e=eU();Object.defineProperty(E,"bindCallback",{enumerable:!0,get:function(){return s5e.bindCallback}});var i5e=rU();Object.defineProperty(E,"bindNodeCallback",{enumerable:!0,get:function(){return i5e.bindNodeCallback}});var a5e=Sx();Object.defineProperty(E,"combineLatest",{enumerable:!0,get:function(){return a5e.combineLatest}});var c5e=Xy();Object.defineProperty(E,"concat",{enumerable:!0,get:function(){return c5e.concat}});var l5e=OU();Object.defineProperty(E,"connectable",{enumerable:!0,get:function(){return l5e.connectable}});var u5e=Qy();Object.defineProperty(E,"defer",{enumerable:!0,get:function(){return u5e.defer}});var d5e=Ai();Object.defineProperty(E,"empty",{enumerable:!0,get:function(){return d5e.empty}});var f5e=IU();Object.defineProperty(E,"forkJoin",{enumerable:!0,get:function(){return f5e.forkJoin}});var p5e=Lc();Object.defineProperty(E,"from",{enumerable:!0,get:function(){return p5e.from}});var m5e=FU();Object.defineProperty(E,"fromEvent",{enumerable:!0,get:function(){return m5e.fromEvent}});var h5e=qU();Object.defineProperty(E,"fromEventPattern",{enumerable:!0,get:function(){return h5e.fromEventPattern}});var g5e=UU();Object.defineProperty(E,"generate",{enumerable:!0,get:function(){return g5e.generate}});var y5e=zU();Object.defineProperty(E,"iif",{enumerable:!0,get:function(){return y5e.iif}});var b5e=TA();Object.defineProperty(E,"interval",{enumerable:!0,get:function(){return b5e.interval}});var w5e=ZU();Object.defineProperty(E,"merge",{enumerable:!0,get:function(){return w5e.merge}});var _5e=PA();Object.defineProperty(E,"never",{enumerable:!0,get:function(){return _5e.never}});var x5e=xx();Object.defineProperty(E,"of",{enumerable:!0,get:function(){return x5e.of}});var v5e=IA();Object.defineProperty(E,"onErrorResumeNext",{enumerable:!0,get:function(){return v5e.onErrorResumeNext}});var k5e=u9();Object.defineProperty(E,"pairs",{enumerable:!0,get:function(){return k5e.pairs}});var E5e=_9();Object.defineProperty(E,"partition",{enumerable:!0,get:function(){return E5e.partition}});var S5e=NA();Object.defineProperty(E,"race",{enumerable:!0,get:function(){return S5e.race}});var $5e=D9();Object.defineProperty(E,"range",{enumerable:!0,get:function(){return $5e.range}});var D5e=kA();Object.defineProperty(E,"throwError",{enumerable:!0,get:function(){return D5e.throwError}});var R5e=nu();Object.defineProperty(E,"timer",{enumerable:!0,get:function(){return R5e.timer}});var C5e=A9();Object.defineProperty(E,"using",{enumerable:!0,get:function(){return C5e.using}});var A5e=Rx();Object.defineProperty(E,"zip",{enumerable:!0,get:function(){return A5e.zip}});var O5e=vA();Object.defineProperty(E,"scheduled",{enumerable:!0,get:function(){return O5e.scheduled}});var T5e=Ai();Object.defineProperty(E,"EMPTY",{enumerable:!0,get:function(){return T5e.EMPTY}});var P5e=PA();Object.defineProperty(E,"NEVER",{enumerable:!0,get:function(){return P5e.NEVER}});IBe(T9(),E);var I5e=rm();Object.defineProperty(E,"config",{enumerable:!0,get:function(){return I5e.config}});var N5e=FA();Object.defineProperty(E,"audit",{enumerable:!0,get:function(){return N5e.audit}});var F5e=j9();Object.defineProperty(E,"auditTime",{enumerable:!0,get:function(){return F5e.auditTime}});var M5e=U9();Object.defineProperty(E,"buffer",{enumerable:!0,get:function(){return M5e.buffer}});var j5e=H9();Object.defineProperty(E,"bufferCount",{enumerable:!0,get:function(){return j5e.bufferCount}});var L5e=z9();Object.defineProperty(E,"bufferTime",{enumerable:!0,get:function(){return L5e.bufferTime}});var q5e=K9();Object.defineProperty(E,"bufferToggle",{enumerable:!0,get:function(){return q5e.bufferToggle}});var B5e=Q9();Object.defineProperty(E,"bufferWhen",{enumerable:!0,get:function(){return B5e.bufferWhen}});var U5e=n7();Object.defineProperty(E,"catchError",{enumerable:!0,get:function(){return U5e.catchError}});var H5e=h7();Object.defineProperty(E,"combineAll",{enumerable:!0,get:function(){return H5e.combineAll}});var V5e=UA();Object.defineProperty(E,"combineLatestAll",{enumerable:!0,get:function(){return V5e.combineLatestAll}});var z5e=_7();Object.defineProperty(E,"combineLatestWith",{enumerable:!0,get:function(){return z5e.combineLatestWith}});var G5e=Dx();Object.defineProperty(E,"concatAll",{enumerable:!0,get:function(){return G5e.concatAll}});var W5e=HA();Object.defineProperty(E,"concatMap",{enumerable:!0,get:function(){return W5e.concatMap}});var K5e=D7();Object.defineProperty(E,"concatMapTo",{enumerable:!0,get:function(){return K5e.concatMapTo}});var J5e=C7();Object.defineProperty(E,"concatWith",{enumerable:!0,get:function(){return J5e.concatWith}});var Y5e=Cx();Object.defineProperty(E,"connect",{enumerable:!0,get:function(){return Y5e.connect}});var X5e=M7();Object.defineProperty(E,"count",{enumerable:!0,get:function(){return X5e.count}});var Q5e=B7();Object.defineProperty(E,"debounce",{enumerable:!0,get:function(){return Q5e.debounce}});var Z5e=V7();Object.defineProperty(E,"debounceTime",{enumerable:!0,get:function(){return Z5e.debounceTime}});var eUe=Zy();Object.defineProperty(E,"defaultIfEmpty",{enumerable:!0,get:function(){return eUe.defaultIfEmpty}});var tUe=sH();Object.defineProperty(E,"delay",{enumerable:!0,get:function(){return tUe.delay}});var nUe=GA();Object.defineProperty(E,"delayWhen",{enumerable:!0,get:function(){return nUe.delayWhen}});var rUe=cH();Object.defineProperty(E,"dematerialize",{enumerable:!0,get:function(){return rUe.dematerialize}});var oUe=fH();Object.defineProperty(E,"distinct",{enumerable:!0,get:function(){return oUe.distinct}});var sUe=WA();Object.defineProperty(E,"distinctUntilChanged",{enumerable:!0,get:function(){return sUe.distinctUntilChanged}});var iUe=yH();Object.defineProperty(E,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return iUe.distinctUntilKeyChanged}});var aUe=kH();Object.defineProperty(E,"elementAt",{enumerable:!0,get:function(){return aUe.elementAt}});var cUe=EH();Object.defineProperty(E,"endWith",{enumerable:!0,get:function(){return cUe.endWith}});var lUe=DH();Object.defineProperty(E,"every",{enumerable:!0,get:function(){return lUe.every}});var uUe=MH();Object.defineProperty(E,"exhaust",{enumerable:!0,get:function(){return uUe.exhaust}});var dUe=JA();Object.defineProperty(E,"exhaustAll",{enumerable:!0,get:function(){return dUe.exhaustAll}});var fUe=KA();Object.defineProperty(E,"exhaustMap",{enumerable:!0,get:function(){return fUe.exhaustMap}});var pUe=qH();Object.defineProperty(E,"expand",{enumerable:!0,get:function(){return pUe.expand}});var mUe=lf();Object.defineProperty(E,"filter",{enumerable:!0,get:function(){return mUe.filter}});var hUe=HH();Object.defineProperty(E,"finalize",{enumerable:!0,get:function(){return hUe.finalize}});var gUe=YA();Object.defineProperty(E,"find",{enumerable:!0,get:function(){return gUe.find}});var yUe=JH();Object.defineProperty(E,"findIndex",{enumerable:!0,get:function(){return yUe.findIndex}});var bUe=QH();Object.defineProperty(E,"first",{enumerable:!0,get:function(){return bUe.first}});var wUe=nV();Object.defineProperty(E,"groupBy",{enumerable:!0,get:function(){return wUe.groupBy}});var _Ue=VA();Object.defineProperty(E,"ignoreElements",{enumerable:!0,get:function(){return _Ue.ignoreElements}});var xUe=sV();Object.defineProperty(E,"isEmpty",{enumerable:!0,get:function(){return xUe.isEmpty}});var vUe=cV();Object.defineProperty(E,"last",{enumerable:!0,get:function(){return vUe.last}});var kUe=Ql();Object.defineProperty(E,"map",{enumerable:!0,get:function(){return kUe.map}});var EUe=zA();Object.defineProperty(E,"mapTo",{enumerable:!0,get:function(){return EUe.mapTo}});var SUe=dV();Object.defineProperty(E,"materialize",{enumerable:!0,get:function(){return SUe.materialize}});var $Ue=mV();Object.defineProperty(E,"max",{enumerable:!0,get:function(){return $Ue.max}});var DUe=Yy();Object.defineProperty(E,"mergeAll",{enumerable:!0,get:function(){return DUe.mergeAll}});var RUe=yV();Object.defineProperty(E,"flatMap",{enumerable:!0,get:function(){return RUe.flatMap}});var CUe=qc();Object.defineProperty(E,"mergeMap",{enumerable:!0,get:function(){return CUe.mergeMap}});var AUe=xV();Object.defineProperty(E,"mergeMapTo",{enumerable:!0,get:function(){return AUe.mergeMapTo}});var OUe=EV();Object.defineProperty(E,"mergeScan",{enumerable:!0,get:function(){return OUe.mergeScan}});var TUe=DV();Object.defineProperty(E,"mergeWith",{enumerable:!0,get:function(){return TUe.mergeWith}});var PUe=AV();Object.defineProperty(E,"min",{enumerable:!0,get:function(){return PUe.min}});var IUe=Ax();Object.defineProperty(E,"multicast",{enumerable:!0,get:function(){return IUe.multicast}});var NUe=Ky();Object.defineProperty(E,"observeOn",{enumerable:!0,get:function(){return NUe.observeOn}});var FUe=NV();Object.defineProperty(E,"onErrorResumeNextWith",{enumerable:!0,get:function(){return FUe.onErrorResumeNextWith}});var MUe=jV();Object.defineProperty(E,"pairwise",{enumerable:!0,get:function(){return MUe.pairwise}});var jUe=BV();Object.defineProperty(E,"pluck",{enumerable:!0,get:function(){return jUe.pluck}});var LUe=VV();Object.defineProperty(E,"publish",{enumerable:!0,get:function(){return LUe.publish}});var qUe=WV();Object.defineProperty(E,"publishBehavior",{enumerable:!0,get:function(){return qUe.publishBehavior}});var BUe=YV();Object.defineProperty(E,"publishLast",{enumerable:!0,get:function(){return BUe.publishLast}});var UUe=ez();Object.defineProperty(E,"publishReplay",{enumerable:!0,get:function(){return UUe.publishReplay}});var HUe=tz();Object.defineProperty(E,"raceWith",{enumerable:!0,get:function(){return HUe.raceWith}});var VUe=Rm();Object.defineProperty(E,"reduce",{enumerable:!0,get:function(){return VUe.reduce}});var zUe=sz();Object.defineProperty(E,"repeat",{enumerable:!0,get:function(){return zUe.repeat}});var GUe=lz();Object.defineProperty(E,"repeatWhen",{enumerable:!0,get:function(){return GUe.repeatWhen}});var WUe=pz();Object.defineProperty(E,"retry",{enumerable:!0,get:function(){return WUe.retry}});var KUe=yz();Object.defineProperty(E,"retryWhen",{enumerable:!0,get:function(){return KUe.retryWhen}});var JUe=ZC();Object.defineProperty(E,"refCount",{enumerable:!0,get:function(){return JUe.refCount}});var YUe=ZA();Object.defineProperty(E,"sample",{enumerable:!0,get:function(){return YUe.sample}});var XUe=kz();Object.defineProperty(E,"sampleTime",{enumerable:!0,get:function(){return XUe.sampleTime}});var QUe=$z();Object.defineProperty(E,"scan",{enumerable:!0,get:function(){return QUe.scan}});var ZUe=Az();Object.defineProperty(E,"sequenceEqual",{enumerable:!0,get:function(){return ZUe.sequenceEqual}});var e9e=t2();Object.defineProperty(E,"share",{enumerable:!0,get:function(){return e9e.share}});var t9e=Nz();Object.defineProperty(E,"shareReplay",{enumerable:!0,get:function(){return t9e.shareReplay}});var n9e=jz();Object.defineProperty(E,"single",{enumerable:!0,get:function(){return n9e.single}});var r9e=Bz();Object.defineProperty(E,"skip",{enumerable:!0,get:function(){return r9e.skip}});var o9e=Vz();Object.defineProperty(E,"skipLast",{enumerable:!0,get:function(){return o9e.skipLast}});var s9e=Kz();Object.defineProperty(E,"skipUntil",{enumerable:!0,get:function(){return s9e.skipUntil}});var i9e=Xz();Object.defineProperty(E,"skipWhile",{enumerable:!0,get:function(){return i9e.skipWhile}});var a9e=tG();Object.defineProperty(E,"startWith",{enumerable:!0,get:function(){return a9e.startWith}});var c9e=Jy();Object.defineProperty(E,"subscribeOn",{enumerable:!0,get:function(){return c9e.subscribeOn}});var l9e=aG();Object.defineProperty(E,"switchAll",{enumerable:!0,get:function(){return l9e.switchAll}});var u9e=n0();Object.defineProperty(E,"switchMap",{enumerable:!0,get:function(){return u9e.switchMap}});var d9e=dG();Object.defineProperty(E,"switchMapTo",{enumerable:!0,get:function(){return d9e.switchMapTo}});var f9e=mG();Object.defineProperty(E,"switchScan",{enumerable:!0,get:function(){return f9e.switchScan}});var p9e=e0();Object.defineProperty(E,"take",{enumerable:!0,get:function(){return p9e.take}});var m9e=XA();Object.defineProperty(E,"takeLast",{enumerable:!0,get:function(){return m9e.takeLast}});var h9e=yG();Object.defineProperty(E,"takeUntil",{enumerable:!0,get:function(){return h9e.takeUntil}});var g9e=_G();Object.defineProperty(E,"takeWhile",{enumerable:!0,get:function(){return g9e.takeWhile}});var y9e=kG();Object.defineProperty(E,"tap",{enumerable:!0,get:function(){return y9e.tap}});var b9e=n2();Object.defineProperty(E,"throttle",{enumerable:!0,get:function(){return b9e.throttle}});var w9e=CG();Object.defineProperty(E,"throttleTime",{enumerable:!0,get:function(){return w9e.throttleTime}});var _9e=t0();Object.defineProperty(E,"throwIfEmpty",{enumerable:!0,get:function(){return _9e.throwIfEmpty}});var x9e=PG();Object.defineProperty(E,"timeInterval",{enumerable:!0,get:function(){return x9e.timeInterval}});var v9e=Ex();Object.defineProperty(E,"timeout",{enumerable:!0,get:function(){return v9e.timeout}});var k9e=FG();Object.defineProperty(E,"timeoutWith",{enumerable:!0,get:function(){return k9e.timeoutWith}});var E9e=LG();Object.defineProperty(E,"timestamp",{enumerable:!0,get:function(){return E9e.timestamp}});var S9e=qA();Object.defineProperty(E,"toArray",{enumerable:!0,get:function(){return S9e.toArray}});var $9e=VG();Object.defineProperty(E,"window",{enumerable:!0,get:function(){return $9e.window}});var D9e=GG();Object.defineProperty(E,"windowCount",{enumerable:!0,get:function(){return D9e.windowCount}});var R9e=YG();Object.defineProperty(E,"windowTime",{enumerable:!0,get:function(){return R9e.windowTime}});var C9e=ZG();Object.defineProperty(E,"windowToggle",{enumerable:!0,get:function(){return C9e.windowToggle}});var A9e=rW();Object.defineProperty(E,"windowWhen",{enumerable:!0,get:function(){return A9e.windowWhen}});var O9e=aW();Object.defineProperty(E,"withLatestFrom",{enumerable:!0,get:function(){return O9e.withLatestFrom}});var T9e=uW();Object.defineProperty(E,"zipAll",{enumerable:!0,get:function(){return T9e.zipAll}});var P9e=fW();Object.defineProperty(E,"zipWith",{enumerable:!0,get:function(){return P9e.zipWith}})});function I9e(e,t){return{value:e,key:t||{}}}function Wr(e){let t=An.fromEvent(e.input,"keypress",I9e).pipe(An.takeUntil(An.fromEvent(e,"close"))).pipe(An.filter(({key:n})=>n.name!=="enter"&&n.name!=="return"));return{line:An.fromEvent(e,"line"),keypress:t,normalizedUpKey:t.pipe(An.filter(({key:n})=>n.name==="up"||n.name==="k"||n.name==="p"&&n.ctrl),An.share()),normalizedDownKey:t.pipe(An.filter(({key:n})=>n.name==="down"||n.name==="j"||n.name==="n"&&n.ctrl),An.share()),numberKey:t.pipe(An.filter((n)=>n.value&&"123456789".includes(n.value)),An.map((n)=>Number(n.value)),An.share()),spaceKey:t.pipe(An.filter(({key:n})=>n&&n.name==="space"),An.share()),aKey:t.pipe(An.filter(({key:n})=>n&&n.name==="a"),An.share()),iKey:t.pipe(An.filter(({key:n})=>n&&n.name==="i"),An.share())}}var An;var Bc=z(()=>{An=et(vs(),1)});class ma{constructor(e,t={}){let{isInfinite:n=!0}=t;this.lastIndex=0,this.screen=e,this.isInfinite=n}paginate(e,t,n){n||=7;let r=e.split(`
|
|
32
32
|
`);if(this.screen)r=this.screen.breakLines(r),t=r.map((s)=>s.length).splice(0,t).reduce((s,i)=>s+i,0),r=r.flat();if(r.length<=n)return e;let o=this.isInfinite?this.getInfiniteLines(r,t,n):this.getFiniteLines(r,t,n);return this.lastIndex=t,o.join(`
|
|
33
33
|
`)+`
|
|
34
|
-
`+wW.default.dim("(Move up and down to reveal more choices)")}getInfiniteLines(e,t,n){if(this.pointer===void 0)this.pointer=0;let r=Math.floor(n/2);if(this.pointer<r&&this.lastIndex<t&&t-this.lastIndex<n)this.pointer=Math.min(r,this.pointer+t-this.lastIndex);let o=[e,e,e].flat(),s=Math.max(0,t+e.length-this.pointer);return o.splice(s,n)}getFiniteLines(e,t,n){let r=t-n/2;if(r<0)r=0;else if(r+n>e.length)r=e.length-n;return e.splice(r,n)}}var wW;var r0=z(()=>{wW=et(Hs(),1)});function Uc(e,t,n){let r=n.choices.realLength,o="loop"in n?Boolean(n.loop):!0;if(t==="up"){if(e>0)return e-1;return o?r-1:e}if(t==="down"){if(e<r-1)return e+1;return o?0:e}throw Error("dir must be up or down")}class ks{constructor(e){this.type="separator",this.line=_W.default.dim(e||Array.from({length:15}).join(Wl.line))}static exclude(e){return e.type!=="separator"}toString(){return this.line}}var _W;var o0=z(()=>{dx();_W=et(Hs(),1)});class Tm{constructor(e,t){if(e instanceof Tm||e.type==="separator")return e;if(typeof e==="string"||typeof e==="number")this.name=String(e),this.value=e,this.short=String(e);else Object.assign(this,e,{name:e.name||e.value,value:"value"in e?e.value:e.name,short:e.short||e.name||e.value});this.disabled=typeof e.disabled==="function"?e.disabled(t):e.disabled}}import xW from"assert";var Ox;var vW=z(()=>{o0();Ox=class Ox{constructor(e,t){this.choices=e.map((n)=>{if(n.type==="separator"){if(!(n instanceof ks))n=new ks(n.line);return n}return new Tm(n,t)}),this.realChoices=this.choices.filter(ks.exclude).filter((n)=>!n.disabled),Object.defineProperty(this,"length",{get(){return this.choices.length},set(n){this.choices.length=n}}),Object.defineProperty(this,"realLength",{get(){return this.realChoices.length},set(){throw Error("Cannot set `realLength` of a Choices collection")}})}[Symbol.iterator](){let e=this.choices,t=-1;return{next:()=>({value:e[++t],done:!(t in e)})}}getChoice(e){return xW(typeof e==="number"),this.realChoices[e]}get(e){return xW(typeof e==="number"),this.choices[e]}where(e){let t;if(typeof e==="function")t=e;else{let[n,r]=Object.entries(e)[0];t=(o)=>o[n]===r}return this.realChoices.filter(t)}pluck(e){return this.realChoices.map((t)=>t[e])}indexOf(...e){return this.choices.indexOf(...e)}forEach(...e){return this.choices.forEach(...e)}filter(...e){return this.choices.filter(...e)}reduce(...e){return this.choices.reduce(...e)}find(e){return this.choices.find(e)}some(e){return this.choices.some(e)}push(...e){let t=e.map((n)=>new Tm(n));return this.choices.push(...t),this.realChoices=this.choices.filter(ks.exclude).filter((n)=>!n.disabled),this.choices}}});var EW=w(function(R3t,kW){kW.exports=F9e;function N9e(e){let t={defaultWidth:0,output:process.stdout,tty:Nt("tty")};if(!e)return t;return Object.keys(t).forEach(function(n){if(!e[n])e[n]=t[n]}),e}function F9e(e){let t=N9e(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let n=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(n)&&n!==0)return n}return t.defaultWidth}});var $W=w(function(C3t,SW){SW.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var s0=w(function(A3t,DW){var M9e=$W();DW.exports=(e)=>typeof e==="string"?e.replace(M9e(),""):e});var CW=w(function(O3t,o2){var RW=(e)=>{if(Number.isNaN(e))return!1;if(e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141))return!0;return!1};o2.exports=RW;o2.exports.default=RW});var OW=w(function(T3t,AW){AW.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var i2=w(function(P3t,s2){var j9e=s0(),L9e=CW(),q9e=OW(),TW=(e)=>{if(typeof e!=="string"||e.length===0)return 0;if(e=j9e(e),e.length===0)return 0;e=e.replace(q9e()," ");let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);if(r<=31||r>=127&&r<=159)continue;if(r>=768&&r<=879)continue;if(r>65535)n++;t+=L9e(r)?2:1}return t};s2.exports=TW;s2.exports.default=TW});var IW=w(function(I3t,PW){PW.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var a2=w(function(N3t,FW){var i0=IW(),NW={};for(let e of Object.keys(i0))NW[i0[e]]=e;var Se={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};FW.exports=Se;for(let e of Object.keys(Se)){if(!("channels"in Se[e]))throw Error("missing channels property: "+e);if(!("labels"in Se[e]))throw Error("missing channel labels property: "+e);if(Se[e].labels.length!==Se[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:n}=Se[e];delete Se[e].channels,delete Se[e].labels,Object.defineProperty(Se[e],"channels",{value:t}),Object.defineProperty(Se[e],"labels",{value:n})}Se.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(t,n,r),s=Math.max(t,n,r),i=s-o,a,c;if(s===o)a=0;else if(t===s)a=(n-r)/i;else if(n===s)a=2+(r-t)/i;else if(r===s)a=4+(t-n)/i;if(a=Math.min(a*60,360),a<0)a+=360;let l=(o+s)/2;if(s===o)c=0;else if(l<=0.5)c=i/(s+o);else c=i/(2-s-o);return[a,c*100,l*100]};Se.rgb.hsv=function(e){let t,n,r,o,s,i=e[0]/255,a=e[1]/255,c=e[2]/255,l=Math.max(i,a,c),d=l-Math.min(i,a,c),f=function(p){return(l-p)/6/d+0.5};if(d===0)o=0,s=0;else{if(s=d/l,t=f(i),n=f(a),r=f(c),i===l)o=r-n;else if(a===l)o=0.3333333333333333+t-r;else if(c===l)o=0.6666666666666666+n-t;if(o<0)o+=1;else if(o>1)o-=1}return[o*360,s*100,l*100]};Se.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],o=Se.rgb.hsl(e)[0],s=0.00392156862745098*Math.min(t,Math.min(n,r));return r=1-0.00392156862745098*Math.max(t,Math.max(n,r)),[o,s*100,r*100]};Se.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(1-t,1-n,1-r),s=(1-t-o)/(1-o)||0,i=(1-n-o)/(1-o)||0,a=(1-r-o)/(1-o)||0;return[s*100,i*100,a*100,o*100]};function B9e(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Se.rgb.keyword=function(e){let t=NW[e];if(t)return t;let n=1/0,r;for(let o of Object.keys(i0)){let s=i0[o],i=B9e(e,s);if(i<n)n=i,r=o}return r};Se.keyword.rgb=function(e){return i0[e]};Se.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>0.04045?((t+0.055)/1.055)**2.4:t/12.92,n=n>0.04045?((n+0.055)/1.055)**2.4:n/12.92,r=r>0.04045?((r+0.055)/1.055)**2.4:r/12.92;let o=t*0.4124+n*0.3576+r*0.1805,s=t*0.2126+n*0.7152+r*0.0722,i=t*0.0193+n*0.1192+r*0.9505;return[o*100,s*100,i*100]};Se.rgb.lab=function(e){let t=Se.rgb.xyz(e),n=t[0],r=t[1],o=t[2];n/=95.047,r/=100,o/=108.883,n=n>0.008856?n**0.3333333333333333:7.787*n+0.13793103448275862,r=r>0.008856?r**0.3333333333333333:7.787*r+0.13793103448275862,o=o>0.008856?o**0.3333333333333333:7.787*o+0.13793103448275862;let s=116*r-16,i=500*(n-r),a=200*(r-o);return[s,i,a]};Se.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,o,s,i;if(n===0)return i=r*255,[i,i,i];if(r<0.5)o=r*(1+n);else o=r+n-r*n;let a=2*r-o,c=[0,0,0];for(let l=0;l<3;l++){if(s=t+0.3333333333333333*-(l-1),s<0)s++;if(s>1)s--;if(6*s<1)i=a+(o-a)*6*s;else if(2*s<1)i=o;else if(3*s<2)i=a+(o-a)*(0.6666666666666666-s)*6;else i=a;c[l]=i*255}return c};Se.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,o=n,s=Math.max(r,0.01);r*=2,n*=r<=1?r:2-r,o*=s<=1?s:2-s;let i=(r+n)/2,a=r===0?2*o/(s+o):2*n/(r+n);return[t,a*100,i*100]};Se.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,o=Math.floor(t)%6,s=t-Math.floor(t),i=255*r*(1-n),a=255*r*(1-n*s),c=255*r*(1-n*(1-s));switch(r*=255,o){case 0:return[r,c,i];case 1:return[a,r,i];case 2:return[i,r,c];case 3:return[i,a,r];case 4:return[c,i,r];case 5:return[r,i,a]}};Se.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,o=Math.max(r,0.01),s,i;i=(2-n)*r;let a=(2-n)*o;return s=n*o,s/=a<=1?a:2-a,s=s||0,i/=2,[t,s*100,i*100]};Se.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,o=n+r,s;if(o>1)n/=o,r/=o;let i=Math.floor(6*t),a=1-r;if(s=6*t-i,(i&1)!==0)s=1-s;let c=n+s*(a-n),l,d,f;switch(i){default:case 6:case 0:l=a,d=c,f=n;break;case 1:l=c,d=a,f=n;break;case 2:l=n,d=a,f=c;break;case 3:l=n,d=c,f=a;break;case 4:l=c,d=n,f=a;break;case 5:l=a,d=n,f=c;break}return[l*255,d*255,f*255]};Se.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,o=e[3]/100,s=1-Math.min(1,t*(1-o)+o),i=1-Math.min(1,n*(1-o)+o),a=1-Math.min(1,r*(1-o)+o);return[s*255,i*255,a*255]};Se.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,o,s,i;return o=t*3.2406+n*-1.5372+r*-0.4986,s=t*-0.9689+n*1.8758+r*0.0415,i=t*0.0557+n*-0.204+r*1.057,o=o>0.0031308?1.055*o**0.4166666666666667-0.055:o*12.92,s=s>0.0031308?1.055*s**0.4166666666666667-0.055:s*12.92,i=i>0.0031308?1.055*i**0.4166666666666667-0.055:i*12.92,o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),i=Math.min(Math.max(0,i),1),[o*255,s*255,i*255]};Se.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];t/=95.047,n/=100,r/=108.883,t=t>0.008856?t**0.3333333333333333:7.787*t+0.13793103448275862,n=n>0.008856?n**0.3333333333333333:7.787*n+0.13793103448275862,r=r>0.008856?r**0.3333333333333333:7.787*r+0.13793103448275862;let o=116*n-16,s=500*(t-n),i=200*(n-r);return[o,s,i]};Se.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],o,s,i;s=(t+16)/116,o=n/500+s,i=s-r/200;let a=s**3,c=o**3,l=i**3;return s=a>0.008856?a:(s-0.13793103448275862)/7.787,o=c>0.008856?c:(o-0.13793103448275862)/7.787,i=l>0.008856?l:(i-0.13793103448275862)/7.787,o*=95.047,s*=100,i*=108.883,[o,s,i]};Se.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],o;if(o=Math.atan2(r,n)*360/2/Math.PI,o<0)o+=360;let i=Math.sqrt(n*n+r*r);return[t,i,o]};Se.lch.lab=function(e){let t=e[0],n=e[1],o=e[2]/360*2*Math.PI,s=n*Math.cos(o),i=n*Math.sin(o);return[t,s,i]};Se.rgb.ansi16=function(e,t=null){let[n,r,o]=e,s=t===null?Se.rgb.hsv(e)[2]:t;if(s=Math.round(s/50),s===0)return 30;let i=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));if(s===2)i+=60;return i};Se.hsv.ansi16=function(e){return Se.rgb.ansi16(Se.hsv.rgb(e),e[2])};Se.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];if(t===n&&n===r){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)};Se.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let n=(~~(e>50)+1)*0.5,r=(t&1)*n*255,o=(t>>1&1)*n*255,s=(t>>2&1)*n*255;return[r,o,s]};Se.ansi256.rgb=function(e){if(e>=232){let s=(e-232)*10+8;return[s,s,s]}e-=16;let t,n=Math.floor(e/36)/5*255,r=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[n,r,o]};Se.rgb.hex=function(e){let n=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(n.length)+n};Se.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];if(t[0].length===3)n=n.split("").map((a)=>a+a).join("");let r=parseInt(n,16),o=r>>16&255,s=r>>8&255,i=r&255;return[o,s,i]};Se.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.max(Math.max(t,n),r),s=Math.min(Math.min(t,n),r),i=o-s,a,c;if(i<1)a=s/(1-i);else a=0;if(i<=0)c=0;else if(o===t)c=(n-r)/i%6;else if(o===n)c=2+(r-t)/i;else c=4+(t-n)/i;return c/=6,c%=1,[c*360,i*100,a*100]};Se.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<0.5?2*t*n:2*t*(1-n),o=0;if(r<1)o=(n-0.5*r)/(1-r);return[e[0],r*100,o*100]};Se.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,o=0;if(r<1)o=(n-r)/(1-r);return[e[0],r*100,o*100]};Se.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let o=[0,0,0],s=t%1*6,i=s%1,a=1-i,c=0;switch(Math.floor(s)){case 0:o[0]=1,o[1]=i,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=i;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=i,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return c=(1-n)*r,[(n*o[0]+c)*255,(n*o[1]+c)*255,(n*o[2]+c)*255]};Se.hcg.hsv=function(e){let t=e[1]/100,n=e[2]/100,r=t+n*(1-t),o=0;if(r>0)o=t/r;return[e[0],o*100,r*100]};Se.hcg.hsl=function(e){let t=e[1]/100,r=e[2]/100*(1-t)+0.5*t,o=0;if(r>0&&r<0.5)o=t/(2*r);else if(r>=0.5&&r<1)o=t/(2*(1-r));return[e[0],o*100,r*100]};Se.hcg.hwb=function(e){let t=e[1]/100,n=e[2]/100,r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};Se.hwb.hcg=function(e){let t=e[1]/100,r=1-e[2]/100,o=r-t,s=0;if(o<1)s=(r-o)/(1-o);return[e[0],o*100,s*100]};Se.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};Se.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};Se.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};Se.gray.hsl=function(e){return[0,0,e[0]]};Se.gray.hsv=Se.gray.hsl;Se.gray.hwb=function(e){return[0,100,e[0]]};Se.gray.cmyk=function(e){return[0,0,0,e[0]]};Se.gray.lab=function(e){return[e[0],0,0]};Se.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r};Se.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}});var jW=w(function(F3t,MW){var Tx=a2();function U9e(){let e={},t=Object.keys(Tx);for(let n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function H9e(e){let t=U9e(),n=[e];t[e].distance=0;while(n.length){let r=n.pop(),o=Object.keys(Tx[r]);for(let s=o.length,i=0;i<s;i++){let a=o[i],c=t[a];if(c.distance===-1)c.distance=t[r].distance+1,c.parent=r,n.unshift(a)}}return t}function V9e(e,t){return function(n){return t(e(n))}}function z9e(e,t){let n=[t[e].parent,e],r=Tx[t[e].parent][e],o=t[e].parent;while(t[o].parent)n.unshift(t[o].parent),r=V9e(Tx[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}MW.exports=function(e){let t=H9e(e),n={},r=Object.keys(t);for(let o=r.length,s=0;s<o;s++){let i=r[s];if(t[i].parent===null)continue;n[i]=z9e(i,t)}return n}});var qW=w(function(M3t,LW){var c2=a2(),G9e=jW(),Pm={},W9e=Object.keys(c2);function K9e(e){let t=function(...n){let r=n[0];if(r===void 0||r===null)return r;if(r.length>1)n=r;return e(n)};if("conversion"in e)t.conversion=e.conversion;return t}function J9e(e){let t=function(...n){let r=n[0];if(r===void 0||r===null)return r;if(r.length>1)n=r;let o=e(n);if(typeof o==="object")for(let s=o.length,i=0;i<s;i++)o[i]=Math.round(o[i]);return o};if("conversion"in e)t.conversion=e.conversion;return t}W9e.forEach((e)=>{Pm[e]={},Object.defineProperty(Pm[e],"channels",{value:c2[e].channels}),Object.defineProperty(Pm[e],"labels",{value:c2[e].labels});let t=G9e(e);Object.keys(t).forEach((r)=>{let o=t[r];Pm[e][r]=J9e(o),Pm[e][r].raw=K9e(o)})});LW.exports=Pm});var u2=w(function(j3t,zW){var BW=(e,t)=>(...n)=>`\x1B[${e(...n)+t}m`,UW=(e,t)=>(...n)=>{let r=e(...n);return`\x1B[${38+t};5;${r}m`},HW=(e,t)=>(...n)=>{let r=e(...n);return`\x1B[${38+t};2;${r[0]};${r[1]};${r[2]}m`},Px=(e)=>e,VW=(e,t,n)=>[e,t,n],Im=(e,t,n)=>{Object.defineProperty(e,t,{get:()=>{let r=n();return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0}),r},enumerable:!0,configurable:!0})},l2,Nm=(e,t,n,r)=>{if(l2===void 0)l2=qW();let o=r?10:0,s={};for(let[i,a]of Object.entries(l2)){let c=i==="ansi16"?"ansi":i;if(i===t)s[c]=e(n,o);else if(typeof a==="object")s[c]=e(a[t],o)}return s};function Y9e(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[n,r]of Object.entries(t)){for(let[o,s]of Object.entries(r))t[o]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[o]=t[o],e.set(s[0],s[1]);Object.defineProperty(t,n,{value:r,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",Im(t.color,"ansi",()=>Nm(BW,"ansi16",Px,!1)),Im(t.color,"ansi256",()=>Nm(UW,"ansi256",Px,!1)),Im(t.color,"ansi16m",()=>Nm(HW,"rgb",VW,!1)),Im(t.bgColor,"ansi",()=>Nm(BW,"ansi16",Px,!0)),Im(t.bgColor,"ansi256",()=>Nm(UW,"ansi256",Px,!0)),Im(t.bgColor,"ansi16m",()=>Nm(HW,"rgb",VW,!0)),t}Object.defineProperty(zW,"exports",{enumerable:!0,get:Y9e})});var JW=w(function(L3t,KW){var a0=i2(),X9e=s0(),WW=u2(),f2=new Set(["\x1B","\x9B"]),GW=(e)=>`${f2.values().next().value}[${e}m`,Q9e=(e)=>e.split(" ").map((t)=>a0(t)),d2=(e,t,n)=>{let r=[...t],o=!1,s=a0(X9e(e[e.length-1]));for(let[i,a]of r.entries()){let c=a0(a);if(s+c<=n)e[e.length-1]+=a;else e.push(a),s=0;if(f2.has(a))o=!0;else if(o&&a==="m"){o=!1;continue}if(o)continue;if(s+=c,s===n&&i<r.length-1)e.push(""),s=0}if(!s&&e[e.length-1].length>0&&e.length>1)e[e.length-2]+=e.pop()},Z9e=(e)=>{let t=e.split(" "),n=t.length;while(n>0){if(a0(t[n-1])>0)break;n--}if(n===t.length)return e;return t.slice(0,n).join(" ")+t.slice(n).join("")},e7e=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let r="",o="",s,i=Q9e(e),a=[""];for(let[c,l]of e.split(" ").entries()){if(n.trim!==!1)a[a.length-1]=a[a.length-1].trimLeft();let d=a0(a[a.length-1]);if(c!==0){if(d>=t&&(n.wordWrap===!1||n.trim===!1))a.push(""),d=0;if(d>0||n.trim===!1)a[a.length-1]+=" ",d++}if(n.hard&&i[c]>t){let f=t-d,p=1+Math.floor((i[c]-f-1)/t);if(Math.floor((i[c]-1)/t)<p)a.push("");d2(a,l,t);continue}if(d+i[c]>t&&d>0&&i[c]>0){if(n.wordWrap===!1&&d<t){d2(a,l,t);continue}a.push("")}if(d+i[c]>t&&n.wordWrap===!1){d2(a,l,t);continue}a[a.length-1]+=l}if(n.trim!==!1)a=a.map(Z9e);r=a.join(`
|
|
34
|
+
`+wW.default.dim("(Move up and down to reveal more choices)")}getInfiniteLines(e,t,n){if(this.pointer===void 0)this.pointer=0;let r=Math.floor(n/2);if(this.pointer<r&&this.lastIndex<t&&t-this.lastIndex<n)this.pointer=Math.min(r,this.pointer+t-this.lastIndex);let o=[e,e,e].flat(),s=Math.max(0,t+e.length-this.pointer);return o.splice(s,n)}getFiniteLines(e,t,n){let r=t-n/2;if(r<0)r=0;else if(r+n>e.length)r=e.length-n;return e.splice(r,n)}}var wW;var r0=z(()=>{wW=et(Hs(),1)});function Uc(e,t,n){let r=n.choices.realLength,o="loop"in n?Boolean(n.loop):!0;if(t==="up"){if(e>0)return e-1;return o?r-1:e}if(t==="down"){if(e<r-1)return e+1;return o?0:e}throw Error("dir must be up or down")}class ks{constructor(e){this.type="separator",this.line=_W.default.dim(e||Array.from({length:15}).join(Wl.line))}static exclude(e){return e.type!=="separator"}toString(){return this.line}}var _W;var o0=z(()=>{dx();_W=et(Hs(),1)});class Tm{constructor(e,t){if(e instanceof Tm||e.type==="separator")return e;if(typeof e==="string"||typeof e==="number")this.name=String(e),this.value=e,this.short=String(e);else Object.assign(this,e,{name:e.name||e.value,value:"value"in e?e.value:e.name,short:e.short||e.name||e.value});this.disabled=typeof e.disabled==="function"?e.disabled(t):e.disabled}}import xW from"assert";var Ox;var vW=z(()=>{o0();Ox=class Ox{constructor(e,t){this.choices=e.map((n)=>{if(n.type==="separator"){if(!(n instanceof ks))n=new ks(n.line);return n}return new Tm(n,t)}),this.realChoices=this.choices.filter(ks.exclude).filter((n)=>!n.disabled),Object.defineProperty(this,"length",{get(){return this.choices.length},set(n){this.choices.length=n}}),Object.defineProperty(this,"realLength",{get(){return this.realChoices.length},set(){throw Error("Cannot set `realLength` of a Choices collection")}})}[Symbol.iterator](){let e=this.choices,t=-1;return{next:()=>({value:e[++t],done:!(t in e)})}}getChoice(e){return xW(typeof e==="number"),this.realChoices[e]}get(e){return xW(typeof e==="number"),this.choices[e]}where(e){let t;if(typeof e==="function")t=e;else{let[n,r]=Object.entries(e)[0];t=(o)=>o[n]===r}return this.realChoices.filter(t)}pluck(e){return this.realChoices.map((t)=>t[e])}indexOf(...e){return this.choices.indexOf(...e)}forEach(...e){return this.choices.forEach(...e)}filter(...e){return this.choices.filter(...e)}reduce(...e){return this.choices.reduce(...e)}find(e){return this.choices.find(e)}some(e){return this.choices.some(e)}push(...e){let t=e.map((n)=>new Tm(n));return this.choices.push(...t),this.realChoices=this.choices.filter(ks.exclude).filter((n)=>!n.disabled),this.choices}}});var EW=w(function(Rqt,kW){kW.exports=F9e;function N9e(e){let t={defaultWidth:0,output:process.stdout,tty:Nt("tty")};if(!e)return t;return Object.keys(t).forEach(function(n){if(!e[n])e[n]=t[n]}),e}function F9e(e){let t=N9e(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let n=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(n)&&n!==0)return n}return t.defaultWidth}});var $W=w(function(Cqt,SW){SW.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var s0=w(function(Aqt,DW){var M9e=$W();DW.exports=(e)=>typeof e==="string"?e.replace(M9e(),""):e});var CW=w(function(Oqt,o2){var RW=(e)=>{if(Number.isNaN(e))return!1;if(e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141))return!0;return!1};o2.exports=RW;o2.exports.default=RW});var OW=w(function(Tqt,AW){AW.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var i2=w(function(Pqt,s2){var j9e=s0(),L9e=CW(),q9e=OW(),TW=(e)=>{if(typeof e!=="string"||e.length===0)return 0;if(e=j9e(e),e.length===0)return 0;e=e.replace(q9e()," ");let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);if(r<=31||r>=127&&r<=159)continue;if(r>=768&&r<=879)continue;if(r>65535)n++;t+=L9e(r)?2:1}return t};s2.exports=TW;s2.exports.default=TW});var IW=w(function(Iqt,PW){PW.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var a2=w(function(Nqt,FW){var i0=IW(),NW={};for(let e of Object.keys(i0))NW[i0[e]]=e;var Se={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};FW.exports=Se;for(let e of Object.keys(Se)){if(!("channels"in Se[e]))throw Error("missing channels property: "+e);if(!("labels"in Se[e]))throw Error("missing channel labels property: "+e);if(Se[e].labels.length!==Se[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:n}=Se[e];delete Se[e].channels,delete Se[e].labels,Object.defineProperty(Se[e],"channels",{value:t}),Object.defineProperty(Se[e],"labels",{value:n})}Se.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(t,n,r),s=Math.max(t,n,r),i=s-o,a,c;if(s===o)a=0;else if(t===s)a=(n-r)/i;else if(n===s)a=2+(r-t)/i;else if(r===s)a=4+(t-n)/i;if(a=Math.min(a*60,360),a<0)a+=360;let l=(o+s)/2;if(s===o)c=0;else if(l<=0.5)c=i/(s+o);else c=i/(2-s-o);return[a,c*100,l*100]};Se.rgb.hsv=function(e){let t,n,r,o,s,i=e[0]/255,a=e[1]/255,c=e[2]/255,l=Math.max(i,a,c),d=l-Math.min(i,a,c),f=function(p){return(l-p)/6/d+0.5};if(d===0)o=0,s=0;else{if(s=d/l,t=f(i),n=f(a),r=f(c),i===l)o=r-n;else if(a===l)o=0.3333333333333333+t-r;else if(c===l)o=0.6666666666666666+n-t;if(o<0)o+=1;else if(o>1)o-=1}return[o*360,s*100,l*100]};Se.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],o=Se.rgb.hsl(e)[0],s=0.00392156862745098*Math.min(t,Math.min(n,r));return r=1-0.00392156862745098*Math.max(t,Math.max(n,r)),[o,s*100,r*100]};Se.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(1-t,1-n,1-r),s=(1-t-o)/(1-o)||0,i=(1-n-o)/(1-o)||0,a=(1-r-o)/(1-o)||0;return[s*100,i*100,a*100,o*100]};function B9e(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Se.rgb.keyword=function(e){let t=NW[e];if(t)return t;let n=1/0,r;for(let o of Object.keys(i0)){let s=i0[o],i=B9e(e,s);if(i<n)n=i,r=o}return r};Se.keyword.rgb=function(e){return i0[e]};Se.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>0.04045?((t+0.055)/1.055)**2.4:t/12.92,n=n>0.04045?((n+0.055)/1.055)**2.4:n/12.92,r=r>0.04045?((r+0.055)/1.055)**2.4:r/12.92;let o=t*0.4124+n*0.3576+r*0.1805,s=t*0.2126+n*0.7152+r*0.0722,i=t*0.0193+n*0.1192+r*0.9505;return[o*100,s*100,i*100]};Se.rgb.lab=function(e){let t=Se.rgb.xyz(e),n=t[0],r=t[1],o=t[2];n/=95.047,r/=100,o/=108.883,n=n>0.008856?n**0.3333333333333333:7.787*n+0.13793103448275862,r=r>0.008856?r**0.3333333333333333:7.787*r+0.13793103448275862,o=o>0.008856?o**0.3333333333333333:7.787*o+0.13793103448275862;let s=116*r-16,i=500*(n-r),a=200*(r-o);return[s,i,a]};Se.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,o,s,i;if(n===0)return i=r*255,[i,i,i];if(r<0.5)o=r*(1+n);else o=r+n-r*n;let a=2*r-o,c=[0,0,0];for(let l=0;l<3;l++){if(s=t+0.3333333333333333*-(l-1),s<0)s++;if(s>1)s--;if(6*s<1)i=a+(o-a)*6*s;else if(2*s<1)i=o;else if(3*s<2)i=a+(o-a)*(0.6666666666666666-s)*6;else i=a;c[l]=i*255}return c};Se.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,o=n,s=Math.max(r,0.01);r*=2,n*=r<=1?r:2-r,o*=s<=1?s:2-s;let i=(r+n)/2,a=r===0?2*o/(s+o):2*n/(r+n);return[t,a*100,i*100]};Se.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,o=Math.floor(t)%6,s=t-Math.floor(t),i=255*r*(1-n),a=255*r*(1-n*s),c=255*r*(1-n*(1-s));switch(r*=255,o){case 0:return[r,c,i];case 1:return[a,r,i];case 2:return[i,r,c];case 3:return[i,a,r];case 4:return[c,i,r];case 5:return[r,i,a]}};Se.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,o=Math.max(r,0.01),s,i;i=(2-n)*r;let a=(2-n)*o;return s=n*o,s/=a<=1?a:2-a,s=s||0,i/=2,[t,s*100,i*100]};Se.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,o=n+r,s;if(o>1)n/=o,r/=o;let i=Math.floor(6*t),a=1-r;if(s=6*t-i,(i&1)!==0)s=1-s;let c=n+s*(a-n),l,d,f;switch(i){default:case 6:case 0:l=a,d=c,f=n;break;case 1:l=c,d=a,f=n;break;case 2:l=n,d=a,f=c;break;case 3:l=n,d=c,f=a;break;case 4:l=c,d=n,f=a;break;case 5:l=a,d=n,f=c;break}return[l*255,d*255,f*255]};Se.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,o=e[3]/100,s=1-Math.min(1,t*(1-o)+o),i=1-Math.min(1,n*(1-o)+o),a=1-Math.min(1,r*(1-o)+o);return[s*255,i*255,a*255]};Se.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,o,s,i;return o=t*3.2406+n*-1.5372+r*-0.4986,s=t*-0.9689+n*1.8758+r*0.0415,i=t*0.0557+n*-0.204+r*1.057,o=o>0.0031308?1.055*o**0.4166666666666667-0.055:o*12.92,s=s>0.0031308?1.055*s**0.4166666666666667-0.055:s*12.92,i=i>0.0031308?1.055*i**0.4166666666666667-0.055:i*12.92,o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),i=Math.min(Math.max(0,i),1),[o*255,s*255,i*255]};Se.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];t/=95.047,n/=100,r/=108.883,t=t>0.008856?t**0.3333333333333333:7.787*t+0.13793103448275862,n=n>0.008856?n**0.3333333333333333:7.787*n+0.13793103448275862,r=r>0.008856?r**0.3333333333333333:7.787*r+0.13793103448275862;let o=116*n-16,s=500*(t-n),i=200*(n-r);return[o,s,i]};Se.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],o,s,i;s=(t+16)/116,o=n/500+s,i=s-r/200;let a=s**3,c=o**3,l=i**3;return s=a>0.008856?a:(s-0.13793103448275862)/7.787,o=c>0.008856?c:(o-0.13793103448275862)/7.787,i=l>0.008856?l:(i-0.13793103448275862)/7.787,o*=95.047,s*=100,i*=108.883,[o,s,i]};Se.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],o;if(o=Math.atan2(r,n)*360/2/Math.PI,o<0)o+=360;let i=Math.sqrt(n*n+r*r);return[t,i,o]};Se.lch.lab=function(e){let t=e[0],n=e[1],o=e[2]/360*2*Math.PI,s=n*Math.cos(o),i=n*Math.sin(o);return[t,s,i]};Se.rgb.ansi16=function(e,t=null){let[n,r,o]=e,s=t===null?Se.rgb.hsv(e)[2]:t;if(s=Math.round(s/50),s===0)return 30;let i=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));if(s===2)i+=60;return i};Se.hsv.ansi16=function(e){return Se.rgb.ansi16(Se.hsv.rgb(e),e[2])};Se.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];if(t===n&&n===r){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)};Se.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let n=(~~(e>50)+1)*0.5,r=(t&1)*n*255,o=(t>>1&1)*n*255,s=(t>>2&1)*n*255;return[r,o,s]};Se.ansi256.rgb=function(e){if(e>=232){let s=(e-232)*10+8;return[s,s,s]}e-=16;let t,n=Math.floor(e/36)/5*255,r=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[n,r,o]};Se.rgb.hex=function(e){let n=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(n.length)+n};Se.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];if(t[0].length===3)n=n.split("").map((a)=>a+a).join("");let r=parseInt(n,16),o=r>>16&255,s=r>>8&255,i=r&255;return[o,s,i]};Se.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.max(Math.max(t,n),r),s=Math.min(Math.min(t,n),r),i=o-s,a,c;if(i<1)a=s/(1-i);else a=0;if(i<=0)c=0;else if(o===t)c=(n-r)/i%6;else if(o===n)c=2+(r-t)/i;else c=4+(t-n)/i;return c/=6,c%=1,[c*360,i*100,a*100]};Se.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<0.5?2*t*n:2*t*(1-n),o=0;if(r<1)o=(n-0.5*r)/(1-r);return[e[0],r*100,o*100]};Se.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,o=0;if(r<1)o=(n-r)/(1-r);return[e[0],r*100,o*100]};Se.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let o=[0,0,0],s=t%1*6,i=s%1,a=1-i,c=0;switch(Math.floor(s)){case 0:o[0]=1,o[1]=i,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=i;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=i,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return c=(1-n)*r,[(n*o[0]+c)*255,(n*o[1]+c)*255,(n*o[2]+c)*255]};Se.hcg.hsv=function(e){let t=e[1]/100,n=e[2]/100,r=t+n*(1-t),o=0;if(r>0)o=t/r;return[e[0],o*100,r*100]};Se.hcg.hsl=function(e){let t=e[1]/100,r=e[2]/100*(1-t)+0.5*t,o=0;if(r>0&&r<0.5)o=t/(2*r);else if(r>=0.5&&r<1)o=t/(2*(1-r));return[e[0],o*100,r*100]};Se.hcg.hwb=function(e){let t=e[1]/100,n=e[2]/100,r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};Se.hwb.hcg=function(e){let t=e[1]/100,r=1-e[2]/100,o=r-t,s=0;if(o<1)s=(r-o)/(1-o);return[e[0],o*100,s*100]};Se.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};Se.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};Se.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};Se.gray.hsl=function(e){return[0,0,e[0]]};Se.gray.hsv=Se.gray.hsl;Se.gray.hwb=function(e){return[0,100,e[0]]};Se.gray.cmyk=function(e){return[0,0,0,e[0]]};Se.gray.lab=function(e){return[e[0],0,0]};Se.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r};Se.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}});var jW=w(function(Fqt,MW){var Tx=a2();function U9e(){let e={},t=Object.keys(Tx);for(let n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function H9e(e){let t=U9e(),n=[e];t[e].distance=0;while(n.length){let r=n.pop(),o=Object.keys(Tx[r]);for(let s=o.length,i=0;i<s;i++){let a=o[i],c=t[a];if(c.distance===-1)c.distance=t[r].distance+1,c.parent=r,n.unshift(a)}}return t}function V9e(e,t){return function(n){return t(e(n))}}function z9e(e,t){let n=[t[e].parent,e],r=Tx[t[e].parent][e],o=t[e].parent;while(t[o].parent)n.unshift(t[o].parent),r=V9e(Tx[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}MW.exports=function(e){let t=H9e(e),n={},r=Object.keys(t);for(let o=r.length,s=0;s<o;s++){let i=r[s];if(t[i].parent===null)continue;n[i]=z9e(i,t)}return n}});var qW=w(function(Mqt,LW){var c2=a2(),G9e=jW(),Pm={},W9e=Object.keys(c2);function K9e(e){let t=function(...n){let r=n[0];if(r===void 0||r===null)return r;if(r.length>1)n=r;return e(n)};if("conversion"in e)t.conversion=e.conversion;return t}function J9e(e){let t=function(...n){let r=n[0];if(r===void 0||r===null)return r;if(r.length>1)n=r;let o=e(n);if(typeof o==="object")for(let s=o.length,i=0;i<s;i++)o[i]=Math.round(o[i]);return o};if("conversion"in e)t.conversion=e.conversion;return t}W9e.forEach((e)=>{Pm[e]={},Object.defineProperty(Pm[e],"channels",{value:c2[e].channels}),Object.defineProperty(Pm[e],"labels",{value:c2[e].labels});let t=G9e(e);Object.keys(t).forEach((r)=>{let o=t[r];Pm[e][r]=J9e(o),Pm[e][r].raw=K9e(o)})});LW.exports=Pm});var u2=w(function(jqt,zW){var BW=(e,t)=>(...n)=>`\x1B[${e(...n)+t}m`,UW=(e,t)=>(...n)=>{let r=e(...n);return`\x1B[${38+t};5;${r}m`},HW=(e,t)=>(...n)=>{let r=e(...n);return`\x1B[${38+t};2;${r[0]};${r[1]};${r[2]}m`},Px=(e)=>e,VW=(e,t,n)=>[e,t,n],Im=(e,t,n)=>{Object.defineProperty(e,t,{get:()=>{let r=n();return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0}),r},enumerable:!0,configurable:!0})},l2,Nm=(e,t,n,r)=>{if(l2===void 0)l2=qW();let o=r?10:0,s={};for(let[i,a]of Object.entries(l2)){let c=i==="ansi16"?"ansi":i;if(i===t)s[c]=e(n,o);else if(typeof a==="object")s[c]=e(a[t],o)}return s};function Y9e(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[n,r]of Object.entries(t)){for(let[o,s]of Object.entries(r))t[o]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[o]=t[o],e.set(s[0],s[1]);Object.defineProperty(t,n,{value:r,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",Im(t.color,"ansi",()=>Nm(BW,"ansi16",Px,!1)),Im(t.color,"ansi256",()=>Nm(UW,"ansi256",Px,!1)),Im(t.color,"ansi16m",()=>Nm(HW,"rgb",VW,!1)),Im(t.bgColor,"ansi",()=>Nm(BW,"ansi16",Px,!0)),Im(t.bgColor,"ansi256",()=>Nm(UW,"ansi256",Px,!0)),Im(t.bgColor,"ansi16m",()=>Nm(HW,"rgb",VW,!0)),t}Object.defineProperty(zW,"exports",{enumerable:!0,get:Y9e})});var JW=w(function(Lqt,KW){var a0=i2(),X9e=s0(),WW=u2(),f2=new Set(["\x1B","\x9B"]),GW=(e)=>`${f2.values().next().value}[${e}m`,Q9e=(e)=>e.split(" ").map((t)=>a0(t)),d2=(e,t,n)=>{let r=[...t],o=!1,s=a0(X9e(e[e.length-1]));for(let[i,a]of r.entries()){let c=a0(a);if(s+c<=n)e[e.length-1]+=a;else e.push(a),s=0;if(f2.has(a))o=!0;else if(o&&a==="m"){o=!1;continue}if(o)continue;if(s+=c,s===n&&i<r.length-1)e.push(""),s=0}if(!s&&e[e.length-1].length>0&&e.length>1)e[e.length-2]+=e.pop()},Z9e=(e)=>{let t=e.split(" "),n=t.length;while(n>0){if(a0(t[n-1])>0)break;n--}if(n===t.length)return e;return t.slice(0,n).join(" ")+t.slice(n).join("")},e7e=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let r="",o="",s,i=Q9e(e),a=[""];for(let[c,l]of e.split(" ").entries()){if(n.trim!==!1)a[a.length-1]=a[a.length-1].trimLeft();let d=a0(a[a.length-1]);if(c!==0){if(d>=t&&(n.wordWrap===!1||n.trim===!1))a.push(""),d=0;if(d>0||n.trim===!1)a[a.length-1]+=" ",d++}if(n.hard&&i[c]>t){let f=t-d,p=1+Math.floor((i[c]-f-1)/t);if(Math.floor((i[c]-1)/t)<p)a.push("");d2(a,l,t);continue}if(d+i[c]>t&&d>0&&i[c]>0){if(n.wordWrap===!1&&d<t){d2(a,l,t);continue}a.push("")}if(d+i[c]>t&&n.wordWrap===!1){d2(a,l,t);continue}a[a.length-1]+=l}if(n.trim!==!1)a=a.map(Z9e);r=a.join(`
|
|
35
35
|
`);for(let[c,l]of[...r].entries()){if(o+=l,f2.has(l)){let f=parseFloat(/\d[^m]*/.exec(r.slice(c,c+4)));s=f===39?null:f}let d=WW.codes.get(Number(s));if(s&&d){if(r[c+1]===`
|
|
36
36
|
`)o+=GW(d);else if(l===`
|
|
37
37
|
`)o+=GW(s)}}return o};KW.exports=(e,t,n)=>String(e).normalize().replace(/\r\n/g,`
|
|
38
38
|
`).split(`
|
|
39
39
|
`).map((r)=>e7e(r,t,n)).join(`
|
|
40
|
-
`)});var XW=w(function(
|
|
40
|
+
`)});var XW=w(function(qqt,YW){YW.exports=(e,t=process.argv)=>{let n=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}});var eK=w(function(Bqt,ZW){var QW=Nt("os"),Ix=Nt("tty"),zs=XW(),{env:Dr}=process,gu;if(zs("no-color")||zs("no-colors")||zs("color=false")||zs("color=never"))gu=0;else if(zs("color")||zs("colors")||zs("color=true")||zs("color=always"))gu=1;if("FORCE_COLOR"in Dr)if(Dr.FORCE_COLOR==="true")gu=1;else if(Dr.FORCE_COLOR==="false")gu=0;else gu=Dr.FORCE_COLOR.length===0?1:Math.min(parseInt(Dr.FORCE_COLOR,10),3);function p2(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function m2(e,t){if(gu===0)return 0;if(zs("color=16m")||zs("color=full")||zs("color=truecolor"))return 3;if(zs("color=256"))return 2;if(e&&!t&&gu===void 0)return 0;let n=gu||0;if(Dr.TERM==="dumb")return n;if(process.platform==="win32"){let r=QW.release().split(".");if(Number(r[0])>=10&&Number(r[2])>=10586)return Number(r[2])>=14931?3:2;return 1}if("CI"in Dr){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((r)=>(r in Dr))||Dr.CI_NAME==="codeship")return 1;return n}if("TEAMCITY_VERSION"in Dr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Dr.TEAMCITY_VERSION)?1:0;if(Dr.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Dr){let r=parseInt((Dr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Dr.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(Dr.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Dr.TERM))return 1;if("COLORTERM"in Dr)return 1;return n}function t7e(e){let t=m2(e,e&&e.isTTY);return p2(t)}ZW.exports={supportsColor:t7e,stdout:p2(m2(!0,Ix.isatty(1))),stderr:p2(m2(!0,Ix.isatty(2)))}});var nK=w(function(Uqt,tK){var n7e=(e,t,n)=>{let r=e.indexOf(t);if(r===-1)return e;let o=t.length,s=0,i="";do i+=e.substr(s,r-s)+t+n,s=r+o,r=e.indexOf(t,s);while(r!==-1);return i+=e.substr(s),i},r7e=(e,t,n,r)=>{let o=0,s="";do{let i=e[r-1]==="\r";s+=e.substr(o,(i?r-1:r)-o)+t+(i?`\r
|
|
41
41
|
`:`
|
|
42
42
|
`)+n,o=r+1,r=e.indexOf(`
|
|
43
|
-
`,o)}while(r!==-1);return s+=e.substr(o),s};tK.exports={stringReplaceAll:n7e,stringEncaseCRLFWithFirstIndex:r7e}});var aK=w(function(
|
|
44
|
-
`],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\x00"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function sK(e){let t=e[0]==="u",n=e[1]==="{";if(t&&!n&&e.length===5||e[0]==="x"&&e.length===3)return String.fromCharCode(parseInt(e.slice(1),16));if(t&&n)return String.fromCodePoint(parseInt(e.slice(2,-1),16));return a7e.get(e)||e}function c7e(e,t){let n=[],r=t.trim().split(/\s*,\s*/g),o;for(let s of r){let i=Number(s);if(!Number.isNaN(i))n.push(i);else if(o=s.match(s7e))n.push(o[2].replace(i7e,(a,c,l)=>c?sK(c):l));else throw Error(`Invalid Chalk template style argument: ${s} (in style '${e}')`)}return n}function l7e(e){rK.lastIndex=0;let t=[],n;while((n=rK.exec(e))!==null){let r=n[1];if(n[2]){let o=c7e(r,n[2]);t.push([r].concat(o))}else t.push([r])}return t}function oK(e,t){let n={};for(let o of t)for(let s of o.styles)n[s[0]]=o.inverse?null:s.slice(1);let r=e;for(let[o,s]of Object.entries(n)){if(!Array.isArray(s))continue;if(!(o in r))throw Error(`Unknown Chalk style: ${o}`);r=s.length>0?r[o](...s):r[o]}return r}iK.exports=(e,t)=>{let n=[],r=[],o=[];if(t.replace(o7e,(s,i,a,c,l,d)=>{if(i)o.push(sK(i));else if(c){let f=o.join("");o=[],r.push(n.length===0?f:oK(e,n)(f)),n.push({inverse:a,styles:l7e(c)})}else if(l){if(n.length===0)throw Error("Found extraneous } in Chalk template literal");r.push(oK(e,n)(o.join(""))),o=[],n.pop()}else o.push(d)}),r.push(o.join("")),n.length>0){let s=`Chalk template literal is missing ${n.length} closing bracket${n.length===1?"":"s"} (\`}\`)`;throw Error(s)}return r.join("")}});var w2=w(function(
|
|
45
|
-
`);if(s!==-1)t=d7e(t,o,r,s);return r+t+o},h2,pK=(e,...t)=>{let[n]=t;if(!Nx(n)||!Nx(n.raw))return t.join(" ");let r=t.slice(1),o=[n.raw[0]];for(let s=1;s<n.length;s++)o.push(String(r[s-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[s]));if(h2===void 0)h2=aK();return h2(e,o.join(""))};Object.defineProperties(Fx.prototype,Fm);var jx=Fx();jx.supportsColor=g2;jx.stderr=Fx({level:y2?y2.level:0});jx.stderr.supportsColor=y2;mK.exports=jx});var gK=w(function(z3t,_2){var hK=(e,t)=>{for(let n of Reflect.ownKeys(t))Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n));return e};_2.exports=hK;_2.exports.default=hK});var bK=w(function(G3t,qx){var m7e=gK(),Lx=new WeakMap,yK=(e,t={})=>{if(typeof e!=="function")throw TypeError("Expected a function");let n,r=0,o=e.displayName||e.name||"<anonymous>",s=function(...i){if(Lx.set(s,++r),r===1)n=e.apply(this,i),e=null;else if(t.throw===!0)throw Error(`Function \`${o}\` can only be called once`);return n};return m7e(s,e),Lx.set(s,r),s};qx.exports=yK;qx.exports.default=yK;qx.exports.callCount=(e)=>{if(!Lx.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Lx.get(e)}});var wK=w(function(W3t,Bx){Bx.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Bx.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Bx.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var _K=w(function(K3t,jm){var vn=global.process,uf=function(e){return 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"};if(!uf(vn))jm.exports=function(){return function(){}};else{if(x2=Nt("assert"),df=wK(),v2=/^win/i.test(vn.platform),Mm=Nt("events"),typeof Mm!=="function")Mm=Mm.EventEmitter;if(vn.__signal_exit_emitter__)_r=vn.__signal_exit_emitter__;else _r=vn.__signal_exit_emitter__=new Mm,_r.count=0,_r.emitted={};if(!_r.infinite)_r.setMaxListeners(1/0),_r.infinite=!0;jm.exports=function(e,t){if(!uf(global.process))return function(){};if(x2.equal(typeof e,"function","a callback must be provided for exit handler"),ff===!1)Ux();var n="exit";if(t&&t.alwaysLast)n="afterexit";var r=function(){if(_r.removeListener(n,e),_r.listeners("exit").length===0&&_r.listeners("afterexit").length===0)c0()};return _r.on(n,e),r},c0=function(){if(!ff||!uf(global.process))return;ff=!1,df.forEach(function(t){try{vn.removeListener(t,l0[t])}catch(n){}}),vn.emit=u0,vn.reallyExit=Hx,_r.count-=1},jm.exports.unload=c0,yu=function(t,n,r){if(_r.emitted[t])return;_r.emitted[t]=!0,_r.emit(t,n,r)},l0={},df.forEach(function(e){l0[e]=function(){if(!uf(global.process))return;var n=vn.listeners(e);if(n.length===_r.count){if(c0(),yu("exit",null,e),yu("afterexit",null,e),v2&&e==="SIGHUP")e="SIGINT";vn.kill(vn.pid,e)}}}),jm.exports.signals=function(){return df},ff=!1,Ux=function(){if(ff||!uf(global.process))return;ff=!0,_r.count+=1,df=df.filter(function(t){try{return vn.on(t,l0[t]),!0}catch(n){return!1}}),vn.emit=E2,vn.reallyExit=k2},jm.exports.load=Ux,Hx=vn.reallyExit,k2=function(t){if(!uf(global.process))return;vn.exitCode=t||0,yu("exit",vn.exitCode,null),yu("afterexit",vn.exitCode,null),Hx.call(vn,vn.exitCode)},u0=vn.emit,E2=function(t,n){if(t==="exit"&&uf(global.process)){if(n!==void 0)vn.exitCode=n;var r=u0.apply(this,arguments);return yu("exit",vn.exitCode,null),yu("afterexit",vn.exitCode,null),r}else return u0.apply(this,arguments)}}var x2,df,v2,Mm,_r,c0,yu,l0,ff,Ux,Hx,k2,u0,E2});var vK=w(function(J3t,xK){var h7e=bK(),g7e=_K();xK.exports=h7e(()=>{g7e(()=>{process.stderr.write("\x1B[?25h")},{alwaysLast:!0})})});var SK=w(function(b7e){var y7e=vK(),Vx=!1;b7e.show=(e=process.stderr)=>{if(!e.isTTY)return;Vx=!1,e.write("\x1B[?25h")};b7e.hide=(e=process.stderr)=>{if(!e.isTTY)return;y7e(),Vx=!0,e.write("\x1B[?25l")};b7e.toggle=(e,t)=>{if(e!==void 0)Vx=e;if(Vx)b7e.show(t);else b7e.hide(t)}});var $K=w(function(X3t,_7e){_7e.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\uD83D\uDE04 ","\uD83D\uDE1D "]},monkey:{interval:300,frames:["\uD83D\uDE48 ","\uD83D\uDE48 ","\uD83D\uDE49 ","\uD83D\uDE4A "]},hearts:{interval:100,frames:["\uD83D\uDC9B ","\uD83D\uDC99 ","\uD83D\uDC9C ","\uD83D\uDC9A ","\u2764\uFE0F "]},clock:{interval:100,frames:["\uD83D\uDD5B ","\uD83D\uDD50 ","\uD83D\uDD51 ","\uD83D\uDD52 ","\uD83D\uDD53 ","\uD83D\uDD54 ","\uD83D\uDD55 ","\uD83D\uDD56 ","\uD83D\uDD57 ","\uD83D\uDD58 ","\uD83D\uDD59 ","\uD83D\uDD5A "]},earth:{interval:180,frames:["\uD83C\uDF0D ","\uD83C\uDF0E ","\uD83C\uDF0F "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\uD83C\uDF11 ","\uD83C\uDF12 ","\uD83C\uDF13 ","\uD83C\uDF14 ","\uD83C\uDF15 ","\uD83C\uDF16 ","\uD83C\uDF17 ","\uD83C\uDF18 "]},runner:{interval:140,frames:["\uD83D\uDEB6 ","\uD83C\uDFC3 "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\uD83C\uDF24 ","\u26C5\uFE0F ","\uD83C\uDF25 ","\u2601\uFE0F ","\uD83C\uDF27 ","\uD83C\uDF28 ","\uD83C\uDF27 ","\uD83C\uDF28 ","\uD83C\uDF27 ","\uD83C\uDF28 ","\u26C8 ","\uD83C\uDF28 ","\uD83C\uDF27 ","\uD83C\uDF28 ","\u2601\uFE0F ","\uD83C\uDF25 ","\u26C5\uFE0F ","\uD83C\uDF24 ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\uD83C\uDF32","\uD83C\uDF84"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\uD83E\uDD18 ","\uD83E\uDD1F ","\uD83D\uDD96 ","\u270B ","\uD83E\uDD1A ","\uD83D\uDC46 "]},fistBump:{interval:80,frames:["\uD83E\uDD1C\u3000\u3000\u3000\u3000\uD83E\uDD1B ","\uD83E\uDD1C\u3000\u3000\u3000\u3000\uD83E\uDD1B ","\uD83E\uDD1C\u3000\u3000\u3000\u3000\uD83E\uDD1B ","\u3000\uD83E\uDD1C\u3000\u3000\uD83E\uDD1B\u3000 ","\u3000\u3000\uD83E\uDD1C\uD83E\uDD1B\u3000\u3000 ","\u3000\uD83E\uDD1C\u2728\uD83E\uDD1B\u3000\u3000 ","\uD83E\uDD1C\u3000\u2728\u3000\uD83E\uDD1B\u3000 "]},soccerHeader:{interval:80,frames:[" \uD83E\uDDD1\u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F\uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 "]},mindblown:{interval:160,frames:["\uD83D\uDE10 ","\uD83D\uDE10 ","\uD83D\uDE2E ","\uD83D\uDE2E ","\uD83D\uDE26 ","\uD83D\uDE26 ","\uD83D\uDE27 ","\uD83D\uDE27 ","\uD83E\uDD2F ","\uD83D\uDCA5 ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\uD83D\uDD08 ","\uD83D\uDD09 ","\uD83D\uDD0A ","\uD83D\uDD09 "]},orangePulse:{interval:100,frames:["\uD83D\uDD38 ","\uD83D\uDD36 ","\uD83D\uDFE0 ","\uD83D\uDFE0 ","\uD83D\uDD36 "]},bluePulse:{interval:100,frames:["\uD83D\uDD39 ","\uD83D\uDD37 ","\uD83D\uDD35 ","\uD83D\uDD35 ","\uD83D\uDD37 "]},orangeBluePulse:{interval:100,frames:["\uD83D\uDD38 ","\uD83D\uDD36 ","\uD83D\uDFE0 ","\uD83D\uDFE0 ","\uD83D\uDD36 ","\uD83D\uDD39 ","\uD83D\uDD37 ","\uD83D\uDD35 ","\uD83D\uDD35 ","\uD83D\uDD37 "]},timeTravel:{interval:100,frames:["\uD83D\uDD5B ","\uD83D\uDD5A ","\uD83D\uDD59 ","\uD83D\uDD58 ","\uD83D\uDD57 ","\uD83D\uDD56 ","\uD83D\uDD55 ","\uD83D\uDD54 ","\uD83D\uDD53 ","\uD83D\uDD52 ","\uD83D\uDD51 ","\uD83D\uDD50 "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Gx=w(function(Q3t,RK){var zx=Object.assign({},$K()),DK=Object.keys(zx);Object.defineProperty(zx,"random",{get(){let e=Math.floor(Math.random()*DK.length),t=DK[e];return zx[t]}});RK.exports=zx});var S2=w(function(Z3t,CK){CK.exports=()=>{if(process.platform!=="win32")return!0;return Boolean(process.env.CI)||Boolean(process.env.WT_SESSION)||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}});var OK=w(function(eqt,AK){var co=w2(),x7e=S2(),v7e={info:co.blue("\u2139"),success:co.green("\u2714"),warning:co.yellow("\u26A0"),error:co.red("\u2716")},k7e={info:co.blue("i"),success:co.green("\u221A"),warning:co.yellow("\u203C"),error:co.red("\xD7")};AK.exports=x7e()?v7e:k7e});var TK=w(function(tqt,Wx){var E7e=function(){function e(i,a,c,l){var d;if(typeof a==="object")c=a.depth,l=a.prototype,d=a.filter,a=a.circular;var f=[],p=[],m=typeof Buffer<"u";if(typeof a>"u")a=!0;if(typeof c>"u")c=1/0;function h(g,y){if(g===null)return null;if(y==0)return g;var b,_;if(typeof g!="object")return g;if(e.__isArray(g))b=[];else if(e.__isRegExp(g)){if(b=new RegExp(g.source,s(g)),g.lastIndex)b.lastIndex=g.lastIndex}else if(e.__isDate(g))b=new Date(g.getTime());else if(m&&Buffer.isBuffer(g)){if(Buffer.allocUnsafe)b=Buffer.allocUnsafe(g.length);else b=new Buffer(g.length);return g.copy(b),b}else if(typeof l>"u")_=Object.getPrototypeOf(g),b=Object.create(_);else b=Object.create(l),_=l;if(a){var x=f.indexOf(g);if(x!=-1)return p[x];f.push(g),p.push(b)}for(var k in g){var v;if(_)v=Object.getOwnPropertyDescriptor(_,k);if(v&&v.set==null)continue;b[k]=h(g[k],y-1)}return b}return h(i,c)}e.clonePrototype=function(a){if(a===null)return null;var c=function(){};return c.prototype=a,new c};function t(i){return Object.prototype.toString.call(i)}e.__objToStr=t;function n(i){return typeof i==="object"&&t(i)==="[object Date]"}e.__isDate=n;function r(i){return typeof i==="object"&&t(i)==="[object Array]"}e.__isArray=r;function o(i){return typeof i==="object"&&t(i)==="[object RegExp]"}e.__isRegExp=o;function s(i){var a="";if(i.global)a+="g";if(i.ignoreCase)a+="i";if(i.multiline)a+="m";return a}return e.__getRegExpFlags=s,e}();if(typeof Wx==="object"&&Wx.exports)Wx.exports=E7e});var IK=w(function(nqt,PK){var S7e=TK();PK.exports=function(e,t){return e=e||{},Object.keys(t).forEach(function(n){if(typeof e[n]>"u")e[n]=S7e(t[n])}),e}});var FK=w(function(rqt,NK){NK.exports=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]]});var qK=w(function(oqt,$2){var $7e=IK(),d0=FK(),jK={nul:0,control:0};$2.exports=function(t){return LK(t,jK)};$2.exports.config=function(e){return e=$7e(e||{},jK),function(n){return LK(n,e)}};function LK(e,t){if(typeof e!=="string")return MK(e,t);var n=0;for(var r=0;r<e.length;r++){var o=MK(e.charCodeAt(r),t);if(o<0)return-1;n+=o}return n}function MK(e,t){if(e===0)return t.nul;if(e<32||e>=127&&e<160)return t.control;if(D7e(e))return 0;return 1+(e>=4352&&(e<=4447||e==9001||e==9002||e>=11904&&e<=42191&&e!=12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141))}function D7e(e){var t=0,n=d0.length-1,r;if(e<d0[0][0]||e>d0[n][1])return!1;while(n>=t)if(r=Math.floor((t+n)/2),e>d0[r][1])t=r+1;else if(e<d0[r][0])n=r-1;else return!0;return!1}});var UK=w(function(sqt,BK){BK.exports=({stream:e=process.stdout}={})=>Boolean(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))});var KK=w(function(iqt,WK){function HK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function VK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HK(Object(n),!0).forEach(function(r){R7e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HK(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function R7e(e,t,n){if(t=GK(t),t in e)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});else e[t]=n;return e}function C7e(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function zK(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r)r.writable=!0;Object.defineProperty(e,GK(r.key),r)}}function A7e(e,t,n){if(t)zK(e.prototype,t);if(n)zK(e,n);return Object.defineProperty(e,"prototype",{writable:!1}),e}function GK(e){var t=O7e(e,"string");return typeof t==="symbol"?t:String(t)}function O7e(e,t){if(typeof e!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!=="object")return r;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var T7e=Nt("buffer"),Kx=T7e.Buffer,P7e=Nt("util"),D2=P7e.inspect,I7e=D2&&D2.custom||"inspect";function N7e(e,t,n){Kx.prototype.copy.call(e,t,n)}WK.exports=function(){function e(){C7e(this,e),this.head=null,this.tail=null,this.length=0}return A7e(e,[{key:"push",value:function(n){var r={data:n,next:null};if(this.length>0)this.tail.next=r;else this.head=r;this.tail=r,++this.length}},{key:"unshift",value:function(n){var r={data:n,next:this.head};if(this.length===0)this.tail=r;this.head=r,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var n=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,n}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(n){if(this.length===0)return"";var r=this.head,o=""+r.data;while(r=r.next)o+=n+r.data;return o}},{key:"concat",value:function(n){if(this.length===0)return Kx.alloc(0);var r=Kx.allocUnsafe(n>>>0),o=this.head,s=0;while(o)N7e(o.data,r,s),s+=o.data.length,o=o.next;return r}},{key:"consume",value:function(n,r){var o;if(n<this.head.data.length)o=this.head.data.slice(0,n),this.head.data=this.head.data.slice(n);else if(n===this.head.data.length)o=this.shift();else o=r?this._getString(n):this._getBuffer(n);return o}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(n){var r=this.head,o=1,s=r.data;n-=s.length;while(r=r.next){var i=r.data,a=n>i.length?i.length:n;if(a===i.length)s+=i;else s+=i.slice(0,n);if(n-=a,n===0){if(a===i.length)if(++o,r.next)this.head=r.next;else this.head=this.tail=null;else this.head=r,r.data=i.slice(a);break}++o}return this.length-=o,s}},{key:"_getBuffer",value:function(n){var r=Kx.allocUnsafe(n),o=this.head,s=1;o.data.copy(r),n-=o.data.length;while(o=o.next){var i=o.data,a=n>i.length?i.length:n;if(i.copy(r,r.length-n,0,a),n-=a,n===0){if(a===i.length)if(++s,o.next)this.head=o.next;else this.head=this.tail=null;else this.head=o,o.data=i.slice(a);break}++s}return this.length-=s,r}},{key:I7e,value:function(n,r){return D2(this,VK(VK({},r),{},{depth:0,customInspect:!1}))}}]),e}()});var C2=w(function(aqt,YK){function F7e(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;if(r||o){if(t)t(e);else if(e){if(!this._writableState)process.nextTick(R2,this,e);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(R2,this,e)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(e||null,function(s){if(!t&&s)if(!n._writableState)process.nextTick(JK,n,s);else if(!n._writableState.errorEmitted)n._writableState.errorEmitted=!0,process.nextTick(JK,n,s);else process.nextTick(Jx,n);else if(t)process.nextTick(Jx,n),t(s);else process.nextTick(Jx,n)}),this}function JK(e,t){R2(e,t),Jx(e)}function Jx(e){if(e._writableState&&!e._writableState.emitClose)return;if(e._readableState&&!e._readableState.emitClose)return;e.emit("close")}function M7e(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function R2(e,t){e.emit("error",t)}function j7e(e,t){var{_readableState:n,_writableState:r}=e;if(n&&n.autoDestroy||r&&r.autoDestroy)e.destroy(t);else e.emit("error",t)}YK.exports={destroy:F7e,undestroy:M7e,errorOrDestroy:j7e}});var bu=w(function(U7e,ZK){var QK={};function Gs(e,t,n){if(!n)n=Error;function r(s,i,a){if(typeof t==="string")return t;else return t(s,i,a)}class o extends n{constructor(s,i,a){super(r(s,i,a))}}o.prototype.name=n.name,o.prototype.code=e,QK[e]=o}function XK(e,t){if(Array.isArray(e)){let n=e.length;if(e=e.map((r)=>String(r)),n>2)return`one of ${t} ${e.slice(0,n-1).join(", ")}, or `+e[n-1];else if(n===2)return`one of ${t} ${e[0]} or ${e[1]}`;else return`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}function L7e(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function q7e(e,t,n){if(n===void 0||n>e.length)n=e.length;return e.substring(n-t.length,n)===t}function B7e(e,t,n){if(typeof n!=="number")n=0;if(n+t.length>e.length)return!1;else return e.indexOf(t,n)!==-1}Gs("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Gs("ERR_INVALID_ARG_TYPE",function(e,t,n){let r;if(typeof t==="string"&&L7e(t,"not "))r="must not be",t=t.replace(/^not /,"");else r="must be";let o;if(q7e(e," argument"))o=`The ${e} ${r} ${XK(t,"type")}`;else{let s=B7e(e,".")?"property":"argument";o=`The "${e}" ${s} ${r} ${XK(t,"type")}`}return o+=`. Received type ${typeof n}`,o},TypeError);Gs("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Gs("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Gs("ERR_STREAM_PREMATURE_CLOSE","Premature close");Gs("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Gs("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Gs("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Gs("ERR_STREAM_WRITE_AFTER_END","write after end");Gs("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Gs("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Gs("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");U7e.codes=QK});var A2=w(function(cqt,eJ){var V7e=bu().codes.ERR_INVALID_OPT_VALUE;function z7e(e,t,n){return e.highWaterMark!=null?e.highWaterMark:t?e[n]:null}function G7e(e,t,n,r){var o=z7e(t,r,n);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var s=r?n:"highWaterMark";throw new V7e(s,o)}return Math.floor(o)}return e.objectMode?16:16384}eJ.exports={getHighWaterMark:G7e}});var tJ=w(function(lqt,O2){if(typeof Object.create==="function")O2.exports=function(t,n){if(n)t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})};else O2.exports=function(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}});var pf=w(function(uqt,T2){try{if(Yx=Nt("util"),typeof Yx.inherits!=="function")throw"";T2.exports=Yx.inherits}catch(e){T2.exports=tJ()}var Yx});var rJ=w(function(dqt,nJ){nJ.exports=Nt("util").deprecate});var N2=w(function(fqt,lJ){lJ.exports=Mn;function sJ(e){var t=this;this.next=null,this.entry=null,this.finish=function(){wHe(t,e)}}var Lm;Mn.WritableState=p0;var W7e={deprecate:rJ()},iJ=Nt("stream"),Qx=Nt("buffer").Buffer,K7e=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J7e(e){return Qx.from(e)}function Y7e(e){return Qx.isBuffer(e)||e instanceof K7e}var I2=C2(),X7e=A2(),Q7e=X7e.getHighWaterMark,wu=bu().codes,{ERR_INVALID_ARG_TYPE:Z7e,ERR_METHOD_NOT_IMPLEMENTED:eHe,ERR_MULTIPLE_CALLBACK:tHe,ERR_STREAM_CANNOT_PIPE:nHe,ERR_STREAM_DESTROYED:rHe,ERR_STREAM_NULL_VALUES:oHe,ERR_STREAM_WRITE_AFTER_END:sHe,ERR_UNKNOWN_ENCODING:iHe}=wu,qm=I2.errorOrDestroy;pf()(Mn,iJ);function aHe(){}function p0(e,t,n){if(Lm=Lm||mf(),e=e||{},typeof n!=="boolean")n=t instanceof Lm;if(this.objectMode=!!e.objectMode,n)this.objectMode=this.objectMode||!!e.writableObjectMode;this.highWaterMark=Q7e(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var r=e.decodeStrings===!1;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(o){mHe(t,o)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new sJ(this)}p0.prototype.getBuffer=function(){var t=this.bufferedRequest,n=[];while(t)n.push(t),t=t.next;return n};(function(){try{Object.defineProperty(p0.prototype,"buffer",{get:W7e.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}})();var Xx;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")Xx=Function.prototype[Symbol.hasInstance],Object.defineProperty(Mn,Symbol.hasInstance,{value:function(t){if(Xx.call(this,t))return!0;if(this!==Mn)return!1;return t&&t._writableState instanceof p0}});else Xx=function(t){return t instanceof this};function Mn(e){Lm=Lm||mf();var t=this instanceof Lm;if(!t&&!Xx.call(Mn,this))return new Mn(e);if(this._writableState=new p0(e,this,t),this.writable=!0,e){if(typeof e.write==="function")this._write=e.write;if(typeof e.writev==="function")this._writev=e.writev;if(typeof e.destroy==="function")this._destroy=e.destroy;if(typeof e.final==="function")this._final=e.final}iJ.call(this)}Mn.prototype.pipe=function(){qm(this,new nHe)};function cHe(e,t){var n=new sHe;qm(e,n),process.nextTick(t,n)}function lHe(e,t,n,r){var o;if(n===null)o=new oHe;else if(typeof n!=="string"&&!t.objectMode)o=new Z7e("chunk",["string","Buffer"],n);if(o)return qm(e,o),process.nextTick(r,o),!1;return!0}Mn.prototype.write=function(e,t,n){var r=this._writableState,o=!1,s=!r.objectMode&&Y7e(e);if(s&&!Qx.isBuffer(e))e=J7e(e);if(typeof t==="function")n=t,t=null;if(s)t="buffer";else if(!t)t=r.defaultEncoding;if(typeof n!=="function")n=aHe;if(r.ending)cHe(this,n);else if(s||lHe(this,r,e,n))r.pendingcb++,o=dHe(this,r,s,e,t,n);return o};Mn.prototype.cork=function(){this._writableState.corked++};Mn.prototype.uncork=function(){var e=this._writableState;if(e.corked){if(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest)aJ(this,e)}};Mn.prototype.setDefaultEncoding=function(t){if(typeof t==="string")t=t.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new iHe(t);return this._writableState.defaultEncoding=t,this};Object.defineProperty(Mn.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function uHe(e,t,n){if(!e.objectMode&&e.decodeStrings!==!1&&typeof t==="string")t=Qx.from(t,n);return t}Object.defineProperty(Mn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function dHe(e,t,n,r,o,s){if(!n){var i=uHe(t,r,o);if(r!==i)n=!0,o="buffer",r=i}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length<t.highWaterMark;if(!c)t.needDrain=!0;if(t.writing||t.corked){var l=t.lastBufferedRequest;if(t.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:s,next:null},l)l.next=t.lastBufferedRequest;else t.bufferedRequest=t.lastBufferedRequest;t.bufferedRequestCount+=1}else P2(e,t,!1,a,r,o,s);return c}function P2(e,t,n,r,o,s,i){if(t.writelen=r,t.writecb=i,t.writing=!0,t.sync=!0,t.destroyed)t.onwrite(new rHe("write"));else if(n)e._writev(o,t.onwrite);else e._write(o,s,t.onwrite);t.sync=!1}function fHe(e,t,n,r,o){if(--t.pendingcb,n)process.nextTick(o,r),process.nextTick(f0,e,t),e._writableState.errorEmitted=!0,qm(e,r);else o(r),e._writableState.errorEmitted=!0,qm(e,r),f0(e,t)}function pHe(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function mHe(e,t){var n=e._writableState,{sync:r,writecb:o}=n;if(typeof o!=="function")throw new tHe;if(pHe(n),t)fHe(e,n,r,t,o);else{var s=cJ(n)||e.destroyed;if(!s&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest)aJ(e,n);if(r)process.nextTick(oJ,e,n,s,o);else oJ(e,n,s,o)}}function oJ(e,t,n,r){if(!n)hHe(e,t);t.pendingcb--,r(),f0(e,t)}function hHe(e,t){if(t.length===0&&t.needDrain)t.needDrain=!1,e.emit("drain")}function aJ(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=Array(r),s=t.corkedRequestsFree;s.entry=n;var i=0,a=!0;while(n){if(o[i]=n,!n.isBuf)a=!1;n=n.next,i+=1}if(o.allBuffers=a,P2(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next)t.corkedRequestsFree=s.next,s.next=null;else t.corkedRequestsFree=new sJ(t);t.bufferedRequestCount=0}else{while(n){var c=n.chunk,l=n.encoding,d=n.callback,f=t.objectMode?1:c.length;if(P2(e,t,!1,f,c,l,d),n=n.next,t.bufferedRequestCount--,t.writing)break}if(n===null)t.lastBufferedRequest=null}t.bufferedRequest=n,t.bufferProcessing=!1}Mn.prototype._write=function(e,t,n){n(new eHe("_write()"))};Mn.prototype._writev=null;Mn.prototype.end=function(e,t,n){var r=this._writableState;if(typeof e==="function")n=e,e=null,t=null;else if(typeof t==="function")n=t,t=null;if(e!==null&&e!==void 0)this.write(e,t);if(r.corked)r.corked=1,this.uncork();if(!r.ending)bHe(this,r,n);return this};Object.defineProperty(Mn.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function cJ(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function gHe(e,t){e._final(function(n){if(t.pendingcb--,n)qm(e,n);t.prefinished=!0,e.emit("prefinish"),f0(e,t)})}function yHe(e,t){if(!t.prefinished&&!t.finalCalled)if(typeof e._final==="function"&&!t.destroyed)t.pendingcb++,t.finalCalled=!0,process.nextTick(gHe,e,t);else t.prefinished=!0,e.emit("prefinish")}function f0(e,t){var n=cJ(t);if(n){if(yHe(e,t),t.pendingcb===0){if(t.finished=!0,e.emit("finish"),t.autoDestroy){var r=e._readableState;if(!r||r.autoDestroy&&r.endEmitted)e.destroy()}}}return n}function bHe(e,t,n){if(t.ending=!0,f0(e,t),n)if(t.finished)process.nextTick(n);else e.once("finish",n);t.ended=!0,e.writable=!1}function wHe(e,t,n){var r=e.entry;e.entry=null;while(r){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree.next=e}Object.defineProperty(Mn.prototype,"destroyed",{enumerable:!1,get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function(t){if(!this._writableState)return;this._writableState.destroyed=t}});Mn.prototype.destroy=I2.destroy;Mn.prototype._undestroy=I2.undestroy;Mn.prototype._destroy=function(e,t){t(e)}});var mf=w(function(pqt,dJ){var _He=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};dJ.exports=ha;var uJ=M2(),F2=N2();pf()(ha,uJ);{Zx=_He(F2.prototype);for(m0=0;m0<Zx.length;m0++)if(h0=Zx[m0],!ha.prototype[h0])ha.prototype[h0]=F2.prototype[h0]}var Zx,h0,m0;function ha(e){if(!(this instanceof ha))return new ha(e);if(uJ.call(this,e),F2.call(this,e),this.allowHalfOpen=!0,e){if(e.readable===!1)this.readable=!1;if(e.writable===!1)this.writable=!1;if(e.allowHalfOpen===!1)this.allowHalfOpen=!1,this.once("end",xHe)}}Object.defineProperty(ha.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(ha.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(ha.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function xHe(){if(this._writableState.ended)return;process.nextTick(vHe,this)}function vHe(e){e.end()}Object.defineProperty(ha.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function(t){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=t,this._writableState.destroyed=t}})});var mJ=w(function(j2,pJ){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ev=Nt("buffer"),ga=ev.Buffer;function fJ(e,t){for(var n in e)t[n]=e[n]}if(ga.from&&ga.alloc&&ga.allocUnsafe&&ga.allocUnsafeSlow)pJ.exports=ev;else fJ(ev,j2),j2.Buffer=hf;function hf(e,t,n){return ga(e,t,n)}hf.prototype=Object.create(ga.prototype);fJ(ga,hf);hf.from=function(e,t,n){if(typeof e==="number")throw TypeError("Argument must not be a number");return ga(e,t,n)};hf.alloc=function(e,t,n){if(typeof e!=="number")throw TypeError("Argument must be a number");var r=ga(e);if(t!==void 0)if(typeof n==="string")r.fill(t,n);else r.fill(t);else r.fill(0);return r};hf.allocUnsafe=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return ga(e)};hf.allocUnsafeSlow=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return ev.SlowBuffer(e)}});var B2=w(function(FHe){var q2=mJ().Buffer,hJ=q2.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function kHe(e){if(!e)return"utf8";var t;while(!0)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function EHe(e){var t=kHe(e);if(typeof t!=="string"&&(q2.isEncoding===hJ||!hJ(e)))throw Error("Unknown encoding: "+e);return t||e}FHe.StringDecoder=g0;function g0(e){this.encoding=EHe(e);var t;switch(this.encoding){case"utf16le":this.text=AHe,this.end=OHe,t=4;break;case"utf8":this.fillLast=DHe,t=4;break;case"base64":this.text=THe,this.end=PHe,t=3;break;default:this.write=IHe,this.end=NHe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q2.allocUnsafe(t)}g0.prototype.write=function(e){if(e.length===0)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";n=this.lastNeed,this.lastNeed=0}else n=0;if(n<e.length)return t?t+this.text(e,n):this.text(e,n);return t||""};g0.prototype.end=CHe;g0.prototype.text=RHe;g0.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function L2(e){if(e<=127)return 0;else if(e>>5===6)return 2;else if(e>>4===14)return 3;else if(e>>3===30)return 4;return e>>6===2?-1:-2}function SHe(e,t,n){var r=t.length-1;if(r<n)return 0;var o=L2(t[r]);if(o>=0){if(o>0)e.lastNeed=o-1;return o}if(--r<n||o===-2)return 0;if(o=L2(t[r]),o>=0){if(o>0)e.lastNeed=o-2;return o}if(--r<n||o===-2)return 0;if(o=L2(t[r]),o>=0){if(o>0)if(o===2)o=0;else e.lastNeed=o-3;return o}return 0}function $He(e,t,n){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2){if((t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}}function DHe(e){var t=this.lastTotal-this.lastNeed,n=$He(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function RHe(e,t){var n=SHe(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function CHe(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+"\uFFFD";return t}function AHe(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function OHe(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function THe(e,t){var n=(e.length-t)%3;if(n===0)return e.toString("base64",t);if(this.lastNeed=3-n,this.lastTotal=3,n===1)this.lastChar[0]=e[e.length-1];else this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1];return e.toString("base64",t,e.length-n)}function PHe(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+this.lastChar.toString("base64",0,3-this.lastNeed);return t}function IHe(e){return e.toString(this.encoding)}function NHe(e){return e&&e.length?this.write(e):""}});var tv=w(function(hqt,bJ){var gJ=bu().codes.ERR_STREAM_PREMATURE_CLOSE;function jHe(e){var t=!1;return function(){if(t)return;t=!0;for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];e.apply(this,r)}}function LHe(){}function qHe(e){return e.setHeader&&typeof e.abort==="function"}function yJ(e,t,n){if(typeof t==="function")return yJ(e,null,t);if(!t)t={};n=jHe(n||LHe);var r=t.readable||t.readable!==!1&&e.readable,o=t.writable||t.writable!==!1&&e.writable,s=function(){if(!e.writable)a()},i=e._writableState&&e._writableState.finished,a=function(){if(o=!1,i=!0,!r)n.call(e)},c=e._readableState&&e._readableState.endEmitted,l=function(){if(r=!1,c=!0,!o)n.call(e)},d=function(h){n.call(e,h)},f=function(){var h;if(r&&!c){if(!e._readableState||!e._readableState.ended)h=new gJ;return n.call(e,h)}if(o&&!i){if(!e._writableState||!e._writableState.ended)h=new gJ;return n.call(e,h)}},p=function(){e.req.on("finish",a)};if(qHe(e))if(e.on("complete",a),e.on("abort",f),e.req)p();else e.on("request",p);else if(o&&!e._writableState)e.on("end",s),e.on("close",s);if(e.on("end",l),e.on("finish",a),t.error!==!1)e.on("error",d);return e.on("close",f),function(){if(e.removeListener("complete",a),e.removeListener("abort",f),e.removeListener("request",p),e.req)e.req.removeListener("finish",a);e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",a),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",f)}}bJ.exports=yJ});var _J=w(function(gqt,wJ){var nv;function _u(e,t,n){if(t=BHe(t),t in e)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});else e[t]=n;return e}function BHe(e){var t=UHe(e,"string");return typeof t==="symbol"?t:String(t)}function UHe(e,t){if(typeof e!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!=="object")return r;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var HHe=tv(),xu=Symbol("lastResolve"),gf=Symbol("lastReject"),y0=Symbol("error"),rv=Symbol("ended"),yf=Symbol("lastPromise"),U2=Symbol("handlePromise"),bf=Symbol("stream");function vu(e,t){return{value:e,done:t}}function VHe(e){var t=e[xu];if(t!==null){var n=e[bf].read();if(n!==null)e[yf]=null,e[xu]=null,e[gf]=null,t(vu(n,!1))}}function zHe(e){process.nextTick(VHe,e)}function GHe(e,t){return function(n,r){e.then(function(){if(t[rv]){n(vu(void 0,!0));return}t[U2](n,r)},r)}}var WHe=Object.getPrototypeOf(function(){}),KHe=Object.setPrototypeOf((nv={get stream(){return this[bf]},next:function(){var t=this,n=this[y0];if(n!==null)return Promise.reject(n);if(this[rv])return Promise.resolve(vu(void 0,!0));if(this[bf].destroyed)return new Promise(function(i,a){process.nextTick(function(){if(t[y0])a(t[y0]);else i(vu(void 0,!0))})});var r=this[yf],o;if(r)o=new Promise(GHe(r,this));else{var s=this[bf].read();if(s!==null)return Promise.resolve(vu(s,!1));o=new Promise(this[U2])}return this[yf]=o,o}},_u(nv,Symbol.asyncIterator,function(){return this}),_u(nv,"return",function(){var t=this;return new Promise(function(n,r){t[bf].destroy(null,function(o){if(o){r(o);return}n(vu(void 0,!0))})})}),nv),WHe),JHe=function(t){var n,r=Object.create(KHe,(n={},_u(n,bf,{value:t,writable:!0}),_u(n,xu,{value:null,writable:!0}),_u(n,gf,{value:null,writable:!0}),_u(n,y0,{value:null,writable:!0}),_u(n,rv,{value:t._readableState.endEmitted,writable:!0}),_u(n,U2,{value:function(s,i){var a=r[bf].read();if(a)r[yf]=null,r[xu]=null,r[gf]=null,s(vu(a,!1));else r[xu]=s,r[gf]=i},writable:!0}),n));return r[yf]=null,HHe(t,function(o){if(o&&o.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=r[gf];if(s!==null)r[yf]=null,r[xu]=null,r[gf]=null,s(o);r[y0]=o;return}var i=r[xu];if(i!==null)r[yf]=null,r[xu]=null,r[gf]=null,i(vu(void 0,!0));r[rv]=!0}),t.on("readable",zHe.bind(null,r)),r};wJ.exports=JHe});var EJ=w(function(yqt,kJ){function xJ(e,t,n,r,o,s,i){try{var a=e[s](i),c=a.value}catch(l){n(l);return}if(a.done)t(c);else Promise.resolve(c).then(r,o)}function YHe(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var s=e.apply(t,n);function i(c){xJ(s,r,o,i,a,"next",c)}function a(c){xJ(s,r,o,i,a,"throw",c)}i(void 0)})}}function vJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function XHe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vJ(Object(n),!0).forEach(function(r){QHe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vJ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function QHe(e,t,n){if(t=ZHe(t),t in e)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});else e[t]=n;return e}function ZHe(e){var t=eVe(e,"string");return typeof t==="symbol"?t:String(t)}function eVe(e,t){if(typeof e!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!=="object")return r;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var tVe=bu().codes.ERR_INVALID_ARG_TYPE;function nVe(e,t,n){var r;if(t&&typeof t.next==="function")r=t;else if(t&&t[Symbol.asyncIterator])r=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])r=t[Symbol.iterator]();else throw new tVe("iterable",["Iterable"],t);var o=new e(XHe({objectMode:!0},n)),s=!1;o._read=function(){if(!s)s=!0,i()};function i(){return a.apply(this,arguments)}function a(){return a=YHe(function*(){try{var c=yield r.next(),{value:l,done:d}=c;if(d)o.push(null);else if(o.push(yield l))i();else s=!1}catch(f){o.destroy(f)}}),a.apply(this,arguments)}return o}kJ.exports=nVe});var M2=w(function(wqt,IJ){IJ.exports=Ot;var Bm;Ot.ReadableState=RJ;var bqt=Nt("events").EventEmitter,DJ=function(t,n){return t.listeners(n).length},w0=Nt("stream"),ov=Nt("buffer").Buffer,rVe=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oVe(e){return ov.from(e)}function sVe(e){return ov.isBuffer(e)||e instanceof rVe}var H2=Nt("util"),wt;if(H2&&H2.debuglog)wt=H2.debuglog("stream");else wt=function(){};var iVe=KK(),Y2=C2(),aVe=A2(),cVe=aVe.getHighWaterMark,sv=bu().codes,{ERR_INVALID_ARG_TYPE:lVe,ERR_STREAM_PUSH_AFTER_EOF:uVe,ERR_METHOD_NOT_IMPLEMENTED:dVe,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:fVe}=sv,Um,V2,z2;pf()(Ot,w0);var b0=Y2.errorOrDestroy,G2=["error","close","destroy","pause","resume"];function pVe(e,t,n){if(typeof e.prependListener==="function")return e.prependListener(t,n);if(!e._events||!e._events[t])e.on(t,n);else if(Array.isArray(e._events[t]))e._events[t].unshift(n);else e._events[t]=[n,e._events[t]]}function RJ(e,t,n){if(Bm=Bm||mf(),e=e||{},typeof n!=="boolean")n=t instanceof Bm;if(this.objectMode=!!e.objectMode,n)this.objectMode=this.objectMode||!!e.readableObjectMode;if(this.highWaterMark=cVe(this,e,"readableHighWaterMark",n),this.buffer=new iVe,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding){if(!Um)Um=B2().StringDecoder;this.decoder=new Um(e.encoding),this.encoding=e.encoding}}function Ot(e){if(Bm=Bm||mf(),!(this instanceof Ot))return new Ot(e);var t=this instanceof Bm;if(this._readableState=new RJ(e,this,t),this.readable=!0,e){if(typeof e.read==="function")this._read=e.read;if(typeof e.destroy==="function")this._destroy=e.destroy}w0.call(this)}Object.defineProperty(Ot.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(t){if(!this._readableState)return;this._readableState.destroyed=t}});Ot.prototype.destroy=Y2.destroy;Ot.prototype._undestroy=Y2.undestroy;Ot.prototype._destroy=function(e,t){t(e)};Ot.prototype.push=function(e,t){var n=this._readableState,r;if(!n.objectMode){if(typeof e==="string"){if(t=t||n.defaultEncoding,t!==n.encoding)e=ov.from(e,t),t="";r=!0}}else r=!0;return CJ(this,e,t,!1,r)};Ot.prototype.unshift=function(e){return CJ(this,e,null,!0,!1)};function CJ(e,t,n,r,o){wt("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,gVe(e,s);else{var i;if(!o)i=mVe(s,t);if(i)b0(e,i);else if(s.objectMode||t&&t.length>0){if(typeof t!=="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==ov.prototype)t=oVe(t);if(r)if(s.endEmitted)b0(e,new fVe);else W2(e,s,t,!0);else if(s.ended)b0(e,new uVe);else if(s.destroyed)return!1;else if(s.reading=!1,s.decoder&&!n)if(t=s.decoder.write(t),s.objectMode||t.length!==0)W2(e,s,t,!1);else J2(e,s);else W2(e,s,t,!1)}else if(!r)s.reading=!1,J2(e,s)}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}function W2(e,t,n,r){if(t.flowing&&t.length===0&&!t.sync)t.awaitDrain=0,e.emit("data",n);else{if(t.length+=t.objectMode?1:n.length,r)t.buffer.unshift(n);else t.buffer.push(n);if(t.needReadable)iv(e)}J2(e,t)}function mVe(e,t){var n;if(!sVe(t)&&typeof t!=="string"&&t!==void 0&&!e.objectMode)n=new lVe("chunk",["string","Buffer","Uint8Array"],t);return n}Ot.prototype.isPaused=function(){return this._readableState.flowing===!1};Ot.prototype.setEncoding=function(e){if(!Um)Um=B2().StringDecoder;var t=new Um(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;var n=this._readableState.buffer.head,r="";while(n!==null)r+=t.write(n.data),n=n.next;if(this._readableState.buffer.clear(),r!=="")this._readableState.buffer.push(r);return this._readableState.length=r.length,this};var SJ=1073741824;function hVe(e){if(e>=SJ)e=SJ;else e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++;return e}function $J(e,t){if(e<=0||t.length===0&&t.ended)return 0;if(t.objectMode)return 1;if(e!==e)if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length;if(e>t.highWaterMark)t.highWaterMark=hVe(e);if(e<=t.length)return e;if(!t.ended)return t.needReadable=!0,0;return t.length}Ot.prototype.read=function(e){wt("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0)t.emittedReadable=!1;if(e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended)){if(wt("read: emitReadable",t.length,t.ended),t.length===0&&t.ended)K2(this);else iv(this);return null}if(e=$J(e,t),e===0&&t.ended){if(t.length===0)K2(this);return null}var r=t.needReadable;if(wt("need readable",r),t.length===0||t.length-e<t.highWaterMark)r=!0,wt("length less than watermark",r);if(t.ended||t.reading)r=!1,wt("reading or ended",r);else if(r){if(wt("do read"),t.reading=!0,t.sync=!0,t.length===0)t.needReadable=!0;if(this._read(t.highWaterMark),t.sync=!1,!t.reading)e=$J(n,t)}var o;if(e>0)o=TJ(e,t);else o=null;if(o===null)t.needReadable=t.length<=t.highWaterMark,e=0;else t.length-=e,t.awaitDrain=0;if(t.length===0){if(!t.ended)t.needReadable=!0;if(n!==e&&t.ended)K2(this)}if(o!==null)this.emit("data",o);return o};function gVe(e,t){if(wt("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();if(n&&n.length)t.buffer.push(n),t.length+=t.objectMode?1:n.length}if(t.ended=!0,t.sync)iv(e);else if(t.needReadable=!1,!t.emittedReadable)t.emittedReadable=!0,AJ(e)}function iv(e){var t=e._readableState;if(wt("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,!t.emittedReadable)wt("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(AJ,e)}function AJ(e){var t=e._readableState;if(wt("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended))e.emit("readable"),t.emittedReadable=!1;t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,X2(e)}function J2(e,t){if(!t.readingMore)t.readingMore=!0,process.nextTick(yVe,e,t)}function yVe(e,t){while(!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0)){var n=t.length;if(wt("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}Ot.prototype._read=function(e){b0(this,new dVe("_read()"))};Ot.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e);break}r.pipesCount+=1,wt("pipe count=%d opts=%j",r.pipesCount,t);var o=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=o?a:g;if(r.endEmitted)process.nextTick(s);else n.once("end",s);e.on("unpipe",i);function i(y,b){if(wt("onunpipe"),y===n){if(b&&b.hasUnpiped===!1)b.hasUnpiped=!0,d()}}function a(){wt("onend"),e.end()}var c=bVe(n);e.on("drain",c);var l=!1;function d(){if(wt("cleanup"),e.removeListener("close",m),e.removeListener("finish",h),e.removeListener("drain",c),e.removeListener("error",p),e.removeListener("unpipe",i),n.removeListener("end",a),n.removeListener("end",g),n.removeListener("data",f),l=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain))c()}n.on("data",f);function f(y){wt("ondata");var b=e.write(y);if(wt("dest.write",b),b===!1){if((r.pipesCount===1&&r.pipes===e||r.pipesCount>1&&PJ(r.pipes,e)!==-1)&&!l)wt("false write response, pause",r.awaitDrain),r.awaitDrain++;n.pause()}}function p(y){if(wt("onerror",y),g(),e.removeListener("error",p),DJ(e,"error")===0)b0(e,y)}pVe(e,"error",p);function m(){e.removeListener("finish",h),g()}e.once("close",m);function h(){wt("onfinish"),e.removeListener("close",m),g()}e.once("finish",h);function g(){wt("unpipe"),n.unpipe(e)}if(e.emit("pipe",n),!r.flowing)wt("pipe resume"),n.resume();return e};function bVe(e){return function(){var n=e._readableState;if(wt("pipeOnDrain",n.awaitDrain),n.awaitDrain)n.awaitDrain--;if(n.awaitDrain===0&&DJ(e,"data"))n.flowing=!0,X2(e)}}Ot.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1){if(e&&e!==t.pipes)return this;if(!e)e=t.pipes;if(t.pipes=null,t.pipesCount=0,t.flowing=!1,e)e.emit("unpipe",this,n);return this}if(!e){var{pipes:r,pipesCount:o}=t;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<o;s++)r[s].emit("unpipe",this,{hasUnpiped:!1});return this}var i=PJ(t.pipes,e);if(i===-1)return this;if(t.pipes.splice(i,1),t.pipesCount-=1,t.pipesCount===1)t.pipes=t.pipes[0];return e.emit("unpipe",this,n),this};Ot.prototype.on=function(e,t){var n=w0.prototype.on.call(this,e,t),r=this._readableState;if(e==="data"){if(r.readableListening=this.listenerCount("readable")>0,r.flowing!==!1)this.resume()}else if(e==="readable"){if(!r.endEmitted&&!r.readableListening){if(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,wt("on readable",r.length,r.reading),r.length)iv(this);else if(!r.reading)process.nextTick(wVe,this)}}return n};Ot.prototype.addListener=Ot.prototype.on;Ot.prototype.removeListener=function(e,t){var n=w0.prototype.removeListener.call(this,e,t);if(e==="readable")process.nextTick(OJ,this);return n};Ot.prototype.removeAllListeners=function(e){var t=w0.prototype.removeAllListeners.apply(this,arguments);if(e==="readable"||e===void 0)process.nextTick(OJ,this);return t};function OJ(e){var t=e._readableState;if(t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused)t.flowing=!0;else if(e.listenerCount("data")>0)e.resume()}function wVe(e){wt("readable nexttick read 0"),e.read(0)}Ot.prototype.resume=function(){var e=this._readableState;if(!e.flowing)wt("resume"),e.flowing=!e.readableListening,_Ve(this,e);return e.paused=!1,this};function _Ve(e,t){if(!t.resumeScheduled)t.resumeScheduled=!0,process.nextTick(xVe,e,t)}function xVe(e,t){if(wt("resume",t.reading),!t.reading)e.read(0);if(t.resumeScheduled=!1,e.emit("resume"),X2(e),t.flowing&&!t.reading)e.read(0)}Ot.prototype.pause=function(){if(wt("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)wt("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function X2(e){var t=e._readableState;wt("flow",t.flowing);while(t.flowing&&e.read()!==null);}Ot.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;e.on("end",function(){if(wt("wrapped end"),n.decoder&&!n.ended){var i=n.decoder.end();if(i&&i.length)t.push(i)}t.push(null)}),e.on("data",function(i){if(wt("wrapped data"),n.decoder)i=n.decoder.write(i);if(n.objectMode&&(i===null||i===void 0))return;else if(!n.objectMode&&(!i||!i.length))return;var a=t.push(i);if(!a)r=!0,e.pause()});for(var o in e)if(this[o]===void 0&&typeof e[o]==="function")this[o]=function(a){return function(){return e[a].apply(e,arguments)}}(o);for(var s=0;s<G2.length;s++)e.on(G2[s],this.emit.bind(this,G2[s]));return this._read=function(i){if(wt("wrapped _read",i),r)r=!1,e.resume()},this};if(typeof Symbol==="function")Ot.prototype[Symbol.asyncIterator]=function(){if(V2===void 0)V2=_J();return V2(this)};Object.defineProperty(Ot.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Ot.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Ot.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){if(this._readableState)this._readableState.flowing=t}});Ot._fromList=TJ;Object.defineProperty(Ot.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function TJ(e,t){if(t.length===0)return null;var n;if(t.objectMode)n=t.buffer.shift();else if(!e||e>=t.length){if(t.decoder)n=t.buffer.join("");else if(t.buffer.length===1)n=t.buffer.first();else n=t.buffer.concat(t.length);t.buffer.clear()}else n=t.buffer.consume(e,t.decoder);return n}function K2(e){var t=e._readableState;if(wt("endReadable",t.endEmitted),!t.endEmitted)t.ended=!0,process.nextTick(vVe,t,e)}function vVe(e,t){if(wt("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy){var n=t._writableState;if(!n||n.autoDestroy&&n.finished)t.destroy()}}}if(typeof Symbol==="function")Ot.from=function(e,t){if(z2===void 0)z2=EJ();return z2(Ot,e,t)};function PJ(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}});var Q2=w(function(_qt,FJ){FJ.exports=Vc;var av=bu().codes,{ERR_METHOD_NOT_IMPLEMENTED:kVe,ERR_MULTIPLE_CALLBACK:EVe,ERR_TRANSFORM_ALREADY_TRANSFORMING:SVe,ERR_TRANSFORM_WITH_LENGTH_0:$Ve}=av,cv=mf();pf()(Vc,cv);function DVe(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new EVe);if(n.writechunk=null,n.writecb=null,t!=null)this.push(t);r(e);var o=this._readableState;if(o.reading=!1,o.needReadable||o.length<o.highWaterMark)this._read(o.highWaterMark)}function Vc(e){if(!(this instanceof Vc))return new Vc(e);if(cv.call(this,e),this._transformState={afterTransform:DVe.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e){if(typeof e.transform==="function")this._transform=e.transform;if(typeof e.flush==="function")this._flush=e.flush}this.on("prefinish",RVe)}function RVe(){var e=this;if(typeof this._flush==="function"&&!this._readableState.destroyed)this._flush(function(t,n){NJ(e,t,n)});else NJ(this,null,null)}Vc.prototype.push=function(e,t){return this._transformState.needTransform=!1,cv.prototype.push.call(this,e,t)};Vc.prototype._transform=function(e,t,n){n(new kVe("_transform()"))};Vc.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;if(r.needTransform||o.needReadable||o.length<o.highWaterMark)this._read(o.highWaterMark)}};Vc.prototype._read=function(e){var t=this._transformState;if(t.writechunk!==null&&!t.transforming)t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform);else t.needTransform=!0};Vc.prototype._destroy=function(e,t){cv.prototype._destroy.call(this,e,function(n){t(n)})};function NJ(e,t,n){if(t)return e.emit("error",t);if(n!=null)e.push(n);if(e._writableState.length)throw new $Ve;if(e._transformState.transforming)throw new SVe;return e.push(null)}});var LJ=w(function(xqt,jJ){jJ.exports=_0;var MJ=Q2();pf()(_0,MJ);function _0(e){if(!(this instanceof _0))return new _0(e);MJ.call(this,e)}_0.prototype._transform=function(e,t,n){n(null,e)}});var VJ=w(function(vqt,HJ){var Z2;function CVe(e){var t=!1;return function(){if(t)return;t=!0,e.apply(void 0,arguments)}}var UJ=bu().codes,{ERR_MISSING_ARGS:AVe,ERR_STREAM_DESTROYED:OVe}=UJ;function qJ(e){if(e)throw e}function TVe(e){return e.setHeader&&typeof e.abort==="function"}function PVe(e,t,n,r){r=CVe(r);var o=!1;if(e.on("close",function(){o=!0}),Z2===void 0)Z2=tv();Z2(e,{readable:t,writable:n},function(i){if(i)return r(i);o=!0,r()});var s=!1;return function(i){if(o)return;if(s)return;if(s=!0,TVe(e))return e.abort();if(typeof e.destroy==="function")return e.destroy();r(i||new OVe("pipe"))}}function BJ(e){e()}function IVe(e,t){return e.pipe(t)}function NVe(e){if(!e.length)return qJ;if(typeof e[e.length-1]!=="function")return qJ;return e.pop()}function FVe(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=NVe(t);if(Array.isArray(t[0]))t=t[0];if(t.length<2)throw new AVe("streams");var o,s=t.map(function(i,a){var c=a<t.length-1,l=a>0;return PVe(i,c,l,function(d){if(!o)o=d;if(d)s.forEach(BJ);if(c)return;s.forEach(BJ),r(o)})});return t.reduce(IVe)}HJ.exports=FVe});var zJ=w(function(Ws,v0){var x0=Nt("stream");if(process.env.READABLE_STREAM==="disable"&&x0)v0.exports=x0.Readable,Object.assign(v0.exports,x0),v0.exports.Stream=x0;else Ws=v0.exports=M2(),Ws.Stream=x0||Ws,Ws.Readable=Ws,Ws.Writable=N2(),Ws.Duplex=mf(),Ws.Transform=Q2(),Ws.PassThrough=LJ(),Ws.finished=tv(),Ws.pipeline=VJ()});var KJ=w(function(kqt,WJ){var{Buffer:Oi}=Nt("buffer"),GJ=Symbol.for("BufferList");function dn(e){if(!(this instanceof dn))return new dn(e);dn._init.call(this,e)}dn._init=function(t){if(Object.defineProperty(this,GJ,{value:!0}),this._bufs=[],this.length=0,t)this.append(t)};dn.prototype._new=function(t){return new dn(t)};dn.prototype._offset=function(t){if(t===0)return[0,0];let n=0;for(let r=0;r<this._bufs.length;r++){let o=n+this._bufs[r].length;if(t<o||r===this._bufs.length-1)return[r,t-n];n=o}};dn.prototype._reverseOffset=function(e){let t=e[0],n=e[1];for(let r=0;r<t;r++)n+=this._bufs[r].length;return n};dn.prototype.get=function(t){if(t>this.length||t<0)return;let n=this._offset(t);return this._bufs[n[0]][n[1]]};dn.prototype.slice=function(t,n){if(typeof t==="number"&&t<0)t+=this.length;if(typeof n==="number"&&n<0)n+=this.length;return this.copy(null,0,t,n)};dn.prototype.copy=function(t,n,r,o){if(typeof r!=="number"||r<0)r=0;if(typeof o!=="number"||o>this.length)o=this.length;if(r>=this.length)return t||Oi.alloc(0);if(o<=0)return t||Oi.alloc(0);let s=!!t,i=this._offset(r),a=o-r,c=a,l=s&&n||0,d=i[1];if(r===0&&o===this.length){if(!s)return this._bufs.length===1?this._bufs[0]:Oi.concat(this._bufs,this.length);for(let f=0;f<this._bufs.length;f++)this._bufs[f].copy(t,l),l+=this._bufs[f].length;return t}if(c<=this._bufs[i[0]].length-d)return s?this._bufs[i[0]].copy(t,n,d,d+c):this._bufs[i[0]].slice(d,d+c);if(!s)t=Oi.allocUnsafe(a);for(let f=i[0];f<this._bufs.length;f++){let p=this._bufs[f].length-d;if(c>p)this._bufs[f].copy(t,l,d),l+=p;else{this._bufs[f].copy(t,l,d,d+c),l+=p;break}if(c-=p,d)d=0}if(t.length>l)return t.slice(0,l);return t};dn.prototype.shallowSlice=function(t,n){if(t=t||0,n=typeof n!=="number"?this.length:n,t<0)t+=this.length;if(n<0)n+=this.length;if(t===n)return this._new();let r=this._offset(t),o=this._offset(n),s=this._bufs.slice(r[0],o[0]+1);if(o[1]===0)s.pop();else s[s.length-1]=s[s.length-1].slice(0,o[1]);if(r[1]!==0)s[0]=s[0].slice(r[1]);return this._new(s)};dn.prototype.toString=function(t,n,r){return this.slice(n,r).toString(t)};dn.prototype.consume=function(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;while(this._bufs.length)if(t>=this._bufs[0].length)t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}return this};dn.prototype.duplicate=function(){let t=this._new();for(let n=0;n<this._bufs.length;n++)t.append(this._bufs[n]);return t};dn.prototype.append=function(t){if(t==null)return this;if(t.buffer)this._appendBuffer(Oi.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let n=0;n<t.length;n++)this.append(t[n]);else if(this._isBufferList(t))for(let n=0;n<t._bufs.length;n++)this.append(t._bufs[n]);else{if(typeof t==="number")t=t.toString();this._appendBuffer(Oi.from(t))}return this};dn.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length};dn.prototype.indexOf=function(e,t,n){if(n===void 0&&typeof t==="string")n=t,t=void 0;if(typeof e==="function"||Array.isArray(e))throw TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');else if(typeof e==="number")e=Oi.from([e]);else if(typeof e==="string")e=Oi.from(e,n);else if(this._isBufferList(e))e=e.slice();else if(Array.isArray(e.buffer))e=Oi.from(e.buffer,e.byteOffset,e.byteLength);else if(!Oi.isBuffer(e))e=Oi.from(e);if(t=Number(t||0),isNaN(t))t=0;if(t<0)t=this.length+t;if(t<0)t=0;if(e.length===0)return t>this.length?this.length:t;let r=this._offset(t),o=r[0],s=r[1];for(;o<this._bufs.length;o++){let i=this._bufs[o];while(s<i.length)if(i.length-s>=e.length){let c=i.indexOf(e,s);if(c!==-1)return this._reverseOffset([o,c]);s=i.length-e.length+1}else{let c=this._reverseOffset([o,s]);if(this._match(c,e))return c;s++}s=0}return-1};dn.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0};(function(){let e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let t in e)(function(n){if(e[n]===null)dn.prototype[n]=function(r,o){return this.slice(r,r+o)[n](0,o)};else dn.prototype[n]=function(r=0){return this.slice(r,r+e[n])[n](0)}})(t)})();dn.prototype._isBufferList=function(t){return t instanceof dn||dn.isBufferList(t)};dn.isBufferList=function(t){return t!=null&&t[GJ]};WJ.exports=dn});var JJ=w(function(Eqt,lv){var eO=zJ().Duplex,MVe=pf(),ku=KJ();function lo(e){if(!(this instanceof lo))return new lo(e);if(typeof e==="function"){this._callback=e;let t=function(r){if(this._callback)this._callback(r),this._callback=null}.bind(this);this.on("pipe",function(r){r.on("error",t)}),this.on("unpipe",function(r){r.removeListener("error",t)}),e=null}ku._init.call(this,e),eO.call(this)}MVe(lo,eO);Object.assign(lo.prototype,ku.prototype);lo.prototype._new=function(t){return new lo(t)};lo.prototype._write=function(t,n,r){if(this._appendBuffer(t),typeof r==="function")r()};lo.prototype._read=function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)};lo.prototype.end=function(t){if(eO.prototype.end.call(this,t),this._callback)this._callback(null,this.slice()),this._callback=null};lo.prototype._destroy=function(t,n){this._bufs.length=0,this.length=0,n(t)};lo.prototype._isBufferList=function(t){return t instanceof lo||t instanceof ku||lo.isBufferList(t)};lo.isBufferList=ku.isBufferList;lv.exports=lo;lv.exports.BufferListStream=lo;lv.exports.BufferList=ku});var QJ=w(function(Sqt,oO){var YJ=Nt("readline"),jVe=w2(),dv=SK(),Hm=Gx(),Eu=OK(),LVe=s0(),qVe=qK(),BVe=UK(),UVe=S2(),{BufferListStream:HVe}=JJ(),tO=Symbol("text"),nO=Symbol("prefixText");class XJ{constructor(){this.requests=0,this.mutedStream=new HVe,this.mutedStream.pipe(process.stdout);let e=this;this.ourEmit=function(t,n,...r){let{stdin:o}=process;if(e.requests>0||o.emit===e.ourEmit){if(t==="keypress")return;if(t==="data"&&n.includes(3))process.emit("SIGINT");Reflect.apply(e.oldEmit,this,[t,n,...r])}else Reflect.apply(process.stdin.emit,this,[t,n,...r])}}start(){if(this.requests++,this.requests===1)this.realStart()}stop(){if(this.requests<=0)throw Error("`stop` called more times than `start`");if(this.requests--,this.requests===0)this.realStop()}realStart(){if(process.platform==="win32")return;this.rl=YJ.createInterface({input:process.stdin,output:this.mutedStream}),this.rl.on("SIGINT",()=>{if(process.listenerCount("SIGINT")===0)process.emit("SIGINT");else this.rl.close(),process.kill(process.pid,"SIGINT")})}realStop(){if(process.platform==="win32")return;this.rl.close(),this.rl=void 0}}var uv;class rO{constructor(e){if(!uv)uv=new XJ;if(typeof e==="string")e={text:e};this.options={text:"",color:"cyan",stream:process.stderr,discardStdin:!0,...e},this.spinner=this.options.spinner,this.color=this.options.color,this.hideCursor=this.options.hideCursor!==!1,this.interval=this.options.interval||this.spinner.interval||100,this.stream=this.options.stream,this.id=void 0,this.isEnabled=typeof this.options.isEnabled==="boolean"?this.options.isEnabled:BVe({stream:this.stream}),this.isSilent=typeof this.options.isSilent==="boolean"?this.options.isSilent:!1,this.text=this.options.text,this.prefixText=this.options.prefixText,this.linesToClear=0,this.indent=this.options.indent,this.discardStdin=this.options.discardStdin,this.isDiscardingStdin=!1}get indent(){return this._indent}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw Error("The `indent` option must be an integer from 0 and up");this._indent=e}_updateInterval(e){if(e!==void 0)this.interval=e}get spinner(){return this._spinner}set spinner(e){if(this.frameIndex=0,typeof e==="object"){if(e.frames===void 0)throw Error("The given spinner must have a `frames` property");this._spinner=e}else if(!UVe())this._spinner=Hm.line;else if(e===void 0)this._spinner=Hm.dots;else if(e!=="default"&&Hm[e])this._spinner=Hm[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.`);this._updateInterval(this._spinner.interval)}get text(){return this[tO]}set text(e){this[tO]=e,this.updateLineCount()}get prefixText(){return this[nO]}set prefixText(e){this[nO]=e,this.updateLineCount()}get isSpinning(){return this.id!==void 0}getFullPrefixText(e=this[nO],t=" "){if(typeof e==="string")return e+t;if(typeof e==="function")return e()+t;return""}updateLineCount(){let e=this.stream.columns||80,t=this.getFullPrefixText(this.prefixText,"-");this.lineCount=0;for(let n of LVe(t+"--"+this[tO]).split(`
|
|
43
|
+
`,o)}while(r!==-1);return s+=e.substr(o),s};tK.exports={stringReplaceAll:n7e,stringEncaseCRLFWithFirstIndex:r7e}});var aK=w(function(Hqt,iK){var o7e=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,rK=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,s7e=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,i7e=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,a7e=new Map([["n",`
|
|
44
|
+
`],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\x00"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function sK(e){let t=e[0]==="u",n=e[1]==="{";if(t&&!n&&e.length===5||e[0]==="x"&&e.length===3)return String.fromCharCode(parseInt(e.slice(1),16));if(t&&n)return String.fromCodePoint(parseInt(e.slice(2,-1),16));return a7e.get(e)||e}function c7e(e,t){let n=[],r=t.trim().split(/\s*,\s*/g),o;for(let s of r){let i=Number(s);if(!Number.isNaN(i))n.push(i);else if(o=s.match(s7e))n.push(o[2].replace(i7e,(a,c,l)=>c?sK(c):l));else throw Error(`Invalid Chalk template style argument: ${s} (in style '${e}')`)}return n}function l7e(e){rK.lastIndex=0;let t=[],n;while((n=rK.exec(e))!==null){let r=n[1];if(n[2]){let o=c7e(r,n[2]);t.push([r].concat(o))}else t.push([r])}return t}function oK(e,t){let n={};for(let o of t)for(let s of o.styles)n[s[0]]=o.inverse?null:s.slice(1);let r=e;for(let[o,s]of Object.entries(n)){if(!Array.isArray(s))continue;if(!(o in r))throw Error(`Unknown Chalk style: ${o}`);r=s.length>0?r[o](...s):r[o]}return r}iK.exports=(e,t)=>{let n=[],r=[],o=[];if(t.replace(o7e,(s,i,a,c,l,d)=>{if(i)o.push(sK(i));else if(c){let f=o.join("");o=[],r.push(n.length===0?f:oK(e,n)(f)),n.push({inverse:a,styles:l7e(c)})}else if(l){if(n.length===0)throw Error("Found extraneous } in Chalk template literal");r.push(oK(e,n)(o.join(""))),o=[],n.pop()}else o.push(d)}),r.push(o.join("")),n.length>0){let s=`Chalk template literal is missing ${n.length} closing bracket${n.length===1?"":"s"} (\`}\`)`;throw Error(s)}return r.join("")}});var w2=w(function(Vqt,mK){var Hc=u2(),{stdout:g2,stderr:y2}=eK(),{stringReplaceAll:u7e,stringEncaseCRLFWithFirstIndex:d7e}=nK(),{isArray:Nx}=Array,lK=["ansi","ansi","ansi256","ansi16m"],Fm=Object.create(null),f7e=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let n=g2?g2.level:0;e.level=t.level===void 0?n:t.level};class uK{constructor(e){return dK(e)}}var dK=(e)=>{let t={};return f7e(t,e),t.template=(...n)=>pK(t.template,...n),Object.setPrototypeOf(t,Fx.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=uK,t.template};function Fx(e){return dK(e)}for(let[e,t]of Object.entries(Hc))Fm[e]={get(){let n=Mx(this,b2(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:n}),n}};Fm.visible={get(){let e=Mx(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:e}),e}};var fK=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let e of fK)Fm[e]={get(){let{level:t}=this;return function(...n){let r=b2(Hc.color[lK[t]][e](...n),Hc.color.close,this._styler);return Mx(this,r,this._isEmpty)}}};for(let e of fK){let t="bg"+e[0].toUpperCase()+e.slice(1);Fm[t]={get(){let{level:n}=this;return function(...r){let o=b2(Hc.bgColor[lK[n]][e](...r),Hc.bgColor.close,this._styler);return Mx(this,o,this._isEmpty)}}}}var p7e=Object.defineProperties(()=>{},{...Fm,level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}}),b2=(e,t,n)=>{let r,o;if(n===void 0)r=e,o=t;else r=n.openAll+e,o=t+n.closeAll;return{open:e,close:t,openAll:r,closeAll:o,parent:n}},Mx=(e,t,n)=>{let r=(...o)=>{if(Nx(o[0])&&Nx(o[0].raw))return cK(r,pK(r,...o));return cK(r,o.length===1?""+o[0]:o.join(" "))};return Object.setPrototypeOf(r,p7e),r._generator=e,r._styler=t,r._isEmpty=n,r},cK=(e,t)=>{if(e.level<=0||!t)return e._isEmpty?"":t;let n=e._styler;if(n===void 0)return t;let{openAll:r,closeAll:o}=n;if(t.indexOf("\x1B")!==-1)while(n!==void 0)t=u7e(t,n.close,n.open),n=n.parent;let s=t.indexOf(`
|
|
45
|
+
`);if(s!==-1)t=d7e(t,o,r,s);return r+t+o},h2,pK=(e,...t)=>{let[n]=t;if(!Nx(n)||!Nx(n.raw))return t.join(" ");let r=t.slice(1),o=[n.raw[0]];for(let s=1;s<n.length;s++)o.push(String(r[s-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[s]));if(h2===void 0)h2=aK();return h2(e,o.join(""))};Object.defineProperties(Fx.prototype,Fm);var jx=Fx();jx.supportsColor=g2;jx.stderr=Fx({level:y2?y2.level:0});jx.stderr.supportsColor=y2;mK.exports=jx});var gK=w(function(zqt,_2){var hK=(e,t)=>{for(let n of Reflect.ownKeys(t))Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n));return e};_2.exports=hK;_2.exports.default=hK});var bK=w(function(Gqt,qx){var m7e=gK(),Lx=new WeakMap,yK=(e,t={})=>{if(typeof e!=="function")throw TypeError("Expected a function");let n,r=0,o=e.displayName||e.name||"<anonymous>",s=function(...i){if(Lx.set(s,++r),r===1)n=e.apply(this,i),e=null;else if(t.throw===!0)throw Error(`Function \`${o}\` can only be called once`);return n};return m7e(s,e),Lx.set(s,r),s};qx.exports=yK;qx.exports.default=yK;qx.exports.callCount=(e)=>{if(!Lx.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Lx.get(e)}});var wK=w(function(Wqt,Bx){Bx.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Bx.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Bx.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var _K=w(function(Kqt,jm){var vn=global.process,uf=function(e){return 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"};if(!uf(vn))jm.exports=function(){return function(){}};else{if(x2=Nt("assert"),df=wK(),v2=/^win/i.test(vn.platform),Mm=Nt("events"),typeof Mm!=="function")Mm=Mm.EventEmitter;if(vn.__signal_exit_emitter__)_r=vn.__signal_exit_emitter__;else _r=vn.__signal_exit_emitter__=new Mm,_r.count=0,_r.emitted={};if(!_r.infinite)_r.setMaxListeners(1/0),_r.infinite=!0;jm.exports=function(e,t){if(!uf(global.process))return function(){};if(x2.equal(typeof e,"function","a callback must be provided for exit handler"),ff===!1)Ux();var n="exit";if(t&&t.alwaysLast)n="afterexit";var r=function(){if(_r.removeListener(n,e),_r.listeners("exit").length===0&&_r.listeners("afterexit").length===0)c0()};return _r.on(n,e),r},c0=function(){if(!ff||!uf(global.process))return;ff=!1,df.forEach(function(t){try{vn.removeListener(t,l0[t])}catch(n){}}),vn.emit=u0,vn.reallyExit=Hx,_r.count-=1},jm.exports.unload=c0,yu=function(t,n,r){if(_r.emitted[t])return;_r.emitted[t]=!0,_r.emit(t,n,r)},l0={},df.forEach(function(e){l0[e]=function(){if(!uf(global.process))return;var n=vn.listeners(e);if(n.length===_r.count){if(c0(),yu("exit",null,e),yu("afterexit",null,e),v2&&e==="SIGHUP")e="SIGINT";vn.kill(vn.pid,e)}}}),jm.exports.signals=function(){return df},ff=!1,Ux=function(){if(ff||!uf(global.process))return;ff=!0,_r.count+=1,df=df.filter(function(t){try{return vn.on(t,l0[t]),!0}catch(n){return!1}}),vn.emit=E2,vn.reallyExit=k2},jm.exports.load=Ux,Hx=vn.reallyExit,k2=function(t){if(!uf(global.process))return;vn.exitCode=t||0,yu("exit",vn.exitCode,null),yu("afterexit",vn.exitCode,null),Hx.call(vn,vn.exitCode)},u0=vn.emit,E2=function(t,n){if(t==="exit"&&uf(global.process)){if(n!==void 0)vn.exitCode=n;var r=u0.apply(this,arguments);return yu("exit",vn.exitCode,null),yu("afterexit",vn.exitCode,null),r}else return u0.apply(this,arguments)}}var x2,df,v2,Mm,_r,c0,yu,l0,ff,Ux,Hx,k2,u0,E2});var vK=w(function(Jqt,xK){var h7e=bK(),g7e=_K();xK.exports=h7e(()=>{g7e(()=>{process.stderr.write("\x1B[?25h")},{alwaysLast:!0})})});var SK=w(function(b7e){var y7e=vK(),Vx=!1;b7e.show=(e=process.stderr)=>{if(!e.isTTY)return;Vx=!1,e.write("\x1B[?25h")};b7e.hide=(e=process.stderr)=>{if(!e.isTTY)return;y7e(),Vx=!0,e.write("\x1B[?25l")};b7e.toggle=(e,t)=>{if(e!==void 0)Vx=e;if(Vx)b7e.show(t);else b7e.hide(t)}});var $K=w(function(Xqt,_7e){_7e.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\uD83D\uDE04 ","\uD83D\uDE1D "]},monkey:{interval:300,frames:["\uD83D\uDE48 ","\uD83D\uDE48 ","\uD83D\uDE49 ","\uD83D\uDE4A "]},hearts:{interval:100,frames:["\uD83D\uDC9B ","\uD83D\uDC99 ","\uD83D\uDC9C ","\uD83D\uDC9A ","\u2764\uFE0F "]},clock:{interval:100,frames:["\uD83D\uDD5B ","\uD83D\uDD50 ","\uD83D\uDD51 ","\uD83D\uDD52 ","\uD83D\uDD53 ","\uD83D\uDD54 ","\uD83D\uDD55 ","\uD83D\uDD56 ","\uD83D\uDD57 ","\uD83D\uDD58 ","\uD83D\uDD59 ","\uD83D\uDD5A "]},earth:{interval:180,frames:["\uD83C\uDF0D ","\uD83C\uDF0E ","\uD83C\uDF0F "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\uD83C\uDF11 ","\uD83C\uDF12 ","\uD83C\uDF13 ","\uD83C\uDF14 ","\uD83C\uDF15 ","\uD83C\uDF16 ","\uD83C\uDF17 ","\uD83C\uDF18 "]},runner:{interval:140,frames:["\uD83D\uDEB6 ","\uD83C\uDFC3 "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\uD83C\uDF24 ","\u26C5\uFE0F ","\uD83C\uDF25 ","\u2601\uFE0F ","\uD83C\uDF27 ","\uD83C\uDF28 ","\uD83C\uDF27 ","\uD83C\uDF28 ","\uD83C\uDF27 ","\uD83C\uDF28 ","\u26C8 ","\uD83C\uDF28 ","\uD83C\uDF27 ","\uD83C\uDF28 ","\u2601\uFE0F ","\uD83C\uDF25 ","\u26C5\uFE0F ","\uD83C\uDF24 ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\uD83C\uDF32","\uD83C\uDF84"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\uD83E\uDD18 ","\uD83E\uDD1F ","\uD83D\uDD96 ","\u270B ","\uD83E\uDD1A ","\uD83D\uDC46 "]},fistBump:{interval:80,frames:["\uD83E\uDD1C\u3000\u3000\u3000\u3000\uD83E\uDD1B ","\uD83E\uDD1C\u3000\u3000\u3000\u3000\uD83E\uDD1B ","\uD83E\uDD1C\u3000\u3000\u3000\u3000\uD83E\uDD1B ","\u3000\uD83E\uDD1C\u3000\u3000\uD83E\uDD1B\u3000 ","\u3000\u3000\uD83E\uDD1C\uD83E\uDD1B\u3000\u3000 ","\u3000\uD83E\uDD1C\u2728\uD83E\uDD1B\u3000\u3000 ","\uD83E\uDD1C\u3000\u2728\u3000\uD83E\uDD1B\u3000 "]},soccerHeader:{interval:80,frames:[" \uD83E\uDDD1\u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F\uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 ","\uD83E\uDDD1 \u26BD\uFE0F \uD83E\uDDD1 "]},mindblown:{interval:160,frames:["\uD83D\uDE10 ","\uD83D\uDE10 ","\uD83D\uDE2E ","\uD83D\uDE2E ","\uD83D\uDE26 ","\uD83D\uDE26 ","\uD83D\uDE27 ","\uD83D\uDE27 ","\uD83E\uDD2F ","\uD83D\uDCA5 ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\uD83D\uDD08 ","\uD83D\uDD09 ","\uD83D\uDD0A ","\uD83D\uDD09 "]},orangePulse:{interval:100,frames:["\uD83D\uDD38 ","\uD83D\uDD36 ","\uD83D\uDFE0 ","\uD83D\uDFE0 ","\uD83D\uDD36 "]},bluePulse:{interval:100,frames:["\uD83D\uDD39 ","\uD83D\uDD37 ","\uD83D\uDD35 ","\uD83D\uDD35 ","\uD83D\uDD37 "]},orangeBluePulse:{interval:100,frames:["\uD83D\uDD38 ","\uD83D\uDD36 ","\uD83D\uDFE0 ","\uD83D\uDFE0 ","\uD83D\uDD36 ","\uD83D\uDD39 ","\uD83D\uDD37 ","\uD83D\uDD35 ","\uD83D\uDD35 ","\uD83D\uDD37 "]},timeTravel:{interval:100,frames:["\uD83D\uDD5B ","\uD83D\uDD5A ","\uD83D\uDD59 ","\uD83D\uDD58 ","\uD83D\uDD57 ","\uD83D\uDD56 ","\uD83D\uDD55 ","\uD83D\uDD54 ","\uD83D\uDD53 ","\uD83D\uDD52 ","\uD83D\uDD51 ","\uD83D\uDD50 "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Gx=w(function(Qqt,RK){var zx=Object.assign({},$K()),DK=Object.keys(zx);Object.defineProperty(zx,"random",{get(){let e=Math.floor(Math.random()*DK.length),t=DK[e];return zx[t]}});RK.exports=zx});var S2=w(function(Zqt,CK){CK.exports=()=>{if(process.platform!=="win32")return!0;return Boolean(process.env.CI)||Boolean(process.env.WT_SESSION)||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}});var OK=w(function(e3t,AK){var co=w2(),x7e=S2(),v7e={info:co.blue("\u2139"),success:co.green("\u2714"),warning:co.yellow("\u26A0"),error:co.red("\u2716")},k7e={info:co.blue("i"),success:co.green("\u221A"),warning:co.yellow("\u203C"),error:co.red("\xD7")};AK.exports=x7e()?v7e:k7e});var TK=w(function(t3t,Wx){var E7e=function(){function e(i,a,c,l){var d;if(typeof a==="object")c=a.depth,l=a.prototype,d=a.filter,a=a.circular;var f=[],p=[],m=typeof Buffer<"u";if(typeof a>"u")a=!0;if(typeof c>"u")c=1/0;function h(g,y){if(g===null)return null;if(y==0)return g;var b,_;if(typeof g!="object")return g;if(e.__isArray(g))b=[];else if(e.__isRegExp(g)){if(b=new RegExp(g.source,s(g)),g.lastIndex)b.lastIndex=g.lastIndex}else if(e.__isDate(g))b=new Date(g.getTime());else if(m&&Buffer.isBuffer(g)){if(Buffer.allocUnsafe)b=Buffer.allocUnsafe(g.length);else b=new Buffer(g.length);return g.copy(b),b}else if(typeof l>"u")_=Object.getPrototypeOf(g),b=Object.create(_);else b=Object.create(l),_=l;if(a){var x=f.indexOf(g);if(x!=-1)return p[x];f.push(g),p.push(b)}for(var k in g){var v;if(_)v=Object.getOwnPropertyDescriptor(_,k);if(v&&v.set==null)continue;b[k]=h(g[k],y-1)}return b}return h(i,c)}e.clonePrototype=function(a){if(a===null)return null;var c=function(){};return c.prototype=a,new c};function t(i){return Object.prototype.toString.call(i)}e.__objToStr=t;function n(i){return typeof i==="object"&&t(i)==="[object Date]"}e.__isDate=n;function r(i){return typeof i==="object"&&t(i)==="[object Array]"}e.__isArray=r;function o(i){return typeof i==="object"&&t(i)==="[object RegExp]"}e.__isRegExp=o;function s(i){var a="";if(i.global)a+="g";if(i.ignoreCase)a+="i";if(i.multiline)a+="m";return a}return e.__getRegExpFlags=s,e}();if(typeof Wx==="object"&&Wx.exports)Wx.exports=E7e});var IK=w(function(n3t,PK){var S7e=TK();PK.exports=function(e,t){return e=e||{},Object.keys(t).forEach(function(n){if(typeof e[n]>"u")e[n]=S7e(t[n])}),e}});var FK=w(function(r3t,NK){NK.exports=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]]});var qK=w(function(o3t,$2){var $7e=IK(),d0=FK(),jK={nul:0,control:0};$2.exports=function(t){return LK(t,jK)};$2.exports.config=function(e){return e=$7e(e||{},jK),function(n){return LK(n,e)}};function LK(e,t){if(typeof e!=="string")return MK(e,t);var n=0;for(var r=0;r<e.length;r++){var o=MK(e.charCodeAt(r),t);if(o<0)return-1;n+=o}return n}function MK(e,t){if(e===0)return t.nul;if(e<32||e>=127&&e<160)return t.control;if(D7e(e))return 0;return 1+(e>=4352&&(e<=4447||e==9001||e==9002||e>=11904&&e<=42191&&e!=12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141))}function D7e(e){var t=0,n=d0.length-1,r;if(e<d0[0][0]||e>d0[n][1])return!1;while(n>=t)if(r=Math.floor((t+n)/2),e>d0[r][1])t=r+1;else if(e<d0[r][0])n=r-1;else return!0;return!1}});var UK=w(function(s3t,BK){BK.exports=({stream:e=process.stdout}={})=>Boolean(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))});var KK=w(function(i3t,WK){function HK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function VK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HK(Object(n),!0).forEach(function(r){R7e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HK(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function R7e(e,t,n){if(t=GK(t),t in e)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});else e[t]=n;return e}function C7e(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function zK(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r)r.writable=!0;Object.defineProperty(e,GK(r.key),r)}}function A7e(e,t,n){if(t)zK(e.prototype,t);if(n)zK(e,n);return Object.defineProperty(e,"prototype",{writable:!1}),e}function GK(e){var t=O7e(e,"string");return typeof t==="symbol"?t:String(t)}function O7e(e,t){if(typeof e!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!=="object")return r;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var T7e=Nt("buffer"),Kx=T7e.Buffer,P7e=Nt("util"),D2=P7e.inspect,I7e=D2&&D2.custom||"inspect";function N7e(e,t,n){Kx.prototype.copy.call(e,t,n)}WK.exports=function(){function e(){C7e(this,e),this.head=null,this.tail=null,this.length=0}return A7e(e,[{key:"push",value:function(n){var r={data:n,next:null};if(this.length>0)this.tail.next=r;else this.head=r;this.tail=r,++this.length}},{key:"unshift",value:function(n){var r={data:n,next:this.head};if(this.length===0)this.tail=r;this.head=r,++this.length}},{key:"shift",value:function(){if(this.length===0)return;var n=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,n}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(n){if(this.length===0)return"";var r=this.head,o=""+r.data;while(r=r.next)o+=n+r.data;return o}},{key:"concat",value:function(n){if(this.length===0)return Kx.alloc(0);var r=Kx.allocUnsafe(n>>>0),o=this.head,s=0;while(o)N7e(o.data,r,s),s+=o.data.length,o=o.next;return r}},{key:"consume",value:function(n,r){var o;if(n<this.head.data.length)o=this.head.data.slice(0,n),this.head.data=this.head.data.slice(n);else if(n===this.head.data.length)o=this.shift();else o=r?this._getString(n):this._getBuffer(n);return o}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(n){var r=this.head,o=1,s=r.data;n-=s.length;while(r=r.next){var i=r.data,a=n>i.length?i.length:n;if(a===i.length)s+=i;else s+=i.slice(0,n);if(n-=a,n===0){if(a===i.length)if(++o,r.next)this.head=r.next;else this.head=this.tail=null;else this.head=r,r.data=i.slice(a);break}++o}return this.length-=o,s}},{key:"_getBuffer",value:function(n){var r=Kx.allocUnsafe(n),o=this.head,s=1;o.data.copy(r),n-=o.data.length;while(o=o.next){var i=o.data,a=n>i.length?i.length:n;if(i.copy(r,r.length-n,0,a),n-=a,n===0){if(a===i.length)if(++s,o.next)this.head=o.next;else this.head=this.tail=null;else this.head=o,o.data=i.slice(a);break}++s}return this.length-=s,r}},{key:I7e,value:function(n,r){return D2(this,VK(VK({},r),{},{depth:0,customInspect:!1}))}}]),e}()});var C2=w(function(a3t,YK){function F7e(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;if(r||o){if(t)t(e);else if(e){if(!this._writableState)process.nextTick(R2,this,e);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,process.nextTick(R2,this,e)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(e||null,function(s){if(!t&&s)if(!n._writableState)process.nextTick(JK,n,s);else if(!n._writableState.errorEmitted)n._writableState.errorEmitted=!0,process.nextTick(JK,n,s);else process.nextTick(Jx,n);else if(t)process.nextTick(Jx,n),t(s);else process.nextTick(Jx,n)}),this}function JK(e,t){R2(e,t),Jx(e)}function Jx(e){if(e._writableState&&!e._writableState.emitClose)return;if(e._readableState&&!e._readableState.emitClose)return;e.emit("close")}function M7e(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function R2(e,t){e.emit("error",t)}function j7e(e,t){var{_readableState:n,_writableState:r}=e;if(n&&n.autoDestroy||r&&r.autoDestroy)e.destroy(t);else e.emit("error",t)}YK.exports={destroy:F7e,undestroy:M7e,errorOrDestroy:j7e}});var bu=w(function(U7e,ZK){var QK={};function Gs(e,t,n){if(!n)n=Error;function r(s,i,a){if(typeof t==="string")return t;else return t(s,i,a)}class o extends n{constructor(s,i,a){super(r(s,i,a))}}o.prototype.name=n.name,o.prototype.code=e,QK[e]=o}function XK(e,t){if(Array.isArray(e)){let n=e.length;if(e=e.map((r)=>String(r)),n>2)return`one of ${t} ${e.slice(0,n-1).join(", ")}, or `+e[n-1];else if(n===2)return`one of ${t} ${e[0]} or ${e[1]}`;else return`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}function L7e(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function q7e(e,t,n){if(n===void 0||n>e.length)n=e.length;return e.substring(n-t.length,n)===t}function B7e(e,t,n){if(typeof n!=="number")n=0;if(n+t.length>e.length)return!1;else return e.indexOf(t,n)!==-1}Gs("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Gs("ERR_INVALID_ARG_TYPE",function(e,t,n){let r;if(typeof t==="string"&&L7e(t,"not "))r="must not be",t=t.replace(/^not /,"");else r="must be";let o;if(q7e(e," argument"))o=`The ${e} ${r} ${XK(t,"type")}`;else{let s=B7e(e,".")?"property":"argument";o=`The "${e}" ${s} ${r} ${XK(t,"type")}`}return o+=`. Received type ${typeof n}`,o},TypeError);Gs("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Gs("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Gs("ERR_STREAM_PREMATURE_CLOSE","Premature close");Gs("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Gs("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Gs("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Gs("ERR_STREAM_WRITE_AFTER_END","write after end");Gs("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Gs("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Gs("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");U7e.codes=QK});var A2=w(function(c3t,eJ){var V7e=bu().codes.ERR_INVALID_OPT_VALUE;function z7e(e,t,n){return e.highWaterMark!=null?e.highWaterMark:t?e[n]:null}function G7e(e,t,n,r){var o=z7e(t,r,n);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var s=r?n:"highWaterMark";throw new V7e(s,o)}return Math.floor(o)}return e.objectMode?16:16384}eJ.exports={getHighWaterMark:G7e}});var tJ=w(function(l3t,O2){if(typeof Object.create==="function")O2.exports=function(t,n){if(n)t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})};else O2.exports=function(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}}});var pf=w(function(u3t,T2){try{if(Yx=Nt("util"),typeof Yx.inherits!=="function")throw"";T2.exports=Yx.inherits}catch(e){T2.exports=tJ()}var Yx});var rJ=w(function(d3t,nJ){nJ.exports=Nt("util").deprecate});var N2=w(function(f3t,lJ){lJ.exports=Mn;function sJ(e){var t=this;this.next=null,this.entry=null,this.finish=function(){wHe(t,e)}}var Lm;Mn.WritableState=p0;var W7e={deprecate:rJ()},iJ=Nt("stream"),Qx=Nt("buffer").Buffer,K7e=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function J7e(e){return Qx.from(e)}function Y7e(e){return Qx.isBuffer(e)||e instanceof K7e}var I2=C2(),X7e=A2(),Q7e=X7e.getHighWaterMark,wu=bu().codes,{ERR_INVALID_ARG_TYPE:Z7e,ERR_METHOD_NOT_IMPLEMENTED:eHe,ERR_MULTIPLE_CALLBACK:tHe,ERR_STREAM_CANNOT_PIPE:nHe,ERR_STREAM_DESTROYED:rHe,ERR_STREAM_NULL_VALUES:oHe,ERR_STREAM_WRITE_AFTER_END:sHe,ERR_UNKNOWN_ENCODING:iHe}=wu,qm=I2.errorOrDestroy;pf()(Mn,iJ);function aHe(){}function p0(e,t,n){if(Lm=Lm||mf(),e=e||{},typeof n!=="boolean")n=t instanceof Lm;if(this.objectMode=!!e.objectMode,n)this.objectMode=this.objectMode||!!e.writableObjectMode;this.highWaterMark=Q7e(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var r=e.decodeStrings===!1;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(o){mHe(t,o)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new sJ(this)}p0.prototype.getBuffer=function(){var t=this.bufferedRequest,n=[];while(t)n.push(t),t=t.next;return n};(function(){try{Object.defineProperty(p0.prototype,"buffer",{get:W7e.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}})();var Xx;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")Xx=Function.prototype[Symbol.hasInstance],Object.defineProperty(Mn,Symbol.hasInstance,{value:function(t){if(Xx.call(this,t))return!0;if(this!==Mn)return!1;return t&&t._writableState instanceof p0}});else Xx=function(t){return t instanceof this};function Mn(e){Lm=Lm||mf();var t=this instanceof Lm;if(!t&&!Xx.call(Mn,this))return new Mn(e);if(this._writableState=new p0(e,this,t),this.writable=!0,e){if(typeof e.write==="function")this._write=e.write;if(typeof e.writev==="function")this._writev=e.writev;if(typeof e.destroy==="function")this._destroy=e.destroy;if(typeof e.final==="function")this._final=e.final}iJ.call(this)}Mn.prototype.pipe=function(){qm(this,new nHe)};function cHe(e,t){var n=new sHe;qm(e,n),process.nextTick(t,n)}function lHe(e,t,n,r){var o;if(n===null)o=new oHe;else if(typeof n!=="string"&&!t.objectMode)o=new Z7e("chunk",["string","Buffer"],n);if(o)return qm(e,o),process.nextTick(r,o),!1;return!0}Mn.prototype.write=function(e,t,n){var r=this._writableState,o=!1,s=!r.objectMode&&Y7e(e);if(s&&!Qx.isBuffer(e))e=J7e(e);if(typeof t==="function")n=t,t=null;if(s)t="buffer";else if(!t)t=r.defaultEncoding;if(typeof n!=="function")n=aHe;if(r.ending)cHe(this,n);else if(s||lHe(this,r,e,n))r.pendingcb++,o=dHe(this,r,s,e,t,n);return o};Mn.prototype.cork=function(){this._writableState.corked++};Mn.prototype.uncork=function(){var e=this._writableState;if(e.corked){if(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest)aJ(this,e)}};Mn.prototype.setDefaultEncoding=function(t){if(typeof t==="string")t=t.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new iHe(t);return this._writableState.defaultEncoding=t,this};Object.defineProperty(Mn.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function uHe(e,t,n){if(!e.objectMode&&e.decodeStrings!==!1&&typeof t==="string")t=Qx.from(t,n);return t}Object.defineProperty(Mn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function dHe(e,t,n,r,o,s){if(!n){var i=uHe(t,r,o);if(r!==i)n=!0,o="buffer",r=i}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length<t.highWaterMark;if(!c)t.needDrain=!0;if(t.writing||t.corked){var l=t.lastBufferedRequest;if(t.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:s,next:null},l)l.next=t.lastBufferedRequest;else t.bufferedRequest=t.lastBufferedRequest;t.bufferedRequestCount+=1}else P2(e,t,!1,a,r,o,s);return c}function P2(e,t,n,r,o,s,i){if(t.writelen=r,t.writecb=i,t.writing=!0,t.sync=!0,t.destroyed)t.onwrite(new rHe("write"));else if(n)e._writev(o,t.onwrite);else e._write(o,s,t.onwrite);t.sync=!1}function fHe(e,t,n,r,o){if(--t.pendingcb,n)process.nextTick(o,r),process.nextTick(f0,e,t),e._writableState.errorEmitted=!0,qm(e,r);else o(r),e._writableState.errorEmitted=!0,qm(e,r),f0(e,t)}function pHe(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function mHe(e,t){var n=e._writableState,{sync:r,writecb:o}=n;if(typeof o!=="function")throw new tHe;if(pHe(n),t)fHe(e,n,r,t,o);else{var s=cJ(n)||e.destroyed;if(!s&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest)aJ(e,n);if(r)process.nextTick(oJ,e,n,s,o);else oJ(e,n,s,o)}}function oJ(e,t,n,r){if(!n)hHe(e,t);t.pendingcb--,r(),f0(e,t)}function hHe(e,t){if(t.length===0&&t.needDrain)t.needDrain=!1,e.emit("drain")}function aJ(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=Array(r),s=t.corkedRequestsFree;s.entry=n;var i=0,a=!0;while(n){if(o[i]=n,!n.isBuf)a=!1;n=n.next,i+=1}if(o.allBuffers=a,P2(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next)t.corkedRequestsFree=s.next,s.next=null;else t.corkedRequestsFree=new sJ(t);t.bufferedRequestCount=0}else{while(n){var c=n.chunk,l=n.encoding,d=n.callback,f=t.objectMode?1:c.length;if(P2(e,t,!1,f,c,l,d),n=n.next,t.bufferedRequestCount--,t.writing)break}if(n===null)t.lastBufferedRequest=null}t.bufferedRequest=n,t.bufferProcessing=!1}Mn.prototype._write=function(e,t,n){n(new eHe("_write()"))};Mn.prototype._writev=null;Mn.prototype.end=function(e,t,n){var r=this._writableState;if(typeof e==="function")n=e,e=null,t=null;else if(typeof t==="function")n=t,t=null;if(e!==null&&e!==void 0)this.write(e,t);if(r.corked)r.corked=1,this.uncork();if(!r.ending)bHe(this,r,n);return this};Object.defineProperty(Mn.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function cJ(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function gHe(e,t){e._final(function(n){if(t.pendingcb--,n)qm(e,n);t.prefinished=!0,e.emit("prefinish"),f0(e,t)})}function yHe(e,t){if(!t.prefinished&&!t.finalCalled)if(typeof e._final==="function"&&!t.destroyed)t.pendingcb++,t.finalCalled=!0,process.nextTick(gHe,e,t);else t.prefinished=!0,e.emit("prefinish")}function f0(e,t){var n=cJ(t);if(n){if(yHe(e,t),t.pendingcb===0){if(t.finished=!0,e.emit("finish"),t.autoDestroy){var r=e._readableState;if(!r||r.autoDestroy&&r.endEmitted)e.destroy()}}}return n}function bHe(e,t,n){if(t.ending=!0,f0(e,t),n)if(t.finished)process.nextTick(n);else e.once("finish",n);t.ended=!0,e.writable=!1}function wHe(e,t,n){var r=e.entry;e.entry=null;while(r){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree.next=e}Object.defineProperty(Mn.prototype,"destroyed",{enumerable:!1,get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function(t){if(!this._writableState)return;this._writableState.destroyed=t}});Mn.prototype.destroy=I2.destroy;Mn.prototype._undestroy=I2.undestroy;Mn.prototype._destroy=function(e,t){t(e)}});var mf=w(function(p3t,dJ){var _He=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};dJ.exports=ha;var uJ=M2(),F2=N2();pf()(ha,uJ);{Zx=_He(F2.prototype);for(m0=0;m0<Zx.length;m0++)if(h0=Zx[m0],!ha.prototype[h0])ha.prototype[h0]=F2.prototype[h0]}var Zx,h0,m0;function ha(e){if(!(this instanceof ha))return new ha(e);if(uJ.call(this,e),F2.call(this,e),this.allowHalfOpen=!0,e){if(e.readable===!1)this.readable=!1;if(e.writable===!1)this.writable=!1;if(e.allowHalfOpen===!1)this.allowHalfOpen=!1,this.once("end",xHe)}}Object.defineProperty(ha.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(ha.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(ha.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function xHe(){if(this._writableState.ended)return;process.nextTick(vHe,this)}function vHe(e){e.end()}Object.defineProperty(ha.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function(t){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=t,this._writableState.destroyed=t}})});var mJ=w(function(j2,pJ){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ev=Nt("buffer"),ga=ev.Buffer;function fJ(e,t){for(var n in e)t[n]=e[n]}if(ga.from&&ga.alloc&&ga.allocUnsafe&&ga.allocUnsafeSlow)pJ.exports=ev;else fJ(ev,j2),j2.Buffer=hf;function hf(e,t,n){return ga(e,t,n)}hf.prototype=Object.create(ga.prototype);fJ(ga,hf);hf.from=function(e,t,n){if(typeof e==="number")throw TypeError("Argument must not be a number");return ga(e,t,n)};hf.alloc=function(e,t,n){if(typeof e!=="number")throw TypeError("Argument must be a number");var r=ga(e);if(t!==void 0)if(typeof n==="string")r.fill(t,n);else r.fill(t);else r.fill(0);return r};hf.allocUnsafe=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return ga(e)};hf.allocUnsafeSlow=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return ev.SlowBuffer(e)}});var B2=w(function(FHe){var q2=mJ().Buffer,hJ=q2.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function kHe(e){if(!e)return"utf8";var t;while(!0)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function EHe(e){var t=kHe(e);if(typeof t!=="string"&&(q2.isEncoding===hJ||!hJ(e)))throw Error("Unknown encoding: "+e);return t||e}FHe.StringDecoder=g0;function g0(e){this.encoding=EHe(e);var t;switch(this.encoding){case"utf16le":this.text=AHe,this.end=OHe,t=4;break;case"utf8":this.fillLast=DHe,t=4;break;case"base64":this.text=THe,this.end=PHe,t=3;break;default:this.write=IHe,this.end=NHe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q2.allocUnsafe(t)}g0.prototype.write=function(e){if(e.length===0)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";n=this.lastNeed,this.lastNeed=0}else n=0;if(n<e.length)return t?t+this.text(e,n):this.text(e,n);return t||""};g0.prototype.end=CHe;g0.prototype.text=RHe;g0.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function L2(e){if(e<=127)return 0;else if(e>>5===6)return 2;else if(e>>4===14)return 3;else if(e>>3===30)return 4;return e>>6===2?-1:-2}function SHe(e,t,n){var r=t.length-1;if(r<n)return 0;var o=L2(t[r]);if(o>=0){if(o>0)e.lastNeed=o-1;return o}if(--r<n||o===-2)return 0;if(o=L2(t[r]),o>=0){if(o>0)e.lastNeed=o-2;return o}if(--r<n||o===-2)return 0;if(o=L2(t[r]),o>=0){if(o>0)if(o===2)o=0;else e.lastNeed=o-3;return o}return 0}function $He(e,t,n){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2){if((t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}}function DHe(e){var t=this.lastTotal-this.lastNeed,n=$He(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function RHe(e,t){var n=SHe(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function CHe(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+"\uFFFD";return t}function AHe(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function OHe(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function THe(e,t){var n=(e.length-t)%3;if(n===0)return e.toString("base64",t);if(this.lastNeed=3-n,this.lastTotal=3,n===1)this.lastChar[0]=e[e.length-1];else this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1];return e.toString("base64",t,e.length-n)}function PHe(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+this.lastChar.toString("base64",0,3-this.lastNeed);return t}function IHe(e){return e.toString(this.encoding)}function NHe(e){return e&&e.length?this.write(e):""}});var tv=w(function(h3t,bJ){var gJ=bu().codes.ERR_STREAM_PREMATURE_CLOSE;function jHe(e){var t=!1;return function(){if(t)return;t=!0;for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];e.apply(this,r)}}function LHe(){}function qHe(e){return e.setHeader&&typeof e.abort==="function"}function yJ(e,t,n){if(typeof t==="function")return yJ(e,null,t);if(!t)t={};n=jHe(n||LHe);var r=t.readable||t.readable!==!1&&e.readable,o=t.writable||t.writable!==!1&&e.writable,s=function(){if(!e.writable)a()},i=e._writableState&&e._writableState.finished,a=function(){if(o=!1,i=!0,!r)n.call(e)},c=e._readableState&&e._readableState.endEmitted,l=function(){if(r=!1,c=!0,!o)n.call(e)},d=function(h){n.call(e,h)},f=function(){var h;if(r&&!c){if(!e._readableState||!e._readableState.ended)h=new gJ;return n.call(e,h)}if(o&&!i){if(!e._writableState||!e._writableState.ended)h=new gJ;return n.call(e,h)}},p=function(){e.req.on("finish",a)};if(qHe(e))if(e.on("complete",a),e.on("abort",f),e.req)p();else e.on("request",p);else if(o&&!e._writableState)e.on("end",s),e.on("close",s);if(e.on("end",l),e.on("finish",a),t.error!==!1)e.on("error",d);return e.on("close",f),function(){if(e.removeListener("complete",a),e.removeListener("abort",f),e.removeListener("request",p),e.req)e.req.removeListener("finish",a);e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",a),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",f)}}bJ.exports=yJ});var _J=w(function(g3t,wJ){var nv;function _u(e,t,n){if(t=BHe(t),t in e)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});else e[t]=n;return e}function BHe(e){var t=UHe(e,"string");return typeof t==="symbol"?t:String(t)}function UHe(e,t){if(typeof e!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!=="object")return r;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var HHe=tv(),xu=Symbol("lastResolve"),gf=Symbol("lastReject"),y0=Symbol("error"),rv=Symbol("ended"),yf=Symbol("lastPromise"),U2=Symbol("handlePromise"),bf=Symbol("stream");function vu(e,t){return{value:e,done:t}}function VHe(e){var t=e[xu];if(t!==null){var n=e[bf].read();if(n!==null)e[yf]=null,e[xu]=null,e[gf]=null,t(vu(n,!1))}}function zHe(e){process.nextTick(VHe,e)}function GHe(e,t){return function(n,r){e.then(function(){if(t[rv]){n(vu(void 0,!0));return}t[U2](n,r)},r)}}var WHe=Object.getPrototypeOf(function(){}),KHe=Object.setPrototypeOf((nv={get stream(){return this[bf]},next:function(){var t=this,n=this[y0];if(n!==null)return Promise.reject(n);if(this[rv])return Promise.resolve(vu(void 0,!0));if(this[bf].destroyed)return new Promise(function(i,a){process.nextTick(function(){if(t[y0])a(t[y0]);else i(vu(void 0,!0))})});var r=this[yf],o;if(r)o=new Promise(GHe(r,this));else{var s=this[bf].read();if(s!==null)return Promise.resolve(vu(s,!1));o=new Promise(this[U2])}return this[yf]=o,o}},_u(nv,Symbol.asyncIterator,function(){return this}),_u(nv,"return",function(){var t=this;return new Promise(function(n,r){t[bf].destroy(null,function(o){if(o){r(o);return}n(vu(void 0,!0))})})}),nv),WHe),JHe=function(t){var n,r=Object.create(KHe,(n={},_u(n,bf,{value:t,writable:!0}),_u(n,xu,{value:null,writable:!0}),_u(n,gf,{value:null,writable:!0}),_u(n,y0,{value:null,writable:!0}),_u(n,rv,{value:t._readableState.endEmitted,writable:!0}),_u(n,U2,{value:function(s,i){var a=r[bf].read();if(a)r[yf]=null,r[xu]=null,r[gf]=null,s(vu(a,!1));else r[xu]=s,r[gf]=i},writable:!0}),n));return r[yf]=null,HHe(t,function(o){if(o&&o.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=r[gf];if(s!==null)r[yf]=null,r[xu]=null,r[gf]=null,s(o);r[y0]=o;return}var i=r[xu];if(i!==null)r[yf]=null,r[xu]=null,r[gf]=null,i(vu(void 0,!0));r[rv]=!0}),t.on("readable",zHe.bind(null,r)),r};wJ.exports=JHe});var EJ=w(function(y3t,kJ){function xJ(e,t,n,r,o,s,i){try{var a=e[s](i),c=a.value}catch(l){n(l);return}if(a.done)t(c);else Promise.resolve(c).then(r,o)}function YHe(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var s=e.apply(t,n);function i(c){xJ(s,r,o,i,a,"next",c)}function a(c){xJ(s,r,o,i,a,"throw",c)}i(void 0)})}}function vJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function XHe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vJ(Object(n),!0).forEach(function(r){QHe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vJ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function QHe(e,t,n){if(t=ZHe(t),t in e)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});else e[t]=n;return e}function ZHe(e){var t=eVe(e,"string");return typeof t==="symbol"?t:String(t)}function eVe(e,t){if(typeof e!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!=="object")return r;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var tVe=bu().codes.ERR_INVALID_ARG_TYPE;function nVe(e,t,n){var r;if(t&&typeof t.next==="function")r=t;else if(t&&t[Symbol.asyncIterator])r=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])r=t[Symbol.iterator]();else throw new tVe("iterable",["Iterable"],t);var o=new e(XHe({objectMode:!0},n)),s=!1;o._read=function(){if(!s)s=!0,i()};function i(){return a.apply(this,arguments)}function a(){return a=YHe(function*(){try{var c=yield r.next(),{value:l,done:d}=c;if(d)o.push(null);else if(o.push(yield l))i();else s=!1}catch(f){o.destroy(f)}}),a.apply(this,arguments)}return o}kJ.exports=nVe});var M2=w(function(w3t,IJ){IJ.exports=Ot;var Bm;Ot.ReadableState=RJ;var b3t=Nt("events").EventEmitter,DJ=function(t,n){return t.listeners(n).length},w0=Nt("stream"),ov=Nt("buffer").Buffer,rVe=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oVe(e){return ov.from(e)}function sVe(e){return ov.isBuffer(e)||e instanceof rVe}var H2=Nt("util"),wt;if(H2&&H2.debuglog)wt=H2.debuglog("stream");else wt=function(){};var iVe=KK(),Y2=C2(),aVe=A2(),cVe=aVe.getHighWaterMark,sv=bu().codes,{ERR_INVALID_ARG_TYPE:lVe,ERR_STREAM_PUSH_AFTER_EOF:uVe,ERR_METHOD_NOT_IMPLEMENTED:dVe,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:fVe}=sv,Um,V2,z2;pf()(Ot,w0);var b0=Y2.errorOrDestroy,G2=["error","close","destroy","pause","resume"];function pVe(e,t,n){if(typeof e.prependListener==="function")return e.prependListener(t,n);if(!e._events||!e._events[t])e.on(t,n);else if(Array.isArray(e._events[t]))e._events[t].unshift(n);else e._events[t]=[n,e._events[t]]}function RJ(e,t,n){if(Bm=Bm||mf(),e=e||{},typeof n!=="boolean")n=t instanceof Bm;if(this.objectMode=!!e.objectMode,n)this.objectMode=this.objectMode||!!e.readableObjectMode;if(this.highWaterMark=cVe(this,e,"readableHighWaterMark",n),this.buffer=new iVe,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding){if(!Um)Um=B2().StringDecoder;this.decoder=new Um(e.encoding),this.encoding=e.encoding}}function Ot(e){if(Bm=Bm||mf(),!(this instanceof Ot))return new Ot(e);var t=this instanceof Bm;if(this._readableState=new RJ(e,this,t),this.readable=!0,e){if(typeof e.read==="function")this._read=e.read;if(typeof e.destroy==="function")this._destroy=e.destroy}w0.call(this)}Object.defineProperty(Ot.prototype,"destroyed",{enumerable:!1,get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(t){if(!this._readableState)return;this._readableState.destroyed=t}});Ot.prototype.destroy=Y2.destroy;Ot.prototype._undestroy=Y2.undestroy;Ot.prototype._destroy=function(e,t){t(e)};Ot.prototype.push=function(e,t){var n=this._readableState,r;if(!n.objectMode){if(typeof e==="string"){if(t=t||n.defaultEncoding,t!==n.encoding)e=ov.from(e,t),t="";r=!0}}else r=!0;return CJ(this,e,t,!1,r)};Ot.prototype.unshift=function(e){return CJ(this,e,null,!0,!1)};function CJ(e,t,n,r,o){wt("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,gVe(e,s);else{var i;if(!o)i=mVe(s,t);if(i)b0(e,i);else if(s.objectMode||t&&t.length>0){if(typeof t!=="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==ov.prototype)t=oVe(t);if(r)if(s.endEmitted)b0(e,new fVe);else W2(e,s,t,!0);else if(s.ended)b0(e,new uVe);else if(s.destroyed)return!1;else if(s.reading=!1,s.decoder&&!n)if(t=s.decoder.write(t),s.objectMode||t.length!==0)W2(e,s,t,!1);else J2(e,s);else W2(e,s,t,!1)}else if(!r)s.reading=!1,J2(e,s)}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}function W2(e,t,n,r){if(t.flowing&&t.length===0&&!t.sync)t.awaitDrain=0,e.emit("data",n);else{if(t.length+=t.objectMode?1:n.length,r)t.buffer.unshift(n);else t.buffer.push(n);if(t.needReadable)iv(e)}J2(e,t)}function mVe(e,t){var n;if(!sVe(t)&&typeof t!=="string"&&t!==void 0&&!e.objectMode)n=new lVe("chunk",["string","Buffer","Uint8Array"],t);return n}Ot.prototype.isPaused=function(){return this._readableState.flowing===!1};Ot.prototype.setEncoding=function(e){if(!Um)Um=B2().StringDecoder;var t=new Um(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;var n=this._readableState.buffer.head,r="";while(n!==null)r+=t.write(n.data),n=n.next;if(this._readableState.buffer.clear(),r!=="")this._readableState.buffer.push(r);return this._readableState.length=r.length,this};var SJ=1073741824;function hVe(e){if(e>=SJ)e=SJ;else e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++;return e}function $J(e,t){if(e<=0||t.length===0&&t.ended)return 0;if(t.objectMode)return 1;if(e!==e)if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length;if(e>t.highWaterMark)t.highWaterMark=hVe(e);if(e<=t.length)return e;if(!t.ended)return t.needReadable=!0,0;return t.length}Ot.prototype.read=function(e){wt("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0)t.emittedReadable=!1;if(e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended)){if(wt("read: emitReadable",t.length,t.ended),t.length===0&&t.ended)K2(this);else iv(this);return null}if(e=$J(e,t),e===0&&t.ended){if(t.length===0)K2(this);return null}var r=t.needReadable;if(wt("need readable",r),t.length===0||t.length-e<t.highWaterMark)r=!0,wt("length less than watermark",r);if(t.ended||t.reading)r=!1,wt("reading or ended",r);else if(r){if(wt("do read"),t.reading=!0,t.sync=!0,t.length===0)t.needReadable=!0;if(this._read(t.highWaterMark),t.sync=!1,!t.reading)e=$J(n,t)}var o;if(e>0)o=TJ(e,t);else o=null;if(o===null)t.needReadable=t.length<=t.highWaterMark,e=0;else t.length-=e,t.awaitDrain=0;if(t.length===0){if(!t.ended)t.needReadable=!0;if(n!==e&&t.ended)K2(this)}if(o!==null)this.emit("data",o);return o};function gVe(e,t){if(wt("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();if(n&&n.length)t.buffer.push(n),t.length+=t.objectMode?1:n.length}if(t.ended=!0,t.sync)iv(e);else if(t.needReadable=!1,!t.emittedReadable)t.emittedReadable=!0,AJ(e)}function iv(e){var t=e._readableState;if(wt("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,!t.emittedReadable)wt("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(AJ,e)}function AJ(e){var t=e._readableState;if(wt("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended))e.emit("readable"),t.emittedReadable=!1;t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,X2(e)}function J2(e,t){if(!t.readingMore)t.readingMore=!0,process.nextTick(yVe,e,t)}function yVe(e,t){while(!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0)){var n=t.length;if(wt("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}Ot.prototype._read=function(e){b0(this,new dVe("_read()"))};Ot.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e);break}r.pipesCount+=1,wt("pipe count=%d opts=%j",r.pipesCount,t);var o=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=o?a:g;if(r.endEmitted)process.nextTick(s);else n.once("end",s);e.on("unpipe",i);function i(y,b){if(wt("onunpipe"),y===n){if(b&&b.hasUnpiped===!1)b.hasUnpiped=!0,d()}}function a(){wt("onend"),e.end()}var c=bVe(n);e.on("drain",c);var l=!1;function d(){if(wt("cleanup"),e.removeListener("close",m),e.removeListener("finish",h),e.removeListener("drain",c),e.removeListener("error",p),e.removeListener("unpipe",i),n.removeListener("end",a),n.removeListener("end",g),n.removeListener("data",f),l=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain))c()}n.on("data",f);function f(y){wt("ondata");var b=e.write(y);if(wt("dest.write",b),b===!1){if((r.pipesCount===1&&r.pipes===e||r.pipesCount>1&&PJ(r.pipes,e)!==-1)&&!l)wt("false write response, pause",r.awaitDrain),r.awaitDrain++;n.pause()}}function p(y){if(wt("onerror",y),g(),e.removeListener("error",p),DJ(e,"error")===0)b0(e,y)}pVe(e,"error",p);function m(){e.removeListener("finish",h),g()}e.once("close",m);function h(){wt("onfinish"),e.removeListener("close",m),g()}e.once("finish",h);function g(){wt("unpipe"),n.unpipe(e)}if(e.emit("pipe",n),!r.flowing)wt("pipe resume"),n.resume();return e};function bVe(e){return function(){var n=e._readableState;if(wt("pipeOnDrain",n.awaitDrain),n.awaitDrain)n.awaitDrain--;if(n.awaitDrain===0&&DJ(e,"data"))n.flowing=!0,X2(e)}}Ot.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1){if(e&&e!==t.pipes)return this;if(!e)e=t.pipes;if(t.pipes=null,t.pipesCount=0,t.flowing=!1,e)e.emit("unpipe",this,n);return this}if(!e){var{pipes:r,pipesCount:o}=t;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<o;s++)r[s].emit("unpipe",this,{hasUnpiped:!1});return this}var i=PJ(t.pipes,e);if(i===-1)return this;if(t.pipes.splice(i,1),t.pipesCount-=1,t.pipesCount===1)t.pipes=t.pipes[0];return e.emit("unpipe",this,n),this};Ot.prototype.on=function(e,t){var n=w0.prototype.on.call(this,e,t),r=this._readableState;if(e==="data"){if(r.readableListening=this.listenerCount("readable")>0,r.flowing!==!1)this.resume()}else if(e==="readable"){if(!r.endEmitted&&!r.readableListening){if(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,wt("on readable",r.length,r.reading),r.length)iv(this);else if(!r.reading)process.nextTick(wVe,this)}}return n};Ot.prototype.addListener=Ot.prototype.on;Ot.prototype.removeListener=function(e,t){var n=w0.prototype.removeListener.call(this,e,t);if(e==="readable")process.nextTick(OJ,this);return n};Ot.prototype.removeAllListeners=function(e){var t=w0.prototype.removeAllListeners.apply(this,arguments);if(e==="readable"||e===void 0)process.nextTick(OJ,this);return t};function OJ(e){var t=e._readableState;if(t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused)t.flowing=!0;else if(e.listenerCount("data")>0)e.resume()}function wVe(e){wt("readable nexttick read 0"),e.read(0)}Ot.prototype.resume=function(){var e=this._readableState;if(!e.flowing)wt("resume"),e.flowing=!e.readableListening,_Ve(this,e);return e.paused=!1,this};function _Ve(e,t){if(!t.resumeScheduled)t.resumeScheduled=!0,process.nextTick(xVe,e,t)}function xVe(e,t){if(wt("resume",t.reading),!t.reading)e.read(0);if(t.resumeScheduled=!1,e.emit("resume"),X2(e),t.flowing&&!t.reading)e.read(0)}Ot.prototype.pause=function(){if(wt("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)wt("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function X2(e){var t=e._readableState;wt("flow",t.flowing);while(t.flowing&&e.read()!==null);}Ot.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;e.on("end",function(){if(wt("wrapped end"),n.decoder&&!n.ended){var i=n.decoder.end();if(i&&i.length)t.push(i)}t.push(null)}),e.on("data",function(i){if(wt("wrapped data"),n.decoder)i=n.decoder.write(i);if(n.objectMode&&(i===null||i===void 0))return;else if(!n.objectMode&&(!i||!i.length))return;var a=t.push(i);if(!a)r=!0,e.pause()});for(var o in e)if(this[o]===void 0&&typeof e[o]==="function")this[o]=function(a){return function(){return e[a].apply(e,arguments)}}(o);for(var s=0;s<G2.length;s++)e.on(G2[s],this.emit.bind(this,G2[s]));return this._read=function(i){if(wt("wrapped _read",i),r)r=!1,e.resume()},this};if(typeof Symbol==="function")Ot.prototype[Symbol.asyncIterator]=function(){if(V2===void 0)V2=_J();return V2(this)};Object.defineProperty(Ot.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Ot.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Ot.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){if(this._readableState)this._readableState.flowing=t}});Ot._fromList=TJ;Object.defineProperty(Ot.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function TJ(e,t){if(t.length===0)return null;var n;if(t.objectMode)n=t.buffer.shift();else if(!e||e>=t.length){if(t.decoder)n=t.buffer.join("");else if(t.buffer.length===1)n=t.buffer.first();else n=t.buffer.concat(t.length);t.buffer.clear()}else n=t.buffer.consume(e,t.decoder);return n}function K2(e){var t=e._readableState;if(wt("endReadable",t.endEmitted),!t.endEmitted)t.ended=!0,process.nextTick(vVe,t,e)}function vVe(e,t){if(wt("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy){var n=t._writableState;if(!n||n.autoDestroy&&n.finished)t.destroy()}}}if(typeof Symbol==="function")Ot.from=function(e,t){if(z2===void 0)z2=EJ();return z2(Ot,e,t)};function PJ(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}});var Q2=w(function(_3t,FJ){FJ.exports=Vc;var av=bu().codes,{ERR_METHOD_NOT_IMPLEMENTED:kVe,ERR_MULTIPLE_CALLBACK:EVe,ERR_TRANSFORM_ALREADY_TRANSFORMING:SVe,ERR_TRANSFORM_WITH_LENGTH_0:$Ve}=av,cv=mf();pf()(Vc,cv);function DVe(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new EVe);if(n.writechunk=null,n.writecb=null,t!=null)this.push(t);r(e);var o=this._readableState;if(o.reading=!1,o.needReadable||o.length<o.highWaterMark)this._read(o.highWaterMark)}function Vc(e){if(!(this instanceof Vc))return new Vc(e);if(cv.call(this,e),this._transformState={afterTransform:DVe.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e){if(typeof e.transform==="function")this._transform=e.transform;if(typeof e.flush==="function")this._flush=e.flush}this.on("prefinish",RVe)}function RVe(){var e=this;if(typeof this._flush==="function"&&!this._readableState.destroyed)this._flush(function(t,n){NJ(e,t,n)});else NJ(this,null,null)}Vc.prototype.push=function(e,t){return this._transformState.needTransform=!1,cv.prototype.push.call(this,e,t)};Vc.prototype._transform=function(e,t,n){n(new kVe("_transform()"))};Vc.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;if(r.needTransform||o.needReadable||o.length<o.highWaterMark)this._read(o.highWaterMark)}};Vc.prototype._read=function(e){var t=this._transformState;if(t.writechunk!==null&&!t.transforming)t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform);else t.needTransform=!0};Vc.prototype._destroy=function(e,t){cv.prototype._destroy.call(this,e,function(n){t(n)})};function NJ(e,t,n){if(t)return e.emit("error",t);if(n!=null)e.push(n);if(e._writableState.length)throw new $Ve;if(e._transformState.transforming)throw new SVe;return e.push(null)}});var LJ=w(function(x3t,jJ){jJ.exports=_0;var MJ=Q2();pf()(_0,MJ);function _0(e){if(!(this instanceof _0))return new _0(e);MJ.call(this,e)}_0.prototype._transform=function(e,t,n){n(null,e)}});var VJ=w(function(v3t,HJ){var Z2;function CVe(e){var t=!1;return function(){if(t)return;t=!0,e.apply(void 0,arguments)}}var UJ=bu().codes,{ERR_MISSING_ARGS:AVe,ERR_STREAM_DESTROYED:OVe}=UJ;function qJ(e){if(e)throw e}function TVe(e){return e.setHeader&&typeof e.abort==="function"}function PVe(e,t,n,r){r=CVe(r);var o=!1;if(e.on("close",function(){o=!0}),Z2===void 0)Z2=tv();Z2(e,{readable:t,writable:n},function(i){if(i)return r(i);o=!0,r()});var s=!1;return function(i){if(o)return;if(s)return;if(s=!0,TVe(e))return e.abort();if(typeof e.destroy==="function")return e.destroy();r(i||new OVe("pipe"))}}function BJ(e){e()}function IVe(e,t){return e.pipe(t)}function NVe(e){if(!e.length)return qJ;if(typeof e[e.length-1]!=="function")return qJ;return e.pop()}function FVe(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=NVe(t);if(Array.isArray(t[0]))t=t[0];if(t.length<2)throw new AVe("streams");var o,s=t.map(function(i,a){var c=a<t.length-1,l=a>0;return PVe(i,c,l,function(d){if(!o)o=d;if(d)s.forEach(BJ);if(c)return;s.forEach(BJ),r(o)})});return t.reduce(IVe)}HJ.exports=FVe});var zJ=w(function(Ws,v0){var x0=Nt("stream");if(process.env.READABLE_STREAM==="disable"&&x0)v0.exports=x0.Readable,Object.assign(v0.exports,x0),v0.exports.Stream=x0;else Ws=v0.exports=M2(),Ws.Stream=x0||Ws,Ws.Readable=Ws,Ws.Writable=N2(),Ws.Duplex=mf(),Ws.Transform=Q2(),Ws.PassThrough=LJ(),Ws.finished=tv(),Ws.pipeline=VJ()});var KJ=w(function(k3t,WJ){var{Buffer:Oi}=Nt("buffer"),GJ=Symbol.for("BufferList");function dn(e){if(!(this instanceof dn))return new dn(e);dn._init.call(this,e)}dn._init=function(t){if(Object.defineProperty(this,GJ,{value:!0}),this._bufs=[],this.length=0,t)this.append(t)};dn.prototype._new=function(t){return new dn(t)};dn.prototype._offset=function(t){if(t===0)return[0,0];let n=0;for(let r=0;r<this._bufs.length;r++){let o=n+this._bufs[r].length;if(t<o||r===this._bufs.length-1)return[r,t-n];n=o}};dn.prototype._reverseOffset=function(e){let t=e[0],n=e[1];for(let r=0;r<t;r++)n+=this._bufs[r].length;return n};dn.prototype.get=function(t){if(t>this.length||t<0)return;let n=this._offset(t);return this._bufs[n[0]][n[1]]};dn.prototype.slice=function(t,n){if(typeof t==="number"&&t<0)t+=this.length;if(typeof n==="number"&&n<0)n+=this.length;return this.copy(null,0,t,n)};dn.prototype.copy=function(t,n,r,o){if(typeof r!=="number"||r<0)r=0;if(typeof o!=="number"||o>this.length)o=this.length;if(r>=this.length)return t||Oi.alloc(0);if(o<=0)return t||Oi.alloc(0);let s=!!t,i=this._offset(r),a=o-r,c=a,l=s&&n||0,d=i[1];if(r===0&&o===this.length){if(!s)return this._bufs.length===1?this._bufs[0]:Oi.concat(this._bufs,this.length);for(let f=0;f<this._bufs.length;f++)this._bufs[f].copy(t,l),l+=this._bufs[f].length;return t}if(c<=this._bufs[i[0]].length-d)return s?this._bufs[i[0]].copy(t,n,d,d+c):this._bufs[i[0]].slice(d,d+c);if(!s)t=Oi.allocUnsafe(a);for(let f=i[0];f<this._bufs.length;f++){let p=this._bufs[f].length-d;if(c>p)this._bufs[f].copy(t,l,d),l+=p;else{this._bufs[f].copy(t,l,d,d+c),l+=p;break}if(c-=p,d)d=0}if(t.length>l)return t.slice(0,l);return t};dn.prototype.shallowSlice=function(t,n){if(t=t||0,n=typeof n!=="number"?this.length:n,t<0)t+=this.length;if(n<0)n+=this.length;if(t===n)return this._new();let r=this._offset(t),o=this._offset(n),s=this._bufs.slice(r[0],o[0]+1);if(o[1]===0)s.pop();else s[s.length-1]=s[s.length-1].slice(0,o[1]);if(r[1]!==0)s[0]=s[0].slice(r[1]);return this._new(s)};dn.prototype.toString=function(t,n,r){return this.slice(n,r).toString(t)};dn.prototype.consume=function(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;while(this._bufs.length)if(t>=this._bufs[0].length)t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}return this};dn.prototype.duplicate=function(){let t=this._new();for(let n=0;n<this._bufs.length;n++)t.append(this._bufs[n]);return t};dn.prototype.append=function(t){if(t==null)return this;if(t.buffer)this._appendBuffer(Oi.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let n=0;n<t.length;n++)this.append(t[n]);else if(this._isBufferList(t))for(let n=0;n<t._bufs.length;n++)this.append(t._bufs[n]);else{if(typeof t==="number")t=t.toString();this._appendBuffer(Oi.from(t))}return this};dn.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length};dn.prototype.indexOf=function(e,t,n){if(n===void 0&&typeof t==="string")n=t,t=void 0;if(typeof e==="function"||Array.isArray(e))throw TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');else if(typeof e==="number")e=Oi.from([e]);else if(typeof e==="string")e=Oi.from(e,n);else if(this._isBufferList(e))e=e.slice();else if(Array.isArray(e.buffer))e=Oi.from(e.buffer,e.byteOffset,e.byteLength);else if(!Oi.isBuffer(e))e=Oi.from(e);if(t=Number(t||0),isNaN(t))t=0;if(t<0)t=this.length+t;if(t<0)t=0;if(e.length===0)return t>this.length?this.length:t;let r=this._offset(t),o=r[0],s=r[1];for(;o<this._bufs.length;o++){let i=this._bufs[o];while(s<i.length)if(i.length-s>=e.length){let c=i.indexOf(e,s);if(c!==-1)return this._reverseOffset([o,c]);s=i.length-e.length+1}else{let c=this._reverseOffset([o,s]);if(this._match(c,e))return c;s++}s=0}return-1};dn.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0};(function(){let e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let t in e)(function(n){if(e[n]===null)dn.prototype[n]=function(r,o){return this.slice(r,r+o)[n](0,o)};else dn.prototype[n]=function(r=0){return this.slice(r,r+e[n])[n](0)}})(t)})();dn.prototype._isBufferList=function(t){return t instanceof dn||dn.isBufferList(t)};dn.isBufferList=function(t){return t!=null&&t[GJ]};WJ.exports=dn});var JJ=w(function(E3t,lv){var eO=zJ().Duplex,MVe=pf(),ku=KJ();function lo(e){if(!(this instanceof lo))return new lo(e);if(typeof e==="function"){this._callback=e;let t=function(r){if(this._callback)this._callback(r),this._callback=null}.bind(this);this.on("pipe",function(r){r.on("error",t)}),this.on("unpipe",function(r){r.removeListener("error",t)}),e=null}ku._init.call(this,e),eO.call(this)}MVe(lo,eO);Object.assign(lo.prototype,ku.prototype);lo.prototype._new=function(t){return new lo(t)};lo.prototype._write=function(t,n,r){if(this._appendBuffer(t),typeof r==="function")r()};lo.prototype._read=function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)};lo.prototype.end=function(t){if(eO.prototype.end.call(this,t),this._callback)this._callback(null,this.slice()),this._callback=null};lo.prototype._destroy=function(t,n){this._bufs.length=0,this.length=0,n(t)};lo.prototype._isBufferList=function(t){return t instanceof lo||t instanceof ku||lo.isBufferList(t)};lo.isBufferList=ku.isBufferList;lv.exports=lo;lv.exports.BufferListStream=lo;lv.exports.BufferList=ku});var QJ=w(function(S3t,oO){var YJ=Nt("readline"),jVe=w2(),dv=SK(),Hm=Gx(),Eu=OK(),LVe=s0(),qVe=qK(),BVe=UK(),UVe=S2(),{BufferListStream:HVe}=JJ(),tO=Symbol("text"),nO=Symbol("prefixText");class XJ{constructor(){this.requests=0,this.mutedStream=new HVe,this.mutedStream.pipe(process.stdout);let e=this;this.ourEmit=function(t,n,...r){let{stdin:o}=process;if(e.requests>0||o.emit===e.ourEmit){if(t==="keypress")return;if(t==="data"&&n.includes(3))process.emit("SIGINT");Reflect.apply(e.oldEmit,this,[t,n,...r])}else Reflect.apply(process.stdin.emit,this,[t,n,...r])}}start(){if(this.requests++,this.requests===1)this.realStart()}stop(){if(this.requests<=0)throw Error("`stop` called more times than `start`");if(this.requests--,this.requests===0)this.realStop()}realStart(){if(process.platform==="win32")return;this.rl=YJ.createInterface({input:process.stdin,output:this.mutedStream}),this.rl.on("SIGINT",()=>{if(process.listenerCount("SIGINT")===0)process.emit("SIGINT");else this.rl.close(),process.kill(process.pid,"SIGINT")})}realStop(){if(process.platform==="win32")return;this.rl.close(),this.rl=void 0}}var uv;class rO{constructor(e){if(!uv)uv=new XJ;if(typeof e==="string")e={text:e};this.options={text:"",color:"cyan",stream:process.stderr,discardStdin:!0,...e},this.spinner=this.options.spinner,this.color=this.options.color,this.hideCursor=this.options.hideCursor!==!1,this.interval=this.options.interval||this.spinner.interval||100,this.stream=this.options.stream,this.id=void 0,this.isEnabled=typeof this.options.isEnabled==="boolean"?this.options.isEnabled:BVe({stream:this.stream}),this.isSilent=typeof this.options.isSilent==="boolean"?this.options.isSilent:!1,this.text=this.options.text,this.prefixText=this.options.prefixText,this.linesToClear=0,this.indent=this.options.indent,this.discardStdin=this.options.discardStdin,this.isDiscardingStdin=!1}get indent(){return this._indent}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw Error("The `indent` option must be an integer from 0 and up");this._indent=e}_updateInterval(e){if(e!==void 0)this.interval=e}get spinner(){return this._spinner}set spinner(e){if(this.frameIndex=0,typeof e==="object"){if(e.frames===void 0)throw Error("The given spinner must have a `frames` property");this._spinner=e}else if(!UVe())this._spinner=Hm.line;else if(e===void 0)this._spinner=Hm.dots;else if(e!=="default"&&Hm[e])this._spinner=Hm[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.`);this._updateInterval(this._spinner.interval)}get text(){return this[tO]}set text(e){this[tO]=e,this.updateLineCount()}get prefixText(){return this[nO]}set prefixText(e){this[nO]=e,this.updateLineCount()}get isSpinning(){return this.id!==void 0}getFullPrefixText(e=this[nO],t=" "){if(typeof e==="string")return e+t;if(typeof e==="function")return e()+t;return""}updateLineCount(){let e=this.stream.columns||80,t=this.getFullPrefixText(this.prefixText,"-");this.lineCount=0;for(let n of LVe(t+"--"+this[tO]).split(`
|
|
46
46
|
`))this.lineCount+=Math.max(1,Math.ceil(qVe(n)/e))}get isEnabled(){return this._isEnabled&&!this.isSilent}set isEnabled(e){if(typeof e!=="boolean")throw TypeError("The `isEnabled` option must be a boolean");this._isEnabled=e}get isSilent(){return this._isSilent}set isSilent(e){if(typeof e!=="boolean")throw TypeError("The `isSilent` option must be a boolean");this._isSilent=e}frame(){let{frames:e}=this.spinner,t=e[this.frameIndex];if(this.color)t=jVe[this.color](t);this.frameIndex=++this.frameIndex%e.length;let n=typeof this.prefixText==="string"&&this.prefixText!==""?this.prefixText+" ":"",r=typeof this.text==="string"?" "+this.text:"";return n+t+r}clear(){if(!this.isEnabled||!this.stream.isTTY)return this;for(let e=0;e<this.linesToClear;e++){if(e>0)this.stream.moveCursor(0,-1);this.stream.clearLine(),this.stream.cursorTo(this.indent)}return this.linesToClear=0,this}render(){if(this.isSilent)return this;return this.clear(),this.stream.write(this.frame()),this.linesToClear=this.lineCount,this}start(e){if(e)this.text=e;if(this.isSilent)return this;if(!this.isEnabled){if(this.text)this.stream.write(`- ${this.text}
|
|
47
47
|
`);return this}if(this.isSpinning)return this;if(this.hideCursor)dv.hide(this.stream);if(this.discardStdin&&process.stdin.isTTY)this.isDiscardingStdin=!0,uv.start();return this.render(),this.id=setInterval(this.render.bind(this),this.interval),this}stop(){if(!this.isEnabled)return this;if(clearInterval(this.id),this.id=void 0,this.frameIndex=0,this.clear(),this.hideCursor)dv.show(this.stream);if(this.discardStdin&&process.stdin.isTTY&&this.isDiscardingStdin)uv.stop(),this.isDiscardingStdin=!1;return this}succeed(e){return this.stopAndPersist({symbol:Eu.success,text:e})}fail(e){return this.stopAndPersist({symbol:Eu.error,text:e})}warn(e){return this.stopAndPersist({symbol:Eu.warning,text:e})}info(e){return this.stopAndPersist({symbol:Eu.info,text:e})}stopAndPersist(e={}){if(this.isSilent)return this;let t=e.prefixText||this.prefixText,n=e.text||this.text,r=typeof n==="string"?" "+n:"";return this.stop(),this.stream.write(`${this.getFullPrefixText(t," ")}${e.symbol||" "}${r}
|
|
48
48
|
`),this}}var VVe=function(e){return new rO(e)};oO.exports=VVe;oO.exports.promise=(e,t)=>{if(typeof e.then!=="function")throw TypeError("Parameter `action` must be a Promise");let n=new rO(t);return n.start(),(async()=>{try{await e,n.succeed()}catch{n.fail()}})(),n}});var fv=function(e,t){e.output.write(_s.cursorBackward(t))},ZJ=function(e,t){e.output.write(_s.cursorForward(t))},eY=function(e,t){e.output.write(_s.cursorUp(t))},sO=function(e,t){e.output.write(_s.cursorDown(t))},k0=function(e,t){e.output.write(_s.eraseLines(t))};var iO=z(()=>{By()});function nY(e){return e.split(`
|
|
@@ -99,7 +99,7 @@ ${t}`,FGe,MGe,jGe=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=NGe.bind(nul
|
|
|
99
99
|
`)}var nN=!1;var{spawn:vpt}=globalThis.Bun;function Bf(e,t=[]){let n=e.replace(kpt,'("$1","<redacted>")');for(let r of t)if(r.length>=Ept)n=n.split(r).join("<redacted>");return n}function CS(e){let t=["AWS_SESSION_TOKEN","AWS_SECRET_ACCESS_KEY","AWS_ACCESS_KEY_ID"],n=new Set;for(let r of[process.env,e??{}])for(let o of t){let s=r[o];if(typeof s==="string"&&s.length>0)n.add(s)}return[...n]}async function Bfe(e,t){let n=e.getReader(),r=new TextDecoder,o="";while(!0){let{done:s,value:i}=await n.read();if(s)break;if(i.byteLength===0)continue;t(),o+=r.decode(i,{stream:!0})}return o+r.decode()}async function R(e,t={}){let n={...process.env,GIT_TERMINAL_PROMPT:"0",...t.env};for(let y of t.unsetEnv??[])delete n[y];let r=vpt({cmd:e,cwd:t.cwd,...t.stdin===void 0?{}:{stdin:new TextEncoder().encode(t.stdin)},stdout:"pipe",stderr:"pipe",env:n}),o=!1,s,i,a=performance.now(),c=()=>{if(i!==void 0)clearTimeout(i),i=void 0},l=()=>{if(!t.onInactivityWarning)return;c(),i=setTimeout(()=>{i=void 0;try{t.onInactivityWarning?.(performance.now()-a)}catch{console.error("Could not display subprocess inactivity warning; the child result is unaffected.")}},t.inactivityWarningAfterMs??Spt)};if(l(),t.timeout)s=setTimeout(()=>{o=!0,c(),r.kill()},t.timeout);let d=ig()?[...CS(n),...t.redact??[]]:[];if(ig()){let y=t.cwd?` (cwd=${t.cwd})`:"";hd(u.dim(Bf(`$ ${e.join(" ")}${y}`,d)))}let f=()=>{a=performance.now(),l()},p,m,h,g=r.exited.then((y)=>(c(),y));try{[p,m,h]=await Promise.all([Bfe(r.stdout,f),Bfe(r.stderr,f),g])}finally{if(c(),s)clearTimeout(s)}if(ig()){if(t.sensitiveOutput)hd(u.dim("[sensitive subprocess output suppressed]"));else{if(p.trim())hd(u.dim(Bf(p.trimEnd(),d)));if(m.trim())hd(u.yellow(Bf(m.trimEnd(),d)))}hd(u.dim(`(exit ${h})`))}if(o)return{stdout:p,stderr:m||`Command timed out after ${Math.round(t.timeout/1000)}s`,exitCode:h??1,timedOut:!0};return{stdout:p,stderr:m,exitCode:h,timedOut:!1}}var kpt,Ept=8,Spt=120000;var qt=z(()=>{He();kpt=/\(\s*"((?:x-amz-)[^"]*|authorization|proxy-authorization)"\s*,\s*"[^"]*"\s*\)/gi});function Dpt(){if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";return"linux"}function Hfe(e,t=Dpt()){return e.installInstructions[t]}function Rpt(e){let t=e.match(/(\d+\.\d+(?:\.\d+)?)/);return t?t[1]:void 0}function Apt(){let e=Number(process.env.TEST_PROBE_TIMEOUT_MS);return Number.isFinite(e)&&e>0?e:Cpt}async function Vfe(e){try{let{exitCode:t,stdout:n,timedOut:r}=await R(e.cmd,{timeout:Apt()});if(r)return{available:!1,timedOut:!0};if(t!==0)return{available:!1};return{available:!0,version:Rpt(n)}}catch(t){let n=t instanceof Error?t.message:String(t);if(!n.includes("ENOENT")&&!n.includes("not found"))console.error(` Warning: ${e.name} check failed unexpectedly: ${n}`);return{available:!1}}}async function jb(){let e=Object.entries(Ufe);return Promise.all(e.map(async([t,n])=>{let{available:r,version:o,timedOut:s}=await Vfe(n);return{key:t,name:n.name,purpose:n.purpose,required:n.required,available:r,version:o,timedOut:s,installInstruction:Hfe(n)}}))}async function zfe(){let t=(await jb()).filter((n)=>n.required&&!n.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 n of t)console.warn(` - ${n.name} (${n.purpose})`),console.warn(` Install: ${n.installInstruction}`);return console.warn("Run `nemar doctor` anytime to re-check. You can finish signup without them.\n"),t}async function Uf(e){let n=$pt[e].map((i)=>Ufe[i]).filter(Boolean),r=await Promise.all(n.map(async(i)=>{let a=await Vfe(i);return{check:i,available:a.available,timedOut:a.timedOut}}));for(let i of r)if(i.timedOut&&i.check.required)console.warn(`Warning: ${i.check.name} did not respond to a version check in time; continuing anyway.`);let o=r.filter((i)=>!i.available&&!i.timedOut&&i.check.required).map((i)=>({tool:i.check.name,installInstruction:Hfe(i.check)}));if(o.length===0)return;let s=[`
|
|
101
101
|
Missing required tools:`];for(let i of o)s.push(` ${i.tool} not installed`),s.push(` Install: ${i.installInstruction}`);throw Error(s.join(`
|
|
102
|
-
`))}var Ufe,$pt,Cpt=4000;var Lb=z(()=>{qt();Ufe={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)"}}},$pt={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 Wfe;var Gfe=z(()=>{Wfe={name:"nemar-cli",packageManager:"bun@1.4.3",version:"0.10.27-dev.
|
|
102
|
+
`))}var Ufe,$pt,Cpt=4000;var Lb=z(()=>{qt();Ufe={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)"}}},$pt={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 Wfe;var Gfe=z(()=>{Wfe={name:"nemar-cli",packageManager:"bun@1.4.3",version:"0.10.27-dev.4112",description:"CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",type:"module",main:"dist/index.js",bin:{nemar:"dist/index.js","git-annex-remote-nemar":"dist/git-annex-remote-nemar.js"},scripts:{dev:"bun run src/index.ts",build:"bun build src/index.ts src/git-annex-remote-nemar.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"]},trustedDependencies:["@biomejs/biome"],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 Ds;var Hf=z(()=>{Gfe();Ds=Wfe.version});import{mkdirSync as Tpt,readdirSync as Ppt,unlinkSync as Ipt,writeFileSync as Npt}from"fs";import{join as rN}from"path";function Zfe(){ag=!0}function ul(){return ag}function epe(e,t=process.env){return e.includes("--debug")||t.NEMAR_DEBUG==="1"}function Bb(e){Qfe=e,$n(`Step: ${e}`)}function Io(){Yfe=!0}function tpe(){return Yfe}function ce(){if(Xfe)return;sN=!0}function Ub(){sN=!1,Xfe=!0}function npe(){return sN}function $n(e){if(ag)process.stderr.write(`[debug] ${e}
|
|
103
103
|
`)}function Lpt(e){let t={};for(let[n,r]of Object.entries(e))t[n]=jpt.has(n.toLowerCase())?"[REDACTED]":r;return t}function ope(e){let t=e.indexOf("@");if(t<=0)return"***";return`${e[0]}***${e.slice(t)}`}function oN(e,t,n=0){if(n>Bpt)return"[REDACTED: depth]";if(Array.isArray(t))return t.map((r)=>oN(e,r,n+1));if(t&&typeof t==="object"){let r={};for(let[o,s]of Object.entries(t))r[o]=oN(o,s,n+1);return r}if(typeof t==="string"){if(qpt.test(e))return"[REDACTED]";return t.replace(rpe,ope)}return t}function iN(e){return e.replace(Upt,"Bearer [REDACTED]").replace(Hpt,"[REDACTED_AWS_KEY]").replace(Vpt,"$1[REDACTED]").replace(zpt,"$1$2=[REDACTED]").replace(rpe,ope)}function Gpt(e){return iN(e)}function Kfe(e,t=Mpt){if(e===void 0)return;let n=e;try{let r=JSON.parse(e);n=JSON.stringify(oN("",r))}catch{}if(n=iN(n),Buffer.byteLength(n,"utf8")>t)n=`${Buffer.from(n,"utf8").subarray(0,t).toString("utf8")}... [truncated]`;return n}function TS(e){if(!ag)return;let t=Gpt(e.url);try{let n={...e,url:t,requestHeaders:e.requestHeaders?Lpt(e.requestHeaders):void 0,requestBody:Kfe(e.requestBody),responseBody:Kfe(e.responseBody)};OS.push(n),$n(`${e.method} ${t} -> ${e.status??"ERROR"} (${e.durationMs}ms)`)}catch(n){let r=G(n);OS.push({method:e.method,url:t,status:e.status,durationMs:e.durationMs,note:`redaction failed: ${r}`}),$n(`redaction failed for ${e.method} ${t}: ${r}`)}}async function Wpt(){let e=[];try{let t=process.versions.bun?`Bun ${process.versions.bun}`:`Node ${process.version}`;e.push(`CLI version: ${Ds}`),e.push(`OS/Arch: ${process.platform}/${process.arch}`),e.push(`Runtime: ${t}`)}catch(t){e.push(`(could not read CLI/OS/runtime info: ${G(t)})`)}e.push(""),e.push("Active account:");try{let t=zt();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: ${G(t)})`)}e.push(""),e.push("External tools:");try{let t=await jb();for(let n of t){let r=n.available?n.version??"installed":n.timedOut?"(timed out)":"not installed";e.push(` ${n.name}: ${r}`)}}catch(t){e.push(` (could not probe external tools: ${G(t)})`)}return e}async function aN(){return(await Wpt()).join(`
|
|
104
104
|
`)}async function spe(){if(!ag||AS!==void 0)return;try{AS=await aN()}catch(e){let t=G(e);AS=`(could not build environment report: ${t})`,$n(`environment snapshot failed: ${t}`)}}function ipe(e){if(Jfe.has(e))return{flag:e};for(let t of Jfe){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 Kpt(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],o=ipe(r);if(!o){t.push(r);continue}if(o.kind==="long-eq")t.push(`${o.flag}=[REDACTED]`);else if(o.kind==="short-attached")t.push(`${o.flag}[REDACTED]`);else if(t.push(r),n+1<e.length)t.push("[REDACTED]"),n++}return t}function Jpt(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],o=ipe(r);if(!o){t.push(r);continue}if(!o.kind&&n+1<e.length)n++}return t}function Ypt(e){let t=[];for(let r of Jpt(e)){if(r.startsWith("-"))continue;if(t.push(r),t.length===2)break}return(t.length>0?t.join("-"):"nemar").replace(/[^a-zA-Z0-9_-]/g,"_")}function Xpt(e,t){let n=[];if(n.push("NEMAR CLI Debug Log"),n.push(`Generated: ${new Date().toISOString()}`),n.push(`Command: nemar ${iN(Kpt(e).join(" "))}`),n.push(""),n.push(AS??"(environment snapshot unavailable)"),n.push(""),n.push("HTTP requests:"),OS.length===0)n.push(" (none)");else OS.forEach((r,o)=>{if(n.push(` [${o+1}] ${r.method} ${r.url} -> ${r.status??"ERROR"} (${r.durationMs}ms)`),r.error)n.push(` Error: ${r.error}`);if(r.note)n.push(` Note: ${r.note}`);if(r.requestHeaders)n.push(` Request headers: ${JSON.stringify(r.requestHeaders)}`);if(r.requestBody)n.push(` Request body: ${r.requestBody}`);if(r.responseBody)n.push(` Response body: ${r.responseBody}`)});return n.push(""),n.push(`Failing step: ${Qfe??"(none recorded)"}`),n.push(`Exit code: ${t}`),`${n.join(`
|
|
105
105
|
`)}
|
|
@@ -249,7 +249,7 @@ sub-02 30 F
|
|
|
249
249
|
`)),t.keys.length>0){let _=D("Verifying copied data...").start(),x=await yl(F_,`${o}/objects/`,Up),k=uOt(t.keys,x);if(k.length>0){let F=`${k.length} of ${t.keys.length} objects missing at s3://${F_}/${o}/objects/. Re-run the copy phase before finalizing.`;throw _.fail(F),Error(F)}_.succeed(`Verified ${t.keys.length} objects present`);let v=await Cd(r,e.devRemote??qL);if(v!==i){let F=`${e.devRemote??qL} uuid drifted (prepare=${i} now=${v}). Aborting before registering keys against the wrong remote.`;throw console.error(u.red(F)),Error(F)}let C=D("Registering files in git-annex...").start(),T=await Ad(r,t.keys,i);if(T.failed>0){let F=`${T.failed} of ${t.keys.length} git-annex key registrations are not in the location log (e.g. ${T.missing.slice(0,3).join(", ")}). Re-run finalize to retry.`;throw C.fail(F),Error(F)}C.succeed(`Registered ${T.success} files in git-annex`);let V=D("Pushing git-annex branch...").start(),A=await ur(r,"origin");if(!A.success){let F=`Failed to push git-annex branch: ${A.error}`;throw V.fail(F),Error(F)}if(A.warning){let F=`git-annex branch push failed: ${A.warning}`;throw V.fail(F),Error(F)}V.succeed("Pushed git-annex branch")}let a=!1,c=D("Deploying CI workflows...").start();try{await dl(o),c.succeed("CI workflows deployed (BIDS validation, LLM enrichment, archive generation)"),a=!0}catch(_){let x=_ instanceof Error?_.message:String(_);c.fail(`CI deployment failed: ${x}`),console.log(u.dim(` After fixing the deploy failure, run 'nemar admin ci add ${o}'.`))}if(a){let _=D("Waiting for BIDS validation run to register...").start(),x=await Fj(o,_);if(x.kind==="found")_.succeed("BIDS validation run registered");else if(x.kind==="timeout")_.warn("BIDS validation run did not register within 120s; continuing (ci_check retries at approval).");else{let k=x.lastError instanceof Error?x.lastError.message:String(x.lastError);_.fail(`BIDS validation polls failed: ${k}`)}}let l=!1,d=D("Refreshing metadata + LLM enrichment...").start();try{let _=await yg(o),x=_.enrichment?.status==="ok",k=_.sync?.metadata_columns_written===!0;if(l=x&&k,l)d.succeed("Refreshed enrichment + metadata columns");else d.warn(`Partial reindex (run 'nemar admin reindex ${o}' to retry)`)}catch(_){let x=_ instanceof Error?_.message:String(_);d.warn(`Reindex failed (non-fatal): ${x}`)}if(!n.publish){console.log(u.green(`
|
|
250
250
|
Exemplar clone complete: ${s} -> ${o} (not published; re-run with --publish).`));return}if(!l)throw Error(`Refusing to publish ${o}: metadata reindex did not fully succeed, so .nemar/metadata.json may still carry the source dataset's real identity. Re-run 'nemar admin reindex ${o}' until it succeeds, then 'nemar admin publish request/approve ${o}' to publish manually.`);let f=5,p=300000,m=D("Requesting publication...").start(),h=!1;for(let _=1;_<=f;_++)try{await ug(o),h=!0;break}catch(x){let k=x instanceof Error?x.message:String(x);if(!k.includes("BIDS validation is currently running")){let v=`Failed to request publication: ${k}`;throw m.fail(v),Error(v)}if(_===f){let v=`BIDS validation still running after ${f} attempts. Re-run 'nemar admin publish request/approve ${o}' once validation completes.`;throw m.fail(v),Error(v)}m.text=`Waiting for BIDS validation to complete... (attempt ${_}/${f})`,await new Promise((v)=>setTimeout(v,p))}if(h)m.succeed("Publication requested");let g=D("Approving publication (sandbox DOI)...").start(),y=10,b=!1;for(let _=1;_<=y;_++)try{await mg(o,_>1,!0),b=!0;break}catch(x){let k=x instanceof Error?x.message:String(x);if(_<y)g.text=`Approving publication... (attempt ${_+1}/${y})`,await new Promise((v)=>setTimeout(v,3000));else{let v=`Failed to approve publication after ${y} attempts: ${k}`;throw g.fail(v),Error(v)}}if(b)g.succeed("Publication approved (sandbox DOI)");console.log(u.green(`
|
|
251
251
|
Exemplar clone + publish complete: ${s} -> ${o}`)),console.log(u.dim(` GitHub: https://github.com/${N_}/${o}`))}async function HL(e){let t=await cOt(e.xxId,e.sourceId,{workDir:e.workDir,name:e.name,description:e.description,...e.mirror!==void 0?{mirror:e.mirror}:{}}),n=await lOt(t,{includeDerived:e.includeDerived});await dOt(t,n,{publish:e.publish})}var N_="nemarDatasets",fDe="nemar",F_="nemar-dev",Up="us-east-2",hDe=16,gDe,yDe,jL="nemar-s3",qL="nemar-s3-dev",pDe="nemar-s3-source",sOt="annex-uuid";var C1=z(()=>{He();uo();rc();ze();Bi();di();cc();qt();pc();jr();b_();ps();gDe=/^xx0999\d{2}$/,yDe=/^(nm|on)\d{6}$/});import{rmSync as fOt}from"fs";function j_(e){let t=!VL(e),n=e.gitResidentData.length>0;if(t&&n)return"policy-and-data";if(n)return"data";if(t)return"policy";return"compliant"}function mOt(e){let t=new Map;for(let r of e.split(`
|
|
252
|
-
`)){let o=r.match(/^(\d+(?:\.\d+)?)s\s+(\S+)\s*(.*)$/);if(!o)continue;let[,s,i,a]=o,c=Number(s),l=a.trim(),d=t.get(i);if(!d||d.at<=c)t.set(i,{at:c,value:l})}let n=new Map;for(let[r,{value:o}]of t)if(o!=="")n.set(r,o);return n}function hOt(e){let t=[];for(let[i,a]of e.attributeContents){let c=Ld(a);if(c.stripped===0&&c.skipped.length===0)continue;t.push({path:i,rulesRemoved:c.stripped,declined:c.skipped})}t.sort((i,a)=>i.path.localeCompare(a.path));let r=(e.configLog?mOt(e.configLog):new Map).get("annex.largefiles")??null,o=[],s=[];for(let i of e.entries){if(i.mode!=="100644"&&i.mode!=="100755")continue;let a=i.size??Number.POSITIVE_INFINITY;if(!Fo(i.path,a))continue;if(a<=zL){s.push(i.path);continue}o.push({path:i.path,size:a})}return{datasetId:e.datasetId,attributeFiles:t,policyConfigured:r!==null&&Zhe(r),configuredExpression:r,gitResidentData:o,pointerSuspects:s,treeTruncated:e.treeTruncated}}function gOt(e){return e.filter((t)=>t.path===".gitattributes"||t.path.endsWith("/.gitattributes")).map((t)=>t.path).sort()}async function xDe(e={}){let t=e.baseUrl??"https://api.github.com",n=process.env.GH_TOKEN?.trim()||process.env.GITHUB_TOKEN?.trim()||"";if(!n){let{stdout:r,exitCode:o,stderr:s}=await R(["gh","auth","token"],{sensitiveOutput:!0});if(o!==0||!r.trim())throw Error(`No GitHub token available: set GH_TOKEN, or run \`gh auth login\` (gh said: ${s.trim()||`exit ${o}`}). A sweep of the fleet cannot run on the anonymous rate limit.`);n=r.trim()}return{async get(r){let o=`${t}/${r.replace(/^\//,"")}`,s="";for(let i=0;i<3;i++){let a;try{a=await fetch(o,{headers:{Authorization:`Bearer ${n}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":"nemar-cli fleet annex-policy sweep"}})}catch(c){s=c instanceof Error?c.message:String(c),await new Promise((l)=>setTimeout(l,500*(i+1)));continue}if(a.status===403||a.status===429){let c=a.headers.get("x-ratelimit-remaining"),l=a.headers.get("x-ratelimit-reset");if(c==="0"){let d=l?new Date(Number(l)*1000).toISOString():"unknown";throw new Tc(`GitHub rate limit exhausted; it resets at ${d}. Re-run the sweep after that, or narrow it with --limit.`,a.status,!0)}}if(a.status>=500||a.status===429){s=`HTTP ${a.status}`,await new Promise((c)=>setTimeout(c,500*(i+1)));continue}return{status:a.status,body:await a.text()}}throw new Tc(`GET ${r} failed after 3 attempts: ${s}`,0)}}}function wDe(e,t){let n=JSON.parse(e);if(n.encoding!=="base64"||typeof n.content!=="string")throw Error(`${t}: expected a base64 blob, got encoding=${n.encoding}`);return Buffer.from(n.content.replace(/\n/g,""),"base64").toString("utf8")}async function A1(e,t,n={}){let r=n.branch??"main",o=`repos/${pOt}/${e}`,s=await t.get(`${o}/git/trees/${r}?recursive=1`);if(s.status!==200)throw new Tc(`Could not read ${e}'s ${r} tree: HTTP ${s.status}`,s.status);let i=JSON.parse(s.body),a=(i.tree??[]).filter((p)=>p.type==="blob"),c=a.map((p)=>({path:p.path,mode:p.mode,size:p.size})),l=new Map;for(let p of gOt(c)){let m=a.find((g)=>g.path===p)?.sha;if(!m)continue;let h=await t.get(`${o}/git/blobs/${m}`);if(h.status!==200)throw new Tc(`Could not read ${e}:${p} (blob ${m.slice(0,8)}): HTTP ${h.status}`,h.status);l.set(p,wDe(h.body,`${e}:${p}`))}let d=await t.get(`${o}/contents/config.log?ref=git-annex`),f=null;if(d.status===200)f=wDe(d.body,`${e}:git-annex:config.log`);else if(d.status!==404)throw new Tc(`Could not read ${e}'s git-annex config.log: HTTP ${d.status}`,d.status);return hOt({datasetId:e,entries:c,treeTruncated:Boolean(i.truncated),attributeContents:l,configLog:f})}async function yOt(e){await R(["chmod","-R","u+w",e]),fOt(e,{recursive:!0,force:!0})}async function vDe(e,t,n){let r=await A1(e,t),o=j_(r);if(o==="compliant")return{datasetId:e,before:r,action:"compliant"};if((o==="data"||o==="policy-and-data")&&!n.includeData)return{datasetId:e,before:r,action:"skipped-has-data",notes:[`${r.gitResidentData.length} file(s) NEMAR policy calls data are in git; that needs the S3 leg (nemar admin annex-normalize ${e})`]};let s=`${n.workRoot.replace(/\/$/,"")}/${e}`;try{let i=await ZR(e,{workDir:n.workRoot,originUrl:n.originUrl});if(i.files.length>0&&!n.includeData)return{datasetId:e,before:r,action:"skipped-has-data",notes:[`the clone found ${i.files.length} data file(s) in git that the tree listing did not; re-run with --include-data or use nemar admin annex-normalize ${e}`]};let a=await e1(i,{push:n.push!==!1,credentials:n.credentials,maxBytes:n.maxBytes});if(!a.committed&&!a.pushed)return{datasetId:e,before:r,action:"compliant",committed:!1,pushed:!1,notes:[...a.notes,"the clone found nothing to change"]};let c;if(n.push!==!1)try{c=await bOt(e,t)}catch(d){if(d instanceof Tc&&d.fatal)throw d;return{datasetId:e,before:r,action:"unverified",committed:a.committed,pushed:a.pushed,notes:[...a.notes,`pushed, but the read-back could not be completed: ${d instanceof Error?d.message:String(d)}. Re-run the read-only report for this dataset to confirm.`]}}let l=[...a.notes];if(c?.remainingDeclined.length)l.push(`left alone: ${c.remainingDeclined.join(", ")} (a quoted pattern the strip will not split; fix by hand)`);return{datasetId:e,before:r,action:c===void 0||c.landed?"applied":"unverified",committed:a.committed,pushed:a.pushed,notes:l,after:c?.state}}catch(i){return{datasetId:e,before:r,action:"failed",error:i instanceof Error?i.message:String(i)}}finally{if(!n.keepClone)try{await yOt(s)}catch{}}}async function bOt(e,t,n={}){let r=n.attempts??3,o=n.delayMs??3000,s=await A1(e,t);for(let i=1;i<r;i++){if(VL(s))break;await new Promise((a)=>setTimeout(a,o)),s=await A1(e,t)}return{landed:VL(s),state:s,remainingDeclined:s.attributeFiles.filter((i)=>i.declined.length>0).map((i)=>i.path)}}function VL(e){if(e.treeTruncated)return!1;return e.policyConfigured&&e.attributeFiles.every((t)=>t.rulesRemoved===0)}function _De(e){let t={compliant:[],policy:[],"policy-and-data":[],data:[]},n=[],r=[],o=[];for(let s of e)if(s.state){if(r.push(s.state),t[j_(s.state)].push(s.datasetId),s.state.treeTruncated)o.push(s.datasetId)}else if(s.error)n.push({datasetId:s.datasetId,error:s.error});return{scanned:r.length,byLabel:t,truncated:o,failed:n,states:r}}async function kDe(e,t,n={}){let r=[];await wOt(e,n.concurrency??4,async(s)=>{try{let i=await A1(s,t);n.onResult?.({datasetId:s,state:i}),r.push({datasetId:s,state:i})}catch(i){if(i instanceof Tc&&i.fatal)throw new O1(i,_De(r));let a=i instanceof Error?i.message:String(i);n.onResult?.({datasetId:s,error:a}),r.push({datasetId:s,error:a})}});let o=new Map(e.map((s,i)=>[s,i]));return r.sort((s,i)=>(o.get(s.datasetId)??0)-(o.get(i.datasetId)??0)),_De(r)}function EDe(e,t){let n=t.prefix??"on",r=t.exclude??new Set,o=e.map((s)=>s.dataset_id).filter((s)=>s.startsWith(n)).filter((s)=>t.force||!r.has(s)).sort();return t.limit!==void 0?o.slice(0,t.limit):o}async function wOt(e,t,n){let r=Array(e.length),o=0,s=Array.from({length:Math.max(1,Math.min(t,e.length))},()=>(async()=>{while(!0){let i=o++;if(i>=e.length)return;r[i]=await n(e[i],i)}})());return await Promise.all(s),r}var pOt="nemarDatasets",zL=256,Tc,O1;var T1=z(()=>{Ui();qt();qd();t1();Tc=class Tc extends Error{status;fatal;constructor(e,t,n=!1){super(e);this.status=t;this.fatal=n;this.name="GitHubReadError"}};O1=class O1 extends Error{cause;partial;constructor(e,t){super(e.message);this.cause=e;this.partial=t;this.name="FleetSweepAborted"}}});function nPt(e){return e.replace(/\/+$/,"")}function JRe(e,t=tPt){return`${nPt(t)}/dataset/${e}`}var KRe,phn,tPt="https://nemar.org";var u3=z(()=>{KRe=["IsCitedBy","Cites","IsSupplementTo","IsSupplementedBy","IsContinuedBy","Continues","IsDescribedBy","Describes","HasMetadata","IsMetadataFor","HasVersion","IsVersionOf","IsNewVersionOf","IsPreviousVersionOf","IsPartOf","HasPart","IsReferencedBy","References","IsDocumentedBy","Documents","IsCompiledBy","Compiles","IsVariantFormOf","IsOriginalFormOf","IsIdenticalTo","IsCollectedBy","Collects","IsRequiredBy","Requires","IsObsoletedBy","Obsoletes","IsDerivedFrom","IsSourceOf","IsReviewedBy","Reviews","IsPublishedIn","HasTranslation","IsTranslationOf"],phn=new Set(KRe)});var DCe=()=>{};function RCe(e){return e.replace(/^(doi:|https?:\/\/(dx\.)?doi\.org\/)/i,"").trim()}function CCe(e){let t=e.split(",").map((n)=>n.trim());if(t.length>=2)return{name:e,familyName:t[0],givenName:t.slice(1).join(", ")};return{name:e}}var ACe=z(()=>{u3();Fi();DCe()});function rNt(e){let t=e,n=(t.match(/\(/g)??[]).length,r=(t.match(/\)/g)??[]).length;while(r>n&&t.endsWith(")"))t=t.slice(0,-1),r-=1;return t}function OCe(e){let t=e.trim().replace(/^(?:doi:|https?:\/\/(?:dx\.)?doi\.org\/)/i,""),n;do n=t,t=rNt(t).replace(/[.,;:]+$/,"").trim();while(t!==n);return t.toLowerCase()}var TCe=()=>{};function cNt(e){if(iNt.has(e))return"absent";return e>=200&&e<300?"found":"failed"}function lNt(e){let t=e instanceof Error?`${e.name} ${e.message}`:String(e);return/AbortError|TimeoutError|timeout|fetch|network/i.test(t)}async function uNt(e,t,n){let{base:r,accept:o}=aNt[e],s=AbortSignal.timeout(sNt);try{let i=await fetch(`${r}/${encodeURIComponent(t)}`,{headers:{Accept:o,"User-Agent":oNt},signal:n?AbortSignal.any([s,n]):s}),a=cNt(i.status);if(a==="absent")return{outcome:"absent"};if(a==="failed"){let c=`HTTP ${i.status}`;return console.warn(`[doi-registry] ${e} returned ${c} for ${t}`),{outcome:"failed",detail:c}}return{outcome:"found",body:await i.json()}}catch(i){if(n?.aborted)return{outcome:"failed",detail:"deadline reached"};let a=i instanceof Error?i.message:String(i);if(lNt(i))console.warn(`[doi-registry] ${e} lookup failed for ${t}: ${a}`);else console.error(`[doi-registry] Unexpected error querying ${e} for ${t}:`,i);return{outcome:"failed",detail:a}}}function z3(e,t,n,r){let o=OCe(t),s=`${e}:${o}`,i=n?.get(s);if(i)return i;if(r?.aborted)return Promise.resolve({outcome:"failed",detail:"deadline reached"});let a=uNt(e,o,r);if(n){if(n.set(s,a),r)a.then((c)=>{if(c.outcome==="failed"&&r.aborted&&n.get(s)===a)n.delete(s)})}return a}var oNt="NEMAR/1.0 (https://nemar.org; mailto:nemar@ucsd.edu)",sNt=1e4,iNt,aNt;var PCe=z(()=>{TCe();iNt=new Set([400,404,410]),aNt={DataCite:{base:"https://api.datacite.org/application/vnd.datacite.datacite+json",accept:"application/vnd.datacite.datacite+json"},Crossref:{base:"https://api.crossref.org/works",accept:"application/json"}}});function pNt(e){let t=[],n=new Set,r=(o,s)=>{let i=RCe(o).trim();if(dNt.test(i)&&!n.has(i))n.add(i),t.push({doi:i,source:s})};if(Array.isArray(e.SourceDatasets))for(let o of e.SourceDatasets){if(!o||typeof o!=="object")continue;let s=o;if(typeof s.DOI==="string")r(s.DOI,"SourceDatasets");else if(typeof s.URL==="string"){let i=s.URL.match(/(?:doi\.org\/|doi:)(10\.\d{4,}\/.+)/);if(i)r(i[1],"SourceDatasets")}}if(Array.isArray(e.ReferencesAndLinks))for(let o of e.ReferencesAndLinks){if(typeof o!=="string"||!o)continue;let s=o.match(/(?:doi\.org\/|^)(10\.\d{4,}\/[^\s]+)/);if(s)r(s[1],"ReferencesAndLinks")}if(typeof e.HowToAcknowledge==="string"){let s=e.HowToAcknowledge.matchAll(/(?:doi\.org\/|(?<=\s|^))(10\.\d{4,}\/[^\s,)]+)/g);for(let i of s)r(i[1].replace(/[.;:]+$/,""),"HowToAcknowledge")}return t}async function mNt(e,t){let n=await z3("DataCite",e,t);if(n.outcome!=="found")return null;let r=n.body;return{doi:e,creators:Array.isArray(r?.creators)?r.creators.map((o)=>({...o})):[]}}async function hNt(e,t){let n=await z3("Crossref",e,t);if(n.outcome!=="found")return null;let o=n.body?.message?.author;if(!Array.isArray(o)||o.length===0)return null;let s=o.map((i)=>{let a=[];if(i.ORCID)a.push({nameIdentifier:i.ORCID,nameIdentifierScheme:"ORCID"});return{name:i.family&&i.given?`${i.family}, ${i.given}`:i.name||i.family||"",givenName:i.given,familyName:i.family,nameIdentifiers:a,affiliation:(i.affiliation||[]).filter((c)=>c.name)}}).filter((i)=>i.name.trim()!=="");return{doi:e,creators:s}}async function gNt(e,t){let n=await mNt(e,t),r=await hNt(e,t);if(!n)return r;if(!r)return n;for(let o of n.creators){if(o.nameIdentifiers?.some((c)=>c.nameIdentifierScheme==="ORCID")||!o.familyName)continue;let a=r.creators.find((c)=>c.familyName&&Si(c.familyName)===Si(o.familyName))?.nameIdentifiers?.find((c)=>c.nameIdentifierScheme==="ORCID");if(a)o.nameIdentifiers=[...o.nameIdentifiers??[],a]}return n}function Si(e){return e.normalize("NFD").replace(/\p{Diacritic}/gu,"").replace(/\./g,"").toLowerCase().trim()}function ICe(e){if(!e)return"";return Si(e).charAt(0)}function yNt(e,t){let n=[],r=new Set,o=new Set,s=t.map((i)=>({original:i,parsed:CCe(i)}));for(let i=0;i<e.length;i++){if(o.has(i))continue;let a=e[i],c=Si(a.name);for(let l of s){if(r.has(l.original))continue;if(Si(l.original)===c){n.push({bidsAuthor:l.original,matchedCreator:a,confidence:"exact"}),r.add(l.original),o.add(i);break}if(l.parsed.familyName&&l.parsed.givenName){if(Si(`${l.parsed.givenName} ${l.parsed.familyName}`)===c){n.push({bidsAuthor:l.original,matchedCreator:a,confidence:"exact"}),r.add(l.original),o.add(i);break}}if(a.givenName&&a.familyName){let d=Si(`${a.givenName} ${a.familyName}`);if(Si(l.original)===d){n.push({bidsAuthor:l.original,matchedCreator:a,confidence:"exact"}),r.add(l.original),o.add(i);break}}}}for(let i=0;i<e.length;i++){if(o.has(i))continue;let a=e[i];if(!a.familyName)continue;let c=Si(a.familyName),l=ICe(a.givenName);for(let d of s){if(r.has(d.original))continue;if(!d.parsed.familyName)continue;if(Si(d.parsed.familyName)!==c)continue;let p=ICe(d.parsed.givenName);if(p&&l&&p===l){n.push({bidsAuthor:d.original,matchedCreator:a,confidence:"high"}),r.add(d.original),o.add(i);break}}}for(let i=0;i<e.length;i++){if(o.has(i))continue;let a=e[i];if(!a.familyName)continue;let c=Si(a.familyName);for(let l of s){if(r.has(l.original))continue;if(!l.parsed.familyName)continue;if(Si(l.parsed.familyName)===c){n.push({bidsAuthor:l.original,matchedCreator:a,confidence:"medium"}),r.add(l.original),o.add(i);break}}}return n}async function FCe(e,t,n,r){let o=pNt(e);if(n?.length)o.push(...n);if(o.length===0)return{discoveries:{},unresolvedDois:[],totalDoisQueried:0};let s=Array.isArray(e.Authors)?e.Authors.filter((f)=>typeof f==="string"):[];if(s.length===0)return{discoveries:{},unresolvedDois:[],totalDoisQueried:o.length};let i=new Set;if(t){for(let[f,p]of Object.entries(t))if(p.orcid)i.add(f)}let a=s.filter((f)=>!i.has(f));if(a.length===0)return{discoveries:{},unresolvedDois:[],totalDoisQueried:o.length};let c=[],l=new Map;for(let f=0;f<o.length;f+=NCe){let p=o.slice(f,f+NCe),m=await Promise.all(p.map((h)=>gNt(h.doi,r)));for(let h=0;h<p.length;h++)if(m[h])l.set(p[h].doi,m[h]?.creators??[]);else c.push(p[h].doi)}let d={};for(let[f,p]of l){let m=p.filter((g)=>g.nameIdentifiers?.some((y)=>y.nameIdentifierScheme==="ORCID"));if(m.length===0)continue;let h=yNt(m,a);for(let g of h){if(d[g.bidsAuthor])continue;let y=g.matchedCreator.nameIdentifiers.find((x)=>x.nameIdentifierScheme==="ORCID");if(!y)continue;let b=y.nameIdentifier.replace(/^https?:\/\/orcid\.org\//i,"").trim();if(!fNt.test(b))continue;let _=g.matchedCreator.affiliation?.filter((x)=>x.name).map((x)=>({name:x.name,...x.affiliationIdentifier&&{identifier:x.affiliationIdentifier},...x.affiliationIdentifierScheme&&{scheme:x.affiliationIdentifierScheme}}));d[g.bidsAuthor]={orcid:b,affiliations:_?.length?_:void 0,sourceDoi:f,confidence:g.confidence}}}return{discoveries:d,unresolvedDois:c,totalDoisQueried:o.length}}var dNt,fNt,NCe=5;var MCe=z(()=>{ACe();PCe();dNt=/^10\.\d{4,}\/[^\s]+$/,fNt=/^\d{4}-\d{4}-\d{4}-[\dX]{4}$/});var LC={};vq(LC,{program:()=>Jq,createCommand:()=>Yq,createOption:()=>Xq,createArgument:()=>Qq,Command:()=>Zq,Option:()=>e4,Argument:()=>t4,Help:()=>n4,CommanderError:()=>r4,InvalidArgumentError:()=>o4,InvalidOptionArgumentError:()=>s4},{program:(HFt)=>Jq=HFt,createCommand:(HFt)=>Yq=HFt,createOption:(HFt)=>Xq=HFt,createArgument:(HFt)=>Qq=HFt,Command:(HFt)=>Zq=HFt,Option:(HFt)=>e4=HFt,Argument:(HFt)=>t4=HFt,Help:(HFt)=>n4=HFt,CommanderError:(HFt)=>r4=HFt,InvalidArgumentError:(HFt)=>o4=HFt,InvalidOptionArgumentError:(HFt)=>s4=HFt});He();var{Argument:Gq}=cx(),{Command:jC}=zq(),{CommanderError:X2e,InvalidArgumentError:Wq}=jy(),{Help:Q2e}=IC(),{Option:Kq}=NC();var Jq=new jC,Yq=(e)=>new jC(e),Xq=(e,t)=>new Kq(e,t),Qq=(e,t)=>new Gq(e,t),Zq=jC,e4=Kq,t4=Gq,n4=Q2e,r4=X2e,o4=Wq,s4=Wq;var{program:zFt,createCommand:GFt,createArgument:WFt,createOption:KFt,CommanderError:JFt,InvalidArgumentError:Us,InvalidOptionArgumentError:YFt,Command:de,Argument:XFt,Option:tm,Help:QFt}=LC;var qC={dataset:["search","download","upload","validate","status","list"],admin:["users","approve","revoke","publish","pr-reviews","mail","doi","make-public","delete-dataset","notify","doctor"]};var BC=process.argv.includes("--help-all");if(process.argv.includes("--no-color"))u.level=0;var i4=process.argv.indexOf("--help-all");if(i4!==-1)process.argv[i4]="--help";var Ly=de.prototype.addHelpText,a4=`
|
|
252
|
+
`)){let o=r.match(/^(\d+(?:\.\d+)?)s\s+(\S+)\s*(.*)$/);if(!o)continue;let[,s,i,a]=o,c=Number(s),l=a.trim(),d=t.get(i);if(!d||d.at<=c)t.set(i,{at:c,value:l})}let n=new Map;for(let[r,{value:o}]of t)if(o!=="")n.set(r,o);return n}function hOt(e){let t=[];for(let[i,a]of e.attributeContents){let c=Ld(a);if(c.stripped===0&&c.skipped.length===0)continue;t.push({path:i,rulesRemoved:c.stripped,declined:c.skipped})}t.sort((i,a)=>i.path.localeCompare(a.path));let r=(e.configLog?mOt(e.configLog):new Map).get("annex.largefiles")??null,o=[],s=[];for(let i of e.entries){if(i.mode!=="100644"&&i.mode!=="100755")continue;let a=i.size??Number.POSITIVE_INFINITY;if(!Fo(i.path,a))continue;if(a<=zL){s.push(i.path);continue}o.push({path:i.path,size:a})}return{datasetId:e.datasetId,attributeFiles:t,policyConfigured:r!==null&&Zhe(r),configuredExpression:r,gitResidentData:o,pointerSuspects:s,treeTruncated:e.treeTruncated}}function gOt(e){return e.filter((t)=>t.path===".gitattributes"||t.path.endsWith("/.gitattributes")).map((t)=>t.path).sort()}async function xDe(e={}){let t=e.baseUrl??"https://api.github.com",n=process.env.GH_TOKEN?.trim()||process.env.GITHUB_TOKEN?.trim()||"";if(!n){let{stdout:r,exitCode:o,stderr:s}=await R(["gh","auth","token"],{sensitiveOutput:!0});if(o!==0||!r.trim())throw Error(`No GitHub token available: set GH_TOKEN, or run \`gh auth login\` (gh said: ${s.trim()||`exit ${o}`}). A sweep of the fleet cannot run on the anonymous rate limit.`);n=r.trim()}return{async get(r){let o=`${t}/${r.replace(/^\//,"")}`,s="";for(let i=0;i<3;i++){let a;try{a=await fetch(o,{headers:{Authorization:`Bearer ${n}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":"nemar-cli fleet annex-policy sweep"}})}catch(c){s=c instanceof Error?c.message:String(c),await new Promise((l)=>setTimeout(l,500*(i+1)));continue}if(a.status===403||a.status===429){let c=a.headers.get("x-ratelimit-remaining"),l=a.headers.get("x-ratelimit-reset");if(c==="0"){let d=l?new Date(Number(l)*1000).toISOString():"unknown";throw new Tc(`GitHub rate limit exhausted; it resets at ${d}. Re-run the sweep after that, or narrow it with --limit.`,a.status,!0)}}if(a.status>=500||a.status===429){s=`HTTP ${a.status}`,await new Promise((c)=>setTimeout(c,500*(i+1)));continue}return{status:a.status,body:await a.text()}}throw new Tc(`GET ${r} failed after 3 attempts: ${s}`,0)}}}function wDe(e,t){let n=JSON.parse(e);if(n.encoding!=="base64"||typeof n.content!=="string")throw Error(`${t}: expected a base64 blob, got encoding=${n.encoding}`);return Buffer.from(n.content.replace(/\n/g,""),"base64").toString("utf8")}async function A1(e,t,n={}){let r=n.branch??"main",o=`repos/${pOt}/${e}`,s=await t.get(`${o}/git/trees/${r}?recursive=1`);if(s.status!==200)throw new Tc(`Could not read ${e}'s ${r} tree: HTTP ${s.status}`,s.status);let i=JSON.parse(s.body),a=(i.tree??[]).filter((p)=>p.type==="blob"),c=a.map((p)=>({path:p.path,mode:p.mode,size:p.size})),l=new Map;for(let p of gOt(c)){let m=a.find((g)=>g.path===p)?.sha;if(!m)continue;let h=await t.get(`${o}/git/blobs/${m}`);if(h.status!==200)throw new Tc(`Could not read ${e}:${p} (blob ${m.slice(0,8)}): HTTP ${h.status}`,h.status);l.set(p,wDe(h.body,`${e}:${p}`))}let d=await t.get(`${o}/contents/config.log?ref=git-annex`),f=null;if(d.status===200)f=wDe(d.body,`${e}:git-annex:config.log`);else if(d.status!==404)throw new Tc(`Could not read ${e}'s git-annex config.log: HTTP ${d.status}`,d.status);return hOt({datasetId:e,entries:c,treeTruncated:Boolean(i.truncated),attributeContents:l,configLog:f})}async function yOt(e){await R(["chmod","-R","u+w",e]),fOt(e,{recursive:!0,force:!0})}async function vDe(e,t,n){let r=await A1(e,t),o=j_(r);if(o==="compliant")return{datasetId:e,before:r,action:"compliant"};if((o==="data"||o==="policy-and-data")&&!n.includeData)return{datasetId:e,before:r,action:"skipped-has-data",notes:[`${r.gitResidentData.length} file(s) NEMAR policy calls data are in git; that needs the S3 leg (nemar admin annex-normalize ${e})`]};let s=`${n.workRoot.replace(/\/$/,"")}/${e}`;try{let i=await ZR(e,{workDir:n.workRoot,originUrl:n.originUrl});if(i.files.length>0&&!n.includeData)return{datasetId:e,before:r,action:"skipped-has-data",notes:[`the clone found ${i.files.length} data file(s) in git that the tree listing did not; re-run with --include-data or use nemar admin annex-normalize ${e}`]};let a=await e1(i,{push:n.push!==!1,credentials:n.credentials,maxBytes:n.maxBytes});if(!a.committed&&!a.pushed)return{datasetId:e,before:r,action:"compliant",committed:!1,pushed:!1,notes:[...a.notes,"the clone found nothing to change"]};let c;if(n.push!==!1)try{c=await bOt(e,t)}catch(d){if(d instanceof Tc&&d.fatal)throw d;return{datasetId:e,before:r,action:"unverified",committed:a.committed,pushed:a.pushed,notes:[...a.notes,`pushed, but the read-back could not be completed: ${d instanceof Error?d.message:String(d)}. Re-run the read-only report for this dataset to confirm.`]}}let l=[...a.notes];if(c?.remainingDeclined.length)l.push(`left alone: ${c.remainingDeclined.join(", ")} (a quoted pattern the strip will not split; fix by hand)`);return{datasetId:e,before:r,action:c===void 0||c.landed?"applied":"unverified",committed:a.committed,pushed:a.pushed,notes:l,after:c?.state}}catch(i){return{datasetId:e,before:r,action:"failed",error:i instanceof Error?i.message:String(i)}}finally{if(!n.keepClone)try{await yOt(s)}catch{}}}async function bOt(e,t,n={}){let r=n.attempts??3,o=n.delayMs??3000,s=await A1(e,t);for(let i=1;i<r;i++){if(VL(s))break;await new Promise((a)=>setTimeout(a,o)),s=await A1(e,t)}return{landed:VL(s),state:s,remainingDeclined:s.attributeFiles.filter((i)=>i.declined.length>0).map((i)=>i.path)}}function VL(e){if(e.treeTruncated)return!1;return e.policyConfigured&&e.attributeFiles.every((t)=>t.rulesRemoved===0)}function _De(e){let t={compliant:[],policy:[],"policy-and-data":[],data:[]},n=[],r=[],o=[];for(let s of e)if(s.state){if(r.push(s.state),t[j_(s.state)].push(s.datasetId),s.state.treeTruncated)o.push(s.datasetId)}else if(s.error)n.push({datasetId:s.datasetId,error:s.error});return{scanned:r.length,byLabel:t,truncated:o,failed:n,states:r}}async function kDe(e,t,n={}){let r=[];await wOt(e,n.concurrency??4,async(s)=>{try{let i=await A1(s,t);n.onResult?.({datasetId:s,state:i}),r.push({datasetId:s,state:i})}catch(i){if(i instanceof Tc&&i.fatal)throw new O1(i,_De(r));let a=i instanceof Error?i.message:String(i);n.onResult?.({datasetId:s,error:a}),r.push({datasetId:s,error:a})}});let o=new Map(e.map((s,i)=>[s,i]));return r.sort((s,i)=>(o.get(s.datasetId)??0)-(o.get(i.datasetId)??0)),_De(r)}function EDe(e,t){let n=t.prefix??"on",r=t.exclude??new Set,o=e.map((s)=>s.dataset_id).filter((s)=>s.startsWith(n)).filter((s)=>t.force||!r.has(s)).sort();return t.limit!==void 0?o.slice(0,t.limit):o}async function wOt(e,t,n){let r=Array(e.length),o=0,s=Array.from({length:Math.max(1,Math.min(t,e.length))},()=>(async()=>{while(!0){let i=o++;if(i>=e.length)return;r[i]=await n(e[i],i)}})());return await Promise.all(s),r}var pOt="nemarDatasets",zL=256,Tc,O1;var T1=z(()=>{Ui();qt();qd();t1();Tc=class Tc extends Error{status;fatal;constructor(e,t,n=!1){super(e);this.status=t;this.fatal=n;this.name="GitHubReadError"}};O1=class O1 extends Error{cause;partial;constructor(e,t){super(e.message);this.cause=e;this.partial=t;this.name="FleetSweepAborted"}}});function nPt(e){return e.replace(/\/+$/,"")}function JRe(e,t=tPt){return`${nPt(t)}/dataset/${e}`}var KRe,phn,tPt="https://nemar.org";var uq=z(()=>{KRe=["IsCitedBy","Cites","IsSupplementTo","IsSupplementedBy","IsContinuedBy","Continues","IsDescribedBy","Describes","HasMetadata","IsMetadataFor","HasVersion","IsVersionOf","IsNewVersionOf","IsPreviousVersionOf","IsPartOf","HasPart","IsReferencedBy","References","IsDocumentedBy","Documents","IsCompiledBy","Compiles","IsVariantFormOf","IsOriginalFormOf","IsIdenticalTo","IsCollectedBy","Collects","IsRequiredBy","Requires","IsObsoletedBy","Obsoletes","IsDerivedFrom","IsSourceOf","IsReviewedBy","Reviews","IsPublishedIn","HasTranslation","IsTranslationOf"],phn=new Set(KRe)});var DCe=()=>{};function RCe(e){return e.replace(/^(doi:|https?:\/\/(dx\.)?doi\.org\/)/i,"").trim()}function CCe(e){let t=e.split(",").map((n)=>n.trim());if(t.length>=2)return{name:e,familyName:t[0],givenName:t.slice(1).join(", ")};return{name:e}}var ACe=z(()=>{uq();Fi();DCe()});function rNt(e){let t=e,n=(t.match(/\(/g)??[]).length,r=(t.match(/\)/g)??[]).length;while(r>n&&t.endsWith(")"))t=t.slice(0,-1),r-=1;return t}function OCe(e){let t=e.trim().replace(/^(?:doi:|https?:\/\/(?:dx\.)?doi\.org\/)/i,""),n;do n=t,t=rNt(t).replace(/[.,;:]+$/,"").trim();while(t!==n);return t.toLowerCase()}var TCe=()=>{};function cNt(e){if(iNt.has(e))return"absent";return e>=200&&e<300?"found":"failed"}function lNt(e){let t=e instanceof Error?`${e.name} ${e.message}`:String(e);return/AbortError|TimeoutError|timeout|fetch|network/i.test(t)}async function uNt(e,t,n){let{base:r,accept:o}=aNt[e],s=AbortSignal.timeout(sNt);try{let i=await fetch(`${r}/${encodeURIComponent(t)}`,{headers:{Accept:o,"User-Agent":oNt},signal:n?AbortSignal.any([s,n]):s}),a=cNt(i.status);if(a==="absent")return{outcome:"absent"};if(a==="failed"){let c=`HTTP ${i.status}`;return console.warn(`[doi-registry] ${e} returned ${c} for ${t}`),{outcome:"failed",detail:c}}return{outcome:"found",body:await i.json()}}catch(i){if(n?.aborted)return{outcome:"failed",detail:"deadline reached"};let a=i instanceof Error?i.message:String(i);if(lNt(i))console.warn(`[doi-registry] ${e} lookup failed for ${t}: ${a}`);else console.error(`[doi-registry] Unexpected error querying ${e} for ${t}:`,i);return{outcome:"failed",detail:a}}}function zq(e,t,n,r){let o=OCe(t),s=`${e}:${o}`,i=n?.get(s);if(i)return i;if(r?.aborted)return Promise.resolve({outcome:"failed",detail:"deadline reached"});let a=uNt(e,o,r);if(n){if(n.set(s,a),r)a.then((c)=>{if(c.outcome==="failed"&&r.aborted&&n.get(s)===a)n.delete(s)})}return a}var oNt="NEMAR/1.0 (https://nemar.org; mailto:nemar@ucsd.edu)",sNt=1e4,iNt,aNt;var PCe=z(()=>{TCe();iNt=new Set([400,404,410]),aNt={DataCite:{base:"https://api.datacite.org/application/vnd.datacite.datacite+json",accept:"application/vnd.datacite.datacite+json"},Crossref:{base:"https://api.crossref.org/works",accept:"application/json"}}});function pNt(e){let t=[],n=new Set,r=(o,s)=>{let i=RCe(o).trim();if(dNt.test(i)&&!n.has(i))n.add(i),t.push({doi:i,source:s})};if(Array.isArray(e.SourceDatasets))for(let o of e.SourceDatasets){if(!o||typeof o!=="object")continue;let s=o;if(typeof s.DOI==="string")r(s.DOI,"SourceDatasets");else if(typeof s.URL==="string"){let i=s.URL.match(/(?:doi\.org\/|doi:)(10\.\d{4,}\/.+)/);if(i)r(i[1],"SourceDatasets")}}if(Array.isArray(e.ReferencesAndLinks))for(let o of e.ReferencesAndLinks){if(typeof o!=="string"||!o)continue;let s=o.match(/(?:doi\.org\/|^)(10\.\d{4,}\/[^\s]+)/);if(s)r(s[1],"ReferencesAndLinks")}if(typeof e.HowToAcknowledge==="string"){let s=e.HowToAcknowledge.matchAll(/(?:doi\.org\/|(?<=\s|^))(10\.\d{4,}\/[^\s,)]+)/g);for(let i of s)r(i[1].replace(/[.;:]+$/,""),"HowToAcknowledge")}return t}async function mNt(e,t){let n=await zq("DataCite",e,t);if(n.outcome!=="found")return null;let r=n.body;return{doi:e,creators:Array.isArray(r?.creators)?r.creators.map((o)=>({...o})):[]}}async function hNt(e,t){let n=await zq("Crossref",e,t);if(n.outcome!=="found")return null;let o=n.body?.message?.author;if(!Array.isArray(o)||o.length===0)return null;let s=o.map((i)=>{let a=[];if(i.ORCID)a.push({nameIdentifier:i.ORCID,nameIdentifierScheme:"ORCID"});return{name:i.family&&i.given?`${i.family}, ${i.given}`:i.name||i.family||"",givenName:i.given,familyName:i.family,nameIdentifiers:a,affiliation:(i.affiliation||[]).filter((c)=>c.name)}}).filter((i)=>i.name.trim()!=="");return{doi:e,creators:s}}async function gNt(e,t){let n=await mNt(e,t),r=await hNt(e,t);if(!n)return r;if(!r)return n;for(let o of n.creators){if(o.nameIdentifiers?.some((c)=>c.nameIdentifierScheme==="ORCID")||!o.familyName)continue;let a=r.creators.find((c)=>c.familyName&&Si(c.familyName)===Si(o.familyName))?.nameIdentifiers?.find((c)=>c.nameIdentifierScheme==="ORCID");if(a)o.nameIdentifiers=[...o.nameIdentifiers??[],a]}return n}function Si(e){return e.normalize("NFD").replace(/\p{Diacritic}/gu,"").replace(/\./g,"").toLowerCase().trim()}function ICe(e){if(!e)return"";return Si(e).charAt(0)}function yNt(e,t){let n=[],r=new Set,o=new Set,s=t.map((i)=>({original:i,parsed:CCe(i)}));for(let i=0;i<e.length;i++){if(o.has(i))continue;let a=e[i],c=Si(a.name);for(let l of s){if(r.has(l.original))continue;if(Si(l.original)===c){n.push({bidsAuthor:l.original,matchedCreator:a,confidence:"exact"}),r.add(l.original),o.add(i);break}if(l.parsed.familyName&&l.parsed.givenName){if(Si(`${l.parsed.givenName} ${l.parsed.familyName}`)===c){n.push({bidsAuthor:l.original,matchedCreator:a,confidence:"exact"}),r.add(l.original),o.add(i);break}}if(a.givenName&&a.familyName){let d=Si(`${a.givenName} ${a.familyName}`);if(Si(l.original)===d){n.push({bidsAuthor:l.original,matchedCreator:a,confidence:"exact"}),r.add(l.original),o.add(i);break}}}}for(let i=0;i<e.length;i++){if(o.has(i))continue;let a=e[i];if(!a.familyName)continue;let c=Si(a.familyName),l=ICe(a.givenName);for(let d of s){if(r.has(d.original))continue;if(!d.parsed.familyName)continue;if(Si(d.parsed.familyName)!==c)continue;let p=ICe(d.parsed.givenName);if(p&&l&&p===l){n.push({bidsAuthor:d.original,matchedCreator:a,confidence:"high"}),r.add(d.original),o.add(i);break}}}for(let i=0;i<e.length;i++){if(o.has(i))continue;let a=e[i];if(!a.familyName)continue;let c=Si(a.familyName);for(let l of s){if(r.has(l.original))continue;if(!l.parsed.familyName)continue;if(Si(l.parsed.familyName)===c){n.push({bidsAuthor:l.original,matchedCreator:a,confidence:"medium"}),r.add(l.original),o.add(i);break}}}return n}async function FCe(e,t,n,r){let o=pNt(e);if(n?.length)o.push(...n);if(o.length===0)return{discoveries:{},unresolvedDois:[],totalDoisQueried:0};let s=Array.isArray(e.Authors)?e.Authors.filter((f)=>typeof f==="string"):[];if(s.length===0)return{discoveries:{},unresolvedDois:[],totalDoisQueried:o.length};let i=new Set;if(t){for(let[f,p]of Object.entries(t))if(p.orcid)i.add(f)}let a=s.filter((f)=>!i.has(f));if(a.length===0)return{discoveries:{},unresolvedDois:[],totalDoisQueried:o.length};let c=[],l=new Map;for(let f=0;f<o.length;f+=NCe){let p=o.slice(f,f+NCe),m=await Promise.all(p.map((h)=>gNt(h.doi,r)));for(let h=0;h<p.length;h++)if(m[h])l.set(p[h].doi,m[h]?.creators??[]);else c.push(p[h].doi)}let d={};for(let[f,p]of l){let m=p.filter((g)=>g.nameIdentifiers?.some((y)=>y.nameIdentifierScheme==="ORCID"));if(m.length===0)continue;let h=yNt(m,a);for(let g of h){if(d[g.bidsAuthor])continue;let y=g.matchedCreator.nameIdentifiers.find((x)=>x.nameIdentifierScheme==="ORCID");if(!y)continue;let b=y.nameIdentifier.replace(/^https?:\/\/orcid\.org\//i,"").trim();if(!fNt.test(b))continue;let _=g.matchedCreator.affiliation?.filter((x)=>x.name).map((x)=>({name:x.name,...x.affiliationIdentifier&&{identifier:x.affiliationIdentifier},...x.affiliationIdentifierScheme&&{scheme:x.affiliationIdentifierScheme}}));d[g.bidsAuthor]={orcid:b,affiliations:_?.length?_:void 0,sourceDoi:f,confidence:g.confidence}}}return{discoveries:d,unresolvedDois:c,totalDoisQueried:o.length}}var dNt,fNt,NCe=5;var MCe=z(()=>{ACe();PCe();dNt=/^10\.\d{4,}\/[^\s]+$/,fNt=/^\d{4}-\d{4}-\d{4}-[\dX]{4}$/});var LC={};v3(LC,{program:()=>J3,createCommand:()=>Y3,createOption:()=>X3,createArgument:()=>Q3,Command:()=>Z3,Option:()=>e4,Argument:()=>t4,Help:()=>n4,CommanderError:()=>r4,InvalidArgumentError:()=>o4,InvalidOptionArgumentError:()=>s4},{program:(HFt)=>J3=HFt,createCommand:(HFt)=>Y3=HFt,createOption:(HFt)=>X3=HFt,createArgument:(HFt)=>Q3=HFt,Command:(HFt)=>Z3=HFt,Option:(HFt)=>e4=HFt,Argument:(HFt)=>t4=HFt,Help:(HFt)=>n4=HFt,CommanderError:(HFt)=>r4=HFt,InvalidArgumentError:(HFt)=>o4=HFt,InvalidOptionArgumentError:(HFt)=>s4=HFt});He();var{Argument:G3}=cx(),{Command:jC}=z3(),{CommanderError:X2e,InvalidArgumentError:W3}=jy(),{Help:Q2e}=IC(),{Option:K3}=NC();var J3=new jC,Y3=(e)=>new jC(e),X3=(e,t)=>new K3(e,t),Q3=(e,t)=>new G3(e,t),Z3=jC,e4=K3,t4=G3,n4=Q2e,r4=X2e,o4=W3,s4=W3;var{program:zFt,createCommand:GFt,createArgument:WFt,createOption:KFt,CommanderError:JFt,InvalidArgumentError:Us,InvalidOptionArgumentError:YFt,Command:de,Argument:XFt,Option:tm,Help:QFt}=LC;var qC={dataset:["search","download","upload","validate","status","list"],admin:["users","approve","revoke","publish","pr-reviews","mail","doi","make-public","delete-dataset","notify","doctor"]};var BC=process.argv.includes("--help-all");if(process.argv.includes("--no-color"))u.level=0;var i4=process.argv.indexOf("--help-all");if(i4!==-1)process.argv[i4]="--help";var Ly=de.prototype.addHelpText,a4=`
|
|
253
253
|
Run with --help-all for examples and detailed descriptions.
|
|
254
254
|
`,lx=new WeakSet;de.prototype.addHelpText=function(e,t){if(e==="after"||e==="afterAll"){if(BC)return Ly.call(this,e,t);if(!lx.has(this))return lx.add(this),Ly.call(this,e,a4);return this}return Ly.call(this,e,t)};function Z2e(e){let t=[];for(let n=e;n?.parent;n=n.parent)t.unshift(n.name());return t.join(" ")}function nr(e){let t=[];for(let n=e;n;n=n.parent)t.unshift(n.name());return t.join(" ")}var eOe={formatHelp(e,t){let n=t.helpWidth??80,r=2,o=2,s=40,i=Math.max(8,n-2-2-40),a=(T)=>Math.min(i,T.reduce((V,A)=>Math.max(V,A.length),0));function c(T,V,A,F){if(!A)return V;let M=F+2;if(T.length>F){let O=t.wrap(A,n-2-4,0);return`${V}
|
|
255
255
|
${O.replace(/^/gm," ")}`}let U=" ".repeat(Math.max(0,M-T.length)),B=`${T}${U}${A}`,P=t.wrap(B,n-2,M);return V+P.slice(T.length)}function l(T){return T.join(`
|
|
@@ -343,7 +343,7 @@ ${p.join(`
|
|
|
343
343
|
`),text:m}}rc();ze();fn();import{spawn as Lbt}from"child_process";function qbt(e,t){if(e==="darwin")return{command:"open",args:[t]};if(e==="win32")return{command:"cmd",args:["/c","start","",t]};if(e==="linux")return{command:"xdg-open",args:[t]};return null}function Rg(e){if(process.env.NEMAR_NO_BROWSER==="1")return!1;let t=qbt(process.platform,e);if(!t)return!1;try{let n=Lbt(t.command,t.args,{stdio:"ignore",detached:!0});return n.on("error",(r)=>{$n(`openInBrowser: ${t.command} failed: ${r instanceof Error?r.message:r}`)}),n.unref(),!0}catch(n){return $n(`openInBrowser: could not spawn ${t.command}: ${n instanceof Error?n.message:n}`),!1}}xr();fn();qt();var fs="nemarDatasets",np=20000,z0e=15000;function F$(e,t){return`https://github.com/${fs}/${e}/pull/${t}`}function W0e(e,t){return`gh pr review ${t} --repo ${fs}/${e} --approve`}function bn(e=process.env){let t=e.NEMAR_GITHUB_API_URL?.trim();if(!t)return"https://api.github.com";try{let n=new URL(t),r=["127.0.0.1","localhost","[::1]"].includes(n.hostname);if(n.protocol==="http:"&&r)return t.replace(/\/+$/,"")}catch{}throw Error("NEMAR_GITHUB_API_URL is set but is not an http://127.0.0.1, http://localhost or http://[::1] address. It is only for tests, so it is refused rather than ignored; unset it to use GitHub.")}async function hi(e=process.env,t=R){let n=e.GH_TOKEN?.trim();if(n)return{ok:!0,token:n,source:"GH_TOKEN"};try{let{stdout:r,exitCode:o,stderr:s,timedOut:i}=await t(["gh","auth","token","--hostname","github.com"],{unsetEnv:["GH_TOKEN","GITHUB_TOKEN"],timeout:z0e,sensitiveOutput:!0});if(i)return{ok:!1,reason:`gh did not answer within ${z0e/1000} seconds (a locked keyring waiting for a prompt?). Set GH_TOKEN, or run 'gh auth status'.`};if(o===0&&r.trim())return{ok:!0,token:r.trim(),source:"gh"};return{ok:!1,reason:`gh has no signed-in account for github.com (${s.trim().split(`
|
|
344
344
|
`)[0]||`exit ${o}`}).`}}catch(r){let o=r instanceof Error?r.message:String(r);return{ok:!1,reason:o.includes("ENOENT")||o.includes("not found")?"The GitHub CLI (gh) is not installed.":`gh could not be run: ${o}`}}}function rp(e){return{Authorization:`Bearer ${e}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":"nemar-cli pr-reviews","Content-Type":"application/json"}}async function M$(e,t=bn()){let n;try{n=await fetch(`${t}/user`,{headers:rp(e),signal:AbortSignal.timeout(np)})}catch(i){return{ok:!1,kind:"unreachable",reason:`GitHub could not be reached (${i instanceof Error?i.message:String(i)}).`}}if(n.status===401)return{ok:!1,kind:"rejected",reason:"GitHub rejected this token."};if(!n.ok){let i=await n.text().catch(()=>"");if(n.status===403&&!/rate limit|abuse/i.test(i))return{ok:!1,kind:"not_a_person",reason:"This token does not belong to a GitHub user (an app or workflow token cannot approve for you)."};return{ok:!1,kind:"unreachable",reason:`GitHub answered HTTP ${n.status} when asked whose token this is. Try again in a moment.`}}let r=Symbol("unreadable"),o=await n.json().catch(()=>r);if(o===r)return{ok:!1,kind:"unreachable",reason:"GitHub answered, but the answer could not be read when asked whose token this is. Try again in a moment."};let s=o;if(typeof s?.login!=="string"||typeof s.id!=="number"||s.type!=="User"||s.login.endsWith("[bot]"))return{ok:!1,kind:"not_a_person",reason:"This token does not belong to a GitHub user, so it cannot approve for you."};return{ok:!0,user:{login:s.login,id:s.id}}}function j$(e,t){if(!e)return"unlinked";return e.toLowerCase()===t.toLowerCase()?"match":"mismatch"}function Cg(e,t){let n=typeof t==="object"&&t!==null&&"message"in t?jo(t.message,160):"";return n?`${n} (HTTP ${e})`:`GitHub answered HTTP ${e}.`}async function Cs(e,t,n,r=bn()){let o;try{o=await fetch(`${r}/repos/${fs}/${t}/pulls/${n}`,{headers:rp(e),signal:AbortSignal.timeout(np)})}catch(d){return{ok:!1,status:0,reason:`GitHub could not be reached (${d instanceof Error?d.message:String(d)}).`}}let s=await o.json().catch(()=>null);if(!o.ok)return{ok:!1,status:o.status,reason:o.status===404?`${fs}/${t} has no pull request #${n}, or your GitHub account cannot see it.`:Cg(o.status,s)};let i=s?.head,a=s?.base,c=s?.user;if(typeof i?.sha!=="string"||!/^[0-9a-f]{40}$/.test(i.sha))return{ok:!1,status:o.status,reason:"GitHub's answer had no head commit."};let l=(d)=>typeof d?.full_name==="string"?d.full_name:null;return{ok:!0,value:{state:s?.merged===!0?"merged":s?.state==="open"?"open":"closed",draft:s?.draft===!0,baseRef:typeof a?.ref==="string"?a.ref:"",headRef:typeof i.ref==="string"?i.ref:"",headSha:i.sha,headRepo:l(i.repo),baseRepo:l(a?.repo),authorLogin:typeof c?.login==="string"?c.login:"",mergeableState:typeof s?.mergeable_state==="string"?s.mergeable_state:"unknown",mergeCommitSha:typeof s?.merge_commit_sha==="string"&&/^[0-9a-f]{40}$/.test(s.merge_commit_sha)?s.merge_commit_sha:null}}}async function qF(e,t,n,r=bn()){let o;try{o=await fetch(`${r}/repos/${fs}/${t}${n}`,{headers:rp(e),signal:AbortSignal.timeout(np)})}catch(a){return{ok:!1,status:0,reason:`GitHub could not be reached (${a instanceof Error?a.message:String(a)}).`}}let s=Symbol("unreadable"),i=await o.json().catch(()=>s);if(!o.ok)return{ok:!1,status:o.status,reason:Cg(o.status,i)};if(i===s)return{ok:!1,status:o.status,reason:"GitHub's answer could not be read."};return{ok:!0,value:i}}function K0e(e){if(e.state==="merged")return"This pull request is already merged.";if(e.state==="closed")return"This pull request is closed.";if(e.baseRef!=="main")return`This pull request targets ${jo(e.baseRef,40)||"another branch"}, not main. The review queue covers pull requests to main.`;if(e.draft)return"This pull request is a draft. Ask the author to mark it ready first.";return null}function Bbt(e){return typeof e==="string"&&Zf.includes(e)?e:null}var Ubt=["pass","fail","uncertain"];function L$(e,t){let n=typeof e==="object"&&e!==null?e:null;if(!n)return{ok:!1,why:"the NEMAR API sent no review"};let r=Bbt(n.verdict);if(r===null)return{ok:!1,why:"the NEMAR API sent a verdict this version of the CLI does not know; update the CLI"};if(n.head_sha!==t)return{ok:!1,why:"the NEMAR API answered about a different commit than GitHub reports"};let o=n.stale_verdict??null;if(o!==null&&!Ubt.includes(o))return{ok:!1,why:"the NEMAR API sent a review this version of the CLI cannot read"};let s=n.review_current??null;if(s!==null&&typeof s!=="boolean")return{ok:!1,why:"the NEMAR API sent a review this version of the CLI cannot read"};let i=n.author?.standing,a=i?.paused===!0?`The contributor's pull requests are not reviewed automatically (paused${i.because==="maintainer"?" by an administrator's block":""}).`:null;return{ok:!0,verdict:r,detail:typeof n.detail==="string"?n.detail:null,staleVerdict:o,reviewCurrent:s,contributorNote:a,outcome:s===!0?n.review?.outcome??null:null}}function q$(e){if(e.unread)return{kind:"needs_force",reason:`The automated review could not be read (${e.unread}), so its verdict is unknown. Pass --force to approve without it.`};switch(e.verdict){case"pass":return{kind:"proceed"};case"fail":return{kind:"needs_force",reason:"The automated review says this pull request needs changes. Read it with `show`, and pass --force to approve it anyway."};case"in_progress":return{kind:"needs_force",reason:"The automated review of this commit is still running. Wait for it, or pass --force to approve without it."};case"uncertain":return{kind:"confirm",warning:"The automated review could not decide whether this is a good change."};case"could_not_decide":return{kind:"confirm",warning:"The automated review ended without a verdict."};case"not_reviewed":return{kind:"confirm",warning:e.staleVerdict===null?"The automated review has not read this commit.":`The automated review read a different commit of this pull request (it said: ${e.staleVerdict}), not this one.`};case"exempt":return{kind:"confirm",warning:`The automated review did not run on this commit: a NEMAR owner or administrator opened this pull request, and they are not reviewed.${e.staleVerdict===null?"":` An earlier commit of it was reviewed and read ${e.staleVerdict}.`}`};case"waived":return{kind:"confirm",warning:"The automated review is waived for this commit: NEMAR's record says it is an upstream re-pull's own head, and a mirror's content is upstream's. What a review of it found, if anything, is a recommendation and holds nothing."}}}function B$(e){return{ok:!1,outcome:"unknown",status:0,reason:`GitHub did not answer (${e instanceof Error?e.message:String(e)}).`}}async function BF(e,t,n,r,o,s,i=bn()){let a;try{a=await fetch(`${i}/repos/${fs}/${t}/pulls/${n}/reviews`,{method:"POST",headers:rp(e),body:JSON.stringify({commit_id:r,event:"APPROVE",body:s}),signal:AbortSignal.timeout(np)})}catch(d){return B$(d)}let c=await a.json().catch(()=>null);if(!a.ok)return{ok:!1,outcome:a.status>=500?"unknown":"refused",status:a.status,reason:Cg(a.status,c)};if(typeof c?.state!=="string")return{ok:!1,outcome:"unknown",status:a.status,reason:`GitHub answered HTTP ${a.status}, but its answer could not be read.`};let l=typeof c.user?.login==="string"?c.user.login:"";if(c.state!=="APPROVED"||c.commit_id!==r||l.toLowerCase()!==o.toLowerCase()){let d=[c.state!=="APPROVED"?`state ${jo(c.state,20)}`:"",l.toLowerCase()!==o.toLowerCase()?`by @${jo(l,40)||"?"}`:"",c.commit_id!==r?`commit ${typeof c.commit_id==="string"?jo(c.commit_id,40).slice(0,7):"?"}`:""].filter(Boolean);return{ok:!1,outcome:"different",status:a.status,reason:`GitHub recorded a review, but not the approval that was asked for (${d.join(", ")}).`}}return{ok:!0}}async function J0e(e,t,n,r,o=bn()){let s;try{s=await fetch(`${o}/repos/${fs}/${t}/issues/${n}/comments`,{method:"POST",headers:rp(e),body:JSON.stringify({body:r}),signal:AbortSignal.timeout(np)})}catch(a){return B$(a)}let i=await s.json().catch(()=>null);if(!s.ok)return{ok:!1,outcome:s.status>=500?"unknown":"refused",status:s.status,reason:Cg(s.status,i)};if(typeof i?.id!=="number")return{ok:!1,outcome:"unknown",status:s.status,reason:`GitHub answered HTTP ${s.status}, but its answer could not be read.`};return{ok:!0}}async function U$(e,t,n,r=bn()){let o;try{o=await fetch(`${r}/repos/${fs}/${t}/pulls/${n}`,{method:"PATCH",headers:rp(e),body:JSON.stringify({state:"closed"}),signal:AbortSignal.timeout(np)})}catch(i){return B$(i)}let s=await o.json().catch(()=>null);if(!o.ok)return{ok:!1,outcome:o.status>=500?"unknown":"refused",status:o.status,reason:Cg(o.status,s)};if(typeof s?.state!=="string")return{ok:!1,outcome:"unknown",status:o.status,reason:`GitHub answered HTTP ${o.status}, but its answer could not be read.`};if(s.state!=="closed")return{ok:!1,outcome:"different",status:o.status,reason:`GitHub answered, but the pull request is ${jo(s.state,20)}, not closed.`};return{ok:!0}}var H$=["merge","squash","rebase"],Hbt="clean",Vbt=new Map([["blocked","a required check or review is not satisfied (the BIDS validation, the version check or, where its ruleset is in force, the NEMAR PR Review); this tool names the NEMAR PR Review check, and no other, as one an owner or administrator can override in the GitHub UI, and only where its ruleset is in force, and it never uses the bypass itself"],["behind","the branch is behind main"],["dirty","it has merge conflicts"],["unstable","a check or status that is not required is not passing or has not reported, for example the automated review holding the pull request"],["draft","it is a draft"],["unknown","GitHub has not said whether it can be merged"]]);function G0e(e){return Vbt.get(e)??"this tool merges only a pull request GitHub reports as clean"}function Ag(e){let t=e&&e.length>0?e:"unknown";if(t===Hbt)return{ok:!0};return{ok:!1,why:`GitHub reports this pull request as '${N$(t)}' (${G0e(t)}), so a merge would not be attempted.`,card:`${G0e(t)} (GitHub: ${N$(t)})`,advice:t==="unknown"?"retry":"without_merge"}}function N$(e){return/^[a-z][a-z_]{0,29}$/.test(e)?e:"unrecognised"}async function op(e,t,n,r,o={}){let s=o.base??bn(),i=o.sleep??((d)=>new Promise((f)=>setTimeout(f,d))),a=o.tries??5,c=r.mergeableState,l=c===null?0:1;for(;;){if(c===null){let d=await Cs(e,t,n,s);if(!d.ok)return{ok:!1,kind:"unreadable",status:d.status,reason:d.reason};if(d.value.state!=="open")return{ok:!1,kind:"closed",merged:d.value.state==="merged"};if(d.value.headSha!==r.headSha)return{ok:!1,kind:"moved"};c=d.value.mergeableState,l++}if(c!=="unknown"||l>=a)return{ok:!0,state:c};await i(1000),c=null}}function Y0e(e){if(e.kind==="moved")return{ok:!1,why:"The pull request changed since it was read.",card:"the pull request changed since it was read",advice:"rerun"};if(e.kind==="closed")return{ok:!1,why:`The pull request is no longer open (it was ${e.merged?"merged":"closed"}).`,card:"the pull request is no longer open",advice:"none"};let t=e.reason.replace(/\.$/,"");return{ok:!1,why:`Could not check whether it can be merged (${t}).`,card:`could not be checked (${t})`,advice:"retry"}}async function Og(e,t,n,r,o={}){let s=await op(e,t,n,r,o);return s.ok?Ag(s.state):Y0e(s)}async function UF(e,t,n,r,o={}){let s=await Og(e,t,n,{headSha:r,mergeableState:null},o);return s.ok?s:{...s,why:`Checked again just before approving: ${s.why}`}}async function pw(e,t,n,r,o,s={}){let i=s.base??bn(),a=await op(e,t,n,{headSha:r,mergeableState:null},s);if(!a.ok){if(a.kind==="moved")return{ok:!1,outcome:"not_sent",status:409,reason:"The pull request changed after it was approved, so it was not merged."};if(a.kind==="closed")return{ok:!1,outcome:"not_sent",status:409,reason:`Not merged: ${Y0e(a).why} The approval stands.`};return{ok:!1,outcome:"not_sent",status:a.status,reason:`Not merged: ${a.reason} The approval stands.`}}let c=s.state==="unstable"?a.state==="unstable"?{ok:!0}:{ok:!1,why:`GitHub reports this pull request as '${N$(a.state)}', not 'unstable', so a merge over a failed BIDS validation would not be attempted.`,card:`not unstable (GitHub: ${N$(a.state)})`,advice:"none"}:Ag(a.state);if(!c.ok)return{ok:!1,outcome:"not_sent",status:405,merge:c,reason:`Not merged: ${c.why} The approval stands.`};let l;try{l=await fetch(`${i}/repos/${fs}/${t}/pulls/${n}/merge`,{method:"PUT",headers:rp(e),body:JSON.stringify({sha:r,merge_method:o,...s.commit?{commit_title:s.commit.title,commit_message:s.commit.message}:{}}),signal:AbortSignal.timeout(np)})}catch(f){return B$(f)}let d=await l.json().catch(()=>null);if(!l.ok)return{ok:!1,outcome:l.status>=500?"unknown":"refused",status:l.status,reason:Cg(l.status,d)};if(d?.merged!==!0)return{ok:!1,outcome:"unknown",status:l.status,reason:`GitHub answered HTTP ${l.status}, but did not say the pull request was merged.`};return{ok:!0}}function Q0e(e){switch(e.trim().toLowerCase()){case"y":case"yes":return"approve";case"n":case"no":return"close";case"c":case"comment":return"comment";case"d":case"details":return"details";case"s":case"skip":return"skip";case"q":case"quit":return"quit";default:return null}}function Z0e(e){let t=[];if(e.bids!=="pass"||e.version!=="pass")t.push(`A required check is not green (BIDS ${X0e(e.bids)}, version ${X0e(e.version)}), so GitHub would not let it merge.`);if(!e.merge.ok)t.push(e.merge.why);if(e.gate.kind==="needs_force"&&!e.force)t.push(e.gate.reason);return t.length===0?{ok:!0}:{ok:!1,reason:t.join(" ")}}function X0e(e){switch(e){case"pass":return"ok";case"fail":return"failing";case"pending":return"pending";case"missing":return"missing";default:return"unknown"}}function V$(e){return`${e.dataset_id}#${e.pr_number}`}function ebe(e,t){if(t.aborted)return Promise.resolve({aborted:!0});return new Promise((n,r)=>{let o=()=>n({aborted:!0});t.addEventListener("abort",o,{once:!0}),e.then((s)=>{t.removeEventListener("abort",o),n({aborted:!1,value:s})},(s)=>{t.removeEventListener("abort",o),r(s)})})}async function tbe(e,t,n){let r=[],o=t.now??Date.now,s=new Map,i=0,a=0,c=null;while(i<e.length){if(n.signal.aborted){c="interrupted";break}if(s.size>=n.concurrency){if(t.onWait?.({running:s.size,remaining:e.length-i}),await t.sleep(n.pollMs,n.signal),n.signal.aborted)continue;for(let[m,h]of[...s])if(o()-h.since>=n.maxHoldMs)s.delete(m);if(s.size<n.concurrency)continue;let f=await ebe(t.inProgress().catch(()=>null),n.signal);if(f.aborted)continue;let p=f.value;if(p===null){if(a++,t.onUnknown?.({count:a,max:n.maxUnknownPolls}),a>=n.maxUnknownPolls){c="unknown_polls";break}continue}a=0;for(let[m,h]of[...s]){if(p.has(m))continue;if(!t.confirmFinished){s.delete(m);continue}let g=await ebe(t.confirmFinished(h.entry).catch(()=>!1),n.signal);if(g.aborted)break;if(g.value)s.delete(m)}continue}let l=e[i++],d;try{d={answer:await t.start(l)}}catch(f){d={error:f}}if(r.push({entry:l,...d}),t.onResult(l,d),"answer"in d){if(t.isRunning(d.answer))s.set(V$(l),{entry:l,since:o()});if(t.stopAfter?.(d.answer)){c="answer";break}}else if(t.maybeRunning?.(d.error))s.set(V$(l),{entry:l,since:o()})}return{results:r,notStarted:e.slice(i),stoppedBy:c}}function nbe(e,t){return new Promise((n)=>{if(t.aborted){n();return}let r=()=>{clearTimeout(o),t.removeEventListener("abort",r),n()},o=setTimeout(r,e);t.addEventListener("abort",r,{once:!0})})}function rbe(e){if(!/^[1-9][0-9]{0,5}$/.test(e.trim()))return null;return Number(e.trim())}import{createInterface as zbt}from"readline";var z$=250;class sp{rl;lines=[];waiting=[];output;typeAhead;ended=!1;wasInterrupted=!1;constructor(e=process.stdin,t=process.stdout,n={}){this.output=t,this.typeAhead=n.typeAhead??(e.isTTY===!0?"discard":"keep"),this.rl=zbt({input:e,output:t,terminal:e.isTTY===!0}),this.rl.on("line",(r)=>{let o=this.waiting.shift();if(o)o(r);else this.lines.push(r)}),this.rl.on("SIGINT",()=>this.interrupt()),this.rl.on("close",()=>{this.ended=!0;for(let r of this.waiting.splice(0))r(null)})}get open(){return!this.ended}get canAnswer(){return!this.wasInterrupted&&(!this.ended||this.lines.length>0)}get interrupted(){return this.wasInterrupted}interrupt(){this.wasInterrupted=!0,this.lines.length=0,this.rl.close()}ask(e){if(this.wasInterrupted)return Promise.resolve(null);let t=this.lines.shift();if(t!==void 0)return this.output.write(`${e}${t}
|
|
345
345
|
`),Promise.resolve(t);if(this.ended)return Promise.resolve(null);return this.rl.setPrompt(e),this.rl.prompt(),new Promise((n)=>this.waiting.push(n))}async discardTyped(e=0){if(this.typeAhead!=="discard")return 0;if(e>0)await new Promise((n)=>setTimeout(n,e));let t=this.lines.length;return this.lines.length=0,t}close(){this.rl.close()}}import{dirname as o$t,join as s$t}from"path";var HF=3679074;var mw="nemarDatasets";function Gi(e,t){return typeof e==="string"&&e.toLowerCase()===`nemarDatasets/${t}`.toLowerCase()}no();var QF="Repull-Patch";function Wi(e){return[`Upstream-Snapshot: ${e.upstream_ds}@${e.to_tag}`,`Repull-Plan: ${e.plan_digest}`]}function yw(e){return`${QF}: corrections=${e}`}function fbe(e,t,n="n0",r="gate"){let[o,s]=Wi(e),i=n==="n1"?e.counts?.corrections:void 0,a=r==="worker"?"squash-merged by the Worker as a machine-clean automatic re-pull":"squash-merged through the re-pull's merge gate";return{title:`Release v${e[Dn[n].version]} (#${t})`,message:[n==="n0"?`Re-pull of upstream ${e.upstream_ds} from snapshot ${e.from_tag} to ${e.to_tag} (re-pull #${e.id}), ${a} (ADR 0111).`:`NEMAR's corrections of re-pull #${e.id} (upstream ${e.upstream_ds} ${e.from_tag} to ${e.to_tag}), replayed onto v${e.to_version}, ${a} (ADR 0111).`,"",o,s,...n==="n1"&&typeof i==="number"?[yw(i)]:[]].join(`
|
|
346
|
-
`)}}no();rc();ze();yo();ze();async function pbe(e){return q("/admin/repulls",{method:"POST",body:JSON.stringify(e)},!0)}async function K$(e){return(await q(`/admin/repulls/${e}`,{},!0)).repull}async function Lo(e={}){let t=new URLSearchParams;if(e.dataset)t.set("dataset",e.dataset);if(e.open)t.set("open","1");if(e.origin)t.set("origin",e.origin);if(e.after!==void 0)t.set("after",String(e.after));if(e.limit!==void 0)t.set("limit",String(e.limit));let n=t.toString()?`?${t.toString()}`:"";return q(`/admin/repulls${n}`,{},!0)}async function J$(){return q("/admin/repulls/switches",{},!0)}async function mbe(e={}){let t=new URLSearchParams;if(e.dataset)t.set("dataset",e.dataset);if(e.status)t.set("status",e.status);if(e.after!==void 0)t.set("after",String(e.after));if(e.limit!==void 0)t.set("limit",String(e.limit));let n=t.toString()?`?${t.toString()}`:"";return q(`/admin/repulls/dispatches${n}`,{},!0)}async function rr(e,t){return(await q(`/admin/repulls/${e}/transition`,{method:"POST",body:JSON.stringify(t)},!0)).repull}async function Ig(e){return q(`/admin/repulls/${e}/screens`,{},!0)}async function hbe(e,t){return q(`/admin/repulls/${e}/screen`,{method:"POST",body:JSON.stringify(t)},!0)}async function gbe(e,t){return q(`/admin/repulls/${e}/screen/acknowledge`,{method:"POST",body:JSON.stringify(t)},!0)}async function ybe(e,t){return(await q(`/admin/repulls/${e}/merge-claim/release`,{method:"POST",body:JSON.stringify(t)},!0)).repull}async function bbe(e,t){return(await q(`/admin/repulls/${e}/merge-claim/check`,{method:"POST",body:JSON.stringify(t)},!0)).repull}async function Y$(e,t){return q(`/admin/repulls/${e}/merged`,{method:"POST",body:JSON.stringify({pr:t})},!0)}async function wbe(e,t){return q(`/admin/repulls/${e}/released`,{method:"POST",body:JSON.stringify(t)},!0)}async function ZF(e,t){return q(`/admin/repulls/${e}/merge-trailers/accept`,{method:"POST",body:JSON.stringify(t)},!0)}function pn(e){if(!(e instanceof L))return;let t=e.rawBody;if(typeof t!=="object"||t===null||Array.isArray(t))return;let n=t.code;return typeof n==="string"?n:void 0}var Zbt=new Set(["nm000103","nm000105","nm000106","nm000107"]);var e6="version-check";function t6(e){return Zbt.has(e)?"bids-validation":"Run BIDS Validation"}var bw=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),vbe=(e)=>typeof e==="number"&&Number.isSafeInteger(e)&&e>0,ewt=new Set(["queued","waiting","requested","pending"]),_be={status:"unreadable",conclusion:null};function kbe(e){if(!bw(e))return"unreadable";let{total_count:t,check_runs:n}=e;if(typeof t!=="number"||!Array.isArray(n)||t>n.length)return"unreadable";let r=[];for(let o of n){if(!bw(o)||!bw(o.app)||!vbe(o.id))return"unreadable";if(typeof o.status!=="string")return"unreadable";if(o.conclusion!==null&&typeof o.conclusion!=="string")return"unreadable";r.push({id:o.id,name:o.name,appId:o.app.id,headSha:o.head_sha,status:o.status,conclusion:o.conclusion})}return r}function xbe(e,t,n){let r=kbe(e);if(r==="unreadable")return _be;let o=null;for(let s of r){if(s.name!==t||s.appId!==HF||s.headSha!==n)continue;if(o===null||s.id>o.id)o=s}if(o===null)return{status:"absent",conclusion:null};if(o.status==="completed")return{status:"completed",conclusion:o.conclusion};if(o.status==="in_progress")return{status:"in_progress",conclusion:null};if(ewt.has(o.status))return{status:"queued",conclusion:null};return _be}function twt(e){if(e.origin!=="administrator")return"automatic";if(e.bids.status==="unreadable"||e.versionCheck.status==="unreadable")return"unreadable";if(e.mergeableState==="blocked")return"blocked";if(e.mergeableState!=="unstable")return"not-unstable";if(e.bids.status!=="completed"||e.bids.conclusion!=="failure")return"bids";if(e.versionCheck.status!=="completed"||e.versionCheck.conclusion!=="success")return"version-check";return null}var nwt=new Set(["success","neutral","skipped"]);function rwt(e){if(!bw(e))return"unreadable";let{total_count:t,statuses:n}=e;if(typeof t!=="number"||!Array.isArray(n)||t>n.length)return"unreadable";let r=[];for(let o of n){if(!bw(o)||typeof o.context!=="string"||typeof o.state!=="string")return"unreadable";r.push({context:o.context,state:o.state})}return r}function X$(e){let t=kbe(e.runs);if(t==="unreadable")return"unreadable";let n=t6(e.datasetId),r=new Map;for(let i of t){if(i.headSha!==e.sha)continue;if(typeof i.name!=="string"||!vbe(i.appId))return"unreadable";if(i.appId===HF&&(i.name===n||i.name===e6))continue;let c=`${i.appId}/${i.name}`,l=r.get(c);if(l===void 0||i.id>l.id)r.set(c,{...i,name:i.name})}let o=[];for(let i of r.values())if(!(i.status==="completed"&&i.conclusion!==null&&nwt.has(i.conclusion)))o.push(i.name);let s=rwt(e.statuses);if(s==="unreadable")return"unreadable";for(let i of s)if(i.state!=="success")o.push(i.context);return o.sort()}function Ebe(e){let t=twt({origin:e.origin,mergeableState:e.mergeableState,bids:xbe(e.runs,t6(e.datasetId),e.sha),versionCheck:xbe(e.runs,e6,e.sha)});if(t!==null)return{fault:t};let n=X$(e);if(n==="unreadable")return{fault:"unreadable"};return n.length>0?{fault:"others",others:n}:null}async function Sbe(e){let t=e.sha.slice(0,12),[n,r]=await Promise.all([qF(e.token,e.datasetId,`/commits/${e.sha}/check-runs?filter=latest&per_page=100`,e.base),qF(e.token,e.datasetId,`/commits/${e.sha}/status?per_page=100`,e.base)]);if(!n.ok)return{unreadable:`the check runs of ${t} could not be read (${n.reason})`};if(!r.ok)return{unreadable:`the commit statuses of ${t} could not be read (${r.reason})`};return{datasetId:e.datasetId,sha:e.sha,runs:n.value,statuses:r.value}}async function r6(e){let t=await Sbe(e);if("unreadable"in t)return{kind:"unreadable",why:t.unreadable};let n=Ebe({...t,origin:e.origin,mergeableState:e.mergeableState});if(n===null)return{kind:"bids-only"};let r=n6(n,e,t);return n.fault==="unreadable"?{kind:"unreadable",why:r}:{kind:"not",why:r}}async function $be(e){let t=await Sbe(e);if("unreadable"in t)return{kind:"unreadable",why:t.unreadable};let n=X$(t);if(n==="unreadable")return{kind:"unreadable",why:n6({fault:"unreadable"},e)};if(n.length===0)return{kind:"bids-only"};return{kind:"not",why:n6({fault:"others",others:n},e)}}function owt(e,t){let n=X$(e);if(n==="unreadable"||n.length===0)return null;let r=t.sha.slice(0,12),o=n.map((s)=>jo(s,60)||"unnamed").join(", ");return`BIDS validation of ${r} has not failed; what does not pass there is: ${o}${Dbe(n,t)}`}function Dbe(e,t){if(!e.includes(OF))return"";let n=`nemar admin pr-reviews start ${t.datasetId} ${t.prNumber}`;return`.
|
|
346
|
+
`)}}no();rc();ze();yo();ze();async function pbe(e){return q("/admin/repulls",{method:"POST",body:JSON.stringify(e)},!0)}async function K$(e){return(await q(`/admin/repulls/${e}`,{},!0)).repull}async function Lo(e={}){let t=new URLSearchParams;if(e.dataset)t.set("dataset",e.dataset);if(e.open)t.set("open","1");if(e.origin)t.set("origin",e.origin);if(e.after!==void 0)t.set("after",String(e.after));if(e.limit!==void 0)t.set("limit",String(e.limit));let n=t.toString()?`?${t.toString()}`:"";return q(`/admin/repulls${n}`,{},!0)}async function J$(){return q("/admin/repulls/switches",{},!0)}async function mbe(e={}){let t=new URLSearchParams;if(e.dataset)t.set("dataset",e.dataset);if(e.status)t.set("status",e.status);if(e.after!==void 0)t.set("after",String(e.after));if(e.limit!==void 0)t.set("limit",String(e.limit));let n=t.toString()?`?${t.toString()}`:"";return q(`/admin/repulls/dispatches${n}`,{},!0)}async function rr(e,t){return(await q(`/admin/repulls/${e}/transition`,{method:"POST",body:JSON.stringify(t)},!0)).repull}async function Ig(e){return q(`/admin/repulls/${e}/screens`,{},!0)}async function hbe(e,t){return q(`/admin/repulls/${e}/screen`,{method:"POST",body:JSON.stringify(t)},!0)}async function gbe(e,t){return q(`/admin/repulls/${e}/screen/acknowledge`,{method:"POST",body:JSON.stringify(t)},!0)}async function ybe(e,t){return(await q(`/admin/repulls/${e}/merge-claim/release`,{method:"POST",body:JSON.stringify(t)},!0)).repull}async function bbe(e,t){return(await q(`/admin/repulls/${e}/merge-claim/check`,{method:"POST",body:JSON.stringify(t)},!0)).repull}async function Y$(e,t){return q(`/admin/repulls/${e}/merged`,{method:"POST",body:JSON.stringify({pr:t})},!0)}async function wbe(e,t){return q(`/admin/repulls/${e}/released`,{method:"POST",body:JSON.stringify(t)},!0)}async function ZF(e,t){return q(`/admin/repulls/${e}/merge-trailers/accept`,{method:"POST",body:JSON.stringify(t)},!0)}function pn(e){if(!(e instanceof L))return;let t=e.rawBody;if(typeof t!=="object"||t===null||Array.isArray(t))return;let n=t.code;return typeof n==="string"?n:void 0}var Zbt=new Set(["nm000103","nm000105","nm000106","nm000107"]);var e6="version-check";function t6(e){return Zbt.has(e)?"bids-validation":"Run BIDS Validation"}var bw=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),vbe=(e)=>typeof e==="number"&&Number.isSafeInteger(e)&&e>0,ewt=new Set(["queued","waiting","requested","pending"]),_be={status:"unreadable",conclusion:null};function kbe(e){if(!bw(e))return"unreadable";let{total_count:t,check_runs:n}=e;if(typeof t!=="number"||!Array.isArray(n)||t>n.length)return"unreadable";let r=[];for(let o of n){if(!bw(o)||!bw(o.app)||!vbe(o.id))return"unreadable";if(typeof o.status!=="string")return"unreadable";if(o.conclusion!==null&&typeof o.conclusion!=="string")return"unreadable";r.push({id:o.id,name:o.name,appId:o.app.id,headSha:o.head_sha,status:o.status,conclusion:o.conclusion})}return r}function xbe(e,t,n){let r=kbe(e);if(r==="unreadable")return _be;let o=null;for(let s of r){if(s.name!==t||s.appId!==HF||s.headSha!==n)continue;if(o===null||s.id>o.id)o=s}if(o===null)return{status:"absent",conclusion:null};if(o.status==="completed")return{status:"completed",conclusion:o.conclusion};if(o.status==="in_progress")return{status:"in_progress",conclusion:null};if(ewt.has(o.status))return{status:"queued",conclusion:null};return _be}function twt(e){if(e.origin!=="administrator")return"automatic";if(e.bids.status==="unreadable"||e.versionCheck.status==="unreadable")return"unreadable";if(e.mergeableState==="blocked")return"blocked";if(e.mergeableState!=="unstable")return"not-unstable";if(e.bids.status!=="completed"||e.bids.conclusion!=="failure")return"bids";if(e.versionCheck.status!=="completed"||e.versionCheck.conclusion!=="success")return"version-check";return null}var nwt=new Set(["success","neutral","skipped"]);function rwt(e){if(!bw(e))return"unreadable";let{total_count:t,statuses:n}=e;if(typeof t!=="number"||!Array.isArray(n)||t>n.length)return"unreadable";let r=[];for(let o of n){if(!bw(o)||typeof o.context!=="string"||typeof o.state!=="string")return"unreadable";r.push({context:o.context,state:o.state})}return r}function X$(e){let t=kbe(e.runs);if(t==="unreadable")return"unreadable";let n=t6(e.datasetId),r=new Map;for(let i of t){if(i.headSha!==e.sha)continue;if(typeof i.name!=="string"||!vbe(i.appId))return"unreadable";if(i.appId===HF&&(i.name===n||i.name===e6))continue;let c=`${i.appId}/${i.name}`,l=r.get(c);if(l===void 0||i.id>l.id)r.set(c,{...i,name:i.name})}let o=[];for(let i of r.values())if(!(i.status==="completed"&&i.conclusion!==null&&nwt.has(i.conclusion)))o.push(i.name);let s=rwt(e.statuses);if(s==="unreadable")return"unreadable";for(let i of s)if(i.state!=="success")o.push(i.context);return o.sort()}function Ebe(e){let t=twt({origin:e.origin,mergeableState:e.mergeableState,bids:xbe(e.runs,t6(e.datasetId),e.sha),versionCheck:xbe(e.runs,e6,e.sha)});if(t!==null)return{fault:t};let n=X$(e);if(n==="unreadable")return{fault:"unreadable"};return n.length>0?{fault:"others",others:n}:null}async function Sbe(e){let t=e.sha.slice(0,12),[n,r]=await Promise.all([qF(e.token,e.datasetId,`/commits/${e.sha}/check-runs?filter=latest&per_page=100`,e.base),qF(e.token,e.datasetId,`/commits/${e.sha}/status?per_page=100`,e.base)]);if(!n.ok)return{unreadable:`the check runs of ${t} could not be read (${n.reason})`};if(!r.ok)return{unreadable:`the commit statuses of ${t} could not be read (${r.reason})`};return{datasetId:e.datasetId,sha:e.sha,runs:n.value,statuses:r.value}}async function r6(e){let t=await Sbe(e);if("unreadable"in t)return{kind:"unreadable",why:t.unreadable};let n=Ebe({...t,origin:e.origin,mergeableState:e.mergeableState});if(n===null)return{kind:"bids-only"};let r=n6(n,e,t);return n.fault==="unreadable"?{kind:"unreadable",why:r}:{kind:"not",why:r}}async function $be(e){let t=await Sbe(e);if("unreadable"in t)return{kind:"unreadable",why:t.unreadable};let n=X$(t);if(n==="unreadable")return{kind:"unreadable",why:n6({fault:"unreadable"},e)};if(n.length===0)return{kind:"bids-only"};return{kind:"not",why:n6({fault:"others",others:n},e)}}function owt(e,t){let n=X$(e);if(n==="unreadable"||n.length===0)return null;let r=t.sha.slice(0,12),o=n.map((s)=>jo(s,60)||"unnamed").join(", ");return`BIDS validation of ${r} has not failed; what does not pass there is: ${o}${Dbe(n,t)}`}function Dbe(e,t){if(!e.includes(OF))return"";let n=`nemar admin pr-reviews start ${t.datasetId} ${t.prNumber}`;return`. A Worker at 0.10.27 or later waives the ${OF} check for an upstream re-pull's own head (an older Worker does not publish the waiver); if that check still reads as a review that failed, run ${n} to publish the waiver, then run this command again`}function n6(e,t,n){let r=t.sha.slice(0,12);if(e.fault==="bids"&&n!==void 0){let o=owt(n,t);if(o!==null)return o}switch(e.fault){case"unreadable":return`the checks of ${r} could not be read (GitHub's answer is not complete, or not of its shape)`;case"automatic":return"the automatic path opened this re-pull, and its pull request is merged over a failed BIDS validation by no one";case"blocked":return"GitHub reports it blocked: a rule requires BIDS validation, and a merge would be a bypass, which a re-pull never uses";case"not-unstable":return`GitHub reports it '${jo(t.mergeableState,30)||"unrecognized"}', not unstable`;case"bids":return`BIDS validation of ${r} has not completed with failure`;case"version-check":return`version-check of ${r} has not completed with success`;case"others":return`another check of ${r} does not pass (${e.others.map((o)=>jo(o,60)||"unnamed").join(", ")})${Dbe(e.others,t)}`}}sc();ze();async function fc(e){let t=null;try{t=await Xn(e)}catch(r){if(!(r instanceof L&&r.statusCode===404))throw r}let n=null;if(t)try{n=(await Kf(e)).versions.map((o)=>({version:o.version,source_version:o.source_version??null,source_version_basis:o.source_version_basis??null}))}catch(r){if(!(r instanceof L&&r.statusCode===404))throw r}return{dataset:t,versions:n}}$d();Ng();var hl=".nemar/";function gl(e,t){if(e.includes(t))return{content:e,changed:!1};return{content:e?`${e.trimEnd()}
|
|
347
347
|
${t}
|
|
348
348
|
`:`${t}
|
|
349
349
|
`,changed:!0}}function Fg(e){let t=new Set,n=/^(sub-[0-9A-Za-z]+)(?:\/|$)/;for(let r of e){let o=n.exec(r.path);if(o)t.add(o[1])}return[...t].sort()}function Mg(e){if(e.length===0)throw Error("buildPlaceholderParticipantsTsv: refusing to emit a header-only TSV");let t="participant_id\tage\tsex",n=e.map((r)=>`${r} n/a n/a`);return`${[t,...n].join(`
|
|
@@ -371,7 +371,7 @@ ${Fbe(r[1],s)}
|
|
|
371
371
|
`)}
|
|
372
372
|
`});if(o.exitCode!==0)throw Error(`git cat-file --batch failed: ${Dp(o)}`);let s=o.stdout,i=0;for(let a of r){let c=s.indexOf(10,i);if(c<0)throw Error("git cat-file --batch ended early");let l=s.subarray(i,c).toString("utf8").split(" ");if(l[1]==="missing"){i=c+1;continue}let d=Number(l[2]);if(!Number.isFinite(d)||d<0)throw Error("git cat-file --batch: bad header");let f=c+1;n.set(a,Buffer.from(s.subarray(f,f+d))),i=f+d+1}return n}class aR{clone;missing;budget;bytes=new Map;refused=new Set;constructor(e,t,n){this.clone=e;this.missing=t;this.budget=n}isMissing(e){return this.missing.has(e)}async load(e){let t=e.filter((n)=>!this.bytes.has(n)&&!this.missing.has(n));for(let[n,r]of await Hd(this.clone.path,t))this.bytes.set(n,r)}get(e){return this.bytes.get(e)??null}async fetch(e){let t=new Set,n=[],r=new Map;for(let i of e){if(!this.missing.has(i.oid)||r.has(i.oid)||t.has(i.oid))continue;if(!this.budget.claim(i.expected)){t.add(i.oid),this.refused.add(i.oid);continue}r.set(i.oid,i.expected),n.push(i.oid)}if(n.length===0)return t;let o=await Vo(["-c","fetch.negotiationAlgorithm=noop","fetch","--quiet","origin","--no-tags","--no-write-fetch-head","--recurse-submodules=no","--filter=blob:none","--stdin"],{cwd:this.clone.path,env:this.clone.env,stdin:`${n.join(`
|
|
373
373
|
`)}
|
|
374
|
-
`});if(o.exitCode!==0)throw Error(`git fetch of ${n.length} blob(s) failed: ${Dp(o)}`);let s=await Hd(this.clone.path,n);for(let i of n){let a=s.get(i);if(!a){t.add(i),this.refused.add(i),this.budget.used-=r.get(i)??0;continue}this.bytes.set(i,a),this.missing.delete(i),this.budget.used+=a.length-(r.get(i)??0)}return t}}class MM{max;used=0;refused=0;constructor(e){this.max=e}claim(e){if(this.used+e>this.max)return this.refused++,!1;return this.used+=e,!0}}async function vve(e){let t=Qw(e.env,"bucket");if(t)try{return{status:"ok",uuid:dEt(IM(t,`${e.prefix}annex-uuid`),"utf8").trim()}}catch(o){let s=o.code;if(s==="ENOENT")return{status:"absent",detail:"no annex-uuid object"};if(s==="EACCES"||s==="EPERM")return{status:"forbidden",detail:s};return{status:"error",detail:s??"read failed"}}if(!sR(e.bucket)||!oR(e.region))return{status:"error",detail:"the bucket name or the region is not one S3 can have, so nothing was requested"};let n=`${e.prefix}annex-uuid`.split("/").map(encodeURIComponent).join("/"),r=`https://${e.bucket}.s3.${e.region}.amazonaws.com/${n}`;try{let o=await tR(r,{headers:{"User-Agent":"nemar-cli-repull-plan"},signal:AbortSignal.timeout(15000)});if(o.status===404)return{status:"absent",detail:"HTTP 404"};if(o.status===403)return{status:"forbidden",detail:"HTTP 403"};if(!o.ok)return{status:"error",detail:`HTTP ${o.status}`};return{status:"ok",uuid:(await o.text()).trim()}}catch(o){return{status:"error",detail:o instanceof Error?o.name:"fetch failed"}}}async function kve(e){let t=new Map,n=Qw(e.env,"bucket");if(n){let i=IM(n,e.prefix),a=[];try{a=fEt(i)}catch(c){if(c.code!=="ENOENT")throw c}for(let c of a){let l=pEt(IM(i,c));if(l.isFile())t.set(c,l.size)}return wve(t,e.prefix)}if(!sR(e.bucket)||!oR(e.region))throw Error("the bucket name or the region is not one S3 can have, so it was not listed");let r=await hve(["s3api","list-objects-v2","--bucket",e.bucket,"--prefix",e.prefix,"--region",e.region,"--output","json"],e.env);if(r.exitCode!==0)throw Error(`aws s3api list-objects-v2 failed: ${Dp(r)}`);let o=r.stdout.toString("utf8").trim(),s=o?JSON.parse(o):{};for(let i of s.Contents??[]){if(typeof i.Key!=="string"||!i.Key.startsWith(e.prefix))continue;let a=i.Key.slice(e.prefix.length);if(a)t.set(a,typeof i.Size==="number"?i.Size:-1)}return wve(t,e.prefix)}function wve(e,t){if(!e.has("annex-uuid"))throw Error(`the listing of ${t} holds no annex-uuid object, so it cannot be told from an empty or partial one`);return e}async function Cp(e){return(await Hd(e,["refs/heads/git-annex:remote.log"])).get("refs/heads/git-annex:remote.log")?.toString("utf8")??""}async function Eve(e,t){let n=new Map;if(t.length===0)return n;let r=hp(await Cp(e)),o=(i)=>`refs/heads/git-annex:${Cw(i)}${Aw(i)}.log.rmet`,s=await Hd(e,t.map(o));for(let i of t){let a=s.get(o(i));if(!a)continue;let c=_D(a.toString("utf8"),r);if(c.length>0)n.set(i,c)}return n}function jM(e){if(typeof e!=="object"||e===null)return null;let t=e,n=t.head??{},r=t.base??{},o=n.repo??null;if(typeof t.number!=="number"||!Number.isSafeInteger(t.number)||t.number<=0||typeof n.ref!=="string"||typeof n.sha!=="string"||!/^[0-9a-f]{40}$/.test(n.sha)||typeof r.ref!=="string")return null;return{number:t.number,state:typeof t.state==="string"?t.state:"",headRef:n.ref,headSha:n.sha,headRepo:o&&typeof o.full_name==="string"?o.full_name:null,baseRef:r.ref}}function cy(e){switch(e.kind){case"unreachable":return`GitHub could not be reached (${e.detail})`;case"status":return`GitHub answered HTTP ${e.status}`;case"too-many":return"100 or more pull requests are listed, which one page cannot show complete";default:return"GitHub's list of pull requests was unreadable"}}async function ly(e){let t=e.head?`&head=${encodeURIComponent(`${ry}:${e.head}`)}`:"",n=`${e.base}/repos/${ry}/${e.datasetId}/pulls?state=${e.state}${t}&per_page=100`,r;try{r=await(e.fetcher??fetch)(n,{headers:{Authorization:`Bearer ${e.token}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":e.userAgent??"nemar-cli repull"},signal:AbortSignal.timeout(20000)})}catch(i){return{ok:!1,kind:"unreachable",detail:i instanceof Error?i.name:"fetch failed"}}if(r.status!==200)return{ok:!1,kind:"status",status:r.status};let o=await r.json().catch(()=>null);if(!Array.isArray(o))return{ok:!1,kind:"unreadable"};if(o.length>=100)return{ok:!1,kind:"too-many"};let s=o.map(jM);if(s.some((i)=>i===null))return{ok:!1,kind:"unreadable"};return{ok:!0,pulls:s}}function Sve(e){let{row:t,mapped:n}=e;if(!t)return{ds:null,check:{name:"source",status:"refused",code:"not-found",detail:"no dataset row"}};let r=typeof t.source_id==="string"&&/^ds\d{6}$/.test(t.source_id)?t.source_id:null;if(t.source!=="openneuro")return{ds:null,check:{name:"source",status:"refused",code:"not-a-mirror",detail:`the dataset row's source is ${t.source??"unset"}, not openneuro`}};if(n&&r&&r!==n)return{ds:null,check:{name:"source",status:"refused",code:"source-disagrees",detail:`${e.datasetId} maps to ${n} but the row names ${r}`}};let o=n??r;if(!o)return{ds:null,check:{name:"source",status:"refused",code:"no-source-id",detail:"no upstream ds id"}};return{ds:o,check:{name:"source",status:"ok",detail:o}}}function $ve(e){let t=e.flag?.trim()||void 0,n=(d,f,p=null)=>({tag:p,check:{name:"to-tag",status:"refused",code:d,detail:f}}),r=(d,f)=>({tag:d,check:{name:"to-tag",status:"unchecked",code:"order-unverified",detail:f}});if(t!==void 0&&!Cr(t))return n("to-tag-malformed",`${t} is not an OpenNeuro snapshot tag`);let o=wEt(e.upstream),s=o.tag===null?null:rl(o.tag),i=t!==void 0?rl(t):s;if(i===null)return n("latest-unknown",`${o.tag===null?o.reason:"no tag"}; name one with --to-tag`);if(!wD(i))return n("to-tag-unrecordable",`${i} is not a tag the version rows can record, so a re-pull to it could never be proved`);if(!e.mirrorTags.includes(i))return n("mirror-lag",`${i} is not on the GitHub mirror yet`);if(e.fromTag!==null&&Ar(i,e.fromTag))return n("nothing-to-pull",`${i} is the mirrored tag`,i);let a=e.upstream,c=e.fromTag??"the mirrored tag (unknown)";if(o.tag===null||s===null||a.kind!=="snapshot"||a.latest===null)return r(i,`OpenNeuro could not say which snapshot is latest (${o.tag===null?o.reason:"no answer"}), so that ${i} is newer than ${c} is not proved`);if(!Ar(i,s))return r(i,`${i} is not OpenNeuro's latest snapshot (${s}), so that it is newer than ${c} is not proved`);if(e.fromTag===null)return r(i,`there is no from_tag to order ${i} against`);let l=dve(a.latest,a.snapshots,e.fromTag);if(l.kind==="newer")return{tag:i,check:{name:"to-tag",status:"ok",detail:`${i} (OpenNeuro's latest)`}};return r(i,`${bEt(l,i,e.fromTag)}, so OpenNeuro's creation order does not show ${i} is newer; a re-pull to it is not executable`)}function bEt(e,t,n){switch(e.kind){case"same":return`OpenNeuro's list names ${t} as the mirrored ${n}`;case"latest_undated":return`the creation date of OpenNeuro's latest ${t} is unreadable`;case"latest_inconsistent":return`OpenNeuro calls ${t} its latest, but ${e.later} in its own list was created later`;case"recorded_absent":return`the mirrored ${n} is not among OpenNeuro's snapshots`;case"recorded_undated":return`the creation date of the mirrored ${n} is unreadable`;case"list_undated":return`the creation date of ${e.undated} in OpenNeuro's list is unreadable, and it could be newer`;case"not_after":return`OpenNeuro's latest ${t} was not created after the mirrored ${n}`}}function wEt(e){if(e.kind==="error")return{tag:null,reason:e.reason};if(e.kind!=="snapshot")return{tag:null,reason:`OpenNeuro: ${e.reason}`};if(e.latest===null)return{tag:null,reason:"OpenNeuro names no snapshot for this dataset yet"};if(!Cr(e.latest.tag))return{tag:null,reason:"OpenNeuro named a latest tag of an unexpected shape"};return{tag:e.latest.tag}}function cR(e){let t=null;for(let n of e){let r=$l(Ww(n));if(!r)continue;let o=`${r.major}.${r.minor}.${r.patch}`;if(t===null||_Et(o,t)>0)t=o}return t}function _Et(e,t){let n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<3;o++){let s=n[o]-r[o];if(s!==0)return s}return 0}function Dve(e){let t=cR(e.tags),n=e.mainVersion?cR([e.mainVersion]):null;if(e.rows!==null&&e.rows.length===0)return{current:null,next:null,check:{name:"version",status:"refused",code:"never-released",detail:"no version row"}};let r=e.rows?cR(e.rows.map((a)=>a.version)):null,o=[r,t,n].filter((a)=>a!==null),s=cR(o),i=s?_i(s,"major"):null;if(e.rows===null)return{current:s,next:i,check:{name:"version",status:"unchecked",code:"rows-unavailable",detail:`version rows could not be read; tag ${t??"none"}, main ${n??"none"}`}};if(r===null||t===null||n===null||r!==t||t!==n)return{current:s,next:i,check:{name:"version",status:"refused",code:"versions-disagree",detail:`row ${r??"none"}, tag ${t??"none"}, main ${n??"none"}`}};return{current:r,next:i,check:{name:"version",status:"ok",detail:`${r} -> ${i}`}}}async function Rve(e){let t=e.nextVersion?`refs/heads/release/v${e.nextVersion}`:null,n=e.branches.filter((a)=>a.startsWith("refs/heads/release/")),r=e.token?await ly({token:e.token,base:e.apiBase,datasetId:e.datasetId,state:"open",fetcher:tR,userAgent:"nemar-cli-repull-plan"}):null,o={branches:n,pulls:r?.ok?r.pulls:null,...r?.ok?{}:{pullsUnread:r?cy(r):"no GitHub token"}},s=(a)=>({check:a,facts:o});if(t&&e.branches.includes(t))return s({name:"release-pr",status:"refused",code:"release-branch-exists",detail:`${t.slice(11)} exists`});if(!r)return s({name:"release-pr",status:"unchecked",code:"no-token",detail:"no GitHub token"});if(!r.ok)switch(r.kind){case"unreachable":return s({name:"release-pr",status:"unchecked",code:"github-unreachable",detail:r.detail});case"status":return s({name:"release-pr",status:"unchecked",code:"github-error",detail:`HTTP ${r.status}`});case"too-many":return s({name:"release-pr",status:"unchecked",code:"too-many-open",detail:"100 or more open"});default:return s({name:"release-pr",status:"unchecked",code:"github-error",detail:"unreadable answer"})}let i=r.pulls.filter((a)=>a.headRef.startsWith("release/"));if(i.length>0)return s({name:"release-pr",status:"refused",code:"release-pr-open",detail:i.map((a)=>`#${a.number} (${a.headRef})`).join(", ")});return s({name:"release-pr",status:"ok",detail:`${r.pulls.length} open, none a release`})}function Cve(e){if(e.remoteUuids.length===0)return{name:"annex-uuid",status:"refused",code:"no-nemar-s3-remote",detail:"remote.log names none"};if(e.remoteUuids.length>1)return{name:"annex-uuid",status:"refused",code:"nemar-s3-ambiguous",detail:`remote.log names ${e.remoteUuids.length}: ${e.remoteUuids.join(", ")}`};let t=e.remoteUuids[0],n=e.marker;if(!n)return{name:"annex-uuid",status:"unchecked",code:"no-bucket",detail:"nemar-s3 is not an S3 remote"};if(n.status!=="ok")return{name:"annex-uuid",status:"unchecked",code:`marker-${n.status}`,detail:n.detail};if(n.uuid!==t)return{name:"annex-uuid",status:"refused",code:"annex-uuid-mismatch",detail:`bucket marker ${n.uuid}, remote.log nemar-s3 ${t}`};return{name:"annex-uuid",status:"ok",detail:t}}var Ave=".nemar/metadata.json",EEt=5368709120,SEt=/^[a-z]{2}\d{6}$/;class oo extends Error{constructor(e){super(e);this.name="RepullCannotPlan"}}function $Et(e,t){let n=!1,r=()=>{if(n)return;if(n=!0,!t)vEt(e,{recursive:!0,force:!0,maxRetries:5,retryDelay:50})},o=(s)=>{mve(),r(),process.exit(s==="SIGINT"?130:143)};return process.on("SIGINT",o),process.on("SIGTERM",o),()=>{process.off("SIGINT",o),process.off("SIGTERM",o),r()}}async function uy(e){let t=e.env??process.env,n=e.datasetId;if(!SEt.test(n))throw new oo(`${n} is not a dataset id`);let r=Sve({datasetId:n,mapped:M6(n),row:e.catalog.dataset});if(!r.ds)return{planned:!1,preflight:[r.check],reason:r.check.code??"source",workdir:null};let o=r.ds,s=oy(o,t),i=xi(n,t),a=sy(s,null),c=sy(i,e.github.token),l=await Hxe(o,{graphqlUrl:e.openNeuroGraphqlUrl,attempts:2,retryDelayMs:1000}),d,f;try{d=await NM(s,["refs/tags/*","refs/heads/git-annex"],a),f=await NM(i,["refs/heads/main","refs/heads/git-annex","refs/heads/release/*","refs/tags/v*"],c)}catch(_){throw new oo(`could not list the remotes: ${_ instanceof Error?_.message:String(_)}`)}if(!f.has("refs/heads/main")||!f.has("refs/heads/git-annex"))throw new oo(`${n} has no main or no git-annex branch`);let p=[...d.keys()].filter((_)=>_.startsWith("refs/tags/")).map((_)=>_.slice(10)),m=[...f.keys()].filter((_)=>_.startsWith("refs/tags/v")).map((_)=>_.slice(10)),h=[...f.keys()].filter((_)=>_.startsWith("refs/heads/release/")),g=xEt(LM(e.workRoot??kEt(),`nemar-repull-${n}-`)),y=e.keepWorkdir===!0,b=$Et(g,y);try{let _=await FM({url:i,dest:LM(g,"nemar.git"),branch:"main",extra:["refs/heads/git-annex"],token:e.github.token}),x=await eve({rows:e.catalog.versions,highestTag:DEt(m),flag:e.fromTag,ds:o,readTagged:async(K)=>{let xt=`refs/tags/v${K}`;if(!f.has(xt))return;if((await Vo(["fetch","--quiet","--depth=1","--no-tags","origin",`+${xt}:${xt}`],{cwd:_.path,env:_.env})).exitCode!==0)throw new oo(`could not fetch ${xt}`);let $o=`${xt}:${Rn}`,aa=(await Hd(_.path,[$o])).get($o);if(!aa)return;try{return JSON.parse(ms(aa.toString("utf8")))}catch{return null}}}),k=$ve({flag:e.toTag,mirrorTags:p,fromTag:x.tag,upstream:l}),v=[x.check,k.check].filter((K)=>K.status==="refused"&&K.code!=="from-tag-not-recorded");if(x.tag===null||k.tag===null||v.length>0)return{planned:!1,preflight:[r.check,x.check,k.check],reason:(v[0]??x.check).code??"preflight",workdir:y?g:null};let C=x.tag,T=k.tag;if(!p.includes(C))throw new oo(`the mirrored tag ${C} is not on the GitHub mirror`);let V=d.has("refs/heads/git-annex"),A=await FM({url:s,dest:LM(g,"upstream.git"),branch:T,extra:[`refs/tags/${T}`,`refs/tags/${C}`,...V?["refs/heads/git-annex"]:[]]});for(let K of[A.path,_.path])if(await xve(K)!=="sha1")throw new oo("only SHA-1 repositories are planned");let F=await iy(A.path,`refs/tags/${C}`),M=await iy(A.path,`refs/tags/${T}`),U=await iy(_.path,"refs/heads/main"),B=await iy(_.path,"refs/heads/git-annex"),P=V?await iy(A.path,"refs/heads/git-annex"):null,[O,H,re]=await Promise.all([Rp(A.path,F.commit),Rp(A.path,M.commit),Rp(_.path,U.commit)]),Ee=new MM(e.maxFetchBytes??EEt),Zt=new aR(A,await ay(A.path,[F.commit,M.commit]),Ee),pt=new aR(_,await ay(_.path,[U.commit]),Ee),Ze=re.get(Rn);if(Ze)await pt.load([Ze.oid]);let oe=Ze?CEt(pt.get(Ze.oid)):null,je=typeof oe?.Version==="string"?Ww(oe.Version):null,Ie=Dve({rows:e.catalog.versions,tags:m,mainVersion:je});if(Ie.next===null)return{planned:!1,preflight:[r.check,x.check,k.check,Ie.check],reason:Ie.check.code??"version",workdir:y?g:null};let Q=[],mt=ty(e.catalog.dataset?.concept_doi),Ue=ty(typeof oe?.DatasetDOI==="string"?oe.DatasetDOI:null);if(mt!==null&&Ue!==null&&mt!==Ue)Q.push({code:"concept-doi-disagrees",detail:`the catalog's concept DOI is ${mt} and main's DatasetDOI is ${Ue}`});let W=ZD(_.env),J=new Map,le=async(K)=>{let xt=K.filter(($o)=>!J.has($o));if(xt.length===0)return;let tr=await Pd(_.path,"refs/heads/git-annex",xt,W);xt.forEach(($o,aa)=>J.set($o,tr[aa]??""))},ne=await cve({base:O,theirs:H,ours:re,upstream:Zt,nemar:pt,ds:o,toTag:T,nextVersion:Ie.next,conceptDoi:mt,prepareDeadKeys:le,deadAtNemar:(K)=>yi(J.get(K)??""),collect:e.collect}),Le=Ap(await Cp(_.path),n);if(Le.problem!==null)throw new oo(Le.problem);let{uuids:It,uuid:wr,record:Fc,region:Ce,prefix:st}=Le,Fn=new Map;for(let K of ne.decisions){if(!K.delta||K.target.kind!=="annex"&&K.target.kind!=="unannex")continue;let xt=Fn.get(K.target.key)??{paths:[],purpose:K.target.kind==="annex"?"copy":"unannex"};if(K.target.kind==="annex")xt.purpose="copy";xt.paths.push(K.path),Fn.set(K.target.key,xt)}await le([...Fn.keys()]);let Gl=null;if(e.presence==="bucket-listing"){if(!Fc?.bucket)throw new oo("nemar-s3 names no bucket, so there is no bucket to list");try{Gl=await kve({bucket:Fc.bucket,region:Ce,prefix:st,env:t})}catch(K){throw new oo(`the bucket listing failed: ${K instanceof Error?K.message:String(K)}`)}}let ws=(K,xt)=>Gl?pr(K,Gl):wr!==null&&Ki(xt).has(wr)||ne.oursKeys.has(K),Iy=[],ex=[],oq=0;for(let[K,{paths:xt,purpose:tr}]of[...Fn].sort(([$o],[aa])=>$o<aa?-1:1)){let $o=J.get(K)??"";if(yi($o)){if(xt.every((aa)=>Uo.test(aa)))ex.push(K);else Q.push({code:"target-names-dead-key",detail:`${xt.length} path(s) would name a key NEMAR's git-annex branch marks dead`});continue}if(tr==="copy"&&ws(K,$o)){oq++;continue}Iy.push({key:K,purpose:tr})}if(ex.length>0)Q.push({code:"dead-recording-unpinned",detail:`${ex.length} recording(s) N.0.0 would name carry a key NEMAR's git-annex branch marks dead, and no upstream version is pinned to scrub them from`});let zAe=V?await Eve(A.path,Iy.map((K)=>K.key)):new Map,sq=[],tx=[],kC=0,EC=0,SC=0,iq=0;for(let{key:K,purpose:xt}of Iy){let tr=[...zAe.get(K)??[]].filter((aa)=>aa.bucket===gp).pop()??null,$o=Ho(K)?.size??null;if(xt==="copy")if(SC++,$o===null)EC++;else kC+=$o;else iq++;if(!tr)tx.push(K);sq.push({key:K,purpose:xt,paths:[...Fn.get(K)?.paths??[]].sort(),size:$o,pin:tr?{bucket:tr.bucket,object:tr.object,version:tr.version}:null})}let Ny=ne.decisions.filter((K)=>K.delta&&K.target.kind==="annex-from-git").map((K)=>{let xt=K.target;return{path:K.path,oid:xt.oid,size:xt.size}}),aq=Ny.reduce((K,xt)=>K+(xt.size??0),0),cq=Ny.filter((K)=>K.size===null).length,of=await OEt(re,pt),nx=ne.decisions.filter((K)=>K.class==="conflict"),Yp=ne.decisions.filter((K)=>K.class==="correction"),rx=ne.decisions.filter((K)=>K.class==="unchecked"),$C=nx.length+Yp.length+rx.length;if(of.status==="unreadable")Q.push({code:"ledger-unreadable",detail:`${In} does not parse as a ledger: ${of.error}`});else if(of.recordedCorrections>0&&$C>0)Q.push({code:"ledger-correction-unexplained",detail:`the ledger records ${of.recordedCorrections} correction(s) and ${$C} path(s) are unexplained; a re-pull could revert one, so it refuses with no override`});if(ne.gitlinks.length>0)Q.push({code:"gitlink",detail:`${ne.gitlinks.length} submodule path(s)`});let lq=ne.decisions.filter((K)=>K.target.kind==="unknown");if(lq.length>0)Q.push({code:"target-unknown",detail:`${lq.length} path(s) whose N.0.0 content could not be computed`});if(ne.fetchRefused>0)Q.push({code:"fetch-bound",detail:`${ne.fetchRefused} blob(s) a check needed were not fetched (over --max-fetch-gb, or not delivered); ${rx.length} path(s) are unchecked`});let uq=await Rve({datasetId:n,nextVersion:Ie.next,branches:h,token:e.github.token,apiBase:e.github.apiBase}),GAe=Fc?.bucket?await vve({bucket:Fc.bucket,region:Ce,prefix:st,env:t}):null,dq=[r.check,x.check,k.check,Ie.check,uq.check,Cve({remoteUuids:It,marker:GAe})],ox=PEt(ne.decisions),WAe=new Set(ox.map((K)=>K.from)),KAe=new Set(ox.map((K)=>K.to)),sf=ne.decisions.filter((K)=>K.delta),fq=ne.decisions.filter((K)=>K.deleted),pq=(K)=>ne.sides.get(K.path)?.ours??{kind:"absent"},mq=(K)=>K.delta&&pq(K).kind==="absent",DC=sf.filter((K)=>Uo.test(K.path)),hq=0,gq=0;for(let K of DC){let xt=K.target,tr=xt.kind==="annex"?Ho(xt.key)?.size??null:xt.kind==="annex-from-git"?xt.size:0;if(tr===null)gq++;else hq+=tr}let yq=SC>0||Ny.length>0||[...sf,...fq].some((K)=>{let xt=pq(K),tr=K.target;return xt.kind==="annex"||tr.kind==="annex"||tr.kind==="annex-from-git"||tr.kind==="unannex"||Fo(K.path,0)}),bq=(K)=>{let xt={};for(let tr of K)xt[tr.subtype??"none"]=(xt[tr.subtype??"none"]??0)+1;return xt},RC=ne.description.keys,JAe={added:sf.filter((K)=>mq(K)&&!KAe.has(K.path)).length,changed:sf.filter((K)=>!mq(K)).length,deleted:fq.filter((K)=>!WAe.has(K.path)).length,renamed:ox.length,delta_paths:sf.length,upstream_changed:ne.decisions.filter((K)=>K.upstreamChanged).length,unexplained:$C,corrections:Yp.length,corrections_by_subtype:bq(Yp),conflicts:nx.length,conflicts_by_subtype:bq(nx),unchecked:rx.length,description_corrections:RC.filter((K)=>K.class==="correction").length,description_conflicts:RC.filter((K)=>K.class==="conflict").length,copy_items:SC,copy_bytes:kC,copy_bytes_unknown:EC,copy_unpinned:tx.length,copy_already_held:oq,unannex_items:iq,local_uploads:Ny.length,local_bytes:aq,local_bytes_unknown:cq,orphan_bytes_max:kC+aq+hq,orphan_bytes_unknown:EC+cq+gq,data_changing:yq,metadata_only:!yq,doi_count:Yp.length>0?2:1,fetched_bytes:Ee.used,fetch_refused:ne.fetchRefused},YAe={recordings_to_read:DC.length,json_files_to_read:sf.filter((K)=>vp.test(K.path)&&(K.target.kind==="git"||K.target.kind==="description")).length,scans_tables_to_read:sf.filter((K)=>kp.test(K.path)&&K.target.kind==="git").length,non_sha256e_recordings:DC.filter((K)=>K.target.kind==="annex"&&Ho(K.target.key)?.backend!=="SHA256E").length},wq=ne.gitlinks.length===0&&ne.decisions.every((K)=>K.explainedBy.base!==null)&&ne.description.explainedBase,XAe=Yp.length>0?_i(Ie.next,"patch"):null,_q={planner:Sw,dataset:n,upstream:{ds:o,from_tag:C,to_tag:T,from_tag_source:x.source,from_commit:F.commit,from_tree:F.tree,to_commit:M.commit,to_tree:M.tree,annex_commit:P?.commit??null},nemar:{main_commit:U.commit,main_tree:U.tree,annex_commit:B.commit,concept_doi:mt},versions:{current:Ie.current,n0:Ie.next,n1:XAe},lineage:{holds:wq,recordable:wq&&x.source!=="flag"},paths:ne.decisions.map(IEt),renames:ox.map((K)=>({from:K.from,to:K.to})),description:{status:ne.description.status,keys:RC.map((K)=>({...K})),source_datasets:{kept:ne.description.sourceDatasets.kept,added_by_nemar:ne.description.sourceDatasets.addedByNemar,removed_by_upstream:ne.description.sourceDatasets.removedByUpstream},merged_json:ne.description.mergedJson},corrections:Yp.map((K)=>({path:K.path,group:K.group,subtype:K.subtype})),conflicts:nx.map((K)=>({path:K.path,group:K.group,subtype:K.subtype})),unchecked:rx.map((K)=>({path:K.path,group:K.group,subtype:K.subtype})),copy:{presence_basis:Gl?"bucket-listing":"location-log",destination_prefix:st,items:sq,unpinned:tx,dead_recordings:ex},local_uploads:Ny,scrub_forecast:YAe,ledger:{status:of.status,lines:of.lines,recorded_corrections:of.recordedCorrections},nemar_owned_edits:await TEt(re,pt,o,T),counts:JAe,refusals:Q},QAe=dq.every((K)=>K.status==="ok")&&tx.length===0&&Q.length===0;return{planned:!0,file:{schema:kw,version:Ew,digest:gc(_q),created_at:(e.now??new Date).toISOString(),environment:e.environment,sources:iR(t,e.openNeuroGraphqlUrl),preflight:dq,executable:QAe,body:_q},workdir:y?g:null,release:uq.facts}}finally{b()}}function DEt(e){let t=null;for(let n of e){let r=/^v(\d+)\.(\d+)\.(\d+)$/.exec(n);if(!r)continue;let o=[Number(r[1]),Number(r[2]),Number(r[3])];if(!t||REt(o,t.parts)>0)t={tag:n,parts:o}}return t?.tag??null}function REt(e,t){for(let n=0;n<3;n++){let r=e[n]-t[n];if(r!==0)return r}return 0}function CEt(e){if(!e)return null;try{let t=JSON.parse(ms(e.toString("utf8")));return t&&typeof t==="object"&&!Array.isArray(t)?t:null}catch{return null}}function Ap(e,t){let n=Bg(e,zg),r=n.length===1?n[0]??null:null,o=r?hp(e).get(r):void 0,s=o?AEt(e,o.uuid)??"us-east-2":"us-east-2";return{uuids:n,uuid:r,record:o,region:s,prefix:o?.fileprefix??`${t}/objects/`,problem:o?bve(o.bucket,s):null}}function AEt(e,t){let n=null;for(let r of e.split(`
|
|
374
|
+
`});if(o.exitCode!==0)throw Error(`git fetch of ${n.length} blob(s) failed: ${Dp(o)}`);let s=await Hd(this.clone.path,n);for(let i of n){let a=s.get(i);if(!a){t.add(i),this.refused.add(i),this.budget.used-=r.get(i)??0;continue}this.bytes.set(i,a),this.missing.delete(i),this.budget.used+=a.length-(r.get(i)??0)}return t}}class MM{max;used=0;refused=0;constructor(e){this.max=e}claim(e){if(this.used+e>this.max)return this.refused++,!1;return this.used+=e,!0}}async function vve(e){let t=Qw(e.env,"bucket");if(t)try{return{status:"ok",uuid:dEt(IM(t,`${e.prefix}annex-uuid`),"utf8").trim()}}catch(o){let s=o.code;if(s==="ENOENT")return{status:"absent",detail:"no annex-uuid object"};if(s==="EACCES"||s==="EPERM")return{status:"forbidden",detail:s};return{status:"error",detail:s??"read failed"}}if(!sR(e.bucket)||!oR(e.region))return{status:"error",detail:"the bucket name or the region is not one S3 can have, so nothing was requested"};let n=`${e.prefix}annex-uuid`.split("/").map(encodeURIComponent).join("/"),r=`https://${e.bucket}.s3.${e.region}.amazonaws.com/${n}`;try{let o=await tR(r,{headers:{"User-Agent":"nemar-cli-repull-plan"},signal:AbortSignal.timeout(15000)});if(o.status===404)return{status:"absent",detail:"HTTP 404"};if(o.status===403)return{status:"forbidden",detail:"HTTP 403"};if(!o.ok)return{status:"error",detail:`HTTP ${o.status}`};return{status:"ok",uuid:(await o.text()).trim()}}catch(o){return{status:"error",detail:o instanceof Error?o.name:"fetch failed"}}}async function kve(e){let t=new Map,n=Qw(e.env,"bucket");if(n){let i=IM(n,e.prefix),a=[];try{a=fEt(i)}catch(c){if(c.code!=="ENOENT")throw c}for(let c of a){let l=pEt(IM(i,c));if(l.isFile())t.set(c,l.size)}return wve(t,e.prefix)}if(!sR(e.bucket)||!oR(e.region))throw Error("the bucket name or the region is not one S3 can have, so it was not listed");let r=await hve(["s3api","list-objects-v2","--bucket",e.bucket,"--prefix",e.prefix,"--region",e.region,"--output","json"],e.env);if(r.exitCode!==0)throw Error(`aws s3api list-objects-v2 failed: ${Dp(r)}`);let o=r.stdout.toString("utf8").trim(),s=o?JSON.parse(o):{};for(let i of s.Contents??[]){if(typeof i.Key!=="string"||!i.Key.startsWith(e.prefix))continue;let a=i.Key.slice(e.prefix.length);if(a)t.set(a,typeof i.Size==="number"?i.Size:-1)}return wve(t,e.prefix)}function wve(e,t){if(!e.has("annex-uuid"))throw Error(`the listing of ${t} holds no annex-uuid object, so it cannot be told from an empty or partial one`);return e}async function Cp(e){return(await Hd(e,["refs/heads/git-annex:remote.log"])).get("refs/heads/git-annex:remote.log")?.toString("utf8")??""}async function Eve(e,t){let n=new Map;if(t.length===0)return n;let r=hp(await Cp(e)),o=(i)=>`refs/heads/git-annex:${Cw(i)}${Aw(i)}.log.rmet`,s=await Hd(e,t.map(o));for(let i of t){let a=s.get(o(i));if(!a)continue;let c=_D(a.toString("utf8"),r);if(c.length>0)n.set(i,c)}return n}function jM(e){if(typeof e!=="object"||e===null)return null;let t=e,n=t.head??{},r=t.base??{},o=n.repo??null;if(typeof t.number!=="number"||!Number.isSafeInteger(t.number)||t.number<=0||typeof n.ref!=="string"||typeof n.sha!=="string"||!/^[0-9a-f]{40}$/.test(n.sha)||typeof r.ref!=="string")return null;return{number:t.number,state:typeof t.state==="string"?t.state:"",headRef:n.ref,headSha:n.sha,headRepo:o&&typeof o.full_name==="string"?o.full_name:null,baseRef:r.ref}}function cy(e){switch(e.kind){case"unreachable":return`GitHub could not be reached (${e.detail})`;case"status":return`GitHub answered HTTP ${e.status}`;case"too-many":return"100 or more pull requests are listed, which one page cannot show complete";default:return"GitHub's list of pull requests was unreadable"}}async function ly(e){let t=e.head?`&head=${encodeURIComponent(`${ry}:${e.head}`)}`:"",n=`${e.base}/repos/${ry}/${e.datasetId}/pulls?state=${e.state}${t}&per_page=100`,r;try{r=await(e.fetcher??fetch)(n,{headers:{Authorization:`Bearer ${e.token}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28","User-Agent":e.userAgent??"nemar-cli repull"},signal:AbortSignal.timeout(20000)})}catch(i){return{ok:!1,kind:"unreachable",detail:i instanceof Error?i.name:"fetch failed"}}if(r.status!==200)return{ok:!1,kind:"status",status:r.status};let o=await r.json().catch(()=>null);if(!Array.isArray(o))return{ok:!1,kind:"unreadable"};if(o.length>=100)return{ok:!1,kind:"too-many"};let s=o.map(jM);if(s.some((i)=>i===null))return{ok:!1,kind:"unreadable"};return{ok:!0,pulls:s}}function Sve(e){let{row:t,mapped:n}=e;if(!t)return{ds:null,check:{name:"source",status:"refused",code:"not-found",detail:"no dataset row"}};let r=typeof t.source_id==="string"&&/^ds\d{6}$/.test(t.source_id)?t.source_id:null;if(t.source!=="openneuro")return{ds:null,check:{name:"source",status:"refused",code:"not-a-mirror",detail:`the dataset row's source is ${t.source??"unset"}, not openneuro`}};if(n&&r&&r!==n)return{ds:null,check:{name:"source",status:"refused",code:"source-disagrees",detail:`${e.datasetId} maps to ${n} but the row names ${r}`}};let o=n??r;if(!o)return{ds:null,check:{name:"source",status:"refused",code:"no-source-id",detail:"no upstream ds id"}};return{ds:o,check:{name:"source",status:"ok",detail:o}}}function $ve(e){let t=e.flag?.trim()||void 0,n=(d,f,p=null)=>({tag:p,check:{name:"to-tag",status:"refused",code:d,detail:f}}),r=(d,f)=>({tag:d,check:{name:"to-tag",status:"unchecked",code:"order-unverified",detail:f}});if(t!==void 0&&!Cr(t))return n("to-tag-malformed",`${t} is not an OpenNeuro snapshot tag`);let o=wEt(e.upstream),s=o.tag===null?null:rl(o.tag),i=t!==void 0?rl(t):s;if(i===null)return n("latest-unknown",`${o.tag===null?o.reason:"no tag"}; name one with --to-tag`);if(!wD(i))return n("to-tag-unrecordable",`${i} is not a tag the version rows can record, so a re-pull to it could never be proved`);if(!e.mirrorTags.includes(i))return n("mirror-lag",`${i} is not on the GitHub mirror yet`);if(e.fromTag!==null&&Ar(i,e.fromTag))return n("nothing-to-pull",`${i} is the mirrored tag`,i);let a=e.upstream,c=e.fromTag??"the mirrored tag (unknown)";if(o.tag===null||s===null||a.kind!=="snapshot"||a.latest===null)return r(i,`OpenNeuro could not say which snapshot is latest (${o.tag===null?o.reason:"no answer"}), so that ${i} is newer than ${c} is not proved`);if(!Ar(i,s))return r(i,`${i} is not OpenNeuro's latest snapshot (${s}), so that it is newer than ${c} is not proved`);if(e.fromTag===null)return r(i,`there is no from_tag to order ${i} against`);let l=dve(a.latest,a.snapshots,e.fromTag);if(l.kind==="newer")return{tag:i,check:{name:"to-tag",status:"ok",detail:`${i} (OpenNeuro's latest)`}};return r(i,`${bEt(l,i,e.fromTag)}, so OpenNeuro's creation order does not show ${i} is newer; a re-pull to it is not executable`)}function bEt(e,t,n){switch(e.kind){case"same":return`OpenNeuro's list names ${t} as the mirrored ${n}`;case"latest_undated":return`the creation date of OpenNeuro's latest ${t} is unreadable`;case"latest_inconsistent":return`OpenNeuro calls ${t} its latest, but ${e.later} in its own list was created later`;case"recorded_absent":return`the mirrored ${n} is not among OpenNeuro's snapshots`;case"recorded_undated":return`the creation date of the mirrored ${n} is unreadable`;case"list_undated":return`the creation date of ${e.undated} in OpenNeuro's list is unreadable, and it could be newer`;case"not_after":return`OpenNeuro's latest ${t} was not created after the mirrored ${n}`}}function wEt(e){if(e.kind==="error")return{tag:null,reason:e.reason};if(e.kind!=="snapshot")return{tag:null,reason:`OpenNeuro: ${e.reason}`};if(e.latest===null)return{tag:null,reason:"OpenNeuro names no snapshot for this dataset yet"};if(!Cr(e.latest.tag))return{tag:null,reason:"OpenNeuro named a latest tag of an unexpected shape"};return{tag:e.latest.tag}}function cR(e){let t=null;for(let n of e){let r=$l(Ww(n));if(!r)continue;let o=`${r.major}.${r.minor}.${r.patch}`;if(t===null||_Et(o,t)>0)t=o}return t}function _Et(e,t){let n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<3;o++){let s=n[o]-r[o];if(s!==0)return s}return 0}function Dve(e){let t=cR(e.tags),n=e.mainVersion?cR([e.mainVersion]):null;if(e.rows!==null&&e.rows.length===0)return{current:null,next:null,check:{name:"version",status:"refused",code:"never-released",detail:"no version row"}};let r=e.rows?cR(e.rows.map((a)=>a.version)):null,o=[r,t,n].filter((a)=>a!==null),s=cR(o),i=s?_i(s,"major"):null;if(e.rows===null)return{current:s,next:i,check:{name:"version",status:"unchecked",code:"rows-unavailable",detail:`version rows could not be read; tag ${t??"none"}, main ${n??"none"}`}};if(r===null||t===null||n===null||r!==t||t!==n)return{current:s,next:i,check:{name:"version",status:"refused",code:"versions-disagree",detail:`row ${r??"none"}, tag ${t??"none"}, main ${n??"none"}`}};return{current:r,next:i,check:{name:"version",status:"ok",detail:`${r} -> ${i}`}}}async function Rve(e){let t=e.nextVersion?`refs/heads/release/v${e.nextVersion}`:null,n=e.branches.filter((a)=>a.startsWith("refs/heads/release/")),r=e.token?await ly({token:e.token,base:e.apiBase,datasetId:e.datasetId,state:"open",fetcher:tR,userAgent:"nemar-cli-repull-plan"}):null,o={branches:n,pulls:r?.ok?r.pulls:null,...r?.ok?{}:{pullsUnread:r?cy(r):"no GitHub token"}},s=(a)=>({check:a,facts:o});if(t&&e.branches.includes(t))return s({name:"release-pr",status:"refused",code:"release-branch-exists",detail:`${t.slice(11)} exists`});if(!r)return s({name:"release-pr",status:"unchecked",code:"no-token",detail:"no GitHub token"});if(!r.ok)switch(r.kind){case"unreachable":return s({name:"release-pr",status:"unchecked",code:"github-unreachable",detail:r.detail});case"status":return s({name:"release-pr",status:"unchecked",code:"github-error",detail:`HTTP ${r.status}`});case"too-many":return s({name:"release-pr",status:"unchecked",code:"too-many-open",detail:"100 or more open"});default:return s({name:"release-pr",status:"unchecked",code:"github-error",detail:"unreadable answer"})}let i=r.pulls.filter((a)=>a.headRef.startsWith("release/"));if(i.length>0)return s({name:"release-pr",status:"refused",code:"release-pr-open",detail:i.map((a)=>`#${a.number} (${a.headRef})`).join(", ")});return s({name:"release-pr",status:"ok",detail:`${r.pulls.length} open, none a release`})}function Cve(e){if(e.remoteUuids.length===0)return{name:"annex-uuid",status:"refused",code:"no-nemar-s3-remote",detail:"remote.log names none"};if(e.remoteUuids.length>1)return{name:"annex-uuid",status:"refused",code:"nemar-s3-ambiguous",detail:`remote.log names ${e.remoteUuids.length}: ${e.remoteUuids.join(", ")}`};let t=e.remoteUuids[0],n=e.marker;if(!n)return{name:"annex-uuid",status:"unchecked",code:"no-bucket",detail:"nemar-s3 is not an S3 remote"};if(n.status!=="ok")return{name:"annex-uuid",status:"unchecked",code:`marker-${n.status}`,detail:n.detail};if(n.uuid!==t)return{name:"annex-uuid",status:"refused",code:"annex-uuid-mismatch",detail:`bucket marker ${n.uuid}, remote.log nemar-s3 ${t}`};return{name:"annex-uuid",status:"ok",detail:t}}var Ave=".nemar/metadata.json",EEt=5368709120,SEt=/^[a-z]{2}\d{6}$/;class oo extends Error{constructor(e){super(e);this.name="RepullCannotPlan"}}function $Et(e,t){let n=!1,r=()=>{if(n)return;if(n=!0,!t)vEt(e,{recursive:!0,force:!0,maxRetries:5,retryDelay:50})},o=(s)=>{mve(),r(),process.exit(s==="SIGINT"?130:143)};return process.on("SIGINT",o),process.on("SIGTERM",o),()=>{process.off("SIGINT",o),process.off("SIGTERM",o),r()}}async function uy(e){let t=e.env??process.env,n=e.datasetId;if(!SEt.test(n))throw new oo(`${n} is not a dataset id`);let r=Sve({datasetId:n,mapped:M6(n),row:e.catalog.dataset});if(!r.ds)return{planned:!1,preflight:[r.check],reason:r.check.code??"source",workdir:null};let o=r.ds,s=oy(o,t),i=xi(n,t),a=sy(s,null),c=sy(i,e.github.token),l=await Hxe(o,{graphqlUrl:e.openNeuroGraphqlUrl,attempts:2,retryDelayMs:1000}),d,f;try{d=await NM(s,["refs/tags/*","refs/heads/git-annex"],a),f=await NM(i,["refs/heads/main","refs/heads/git-annex","refs/heads/release/*","refs/tags/v*"],c)}catch(_){throw new oo(`could not list the remotes: ${_ instanceof Error?_.message:String(_)}`)}if(!f.has("refs/heads/main")||!f.has("refs/heads/git-annex"))throw new oo(`${n} has no main or no git-annex branch`);let p=[...d.keys()].filter((_)=>_.startsWith("refs/tags/")).map((_)=>_.slice(10)),m=[...f.keys()].filter((_)=>_.startsWith("refs/tags/v")).map((_)=>_.slice(10)),h=[...f.keys()].filter((_)=>_.startsWith("refs/heads/release/")),g=xEt(LM(e.workRoot??kEt(),`nemar-repull-${n}-`)),y=e.keepWorkdir===!0,b=$Et(g,y);try{let _=await FM({url:i,dest:LM(g,"nemar.git"),branch:"main",extra:["refs/heads/git-annex"],token:e.github.token}),x=await eve({rows:e.catalog.versions,highestTag:DEt(m),flag:e.fromTag,ds:o,readTagged:async(K)=>{let xt=`refs/tags/v${K}`;if(!f.has(xt))return;if((await Vo(["fetch","--quiet","--depth=1","--no-tags","origin",`+${xt}:${xt}`],{cwd:_.path,env:_.env})).exitCode!==0)throw new oo(`could not fetch ${xt}`);let $o=`${xt}:${Rn}`,aa=(await Hd(_.path,[$o])).get($o);if(!aa)return;try{return JSON.parse(ms(aa.toString("utf8")))}catch{return null}}}),k=$ve({flag:e.toTag,mirrorTags:p,fromTag:x.tag,upstream:l}),v=[x.check,k.check].filter((K)=>K.status==="refused"&&K.code!=="from-tag-not-recorded");if(x.tag===null||k.tag===null||v.length>0)return{planned:!1,preflight:[r.check,x.check,k.check],reason:(v[0]??x.check).code??"preflight",workdir:y?g:null};let C=x.tag,T=k.tag;if(!p.includes(C))throw new oo(`the mirrored tag ${C} is not on the GitHub mirror`);let V=d.has("refs/heads/git-annex"),A=await FM({url:s,dest:LM(g,"upstream.git"),branch:T,extra:[`refs/tags/${T}`,`refs/tags/${C}`,...V?["refs/heads/git-annex"]:[]]});for(let K of[A.path,_.path])if(await xve(K)!=="sha1")throw new oo("only SHA-1 repositories are planned");let F=await iy(A.path,`refs/tags/${C}`),M=await iy(A.path,`refs/tags/${T}`),U=await iy(_.path,"refs/heads/main"),B=await iy(_.path,"refs/heads/git-annex"),P=V?await iy(A.path,"refs/heads/git-annex"):null,[O,H,re]=await Promise.all([Rp(A.path,F.commit),Rp(A.path,M.commit),Rp(_.path,U.commit)]),Ee=new MM(e.maxFetchBytes??EEt),Zt=new aR(A,await ay(A.path,[F.commit,M.commit]),Ee),pt=new aR(_,await ay(_.path,[U.commit]),Ee),Ze=re.get(Rn);if(Ze)await pt.load([Ze.oid]);let oe=Ze?CEt(pt.get(Ze.oid)):null,je=typeof oe?.Version==="string"?Ww(oe.Version):null,Ie=Dve({rows:e.catalog.versions,tags:m,mainVersion:je});if(Ie.next===null)return{planned:!1,preflight:[r.check,x.check,k.check,Ie.check],reason:Ie.check.code??"version",workdir:y?g:null};let Q=[],mt=ty(e.catalog.dataset?.concept_doi),Ue=ty(typeof oe?.DatasetDOI==="string"?oe.DatasetDOI:null);if(mt!==null&&Ue!==null&&mt!==Ue)Q.push({code:"concept-doi-disagrees",detail:`the catalog's concept DOI is ${mt} and main's DatasetDOI is ${Ue}`});let W=ZD(_.env),J=new Map,le=async(K)=>{let xt=K.filter(($o)=>!J.has($o));if(xt.length===0)return;let tr=await Pd(_.path,"refs/heads/git-annex",xt,W);xt.forEach(($o,aa)=>J.set($o,tr[aa]??""))},ne=await cve({base:O,theirs:H,ours:re,upstream:Zt,nemar:pt,ds:o,toTag:T,nextVersion:Ie.next,conceptDoi:mt,prepareDeadKeys:le,deadAtNemar:(K)=>yi(J.get(K)??""),collect:e.collect}),Le=Ap(await Cp(_.path),n);if(Le.problem!==null)throw new oo(Le.problem);let{uuids:It,uuid:wr,record:Fc,region:Ce,prefix:st}=Le,Fn=new Map;for(let K of ne.decisions){if(!K.delta||K.target.kind!=="annex"&&K.target.kind!=="unannex")continue;let xt=Fn.get(K.target.key)??{paths:[],purpose:K.target.kind==="annex"?"copy":"unannex"};if(K.target.kind==="annex")xt.purpose="copy";xt.paths.push(K.path),Fn.set(K.target.key,xt)}await le([...Fn.keys()]);let Gl=null;if(e.presence==="bucket-listing"){if(!Fc?.bucket)throw new oo("nemar-s3 names no bucket, so there is no bucket to list");try{Gl=await kve({bucket:Fc.bucket,region:Ce,prefix:st,env:t})}catch(K){throw new oo(`the bucket listing failed: ${K instanceof Error?K.message:String(K)}`)}}let ws=(K,xt)=>Gl?pr(K,Gl):wr!==null&&Ki(xt).has(wr)||ne.oursKeys.has(K),Iy=[],ex=[],o3=0;for(let[K,{paths:xt,purpose:tr}]of[...Fn].sort(([$o],[aa])=>$o<aa?-1:1)){let $o=J.get(K)??"";if(yi($o)){if(xt.every((aa)=>Uo.test(aa)))ex.push(K);else Q.push({code:"target-names-dead-key",detail:`${xt.length} path(s) would name a key NEMAR's git-annex branch marks dead`});continue}if(tr==="copy"&&ws(K,$o)){o3++;continue}Iy.push({key:K,purpose:tr})}if(ex.length>0)Q.push({code:"dead-recording-unpinned",detail:`${ex.length} recording(s) N.0.0 would name carry a key NEMAR's git-annex branch marks dead, and no upstream version is pinned to scrub them from`});let zAe=V?await Eve(A.path,Iy.map((K)=>K.key)):new Map,s3=[],tx=[],kC=0,EC=0,SC=0,i3=0;for(let{key:K,purpose:xt}of Iy){let tr=[...zAe.get(K)??[]].filter((aa)=>aa.bucket===gp).pop()??null,$o=Ho(K)?.size??null;if(xt==="copy")if(SC++,$o===null)EC++;else kC+=$o;else i3++;if(!tr)tx.push(K);s3.push({key:K,purpose:xt,paths:[...Fn.get(K)?.paths??[]].sort(),size:$o,pin:tr?{bucket:tr.bucket,object:tr.object,version:tr.version}:null})}let Ny=ne.decisions.filter((K)=>K.delta&&K.target.kind==="annex-from-git").map((K)=>{let xt=K.target;return{path:K.path,oid:xt.oid,size:xt.size}}),a3=Ny.reduce((K,xt)=>K+(xt.size??0),0),c3=Ny.filter((K)=>K.size===null).length,of=await OEt(re,pt),nx=ne.decisions.filter((K)=>K.class==="conflict"),Yp=ne.decisions.filter((K)=>K.class==="correction"),rx=ne.decisions.filter((K)=>K.class==="unchecked"),$C=nx.length+Yp.length+rx.length;if(of.status==="unreadable")Q.push({code:"ledger-unreadable",detail:`${In} does not parse as a ledger: ${of.error}`});else if(of.recordedCorrections>0&&$C>0)Q.push({code:"ledger-correction-unexplained",detail:`the ledger records ${of.recordedCorrections} correction(s) and ${$C} path(s) are unexplained; a re-pull could revert one, so it refuses with no override`});if(ne.gitlinks.length>0)Q.push({code:"gitlink",detail:`${ne.gitlinks.length} submodule path(s)`});let l3=ne.decisions.filter((K)=>K.target.kind==="unknown");if(l3.length>0)Q.push({code:"target-unknown",detail:`${l3.length} path(s) whose N.0.0 content could not be computed`});if(ne.fetchRefused>0)Q.push({code:"fetch-bound",detail:`${ne.fetchRefused} blob(s) a check needed were not fetched (over --max-fetch-gb, or not delivered); ${rx.length} path(s) are unchecked`});let u3=await Rve({datasetId:n,nextVersion:Ie.next,branches:h,token:e.github.token,apiBase:e.github.apiBase}),GAe=Fc?.bucket?await vve({bucket:Fc.bucket,region:Ce,prefix:st,env:t}):null,d3=[r.check,x.check,k.check,Ie.check,u3.check,Cve({remoteUuids:It,marker:GAe})],ox=PEt(ne.decisions),WAe=new Set(ox.map((K)=>K.from)),KAe=new Set(ox.map((K)=>K.to)),sf=ne.decisions.filter((K)=>K.delta),f3=ne.decisions.filter((K)=>K.deleted),p3=(K)=>ne.sides.get(K.path)?.ours??{kind:"absent"},m3=(K)=>K.delta&&p3(K).kind==="absent",DC=sf.filter((K)=>Uo.test(K.path)),h3=0,g3=0;for(let K of DC){let xt=K.target,tr=xt.kind==="annex"?Ho(xt.key)?.size??null:xt.kind==="annex-from-git"?xt.size:0;if(tr===null)g3++;else h3+=tr}let y3=SC>0||Ny.length>0||[...sf,...f3].some((K)=>{let xt=p3(K),tr=K.target;return xt.kind==="annex"||tr.kind==="annex"||tr.kind==="annex-from-git"||tr.kind==="unannex"||Fo(K.path,0)}),b3=(K)=>{let xt={};for(let tr of K)xt[tr.subtype??"none"]=(xt[tr.subtype??"none"]??0)+1;return xt},RC=ne.description.keys,JAe={added:sf.filter((K)=>m3(K)&&!KAe.has(K.path)).length,changed:sf.filter((K)=>!m3(K)).length,deleted:f3.filter((K)=>!WAe.has(K.path)).length,renamed:ox.length,delta_paths:sf.length,upstream_changed:ne.decisions.filter((K)=>K.upstreamChanged).length,unexplained:$C,corrections:Yp.length,corrections_by_subtype:b3(Yp),conflicts:nx.length,conflicts_by_subtype:b3(nx),unchecked:rx.length,description_corrections:RC.filter((K)=>K.class==="correction").length,description_conflicts:RC.filter((K)=>K.class==="conflict").length,copy_items:SC,copy_bytes:kC,copy_bytes_unknown:EC,copy_unpinned:tx.length,copy_already_held:o3,unannex_items:i3,local_uploads:Ny.length,local_bytes:a3,local_bytes_unknown:c3,orphan_bytes_max:kC+a3+h3,orphan_bytes_unknown:EC+c3+g3,data_changing:y3,metadata_only:!y3,doi_count:Yp.length>0?2:1,fetched_bytes:Ee.used,fetch_refused:ne.fetchRefused},YAe={recordings_to_read:DC.length,json_files_to_read:sf.filter((K)=>vp.test(K.path)&&(K.target.kind==="git"||K.target.kind==="description")).length,scans_tables_to_read:sf.filter((K)=>kp.test(K.path)&&K.target.kind==="git").length,non_sha256e_recordings:DC.filter((K)=>K.target.kind==="annex"&&Ho(K.target.key)?.backend!=="SHA256E").length},w3=ne.gitlinks.length===0&&ne.decisions.every((K)=>K.explainedBy.base!==null)&&ne.description.explainedBase,XAe=Yp.length>0?_i(Ie.next,"patch"):null,_3={planner:Sw,dataset:n,upstream:{ds:o,from_tag:C,to_tag:T,from_tag_source:x.source,from_commit:F.commit,from_tree:F.tree,to_commit:M.commit,to_tree:M.tree,annex_commit:P?.commit??null},nemar:{main_commit:U.commit,main_tree:U.tree,annex_commit:B.commit,concept_doi:mt},versions:{current:Ie.current,n0:Ie.next,n1:XAe},lineage:{holds:w3,recordable:w3&&x.source!=="flag"},paths:ne.decisions.map(IEt),renames:ox.map((K)=>({from:K.from,to:K.to})),description:{status:ne.description.status,keys:RC.map((K)=>({...K})),source_datasets:{kept:ne.description.sourceDatasets.kept,added_by_nemar:ne.description.sourceDatasets.addedByNemar,removed_by_upstream:ne.description.sourceDatasets.removedByUpstream},merged_json:ne.description.mergedJson},corrections:Yp.map((K)=>({path:K.path,group:K.group,subtype:K.subtype})),conflicts:nx.map((K)=>({path:K.path,group:K.group,subtype:K.subtype})),unchecked:rx.map((K)=>({path:K.path,group:K.group,subtype:K.subtype})),copy:{presence_basis:Gl?"bucket-listing":"location-log",destination_prefix:st,items:s3,unpinned:tx,dead_recordings:ex},local_uploads:Ny,scrub_forecast:YAe,ledger:{status:of.status,lines:of.lines,recorded_corrections:of.recordedCorrections},nemar_owned_edits:await TEt(re,pt,o,T),counts:JAe,refusals:Q},QAe=d3.every((K)=>K.status==="ok")&&tx.length===0&&Q.length===0;return{planned:!0,file:{schema:kw,version:Ew,digest:gc(_3),created_at:(e.now??new Date).toISOString(),environment:e.environment,sources:iR(t,e.openNeuroGraphqlUrl),preflight:d3,executable:QAe,body:_3},workdir:y?g:null,release:u3.facts}}finally{b()}}function DEt(e){let t=null;for(let n of e){let r=/^v(\d+)\.(\d+)\.(\d+)$/.exec(n);if(!r)continue;let o=[Number(r[1]),Number(r[2]),Number(r[3])];if(!t||REt(o,t.parts)>0)t={tag:n,parts:o}}return t?.tag??null}function REt(e,t){for(let n=0;n<3;n++){let r=e[n]-t[n];if(r!==0)return r}return 0}function CEt(e){if(!e)return null;try{let t=JSON.parse(ms(e.toString("utf8")));return t&&typeof t==="object"&&!Array.isArray(t)?t:null}catch{return null}}function Ap(e,t){let n=Bg(e,zg),r=n.length===1?n[0]??null:null,o=r?hp(e).get(r):void 0,s=o?AEt(e,o.uuid)??"us-east-2":"us-east-2";return{uuids:n,uuid:r,record:o,region:s,prefix:o?.fileprefix??`${t}/objects/`,problem:o?bve(o.bucket,s):null}}function AEt(e,t){let n=null;for(let r of e.split(`
|
|
375
375
|
`)){let o=r.trim().split(/\s+/);if(o[0]!==t)continue;let s=o.find((i)=>i.startsWith("datacenter="));if(s)n=s.slice(11)}return n}function Ove(e){return e instanceof Error&&/^[A-Za-z]{1,40}$/.test(e.name)?e.name:"unparseable"}async function OEt(e,t){let n=e.get(In);if(!n)return{status:"absent",lines:0,recordedCorrections:0,error:null};await t.load([n.oid]);let r=t.get(n.oid);if(!r)return{status:"unreadable",lines:0,recordedCorrections:0,error:"its blob is not in the clone (1 MiB or larger)"};try{let o=cp(r.toString("utf8"));return{status:"ok",lines:o.length,recordedCorrections:o.filter((s)=>!Z$.has(s.action)).length,error:null}}catch(o){return{status:"unreadable",lines:0,recordedCorrections:0,error:Ove(o)}}}async function TEt(e,t,n,r){let o=e.get(Ave),s=`10.18112/openneuro.${n}.v${r}`,i=(f,p,m=null)=>[{path:Ave,edit:"is-identical-to",status:f,from:p,to:s,error:m}];if(!o)return i("absent",null);await t.load([o.oid]);let a=t.get(o.oid);if(!a)return i("unreadable",null,"its blob is not in the clone (1 MiB or larger)");let c;try{c=JSON.parse(ms(a.toString("utf8")))}catch(f){return i("unparseable",null,Ove(f))}let l=c?.related_identifiers,d=Array.isArray(l)?l.find((f)=>f?.relation_type==="IsIdenticalTo"):void 0;if(typeof d?.identifier!=="string")return i("no-is-identical-to",null);return i("ok",d.identifier)}function PEt(e){let t=(i)=>i.kind==="annex"?`A:${i.key}`:i.kind==="git"?`G:${i.oid}`:null,n=(i)=>i.ours.startsWith("A:")?i.ours:i.ours.startsWith("G:")?`G:${i.ours.split(":")[2]}`:null,r=e.filter((i)=>i.delta&&i.ours==="absent"),o=new Set,s=[];for(let i of e.filter((a)=>a.deleted)){let a=n(i);if(!a)continue;let c=r.find((l)=>!o.has(l.path)&&t(l.target)===a);if(!c)continue;o.add(c.path),s.push({from:i.path,to:c.path})}return s}function IEt(e){return{path:e.path,group:e.group,base:e.base,theirs:e.theirs,ours:e.ours,upstream_changed:e.upstreamChanged,explained_by_base:e.explainedBy.base,explained_by_theirs:e.explainedBy.theirs,class:e.class,subtype:e.subtype,decision:e.decision,target:{...e.target},delta:e.delta,deleted:e.deleted}}function Tve(e){return e.body.counts}function Pve(e){return e.body.upstream}function Ive(e){return e.body.versions}function lR(e){let t=Object.entries(e??{});return t.length===0?"":` (${t.map(([n,r])=>`${n} ${r}`).join(", ")})`}function uR(e,t){let n=Number(t??0);return n>0?`${e} bytes known, plus ${n} of unknown size`:`${e} bytes`}function Nve(e,t){let n=Number(t??0);return n>0?`${e} bytes known, plus ${n} of unknown size, no upper bound`:`at most ${e} bytes`}function NEt(e){return(e.body.nemar_owned_edits??[]).filter((n)=>n.status!=="ok").map((n)=>` ${n.path}: ${n.status}${n.error?` (${n.error})`:""}`)}function dy(e){return e.map((t)=>` ${t.name.padEnd(11)} ${t.status.padEnd(9)} ${t.code?`${t.code}`:""}${t.detail?`${t.code?": ":""}${t.detail}`:""}`)}function Fve(e,t){let n=Tve(e),r=Pve(e),o=Ive(e),s=e.body.refusals,i=[`Re-pull plan for ${e.body.dataset}: ${r.ds} ${r.from_tag} -> ${r.to_tag} (from ${r.from_tag_source})`,`Versions: ${o.current} -> ${o.n0}${o.n1?`, then ${o.n1} for the corrections`:""}`,"","Paths:",` delta ${n.delta_paths}: added ${n.added}, changed ${n.changed}, renamed ${n.renamed}; deleted ${n.deleted}`,` upstream-changed ${n.upstream_changed}, unexplained ${n.unexplained}`,` conflicts ${n.conflicts}${lR(n.conflicts_by_subtype)}`,` corrections ${n.corrections}${lR(n.corrections_by_subtype)}`,` unchecked ${n.unchecked} (bytes a check needed could not be read)`,` description keys: ${n.description_conflicts} conflict(s), ${n.description_corrections} correction(s)`,"Data:",` copy ${n.copy_items} key(s), ${uR(n.copy_bytes,n.copy_bytes_unknown)}, unpinned ${n.copy_unpinned}, already held ${n.copy_already_held}; un-annexed from upstream ${n.unannex_items}`,` local uploads ${n.local_uploads}, ${uR(n.local_bytes,n.local_bytes_unknown)}`,` orphan bytes if abandoned: ${Nve(n.orphan_bytes_max,n.orphan_bytes_unknown)}; ${n.data_changing?"data-changing":"metadata-only"}; DOIs ${n.doi_count}`,` fetched ${n.fetched_bytes} bytes of large blobs; ${n.fetch_refused} needed and not fetched`,"","Preflight:",...dy(e.preflight)],a=NEt(e);if(a.length>0)i.push("","NEMAR-owned edits that could not be read:",...a);if(s.length>0)i.push("","Refusals:",...s.map((c)=>` ${c.code}: ${c.detail}`));return i.push("",`Digest: ${e.digest}`,`Executable: ${e.executable?"yes":"no"}`,...t?[`Plan file: ${t}`]:[]),i}function Mve(e){let t=Tve(e),n=Pve(e),r=Ive(e),o=(i,a)=>`| ${i} | ${a} |`,s=e.body.refusals;return[`**Re-pull plan, ${e.body.dataset}** (${n.ds} ${n.from_tag} to ${n.to_tag}, ${r.current} to ${r.n0}${r.n1?` and ${r.n1}`:""})`,"","| Count | Value |","|---|---|",o("delta paths",t.delta_paths),o("added / changed / renamed / deleted",`${t.added} / ${t.changed} / ${t.renamed} / ${t.deleted}`),o("upstream-changed",t.upstream_changed),o("unexplained",t.unexplained),o("conflicts",`${t.conflicts}${lR(t.conflicts_by_subtype)}`),o("corrections",`${t.corrections}${lR(t.corrections_by_subtype)}`),o("unchecked",t.unchecked),o("copy keys / bytes",`${t.copy_items} / ${uR(t.copy_bytes,t.copy_bytes_unknown)}`),o("copy keys unpinned",t.copy_unpinned),o("local uploads / bytes",`${t.local_uploads} / ${uR(t.local_bytes,t.local_bytes_unknown)}`),o("orphan bytes if abandoned",Nve(t.orphan_bytes_max,t.orphan_bytes_unknown)),o("data-changing",t.data_changing?"yes":"no"),o("DOIs",t.doi_count),"",`Preflight: ${e.preflight.map((i)=>`${i.name} ${i.status}${i.code?` (${i.code})`:""}`).join(", ")}.`,`Refusals: ${s.length===0?"none":s.map((i)=>i.code).join(", ")}. Executable: ${e.executable?"yes":"no"}. Digest \`${e.digest.slice(0,19)}\`.`,""].join(`
|
|
376
376
|
`)}class I extends Error{code;lines;constructor(e,t,n=[]){super(t);this.code=e;this.lines=n;this.name="ExecuteRefused"}resumable=!1;step}function vc(e,t){if(e instanceof I)e.step??=t;return e}function BM(e){let t=e.nemar;return t&&typeof t==="object"&&!Array.isArray(t)?t:{}}function LEt(e,t){if(gc(e)===gc(t))return"equal";let n=BM(e),r={...t,nemar:{...t.nemar,main_commit:n.main_commit,main_tree:n.main_tree}};return gc(r)===gc(e)?"nemar-only-moved":"different"}function qEt(e){return e.length>0&&e.every((t)=>t.startsWith(".nemar/")&&t!==".nemar/corrections.jsonl")}function BEt(e,t){let n=new Set;for(let[r,o]of e){let s=t.get(r);if(!s||s.mode!==o.mode||s.oid!==o.oid)n.add(r)}for(let r of t.keys())if(!e.has(r))n.add(r);return[...n].sort()}function fy(e){return typeof e==="string"?e:null}function dR(e){return e&&typeof e==="object"&&!Array.isArray(e)?e:{}}function jve(e){let t;try{t=FEt(e,"utf8")}catch(i){let a=i.code;throw new I("plan-unreadable",`The plan file could not be read${typeof a==="string"?` (${a})`:""}.`)}let n;try{n=lD(t)}catch{throw new I("plan-unreadable","The plan file is not JSON.")}let{file:r,body:o,digest:s}=n;if(r.schema!==kw||r.version!==Ew)throw new I("plan-schema",`The file is not a re-pull plan this build reads (${kw} version ${Ew}).`);if(o.planner!==Sw)throw new I("planner-version",`The plan was made by planner ${String(o.planner)}, and this build executes plans of planner ${Sw} only: plan again, so the plan is made under the rules it is executed with.`);if(typeof r.digest!=="string"||r.digest!==s)throw new I("plan-tampered","The plan's body does not hash to the digest the file states, so it is not the plan that was reviewed. Plan again.");return{file:r,body:o}}function fR(e){let{file:t,body:n}=jve(e),r=fy(n.dataset);if(!r||!/^[a-z]{2}\d{6}$/.test(r))throw new I("plan-schema","The plan names no dataset id.");return{datasetId:r,digest:t.digest}}function Al(e){if(!e.dataset)throw new I("dataset-missing","The NEMAR API has no dataset row for the plan's dataset.");let t=e.dataset.anonymous;if(t!==0)throw new I(t===1?"anonymous-dataset":"anonymity-unknown",t===1?"An anonymous dataset is never re-pulled: the re-pull takes upstream's authors and README, which would undo the blind.":"The dataset row does not say whether it is an anonymous deposit, and an anonymous one is never re-pulled.")}function Op(e,t){let{file:n,body:r}=jve(e);if(n.environment!==t.environment)throw new I("plan-environment","The plan was made against another NEMAR API than the one this execution talks to.");let o=iR(t.env,t.openNeuroGraphqlUrl);if(n.sources!==o)throw new I("plan-sources",`The plan was made from ${String(n.sources)} and this execution reads ${o}; a plan made from test bases never executes against the real remotes, nor the reverse.`);return{file:n,body:r}}async function Lve(e,t){let{file:n,body:r}=Op(e,t);Al(t.catalog);let o=dR(r.upstream),s=dR(r.copy),i=fy(r.dataset),a=fy(o.to_tag);if(!i||!a)throw new I("plan-schema","The plan names no dataset or no to_tag.");let c;try{c=await uy({datasetId:i,toTag:a,fromTag:o.from_tag_source==="flag"?fy(o.from_tag)??void 0:void 0,presence:s.presence_basis==="bucket-listing"?"bucket-listing":"location-log",...t.maxFetchBytes!==void 0?{maxFetchBytes:t.maxFetchBytes}:{},keepWorkdir:!0,workRoot:t.workRoot,env:t.env,catalog:t.catalog,github:t.github,environment:t.environment,openNeuroGraphqlUrl:t.openNeuroGraphqlUrl,collect:t.collect})}catch(p){throw new I("not-planned",p instanceof oo?`The plan could not be made again: ${p.message}.`:`The plan could not be made again: ${p instanceof Error?p.name:"error"}.`)}let l=c.workdir,d=()=>{if(l)MEt(l,{recursive:!0,force:!0,maxRetries:5,retryDelay:50})};if(!c.planned||!l)throw d(),new I("not-planned",c.planned?"The planner kept no scratch clones.":`Nothing was planned from live sources: ${c.reason}.`,c.planned?[]:dy(c.preflight));let f=c.file;try{let p=LEt(r,f.body),m=null;if(p==="different")throw qM();if(p==="nemar-only-moved"){let g=fy(BM(r).main_commit),y=fy(BM(f.body).main_commit);if(!g||!y)throw qM();let b=await HEt(jEt(l,"nemar.git"),i,g,y,{env:t.env,token:t.github.token});if(b===null||!qEt(b))throw qM();m=y}let h=f.executable?null:UEt(f,c.release,t);if(!f.executable&&h?.ok!==!0){let g=f.body.refusals??[],y=dR(f.body.copy).unpinned??[];throw new I("not-executable",`The plan is not executable now: ${[...f.preflight.filter((b)=>b.status!=="ok").map((b)=>b.code??b.name),...g.map((b)=>String(b.code)),...y.length>0?[`${y.length} unpinned key(s)`]:[]].join(", ")}.`,[...dy(f.preflight),...h&&!h.ok?[`Not superseded: ${h.why}.`]:[]])}return{file:n,body:r,live:f,rebasedOnto:m,workdir:l}}catch(p){throw d(),p}}function UEt(e,t,n){if(!n.ownRelease)return null;let r=e.preflight.filter((a)=>a.status!=="ok"),o=e.body.refusals??[],s=dR(e.body.copy).unpinned??[];if(o.length>0||s.length>0||r.length!==1)return{ok:!1,why:"the plan is not executable for more than the superseded record's own release"};let i=r[0]?.code;if(i!=="release-branch-exists"&&i!=="release-pr-open")return{ok:!1,why:"the plan is not executable for another reason than a release branch or pull request"};return n.ownRelease(t)}function qM(){return new I("plan-stale","The live sources no longer give the reviewed plan: plan again and review the new digest.")}async function HEt(e,t,n,r,o){let s=sy(xi(t,o.env),o.token);if((await Vo(["fetch","--quiet","--depth=1","--no-tags","origin",n],{cwd:e,env:s})).exitCode!==0)return null;try{let[a,c]=await Promise.all([Rp(e,n),Rp(e,r)]);return BEt(a,c)}catch{return null}}var ln={name:"NEMAR re-pull",email:"noreply@nemar.org"},Ol="repull-work";function t_(e){return e.slice(7,15)}function Ec(e,t,n){let r=kc(e,"repull",t),o=kc(r,"work",t_(n));return{root:o,repo:kc(o,"repo"),plan:kc(o,"plan"),upload:kc(o,"upload"),bundle:kc(r,`${t_(n)}.bundle`),lock:kc(r,`${t_(n)}.lock`)}}function vo(e,t){Uve(e,{recursive:!0,mode:448});for(let n=e;n.startsWith(t);n=KEt(n))if(zM(n,448),n===t)break}var Tp={GIT_CONFIG_GLOBAL:"/dev/null",GIT_CONFIG_NOSYSTEM:"1"},JEt=["gc.auto=0","maintenance.auto=false","annex.addunlocked=false","core.autocrlf=false","core.hooksPath=/dev/null","core.attributesFile=/dev/null","core.excludesFile=/dev/null"],pR=0,Bve=[];async function Vd(e){if(pR===0)Bve=Object.keys(Tp).map((t)=>[t,process.env[t]]),Object.assign(process.env,Tp);pR++;try{return await e()}finally{if(pR--,pR===0)for(let[t,n]of Bve)if(n===void 0)Reflect.deleteProperty(process.env,t);else process.env[t]=n}}async function ee(e,t,n={}){let r=await R(["git",...t],{cwd:e,...n.stdin!==void 0?{stdin:n.stdin}:{},env:{...Tp,...n.env}});if(r.exitCode!==0&&!n.ok)throw new I(n.code??"git-failed",`git ${n.step??t[0]??""} failed in the working clone (exit ${r.exitCode}).`);return{stdout:r.stdout,stderr:r.stderr,exitCode:r.exitCode}}async function VM(e,t){return(await R(["git","cat-file","-e",`${t}^{commit}`],{cwd:e,env:{...Tp,GIT_NO_LAZY_FETCH:"1"}})).exitCode===0}async function WM(e){Ps(e.dir);let t=As(e.originUrl,e.token),n=await R(["git","clone","--quiet","--no-tags","--depth=2",...JEt.flatMap((i)=>["--config",i]),"--branch","main",e.originUrl,e.dir],{env:{...Tp,...t}});if(n.exitCode!==0)throw new I("clone-failed",`NEMAR's repository could not be cloned (exit ${n.exitCode}).`);let r=e.dir,o=t?{env:t}:{};if(!await VM(r,e.baseSha))await ee(r,["fetch","--quiet","--no-tags","--depth=2","origin",e.baseSha],{...o,ok:!0});if(!await VM(r,e.baseSha))throw new I("main-moved","The commit the re-pull bases on is no longer reachable on NEMAR's main: plan again.");await ee(r,["config","user.name",ln.name]),await ee(r,["config","user.email",ln.email]),await ee(r,["config","commit.gpgsign","false"]),await ee(r,["checkout","--quiet","-B",Ol,e.baseSha],{step:"checkout"}),await ee(r,["fetch","--quiet","--no-tags","--depth=1","origin","+refs/heads/git-annex:refs/remotes/origin/git-annex"],{...o,code:"clone-failed",step:"fetch of the git-annex branch"});let s=(await ee(r,["rev-parse","--verify","--quiet","refs/remotes/origin/git-annex"],{ok:!0})).stdout.trim();if(e.annexCommit!==null&&s!==e.annexCommit)throw new I("plan-stale","NEMAR's git-annex branch moved since the plan was made again: plan again and review the new digest.");return await ee(r,["annex","init","--quiet","--no-autoenable","nemar-repull"],{code:"clone-failed",step:"annex init"}),r}async function KM(e,t,n){e_(t,{force:!0}),await ee(e,["bundle","create","--quiet",t,`refs/heads/${Ol}`,"refs/heads/git-annex",`^${n}`,"^refs/remotes/origin/git-annex"],{code:"checkpoint-failed",step:"bundle create"}),zM(t,384)}async function mR(e){if(!GM(e.bundle))return"no-checkpoint";let t;try{t=await WM({dir:e.dir,originUrl:e.originUrl,baseSha:e.baseSha,token:e.token,annexCommit:e.annexCommit})}catch{return"clone-failed"}if(e.bundleAnnex&&!await VM(t,e.bundleAnnex)){let i=As(e.originUrl,e.token);await ee(t,["fetch","--quiet","--no-tags","--depth=1","origin",e.bundleAnnex],{...i?{env:i}:{},ok:!0})}if((await ee(t,["bundle","verify","--quiet",e.bundle],{ok:!0})).exitCode!==0)return"checkpoint-unverified";if((await ee(t,["fetch","--quiet","--no-tags",e.bundle,`refs/heads/${Ol}:refs/remotes/checkpoint/${Ol}`,"refs/heads/git-annex:refs/remotes/checkpoint/git-annex"],{ok:!0})).exitCode!==0)return"checkpoint-unreadable";await ee(t,["checkout","--quiet","-B",Ol,e.synthSha],{ok:!0});let o=async(i)=>(await ee(t,["rev-parse","--verify","--quiet",i],{ok:!0})).stdout.trim();if(await o("HEAD")!==e.synthSha||await o("HEAD^{tree}")!==e.synthTree||await o("HEAD^")!==e.baseSha)return"commit-not-in-checkpoint";return(await ee(t,["annex","merge","--quiet"],{ok:!0})).exitCode===0?null:"annex-merge-failed"}function Tl(e){for(let t=0;t<3;t++){let n=`${e}.${process.pid}.${qve()}.new`;Uve(n,{mode:448}),WEt(kc(n,"pid"),`${process.pid}
|
|
377
377
|
`,{mode:384});try{return UM(n,e),()=>{if(Zw(e)===process.pid)e_(e,{recursive:!0,force:!0})}}catch(s){e_(n,{recursive:!0,force:!0});let i=s.code;if(i!=="ENOTEMPTY"&&i!=="EEXIST")throw s}let r=Zw(e);if(r===void 0)continue;if(r===null||YEt(r))throw HM(e,r);let o=`${e}.${process.pid}.${qve()}.stale`;try{UM(e,o)}catch{continue}if(Zw(o)!==r){try{UM(o,e)}catch{}throw HM(e,Zw(e)??null)}e_(o,{recursive:!0,force:!0})}throw HM(e,Zw(e)??null)}function Zw(e){if(!GM(e))return;let t;try{t=zEt(kc(e,"pid"),"utf8")}catch{return null}let n=Number.parseInt(t,10);return/^\d+\n?$/.test(t)&&Number.isSafeInteger(n)&&n>0?n:null}function HM(e,t){return new I("execution-locked",`Another execution of this plan holds its lock (${t===null?"its process id cannot be read":`process ${t}`}): ${e}. Wait for it to finish. If no execution is running (a crashed run whose process id is now another process's), remove that directory and run again.`)}function YEt(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function Hve(e){let t;try{t=VEt(e)}catch{return}if(!t.isDirectory())return;try{zM(e,t.mode&4095|448)}catch{}for(let n of GEt(e))Hve(kc(e,n))}function Ps(e){for(let t=1;GM(e);t++){Hve(e);try{e_(e,{recursive:!0,maxRetries:5,retryDelay:50})}catch(n){if(t>=5)throw new I("workdir-busy",`A working directory could not be removed (${n.code??"error"}); is another run using it?`)}}}var ko=Ed+2,Vve=In;async function zve(e,t,n){let r=await ee(e,["diff-tree","-r","-z","--no-commit-id","--raw",t,n],{ok:!0});if(r.exitCode!==0)return null;let o=r.stdout.split("\x00"),s=[];for(let i=0;i+1<o.length;i+=2){let a=/^:([0-7]{6}) ([0-7]{6}) ([0-9a-f]{40}) ([0-9a-f]{40}) ([A-Z])\d*$/.exec(o[i]);if(!a)return null;s.push({srcMode:a[1],dstMode:a[2],srcOid:a[3],dstOid:a[4],status:a[5],path:o[i+1]})}return s}async function r_(e,t,n){let r=await zve(e,t,n);if(r===null)return null;return r.map((o)=>o.path).filter((o)=>!o.startsWith(".nemar/")&&!o.startsWith(".github/"))}async function n_(e,t){let n=await ee(e,["cat-file","blob",t],{ok:!0});return n.exitCode===0?n.stdout:null}async function XEt(e,t,n){let r=n.dstMode==="100644";if(n.path.startsWith(".nemar/")&&n.path!==Vve)return r&&(n.status==="A"||n.status==="M");if(n.path===".bidsignore"){if(!r||n.status!=="A"&&n.status!=="M")return!1;let o=n.status==="A"?"":await n_(e,n.srcOid),s=await n_(e,n.dstOid);if(o===null||s===null)return!1;let i=gl(o,hl);return i.changed&&s===i.content}if(n.path==="participants.tsv"){if(!r||n.status!=="A")return!1;let o=await ee(e,["ls-tree","-r","-z","--name-only",t],{ok:!0});if(o.exitCode!==0)return!1;let s=Fg(o.stdout.split("\x00").filter(Boolean).map((i)=>({path:i})));if(s.length===0)return!1;return await n_(e,n.dstOid)===Mg(s)}return!1}async function QEt(e,t){if(t.path!==Vve||t.dstMode!=="100644"||t.status!=="A"&&t.status!=="M")return!1;let n=t.status==="A"?"":await n_(e,t.srcOid),r=await n_(e,t.dstOid);if(n===null||r===null)return!1;let o=ml(n),s=ml(r);if(s.length<=o.length||o.some((i,a)=>i!==s[a]))return!1;try{return cp(s.slice(o.length).join(`
|
|
@@ -411,10 +411,10 @@ ${s}
|
|
|
411
411
|
|
|
412
412
|
`);if(i<0)throw sn("synthesis-mismatch","N.0.1's commit has no message.");let a=aj(s.slice(0,i)),c=s.slice(i+2),l=new Map((await js(t,o)).map((y)=>[y.path,y])),d=new Map((await js(t,n)).map((y)=>[y.path,y])),f=new Map((await js(t,r)).map((y)=>[y.path,y])),p=(y,b)=>y?.mode===b?.mode&&y?.oid===b?.oid,m=new Set;for(let y of new Set([...l.keys(),...d.keys()]))if(!p(l.get(y),d.get(y)))m.add(y);for(let y of m){if(!p(l.get(y),f.get(y)))throw sn("patch-main-moved","NEMAR's main moved by enrichment on a path N.0.1 replays, so N.0.1 is not made again on it; decline N.0.1 (nemar admin repull abandon) and correct the dataset by hand.");let b=d.get(y);if(b)f.set(y,b);else f.delete(y)}let h=await Oke(t,[...f.values()],"patch-again.index");return{sha:await Tke(t,h,r,c,a),tree:h}}async function Ike(e){let{dir:t,row:n}=e,r=e.head;for(let o=0;o<=Ed;o++){let s=await dj(t,r);if(!s)return null;if((await Is(t,n.patch_base_sha,s)).ok)try{let i=await fj({dir:t,commit:e.recorded,newMain:s});if(i.sha===r)return(await Is(t,r,e.head)).ok?{sha:r,tree:i.tree,baseSha:s}:null}catch(i){if(!(i instanceof I))throw i}r=s}return null}var Wt=(e,t)=>({ok:!1,stage:e,reason:t});async function i$t(e,t){let n;for(let r=0;r<20;r++){let o=await Lo({dataset:e,limit:50,after:n});for(let s of o.repulls){if(s.pr_number===t)return{row:s,pr:"n0"};if(s.patch_pr_number===t)return{row:s,pr:"n1"}}if(o.next_after===null)return null;n=o.next_after}throw Error("the re-pull records of this dataset could not be read to the end")}async function pj(e){if(e.headRef==="")return{kind:"refused",reason:"GitHub's answer did not name the pull request's head branch, so whether it is an upstream re-pull's cannot be told, and a re-pull's merges only through its gate."};if(!e.headRef.startsWith("release/"))return{kind:"ordinary"};let t;try{t=await i$t(e.datasetId,e.prNumber)}catch(o){return{kind:"refused",reason:`Could not tell whether this is an upstream re-pull's pull request (the NEMAR API answered ${Np(o)}), and a re-pull's merges only through its gate.`}}if(!t)return{kind:"ordinary"};let n={datasetId:e.datasetId,token:e.token,base:e.base,env:e.env,configDir:e.configDir,force:e.force},r=await mj(n,{row:t.row,prNumber:e.prNumber});if(!r.ok)return{kind:"refused",reason:`This is upstream re-pull #${t.row.id}'s pull request, which merges only through its gate, and the gate refuses (${r.stage}): ${r.reason}`};return{kind:"repull",ctx:n,check:r.check}}function a$t(e,t,n="n0"){return fbe(e,t,n,"gate")}async function Nke(e,t,n){let r,o="not_reviewed",s=null;try{let i=L$(await wg(e,t,n),n);if(i.ok)o=i.verdict,s=i.staleVerdict;else r=i.why}catch(i){let a=pn(i);if(a==="not_owned_here"||a==="github_unavailable"||a==="no_such_pull_request")r=i instanceof Error?i.message:"the NEMAR API did not answer";else return Wt("review",`The automated review of ${n.slice(0,12)} could not be read (${i instanceof L?`HTTP ${i.statusCode}`:"no answer"}); nothing was claimed or merged.`)}return q$({verdict:o,staleVerdict:s,unread:r})}async function mj(e,t){return Vd(()=>c$t(e,t))}async function c$t(e,t){let n=e.datasetId,r;try{r=t?await K$(t.row.id):(await Lo({dataset:n,open:!0,limit:1})).repulls[0]??null}catch(x){return Wt("not-ready",`The re-pull record could not be read (${Np(x)}).`)}if(!r)return Wt("not-ready",`${n} has no open re-pull.`);let o=t?r.pr_number===t.prNumber?"n0":r.patch_pr_number===t.prNumber?"n1":null:abe(r.status);if(t&&o===null)return Wt("not-ready",`Pull request #${t.prNumber} is not one of re-pull #${r.id}'s pull requests.`);let s=o??"n0",i=Dn[s];if(r.status!==i.gatesClear)return Wt("not-ready",r.status==="pr_open"||r.status==="patch_synthesized"?`Re-pull #${r.id}'s gates are not recorded: run nemar admin repull resume ${n} (the identifier screen and GitHub's state).`:`Re-pull #${r.id} is ${r.status}; its ${s==="n0"?"N.0.0":"N.0.1"} pull request is merged only from ${i.gatesClear}.`);let a=r[i.number],c=r[i.gates],l=r[i.branch],d=s==="n0"?r.base_sha:r.patch_base_sha;if(e.bidsFailureReason!==void 0&&r.origin!=="administrator")return Wt("bids",`Re-pull #${r.id} was opened by the automatic path, and its pull request is not merged over a failed BIDS validation; nothing was claimed or merged. Merge it once BIDS validation passes, or abandon it (nemar admin repull abandon ${n}) and re-pull it by hand.`);try{Al(await fc(n))}catch(x){return Wt("not-ready",x instanceof Error?x.message:String(x))}let f=await Cs(e.token,n,a,e.base);if(!f.ok)return Wt("github",`Pull request #${a} could not be read: ${f.reason}`);if(f.value.state!=="open")return Wt("not-ready",`Pull request #${a} is ${f.value.state}; run nemar admin repull resume ${n}, which records it.`);if(f.value.draft)return Wt("not-ready",`Pull request #${a} is a draft.`);if(f.value.baseRef!=="main"||f.value.headRef!==l)return Wt("not-ready",`Pull request #${a} is not ${l} into main.`);if(!Gi(f.value.headRepo,n)||!Gi(f.value.baseRepo,n))return Wt("not-ready",`Pull request #${a} is not from and into ${fs}/${n} itself (its head is ${f.value.headRepo??"a repository GitHub no longer names"}, its base ${f.value.baseRepo??"a repository GitHub no longer names"}): a fork's pull request is never merged as a re-pull's. Nothing was claimed or merged.`);if(f.value.headSha!==c)return Wt("not-ready",`Pull request #${a} is at ${f.value.headSha.slice(0,12)}, not the screened ${c.slice(0,12)}: run nemar admin repull resume ${n}.`);let p=await Pl({configDir:e.configDir,datasetId:n,digest:r.plan_digest,purpose:"merge",env:e.env,token:e.token});try{let x=await Nl({work:p.dir,baseSha:d,env:p.env});if(x!==d){let k=await r_(p.dir,d,x);if(k===null)return Wt("github","Whether NEMAR's main moved outside .nemar/ and .github/ since the gates could not be read; nothing was claimed or merged.");if(k.length>0)return Wt("merge-main-moved",`NEMAR's main moved by enrichment since the gates, on ${k.length} path(s) outside .nemar/ and .github/, so the squash would tag a tree the gates did not clear; nothing was claimed or merged. Run nemar admin repull resume ${n}: it makes the commit again on the new main, whose screen and gates run again.`)}}catch(x){if(x instanceof I&&x.code==="main-moved")return Wt("main-moved",`${x.message} Nothing was claimed or merged.`);return Wt("github",x instanceof Error?x.message:String(x))}finally{p.close()}let m=await Nke(n,a,c);if("ok"in m)return m;if(m.kind==="needs_force"&&!e.force)return Wt("review",m.reason);let h=m.kind==="confirm"?[m.warning]:m.kind==="needs_force"?["Merging anyway (--force): the automated review failed, is running or was not read."]:[],g;try{g=await Ig(r.id)}catch(x){return Wt("screen",`The identifier screen could not be read (${Np(x)}).`)}if(!g.exempt){let x=g.screens.find((v)=>v.pr===s&&v.sha===c);if(!(x!==void 0&&(x.gate==="clear"||x.gate==="acknowledge"&&x.acknowledged_at!==null)))return Wt("screen",`${x?x.headline:"No identifier screen of this head is recorded"}; run nemar admin repull resume ${n}.`)}if(e.bidsFailureReason!==void 0){let x=await l$t(e,r,a,c,f.value.mergeableState);if(x)return x}else{let x=await Og(e.token,n,a,{headSha:c,mergeableState:f.value.mergeableState},{base:e.base,...e.sleep?{sleep:e.sleep}:{}});if(!x.ok)return Wt("github",`${x.why} Nothing was claimed or merged.`)}let y=r.counts?.corrections;if(s==="n1"&&(typeof y!=="number"||!Number.isSafeInteger(y)||y<0))return Wt("message",`Re-pull #${r.id} does not state how many corrections N.0.1 replays, so its squash message would not carry ${lj}:; nothing was claimed or merged.`);let b=a$t(r,a,s),_=await Fl(`${b.title}
|
|
413
413
|
|
|
414
|
-
${b.message}`,r);if(_)return Wt("message",`The squash message would not carry the re-pull's trailers: ${_}.`);return{ok:!0,check:{row:r,pr:s,version:r[i.version],prNumber:a,head:c,squash:b,heldClaim:r[i.claimSha]===c,warnings:h}}}async function l$t(e,t,n,r,o){let s=await op(e.token,e.datasetId,n,{headSha:r,mergeableState:o},{base:e.base,...e.sleep?{sleep:e.sleep}:{}});if(!s.ok){if(s.kind==="unreadable")return Wt("github",`Pull request #${n} could not be read: ${s.reason} Nothing was claimed or merged.`);return Wt("not-ready",s.kind==="moved"?`Pull request #${n} changed since it was read; run the merge again. Nothing was claimed or merged.`:`Pull request #${n} is no longer open; nothing was claimed or merged.`)}if(s.state==="unstable")return Fke(e,t,n,r);if(s.state==="blocked")return Wt("bids","GitHub reports the pull request blocked: this dataset's rules require BIDS validation, and merging would be a bypass, which a re-pull never uses. Nothing was claimed or merged.");if(s.state==="clean")return Wt("bids","GitHub reports the pull request clean, so no check fails: merge it without --bids-failure-reason. Nothing was claimed or merged.");let i=Ag(s.state);return Wt("github",`${i.ok?"GitHub's state is not unstable.":i.why} Nothing was claimed or merged.`)}async function Fke(e,t,n,r){let o=await $be({token:e.token,base:e.base,datasetId:e.datasetId,sha:r,origin:t.origin,mergeableState:"unstable",prNumber:n});if(o.kind==="bids-only")return null;return o.kind==="unreadable"?Wt("github",`Whether BIDS validation is the one check of #${n} that fails could not be read: ${o.why}. Nothing was claimed or merged.`):Wt("bids",`A merge over a failed BIDS validation is made only while that validation is the one check that fails, and ${o.why}. Nothing was claimed or merged.`)}function Np(e){return e instanceof L?`HTTP ${e.statusCode}`:e instanceof Error?e.message:String(e)}function DR(e,t="n0"){return`This merge mints one irreversible version DOI, v${e[Dn[t].version]}, and takes one unit of today's re-pull merge cap.`}async function l_(e,t,n){let{row:r,prNumber:o}=t,s=await Nke(e.datasetId,o,t.head);if("ok"in s)return{merged:!1,stage:s.stage,reason:s.reason};if(s.kind==="needs_force"&&!e.force)return{merged:!1,stage:"review",reason:s.reason};if(n.confirm){let c=[DR(r,t.pr),...t.warnings];if(!await n.confirm(`${c.join(" ")} Merge pull request #${o} of ${e.datasetId}?`))return{merged:!1,stage:"declined",reason:"Not confirmed; nothing was claimed or merged."}}let i=Ec(e.configDir,e.datasetId,r.plan_digest);vo(o$t(i.lock),s$t(e.configDir,"repull"));let a;try{a=Tl(i.lock)}catch(c){if(!(c instanceof I))throw c;return{merged:!1,stage:"not-ready",reason:`${c.message} A resume or an execution of re-pull #${r.id} runs now; nothing was claimed or merged.`}}try{return await p$t(e,t,n)}finally{a()}}function u$t(e,t){let n=pn(e);if(!(e instanceof L)||e.statusCode===0||e.statusCode>=500)return{merged:!1,stage:"github",claimHeld:!0,reason:`The claim to merge got no usable answer (${Np(e)}), so a claim may be held. Nothing was merged. nemar admin repull resume ${t} reads the record, and expires a claim nothing merged under once it is 30 minutes old.`};let r=`The claim to merge was refused (${n??Np(e)}): ${e.message} Nothing was merged.`;if(n==="merge-cap"||n==="merge-cap-unreadable")return{merged:!1,stage:"cap",reason:r};if(n==="screen-not-clear"||n==="screen-changed")return{merged:!1,stage:"screen",reason:r};if(n?.startsWith("bids-override-"))return{merged:!1,stage:"bids",reason:r};return{merged:!1,stage:"not-ready",reason:r}}function d$t(e,t){let n=pn(e),r=e instanceof Error?e.message:String(e);return{merged:!1,stage:n==="screen-not-clear"?"screen":!(e instanceof L)||e.statusCode===0||e.statusCode>=500||n==="github-unreadable"?"github":"not-ready",claimHeld:!0,reason:`The claim to merge already held was not used (${n??Np(e)}): ${r} Nothing was merged. nemar admin repull resume ${t} reads GitHub, records a merge that happened, and expires the claim once it is 30 minutes old.`}}function f$t(e){if(e.outcome==="refused")return`GitHub refused the merge: ${e.reason}`;if(e.merge)return e.merge.why;return e.status===409?"The pull request changed after the gate read it (its head moved, or it was closed), so the merge was not sent.":`GitHub could not be read at the last look before the merge (${e.status===0?"no answer":`HTTP ${e.status}`}), so the merge was not sent.`}async function p$t(e,t,n){let{row:r,prNumber:o,head:s,pr:i}=t,a=Dn[i],c=e.bidsFailureReason;if(c!==void 0&&t.heldClaim)return{merged:!1,stage:"bids",claimHeld:!0,reason:`A claim to merge ${s.slice(0,12)} is already held, and a merge over a failed BIDS validation is sent only under a claim of its own, which records its reason. Nothing was merged. nemar admin repull resume ${e.datasetId} records a merge that happened, or expires the claim once it is 30 minutes old; then run this again.`};if(c!==void 0){let d=await Fke(e,r,o,s);if(d)return{merged:!1,stage:d.stage,reason:d.reason}}if(!t.heldClaim){try{await rr(r.id,{from:a.gatesClear,to:a.gatesClear,fields:{[a.claimSha]:s},...c!==void 0?{override:{kind:"bids-failure",reason:c}}:{}})}catch(d){return u$t(d,e.datasetId)}if(n.out(`Claimed one unit of today's re-pull merge cap for ${s.slice(0,12)}.`),c!==void 0)n.out("Recorded with the claim: the merge is over a failed BIDS validation, and why.")}else{try{await bbe(r.id,{pr:i,sha:s})}catch(d){return d$t(d,e.datasetId)}n.out(`A claim to merge ${s.slice(0,12)} is already held; the merge is sent again under it.`)}let l=await pw(e.token,e.datasetId,o,s,"squash",{base:e.base,commit:t.squash,...c!==void 0?{state:"unstable"}:{},...e.sleep?{sleep:e.sleep}:{},...n.tries!==void 0?{tries:n.tries}:{}});if(l.ok)try{let d=await Y$(r.id,i);return{merged:!0,row:d.repull,mergeSha:d.repull[a.mergeSha],recorded:!0}}catch(d){return n.out(`GitHub merged pull request #${o}, and the merge could not be recorded yet (${pn(d)??Np(d)}); nemar admin repull resume ${e.datasetId} records it.`),{merged:!0,row:r,mergeSha:null,recorded:!1}}if(l.outcome==="unknown"||l.outcome==="different")return{merged:!1,stage:"github",outcome:l.outcome,claimHeld:!0,reason:`${l.reason} GitHub may have merged it: the claim is kept, and nemar admin repull resume ${e.datasetId} reads GitHub and records the merge.`};return{merged:!1,stage:"github",outcome:l.outcome,claimHeld:!0,reason:`${f$t(l)} The claim to merge is kept: run nemar admin repull merge ${e.datasetId} again within 25 minutes of the claim to send the merge under it, once GitHub reports the pull request clean at the same head; if the head moved, nemar admin repull resume ${e.datasetId} expires the claim once it is 30 minutes old and then records the new head.`}}ze();fn();import{dirname as J$t,join as Y$t}from"path";no();xr();_l();var{spawn:Mke}=globalThis.Bun;var CR=1048576,m$t=1024*CR,zrn=5*CR,Grn=8*CR,Wrn=5*CR,jke=4*m$t,Lke=1e4;var h$t={failed:1,usage:2,refused:3,unreadable:4,remainder:5};class qke extends Error{word;exitCode;constructor(e,t=h$t.failed){super(e);this.word=e;this.exitCode=t;this.name="StageError"}}class Bt extends Error{code;op;constructor(e,t){super(`${t}:${e}`);this.code=e;this.op=t;this.name="AwsCliError"}}var g$t={AccessDenied:"access-denied","403":"access-denied",NoSuchKey:"not-found",NoSuchVersion:"not-found",NoSuchObjectLockConfiguration:"not-found",NotFound:"not-found","404":"not-found",NoSuchUpload:"no-such-upload",PreconditionFailed:"precondition-failed","412":"precondition-failed",ConditionalRequestConflict:"precondition-failed",InvalidRange:"invalid-range","416":"invalid-range",SlowDown:"throttled",Throttling:"throttled",ThrottlingException:"throttled",RequestLimitExceeded:"throttled","503":"throttled",ExpiredToken:"credentials",InvalidAccessKeyId:"credentials",InvalidToken:"credentials",SignatureDoesNotMatch:"credentials","401":"credentials"};function y$t(e,t){return new Bt(g$t[e]??"failed",t)}function b$t(e,t){let n=/An error occurred \(([A-Za-z0-9]+)\) when calling the (\w+) operation/.exec(e);if(n)return y$t(n[1],n[2]);if(/Could not connect to the endpoint URL|Connection was closed|Read timeout/.test(e))return new Bt("unreachable",t);if(/Unable to locate credentials|SSO session|token has expired/i.test(e))return new Bt("credentials",t);return new Bt("failed",t)}function Gd(e){if(e instanceof qke)return e.word;if(e instanceof Bt)return`${e.op}:${e.code}`;return"unexpected"}var RR=new Set;var AR=120000,w$t=5;function OR(e={}){let t=e.command??["aws","configure","export-credentials","--format","process"],n=e.skewMs??120000,r=e.now??Date.now,o=e.timeoutMs??60000,s,i;async function a(){let c;try{c=Mke({cmd:t,...e.commandEnv?{env:e.commandEnv}:{},stdout:"pipe",stderr:"ignore"})}catch{throw new Bt("credentials","ExportCredentials")}RR.add(c);let l=setTimeout(()=>c.kill("SIGKILL"),o),d,f;try{[d,f]=await Promise.all([new Response(c.stdout).text(),c.exited])}finally{clearTimeout(l),RR.delete(c)}if(f!==0)throw new Bt("credentials","ExportCredentials");let p;try{p=JSON.parse(d)}catch{throw new Bt("bad-output","ExportCredentials")}let m=typeof p.AccessKeyId==="string"?p.AccessKeyId:"",h=typeof p.SecretAccessKey==="string"?p.SecretAccessKey:"",g=typeof p.SessionToken==="string"?p.SessionToken:"";if(!m||!h)throw new Bt("bad-output","ExportCredentials");if(!m.startsWith("ASIA")||!g)throw new Bt("long-lived-credentials","ExportCredentials");let y=typeof p.Expiration==="string"?Date.parse(p.Expiration):Number.NaN,b={AWS_ACCESS_KEY_ID:m,AWS_SECRET_ACCESS_KEY:h,AWS_SESSION_TOKEN:g};return s={env:b,expiresAt:Number.isFinite(y)?y:r()+n*2},b}return{async env(){if(s&&s.expiresAt-n>r())return s.env;return i??=a().finally(()=>{i=void 0}),i}}}var _$t="when_supported";function TR(e){let t={};for(let[n,r]of Object.entries(e.env??process.env))if(r!==void 0)t[n]=r;if(t.AWS_PAGER="",t.AWS_REQUEST_CHECKSUM_CALCULATION=_$t,e.endpointUrl)t.AWS_ENDPOINT_URL_S3=e.endpointUrl;return{async api(n,r,o={}){let s=n.split("-").map((p)=>p.charAt(0).toUpperCase()+p.slice(1)).join(""),i=["aws","s3api",n,...r,"--region",e.region,"--output","json"],a=e.credentials?await e.credentials.env():{},c;try{c=Mke({cmd:i,env:{...t,...a},stdout:"pipe",stderr:"pipe"})}catch{throw new Bt("spawn-failed",s)}RR.add(c);let l=e.timeoutMs*(o.slow?w$t:1),d=!1,f=setTimeout(()=>{d=!0,c.kill("SIGKILL")},l);try{let[p,m,h]=await Promise.all([new Response(c.stdout).text(),new Response(c.stderr).text(),c.exited]);if(d)throw new Bt("timeout",s);if(h!==0)throw b$t(m,s);let g=p.trim();if(g==="")return{};try{let y=JSON.parse(g);if(typeof y!=="object"||y===null||Array.isArray(y))throw new Bt("bad-output",s);return y}catch(y){if(y instanceof Bt)throw y;throw new Bt("bad-output",s)}}finally{clearTimeout(f),RR.delete(c)}}}}async function Bke(e,t,n,r=()=>!1){let o=Array(e.length).fill(void 0),s=0,i=async()=>{while(s<e.length&&!r()){let a=s++;o[a]=await n(e[a],a)}};return await Promise.all(Array.from({length:Math.max(1,t)},i)),o}no();yo();import{chmodSync as x$t,rmSync as v$t,writeFileSync as k$t}from"fs";import{join as E$t}from"path";ps();var S$t=5368709120,Hke="us-east-1",$$t=8;function PR(e,t){return`${e}/staging/repull-${t}.json`}var Ml=(e)=>typeof e==="string"?e:void 0;async function Wd(e,t,n){let r=new Map,o=new Set,s=null;for(;;){let i=await e.api("list-objects-v2",["--bucket",t,"--prefix",n,"--max-keys","1000","--no-paginate",...s?["--continuation-token",s]:[]]),a=i.Contents;if(a!==void 0&&!Array.isArray(a))throw new Bt("bad-output","ListObjectsV2");for(let c of a??[]){let l=Ml(c.Key);if(l===void 0||typeof c.Size!=="number")throw new Bt("bad-output","ListObjectsV2");if(l.startsWith(n)&&l.length>n.length)r.set(l.slice(n.length),c.Size)}if(i.IsTruncated!==!0)return r;if(s=Ml(i.NextContinuationToken)??null,!s||o.has(s))throw new Bt("bad-output","ListObjectsV2");o.add(s)}}async function Vke(e){let t=E$t(e.dir,"staging-manifest.json");k$t(t,hc(e.manifest),{mode:384}),x$t(t,384);try{await e.aws.api("put-object",["--bucket",e.bucket,"--key",e.key,"--body",t,"--content-type","application/json"])}finally{v$t(t,{force:!0})}}async function Uke(e,t,n,r){let o;try{o=await e.api("head-object",["--bucket",t,"--key",n,...r?["--version-id",r]:[]])}catch(i){if(i instanceof Bt&&i.code==="not-found")return null;throw i}let s=Ml(o.ETag);if(typeof o.ContentLength!=="number"||s===void 0)throw new Bt("bad-output","HeadObject");return{size:o.ContentLength,etag:s,versionId:Ml(o.VersionId)}}function D$t(e){return`${e.bucket}/${e.object}?versionId=${e.version}`}function R$t(e,t){return Math.max(t,Math.ceil(e/Lke))}async function C$t(e){let{aws:t,bucket:n,key:r}=e,o=await t.api("create-multipart-upload",["--bucket",n,"--key",r]),s=Ml(o.UploadId);if(!s)throw new Bt("bad-output","CreateMultipartUpload");try{let i=R$t(e.size,e.partBytes),a=[];for(let c=0,l=1;c<e.size;c+=i,l++){let d=Math.min(c+i,e.size)-1,f=await t.api("upload-part-copy",["--bucket",n,"--key",r,"--upload-id",s,"--part-number",String(l),"--copy-source",e.source,"--copy-source-range",`bytes=${c}-${d}`,"--copy-source-if-match",e.etag],{slow:!0}),p=f.CopyPartResult,m=p?Ml(p.ETag):void 0;if(!m)throw new Bt("bad-output","UploadPartCopy");if(Ml(f.CopySourceVersionId)!==e.version)throw new I("pin-version-mismatch",`S3 copied part ${l} of a multipart copy from another version than the pinned one`);a.push({ETag:m,PartNumber:l})}await t.api("complete-multipart-upload",["--bucket",n,"--key",r,"--upload-id",s,"--multipart-upload",JSON.stringify({Parts:a})],{slow:!0})}catch(i){try{await t.api("abort-multipart-upload",["--bucket",n,"--key",r,"--upload-id",s])}catch{e.open.push({key:r,uploadId:s})}throw i}}async function A$t(e,t,n,r){let o=Ml(r.VersionId);if(o===void 0)return!1;try{return await e.api("delete-object",["--bucket",t,"--key",n,"--version-id",o]),!0}catch{return!1}}function O$t(e){if(e instanceof I)return e;if(e instanceof Ke)return new I("write-refused",e.message);if(e instanceof Bt){if(e.op==="CopyObject"||e.op==="UploadPartCopy"){if(e.code==="not-found")return new I("pin-absent","a pinned upstream version is no longer served");if(e.code==="precondition-failed")return new I("pin-changed","a pinned upstream version changed its ETag")}return new I("copy-failed",`an S3 call failed (${Gd(e)})`)}return new I("copy-failed",`a copy failed (${e instanceof Error?e.name:"error"})`)}async function zke(e){let t=e.singleCopyMax??S$t,n=e.partBytes??jke,r=0,o=0,s=0,i=[],a=[],c=e.manifest.items;if(await Bke(c,e.concurrency??$$t,async(l)=>{try{let d=qo(l.key),f=e.existing.get(l.key);if(d!==null&&f===d){o++;return}let p=await Uke(e.aws.source,l.bucket,l.object,l.version);if(!p)throw new I("pin-absent","a pinned upstream version is not served");if(p.versionId!==l.version)throw new I("pin-version-mismatch","upstream answered for another version than the pinned one, or for none");if(d!==null&&p.size!==d)throw new I("pin-size-mismatch","a pinned upstream version is not the size its key declares");if(d===null&&f===p.size){o++;return}let m=`${e.prefix}${l.key}`,h=D$t(l);if(p.size<=t){let y=await e.aws.dest.api("copy-object",["--bucket",e.destBucket,"--key",m,"--copy-source",h,"--copy-source-if-match",p.etag,"--tagging-directive","REPLACE"],{slow:!0});if(Ml(y.CopySourceVersionId)!==l.version){let b=await A$t(e.aws.dest,e.destBucket,m,y);throw new I("pin-version-mismatch",b?"S3 copied from another version than the pinned one; the copy was removed":"S3 copied from another version than the pinned one and the copy could not be removed: delete it by hand before a rerun")}}else await C$t({aws:e.aws.dest,source:h,version:l.version,etag:p.etag,size:p.size,bucket:e.destBucket,key:m,partBytes:n,open:a});let g=await Uke(e.aws.dest,e.destBucket,m);if(!g||g.size!==p.size)throw new I("copy-size-mismatch","a copied object is not the size of the version it was copied from");r++,s+=p.size}catch(d){i.push(O$t(d))}},()=>i.length>0),i.length>0){let l=i[0],d=a.length>0?` ${a.length} multipart upload(s) could not be aborted and stay open (abort them with abort-multipart-upload): ${a.map((f)=>f.uploadId).join(", ")}.`:"";throw new I(l.code,`The copy stopped: ${l.message}; ${i.length} of ${c.length} item(s) refused, ${r} copied and ${o} already present this run. Nothing is registered for a partial copy, and a rerun skips what landed.${d}`)}return{copied:r,skipped:o,bytes:s}}import{createHash as j$t}from"crypto";import{readFileSync as L$t}from"fs";import{join as q$t}from"path";no();oc();sc();ze();Ng();no();ze();ze();function gs(e,t){if(t instanceof I)return`[${e}:${t.code}] ${t.message}`.slice(0,2000);let n=t instanceof Error?t.name:"unknown";return`[${e}:${e}-failed] The step failed (${n}).`}function ot(e,t){let n=new I(e,t);return n.resumable=!0,n}function so(e,t){let n=pn(e)??(e instanceof L?"record-refused":"github-failed"),r=e instanceof Error?e.message:String(e);return ot(n,`${t}: ${r}`)}function hj(e){if(e.status==="pr_open")return{branch:e.branch,pr_number:e.pr_number,head_sha:e.head_sha};if(e.status==="patch_synthesized")return{patch_version:e.patch_version,patch_branch:e.patch_branch,patch_pr_number:e.patch_pr_number,patch_head_sha:e.patch_head_sha,patch_base_sha:e.patch_base_sha};return{}}async function io(e,t,n){let r=hj(e);try{await rr(e.id,{from:e.status,to:e.status,fields:r,error:t})}catch(o){n(`The failure could not be recorded on re-pull #${e.id} (${pn(o)??(o instanceof L?`HTTP ${o.statusCode}`:"no answer")}); its record keeps the last error it had.`)}}function jl(e,t){return new I(e,`${t} Nothing was accepted or written.`)}var T$t=new Set(["github-unreadable","attestation-unwritten"]),P$t=new Set([0,408,429]);function Wke(e,t){let n=pn(e),r=e instanceof Error?e.message:String(e),o=n===void 0?!(e instanceof L)||P$t.has(e.statusCode)||e.statusCode>=500:T$t.has(n),s=new I(n??(e instanceof L?"record-refused":"api-unreadable"),`${t}: ${r}`);return s.resumable=o,s}var an=(e)=>e.slice(0,12);async function gj(e,t){let n=await ee(e.dir,["cat-file","blob",`${t}:${In}`],{ok:!0});return n.exitCode===0?n.stdout:null}async function I$t(e,t){let n=await ee(e.dir,["rev-list","--parents","-n","1",t],{ok:!0});if(n.exitCode!==0)return null;return n.stdout.trim().split(" ").slice(1)}async function Gke(e,t,n){for(let r of[t,...n])if(await Qn(e,r,ko+1)){if((await ee(e.dir,["cat-file","-e",`${t}^{commit}`],{ok:!0})).exitCode===0)return!0}return!1}async function N$t(e,t,n,r){let o=Dn[r],s=n[o.mergeSha],i=n[o.number],a=n[o.branch];if(n.origin!=="administrator")throw jl("accept-automatic",`Re-pull #${n.id} was opened by the automatic path, whose merges the Worker sends with the trailers; its merge is not accepted without them.`);let c=await Cs(e.token,e.datasetId,i,e.base);if(!c.ok)throw ot("github-unreadable",`Pull request #${i} could not be read on GitHub (${c.reason}); nothing was accepted.`);let l=c.value;if(l.baseRef!=="main"||l.headRef!==a||!Gi(l.headRepo,n.dataset_id)||!Gi(l.baseRepo,n.dataset_id))throw jl("pr-foreign",`Pull request #${i} is not ${a} into main of ${mw}/${n.dataset_id} itself.`);if(l.state!=="merged"||l.mergeCommitSha!==s)throw jl("merge-mismatch",l.state==="merged"?`GitHub says pull request #${i} merged as ${l.mergeCommitSha?an(l.mergeCommitSha):"no commit it names"}, not the recorded ${an(s)}.`:`GitHub says pull request #${i} is not merged.`);if(!await Gke(t,s,["refs/heads/main"]))throw ot("merge-unreadable",`The merge commit ${an(s)} could not be fetched from NEMAR's repository; nothing was accepted.`);let d=await I$t(t,s);if(d===null)throw ot("merge-unreadable",`The merge commit ${an(s)} could not be read.`);if(d.length!==1)throw jl("merge-not-squash",`The merge commit ${an(s)} has ${d.length} parents; a squash merge has one.`);let f=d[0],p=r==="n0"?n.base_sha:n.patch_base_sha;if(f!==p){let b=await Is(t.dir,p,f);if(!b.ok){if(b.code==="unreadable")throw ot("main-unreadable",`Whether the merge commit's parent ${an(f)} moved from the record's base ${an(p)} by enrichment only could not be read; nothing was accepted.`);throw jl("merge-parent-foreign",`The merge commit's parent ${an(f)} is not the record's base ${an(p)} or a commit enrichment moved it to.`)}}let m=n[o.head];if(l.headSha!==m){let _=await Gke(t,l.headSha,[Cn(n[o.version]),`refs/pull/${i}/head`])?await Is(t.dir,m,l.headSha):{ok:!1,code:"unreadable"};if(!_.ok){if(_.code==="unreadable")throw ot("branch-unreadable",`Whether the merged head ${an(l.headSha)} is the recorded head ${an(m)} moved by enrichment could not be read; nothing was accepted.`);throw jl("merge-head-foreign",`Pull request #${i} merged at ${an(l.headSha)}, which is not the recorded head ${an(m)} or a commit enrichment moved it to.`)}}let h=r==="n0"?n.synth_sha:n.patch_gates_sha;if(h===null)throw jl("tree-anchor-missing",`Re-pull #${n.id} records no gated head of its N.0.1 pull request, so the merged tree has nothing to be compared with.`);let g=await IR(t,n,s,r);if(g!=="same"){if(g==="differs")throw jl("merge-tree-mismatch",`The merge commit's tree is not the re-pull's ${r==="n0"?"commit":"gated N.0.1 head"} ${an(h)} outside .nemar/ and .github/.`);throw ot("origin-unreadable","The merge commit or the re-pull's commit could not be read from NEMAR's repository, so the trees were not compared; nothing was accepted.")}let y=i6(await gj(t,f),await gj(t,s));if(y.kind==="other")throw jl("merge-ledger-foreign","The merge commit changes the privacy ledger other than by appending a scrub's lines, which the fresh-clone proof refuses whatever is accepted.");return{number:i,branch:a,mergedHead:l.headSha,headMoved:l.headSha!==m,parent:f,parentMoved:f!==p,anchor:h,ledger:Obe(y)}}function F$t(e,t,n){let r=Dn[t],o=e[r.head],s=t==="n0"?e.base_sha:e.patch_base_sha;return["Verified by this run, with your GitHub token and NEMAR's repository:",` - it is GitHub's squash merge of pull request #${n.number} (${n.branch} into main of ${mw}/${e.dataset_id}), merged at ${an(n.mergedHead)}, ${n.headMoved?`which enrichment moved the recorded head ${an(o)} to`:"the recorded head"};`,` - its one parent ${an(n.parent)} is ${n.parentMoved?`the record's base ${an(s)} moved by enrichment only`:"the record's base"};`,` - its tree is the re-pull's ${t==="n0"?"commit":"gated N.0.1 head"} ${an(n.anchor)} outside .nemar/ and .github/;`,` - it ${Kke(n.ledger)};`," - the re-pull is one an administrator opened.","Asking the Worker to read it again on GitHub and to record your acceptance."]}function Kke(e){return e==="untouched"?"does not touch the privacy ledger":e==="scrub-lines"?"appends only a scrub's lines to the privacy ledger":"appends the delta scrub's repull-scrubbed line to the privacy ledger and edits no line before it"}function M$t(e){return`The Worker read on GitHub with its own credential: pull request #${e.pull_request} merged at ${an(e.merged_head)}${e.head_moved_by_enrichment?" (moved by enrichment)":""}, parent ${an(e.parent)}${e.parent_moved_by_enrichment?" (moved by enrichment)":""}, tree ${an(e.tree)}, the re-pull's outside .nemar/ and .github/; the merge ${Kke(e.ledger)}; and the re-pull is yours.`}async function Jke(e,t,n){if(!await Qn(e,"refs/heads/main",1))throw ot("origin-unreadable","NEMAR's main could not be fetched to read the acceptance's ledger line back; run resume again.");let r=await gj(e,"refs/remotes/origin/heads/main");if(r===null||!a6(r).includes(t)||!ml(r).includes(n))throw ot("attestation-unseen",`The Worker answered that the ledger line naming ${an(t)} is on main, and NEMAR's repository does not show it; run resume again, which reads main again and writes the line once more if it is not there.`)}function Yke(e,t,n){return n===null?"The merge appends no repull-scrubbed line beside other files, so the privacy ledger's fresh-clone proof needs no line for it, and none was written.":`The line that names ${an(e)} is on main in ${In}${t.attestation_sha?` (commit ${an(t.attestation_sha)})`:""}, so the privacy ledger's fresh-clone proof reads the merge as the re-pull's own.`}async function Xke(e,t,n,r,o){let s=n[Dn[r].mergeSha],i;try{i=await ZF(n.id,{pr:r,merge_sha:s})}catch(c){if(pn(c)==="merge-trailers-not-accepted")return!1;throw Wke(c,`The merge commit ${an(s)} carries no trailers (${o}); asked for an acceptance recorded earlier, the Worker answered`)}let a=i.acceptance;if(i.attestation_line!==null)await Jke(t,s,i.attestation_line);if(e.opts.out(`The merge commit ${an(s)} on main carries no trailers (${o}); it was accepted earlier, by administrator #${a.accepted_by} at ${a.accepted_at}, on the reason: ${a.reason}`),e.opts.out(Yke(s,a,i.attestation_line)),e.opts.acceptMergeTrailers)e.opts.out("It is accepted once; --accept-merge-trailers changes nothing now.");return!0}async function Qke(e,t,n,r,o,s){let i=n[Dn[r].mergeSha],a=e.opts.out;a(`The merge commit ${an(i)} on main does not end with the re-pull commit's two trailers (${o}).`);let c=await N$t(e,t,n,r);for(let d of F$t(n,r,c))a(d);let l;try{l=await ZF(n.id,{pr:r,merge_sha:i,reason:s})}catch(d){throw Wke(d,"The Worker answered")}if(l.evidence)a(M$t(l.evidence));if(a(`Accepted on your reason, and recorded on re-pull #${n.id}: ${l.acceptance.reason}`),l.attestation_line!==null)await Jke(t,i,l.attestation_line);a(Yke(i,l.acceptance,l.attestation_line))}async function Zke(e,t){let n=await ee(e,["ls-tree","-r","-z","--full-tree",t],{ok:!0});if(n.exitCode!==0)return null;return n.stdout.split("\x00").filter(Boolean).map((r)=>/^(\d{6}) [a-z]+ ([0-9a-f]{40})\t(.+)$/s.exec(r)).filter((r)=>r!==null).filter((r)=>!r[3].startsWith(".nemar/")&&!r[3].startsWith(".github/")).map((r)=>`${r[1]} ${r[2]} ${r[3]}`).sort().join(`
|
|
414
|
+
${b.message}`,r);if(_)return Wt("message",`The squash message would not carry the re-pull's trailers: ${_}.`);return{ok:!0,check:{row:r,pr:s,version:r[i.version],prNumber:a,head:c,squash:b,heldClaim:r[i.claimSha]===c,warnings:h}}}async function l$t(e,t,n,r,o){let s=await op(e.token,e.datasetId,n,{headSha:r,mergeableState:o},{base:e.base,...e.sleep?{sleep:e.sleep}:{}});if(!s.ok){if(s.kind==="unreadable")return Wt("github",`Pull request #${n} could not be read: ${s.reason} Nothing was claimed or merged.`);return Wt("not-ready",s.kind==="moved"?`Pull request #${n} changed since it was read; run the merge again. Nothing was claimed or merged.`:`Pull request #${n} is no longer open; nothing was claimed or merged.`)}if(s.state==="unstable")return Fke(e,t,n,r);if(s.state==="blocked")return Wt("bids","GitHub reports the pull request blocked: this dataset's rules require BIDS validation, and merging would be a bypass, which a re-pull never uses. Nothing was claimed or merged.");if(s.state==="clean")return Wt("bids","GitHub reports the pull request clean, so no check fails: merge it without --bids-failure-reason. Nothing was claimed or merged.");let i=Ag(s.state);return Wt("github",`${i.ok?"GitHub's state is not unstable.":i.why} Nothing was claimed or merged.`)}async function Fke(e,t,n,r){let o=await $be({token:e.token,base:e.base,datasetId:e.datasetId,sha:r,origin:t.origin,mergeableState:"unstable",prNumber:n});if(o.kind==="bids-only")return null;return o.kind==="unreadable"?Wt("github",`Whether BIDS validation is the one check of #${n} that fails could not be read: ${o.why}. Nothing was claimed or merged.`):Wt("bids",`A merge over a failed BIDS validation is made only while that validation is the one check that fails, and ${o.why}. Nothing was claimed or merged.`)}function Np(e){return e instanceof L?`HTTP ${e.statusCode}`:e instanceof Error?e.message:String(e)}function DR(e,t="n0"){return`This merge mints one irreversible version DOI, v${e[Dn[t].version]}, and takes one unit of today's re-pull merge cap.`}async function l_(e,t,n){let{row:r,prNumber:o}=t,s=await Nke(e.datasetId,o,t.head);if("ok"in s)return{merged:!1,stage:s.stage,reason:s.reason};if(s.kind==="needs_force"&&!e.force)return{merged:!1,stage:"review",reason:s.reason};if(n.confirm){let c=[DR(r,t.pr),...t.warnings];if(!await n.confirm(`${c.join(" ")} Merge pull request #${o} of ${e.datasetId}?`))return{merged:!1,stage:"declined",reason:"Not confirmed; nothing was claimed or merged."}}let i=Ec(e.configDir,e.datasetId,r.plan_digest);vo(o$t(i.lock),s$t(e.configDir,"repull"));let a;try{a=Tl(i.lock)}catch(c){if(!(c instanceof I))throw c;return{merged:!1,stage:"not-ready",reason:`${c.message} A resume or an execution of re-pull #${r.id} runs now; nothing was claimed or merged.`}}try{return await p$t(e,t,n)}finally{a()}}function u$t(e,t){let n=pn(e);if(!(e instanceof L)||e.statusCode===0||e.statusCode>=500)return{merged:!1,stage:"github",claimHeld:!0,reason:`The claim to merge got no usable answer (${Np(e)}), so a claim may be held. Nothing was merged. nemar admin repull resume ${t} reads the record, and expires a claim nothing merged under once it is 30 minutes old.`};let r=`The claim to merge was refused (${n??Np(e)}): ${e.message} Nothing was merged.`;if(n==="merge-cap"||n==="merge-cap-unreadable")return{merged:!1,stage:"cap",reason:r};if(n==="screen-not-clear"||n==="screen-changed")return{merged:!1,stage:"screen",reason:r};if(n?.startsWith("bids-override-"))return{merged:!1,stage:"bids",reason:r};return{merged:!1,stage:"not-ready",reason:r}}function d$t(e,t){let n=pn(e),r=e instanceof Error?e.message:String(e);return{merged:!1,stage:n==="screen-not-clear"?"screen":!(e instanceof L)||e.statusCode===0||e.statusCode>=500||n==="github-unreadable"?"github":"not-ready",claimHeld:!0,reason:`The claim to merge already held was not used (${n??Np(e)}): ${r} Nothing was merged. nemar admin repull resume ${t} reads GitHub, records a merge that happened, and expires the claim once it is 30 minutes old.`}}function f$t(e){if(e.outcome==="refused")return`GitHub refused the merge: ${e.reason}`;if(e.merge)return e.merge.why;return e.status===409?"The pull request changed after the gate read it (its head moved, or it was closed), so the merge was not sent.":`GitHub could not be read at the last look before the merge (${e.status===0?"no answer":`HTTP ${e.status}`}), so the merge was not sent.`}async function p$t(e,t,n){let{row:r,prNumber:o,head:s,pr:i}=t,a=Dn[i],c=e.bidsFailureReason;if(c!==void 0&&t.heldClaim)return{merged:!1,stage:"bids",claimHeld:!0,reason:`A claim to merge ${s.slice(0,12)} is already held, and a merge over a failed BIDS validation is sent only under a claim of its own, which records its reason. Nothing was merged. nemar admin repull resume ${e.datasetId} records a merge that happened, or expires the claim once it is 30 minutes old; then run this again.`};if(c!==void 0){let d=await Fke(e,r,o,s);if(d)return{merged:!1,stage:d.stage,reason:d.reason}}if(!t.heldClaim){try{await rr(r.id,{from:a.gatesClear,to:a.gatesClear,fields:{[a.claimSha]:s},...c!==void 0?{override:{kind:"bids-failure",reason:c}}:{}})}catch(d){return u$t(d,e.datasetId)}if(n.out(`Claimed one unit of today's re-pull merge cap for ${s.slice(0,12)}.`),c!==void 0)n.out("Recorded with the claim: the merge is over a failed BIDS validation, and why.")}else{try{await bbe(r.id,{pr:i,sha:s})}catch(d){return d$t(d,e.datasetId)}n.out(`A claim to merge ${s.slice(0,12)} is already held; the merge is sent again under it.`)}let l=await pw(e.token,e.datasetId,o,s,"squash",{base:e.base,commit:t.squash,...c!==void 0?{state:"unstable"}:{},...e.sleep?{sleep:e.sleep}:{},...n.tries!==void 0?{tries:n.tries}:{}});if(l.ok)try{let d=await Y$(r.id,i);return{merged:!0,row:d.repull,mergeSha:d.repull[a.mergeSha],recorded:!0}}catch(d){return n.out(`GitHub merged pull request #${o}, and the merge could not be recorded yet (${pn(d)??Np(d)}); nemar admin repull resume ${e.datasetId} records it.`),{merged:!0,row:r,mergeSha:null,recorded:!1}}if(l.outcome==="unknown"||l.outcome==="different")return{merged:!1,stage:"github",outcome:l.outcome,claimHeld:!0,reason:`${l.reason} GitHub may have merged it: the claim is kept, and nemar admin repull resume ${e.datasetId} reads GitHub and records the merge.`};return{merged:!1,stage:"github",outcome:l.outcome,claimHeld:!0,reason:`${f$t(l)} The claim to merge is kept: run nemar admin repull merge ${e.datasetId} again within 25 minutes of the claim to send the merge under it, once GitHub reports the pull request clean at the same head; if the head moved, nemar admin repull resume ${e.datasetId} expires the claim once it is 30 minutes old and then records the new head.`}}ze();fn();import{dirname as J$t,join as Y$t}from"path";no();xr();_l();var{spawn:Mke}=globalThis.Bun;var CR=1048576,m$t=1024*CR,zrn=5*CR,Grn=8*CR,Wrn=5*CR,jke=4*m$t,Lke=1e4;var h$t={failed:1,usage:2,refused:3,unreadable:4,remainder:5};class qke extends Error{word;exitCode;constructor(e,t=h$t.failed){super(e);this.word=e;this.exitCode=t;this.name="StageError"}}class Bt extends Error{code;op;constructor(e,t){super(`${t}:${e}`);this.code=e;this.op=t;this.name="AwsCliError"}}var g$t={AccessDenied:"access-denied","403":"access-denied",NoSuchKey:"not-found",NoSuchVersion:"not-found",NoSuchObjectLockConfiguration:"not-found",NotFound:"not-found","404":"not-found",NoSuchUpload:"no-such-upload",PreconditionFailed:"precondition-failed","412":"precondition-failed",ConditionalRequestConflict:"precondition-failed",InvalidRange:"invalid-range","416":"invalid-range",SlowDown:"throttled",Throttling:"throttled",ThrottlingException:"throttled",RequestLimitExceeded:"throttled","503":"throttled",ExpiredToken:"credentials",InvalidAccessKeyId:"credentials",InvalidToken:"credentials",SignatureDoesNotMatch:"credentials","401":"credentials"};function y$t(e,t){return new Bt(g$t[e]??"failed",t)}function b$t(e,t){let n=/An error occurred \(([A-Za-z0-9]+)\) when calling the (\w+) operation/.exec(e);if(n)return y$t(n[1],n[2]);if(/Could not connect to the endpoint URL|Connection was closed|Read timeout/.test(e))return new Bt("unreachable",t);if(/Unable to locate credentials|SSO session|token has expired/i.test(e))return new Bt("credentials",t);return new Bt("failed",t)}function Gd(e){if(e instanceof qke)return e.word;if(e instanceof Bt)return`${e.op}:${e.code}`;return"unexpected"}var RR=new Set;var AR=120000,w$t=5;function OR(e={}){let t=e.command??["aws","configure","export-credentials","--format","process"],n=e.skewMs??120000,r=e.now??Date.now,o=e.timeoutMs??60000,s,i;async function a(){let c;try{c=Mke({cmd:t,...e.commandEnv?{env:e.commandEnv}:{},stdout:"pipe",stderr:"ignore"})}catch{throw new Bt("credentials","ExportCredentials")}RR.add(c);let l=setTimeout(()=>c.kill("SIGKILL"),o),d,f;try{[d,f]=await Promise.all([new Response(c.stdout).text(),c.exited])}finally{clearTimeout(l),RR.delete(c)}if(f!==0)throw new Bt("credentials","ExportCredentials");let p;try{p=JSON.parse(d)}catch{throw new Bt("bad-output","ExportCredentials")}let m=typeof p.AccessKeyId==="string"?p.AccessKeyId:"",h=typeof p.SecretAccessKey==="string"?p.SecretAccessKey:"",g=typeof p.SessionToken==="string"?p.SessionToken:"";if(!m||!h)throw new Bt("bad-output","ExportCredentials");if(!m.startsWith("ASIA")||!g)throw new Bt("long-lived-credentials","ExportCredentials");let y=typeof p.Expiration==="string"?Date.parse(p.Expiration):Number.NaN,b={AWS_ACCESS_KEY_ID:m,AWS_SECRET_ACCESS_KEY:h,AWS_SESSION_TOKEN:g};return s={env:b,expiresAt:Number.isFinite(y)?y:r()+n*2},b}return{async env(){if(s&&s.expiresAt-n>r())return s.env;return i??=a().finally(()=>{i=void 0}),i}}}var _$t="when_supported";function TR(e){let t={};for(let[n,r]of Object.entries(e.env??process.env))if(r!==void 0)t[n]=r;if(t.AWS_PAGER="",t.AWS_REQUEST_CHECKSUM_CALCULATION=_$t,e.endpointUrl)t.AWS_ENDPOINT_URL_S3=e.endpointUrl;return{async api(n,r,o={}){let s=n.split("-").map((p)=>p.charAt(0).toUpperCase()+p.slice(1)).join(""),i=["aws","s3api",n,...r,"--region",e.region,"--output","json"],a=e.credentials?await e.credentials.env():{},c;try{c=Mke({cmd:i,env:{...t,...a},stdout:"pipe",stderr:"pipe"})}catch{throw new Bt("spawn-failed",s)}RR.add(c);let l=e.timeoutMs*(o.slow?w$t:1),d=!1,f=setTimeout(()=>{d=!0,c.kill("SIGKILL")},l);try{let[p,m,h]=await Promise.all([new Response(c.stdout).text(),new Response(c.stderr).text(),c.exited]);if(d)throw new Bt("timeout",s);if(h!==0)throw b$t(m,s);let g=p.trim();if(g==="")return{};try{let y=JSON.parse(g);if(typeof y!=="object"||y===null||Array.isArray(y))throw new Bt("bad-output",s);return y}catch(y){if(y instanceof Bt)throw y;throw new Bt("bad-output",s)}}finally{clearTimeout(f),RR.delete(c)}}}}async function Bke(e,t,n,r=()=>!1){let o=Array(e.length).fill(void 0),s=0,i=async()=>{while(s<e.length&&!r()){let a=s++;o[a]=await n(e[a],a)}};return await Promise.all(Array.from({length:Math.max(1,t)},i)),o}no();yo();import{chmodSync as x$t,rmSync as v$t,writeFileSync as k$t}from"fs";import{join as E$t}from"path";ps();var S$t=5368709120,Hke="us-east-1",$$t=8;function PR(e,t){return`${e}/staging/repull-${t}.json`}var Ml=(e)=>typeof e==="string"?e:void 0;async function Wd(e,t,n){let r=new Map,o=new Set,s=null;for(;;){let i=await e.api("list-objects-v2",["--bucket",t,"--prefix",n,"--max-keys","1000","--no-paginate",...s?["--continuation-token",s]:[]]),a=i.Contents;if(a!==void 0&&!Array.isArray(a))throw new Bt("bad-output","ListObjectsV2");for(let c of a??[]){let l=Ml(c.Key);if(l===void 0||typeof c.Size!=="number")throw new Bt("bad-output","ListObjectsV2");if(l.startsWith(n)&&l.length>n.length)r.set(l.slice(n.length),c.Size)}if(i.IsTruncated!==!0)return r;if(s=Ml(i.NextContinuationToken)??null,!s||o.has(s))throw new Bt("bad-output","ListObjectsV2");o.add(s)}}async function Vke(e){let t=E$t(e.dir,"staging-manifest.json");k$t(t,hc(e.manifest),{mode:384}),x$t(t,384);try{await e.aws.api("put-object",["--bucket",e.bucket,"--key",e.key,"--body",t,"--content-type","application/json"])}finally{v$t(t,{force:!0})}}async function Uke(e,t,n,r){let o;try{o=await e.api("head-object",["--bucket",t,"--key",n,...r?["--version-id",r]:[]])}catch(i){if(i instanceof Bt&&i.code==="not-found")return null;throw i}let s=Ml(o.ETag);if(typeof o.ContentLength!=="number"||s===void 0)throw new Bt("bad-output","HeadObject");return{size:o.ContentLength,etag:s,versionId:Ml(o.VersionId)}}function D$t(e){return`${e.bucket}/${e.object}?versionId=${e.version}`}function R$t(e,t){return Math.max(t,Math.ceil(e/Lke))}async function C$t(e){let{aws:t,bucket:n,key:r}=e,o=await t.api("create-multipart-upload",["--bucket",n,"--key",r]),s=Ml(o.UploadId);if(!s)throw new Bt("bad-output","CreateMultipartUpload");try{let i=R$t(e.size,e.partBytes),a=[];for(let c=0,l=1;c<e.size;c+=i,l++){let d=Math.min(c+i,e.size)-1,f=await t.api("upload-part-copy",["--bucket",n,"--key",r,"--upload-id",s,"--part-number",String(l),"--copy-source",e.source,"--copy-source-range",`bytes=${c}-${d}`,"--copy-source-if-match",e.etag],{slow:!0}),p=f.CopyPartResult,m=p?Ml(p.ETag):void 0;if(!m)throw new Bt("bad-output","UploadPartCopy");if(Ml(f.CopySourceVersionId)!==e.version)throw new I("pin-version-mismatch",`S3 copied part ${l} of a multipart copy from another version than the pinned one`);a.push({ETag:m,PartNumber:l})}await t.api("complete-multipart-upload",["--bucket",n,"--key",r,"--upload-id",s,"--multipart-upload",JSON.stringify({Parts:a})],{slow:!0})}catch(i){try{await t.api("abort-multipart-upload",["--bucket",n,"--key",r,"--upload-id",s])}catch{e.open.push({key:r,uploadId:s})}throw i}}async function A$t(e,t,n,r){let o=Ml(r.VersionId);if(o===void 0)return!1;try{return await e.api("delete-object",["--bucket",t,"--key",n,"--version-id",o]),!0}catch{return!1}}function O$t(e){if(e instanceof I)return e;if(e instanceof Ke)return new I("write-refused",e.message);if(e instanceof Bt){if(e.op==="CopyObject"||e.op==="UploadPartCopy"){if(e.code==="not-found")return new I("pin-absent","a pinned upstream version is no longer served");if(e.code==="precondition-failed")return new I("pin-changed","a pinned upstream version changed its ETag")}return new I("copy-failed",`an S3 call failed (${Gd(e)})`)}return new I("copy-failed",`a copy failed (${e instanceof Error?e.name:"error"})`)}async function zke(e){let t=e.singleCopyMax??S$t,n=e.partBytes??jke,r=0,o=0,s=0,i=[],a=[],c=e.manifest.items;if(await Bke(c,e.concurrency??$$t,async(l)=>{try{let d=qo(l.key),f=e.existing.get(l.key);if(d!==null&&f===d){o++;return}let p=await Uke(e.aws.source,l.bucket,l.object,l.version);if(!p)throw new I("pin-absent","a pinned upstream version is not served");if(p.versionId!==l.version)throw new I("pin-version-mismatch","upstream answered for another version than the pinned one, or for none");if(d!==null&&p.size!==d)throw new I("pin-size-mismatch","a pinned upstream version is not the size its key declares");if(d===null&&f===p.size){o++;return}let m=`${e.prefix}${l.key}`,h=D$t(l);if(p.size<=t){let y=await e.aws.dest.api("copy-object",["--bucket",e.destBucket,"--key",m,"--copy-source",h,"--copy-source-if-match",p.etag,"--tagging-directive","REPLACE"],{slow:!0});if(Ml(y.CopySourceVersionId)!==l.version){let b=await A$t(e.aws.dest,e.destBucket,m,y);throw new I("pin-version-mismatch",b?"S3 copied from another version than the pinned one; the copy was removed":"S3 copied from another version than the pinned one and the copy could not be removed: delete it by hand before a rerun")}}else await C$t({aws:e.aws.dest,source:h,version:l.version,etag:p.etag,size:p.size,bucket:e.destBucket,key:m,partBytes:n,open:a});let g=await Uke(e.aws.dest,e.destBucket,m);if(!g||g.size!==p.size)throw new I("copy-size-mismatch","a copied object is not the size of the version it was copied from");r++,s+=p.size}catch(d){i.push(O$t(d))}},()=>i.length>0),i.length>0){let l=i[0],d=a.length>0?` ${a.length} multipart upload(s) could not be aborted and stay open (abort them with abort-multipart-upload): ${a.map((f)=>f.uploadId).join(", ")}.`:"";throw new I(l.code,`The copy stopped: ${l.message}; ${i.length} of ${c.length} item(s) refused, ${r} copied and ${o} already present this run. Nothing is registered for a partial copy, and a rerun skips what landed.${d}`)}return{copied:r,skipped:o,bytes:s}}import{createHash as j$t}from"crypto";import{readFileSync as L$t}from"fs";import{join as q$t}from"path";no();oc();sc();ze();Ng();no();ze();ze();function gs(e,t){if(t instanceof I)return`[${e}:${t.code}] ${t.message}`.slice(0,2000);let n=t instanceof Error?t.name:"unknown";return`[${e}:${e}-failed] The step failed (${n}).`}function ot(e,t){let n=new I(e,t);return n.resumable=!0,n}function so(e,t){let n=pn(e)??(e instanceof L?"record-refused":"github-failed"),r=e instanceof Error?e.message:String(e);return ot(n,`${t}: ${r}`)}function hj(e){if(e.status==="pr_open")return{branch:e.branch,pr_number:e.pr_number,head_sha:e.head_sha};if(e.status==="patch_synthesized")return{patch_version:e.patch_version,patch_branch:e.patch_branch,patch_pr_number:e.patch_pr_number,patch_head_sha:e.patch_head_sha,patch_base_sha:e.patch_base_sha};return{}}async function io(e,t,n){let r=hj(e);try{await rr(e.id,{from:e.status,to:e.status,fields:r,error:t})}catch(o){n(`The failure could not be recorded on re-pull #${e.id} (${pn(o)??(o instanceof L?`HTTP ${o.statusCode}`:"no answer")}); its record keeps the last error it had.`)}}function jl(e,t){return new I(e,`${t} Nothing was accepted or written.`)}var T$t=new Set(["github-unreadable","attestation-unwritten"]),P$t=new Set([0,408,429]);function Wke(e,t){let n=pn(e);if(n===void 0&&e instanceof L&&[404,405].includes(e.statusCode)){let i=new I("accept-route-missing",`${t}: this Worker has no acceptance route (it is older than the CLI), so nothing was sent that acts.`);return i.resumable=!1,i}let r=e instanceof Error?e.message:String(e),o=n===void 0?!(e instanceof L)||P$t.has(e.statusCode)||e.statusCode>=500:T$t.has(n),s=new I(n??(e instanceof L?"record-refused":"api-unreadable"),`${t}: ${r}`);return s.resumable=o,s}var an=(e)=>e.slice(0,12);async function gj(e,t){let n=await ee(e.dir,["cat-file","blob",`${t}:${In}`],{ok:!0});return n.exitCode===0?n.stdout:null}async function I$t(e,t){let n=await ee(e.dir,["rev-list","--parents","-n","1",t],{ok:!0});if(n.exitCode!==0)return null;return n.stdout.trim().split(" ").slice(1)}async function Gke(e,t,n){for(let r of[t,...n])if(await Qn(e,r,ko+1)){if((await ee(e.dir,["cat-file","-e",`${t}^{commit}`],{ok:!0})).exitCode===0)return!0}return!1}async function N$t(e,t,n,r){let o=Dn[r],s=n[o.mergeSha],i=n[o.number],a=n[o.branch];if(n.origin!=="administrator")throw jl("accept-automatic",`Re-pull #${n.id} was opened by the automatic path, whose merges the Worker sends with the trailers; its merge is not accepted without them.`);let c=await Cs(e.token,e.datasetId,i,e.base);if(!c.ok)throw ot("github-unreadable",`Pull request #${i} could not be read on GitHub (${c.reason}); nothing was accepted.`);let l=c.value;if(l.baseRef!=="main"||l.headRef!==a||!Gi(l.headRepo,n.dataset_id)||!Gi(l.baseRepo,n.dataset_id))throw jl("pr-foreign",`Pull request #${i} is not ${a} into main of ${mw}/${n.dataset_id} itself.`);if(l.state!=="merged"||l.mergeCommitSha!==s)throw jl("merge-mismatch",l.state==="merged"?`GitHub says pull request #${i} merged as ${l.mergeCommitSha?an(l.mergeCommitSha):"no commit it names"}, not the recorded ${an(s)}.`:`GitHub says pull request #${i} is not merged.`);if(!await Gke(t,s,["refs/heads/main"]))throw ot("merge-unreadable",`The merge commit ${an(s)} could not be fetched from NEMAR's repository; nothing was accepted.`);let d=await I$t(t,s);if(d===null)throw ot("merge-unreadable",`The merge commit ${an(s)} could not be read.`);if(d.length!==1)throw jl("merge-not-squash",`The merge commit ${an(s)} has ${d.length} parents; a squash merge has one.`);let f=d[0],p=r==="n0"?n.base_sha:n.patch_base_sha;if(f!==p){let b=await Is(t.dir,p,f);if(!b.ok){if(b.code==="unreadable")throw ot("main-unreadable",`Whether the merge commit's parent ${an(f)} moved from the record's base ${an(p)} by enrichment only could not be read; nothing was accepted.`);throw jl("merge-parent-foreign",`The merge commit's parent ${an(f)} is not the record's base ${an(p)} or a commit enrichment moved it to.`)}}let m=n[o.head];if(l.headSha!==m){let _=await Gke(t,l.headSha,[Cn(n[o.version]),`refs/pull/${i}/head`])?await Is(t.dir,m,l.headSha):{ok:!1,code:"unreadable"};if(!_.ok){if(_.code==="unreadable")throw ot("branch-unreadable",`Whether the merged head ${an(l.headSha)} is the recorded head ${an(m)} moved by enrichment could not be read; nothing was accepted.`);throw jl("merge-head-foreign",`Pull request #${i} merged at ${an(l.headSha)}, which is not the recorded head ${an(m)} or a commit enrichment moved it to.`)}}let h=r==="n0"?n.synth_sha:n.patch_gates_sha;if(h===null)throw jl("tree-anchor-missing",`Re-pull #${n.id} records no gated head of its N.0.1 pull request, so the merged tree has nothing to be compared with.`);let g=await IR(t,n,s,r);if(g!=="same"){if(g==="differs")throw jl("merge-tree-mismatch",`The merge commit's tree is not the re-pull's ${r==="n0"?"commit":"gated N.0.1 head"} ${an(h)} outside .nemar/ and .github/.`);throw ot("origin-unreadable","The merge commit or the re-pull's commit could not be read from NEMAR's repository, so the trees were not compared; nothing was accepted.")}let y=i6(await gj(t,f),await gj(t,s));if(y.kind==="other")throw jl("merge-ledger-foreign","The merge commit changes the privacy ledger other than by appending a scrub's lines, which the fresh-clone proof refuses whatever is accepted.");return{number:i,branch:a,mergedHead:l.headSha,headMoved:l.headSha!==m,parent:f,parentMoved:f!==p,anchor:h,ledger:Obe(y)}}function F$t(e,t,n){let r=Dn[t],o=e[r.head],s=t==="n0"?e.base_sha:e.patch_base_sha;return["Verified by this run, with your GitHub token and NEMAR's repository:",` - it is GitHub's squash merge of pull request #${n.number} (${n.branch} into main of ${mw}/${e.dataset_id}), merged at ${an(n.mergedHead)}, ${n.headMoved?`which enrichment moved the recorded head ${an(o)} to`:"the recorded head"};`,` - its one parent ${an(n.parent)} is ${n.parentMoved?`the record's base ${an(s)} moved by enrichment only`:"the record's base"};`,` - its tree is the re-pull's ${t==="n0"?"commit":"gated N.0.1 head"} ${an(n.anchor)} outside .nemar/ and .github/;`,` - it ${Kke(n.ledger)};`," - the re-pull is one an administrator opened.","Asking the Worker to read it again on GitHub and to record your acceptance."]}function Kke(e){return e==="untouched"?"does not touch the privacy ledger":e==="scrub-lines"?"appends only a scrub's lines to the privacy ledger":"appends the delta scrub's repull-scrubbed line to the privacy ledger and edits no line before it"}function M$t(e){return`The Worker read on GitHub with its own credential: pull request #${e.pull_request} merged at ${an(e.merged_head)}${e.head_moved_by_enrichment?" (moved by enrichment)":""}, parent ${an(e.parent)}${e.parent_moved_by_enrichment?" (moved by enrichment)":""}, tree ${an(e.tree)}, the re-pull's outside .nemar/ and .github/; the merge ${Kke(e.ledger)}; and the re-pull is yours.`}async function Jke(e,t,n){if(!await Qn(e,"refs/heads/main",1))throw ot("origin-unreadable","NEMAR's main could not be fetched to read the acceptance's ledger line back; run resume again.");let r=await gj(e,"refs/remotes/origin/heads/main");if(r===null||!a6(r).includes(t)||!ml(r).includes(n))throw ot("attestation-unseen",`The Worker answered that the ledger line naming ${an(t)} is on main, and NEMAR's repository does not show it; run resume again, which reads main again and writes the line once more if it is not there.`)}function Yke(e,t,n){return n===null?"The merge appends no repull-scrubbed line beside other files, so the privacy ledger's fresh-clone proof needs no line for it, and none was written.":`The line that names ${an(e)} is on main in ${In}${t.attestation_sha?` (commit ${an(t.attestation_sha)})`:""}, so the privacy ledger's fresh-clone proof reads the merge as the re-pull's own.`}async function Xke(e,t,n,r,o){let s=n[Dn[r].mergeSha],i;try{i=await ZF(n.id,{pr:r,merge_sha:s})}catch(c){if(pn(c)==="merge-trailers-not-accepted")return!1;throw Wke(c,`The merge commit ${an(s)} carries no trailers (${o}); asked for an acceptance recorded earlier, the Worker answered`)}let a=i.acceptance;if(i.attestation_line!==null)await Jke(t,s,i.attestation_line);if(e.opts.out(`The merge commit ${an(s)} on main carries no trailers (${o}); it was accepted earlier, by administrator #${a.accepted_by} at ${a.accepted_at}, on the reason: ${a.reason}`),e.opts.out(Yke(s,a,i.attestation_line)),e.opts.acceptMergeTrailers)e.opts.out("It is accepted once; --accept-merge-trailers changes nothing now.");return!0}async function Qke(e,t,n,r,o,s){let i=n[Dn[r].mergeSha],a=e.opts.out;a(`The merge commit ${an(i)} on main does not end with the re-pull commit's two trailers (${o}).`);let c=await N$t(e,t,n,r);for(let d of F$t(n,r,c))a(d);let l;try{l=await ZF(n.id,{pr:r,merge_sha:i,reason:s})}catch(d){throw Wke(d,"The Worker answered")}if(l.evidence)a(M$t(l.evidence));if(a(`Accepted on your reason, and recorded on re-pull #${n.id}: ${l.acceptance.reason}`),l.attestation_line!==null)await Jke(t,i,l.attestation_line);a(Yke(i,l.acceptance,l.attestation_line))}async function Zke(e,t){let n=await ee(e,["ls-tree","-r","-z","--full-tree",t],{ok:!0});if(n.exitCode!==0)return null;return n.stdout.split("\x00").filter(Boolean).map((r)=>/^(\d{6}) [a-z]+ ([0-9a-f]{40})\t(.+)$/s.exec(r)).filter((r)=>r!==null).filter((r)=>!r[3].startsWith(".nemar/")&&!r[3].startsWith(".github/")).map((r)=>`${r[1]} ${r[2]} ${r[3]}`).sort().join(`
|
|
415
415
|
`)}async function IR(e,t,n,r){let o=Dn[r],s=r==="n0"?t.synth_sha:t[o.gates];if(!await Qn(e,n,1))return"tag-unread";let i=async()=>(await ee(e.dir,["cat-file","-e",`${s}^{commit}`],{ok:!0})).exitCode===0;if(!await i()){for(let l of[s,Cn(t[o.version]),`refs/pull/${t[o.number]}/head`])if(await Qn(e,l,ko)&&await i())break}if(!await i())return"commit-unread";let a=await Zke(e.dir,n),c=await Zke(e.dir,s);if(a===null||c===null)return"tag-unread";return a===c?"same":"differs"}async function B$t(e,t,n,r){let o=await IR(e,t,n,"n0");if(o==="same")return!0;return r(o==="tag-unread"?"The tagged commit could not be fetched, so its tree is not verified (lineage is not recorded).":o==="commit-unread"?"The re-pull's commit could not be fetched, so the tagged tree is not verified (lineage is not recorded).":"The tagged tree is not the re-pull's commit outside .nemar/ and .github/, so lineage is not recorded for it."),!1}async function U$t(e,t,n,r){let o=await IR(t,n,r,"n1");if(o==="same")return;let s=n.patch_gates_sha.slice(0,12);if(o==="differs"&&e.opts.acceptTagTree){e.opts.out(`The tag v${n.patch_version} is not N.0.1's gated head ${s} outside .nemar/ and .github/; its release is recorded on your reason: ${e.opts.acceptTagTree}`);return}let i=o==="differs"?ot("patch-tree-mismatch",`The tag v${n.patch_version} on NEMAR's main is not N.0.1's gated head outside .nemar/ and .github/, so its release is not recorded and the record stays ${n.status}. Read the difference (git diff ${s} v${n.patch_version} -- . ':!.nemar' ':!.github'), then record the release with nemar admin repull resume ${n.dataset_id} --accept-tag-tree "<reason>".`):ot("origin-unreadable",`The tag v${n.patch_version} or N.0.1's gated head could not be read from NEMAR's repository, so the tagged tree is not verified and its release is not recorded; run resume again.`);throw await io(n,gs("release",i),e.opts.out),i}async function H$t(e,t){return(await Kf(e)).versions.some((r)=>r.version===t||r.version===`v${t}`)}async function V$t(e,t,n,r,o){let s=n[Dn[r].mergeSha];if(e.mergeTrailersRead=!0,!await Qn(t,s,1))throw await o("merge-unreadable",`The merge commit ${s.slice(0,12)} could not be fetched from NEMAR's repository, so its trailers were not read; nothing was recorded past merged.`);let i=await ee(t.dir,["cat-file","commit",s],{ok:!0}),a=i.stdout.indexOf(`
|
|
416
416
|
|
|
417
|
-
`);if(i.exitCode!==0||a<0)throw await o("merge-trailers",`The message of the merge commit ${s.slice(0,12)} could not be read, so its trailers were not read; nothing was recorded past ${n.status}.`);let c=await Fl(i.stdout.slice(a+2),n);if(c===null&&e.opts.acceptMergeTrailers)e.opts.out(`The merge commit ${s.slice(0,12)} carries the re-pull's trailers; --accept-merge-trailers changes nothing.`);return c}async function yj(e,t,n){let r=t[Dn[n].version],o=`refs/tags/v${r}`,s=t[Dn[n].mergeSha],i=await e.origin(),a=async(h,g)=>{let y=ot(h,g);return await io(t,gs("release",y),e.opts.out),y},c=await V$t(e,i,t,n,a),l=!1;if(c!==null){if(l=await Xke(e,i,t,n,c),!l&&!e.opts.acceptMergeTrailers)throw await a("merge-trailers",`The merge commit ${s.slice(0,12)} on main does not end with the re-pull commit's two trailers (${c}), so the privacy ledger's fresh-clone proof would not read it as the re-pull's commit. The record stays ${t.status}.
|
|
417
|
+
`);if(i.exitCode!==0||a<0)throw await o("merge-trailers",`The message of the merge commit ${s.slice(0,12)} could not be read, so its trailers were not read; nothing was recorded past ${n.status}.`);let c=await Fl(i.stdout.slice(a+2),n);if(c===null&&e.opts.acceptMergeTrailers)e.opts.out(`The merge commit ${s.slice(0,12)} carries the re-pull's trailers; --accept-merge-trailers changes nothing.`);return c}async function yj(e,t,n){let r=t[Dn[n].version],o=`refs/tags/v${r}`,s=t[Dn[n].mergeSha],i=await e.origin(),a=async(h,g)=>{let y=ot(h,g);return await io(t,gs("release",y),e.opts.out),y},c=await V$t(e,i,t,n,a),l=!1;if(c!==null){if(l=await Xke(e,i,t,n,c),!l&&!e.opts.acceptMergeTrailers){let h=t.origin==="administrator"?`If it was merged outside NEMAR's gate (GitHub's merge button, say), read what it holds, then run nemar admin repull resume ${t.dataset_id} --accept-merge-trailers "<reason>", which accepts it only once it is shown to be this re-pull's own squash merge, and only for the administrator who opened the re-pull.`:"The automatic path opened this re-pull, and the Worker merges its pull requests with the trailers, so a merge made another way is not accepted and no command moves this record on; tell the owner.";throw await a("merge-trailers",`The merge commit ${s.slice(0,12)} on main does not end with the re-pull commit's two trailers (${c}), so the privacy ledger's fresh-clone proof would not read it as the re-pull's commit. The record stays ${t.status}. ${h}`)}}let d;try{d=(await Il(i,[o])).get(o)}catch(h){if(h instanceof I)h.resumable=!0;throw h}if(!d)return{kind:"wait",row:t,waitingFor:`the tag v${r} on NEMAR's repository`};let f;try{f=await H$t(e.datasetId,r)}catch(h){throw so(h,"The dataset's versions could not be read")}if(!f)return{kind:"wait",row:t,waitingFor:`the version row of v${r} (its DOI)`};if(c!==null&&!l)await Qke(e,i,t,n,c,e.opts.acceptMergeTrailers);if(n==="n1")await U$t(e,i,t,d);let p=n==="n0"?await B$t(i,t,d,e.opts.out):!1,m;try{m=await wbe(t.id,{pr:n,tag_sha:d,tree_verified:p})}catch(h){let g=pn(h);if(g==="not-released")return{kind:"wait",row:t,waitingFor:`the DOI of v${r}`};let y=ot(g??"release-failed",`The release of v${r} could not be recorded: ${h instanceof Error?h.message:String(h)}`);if(h instanceof L)await io(t,gs("release",y),e.opts.out);throw y}return e.opts.out(`Re-pull #${t.id} is released: v${r} at ${d.slice(0,12)}${n==="n1"?"":m.lineage_rows?`, lineage recorded for v${r}`:p?"":", lineage not recorded"}; the dataset's sweeps read it again.`),{kind:"next",row:m.repull}}async function u_(e){let t=await e.origin();if(!await Qn(t,"refs/heads/git-annex",1))throw ot("origin-unreadable","NEMAR's git-annex branch could not be fetched.");let n=await ee(t.dir,["cat-file","blob","refs/remotes/origin/heads/git-annex:remote.log"],{ok:!0}),r=Ap(n.exitCode===0?n.stdout:"",e.datasetId);if(r.problem!==null)throw ot("nemar-s3-invalid",r.problem);let o=r.record?.bucket;if(n.exitCode!==0||!r.uuid||!o)throw ot("no-nemar-s3","NEMAR's remote.log names no single nemar-s3 bucket.");let s={};for(let[a,c]of Object.entries(e.env))if(c!==void 0)s[a]=c;let i=TR({region:r.region,timeoutMs:AR,env:s,credentials:OR({commandEnv:s})});return{scratch:t,uuid:r.uuid,bucket:o,region:r.region,prefix:r.prefix,aws:i}}async function bj(e,t,n){let{scratch:r,bucket:o,aws:s}=n??await u_(e),i=q$t(r.dir,"staging-manifest.json"),a=!1;for(let f of new Set([t.to_tag,`v${t.to_tag}`]))try{await s.api("get-object",["--bucket",o,"--key",PR(e.datasetId,f),i]),a=!0;break}catch(p){if(!(p instanceof Bt))throw p;if(p.code!=="not-found")throw ot("staging-unreadable",`The staging manifest of re-pull #${t.id} could not be read (${Gd(p)}); the ambient AWS credentials read it, as the copy wrote it.`)}if(!a)throw ot("staging-unreadable",`The staging manifest of re-pull #${t.id} is not in NEMAR's bucket, so which objects its copy wrote is not known.`);let c=L$t(i);if(`sha256:${j$t("sha256").update(c).digest("hex")}`!==t.manifest_digest)throw ot("manifest-mismatch","The staging manifest in NEMAR's bucket is not the copy manifest recorded at prepared.");let l=JSON.parse(c.toString("utf8")),d=[...l.items??[],...l.local??[]].map((f)=>f.key);if(!d.every((f)=>typeof f==="string"))throw ot("manifest-mismatch","The staging manifest names an object without a key.");return[...new Set(d)].sort()}async function eEe(e,t){if(typeof t.counts.locked==="number")return{kind:"next",row:t};let n=async(c,l)=>{let d=ot(c,l);return await io(t,gs("lock",d),e.opts.out),d},r;try{r=await bj(e,t)}catch(c){if(c instanceof I)throw await n(c.code,c.message);throw c}let o;try{o=r.length>0?await uhe(e.datasetId,r):{locked:0,failed:[],objects:[]}}catch(c){throw await n("lock-failed",`The objects of v${t.to_version} could not be locked (${c instanceof L?`HTTP ${c.statusCode}`:"no answer"}); run resume again.`)}let s=new Set(o.objects.map((c)=>c.key)),i=r.filter((c)=>!s.has(c)).length;if(o.failed.length>0||i>0)throw await n("lock-incomplete",`${i} of the ${r.length} object(s) N.0.0's copy and uploads wrote were not locked (${r.length-i} were); run resume again, which locks them again.`);let a;try{a=await rr(t.id,{from:"released",to:"released",fields:{counts:{locked:r.length}}})}catch(c){throw so(c,"The count of locked objects could not be recorded")}return e.opts.out(`Locked the ${r.length} object(s) N.0.0's copy and uploads wrote under the governance lock.`),{kind:"next",row:a}}async function tEe(e,t,n){let r;try{r=await rr(t.id,{from:"released",to:"complete"})}catch(o){throw so(o,"The record could not be completed")}return e.opts.out(`Re-pull #${t.id} of ${e.datasetId} is complete${n}.`),{kind:"done",result:{row:r,outcome:"complete"}}}async function z$t(e,t){let n=e.opts.plan??Ug(e.configDir,e.datasetId,t.to_tag,t.plan_digest),{file:r,body:o}=Op(n,{environment:Ir(),env:e.env,openNeuroGraphqlUrl:Cl(e.env)});if(r.digest!==t.plan_digest)throw new I("plan-not-the-record",`The plan file is not the plan re-pull #${t.id} was made from (its digest differs); pass the reviewed plan with --plan <file>.`);return o}function G$t(e,t,n){return[`NEMAR's corrections of re-pull #${e.id} (upstream ${e.upstream_ds} ${e.from_tag} to ${e.to_tag}), replayed onto v${e.to_version} as v${n} of ${e.dataset_id} (ADR 0111).`,"",`v${e.to_version} is upstream's snapshot ${e.upstream_ds}@${e.to_tag} with NEMAR's standard edits; this pull request puts back NEMAR's own side of what the plan listed as a correction, and of each conflict an administrator resolved to NEMAR's side. Nothing is scrubbed and nothing is copied: every replayed byte is in a version NEMAR already published.`,"",`- Re-pull record: #${e.id}`,`- Plan digest: ${e.plan_digest}`,`- Corrections the plan listed: ${t.corrections}; conflicts resolved to NEMAR's side: ${t.resolutions}`,`- Paths replayed: ${t.paths.length}; description keys replayed: ${t.keys.length}`,"- Version DOIs this pull request mints when merged: 1","",`\`nemar admin repull resume ${e.dataset_id}\` takes this pull request through the identifier screen and the gates, and \`nemar admin repull merge ${e.dataset_id}\` (or \`nemar admin pr-reviews\`, through the same gate) squash-merges it under the daily merge cap; a merge mints a version DOI that cannot be withdrawn.`,"","The squash commit message must end with the re-pull's trailers, as its last paragraph; the merge path writes that message itself and refuses one that does not:","","```",...Wi(e),yw(t.corrections),"```","","Do not merge this from GitHub's page."].join(`
|
|
418
418
|
`)}async function nEe(e,t){let n=t.counts.corrections,r=t.counts.conflicts,o=e.opts.takeOurs??[];if(typeof n!=="number"||typeof r!=="number")return e.opts.out(`Re-pull #${t.id}'s record does not say how many corrections and conflicts its plan has, so it is not completed; it stays released, and it blocks ${t.dataset_id}'s next re-pull until it is ended. nemar admin repull abandon ${t.dataset_id} ends it as patch_declined (v${t.to_version} stays released and N.0.1 is not made).`),{kind:"done",result:{row:t,outcome:"released"}};if(n===0&&r===0&&o.length===0)return tEe(e,t,"");if(r>0&&o.length===0&&!e.opts.keepUpstream)return{kind:"done",result:{row:t,outcome:"waiting",waitingFor:`an administrator's decision on the ${r} conflict(s) the plan lists, before N.0.1 is made: resolve one to NEMAR's side with --take-ours <path> (or --take-ours dataset_description.json#<Key>), or leave every one on upstream's side with --keep-upstream (the reviewed plan file names them, under conflicts and description.keys)`}};let s=G$(t.to_version);try{let i=await z$t(e,t);Rke(i);let a=Cke(i,o);if(a.corrections!==n)throw new I("patch-plan-mismatch",`The plan lists ${a.corrections} correction(s) and re-pull #${t.id} records ${n}; they are the same plan only when they agree.`);if(a.unresolved>0&&!e.opts.keepUpstream)return{kind:"done",result:{row:t,outcome:"waiting",waitingFor:`an administrator's decision on the ${a.unresolved} conflict(s) the plan lists that no --take-ours names, before N.0.1 is made: name each to take NEMAR's side, or add --keep-upstream to leave them on upstream's side`}};if(!Ake(a))return tEe(e,t,": the plan has no correction, and every conflict stays on upstream's side");return await K$t(e,t,a,s)}catch(i){if(i instanceof I&&!W$t.has(i.code))i.resumable=!0,await io(t,gs("patch",i),e.opts.out);throw i}}var W$t=new Set(["take-ours-invalid","declined","plan-unreadable","plan-schema","plan-environment","plan-sources","planner-version","plan-tampered","plan-not-the-record"]);async function K$t(e,t,n,r){let o=await u_(e),{scratch:s}=o;if(o.prefix!==`${e.datasetId}/objects/`)throw new I("destination-prefix",`NEMAR's nemar-s3 is not at ${e.datasetId}/objects/, where the keys N.0.1 replays are read.`);let i=await Nl({work:s.dir,baseSha:t.merge_sha,env:s.env,acceptances:!0}),a=Cn(r),c=(await Il(s,[a])).get(a),l,d,f;if(c){if(!await Qn(s,a,ko))throw ot("origin-unreadable",`release/v${r} could not be fetched.`);let y=await hy({dir:s.dir,row:t,head:c}),b=y?await uj({scratch:s,row:t,selection:n,parent:y.parent}):null;if(!y||!b||b.sha!==y.commit)throw new I("branch-foreign",`release/v${r} exists on NEMAR's repository and is not this re-pull's N.0.1 commit with these resolutions; run resume with the resolutions the earlier run was given, or decline N.0.1 with nemar admin repull abandon ${e.datasetId}.`);l=y.commit,d=y.parent,f=b.keys}else{let y=await uj({scratch:s,row:t,selection:n,parent:i});l=y.sha,d=i,f=y.keys}let p;try{p=f.length>0?await Wd(o.aws,o.bucket,o.prefix):new Map}catch(y){if(!(y instanceof Bt))throw y;throw new I("s3-failed",`NEMAR's bucket could not be listed for the keys N.0.1 replays (${Gd(y)}); the ambient AWS credentials list it.`)}if(await Pke({dir:s.dir,annexRef:"refs/remotes/origin/heads/git-annex",keys:f,nemarUuid:o.uuid,listing:p}),!c&&e.opts.confirm&&!await e.opts.confirm(`Make v${r} of ${e.datasetId}: replay ${n.paths.length} path(s) and ${n.keys.length} description key(s) onto main (${n.corrections} correction(s), ${n.resolutions} conflict(s) resolved to NEMAR's side, ${n.unresolved} left on upstream's side), push release/v${r} and open its pull request? Its merge will mint one more version DOI, which cannot be withdrawn.`))throw new I("declined","Not confirmed; nothing was pushed.");let m=await xR({work:s.dir,synthSha:l,version:r,push:{versions:[r]},env:s.env});e.opts.out(m.pushed?`Pushed release/v${r} (${l.slice(0,12)}).`:`release/v${r} is already this re-pull's N.0.1 commit${m.head===l?"":" (moved by enrichment)"}.`);let h=await vR({token:e.token,base:e.base,datasetId:e.datasetId,version:r,body:G$t(t,n,r),acceptHead:(y)=>Ns({work:s.dir,from:l,head:y,ref:a,env:s.env})}),g;try{g=await rr(t.id,{from:"released",to:"patch_synthesized",fields:{patch_version:r,patch_branch:`release/v${r}`,patch_pr_number:h.number,patch_head_sha:h.head,patch_base_sha:d,counts:{resolutions:n.resolutions}}})}catch(y){throw so(y,"N.0.1's pull request could not be recorded")}return e.opts.out(`${h.reused?"Found":"Opened"} N.0.1's pull request #${h.number} of release/v${r} (${n.resolutions} conflict(s) resolved to NEMAR's side, ${n.unresolved} left on upstream's side); re-pull #${t.id} is patch_synthesized. Resume never merges.`),{kind:"next",row:g}}async function X$t(e){try{return(await Lo({dataset:e,open:!0,limit:1})).repulls[0]??null}catch(t){throw so(t,"The NEMAR API could not list the re-pulls")}}async function NR(e){return Vd(()=>Q$t(e))}async function Q$t(e){let t=e.env??process.env,n=bn(t),r=await hi(t);if(!r.ok)throw new I("no-github-token",`No GitHub token (${r.reason}): resume reads the pull request with the administrator's own (GH_TOKEN, or gh auth login).`);Al(await fc(e.datasetId));let o=await X$t(e.datasetId);if(!o){let d=(await Lo({dataset:e.datasetId,limit:1})).repulls[0]??null,f=e.automaticFinish;if(f&&!(d?.id===f.repullId&&d.status==="complete"))throw new I("finish-not-merged",`Re-pull #${f.repullId} is not open: a finish takes up only a merged re-pull.`);return{row:d,outcome:f?"complete":"nothing"}}if(e.automaticFinish)Z$t(o,e.automaticFinish.repullId);let s=Jn(),i=Ec(s,e.datasetId,o.plan_digest);vo(J$t(i.lock),Y$t(s,"repull"));let a=Tl(i.lock),c=null,l={datasetId:e.datasetId,token:r.token,base:n,env:t,configDir:s,opts:e,origin:async()=>(c??=await Pl({configDir:s,datasetId:e.datasetId,digest:o.plan_digest,purpose:"resume",env:t,token:r.token}),c),replaced:new Set,sleep:(d)=>new Promise((f)=>setTimeout(f,d))};if(((e.takeOurs?.length??0)>0||e.keepUpstream)&&o.status.startsWith("patch_"))e.out(`Re-pull #${o.id} is ${o.status}: N.0.1 is already made, so --take-ours and --keep-upstream change nothing now.`);try{return await eDt(l,o)}finally{if(e.acceptMergeTrailers&&!l.mergeTrailersRead)e.out(`--accept-merge-trailers changed nothing: re-pull #${o.id} did not reach a merge's release in this run, where a merge's trailers are read.`);c?.close(),a()}}function Z$t(e,t){if(e.id!==t||e.origin!=="automatic")throw new I("repull-mismatch",`The dataset's open re-pull is #${e.id} (origin ${e.origin}); the finish takes up only #${t}, an automatic re-pull.`);if(e.status!=="merged"&&e.status!=="released")throw new I("finish-not-merged",`Re-pull #${e.id} is ${e.status}: a finish takes up only a merged re-pull.`)}async function eDt(e,t){let n=Date.now()+Math.max(0,e.opts.waitMinutes)*60000,r=Math.max(100,e.opts.pollMs??15000),o=t;for(let s=0;;){if(s>20)throw ot("resume-looped",`Re-pull #${o.id} did not settle; run resume again.`);let i=await tDt(e,o);if(i.kind==="done")return i.result;if(i.kind==="next"){o=i.row,s++;continue}if(s=0,Date.now()+r>n)return{row:i.row,outcome:"waiting",waitingFor:i.waitingFor};e.opts.out(`Waiting for ${i.waitingFor}.`),await e.sleep(r);try{o=await K$(i.row.id)}catch(a){throw so(a,"The NEMAR API could not read the re-pull")}}}async function tDt(e,t){switch(t.status){case"planned":case"prepared":case"copied":case"registered":throw new I("use-execute",`Re-pull #${t.id} is ${t.status}: it is taken up by nemar admin repull execute <plan-file>, with the plan it was made from.`);case"pr_open":return rEe(e,t,"n0");case"patch_synthesized":return rEe(e,t,"n1");case"gates_clear":return oEe(e,t,"n0");case"patch_gates_clear":return oEe(e,t,"n1");case"merged":return yj(e,t,"n0");case"patch_merged":return yj(e,t,"n1");case"released":{let n=await eEe(e,t);return n.kind==="next"?nEe(e,n.row):n}case"patch_released":return aDt(e,t);default:throw new I("not-built",`Re-pull #${t.id} is ${t.status}, which resume does not take on.`)}}function sEe(e,t){let n=Dn[t];return{pr:t,number:e[n.number],branch:e[n.branch],head:e[n.head],gates:e[n.gates],claimSha:e[n.claimSha],claimedAt:e[n.claimedAt],version:e[n.version],base:t==="n0"?e.base_sha:e.patch_base_sha,anchor:t==="n0"?e.synth_sha:e.patch_head_sha,closedTo:t==="n0"?"abandoned":"patch_declined"}}async function iEe(e,t){let n=await Cs(e.token,e.datasetId,t.number,e.base);if(!n.ok)throw ot("github-unreadable",`Pull request #${t.number} could not be read on GitHub (${n.reason})`);return n.value}async function aEe(e,t,n){let r;try{r=await Y$(t.id,n.pr)}catch(s){throw so(s,`The merge of pull request #${n.number} could not be recorded`)}let o=[r.merged_outside_tool?"no NEMAR tool held a claim for it":null,r.merged_unscreened_head?"at a head other than the screened one":null].filter(Boolean);return e.opts.out(`Pull request #${n.number} is merged; re-pull #${t.id} records it${o.length>0?` (${o.join(", ")})`:""}.`),{kind:"next",row:r.repull}}async function gy(e,t,n,r){try{return await rr(e.id,{from:e.status,to:t,fields:n})}catch(o){throw so(o,r)}}function d_(e,t,n,r){let o={...hj(e)};if(t.pr==="n0"){if(o.head_sha=n,r)o.synth_sha=r.synthSha,o.synth_tree=r.synthTree,o.base_sha=r.baseSha}else if(o.patch_head_sha=n,r)o.patch_base_sha=r.baseSha;return o}async function cEe(e,t,n){let r=await gy(t,n.closedTo,{},"The record could not be ended");return e.opts.out(n.pr==="n0"?`Pull request #${n.number} was closed without being merged: re-pull #${t.id} is abandoned. Plan the dataset again to re-pull it.`:`N.0.1's pull request #${n.number} was closed without being merged: re-pull #${t.id} is patch_declined, and v${t.to_version} stays released; its corrections remain corrections in the next plan.`),{kind:"done",result:{row:r,outcome:"ended"}}}async function lEe(e,t,n){return Ns({work:e.dir,from:t.anchor,head:n,ref:Cn(t.version),env:e.env})}async function nDt(e,t,n,r){if(n.pr==="n0")return Dke({scratch:e,row:t,head:r});let o=await uEe(e,t,n);if(!o)return null;let s=await Ike({dir:e.dir,row:t,recorded:o,head:r});return s?{synthSha:s.sha,synthTree:s.tree,baseSha:s.baseSha}:null}async function uEe(e,t,n){if(!await Qn(e,n.anchor,ko))return null;return await Qn(e,t.merge_sha,ko),(await hy({dir:e.dir,row:t,head:n.anchor}))?.commit??null}async function rEe(e,t,n){let r=sEe(t,n),o=await iEe(e,r);if(o.state==="merged")return aEe(e,t,r);if(o.state==="closed")return cEe(e,t,r);if(o.baseRef!=="main"||o.headRef!==r.branch){let g=ot("pr-foreign",`Pull request #${r.number} is not ${r.branch} into main.`);throw await io(t,gs("gates",g),e.opts.out),g}if(!Gi(o.headRepo,t.dataset_id)||!Gi(o.baseRepo,t.dataset_id)){let g=ot("pr-foreign",`Pull request #${r.number} is not from and into ${mw}/${t.dataset_id} itself (its head is ${o.headRepo??"a repository GitHub no longer names"}, its base ${o.baseRepo??"a repository GitHub no longer names"}): a fork's pull request is never merged as a re-pull's.`);throw await io(t,gs("gates",g),e.opts.out),g}if(o.headSha!==r.head){if(e.replaced.has(o.headSha))return{kind:"wait",row:t,waitingFor:"GitHub to show the re-synthesized head"};let g=await e.origin(),y=await lEe(g,r,o.headSha);if(y!=="ok"){let _=await nDt(g,t,r,o.headSha);if(_){let k=await gy(t,t.status,d_(t,r,o.headSha,_),"The re-synthesized commit could not be recorded");return e.opts.out(`${r.branch} holds this re-pull's commit made again on a moved main (${_.synthSha.slice(0,12)}), pushed by an earlier run; re-pull #${t.id} records it.`),{kind:"next",row:k}}let x=y==="unreadable"?ot("branch-unreadable",`Whether the head of ${r.branch} is this re-pull's commit and enrichment's could not be read.`):ot("head-foreign",`${r.branch} holds a commit enrichment does not make: this pull request cannot be merged as it is; end the record with nemar admin repull abandon ${e.datasetId}.`);throw await io(t,gs("gates",x),e.opts.out),x}let b=await gy(t,t.status,d_(t,r,o.headSha),"The moved head could not be recorded");return e.opts.out(`${r.branch} moved by enrichment to ${o.headSha.slice(0,12)}; re-pull #${t.id} records it.`),{kind:"next",row:b}}let s=await e.origin(),i;try{i=await Nl({work:s.dir,baseSha:r.base,env:s.env})}catch(g){if(g instanceof I)g.resumable=!0,await io(t,gs("gates",g),e.opts.out);throw g}let a=await op(e.token,e.datasetId,r.number,{headSha:o.headSha,mergeableState:o.mergeableState},{base:e.base,sleep:e.sleep});if(!a.ok){if(a.kind==="unreadable")throw ot("github-unreadable",`GitHub could not say whether #${r.number} can be merged.`);return{kind:"wait",row:t,waitingFor:`pull request #${r.number} to settle on GitHub`}}let c=a.state,l=i===r.base?[]:await r_(s.dir,r.base,i);if(l===null)throw ot("main-unreadable","Whether NEMAR's main moved outside .nemar/ and .github/ could not be read; run resume again.");if(i!==r.base&&(c==="dirty"||c==="behind"||l.length>0))return sDt(e,t,r,i,o.headSha,l.length>0?`enrichment changed ${l.length} path(s) outside .nemar/ and .github/ on it`:`GitHub reports its pull request '${c}'`);let d=await rDt(e,t,r),f=[];if(d!==null)f.push(d);let p=c==="unstable"&&t.origin==="administrator"?await r6({token:e.token,base:e.base,datasetId:e.datasetId,sha:r.head,origin:t.origin,mergeableState:c,prNumber:r.number}):null;if(c!=="clean"&&p?.kind!=="bids-only")f.push(`GitHub to report pull request #${r.number} clean (it reports '${c}'${p?`: ${p.why}`:""})`);if(f.length>0)return{kind:"wait",row:t,waitingFor:f.join(", and ")};let m=Dn[n],h;try{h=await rr(t.id,{from:m.open,to:m.gatesClear,fields:{[m.gates]:r.head}})}catch(g){let y=pn(g);if(y==="head-moved"||y==="screen-changed")return{kind:"next",row:t};if(y==="screen-not-clear")return{kind:"wait",row:t,waitingFor:"the identifier screen to pass for this head"};throw so(g,"The gates could not be recorded")}if(c==="clean")return e.opts.out(`The identifier screen and GitHub pass for ${r.head.slice(0,12)}: re-pull #${t.id} is ${m.gatesClear}.`),{kind:"done",result:{row:h,outcome:"ready"}};return e.opts.out(`The identifier screen passes for ${r.head.slice(0,12)}, and GitHub reports its pull request unstable only because BIDS validation failed: re-pull #${t.id} is ${m.gatesClear}. It merges over the failed validation with a reason, once you have read it, or without one once the validation passes.`),{kind:"done",result:{row:h,outcome:"ready",bidsFailure:!0}}}async function rDt(e,t,n){let r=n.head,o;try{o=await Ig(t.id)}catch(i){throw so(i,"The identifier screens could not be read")}if(o.exempt)return null;let s=o.screens.find((i)=>i.pr===n.pr&&i.sha===r)??null;if(s===null||s.gate==="rerun"){try{let i=await hbe(t.id,{pr:n.pr,sha:r});if(i.exempt)return null;e.opts.out(`Dispatched the identifier screen of ${r.slice(0,12)}.`),s=i.screen}catch(i){if(pn(i)!=="screen-exists")throw so(i,"The identifier screen could not be dispatched");s=i.rawBody?.screen??null}if(s===null||s.gate==="rerun"||s.gate==="wait")return`the identifier screen of ${r.slice(0,12)}`}switch(s.gate){case"clear":return null;case"wait":return`the identifier screen of ${r.slice(0,12)} (running)`;case"blocks":{let i=ot("screen-blocks",`${s.headline}. A direct identifier cannot be acknowledged: this commit is not merged.`);throw await io(t,gs("gates",i),e.opts.out),i}case"acknowledge":{if(s.acknowledged_at!==null)return null;if(!e.opts.acknowledgment)return`an administrator's reason for the identifier screen (${s.headline}); read it with nemar admin repull status ${e.datasetId}, then run nemar admin repull resume ${e.datasetId} --acknowledge-identifier-screen "<reason>"`;try{await gbe(t.id,{pr:n.pr,sha:r,reason:e.opts.acknowledgment})}catch(i){throw so(i,"The acknowledgment could not be recorded")}return e.opts.out(`Recorded your acknowledgment of the identifier screen of ${r.slice(0,12)}.`),null}default:return`the identifier screen of ${r.slice(0,12)}`}}async function oDt(e,t,n,r,o){let s=await uEe(e,t,n);if(!s)throw new I("origin-unreadable","N.0.1's commit could not be found beneath its recorded head on NEMAR's repository.");let i=await fj({dir:e.dir,commit:s,newMain:r}),a=Cn(n.version),c=await Sc(e.dir,[`${i.sha}:${a}`],{versions:[n.version]},e.env,[`--force-with-lease=${a}:${o}`]);if(c.outcome==="rejected")throw new I("branch-moved",`release/v${n.version} moved while it was re-synthesized; nothing was replaced. Run resume again.`);if(c.outcome==="remote-rejected"||c.outcome==="failed")throw new I("push-failed",`The re-synthesized release/v${n.version} could not be pushed (${vi(c.cause)}).`);return{synthSha:i.sha,synthTree:i.tree}}async function sDt(e,t,n,r,o,s){if(e.opts.confirm&&!await e.opts.confirm(`NEMAR's main moved by enrichment since re-pull #${t.id}'s ${n.pr==="n0"?"commit":"N.0.1 commit"} was made, and ${s}. Make the commit again on the new main and push ${n.branch} with a lease (nothing enrichment wrote is undone)?`))throw new I("declined","Not confirmed; nothing was pushed.");let i=await e.origin(),a;try{a=n.pr==="n0"?await $ke({scratch:i,row:t,newMain:r,liveHead:o}):await oDt(i,t,n,r,o)}catch(l){if(l instanceof I)l.resumable=!0,await io(t,gs("gates",l),e.opts.out);throw l}e.replaced.add(o);let c=await gy(t,t.status,d_(t,n,a.synthSha,{...a,baseSha:r}),"The re-synthesized commit could not be recorded");return e.opts.out(`Made re-pull #${t.id}'s commit again on the new main (${a.synthSha.slice(0,12)}) and pushed ${n.branch}; its identifier screen runs again for the new head.`),{kind:"next",row:c}}async function oEe(e,t,n){let r=sEe(t,n),o=await iEe(e,r);if(o.state==="merged")return aEe(e,t,r);if(r.claimSha!==null)try{let l=await ybe(t.id,{pr:n,sha:r.claimSha,outcome:"expired"});return e.opts.out(`The claim to merge made at ${r.claimedAt} expired: GitHub says pull request #${r.number} did not merge, and its unit of today's merge cap is free.`),{kind:"next",row:l}}catch(l){let d=pn(l);if(d==="pull-request-merged")return{kind:"next",row:t};if(d==="claim-too-recent")return{kind:"done",result:{row:t,outcome:"waiting",waitingFor:`the claim to merge made at ${r.claimedAt} to be resolved: run nemar admin repull merge ${e.datasetId} to send the merge again under it, or resume later to expire it`}};throw so(l,"The claim to merge could not be resolved")}if(o.state==="closed")return cEe(e,t,r);if(o.headSha!==r.gates){let l=await e.origin(),d=await lEe(l,r,o.headSha);if(d!=="ok")throw ot(d==="unreadable"?"branch-unreadable":"head-foreign",`${r.branch} moved since its gates were recorded, ${d==="unreadable"?"and whether by enrichment only could not be read":"by a commit enrichment does not make"}.`);let f=await gy(t,Dn[n].open,d_({...t,status:Dn[n].open},r,o.headSha),"The moved head could not be recorded");return e.opts.out(`${r.branch} moved by enrichment since its gates were recorded; re-pull #${t.id} is ${Dn[n].open} again, and its screen runs for the new head.`),{kind:"next",row:f}}let s=await e.origin(),i;try{i=await Nl({work:s.dir,baseSha:r.base,env:s.env})}catch(l){if(l instanceof I)l.resumable=!0;throw l}let a=i===r.base?[]:await r_(s.dir,r.base,i);if(a===null)throw ot("main-unreadable","Whether NEMAR's main moved outside .nemar/ and .github/ since the gates could not be read; run resume again.");if(a.length>0){let l=Dn[n].open,d=await gy(t,l,d_({...t,status:l},r,o.headSha),"The return to the open pull request could not be recorded");return e.opts.out(`NEMAR's main moved by enrichment since the gates, on ${a.length} path(s) outside .nemar/ and .github/: re-pull #${t.id} is ${l} again, and its commit is made again on the new main.`),{kind:"next",row:d}}let c=await iDt(e,t,r,o);return{kind:"done",result:{row:t,outcome:"ready",...c?{bidsFailure:!0}:{}}}}async function iDt(e,t,n,r){if(t.origin!=="administrator")return!1;let o=await op(e.token,e.datasetId,n.number,{headSha:r.headSha,mergeableState:r.mergeableState},{base:e.base,sleep:e.sleep});if(!o.ok||o.state!=="unstable")return!1;return(await r6({token:e.token,base:e.base,datasetId:e.datasetId,sha:r.headSha,origin:t.origin,mergeableState:o.state,prNumber:n.number})).kind==="bids-only"}async function aDt(e,t){let n;try{n=await rr(t.id,{from:"patch_released",to:"complete"})}catch(r){throw so(r,"The record could not be completed")}return e.opts.out(`Re-pull #${t.id} of ${e.datasetId} is complete: v${t.to_version} and v${t.patch_version} are released.`),{kind:"done",result:{row:n,outcome:"complete"}}}no();var zo=(e)=>e?e.slice(0,12):"none";function cDt(e){let t=e.dataset_id;switch(e.status){case"planned":case"prepared":case"copied":case"registered":return"nemar admin repull execute <plan-file> (the reviewed plan this record was made from)";case"pr_open":return`nemar admin repull resume ${t} (the identifier screen and the gates)`;case"gates_clear":return e.merge_claim_sha?`nemar admin repull merge ${t} (sends the merge again under the held claim), or resume ${t} once the claim is old enough to expire`:`nemar admin repull merge ${t} (mints one version DOI, v${e.to_version})`;case"merged":return`nemar admin repull resume ${t} (the release, the lock, then N.0.1 or the end)`;case"released":return typeof e.counts.conflicts==="number"&&e.counts.conflicts>0?`nemar admin repull resume ${t} --take-ours <path> or --keep-upstream (the lock, then N.0.1 or the end; the plan's ${e.counts.conflicts} conflict(s) wait for your decision), or nemar admin repull abandon ${t} (declines N.0.1)`:`nemar admin repull resume ${t} (the lock, then N.0.1 or the end)`;case"patch_synthesized":return`nemar admin repull resume ${t} (N.0.1's identifier screen and gates)`;case"patch_gates_clear":return e.patch_merge_claim_sha?`nemar admin repull merge ${t} (sends N.0.1's merge again under the held claim), or resume ${t} once the claim is old enough to expire`:`nemar admin repull merge ${t} (mints one version DOI, v${e.patch_version})`;case"patch_merged":case"patch_released":return`nemar admin repull resume ${t} (N.0.1's release and the end)`;default:return VF(e.status)?null:`nemar admin repull resume ${t}`}}function dEe(e,t){let n=[`Re-pull #${e.id} of ${e.dataset_id}: ${e.status} (attempt ${e.attempt}, ${e.origin})`,` Upstream ${e.upstream_ds}: ${e.from_tag} -> ${e.to_tag}, as v${e.to_version} (from v${e.from_version})`,` Plan: ${e.plan_digest} (planner ${e.planner})`,` Base: ${zo(e.base_sha)} Commit: ${zo(e.synth_sha)} Tree: ${zo(e.synth_tree)}`];if(e.pr_number!==null)n.push(` Pull request: #${e.pr_number} of ${e.branch}, head ${zo(e.head_sha)}`);if(e.gates_sha)n.push(` Gates clear at: ${zo(e.gates_sha)}`);if(e.merge_claim_sha)n.push(` Claim to merge: ${zo(e.merge_claim_sha)}, made ${e.merge_claimed_at} UTC`);if(e.merge_sha)n.push(` Merge: ${zo(e.merge_sha)}`);if(e.tag_sha)n.push(` Tag v${e.to_version}: ${zo(e.tag_sha)}`);if(e.patch_pr_number!==null)n.push(` N.0.1 pull request: #${e.patch_pr_number} of ${e.patch_branch}, head ${zo(e.patch_head_sha)}, base ${zo(e.patch_base_sha)}`);if(e.patch_gates_sha)n.push(` N.0.1 gates clear at: ${zo(e.patch_gates_sha)}`);if(e.patch_merge_claim_sha)n.push(` N.0.1 claim to merge: ${zo(e.patch_merge_claim_sha)}, made ${e.patch_merge_claimed_at} UTC`);if(e.patch_merge_sha)n.push(` N.0.1 merge: ${zo(e.patch_merge_sha)}`);if(e.patch_tag_sha)n.push(` Tag v${e.patch_version}: ${zo(e.patch_tag_sha)}`);if(e.status==="released")n.push(typeof e.counts.locked==="number"?` Objects locked: ${e.counts.locked}`:" Objects locked: not yet (resume applies the lock)");let r=Object.entries(e.counts).sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>`${s}=${i}`);if(r.length>0)n.push(` Counts: ${r.join(", ")}`);if(e.last_error)n.push(` Last error: ${e.last_error}`);if(n.push(` Created ${e.created_at} UTC, updated ${e.updated_at} UTC`),t===null)n.push(" Identifier screens: an xx dataset is not screened");else for(let s of t){let i=s.acknowledged_at!==null?`; acknowledged by administrator #${s.acknowledged_by} at ${s.acknowledged_at} UTC`:"";n.push(` Identifier screen of ${zo(s.sha)} (${s.pr}): ${s.headline} (gate: ${s.gate}${s.waiting?", running":""}${i})`);for(let a of s.lines)n.push(` ${a}`)}let o=cDt(e);if(o)n.push(` Next: ${o}`);return n}function fEe(e){return` #${e.id}: ${e.from_tag} -> ${e.to_tag}, attempt ${e.attempt}, ${e.status}${e.terminal_at?` (${e.terminal_at} UTC)`:""}`}Fi();no();yo();ze();xr();fn();import{mkdirSync as H1t,mkdtempSync as V1t,readFileSync as z1t,rmSync as MSe}from"fs";import{dirname as G1t,join as FSe}from"path";Fi();no();yo();fn();Xi();import{existsSync as wj,mkdirSync as lDt,readFileSync as _j,readdirSync as uDt,renameSync as dDt,rmSync as fDt,statSync as pDt,writeFileSync as xj}from"fs";import{join as Kd}from"path";Hf();var pEe="--automatic-dispatch",mDt="run-upstream-repull",mEe=["mode","dataset_id","upstream_ds","from_tag","to_tag","dispatch_id","dispatch_token","cli_version","repull_id"],hDt=new Set(["repull_id"]);function vj(e){return W$.test(e)?Number(e):null}function br(e){return new I("dispatch-invalid",`The dispatch's ${e} is not what the Worker sends, so the run does not act on it.`)}function gDt(e){if(e===null||typeof e!=="object"||Array.isArray(e))throw br("payload");let t=e,n=mEe;for(let m of Object.keys(t))if(!n.includes(m))throw br("set of keys");for(let m of mEe){if(!(m in t)){if(!hDt.has(m))throw br("set of keys");continue}if(typeof t[m]!=="string")throw br(m)}let r=t,o=r.mode;if(o!=="open"&&o!=="finish")throw br("mode");let s=r.dataset_id;if(!/^on\d{6}$/.test(s))throw br("dataset_id");let i=r.upstream_ds;if(!/^ds\d{6}$/.test(i))throw br("upstream_ds");let{from_tag:a,to_tag:c}=r;if(!Cr(a))throw br("from_tag");if(!Cr(c))throw br("to_tag");if(Ar(a,c))throw br("tag pair");let l=vj(r.dispatch_id);if(l===null)throw br("dispatch_id");let d=null;if(r.repull_id!==void 0){if(d=vj(r.repull_id),d===null)throw br("repull_id")}if(o==="finish"&&d===null)throw br("repull_id");let f=r.dispatch_token;if(!ube.test(f))throw br("dispatch_token");let p=r.cli_version;if(!Pg.test(p))throw br("cli_version");return{mode:o,datasetId:s,upstreamDs:i,fromTag:a,toTag:c,dispatchId:l,repullId:d,token:f,cliVersion:p}}var yDt=1048576;function bDt(e){let t=e.GITHUB_EVENT_PATH,n=()=>new I("runner-failed","No dispatch event file: the automatic mode runs only inside the run-upstream-repull workflow.");if(!t)throw n();let r;try{if(pDt(t).size>yDt)throw br("event");r=JSON.parse(_j(t,"utf8"))}catch(s){if(s instanceof I)throw s;if(s.code==="ENOENT")throw n();throw br("event")}if(r===null||typeof r!=="object"||Array.isArray(r))throw br("event");let o=r;if(o.action!==mDt)throw br("event type");return gDt(o.client_payload)}var wDt=/^[a-z][a-z0-9-]{0,31}$/,_Dt=/^[a-z][a-z0-9_]{0,31}$/,xDt=/^[a-z0-9_.-]{1,64}$/;function f_(e,t={}){if(!wDt.test(e))return"repull-auto: unprintable-line";let n=[`repull-auto: ${e}`];for(let[r,o]of Object.entries(t)){let s=typeof o==="boolean"?o?"yes":"no":typeof o==="number"?Number.isSafeInteger(o)&&o>=0?String(o):"invalid":o;if(!_Dt.test(r)||!xDt.test(s))return"repull-auto: unprintable-line";n.push(`${r}=${s}`)}return n.join(" ")}var FR=null;function MR(){if(FR)return FR;let e=process.stdout.write.bind(process.stdout),t=0,n=(...d)=>{t++;let f=d[d.length-1];if(typeof f==="function")queueMicrotask(()=>f(null));return!0},r=()=>{t++};for(let d of["log","info","warn","error","debug","trace","dir","table"])console[d]=r;process.stdout.write=n,process.stderr.write=n;let o=null,s=null,i=new Map,a=()=>{let d={suppressed:t};for(let[f,p]of i)d[`${f}_s`]=p;return d},c=()=>{let d=s;if(o=d?d.phase:"failed",e(`${f_("quiet",a())}
|
|
419
419
|
`),d){e(`${f_("report-stands",{phase:d.phase})}
|
|
420
420
|
`);let{phase:f,code:p}=d;e(`${f_("result",p===void 0?{phase:f}:{phase:f,code:p})}
|
|
@@ -1680,8 +1680,8 @@ ${o} finding(s). Preview the remediation with: nemar admin doctor fix <check> --
|
|
|
1680
1680
|
${u.bold(e)}: ${u.green(`${i.fixed} fixed`)}, ${i.skipped} skipped, ${i.failed>0?u.red(`${i.failed} failed`):"0 failed"}${c}`)}if(i.failed>0)process.exit(1)});async function FOt(e,t,n){let r={fixed:0,skipped:0,failed:0,resolved:0},o=[];for(let[s,i]of e.entries()){let a;try{let c=await t(i,s);if(a=c.results,a.length===0)r.resolved++;else r.fixed+=c.fixed,r.skipped+=c.skipped,r.failed+=c.failed}catch(c){r.failed++,a=[{dataset_id:i,status:"failed",message:G(c)}]}o.push(...a),n?.onDataset?.(i,a)}return{totals:r,results:o}}L1.command("kinds").description("Check that operational accounts carry their expected account kind (read-only)").action(async()=>{if(!ke())return;let e=Object.entries(oZ),t=D(`Checking ${e.length} operational account kind(s)...`).start(),n=[],r=[];try{for(let[o,s]of e)try{let{user:i}=await BS(o);if(i.account_kind!==s)n.push(`${o}: expected '${s}', found '${i.account_kind??"unknown"}'`)}catch(i){if(i instanceof L&&i.statusCode===404)r.push(o);else throw i}if(t.stop(),n.length===0&&r.length===0){console.log(u.green(`All ${e.length} operational account(s) carry their expected kind.`));return}for(let o of n)console.log(` ${u.yellow("kind mismatch")} ${o}`);for(let o of r)console.log(` ${u.yellow("account absent")} ${o}`);console.log(u.yellow(`
|
|
1681
1681
|
${n.length+r.length} finding(s). Fix a mismatch with \`nemar admin kind <username> <kind>\`.`))}catch(o){t.fail("Doctor kinds check failed"),console.error(u.red(G(o))),process.exit(1)}});Oe.addCommand(L1);var ZL=new de("email-preferences").description("Manage email notification preferences");ZL.command("show").description("Show email notification preferences").option("--user <username>","(owner only) show another user's preferences").action(async(e)=>{if(!Ve())console.error(u.red("Not authenticated. Run: nemar auth login")),process.exit(1);let t=D("Fetching email preferences...").start();try{let n=await xme(e.user),r=n.username?`${n.username}'s`:"Your";t.succeed(`${r} email notification preferences:`),console.log();let o=[{key:"user_approval",label:"User approval notifications"},{key:"publication_request",label:"Publication request notifications"},{key:"announcements",label:"Announcement emails"},{key:"dataset_anonymity",label:"Anonymity sweep findings"},{key:"identifier_sweep",label:"Identifier sweep weekly report"},{key:"support_tickets",label:"Support tickets assigned to you"}];for(let s of o){let a=n[s.key]?u.green("enabled"):u.dim("disabled");console.log(` ${s.label.padEnd(40)} ${a}`)}console.log(),console.log(u.dim(" Use 'nemar admin email-preferences update' to change settings."))}catch(n){t.fail("Failed to fetch preferences"),console.error(u.red(G(n)))}});ZL.command("update").description("Update email notification preferences").option("--user-approval <bool>","Enable/disable user approval notifications").option("--publication-request <bool>","Enable/disable publication request notifications").option("--announcements <bool>","Enable/disable announcement emails").option("--dataset-anonymity <bool>","Enable/disable anonymity sweep findings").option("--identifier-sweep <bool>","Enable/disable the identifier sweep weekly report").option("--support-tickets <bool>","Enable/disable support ticket notifications").option("--all <bool>","Enable/disable all notifications").option("--user <username>","(owner only) update another user's preferences").action(async(e)=>{if(!Ve())console.error(u.red("Not authenticated. Run: nemar auth login")),process.exit(1);function t(o){if(o===void 0)return;let s=o.toLowerCase();if(s==="true"||s==="1"||s==="on"||s==="yes")return!0;if(s==="false"||s==="0"||s==="off"||s==="no")return!1;console.error(u.red(`Invalid boolean value: "${o}". Use true/false, on/off, yes/no.`)),process.exit(1)}let n={};if(e.all!==void 0){let o=t(e.all);n.user_approval=o,n.publication_request=o,n.announcements=o,n.dataset_anonymity=o,n.identifier_sweep=o,n.support_tickets=o}else{let o=t(e.userApproval),s=t(e.publicationRequest),i=t(e.announcements),a=t(e.datasetAnonymity),c=t(e.identifierSweep),l=t(e.supportTickets);if(o===void 0&&s===void 0&&i===void 0&&a===void 0&&c===void 0&&l===void 0)console.error(u.red("No preferences specified.")),console.log(" --user-approval <bool> User approval notifications"),console.log(" --publication-request <bool> Publication request notifications"),console.log(" --announcements <bool> Announcement emails"),console.log(" --dataset-anonymity <bool> Anonymity sweep findings"),console.log(" --identifier-sweep <bool> Identifier sweep weekly report"),console.log(" --support-tickets <bool> Support ticket notifications"),console.log(" --all <bool> All notifications"),process.exit(1);if(o!==void 0)n.user_approval=o;if(s!==void 0)n.publication_request=s;if(i!==void 0)n.announcements=i;if(a!==void 0)n.dataset_anonymity=a;if(c!==void 0)n.identifier_sweep=c;if(l!==void 0)n.support_tickets=l}let r=D("Updating email preferences...").start();try{let o=await vme(n,e.user),s=o.username?`${o.username}'s`:"Your";r.succeed(`${s} email preferences updated:`),console.log(),console.log(` User approval: ${o.user_approval?u.green("enabled"):u.dim("disabled")}`),console.log(` Publication request: ${o.publication_request?u.green("enabled"):u.dim("disabled")}`),console.log(` Announcements: ${o.announcements?u.green("enabled"):u.dim("disabled")}`),console.log(` Anonymity findings: ${o.dataset_anonymity?u.green("enabled"):u.dim("disabled")}`),console.log(` Identifier sweep: ${o.identifier_sweep?u.green("enabled"):u.dim("disabled")}`),console.log(` Support tickets: ${o.support_tickets?u.green("enabled"):u.dim("disabled")}`)}catch(o){r.fail("Failed to update preferences"),console.error(u.red(G(o)))}});Oe.addCommand(ZL);var q1=new de("notice").description("Manage system notices displayed to CLI users");q1.command("list").description("List all notices (including expired)").action(async()=>{if(!Ve())console.error(u.red("Not authenticated. Run: nemar auth login")),process.exit(1);let e=D("Fetching notices...").start();try{let{notices:t}=await She();if(t.length===0){e.succeed("No notices found.");return}e.succeed(`${t.length} notice(s):`),console.log();for(let n of t){let o={critical:u.red.bold,warning:u.yellow,maintenance:u.magenta,announcement:u.green,tip:u.blue,info:u.blue}[n.level]||u.white,s=n.expires_at&&new Date(n.expires_at)<new Date?u.dim(" (expired)"):"";if(console.log(` ${u.dim(`#${n.id}`)} ${o(`[${n.level.toUpperCase()}]`)} ${u.dim(`scope:${n.scope}`)}${s}`),console.log(` ${n.message}`),console.log(` ${u.dim(`Created: ${n.created_at}`)}`),n.expires_at)console.log(` ${u.dim(`Expires: ${n.expires_at}`)}`);console.log()}}catch(t){At(t,e,"Failed to fetch notices")}});q1.command("set").description("Create a new system notice").requiredOption("-m, --message <text>","Notice message text").option("-l, --level <level>","Notice level: tip, announcement, maintenance, warning, critical","tip").option("-s, --scope <scope>","Target scope: all, admins, members","all").option("-e, --expires <datetime>","Expiry datetime (ISO 8601)").action(async(e)=>{if(!Ve())console.error(u.red("Not authenticated. Run: nemar auth login")),process.exit(1);if(![...LN,"info"].includes(e.level))console.error(u.red(`Invalid level: ${e.level}. Use ${LN.join(", ")}.`)),process.exit(1);if(!["all","admins","members"].includes(e.scope))console.error(u.red(`Invalid scope: ${e.scope}. Use all, admins, or members.`)),process.exit(1);let t=D("Creating notice...").start();try{let n=await $he({message:e.message,level:e.level,scope:e.scope,expires_at:e.expires});if(t.succeed(`Notice created (ID: ${n.id})`),console.log(` Level: ${n.level}`),console.log(` Scope: ${n.scope}`),console.log(` Message: ${n.message}`),n.expires_at)console.log(` Expires: ${n.expires_at}`)}catch(n){At(n,t,"Failed to create notice")}});q1.command("clear <id>").description("Delete a notice by ID").option(Xe,nt).option(bt,gt).action(async(e,t)=>{if(!Ve())console.error(u.red("Not authenticated. Run: nemar auth login")),process.exit(1);let n=Number.parseInt(e,10);if(Number.isNaN(n))console.error(u.red("Invalid notice ID")),process.exit(1);if(!await De(`Delete notice #${n}?`,t,!1))return;let o=D("Deleting notice...").start();try{await Dhe(n),o.succeed(`Notice #${n} deleted`)}catch(s){At(s,o,"Failed to delete notice")}});Oe.addCommand(q1);function MOt(e){let t=[`${u.bold(`Announcement ${e.id}`)} ${u.cyan(e.status)}`,` Subject: ${e.subject}`,` To: ${e.recipient_group}`,` Sent at: ${e.sent_at}`];if(e.status==="sent")t.push(` Delivered: ${e.queued_count>0?e.delivered_count:"n/a (sent inline)"}`),t.push(` Failed: ${e.failure_count}`);else{t.push(` Queued: ${e.queued_count}`),t.push(` Delivered: ${e.delivered_count}`),t.push(` Failed: ${e.failure_count}`),t.push(` Unconfirmed: ${e.unknown_count} (not retried; the provider never confirmed them)`);let n=e.queued_count-e.delivered_count-e.failure_count-e.unknown_count;if(n>0)t.push(` Pending: ${n}`)}if(e.failed_recipients.length>0){t.push(" Failed addresses are shown redacted and may not be unique:");for(let n of e.failed_recipients)t.push(u.red(` Failed: ${n}`))}return t}Oe.command("notify").description("Send an email to a group or a single user").option("--to <group>","Recipient group: all, admins, members").option("--user <username>","Send to a single user by username").option("--subject <text>","Email subject line").option("--body <text>","Email body (markdown)").option("--body-file <path>","Read email body from file (markdown)").option("--dry-run","Preview recipients without sending").option("--status <id>","Show the progress of a queued announcement by its ID").option("--json","Output raw JSON (with --status)").option(Xe,nt).option(bt,gt).action(async(e)=>{if(!Ve())console.error(u.red("Not authenticated. Run: nemar auth login")),process.exit(1);if(e.status!==void 0){let c=Number(e.status);if(!Number.isInteger(c)||c<1)console.error(u.red(`Invalid announcement ID: ${e.status}`)),process.exit(1);let l=e.json?null:D("Fetching announcement status...").start();try{let d=await kme(c);if(e.json){console.log(JSON.stringify(d,null,2));return}l?.stop();for(let f of MOt(d))console.log(f)}catch(d){At(d,l??D(),"Failed to fetch announcement status")}return}if(!e.subject)console.error(u.red("Email subject required. Use --subject.")),process.exit(1);let t=e.subject;if(e.to&&e.user)console.error(u.red("--to and --user are mutually exclusive. Provide exactly one.")),process.exit(1);if(!e.to&&!e.user)console.error(u.red("Provide either --to <group> or --user <username>.")),process.exit(1);if(e.to&&!["all","admins","members"].includes(e.to))console.error(u.red(`Invalid group: ${e.to}. Use all, admins, or members.`)),process.exit(1);let n;if(e.bodyFile){if(!N1(e.bodyFile))console.error(u.red(`File not found: ${e.bodyFile}`)),process.exit(1);n=_Ot(e.bodyFile,"utf-8")}else if(e.body)n=e.body;else console.error(u.red("Email body required. Use --body or --body-file.")),process.exit(1);let r=e.user?`user:${e.user}`:e.to,o=e.user?{user:e.user,subject:t,body:n}:{to:e.to,subject:t,body:n};if(e.dryRun){let c=D("Checking recipients...").start();try{let l=await CN({...o,dry_run:!0});if("dry_run"in l){c.succeed(`Dry run: ${l.recipient_count} recipient(s) for "${l.recipient_group}"`),console.log();for(let d of l.recipients)console.log(` ${d}`)}}catch(l){At(l,c,"Failed to check recipients")}return}console.log(u.bold("Email preview:")),console.log(` To: ${u.cyan(r)}`),console.log(` Subject: ${t}`),console.log(` Body: ${n.length>100?`${n.substring(0,100)}...`:n}`),console.log();let s=e.user?`Send this email to ${e.user}?`:"Send this broadcast email?";if(!await De(s,e,!1))return;let a=D(e.user?`Sending to ${e.user}...`:"Sending broadcast...").start();try{let c=await CN(o);if("broadcast_id"in c){if(c.error==="queue_enqueue_failed")a.warn(`Enqueue failed (ID ${c.broadcast_id}): ${c.recipient_count} queued, ${c.failure_count} not queued; check progress with: nemar admin notify --status ${c.broadcast_id}`);else if(c.status==="queued"&&c.failure_count===0)a.succeed(`Queued ${c.recipient_count} announcement(s) (ID ${c.broadcast_id}); check progress with: nemar admin notify --status ${c.broadcast_id}`);else if(c.failure_count>0){a.warn(`Email send: ${c.recipient_count} delivered, ${c.failure_count} failed`);for(let l of c.failed_recipients)console.log(u.red(` Failed: ${l}`))}else{let l=e.user?`Email sent to ${e.user}`:`Broadcast sent to ${c.recipient_count} recipient(s)`;a.succeed(`${l} (ID: ${c.broadcast_id})`)}if((c.suppressed_count??0)>0)console.log(u.yellow(` ${c.suppressed_count} recipient(s) withheld by the non-production delivery fence`))}}catch(c){At(c,a,"Failed to send email")}});var jOt=1500;function LOt(e){switch(e.kind){case"ok":return u.green(`ok ${e.schema_version}`);case"stale":return u.yellow(`stale ${e.schema_version}`);case"missing":return u.red("missing");case"error":return u.red(`error ${e.status||"?"}: ${e.message}`)}}function qOt(e){return e.kind==="stale"||e.kind==="missing"}function BOt(e){let n=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${n}$`)}var eRe=new de("summary").description("summary.json coverage across published dataset versions");eRe.command("check").description("Report which (dataset_id, version) pairs have stale or missing summary.json").option("--fix","Dispatch generate-manifest for every stale/missing version").option("--id <id>","Limit to a single dataset_id (exact match)").option("--match <glob>","Limit to dataset_ids matching a glob pattern: `*` matches any run of chars, `?` matches one char. Examples: `on*`, `nm00010?`, `*99999`. Can be combined with --id (id wins if both passed).").option("--only-stale","Print only rows that are not ok (suppresses ok rows)").option("--json","Emit the full report as JSON instead of a table").option(Xe,nt).option(bt,gt).action(async(e)=>{if(!ke())return;let t=D("Building coverage report...").start(),n;try{n=await Eme()}catch(p){At(p,t,"Failed to fetch coverage report");return}t.succeed(`Coverage: target=schema ${n.target_schema}, versions=${n.totals.versions}`);let r=n.versions,o=null;if(e.id){if(r=r.filter((p)=>p.dataset_id===e.id),o=`dataset_id=${e.id}`,r.length===0){console.log(u.yellow(`No rows for ${o}`));return}}else if(e.match){let p=BOt(e.match);if(r=r.filter((m)=>p.test(m.dataset_id)),o=`--match ${e.match}`,r.length===0){console.log(u.yellow(`No rows match ${o}`));return}console.log(u.dim(`Scoped to ${r.length} version(s) matching ${e.match}`))}if(e.json){console.log(JSON.stringify(o?{...n,versions:r,totals:ADe(r)}:n,null,2));return}let s=e.onlyStale?r.filter((p)=>p.state.kind!=="ok"):r;if(s.length===0)console.log(u.green("All versions at target schema \u2014 no drift."));else{let p=Math.max(...s.map((h)=>h.dataset_id.length),10),m=Math.max(...s.map((h)=>h.version.length),7);for(let h of s)console.log(` ${h.dataset_id.padEnd(p)} ${h.version.padEnd(m)} ${LOt(h.state)}`)}let i=o?ADe(r):n.totals;if(console.log(),console.log(` Total: ${i.versions} ${u.green(`ok=${i.ok}`)} ${u.yellow(`stale=${i.stale}`)} ${u.red(`missing=${i.missing}`)} ${u.red(`error=${i.error}`)}`),!e.fix){if(i.stale+i.missing>0)console.log(u.dim(`
|
|
1682
1682
|
Run with --fix to dispatch generate-manifest for the ${i.stale+i.missing} drifted version(s).`));return}let a=r.filter((p)=>qOt(p.state));if(a.length===0){console.log(u.green(`
|
|
1683
|
-
Nothing to dispatch.`));return}let c=o?` (scoped to ${o})`:"",l=await De(`Dispatch generate-manifest for ${a.length} version(s)${c}? Each dispatch queues a runner job on nemarDatasets/.github.`,e);if(l!=="confirmed"){console.log(u.dim(l==="declined"?"Skipped":"Cancelled"));return}let d=0,f=0;console.log();for(let[p,m]of a.entries()){let h=`${m.dataset_id}@${m.version}`,g=D(`[${p+1}/${a.length}] dispatching ${h}...`).start();try{await Sme(m.dataset_id,m.version),g.succeed(`[${p+1}/${a.length}] dispatched ${h}`),d++}catch(y){g.fail(`[${p+1}/${a.length}] ${h}: ${G(y)}`),f++}if(p<a.length-1)await new Promise((y)=>setTimeout(y,jOt))}if(console.log(),console.log(f===0?u.green(`All ${d} dispatches succeeded.`):u.yellow(`${d} succeeded, ${f} failed.`)),console.log(u.dim("Workflow runs will appear on https://github.com/nemarDatasets/.github/actions. Re-run `nemar admin summary check` once they complete to verify drift cleared.")),f>0)process.exitCode=1});function ADe(e){return{versions:e.length,ok:e.filter((t)=>t.state.kind==="ok").length,stale:e.filter((t)=>t.state.kind==="stale").length,missing:e.filter((t)=>t.state.kind==="missing").length,error:e.filter((t)=>t.state.kind==="error").length}}Oe.addCommand(eRe);var tRe=new de("zarr-catalog").description("Top-level Zarr discovery catalog (zarr-catalog.json)");tRe.command("publish").description("Rebuild and republish zarr-catalog.json to this environment's bucket").action(async()=>{if(!ke())return;let e=D("Publishing zarr-catalog.json...").start();try{let t=await $me();e.succeed(`Published zarr-catalog.json: ${t.count} dataset(s), ${t.bytes} bytes`)}catch(t){At(t,e,"Failed to publish zarr catalog"),process.exit(1)}});Oe.addCommand(tRe);var nRe=new de("backfill-names").description("Fill missing researcher names from users' public ORCID records (dry run by default)");nRe.option("--apply","Write the names (without this flag, only report what would change)").option("--limit <n>","Users per batch (server clamps to [1,100])","25").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=Number.parseInt(e.limit??"25",10)||25,n=e.apply===!0,r=D(n?"Backfilling names from ORCID...":"Checking ORCID for missing names...").start(),o;try{o=await Fme({apply:n,limit:t}),r.stop()}catch(s){r.fail("Name backfill failed"),console.error(u.red(G(s))),process.exit(1);return}if(o.lookup_failed>0||(o.write_failed??0)>0||o.remaining===null)process.exitCode=1;if(e.json){console.log(JSON.stringify(o,null,2));return}if(console.log(),!o.apply)console.log(u.yellow("DRY RUN \u2014 nothing was written. Re-run with --apply."));console.log(u.cyan(`scanned=${o.scanned} ${o.apply?"filled":"would_fill"}=${o.apply?o.filled:o.would_fill} no_public_name=${o.no_public_name} lookup_failed=${o.lookup_failed} write_failed=${o.write_failed??0} remaining=${o.remaining??"unknown"}`));for(let s of o.results){let i=s.username??`id ${s.id} <${s.email}>`;if(s.outcome==="filled"||s.outcome==="would_fill"){let a=s.outcome==="filled"?u.green("filled "):u.cyan("would fill");console.log(` ${a} ${i}: ${s.given_name} ${s.family_name} (${s.orcid})`)}else if(s.outcome==="no_public_name")console.log(` ${u.yellow("no name ")} ${i}: ORCID ${s.orcid} does not publish a full name`);else if(s.outcome==="write_failed")console.log(` ${u.red("write ")} ${i}: ${s.error}; retry the batch`);else console.log(` ${u.red("error ")} ${i}: ${s.error}`)}if(o.warning)console.log(u.yellow(` Warning: ${o.warning}`));if(o.no_public_name>0)console.log(),console.log(u.dim("These accounts must make their name public on their ORCID record and sign in again; NEMAR cannot type a name in for an ORCID-linked account, because the record is re-read on every sign-in and would overwrite it. An account with no verified ORCID can set its name in Settings (ADR 0042)."))});Oe.addCommand(nRe);function UOt(e){return typeof e==="object"&&e!==null&&Array.isArray(e.errors)}function HOt(e){return typeof e==="object"&&e!==null&&Array.isArray(e.errors)}var P1=20,rRe=new de("import-issue-triage").description("Close recovered import-failure issues and retire stale cause labels (dry run by default)");rRe.option("--apply","Perform the changes (without this flag, only report what would change)").option("--limit <n>","Issues per batch (server clamps to [1,30])","15").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=e.limit??"15",n=t.trim()===""?Number.NaN:Number(t);if(!Number.isInteger(n)||n<1){console.error(u.red(`Invalid --limit ${JSON.stringify(t)}: expected an integer >= 1.`)),process.exitCode=1;return}let r=e.apply===!0,o=D(r?"Triaging import-failure issues...":"Checking import-failure issues...").start(),s;try{s=await Pme({apply:r,limit:n}),o.stop()}catch(i){o.fail("Import-failure issue triage failed"),console.error(u.red(G(i)));let a=i instanceof L?i.details:void 0,c=UOt(a)?a.errors:[];if(e.json)console.log(JSON.stringify(i instanceof L?i.rawBody??{errors:c}:{errors:c},null,2));else for(let l of c)console.error(`${u.red("ERROR".padEnd(15))} #${l.issue} ${l.dataset_id??""} ${l.stage}: ${l.error}`);process.exitCode=1;return}if(s.errors.length>0)process.exitCode=1;if(e.json){console.log(JSON.stringify(s,null,2));return}if(console.log(),!s.applied)console.log(u.yellow("DRY RUN \u2014 nothing was written. Re-run with --apply."));for(let i of s.plan){let a=i.failed?"FAILED ":s.applied?"":"WOULD ",c=`#${i.issueNumber} ${i.datasetId??"(unknown)"}`;if(i.kind==="close"){let l=`${a}CLOSE`.padEnd(15);console.log(`${i.failed?u.red(l):u.green(l)} ${c} ${u.dim(i.reason)}`)}else if(i.kind==="relabel"){let l=`${a}RELABEL`.padEnd(15);console.log(`${i.failed?u.red(l):u.yellow(l)} ${c} ${u.dim(i.reason)}`)}else console.log(`${u.dim("KEEP".padEnd(15))} ${c} ${u.dim(i.reason)}`)}for(let i of s.rollups){let c=(i.outcome==="failed"?"FAILED RELEASE":i.outcome==="released"?"RELEASE":s.mode==="per-dataset"?"WOULD RELEASE":"ROLLUP").padEnd(15);console.log(`${i.outcome==="failed"?u.red(c):u.magenta(c)} #${i.number} ${u.dim(i.title)}`)}for(let i of s.errors)console.log(`${u.red("ERROR".padEnd(15))} #${i.issue} ${i.dataset_id??""} ${i.stage}: ${i.error}`);if(console.log(),console.log(u.cyan(`open=${s.openIssues} mode=${s.mode} examined=${s.examined} attempted=${s.attempted} ${s.applied?"closed":"would_close"}=${s.closed} ${s.applied?"relabelled":"would_relabel"}=${s.relabelled} kept=${s.kept} errors=${s.errors.length} remaining=${s.remaining}`)),s.remaining>0)console.log(u.dim(` ${s.remaining} candidate(s) outside this run's window; the window rotates daily.`));if(s.mode==="rollup")console.log(u.dim(" Rollup mode: new failures with a cause that already has a rollup join it instead of opening their own issue."));if(s.rollupsReleased>0)console.log(u.dim(` ${s.applied?"Released":"Would release"} ${s.rollupsReleased} rollup(s): the backlog has drained, so per-dataset filing resumes.`));if(s.audit_failed)console.log(u.yellow(` Changes were applied but the audit row failed to write: ${s.audit_failed}`));if(!s.applied&&(s.closed>0||s.relabelled>0||s.rollupsReleased>0))console.log(u.dim(" Re-run with --apply to perform these changes."));if(s.reconcile==null)console.log(),console.log(u.yellow(`reconcile=unknown${s.reconcileError?`: ${s.reconcileError}`:""}`));else{let i=s.reconcile;console.log(),console.log(u.cyan(`reconcile rows_without_issue=${i.rowsWithoutIssue.length} issues_without_row=${i.issuesWithoutRow.length} parked=${i.parked} quarantined=${i.quarantined} rows_examined=${i.rowsExamined} issues_examined=${i.issuesExamined}`));for(let l of i.rowsWithoutIssue.slice(0,P1))console.log(`${u.yellow("UNTRACKED".padEnd(15))} ${l.datasetId} (${l.sourceId}) ${l.status} at ${l.stage} ${u.dim(l.cause)}`);let a=i.rowsWithoutIssue.length-P1;if(a>0)console.log(u.dim(` ... and ${a} more untracked`));for(let l of i.issuesWithoutRow.slice(0,P1))console.log(`${u.yellow("NO IMPORT ROW".padEnd(15))} #${l.number} ${l.datasetId}`);let c=i.issuesWithoutRow.length-P1;if(c>0)console.log(u.dim(` ... and ${c} more`));if(console.log(u.dim(` ${i.reason}`)),i.rowsWithoutIssue.length>0||i.issuesWithoutRow.length>0)console.log(u.dim(" Reported only: this command files and closes nothing for these."))}});Oe.addCommand(rRe);var oRe=new de("import-coverage").description("Check whether the import pipeline is keeping up with OpenNeuro (dry run by default)"),I1=20,ODe=5,VOt={created:"create",refreshed:"refresh",relabelled:"relabel",closed:"close"};oRe.option("--apply","File, update or close the tracking issue (production only)").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=e.apply===!0,n=D("Checking import coverage...").start(),r;try{r=await Ime({apply:t}),n.stop()}catch(c){n.fail("Import coverage check failed"),console.error(u.red(G(c)));let l=c instanceof L?c.details:void 0,d=HOt(l)?l.errors:[];if(e.json)console.log(JSON.stringify(c instanceof L?c.rawBody??{errors:d}:{errors:d},null,2));else for(let f of d)console.error(`${u.red("ERROR".padEnd(12))} ${f.stage}: ${f.error}`);process.exitCode=c instanceof L&&c.statusCode===502?2:1;return}if(r.status==="unknown")process.exitCode=2;else if(r.status!=="healthy"||r.errors.length>0)process.exitCode=1;if(process.exitCode!==0)ce();if(e.json){console.log(JSON.stringify(r,null,2));return}let o=r.backlog,s=o.neverAttempted.length+o.untracked.length;console.log();let i=`${r.status.toUpperCase()}${r.kind?` (${r.kind})`:""}`;console.log(r.status==="healthy"?u.green(i):u.red(u.bold(i))),console.log(r.reason),console.log(),console.log(u.cyan(`auto_import=${r.enabled?"enabled":u.red("DISABLED")} last_dispatch=${r.dispatchAgeHours===null?"never":r.dispatchAgeHours<0?"dated in the future":`${r.dispatchAgeHours}h ago`}${r.lastDispatchSourceId?` (${r.lastDispatchSourceId})`:""} dispatch_lost=${r.dispatchLost}`));let a=r.importedInScan+r.inFlight+r.terminal+s+o.tracked.length+o.blocklisted.length;if(console.log(u.cyan(`discovered=${r.discovered} in_scan=${r.importedInScan} in_flight=${r.inFlight} terminal=${r.terminal} tracked=${o.tracked.length} blocklisted=${o.blocklisted.length}`)),console.log(u.cyan(`outstanding=${s} (never_attempted=${o.neverAttempted.length} untracked=${o.untracked.length})`)),r.importedNotInScan>0)console.log(u.dim(` ${r.importedNotInScan} of ${r.imported} mirror(s) are no longer in the scan (upstream removal, unreadable snapshot, or a modality retag). Drift, not a gap.`));if(a!==r.discovered)console.log(u.yellow(` Counts do not balance (${a} accounted for vs ${r.discovered} discovered): this run did not get a complete view, so treat the verdict as unreliable.`));if(o.neverAttempted.length>0){let c=o.neverAttempted.slice(0,I1).join(", "),l=o.neverAttempted.length-I1;console.log(u.dim(` never attempted: ${c}${l>0?` ... and ${l} more`:""}`))}if(o.untracked.length>0){let c=o.untracked.slice(0,I1).join(", "),l=o.untracked.length-I1;console.log(u.dim(` stale row nothing owns: ${c}${l>0?` ... and ${l} more`:""}`))}for(let c of r.errors){let l=`${c.stage}: ${c.error}`;console.log(c.stage==="anomaly"?`${u.yellow("ANOMALY".padEnd(12))} ${l}`:`${u.red("ERROR".padEnd(12))} ${l}`)}if(r.issue){let c=r.applied?r.issue.action:`would ${VOt[r.issue.action]??r.issue.action}`,l=r.issue.number===null?"":` #${r.issue.number}`;if(console.log(u.dim(` Issue: ${c}${l} on nemarDatasets/.github`)),r.issue.labelError)console.log(u.yellow(` The body was updated but its labels were not: ${r.issue.labelError}`));if(r.issue.commentError)console.log(u.yellow(` The issue changed but its comment failed: ${r.issue.commentError}`))}if(r.audit_failed)console.log(u.yellow(` Changes applied but the audit row failed to write: ${r.audit_failed}`));if(!r.applied&&r.issue)console.log(u.dim(" Re-run with --apply to perform this change."))});Oe.addCommand(oRe);var sRe=new de("import-weekly").description("Read this week's import summary (dry run by default; the cron posts it on Mondays)");function zOt(e){return JT(e).attention}function un(e){return e==null?u.yellow("unknown"):String(e)}sRe.option("--apply","Actually file the issue (production only; the cron normally does this)").option("--json","Output raw JSON instead of the human summary").option("--body","Also print the issue body exactly as it would be posted").action(async(e)=>{if(!ke())return;let t=e.apply===!0,n=D("Building the weekly import summary...").start(),r;try{r=await Nme({apply:t}),n.stop()}catch(a){n.fail("Weekly import summary failed"),console.error(u.red(G(a))),process.exitCode=1;return}let o=r.facts;if(o===null)process.exitCode=0;else if(o.errors.length>0)process.exitCode=2;else if(zOt(o))process.exitCode=1;if(process.exitCode!==0)ce();if(e.json){console.log(JSON.stringify(r,null,2));return}if(o===null){console.log(),console.log(u.yellow(`Nothing computed: ${r.gateReason}`)),console.log(u.dim(" The report is built once a week; --apply files it."));return}console.log(),console.log(u.bold(`Import summary ${o.week}`)),console.log(u.dim(`${o.windowStart} to ${o.windowEnd} (UTC)`)),console.log(),console.log(u.cyan(`imported_this_week=${un(o.importedThisWeek)} total=${un(o.importedTotal)} in_scope=${un(o.discovered)} not_in_scope=${un(o.importedNotInScan)}`));let s=o.coverageStatus===null?u.yellow("unknown"):o.coverageStatus==="healthy"?u.green(o.coverageStatus):u.red(o.coverageStatus);if(console.log(u.cyan(`coverage=${s} outstanding=${un(o.outstanding)}`)),console.log(u.cyan(`auto_import=${o.autoImportEnabled===null?u.yellow("unknown"):o.autoImportEnabled?"enabled":u.red("DISABLED")} last_dispatch=${o.dispatchPhrase??u.yellow("unknown")} dispatch_lost=${o.dispatchLost===null?u.yellow("unknown"):o.dispatchLost}`)),console.log(u.cyan(`open_failures=${un(o.openFailureTotal)} parked=${o.parked===null?u.yellow("unknown"):o.parked.length} closed_this_week=${un(o.issuesClosed)} relabelled=${un(o.issuesRelabelled)}`)),o.upstream==null)console.log(u.cyan(`upstream=${u.yellow("unknown")}`));else{let a=o.upstream.counts.states,c=o.upstream.truncated?` ${u.yellow("(did not reach every mirror)")}`:"",l=`upstream: stale=${un(o.upstream.counts.stale)} current=${un(a.current)} anomaly=${un(a.anomaly)} unknown=${un(a.unknown)} unchecked=${un(a.unchecked)}`;console.log(u.cyan(`${l}${c}`))}if(o.repulls==null)console.log(u.cyan(`repulls=${u.yellow("unknown")}`));else{let a=o.repulls,c=a.switches,l=c.auto_repull_merge_enabled?"open+merge":c.auto_repull_enabled?"open":"off";console.log(u.cyan(`repulls: switches=${l} dispatched=${un(a.dispatches.sent)} opened=${un(a.dispatches.by_status.opened)} refused=${un(a.dispatches.by_status.refused)} failed=${un(a.dispatches.by_status.failed)} unreported=${un(a.dispatches.by_status.unreported)} not_accepted=${un(a.dispatches.by_status.dispatch_failed)}`)),console.log(u.cyan(`repulls: open=${un(a.open_automatic.total)} held=${un(a.open_automatic.held)} claims_held=${un(a.held_claims)} ended_failed=${un(a.ended_failed)} merged_worker=${un(a.merged.worker)} merged_admin=${un(a.merged.administrator)} merged_outside=${un(a.merged.outside_tool)} merged_unattributed=${un(a.merged.unattributed)}`))}if(o.failuresByCause!==null){let a=Object.entries(o.failuresByCause).filter(([,c])=>c>0);for(let[c,l]of a)console.log(u.dim(` ${c}: ${l}`))}if(o.parked!==null&&o.parked.length>0){for(let c of o.parked.slice(0,ODe))console.log(u.dim(` parked ${c.datasetId} (${c.reason??"unknown"}): ${c.parkedDays==null?"unknown":`${c.parkedDays} days`}`));let a=o.parked.length-ODe;if(a>0)console.log(u.dim(` ... and ${a} more parked`))}for(let a of o.errors)console.log(`${u.yellow("UNKNOWN".padEnd(10))} ${a.stage}: ${a.error}`);let i=JT(o);if(i.attention)console.log(u.yellow(`Needs attention: ${i.problems.join("; ")}.`));if(console.log(),!r.posted&&!t)console.log(u.dim("Dry run: nothing was filed.")),console.log(u.dim(" Re-run with --apply to file it (production only)."));else if(!r.posted)console.log(u.yellow(`Not posted: ${r.gateReason}`));else console.log(u.green(`Posted${r.issue?.number?` #${r.issue.number}`:""}${r.closedPrevious?`, closed #${r.closedPrevious}`:""}`));if(e.body)console.log(),console.log(u.dim("--- rendered issue body ---")),console.log(r.renderedBody??u.yellow("(no body was rendered)"))});Oe.addCommand(sRe);var iRe=new de("backfill-usernames").description("Give username-less accounts a username from their name (dry run by default)");iRe.option("--apply","Write the usernames and send verification messages").option("--limit <n>","Users per batch (server clamps to [1,100])","25").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=Number.parseInt(e.limit??"25",10)||25,n=e.apply===!0,r=D(n?"Assigning usernames...":"Checking which accounts need a username...").start(),o;try{o=await Mme({apply:n,limit:t}),r.stop()}catch(s){r.fail("Username backfill failed"),console.error(u.red(G(s))),process.exit(1);return}if(o.lookup_failed>0||o.conflict>0||(o.exhausted??0)>0||(o.write_failed??0)>0||(o.verify_failed??0)>0||(o.verify_rate_limited??0)>0||o.remaining===null)process.exitCode=1;if(e.json){console.log(JSON.stringify(o,null,2));return}if(console.log(),!o.apply)console.log(u.yellow("DRY RUN \u2014 nothing was written. Re-run with --apply."));console.log(u.cyan(`scanned=${o.scanned} ${o.apply?"assigned":"would_assign"}=${o.apply?o.assigned:o.would_assign} single_name=${o.single_name} no_name=${o.no_name} lookup_failed=${o.lookup_failed} conflict=${o.conflict} exhausted=${o.exhausted??0} write_failed=${o.write_failed??0} verify_sent=${o.verify_sent} verify_failed=${o.verify_failed??0} verify_rate_limited=${o.verify_rate_limited??0} remaining=${o.remaining??"unknown"}`));for(let s of o.results){let i=`id ${s.id} <${s.email}>`,a=[s.given_name,s.family_name].filter(Boolean).join(" ");if(s.outcome==="assigned"||s.outcome==="would_assign"){let c=s.outcome==="assigned"?u.green("assigned "):u.cyan("would give"),l=s.outcome==="assigned"?` [verify: ${s.verify}]`:"";console.log(` ${c} ${i}: ${u.cyan(s.username??"?")} (${a})${l}`)}else if(s.outcome==="single_name")console.log(` ${u.yellow("one name ")} ${i}: only "${a}" on record; pick a username by hand`);else if(s.outcome==="no_name")console.log(` ${u.yellow("no name ")} ${i}: run 'nemar admin backfill-names --apply' first`);else if(s.outcome==="conflict")console.log(` ${u.yellow("conflict ")} ${i}: ${s.error}`);else if(s.outcome==="exhausted")console.log(` ${u.yellow("exhausted ")} ${i}: ${s.error}; pick a username by hand`);else if(s.outcome==="write_failed")console.log(` ${u.red("write ")} ${i}: ${s.error}; retry the batch`);else console.log(` ${u.red("error ")} ${i}: ${s.error}`)}for(let s of o.verify_retries??[]){let i=s.verify==="sent"?u.green("re-sent "):s.verify==="not_attempted"?u.cyan("would send"):u.yellow(`verify ${s.verify}`);console.log(` ${i} id ${s.id} <${s.email}>`)}if(o.warning)console.log(u.yellow(` Warning: ${o.warning}`));if(o.single_name>0||o.no_name>0)console.log(),console.log(u.dim("Accounts with one name or none are listed, never guessed at: a username derived from an email address is a handle the person never chose."))});Oe.addCommand(iRe);var aRe=new de("duplicates").description("Report live accounts sharing an ORCID iD, email, or GitHub handle");function GOt(e){let t=e.username??u.dim("(no username)"),n=[];if(e.canonical)n.push(u.green("canonical"));if(e.identity_conflict===1)n.push(u.yellow("flagged"));if(e.has_oauth_identity)n.push(u.dim("orcid-login"));let r=n.length>0?` [${n.join(", ")}]`:"",o=`created ${e.created_at} datasets=${e.dataset_count}`;console.log(` id ${String(e.id).padEnd(5)} ${t} <${e.email}> ${o}${r}`)}aRe.option("--json","Output raw JSON instead of the human report").option("--clear <id>","Clear one account's identity-conflict flag (refuses while the collision remains)").action(async(e)=>{if(!ke())return;if(e.clear!==void 0){let r=Number.parseInt(e.clear,10);if(!Number.isInteger(r)||r<=0){console.error(u.red(`Invalid user id: ${e.clear}`)),process.exit(1);return}let o=D(`Clearing identity-conflict flag on user ${r}...`).start();try{let s=await Lme(r);if(o.stop(),e.json){console.log(JSON.stringify(s,null,2));return}console.log(s.cleared?u.green(`Cleared the identity-conflict flag on user ${r}.`):u.dim(`User ${r} was not flagged; nothing to clear.`))}catch(s){o.fail(s instanceof L&&s.statusCode===409?"Still colliding; flag not cleared":"Failed to clear the identity-conflict flag"),console.error(u.red(G(s))),process.exit(1)}return}let t=D("Checking for duplicate accounts...").start(),n;try{n=await jme(),t.stop()}catch(r){t.fail("Duplicate report failed"),console.error(u.red(G(r))),process.exit(1);return}if(e.json){console.log(JSON.stringify(n,null,2));return}if(console.log(),n.groups.length===0){if(console.log(u.green("No duplicate accounts.")),n.flagged_count>0)console.log(u.yellow(`${n.flagged_count} account(s) still carry an identity-conflict flag with no remaining collision.`)),console.log(u.dim(" Clear each with 'nemar admin duplicates --clear <id>'."));return}console.log(u.cyan(`${n.group_count} duplicate group(s); ${n.flagged_count} account(s) flagged`));for(let r of n.groups){console.log(),console.log(` ${u.bold(r.kind)} ${r.value}`);for(let o of r.accounts)GOt(o)}console.log(),console.log(u.dim("The fix is self-service on the surviving account: change its email or GitHub username, or unlink/re-link its ORCID iD, in Settings on nemar.org. Merging two accounts is manual.")),process.exitCode=1});Oe.addCommand(aRe);var B1=new de("neurobagel").description("Neurobagel federation artifacts: regenerate and inspect the private store (epic #1586)"),oa=(e)=>e===null?u.yellow("unknown"):String(e),GL=(e)=>e==="healthy"?u.green(e):e==="alarm"?u.red(e):e==="unknown"?u.yellow(e):u.dim(e);function cRe(e){console.log(`${u.bold("Verification")} ${GL(e.overall)} ${e.at} (${e.trigger})${e.failed?u.red(` the sweep itself failed: ${e.error??"no reason recorded"}`):""}`);for(let t of ZZ){let n=e.checks[t];console.log(` ${t.padEnd(13)}${GL(n.verdict)} ${n.reason}`)}for(let t of e.warnings)console.log(u.yellow(` warning: ${t}`))}function WOt(e){if(console.log(),e.dry_run)console.log(u.yellow("DRY RUN: nothing was written. Re-run with --execute to write."));if(e.status!=="ok"){let t=e.status==="disabled"?"the writer is disabled (NEUROBAGEL_WRITER_ENABLED is not 1)":e.status==="store_unconfigured"?"no NEUROBAGEL bucket is bound":e.error??"the run failed";console.log(u.red(`status=${e.status}: ${t}`))}console.log(u.cyan(`eligible=${oa(e.eligible)} examined=${e.examined} limit=${e.limit} unexamined=${e.unexamined} removed=${e.removed.length} removals_pending=${e.removals_pending} index_entries=${oa(e.index.entries)} index_written=${e.index.written} index_patched=${e.index.patched??0} anonymity_findings=${e.anonymity_findings} ops=${e.ops.spent}/${e.ops.budget}`));for(let t of e.results)switch(t.outcome){case"written":console.log(` ${u.green("written ")} ${t.id}${t.flags.length>0?` needs review: ${t.flags.join(", ")}`:""}`);break;case"would_write":console.log(` ${u.cyan("would write")} ${t.id} (${t.reason})`);break;case"unchanged":console.log(` ${u.dim("unchanged ")} ${t.id}`);break;case"would_remove":console.log(` ${u.cyan("would remove")} ${t.id}`);break;case"removed":console.log(` ${u.green("removed ")} ${t.id}`);break;case"refused":console.log(` ${u.red("refused ")} ${t.id} ${t.code}${t.detail?`: ${t.detail}`:""}`);break;case"error":console.log(` ${u.red("error ")} ${t.id} ${t.error}`);break}if(e.stopped==="ops_budget")console.log(u.yellow(` the run spent its operation budget (${e.ops.spent} of ${e.ops.budget}, ${e.ops.reserved} of it held back to finish) with ${e.unexamined} dataset(s) not yet examined: run the same command again to continue`));else if(e.unexamined>0&&e.stopped===null)console.log(u.yellow(` ${e.unexamined} dataset(s) are still waiting beyond this call's limit: run the same command again to continue`));if(e.index.contended)console.log(u.red(" the index was replaced by another run during this one; re-run to settle it"));for(let t of e.index.problems??[])console.log(u.red(` index not written: ${t}`));for(let t of e.warnings)console.log(u.yellow(` warning: ${t}`));if(e.anonymity_findings>0)console.log(u.red(` ${e.anonymity_findings} dataset(s) were refused because their data says anonymous. They are in the audit log (neurobagel_anonymity_finding); nothing was filed or mailed.`))}B1.command("regenerate").description("Examine datasets and write what changed to the Neurobagel artifact store (dry run unless --execute)").option("--execute","Write to the store (without it, only report what would change)").option("--dataset <ids...>","Examine exactly these dataset ids instead of the next ones due").option("--limit <n>",`Datasets to examine (default: the server's per-tick bound, at most ${Ek}); run again to continue`).option("--force","Rewrite even when the fingerprint matches").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=e.limit===void 0?void 0:/^[1-9][0-9]*$/.test(e.limit)?Number(e.limit):Number.NaN;if(t!==void 0&&!Number.isInteger(t)){console.error(u.red("--limit must be a positive whole number")),process.exit(1);return}if(t!==void 0&&t>Ek){console.error(u.red(`--limit is at most ${Ek} per call (each call runs inside one request); run the command again to continue`)),process.exit(1);return}let n=e.execute===!0,r=D(n?"Regenerating Neurobagel artifacts...":"Checking what would change...").start(),o;try{o=await Dme({...n?{execute:!0}:{},...e.dataset&&e.dataset.length>0?{datasets:e.dataset}:{},...t!==void 0?{limit:t}:{},...e.force?{force:!0}:{}}),r.stop()}catch(i){At(i,r,"Neurobagel regenerate failed",{409:"Set NEUROBAGEL_WRITER_ENABLED=1 (and bind the bucket) to write. A dry run needs neither the switch nor --execute."}),process.exit(1);return}if(e.json)console.log(JSON.stringify(o,null,2));else WOt(o);let s=o.results.some((i)=>i.outcome==="error");if(o.status!=="ok"||s||o.index.contended||o.stopped==="index_patch"||(o.index.problems?.length??0)>0||o.anonymity_findings>0)process.exitCode=1});B1.command("status").description("What is eligible, written, stale and waiting on a person in the Neurobagel store, and the latest verification (exit 0 healthy, 1 alarm, 2 unknown)").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=D("Reading the Neurobagel store...").start(),n;try{n=await Rme(),t.stop()}catch(l){At(l,t,"Neurobagel status failed"),process.exit(1);return}if(e.json){console.log(JSON.stringify(n,null,2));return}let r=n.writer.mode==="enabled"?u.green("enabled"):n.writer.mode==="disabled"?u.yellow("disabled (NEUROBAGEL_WRITER_ENABLED is not 1)"):u.red("store_unconfigured (no NEUROBAGEL bucket is bound)");console.log(),console.log(`${u.bold("Writer")} ${r}`),console.log(`${u.bold("Read route")} ${n.read_route.token_configured?u.green("token configured"):u.yellow("no NEUROBAGEL_READ_TOKEN: the route answers 404")}`),console.log(`${u.bold("Per tick")} ${n.limits.reconcile_max} datasets (hard limit ${n.limits.hard_max})`),console.log();let o=n.counts;console.log(`${u.bold("Datasets")} eligible=${oa(o.eligible)} written=${oa(o.written)} missing=${oa(o.missing)} stale=${oa(o.stale)} incomplete=${oa(o.incomplete)} waiting to be removed=${oa(o.residue)}`),console.log(`${u.bold("Store")} objects=${oa(n.store.objects)} bytes=${oa(n.store.total_bytes)}${n.store.over_loader_cap?u.red(" OVER the loader's total cap"):""}${(n.store.unexpected_objects??0)>0?u.yellow(` ${n.store.unexpected_objects} object(s) that are not the writer's`):""}`);let s=n.index.matches_store===null?u.yellow("unknown"):n.index.matches_store?u.green("matches the store"):u.yellow("differs from what the store and eligibility imply (the next run settles it)");console.log(`${u.bold("Index")} ${n.index.present===null?u.yellow("unknown"):n.index.present?`${oa(n.index.entries)} entries, generated ${n.index.generated_at??"?"}`:u.dim("not written yet")} ${s}`);let i=n.last_reconcile;console.log(`${u.bold("Last reconcile")} ${i?`${i.at} (${JSON.stringify(i.summary)})`:u.dim("none recorded")}`),console.log(`${u.bold("Anonymity")} ${n.anonymity_findings===null?u.yellow("unknown"):n.anonymity_findings===0?"no findings":u.red(`${n.anonymity_findings} finding(s): see the audit log (neurobagel_anonymity_finding); ids are not shown here`)}`);let a=eee({verification:n.verification,writerMode:n.writer.mode,now:new Date});if(n.verification)cRe(n.verification);if(a.note)console.log(`${u.bold("Verification")} ${GL(a.verdict)} ${a.note}`);else if(!n.verification)console.log(`${u.bold("Verification")} ${u.dim("none recorded; the writer is off, so none is expected")}`);if(n.needs_review.length>0){console.log(),console.log(u.bold(`Needs review (${n.needs_review.length})`));for(let l of n.needs_review)console.log(` ${l.id} ${l.source==="refusal"?u.red(`refused: ${l.code}${l.since?` (last confirmed ${l.since})`:""}`):u.yellow((l.flags??[]).join(", "))}`)}for(let l of n.warnings)console.log(u.yellow(`warning: ${l}`));let c=n.writer.mode==="store_unconfigured"||(n.anonymity_findings??0)>0||n.counts.eligible===null||a.verdict==="alarm";process.exitCode=c?1:KT(a.verdict)}).addHelpText("after","\nExit codes: 0 healthy or nothing to check, 1 an alarm, 2 could not be determined (no verification recorded while the writer is on, a record over 36 hours old, or an unknown verdict). The same as `verify`.");B1.command("verify").description("Run the verification sweep now: the store against eligibility, the node, registration and upstream drift (reports only; exit 0 healthy, 1 alarm, 2 unknown)").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=D("Verifying the Neurobagel federation...").start(),n;try{n=await Cme(),t.stop()}catch(r){At(r,t,"Neurobagel verify failed"),process.exit(1);return}if(e.json)console.log(JSON.stringify(n,null,2));else if(console.log(),cRe(n),!n.heartbeat_written)console.log(u.yellow("The heartbeat could not be written: this run is not recorded."));process.exitCode=KT(n.overall)}).addHelpText("after","\nExit codes: 0 healthy or nothing to check, 1 an alarm, 2 could not be determined. The same as `status`.");Oe.addCommand(B1);Oe.addCommand(ra);Oe.addCommand(Ul);Oe.addCommand(N0e);He();Qs();uo();uh();fh();ah();He();uh();fh();var KOt=Ln["cli.gaps.section.title"];function lRe(e){if(e.gaps===void 0)return[e.unknownReason??Ln["cli.gaps.unknown"]];let t=yk(e.gaps,{orcidVerified:e.orcidVerified}).map(BZ);if(e.sandboxCompleted===!1)t.push(bk());return t.length>0?t:[Ln["gaps.none"]]}function JOt(e){let t=lRe(e);return t.length===1&&t[0]===Ln["gaps.none"]}function H_(e){let t=e.gaps===void 0||JOt(e);console.log(),console.log(u.bold(KOt));for(let n of lRe(e))console.log(` ${t?u.dim(n):u.yellow(n)}`)}function U1(e,t,n={}){let r=n.indent??" ";console.log(),console.log(`${r}${e}`);for(let o of t)console.log(`${r} ${u.yellow(o.label)} ${VT(o)}`)}ze();bp();xr();fn();He();hk();import{hostname as YOt}from"os";ze();fn();function XOt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"").replace(/\s+/g," ").trim();return t?t.slice(0,OZ):BT}function QOt(){try{return XOt(YOt())}catch{return BT}}function ZOt(e,t,n=qT){return e+(t+n)*1000}function fRe(e){switch(e.kind){case"cancelled":return{lines:["Sign-in canceled. Run `nemar auth login` to try again."],exitCode:130};case"denied":case"expired":case"invalid":return{lines:[e.message],exitCode:1};case"unreachable":return{lines:[`NEMAR could not be reached: ${e.detail}`,"Run `nemar auth login` again once you're back online."],exitCode:1};case"server_error":return{lines:[`NEMAR keeps answering with an error (${e.detail}). Try again in a few minutes; if it keeps happening, run \`nemar auth login --debug\` and report the log.`],exitCode:1};case"start_failed":return{lines:[`Could not start sign-in: ${e.detail}`],exitCode:1}}}var eTt=15000,uRe=1000,tTt=5000,dRe=3;function nTt(e){if(e instanceof L&&e.statusCode!==0)return`HTTP ${e.statusCode}`;return G(e)}function rTt(e){if(typeof AbortSignal.any==="function")return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted){t.abort();break}n.addEventListener("abort",()=>t.abort(),{once:!0})}return t.signal}function oTt(e,t){return new Promise((n)=>{if(t.aborted){n();return}let r=setTimeout(()=>{t.removeEventListener("abort",o),n()},e);function o(){clearTimeout(r),n()}t.addEventListener("abort",o,{once:!0})})}async function sTt(e,t={}){let n=Date.now(),r=ZOt(n,e.expires_in,t.graceSeconds??qT),o=Math.max(e.interval*1000,uRe),s=new AbortController,i=()=>s.abort();process.on("SIGINT",i);let a=0;try{while(!0){if(s.signal.aborted)return{kind:"cancelled"};if(Date.now()>=r)return{kind:"unreachable",detail:"gave up waiting to reach NEMAR"};if(await oTt(o,s.signal),s.signal.aborted)return{kind:"cancelled"};let c=rTt([s.signal,AbortSignal.timeout(eTt)]),l;try{l=await qhe(e.device_code,c),a=0}catch(d){if(s.signal.aborted)return{kind:"cancelled"};if(d instanceof L&&d.statusCode===0){console.log(u.dim(" NEMAR is unreachable; retrying...")),a=0;continue}let f=nTt(d);if(a+=1,$n(`poll error ${a}/${dRe}: ${f} -- ${G(d)}`),console.log(u.dim(` NEMAR answered with an error (${f}); retrying...`)),a>=dRe)return{kind:"server_error",detail:f};continue}if(l.status==="pending")continue;if(l.status==="slow_down"){o=Math.max(o+tTt,e.interval*1000,uRe);continue}if(l.status==="success")return{...l.data,kind:"success"};if(l.error==="expired_token")return{kind:"expired",message:l.message};if(l.error==="access_denied")return{kind:"denied",message:l.message};return{kind:"invalid",message:l.message}}}finally{process.off("SIGINT",i)}}async function e3(e={}){let t;try{t=await Lhe(QOt())}catch(n){return{kind:"start_failed",detail:G(n)}}if(console.log(` ${t.verification_uri_complete}`),console.log(` Code: ${u.cyan(t.user_code)}`),console.log(u.dim(" (if the page asks for it)")),console.log(),e.open!==!1&&Rg(t.verification_uri_complete))console.log(u.dim(" (trying to open your browser; use the link above if it doesn't)")),console.log();return sTt(t)}yo();var pRe="NEMAR_DATA_HOSTS",iTt="NEMAR_DATA_HOSTS_ONLY",aTt="https://private.nemar.org",cTt="https://private-test.nemar.org",lTt=/^[a-z]{2,3}[0-9]{6}$/;function H1(e){return lTt.test(e)}function uTt(e){return e}function mRe(e){return e==="127.0.0.1"||e==="localhost"||e==="[::1]"}function hRe(e){let t=e.trim();if(t===""||/[?#@]/.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(n.username!==""||n.password!=="")return null;if(n.pathname!=="/")return null;if(n.protocol==="https:")return n.origin;if(n.protocol==="http:"&&mRe(n.hostname))return n.origin;return null}function gRe(e){let t=[],n=[];for(let r of(e??"").split(",")){let o=r.trim();if(o==="")continue;let s=hRe(o);if(s===null)n.push(o);else if(!t.includes(s))t.push(s)}return{origins:t,rejected:n}}function yRe(e){return e.env??process.env}function V1(e={}){let t=yRe(e),n=e.isDevBuild??Vf,r=t[iTt]==="1"?[]:[n?cTt:aTt],{origins:o}=gRe(t[pRe]);return[...r,...o.filter((s)=>!r.includes(s))].map(uTt)}function bRe(e={}){return gRe(yRe(e)[pRe]).rejected}function z1(e,t={}){let n=hRe(e);if(n===null)return null;return V1(t).find((r)=>r===n)??null}function G1(e,t={}){return z1(e,t)!==null}function wRe(e,t={}){let n;try{n=new URL(e)}catch{return null}if(n.username!==""||n.password!=="")return null;return z1(n.origin,t)}function xmn(e,t){if(e.protocol==="https:")return!0;return e.protocol==="http:"&&mRe(e.hostname)&&new URL(t).protocol==="http:"}var dTt="NEMAR_DATA_HOST_TIMEOUT_MS";function _Re(e,t=process.env){let n=t[dTt];if(n===void 0||!/^[0-9]+$/.test(n))return e;let r=Number(n);return r>0&&r<e?r:e}function xRe(e){if(!(e instanceof Error))return"error";let t=e.code;return typeof t==="string"&&/^[A-Z][A-Z0-9_]+$/.test(t)?`${e.name} ${t}`:e.name}var fTt="nemar";function vRe(e){let t={};for(let n of e.split(`
|
|
1684
|
-
`)){let r=n.replace(/\r$/,"");if(r==="")break;let o=r.indexOf("=");if(o<=0)continue;t[r.slice(0,o)]=r.slice(o+1)}return t}function
|
|
1683
|
+
Nothing to dispatch.`));return}let c=o?` (scoped to ${o})`:"",l=await De(`Dispatch generate-manifest for ${a.length} version(s)${c}? Each dispatch queues a runner job on nemarDatasets/.github.`,e);if(l!=="confirmed"){console.log(u.dim(l==="declined"?"Skipped":"Cancelled"));return}let d=0,f=0;console.log();for(let[p,m]of a.entries()){let h=`${m.dataset_id}@${m.version}`,g=D(`[${p+1}/${a.length}] dispatching ${h}...`).start();try{await Sme(m.dataset_id,m.version),g.succeed(`[${p+1}/${a.length}] dispatched ${h}`),d++}catch(y){g.fail(`[${p+1}/${a.length}] ${h}: ${G(y)}`),f++}if(p<a.length-1)await new Promise((y)=>setTimeout(y,jOt))}if(console.log(),console.log(f===0?u.green(`All ${d} dispatches succeeded.`):u.yellow(`${d} succeeded, ${f} failed.`)),console.log(u.dim("Workflow runs will appear on https://github.com/nemarDatasets/.github/actions. Re-run `nemar admin summary check` once they complete to verify drift cleared.")),f>0)process.exitCode=1});function ADe(e){return{versions:e.length,ok:e.filter((t)=>t.state.kind==="ok").length,stale:e.filter((t)=>t.state.kind==="stale").length,missing:e.filter((t)=>t.state.kind==="missing").length,error:e.filter((t)=>t.state.kind==="error").length}}Oe.addCommand(eRe);var tRe=new de("zarr-catalog").description("Top-level Zarr discovery catalog (zarr-catalog.json)");tRe.command("publish").description("Rebuild and republish zarr-catalog.json to this environment's bucket").action(async()=>{if(!ke())return;let e=D("Publishing zarr-catalog.json...").start();try{let t=await $me();e.succeed(`Published zarr-catalog.json: ${t.count} dataset(s), ${t.bytes} bytes`)}catch(t){At(t,e,"Failed to publish zarr catalog"),process.exit(1)}});Oe.addCommand(tRe);var nRe=new de("backfill-names").description("Fill missing researcher names from users' public ORCID records (dry run by default)");nRe.option("--apply","Write the names (without this flag, only report what would change)").option("--limit <n>","Users per batch (server clamps to [1,100])","25").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=Number.parseInt(e.limit??"25",10)||25,n=e.apply===!0,r=D(n?"Backfilling names from ORCID...":"Checking ORCID for missing names...").start(),o;try{o=await Fme({apply:n,limit:t}),r.stop()}catch(s){r.fail("Name backfill failed"),console.error(u.red(G(s))),process.exit(1);return}if(o.lookup_failed>0||(o.write_failed??0)>0||o.remaining===null)process.exitCode=1;if(e.json){console.log(JSON.stringify(o,null,2));return}if(console.log(),!o.apply)console.log(u.yellow("DRY RUN \u2014 nothing was written. Re-run with --apply."));console.log(u.cyan(`scanned=${o.scanned} ${o.apply?"filled":"would_fill"}=${o.apply?o.filled:o.would_fill} no_public_name=${o.no_public_name} lookup_failed=${o.lookup_failed} write_failed=${o.write_failed??0} remaining=${o.remaining??"unknown"}`));for(let s of o.results){let i=s.username??`id ${s.id} <${s.email}>`;if(s.outcome==="filled"||s.outcome==="would_fill"){let a=s.outcome==="filled"?u.green("filled "):u.cyan("would fill");console.log(` ${a} ${i}: ${s.given_name} ${s.family_name} (${s.orcid})`)}else if(s.outcome==="no_public_name")console.log(` ${u.yellow("no name ")} ${i}: ORCID ${s.orcid} does not publish a full name`);else if(s.outcome==="write_failed")console.log(` ${u.red("write ")} ${i}: ${s.error}; retry the batch`);else console.log(` ${u.red("error ")} ${i}: ${s.error}`)}if(o.warning)console.log(u.yellow(` Warning: ${o.warning}`));if(o.no_public_name>0)console.log(),console.log(u.dim("These accounts must make their name public on their ORCID record and sign in again; NEMAR cannot type a name in for an ORCID-linked account, because the record is re-read on every sign-in and would overwrite it. An account with no verified ORCID can set its name in Settings (ADR 0042)."))});Oe.addCommand(nRe);function UOt(e){return typeof e==="object"&&e!==null&&Array.isArray(e.errors)}function HOt(e){return typeof e==="object"&&e!==null&&Array.isArray(e.errors)}var P1=20,rRe=new de("import-issue-triage").description("Close recovered import-failure issues and retire stale cause labels (dry run by default)");rRe.option("--apply","Perform the changes (without this flag, only report what would change)").option("--limit <n>","Issues per batch (server clamps to [1,30])","15").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=e.limit??"15",n=t.trim()===""?Number.NaN:Number(t);if(!Number.isInteger(n)||n<1){console.error(u.red(`Invalid --limit ${JSON.stringify(t)}: expected an integer >= 1.`)),process.exitCode=1;return}let r=e.apply===!0,o=D(r?"Triaging import-failure issues...":"Checking import-failure issues...").start(),s;try{s=await Pme({apply:r,limit:n}),o.stop()}catch(i){o.fail("Import-failure issue triage failed"),console.error(u.red(G(i)));let a=i instanceof L?i.details:void 0,c=UOt(a)?a.errors:[];if(e.json)console.log(JSON.stringify(i instanceof L?i.rawBody??{errors:c}:{errors:c},null,2));else for(let l of c)console.error(`${u.red("ERROR".padEnd(15))} #${l.issue} ${l.dataset_id??""} ${l.stage}: ${l.error}`);process.exitCode=1;return}if(s.errors.length>0)process.exitCode=1;if(e.json){console.log(JSON.stringify(s,null,2));return}if(console.log(),!s.applied)console.log(u.yellow("DRY RUN \u2014 nothing was written. Re-run with --apply."));for(let i of s.plan){let a=i.failed?"FAILED ":s.applied?"":"WOULD ",c=`#${i.issueNumber} ${i.datasetId??"(unknown)"}`;if(i.kind==="close"){let l=`${a}CLOSE`.padEnd(15);console.log(`${i.failed?u.red(l):u.green(l)} ${c} ${u.dim(i.reason)}`)}else if(i.kind==="relabel"){let l=`${a}RELABEL`.padEnd(15);console.log(`${i.failed?u.red(l):u.yellow(l)} ${c} ${u.dim(i.reason)}`)}else console.log(`${u.dim("KEEP".padEnd(15))} ${c} ${u.dim(i.reason)}`)}for(let i of s.rollups){let c=(i.outcome==="failed"?"FAILED RELEASE":i.outcome==="released"?"RELEASE":s.mode==="per-dataset"?"WOULD RELEASE":"ROLLUP").padEnd(15);console.log(`${i.outcome==="failed"?u.red(c):u.magenta(c)} #${i.number} ${u.dim(i.title)}`)}for(let i of s.errors)console.log(`${u.red("ERROR".padEnd(15))} #${i.issue} ${i.dataset_id??""} ${i.stage}: ${i.error}`);if(console.log(),console.log(u.cyan(`open=${s.openIssues} mode=${s.mode} examined=${s.examined} attempted=${s.attempted} ${s.applied?"closed":"would_close"}=${s.closed} ${s.applied?"relabelled":"would_relabel"}=${s.relabelled} kept=${s.kept} errors=${s.errors.length} remaining=${s.remaining}`)),s.remaining>0)console.log(u.dim(` ${s.remaining} candidate(s) outside this run's window; the window rotates daily.`));if(s.mode==="rollup")console.log(u.dim(" Rollup mode: new failures with a cause that already has a rollup join it instead of opening their own issue."));if(s.rollupsReleased>0)console.log(u.dim(` ${s.applied?"Released":"Would release"} ${s.rollupsReleased} rollup(s): the backlog has drained, so per-dataset filing resumes.`));if(s.audit_failed)console.log(u.yellow(` Changes were applied but the audit row failed to write: ${s.audit_failed}`));if(!s.applied&&(s.closed>0||s.relabelled>0||s.rollupsReleased>0))console.log(u.dim(" Re-run with --apply to perform these changes."));if(s.reconcile==null)console.log(),console.log(u.yellow(`reconcile=unknown${s.reconcileError?`: ${s.reconcileError}`:""}`));else{let i=s.reconcile;console.log(),console.log(u.cyan(`reconcile rows_without_issue=${i.rowsWithoutIssue.length} issues_without_row=${i.issuesWithoutRow.length} parked=${i.parked} quarantined=${i.quarantined} rows_examined=${i.rowsExamined} issues_examined=${i.issuesExamined}`));for(let l of i.rowsWithoutIssue.slice(0,P1))console.log(`${u.yellow("UNTRACKED".padEnd(15))} ${l.datasetId} (${l.sourceId}) ${l.status} at ${l.stage} ${u.dim(l.cause)}`);let a=i.rowsWithoutIssue.length-P1;if(a>0)console.log(u.dim(` ... and ${a} more untracked`));for(let l of i.issuesWithoutRow.slice(0,P1))console.log(`${u.yellow("NO IMPORT ROW".padEnd(15))} #${l.number} ${l.datasetId}`);let c=i.issuesWithoutRow.length-P1;if(c>0)console.log(u.dim(` ... and ${c} more`));if(console.log(u.dim(` ${i.reason}`)),i.rowsWithoutIssue.length>0||i.issuesWithoutRow.length>0)console.log(u.dim(" Reported only: this command files and closes nothing for these."))}});Oe.addCommand(rRe);var oRe=new de("import-coverage").description("Check whether the import pipeline is keeping up with OpenNeuro (dry run by default)"),I1=20,ODe=5,VOt={created:"create",refreshed:"refresh",relabelled:"relabel",closed:"close"};oRe.option("--apply","File, update or close the tracking issue (production only)").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=e.apply===!0,n=D("Checking import coverage...").start(),r;try{r=await Ime({apply:t}),n.stop()}catch(c){n.fail("Import coverage check failed"),console.error(u.red(G(c)));let l=c instanceof L?c.details:void 0,d=HOt(l)?l.errors:[];if(e.json)console.log(JSON.stringify(c instanceof L?c.rawBody??{errors:d}:{errors:d},null,2));else for(let f of d)console.error(`${u.red("ERROR".padEnd(12))} ${f.stage}: ${f.error}`);process.exitCode=c instanceof L&&c.statusCode===502?2:1;return}if(r.status==="unknown")process.exitCode=2;else if(r.status!=="healthy"||r.errors.length>0)process.exitCode=1;if(process.exitCode!==0)ce();if(e.json){console.log(JSON.stringify(r,null,2));return}let o=r.backlog,s=o.neverAttempted.length+o.untracked.length;console.log();let i=`${r.status.toUpperCase()}${r.kind?` (${r.kind})`:""}`;console.log(r.status==="healthy"?u.green(i):u.red(u.bold(i))),console.log(r.reason),console.log(),console.log(u.cyan(`auto_import=${r.enabled?"enabled":u.red("DISABLED")} last_dispatch=${r.dispatchAgeHours===null?"never":r.dispatchAgeHours<0?"dated in the future":`${r.dispatchAgeHours}h ago`}${r.lastDispatchSourceId?` (${r.lastDispatchSourceId})`:""} dispatch_lost=${r.dispatchLost}`));let a=r.importedInScan+r.inFlight+r.terminal+s+o.tracked.length+o.blocklisted.length;if(console.log(u.cyan(`discovered=${r.discovered} in_scan=${r.importedInScan} in_flight=${r.inFlight} terminal=${r.terminal} tracked=${o.tracked.length} blocklisted=${o.blocklisted.length}`)),console.log(u.cyan(`outstanding=${s} (never_attempted=${o.neverAttempted.length} untracked=${o.untracked.length})`)),r.importedNotInScan>0)console.log(u.dim(` ${r.importedNotInScan} of ${r.imported} mirror(s) are no longer in the scan (upstream removal, unreadable snapshot, or a modality retag). Drift, not a gap.`));if(a!==r.discovered)console.log(u.yellow(` Counts do not balance (${a} accounted for vs ${r.discovered} discovered): this run did not get a complete view, so treat the verdict as unreliable.`));if(o.neverAttempted.length>0){let c=o.neverAttempted.slice(0,I1).join(", "),l=o.neverAttempted.length-I1;console.log(u.dim(` never attempted: ${c}${l>0?` ... and ${l} more`:""}`))}if(o.untracked.length>0){let c=o.untracked.slice(0,I1).join(", "),l=o.untracked.length-I1;console.log(u.dim(` stale row nothing owns: ${c}${l>0?` ... and ${l} more`:""}`))}for(let c of r.errors){let l=`${c.stage}: ${c.error}`;console.log(c.stage==="anomaly"?`${u.yellow("ANOMALY".padEnd(12))} ${l}`:`${u.red("ERROR".padEnd(12))} ${l}`)}if(r.issue){let c=r.applied?r.issue.action:`would ${VOt[r.issue.action]??r.issue.action}`,l=r.issue.number===null?"":` #${r.issue.number}`;if(console.log(u.dim(` Issue: ${c}${l} on nemarDatasets/.github`)),r.issue.labelError)console.log(u.yellow(` The body was updated but its labels were not: ${r.issue.labelError}`));if(r.issue.commentError)console.log(u.yellow(` The issue changed but its comment failed: ${r.issue.commentError}`))}if(r.audit_failed)console.log(u.yellow(` Changes applied but the audit row failed to write: ${r.audit_failed}`));if(!r.applied&&r.issue)console.log(u.dim(" Re-run with --apply to perform this change."))});Oe.addCommand(oRe);var sRe=new de("import-weekly").description("Read this week's import summary (dry run by default; the cron posts it on Mondays)");function zOt(e){return JT(e).attention}function un(e){return e==null?u.yellow("unknown"):String(e)}sRe.option("--apply","Actually file the issue (production only; the cron normally does this)").option("--json","Output raw JSON instead of the human summary").option("--body","Also print the issue body exactly as it would be posted").action(async(e)=>{if(!ke())return;let t=e.apply===!0,n=D("Building the weekly import summary...").start(),r;try{r=await Nme({apply:t}),n.stop()}catch(a){n.fail("Weekly import summary failed"),console.error(u.red(G(a))),process.exitCode=1;return}let o=r.facts;if(o===null)process.exitCode=0;else if(o.errors.length>0)process.exitCode=2;else if(zOt(o))process.exitCode=1;if(process.exitCode!==0)ce();if(e.json){console.log(JSON.stringify(r,null,2));return}if(o===null){console.log(),console.log(u.yellow(`Nothing computed: ${r.gateReason}`)),console.log(u.dim(" The report is built once a week; --apply files it."));return}console.log(),console.log(u.bold(`Import summary ${o.week}`)),console.log(u.dim(`${o.windowStart} to ${o.windowEnd} (UTC)`)),console.log(),console.log(u.cyan(`imported_this_week=${un(o.importedThisWeek)} total=${un(o.importedTotal)} in_scope=${un(o.discovered)} not_in_scope=${un(o.importedNotInScan)}`));let s=o.coverageStatus===null?u.yellow("unknown"):o.coverageStatus==="healthy"?u.green(o.coverageStatus):u.red(o.coverageStatus);if(console.log(u.cyan(`coverage=${s} outstanding=${un(o.outstanding)}`)),console.log(u.cyan(`auto_import=${o.autoImportEnabled===null?u.yellow("unknown"):o.autoImportEnabled?"enabled":u.red("DISABLED")} last_dispatch=${o.dispatchPhrase??u.yellow("unknown")} dispatch_lost=${o.dispatchLost===null?u.yellow("unknown"):o.dispatchLost}`)),console.log(u.cyan(`open_failures=${un(o.openFailureTotal)} parked=${o.parked===null?u.yellow("unknown"):o.parked.length} closed_this_week=${un(o.issuesClosed)} relabelled=${un(o.issuesRelabelled)}`)),o.upstream==null)console.log(u.cyan(`upstream=${u.yellow("unknown")}`));else{let a=o.upstream.counts.states,c=o.upstream.truncated?` ${u.yellow("(did not reach every mirror)")}`:"",l=`upstream: stale=${un(o.upstream.counts.stale)} current=${un(a.current)} anomaly=${un(a.anomaly)} unknown=${un(a.unknown)} unchecked=${un(a.unchecked)}`;console.log(u.cyan(`${l}${c}`))}if(o.repulls==null)console.log(u.cyan(`repulls=${u.yellow("unknown")}`));else{let a=o.repulls,c=a.switches,l=c.auto_repull_merge_enabled?"open+merge":c.auto_repull_enabled?"open":"off";console.log(u.cyan(`repulls: switches=${l} dispatched=${un(a.dispatches.sent)} opened=${un(a.dispatches.by_status.opened)} refused=${un(a.dispatches.by_status.refused)} failed=${un(a.dispatches.by_status.failed)} unreported=${un(a.dispatches.by_status.unreported)} not_accepted=${un(a.dispatches.by_status.dispatch_failed)}`)),console.log(u.cyan(`repulls: open=${un(a.open_automatic.total)} held=${un(a.open_automatic.held)} claims_held=${un(a.held_claims)} ended_failed=${un(a.ended_failed)} merged_worker=${un(a.merged.worker)} merged_admin=${un(a.merged.administrator)} merged_outside=${un(a.merged.outside_tool)} merged_unattributed=${un(a.merged.unattributed)}`))}if(o.failuresByCause!==null){let a=Object.entries(o.failuresByCause).filter(([,c])=>c>0);for(let[c,l]of a)console.log(u.dim(` ${c}: ${l}`))}if(o.parked!==null&&o.parked.length>0){for(let c of o.parked.slice(0,ODe))console.log(u.dim(` parked ${c.datasetId} (${c.reason??"unknown"}): ${c.parkedDays==null?"unknown":`${c.parkedDays} days`}`));let a=o.parked.length-ODe;if(a>0)console.log(u.dim(` ... and ${a} more parked`))}for(let a of o.errors)console.log(`${u.yellow("UNKNOWN".padEnd(10))} ${a.stage}: ${a.error}`);let i=JT(o);if(i.attention)console.log(u.yellow(`Needs attention: ${i.problems.join("; ")}.`));if(console.log(),!r.posted&&!t)console.log(u.dim("Dry run: nothing was filed.")),console.log(u.dim(" Re-run with --apply to file it (production only)."));else if(!r.posted)console.log(u.yellow(`Not posted: ${r.gateReason}`));else console.log(u.green(`Posted${r.issue?.number?` #${r.issue.number}`:""}${r.closedPrevious?`, closed #${r.closedPrevious}`:""}`));if(e.body)console.log(),console.log(u.dim("--- rendered issue body ---")),console.log(r.renderedBody??u.yellow("(no body was rendered)"))});Oe.addCommand(sRe);var iRe=new de("backfill-usernames").description("Give username-less accounts a username from their name (dry run by default)");iRe.option("--apply","Write the usernames and send verification messages").option("--limit <n>","Users per batch (server clamps to [1,100])","25").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=Number.parseInt(e.limit??"25",10)||25,n=e.apply===!0,r=D(n?"Assigning usernames...":"Checking which accounts need a username...").start(),o;try{o=await Mme({apply:n,limit:t}),r.stop()}catch(s){r.fail("Username backfill failed"),console.error(u.red(G(s))),process.exit(1);return}if(o.lookup_failed>0||o.conflict>0||(o.exhausted??0)>0||(o.write_failed??0)>0||(o.verify_failed??0)>0||(o.verify_rate_limited??0)>0||o.remaining===null)process.exitCode=1;if(e.json){console.log(JSON.stringify(o,null,2));return}if(console.log(),!o.apply)console.log(u.yellow("DRY RUN \u2014 nothing was written. Re-run with --apply."));console.log(u.cyan(`scanned=${o.scanned} ${o.apply?"assigned":"would_assign"}=${o.apply?o.assigned:o.would_assign} single_name=${o.single_name} no_name=${o.no_name} lookup_failed=${o.lookup_failed} conflict=${o.conflict} exhausted=${o.exhausted??0} write_failed=${o.write_failed??0} verify_sent=${o.verify_sent} verify_failed=${o.verify_failed??0} verify_rate_limited=${o.verify_rate_limited??0} remaining=${o.remaining??"unknown"}`));for(let s of o.results){let i=`id ${s.id} <${s.email}>`,a=[s.given_name,s.family_name].filter(Boolean).join(" ");if(s.outcome==="assigned"||s.outcome==="would_assign"){let c=s.outcome==="assigned"?u.green("assigned "):u.cyan("would give"),l=s.outcome==="assigned"?` [verify: ${s.verify}]`:"";console.log(` ${c} ${i}: ${u.cyan(s.username??"?")} (${a})${l}`)}else if(s.outcome==="single_name")console.log(` ${u.yellow("one name ")} ${i}: only "${a}" on record; pick a username by hand`);else if(s.outcome==="no_name")console.log(` ${u.yellow("no name ")} ${i}: run 'nemar admin backfill-names --apply' first`);else if(s.outcome==="conflict")console.log(` ${u.yellow("conflict ")} ${i}: ${s.error}`);else if(s.outcome==="exhausted")console.log(` ${u.yellow("exhausted ")} ${i}: ${s.error}; pick a username by hand`);else if(s.outcome==="write_failed")console.log(` ${u.red("write ")} ${i}: ${s.error}; retry the batch`);else console.log(` ${u.red("error ")} ${i}: ${s.error}`)}for(let s of o.verify_retries??[]){let i=s.verify==="sent"?u.green("re-sent "):s.verify==="not_attempted"?u.cyan("would send"):u.yellow(`verify ${s.verify}`);console.log(` ${i} id ${s.id} <${s.email}>`)}if(o.warning)console.log(u.yellow(` Warning: ${o.warning}`));if(o.single_name>0||o.no_name>0)console.log(),console.log(u.dim("Accounts with one name or none are listed, never guessed at: a username derived from an email address is a handle the person never chose."))});Oe.addCommand(iRe);var aRe=new de("duplicates").description("Report live accounts sharing an ORCID iD, email, or GitHub handle");function GOt(e){let t=e.username??u.dim("(no username)"),n=[];if(e.canonical)n.push(u.green("canonical"));if(e.identity_conflict===1)n.push(u.yellow("flagged"));if(e.has_oauth_identity)n.push(u.dim("orcid-login"));let r=n.length>0?` [${n.join(", ")}]`:"",o=`created ${e.created_at} datasets=${e.dataset_count}`;console.log(` id ${String(e.id).padEnd(5)} ${t} <${e.email}> ${o}${r}`)}aRe.option("--json","Output raw JSON instead of the human report").option("--clear <id>","Clear one account's identity-conflict flag (refuses while the collision remains)").action(async(e)=>{if(!ke())return;if(e.clear!==void 0){let r=Number.parseInt(e.clear,10);if(!Number.isInteger(r)||r<=0){console.error(u.red(`Invalid user id: ${e.clear}`)),process.exit(1);return}let o=D(`Clearing identity-conflict flag on user ${r}...`).start();try{let s=await Lme(r);if(o.stop(),e.json){console.log(JSON.stringify(s,null,2));return}console.log(s.cleared?u.green(`Cleared the identity-conflict flag on user ${r}.`):u.dim(`User ${r} was not flagged; nothing to clear.`))}catch(s){o.fail(s instanceof L&&s.statusCode===409?"Still colliding; flag not cleared":"Failed to clear the identity-conflict flag"),console.error(u.red(G(s))),process.exit(1)}return}let t=D("Checking for duplicate accounts...").start(),n;try{n=await jme(),t.stop()}catch(r){t.fail("Duplicate report failed"),console.error(u.red(G(r))),process.exit(1);return}if(e.json){console.log(JSON.stringify(n,null,2));return}if(console.log(),n.groups.length===0){if(console.log(u.green("No duplicate accounts.")),n.flagged_count>0)console.log(u.yellow(`${n.flagged_count} account(s) still carry an identity-conflict flag with no remaining collision.`)),console.log(u.dim(" Clear each with 'nemar admin duplicates --clear <id>'."));return}console.log(u.cyan(`${n.group_count} duplicate group(s); ${n.flagged_count} account(s) flagged`));for(let r of n.groups){console.log(),console.log(` ${u.bold(r.kind)} ${r.value}`);for(let o of r.accounts)GOt(o)}console.log(),console.log(u.dim("The fix is self-service on the surviving account: change its email or GitHub username, or unlink/re-link its ORCID iD, in Settings on nemar.org. Merging two accounts is manual.")),process.exitCode=1});Oe.addCommand(aRe);var B1=new de("neurobagel").description("Neurobagel federation artifacts: regenerate and inspect the private store (epic #1586)"),oa=(e)=>e===null?u.yellow("unknown"):String(e),GL=(e)=>e==="healthy"?u.green(e):e==="alarm"?u.red(e):e==="unknown"?u.yellow(e):u.dim(e);function cRe(e){console.log(`${u.bold("Verification")} ${GL(e.overall)} ${e.at} (${e.trigger})${e.failed?u.red(` the sweep itself failed: ${e.error??"no reason recorded"}`):""}`);for(let t of ZZ){let n=e.checks[t];console.log(` ${t.padEnd(13)}${GL(n.verdict)} ${n.reason}`)}for(let t of e.warnings)console.log(u.yellow(` warning: ${t}`))}function WOt(e){if(console.log(),e.dry_run)console.log(u.yellow("DRY RUN: nothing was written. Re-run with --execute to write."));if(e.status!=="ok"){let t=e.status==="disabled"?"the writer is disabled (NEUROBAGEL_WRITER_ENABLED is not 1)":e.status==="store_unconfigured"?"no NEUROBAGEL bucket is bound":e.error??"the run failed";console.log(u.red(`status=${e.status}: ${t}`))}console.log(u.cyan(`eligible=${oa(e.eligible)} examined=${e.examined} limit=${e.limit} unexamined=${e.unexamined} removed=${e.removed.length} removals_pending=${e.removals_pending} index_entries=${oa(e.index.entries)} index_written=${e.index.written} index_patched=${e.index.patched??0} anonymity_findings=${e.anonymity_findings} ops=${e.ops.spent}/${e.ops.budget}`));for(let t of e.results)switch(t.outcome){case"written":console.log(` ${u.green("written ")} ${t.id}${t.flags.length>0?` needs review: ${t.flags.join(", ")}`:""}`);break;case"would_write":console.log(` ${u.cyan("would write")} ${t.id} (${t.reason})`);break;case"unchanged":console.log(` ${u.dim("unchanged ")} ${t.id}`);break;case"would_remove":console.log(` ${u.cyan("would remove")} ${t.id}`);break;case"removed":console.log(` ${u.green("removed ")} ${t.id}`);break;case"refused":console.log(` ${u.red("refused ")} ${t.id} ${t.code}${t.detail?`: ${t.detail}`:""}`);break;case"error":console.log(` ${u.red("error ")} ${t.id} ${t.error}`);break}if(e.stopped==="ops_budget")console.log(u.yellow(` the run spent its operation budget (${e.ops.spent} of ${e.ops.budget}, ${e.ops.reserved} of it held back to finish) with ${e.unexamined} dataset(s) not yet examined: run the same command again to continue`));else if(e.unexamined>0&&e.stopped===null)console.log(u.yellow(` ${e.unexamined} dataset(s) are still waiting beyond this call's limit: run the same command again to continue`));if(e.index.contended)console.log(u.red(" the index was replaced by another run during this one; re-run to settle it"));for(let t of e.index.problems??[])console.log(u.red(` index not written: ${t}`));for(let t of e.warnings)console.log(u.yellow(` warning: ${t}`));if(e.anonymity_findings>0)console.log(u.red(` ${e.anonymity_findings} dataset(s) were refused because their data says anonymous. They are in the audit log (neurobagel_anonymity_finding); nothing was filed or mailed.`))}B1.command("regenerate").description("Examine datasets and write what changed to the Neurobagel artifact store (dry run unless --execute)").option("--execute","Write to the store (without it, only report what would change)").option("--dataset <ids...>","Examine exactly these dataset ids instead of the next ones due").option("--limit <n>",`Datasets to examine (default: the server's per-tick bound, at most ${Ek}); run again to continue`).option("--force","Rewrite even when the fingerprint matches").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=e.limit===void 0?void 0:/^[1-9][0-9]*$/.test(e.limit)?Number(e.limit):Number.NaN;if(t!==void 0&&!Number.isInteger(t)){console.error(u.red("--limit must be a positive whole number")),process.exit(1);return}if(t!==void 0&&t>Ek){console.error(u.red(`--limit is at most ${Ek} per call (each call runs inside one request); run the command again to continue`)),process.exit(1);return}let n=e.execute===!0,r=D(n?"Regenerating Neurobagel artifacts...":"Checking what would change...").start(),o;try{o=await Dme({...n?{execute:!0}:{},...e.dataset&&e.dataset.length>0?{datasets:e.dataset}:{},...t!==void 0?{limit:t}:{},...e.force?{force:!0}:{}}),r.stop()}catch(i){At(i,r,"Neurobagel regenerate failed",{409:"Set NEUROBAGEL_WRITER_ENABLED=1 (and bind the bucket) to write. A dry run needs neither the switch nor --execute."}),process.exit(1);return}if(e.json)console.log(JSON.stringify(o,null,2));else WOt(o);let s=o.results.some((i)=>i.outcome==="error");if(o.status!=="ok"||s||o.index.contended||o.stopped==="index_patch"||(o.index.problems?.length??0)>0||o.anonymity_findings>0)process.exitCode=1});B1.command("status").description("What is eligible, written, stale and waiting on a person in the Neurobagel store, and the latest verification (exit 0 healthy, 1 alarm, 2 unknown)").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=D("Reading the Neurobagel store...").start(),n;try{n=await Rme(),t.stop()}catch(l){At(l,t,"Neurobagel status failed"),process.exit(1);return}if(e.json){console.log(JSON.stringify(n,null,2));return}let r=n.writer.mode==="enabled"?u.green("enabled"):n.writer.mode==="disabled"?u.yellow("disabled (NEUROBAGEL_WRITER_ENABLED is not 1)"):u.red("store_unconfigured (no NEUROBAGEL bucket is bound)");console.log(),console.log(`${u.bold("Writer")} ${r}`),console.log(`${u.bold("Read route")} ${n.read_route.token_configured?u.green("token configured"):u.yellow("no NEUROBAGEL_READ_TOKEN: the route answers 404")}`),console.log(`${u.bold("Per tick")} ${n.limits.reconcile_max} datasets (hard limit ${n.limits.hard_max})`),console.log();let o=n.counts;console.log(`${u.bold("Datasets")} eligible=${oa(o.eligible)} written=${oa(o.written)} missing=${oa(o.missing)} stale=${oa(o.stale)} incomplete=${oa(o.incomplete)} waiting to be removed=${oa(o.residue)}`),console.log(`${u.bold("Store")} objects=${oa(n.store.objects)} bytes=${oa(n.store.total_bytes)}${n.store.over_loader_cap?u.red(" OVER the loader's total cap"):""}${(n.store.unexpected_objects??0)>0?u.yellow(` ${n.store.unexpected_objects} object(s) that are not the writer's`):""}`);let s=n.index.matches_store===null?u.yellow("unknown"):n.index.matches_store?u.green("matches the store"):u.yellow("differs from what the store and eligibility imply (the next run settles it)");console.log(`${u.bold("Index")} ${n.index.present===null?u.yellow("unknown"):n.index.present?`${oa(n.index.entries)} entries, generated ${n.index.generated_at??"?"}`:u.dim("not written yet")} ${s}`);let i=n.last_reconcile;console.log(`${u.bold("Last reconcile")} ${i?`${i.at} (${JSON.stringify(i.summary)})`:u.dim("none recorded")}`),console.log(`${u.bold("Anonymity")} ${n.anonymity_findings===null?u.yellow("unknown"):n.anonymity_findings===0?"no findings":u.red(`${n.anonymity_findings} finding(s): see the audit log (neurobagel_anonymity_finding); ids are not shown here`)}`);let a=eee({verification:n.verification,writerMode:n.writer.mode,now:new Date});if(n.verification)cRe(n.verification);if(a.note)console.log(`${u.bold("Verification")} ${GL(a.verdict)} ${a.note}`);else if(!n.verification)console.log(`${u.bold("Verification")} ${u.dim("none recorded; the writer is off, so none is expected")}`);if(n.needs_review.length>0){console.log(),console.log(u.bold(`Needs review (${n.needs_review.length})`));for(let l of n.needs_review)console.log(` ${l.id} ${l.source==="refusal"?u.red(`refused: ${l.code}${l.since?` (last confirmed ${l.since})`:""}`):u.yellow((l.flags??[]).join(", "))}`)}for(let l of n.warnings)console.log(u.yellow(`warning: ${l}`));let c=n.writer.mode==="store_unconfigured"||(n.anonymity_findings??0)>0||n.counts.eligible===null||a.verdict==="alarm";process.exitCode=c?1:KT(a.verdict)}).addHelpText("after","\nExit codes: 0 healthy or nothing to check, 1 an alarm, 2 could not be determined (no verification recorded while the writer is on, a record over 36 hours old, or an unknown verdict). The same as `verify`.");B1.command("verify").description("Run the verification sweep now: the store against eligibility, the node, registration and upstream drift (reports only; exit 0 healthy, 1 alarm, 2 unknown)").option("--json","Output raw JSON instead of the human summary").action(async(e)=>{if(!ke())return;let t=D("Verifying the Neurobagel federation...").start(),n;try{n=await Cme(),t.stop()}catch(r){At(r,t,"Neurobagel verify failed"),process.exit(1);return}if(e.json)console.log(JSON.stringify(n,null,2));else if(console.log(),cRe(n),!n.heartbeat_written)console.log(u.yellow("The heartbeat could not be written: this run is not recorded."));process.exitCode=KT(n.overall)}).addHelpText("after","\nExit codes: 0 healthy or nothing to check, 1 an alarm, 2 could not be determined. The same as `status`.");Oe.addCommand(B1);Oe.addCommand(ra);Oe.addCommand(Ul);Oe.addCommand(N0e);He();Qs();uo();uh();fh();ah();He();uh();fh();var KOt=Ln["cli.gaps.section.title"];function lRe(e){if(e.gaps===void 0)return[e.unknownReason??Ln["cli.gaps.unknown"]];let t=yk(e.gaps,{orcidVerified:e.orcidVerified}).map(BZ);if(e.sandboxCompleted===!1)t.push(bk());return t.length>0?t:[Ln["gaps.none"]]}function JOt(e){let t=lRe(e);return t.length===1&&t[0]===Ln["gaps.none"]}function H_(e){let t=e.gaps===void 0||JOt(e);console.log(),console.log(u.bold(KOt));for(let n of lRe(e))console.log(` ${t?u.dim(n):u.yellow(n)}`)}function U1(e,t,n={}){let r=n.indent??" ";console.log(),console.log(`${r}${e}`);for(let o of t)console.log(`${r} ${u.yellow(o.label)} ${VT(o)}`)}ze();bp();xr();fn();He();hk();import{hostname as YOt}from"os";ze();fn();function XOt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"").replace(/\s+/g," ").trim();return t?t.slice(0,OZ):BT}function QOt(){try{return XOt(YOt())}catch{return BT}}function ZOt(e,t,n=qT){return e+(t+n)*1000}function fRe(e){switch(e.kind){case"cancelled":return{lines:["Sign-in canceled. Run `nemar auth login` to try again."],exitCode:130};case"denied":case"expired":case"invalid":return{lines:[e.message],exitCode:1};case"unreachable":return{lines:[`NEMAR could not be reached: ${e.detail}`,"Run `nemar auth login` again once you're back online."],exitCode:1};case"server_error":return{lines:[`NEMAR keeps answering with an error (${e.detail}). Try again in a few minutes; if it keeps happening, run \`nemar auth login --debug\` and report the log.`],exitCode:1};case"start_failed":return{lines:[`Could not start sign-in: ${e.detail}`],exitCode:1}}}var eTt=15000,uRe=1000,tTt=5000,dRe=3;function nTt(e){if(e instanceof L&&e.statusCode!==0)return`HTTP ${e.statusCode}`;return G(e)}function rTt(e){if(typeof AbortSignal.any==="function")return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted){t.abort();break}n.addEventListener("abort",()=>t.abort(),{once:!0})}return t.signal}function oTt(e,t){return new Promise((n)=>{if(t.aborted){n();return}let r=setTimeout(()=>{t.removeEventListener("abort",o),n()},e);function o(){clearTimeout(r),n()}t.addEventListener("abort",o,{once:!0})})}async function sTt(e,t={}){let n=Date.now(),r=ZOt(n,e.expires_in,t.graceSeconds??qT),o=Math.max(e.interval*1000,uRe),s=new AbortController,i=()=>s.abort();process.on("SIGINT",i);let a=0;try{while(!0){if(s.signal.aborted)return{kind:"cancelled"};if(Date.now()>=r)return{kind:"unreachable",detail:"gave up waiting to reach NEMAR"};if(await oTt(o,s.signal),s.signal.aborted)return{kind:"cancelled"};let c=rTt([s.signal,AbortSignal.timeout(eTt)]),l;try{l=await qhe(e.device_code,c),a=0}catch(d){if(s.signal.aborted)return{kind:"cancelled"};if(d instanceof L&&d.statusCode===0){console.log(u.dim(" NEMAR is unreachable; retrying...")),a=0;continue}let f=nTt(d);if(a+=1,$n(`poll error ${a}/${dRe}: ${f} -- ${G(d)}`),console.log(u.dim(` NEMAR answered with an error (${f}); retrying...`)),a>=dRe)return{kind:"server_error",detail:f};continue}if(l.status==="pending")continue;if(l.status==="slow_down"){o=Math.max(o+tTt,e.interval*1000,uRe);continue}if(l.status==="success")return{...l.data,kind:"success"};if(l.error==="expired_token")return{kind:"expired",message:l.message};if(l.error==="access_denied")return{kind:"denied",message:l.message};return{kind:"invalid",message:l.message}}}finally{process.off("SIGINT",i)}}async function eq(e={}){let t;try{t=await Lhe(QOt())}catch(n){return{kind:"start_failed",detail:G(n)}}if(console.log(` ${t.verification_uri_complete}`),console.log(` Code: ${u.cyan(t.user_code)}`),console.log(u.dim(" (if the page asks for it)")),console.log(),e.open!==!1&&Rg(t.verification_uri_complete))console.log(u.dim(" (trying to open your browser; use the link above if it doesn't)")),console.log();return sTt(t)}yo();var pRe="NEMAR_DATA_HOSTS",iTt="NEMAR_DATA_HOSTS_ONLY",aTt="https://private.nemar.org",cTt="https://private-test.nemar.org",lTt=/^[a-z]{2,3}[0-9]{6}$/;function H1(e){return lTt.test(e)}function uTt(e){return e}function mRe(e){return e==="127.0.0.1"||e==="localhost"||e==="[::1]"}function hRe(e){let t=e.trim();if(t===""||/[?#@]/.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(n.username!==""||n.password!=="")return null;if(n.pathname!=="/")return null;if(n.protocol==="https:")return n.origin;if(n.protocol==="http:"&&mRe(n.hostname))return n.origin;return null}function gRe(e){let t=[],n=[];for(let r of(e??"").split(",")){let o=r.trim();if(o==="")continue;let s=hRe(o);if(s===null)n.push(o);else if(!t.includes(s))t.push(s)}return{origins:t,rejected:n}}function yRe(e){return e.env??process.env}function V1(e={}){let t=yRe(e),n=e.isDevBuild??Vf,r=t[iTt]==="1"?[]:[n?cTt:aTt],{origins:o}=gRe(t[pRe]);return[...r,...o.filter((s)=>!r.includes(s))].map(uTt)}function bRe(e={}){return gRe(yRe(e)[pRe]).rejected}function z1(e,t={}){let n=hRe(e);if(n===null)return null;return V1(t).find((r)=>r===n)??null}function G1(e,t={}){return z1(e,t)!==null}function wRe(e,t={}){let n;try{n=new URL(e)}catch{return null}if(n.username!==""||n.password!=="")return null;return z1(n.origin,t)}function xmn(e,t){if(e.protocol==="https:")return!0;return e.protocol==="http:"&&mRe(e.hostname)&&new URL(t).protocol==="http:"}var dTt="NEMAR_DATA_HOST_TIMEOUT_MS";function _Re(e,t=process.env){let n=t[dTt];if(n===void 0||!/^[0-9]+$/.test(n))return e;let r=Number(n);return r>0&&r<e?r:e}function xRe(e){if(!(e instanceof Error))return"error";let t=e.code;return typeof t==="string"&&/^[A-Z][A-Z0-9_]+$/.test(t)?`${e.name} ${t}`:e.name}var fTt="nemar";function vRe(e){let t={};for(let n of e.split(`
|
|
1684
|
+
`)){let r=n.replace(/\r$/,"");if(r==="")break;let o=r.indexOf("=");if(o<=0)continue;t[r.slice(0,o)]=r.slice(o+1)}return t}function tq(e,t={}){let{protocol:n,host:r}=e;if(!n||!r)return!1;if(/[/?#@\s]/.test(r))return!1;return G1(`${n}://${r}`,t)}function kRe(e,t,n,r={}){if(e!=="get"||!n||!tq(t,r))return"";return`username=${fTt}
|
|
1685
1685
|
password=${n}
|
|
1686
1686
|
`}function ERe(e){let t=e.filter((n)=>!n.startsWith("-"));return t[0]==="auth"&&t[1]==="git-credential"}Lb();import{appendFileSync as pTt,existsSync as tf,mkdirSync as SRe,readFileSync as K1,writeFileSync as mTt}from"fs";import{homedir as hTt}from"os";import{join as W1}from"path";var{spawn:$Re}=globalThis.Bun;function Hp(){let e=W1(hTt(),".ssh");return{sshDir:e,privateKey:W1(e,"nemar_ed25519"),publicKey:W1(e,"nemar_ed25519.pub"),configFile:W1(e,"config")}}function DRe(){let e=Hp();return tf(e.privateKey)&&tf(e.publicKey)}async function RRe(e){let t=Hp();if(!tf(t.sshDir))try{SRe(t.sshDir,{mode:448})}catch(n){return{success:!1,error:`Cannot create ~/.ssh directory: ${n.message}`}}if(tf(t.privateKey))try{return{success:!0,publicKey:K1(t.publicKey,"utf-8").trim()}}catch(n){return{success:!1,error:`NEMAR SSH key exists but cannot read public key: ${n.message}`}}try{let n=$Re({cmd:["ssh-keygen","-t","ed25519","-f",t.privateKey,"-N","","-C",`nemar-cli-${e}`],stdout:"pipe",stderr:"pipe"}),r=await new Response(n.stderr).text();if(await n.exited!==0)return{success:!1,error:`ssh-keygen failed: ${r}`};return{success:!0,publicKey:K1(t.publicKey,"utf-8").trim()}}catch(n){return{success:!1,error:`Failed to generate SSH key: ${n.message}`}}}function CRe(){let e=Hp();if(!tf(e.publicKey))return null;try{return K1(e.publicKey,"utf-8").trim()}catch{return null}}function gTt(){let e=Hp();if(!tf(e.configFile))return!1;try{let t=K1(e.configFile,"utf-8");return t.includes("IdentityFile ~/.ssh/nemar_ed25519")||t.includes(`IdentityFile ${e.privateKey}`)}catch{return!1}}function ARe(){let e=Hp();if(!tf(e.sshDir))try{SRe(e.sshDir,{mode:448})}catch(n){return{success:!1,error:`Cannot create ~/.ssh directory: ${n.message}`}}if(gTt())return{success:!0};let t=`
|
|
1687
1687
|
# NEMAR CLI SSH key (auto-generated)
|
|
@@ -1690,7 +1690,7 @@ Host github.com
|
|
|
1690
1690
|
IdentityFile ~/.ssh/nemar_ed25519
|
|
1691
1691
|
IdentitiesOnly no
|
|
1692
1692
|
`;try{if(tf(e.configFile))pTt(e.configFile,t);else mTt(e.configFile,`${t.trim()}
|
|
1693
|
-
`,{mode:384});return{success:!0}}catch(n){return{success:!1,error:`Failed to update SSH config: ${n.message}`}}}async function
|
|
1693
|
+
`,{mode:384});return{success:!0}}catch(n){return{success:!1,error:`Failed to update SSH config: ${n.message}`}}}async function nq(){try{let e=$Re({cmd:["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ConnectTimeout=10","git@github.com"],stdout:"pipe",stderr:"pipe"}),t=await new Response(e.stdout).text(),n=await new Response(e.stderr).text();await e.exited;let r=t+n,o=r.match(/Hi ([^!]+)!/);if(o)return{success:!0,username:o[1]};if(r.includes("Permission denied"))return{success:!1,error:"Permission denied - SSH key not recognized by GitHub"};if(r.includes("successfully authenticated"))return{success:!0};return{success:!1,error:"Could not authenticate with GitHub"}}catch(e){return{success:!1,error:`SSH connection failed: ${e.message}`}}}var ao=new de("auth").description("Authentication management");$r(ao,`
|
|
1694
1694
|
Description:
|
|
1695
1695
|
Manage your NEMAR account authentication. New users sign in with their
|
|
1696
1696
|
browser (ORCID creates the account); that activates it (browse, download,
|
|
@@ -1720,7 +1720,7 @@ Examples:
|
|
|
1720
1720
|
$ nemar auth whoami # Alias for status
|
|
1721
1721
|
$ nemar auth switch # Switch between accounts
|
|
1722
1722
|
$ nemar auth logout # Clear active account
|
|
1723
|
-
$ nemar auth logout --all # Clear all accounts`);function yTt(e){if(!e.hasStoredKey)return{kind:"fresh"};let t=e.username||"unknown";return e.storedKeyState==="invalid"?{kind:"stale",username:t}:{kind:"active",username:t}}function
|
|
1723
|
+
$ nemar auth logout --all # Clear all accounts`);function yTt(e){if(!e.hasStoredKey)return{kind:"fresh"};let t=e.username||"unknown";return e.storedKeyState==="invalid"?{kind:"stale",username:t}:{kind:"active",username:t}}function rq(e){if(e.username&&hpe(e.username)==="key_taken")console.log(u.yellow(` This machine already has a different account stored as '${e.username}'.`)),console.log(u.dim(" Your credentials stay under the old name; 'nemar auth switch' still selects that one."));if(Tn("username",e.username??void 0),Tn("email",e.email),Tn("githubUsername",e.github_username??void 0),e.service_access!==void 0)Tn("serviceAccess",e.service_access);if(e.profile_gaps!==void 0)Tn("profileGaps",e.profile_gaps);if(e.sandbox_completed!==void 0)Tn("sandboxCompleted",e.sandbox_completed);if(e.sandbox_dataset_id)Tn("sandboxDatasetId",e.sandbox_dataset_id);if(e.orcid_verified!==void 0)Tn("orcidVerified",e.orcid_verified);if(Tn("role",e.role),e.account_kind!==void 0)Tn("accountKind",e.account_kind)}async function oq(e,t,n,r){let o=ppe(e),s=n.source==="device"?{keySource:"device",keyId:n.key.id,keyName:n.key.name,keyCreatedAt:n.key.created_at}:{keySource:"paste",keyId:void 0,keyName:void 0,keyCreatedAt:void 0},i;try{({previous:i}=mpe(o,{apiKey:t,email:e.email,...s}))}catch(l){if(n.source==="device")try{await Vhe(n.key.id,t)}catch{}console.log(),console.log(u.red(` Could not save your credentials (${G(l)}).${n.source==="device"?" The new key was revoked;":""} fix ${uN()} and run \`nemar auth login\` again.`)),process.exitCode=1;return}rq(e),console.log();let a=n.source==="paste"?"Welcome back":"Welcome";if(console.log(` ${a}${e.username?`, ${u.cyan(e.username)}`:""}!`),e.role==="owner")console.log(` ${u.red("Owner access enabled")}`);else if(e.role==="admin")console.log(` ${u.magenta("Admin access enabled")}`);if(!e.sandbox_completed)console.log(),console.log(u.yellow(" Note: Sandbox training required before uploading datasets")),console.log(u.dim(" Run 'nemar sandbox' to complete training"));if(n.source==="device"&&i?.keySource==="device"&&i.keyId!==void 0&&i.keyId!==n.key.id)try{if(await KS(i.keyId),!r)console.log(u.dim(" (replaced this machine's previous key)"))}catch(l){console.log(u.yellow(` Could not revoke this machine's previous key (${G(l)}); it stays active until you run \`nemar auth keys revoke ${i.keyId}\`.`))}let c=zt();H_({gaps:c.profileGaps,orcidVerified:c.orcidVerified,sandboxCompleted:c.sandboxCompleted})}function NRe(e){let{lines:t,exitCode:n}=fRe(e);console.log();let r=e.kind==="cancelled"?u.yellow:u.red;for(let o of t)console.log(r(o));process.exitCode=n}async function sq(e){if(e.key!==void 0&&e.key.trim()===""){console.log(u.red("--key was given but is empty.")),console.log(u.dim(" Pass the key itself, or drop --key to sign in with your browser instead.")),Io(),process.exitCode=1;return}let t=e.key||process.env.NEMAR_API_KEY,n=!1;if(Ve()){let o=zt(),s=o.apiKey,i="unknown";if(s){let c=D("Checking your saved credentials...").start();try{i=(await qN(s)).valid?"valid":"invalid",c.stop()}catch(l){if(c.stop(),l instanceof Cu)return;i=l instanceof L&&l.statusCode===401?"invalid":"unknown"}}n=i==="invalid";let a=yTt({hasStoredKey:!0,storedKeyState:i,username:o.username});if(t){if(a.kind==="active"){if(console.log(u.yellow(`Already logged in as ${a.username}`)),console.log(u.dim(" This will add another account (use 'nemar auth switch' to switch)")),await De("Add a different account?",e)!=="confirmed")return}else if(a.kind==="stale")console.log(u.yellow(`Your saved API key for ${a.username} is no longer valid.`)),console.log(u.dim(" It may have expired or been revoked (e.g. via 'nemar auth regenerate-key').")),console.log(u.dim(" Enter your new key below to re-authenticate."))}else if(a.kind==="active")console.log(u.yellow(`Already signed in as ${a.username}; signing in again refreshes this machine's key.`));else if(a.kind==="stale")console.log(u.yellow(`Your saved key for ${a.username} is no longer valid.`)),console.log(u.dim(" Sign in again below; the browser step continues."))}if(t){await bTt(t,n);return}let r=await eq({open:e.open});if(r.kind==="success"){await oq(r.user,r.api_key,{source:"device",key:r.key},n);return}NRe(r)}async function bTt(e,t){let n=D("Validating API key...").start();try{let r=await qN(e);if(!r.valid){_o(n,"Invalid API key","Check that your API key is correct"),process.exitCode=1;return}n.succeed("Login successful"),await oq(r.user,e,{source:"paste"},t)}catch(r){if(process.exitCode=1,r instanceof L){if(n.fail(r.message),Bb(r.message),r.statusCode===401)console.log(u.dim(" Check that your API key is correct"));else if(r.statusCode===403)console.log(u.dim(" Your account is not active; verify your email first"))}else n.fail("Connection failed"),Bb("Connection failed"),console.log(u.dim(" Check your internet connection"))}}var wTt=ao.command("login").description("Sign in with your browser (opens NEMAR's device sign-in page)").option("-k, --key <key>","Paste an existing API key instead (alternative: NEMAR_API_KEY)").option("--no-open","Print the sign-in link instead of trying to open a browser").option(Xe,nt).option(bt,gt).action(sq);$r(wTt,`
|
|
1724
1724
|
Description:
|
|
1725
1725
|
Prints a link and a code, tries to open your browser to it, then waits
|
|
1726
1726
|
for you to authorize this machine there. The link and code are the real
|
|
@@ -1739,7 +1739,7 @@ Examples:
|
|
|
1739
1739
|
$ nemar auth login # Browser sign-in
|
|
1740
1740
|
$ nemar auth login --no-open # Print the link only (headless)
|
|
1741
1741
|
$ nemar auth login -k nemar_abc123... # Paste an existing key`);function ORe(e){if(e.length===0||process.stdin.isTTY)return!1;return console.log(u.yellow(`Provide ${e.join(", ")} (this terminal cannot prompt).`)),process.exitCode=1,!0}async function J1(e){let{value:t}=await Ae.prompt([{type:"input",name:"value",message:e,validate:(n)=>n?.trim()?!0:"Required"}]);return String(t).trim()}async function _Tt(e){let t=D("Checking your profile...").start(),n;try{n=await Qr(),t.stop()}catch(l){t.fail(`Could not read your profile: ${G(l)}`),process.exitCode=1;return}let r=new Set((n.profile_gaps??[]).map((l)=>l.field)),o=r.has("username")||!n.username,s=n.username_auto_assigned===!0,i=[];if(o&&!e.username)i.push("--username");if(s&&!e.username&&e.no===!0)i.push("--username");if(r.has("github_username")&&!e.github)i.push("--github");if(r.has("city")&&!e.city)i.push("--city");if(r.has("country")&&!e.country)i.push("--country");if(ORe(i))return;let a={};if(s){if(e.username){if(e.username!==n.username)a.username=e.username}else if(await De(`Keep the username '${n.username}'?`,e,!0)==="declined")a.username=e.username??await J1("New username:")}else if(o)if(e.username)a.username=e.username;else{let l=await zhe().catch(()=>null),{chosen:d}=await Ae.prompt([{type:"input",name:"chosen",message:"Choose a username:",default:l?.suggestion??void 0,validate:(f)=>f?.trim()?!0:"A username is required"}]);a.username=String(d).trim()}if(r.has("github_username"))a.github_username=e.github??await J1("GitHub username (for PR collaboration):");if(r.has("city"))a.city=e.city??await J1("City (for export-control screening):");if(r.has("country"))a.country=e.country??await J1("Country (for export-control screening):");if(Object.keys(a).length>0){let l=D("Saving your profile...").start();try{await BN(a),l.succeed("Profile updated")}catch(d){zl(l,d,"Could not save your profile");return}}if(e.uploadAccess!==!1){let l=e.why?.trim();if(!l){if(ORe(["--why"]))return;let d=await Ae.prompt([{type:"input",name:"why",message:"What do you intend to upload to NEMAR?",validate:FRe}]);l=String(d.why).trim()}await MRe(l)}await V_();let c=zt();H_({gaps:c.profileGaps,orcidVerified:c.orcidVerified,sandboxCompleted:c.sandboxCompleted})}async function X1(e){console.log(u.cyan("NEMAR Account Sign-Up")),console.log(u.dim(`Sign in with your browser to create or continue your account
|
|
1742
|
-
`)),await zfe();let t=await
|
|
1742
|
+
`)),await zfe();let t=await eq({open:e.open});if(t.kind!=="success"){NRe(t);return}await oq(t.user,t.api_key,{source:"device",key:t.key},!1),await _Tt(e)}var xTt=ao.command("signup").description("Create or continue your NEMAR account (browser sign-in, then a few questions)").option("--username <name>","Username to set, or to change to").option("--github <handle>","GitHub username").option("--city <city>","City").option("--country <country>","Country").option("--why <text>","What you intend to upload (20-500 characters)").option("--no-upload-access","Skip the upload-access request").option("--no-open","Print the sign-in link instead of trying to open a browser").option(Xe,nt).option(bt,gt).action(X1);$r(xTt,`
|
|
1743
1743
|
Description:
|
|
1744
1744
|
Signs in with your browser like 'nemar auth login' -- ORCID creates a
|
|
1745
1745
|
brand-new account the first time, or signs into an existing one. Then
|
|
@@ -1754,7 +1754,7 @@ Examples:
|
|
|
1754
1754
|
$ nemar auth signup
|
|
1755
1755
|
$ nemar auth signup --no-open
|
|
1756
1756
|
$ nemar auth signup --github octocat --city "San Diego" --country USA \\
|
|
1757
|
-
--why "Sharing our lab's 64-channel EEG study of motor imagery"`);function vTt(e){if(!e.apiKey)return;if(e.keySource==="device"){let t=e.keyName||"this machine",n=e.keyCreatedAt?e.keyCreatedAt.slice(0,10):"an unknown date";return`${t}, signed in via browser on ${n}`}if(e.keySource==="paste")return"pasted key";return"password-era key; run `nemar auth login` to replace it with a machine-named key"}async function Q1(e){if(!Ve()){console.log(u.yellow("Not authenticated")),console.log(),console.log(" Run 'nemar auth login' to authenticate"),console.log(" Run 'nemar auth signup' to create an account");return}let t,n,r;if(e.refresh){let c=D("Fetching user info...").start();try{let l=await Qr();
|
|
1757
|
+
--why "Sharing our lab's 64-channel EEG study of motor imagery"`);function vTt(e){if(!e.apiKey)return;if(e.keySource==="device"){let t=e.keyName||"this machine",n=e.keyCreatedAt?e.keyCreatedAt.slice(0,10):"an unknown date";return`${t}, signed in via browser on ${n}`}if(e.keySource==="paste")return"pasted key";return"password-era key; run `nemar auth login` to replace it with a machine-named key"}async function Q1(e){if(!Ve()){console.log(u.yellow("Not authenticated")),console.log(),console.log(" Run 'nemar auth login' to authenticate"),console.log(" Run 'nemar auth signup' to create an account");return}let t,n,r;if(e.refresh){let c=D("Fetching user info...").start();try{let l=await Qr();rq(l),t=l.role,n=l.account_kind,c.stop()}catch(l){let d=l instanceof Error?l.message:String(l);if(c.fail(`Could not refresh user info: ${d}`),r=d,l instanceof L&&l.statusCode===401){console.log(u.yellow(" Your saved API key is no longer valid (expired or revoked).")),console.log(u.dim(" Run 'nemar auth login' with a new key to re-authenticate."));return}if(l instanceof L&&l.statusCode===403){console.log(u.yellow(" Your account is not active (unverified email, or revoked).")),console.log(u.dim(" Verify your email, or contact a NEMAR admin if you believe this is an error."));return}}}let o=zt();if(console.log(u.green("Authenticated")),console.log(),o.username)console.log(` Username: ${u.cyan(o.username)}`);if(o.email)console.log(` Email: ${o.email}`);if(o.githubUsername)console.log(` GitHub: @${o.githubUsername}`);if(t){let c=t==="owner"?u.red("Owner"):t==="admin"?u.magenta("Admin"):u.white("Member");console.log(` Role: ${c}`)}if(n&&n!=="person")console.log(` Kind: ${u.yellow(n)}`);let s=vTt(o);if(s)console.log(` Key: ${s}`);if(r)console.log(` Upload access: ${u.dim("unknown (refresh failed; showing cached account)")}`);else if(o.serviceAccess===!0)console.log(` Upload access: ${u.green("granted")}`);else if(o.serviceAccess===!1)console.log(` Upload access: ${u.yellow("not granted")}`),console.log(` ${u.dim(ar("upload_access.section.lede"))}`),console.log(` ${u.cyan(ar("cli.upload_access.cta"))}`);else console.log(` Upload access: ${u.dim("unknown (run 'nemar auth status --refresh')")}`);console.log(` Config: ${u.dim(uN())}`),H_({gaps:r?void 0:o.profileGaps,orcidVerified:o.orcidVerified,sandboxCompleted:r?void 0:o.sandboxCompleted});let a=Gb().filter((c)=>!c.active);if(a.length>0)console.log(),console.log(` Other accounts: ${a.map((c)=>u.dim(c.username??c.key)).join(", ")}`),console.log(u.dim(" Run 'nemar auth switch' to switch accounts"))}ao.command("status").description("Check current authentication status").option("--refresh","Refresh user info from server").action(Q1);ao.command("whoami").description("Show current user (alias for status)").option("--refresh","Refresh user info from server").action(Q1);async function kTt(e){try{let t=Bun.which("gh");if(!t){console.log(u.dim(" GitHub CLI (gh) not found in PATH, skipping"));return}let n=Bun.spawn({cmd:[t,"auth","switch","--user",e],stdout:"pipe",stderr:"pipe"}),r=await new Response(n.stderr).text(),o=await n.exited;if(o===0)console.log(` GitHub CLI switched to ${u.cyan(`@${e}`)}`);else{let s=r.trim();if(s.includes("not found")||s.includes("no accounts"))console.log(u.dim(` GitHub CLI: @${e} not logged in (run 'gh auth login')`));else console.log(u.dim(` GitHub CLI switch failed: ${s||`exit code ${o}`}`))}}catch(t){let n=t instanceof Error?t.message:String(t);console.log(u.dim(` GitHub CLI switch skipped: ${n}`))}}async function iq(e){let t=Gb();if(t.length===0){console.log(u.yellow("No stored accounts")),console.log(" Run 'nemar auth login' to add an account");return}if(t.length===1){let s=t[0];if(s.active){console.log(u.yellow(`Only one account stored: ${s.username??s.key}`)),console.log(" Run 'nemar auth login' to add another account");return}}if(e!==void 0&&e.trim()===""){console.log(u.red("Account name was given but is empty.")),console.log(u.dim(" Name an account, or run 'nemar switch' with no argument to choose.")),Io(),process.exitCode=1;return}let n;if(e)n=e;else{let s=t.map((a)=>({name:`${a.username??a.key}${a.githubUsername?` (@${a.githubUsername})`:""}${a.active?u.green(" (active)"):""}`,value:a.key,short:a.username??a.key})),{selected:i}=await Ae.prompt([{type:"list",name:"selected",message:"Switch to account:",choices:s,default:t.find((a)=>a.active)?.key}]);n=i}let r=t.find((s)=>s.active);if(r&&r.key===n){console.log(u.yellow(`Already using account ${r.username??r.key}`));return}let o=dN(n);if(!o){console.log(u.red(`Account not found: ${n}`)),console.log(u.dim(" Provide a NEMAR username or GitHub username")),console.log(u.dim(` Available: ${t.map((s)=>s.username??s.key).join(", ")}`)),process.exitCode=1;return}if(console.log(u.green(`Switched to ${u.cyan(o.username||n)}`)),o.githubUsername)await kTt(o.githubUsername)}var ETt=ao.command("switch [username]").description("Switch between stored accounts").action(iq);$r(ETt,`
|
|
1758
1758
|
Description:
|
|
1759
1759
|
Switch the active NEMAR account. You can specify a NEMAR username or
|
|
1760
1760
|
GitHub username. If no username is given, an interactive picker is shown.
|
|
@@ -1764,7 +1764,7 @@ Description:
|
|
|
1764
1764
|
Examples:
|
|
1765
1765
|
$ nemar auth switch # Interactive picker
|
|
1766
1766
|
$ nemar auth switch yahya # Switch by NEMAR username
|
|
1767
|
-
$ nemar auth switch cool-vibers # Switch by GitHub username`);async function TRe(e,t){if(t.revokeKey===!1)return;if(!(t.revokeKey===!0||e.keySource==="device")){if(e.keySource!=="device")console.log(u.dim(" This key may be used on other machines and was kept; revoke it with 'nemar auth keys revoke' or in Settings on nemar.org."));return}try{await KS("current")}catch(r){if(r instanceof L&&r.statusCode===401)return;console.log(u.yellow(` Could not revoke this machine's key (${G(r)}); it stays valid.`))}}async function
|
|
1767
|
+
$ nemar auth switch cool-vibers # Switch by GitHub username`);async function TRe(e,t){if(t.revokeKey===!1)return;if(!(t.revokeKey===!0||e.keySource==="device")){if(e.keySource!=="device")console.log(u.dim(" This key may be used on other machines and was kept; revoke it with 'nemar auth keys revoke' or in Settings on nemar.org."));return}try{await KS("current")}catch(r){if(r instanceof L&&r.statusCode===401)return;console.log(u.yellow(` Could not revoke this machine's key (${G(r)}); it stays valid.`))}}async function aq(e){if(!Ve()){console.log(u.yellow("Not currently authenticated"));return}if(e.all){let o=Gb();if(await De(`Log out all ${o.length} stored account(s)?`,e)!=="confirmed")return;for(let i of o)dN(i.key),await TRe(i,e);fpe(),console.log(u.green("All accounts removed"));return}let t=zt();if(await De(`Log out ${t.username||"current user"}?`,e)!=="confirmed")return;await TRe(t,e),dpe(),console.log(u.green("Logged out successfully"));let r=Gb();if(r.length>0){let o=r.find((s)=>s.active);if(o)console.log(` Switched to ${u.cyan(o.username)}`)}}var STt=ao.command("logout").description("Remove the active account (use --all to remove all)").option(Xe,nt).option(bt,gt).option("--all","Remove all stored accounts").option("--revoke-key","Revoke this machine's key even if it may be shared").option("--no-revoke-key","Never revoke the key server-side, only clear it locally").action(aq);$r(STt,`
|
|
1768
1768
|
Description:
|
|
1769
1769
|
Clears the active account's credential from this machine. A key this
|
|
1770
1770
|
machine's own 'nemar auth login' minted (device sign-in) is also revoked
|
|
@@ -1775,8 +1775,8 @@ Description:
|
|
|
1775
1775
|
Examples:
|
|
1776
1776
|
$ nemar auth logout # Remove the active account
|
|
1777
1777
|
$ nemar auth logout --no-revoke-key # Clear locally, keep the key valid
|
|
1778
|
-
$ nemar auth logout --all # Remove every stored account`);ao.command("resend-verification").description("Resend email verification link").action(async()=>{let{email:e}=await Ae.prompt([{type:"input",name:"email",message:"Enter your email address:",validate:(n)=>{if(!n||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n))return"Please enter a valid email address";return!0}}]),t=D("Sending verification email...").start();try{let n=await Ahe(e);t.succeed(n.message)}catch(n){if(n instanceof L){if(t.fail(n.message),n.statusCode===0)console.log(u.dim(" Check your internet connection"))}else t.fail(`Failed to send verification email: ${n instanceof Error?n.message:"Unknown error"}`),console.log(u.dim(" Check your internet connection"))}});async function $Tt(e){if(!Ve()){console.log(u.yellow("Not authenticated")),console.log(),console.log(" Run 'nemar auth login' first to authenticate");return}let t=zt();if(!e.force){let c=D("Checking existing SSH access...").start(),l=await
|
|
1779
|
-
`));let n=null,r=Hp();if(DRe()&&!e.force)console.log(u.dim(` Using existing key: ${r.privateKey}`)),n=CRe();else{let c=D("Generating SSH key...").start(),l=await RRe(t.email||"nemar-user");if(!l.success){c.fail("Failed to generate SSH key"),console.log(u.dim(` ${l.error}`));return}c.succeed("SSH key generated"),console.log(u.dim(` Private key: ${r.privateKey}`)),console.log(u.dim(` Public key: ${r.publicKey}`)),n=l.publicKey||null}if(!n){console.log(u.red("Could not read public key"));return}let o=D("Configuring SSH...").start(),s=ARe();if(!s.success){o.fail("Failed to configure SSH"),console.log(u.dim(` ${s.error}`));return}o.succeed("SSH configured for GitHub"),console.log();let i=D("Testing SSH connection to GitHub...").start(),a=await
|
|
1778
|
+
$ nemar auth logout --all # Remove every stored account`);ao.command("resend-verification").description("Resend email verification link").action(async()=>{let{email:e}=await Ae.prompt([{type:"input",name:"email",message:"Enter your email address:",validate:(n)=>{if(!n||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n))return"Please enter a valid email address";return!0}}]),t=D("Sending verification email...").start();try{let n=await Ahe(e);t.succeed(n.message)}catch(n){if(n instanceof L){if(t.fail(n.message),n.statusCode===0)console.log(u.dim(" Check your internet connection"))}else t.fail(`Failed to send verification email: ${n instanceof Error?n.message:"Unknown error"}`),console.log(u.dim(" Check your internet connection"))}});async function $Tt(e){if(!Ve()){console.log(u.yellow("Not authenticated")),console.log(),console.log(" Run 'nemar auth login' first to authenticate");return}let t=zt();if(!e.force){let c=D("Checking existing SSH access...").start(),l=await nq();if(l.success){if(c.succeed("SSH access to GitHub already configured"),l.username)console.log(` GitHub user: ${u.cyan(l.username)}`);console.log(),console.log(u.dim("Use --force to regenerate SSH key anyway"));return}c.info("SSH access to GitHub not configured")}console.log(),console.log(u.cyan("Setting up SSH access for GitHub")),console.log(u.dim(`This will generate a dedicated SSH key for NEMAR uploads
|
|
1779
|
+
`));let n=null,r=Hp();if(DRe()&&!e.force)console.log(u.dim(` Using existing key: ${r.privateKey}`)),n=CRe();else{let c=D("Generating SSH key...").start(),l=await RRe(t.email||"nemar-user");if(!l.success){c.fail("Failed to generate SSH key"),console.log(u.dim(` ${l.error}`));return}c.succeed("SSH key generated"),console.log(u.dim(` Private key: ${r.privateKey}`)),console.log(u.dim(` Public key: ${r.publicKey}`)),n=l.publicKey||null}if(!n){console.log(u.red("Could not read public key"));return}let o=D("Configuring SSH...").start(),s=ARe();if(!s.success){o.fail("Failed to configure SSH"),console.log(u.dim(` ${s.error}`));return}o.succeed("SSH configured for GitHub"),console.log();let i=D("Testing SSH connection to GitHub...").start(),a=await nq();if(a.success){if(i.succeed("SSH connection verified"),a.username)console.log(` GitHub user: ${u.cyan(a.username)}`);console.log(),console.log(u.green("SSH setup complete! You can now upload datasets."));return}i.info("SSH key generated but not yet added to GitHub"),console.log(),console.log(u.yellow("To complete setup, add this SSH key to your GitHub account:")),console.log(),console.log(u.cyan(` ${n}`)),console.log(),console.log("Steps:"),console.log(" 1. Copy the key above"),console.log(` 2. Go to: ${u.underline("https://github.com/settings/ssh/new")}`),console.log(` 3. Title: ${u.dim("NEMAR CLI")}`),console.log(" 4. Paste the key and click 'Add SSH key'"),console.log(),console.log(u.dim("After adding the key, run 'nemar auth setup-ssh' again to verify."))}var DTt=ao.command("setup-ssh").description("Configure SSH access for GitHub (optional, gh CLI preferred)").option("-f, --force","Regenerate SSH key even if one exists").action($Tt);$r(DTt,`
|
|
1780
1780
|
Description:
|
|
1781
1781
|
Configures SSH access for GitHub as an alternative to gh CLI (HTTPS).
|
|
1782
1782
|
Most users should use 'gh auth login' instead; SSH is only needed if
|
|
@@ -1797,7 +1797,7 @@ Description:
|
|
|
1797
1797
|
'nemar dataset clone' sets this up for the clone; you do not run it yourself.
|
|
1798
1798
|
|
|
1799
1799
|
Examples:
|
|
1800
|
-
$ git config credential.https://private.nemar.org.helper '!nemar auth git-credential'`).action(async(e)=>{let t=vRe(await Bun.stdin.text()),n=zt().apiKey,r=kRe(e,t,n);if(r!=="")process.stdout.write(r);else if(e==="get"&&!n&&
|
|
1800
|
+
$ git config credential.https://private.nemar.org.helper '!nemar auth git-credential'`).action(async(e)=>{let t=vRe(await Bun.stdin.text()),n=zt().apiKey,r=kRe(e,t,n);if(r!=="")process.stdout.write(r);else if(e==="get"&&!n&&tq(t))process.stderr.write(`No NEMAR API key is stored. Run 'nemar auth login'.
|
|
1801
1801
|
`)});ao.command("retrieve-key",{hidden:!0}).description("Removed: there is no password sign-in").allowUnknownOption().allowExcessArguments().action(()=>{console.error(u.yellow("Password sign-in was removed, so 'nemar auth retrieve-key' no longer exists.")),console.error(` Run ${u.cyan("nemar auth login")} to sign in with your browser; it also creates your API key.`),ce(),process.exitCode=1});var RTt=ao.command("regenerate-key").description("Request a new API key (revokes current key, requires email verification)").action(async()=>{console.log(u.dim(" This revokes the key on EVERY machine, not just this one; see 'nemar auth keys revoke'.")),console.log(),console.log(u.yellow("API Key Regeneration")),console.log(u.dim(`This will revoke your current key and generate a new one
|
|
1802
1802
|
`));let{email:e}=await Ae.prompt([{type:"input",name:"email",message:"Email address associated with your account:",validate:(n)=>{if(!n||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n))return"Please enter a valid email address";return!0}}]),t=D("Sending verification email...").start();try{let n=await Ohe(e);t.succeed("Verification email sent"),console.log(),console.log("Next steps:"),console.log(" 1. Check your email for a verification link"),console.log(" 2. Click the link to generate your new API key"),console.log(" 3. Copy the new key and run 'nemar auth login -k <new-key>'"),console.log(),console.log(u.dim("The link expires in 1 hour"))}catch(n){if(process.exitCode=1,n instanceof L){if([401,403,429].includes(n.statusCode))ce();t.fail(n.message)}else t.fail("Failed to send verification email"),console.log(u.dim(" Check your internet connection"))}});$r(RTt,`
|
|
1803
1803
|
Description:
|
|
@@ -1872,7 +1872,7 @@ Subcommands (the same changes Settings on nemar.org makes):
|
|
|
1872
1872
|
Examples:
|
|
1873
1873
|
$ nemar auth profile
|
|
1874
1874
|
$ nemar auth profile set-email ada@lab.example.org
|
|
1875
|
-
$ nemar auth profile orcid link`);var
|
|
1875
|
+
$ nemar auth profile orcid link`);var cq="Also changeable in Settings on https://nemar.org/settings";function eC(){if(Ve())return!0;return console.log(u.yellow("Not authenticated")),console.log(),console.log(" Run 'nemar auth login' to authenticate"),process.exitCode=1,!1}async function V_(){try{let e=await Qr();rq(e)}catch(e){console.log(u.dim(` (local copy not refreshed: ${G(e)} \u2014 run 'nemar auth status --refresh')`))}}function LRe(e){try{e()}catch(t){console.log(u.yellow(` The change is live on the server; your local config could not be updated: ${G(t)}`)),console.log(u.dim(" Run 'nemar auth status --refresh' once the problem is fixed."))}}function zl(e,t,n){if(t instanceof L||t instanceof Cu)e.fail(t.message);else e.fail(n),console.log(u.dim(` ${G(t)}`));process.exitCode=1}async function tC(e,t,n){if(!eC())return;let r=D(t).start();try{await BN(e),r.succeed(n),await V_(),console.log(u.dim(` ${cq}`))}catch(o){zl(r,o,"Could not update your profile")}}var NTt=nf.command("set-email <address>").description("Start an email change: mails a confirmation code to the new address").action(async(e)=>{if(!eC())return;let t=D(`Sending a confirmation code to ${e}...`).start(),n;try{n=await Nhe(e)}catch(r){zl(t,r,"Could not send the confirmation code");return}if(t.succeed(`Code sent to ${n.masked_email}`),LRe(()=>Tn("pendingEmailChange",e)),console.log(),console.log(" The address is not changed until you confirm the code:"),console.log(` ${u.cyan("nemar auth profile verify-email <code>")}`),console.log(u.dim(" The code expires in 10 minutes.")),n.dev_code)console.log(u.dim(` (development backend echoed the code: ${n.dev_code})`));if(n.dev_skip)console.log(u.yellow(" This backend is non-production and did not mail anything (delivery allow-list)."));console.log(u.dim(` ${cq}`))});$r(NTt,`
|
|
1876
1876
|
Description:
|
|
1877
1877
|
Step one of changing the email address your NEMAR account signs in with.
|
|
1878
1878
|
A 6-digit code goes to the NEW address; nothing changes until you enter it
|
|
@@ -1937,7 +1937,7 @@ Description:
|
|
|
1937
1937
|
without them. Neither may be blank.
|
|
1938
1938
|
|
|
1939
1939
|
Examples:
|
|
1940
|
-
$ nemar auth profile set-location --city "San Diego" --country USA`);var BTt=3000,UTt=3;async function HTt(e,t){let n=Date.now()+t,r=0;while(Date.now()<n){await new Promise((o)=>setTimeout(o,BTt));try{let o=await Qr();r=0;let s=o.orcid??null;if(s&&s!==e)return{kind:"linked",orcid:s}}catch(o){if(o instanceof L&&o.statusCode===401)return{kind:"unauthenticated"};if(o instanceof L&&o.statusCode===0){if(r+=1,r>=UTt)return{kind:"unreachable",detail:G(o)}}else r=0}}return{kind:"timeout"}}function VTt(e){let t=Number(e);if(!Number.isFinite(t)||!Number.isInteger(t)||t<=0)throw new Us("--timeout must be a whole number of seconds greater than 0");return t}var zTt=nf.command("orcid <action>").description("Link, re-link, or unlink your ORCID iD (link opens a browser)").option("--no-open","Print the URL instead of opening a browser").option("--timeout <seconds>","How long to wait for the browser flow to finish",VTt,300).option("-y, --yes","Skip the confirmation prompt (unlink)").option("-n, --no","Decline the confirmation prompt (unlink)").action(async(e,t)=>{if(e!=="link"&&e!=="relink"&&e!=="unlink"){console.log(u.yellow(`Unknown action '${e}'`)),console.log(),console.log(" Use one of: link, relink, unlink"),process.exitCode=1;return}if(!eC())return;if(e==="unlink"){let c=await De("Unlink your ORCID iD from this NEMAR account?",{yes:t.yes,no:t.no},!1);if(c!=="confirmed"){console.log(c==="declined"?"Declined":"Cancelled");return}let l=D("Unlinking your ORCID iD...").start();try{await jhe(),l.succeed("ORCID iD unlinked"),console.log(u.dim(" Your account no longer claims that iD. Link it again any time with 'nemar auth profile orcid link'.")),await V_()}catch(d){zl(l,d,"Could not unlink your ORCID iD")}return}let n=D("Preparing the ORCID sign-in link...").start(),r,o=null;try{o=(await Qr()).orcid??null,r=(await Mhe(e)).authorize_url,n.stop()}catch(c){zl(n,c,"Could not start the ORCID flow");return}if(console.log(),console.log(" Open this link and sign in with ORCID:"),console.log(` ${u.cyan(r)}`),console.log(u.dim(" The link is good for 10 minutes and works only for this account.")),t.open!==!1&&Rg(r))console.log(u.dim(" (trying to open your browser; use the link above if it doesn't)"));console.log();let s=t.timeout??300,i=D("Waiting for you to finish in the browser...").start(),a=await HTt(o,s*1000);if(a.kind==="linked"){i.succeed(`ORCID iD ${a.orcid} is linked to your account`),await V_(),console.log(u.dim(` ${
|
|
1940
|
+
$ nemar auth profile set-location --city "San Diego" --country USA`);var BTt=3000,UTt=3;async function HTt(e,t){let n=Date.now()+t,r=0;while(Date.now()<n){await new Promise((o)=>setTimeout(o,BTt));try{let o=await Qr();r=0;let s=o.orcid??null;if(s&&s!==e)return{kind:"linked",orcid:s}}catch(o){if(o instanceof L&&o.statusCode===401)return{kind:"unauthenticated"};if(o instanceof L&&o.statusCode===0){if(r+=1,r>=UTt)return{kind:"unreachable",detail:G(o)}}else r=0}}return{kind:"timeout"}}function VTt(e){let t=Number(e);if(!Number.isFinite(t)||!Number.isInteger(t)||t<=0)throw new Us("--timeout must be a whole number of seconds greater than 0");return t}var zTt=nf.command("orcid <action>").description("Link, re-link, or unlink your ORCID iD (link opens a browser)").option("--no-open","Print the URL instead of opening a browser").option("--timeout <seconds>","How long to wait for the browser flow to finish",VTt,300).option("-y, --yes","Skip the confirmation prompt (unlink)").option("-n, --no","Decline the confirmation prompt (unlink)").action(async(e,t)=>{if(e!=="link"&&e!=="relink"&&e!=="unlink"){console.log(u.yellow(`Unknown action '${e}'`)),console.log(),console.log(" Use one of: link, relink, unlink"),process.exitCode=1;return}if(!eC())return;if(e==="unlink"){let c=await De("Unlink your ORCID iD from this NEMAR account?",{yes:t.yes,no:t.no},!1);if(c!=="confirmed"){console.log(c==="declined"?"Declined":"Cancelled");return}let l=D("Unlinking your ORCID iD...").start();try{await jhe(),l.succeed("ORCID iD unlinked"),console.log(u.dim(" Your account no longer claims that iD. Link it again any time with 'nemar auth profile orcid link'.")),await V_()}catch(d){zl(l,d,"Could not unlink your ORCID iD")}return}let n=D("Preparing the ORCID sign-in link...").start(),r,o=null;try{o=(await Qr()).orcid??null,r=(await Mhe(e)).authorize_url,n.stop()}catch(c){zl(n,c,"Could not start the ORCID flow");return}if(console.log(),console.log(" Open this link and sign in with ORCID:"),console.log(` ${u.cyan(r)}`),console.log(u.dim(" The link is good for 10 minutes and works only for this account.")),t.open!==!1&&Rg(r))console.log(u.dim(" (trying to open your browser; use the link above if it doesn't)"));console.log();let s=t.timeout??300,i=D("Waiting for you to finish in the browser...").start(),a=await HTt(o,s*1000);if(a.kind==="linked"){i.succeed(`ORCID iD ${a.orcid} is linked to your account`),await V_(),console.log(u.dim(` ${cq}`));return}if(a.kind==="unauthenticated"){i.fail("Your credentials no longer authenticate"),console.log(),console.log(" Run 'nemar auth login' with a current API key, then try again."),console.log(u.dim(" If you finished the browser step, the link may still have been made.")),process.exitCode=1;return}if(a.kind==="unreachable"){i.fail(`Cannot reach the API: ${a.detail}`),console.log(),console.log(" The browser step may still have worked; check with 'nemar auth profile'."),process.exitCode=1;return}i.warn("Gave up waiting for the browser flow"),console.log(),console.log(" If you finished it, check with 'nemar auth profile'."),console.log(" If the browser showed an error, run this command again."),process.exitCode=1});$r(zTt,`
|
|
1941
1941
|
Description:
|
|
1942
1942
|
ORCID stays a browser flow: the consent screen is ORCID's, and no NEMAR
|
|
1943
1943
|
command should ever ask for an ORCID password. This mints a short-lived link
|
|
@@ -1967,11 +1967,11 @@ Examples:
|
|
|
1967
1967
|
$ nemar auth profile orcid relink --no-open
|
|
1968
1968
|
$ nemar auth profile orcid unlink --yes`);He();ze();sc();Zo();ph();import{mkdirSync as GTt,readFileSync as WTt,writeFileSync as KTt}from"fs";import{homedir as JTt}from"os";import{join as qRe}from"path";function BRe(){return process.env.NEMAR_CONFIG_DIR||qRe(JTt(),".config","nemar")}function URe(){return qRe(BRe(),"completion-cache.json")}var YTt=3600000,XTt=te({cachedAt:j(),data:uk});function HRe(){try{let e=WTt(URe(),"utf-8"),t=XTt.safeParse(JSON.parse(e));if(!t.success)return null;if(Date.now()-t.data.cachedAt>=YTt)return null;return t.data.data}catch(e){if(process.env.VERBOSE)process.stderr.write(`[completion] cache read failed: ${e instanceof Error?e.message:e}
|
|
1969
1969
|
`);return null}}function VRe(e){try{GTt(BRe(),{recursive:!0}),KTt(URe(),JSON.stringify({cachedAt:Date.now(),data:e}))}catch(t){if(process.env.VERBOSE)process.stderr.write(`[completion] cache write failed: ${t instanceof Error?t.message:t}
|
|
1970
|
-
`)}}async function
|
|
1970
|
+
`)}}async function lq(){let e=await mhe();VRe(e)}function Vp(){lq().catch((e)=>{if(process.env.VERBOSE)process.stderr.write(`[completion] opportunistic refresh failed: ${e instanceof Error?e.message:e}
|
|
1971
1971
|
`)})}var QTt=["# nemar completion for bash","# Install (current shell): source <(nemar completion bash)","# Install (persistent): nemar completion bash > /usr/local/etc/bash_completion.d/nemar","_nemar_complete() {"," local cur words_to_complete raw line lines n",' cur="${COMP_WORDS[COMP_CWORD]}"',' words_to_complete=("${COMP_WORDS[@]:1:COMP_CWORD}")',' raw="$(nemar __complete -- "${words_to_complete[@]}" 2>/dev/null)"'," COMPREPLY=()",' if [[ -n "$raw" ]]; then'," lines=()",' while IFS= read -r line; do lines+=("$line"); done <<< "$raw"'," n=${#lines[@]}"," if (( n > 0 )); then",' COMPREPLY=("${lines[@]:0:n-1}")'," fi"," fi","}","complete -F _nemar_complete nemar",""],ZTt=["#compdef nemar","# nemar completion for zsh","# Install (current shell): source <(nemar completion zsh)",'# Install (persistent): nemar completion zsh > "${fpath[1]}/_nemar" (then restart your shell)',"_nemar() {"," local -a request_words lines candidates",' request_words=("${(@)words[2,CURRENT]}")',' lines=("${(@f)$(nemar __complete -- "${request_words[@]}" 2>/dev/null)}")'," if (( ${#lines[@]} > 0 )); then",' candidates=("${(@)lines[1,-2]}")'," else"," candidates=()"," fi",' compadd -- "${candidates[@]}"',"}",'_nemar "$@"',""],ePt=["# nemar completion for fish","# Install: nemar completion fish > ~/.config/fish/completions/nemar.fish","function __nemar_complete_words"," set -l tokens (commandline -opc)"," set -l cur (commandline -ct)"," set -l request_words"," if test (count $tokens) -gt 1"," set request_words $tokens[2..-1]"," end"," set request_words $request_words $cur"," set -l lines (nemar __complete -- $request_words 2>/dev/null)"," if test (count $lines) -gt 0"," set -e lines[-1]"," end"," for line in $lines"," echo $line"," end","end","complete -c nemar -f -a '(__nemar_complete_words)'",""];function zRe(){return QTt.join(`
|
|
1972
1972
|
`)}function GRe(){return ZTt.join(`
|
|
1973
1973
|
`)}function WRe(){return ePt.join(`
|
|
1974
|
-
`)}var zp=new de("completion").description("Print a shell completion script, or refresh cached dynamic candidates");zp.command("bash").description("Print the bash completion script").action(()=>{process.stdout.write(zRe())});zp.command("zsh").description("Print the zsh completion script").action(()=>{process.stdout.write(GRe())});zp.command("fish").description("Print the fish completion script").action(()=>{process.stdout.write(WRe())});zp.command("refresh").description("Refresh the cached dynamic completion candidates (task, license, ...)").action(async()=>{try{await
|
|
1974
|
+
`)}var zp=new de("completion").description("Print a shell completion script, or refresh cached dynamic candidates");zp.command("bash").description("Print the bash completion script").action(()=>{process.stdout.write(zRe())});zp.command("zsh").description("Print the zsh completion script").action(()=>{process.stdout.write(GRe())});zp.command("fish").description("Print the fish completion script").action(()=>{process.stdout.write(WRe())});zp.command("refresh").description("Refresh the cached dynamic completion candidates (task, license, ...)").action(async()=>{try{await lq(),console.log(u.green("Completion cache refreshed."))}catch(e){let t=e instanceof L?e.message:e.message;console.log(u.red(`Failed to refresh completion cache: ${t}`)),process.exit(1)}});zp.addHelpText("after",`
|
|
1975
1975
|
Description:
|
|
1976
1976
|
Tab completion for subcommands, flags, and facet vocabularies. Subcommand
|
|
1977
1977
|
names, flags, and the enum flags with a fixed declared vocabulary
|
|
@@ -1994,26 +1994,26 @@ Setup:
|
|
|
1994
1994
|
|
|
1995
1995
|
Examples:
|
|
1996
1996
|
$ nemar completion bash
|
|
1997
|
-
$ nemar completion refresh`);He();import{existsSync as bs,mkdtempSync as SNt,readFileSync as X_,writeFileSync as cAe}from"fs";import{tmpdir as $Nt}from"os";import{join as Jp,resolve as qs}from"path";var{spawn:So}=globalThis.Bun;Qs();uo();fh();
|
|
1998
|
-
`).map((n)=>n.trim()).filter((n)=>n!==""&&!n.startsWith("Download"));return t.find((n)=>n.startsWith("error:"))??t.filter((n)=>!n.startsWith("at ")).pop()}async function a1e(e,t={}){let n=i1e(e,{...t,json:!0}),r=W_({cmd:["deno",...n],stdout:"pipe",stderr:"pipe",env:{...process.env,NO_COLOR:"1"}}),o=await new Response(r.stdout).text(),s=await new Response(r.stderr).text(),i=await r.exited;if(i!==0&&i!==oC){let f=xPt(s);throw Error(f?`BIDS validator failed (exit ${i}): ${f}`:`BIDS validator failed with exit code ${i}`)}let a;try{a=JSON.parse(o)}catch{throw Error(`Failed to parse validator output: ${o.slice(0,200)}`)}if(!Array.isArray(a?.issues?.issues))throw Error("The BIDS validator's report has no list of issues");let c=a.issues.issues,l=c.filter((f)=>f.severity==="error").length,d=c.filter((f)=>f.severity==="warning").length;return{valid:l===0,issues:c,codeMessages:a.issues.codeMessages||{},summary:a.summary,errorCount:l,warningCount:d,validatorVersion:Ay}}async function c1e(e,t={}){let n=i1e(e,t),r=W_({cmd:["deno",...n],stdout:"pipe",stderr:"pipe"}),o=await new Response(r.stdout).text(),s=await new Response(r.stderr).text(),i=await r.exited;return{stdout:o,stderr:s,exitCode:i}}function
|
|
1997
|
+
$ nemar completion refresh`);He();import{existsSync as bs,mkdtempSync as SNt,readFileSync as X_,writeFileSync as cAe}from"fs";import{tmpdir as $Nt}from"os";import{join as Jp,resolve as qs}from"path";var{spawn:So}=globalThis.Bun;Qs();uo();fh();uq();Fp();var dq=["public","attribution","sharealike","noncommercial","noderiv","unknown"];var ghn=["Filter by modality: a whole-token, case-insensitive match against the dataset's modality","list, so `eeg` does not match `ieeg`. A comma-separated list matches a dataset holding any","of its modalities, at most 32 distinct values; more is refused."].join(" "),fq=["Filter by modality (eeg, emg, meg, etc.), matched as a whole token;","a comma list matches any of up to 32"].join(" ");Ck();class sa extends Error{reason;constructor(e,t){super(t);this.name="RangeParseError",this.reason=e}}var rPt={"":1,b:1,kb:1024,mb:1048576,gb:1073741824,tb:1099511627776},oPt={"":1,s:1,m:60,h:3600,d:86400},sPt={"":1};function iPt(e){switch(e){case"bytes":return rPt;case"duration":return oPt;case"number":return sPt}}var aPt=/^(-?\d+(?:\.\d+)?)([a-z]*)$/i;function pq(e,t){let n=aPt.exec(e);if(!n)throw new sa("non-numeric",`"${e}" is not a valid number`);let[,r,o]=n,s=o.toLowerCase(),i=Number(r);if(!Number.isFinite(i))throw new sa("non-finite",`"${e}" is not a finite number`);if(i<0)throw new sa("negative",`"${e}" must not be negative`);if(s!==""&&t==="number")throw new sa("unit-not-allowed",`"${e}" has a unit, but this facet takes a plain number`);let c=iPt(t)[s];if(c===void 0)throw new sa("unknown-unit",`"${s}" is not a recognized ${t} unit`);return i*c}function YRe(e,t){let n=e.trim();if(n.includes("..")){let o=n.split("..");if(o.length!==2)throw new sa("malformed",`"${e}" must contain at most one ".." separator`);let[s,i]=o,a=s.trim(),c=i.trim();if(a===""&&c==="")throw new sa("malformed",`"${e}" does not specify either bound`);let l=a===""?null:pq(a,t),d=c===""?null:pq(c,t);if(l!==null&&d!==null&&l>d)throw new sa("inverted",`"${e}" is inverted: ${l} is greater than ${d}`);return{min:l,max:d}}let r=pq(n,t);return{min:r,max:r}}oc();sc();ze();Bi();He();Qs();var nC="https://docs.nemar.org/policies/contributor-terms/",XRe={deposit_type:"owner",key_status:"destroyed",deidentified:!0};function cPt(e){let{depositType:t,keyStatus:n,confirmDeidentified:r,affirmNoDuplicate:o,upstreamSource:s}=e;if(!(t!==void 0||n!==void 0||r===!0||o===!0||s!==void 0))return null;if(t!=="owner"&&t!=="redistribution")throw Error(`--deposit-type must be "owner" or "redistribution" (got ${t??"nothing"}); it is required when attesting via flags.`);if(n!=="destroyed"&&n!=="retained")throw Error(`--key-status must be "destroyed" or "retained" (got ${n??"nothing"}); it is required when attesting via flags.`);if(r!==!0)throw Error("--confirm-deidentified is required when attesting via flags: you must confirm the dataset contains no identifiable personal information.");if(t==="redistribution"&&o!==!0)throw Error("Redistribution deposits require --affirm-no-duplicate: you must affirm the dataset is not already on NEMAR or an upstream archive in BIDS format.");if(t==="owner"&&o)throw Error("--affirm-no-duplicate only applies to --deposit-type redistribution.");let a={deposit_type:t,key_status:n,deidentified:!0};if(t==="redistribution"){if(a.no_duplicate=!0,s)a.upstream_source=s}else if(s)throw Error("--upstream-source only applies to --deposit-type redistribution.");return a}async function lPt(){console.log(),console.log(u.bold("Deposit attestation")),console.log(u.dim(` These answers are recorded with the dataset. Terms: ${nC}`));let{depositType:e}=await Ae.prompt([{type:"list",name:"depositType",message:"Which describes this deposit?",choices:[{name:"I own this dataset (or am authorized by the owner) and hold ethics permissions for public sharing",value:"owner"},{name:"I am redistributing a publicly released dataset whose license permits it",value:"redistribution"}]}]),{keyStatus:t}=await Ae.prompt([{type:"list",name:"keyStatus",message:"The key linking subject codes to participant identities:",choices:[{name:"Has been destroyed (dataset is anonymous)",value:"destroyed"},{name:"Is retained by the owning institution and is never transmitted to NEMAR",value:"retained"}]}]),n={deposit_type:e,key_status:t,deidentified:!0};if(e==="redistribution"){let{noDuplicate:o}=await Ae.prompt([{type:"confirm",name:"noDuplicate",message:"Do you affirm this dataset is NOT already available on NEMAR or an upstream archive (e.g. OpenNeuro) in BIDS format?",default:!1}]);if(!o)throw Error("Upload cancelled: NEMAR does not accept duplicates of datasets already archived in BIDS format.");n.no_duplicate=!0;let{upstream:s}=await Ae.prompt([{type:"input",name:"upstream",message:"Upstream source of this dataset in its original form (URL or accession; blank if none):"}]);if(s.trim())n.upstream_source=s.trim()}let{deidentified:r}=await Ae.prompt([{type:"confirm",name:"deidentified",message:"Do you confirm the dataset contains no identifiable personal information (HIPAA Safe Harbor identifiers removed, anatomical images defaced, headers scrubbed)?",default:!0}]);if(!r)throw Error("Upload cancelled: datasets must be de-identified before deposit. See the contributor terms for what must be removed.");return n}async function QRe(e,t=process.stdin.isTTY===!0){let n=cPt(e);if(n)return n;if(!t)throw Error(`Deposit attestation required: run interactively, or pass --deposit-type, --key-status, and --confirm-deidentified (plus --affirm-no-duplicate for redistribution). --yes does not substitute for attestation. Terms: ${nC}`);return lPt()}jg();var{Glob:ZRe}=globalThis.Bun;var uPt=["stimuli/**","**/stimuli/**"],dPt=["derivatives/**","**/derivatives/**"];function e1e(e,t){let n=e.trim();if(!n)return"";let r=n.startsWith(`${t}-`)?n.slice(t.length+1):n;return`${t}-${r}`}function fPt(e){let t=e.trim().replace(/^run-/,"");if(!t)return[];if(/^[1-9]$/.test(t))return[t,`0${t}`];return[t]}function pPt(e,t){let n=e.trim();if(!n)return"";return n.startsWith(`${t}-`)?n.slice(t.length+1):n}function Gp(e){if(!e)return[];return e.split(",").map((t)=>t.trim()).filter(Boolean)}function mPt(e){let t=Array.from(new Set(e)).filter(Boolean);if(t.length===0)return[];if(t.length===1)return["--include",t[0]];let n=["-("];for(let r=0;r<t.length;r++){if(r>0)n.push("--or");n.push("--include",t[r])}return n.push("-)"),n}function rC(e){let t=[],n=[],r=Gp(e.subjects).map((m)=>e1e(m,"sub"));if(r.length>0)t.push(r.map((m)=>`${m}/**`)),n.push(`subjects: ${r.join(", ")}`);let o=Gp(e.sessions).map((m)=>e1e(m,"ses"));if(o.length>0)t.push(o.map((m)=>`**/${m}/**`)),n.push(`sessions: ${o.join(", ")}`);let s=Gp(e.tasks).map((m)=>pPt(m,"task"));if(s.length>0)t.push(s.map((m)=>`**/*_task-${m}_*`)),n.push(`tasks: ${s.join(", ")}`);let i=Gp(e.runs).flatMap(fPt);if(i.length>0)t.push(i.map((m)=>`**/*_run-${m}_*`)),n.push(`runs: ${i.join(", ")}`);let a=Gp(e.datatypes);if(a.length>0)t.push(a.map((m)=>`**/${m}/**`)),n.push(`datatypes: ${a.join(", ")}`);let c=Gp(e.include);if(c.length>0)t.push(c),n.push(`include: ${c.join(", ")}`);let l=Gp(e.exclude),d=t.length>0||l.length>0,f=[];if(e.excludeStimuli)f.push(...uPt),n.push("skipping stimuli/ (use --stimuli to include)");if(e.excludeDerivatives)f.push(...dPt),n.push("skipping derivatives/ (use --derivatives to include)");let p=[];for(let m of t)p.push(...mPt(m));for(let m of f)p.push("--exclude",m);for(let m of l)p.push("--exclude",m);if(l.length>0)n.push(`exclude: ${l.join(", ")}`);return{args:p,active:d,summary:n,includeGroups:t,excludePatterns:[...f,...l]}}function n1e(e,t){let n=hPt(t);for(let r of n.excludes)if(r.match(e))return!1;for(let r of n.includes){if(r.length===0)continue;if(!r.some((o)=>o.match(e)))return!1}return!0}var t1e=new WeakMap;function hPt(e){let t=t1e.get(e);if(t)return t;let n={includes:e.includeGroups.map((r)=>r.map((o)=>new ZRe(o))),excludes:e.excludePatterns.map((r)=>new ZRe(r))};return t1e.set(e,n),n}function r1e(e,t){if(e&&e.length>0)return rC({});return rC({excludeStimuli:t.stimuli!==!0,excludeDerivatives:t.derivatives!==!0})}import{existsSync as yPt,readFileSync as bPt,statSync as s1e,writeFileSync as o1e}from"fs";import{homedir as hq}from"os";import{join as z_}from"path";var{spawn:W_}=globalThis.Bun;var mq={version:"3.0.2",specifier:"jsr:@bids/validator"};var Ay=mq.version,G_=`${mq.specifier}@${Ay}`,wPt=86400000,oC=16;async function Oy(){try{let e=W_({cmd:["deno","--version"],stdout:"pipe",stderr:"pipe"}),t=await new Response(e.stdout).text();await e.exited;let n=t.match(/deno\s+(\d+\.\d+\.\d+)/);return{installed:!0,version:n?n[1]:void 0}}catch{return{installed:!1}}}function gq(){try{let e=process.platform,t=process.env.DENO_DIR||(e==="darwin"?z_(hq(),"Library","Caches","deno"):e==="win32"?z_(process.env.LOCALAPPDATA||z_(hq(),"AppData","Local"),"deno"):z_(hq(),".cache","deno")),n=z_(t,"deps");if(!yPt(n))return!0;let r=s1e(n);return Date.now()-r.mtimeMs>wPt}catch{return!0}}async function yq(){try{let e=W_({cmd:["deno","run","--node-modules-dir=none",`--reload=${G_}`,"-ERWN",G_,"--version"],stdout:"pipe",stderr:"pipe"}),t=await new Response(e.stdout).text();await e.exited;let n=t.match(/(\d+\.\d+\.\d+)/);return n?n[1]:null}catch{return null}}async function bq(){try{let e=W_({cmd:["deno","run","--node-modules-dir=none","-ERWN",G_,"--version"],stdout:"pipe",stderr:"pipe"}),t=await new Response(e.stdout).text();await e.exited;let n=t.match(/(\d+\.\d+\.\d+)/);return n?n[1]:null}catch{return null}}function i1e(e,t={}){let n=["run","--node-modules-dir=none"];if(t.forceReload)n.push(`--reload=${G_}`);if(n.push("-ERWN",G_,e),t.json)n.push("--json");if(t.config)n.push("--config",t.config);if(t.ignoreWarnings)n.push("--ignoreWarnings");if(t.recursive)n.push("--recursive");if(t.prune)n.push("--prune");if(t.verbose)n.push("--verbose");if(t.extraArgs?.length)n.push(...t.extraArgs);return n}var _Pt=/\u001b\[[0-9;]*[A-Za-z]/g;function xPt(e){let t=e.replace(_Pt,"").split(`
|
|
1998
|
+
`).map((n)=>n.trim()).filter((n)=>n!==""&&!n.startsWith("Download"));return t.find((n)=>n.startsWith("error:"))??t.filter((n)=>!n.startsWith("at ")).pop()}async function a1e(e,t={}){let n=i1e(e,{...t,json:!0}),r=W_({cmd:["deno",...n],stdout:"pipe",stderr:"pipe",env:{...process.env,NO_COLOR:"1"}}),o=await new Response(r.stdout).text(),s=await new Response(r.stderr).text(),i=await r.exited;if(i!==0&&i!==oC){let f=xPt(s);throw Error(f?`BIDS validator failed (exit ${i}): ${f}`:`BIDS validator failed with exit code ${i}`)}let a;try{a=JSON.parse(o)}catch{throw Error(`Failed to parse validator output: ${o.slice(0,200)}`)}if(!Array.isArray(a?.issues?.issues))throw Error("The BIDS validator's report has no list of issues");let c=a.issues.issues,l=c.filter((f)=>f.severity==="error").length,d=c.filter((f)=>f.severity==="warning").length;return{valid:l===0,issues:c,codeMessages:a.issues.codeMessages||{},summary:a.summary,errorCount:l,warningCount:d,validatorVersion:Ay}}async function c1e(e,t={}){let n=i1e(e,t),r=W_({cmd:["deno",...n],stdout:"pipe",stderr:"pipe"}),o=await new Response(r.stdout).text(),s=await new Response(r.stderr).text(),i=await r.exited;return{stdout:o,stderr:s,exitCode:i}}function wq(e){let t;try{t=JSON.parse(e)}catch{throw Error("The BIDS validator did not print a JSON report")}if(typeof t!=="object"||t===null||Array.isArray(t))throw Error("The BIDS validator's JSON report is not an object");return JSON.stringify({...t,validatorVersion:Ay})}function l1e(e){let t;for(let n=0;n<e.length;n++){let r=e[n];if(r==="--outfile"||r==="-o"){let o=e[n+1];if(o)t=o,n++}else if(r.startsWith("--outfile=")&&r.length>10)t=r.slice(10)}return t}function u1e(e,t){try{if(!s1e(e).isFile())return}catch(o){if(o.code==="ENOENT")throw Error(`The BIDS validator exited normally but wrote no report to ${e}`);throw o}let n=bPt(e,"utf-8");if(t){let o;try{o=wq(n)}catch{throw Error(`The BIDS validator's report file does not hold a JSON report: ${e}`)}o1e(e,o);return}let r=n===""||n.endsWith(`
|
|
1999
1999
|
`)?"":`
|
|
2000
2000
|
`;o1e(e,`${n}${r}Validator: @bids/validator ${Ay}
|
|
2001
2001
|
`)}function d1e(e,t=!0){let n=[],r=e.issues.filter((a)=>a.severity==="error"),o=e.issues.filter((a)=>a.severity==="warning");if(e.valid)n.push(t?"\x1B[32m\u2713 Dataset is valid BIDS\x1B[0m":"\u2713 Dataset is valid BIDS");else n.push(t?"\x1B[31m\u2717 Dataset has validation errors\x1B[0m":"\u2717 Dataset has validation errors");if(n.push(""),r.length>0){n.push(t?"\x1B[31mErrors:\x1B[0m":"Errors:");for(let a of r){let c=t?`\x1B[31m${a.code}\x1B[0m`:a.code,l=e.codeMessages[a.code]?.split(`
|
|
2002
2002
|
`)[0]||"";if(n.push(` ${c}: ${l}`),n.push(` ${a.location}`),a.issueMessage)n.push(` ${a.issueMessage.split(`
|
|
2003
2003
|
`)[0]}`)}n.push("")}if(o.length>0){n.push(t?"\x1B[33mWarnings:\x1B[0m":"Warnings:");for(let a of o){let c=t?`\x1B[33m${a.code}\x1B[0m`:a.code,l=e.codeMessages[a.code]?.split(`
|
|
2004
2004
|
`)[0]||"";n.push(` ${c}: ${l}`),n.push(` ${a.location}`)}n.push("")}if(n.push("Summary:"),n.push(` Files: ${e.summary.totalFiles}`),n.push(` Size: ${JQ(e.summary.size)}`),e.summary.subjects.length>0)n.push(` Subjects: ${e.summary.subjects.length}`);if(e.summary.sessions.length>0)n.push(` Sessions: ${e.summary.sessions.length}`);if(e.summary.tasks.length>0)n.push(` Tasks: ${e.summary.tasks.join(", ")}`);if(e.summary.modalities.length>0)n.push(` Modalities: ${e.summary.modalities.join(", ")}`);n.push(` Schema: BIDS ${e.summary.schemaVersion}`),n.push(` Validator: @bids/validator ${e.validatorVersion}`),n.push("");let s=e.errorCount===1?"error":"errors",i=e.warningCount===1?"warning":"warnings";return n.push(`${e.errorCount} ${s}, ${e.warningCount} ${i}`),n.join(`
|
|
2005
|
-
`)}bp();xr();import{constants as vPt,accessSync as kPt,statSync as EPt}from"fs";import{isAbsolute as SPt}from"path";Vi();qt();var $Pt=15000;function DPt(e,t){return`${e}/git/${t}.git`}class K_ extends Error{constructor(e){super(e);this.name="CredentialHelperError"}}function RPt(e){try{if(!EPt(e).isFile())return!1;return kPt(e,vPt.X_OK),!0}catch{return!1}}function
|
|
2006
|
-
`).some((r)=>r.trim().split(/\s+/)[1]?.toLowerCase()==="nemar")}function
|
|
2005
|
+
`)}bp();xr();import{constants as vPt,accessSync as kPt,statSync as EPt}from"fs";import{isAbsolute as SPt}from"path";Vi();qt();var $Pt=15000;function DPt(e,t){return`${e}/git/${t}.git`}class K_ extends Error{constructor(e){super(e);this.name="CredentialHelperError"}}function RPt(e){try{if(!EPt(e).isFile())return!1;return kPt(e,vPt.X_OK),!0}catch{return!1}}function xq(e=process.env){let t=e.NEMAR_CREDENTIAL_HELPER?.trim();if(t){if(SPt(t)){if(!RPt(t))throw new K_("NEMAR_CREDENTIAL_HELPER is not an executable file; give an absolute path to the program or a bare command name.");return`!${_q(t)} auth git-credential`}if(!/^[A-Za-z0-9._-]+$/.test(t))throw new K_("NEMAR_CREDENTIAL_HELPER must be an absolute path to an executable or a bare command name with no slash.");return`!${t} auth git-credential`}if(Bun.which("nemar",{PATH:e.PATH??""}))return"!nemar auth git-credential";let n=process.argv[1];if(n)return`!${_q(process.execPath)} ${_q(n)} auth git-credential`;return"!nemar auth git-credential"}function _q(e){return`'${e.replace(/'/g,"'\\''")}'`}async function f1e(e,t,n,r={}){let o={found:null,refused:[],unreachable:[]};for(let s of n){if(!G1(s,r))throw Error("refusing to send the API key to a host that is not on the data host list");try{let i=await fetch(`${s}/api/datasets/${encodeURIComponent(e)}`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},redirect:"manual",signal:AbortSignal.timeout(_Re($Pt,r.env))});if(i.status===200){let a=await i.json().catch(()=>null);if(a?.dataset?.id===e){let c=typeof a.dataset.name==="string"?a.dataset.name:void 0;return o.found={origin:s,name:c},o}o.unreachable.push({origin:s,detail:"an answer that is not this dataset"})}else if(i.status===404)await i.body?.cancel().catch(()=>{});else if(i.status===401)await i.body?.cancel().catch(()=>{}),o.refused.push(s);else await i.body?.cancel().catch(()=>{}),o.unreachable.push({origin:s,detail:`status ${i.status}`})}catch(i){o.unreachable.push({origin:s,detail:xRe(i)})}}return o}async function p1e(e,t,n,r=xq()){let o=`credential.${e}.helper`,s=await R(["git","clone","-c",`${o}=`,"-c",`${o}=${r}`,DPt(e,t),n]);if(s.exitCode!==0)return{success:!1,error:N(s.stderr).trim()||"Failed to clone dataset"};let i=await R(["git","annex","init",r$],{cwd:n});if(i.exitCode!==0){if((await R(["git","annex","info"],{cwd:n})).exitCode!==0)return{success:!1,error:`Cloned repository but git-annex initialization failed: ${N(i.stderr).trim()}`}}return{success:!0}}async function vq(e){let{stdout:t,exitCode:n}=await R(["git","config","--get-regexp","^remote\\..+\\.annex-externaltype$"],{cwd:e});if(n!==0)return!1;return t.split(`
|
|
2006
|
+
`).some((r)=>r.trim().split(/\s+/)[1]?.toLowerCase()==="nemar")}function kq(e=process.env){return Bun.which("git-annex-remote-nemar",{PATH:e.PATH??""})!==null}async function m1e(e,t={}){let{stdout:n,exitCode:r}=await R(["git","remote","get-url","origin"],{cwd:e});if(r!==0)return null;let o=n.trim(),s=wRe(o,t);if(s===null)return null;let i=/^\/git\/([a-z]{2,3}[0-9]{6})\.git\/?$/.exec(new URL(o).pathname);return i?{origin:s,datasetId:i[1]}:null}fn();kk();var h1e="Accepted forms: a..b (between), a.. (at least), ..b (at most), or a bare number (exact).";class sC extends Error{facet;badTokens;constructor(e,t){super(`Invalid value${t.length>1?"s":""} for ${e.flag}: ${t.map((n)=>`"${n}"`).join(", ")} -- must be one of: ${(e.enumValues??[]).join(", ")}`);this.facet=e;this.badTokens=t;this.name="FacetEnumCliError"}}function CPt(e){switch(e.valueKind){case"enum":return"<values>";case"text":return"<text>";case"version":return"<version>";default:return"<range>"}}function Eq(e){for(let t of $a)e.addOption(new tm(`${t.flag} ${CPt(t)}`,VZ(t)));return e}function APt(e){return new tm(e.flag).attributeName()}function OPt(e,t){if(e!==null&&t!==null&&e===t)return String(e);return`${e??""}..${t??""}`}function TPt(e,t){switch(e.valueKind){case"number":case"bytes":case"duration":{let n=YRe(t,e.valueKind);return OPt(n.min,n.max)}case"enum":{let n=new Set(e.enumValues??[]),r=t.split(",").map((s)=>s.trim().toLowerCase()).filter((s)=>s!==""),o=[...new Set(r.filter((s)=>!n.has(s)))];if(o.length>0)throw new sC(e,o);return r.join(",")}case"text":case"version":return t}}function g1e(e){let t={};for(let n of $a){let r=e[APt(n)];if(r===void 0||r===null||r==="")continue;t[n.queryParam]=TPt(n,String(r))}return t}function Sq(e,t){let n=$a.filter((r)=>(t[r.key]??0)>0).map((r)=>`${r.key} ${t[r.key]}`).join(", ");return`note: ${e} datasets excluded for unknown values - ${n}
|
|
2007
2007
|
(a dataset can be unknown in more than one field; --include-unknown keeps them)`}di();Vi();xg();pc();jr();He();HD();yo();import{existsSync as y1e,mkdirSync as b1e,readFileSync as PPt,writeFileSync as w1e}from"fs";import{dirname as _1e,join as iC}from"path";zD();HD();zD();var x1e=".nemar/http-snapshot.json",IPt=".nemar/http-download-failures.txt";function v1e(){return`${Ir().replace(/\/+$/,"")}/data`}class Pc extends Error{}async function k1e(e,t,n,r){let o;try{o=await fetch(e,{headers:{Accept:"application/json"}})}catch(a){throw new Pc(`Could not reach the NEMAR data service at ${e}: ${a instanceof Error?a.message:String(a)}`)}if(o.status===404)throw new Pc(r());if(!o.ok)throw new Pc(await NPt(o,n));let s;try{s=await o.json()}catch{let a=o.headers.get("content-type")??"no content-type";throw new Pc(`${n} did not come back as JSON (${a}) from ${e}. A proxy or captive portal may be intercepting the request.`)}let i=t.safeParse(s);if(!i.success||i.data===void 0)throw new Pc(`${n} did not match the expected shape. The data service may be mid-deploy, or this CLI may be too old for it; try upgrading.`);return i.data}async function NPt(e,t){let n={};try{let o=await e.json();if(o!==null&&typeof o==="object")n=o}catch{}let r=typeof n.error==="string"?n.error:null;if(e.status===413){let o=typeof n.listing_url==="string"?n.listing_url:null;return[`${t} was refused (HTTP 413): ${r??"it lists more files than the data service sends in one response."}`,"A plain-HTTP download cannot fetch this version; install git-annex and run the download again without --http, which fetches any version.",o&&!r?.includes(o)?`Its files can be browsed from ${o}`:null].filter((s)=>s!==null).join(" ")}return r?`${t} could not be read (HTTP ${e.status}): ${r}`:`${t} could not be read (HTTP ${e.status}).`}async function E1e(e){let t=await k1e(`${v1e()}/${e}`,Txe,`Dataset ${e}`,()=>`Dataset ${e} is not served over HTTP. The data service carries published, public datasets; a private or not-yet-published dataset has to be downloaded with git-annex.`),n=t.versions.map((r)=>r.version).filter(Boolean);if(n.length===0)throw new Pc(`Dataset ${e} has no published version to download over HTTP. Only published versions are served; use git-annex for an unpublished dataset.`);return{latest:t.latest||n[0],versions:n}}async function S1e(e,t){let n=await k1e(`${v1e()}/${e}/${t}/manifest.json`,Oxe,`Manifest for ${e} ${t}`,()=>`${e} ${t} is published, but its file list is missing from the data service. That is a NEMAR-side gap rather than a permission problem: please report it at https://github.com/nemarOrg/nemar-cli/issues. git-annex can still download this dataset meanwhile.`);if(n.length>0&&!n.some(Hw))throw new Pc(`Manifest for ${e} ${t} lists ${n.length} files but marks none as git-tracked metadata, which cannot be right for a BIDS dataset. Refusing to download a tree that would be missing its sidecars; please report this at https://github.com/nemarOrg/nemar-cli/issues.`);return n}function $1e(e,t,n={}){return e.filter((r)=>{if(n.metadataOnly&&!Hw(r))return!1;if(Hw(r))return!0;return n1e(r.path,t)})}async function D1e(e,t,n={}){let r=e.map((o)=>({path:o.path,url:o.bytes_url,size:o.size}));return VD(r,t,n)}function FPt(e){try{let t=JSON.parse(PPt(iC(e,x1e),"utf8"));if(!t.dataset_id||!t.version)return null;return{dataset_id:t.dataset_id,version:t.version,updated_at:t.updated_at??""}}catch{return null}}function R1e(e,t,n){let r=iC(e,x1e);b1e(_1e(r),{recursive:!0}),w1e(r,`${JSON.stringify({dataset_id:t,version:n,updated_at:new Date().toISOString()},null,2)}
|
|
2008
2008
|
`)}function C1e(e,t,n){if(!y1e(e))return null;if(y1e(iC(e,".git")))return{kind:"git-repo"};let r=FPt(e);if(!r)return null;if(r.dataset_id!==t)return{kind:"other-dataset",datasetId:r.dataset_id};if(r.version!==n)return{kind:"other-version",version:r.version};return null}function A1e(e,t){if(t.length===0)return null;let n=iC(e,IPt);try{return b1e(_1e(n),{recursive:!0}),w1e(n,`${t.join(`
|
|
2009
2009
|
`)}
|
|
2010
2010
|
`),n}catch{return null}}function O1e(e){console.log(u.dim(" This is a file snapshot, not a git repository:")),console.log(u.dim(" - 'nemar dataset commit/push/update' need a git-annex clone, not this copy")),console.log(u.dim(` - to widen the selection, re-run the download into ${e} with`)),console.log(u.dim(" different filters; already-present files are skipped")),console.log(u.dim(" - files are checked against their declared size, but not checksum-verified;")),console.log(u.dim(" the git-annex path verifies content hashes, this one does not"))}function T1e(e,t){let n=e.files??{},r=t.files??{},o=[],s=[],i=[];for(let[a,c]of Object.entries(r)){let l=n[a];if(!l)o.push(a);else if(l.key!==c.key)s.push(a)}for(let a of Object.keys(n))if(!(a in r))i.push(a);return o.sort(),s.sort(),i.sort(),{added:o,changed:s,removed:i}}Vw();Lb();He();function P1e(e){return`${Ut(e)}/s`}function MPt(e){if(e<60)return`${Math.round(e)}s`;if(e<3600)return`${Math.floor(e/60)}m ${Math.round(e%60)}s`;return`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function jPt(e,t=20){let n=Math.round(e/100*t),r=t-n;return`[${"=".repeat(n)}${" ".repeat(r)}]`}class aC{filesCompleted=0;filesTotal;bytesTotal=0;inFlight=new Map;currentFile="";startTime;lastUpdateTime;lastBytesTransferred=0;totalBytesTransferred=0;speedSamples=[];lastRenderedLine="";constructor(e=0,t=0){this.filesTotal=e,this.bytesTotal=t,this.startTime=Date.now(),this.lastUpdateTime=this.startTime}inFlightBytes(){let e=0;for(let t of this.inFlight.values())e+=t.transferred;return e}processLine(e){let t=e.file??e.action?.file;if(e.ok===!0||e.success===!0){this.filesCompleted++;let n=t??this.currentFile,r=n?this.inFlight.get(n):void 0,o=r?r.total||r.transferred:0;if(this.totalBytesTransferred+=o,n)this.inFlight.delete(n);this.render();return}if(e["byte-progress"]!==void 0){let n=t??this.currentFile;if(!n)return;this.currentFile=n;let r=this.inFlight.get(n)??{transferred:0,total:0};if(r.transferred=e["byte-progress"]??r.transferred,e["total-size"]!==void 0)r.total=e["total-size"];this.inFlight.set(n,r);let o=Date.now(),s=(o-this.lastUpdateTime)/1000;if(s>0.5){let i=this.totalBytesTransferred+this.inFlightBytes(),c=(i-this.lastBytesTransferred)/s;if(c>0){if(this.speedSamples.push(c),this.speedSamples.length>5)this.speedSamples.shift()}this.lastBytesTransferred=i,this.lastUpdateTime=o}this.render()}}incrementFilesCompleted(){this.filesCompleted++}setFilesTotal(e){this.filesTotal=e}setBytesTotal(e){this.bytesTotal=e}getPercent(){let e=this.totalBytesTransferred+this.inFlightBytes();if(this.bytesTotal>0)return Math.min(100,Math.round(e/this.bytesTotal*100));if(this.filesTotal>0)return Math.min(100,Math.round(this.filesCompleted/this.filesTotal*100));return null}getProgress(){return{filesCompleted:this.filesCompleted,filesTotal:this.filesTotal,bytesTransferred:this.totalBytesTransferred+this.inFlightBytes(),bytesTotal:this.bytesTotal,currentFile:this.currentFile||void 0}}render(){let e=this.speedSamples.length>0?this.speedSamples.reduce((i,a)=>i+a,0)/this.speedSamples.length:0,t=this.totalBytesTransferred+this.inFlightBytes(),n=0,r=!1;if(this.bytesTotal>0)n=Math.min(100,Math.round(t/this.bytesTotal*100)),r=!0;else if(this.filesTotal>0)n=Math.min(100,Math.round(this.filesCompleted/this.filesTotal*100)),r=!0;let o=this.filesTotal>0?`${this.filesCompleted}/${this.filesTotal} files`:`${this.filesCompleted} files`,s;if(r)s=`${jPt(n)} ${n}% ${o}`;else s=o;if(t>0){let i=this.bytesTotal>0?`${Ut(t)}/${Ut(this.bytesTotal)}`:Ut(t);s+=` | ${i}`}if(e>0)s+=` | ${P1e(e)}`;if(e>0){let i=0;if(this.bytesTotal>0)i=Math.max(0,this.bytesTotal-t);else for(let a of this.inFlight.values())if(a.total>a.transferred)i+=a.total-a.transferred;if(i>0){let a=i/e;if(a>0)s+=` | ETA ${MPt(a)}`}}if(s!==this.lastRenderedLine)process.stderr.write(`\r${u.cyan(s)}${" ".repeat(10)}`),this.lastRenderedLine=s}finish(e){let t=(Date.now()-this.startTime)/1000;if(process.stderr.write(`\r${" ".repeat(this.lastRenderedLine.length+15)}\r`),e>0){let n=t>0?`${P1e(this.totalBytesTransferred/t)}`:"",r=[`${e} file${e!==1?"s":""} downloaded`,this.totalBytesTransferred>0?Ut(this.totalBytesTransferred):"",n].filter(Boolean).join(" | ");process.stderr.write(`${u.green(r)}
|
|
2011
|
-
`)}}}Z0();ze();function I1e(e){return e instanceof L&&e.statusCode===422&&e.rawBody?.status==="blocked"&&dk(e.blockReason)}function N1e(e){let t=e.rawBody?.ci_url;return typeof t==="string"&&/^https:\/\/\S+$/.test(t)?t:void 0}function $
|
|
2011
|
+
`)}}}Z0();ze();function I1e(e){return e instanceof L&&e.statusCode===422&&e.rawBody?.status==="blocked"&&dk(e.blockReason)}function N1e(e){let t=e.rawBody?.ci_url;return typeof t==="string"&&/^https:\/\/\S+$/.test(t)?t:void 0}function $q(e){return e==="bids_validation_in_progress"?"Request recorded: BIDS validation is still running.":"Request recorded: BIDS validation has not started yet."}function Dq(e,t=!1){let n=`nemar dataset publish request ${e}${t?" --anonymous":""}`;return[" Your request is recorded. NEMAR re-checks it automatically and continues once validation passes.",` If you would rather not wait for that, check validation with: nemar dataset ci ${e}`,` Once it has passed, request again: ${n}`," If it says a request already exists, nothing more is needed."," If validation fails or a submission minimum fails, the request stays blocked and nothing is emailed:",` check nemar dataset ci ${e} or nemar dataset publish status ${e}.`]}ze();xr();async function cC(){let e=zt().sandboxCompleted;if(e!==void 0)return{status:e?"completed":"not_completed"};try{let t=await WS();if(Tn("sandboxCompleted",t.sandbox_completed),t.sandbox_dataset_id)Tn("sandboxDatasetId",t.sandbox_dataset_id);return t.sandbox_completed?{status:"completed"}:{status:"not_completed"}}catch(t){return{status:"unknown",reason:G(t)}}}He();di();Z6();He();uo();rc();ze();bp();CD();Jf();di();Ui();PD();nM();jd();wp();import{existsSync as Rq,mkdirSync as LPt,readFileSync as qPt,statSync as BPt,writeFileSync as F1e}from"fs";import{join as UPt,resolve as Cq}from"path";function M1e(e,t,n){if(!Ji(n,"metadata_write")){if(t)try{let r=Cq(e,".nemar"),o=Cq(r,"metadata.json");if(!Rq(o)){if(!Rq(r))LPt(r,{recursive:!0});F1e(o,JSON.stringify(t,null,2))}let s=Cq(e,".bidsignore"),i="";if(Rq(s))i=qPt(s,"utf-8");if(!i.includes(".nemar/")){let a=i?`${i.trimEnd()}
|
|
2012
2012
|
.nemar/
|
|
2013
2013
|
`:`.nemar/
|
|
2014
|
-
`;F1e(s,a)}console.log(u.dim(" Updated .bidsignore for NEMAR metadata"))}catch(r){console.log(u.yellow(` Warning: Could not update .bidsignore: ${G(r)}`)),console.log(u.dim(" Upload will continue without author enrichment."))}vl(n,"metadata_write"),qr(e,n)}else console.log(u.dim(" Metadata write already completed (skipping)"))}var j1e=1073741824;function HPt(e,t,n=j1e){let r=[],o=0;for(let s of t){let i=e.files[s];if(!i||i.mtimeMs===void 0)continue;r.push({path:s,size:i.size,mtimeMs:i.mtimeMs}),o+=i.size}return o>=n?r:null}function VPt(e,t){return t.filter((n)=>{try{return Fo(n.path,BPt(UPt(e,n.path)).size)}catch{return!0}})}function zPt(e){let t=0;for(let n of Object.values(e.files))t+=n.size;return t}function GPt(e){return["Warning: saving dataset changes has produced no stdout or stderr for",`${ID(e)}. git add -A is still running.`,"Wait, or interrupt and rerun the upload; the save step will run again."].join(" ")}async function L1e(e,t,n,r={}){if(!Ji(n,"dataset_save")){let o=D({text:"Saving dataset changes...",...r.spinnerStream?{stream:r.spinnerStream}:{}}).start(),s=r.skipMinBytes??j1e,i=[];if(zPt(n)>=s){let c=r.annexedPaths??null;if(c===null)try{c=await Md(e)}catch(l){console.log(u.dim(` Could not list annexed files (${G(l)}); staging will re-read them`))}if(c!==null)i=VPt(e,HPt(n,c,s)??[])}let a=await pl(e,"Initial NEMAR dataset upload",t,{skipContentCheck:i,onInactivityWarning:(c)=>{o=Fw(o,GPt(c))},...r.inactivityWarningAfterMs===void 0?{}:{inactivityWarningAfterMs:r.inactivityWarningAfterMs}});if(!a.success)return qr(e,n),_o(o,"Failed to save dataset",a.error),console.log(),console.log(u.yellow("Re-run the same command to resume from this step.")),Ne;if(r.verifyRemote){let c;try{c=await lM(e,r.verifyRemote)}catch(l){return qr(e,n),_o(o,"Could not confirm the saved files are at the S3 remote",l),console.log(),console.log(u.yellow("Re-run the same command to resume from this step.")),Ne}if(c.length>0){kl(n,"s3_upload"),qr(e,n);let l=XS(c.slice(0,5)),d=c.length>5?` (and ${c.length-5} more)`:"";return _o(o,"Saved files are not at the S3 remote",`${c.length} annexed file(s) in the commit are not recorded at the remote: ${l}${d}. The save itself annexed them, after the upload step had run.`),console.log(),console.log(u.yellow("Re-run the same command: it uploads them and saves again.")),Ne}}o.succeed("Dataset changes saved"),vl(n,"dataset_save"),qr(e,n)}else console.log(u.dim(" Dataset save already completed (skipping)"));return mn()}async function q1e(e,t){if(!Ji(t,"github_push")){let n=D("Pushing metadata to GitHub...").start(),r=await ur(e);if(!r.success)return qr(e,t),_o(n,"Failed to push to GitHub",r.error),console.log(),console.log(u.yellow("Re-run the same command to resume from this step.")),Ne;if(r.warning)n.warn("Metadata pushed to GitHub (with warning)"),console.log(u.yellow(` ${r.warning}`));else n.succeed("Metadata pushed to GitHub");vl(t,"github_push"),qr(e,t)}else console.log(u.dim(" GitHub push already completed (skipping)"));return mn()}async function B1e(e,t,n){if(!Ji(n,"ci_deploy")){let r=D("Setting up BIDS validation CI...").start(),o="configured";try{await dl(t),r.succeed("BIDS validation CI configured")}catch(s){if(o="not-configured",s instanceof L&&s.statusCode===403)r.info("CI workflow will be configured by an admin");else{let i=s instanceof Error?s.message:String(s);r.warn(`Could not configure CI: ${i}`),console.log(u.dim(` An admin can add it later with: nemar admin ci add ${t}`))}}return vl(n,"ci_deploy"),qr(e,n),o}return console.log(u.dim(" CI deploy already completed (skipping)")),"unknown"}function WPt(e,t){let n=e.startsWith("xx");if(t==="not-configured"){if(n)return;console.log("BIDS validation is not set up yet."),console.log(` CI is set up when you request publication: ${u.cyan(`nemar dataset publish request ${e}`)}`),console.log();return}if(console.log("BIDS validation runs on GitHub after the upload."),console.log(` Check it with: ${u.cyan(`nemar dataset ci ${e}`)}`),!n)console.log(` Once it has passed, request publication: ${u.cyan(`nemar dataset publish request ${e}`)}`);console.log()}function U1e(e,t,n="unknown"){Nw(e),R_e(e),console.log(),console.log(u.green.bold("Upload complete!")),console.log(),console.log(` Dataset ID: ${u.cyan(t.dataset_id)}`),console.log(` GitHub: ${u.cyan(t.github_url)}`),console.log(),console.log(u.dim("To download this dataset:")),console.log(u.dim(` nemar dataset download ${t.dataset_id}`)),console.log(),WPt(t.dataset_id,n),console.log(u.yellow("Note: This dataset is private. Only the owner and designated collaborators can")),console.log(u.yellow("download it, and only through the NEMAR CLI (not direct git-annex commands).")),console.log(u.yellow("After publishing, the data will be publicly available for everyone."))}jd();wp();async function H1e(e,t={}){let n=await xge(e.absolutePath);if(!n.success)return console.log(u.red(n.error)),console.log(u.yellow("Re-run the same command to retry.")),Ne;if(n.cleared>0)console.log(u.yellow(` Cleared ${n.cleared} assume-unchanged flag(s) an earlier, interrupted save left on annexed files`));let r=await I_e(e.absolutePath);if(r.status==="error")return console.log(u.red(r.error)),Ne;if(r.status==="warning")console.log(u.yellow(` ${r.warning}`));if(r.status==="restored")console.log(u.yellow(" Put back git-annex's filter process, which an earlier, interrupted upload had left out of this repository's configuration"));let o=await pxe(e.absolutePath,e.options,e.dataFiles,e.filesToUpload,e.uploadProgress,e.datasetInfo,{openRemote:t.openRemote,...t.primeMinBytes===void 0?{}:{primeMinBytes:t.primeMinBytes},...t.primeOnSuspended?{primeOnSuspended:t.primeOnSuspended}:{}});if(o.status==="fail")return Ne;let{progress:s,annexedPaths:i}=o.value;if(M1e(e.absolutePath,e.coAuthorEnrichment,s),(await(t.saveStep??L1e)(e.absolutePath,e.author,s,{annexedPaths:i,verifyRemote:wc,...t.skipMinBytes===void 0?{}:{skipMinBytes:t.skipMinBytes},...t.saveInactivityWarningAfterMs===void 0?{}:{inactivityWarningAfterMs:t.saveInactivityWarningAfterMs},...t.saveSpinnerStream===void 0?{}:{spinnerStream:t.saveSpinnerStream}})).status==="fail")return Ne;return mn(s)}He();_l();Fp();Ow();fn();qt();import{randomBytes as CIt}from"crypto";import{constants as N3,accessSync as AIt,chmodSync as OIt,chownSync as TIt,closeSync as L3,copyFileSync as PIt,existsSync as mCe,fsyncSync as hCe,lstatSync as Ic,mkdirSync as IIt,mkdtempSync as NIt,openSync as q3,readSync as FIt,readdirSync as MIt,renameSync as jIt,rmSync as B3,rmdirSync as LIt,statSync as gCe,writeSync as qIt}from"fs";import{tmpdir as BIt}from"os";import{dirname as hC,join as ia}from"path";He();import{lstatSync as xIt,readdirSync as vIt,statSync as nCe}from"fs";import{open as kIt}from"fs/promises";import{join as tCe}from"path";Qs();uo();_l();var K1e="nemar-identifier-scan/1.0 (+https://docs.nemar.org/policies/takedown/)",KPt="https://nemar-api-dev.sccn-org.workers.dev",JPt="https://data.nemar.org",YPt="https://nemar.s3.us-east-2.amazonaws.com",XPt="https://api.github.com";function fC(e,t){if(!Number.isSafeInteger(t)||t<1)throw RangeError(`${e} must be a positive integer, got ${t}`)}async function lC(e,t,n){fC("pool size",t);let r=0,o=Array.from({length:Math.min(t,e.length)},async()=>{while(r<e.length){let a=e[r++];await n(a)}}),i=(await Promise.allSettled(o)).find((a)=>a.status==="rejected");if(i)throw i.reason}function QPt(e){fC("limit",e);let t=0,n=[];return async(r)=>{if(t>=e)await new Promise((o)=>n.push(o));else t++;try{return await r()}finally{let o=n.shift();if(o)o();else t--}}}class Zn extends Error{cls;status;retryable;retryAfterMs;constructor(e,t={}){super(e);this.name="ReadFailure",this.cls=e,this.status=t.status,this.retryable=t.retryable??!1,this.retryAfterMs=t.retryAfterMs}}function ZPt(e,t=Date.now()){let n=e?.trim();if(!n)return;if(/^\d+$/.test(n))return Number(n)*1000;let r=Date.parse(n);return Number.isNaN(r)?void 0:Math.max(0,r-t)}function eIt(e,t){let n=e>=500||e===429;return new Zn(`http-${e}`,{status:e,retryable:n,retryAfterMs:n?ZPt(t):void 0})}class A3 extends Error{constructor(e){super(e);this.name="RunAborted"}}function tIt(e){fC("abort streak",e.streak);let t=e.now??Date.now,n={tripped:null},r=(o)=>{let s=0,i=0,a=(c)=>{throw n.tripped=new A3(c),n.tripped};return{check(){if(n.tripped)throw n.tripped},ok(){s=0},pausedUntilMs(){return i},observe(c){if(n.tripped)throw n.tripped;if(c.retryAfterMs!==void 0&&c.retryAfterMs>e.retryAfterCapMs)a(`${o} asked to wait ${Math.round(c.retryAfterMs/1000)} s (Retry-After), over the ${Math.round(e.retryAfterCapMs/1000)} s cap (${c.cls})`);if(c.retryAfterMs!==void 0)i=Math.max(i,t()+c.retryAfterMs);if(!c.retryable){s=0;return}if(s++,s>=e.streak)a(`${s} consecutive 429, 5xx, timeout or network failures from ${o} (last ${c.cls})`)}}};return{worker:r("the Worker"),direct:r("direct reads")}}function V1e(e){let t=e instanceof Error?e.name:"";return new Zn(t==="TimeoutError"||t==="AbortError"?"timeout":"network",{retryable:!0})}function nIt(e){if(e instanceof Zn)return e.cls;return`error-${e instanceof Error?e.name:"unknown"}`}async function rIt(e,t={}){let n=t.tries??3,r=t.baseMs??400,o=t.sleep??((s)=>new Promise((i)=>setTimeout(i,s)));fC("tries",n);for(let s=1;;s++)try{return await e()}catch(i){if(!(i instanceof Zn&&i.retryable)||s>=n)throw i;let c=i.retryAfterMs??0;if(c>(t.retryAfterCapMs??30000))throw i;await o(Math.max(r*2**(s-1),c))}}async function oIt(e){await e.body?.cancel().catch(()=>{return})}async function sIt(e,t,n={}){let r;try{r=await fetch(e,{headers:{Range:`bytes=0-${t-1}`,"Accept-Encoding":"identity","User-Agent":n.userAgent??K1e},signal:AbortSignal.timeout(n.timeoutMs??30000)})}catch(a){throw V1e(a)}if(r.status!==200&&r.status!==206)throw await oIt(r),eIt(r.status,r.headers.get("retry-after"));let o=r.body?.getReader();if(!o)throw new Zn("no-body");let s=new Uint8Array(t),i=0;try{while(i<t){let{done:a,value:c}=await o.read();if(a||!c)break;let l=Math.min(c.length,t-i);s.set(c.subarray(0,l),i),i+=l}}catch(a){throw V1e(a)}finally{await o.cancel().catch(()=>{return})}if(i<(n.minBytes??0))throw new Zn("short-body");return s.subarray(0,i)}var J1e={sideFileBytes:2097152,participantsBytes:16777216};function iIt(e,t){let n=/An error occurred \(([A-Za-z0-9]{1,40})\)/.exec(e)?.[1];if(n)return/^\d+$/.test(n)?`aws/http-${n}`:`aws/error-${n}`;return`aws/exit-${t}`}async function aIt(e,t,n={}){let r;try{let o=Bun.spawn(["aws","s3","cp",`s3://nemar/${e}/version/${t}.json`,"-"],{stdout:"pipe",stderr:"pipe",...n.env?{env:n.env}:{}}),s=!1;r=setTimeout(()=>{s=!0,o.kill("SIGKILL")},n.timeoutMs??600000);let[i,a,c]=await Promise.all([new Response(o.stdout).text(),new Response(o.stderr).text(),o.exited]);if(s)throw new Zn("aws/timeout");if(c!==0)throw new Zn(iIt(a,c));return i}catch(o){if(o instanceof Zn)throw o;throw new Zn("aws/unavailable")}finally{clearTimeout(r)}}function cIt(){let e;return async()=>{if(e!==void 0)return e;if(process.env.GITHUB_TOKEN)return e=process.env.GITHUB_TOKEN,e;try{let t=Bun.spawn(["gh","auth","token"],{stdout:"pipe",stderr:"ignore"}),n=(await new Response(t.stdout).text()).trim();e=n===""?null:n}catch{e=null}return e}}var uC=(e)=>e.replace(/\/+$/,"");function Y1e(e={}){let t=e.retryAfterCapMs??30000,n=e.awsTimeoutMs??600000;return{api:uC(e.api??process.env.NEMAR_API_BASE??KPt),data:uC(e.data??process.env.NEMAR_DATA_BASE??JPt),s3Base:uC(e.s3Base??YPt),githubApi:uC(e.githubApi??XPt),userAgent:e.userAgent??K1e,fileConcurrency:e.fileConcurrency??24,workerLimit:QPt(e.workerConcurrency??6),timeoutMs:e.timeoutMs??30000,manifestTimeoutMs:e.manifestTimeoutMs??120000,retryBaseMs:e.retryBaseMs??400,sleep:e.sleep??((r)=>new Promise((o)=>setTimeout(o,r))),now:e.now??Date.now,retryAfterCapMs:t,breakers:tIt({streak:e.abortStreak??25,retryAfterCapMs:t,now:e.now??Date.now}),limits:{treeHeaderSample:300,scansTables:1,jsonFiles:300,textFiles:300,sideFileBytes:65536,participantsBytes:1048576,...e.limits},readVersionManifest:e.readVersionManifest??((r,o)=>aIt(r,o,{timeoutMs:n,env:e.awsEnv})),githubToken:e.githubToken??cIt(),...e.readEntryHead?{readEntryHead:e.readEntryHead}:{}}}var X1e=(e,t)=>t.startsWith(`${e.data}/`),lIt=(e,t)=>X1e(e,t)||t.startsWith(`${e.api}/`)?e.breakers.worker:e.breakers.direct;async function uIt(e,t,n){let r=lIt(e,t);r.check();let o=r.pausedUntilMs()-e.now();if(o>0)await e.sleep(o),r.check();try{let s=await n();return r.ok(),s}catch(s){if(s instanceof Zn)r.observe(s);throw s}}var dIt=(e,t)=>({...t===void 0?{}:{tries:t},baseMs:e.retryBaseMs,sleep:e.sleep,retryAfterCapMs:e.retryAfterCapMs});var z1e=(e)=>/sub-([^/_]+)/.exec(e)?.[1]??"?";function G1e(e,t,n){if(t<1)return[];if(e.length<=t)return[...e];let r=new Map;for(let c of e){let l=n(c),d=r.get(l);if(d)d.push(c);else r.set(l,[c])}let o=[...r.entries()].sort(([c],[l])=>c<l?-1:c>l?1:0).map(([,c])=>c);if(o.length>t)return Array.from({length:t},(c,l)=>o[Math.floor((l+0.5)*o.length/t)][0]);let s=o.map((c,l)=>({list:c,index:l})).sort((c,l)=>c.list.length-l.list.length||c.index-l.index),i=t,a=[];return s.forEach(({list:c},l)=>{let d=Math.min(c.length,Math.ceil(i/(s.length-l)));for(let f=0;f<d;f++)a.push(c[Math.floor((f+0.5)*c.length/d)]);i-=d}),a}var fIt=(e)=>e.severity==="identifier"&&Dwe.has(e.kind),pIt=(e)=>pp.has(e.kind);function Q1e(e){return e.headerRead===e.edfCount&&e.incompleteReasons.length===0}function mIt(e){if(e.findings.some(fIt))return"direct-identifiers";if(e.findings.some((t)=>!pIt(t)))return"review";if(!Q1e(e))return"unchecked";if(e.edfCount>0&&e.unscreenedCount>0)return"clean-edf-only-others-unscreened";if(e.edfCount===0)return e.unscreenedCount>0?"not-screened":"no-recordings";return e.findings.length>0?"dates-only":"clean"}var hIt=/\.(edf|bdf)$/i,gIt=(e)=>e.edf===!0||hIt.test(e.path);function yIt(e){return{edf:e.filter(gIt),participants:e.find((t)=>t.path==="participants.tsv"),scans:e.filter((t)=>t.path.endsWith("_scans.tsv")),json:e.filter((t)=>t.path.endsWith(".json")).filter((t)=>t.path.startsWith("sourcedata/")||!bIt.test(t.path)).filter((t)=>!wIt.test(t.path)),text:e.filter((t)=>_It.test(t.path)).filter((t)=>t.path.startsWith("sourcedata/")||t.path.startsWith("code/"))}}var bIt=/_(eeg|ieeg|meg|emg|nirs|beh|events|channels|electrodes|coordsystem|scans|physio|stim|photo|T1w|bold)\.(json|tsv)$/,wIt=/(^|\/)(dataset_description|participants|genetic_info)\.json$/,_It=/\.(py|m|r|txt|md|ya?ml|xml|iml|cfg|ini)$/i;function Z1e(e,t,n,r=0){let o=()=>uIt(e,t.url,()=>{let s={minBytes:r,userAgent:e.userAgent,timeoutMs:e.timeoutMs};return e.readEntryHead?e.readEntryHead(t,n,s):sIt(t.url,n,s)});return rIt(()=>X1e(e,t.url)?e.workerLimit(o):o(),dIt(e))}async function dC(e,t,n){let r=await Z1e(e,t,n),o=t.size===null?r.length>=n:t.size>n;return{text:new TextDecoder("utf-8",{fatal:!1}).decode(r),truncated:o}}function Ty(e,t){for(let n of t)e.push(n)}var W1e="edf/superseded-absent";async function eCe(e,t,n,r,o,s={}){let i=r.map((Ce)=>Ce.path),a=o==="clone",c=(Ce,st,Fn)=>a?[...Ce]:G1e(Ce,st,Fn),l=[...hD([...i,...s.extraPaths??[]])],d=jwe(i),f=Object.values(d.unscreened).reduce((Ce,st)=>Ce+st,0),p={},m=(Ce,st)=>{if(st instanceof A3)throw st;let Fn=`${Ce}/${nIt(st)}`;p[Fn]=(p[Fn]??0)+1},h=(Ce)=>z1e(Ce.path),g=yIt(r),y=new Set(s.supersededEdf??[]),b=[...g.edf,...y],{participants:_,scans:x,json:k,text:v}=g,C=o==="git-tree"?G1e(b,e.limits.treeHeaderSample,h):[...b],T=0,V=0,A=0,F=0,M={},U=new Set,B=new Set,P=new Set,O=new Set,H=new Set,re=new Set;await lC(C,e.fileConcurrency,async(Ce)=>{try{let st=await Z1e(e,Ce,kt,kt),Fn=Td(st),{patient:Gl}=pD(st);if(!Fn.some((ws)=>ws.kind==="edf-unreadable")){U.add(Gl);let ws=Gl.split(/\s+/);if(ws.length>=4)P.add(ws[0]),H.add(ws[2]),O.add(ws[3])}if(re.add(z1e(Ce.path)),Fn.some((ws)=>ws.severity==="identifier"))F++,B.add(Gl);Ty(l,Fn);for(let ws of new Set(Fn.map((Iy)=>Iy.kind)))M[ws]=(M[ws]??0)+1;T++}catch(st){if(y.has(Ce)&&st instanceof Zn&&st.status===404){A++,p[W1e]=(p[W1e]??0)+1;return}V++,m("edf",st)}});let Ee=b.length-A,Zt=!1,pt=!1;if(_&&_.size!==0)try{let{text:Ce,truncated:st}=await dC(e,_,e.limits.participantsBytes),Fn=Ce.indexOf(`
|
|
2015
|
-
`);if(Fn<0&&st)throw new Zn("header-truncated");Ty(l,Iwe(Fn<0?Ce:Ce.slice(0,Fn))),Ty(l,Fwe(Ce)),pt=st}catch(Ce){Zt=!0,m("participants",Ce)}let Ze=c(x,e.limits.scansTables,h),oe=0;await lC(Ze,e.fileConcurrency,async(Ce)=>{if(Ce.size===0){oe++;return}try{let{text:st}=await dC(e,Ce,e.limits.sideFileBytes);Ty(l,mD(st)),oe++}catch(st){m("scans",st)}});let je=e.limits.sideFileBytes,Ie=(Ce)=>Ce.size!==null&&Ce.size>je,Q=c(k.filter((Ce)=>!Ie(Ce)),e.limits.jsonFiles,h),mt=c(v.filter((Ce)=>!Ie(Ce)),e.limits.textFiles,h),Ue=0,W=0;await lC(Q,e.fileConcurrency,async(Ce)=>{if(Ce.size===0){Ue++;return}try{let{text:st}=await dC(e,Ce,je),Fn;try{Fn=JSON.parse(st)}catch{throw new Zn("json-parse")}Ty(l,fp(Fn)),Ue++}catch(st){m("json",st)}}),await lC(mt,e.fileConcurrency,async(Ce)=>{if(Ce.size===0){W++;return}try{let{text:st}=await dC(e,Ce,je);Ty(l,Mwe(st)),W++}catch(st){m("text",st)}});let J={edf_headers:{candidates:Ee,oversize:0,selected:C.length-A,scanned:T},scans_tables:{candidates:x.length,oversize:0,selected:Ze.length,scanned:oe},json_files:{candidates:k.length,oversize:k.filter(Ie).length,selected:Q.length,scanned:Ue},text_files:{candidates:v.length,oversize:v.filter(Ie).length,selected:mt.length,scanned:W}},le=new Set,ne=(Ce,st)=>{if(st.oversize>0)le.add(`${Ce}-oversize`);if(st.candidates-st.oversize>st.selected)le.add(`${Ce}-sampled`);if(st.scanned<st.selected)le.add(`${Ce}-unread`)};if(ne("edf-headers",J.edf_headers),ne("json",J.json_files),ne("text",J.text_files),J.scans_tables.scanned<J.scans_tables.selected)le.add("scans-unread");if(Zt)le.add("participants-unread");if(pt)le.add("participants-truncated");for(let Ce of s.extraIncompleteReasons??[])le.add(Ce);let Le=[...le].sort(),It={findings:l,edfCount:Ee,headerRead:T,unscreenedCount:f,incompleteReasons:Le},wr=l.filter((Ce)=>Ce.severity==="identifier"),Fc=Object.entries(p).filter(([Ce])=>!Ce.startsWith("edf/")).reduce((Ce,[,st])=>Ce+st,0);return{id:t,version:n,scanned_at:new Date().toISOString(),manifest_source:o,status:mIt(It),incomplete:!Q1e(It),incomplete_reasons:Le,files:{total:r.length,edf_bdf:Ee,header_read:T,header_read_failed:V},sampling:J,read_failures:p,edf_bdf_files_flagged:F,distinct_patient_field_values:U.size,distinct_subjects_with_edf_bdf:re.size,distinct_patient_code_subfield:P.size,distinct_patient_name_subfield:O.size,distinct_patient_birth_subfield:H.size,distinct_patient_field_values_in_flagged_files:B.size,findings_by_kind:Lwe(l),edf_bdf_files_by_kind:M,unscreened_formats:d.unscreened,side_reads_failed:Fc,finding_fields:[...new Set(wr.map((Ce)=>`${Ce.kind}:${Ce.field}`))].sort()}}Fp();fn();Hf();wp();var Wp="--acknowledge-identifier-preflight",EIt=16,SIt="local:";function
|
|
2016
|
-
Upload cancelled. Nothing was sent.`)),ce(),process.exit(130)};process.once("SIGINT",m);let h=setInterval(()=>{return},1000);try{({acknowledged:p}=await Ae.prompt([{type:"confirm",name:"acknowledged",message:"Upload anyway?",default:!1}]))}catch{p=!1}finally{clearInterval(h),process.off("SIGINT",m)}if(p!==!0)return console.log(u.red(" Upload cancelled. Nothing was sent.")),ce(),Ne;console.log(u.dim(" Acknowledged at the prompt.")),d="prompt";break}case"refuse":return iCe(),ce(),Ne;case"stop":if(l.why==="acknowledgment-mismatch")console.log(u.red(` ${Wp} must name exactly what was found, which is: ${c.join(",")}. It does not acknowledge this scan. Nothing was sent.`));else T3(c),console.log(u.red(l.why==="declined"?" Declined (--no). Nothing was sent.":` No terminal to ask at: run interactively, or pass ${O3(c)}. --yes does not acknowledge a finding. Nothing was sent.`));return ce(),Ne}let f=lCe(a,d);if(f.status==="ok")console.log();return f}async function dCe(e,t){let n=D("Screening again, right before anything is sent...").start(),r;try{r=await rCe(e)}catch(a){return cCe(n,a),Ne}let o=Jd(r.status);if(o!=="clear"&&o!=="acknowledge")return pC(n,r),iCe(),ce(),Ne;let s=mC(t.scan),i=mC(r);if(!oCe(s,i))return pC(n,r),console.log(u.red(` The files changed since the preflight, and so did what it found (acknowledged: ${s.join(",")||"nothing"}; now: ${i.join(",")}). Nothing was sent. Run the upload again.`)),ce(),Ne;if(WR(r.findings_by_kind)!==WR(t.scan.findings_by_kind))pC(n,r," (screened again)");else n.succeed(`${Tj(r,null).headline} (screened again)`);return lCe(r,t.acknowledged_via)}var UIt=/\.(edf|bdf)$/i,yCe=ia(".nemar","date-normalization"),HIt=()=>({tracked:0,"nested-repository":0,ignored:0,"tracking-unknown":0,link:0,"not-writable":0,"other-filesystem":0,unverified:0});function VIt(){return{items:[],left:HIt()}}function zIt(e){if(process.env.GIT_DIR||process.env.GIT_WORK_TREE)return!0;for(let t=e;;t=hC(t)){if(mCe(ia(t,".git")))return!0;if(hC(t)===t)return!1}}var F3=(e)=>e.normalize("NFC").toLowerCase();async function I3(e,t,n){try{let r=await R(e,{cwd:t,...n===void 0?{}:{stdin:n}});if(!(r.exitCode===0||e.includes("check-ignore")&&r.exitCode===1))return null;return new Set(r.stdout.split("\x00").filter(Boolean).map(F3))}catch{return null}}async function GIt(e,t){let n=`${t.join("\x00")}\x00`;if(zIt(e)){let o=await I3(["git","ls-files","-z"],e),s=await I3(["git","check-ignore","-z","--stdin"],e,n);return o&&s?{tracked:o,ignored:s}:null}let r=null;try{if(r=NIt(ia(BIt(),"nemar-ignore-")),(await R(["git","init","-q","--bare",r],{cwd:e})).exitCode!==0)return null;let s=await I3(["git",`--git-dir=${r}`,`--work-tree=${e}`,"check-ignore","--no-index","-z","--stdin"],e,n);return s?{tracked:new Set,ignored:s}:null}catch{return null}finally{if(r!==null)try{B3(r,{recursive:!0,force:!0})}catch{}}}function M3(e){let t;try{t=q3(e,"r")}catch{return null}try{let n=new Uint8Array(kt),r=0;while(r<kt){let o=FIt(t,n,r,kt-r,r);if(o===0)break;r+=o}return r===kt?n:null}catch{return null}finally{try{L3(t)}catch{}}}var fCe=(e,t)=>e!==null&&e.length===t.length&&e.every((n,r)=>n===t[r]);function pCe(e){try{return AIt(e,N3.W_OK),!0}catch{return!1}}function WIt(e,t,n){let r=t.split("/").slice(0,-1);for(let o=1;o<=r.length;o++){let s=r.slice(0,o).join("/"),i=n.get(s);if(i===void 0){i=mCe(ia(e,s,".git"));try{i||=Ic(ia(e,s,".git")).isSymbolicLink()}catch{}n.set(s,i)}if(i)return!0}return!1}async function bCe(e){let t=VIt();try{await KIt(e,t)}catch(n){$n(`date normalization: planning stopped (${n instanceof Error?n.name:"unknown"})`)}return t}async function KIt(e,t){let n=gCe(e).dev,r=P3(e),o=[];for(let c of r.entries){if(!UIt.test(c.path))continue;let l=r.readable.get(c.url);if(l===void 0)continue;let d=M3(l);if(d===null)continue;try{let f=H6(d);if(f.changed)o.push({path:l,rel:c.path,before:d,after:f.header})}catch(f){if(f instanceof Nd)continue;t.left.unverified++,$n(`date normalization: a header was not planned (${f instanceof Error?f.name:"unknown"})`)}}if(o.length===0)return;let s=await GIt(e,o.map((c)=>c.rel)),i=new Map,a=typeof process.getuid==="function"?process.getuid():null;for(let c of o){if(s===null){t.left["tracking-unknown"]++;continue}if(s.tracked.has(F3(c.rel))){t.left.tracked++;continue}if(WIt(e,c.rel,i)){t.left["nested-repository"]++;continue}if(s.ignored.has(F3(c.rel))){t.left.ignored++;continue}let l;try{l=Ic(c.path)}catch{continue}if(l.isSymbolicLink()){t.left.link++;continue}if(!l.isFile())continue;if(l.dev!==n){t.left["other-filesystem"]++;continue}if(a!==null&&l.uid!==a||(l.mode&128)===0||!pCe(c.path)||!pCe(hC(c.path))){t.left["not-writable"]++;continue}t.items.push({path:c.path,rel:c.rel,dev:l.dev,ino:l.ino,size:l.size,mtimeMs:l.mtimeMs,mode:l.mode,gid:l.gid,before:c.before,after:c.after})}}var JIt=/^\d+-[0-9a-f]{16}$/;function YIt(e){try{let t=ia(e,yCe);for(let n of[ia(e,".nemar"),t])if(!Ic(n).isDirectory())return;for(let n of MIt(t))if(JIt.test(n))B3(ia(t,n),{force:!0})}catch{}}function j3(e){for(let t of e)try{LIt(t)}catch{}}function XIt(e,t){let n=[],r=ia(e,yCe);try{for(let o of[ia(e,".nemar"),r]){let s;try{s=Ic(o)}catch{IIt(o),n.push(o),s=Ic(o)}if(!s.isDirectory()||s.dev!==t)return j3([...n].reverse()),null}return{dir:r,made:n}}catch{return j3([...n].reverse()),null}}function QIt(e){try{let t=q3(e,"r");try{hCe(t)}finally{L3(t)}}catch{}}function ZIt(e,t){let n=null;try{let r=(s)=>s.isFile()&&s.dev===e.dev&&s.ino===e.ino&&s.size===e.size&&s.mtimeMs===e.mtimeMs;if(!r(Ic(e.path))||!fCe(M3(e.path),e.before))return null;if(n=ia(t,`${process.pid}-${CIt(8).toString("hex")}`),PIt(e.path,n,N3.COPYFILE_EXCL|N3.COPYFILE_FICLONE),Ic(n).gid!==e.gid)TIt(n,-1,e.gid);OIt(n,e.mode&4095);let o=q3(n,"r+");try{if(qIt(o,e.after,0,kt,0)!==kt)return null;hCe(o)}finally{L3(o)}if(Ic(n).size!==e.size||!fCe(M3(n),e.after))return null;if(!r(Ic(e.path)))return null;return jIt(n,e.path),n=null,QIt(hC(e.path)),Ic(e.path).mtimeMs}catch(r){return $n(`date normalization: a header was not set (${r instanceof Error?r.name:"unknown"})`),null}finally{if(n!==null)try{B3(n,{force:!0})}catch{}}}function wCe(e,t){let n={set:0,left:0,mtimes:new Map};if(YIt(e),t.items.length===0)return n;let r=null;try{r=XIt(e,gCe(e).dev)}catch{}if(r===null)return n.left=t.items.length,$n("date normalization: no work directory, nothing set"),n;try{for(let o of t.items){let s=ZIt(o,r.dir);if(s===null){n.left++;continue}n.set++,n.mtimes.set(o.rel,s)}}finally{j3([r.dir,...[...r.made].reverse().filter((o)=>o!==r.dir)])}if(n.set>0)console.log(u.dim(` ${TEe(n.set)}`));return n}He();Qs();uo();import{existsSync as J_,mkdirSync as bNt,readFileSync as Y_,writeFileSync as jCe}from"fs";import{basename as wNt,resolve as Kp}from"path";sc();ze();jr();Qs();import{existsSync as gC,readFileSync as U3,writeFileSync as xCe}from"fs";import{resolve as yC}from"path";var H3=[{spdxId:"CC0-1.0",name:"CC0 1.0 Universal (Public Domain)",description:"No rights reserved. Anyone can use the data for any purpose.",url:"https://creativecommons.org/publicdomain/zero/1.0/",allowsResearchUse:!0},{spdxId:"PDDL-1.0",name:"Open Data Commons Public Domain Dedication and License (PDDL)",description:"Database-specific public domain dedication.",url:"https://opendatacommons.org/licenses/pddl/1-0/",allowsResearchUse:!0},{spdxId:"CC-BY-4.0",name:"Creative Commons Attribution 4.0 International",description:"Attribution required. Free for any use including commercial.",url:"https://creativecommons.org/licenses/by/4.0/",allowsResearchUse:!0},{spdxId:"CC-BY-SA-4.0",name:"Creative Commons Attribution-ShareAlike 4.0 International",description:"Attribution + share-alike required. Derivatives must use same license.",url:"https://creativecommons.org/licenses/by-sa/4.0/",allowsResearchUse:!0},{spdxId:"CC-BY-NC-4.0",name:"Creative Commons Attribution-NonCommercial 4.0 International",description:"Attribution required. Non-commercial use only.",url:"https://creativecommons.org/licenses/by-nc/4.0/",allowsResearchUse:!0},{spdxId:"CC-BY-NC-SA-4.0",name:"Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International",description:"Attribution + non-commercial + share-alike required.",url:"https://creativecommons.org/licenses/by-nc-sa/4.0/",allowsResearchUse:!0},{spdxId:"ODC-By-1.0",name:"Open Data Commons Attribution License v1.0",description:"Database-specific attribution license.",url:"https://opendatacommons.org/licenses/by/1.0/",allowsResearchUse:!0},{spdxId:"ODbL-1.0",name:"Open Data Commons Open Database License v1.0",description:"Database attribution + share-alike. Produced works can be any license.",url:"https://opendatacommons.org/licenses/odbl/1.0/",allowsResearchUse:!0}],_Ce=new Set(["CC0-1.0","CC-BY-4.0","CC-BY-SA-4.0","CC-BY-NC-4.0","CC-BY-NC-SA-4.0","CC-BY-ND-4.0","CC-BY-NC-ND-4.0","PDDL-1.0","ODC-By-1.0","ODbL-1.0","MIT","Apache-2.0","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","BSD-2-Clause","BSD-3-Clause","ISC","Unlicense"]);function vCe(e){let t=yC(e,"dataset_description.json");if(gC(t))try{let r=JSON.parse(U3(t,"utf-8"));if(typeof r.License==="string"&&r.License.trim())return{spdxId:r.License.trim(),source:"dataset_description"}}catch(r){if(r instanceof SyntaxError)console.warn(` Warning: dataset_description.json has invalid JSON: ${r.message}`);else console.warn(` Warning: Could not read dataset_description.json: ${r instanceof Error?r.message:String(r)}`)}let n=["LICENSE","LICENSE.txt","LICENSE.md","LICENCE","LICENCE.txt"];for(let r of n){let o=yC(e,r);if(gC(o)){try{let s=U3(o,"utf-8").toLowerCase();if(s.includes("cc0")||s.includes("public domain dedication"))return{spdxId:"CC0-1.0",source:"license_file"};if(s.includes("attribution-noncommercial-sharealike"))return{spdxId:"CC-BY-NC-SA-4.0",source:"license_file"};if(s.includes("attribution-noncommercial"))return{spdxId:"CC-BY-NC-4.0",source:"license_file"};if(s.includes("attribution-sharealike"))return{spdxId:"CC-BY-SA-4.0",source:"license_file"};if(s.includes("creativecommons")&&s.includes("attribution"))return{spdxId:"CC-BY-4.0",source:"license_file"};if(s.includes("open database license")||s.includes("odbl"))return{spdxId:"ODbL-1.0",source:"license_file"};if(s.includes("open data commons")&&s.includes("attribution"))return{spdxId:"ODC-By-1.0",source:"license_file"};if(s.includes("public domain dedication and license")||s.includes("pddl"))return{spdxId:"PDDL-1.0",source:"license_file"};if(s.includes("permission is hereby granted, free of charge")||s.includes("mit license"))return{spdxId:"MIT",source:"license_file"}}catch(s){console.warn(` Warning: Could not read ${r}: ${s instanceof Error?s.message:String(s)}`)}return{spdxId:void 0,source:"license_file"}}}return{spdxId:void 0,source:"none"}}async function V3(e){let t=H3.map((o)=>({name:`${o.spdxId.padEnd(22)} ${o.description}`,value:o.spdxId,short:o.spdxId}));t.push({name:"Other (enter SPDX ID manually)",value:"__custom__",short:"Custom"});let n=e?H3.find((o)=>o.spdxId===e)?.spdxId:void 0,{selected:r}=await Ae.prompt([{type:"list",name:"selected",message:"Select a license for this dataset:",choices:t,default:n,pageSize:t.length}]);if(r==="__custom__"){let{customId:o}=await Ae.prompt([{type:"input",name:"customId",message:"Enter SPDX license ID (e.g., MIT, Apache-2.0):",validate:(s)=>{if(!s.trim())return"License ID is required";return!0}}]);return o.trim()}return r}function kCe(e){let t=e.toUpperCase().replace(/\s+/g,"-");if(_Ce.has(e))return!0;for(let n of _Ce)if(n.toUpperCase()===t)return!0;return!1}function eNt(e){let t=H3.find((n)=>n.spdxId===e);if(t)return`${t.name}
|
|
2014
|
+
`;F1e(s,a)}console.log(u.dim(" Updated .bidsignore for NEMAR metadata"))}catch(r){console.log(u.yellow(` Warning: Could not update .bidsignore: ${G(r)}`)),console.log(u.dim(" Upload will continue without author enrichment."))}vl(n,"metadata_write"),qr(e,n)}else console.log(u.dim(" Metadata write already completed (skipping)"))}var j1e=1073741824;function HPt(e,t,n=j1e){let r=[],o=0;for(let s of t){let i=e.files[s];if(!i||i.mtimeMs===void 0)continue;r.push({path:s,size:i.size,mtimeMs:i.mtimeMs}),o+=i.size}return o>=n?r:null}function VPt(e,t){return t.filter((n)=>{try{return Fo(n.path,BPt(UPt(e,n.path)).size)}catch{return!0}})}function zPt(e){let t=0;for(let n of Object.values(e.files))t+=n.size;return t}function GPt(e){return["Warning: saving dataset changes has produced no stdout or stderr for",`${ID(e)}. git add -A is still running.`,"Wait, or interrupt and rerun the upload; the save step will run again."].join(" ")}async function L1e(e,t,n,r={}){if(!Ji(n,"dataset_save")){let o=D({text:"Saving dataset changes...",...r.spinnerStream?{stream:r.spinnerStream}:{}}).start(),s=r.skipMinBytes??j1e,i=[];if(zPt(n)>=s){let c=r.annexedPaths??null;if(c===null)try{c=await Md(e)}catch(l){console.log(u.dim(` Could not list annexed files (${G(l)}); staging will re-read them`))}if(c!==null)i=VPt(e,HPt(n,c,s)??[])}let a=await pl(e,"Initial NEMAR dataset upload",t,{skipContentCheck:i,onInactivityWarning:(c)=>{o=Fw(o,GPt(c))},...r.inactivityWarningAfterMs===void 0?{}:{inactivityWarningAfterMs:r.inactivityWarningAfterMs}});if(!a.success)return qr(e,n),_o(o,"Failed to save dataset",a.error),console.log(),console.log(u.yellow("Re-run the same command to resume from this step.")),Ne;if(r.verifyRemote){let c;try{c=await lM(e,r.verifyRemote)}catch(l){return qr(e,n),_o(o,"Could not confirm the saved files are at the S3 remote",l),console.log(),console.log(u.yellow("Re-run the same command to resume from this step.")),Ne}if(c.length>0){kl(n,"s3_upload"),qr(e,n);let l=XS(c.slice(0,5)),d=c.length>5?` (and ${c.length-5} more)`:"";return _o(o,"Saved files are not at the S3 remote",`${c.length} annexed file(s) in the commit are not recorded at the remote: ${l}${d}. The save itself annexed them, after the upload step had run.`),console.log(),console.log(u.yellow("Re-run the same command: it uploads them and saves again.")),Ne}}o.succeed("Dataset changes saved"),vl(n,"dataset_save"),qr(e,n)}else console.log(u.dim(" Dataset save already completed (skipping)"));return mn()}async function q1e(e,t){if(!Ji(t,"github_push")){let n=D("Pushing metadata to GitHub...").start(),r=await ur(e);if(!r.success)return qr(e,t),_o(n,"Failed to push to GitHub",r.error),console.log(),console.log(u.yellow("Re-run the same command to resume from this step.")),Ne;if(r.warning)n.warn("Metadata pushed to GitHub (with warning)"),console.log(u.yellow(` ${r.warning}`));else n.succeed("Metadata pushed to GitHub");vl(t,"github_push"),qr(e,t)}else console.log(u.dim(" GitHub push already completed (skipping)"));return mn()}async function B1e(e,t,n){if(!Ji(n,"ci_deploy")){let r=D("Setting up BIDS validation CI...").start(),o="configured";try{await dl(t),r.succeed("BIDS validation CI configured")}catch(s){if(o="not-configured",s instanceof L&&s.statusCode===403)r.info("CI workflow will be configured by an admin");else{let i=s instanceof Error?s.message:String(s);r.warn(`Could not configure CI: ${i}`),console.log(u.dim(` An admin can add it later with: nemar admin ci add ${t}`))}}return vl(n,"ci_deploy"),qr(e,n),o}return console.log(u.dim(" CI deploy already completed (skipping)")),"unknown"}function WPt(e,t){let n=e.startsWith("xx");if(t==="not-configured"){if(n)return;console.log("BIDS validation is not set up yet."),console.log(` CI is set up when you request publication: ${u.cyan(`nemar dataset publish request ${e}`)}`),console.log();return}if(console.log("BIDS validation runs on GitHub after the upload."),console.log(` Check it with: ${u.cyan(`nemar dataset ci ${e}`)}`),!n)console.log(` Once it has passed, request publication: ${u.cyan(`nemar dataset publish request ${e}`)}`);console.log()}function U1e(e,t,n="unknown"){Nw(e),R_e(e),console.log(),console.log(u.green.bold("Upload complete!")),console.log(),console.log(` Dataset ID: ${u.cyan(t.dataset_id)}`),console.log(` GitHub: ${u.cyan(t.github_url)}`),console.log(),console.log(u.dim("To download this dataset:")),console.log(u.dim(` nemar dataset download ${t.dataset_id}`)),console.log(),WPt(t.dataset_id,n),console.log(u.yellow("Note: This dataset is private. Only the owner and designated collaborators can")),console.log(u.yellow("download it, and only through the NEMAR CLI (not direct git-annex commands).")),console.log(u.yellow("After publishing, the data will be publicly available for everyone."))}jd();wp();async function H1e(e,t={}){let n=await xge(e.absolutePath);if(!n.success)return console.log(u.red(n.error)),console.log(u.yellow("Re-run the same command to retry.")),Ne;if(n.cleared>0)console.log(u.yellow(` Cleared ${n.cleared} assume-unchanged flag(s) an earlier, interrupted save left on annexed files`));let r=await I_e(e.absolutePath);if(r.status==="error")return console.log(u.red(r.error)),Ne;if(r.status==="warning")console.log(u.yellow(` ${r.warning}`));if(r.status==="restored")console.log(u.yellow(" Put back git-annex's filter process, which an earlier, interrupted upload had left out of this repository's configuration"));let o=await pxe(e.absolutePath,e.options,e.dataFiles,e.filesToUpload,e.uploadProgress,e.datasetInfo,{openRemote:t.openRemote,...t.primeMinBytes===void 0?{}:{primeMinBytes:t.primeMinBytes},...t.primeOnSuspended?{primeOnSuspended:t.primeOnSuspended}:{}});if(o.status==="fail")return Ne;let{progress:s,annexedPaths:i}=o.value;if(M1e(e.absolutePath,e.coAuthorEnrichment,s),(await(t.saveStep??L1e)(e.absolutePath,e.author,s,{annexedPaths:i,verifyRemote:wc,...t.skipMinBytes===void 0?{}:{skipMinBytes:t.skipMinBytes},...t.saveInactivityWarningAfterMs===void 0?{}:{inactivityWarningAfterMs:t.saveInactivityWarningAfterMs},...t.saveSpinnerStream===void 0?{}:{spinnerStream:t.saveSpinnerStream}})).status==="fail")return Ne;return mn(s)}He();_l();Fp();Ow();fn();qt();import{randomBytes as CIt}from"crypto";import{constants as Nq,accessSync as AIt,chmodSync as OIt,chownSync as TIt,closeSync as Lq,copyFileSync as PIt,existsSync as mCe,fsyncSync as hCe,lstatSync as Ic,mkdirSync as IIt,mkdtempSync as NIt,openSync as qq,readSync as FIt,readdirSync as MIt,renameSync as jIt,rmSync as Bq,rmdirSync as LIt,statSync as gCe,writeSync as qIt}from"fs";import{tmpdir as BIt}from"os";import{dirname as hC,join as ia}from"path";He();import{lstatSync as xIt,readdirSync as vIt,statSync as nCe}from"fs";import{open as kIt}from"fs/promises";import{join as tCe}from"path";Qs();uo();_l();var K1e="nemar-identifier-scan/1.0 (+https://docs.nemar.org/policies/takedown/)",KPt="https://nemar-api-dev.sccn-org.workers.dev",JPt="https://data.nemar.org",YPt="https://nemar.s3.us-east-2.amazonaws.com",XPt="https://api.github.com";function fC(e,t){if(!Number.isSafeInteger(t)||t<1)throw RangeError(`${e} must be a positive integer, got ${t}`)}async function lC(e,t,n){fC("pool size",t);let r=0,o=Array.from({length:Math.min(t,e.length)},async()=>{while(r<e.length){let a=e[r++];await n(a)}}),i=(await Promise.allSettled(o)).find((a)=>a.status==="rejected");if(i)throw i.reason}function QPt(e){fC("limit",e);let t=0,n=[];return async(r)=>{if(t>=e)await new Promise((o)=>n.push(o));else t++;try{return await r()}finally{let o=n.shift();if(o)o();else t--}}}class Zn extends Error{cls;status;retryable;retryAfterMs;constructor(e,t={}){super(e);this.name="ReadFailure",this.cls=e,this.status=t.status,this.retryable=t.retryable??!1,this.retryAfterMs=t.retryAfterMs}}function ZPt(e,t=Date.now()){let n=e?.trim();if(!n)return;if(/^\d+$/.test(n))return Number(n)*1000;let r=Date.parse(n);return Number.isNaN(r)?void 0:Math.max(0,r-t)}function eIt(e,t){let n=e>=500||e===429;return new Zn(`http-${e}`,{status:e,retryable:n,retryAfterMs:n?ZPt(t):void 0})}class Aq extends Error{constructor(e){super(e);this.name="RunAborted"}}function tIt(e){fC("abort streak",e.streak);let t=e.now??Date.now,n={tripped:null},r=(o)=>{let s=0,i=0,a=(c)=>{throw n.tripped=new Aq(c),n.tripped};return{check(){if(n.tripped)throw n.tripped},ok(){s=0},pausedUntilMs(){return i},observe(c){if(n.tripped)throw n.tripped;if(c.retryAfterMs!==void 0&&c.retryAfterMs>e.retryAfterCapMs)a(`${o} asked to wait ${Math.round(c.retryAfterMs/1000)} s (Retry-After), over the ${Math.round(e.retryAfterCapMs/1000)} s cap (${c.cls})`);if(c.retryAfterMs!==void 0)i=Math.max(i,t()+c.retryAfterMs);if(!c.retryable){s=0;return}if(s++,s>=e.streak)a(`${s} consecutive 429, 5xx, timeout or network failures from ${o} (last ${c.cls})`)}}};return{worker:r("the Worker"),direct:r("direct reads")}}function V1e(e){let t=e instanceof Error?e.name:"";return new Zn(t==="TimeoutError"||t==="AbortError"?"timeout":"network",{retryable:!0})}function nIt(e){if(e instanceof Zn)return e.cls;return`error-${e instanceof Error?e.name:"unknown"}`}async function rIt(e,t={}){let n=t.tries??3,r=t.baseMs??400,o=t.sleep??((s)=>new Promise((i)=>setTimeout(i,s)));fC("tries",n);for(let s=1;;s++)try{return await e()}catch(i){if(!(i instanceof Zn&&i.retryable)||s>=n)throw i;let c=i.retryAfterMs??0;if(c>(t.retryAfterCapMs??30000))throw i;await o(Math.max(r*2**(s-1),c))}}async function oIt(e){await e.body?.cancel().catch(()=>{return})}async function sIt(e,t,n={}){let r;try{r=await fetch(e,{headers:{Range:`bytes=0-${t-1}`,"Accept-Encoding":"identity","User-Agent":n.userAgent??K1e},signal:AbortSignal.timeout(n.timeoutMs??30000)})}catch(a){throw V1e(a)}if(r.status!==200&&r.status!==206)throw await oIt(r),eIt(r.status,r.headers.get("retry-after"));let o=r.body?.getReader();if(!o)throw new Zn("no-body");let s=new Uint8Array(t),i=0;try{while(i<t){let{done:a,value:c}=await o.read();if(a||!c)break;let l=Math.min(c.length,t-i);s.set(c.subarray(0,l),i),i+=l}}catch(a){throw V1e(a)}finally{await o.cancel().catch(()=>{return})}if(i<(n.minBytes??0))throw new Zn("short-body");return s.subarray(0,i)}var J1e={sideFileBytes:2097152,participantsBytes:16777216};function iIt(e,t){let n=/An error occurred \(([A-Za-z0-9]{1,40})\)/.exec(e)?.[1];if(n)return/^\d+$/.test(n)?`aws/http-${n}`:`aws/error-${n}`;return`aws/exit-${t}`}async function aIt(e,t,n={}){let r;try{let o=Bun.spawn(["aws","s3","cp",`s3://nemar/${e}/version/${t}.json`,"-"],{stdout:"pipe",stderr:"pipe",...n.env?{env:n.env}:{}}),s=!1;r=setTimeout(()=>{s=!0,o.kill("SIGKILL")},n.timeoutMs??600000);let[i,a,c]=await Promise.all([new Response(o.stdout).text(),new Response(o.stderr).text(),o.exited]);if(s)throw new Zn("aws/timeout");if(c!==0)throw new Zn(iIt(a,c));return i}catch(o){if(o instanceof Zn)throw o;throw new Zn("aws/unavailable")}finally{clearTimeout(r)}}function cIt(){let e;return async()=>{if(e!==void 0)return e;if(process.env.GITHUB_TOKEN)return e=process.env.GITHUB_TOKEN,e;try{let t=Bun.spawn(["gh","auth","token"],{stdout:"pipe",stderr:"ignore"}),n=(await new Response(t.stdout).text()).trim();e=n===""?null:n}catch{e=null}return e}}var uC=(e)=>e.replace(/\/+$/,"");function Y1e(e={}){let t=e.retryAfterCapMs??30000,n=e.awsTimeoutMs??600000;return{api:uC(e.api??process.env.NEMAR_API_BASE??KPt),data:uC(e.data??process.env.NEMAR_DATA_BASE??JPt),s3Base:uC(e.s3Base??YPt),githubApi:uC(e.githubApi??XPt),userAgent:e.userAgent??K1e,fileConcurrency:e.fileConcurrency??24,workerLimit:QPt(e.workerConcurrency??6),timeoutMs:e.timeoutMs??30000,manifestTimeoutMs:e.manifestTimeoutMs??120000,retryBaseMs:e.retryBaseMs??400,sleep:e.sleep??((r)=>new Promise((o)=>setTimeout(o,r))),now:e.now??Date.now,retryAfterCapMs:t,breakers:tIt({streak:e.abortStreak??25,retryAfterCapMs:t,now:e.now??Date.now}),limits:{treeHeaderSample:300,scansTables:1,jsonFiles:300,textFiles:300,sideFileBytes:65536,participantsBytes:1048576,...e.limits},readVersionManifest:e.readVersionManifest??((r,o)=>aIt(r,o,{timeoutMs:n,env:e.awsEnv})),githubToken:e.githubToken??cIt(),...e.readEntryHead?{readEntryHead:e.readEntryHead}:{}}}var X1e=(e,t)=>t.startsWith(`${e.data}/`),lIt=(e,t)=>X1e(e,t)||t.startsWith(`${e.api}/`)?e.breakers.worker:e.breakers.direct;async function uIt(e,t,n){let r=lIt(e,t);r.check();let o=r.pausedUntilMs()-e.now();if(o>0)await e.sleep(o),r.check();try{let s=await n();return r.ok(),s}catch(s){if(s instanceof Zn)r.observe(s);throw s}}var dIt=(e,t)=>({...t===void 0?{}:{tries:t},baseMs:e.retryBaseMs,sleep:e.sleep,retryAfterCapMs:e.retryAfterCapMs});var z1e=(e)=>/sub-([^/_]+)/.exec(e)?.[1]??"?";function G1e(e,t,n){if(t<1)return[];if(e.length<=t)return[...e];let r=new Map;for(let c of e){let l=n(c),d=r.get(l);if(d)d.push(c);else r.set(l,[c])}let o=[...r.entries()].sort(([c],[l])=>c<l?-1:c>l?1:0).map(([,c])=>c);if(o.length>t)return Array.from({length:t},(c,l)=>o[Math.floor((l+0.5)*o.length/t)][0]);let s=o.map((c,l)=>({list:c,index:l})).sort((c,l)=>c.list.length-l.list.length||c.index-l.index),i=t,a=[];return s.forEach(({list:c},l)=>{let d=Math.min(c.length,Math.ceil(i/(s.length-l)));for(let f=0;f<d;f++)a.push(c[Math.floor((f+0.5)*c.length/d)]);i-=d}),a}var fIt=(e)=>e.severity==="identifier"&&Dwe.has(e.kind),pIt=(e)=>pp.has(e.kind);function Q1e(e){return e.headerRead===e.edfCount&&e.incompleteReasons.length===0}function mIt(e){if(e.findings.some(fIt))return"direct-identifiers";if(e.findings.some((t)=>!pIt(t)))return"review";if(!Q1e(e))return"unchecked";if(e.edfCount>0&&e.unscreenedCount>0)return"clean-edf-only-others-unscreened";if(e.edfCount===0)return e.unscreenedCount>0?"not-screened":"no-recordings";return e.findings.length>0?"dates-only":"clean"}var hIt=/\.(edf|bdf)$/i,gIt=(e)=>e.edf===!0||hIt.test(e.path);function yIt(e){return{edf:e.filter(gIt),participants:e.find((t)=>t.path==="participants.tsv"),scans:e.filter((t)=>t.path.endsWith("_scans.tsv")),json:e.filter((t)=>t.path.endsWith(".json")).filter((t)=>t.path.startsWith("sourcedata/")||!bIt.test(t.path)).filter((t)=>!wIt.test(t.path)),text:e.filter((t)=>_It.test(t.path)).filter((t)=>t.path.startsWith("sourcedata/")||t.path.startsWith("code/"))}}var bIt=/_(eeg|ieeg|meg|emg|nirs|beh|events|channels|electrodes|coordsystem|scans|physio|stim|photo|T1w|bold)\.(json|tsv)$/,wIt=/(^|\/)(dataset_description|participants|genetic_info)\.json$/,_It=/\.(py|m|r|txt|md|ya?ml|xml|iml|cfg|ini)$/i;function Z1e(e,t,n,r=0){let o=()=>uIt(e,t.url,()=>{let s={minBytes:r,userAgent:e.userAgent,timeoutMs:e.timeoutMs};return e.readEntryHead?e.readEntryHead(t,n,s):sIt(t.url,n,s)});return rIt(()=>X1e(e,t.url)?e.workerLimit(o):o(),dIt(e))}async function dC(e,t,n){let r=await Z1e(e,t,n),o=t.size===null?r.length>=n:t.size>n;return{text:new TextDecoder("utf-8",{fatal:!1}).decode(r),truncated:o}}function Ty(e,t){for(let n of t)e.push(n)}var W1e="edf/superseded-absent";async function eCe(e,t,n,r,o,s={}){let i=r.map((Ce)=>Ce.path),a=o==="clone",c=(Ce,st,Fn)=>a?[...Ce]:G1e(Ce,st,Fn),l=[...hD([...i,...s.extraPaths??[]])],d=jwe(i),f=Object.values(d.unscreened).reduce((Ce,st)=>Ce+st,0),p={},m=(Ce,st)=>{if(st instanceof Aq)throw st;let Fn=`${Ce}/${nIt(st)}`;p[Fn]=(p[Fn]??0)+1},h=(Ce)=>z1e(Ce.path),g=yIt(r),y=new Set(s.supersededEdf??[]),b=[...g.edf,...y],{participants:_,scans:x,json:k,text:v}=g,C=o==="git-tree"?G1e(b,e.limits.treeHeaderSample,h):[...b],T=0,V=0,A=0,F=0,M={},U=new Set,B=new Set,P=new Set,O=new Set,H=new Set,re=new Set;await lC(C,e.fileConcurrency,async(Ce)=>{try{let st=await Z1e(e,Ce,kt,kt),Fn=Td(st),{patient:Gl}=pD(st);if(!Fn.some((ws)=>ws.kind==="edf-unreadable")){U.add(Gl);let ws=Gl.split(/\s+/);if(ws.length>=4)P.add(ws[0]),H.add(ws[2]),O.add(ws[3])}if(re.add(z1e(Ce.path)),Fn.some((ws)=>ws.severity==="identifier"))F++,B.add(Gl);Ty(l,Fn);for(let ws of new Set(Fn.map((Iy)=>Iy.kind)))M[ws]=(M[ws]??0)+1;T++}catch(st){if(y.has(Ce)&&st instanceof Zn&&st.status===404){A++,p[W1e]=(p[W1e]??0)+1;return}V++,m("edf",st)}});let Ee=b.length-A,Zt=!1,pt=!1;if(_&&_.size!==0)try{let{text:Ce,truncated:st}=await dC(e,_,e.limits.participantsBytes),Fn=Ce.indexOf(`
|
|
2015
|
+
`);if(Fn<0&&st)throw new Zn("header-truncated");Ty(l,Iwe(Fn<0?Ce:Ce.slice(0,Fn))),Ty(l,Fwe(Ce)),pt=st}catch(Ce){Zt=!0,m("participants",Ce)}let Ze=c(x,e.limits.scansTables,h),oe=0;await lC(Ze,e.fileConcurrency,async(Ce)=>{if(Ce.size===0){oe++;return}try{let{text:st}=await dC(e,Ce,e.limits.sideFileBytes);Ty(l,mD(st)),oe++}catch(st){m("scans",st)}});let je=e.limits.sideFileBytes,Ie=(Ce)=>Ce.size!==null&&Ce.size>je,Q=c(k.filter((Ce)=>!Ie(Ce)),e.limits.jsonFiles,h),mt=c(v.filter((Ce)=>!Ie(Ce)),e.limits.textFiles,h),Ue=0,W=0;await lC(Q,e.fileConcurrency,async(Ce)=>{if(Ce.size===0){Ue++;return}try{let{text:st}=await dC(e,Ce,je),Fn;try{Fn=JSON.parse(st)}catch{throw new Zn("json-parse")}Ty(l,fp(Fn)),Ue++}catch(st){m("json",st)}}),await lC(mt,e.fileConcurrency,async(Ce)=>{if(Ce.size===0){W++;return}try{let{text:st}=await dC(e,Ce,je);Ty(l,Mwe(st)),W++}catch(st){m("text",st)}});let J={edf_headers:{candidates:Ee,oversize:0,selected:C.length-A,scanned:T},scans_tables:{candidates:x.length,oversize:0,selected:Ze.length,scanned:oe},json_files:{candidates:k.length,oversize:k.filter(Ie).length,selected:Q.length,scanned:Ue},text_files:{candidates:v.length,oversize:v.filter(Ie).length,selected:mt.length,scanned:W}},le=new Set,ne=(Ce,st)=>{if(st.oversize>0)le.add(`${Ce}-oversize`);if(st.candidates-st.oversize>st.selected)le.add(`${Ce}-sampled`);if(st.scanned<st.selected)le.add(`${Ce}-unread`)};if(ne("edf-headers",J.edf_headers),ne("json",J.json_files),ne("text",J.text_files),J.scans_tables.scanned<J.scans_tables.selected)le.add("scans-unread");if(Zt)le.add("participants-unread");if(pt)le.add("participants-truncated");for(let Ce of s.extraIncompleteReasons??[])le.add(Ce);let Le=[...le].sort(),It={findings:l,edfCount:Ee,headerRead:T,unscreenedCount:f,incompleteReasons:Le},wr=l.filter((Ce)=>Ce.severity==="identifier"),Fc=Object.entries(p).filter(([Ce])=>!Ce.startsWith("edf/")).reduce((Ce,[,st])=>Ce+st,0);return{id:t,version:n,scanned_at:new Date().toISOString(),manifest_source:o,status:mIt(It),incomplete:!Q1e(It),incomplete_reasons:Le,files:{total:r.length,edf_bdf:Ee,header_read:T,header_read_failed:V},sampling:J,read_failures:p,edf_bdf_files_flagged:F,distinct_patient_field_values:U.size,distinct_subjects_with_edf_bdf:re.size,distinct_patient_code_subfield:P.size,distinct_patient_name_subfield:O.size,distinct_patient_birth_subfield:H.size,distinct_patient_field_values_in_flagged_files:B.size,findings_by_kind:Lwe(l),edf_bdf_files_by_kind:M,unscreened_formats:d.unscreened,side_reads_failed:Fc,finding_fields:[...new Set(wr.map((Ce)=>`${Ce.kind}:${Ce.field}`))].sort()}}Fp();fn();Hf();wp();var Wp="--acknowledge-identifier-preflight",EIt=16,SIt="local:";function Pq(e){let t=[],n=new Map,r=0,o=[""];while(o.length>0){let s=o.pop(),i;try{i=vIt(s===""?e:tCe(e,s),{withFileTypes:!0})}catch{r++;continue}i.sort((c,l)=>c.name<l.name?-1:c.name>l.name?1:0);let a=[];for(let c of i){let l=c.name;if(s===""&&(l===".git"||l===".nemar"))continue;let d=s===""?l:`${s}/${l}`;if(c.isDirectory()){a.push(d);continue}if(l===".gitattributes")continue;let f=`${SIt}${t.length}`,p=tCe(e,d),m=null;try{let h=nCe(p);if(h.isFile())m=h.size,n.set(f,p);else if(h.isDirectory()&&!xIt(p).isSymbolicLink()){a.push(d);continue}}catch{}t.push({path:d,size:m,url:f})}for(let c=a.length-1;c>=0;c--)o.push(a[c])}return{entries:t,readable:n,unlisted:r}}function $It(e,t=new Map){return async(n,r,o)=>{let s=e.get(n.url);if(s===void 0)throw new Zn("unreadable-entry");let i=t.get(s),a;try{a=await kIt(s,"r")}catch{throw new Zn("unreadable-entry")}try{let c=n.size===null?r:Math.min(r,n.size),l=new Uint8Array(c),d=0;while(d<c){let{bytesRead:f}=await a.read(l,d,c-d,d);if(f===0)break;d+=f}if(d<o.minBytes)throw new Zn("short-body");if(i)l.set(i.subarray(0,Math.min(d,i.length)),0);return l.subarray(0,d)}catch(c){if(c instanceof Zn)throw c;throw new Zn("unreadable-entry")}finally{await a.close().catch(()=>{return})}}}async function rCe(e,t){let n=Pq(e),r=Y1e({fileConcurrency:EIt,workerConcurrency:1,limits:{...J1e},readEntryHead:$It(n.readable,t),githubToken:async()=>null,readVersionManifest:async()=>{throw new Zn("unreadable-entry")},sleep:async()=>{return}}),o=await eCe(r,"local",null,n.entries,"clone",{extraIncompleteReasons:n.unlisted>0?["tree-truncated"]:[]}),s={scanned_at:o.scanned_at,status:o.status,incomplete:o.incomplete,incomplete_reasons:o.incomplete_reasons,files:o.files,findings_by_kind:o.findings_by_kind,edf_bdf_files_flagged:o.edf_bdf_files_flagged,unscreened_formats:o.unscreened_formats,read_failures:o.read_failures};return Oj(NEe(FEe(s)))}function mC(e){if(Jd(e.status)!=="acknowledge")return[];let t=new Set([e.status]);if(e.incomplete&&e.status!=="unchecked")t.add("unchecked");let n=Object.values(e.unscreened_formats).reduce((o,s)=>o+s,0),r=e.status==="not-screened"||e.status==="clean-edf-only-others-unscreened";if(n>0&&!r)t.add("not-screened");return[...t].sort()}var oCe=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]);function sCe(e,t){let n=e.split(",").map((o)=>o.trim()).filter((o)=>o!==""),r=JR;if(n.length===0||!n.every((o)=>r.includes(o)))throw new Us(`Allowed verdicts are ${r.join(", ")}. Direct identifiers cannot be acknowledged.`);return[...t??[],...n]}function DIt(e,t){let n=Jd(e.status);if(n==="clear")return{action:"proceed",acknowledgedVia:null};if(n!=="acknowledge")return{action:"refuse"};if(t.acknowledge!==void 0){let r=[...new Set(t.acknowledge)].sort();return oCe(r,mC(e))?{action:"proceed",acknowledgedVia:"flag"}:{action:"stop",why:"acknowledgment-mismatch"}}if(t.dryRun)return{action:"preview"};if(t.no)return{action:"stop",why:"declined"};if(t.isTty)return{action:"prompt"};return{action:"stop",why:"acknowledgment-required"}}var RIt={review:"the scanner found something a person should look at (the kinds are listed above)",unchecked:"the scanner could not read everything it should have (see Incomplete above)","not-screened":"some recordings are in formats the scanner cannot read, so their headers were not checked","clean-edf-only-others-unscreened":"the EDF/BDF headers are clean, but other recordings are in formats the scanner cannot read"},Oq=(e)=>`${Wp} ${e.join(",")}`;function Tq(e){console.log(u.yellow(" This does not stop an upload, but it needs your explicit acknowledgment of:"));for(let t of e)console.log(u.yellow(` ${t}: ${RIt[t]??"not clean"}.`));console.log(u.dim(" Your acknowledgment is recorded with your deposit attestation. NEMAR screens the dataset again when you request publication, and an administrator decides then."))}function iCe(){console.log(),console.log(u.red(" Upload refused: the preflight found direct identifiers (a name, a birth date finer than the year, a record number, an age over 89, or an identifying column or key). Nothing was sent.")),console.log(u.red(" Remove them from the files (for EDF/BDF, the patient and recording fields of the header) and run the upload again.")),console.log(u.dim(` There is no override, and ${Wp} does not apply. If this is a false positive, please report it, so the scanner is fixed for every dataset. Terms: ${nC}`))}function aCe(e){if(e instanceof GR)return`report-${e.message}`;let t=e instanceof Error&&/^[A-Za-z]{1,40}$/.test(e.name)?e.name:"unknown",n=e?.code;return typeof n==="string"&&/^E[A-Z0-9]{1,20}$/.test(n)?`${t} ${n}`:t}function cCe(e,t){e.fail("Identifier preflight: DID NOT FINISH"),console.log(u.red(` The preflight could not produce a verdict, so nothing was uploaded (${aCe(t)}).`)),console.log(u.dim(" Please report this: https://github.com/nemarOrg/nemar-cli/issues"))}function pC(e,t,n=""){let r=Tj(t,null),o=`${r.headline}${n}`;if(r.tone==="ok")e.succeed(o);else if(r.tone==="stop")e.fail(o);else e.warn(o);for(let s of Oc({state:t.status,...r},2).slice(1))console.log(s)}function lCe(e,t){try{return mn(MEe({version:zR,scanner:`nemar-cli@${Ds}`,scan:e,acknowledged_via:t}))}catch(n){return console.log(u.red(` The preflight's record did not fit the report contract (${aCe(n)}), so nothing was uploaded.`)),Ne}}async function uCe(e,t,n=process.stdin.isTTY===!0,r){let o=D("Screening for identifiers on this machine (nothing is sent)...").start(),s=!1;try{s=nCe(e).isDirectory()}catch{s=!1}if(!s)return o.fail("Identifier preflight: the dataset path is not a directory"),Ne;let i=new Map((r?.items??[]).map((p)=>[p.path,p.after])),a;try{a=await rCe(e,i)}catch(p){return cCe(o,p),Ne}pC(o,a);let c=mC(a),l=DIt(a,{acknowledge:t.acknowledgeIdentifierPreflight,dryRun:t.dryRun,no:t.no,isTty:n}),d;switch(l.action){case"proceed":if(l.acknowledgedVia==="flag")console.log(u.dim(` Acknowledged with ${Oq(c)}.`));else if(t.acknowledgeIdentifierPreflight!==void 0)console.log(u.dim(` Nothing to acknowledge; ${Wp} was not needed.`));d=l.acknowledgedVia;break;case"preview":return Tq(c),console.log(u.yellow(` A real upload stops here until you acknowledge it: answer the prompt, or pass ${Oq(c)}.`)),console.log(),mn(null);case"prompt":{Tq(c);let p=!1,m=()=>{console.log(u.red(`
|
|
2016
|
+
Upload cancelled. Nothing was sent.`)),ce(),process.exit(130)};process.once("SIGINT",m);let h=setInterval(()=>{return},1000);try{({acknowledged:p}=await Ae.prompt([{type:"confirm",name:"acknowledged",message:"Upload anyway?",default:!1}]))}catch{p=!1}finally{clearInterval(h),process.off("SIGINT",m)}if(p!==!0)return console.log(u.red(" Upload cancelled. Nothing was sent.")),ce(),Ne;console.log(u.dim(" Acknowledged at the prompt.")),d="prompt";break}case"refuse":return iCe(),ce(),Ne;case"stop":if(l.why==="acknowledgment-mismatch")console.log(u.red(` ${Wp} must name exactly what was found, which is: ${c.join(",")}. It does not acknowledge this scan. Nothing was sent.`));else Tq(c),console.log(u.red(l.why==="declined"?" Declined (--no). Nothing was sent.":` No terminal to ask at: run interactively, or pass ${Oq(c)}. --yes does not acknowledge a finding. Nothing was sent.`));return ce(),Ne}let f=lCe(a,d);if(f.status==="ok")console.log();return f}async function dCe(e,t){let n=D("Screening again, right before anything is sent...").start(),r;try{r=await rCe(e)}catch(a){return cCe(n,a),Ne}let o=Jd(r.status);if(o!=="clear"&&o!=="acknowledge")return pC(n,r),iCe(),ce(),Ne;let s=mC(t.scan),i=mC(r);if(!oCe(s,i))return pC(n,r),console.log(u.red(` The files changed since the preflight, and so did what it found (acknowledged: ${s.join(",")||"nothing"}; now: ${i.join(",")}). Nothing was sent. Run the upload again.`)),ce(),Ne;if(WR(r.findings_by_kind)!==WR(t.scan.findings_by_kind))pC(n,r," (screened again)");else n.succeed(`${Tj(r,null).headline} (screened again)`);return lCe(r,t.acknowledged_via)}var UIt=/\.(edf|bdf)$/i,yCe=ia(".nemar","date-normalization"),HIt=()=>({tracked:0,"nested-repository":0,ignored:0,"tracking-unknown":0,link:0,"not-writable":0,"other-filesystem":0,unverified:0});function VIt(){return{items:[],left:HIt()}}function zIt(e){if(process.env.GIT_DIR||process.env.GIT_WORK_TREE)return!0;for(let t=e;;t=hC(t)){if(mCe(ia(t,".git")))return!0;if(hC(t)===t)return!1}}var Fq=(e)=>e.normalize("NFC").toLowerCase();async function Iq(e,t,n){try{let r=await R(e,{cwd:t,...n===void 0?{}:{stdin:n}});if(!(r.exitCode===0||e.includes("check-ignore")&&r.exitCode===1))return null;return new Set(r.stdout.split("\x00").filter(Boolean).map(Fq))}catch{return null}}async function GIt(e,t){let n=`${t.join("\x00")}\x00`;if(zIt(e)){let o=await Iq(["git","ls-files","-z"],e),s=await Iq(["git","check-ignore","-z","--stdin"],e,n);return o&&s?{tracked:o,ignored:s}:null}let r=null;try{if(r=NIt(ia(BIt(),"nemar-ignore-")),(await R(["git","init","-q","--bare",r],{cwd:e})).exitCode!==0)return null;let s=await Iq(["git",`--git-dir=${r}`,`--work-tree=${e}`,"check-ignore","--no-index","-z","--stdin"],e,n);return s?{tracked:new Set,ignored:s}:null}catch{return null}finally{if(r!==null)try{Bq(r,{recursive:!0,force:!0})}catch{}}}function Mq(e){let t;try{t=qq(e,"r")}catch{return null}try{let n=new Uint8Array(kt),r=0;while(r<kt){let o=FIt(t,n,r,kt-r,r);if(o===0)break;r+=o}return r===kt?n:null}catch{return null}finally{try{Lq(t)}catch{}}}var fCe=(e,t)=>e!==null&&e.length===t.length&&e.every((n,r)=>n===t[r]);function pCe(e){try{return AIt(e,Nq.W_OK),!0}catch{return!1}}function WIt(e,t,n){let r=t.split("/").slice(0,-1);for(let o=1;o<=r.length;o++){let s=r.slice(0,o).join("/"),i=n.get(s);if(i===void 0){i=mCe(ia(e,s,".git"));try{i||=Ic(ia(e,s,".git")).isSymbolicLink()}catch{}n.set(s,i)}if(i)return!0}return!1}async function bCe(e){let t=VIt();try{await KIt(e,t)}catch(n){$n(`date normalization: planning stopped (${n instanceof Error?n.name:"unknown"})`)}return t}async function KIt(e,t){let n=gCe(e).dev,r=Pq(e),o=[];for(let c of r.entries){if(!UIt.test(c.path))continue;let l=r.readable.get(c.url);if(l===void 0)continue;let d=Mq(l);if(d===null)continue;try{let f=H6(d);if(f.changed)o.push({path:l,rel:c.path,before:d,after:f.header})}catch(f){if(f instanceof Nd)continue;t.left.unverified++,$n(`date normalization: a header was not planned (${f instanceof Error?f.name:"unknown"})`)}}if(o.length===0)return;let s=await GIt(e,o.map((c)=>c.rel)),i=new Map,a=typeof process.getuid==="function"?process.getuid():null;for(let c of o){if(s===null){t.left["tracking-unknown"]++;continue}if(s.tracked.has(Fq(c.rel))){t.left.tracked++;continue}if(WIt(e,c.rel,i)){t.left["nested-repository"]++;continue}if(s.ignored.has(Fq(c.rel))){t.left.ignored++;continue}let l;try{l=Ic(c.path)}catch{continue}if(l.isSymbolicLink()){t.left.link++;continue}if(!l.isFile())continue;if(l.dev!==n){t.left["other-filesystem"]++;continue}if(a!==null&&l.uid!==a||(l.mode&128)===0||!pCe(c.path)||!pCe(hC(c.path))){t.left["not-writable"]++;continue}t.items.push({path:c.path,rel:c.rel,dev:l.dev,ino:l.ino,size:l.size,mtimeMs:l.mtimeMs,mode:l.mode,gid:l.gid,before:c.before,after:c.after})}}var JIt=/^\d+-[0-9a-f]{16}$/;function YIt(e){try{let t=ia(e,yCe);for(let n of[ia(e,".nemar"),t])if(!Ic(n).isDirectory())return;for(let n of MIt(t))if(JIt.test(n))Bq(ia(t,n),{force:!0})}catch{}}function jq(e){for(let t of e)try{LIt(t)}catch{}}function XIt(e,t){let n=[],r=ia(e,yCe);try{for(let o of[ia(e,".nemar"),r]){let s;try{s=Ic(o)}catch{IIt(o),n.push(o),s=Ic(o)}if(!s.isDirectory()||s.dev!==t)return jq([...n].reverse()),null}return{dir:r,made:n}}catch{return jq([...n].reverse()),null}}function QIt(e){try{let t=qq(e,"r");try{hCe(t)}finally{Lq(t)}}catch{}}function ZIt(e,t){let n=null;try{let r=(s)=>s.isFile()&&s.dev===e.dev&&s.ino===e.ino&&s.size===e.size&&s.mtimeMs===e.mtimeMs;if(!r(Ic(e.path))||!fCe(Mq(e.path),e.before))return null;if(n=ia(t,`${process.pid}-${CIt(8).toString("hex")}`),PIt(e.path,n,Nq.COPYFILE_EXCL|Nq.COPYFILE_FICLONE),Ic(n).gid!==e.gid)TIt(n,-1,e.gid);OIt(n,e.mode&4095);let o=qq(n,"r+");try{if(qIt(o,e.after,0,kt,0)!==kt)return null;hCe(o)}finally{Lq(o)}if(Ic(n).size!==e.size||!fCe(Mq(n),e.after))return null;if(!r(Ic(e.path)))return null;return jIt(n,e.path),n=null,QIt(hC(e.path)),Ic(e.path).mtimeMs}catch(r){return $n(`date normalization: a header was not set (${r instanceof Error?r.name:"unknown"})`),null}finally{if(n!==null)try{Bq(n,{force:!0})}catch{}}}function wCe(e,t){let n={set:0,left:0,mtimes:new Map};if(YIt(e),t.items.length===0)return n;let r=null;try{r=XIt(e,gCe(e).dev)}catch{}if(r===null)return n.left=t.items.length,$n("date normalization: no work directory, nothing set"),n;try{for(let o of t.items){let s=ZIt(o,r.dir);if(s===null){n.left++;continue}n.set++,n.mtimes.set(o.rel,s)}}finally{jq([r.dir,...[...r.made].reverse().filter((o)=>o!==r.dir)])}if(n.set>0)console.log(u.dim(` ${TEe(n.set)}`));return n}He();Qs();uo();import{existsSync as J_,mkdirSync as bNt,readFileSync as Y_,writeFileSync as jCe}from"fs";import{basename as wNt,resolve as Kp}from"path";sc();ze();jr();Qs();import{existsSync as gC,readFileSync as Uq,writeFileSync as xCe}from"fs";import{resolve as yC}from"path";var Hq=[{spdxId:"CC0-1.0",name:"CC0 1.0 Universal (Public Domain)",description:"No rights reserved. Anyone can use the data for any purpose.",url:"https://creativecommons.org/publicdomain/zero/1.0/",allowsResearchUse:!0},{spdxId:"PDDL-1.0",name:"Open Data Commons Public Domain Dedication and License (PDDL)",description:"Database-specific public domain dedication.",url:"https://opendatacommons.org/licenses/pddl/1-0/",allowsResearchUse:!0},{spdxId:"CC-BY-4.0",name:"Creative Commons Attribution 4.0 International",description:"Attribution required. Free for any use including commercial.",url:"https://creativecommons.org/licenses/by/4.0/",allowsResearchUse:!0},{spdxId:"CC-BY-SA-4.0",name:"Creative Commons Attribution-ShareAlike 4.0 International",description:"Attribution + share-alike required. Derivatives must use same license.",url:"https://creativecommons.org/licenses/by-sa/4.0/",allowsResearchUse:!0},{spdxId:"CC-BY-NC-4.0",name:"Creative Commons Attribution-NonCommercial 4.0 International",description:"Attribution required. Non-commercial use only.",url:"https://creativecommons.org/licenses/by-nc/4.0/",allowsResearchUse:!0},{spdxId:"CC-BY-NC-SA-4.0",name:"Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International",description:"Attribution + non-commercial + share-alike required.",url:"https://creativecommons.org/licenses/by-nc-sa/4.0/",allowsResearchUse:!0},{spdxId:"ODC-By-1.0",name:"Open Data Commons Attribution License v1.0",description:"Database-specific attribution license.",url:"https://opendatacommons.org/licenses/by/1.0/",allowsResearchUse:!0},{spdxId:"ODbL-1.0",name:"Open Data Commons Open Database License v1.0",description:"Database attribution + share-alike. Produced works can be any license.",url:"https://opendatacommons.org/licenses/odbl/1.0/",allowsResearchUse:!0}],_Ce=new Set(["CC0-1.0","CC-BY-4.0","CC-BY-SA-4.0","CC-BY-NC-4.0","CC-BY-NC-SA-4.0","CC-BY-ND-4.0","CC-BY-NC-ND-4.0","PDDL-1.0","ODC-By-1.0","ODbL-1.0","MIT","Apache-2.0","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","BSD-2-Clause","BSD-3-Clause","ISC","Unlicense"]);function vCe(e){let t=yC(e,"dataset_description.json");if(gC(t))try{let r=JSON.parse(Uq(t,"utf-8"));if(typeof r.License==="string"&&r.License.trim())return{spdxId:r.License.trim(),source:"dataset_description"}}catch(r){if(r instanceof SyntaxError)console.warn(` Warning: dataset_description.json has invalid JSON: ${r.message}`);else console.warn(` Warning: Could not read dataset_description.json: ${r instanceof Error?r.message:String(r)}`)}let n=["LICENSE","LICENSE.txt","LICENSE.md","LICENCE","LICENCE.txt"];for(let r of n){let o=yC(e,r);if(gC(o)){try{let s=Uq(o,"utf-8").toLowerCase();if(s.includes("cc0")||s.includes("public domain dedication"))return{spdxId:"CC0-1.0",source:"license_file"};if(s.includes("attribution-noncommercial-sharealike"))return{spdxId:"CC-BY-NC-SA-4.0",source:"license_file"};if(s.includes("attribution-noncommercial"))return{spdxId:"CC-BY-NC-4.0",source:"license_file"};if(s.includes("attribution-sharealike"))return{spdxId:"CC-BY-SA-4.0",source:"license_file"};if(s.includes("creativecommons")&&s.includes("attribution"))return{spdxId:"CC-BY-4.0",source:"license_file"};if(s.includes("open database license")||s.includes("odbl"))return{spdxId:"ODbL-1.0",source:"license_file"};if(s.includes("open data commons")&&s.includes("attribution"))return{spdxId:"ODC-By-1.0",source:"license_file"};if(s.includes("public domain dedication and license")||s.includes("pddl"))return{spdxId:"PDDL-1.0",source:"license_file"};if(s.includes("permission is hereby granted, free of charge")||s.includes("mit license"))return{spdxId:"MIT",source:"license_file"}}catch(s){console.warn(` Warning: Could not read ${r}: ${s instanceof Error?s.message:String(s)}`)}return{spdxId:void 0,source:"license_file"}}}return{spdxId:void 0,source:"none"}}async function Vq(e){let t=Hq.map((o)=>({name:`${o.spdxId.padEnd(22)} ${o.description}`,value:o.spdxId,short:o.spdxId}));t.push({name:"Other (enter SPDX ID manually)",value:"__custom__",short:"Custom"});let n=e?Hq.find((o)=>o.spdxId===e)?.spdxId:void 0,{selected:r}=await Ae.prompt([{type:"list",name:"selected",message:"Select a license for this dataset:",choices:t,default:n,pageSize:t.length}]);if(r==="__custom__"){let{customId:o}=await Ae.prompt([{type:"input",name:"customId",message:"Enter SPDX license ID (e.g., MIT, Apache-2.0):",validate:(s)=>{if(!s.trim())return"License ID is required";return!0}}]);return o.trim()}return r}function kCe(e){let t=e.toUpperCase().replace(/\s+/g,"-");if(_Ce.has(e))return!0;for(let n of _Ce)if(n.toUpperCase()===t)return!0;return!1}function eNt(e){let t=Hq.find((n)=>n.spdxId===e);if(t)return`${t.name}
|
|
2017
2017
|
|
|
2018
2018
|
${t.url}
|
|
2019
2019
|
|
|
@@ -2022,14 +2022,14 @@ See the URL above for the full license text.
|
|
|
2022
2022
|
`;return`SPDX-License-Identifier: ${e}
|
|
2023
2023
|
|
|
2024
2024
|
Please see https://spdx.org/licenses/${e}.html for the full license text.
|
|
2025
|
-
`}function ECe(e,t){let n=yC(e,"LICENSE");if(gC(n))return!1;return xCe(n,eNt(t)),!0}function SCe(e,t){let n=yC(e,"dataset_description.json");if(!gC(n))return;let r=JSON.parse(
|
|
2025
|
+
`}function ECe(e,t){let n=yC(e,"LICENSE");if(gC(n))return!1;return xCe(n,eNt(t)),!0}function SCe(e,t){let n=yC(e,"dataset_description.json");if(!gC(n))return;let r=JSON.parse(Uq(n,"utf-8"));r.License=t,xCe(n,`${JSON.stringify(r,null,2)}
|
|
2026
2026
|
`)}Qs();var tNt={"CC0-1.0":{allows:["*"],note:"Public domain; no restrictions on derivative licenses."},"PDDL-1.0":{allows:["*"],note:"Public domain dedication; no restrictions on derivative licenses."},"CC-BY-4.0":{allows:["*"],note:"Any license is allowed as long as attribution is given."},"CC-BY-SA-4.0":{allows:["CC-BY-SA-4.0"],note:"Share-alike: derivative datasets must use CC-BY-SA-4.0."},"CC-BY-NC-4.0":{allows:["CC-BY-NC-4.0","CC-BY-NC-SA-4.0","CC-BY-NC-ND-4.0"],note:"NonCommercial: derivative datasets must also be NonCommercial."},"CC-BY-NC-SA-4.0":{allows:["CC-BY-NC-SA-4.0"],note:"NonCommercial + ShareAlike: derivative must use CC-BY-NC-SA-4.0."},"ODC-By-1.0":{allows:["*"],note:"Any license allowed with attribution."},"ODbL-1.0":{allows:["ODbL-1.0"],note:"Share-alike for databases: derivative databases must use ODbL-1.0."},"CC-BY-ND-4.0":{allows:[],note:"NoDerivatives: derivative datasets are not permitted under this license."},"CC-BY-NC-ND-4.0":{allows:[],note:"NonCommercial-NoDerivatives: derivative datasets are not permitted under this license."}};function nNt(e,t){let n=tNt[e];if(!n)return{compatible:!0,reason:`Source license "${e}" is not in the compatibility table. Please verify compatibility manually.`};if(n.allows.includes("*")||n.allows.includes(t))return{compatible:!0,reason:n.note??"Compatible."};return{compatible:!1,reason:`Source license "${e}" does not allow derivative datasets to be licensed as "${t}". ${n.note??""} Allowed target licenses: ${n.allows.join(", ")}.`}}async function $Ce(e){let{isDerived:t}=await Ae.prompt([{type:"confirm",name:"isDerived",message:"Is this dataset derived from or based on another existing dataset?",default:!1}]);if(!t){let{confirmed:s}=await Ae.prompt([{type:"confirm",name:"confirmed",message:"Do you confirm you have the right to upload and share this dataset under the selected license?",default:!0}]);if(!s)throw Error("Upload cancelled: you must confirm redistribution rights before uploading.");return{isDerived:!1,confirmedRedistributionRights:!0}}let n=[],r=!0;console.log(`
|
|
2027
2027
|
Provide source dataset information so we can check license compatibility.`);while(r){let{identifier:s}=await Ae.prompt([{type:"input",name:"identifier",message:`Source dataset DOI or URL${n.length>0?" (or leave empty to stop)":""}:`,validate:(l)=>{if(n.length>0&&!l.trim())return!0;if(!l.trim())return"At least one source dataset is required for derived data.";return!0}}]);if(!s.trim()){r=!1;break}let{sourceLicense:i}=await Ae.prompt([{type:"input",name:"sourceLicense",message:`License of "${s}" (SPDX ID, e.g. CC-BY-4.0):`,validate:(l)=>{if(!l.trim())return"Source license is required.";return!0}}]),a=nNt(i.trim(),e);if(!a.compatible){console.error(`
|
|
2028
2028
|
Warning: License incompatibility detected.`),console.error(` ${a.reason}`),console.error(` You should change your target license or verify this derivation is permitted.
|
|
2029
2029
|
`);let{continueAnyway:l}=await Ae.prompt([{type:"confirm",name:"continueAnyway",message:"Continue despite the incompatibility warning?",default:!1}]);if(!l)throw Error("Upload cancelled due to license incompatibility.")}else if(a.reason&&!a.reason.includes("Compatible."))console.log(`
|
|
2030
2030
|
Note: ${a.reason}
|
|
2031
|
-
`);n.push({identifier:s.trim(),license:i.trim()});let{more:c}=await Ae.prompt([{type:"confirm",name:"more",message:"Add another source dataset?",default:!1}]);r=c}let{confirmed:o}=await Ae.prompt([{type:"confirm",name:"confirmed",message:"Do you confirm you have the right to redistribute this derived dataset under the selected license, respecting the source dataset(s) terms?",default:!0}]);if(!o)throw Error("Upload cancelled: redistribution rights must be confirmed before uploading.");return{isDerived:!0,sourceDatasets:n,confirmedRedistributionRights:!0}}async function LCe(e,t){let n=D("Analyzing dataset files...").start(),r={};try{let i=Kp(e,"dataset_description.json");r=JSON.parse(Y_(i,"utf-8"))}catch(i){if(i.code!=="ENOENT")console.log(u.yellow(`Warning: Could not read dataset_description.json: ${i.message}`))}let o=t.name||(typeof r.Name==="string"?r.Name:null)||wNt(e),s=await ywe(e);return n.succeed(`Found ${s.files.length} files (${s.dataFiles} data, ${s.metadataFiles} metadata)`),{datasetName:o,manifest:s,bidsDescription:r}}async function qCe(e,t,n){let r,o=Kp(e,".nemar","metadata.json"),s=Kp(e,"nemar_metadata.json");if(J_(o))try{r=JSON.parse(Y_(o,"utf-8")),console.log(u.dim(" Using existing .nemar/metadata.json (author ORCIDs from prior run)"))}catch(i){console.log(u.yellow(` Warning: Could not read .nemar/metadata.json: ${i instanceof Error?i.message:i}. Will re-collect author information.`))}else if(J_(s))try{r=JSON.parse(Y_(s,"utf-8")),console.log(u.dim(" Using existing nemar_metadata.json (author ORCIDs from prior run)"))}catch(i){console.log(u.yellow(` Warning: Could not read nemar_metadata.json: ${i instanceof Error?i.message:i}. Will re-collect author information.`))}if(!r&&!t.skipOrcid&&process.stdin.isTTY){let i=n.Authors,a=Array.isArray(i)?i.filter((c)=>typeof c==="string"):[];if(a.length>0)try{let c,l;try{let p=await Qr();c=p.orcid||void 0,l=p.username??void 0}catch(p){console.log(u.dim(` Could not fetch profile: ${G(p)}`))}console.log(),console.log(u.cyan("Authors found:"),a.join(" | "));let d={},f;if(c&&l){let p=l.toLowerCase(),m=a.find((h)=>h.toLowerCase().includes(p));if(m)d[m]={orcid:c},f=m,console.log(` Your ORCID (from profile): ${u.green(c)} (matched to "${m}")`)}try{await Promise.resolve().then(() => MCe());let m=D("Looking up author ORCIDs from referenced publications...").start(),h=await FCe(n,d),g=Object.keys(h.discoveries).length;if(g>0){m.succeed(`Found ${g} ORCID(s) from referenced DOIs`);for(let[b,_]of Object.entries(h.discoveries))console.log(` ${u.green(_.orcid)} -> "${b}" (from ${_.sourceDoi}, ${_.confidence} match)`);let{confirmOrcids:y}=await Ae.prompt([{type:"confirm",name:"confirmOrcids",message:"Accept these auto-discovered ORCIDs?",default:!0}]);if(y)for(let[b,_]of Object.entries(h.discoveries))d[b]={...d[b],orcid:_.orcid,..._.affiliations&&{affiliations:_.affiliations}}}else m.info("No ORCIDs found from referenced DOIs")}catch(p){console.log(u.yellow(` Could not auto-discover ORCIDs: ${G(p)}`))}for(let p of a){if(p===f)continue;if(d[p]?.orcid)continue;let{orcid:m}=await Ae.prompt([{type:"input",name:"orcid",message:`ORCID for "${p}" (Enter to skip):`,validate:(h)=>{if(!h)return!0;return US.test(h)||"Invalid ORCID format (XXXX-XXXX-XXXX-XXXX)"}}]);if(m){let h={orcid:m},{affiliation:g}=await Ae.prompt([{type:"input",name:"affiliation",message:` Affiliation for "${p}" (optional):`}]);if(g)h.affiliations=[{name:g}];d[p]=h}}if(Object.keys(d).length>0){r={version:"2.0",authors:d};try{let p=Kp(e,".nemar");if(!J_(p))bNt(p,{recursive:!0});let m=Kp(p,"metadata.json");jCe(m,JSON.stringify(r,null,2)),console.log(u.dim(" Saved .nemar/metadata.json with author ORCIDs"))}catch(p){console.log(u.yellow(` Warning: Could not save .nemar/metadata.json: ${G(p)}`))}}console.log()}catch(c){if(c instanceof L)console.log(u.yellow(` Could not fetch profile: ${c.message}`));else console.log(u.yellow(` Could not collect ORCIDs: ${G(c)}`));console.log(u.dim(" Continuing without author enrichment."))}}return r}async function BCe(e,t){let n;if(process.stdin.isTTY&&!t.skipValidation){let r=vCe(e);if(r.spdxId){if(console.log(),console.log(u.cyan("License detected:"),u.bold(r.spdxId),u.dim(`(from ${r.source==="dataset_description"?"dataset_description.json":"LICENSE file"})`)),!kCe(r.spdxId))console.log(u.yellow(` Warning: "${r.spdxId}" is not in the list of known research-compatible licenses.`));let{keepLicense:s}=await Ae.prompt([{type:"confirm",name:"keepLicense",message:`Use "${r.spdxId}" as the dataset license?`,default:!0}]);if(s)n=r.spdxId;else n=await
|
|
2032
|
-
`),console.log(u.dim(` Updated dataset_description.json SourceDatasets (${c.length} source(s))`))}}catch(o){console.log(u.yellow(` Warning: Could not update SourceDatasets: ${G(o)}`))}console.log()}}}He();CD();PD();jd();wp();function HCe(e,t,n){if(t&&t.dataset_id!==n)return console.log(u.yellow(" Progress file is for a different dataset; starting fresh.")),Nw(e),null;return t}function VCe(e,t,n,r){let o=Y6(e);if(console.log(),o)console.log(u.bold.yellow("Resume Upload:")),console.log(` Dataset ID: ${u.cyan(o.dataset_id)}`),console.log(` Last attempt: ${o.last_upload_at||o.created_at}`);else console.log(u.bold("Upload Plan:"));if(console.log(` Name: ${t}`),console.log(` Path: ${e}`),console.log(` Files: ${n.files.length}`),console.log(` Size: ${Ut(n.totalSize)}`),console.log(` Data files: ${n.dataFiles} (will be uploaded to S3)`),console.log(` Metadata files: ${n.metadataFiles} (will be stored in git)`),console.log(` Local git-annex add workers: ${r.annexJobs??Qg}`),console.log(` Parallel S3 copy streams: ${r.jobs}`),console.log(),r.dryRun)return console.log(u.yellow("Dry run mode - no changes made")),Q_e;return mn({existingConfig:o})}function zCe(e,t){return e?K_e(e,t):t}function GCe(e,t,n){let r=t.files.filter((s)=>s.type==="data");if(n.restart)Nw(e),console.log(u.dim(" Upload progress cleared (--restart)")),console.log();let o=n.restart?null:V_e(e);if(o){let s=J_e(o);if(console.log(u.bold.cyan("Upload Progress:")),console.log(` Files: ${s.uploaded}/${s.total} uploaded, ${s.failed} failed, ${s.pending} pending`),s.completedSteps.length>0)console.log(` Completed steps: ${s.completedSteps.join(", ")}`);console.log()}return{dataFiles:r,uploadProgress:o}}He();uo();import{existsSync as _Nt}from"fs";import{resolve as xNt}from"path";uh();fh();ze();bp();cc();qt();wp();var vNt=17179869184;function kNt(e){let t=e.trim();if(t==="unlimited")return"unlimited";if(!/^\d+$/.test(t))return null;return Number(t)*1024}async function ENt(){try{let{stdout:e,exitCode:t}=await R(["sh","-c","ulimit -v"]);if(t!==0)return null;return kNt(e)}catch{return null}}async function WCe(e={}){let t=D("Checking upload access...").start(),n;try{n=await Qr()}catch(r){return t.warn(nl(ar("cli.upload.preflight.unchecked"),{reason:G(r)})),console.log(),mn()}if(n.service_access===!0)return t.succeed("Upload access granted"),console.log(),mn();if(n.service_access===void 0)return t.warn(nl(ar("cli.upload.preflight.unchecked"),{reason:"this backend does not report it"})),console.log(),mn();if(t.warn(ar("cli.upload.preflight.title")),console.log(),console.log(` ${ar("cli.upload.preflight.body")}`),n.profile_gaps===void 0)console.log(),console.log(` ${u.dim(ar("cli.upload.preflight.gaps_unknown"))}`);else{let r=yk(n.profile_gaps,{orcidVerified:n.orcid_verified===!0}).filter((o)=>o.blocks.includes("upload_access"));if(r.length>0)U1(ar("gaps.upload.title"),r)}if(console.log(),console.log(` ${u.cyan(ar("cli.upload_access.cta"))}`),e.dryRun)return console.log(` ${u.dim(ar("cli.upload.preflight.dry_run"))}`),console.log(),mn();return console.log(),Ne}async function KCe(){let e=D("Checking prerequisites...").start(),t=await C$();if(!t.allPassed){e.fail("Prerequisites check failed"),console.log();for(let r of t.errors)console.log(u.red(` - ${r}`));return Ne}if(e.succeed("Prerequisites check passed"),console.log(u.dim(` git-annex ${t.gitAnnex.version}`)),t.githubSSH.username)console.log(u.dim(` GitHub: ${t.githubSSH.username}`));let n=await ENt();if(typeof n==="number"&&n<vNt)console.log(u.yellow(` Warning: virtual memory limit is ${Ut(n)} (ulimit -v).`)),console.log(u.yellow(" git-annex may be killed with out-of-memory errors while tracking data files.")),console.log(u.yellow(" On HPC systems, run the upload from a compute node or raise the limit (ulimit -v unlimited)."));return console.log(),mn()}async function JCe(e){let t=D("Verifying GitHub CLI authentication...").start(),n=await QS(e.githubUsername);if(!n.authenticated)return _o(t,"GitHub CLI not authenticated",n.error),console.log(),console.log("GitHub CLI is required for dataset uploads. Install and authenticate:"),console.log(u.cyan(" brew install gh # or visit https://cli.github.com/")),console.log(u.cyan(" gh auth login")),Ne;if(e.githubUsername&&!n.matches)t.warn("GitHub CLI user mismatch"),console.log(u.yellow(` ${n.error}`)),console.log(),console.log("Your gh CLI is authenticated as a different GitHub account than your NEMAR account."),console.log("This may cause issues with repository access. To fix:"),console.log(u.cyan(` gh auth login # Login as ${e.githubUsername}`)),console.log(),console.log(u.yellow("WARNING: If upload fails with permission errors, this mismatch is the likely cause.")),console.log();else t.succeed(`GitHub CLI authenticated as ${n.username}`);return mn()}async function YCe(e,t){if(!t.skipValidation){let n=D("Validating BIDS dataset...").start(),r=xNt(e,"dataset_description.json");if(!_Nt(r))return n.fail("Not a valid BIDS dataset"),console.log(u.red("Missing required file: dataset_description.json")),Ne;if(!(await Oy()).installed)return n.fail("Deno is required for BIDS validation"),console.log(),console.log(u.red("Error: Deno is not installed")),console.log(),console.log("The BIDS validator requires Deno runtime to run."),console.log("Install Deno with one of these commands:"),console.log(),console.log(u.cyan(" # macOS/Linux (curl)")),console.log(" curl -fsSL https://deno.land/install.sh | sh"),console.log(),console.log(u.cyan(" # macOS (Homebrew)")),console.log(" brew install deno"),console.log(),console.log(u.cyan(" # Windows (PowerShell)")),console.log(" irm https://deno.land/install.ps1 | iex"),console.log(),console.log("Learn more: https://docs.deno.com/runtime/getting_started/installation/"),console.log(),console.log(u.dim("To skip validation (not recommended): nemar dataset upload --skip-validation")),Ne;try{let s=await a1e(e,{prune:!0});if(!s.valid)return n.fail("Dataset has validation errors"),console.log(),console.log(d1e(s)),console.log(),console.log(u.yellow("Fix the errors above before uploading.")),console.log(u.dim("Or use --skip-validation to upload anyway (not recommended).")),Ne;n.succeed(`Dataset is valid BIDS (${s.warningCount} warnings)`)}catch(s){return n.fail("Validation failed"),console.log(u.red(s.message)),Ne}console.log()}return mn()}jd();function
|
|
2031
|
+
`);n.push({identifier:s.trim(),license:i.trim()});let{more:c}=await Ae.prompt([{type:"confirm",name:"more",message:"Add another source dataset?",default:!1}]);r=c}let{confirmed:o}=await Ae.prompt([{type:"confirm",name:"confirmed",message:"Do you confirm you have the right to redistribute this derived dataset under the selected license, respecting the source dataset(s) terms?",default:!0}]);if(!o)throw Error("Upload cancelled: redistribution rights must be confirmed before uploading.");return{isDerived:!0,sourceDatasets:n,confirmedRedistributionRights:!0}}async function LCe(e,t){let n=D("Analyzing dataset files...").start(),r={};try{let i=Kp(e,"dataset_description.json");r=JSON.parse(Y_(i,"utf-8"))}catch(i){if(i.code!=="ENOENT")console.log(u.yellow(`Warning: Could not read dataset_description.json: ${i.message}`))}let o=t.name||(typeof r.Name==="string"?r.Name:null)||wNt(e),s=await ywe(e);return n.succeed(`Found ${s.files.length} files (${s.dataFiles} data, ${s.metadataFiles} metadata)`),{datasetName:o,manifest:s,bidsDescription:r}}async function qCe(e,t,n){let r,o=Kp(e,".nemar","metadata.json"),s=Kp(e,"nemar_metadata.json");if(J_(o))try{r=JSON.parse(Y_(o,"utf-8")),console.log(u.dim(" Using existing .nemar/metadata.json (author ORCIDs from prior run)"))}catch(i){console.log(u.yellow(` Warning: Could not read .nemar/metadata.json: ${i instanceof Error?i.message:i}. Will re-collect author information.`))}else if(J_(s))try{r=JSON.parse(Y_(s,"utf-8")),console.log(u.dim(" Using existing nemar_metadata.json (author ORCIDs from prior run)"))}catch(i){console.log(u.yellow(` Warning: Could not read nemar_metadata.json: ${i instanceof Error?i.message:i}. Will re-collect author information.`))}if(!r&&!t.skipOrcid&&process.stdin.isTTY){let i=n.Authors,a=Array.isArray(i)?i.filter((c)=>typeof c==="string"):[];if(a.length>0)try{let c,l;try{let p=await Qr();c=p.orcid||void 0,l=p.username??void 0}catch(p){console.log(u.dim(` Could not fetch profile: ${G(p)}`))}console.log(),console.log(u.cyan("Authors found:"),a.join(" | "));let d={},f;if(c&&l){let p=l.toLowerCase(),m=a.find((h)=>h.toLowerCase().includes(p));if(m)d[m]={orcid:c},f=m,console.log(` Your ORCID (from profile): ${u.green(c)} (matched to "${m}")`)}try{await Promise.resolve().then(() => MCe());let m=D("Looking up author ORCIDs from referenced publications...").start(),h=await FCe(n,d),g=Object.keys(h.discoveries).length;if(g>0){m.succeed(`Found ${g} ORCID(s) from referenced DOIs`);for(let[b,_]of Object.entries(h.discoveries))console.log(` ${u.green(_.orcid)} -> "${b}" (from ${_.sourceDoi}, ${_.confidence} match)`);let{confirmOrcids:y}=await Ae.prompt([{type:"confirm",name:"confirmOrcids",message:"Accept these auto-discovered ORCIDs?",default:!0}]);if(y)for(let[b,_]of Object.entries(h.discoveries))d[b]={...d[b],orcid:_.orcid,..._.affiliations&&{affiliations:_.affiliations}}}else m.info("No ORCIDs found from referenced DOIs")}catch(p){console.log(u.yellow(` Could not auto-discover ORCIDs: ${G(p)}`))}for(let p of a){if(p===f)continue;if(d[p]?.orcid)continue;let{orcid:m}=await Ae.prompt([{type:"input",name:"orcid",message:`ORCID for "${p}" (Enter to skip):`,validate:(h)=>{if(!h)return!0;return US.test(h)||"Invalid ORCID format (XXXX-XXXX-XXXX-XXXX)"}}]);if(m){let h={orcid:m},{affiliation:g}=await Ae.prompt([{type:"input",name:"affiliation",message:` Affiliation for "${p}" (optional):`}]);if(g)h.affiliations=[{name:g}];d[p]=h}}if(Object.keys(d).length>0){r={version:"2.0",authors:d};try{let p=Kp(e,".nemar");if(!J_(p))bNt(p,{recursive:!0});let m=Kp(p,"metadata.json");jCe(m,JSON.stringify(r,null,2)),console.log(u.dim(" Saved .nemar/metadata.json with author ORCIDs"))}catch(p){console.log(u.yellow(` Warning: Could not save .nemar/metadata.json: ${G(p)}`))}}console.log()}catch(c){if(c instanceof L)console.log(u.yellow(` Could not fetch profile: ${c.message}`));else console.log(u.yellow(` Could not collect ORCIDs: ${G(c)}`));console.log(u.dim(" Continuing without author enrichment."))}}return r}async function BCe(e,t){let n;if(process.stdin.isTTY&&!t.skipValidation){let r=vCe(e);if(r.spdxId){if(console.log(),console.log(u.cyan("License detected:"),u.bold(r.spdxId),u.dim(`(from ${r.source==="dataset_description"?"dataset_description.json":"LICENSE file"})`)),!kCe(r.spdxId))console.log(u.yellow(` Warning: "${r.spdxId}" is not in the list of known research-compatible licenses.`));let{keepLicense:s}=await Ae.prompt([{type:"confirm",name:"keepLicense",message:`Use "${r.spdxId}" as the dataset license?`,default:!0}]);if(s)n=r.spdxId;else n=await Vq(r.spdxId)}else{if(console.log(),r.source==="license_file")console.log(u.yellow("A LICENSE file was found but the license could not be identified automatically."));else console.log(u.yellow("No license found in this dataset."));console.log(u.dim("A license is required to publish on NEMAR.")),n=await Vq()}try{let s=Kp(e,"dataset_description.json");if(J_(s)){if(JSON.parse(Y_(s,"utf-8")).License!==n)SCe(e,n),console.log(u.dim(` Updated dataset_description.json License -> ${n}`))}}catch(s){console.log(u.yellow(` Warning: Could not update license in dataset_description.json: ${G(s)}`))}if(ECe(e,n))console.log(u.dim(` Created LICENSE file (${n})`));console.log()}return n}async function UCe(e,t,n){if(process.stdin.isTTY&&!t.skipValidation&&n){let r=await $Ce(n);if(r.isDerived&&r.sourceDatasets&&r.sourceDatasets.length>0){try{let o=Kp(e,"dataset_description.json");if(J_(o)){let s=JSON.parse(Y_(o,"utf-8")),i=Array.isArray(s.SourceDatasets)?s.SourceDatasets:[],a=r.sourceDatasets.map((l)=>l.identifier),c=Array.from(new Set([...i,...a]));s.SourceDatasets=c,jCe(o,`${JSON.stringify(s,null,2)}
|
|
2032
|
+
`),console.log(u.dim(` Updated dataset_description.json SourceDatasets (${c.length} source(s))`))}}catch(o){console.log(u.yellow(` Warning: Could not update SourceDatasets: ${G(o)}`))}console.log()}}}He();CD();PD();jd();wp();function HCe(e,t,n){if(t&&t.dataset_id!==n)return console.log(u.yellow(" Progress file is for a different dataset; starting fresh.")),Nw(e),null;return t}function VCe(e,t,n,r){let o=Y6(e);if(console.log(),o)console.log(u.bold.yellow("Resume Upload:")),console.log(` Dataset ID: ${u.cyan(o.dataset_id)}`),console.log(` Last attempt: ${o.last_upload_at||o.created_at}`);else console.log(u.bold("Upload Plan:"));if(console.log(` Name: ${t}`),console.log(` Path: ${e}`),console.log(` Files: ${n.files.length}`),console.log(` Size: ${Ut(n.totalSize)}`),console.log(` Data files: ${n.dataFiles} (will be uploaded to S3)`),console.log(` Metadata files: ${n.metadataFiles} (will be stored in git)`),console.log(` Local git-annex add workers: ${r.annexJobs??Qg}`),console.log(` Parallel S3 copy streams: ${r.jobs}`),console.log(),r.dryRun)return console.log(u.yellow("Dry run mode - no changes made")),Q_e;return mn({existingConfig:o})}function zCe(e,t){return e?K_e(e,t):t}function GCe(e,t,n){let r=t.files.filter((s)=>s.type==="data");if(n.restart)Nw(e),console.log(u.dim(" Upload progress cleared (--restart)")),console.log();let o=n.restart?null:V_e(e);if(o){let s=J_e(o);if(console.log(u.bold.cyan("Upload Progress:")),console.log(` Files: ${s.uploaded}/${s.total} uploaded, ${s.failed} failed, ${s.pending} pending`),s.completedSteps.length>0)console.log(` Completed steps: ${s.completedSteps.join(", ")}`);console.log()}return{dataFiles:r,uploadProgress:o}}He();uo();import{existsSync as _Nt}from"fs";import{resolve as xNt}from"path";uh();fh();ze();bp();cc();qt();wp();var vNt=17179869184;function kNt(e){let t=e.trim();if(t==="unlimited")return"unlimited";if(!/^\d+$/.test(t))return null;return Number(t)*1024}async function ENt(){try{let{stdout:e,exitCode:t}=await R(["sh","-c","ulimit -v"]);if(t!==0)return null;return kNt(e)}catch{return null}}async function WCe(e={}){let t=D("Checking upload access...").start(),n;try{n=await Qr()}catch(r){return t.warn(nl(ar("cli.upload.preflight.unchecked"),{reason:G(r)})),console.log(),mn()}if(n.service_access===!0)return t.succeed("Upload access granted"),console.log(),mn();if(n.service_access===void 0)return t.warn(nl(ar("cli.upload.preflight.unchecked"),{reason:"this backend does not report it"})),console.log(),mn();if(t.warn(ar("cli.upload.preflight.title")),console.log(),console.log(` ${ar("cli.upload.preflight.body")}`),n.profile_gaps===void 0)console.log(),console.log(` ${u.dim(ar("cli.upload.preflight.gaps_unknown"))}`);else{let r=yk(n.profile_gaps,{orcidVerified:n.orcid_verified===!0}).filter((o)=>o.blocks.includes("upload_access"));if(r.length>0)U1(ar("gaps.upload.title"),r)}if(console.log(),console.log(` ${u.cyan(ar("cli.upload_access.cta"))}`),e.dryRun)return console.log(` ${u.dim(ar("cli.upload.preflight.dry_run"))}`),console.log(),mn();return console.log(),Ne}async function KCe(){let e=D("Checking prerequisites...").start(),t=await C$();if(!t.allPassed){e.fail("Prerequisites check failed"),console.log();for(let r of t.errors)console.log(u.red(` - ${r}`));return Ne}if(e.succeed("Prerequisites check passed"),console.log(u.dim(` git-annex ${t.gitAnnex.version}`)),t.githubSSH.username)console.log(u.dim(` GitHub: ${t.githubSSH.username}`));let n=await ENt();if(typeof n==="number"&&n<vNt)console.log(u.yellow(` Warning: virtual memory limit is ${Ut(n)} (ulimit -v).`)),console.log(u.yellow(" git-annex may be killed with out-of-memory errors while tracking data files.")),console.log(u.yellow(" On HPC systems, run the upload from a compute node or raise the limit (ulimit -v unlimited)."));return console.log(),mn()}async function JCe(e){let t=D("Verifying GitHub CLI authentication...").start(),n=await QS(e.githubUsername);if(!n.authenticated)return _o(t,"GitHub CLI not authenticated",n.error),console.log(),console.log("GitHub CLI is required for dataset uploads. Install and authenticate:"),console.log(u.cyan(" brew install gh # or visit https://cli.github.com/")),console.log(u.cyan(" gh auth login")),Ne;if(e.githubUsername&&!n.matches)t.warn("GitHub CLI user mismatch"),console.log(u.yellow(` ${n.error}`)),console.log(),console.log("Your gh CLI is authenticated as a different GitHub account than your NEMAR account."),console.log("This may cause issues with repository access. To fix:"),console.log(u.cyan(` gh auth login # Login as ${e.githubUsername}`)),console.log(),console.log(u.yellow("WARNING: If upload fails with permission errors, this mismatch is the likely cause.")),console.log();else t.succeed(`GitHub CLI authenticated as ${n.username}`);return mn()}async function YCe(e,t){if(!t.skipValidation){let n=D("Validating BIDS dataset...").start(),r=xNt(e,"dataset_description.json");if(!_Nt(r))return n.fail("Not a valid BIDS dataset"),console.log(u.red("Missing required file: dataset_description.json")),Ne;if(!(await Oy()).installed)return n.fail("Deno is required for BIDS validation"),console.log(),console.log(u.red("Error: Deno is not installed")),console.log(),console.log("The BIDS validator requires Deno runtime to run."),console.log("Install Deno with one of these commands:"),console.log(),console.log(u.cyan(" # macOS/Linux (curl)")),console.log(" curl -fsSL https://deno.land/install.sh | sh"),console.log(),console.log(u.cyan(" # macOS (Homebrew)")),console.log(" brew install deno"),console.log(),console.log(u.cyan(" # Windows (PowerShell)")),console.log(" irm https://deno.land/install.ps1 | iex"),console.log(),console.log("Learn more: https://docs.deno.com/runtime/getting_started/installation/"),console.log(),console.log(u.dim("To skip validation (not recommended): nemar dataset upload --skip-validation")),Ne;try{let s=await a1e(e,{prune:!0});if(!s.valid)return n.fail("Dataset has validation errors"),console.log(),console.log(d1e(s)),console.log(),console.log(u.yellow("Fix the errors above before uploading.")),console.log(u.dim("Or use --skip-validation to upload anyway (not recommended).")),Ne;n.succeed(`Dataset is valid BIDS (${s.warningCount} warnings)`)}catch(s){return n.fail("Validation failed"),console.log(u.red(s.message)),Ne}console.log()}return mn()}jd();function Gq(e,t){return e.startsWith("on")||t==="openneuro"}function XCe(e){if(!Gq(e.datasetId,e.source))return null;let t=$l(e.current),n=$l(e.next);if(!t||!n)return`${e.datasetId} is a mirror, and its version ${JSON.stringify(e.current)} -> ${JSON.stringify(e.next)} cannot be read as two releases, so whether it is a major (an upstream re-pull, ADR 0111) is not known; it is not released by hand. A version is of the form X.Y.Z (three numbers, such as 1.2.0, with no prerelease): give one with --version X.Y.Z, or correct the dataset's Version to that form first.`;if(n.major<=t.major)return null;return`A major version of a mirror means an upstream re-pull (ADR 0006, ADR 0111): ${e.datasetId} ${e.current} -> ${e.next} is not released by hand. Plan one with: nemar admin repull plan ${e.datasetId}`}function lAe(e){if(e instanceof L){if(e.statusCode===404)return"Dataset not found";if(e.statusCode===403)return"Dataset not accessible";return`Could not read the dataset (HTTP ${e.statusCode})`}return"Could not reach the backend"}var Nn=new de("dataset").description("Dataset management").addHelpText("after",`
|
|
2033
2033
|
Description:
|
|
2034
2034
|
Manage BIDS datasets on NEMAR. Upload, download, validate, and version
|
|
2035
2035
|
neurophysiology datasets in Brain Imaging Data Structure (BIDS) format.
|
|
@@ -2078,9 +2078,9 @@ Learn More:
|
|
|
2078
2078
|
$ nemar dataset validate ./ds --prune # Skip derivatives
|
|
2079
2079
|
$ nemar dataset validate ./ds --json > out.json # JSON for scripting
|
|
2080
2080
|
$ nemar dataset validate ./ds --ignoreNiftiHeaders # Pass-through flag
|
|
2081
|
-
$ nemar dataset validate ./ds --max-rows 0 # Headers only`).action(async(e,t)=>{if(t.update){if(!(await Oy()).installed)console.log(u.red("Deno is not installed")),console.log("Install Deno: https://deno.com"),process.exit(1);let d=await
|
|
2081
|
+
$ nemar dataset validate ./ds --max-rows 0 # Headers only`).action(async(e,t)=>{if(t.update){if(!(await Oy()).installed)console.log(u.red("Deno is not installed")),console.log("Install Deno: https://deno.com"),process.exit(1);let d=await bq(),f=D("Updating BIDS validator to latest version...").start(),p=await yq();if(!p)f.fail("Failed to update BIDS validator"),process.exit(1);if(d&&d!==p)f.succeed(`BIDS validator updated: ${d} -> ${p}`);else f.succeed(`BIDS validator is up to date (v${p})`);if(!e||e==="."){let m=process.cwd();if(!bs(qs(m,"dataset_description.json")))return}}if(t.versionInfo){let l=await Oy();if(!l.installed)console.log(u.red("Deno is not installed")),console.log("Install Deno: https://deno.com"),process.exit(1);let d=gq(),f=await bq();console.log(`BIDS Validator: ${f||"unknown"}${d?u.yellow(" (cache may be stale, run --update to refresh)"):""}`),console.log(`Deno: ${l.version||"unknown"}`);return}if(!e)console.log(u.red("Error: Missing required argument: path")),console.log("Usage: nemar dataset validate <path>"),process.exit(1);if(!(await Oy()).installed)console.log(u.red("Error: Deno is required for BIDS validation")),console.log(),console.log("The BIDS validator runs on Deno runtime."),console.log("Install Deno with one of these commands:"),console.log(),console.log(u.cyan(" # macOS/Linux (curl)")),console.log(" curl -fsSL https://deno.land/install.sh | sh"),console.log(),console.log(u.cyan(" # macOS (Homebrew)")),console.log(" brew install deno"),console.log(),console.log(u.cyan(" # Windows (PowerShell)")),console.log(" irm https://deno.land/install.ps1 | iex"),console.log(),console.log("Learn more: https://docs.deno.com/runtime/getting_started/installation/"),process.exit(1);let r=!!t.update;if(!r&&gq()){let l=D("Checking for BIDS validator updates...").start(),d=await yq();if(d)l.succeed(`BIDS validator updated to v${d}`);else l.info("Could not check for validator updates, using cached version")}let o=qs(e);if(!bs(o))console.log(u.red(`Error: Path does not exist: ${o}`)),process.exit(1);let s=qs(o,"dataset_description.json");if(!bs(s))console.log(u.red("Error: Not a valid BIDS dataset")),console.log("Missing required file: dataset_description.json"),console.log(`Path: ${o}`),process.exit(1);let i=DNt(),a=l1e(i),c=D("Validating BIDS dataset...").start();try{let{stdout:l,stderr:d,exitCode:f}=await c1e(o,{config:t.config,ignoreWarnings:t.ignoreWarnings,recursive:t.recursive,prune:t.prune,verbose:t.verbose,json:t.json,extraArgs:i,forceReload:r}),p=a!==void 0&&f===oC;if(!l.trim()&&f!==0&&!p){if(c.fail("Validation failed"),d.trim()){let m=d.split(`
|
|
2082
2082
|
`).filter((h)=>!h.includes("Ignored build scripts")).join(`
|
|
2083
|
-
`).trim();if(m)console.error(m)}process.exit(1)}if(f!==0&&f!==oC)c.fail("Validation failed"),console.error(d.trim()||l.trim()||`BIDS validator exited with code ${f}`),process.exit(f);if(a)u1e(qs(a),Boolean(t.json));if(c.succeed("Validation complete"),t.json){if(!a)console.log(
|
|
2083
|
+
`).trim();if(m)console.error(m)}process.exit(1)}if(f!==0&&f!==oC)c.fail("Validation failed"),console.error(d.trim()||l.trim()||`BIDS validator exited with code ${f}`),process.exit(f);if(a)u1e(qs(a),Boolean(t.json));if(c.succeed("Validation complete"),t.json){if(!a)console.log(wq(l));else if(l.trim())console.log(l)}else{if(l.trim())console.log(l);console.log(`Validator: @bids/validator ${Ay}`)}process.exit(f)}catch(l){c.fail("Validation failed"),console.error(u.red(l.message)),process.exit(1)}});function DNt(){let e=new Set(["--ignore-warnings","--config","-c","--recursive","-r","--prune","--verbose","-v","--json","--version-info","--help","-h"]),t=[],n=process.argv.indexOf("validate");if(n<0)return t;let r=process.argv.slice(n+1);for(let o=0;o<r.length;o++){let s=r[o];if(!s.startsWith("-"))continue;if(e.has(s)){if(s==="--config"||s==="-c")o++;continue}if(t.push(s),o+1<r.length&&!r[o+1].startsWith("-"))t.push(r[o+1]),o++}return t}function Jq(){return new de("upload").description("Upload a BIDS dataset to NEMAR").argument("<path>","Path to BIDS dataset directory").option("-n, --name <name>","Dataset name (defaults to BIDS Name, then directory name)").option("-d, --description <desc>","Dataset description").option("--skip-validation","Skip BIDS validation (not recommended)").option("--skip-orcid","Skip co-author ORCID collection").option("--dry-run","Show what would be uploaded without doing it").option("-j, --jobs <number>","Parallel S3 copy streams","4").option("--annex-jobs <number>","Parallel local git-annex add workers",String(Qg)).option(Xe,nt).option("--restart","Clear upload progress and re-upload all files").option("--no",gt).option("--deposit-type <type>","Attestation: 'owner' or 'redistribution' (non-interactive)").option("--key-status <status>","Attestation: re-identification key 'destroyed' or 'retained'").option("--confirm-deidentified","Attestation: confirm the dataset contains no identifiable personal information").option("--affirm-no-duplicate","Attestation (redistribution only): affirm the dataset is not already archived in BIDS format").option("--upstream-source <ref>","Attestation (redistribution only): upstream release URL or accession").option("--dataset-id <id>","Name the dataset id instead of being allocated one (admin, non-production, reserved fixture band only)").addOption(new tm(`${Wp} <verdicts>`,`Upload despite what the identifier preflight found, naming every condition it reports (non-interactive; recorded; repeatable or comma-separated: ${JR.join(", ")}). Direct identifiers cannot be acknowledged`).argParser(sCe)).addHelpText("after",({command:e})=>`
|
|
2084
2084
|
Description:
|
|
2085
2085
|
Upload a BIDS dataset to NEMAR. The dataset will be validated, assigned
|
|
2086
2086
|
a unique ID (nm000XXX), and stored on GitHub (metadata) and S3 (data files).
|
|
@@ -2125,9 +2125,9 @@ Examples:
|
|
|
2125
2125
|
$ ${nr(e)} ./ds --dry-run # Preview without uploading
|
|
2126
2126
|
$ ${nr(e)} ./ds -j 16 # More parallel S3 copy streams
|
|
2127
2127
|
$ ${nr(e)} ./ds --annex-jobs 8 # More local git-annex add workers
|
|
2128
|
-
$ ${nr(e)} ./ds --dataset-id nm099998 # Standing fixture (admin, staging)`).action(async(e,t)=>{let n=String(t.jobs),r=Number.parseInt(n,10);if(!/^\d+$/.test(n)||!Number.isSafeInteger(r)||r<1)console.log(u.red(`Error: --jobs must be a positive integer (got "${t.jobs}").`)),process.exit(1);let o=Number(t.annexJobs);if(!Number.isSafeInteger(o)||o<1)console.log(u.red(`Error: --annex-jobs must be a positive integer (got "${t.annexJobs}").`)),process.exit(1);let s=zt();Lr();let i=await cC();if(i.status==="not_completed")console.log(u.yellow(bk())),console.log(),console.log("It verifies your setup and familiarizes you with the workflow."),process.exit(1);if(i.status==="unknown")console.log(u.yellow(UZ())),console.log(u.dim(` ${i.reason}`)),console.log(),process.exit(1);if((await WCe({dryRun:t.dryRun})).status==="fail")process.exit(1);let a=qs(e);if(!bs(a))console.log(u.red(`Error: Path does not exist: ${a}`)),process.exit(1);let c=await bCe(a),l=await uCe(a,t,void 0,c);if(l.status==="fail")process.exit(1);let d=l.value;if(await Uf("upload"),(await KCe()).status==="fail")process.exit(1);if((await JCe(s)).status==="fail")process.exit(1);if((await YCe(a,t)).status==="fail")process.exit(1);let{datasetName:f,manifest:p,bidsDescription:m}=await LCe(a,t),h=await qCe(a,t,m),g=await BCe(a,t);await UCe(a,t,g);let y=VCe(a,f,p,t);if(y.status==="stop")return;let{existingConfig:b}=y.value,_;try{_=await QRe(t)}catch(O){console.log(u.red(O instanceof Error?O.message:String(O))),process.exit(1)}let x=await De("Proceed with upload?",{yes:t.yes,no:t.no},!0);if(x!=="confirmed"){console.log(x==="declined"?"Upload skipped.":"Upload cancelled.");return}if(console.log(),d===null)console.log(u.red("Identifier preflight: no record to send. Nothing was sent.")),process.exit(1);let k=wCe(a,c);for(let O of p.files){let H=k.mtimes.get(O.path);if(H!==void 0)O.mtimeMs=H}let v=await dCe(a,d);if(v.status==="fail")process.exit(1);let{dataFiles:C,uploadProgress:T}=GCe(a,p,t),V=await nxe(a,t,f,C,b,_,v.value);if(V.status==="fail")process.exit(1);let A=V.value,F=HCe(a,T,A.dataset_id),M=zCe(F,C);if((await rxe(A)).status==="fail")process.exit(1);let U=s.username&&s.email?{name:s.username,email:s.email}:void 0;if((await oxe(a,U)).status==="fail")process.exit(1);if((await sxe(a,A,t)).status==="fail")process.exit(1);let B=await H1e({absolutePath:a,options:t,dataFiles:C,filesToUpload:M,uploadProgress:F,datasetInfo:A,coAuthorEnrichment:h,author:U});if(B.status==="fail")process.exit(1);if(F=B.value,(await q1e(a,F)).status==="fail")process.exit(1);let P=await B1e(a,A.dataset_id,F);U1e(a,A,P)})}Nn.addCommand(
|
|
2128
|
+
$ ${nr(e)} ./ds --dataset-id nm099998 # Standing fixture (admin, staging)`).action(async(e,t)=>{let n=String(t.jobs),r=Number.parseInt(n,10);if(!/^\d+$/.test(n)||!Number.isSafeInteger(r)||r<1)console.log(u.red(`Error: --jobs must be a positive integer (got "${t.jobs}").`)),process.exit(1);let o=Number(t.annexJobs);if(!Number.isSafeInteger(o)||o<1)console.log(u.red(`Error: --annex-jobs must be a positive integer (got "${t.annexJobs}").`)),process.exit(1);let s=zt();Lr();let i=await cC();if(i.status==="not_completed")console.log(u.yellow(bk())),console.log(),console.log("It verifies your setup and familiarizes you with the workflow."),process.exit(1);if(i.status==="unknown")console.log(u.yellow(UZ())),console.log(u.dim(` ${i.reason}`)),console.log(),process.exit(1);if((await WCe({dryRun:t.dryRun})).status==="fail")process.exit(1);let a=qs(e);if(!bs(a))console.log(u.red(`Error: Path does not exist: ${a}`)),process.exit(1);let c=await bCe(a),l=await uCe(a,t,void 0,c);if(l.status==="fail")process.exit(1);let d=l.value;if(await Uf("upload"),(await KCe()).status==="fail")process.exit(1);if((await JCe(s)).status==="fail")process.exit(1);if((await YCe(a,t)).status==="fail")process.exit(1);let{datasetName:f,manifest:p,bidsDescription:m}=await LCe(a,t),h=await qCe(a,t,m),g=await BCe(a,t);await UCe(a,t,g);let y=VCe(a,f,p,t);if(y.status==="stop")return;let{existingConfig:b}=y.value,_;try{_=await QRe(t)}catch(O){console.log(u.red(O instanceof Error?O.message:String(O))),process.exit(1)}let x=await De("Proceed with upload?",{yes:t.yes,no:t.no},!0);if(x!=="confirmed"){console.log(x==="declined"?"Upload skipped.":"Upload cancelled.");return}if(console.log(),d===null)console.log(u.red("Identifier preflight: no record to send. Nothing was sent.")),process.exit(1);let k=wCe(a,c);for(let O of p.files){let H=k.mtimes.get(O.path);if(H!==void 0)O.mtimeMs=H}let v=await dCe(a,d);if(v.status==="fail")process.exit(1);let{dataFiles:C,uploadProgress:T}=GCe(a,p,t),V=await nxe(a,t,f,C,b,_,v.value);if(V.status==="fail")process.exit(1);let A=V.value,F=HCe(a,T,A.dataset_id),M=zCe(F,C);if((await rxe(A)).status==="fail")process.exit(1);let U=s.username&&s.email?{name:s.username,email:s.email}:void 0;if((await oxe(a,U)).status==="fail")process.exit(1);if((await sxe(a,A,t)).status==="fail")process.exit(1);let B=await H1e({absolutePath:a,options:t,dataFiles:C,filesToUpload:M,uploadProgress:F,datasetInfo:A,coAuthorEnrichment:h,author:U});if(B.status==="fail")process.exit(1);if(F=B.value,(await q1e(a,F)).status==="fail")process.exit(1);let P=await B1e(a,A.dataset_id,F);U1e(a,A,P)})}Nn.addCommand(Jq());function uAe(e,t,n,r){let o=Math.round(e/t*100),s=20,i=Math.round(o/100*20);return`${`[${"=".repeat(i)}${" ".repeat(20-i)}]`} ${o}% | ${e}/${t} files | ${Ut(n)} / ${Ut(r)}`}async function dAe(e,t){if(t==="public")return;let n=D("Requesting download credentials...").start();try{let r=await MN(e);return n.succeed("Download credentials received (2h expiry)"),mr(r.credentials)}catch(r){n.fail("Failed to get download credentials"),console.log(u.red(` ${r.message}`)),console.log(u.dim("Private datasets require authentication. Run 'nemar auth login' first.")),process.exit(1)}}async function RNt(e,t){if(console.log(),console.log(u.yellow("OpenNeuro Dataset")),console.log(u.yellow("This dataset will be downloaded as plain files from OpenNeuro's public S3 bucket.")),console.log(u.yellow("Unlike NEMAR datasets, there is no git-annex version tracking or selective file download.")),console.log(u.dim("For full version control, use DataLad directly:")),console.log(u.dim(` datalad install https://github.com/OpenNeuroDatasets/${e}`)),console.log(),t.data===!1)console.log(u.yellow("Note: --no-data is not supported for OpenNeuro downloads. Downloading all files.")),console.log();if(t.verify===!1)console.error(u.dim("Note: --no-verify has no effect here; OpenNeuro downloads already check size only and have no checksum step to skip."));let n=t.output||e,r=qs(n);if(bs(r))console.log(u.red(`Error: Output path already exists: ${r}`)),console.log("Remove or rename the existing directory and try again."),process.exit(1);let o=await lp(),s=D(`Checking OpenNeuro for ${e}...`).start(),i;try{i=await Vxe(e,o)}catch(a){s.fail(`Could not reach OpenNeuro: ${a.message}`),process.exit(1)}if(!i)s.fail(`Dataset ${e} not found on OpenNeuro`),process.exit(1);if(s.succeed(`Found ${e} on OpenNeuro`),o){console.log(),console.log(u.bold("Download Plan:")),console.log(` Dataset: ${e} (OpenNeuro)`),console.log(` Output: ${r}`),console.log(" Method: AWS CLI (aws s3 sync)"),console.log(),console.log(u.bold("Downloading data files..."));let a=await Gxe(e,r,(c)=>{process.stderr.write(`\r${u.cyan(` ${c} files downloaded`)}`)});if(process.stderr.write(`\r${" ".repeat(40)}\r`),!a.success)console.log(u.red(`Download failed: ${a.error}`)),process.exit(1);console.log(u.green(`Downloaded ${a.filesDownloaded} files`))}else{console.log(),console.log(u.yellow("AWS CLI not found. Using direct HTTPS download.")),console.log(u.yellow("This will be slower than AWS CLI. To install it:")),console.log(u.dim(" https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html")),console.log();let a=D("Listing dataset files...").start(),c;try{c=await zxe(e)}catch(m){a.fail(`Failed to list files: ${m.message}`),process.exit(1)}if(c.length===0)a.fail("No files found in dataset"),process.exit(1);let l=c.reduce((m,h)=>m+h.size,0);a.succeed(`${c.length} files (${Ut(l)})`),console.log(u.bold("Download Plan:")),console.log(` Dataset: ${e} (OpenNeuro)`),console.log(` Output: ${r}`),console.log(" Method: HTTPS (direct download)"),console.log(` Files: ${c.length} (${Ut(l)})`),console.log(),console.log(u.bold("Downloading data files..."));let d=Number.parseInt(t.jobs||"8",10),f=Math.min(d,Sl);if(d>Sl)console.log(u.yellow(`Note: --jobs ${d} capped at ${Sl} parallel HTTP requests.`));let p=await Wxe(e,r,c,{concurrency:f,onProgress:(m,h,g,y)=>{process.stderr.write(`\r${u.cyan(uAe(m,h,g,y))}`)}});if(process.stderr.write(`\r${" ".repeat(80)}\r`),!p.success){if(console.log(u.red(`
|
|
2129
2129
|
Download incomplete: ${p.error}`)),p.filesDownloaded>0)console.log(u.yellow(`${p.filesDownloaded} files succeeded. Re-run to retry failed files (resume support).`));console.log(`
|
|
2130
|
-
Location: ${u.cyan(r)}`),process.exit(1)}console.log(u.green(`Downloaded ${p.filesDownloaded} files (${Ut(p.totalBytes)})`))}console.log(),console.log(u.green.bold("Download complete!")),console.log(),console.log(` Location: ${u.cyan(r)}`),console.log()}async function QCe(e,t,n){for(let[h,g,y]of[["--update",t.update,"reconciles a clone against its remote"],["--prune",t.prune,"reconciles a clone against its remote"],["--resume",t.resume,"runs clone checks this path cannot make"]])if(g){if(console.log(u.red(`Error: ${h} needs a git-annex clone (it ${y}).`)),h==="--resume")console.log(u.dim(" An HTTP download always resumes: re-run the same command and any file")),console.log(u.dim(" already present at its declared size is skipped."));else console.log(u.dim(" Install git-annex, or re-download into a fresh directory."));process.exit(1)}if(t.verify===!1)console.error(u.dim("Note: --no-verify has no effect here; an HTTP download already checks size only and has no checksum step to skip."));let r=Number.parseInt(t.jobs||"4",10);if(Number.isNaN(r)||r<1)console.log(u.red(`Error: --jobs must be a positive integer (got "${t.jobs}").`)),process.exit(1);let o=Math.min(r,Sl);if(r>Sl)console.log(u.yellow(`Note: --jobs ${r} capped at ${Sl} parallel HTTP requests.`));let s=t.output||e,i=qs(s),a=D("Reading the published file list...").start(),c,l;try{l=(await E1e(e)).latest,c=await S1e(e,l)}catch(h){if(a.fail("Could not read the file list"),h instanceof Pc)console.log(u.red(` ${h.message}`)),process.exit(1);throw h}a.succeed(`${l}: ${c.length} files published`);let d=C1e(i,e,l);if(d){if(console.log(),d.kind==="git-repo")console.log(u.red(`Error: ${i} is a git repository.`)),console.log(u.dim(" Writing plain files into a git-annex clone corrupts its object store.")),console.log(u.dim(" Use a different -o directory, or 'nemar dataset get' in place."));else if(d.kind==="other-dataset")console.log(u.red(`Error: ${i} already holds dataset ${d.datasetId}.`)),console.log(u.dim(" Downloading a second dataset on top of it would merge the two."));else console.log(u.red(`Error: ${i} holds ${e} ${d.version}.`)),console.log(u.dim(` Resuming into it would mix ${d.version} and ${l}: files whose size is`)),console.log(u.dim(" unchanged between versions are skipped, including dataset_description.json, so")),console.log(u.dim(" the tree would misreport its own version. Use a fresh directory."));process.exit(1)}let f=$1e(c,n,{metadataOnly:t.data===!1}),p=f.reduce((h,g)=>h+g.size,0);if(f.length===0){if(console.log(u.yellow(n.active||t.data===!1?"Nothing matched the requested filters; nothing to download.":`${e} ${l} lists no files; nothing to download.`)),t.requireComplete)process.exit(1);return}console.log(),console.log(u.bold("Download plan:")),console.log(` Dataset: ${u.cyan(e)} ${u.dim(l)}`),console.log(` Output: ${i}`),console.log(` Method: HTTP (no git-annex), ${o} parallel`),console.log(` Files: ${f.length} (${Ut(p)})`);for(let h of n.summary)console.log(u.dim(` ${h}`));if(t.data===!1)console.log(u.dim(" metadata only (--no-data)"));console.log();let m=await D1e(f,i,{concurrency:o,onProgress:(h,g,y)=>{process.stderr.write(`\r${u.cyan(uAe(h,g,y,p))}`)}});if(process.stderr.write(`\r${" ".repeat(80)}\r`),R1e(i,e,l),m.errors.length>0){let h=m.filesDownloaded+m.filesSkipped;console.log(u.yellow(`Downloaded ${h} of ${f.length} files; ${m.errors.length} failed:`));for(let y of m.errors.slice(0,10))console.log(u.red(` ${y}`));let g=A1e(i,m.errors);if(m.errors.length>10)console.log(u.dim(g?` ... and ${m.errors.length-10} more; the full list is at ${g}`:` ... and ${m.errors.length-10} more`));console.log(u.dim(" Re-run the same command to retry only the missing files."))}else console.log(u.green(`Downloaded ${m.filesDownloaded} files (${Ut(m.bytesDownloaded)})${m.filesSkipped>0?`, ${m.filesSkipped} already present`:""}`));if(console.log(),console.log(` Location: ${u.cyan(i)}`),O1e(i),console.log(),m.hadInfrastructureFailure||m.errors.length>0&&t.requireComplete)process.exit(1)}function
|
|
2130
|
+
Location: ${u.cyan(r)}`),process.exit(1)}console.log(u.green(`Downloaded ${p.filesDownloaded} files (${Ut(p.totalBytes)})`))}console.log(),console.log(u.green.bold("Download complete!")),console.log(),console.log(` Location: ${u.cyan(r)}`),console.log()}async function QCe(e,t,n){for(let[h,g,y]of[["--update",t.update,"reconciles a clone against its remote"],["--prune",t.prune,"reconciles a clone against its remote"],["--resume",t.resume,"runs clone checks this path cannot make"]])if(g){if(console.log(u.red(`Error: ${h} needs a git-annex clone (it ${y}).`)),h==="--resume")console.log(u.dim(" An HTTP download always resumes: re-run the same command and any file")),console.log(u.dim(" already present at its declared size is skipped."));else console.log(u.dim(" Install git-annex, or re-download into a fresh directory."));process.exit(1)}if(t.verify===!1)console.error(u.dim("Note: --no-verify has no effect here; an HTTP download already checks size only and has no checksum step to skip."));let r=Number.parseInt(t.jobs||"4",10);if(Number.isNaN(r)||r<1)console.log(u.red(`Error: --jobs must be a positive integer (got "${t.jobs}").`)),process.exit(1);let o=Math.min(r,Sl);if(r>Sl)console.log(u.yellow(`Note: --jobs ${r} capped at ${Sl} parallel HTTP requests.`));let s=t.output||e,i=qs(s),a=D("Reading the published file list...").start(),c,l;try{l=(await E1e(e)).latest,c=await S1e(e,l)}catch(h){if(a.fail("Could not read the file list"),h instanceof Pc)console.log(u.red(` ${h.message}`)),process.exit(1);throw h}a.succeed(`${l}: ${c.length} files published`);let d=C1e(i,e,l);if(d){if(console.log(),d.kind==="git-repo")console.log(u.red(`Error: ${i} is a git repository.`)),console.log(u.dim(" Writing plain files into a git-annex clone corrupts its object store.")),console.log(u.dim(" Use a different -o directory, or 'nemar dataset get' in place."));else if(d.kind==="other-dataset")console.log(u.red(`Error: ${i} already holds dataset ${d.datasetId}.`)),console.log(u.dim(" Downloading a second dataset on top of it would merge the two."));else console.log(u.red(`Error: ${i} holds ${e} ${d.version}.`)),console.log(u.dim(` Resuming into it would mix ${d.version} and ${l}: files whose size is`)),console.log(u.dim(" unchanged between versions are skipped, including dataset_description.json, so")),console.log(u.dim(" the tree would misreport its own version. Use a fresh directory."));process.exit(1)}let f=$1e(c,n,{metadataOnly:t.data===!1}),p=f.reduce((h,g)=>h+g.size,0);if(f.length===0){if(console.log(u.yellow(n.active||t.data===!1?"Nothing matched the requested filters; nothing to download.":`${e} ${l} lists no files; nothing to download.`)),t.requireComplete)process.exit(1);return}console.log(),console.log(u.bold("Download plan:")),console.log(` Dataset: ${u.cyan(e)} ${u.dim(l)}`),console.log(` Output: ${i}`),console.log(` Method: HTTP (no git-annex), ${o} parallel`),console.log(` Files: ${f.length} (${Ut(p)})`);for(let h of n.summary)console.log(u.dim(` ${h}`));if(t.data===!1)console.log(u.dim(" metadata only (--no-data)"));console.log();let m=await D1e(f,i,{concurrency:o,onProgress:(h,g,y)=>{process.stderr.write(`\r${u.cyan(uAe(h,g,y,p))}`)}});if(process.stderr.write(`\r${" ".repeat(80)}\r`),R1e(i,e,l),m.errors.length>0){let h=m.filesDownloaded+m.filesSkipped;console.log(u.yellow(`Downloaded ${h} of ${f.length} files; ${m.errors.length} failed:`));for(let y of m.errors.slice(0,10))console.log(u.red(` ${y}`));let g=A1e(i,m.errors);if(m.errors.length>10)console.log(u.dim(g?` ... and ${m.errors.length-10} more; the full list is at ${g}`:` ... and ${m.errors.length-10} more`));console.log(u.dim(" Re-run the same command to retry only the missing files."))}else console.log(u.green(`Downloaded ${m.filesDownloaded} files (${Ut(m.bytesDownloaded)})${m.filesSkipped>0?`, ${m.filesSkipped} already present`:""}`));if(console.log(),console.log(` Location: ${u.cyan(i)}`),O1e(i),console.log(),m.hadInfrastructureFailure||m.errors.length>0&&t.requireComplete)process.exit(1)}function Yq(){return new de("download").description("Download a dataset from NEMAR or OpenNeuro").argument("<dataset-id>","Dataset ID (e.g., nm000104 or OpenNeuro ds000248)").option("-o, --output <path>","Output directory (default: ./<dataset-id>)").option("-j, --jobs <number>","Parallel download streams (default: 4)","4").option("--no-data","Download metadata only (skip large data files)").option("--resume","Resume a partial download into an existing clone").option("--update","Pull only the version diff into an existing clone").option("--prune","With --update, drop annex objects that no longer exist upstream").option("--subjects <list>","Comma-separated subjects (e.g. sub-01,02)").option("--sessions <list>","Comma-separated sessions (e.g. ses-pre,post)").option("--tasks <list>","Comma-separated tasks (e.g. rest,nback)").option("--runs <list>","Comma-separated runs (e.g. 1,2 \u2014 matches run-1 and run-01)").option("--datatypes <list>","Comma-separated BIDS datatypes (e.g. eeg,emg)").option("--include <globs>","Comma-separated extra include globs").option("--exclude <globs>","Comma-separated exclude globs (e.g. sourcedata/**)").option("--stimuli","Include stimuli/ content (skipped by default; can be large)").option("--derivatives","Include derivatives/ content (skipped by default; can be large)").option("--http","Download over plain HTTP without git or git-annex (a file snapshot, not a repository)").option("--skip-port-check","Skip the porting-in-progress check (use if falsely blocked on an OpenNeuro-sourced dataset)").option("--require-complete","Exit non-zero if any file is unavailable from the archive (for strict pipelines)").option("--no-verify","Skip git-annex checksum verification for this run only (size is still checked); a documented no-op on --http or OpenNeuro downloads, which already check size only").addHelpText("after",({command:e})=>`
|
|
2131
2131
|
Description:
|
|
2132
2132
|
Download a BIDS dataset from NEMAR or OpenNeuro.
|
|
2133
2133
|
|
|
@@ -2180,14 +2180,14 @@ Examples:
|
|
|
2180
2180
|
$ ${nr(e)} nm000104 --tasks rest --datatypes eeg # Subset
|
|
2181
2181
|
$ ${nr(e)} nm000104 --stimuli # Also download stimuli/
|
|
2182
2182
|
$ ${nr(e)} nm000104 --stimuli --derivatives # Download everything
|
|
2183
|
-
$ ${nr(e)} ds000248 # Download from OpenNeuro`).action(async(e,t)=>{let n=await CNt(e);if(!n){await RNt(e,t);return}if(t.resume&&t.update)console.log(u.red("Error: --resume and --update are mutually exclusive.")),process.exit(1);if(t.prune&&!t.update)console.log(u.red("Error: --prune requires --update.")),process.exit(1);let r=t.verify===!1,o=rC({subjects:t.subjects,sessions:t.sessions,tasks:t.tasks,runs:t.runs,datatypes:t.datatypes,include:t.include,exclude:t.exclude,excludeStimuli:t.stimuli!==!0,excludeDerivatives:t.derivatives!==!0});if(o.active&&t.data===!1)console.log(u.red("Error: --no-data cannot be combined with BIDS filters (--subjects, --tasks, etc.). Filters imply data download.")),process.exit(1);if(t.http){await QCe(n,t,o);return}await Uf("download");let s=D("Checking git-annex...").start(),i=await cw();if(!i.allPassed){s.warn(i.gitAnnex.installed?`git-annex ${i.gitAnnex.version} is not usable here`:"git-annex is not installed");for(let _ of i.errors)console.log(u.dim(` ${_}`));console.log(u.yellow(" Falling back to a plain HTTP download (a file snapshot).")),console.log(u.dim(" Pass --http to choose this path deliberately and skip this notice.")),console.log(),await QCe(n,t,o);return}s.succeed(`git-annex ${i.gitAnnex.version}`),s=D(`Fetching dataset info for ${n}...`).start();let a;try{a=await Xn(n),s.succeed(`Found dataset: ${a.name}`)}catch(_){if(s.fail(lAe(_)),_ instanceof L)console.log(u.red(` ${_.message}`));else console.log(u.red(` ${_.message}`));process.exit(1)}if(!a.github_repo)console.log(u.red("Error: Dataset repository not available")),process.exit(1);let c=t.output||n,l=qs(c),d,f=t.resume?"resume":t.update?"update":null;if(f){if(!bs(l))console.log(u.red(`Error: --${f} target does not exist: ${l}`)),console.log(u.dim(`Drop --${f} to perform a fresh clone.`)),process.exit(1);if(s=D(`Validating ${f} target...`).start(),!await Hi(l))s.fail("Not a git-annex dataset"),console.log(u.red(` ${l} is not a git-annex repository.`)),console.log(u.dim(`--${f} requires a previous clone of the same dataset.`)),process.exit(1);let _=await xd(l);if(_!==n)s.fail("Dataset ID mismatch"),console.log(u.red(` Expected ${n}, but ${l} is a clone of ${_??"an unknown repo"}.`)),process.exit(1);let x=await fge(l);if(x.error)s.fail("Could not check working tree status"),console.log(u.red(` ${x.error}`)),process.exit(1);if(x.dirty)s.fail("Working tree is dirty"),console.log(u.red(` Refusing to ${f} with uncommitted local changes.`)),console.log(u.dim(" Commit, stash, or discard them first.")),process.exit(1);let k=await pge(l);if(!k.success)s.fail("Failed to fetch remote refs"),console.log(u.red(` ${k.error}`)),process.exit(1);let v=lge(l);if(v.error)console.log(u.yellow(` Warning: ${v.error}`));let C=await uge(l);for(let A of C.warnings)console.log(u.yellow(` Warning: ${A}`));let T=v.version,V=C.version;if(t.resume){if(T&&V&&T!==V)s.fail("Local clone is behind upstream"),console.log(u.red(` Local version: ${T} | Remote HEAD: ${V}`)),console.log(u.dim(" Run `nemar dataset download <id> --update` to pull the version diff.")),process.exit(1);s.succeed(`Resume target verified: ${n}`)}else{if(T&&V&&T===V)s.succeed(`Already up to date (${T})`),process.exit(0);if(s.succeed(`Update plan: ${T??"unknown"} \u2192 ${V??"HEAD"}`),T&&V){s=D("Computing version diff from manifests...").start();try{let[U,B]=await Promise.all([VS(n,T),VS(n,V)]),P=T1e(U,B);if(s.succeed(`Diff: +${P.added.length} added, ~${P.changed.length} changed, -${P.removed.length} removed`),d=[...P.added,...P.changed],d.length===0)console.log(u.dim(" No annex content changes between versions; metadata-only update."))}catch(U){let B=U.message;if(s.warn(`Manifest diff unavailable: ${B}`),/401|403|unauthor/i.test(B))console.log(u.yellow(" Looks like an auth issue. Run `nemar auth status` to verify."));else if(!/404|not found/i.test(B))console.log(u.yellow(" Unexpected manifest error. Please report if this recurs."));console.log(u.dim(" Falling back to full git annex get (skips already-present files).")),d=void 0}}let A=await uc(l);if(A?.startsWith("adjusted/"))console.log(u.red(` --update is not supported on git-annex adjusted branches (${A}).`)),console.log(u.dim(" Run `git -C <clone> annex sync` to bring the clone onto a normal branch first.")),process.exit(1);s=D("Resolving remote tracking branch...").start();let F=await dge(l);if(!F.ref)s.fail("Cannot resolve remote tracking branch"),console.log(u.red(` ${F.error??"no upstream ref found"}`)),process.exit(1);s.text=`Fast-forwarding to ${F.ref}...`;let M=await mge(l,F.ref);if(!M.success)s.fail("Cannot fast-forward (local has diverging commits)"),console.log(u.red(` ${M.error}`)),console.log(u.dim(" Use `nemar dataset update` (PR workflow) to push local changes first.")),process.exit(1);s.succeed(`Merged ${F.ref}`)}}else if(bs(l))console.log(u.red(`Error: Output path already exists: ${l}`)),console.log("Remove or rename the existing directory, or pass --resume / --update to reuse it."),process.exit(1);console.log();let p=t.update?"Update Plan:":t.resume?"Resume Plan:":"Download Plan:";if(console.log(u.bold(p)),console.log(` Dataset: ${a.name} (${n})`),console.log(` Output: ${l}`),console.log(` Data files: ${t.data===!1?"metadata only":"included"}`),t.data!==!1)console.log(` Parallel jobs: ${t.jobs}`);if(t.update&&d&&d.length>0)console.log(` Files to fetch: ${d.length}`);if(o.active)for(let _ of o.summary)console.log(` Filter ${_}`);if(console.log(),!f){let _=`https://github.com/${a.github_repo}.git`;s=D("Cloning metadata from GitHub...").start();let x=await wo(_,l);if(!x.success)s.fail("Failed to clone dataset"),console.log(u.red(` ${x.error}`)),process.exit(1);s.succeed("Metadata cloned")}if(!t.skipPortCheck&&a.source==="openneuro"&&t.data!==!1){if(await YN(l)==="absent")console.log(),console.log(u.yellow("Porting still in progress.")),console.log(u.dim(" This dataset is being imported from OpenNeuro. Data files are not yet available.")),console.log(u.dim(" The metadata-only clone is already at the path above.")),console.log(u.dim(" Wait 5\u201330 minutes (depending on dataset size), then run:")),console.log(u.dim(` cd ${l} && nemar dataset get`)),console.log(u.dim(" Run 'nemar dataset status <id>' to track porting progress.")),console.log(u.dim(" Pass --skip-port-check to bypass this check if you are certain porting is complete.")),process.exit(1)}let m=await dAe(n,a.visibility),h=await qg(l,"nemar-s3",m);if(h.enabled)console.log(u.dim(" S3 remote enabled for data downloads"));else if(!h.success)console.log(u.yellow(` Warning: Could not enable S3 remote: ${h.error}`));if(t.data===!1||t.update&&d&&d.length===0){if(t.data===!1)console.log(u.dim("Skipping data files (--no-data flag)"))}else{for(let C of o.summary)console.log(u.dim(` ${C}`));console.log(u.bold(`Downloading data files (${t.jobs} parallel streams)...`));let _=o.args.length>0?o.args:void 0,x=await x6(l,void 0,_),k=new aC(x?.fileCount??0,x?.totalBytes??0),v=await v6(l,{jobs:Number.parseInt(t.jobs,10),credentials:m,paths:d,extraArgs:_,requireComplete:Boolean(t.requireComplete),noVerify:r,onProgress:(C)=>k.processLine(C)});if(!v.success){if(k.finish(v.filesDownloaded),console.log(u.red(`Failed to download data files: ${v.error}`)),console.log(u.dim("The dataset was cloned but data files are not available locally.")),console.log(u.dim(`You can try again with: cd ${l} && nemar dataset get`)),Tw(v.noVerifyMismatches),m)await ro(l);process.exit(1)}if(k.finish(v.filesDownloaded),v.outcome==="partial")W6(v);else console.log(u.green(`Data downloaded (${v.filesDownloaded} files)`));if(Tw(v.noVerifyMismatches),r)K6(v.unsizedFiles)}if(t.update&&t.prune){s=D("Pruning orphan annex objects...").start();let _=await gwe(l);if(_.success)s.succeed(`Pruned ${_.dropped??0} unused annex objects`);else s.warn(`Prune skipped: ${_.error}`)}if(m)await ro(l);let y=await ige(l);console.log();let b=t.update?"Update complete!":t.resume?"Resume complete!":"Download complete!";if(console.log(u.green.bold(b)),console.log(),console.log(` Location: ${u.cyan(l)}`),y){if(console.log(` Files: ${y.files}`),y.size!=="unknown")console.log(` Size: ${y.size}`);if(y.missingFiles>0)console.log(u.dim(` Missing files: ${y.missingFiles} (use 'git annex get' to download)`))}if(console.log(),t.update)console.log(u.dim("Note: --update fetches only the version diff. If a prior version was")),console.log(u.dim("partially downloaded, run with --resume to fill any pre-existing gaps.")),console.log();console.log(u.dim("To get additional data:")),console.log(u.dim(` cd ${l} && git annex get <path>`))})}Nn.addCommand(
|
|
2183
|
+
$ ${nr(e)} ds000248 # Download from OpenNeuro`).action(async(e,t)=>{let n=await CNt(e);if(!n){await RNt(e,t);return}if(t.resume&&t.update)console.log(u.red("Error: --resume and --update are mutually exclusive.")),process.exit(1);if(t.prune&&!t.update)console.log(u.red("Error: --prune requires --update.")),process.exit(1);let r=t.verify===!1,o=rC({subjects:t.subjects,sessions:t.sessions,tasks:t.tasks,runs:t.runs,datatypes:t.datatypes,include:t.include,exclude:t.exclude,excludeStimuli:t.stimuli!==!0,excludeDerivatives:t.derivatives!==!0});if(o.active&&t.data===!1)console.log(u.red("Error: --no-data cannot be combined with BIDS filters (--subjects, --tasks, etc.). Filters imply data download.")),process.exit(1);if(t.http){await QCe(n,t,o);return}await Uf("download");let s=D("Checking git-annex...").start(),i=await cw();if(!i.allPassed){s.warn(i.gitAnnex.installed?`git-annex ${i.gitAnnex.version} is not usable here`:"git-annex is not installed");for(let _ of i.errors)console.log(u.dim(` ${_}`));console.log(u.yellow(" Falling back to a plain HTTP download (a file snapshot).")),console.log(u.dim(" Pass --http to choose this path deliberately and skip this notice.")),console.log(),await QCe(n,t,o);return}s.succeed(`git-annex ${i.gitAnnex.version}`),s=D(`Fetching dataset info for ${n}...`).start();let a;try{a=await Xn(n),s.succeed(`Found dataset: ${a.name}`)}catch(_){if(s.fail(lAe(_)),_ instanceof L)console.log(u.red(` ${_.message}`));else console.log(u.red(` ${_.message}`));process.exit(1)}if(!a.github_repo)console.log(u.red("Error: Dataset repository not available")),process.exit(1);let c=t.output||n,l=qs(c),d,f=t.resume?"resume":t.update?"update":null;if(f){if(!bs(l))console.log(u.red(`Error: --${f} target does not exist: ${l}`)),console.log(u.dim(`Drop --${f} to perform a fresh clone.`)),process.exit(1);if(s=D(`Validating ${f} target...`).start(),!await Hi(l))s.fail("Not a git-annex dataset"),console.log(u.red(` ${l} is not a git-annex repository.`)),console.log(u.dim(`--${f} requires a previous clone of the same dataset.`)),process.exit(1);let _=await xd(l);if(_!==n)s.fail("Dataset ID mismatch"),console.log(u.red(` Expected ${n}, but ${l} is a clone of ${_??"an unknown repo"}.`)),process.exit(1);let x=await fge(l);if(x.error)s.fail("Could not check working tree status"),console.log(u.red(` ${x.error}`)),process.exit(1);if(x.dirty)s.fail("Working tree is dirty"),console.log(u.red(` Refusing to ${f} with uncommitted local changes.`)),console.log(u.dim(" Commit, stash, or discard them first.")),process.exit(1);let k=await pge(l);if(!k.success)s.fail("Failed to fetch remote refs"),console.log(u.red(` ${k.error}`)),process.exit(1);let v=lge(l);if(v.error)console.log(u.yellow(` Warning: ${v.error}`));let C=await uge(l);for(let A of C.warnings)console.log(u.yellow(` Warning: ${A}`));let T=v.version,V=C.version;if(t.resume){if(T&&V&&T!==V)s.fail("Local clone is behind upstream"),console.log(u.red(` Local version: ${T} | Remote HEAD: ${V}`)),console.log(u.dim(" Run `nemar dataset download <id> --update` to pull the version diff.")),process.exit(1);s.succeed(`Resume target verified: ${n}`)}else{if(T&&V&&T===V)s.succeed(`Already up to date (${T})`),process.exit(0);if(s.succeed(`Update plan: ${T??"unknown"} \u2192 ${V??"HEAD"}`),T&&V){s=D("Computing version diff from manifests...").start();try{let[U,B]=await Promise.all([VS(n,T),VS(n,V)]),P=T1e(U,B);if(s.succeed(`Diff: +${P.added.length} added, ~${P.changed.length} changed, -${P.removed.length} removed`),d=[...P.added,...P.changed],d.length===0)console.log(u.dim(" No annex content changes between versions; metadata-only update."))}catch(U){let B=U.message;if(s.warn(`Manifest diff unavailable: ${B}`),/401|403|unauthor/i.test(B))console.log(u.yellow(" Looks like an auth issue. Run `nemar auth status` to verify."));else if(!/404|not found/i.test(B))console.log(u.yellow(" Unexpected manifest error. Please report if this recurs."));console.log(u.dim(" Falling back to full git annex get (skips already-present files).")),d=void 0}}let A=await uc(l);if(A?.startsWith("adjusted/"))console.log(u.red(` --update is not supported on git-annex adjusted branches (${A}).`)),console.log(u.dim(" Run `git -C <clone> annex sync` to bring the clone onto a normal branch first.")),process.exit(1);s=D("Resolving remote tracking branch...").start();let F=await dge(l);if(!F.ref)s.fail("Cannot resolve remote tracking branch"),console.log(u.red(` ${F.error??"no upstream ref found"}`)),process.exit(1);s.text=`Fast-forwarding to ${F.ref}...`;let M=await mge(l,F.ref);if(!M.success)s.fail("Cannot fast-forward (local has diverging commits)"),console.log(u.red(` ${M.error}`)),console.log(u.dim(" Use `nemar dataset update` (PR workflow) to push local changes first.")),process.exit(1);s.succeed(`Merged ${F.ref}`)}}else if(bs(l))console.log(u.red(`Error: Output path already exists: ${l}`)),console.log("Remove or rename the existing directory, or pass --resume / --update to reuse it."),process.exit(1);console.log();let p=t.update?"Update Plan:":t.resume?"Resume Plan:":"Download Plan:";if(console.log(u.bold(p)),console.log(` Dataset: ${a.name} (${n})`),console.log(` Output: ${l}`),console.log(` Data files: ${t.data===!1?"metadata only":"included"}`),t.data!==!1)console.log(` Parallel jobs: ${t.jobs}`);if(t.update&&d&&d.length>0)console.log(` Files to fetch: ${d.length}`);if(o.active)for(let _ of o.summary)console.log(` Filter ${_}`);if(console.log(),!f){let _=`https://github.com/${a.github_repo}.git`;s=D("Cloning metadata from GitHub...").start();let x=await wo(_,l);if(!x.success)s.fail("Failed to clone dataset"),console.log(u.red(` ${x.error}`)),process.exit(1);s.succeed("Metadata cloned")}if(!t.skipPortCheck&&a.source==="openneuro"&&t.data!==!1){if(await YN(l)==="absent")console.log(),console.log(u.yellow("Porting still in progress.")),console.log(u.dim(" This dataset is being imported from OpenNeuro. Data files are not yet available.")),console.log(u.dim(" The metadata-only clone is already at the path above.")),console.log(u.dim(" Wait 5\u201330 minutes (depending on dataset size), then run:")),console.log(u.dim(` cd ${l} && nemar dataset get`)),console.log(u.dim(" Run 'nemar dataset status <id>' to track porting progress.")),console.log(u.dim(" Pass --skip-port-check to bypass this check if you are certain porting is complete.")),process.exit(1)}let m=await dAe(n,a.visibility),h=await qg(l,"nemar-s3",m);if(h.enabled)console.log(u.dim(" S3 remote enabled for data downloads"));else if(!h.success)console.log(u.yellow(` Warning: Could not enable S3 remote: ${h.error}`));if(t.data===!1||t.update&&d&&d.length===0){if(t.data===!1)console.log(u.dim("Skipping data files (--no-data flag)"))}else{for(let C of o.summary)console.log(u.dim(` ${C}`));console.log(u.bold(`Downloading data files (${t.jobs} parallel streams)...`));let _=o.args.length>0?o.args:void 0,x=await x6(l,void 0,_),k=new aC(x?.fileCount??0,x?.totalBytes??0),v=await v6(l,{jobs:Number.parseInt(t.jobs,10),credentials:m,paths:d,extraArgs:_,requireComplete:Boolean(t.requireComplete),noVerify:r,onProgress:(C)=>k.processLine(C)});if(!v.success){if(k.finish(v.filesDownloaded),console.log(u.red(`Failed to download data files: ${v.error}`)),console.log(u.dim("The dataset was cloned but data files are not available locally.")),console.log(u.dim(`You can try again with: cd ${l} && nemar dataset get`)),Tw(v.noVerifyMismatches),m)await ro(l);process.exit(1)}if(k.finish(v.filesDownloaded),v.outcome==="partial")W6(v);else console.log(u.green(`Data downloaded (${v.filesDownloaded} files)`));if(Tw(v.noVerifyMismatches),r)K6(v.unsizedFiles)}if(t.update&&t.prune){s=D("Pruning orphan annex objects...").start();let _=await gwe(l);if(_.success)s.succeed(`Pruned ${_.dropped??0} unused annex objects`);else s.warn(`Prune skipped: ${_.error}`)}if(m)await ro(l);let y=await ige(l);console.log();let b=t.update?"Update complete!":t.resume?"Resume complete!":"Download complete!";if(console.log(u.green.bold(b)),console.log(),console.log(` Location: ${u.cyan(l)}`),y){if(console.log(` Files: ${y.files}`),y.size!=="unknown")console.log(` Size: ${y.size}`);if(y.missingFiles>0)console.log(u.dim(` Missing files: ${y.missingFiles} (use 'git annex get' to download)`))}if(console.log(),t.update)console.log(u.dim("Note: --update fetches only the version diff. If a prior version was")),console.log(u.dim("partially downloaded, run with --resume to fill any pre-existing gaps.")),console.log();console.log(u.dim("To get additional data:")),console.log(u.dim(` cd ${l} && git annex get <path>`))})}Nn.addCommand(Yq());Nn.command("status").alias("view").description("Check status of a dataset (alias: view)").argument("<dataset-id>","Dataset ID (e.g., nm000104)").option("--json","Output as JSON for scripting").addHelpText("after",`
|
|
2184
2184
|
Description:
|
|
2185
2185
|
Show detailed information about a NEMAR dataset including owner,
|
|
2186
2186
|
creation date, GitHub repository, and DOI information.
|
|
2187
2187
|
|
|
2188
2188
|
Examples:
|
|
2189
2189
|
$ nemar dataset status nm000104
|
|
2190
|
-
$ nemar dataset status nm000104 --json | jq '.concept_doi'`).action(async(e,t)=>{let n=D(`Fetching dataset info for ${e}...`).start(),r;try{r=await Xn(e),n.stop()}catch(o){if(n.fail(lAe(o)),o instanceof L)console.log(u.red(` ${o.message}`));else console.log(u.red(` ${o.message}`));process.exit(1)}if(t.json){console.log(JSON.stringify(r,null,2));return}if(console.log(),console.log(u.bold(`Dataset: ${r.dataset_id}`)),console.log(),console.log(` Name: ${r.name}`),console.log(` Owner: ${r.owner_username}`),console.log(` Status: ${ANt(r.status)}`),r.withdrawn_at){let o=r.withdrawn_reason?` ${u.dim(`- ${r.withdrawn_reason}`)}`:"";console.log(` Withdrawn: ${u.red(new Date(r.withdrawn_at).toLocaleDateString())}${o}`)}if(r.anonymous===1)console.log(` Anonymous: ${u.yellow("identity withheld until publication")}`),console.log(u.dim(" Restore the real Authors in dataset_description.json, then 'nemar dataset publish request' without --anonymous.")),VNt(r);if(console.log(` Created: ${new Date(r.created_at).toLocaleDateString()}`),r.description)console.log(` Description: ${r.description}`);if(r.github_repo&&r.anonymous!==1)console.log(` GitHub: https://github.com/${r.github_repo}`);if(r.concept_doi){let o=`https://doi.org/${r.concept_doi}`;if(r.anonymous===1)console.log(` DOI: ${u.dim(o)} ${u.yellow("(reserved)")}`),console.log(` Cite: ${JRe(r.dataset_id)}`);else console.log(r.withdrawn_at?` DOI: ${u.dim(o)} ${u.red("(tombstoned)")}`:` DOI: ${o}`)}if(r.data_complete===0)console.log(r.withdrawn_at?` Data: ${u.dim("removed as part of the withdrawal")}`:` Data: ${u.red("incomplete")} ${u.dim("(some files failed to upload; see `nemar admin data-integrity-sweep`)")}`);if(console.log(),r.withdrawn_at)console.log(u.dim("This dataset was withdrawn; its content is no longer available."));else console.log(u.dim("To download this dataset:")),console.log(u.dim(` nemar dataset download ${e}`))});async function CNt(e){if(!qxe(e))return e;let t=null;try{t=await phe(e)}catch(r){return console.log(u.dim(`Could not check NEMAR availability: ${r.message}`)),null}if(!t?.found||!t.dataset_id)return null;console.log(),console.log(u.green(`This dataset is available on NEMAR as ${u.bold(t.dataset_id)}`)),console.log(u.dim("NEMAR provides git-annex version tracking and selective file download."));let{useNemarBackend:n}=await Ae.prompt([{type:"confirm",name:"useNemarBackend",message:`Download from NEMAR (${t.dataset_id}) instead of OpenNeuro?`,default:!0}]);return n?t.dataset_id:null}function ANt(e){switch(e.toLowerCase()){case"published":return u.green(e);case"active":return u.blue(e);case"archived":return u.dim(e);case"pending":return u.yellow(e);default:return e}}function ONt(e,t){let{offset:n,totalCount:r}=t,o=n+1,s=n+e.length,i=r>e.length?`${o}-${s} of ${r}`:`${r}`;console.log(),console.log(u.bold(`Datasets (${i}):`)),console.log();let a=(g)=>g.dataset_id||g.id||"",c=Math.max(10,...e.map((g)=>a(g).length)),l=Math.min(30,Math.max(10,...e.map((g)=>g.name.length))),d=10,f=8,p=Math.max(8,...e.map((g)=>(g.owner_username||"-").length)),m=10,h=["ID".padEnd(c),"Name".padEnd(l),"Modality".padEnd(d),"Subj".padEnd(f),"HED".padEnd(3),"Data".padEnd(m),"Owner".padEnd(p),"Status"].join(" ");console.log(u.dim(h)),console.log(u.dim("-".repeat(h.length)));for(let g of e){let y=a(g),b=g.name.length>l?`${g.name.substring(0,l-3)}...`:g.name,_=(g.modalities||"").substring(0,d),x=g.participants?String(g.participants):"-",k=g.owner_username||"-",v=g.visibility==="public"?u.green("pub"):u.yellow("prv"),C;if(g.source_type==="catalog")C=u.dim(y.padEnd(c));else C=u.cyan(y.padEnd(c));let T=g.source_type==="catalog"?u.dim(b):b,V=[C,T.padEnd(l+(g.source_type==="catalog"?u.dim("").length:0)),_.padEnd(d),x.padEnd(f),g.has_hed===1?u.magenta("HED".padEnd(3)):u.dim("-".padEnd(3)),g.data_complete===0?u.red("incomplete".padEnd(m)):"".padEnd(m),k.padEnd(p),v].join(" ");console.log(V)}if(console.log(),r>s){let g=Math.floor(n/t.limit)+1,y=Math.ceil(r/t.limit);console.log(u.dim(`Page ${g}/${y}. Next: nemar dataset list --page ${g+1}`))}console.log(u.dim(` * = not synced to nemar.org ${u.dim("dim")} = catalog-only (not on GitHub)`)),console.log(u.dim("For details: nemar dataset status <dataset-id>")),console.log(u.dim("Search: nemar dataset search <query>"))}var TNt=35,PNt=8,INt=4,ZCe=10,eAe=6,fAe=3,bC=2,
|
|
2190
|
+
$ nemar dataset status nm000104 --json | jq '.concept_doi'`).action(async(e,t)=>{let n=D(`Fetching dataset info for ${e}...`).start(),r;try{r=await Xn(e),n.stop()}catch(o){if(n.fail(lAe(o)),o instanceof L)console.log(u.red(` ${o.message}`));else console.log(u.red(` ${o.message}`));process.exit(1)}if(t.json){console.log(JSON.stringify(r,null,2));return}if(console.log(),console.log(u.bold(`Dataset: ${r.dataset_id}`)),console.log(),console.log(` Name: ${r.name}`),console.log(` Owner: ${r.owner_username}`),console.log(` Status: ${ANt(r.status)}`),r.withdrawn_at){let o=r.withdrawn_reason?` ${u.dim(`- ${r.withdrawn_reason}`)}`:"";console.log(` Withdrawn: ${u.red(new Date(r.withdrawn_at).toLocaleDateString())}${o}`)}if(r.anonymous===1)console.log(` Anonymous: ${u.yellow("identity withheld until publication")}`),console.log(u.dim(" Restore the real Authors in dataset_description.json, then 'nemar dataset publish request' without --anonymous.")),VNt(r);if(console.log(` Created: ${new Date(r.created_at).toLocaleDateString()}`),r.description)console.log(` Description: ${r.description}`);if(r.github_repo&&r.anonymous!==1)console.log(` GitHub: https://github.com/${r.github_repo}`);if(r.concept_doi){let o=`https://doi.org/${r.concept_doi}`;if(r.anonymous===1)console.log(` DOI: ${u.dim(o)} ${u.yellow("(reserved)")}`),console.log(` Cite: ${JRe(r.dataset_id)}`);else console.log(r.withdrawn_at?` DOI: ${u.dim(o)} ${u.red("(tombstoned)")}`:` DOI: ${o}`)}if(r.data_complete===0)console.log(r.withdrawn_at?` Data: ${u.dim("removed as part of the withdrawal")}`:` Data: ${u.red("incomplete")} ${u.dim("(some files failed to upload; see `nemar admin data-integrity-sweep`)")}`);if(console.log(),r.withdrawn_at)console.log(u.dim("This dataset was withdrawn; its content is no longer available."));else console.log(u.dim("To download this dataset:")),console.log(u.dim(` nemar dataset download ${e}`))});async function CNt(e){if(!qxe(e))return e;let t=null;try{t=await phe(e)}catch(r){return console.log(u.dim(`Could not check NEMAR availability: ${r.message}`)),null}if(!t?.found||!t.dataset_id)return null;console.log(),console.log(u.green(`This dataset is available on NEMAR as ${u.bold(t.dataset_id)}`)),console.log(u.dim("NEMAR provides git-annex version tracking and selective file download."));let{useNemarBackend:n}=await Ae.prompt([{type:"confirm",name:"useNemarBackend",message:`Download from NEMAR (${t.dataset_id}) instead of OpenNeuro?`,default:!0}]);return n?t.dataset_id:null}function ANt(e){switch(e.toLowerCase()){case"published":return u.green(e);case"active":return u.blue(e);case"archived":return u.dim(e);case"pending":return u.yellow(e);default:return e}}function ONt(e,t){let{offset:n,totalCount:r}=t,o=n+1,s=n+e.length,i=r>e.length?`${o}-${s} of ${r}`:`${r}`;console.log(),console.log(u.bold(`Datasets (${i}):`)),console.log();let a=(g)=>g.dataset_id||g.id||"",c=Math.max(10,...e.map((g)=>a(g).length)),l=Math.min(30,Math.max(10,...e.map((g)=>g.name.length))),d=10,f=8,p=Math.max(8,...e.map((g)=>(g.owner_username||"-").length)),m=10,h=["ID".padEnd(c),"Name".padEnd(l),"Modality".padEnd(d),"Subj".padEnd(f),"HED".padEnd(3),"Data".padEnd(m),"Owner".padEnd(p),"Status"].join(" ");console.log(u.dim(h)),console.log(u.dim("-".repeat(h.length)));for(let g of e){let y=a(g),b=g.name.length>l?`${g.name.substring(0,l-3)}...`:g.name,_=(g.modalities||"").substring(0,d),x=g.participants?String(g.participants):"-",k=g.owner_username||"-",v=g.visibility==="public"?u.green("pub"):u.yellow("prv"),C;if(g.source_type==="catalog")C=u.dim(y.padEnd(c));else C=u.cyan(y.padEnd(c));let T=g.source_type==="catalog"?u.dim(b):b,V=[C,T.padEnd(l+(g.source_type==="catalog"?u.dim("").length:0)),_.padEnd(d),x.padEnd(f),g.has_hed===1?u.magenta("HED".padEnd(3)):u.dim("-".padEnd(3)),g.data_complete===0?u.red("incomplete".padEnd(m)):"".padEnd(m),k.padEnd(p),v].join(" ");console.log(V)}if(console.log(),r>s){let g=Math.floor(n/t.limit)+1,y=Math.ceil(r/t.limit);console.log(u.dim(`Page ${g}/${y}. Next: nemar dataset list --page ${g+1}`))}console.log(u.dim(` * = not synced to nemar.org ${u.dim("dim")} = catalog-only (not on GitHub)`)),console.log(u.dim("For details: nemar dataset status <dataset-id>")),console.log(u.dim("Search: nemar dataset search <query>"))}var TNt=35,PNt=8,INt=4,ZCe=10,eAe=6,fAe=3,bC=2,Wq=80;function NNt(e,t){let n=Number.isFinite(t)&&t>0?Math.floor(t):Wq,r=Math.max(10,...e.map((l)=>l.id.length)),o=Math.min(TNt,Math.max(10,...e.map((l)=>l.name.length))),s=!0,i=!0,a=!0,c=()=>{let l=r+bC+o;if(s)l+=bC+ZCe;if(i)l+=bC+eAe;if(a)l+=bC+fAe;return l};while(c()>n&&o>PNt)o--;if(c()>n&&a)a=!1;if(c()>n&&i)i=!1;if(c()>n&&s)s=!1;while(c()>n&&o>INt)o--;return{idWidth:r,nameWidth:o,modWidth:ZCe,subjWidth:eAe,showModality:s,showSubj:i,showHed:a}}function FNt(e,t,n={}){let{snippets:r=!1}=n,o=NNt(e,t),s=[],i=["ID".padEnd(o.idWidth),"Name".padEnd(o.nameWidth)];if(o.showModality)i.push("Modality".padEnd(o.modWidth));if(o.showSubj)i.push("Subj".padEnd(o.subjWidth));if(o.showHed)i.push("HED".padEnd(fAe));let a=i.join(" ");s.push(Nr.muted(a)),s.push(Nr.muted("-".repeat(a.length)));for(let c of e)try{let l=c.name.length>o.nameWidth?`${c.name.substring(0,o.nameWidth-3)}...`:c.name,d=[Nr.id(c.id.padEnd(o.idWidth)),l.padEnd(o.nameWidth)];if(o.showModality)d.push(Cpe(c.modalities||"-",o.modWidth).padEnd(o.modWidth));if(o.showSubj)d.push((c.participants?String(c.participants):"-").padEnd(o.subjWidth));if(o.showHed)d.push(c.has_hed===1?Nr.metric("HED"):Nr.muted("-"));if(s.push(d.join(" ")),r){let f=null;try{f=Rpe(c.snippet)}catch{f=null}if(f)s.push(` ${f}`)}}catch{s.push(`${c.id??"?"} ${c.name??"?"}`)}return s}function pAe(e){if(!e)return;let t=e.split(",").map((n)=>n.trim().toLowerCase()).filter((n)=>n&&!dq.includes(n));if(t.length>0)console.log(u.red(`Error: invalid license tier(s): ${t.join(", ")}`)),console.log(`Valid tiers: ${dq.join(", ")}`),process.exit(1)}function mAe(e){try{return g1e(e)}catch(t){if(t instanceof sa)console.log(u.red(`Error: ${t.message}`)),console.log(u.dim(h1e));else if(t instanceof sC)console.log(u.red(`Error: ${t.message}`));else throw t;process.exit(1)}}var hAe=Nn.command("list").description("List datasets on NEMAR (full catalog)").option("--mine","List only your datasets (both private and public)").option("--owner <username>","List datasets owned by a specific user").option("--search <query>","Search by name, description, authors, or tasks").option("--modality <type>",fq).option("--author <name>","Filter by author name").option("--task <name>","Filter by task name").option("--license <tiers>","Filter by license tier(s), comma-separated: public, attribution, sharealike, noncommercial, noderiv, unknown").option("--doi","Show only datasets with DOIs").option("--hed","Show only datasets with HED annotations").option("--has-zarr","Show only datasets with a ready Zarr copy (#1062)").option("--has-zarr-verified","Show only datasets whose Zarr copy passed fidelity verification (#1068)").option("--complete","Show only datasets verified data-complete (#970)").option("--recent [days]","Show recently published datasets").addOption(new tm("--sort <order>","Sort order").choices(["newest","oldest","name","participants","size","citations"]).default("newest")).option("--include-unknown","Include datasets with an unknown value for the active facet filter(s)").option("--json","Output as JSON for scripting").option("-n, --limit <n>","Results per page (default: 20, max: 200)","20").option("--page <n>","Page number (starts at 1)").option("--offset <n>","Skip this many results (alternative to --page)").option("--all","Show all results (up to 200)");Eq(hAe);hAe.addHelpText("after",`
|
|
2191
2191
|
Description:
|
|
2192
2192
|
Lists the full NEMAR catalog, including legacy datasets from nemar.org
|
|
2193
2193
|
and datasets managed via nemar-cli. Shows 20 results per page by default.
|
|
@@ -2222,7 +2222,7 @@ Examples:
|
|
|
2222
2222
|
$ nemar dataset list --doi --sort size # Published, by size
|
|
2223
2223
|
$ nemar dataset list --subjects 20..50 --age 18.. # Facet filters
|
|
2224
2224
|
$ nemar dataset search "resting state EEG" # Semantic search`).action(async(e)=>{if(e.mine&&e.owner)console.log(u.red("Error: --mine and --owner cannot be used together")),console.log("Use --mine for your datasets, or --owner <username> for another user's."),process.exit(1);if(e.mine&&!Ve())console.log(u.red("Error: Not authenticated")),console.log("Run 'nemar auth login' to see your datasets"),process.exit(1);pAe(e.license);let t=mAe(e),n=e.all?200:Math.min(Number.parseInt(e.limit,10)||20,200),r=0;if(e.page)r=(Math.max(Number.parseInt(e.page,10)||1,1)-1)*n;else if(e.offset)r=Math.max(Number.parseInt(e.offset,10)||0,0);let o=D("Fetching datasets...").start(),s;try{s=await wd({mine:!!e.mine,search:e.search,modality:e.modality,author:e.author,task:e.task,license:e.license,hasDoi:!!e.doi,hasHed:!!e.hed,hasZarr:!!e.hasZarr,hasZarrVerified:!!e.hasZarrVerified,dataComplete:!!e.complete,recent:e.recent?Number.parseInt(e.recent,10)||30:void 0,sort:e.sort,limit:n,offset:r,owner:e.owner,facets:t,includeUnknown:!!e.includeUnknown}),o.stop()}catch(c){if(o.fail("Failed to fetch datasets"),c instanceof L)console.log(u.red(` ${c.message}`));else console.log(u.red(` ${c.message}`));process.exit(1)}let i=s.datasets,a=s.total_count??s.count;if(e.json){console.log(JSON.stringify({datasets:i,total_count:a,limit:n,offset:r,fallback:s.fallback,warning:s.warning,excluded_unknown:s.excluded_unknown,excluded_unknown_by_facet:s.excluded_unknown_by_facet},null,2)),Vp();return}if(s.warning)console.log(u.yellow(`
|
|
2225
|
-
\u26A0 ${s.warning}`));if(s.excluded_unknown!==void 0&&s.excluded_unknown>0)console.error(u.dim(
|
|
2225
|
+
\u26A0 ${s.warning}`));if(s.excluded_unknown!==void 0&&s.excluded_unknown>0)console.error(u.dim(Sq(s.excluded_unknown,s.excluded_unknown_by_facet??{})));if(i.length===0){if(console.log(),e.mine)console.log(u.yellow("You don't have any datasets yet.")),console.log(u.dim("Create one with: nemar dataset upload <path>"));else if(e.owner)console.log(u.yellow(`No datasets found for user '${e.owner}'.`));else if(e.search||e.modality||e.author||e.hed||e.complete||e.license||e.task)console.log(u.yellow("No datasets match your filters.")),console.log(u.dim("Try broader search terms or remove filters."));else console.log(u.yellow("No datasets found."));Vp();return}ONt(i,{limit:n,offset:r,totalCount:a}),Vp()});var Xq=Nn.command("search <query>").description("Search datasets using semantic matching").option("--modality <type>",fq).option("--author <name>","Filter by author name").option("--task <name>","Filter by task name").option("--license <tiers>","Filter by license tier(s), comma-separated: public, attribution, sharealike, noncommercial, noderiv, unknown").option("--doi","Show only datasets with DOIs").option("--hed","Show only datasets with HED annotations").option("--has-zarr","Show only datasets with a ready Zarr copy (#1062)").option("--has-zarr-verified","Show only datasets whose Zarr copy passed fidelity verification (#1068)").option("--complete","Show only datasets verified data-complete (#970)").option("--recent [days]","Show recently published datasets").option("--include-unknown","Include datasets with an unknown value for the active facet filter(s)").option("--verbose","Show a README snippet under each result (off by default)").option("--json","Output as JSON for scripting").option("--limit <n>","Limit results (default: 20)","20");function MNt(){return!!Xq.optsWithGlobals().verbose}Eq(Xq);Xq.addHelpText("after",`
|
|
2226
2226
|
Description:
|
|
2227
2227
|
Searches the NEMAR dataset catalog by meaning. Unlike --search on the list
|
|
2228
2228
|
command (which uses exact text matching), this uses AI embeddings and a
|
|
@@ -2251,7 +2251,7 @@ Examples:
|
|
|
2251
2251
|
$ nemar dataset search "P300 oddball" --verbose # Show README snippets`).action(async(e,t)=>{pAe(t.license);let n=mAe(t),r=D("Searching datasets...").start();try{let o=await hhe(e,{modality:t.modality,hasHed:!!t.hed,hasZarr:!!t.hasZarr,hasZarrVerified:!!t.hasZarrVerified,limit:Number.parseInt(t.limit,10),author:t.author,task:t.task,license:t.license,hasDoi:!!t.doi,dataComplete:!!t.complete,recent:t.recent?Number.parseInt(t.recent,10)||30:void 0,facets:n,includeUnknown:!!t.includeUnknown});if(r.stop(),t.json){console.log(JSON.stringify(o,null,2)),Vp();return}if(o.warning)console.log(Nr.warn(`
|
|
2252
2252
|
\u26A0 ${o.warning}`));if(o.modality_boost?.length)console.log(Nr.muted(`
|
|
2253
2253
|
Listing ${o.modality_boost.join(", ")} datasets first.`));if(o.corrected_query)console.log(Nr.muted(`
|
|
2254
|
-
Showing results for "${o.corrected_query}" instead of "${e}".`));if(o.excluded_unknown!==void 0&&o.excluded_unknown>0)console.error(Nr.muted(
|
|
2254
|
+
Showing results for "${o.corrected_query}" instead of "${e}".`));if(o.excluded_unknown!==void 0&&o.excluded_unknown>0)console.error(Nr.muted(Sq(o.excluded_unknown,o.excluded_unknown_by_facet??{})));if(o.results.length===0){console.log(),console.log(Nr.warn("No datasets match your search.")),console.log(Nr.muted("Try different search terms or use 'nemar dataset list' for browsing.")),Vp();return}console.log(),console.log(Nr.label(`Search results for "${e}" (${o.results.length} found, ${o.method}):`)),console.log();let s=Wq;try{let i=process.stdout.columns;if(typeof i==="number"&&Number.isFinite(i)&&i>0)s=Math.floor(i)}catch{s=Wq}try{for(let i of FNt(o.results,s,{snippets:MNt()}))console.log(i)}catch(i){if(process.env.VERBOSE)console.error(Nr.muted(`[search] table rendering failed, falling back to a plain list: ${i instanceof Error?i.message:String(i)}`));for(let a of o.results)console.log(`${a.id} ${a.name}`)}console.log(),console.log(Nr.muted("For details: nemar dataset status <dataset-id>")),Vp()}catch(o){if(r.fail("Search failed"),o instanceof L)console.log(u.red(` ${o.message}`));else console.log(u.red(` ${o.message}`));process.exit(1)}});Nn.command("release").description("Create a version bump PR for a dataset").argument("<dataset-id>","Dataset ID (e.g., nm000104)").option("--type <type>","Bump type: patch, minor, or major").option("--version <version>","Explicit version (e.g., 2.0.0)").option("--dir <path>","Use existing local clone instead of cloning").option("--monitor","Watch CI checks and offer to merge").option(Xe,nt).addHelpText("after",`
|
|
2255
2255
|
Description:
|
|
2256
2256
|
Create a pull request that bumps the dataset version in
|
|
2257
2257
|
dataset_description.json. The PR triggers CI checks (BIDS validation,
|
|
@@ -2261,7 +2261,7 @@ Description:
|
|
|
2261
2261
|
Examples:
|
|
2262
2262
|
$ nemar dataset release nm000104 --type patch
|
|
2263
2263
|
$ nemar dataset release nm000104 --version 2.0.0
|
|
2264
|
-
$ nemar dataset release nm000104 # interactive prompt`).action(async(e,t)=>{Lr(),await Uf("release");let n=D("Fetching dataset info...").start(),r;try{r=await Xn(e),n.succeed(`Dataset: ${r.name||e}`)}catch(v){if(v instanceof L)n.fail(v.message);else n.fail("Failed to fetch dataset");process.exit(1)}if(!r.github_repo)console.log(u.red("Error: Dataset has no GitHub repository")),process.exit(1);let o;try{let v=await Kf(e);if(o=v.current_version.replace(/^v/,""),console.log(` Current version: ${u.cyan(o)}`),v.versions.length>0){console.log(` Version DOIs: ${v.versions.length}`);for(let C of v.versions.slice(0,3))console.log(` ${C.version} - ${u.dim(C.doi)}`);if(v.versions.length>3)console.log(u.dim(` ... and ${v.versions.length-3} more`))}}catch(v){let C=v instanceof L?`${v.statusCode}: ${v.message}`:String(v);console.log(u.red(`Error: Could not fetch version history (${C})`)),console.log(" Cannot determine current version. Ensure the backend is reachable."),process.exit(1)}let s;if(t.version!==void 0){if(!xM(t.version))console.log(u.red(`Error: Invalid version: ${t.version}`)),console.log(" Expected format: X.Y.Z (e.g., 2.0.0)"),process.exit(1);s=t.version.replace(/^v/,"")}else if(t.type){let v=t.type;if(!["patch","minor","major"].includes(v))console.log(u.red(`Error: Invalid bump type: ${t.type}`)),console.log(" Expected: patch, minor, or major"),process.exit(1);s=_i(o,v)}else{if(!$l(o))console.log(u.red(`Error: Cannot parse current version: ${o}`)),process.exit(1);let C=[{name:`patch ${o} -> ${_i(o,"patch")}`,value:"patch"},{name:`minor ${o} -> ${_i(o,"minor")}`,value:"minor"},{name:`major ${o} -> ${_i(o,"major")}`,value:"major",...
|
|
2264
|
+
$ nemar dataset release nm000104 # interactive prompt`).action(async(e,t)=>{Lr(),await Uf("release");let n=D("Fetching dataset info...").start(),r;try{r=await Xn(e),n.succeed(`Dataset: ${r.name||e}`)}catch(v){if(v instanceof L)n.fail(v.message);else n.fail("Failed to fetch dataset");process.exit(1)}if(!r.github_repo)console.log(u.red("Error: Dataset has no GitHub repository")),process.exit(1);let o;try{let v=await Kf(e);if(o=v.current_version.replace(/^v/,""),console.log(` Current version: ${u.cyan(o)}`),v.versions.length>0){console.log(` Version DOIs: ${v.versions.length}`);for(let C of v.versions.slice(0,3))console.log(` ${C.version} - ${u.dim(C.doi)}`);if(v.versions.length>3)console.log(u.dim(` ... and ${v.versions.length-3} more`))}}catch(v){let C=v instanceof L?`${v.statusCode}: ${v.message}`:String(v);console.log(u.red(`Error: Could not fetch version history (${C})`)),console.log(" Cannot determine current version. Ensure the backend is reachable."),process.exit(1)}let s;if(t.version!==void 0){if(!xM(t.version))console.log(u.red(`Error: Invalid version: ${t.version}`)),console.log(" Expected format: X.Y.Z (e.g., 2.0.0)"),process.exit(1);s=t.version.replace(/^v/,"")}else if(t.type){let v=t.type;if(!["patch","minor","major"].includes(v))console.log(u.red(`Error: Invalid bump type: ${t.type}`)),console.log(" Expected: patch, minor, or major"),process.exit(1);s=_i(o,v)}else{if(!$l(o))console.log(u.red(`Error: Cannot parse current version: ${o}`)),process.exit(1);let C=[{name:`patch ${o} -> ${_i(o,"patch")}`,value:"patch"},{name:`minor ${o} -> ${_i(o,"minor")}`,value:"minor"},{name:`major ${o} -> ${_i(o,"major")}`,value:"major",...Gq(e,r.source)?{disabled:"a mirror's major is an upstream re-pull (nemar admin repull plan)"}:{}},{name:"custom version",value:"custom"}],{bumpType:T}=await Ae.prompt([{type:"list",name:"bumpType",message:"Select version bump type:",choices:C}]);if(T==="custom"){let{customVersion:V}=await Ae.prompt([{type:"input",name:"customVersion",message:"Enter version (X.Y.Z):",validate:(A)=>xM(A)||"Invalid format. Use X.Y.Z (e.g., 2.0.0)"}]);s=V.replace(/^v/,"")}else s=_i(o,T)}if(yAe({datasetId:e,source:r.source,current:o,next:s}),console.log(),console.log(` ${u.bold("Version bump:")} ${o} -> ${u.green(s)}`),Kq(s_(s)),await De(`Create release PR for ${e} v${s}?`,{yes:t.yes})!=="confirmed"){console.log("Cancelled.");return}let a,c=!0;if(t.dir){if(!bs(t.dir))console.log(u.red(`Error: Directory not found: ${t.dir}`)),process.exit(1);a=qs(t.dir),c=!1}else a=SNt(Jp($Nt(),`nemar-release-${e}-`));if(c){let v=`https://github.com/${r.github_repo}.git`,C=D("Cloning dataset...").start(),T=await wo(v,a);if(!T.success)C.fail(`Clone failed: ${T.error}`),process.exit(1);C.succeed("Cloned dataset")}let l=`release/v${s}`,d=D("Creating release branch...").start(),f=So({cmd:["git","checkout","-b",l],cwd:a,stdout:"pipe",stderr:"pipe"});if(await f.exited!==0){let v=await new Response(f.stderr).text();d.fail(`Failed to create branch: ${v.trim()}`),process.exit(1)}d.succeed(`Created branch: ${l}`);let p=Jp(a,"dataset_description.json");if(!bs(p))console.log(u.red("Error: dataset_description.json not found in repo")),process.exit(1);let m;try{m=JSON.parse(X_(p,"utf-8"))}catch(v){if(v instanceof SyntaxError)console.log(u.red("Error: dataset_description.json contains invalid JSON"));else console.log(u.red(`Error: Could not read dataset_description.json: ${v}`));process.exit(1)}m.Version=s,cAe(p,`${JSON.stringify(m,null,2)}
|
|
2265
2265
|
`);let h=D("Committing version bump...").start(),g=So({cmd:["git","add","dataset_description.json"],cwd:a,stdout:"pipe",stderr:"pipe"});if(await g.exited!==0){let v=await new Response(g.stderr).text();h.fail(`Failed to stage changes: ${v.trim()}`),process.exit(1)}let y=So({cmd:["git","commit","-m",`Bump version to ${s}`],cwd:a,stdout:"pipe",stderr:"pipe"});if(await y.exited!==0){let v=await new Response(y.stderr).text();h.fail(`Commit failed: ${v.trim()}`),process.exit(1)}h.succeed("Committed version bump");let b=D("Pushing branch...").start(),_=await tw(a,l);if(!_.success)b.fail(`Push failed: ${_.error}`),process.exit(1);b.succeed("Pushed branch");let x=!1,k=D("Creating pull request...").start();try{let v=s_(s),C=`## Version Bump
|
|
2266
2266
|
|
|
2267
2267
|
Bumps ${e} from ${o} to ${s}.
|
|
@@ -2269,7 +2269,7 @@ Bumps ${e} from ${o} to ${s}.
|
|
|
2269
2269
|
On merge, CI will:
|
|
2270
2270
|
- Tag the release (v${s})
|
|
2271
2271
|
- Publish a version DOI (if concept DOI exists)`,T=So({cmd:["gh","pr","create","--repo",r.github_repo,"--head",l,"--base","main","--title",v,"--body",C],cwd:a,stdout:"pipe",stderr:"pipe"}),V=(await new Response(T.stdout).text()).trim();if(await T.exited!==0){let A=await new Response(T.stderr).text();throw Error(A.trim()||"gh pr create failed")}x=!0,k.succeed("Created pull request"),console.log(),console.log(` ${u.cyan("PR:")} ${V}`)}catch(v){k.fail("Failed to create PR");let C=v instanceof Error?v.message:String(v);if(console.log(u.red(` ${C}`)),C.includes("not found")||C.includes("command not found"))console.log(u.yellow(" Install: brew install gh"));else if(C.includes("auth")||C.includes("401"))console.log(u.yellow(" Run: gh auth login"));console.log(u.dim(` Branch ${l} has been pushed. Create the PR manually.`))}if(t.monitor&&x){console.log(),console.log(u.dim("Monitoring CI checks...")),console.log(u.dim(" Press Ctrl+C to stop monitoring"));let v=0,C=60;while(v<C){await new Promise((F)=>setTimeout(F,1e4)),v++;let T=So({cmd:["gh","pr","checks","--repo",r.github_repo,l],cwd:a,stdout:"pipe",stderr:"pipe"}),V=await new Response(T.stdout).text();if(await T.exited===0){if(console.log(u.green(" All checks passed!")),await De("Merge the PR?",{yes:t.yes})==="confirmed"){let M=So({cmd:["gh","pr","merge","--repo",r.github_repo,l,"--squash","--delete-branch"],cwd:a,stdout:"pipe",stderr:"pipe"});if(await M.exited===0)console.log(u.green(" PR merged successfully!"));else{let B=await new Response(M.stderr).text();console.log(u.red(` Merge failed: ${B.trim()}`))}}break}if(V.includes("fail")||V.includes("X")){console.log(u.red(" Some checks failed:")),console.log(V);break}process.stdout.write(u.dim("."))}if(v>=C)console.log(u.yellow(`
|
|
2272
|
-
Timed out waiting for checks.`))}if(c)console.log(),console.log(u.dim(`Working directory: ${a}`)),console.log(u.dim("You can delete this directory after the PR is merged."))});var jNt={command:"nemar dataset update",title:"--message",description:"--description",example:'nemar dataset update -m "Add twelve subjects" --description "Adds sub-21 to sub-32, each with a resting-state recording."'},LNt={command:"nemar dataset push --pr",title:"--title",description:"--body",example:'nemar dataset push --pr -t "Add the second session" -b "Adds ses-02 for sub-01 to sub-05."'},qNt={title:"Title (one line saying what changed):",description:"Description (what changed and why):"},BNt={title:"The title",description:"The description"};function gAe(e,t,n){let r=n.terminal&&!n.yes,o={},s=[],i=[];for(let[a,c,l]of[["title",e.title,t.title],["description",e.description,t.description]]){if(c===void 0){i.push(l);continue}let d=XM(a,c);if(d)s.push(QM(`${BNt[a]} (${l})`,d));else o[a]=gR(a,c)}if(s.length===0&&(i.length===0||r))return o;for(let a of s)console.log(u.red(`Error: ${a}`));if(i.length>0&&!r)console.log(u.red(`Error: ${t.command} needs a pull request title and description; missing ${i.join(" and ")}.`)),console.log(" They are written into the pull request for a person to read, so say in plain words what changed."),console.log(n.yes?n.terminal?" --yes does not stand in for them: drop it to be asked for them here, or pass both.":" --yes does not stand in for them, and without a terminal nothing can ask for them: pass both.":" Without a terminal nothing can ask for them: pass both."),console.log(u.dim(` Example: ${t.example}`));Io(),process.exit(1)}function
|
|
2272
|
+
Timed out waiting for checks.`))}if(c)console.log(),console.log(u.dim(`Working directory: ${a}`)),console.log(u.dim("You can delete this directory after the PR is merged."))});var jNt={command:"nemar dataset update",title:"--message",description:"--description",example:'nemar dataset update -m "Add twelve subjects" --description "Adds sub-21 to sub-32, each with a resting-state recording."'},LNt={command:"nemar dataset push --pr",title:"--title",description:"--body",example:'nemar dataset push --pr -t "Add the second session" -b "Adds ses-02 for sub-01 to sub-05."'},qNt={title:"Title (one line saying what changed):",description:"Description (what changed and why):"},BNt={title:"The title",description:"The description"};function gAe(e,t,n){let r=n.terminal&&!n.yes,o={},s=[],i=[];for(let[a,c,l]of[["title",e.title,t.title],["description",e.description,t.description]]){if(c===void 0){i.push(l);continue}let d=XM(a,c);if(d)s.push(QM(`${BNt[a]} (${l})`,d));else o[a]=gR(a,c)}if(s.length===0&&(i.length===0||r))return o;for(let a of s)console.log(u.red(`Error: ${a}`));if(i.length>0&&!r)console.log(u.red(`Error: ${t.command} needs a pull request title and description; missing ${i.join(" and ")}.`)),console.log(" They are written into the pull request for a person to read, so say in plain words what changed."),console.log(n.yes?n.terminal?" --yes does not stand in for them: drop it to be asked for them here, or pass both.":" --yes does not stand in for them, and without a terminal nothing can ask for them: pass both.":" Without a terminal nothing can ask for them: pass both."),console.log(u.dim(` Example: ${t.example}`));Io(),process.exit(1)}function Kq(e){let t=bR(e);if(t===null)return;console.log(u.red(`Error: ${eke(e,t)}`)),console.log(u.dim(" Nothing was changed.")),Io(),process.exit(1)}function yAe(e){let t=XCe(e);if(t===null)return;console.log(u.red(`Error: ${t}`)),console.log(u.dim(" Nothing was changed. NEMAR's own changes to a mirror take minor and patch.")),Io(),process.exit(1)}function UNt(e,t){if(!["patch","minor","major"].includes(t))return null;try{let n=JSON.parse(X_(Jp(e,"dataset_description.json"),"utf-8"));if(typeof n.Version!=="string"||!n.Version)return null;return _i(n.Version,t)}catch{return null}}async function tAe(e){for(;;){let{value:t}=await Ae.prompt([{type:"input",name:"value",message:qNt[e]}]),n=XM(e,t);if(!n)return gR(e,t);console.log(u.red(` ${QM("That",n)}`))}}async function bAe(e){let t=e.title??await tAe("title"),n=e.description??await tAe("description");return{title:t,description:n}}async function nAe(e){let t=gAe({title:e.title,description:e.body},LNt,{yes:!1,terminal:process.stdin.isTTY===!0});return bAe(t)}var rAe=(e)=>e==="main"||e==="master";Nn.command("update").description("Push local changes to a dataset via PR").argument("[path]","Path to local dataset clone (default: current directory)").option("--bump <type>","Version bump type: patch, minor, or major","patch").option("--branch <name>","Custom branch name").option("-m, --message <title>","Title of the update: the pull request title and the CHANGES entry (required)").option("--description <text>","What changed and why, in plain words: the pull request body (required)").option("--monitor","Watch CI checks and offer to merge").option(Xe,nt).addHelpText("after",`
|
|
2273
2273
|
Description:
|
|
2274
2274
|
Push local changes (metadata or data files) to a dataset via a pull
|
|
2275
2275
|
request. Automatically bumps the version, writes the CHANGES entry for
|
|
@@ -2304,7 +2304,7 @@ Examples:
|
|
|
2304
2304
|
$ nemar dataset update ./nm000104 --bump minor -m "Add new subjects" \\
|
|
2305
2305
|
--description "Second cohort, recorded in 2026."
|
|
2306
2306
|
$ nemar dataset update --branch fix/metadata -m "Fix participant ages" \\
|
|
2307
|
-
--description "Ages in participants.tsv were in months; they are now in years."`).action(async(e,t)=>{let n=gAe({title:t.message,description:t.description},jNt,{yes:t.yes===!0,terminal:process.stdin.isTTY===!0}),r=UNt(qs(e||"."),t.bump);if(n.title!==void 0&&r!==null)
|
|
2307
|
+
--description "Ages in participants.tsv were in months; they are now in years."`).action(async(e,t)=>{let n=gAe({title:t.message,description:t.description},jNt,{yes:t.yes===!0,terminal:process.stdin.isTTY===!0}),r=UNt(qs(e||"."),t.bump);if(n.title!==void 0&&r!==null)Kq(wR(n.title,r));Lr(),await Uf("update");let o=qs(e||".");if(!bs(Jp(o,".git")))console.log(u.red("Error: Not a git repository")),console.log(" Run this from inside a dataset clone, or pass the path."),process.exit(1);let s=await xd(o);if(!s)console.log(u.red("Error: Could not detect dataset ID from git remote")),process.exit(1);console.log(` Dataset: ${u.cyan(s)}`);let i=await uc(o);if(i!=="main"){if(console.log(u.yellow(`Warning: Currently on branch '${i}', expected 'main'`)),await De("Continue anyway?",{yes:t.yes})!=="confirmed"){console.log("Cancelled.");return}}let a=So({cmd:["git","status","--porcelain","-z"],cwd:o,stdout:"pipe",stderr:"pipe"}),c=nke(await new Response(a.stdout).text());if(await a.exited!==0)console.log(u.red("Error: Failed to check git status")),process.exit(1);if(c.length===0){console.log(u.yellow("No changes detected.")),console.log(" Make changes to the dataset files, then run this command again.");return}let l=[],d=[];for(let oe of c)if(/\.(edf|bdf|set|fdt|nwb|eeg|vhdr|vmrk|cnt|mff|gz)$/i.test(oe))l.push(oe);else d.push(oe);if(console.log(),d.length>0){console.log(` ${u.bold("Metadata files:")} ${d.length}`);for(let oe of d.slice(0,5))console.log(` ${oe}`);if(d.length>5)console.log(u.dim(` ... and ${d.length-5} more`))}if(l.length>0){console.log(` ${u.bold("Data files:")} ${l.length}`);for(let oe of l.slice(0,5))console.log(` ${oe}`);if(l.length>5)console.log(u.dim(` ... and ${l.length-5} more`))}let f=D("Fetching dataset info...").start(),p;try{p=await Xn(s),f.succeed()}catch(oe){if(oe instanceof L)f.fail(oe.message);else f.fail("Failed to fetch dataset");process.exit(1)}if(!p.github_repo)console.log(u.red("Error: Dataset has no GitHub repository")),process.exit(1);let m,h=Jp(o,"dataset_description.json");if(!bs(h))console.log(u.red("Error: dataset_description.json not found")),console.log(" This file is required for BIDS datasets."),process.exit(1);try{let oe=JSON.parse(X_(h,"utf-8"));if(typeof oe.Version!=="string"||!oe.Version)console.log(u.red("Error: No Version field in dataset_description.json")),console.log(' Set the Version field before updating (e.g., "Version": "1.0.0").'),process.exit(1);m=oe.Version}catch(oe){if(oe instanceof SyntaxError)console.log(u.red("Error: dataset_description.json contains invalid JSON"));else console.log(u.red(`Error: Could not read dataset_description.json: ${oe}`));process.exit(1)}let g=t.bump;if(!["patch","minor","major"].includes(g))console.log(u.red(`Error: Invalid bump type: ${t.bump}`)),process.exit(1);let y=_i(m,g);yAe({datasetId:s,source:p.source,current:m,next:y}),console.log(` ${u.bold("Version bump:")} ${m} -> ${u.green(y)}`);try{ej(o,y)}catch(oe){console.log(u.red(`Error: Cannot update the change log: ${G(oe)}`)),console.log(u.dim(" Nothing was changed.")),ce(),process.exit(1)}let{title:b,description:_}=await bAe(n);if(Kq(wR(b,y)),await De(`Create update PR for ${s}?`,{yes:t.yes})!=="confirmed"){console.log("Cancelled.");return}let k=Date.now().toString(36),v=t.branch||`update/${s}-${k}`,C=D("Creating update branch...").start(),T=So({cmd:["git","checkout","-b",v],cwd:o,stdout:"pipe",stderr:"pipe"});if(await T.exited!==0){let oe=await new Response(T.stderr).text();C.fail(`Failed to create branch: ${oe.trim()}`),process.exit(1)}C.succeed(`Created branch: ${v}`);let V=Jp(o,"dataset_description.json"),A;try{A=JSON.parse(X_(V,"utf-8"))}catch(oe){if(oe instanceof SyntaxError)console.log(u.red("Error: dataset_description.json contains invalid JSON"));else console.log(u.red(`Error: Could not read dataset_description.json: ${oe}`));process.exit(1)}A.Version=y,cAe(V,`${JSON.stringify(A,null,2)}
|
|
2308
2308
|
`);let F=ake(o,y,b,cke(new Date));console.log(u.dim(` ${ike(F,y)}`));let M=D("Committing changes...").start(),U=So({cmd:["git","add","-A"],cwd:o,stdout:"pipe",stderr:"pipe"});if(await U.exited!==0){let oe=await new Response(U.stderr).text();M.fail(`Failed to stage changes: ${oe.trim()}`),process.exit(1)}let B=So({cmd:["git","diff","--cached","--name-status","-z","--no-renames"],cwd:o,stdout:"pipe",stderr:"pipe"}),P=tke(await new Response(B.stdout).text());if(await B.exited!==0){let oe=await new Response(B.stderr).text();M.fail(`Failed to read the staged changes: ${oe.trim()}`),process.exit(1)}let O=So({cmd:["git","commit","-m",b],cwd:o,stdout:"pipe",stderr:"pipe"});if(await O.exited!==0){let oe=await new Response(O.stderr).text();M.fail(`Commit failed: ${oe.trim()}`),process.exit(1)}if(M.succeed("Committed changes"),l.length>0)if(await So({cmd:["git","annex","version"],cwd:o,stdout:"pipe",stderr:"pipe"}).exited===0){let je=D("Requesting upload credentials...").start(),Ie=null;try{Ie=await Xr(s),je.succeed("Upload credentials received")}catch(Q){je.fail(`Could not get upload credentials: ${G(Q)}`),console.log(u.yellow(" Data files will not be uploaded. Push manually after PR."))}if(Ie){if((await iD(o)).length===0){je=D("Configuring S3 remote...").start();let Ue=await Bo(o,{name:"nemar-s3",bucket:Ie.s3.bucket,prefix:`${s}/objects`,region:Ie.s3.region,publicUrl:`https://${Ie.s3.bucket}.s3.${Ie.s3.region}.amazonaws.com`},mr(Ie.credentials));if(!Ue.success)je.warn(`Failed to configure S3 remote: ${Ue.error}`),console.log(u.yellow(" Data files will not be uploaded. Push manually after PR."));else je.succeed("S3 remote configured")}if((await iD(o)).includes("nemar-s3")){je=D("Uploading data files to S3...").start();let Ue=await Rd(o,"nemar-s3",4,mr(Ie.credentials));if(await ro(o),!Ue.success)je.warn(`S3 upload issue: ${Ue.error}`),console.log(u.yellow(" Data files may need manual upload after PR creation."));else je.succeed(`Uploaded ${Ue.filesCopied} data files to S3`)}}}else console.log(u.yellow(" git-annex not available; data files will be committed to git."));let H=D("Pushing branch...").start(),re=await tw(o,v);if(!re.success)H.fail(`Push failed: ${re.error}`),process.exit(1);if(l.length>0){let oe=await ew(o,"origin");if(!oe.success)console.log(u.yellow(` Warning: Failed to push git-annex branch: ${oe.error}`))}H.succeed("Pushed branch");let Ee=!1,Zt=D("Creating pull request...").start(),pt=wR(b,y),Ze=oke({description:_,datasetId:s,fromVersion:m,toVersion:y,files:P});try{let oe=So({cmd:["gh","pr","create","--repo",p.github_repo,"--head",v,"--base","main","--title",pt,"--body",Ze],cwd:o,stdout:"pipe",stderr:"pipe"}),je=(await new Response(oe.stdout).text()).trim();if(await oe.exited!==0){let Ie=await new Response(oe.stderr).text();throw Error(Ie.trim()||"gh pr create failed")}Ee=!0,Zt.succeed("Created pull request"),console.log(),console.log(` ${u.cyan("PR:")} ${je}`)}catch(oe){Zt.fail("Failed to create PR");let je=oe instanceof Error?oe.message:String(oe);console.log(u.red(` ${je}`)),console.log(u.dim(` Branch ${v} has been pushed. Create the PR manually.`));for(let Ie of ZM(pt,Ze))console.log(u.dim(Ie))}if(t.monitor&&Ee){console.log(),console.log(u.dim("Monitoring CI checks..."));let oe=0,je=60;while(oe<je){await new Promise((Ue)=>setTimeout(Ue,1e4)),oe++;let Ie=So({cmd:["gh","pr","checks","--repo",p.github_repo,v],cwd:o,stdout:"pipe",stderr:"pipe"}),Q=await new Response(Ie.stdout).text();if(await Ie.exited===0){if(console.log(u.green(" All checks passed!")),await De("Merge the PR?",{yes:t.yes})==="confirmed"){let W=So({cmd:["gh","pr","merge","--repo",p.github_repo,v,"--squash","--delete-branch"],cwd:o,stdout:"pipe",stderr:"pipe"});if(await W.exited===0)console.log(u.green(" PR merged successfully!"));else{let J=await new Response(W.stderr).text();console.log(u.red(` Merge failed: ${J.trim()}`))}}break}if(Q.includes("fail")||Q.includes("X")){console.log(u.red(" Some checks failed:")),console.log(Q);break}process.stdout.write(u.dim("."))}if(oe>=je)console.log(u.yellow(`
|
|
2309
2309
|
Timed out waiting for checks.`))}});Nn.command("request-access").description("Request collaborator access to a dataset").argument("<dataset-id>","Dataset ID (e.g., nm000104)").addHelpText("after",`
|
|
2310
2310
|
Description:
|
|
@@ -2399,7 +2399,7 @@ Examples:
|
|
|
2399
2399
|
$ nemar dataset publish request nm000104 --anonymous # blind, for review
|
|
2400
2400
|
$ nemar dataset publish status nm000104 # Check request status`).option("--anonymous","Release the data with your identity withheld until publication").action(async(e,t)=>{Lr();let n=D(t.anonymous?`Requesting anonymous release for ${e}...`:`Requesting publication for ${e}...`).start();try{let r=await ug(e,{anonymous:t.anonymous});n.succeed(r.message);let o=t.anonymous===!0&&r.anonymous!==!0;if(o)oAe(e);else if(r.anonymous===!0)console.log(u.dim(`
|
|
2401
2401
|
Your identity will be withheld: the repository stays private, the DOI stays
|
|
2402
|
-
reserved, and NEMAR names nobody until you publish without --anonymous.`));let s=r.identifier_screen;if(s){console.log();for(let i of Oc(s))console.log(i)}console.log();for(let i of PEe(e))console.log(` ${i}`);if(o)process.exit(1)}catch(r){if(I1e(r)){n.info($
|
|
2402
|
+
reserved, and NEMAR names nobody until you publish without --anonymous.`));let s=r.identifier_screen;if(s){console.log();for(let i of Oc(s))console.log(i)}console.log();for(let i of PEe(e))console.log(` ${i}`);if(o)process.exit(1)}catch(r){if(I1e(r)){n.info($q(r.blockReason));for(let i of Dq(e,t.anonymous===!0))console.log(i);let o=N1e(r);if(o)console.log(` CI: ${o}`);let s=r.rawBody?.anonymous;if(t.anonymous&&s!==!0)oAe(e),process.exit(1);return}if(r instanceof L){if(n.fail(r.message),console.log(u.dim(` ${r.message}`)),r.statusCode===409)console.log(u.dim(" Use 'nemar dataset publish resend' to remind admins."));else if(r.statusCode===403)console.log(u.dim(" Only the dataset owner can request publication."));else if(r.statusCode===422){let o=r.details;if(o?.reasons?.length){console.log(`
|
|
2403
2403
|
${u.red("Not accepted for publication:")}`);for(let s of o.reasons)console.log(` ${u.red("-")} ${s}`);if(o.policy_url)console.log(u.dim(`
|
|
2404
2404
|
Policy: ${o.policy_url}`));console.log(u.dim(" Fix the items above, then re-run 'nemar dataset publish request'."))}}}else{n.fail("Failed to request publication");let o=r instanceof Error?r.message:String(r);console.log(u.dim(` Error details: ${o}`))}process.exit(1)}});Q_.command("status").description("Check publication status of a dataset").argument("<dataset-id>","Dataset ID (e.g., nm000104)").addHelpText("after",`
|
|
2405
2405
|
Description:
|
|
@@ -2436,7 +2436,7 @@ ${u.cyan("Publication Status:")} ${e}
|
|
|
2436
2436
|
`);let r={published:u.green,denied:u.red,approving:u.yellow},o=n.status==="denied"&&n.withdrawn===!0,s=o?u.yellow:r[n.status]||u.dim;if(console.log(` Status: ${s(o?"withdrawn":n.status)}`),n.anonymous===!0)console.log(` Anonymous: ${u.yellow("yes")} ${u.dim("(identity withheld; repository stays private, DOI stays reserved)")}`);else if(n.anonymous===!1)console.log(` Anonymous: ${u.dim("no")} ${u.dim("(published under your name, with a resolving DOI)")}`);if(n.requested_at)console.log(` Requested: ${u.dim(n.requested_at)}`);if(n.requested_by)console.log(` Requested by: ${u.dim(n.requested_by)}`);if(o)console.log(u.dim(`
|
|
2437
2437
|
You withdrew this request. Request again with: nemar dataset publish request ${e}`));else if(n.status==="denied"&&n.denied_reason)console.log(`
|
|
2438
2438
|
${u.red("Reason:")} ${n.denied_reason}`);let i=n.status==="blocked"&&dk(n.block_reason)?n.block_reason:void 0,a=i?[]:Oc(n.identifier_screen);if(a.length>0){console.log();for(let c of a)console.log(c)}if(i){console.log(`
|
|
2439
|
-
${u.cyan("\u2139")} ${$
|
|
2439
|
+
${u.cyan("\u2139")} ${$q(i)}`);for(let c of Dq(e,n.anonymous===!0))console.log(c);if(n.ci_url)console.log(` ${u.dim("CI:")} ${n.ci_url}`)}else if(n.status==="blocked"){if(n.message)console.log(`
|
|
2440
2440
|
${u.red("Blocked:")} ${n.message}`);else if(n.block_reason)console.log(`
|
|
2441
2441
|
${u.red("Blocked:")} ${n.block_reason}`);if(n.reasons?.length){for(let l of n.reasons)console.log(` ${u.red("-")} ${l}`);if(n.policy_url)console.log(u.dim(` Policy: ${n.policy_url}`))}if(n.ci_url)console.log(` ${u.dim("CI:")} ${n.ci_url}`);let c=`nemar dataset publish request ${e}${n.anonymous===!0?" --anonymous":""}`;console.log(u.dim(` This re-checks automatically once CI passes; or re-run '${c}' to retry now.`))}if(n.advisory?.source==="prescreen"){console.log(`
|
|
2442
2442
|
${u.yellow("Pre-screen advisory")} ${u.dim("(non-blocking):")}`);for(let c of n.advisory.reasons)console.log(` ${u.yellow("-")} ${c}`);if(n.advisory.issue_url)console.log(u.dim(` ${n.advisory.issue_url}`))}if(n.status==="approving"){let c=Rk(n.anonymous===!0),l=n.steps_completed||[],d=c.length;console.log(`
|
|
@@ -2477,7 +2477,7 @@ Description:
|
|
|
2477
2477
|
|
|
2478
2478
|
Examples:
|
|
2479
2479
|
$ nemar dataset publish withdraw nm000104
|
|
2480
|
-
$ nemar dataset publish withdraw nm000104 --yes`).action(async(e,t)=>{Lr();let n=await De(`Withdraw the publication request for ${e}?`,t);if(n!=="confirmed"){console.log(u.dim(n==="declined"?"Skipped":"Cancelled"));return}let r=D(`Withdrawing the publication request for ${e}...`).start();try{await _pe(e),r.succeed(`Publication request withdrawn for ${e}`),console.log(u.dim(` Request again any time: nemar dataset publish request ${e}`))}catch(o){if(o instanceof L){r.fail(o.message);let s=HNt(o);if(hg(o))ce();if(s==="no_active_request")console.log(u.dim(" There is no active publication request for this dataset."));else if(s==="withdraw_too_late")console.log(u.dim(" Your request was left as it was. Ask an administrator if it should stop."))}else{r.fail("Failed to withdraw the publication request");let s=o instanceof Error?o.message:String(o);console.log(u.dim(` Error details: ${s}`))}process.exit(1)}});Nn.addCommand(Q_);function sAe(e){if(H1(e)&&Ve())console.log(u.dim(" Data hosts were not asked: the main service did not say it lacks this dataset.")),console.log(u.dim(" Try again, or use --host <origin> to read from one data host."))}async function iAe(e,t,n){let r;if(n!==void 0){let m=z1(n);if(m===null)console.log(u.red(`Error: ${No(n,100)} is not a data host this CLI sends your API key to.`)),console.log(u.dim(` Allowed: ${V1().join(", ")}`)),console.log(u.dim(" NEMAR_DATA_HOSTS adds https origins (for staging).")),process.exit(1);if(r=m,!H1(e))console.log(u.red(`Error: ${No(e,40)} is not a dataset id on a data host.`)),console.log(u.dim(" A dataset id is two or three letters and six digits.")),process.exit(1)}let o=zt().apiKey;if(!o)console.log(u.red("Error: Reading from a data host needs your NEMAR API key.")),console.log(u.dim(" Run 'nemar auth login' first.")),process.exit(1);for(let m of bRe())console.log(u.yellow(` Ignoring NEMAR_DATA_HOSTS entry ${No(m,60)}: not an https origin.`));let s=D(`Looking for ${e} on ${r??"NEMAR data hosts"}...`).start(),i=await f1e(e,o,r?[r]:V1());if(!i.found){s.stop();for(let m of i.refused)console.log(u.yellow(` ${m} did not accept your API key. Run 'nemar auth login'.`));for(let{origin:m,detail:h}of i.unreachable)console.log(u.yellow(` Could not get an answer from ${m} (${h}).`));if(r)console.log(u.red(`Error: Dataset ${e} not found on ${r}`));return!1}let{origin:a,name:c}=i.found;s.succeed(`Found: ${c?No(c,100):e} (${a})`);let l=qs(t.output||e);if(bs(l))console.log(u.red(`Error: Path already exists: ${l}`)),process.exit(1);let d;try{d=
|
|
2480
|
+
$ nemar dataset publish withdraw nm000104 --yes`).action(async(e,t)=>{Lr();let n=await De(`Withdraw the publication request for ${e}?`,t);if(n!=="confirmed"){console.log(u.dim(n==="declined"?"Skipped":"Cancelled"));return}let r=D(`Withdrawing the publication request for ${e}...`).start();try{await _pe(e),r.succeed(`Publication request withdrawn for ${e}`),console.log(u.dim(` Request again any time: nemar dataset publish request ${e}`))}catch(o){if(o instanceof L){r.fail(o.message);let s=HNt(o);if(hg(o))ce();if(s==="no_active_request")console.log(u.dim(" There is no active publication request for this dataset."));else if(s==="withdraw_too_late")console.log(u.dim(" Your request was left as it was. Ask an administrator if it should stop."))}else{r.fail("Failed to withdraw the publication request");let s=o instanceof Error?o.message:String(o);console.log(u.dim(` Error details: ${s}`))}process.exit(1)}});Nn.addCommand(Q_);function sAe(e){if(H1(e)&&Ve())console.log(u.dim(" Data hosts were not asked: the main service did not say it lacks this dataset.")),console.log(u.dim(" Try again, or use --host <origin> to read from one data host."))}async function iAe(e,t,n){let r;if(n!==void 0){let m=z1(n);if(m===null)console.log(u.red(`Error: ${No(n,100)} is not a data host this CLI sends your API key to.`)),console.log(u.dim(` Allowed: ${V1().join(", ")}`)),console.log(u.dim(" NEMAR_DATA_HOSTS adds https origins (for staging).")),process.exit(1);if(r=m,!H1(e))console.log(u.red(`Error: ${No(e,40)} is not a dataset id on a data host.`)),console.log(u.dim(" A dataset id is two or three letters and six digits.")),process.exit(1)}let o=zt().apiKey;if(!o)console.log(u.red("Error: Reading from a data host needs your NEMAR API key.")),console.log(u.dim(" Run 'nemar auth login' first.")),process.exit(1);for(let m of bRe())console.log(u.yellow(` Ignoring NEMAR_DATA_HOSTS entry ${No(m,60)}: not an https origin.`));let s=D(`Looking for ${e} on ${r??"NEMAR data hosts"}...`).start(),i=await f1e(e,o,r?[r]:V1());if(!i.found){s.stop();for(let m of i.refused)console.log(u.yellow(` ${m} did not accept your API key. Run 'nemar auth login'.`));for(let{origin:m,detail:h}of i.unreachable)console.log(u.yellow(` Could not get an answer from ${m} (${h}).`));if(r)console.log(u.red(`Error: Dataset ${e} not found on ${r}`));return!1}let{origin:a,name:c}=i.found;s.succeed(`Found: ${c?No(c,100):e} (${a})`);let l=qs(t.output||e);if(bs(l))console.log(u.red(`Error: Path already exists: ${l}`)),process.exit(1);let d;try{d=xq()}catch(m){if(!(m instanceof K_))throw m;console.log(u.red(`Error: ${m.message}`)),process.exit(1)}let f=D("Cloning dataset...").start(),p=await p1e(i.found.origin,e,l,d);if(!p.success)f.fail("Clone failed"),console.log(u.red(` ${p.error}`)),process.exit(1);if(f.succeed("Dataset cloned"),await vq(l))console.log(u.dim(" Data remote enabled for data downloads"));else if(!kq())console.log(u.yellow(" Warning: git-annex-remote-nemar is not on your PATH, so git-annex could not enable the data remote.")),console.log(u.dim(" It is installed with the nemar CLI; check that its bin directory is on PATH."));else console.log(u.yellow(" This dataset does not declare a data remote yet, so data files cannot be fetched."));return console.log(),console.log(` Location: ${u.cyan(l)}`),console.log(),console.log(u.dim("Data files are not downloaded yet. To get them:")),console.log(u.dim(` cd ${l}`)),console.log(u.dim(" nemar dataset get")),!0}Nn.command("clone").description("Clone a dataset from NEMAR").argument("<dataset-id>","Dataset ID (e.g., nm000104)").option("-o, --output <path>","Output directory (default: ./<dataset-id>)").option("--host <origin>","Read the dataset from this authenticated NEMAR data host (must be on the CLI's list)").addHelpText("after",`
|
|
2481
2481
|
Description:
|
|
2482
2482
|
Clone a NEMAR dataset repository with git-annex initialized.
|
|
2483
2483
|
Data files are not downloaded; use 'nemar dataset get' afterward.
|
|
@@ -2532,7 +2532,7 @@ Examples:
|
|
|
2532
2532
|
$ nemar dataset get sub-01/eeg/ # Get specific directory
|
|
2533
2533
|
$ nemar dataset get stimuli/ # Explicit path: fetches stimuli/
|
|
2534
2534
|
$ nemar dataset get *.edf -j 8 # Get EDF files with 8 streams
|
|
2535
|
-
$ nemar dataset get --no-verify # Skip checksum verification (size still checked)`).action(async(e,t)=>{let n=process.cwd();if(!await Hi(n))console.log(u.red("Error: Not inside a git-annex dataset directory")),console.log(u.dim("Use 'nemar dataset clone <id>' first, then cd into the dataset.")),process.exit(1);let r=Number.parseInt(t.jobs,10);if(Number.isNaN(r)||r<1)console.log(u.red("Error: --jobs must be a positive integer")),process.exit(1);let o=await m1e(n);if(o){if(!Ve())console.log(u.red("Error: This dataset is on an authenticated data host.")),console.log(u.dim("Run 'nemar auth login' first.")),process.exit(1);if(!await
|
|
2535
|
+
$ nemar dataset get --no-verify # Skip checksum verification (size still checked)`).action(async(e,t)=>{let n=process.cwd();if(!await Hi(n))console.log(u.red("Error: Not inside a git-annex dataset directory")),console.log(u.dim("Use 'nemar dataset clone <id>' first, then cd into the dataset.")),process.exit(1);let r=Number.parseInt(t.jobs,10);if(Number.isNaN(r)||r<1)console.log(u.red("Error: --jobs must be a positive integer")),process.exit(1);let o=await m1e(n);if(o){if(!Ve())console.log(u.red("Error: This dataset is on an authenticated data host.")),console.log(u.dim("Run 'nemar auth login' first.")),process.exit(1);if(!await vq(n))console.log(u.yellow("This clone declares no data remote, so files cannot be fetched.")),console.log(u.dim(" Once the dataset declares it, 'git fetch' then 'git annex init' here enables it.")),process.exit(1);if(!kq())console.log(u.red("Error: git-annex-remote-nemar is not on your PATH.")),console.log(u.dim(" It is installed with the nemar CLI; check its bin directory.")),process.exit(1)}let s=null,i=o?null:await xd(n);if(i){let y=null,b=!0;try{y=await Xn(i)}catch(_){if(_ instanceof L&&_.statusCode!==0){if(_.statusCode===401||_.statusCode===403)console.log(u.red(`\u2716 ${_.message}`)),console.log(u.dim(" Run 'nemar auth login' or 'nemar auth regenerate-key'.")),process.exit(1);throw _}b=!1}if(!t.skipPortCheck){let _=y?.source==="openneuro";if(!b&&!_){let x=Jp(n,".nemar","metadata.json");if(bs(x))try{_=JSON.parse(X_(x,"utf-8")).source==="openneuro"}catch{}}if(_){if(await YN(n)==="absent")console.log(u.yellow("Porting still in progress.")),console.log(u.dim(" This dataset is being imported from OpenNeuro. Data files are not yet available.")),console.log(u.dim(" Wait 5\u201330 minutes (depending on dataset size), then retry.")),console.log(u.dim(" Run 'nemar dataset status <id>' to track progress.")),console.log(u.dim(" Pass --skip-port-check to bypass this check if you are certain porting is complete.")),process.exit(1)}}if(y&&y.visibility!=="public"){if(!Ve())console.log(u.red("Error: This is a private dataset. Authentication required.")),console.log(u.dim("Run 'nemar auth login' first.")),process.exit(1);let _=D("Requesting download credentials...").start();try{s=await MN(i),_.succeed("Download credentials received (2h expiry)")}catch(x){_.fail("Failed to get download credentials"),console.log(u.red(` ${x.message}`)),console.log(u.dim("Private datasets require authentication. Run 'nemar auth login' first.")),process.exit(1)}}}let a=s?mr(s.credentials):void 0;if(!o){let y=await qg(n,"nemar-s3",a);if(!y.success&&!y.enabled)console.log(u.yellow(` Warning: Could not enable S3 remote: ${y.error}`))}let c=e.length>0?e:void 0,l=r1e(c,{stimuli:t.stimuli,derivatives:t.derivatives}),d=l.args.length>0?l.args:void 0;for(let y of l.summary)console.log(u.dim(` ${y}`));let f=await x6(n,c,d);if(f&&f.fileCount===0){if(console.log(u.green("All data files already present")),s)await ro(n);return}let p=c?`Getting ${c.length} path(s)${f?` (${f.fileCount} files, ${Ut(f.totalBytes)})`:""}...`:`Getting all data files${f?` (${f.fileCount} files, ${Ut(f.totalBytes)})`:""}...`;console.log(u.bold(p));let m=new aC(f?.fileCount??0,f?.totalBytes??0),h=t.verify===!1,g=await v6(n,{jobs:r,paths:c,credentials:a,extraArgs:d,requireComplete:Boolean(t.requireComplete),noVerify:h,onProgress:(y)=>m.processLine(y)});if(!g.success){if(m.finish(g.filesDownloaded),console.log(u.red(` ${g.error}`)),Tw(g.noVerifyMismatches),s)await ro(n);process.exit(1)}if(m.finish(g.filesDownloaded),s)await ro(n);if(g.outcome==="partial")W6(g);else if(g.filesDownloaded===0)console.log(u.green("All data files already present"));else console.log(u.green(`Downloaded ${g.filesDownloaded} file(s)`));if(Tw(g.noVerifyMismatches),h)K6(g.unsizedFiles)});async function wAe(e){let t=process.cwd();if(!await Hi(t))console.log(u.red("Error: Not inside a git-annex dataset directory")),process.exit(1);let n=D("Saving changes...").start(),r=await pl(t,e.message);if(!r.success)n.fail("Save failed"),console.log(u.red(` ${r.error}`)),process.exit(1);n.succeed("Changes saved")}Nn.command("commit").description("Stage and commit changes in the current dataset").option("-m, --message <msg>","Commit message","Save changes").addHelpText("after",`
|
|
2536
2536
|
Description:
|
|
2537
2537
|
Stage all changes (git add -A) and commit them. Large files are
|
|
2538
2538
|
automatically handled by git-annex based on the dataset's largefiles config.
|
|
@@ -2648,7 +2648,7 @@ Examples:
|
|
|
2648
2648
|
$ nemar sandbox --verbose # Run with full subprocess output (debug stuck runs)
|
|
2649
2649
|
$ nemar sandbox status # Check if training is completed
|
|
2650
2650
|
$ nemar sandbox reset # Reset for re-training
|
|
2651
|
-
`).action(QNt);async function XNt(e,t,n){let r=await pl(e,t,n);if(!r.success)return{ok:!1,step:"save",error:r.error??"unknown error"};let o=await ur(e);if(!o.success)return{ok:!1,step:"push",error:o.error??"unknown error"};return{ok:!0,...o.warning?{warning:o.warning}:{}}}async function QNt(e={}){if(e.verbose)qfe(!0);if(console.log(),console.log(u.bold("NEMAR Sandbox Training")),console.log(u.dim("Verify your setup and learn the upload workflow")),e.verbose)console.log(u.dim("Verbose mode: subprocess invocations will be printed"));if(console.log(),!Ve()){console.log(u.red("Not authenticated")),console.log(u.dim("Run 'nemar auth login' first"));return}let t=await cC();if(t.status==="unknown")console.log(u.yellow("Could not confirm your training status with the server.")),console.log(u.dim(` ${t.reason}`)),console.log(u.dim(" Continuing; run 'nemar sandbox status --refresh' to re-check.")),console.log();let n=zt();if(t.status==="completed"){console.log(u.green("Sandbox training already completed!")),console.log(u.dim(`Dataset ID: ${n.sandboxDatasetId}`)),console.log(),console.log("You can upload real datasets with:"),console.log(u.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(u.dim("To re-run training, use: nemar sandbox reset"));return}console.log(u.bold("Step 1/6: Checking prerequisites..."));let r=D("Checking prerequisites...").start(),o=await C$();if(!o.allPassed){r.fail("Prerequisites check failed"),console.log(),console.log(u.red("Missing requirements:"));for(let H of o.errors)console.log(u.yellow(` - ${H}`));if(o.errors.some((H)=>H.includes("GitHub")))console.log(u.dim(" Run 'gh auth login' to authenticate with GitHub"));return}r.succeed("All prerequisites met");let s=D("Verifying GitHub CLI authentication...").start(),i=await QS(n.githubUsername);if(!i.authenticated){s.fail("GitHub CLI not authenticated"),console.log(u.red(` ${i.error}`)),console.log(),console.log("GitHub CLI is required for sandbox training. Install and authenticate:"),console.log(u.cyan(" brew install gh # or visit https://cli.github.com/")),console.log(u.cyan(" gh auth login"));return}if(n.githubUsername&&!i.matches)s.warn("GitHub CLI user mismatch"),console.log(u.yellow(` ${i.error}`)),console.log(),console.log("Your gh CLI is authenticated as a different GitHub account than your NEMAR account."),console.log("This may cause issues with repository access. To fix:"),console.log(u.cyan(` gh auth login # Login as ${n.githubUsername}`)),console.log(),console.log(u.yellow("WARNING: If upload fails with permission errors, this mismatch is the likely cause.")),console.log();else s.succeed(`GitHub CLI authenticated as ${i.username}`);console.log(),console.log(u.bold("Step 2/6: Generating test dataset..."));let a=D("Creating minimal BIDS structure...").start(),c;try{let H=xAe();c=H.root;let re=vAe(H);a.succeed(`Test dataset created (${Ut(re)})`),console.log(u.dim(` Location: ${c}`))}catch(H){a.fail("Failed to generate test dataset"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`));return}console.log(),console.log(u.bold("Step 3/6: Registering sandbox dataset..."));let l=D("Creating dataset on NEMAR...").start(),d,f,p,m,h;try{let H=await zS({name:"Sandbox Training Dataset",description:"Placeholder dataset for sandbox training",files:[{path:"sub-01/eeg/sub-01_task-rest_eeg.edf",size:512000,type:"data"},{path:"dataset_description.json",size:200,type:"metadata"},{path:"participants.tsv",size:50,type:"metadata"},{path:"README",size:500,type:"metadata"},{path:"sub-01/eeg/sub-01_task-rest_eeg.json",size:300,type:"metadata"}],sandbox:!0,attestation:XRe});d=H.dataset.dataset_id,f=H.dataset.ssh_url,p=H.dataset.github_url,m=H.s3_config,h=H.dataset.s3_prefix,l.succeed(`Sandbox dataset created: ${u.cyan(d)}`),console.log(u.dim(` GitHub: ${p}`)),await new Promise((re)=>setTimeout(re,1e4))}catch(H){if(l.fail("Failed to create sandbox dataset"),H instanceof L)console.log(u.red(` ${H.message}`));else console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`));$i(c);return}let g=D("Accepting GitHub repository invitation...").start(),y=p?.match(/github\.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)/),b=y?y[1].replace(/\.git$/,""):null;if(!b){g.fail("Invalid GitHub repository URL from backend"),console.log(u.red(` Received: ${p||"(empty)"}`)),console.log(u.red(" Expected format: https://github.com/owner/repo")),console.log(),console.log("This may indicate a backend issue. Please contact support."),$i(c);return}let _=await ZS(b);if(_.accepted)if(_.alreadyCollaborator)g.succeed("Already a collaborator on this repository");else g.succeed("GitHub invitation accepted");else g.warn("Could not auto-accept invitation"),console.log(u.yellow(` ${_.error}`)),console.log(),console.log("You may need to accept the invitation manually:"),console.log(u.cyan(` https://github.com/${b}/invitations`)),console.log();console.log(),console.log(u.bold("Step 4/6: Initializing repository..."));let x=D("Setting up git-annex...").start(),k=n.username&&n.email?{name:n.username,email:n.email}:void 0;try{let H=await _g(c,{author:k});if(!H.success)throw Error(H.error||"Failed to initialize dataset");await _d(c),await ac(c,f),x.succeed("Repository initialized")}catch(H){x.fail("Failed to initialize repository"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`)),$i(c);return}console.log(),console.log(u.bold("Step 5/6: Uploading to S3..."));let v=D("Requesting upload credentials...").start(),C;try{C=await Xr(d),v.succeed("Upload credentials received")}catch(H){v.fail("Could not get upload credentials"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`)),$i(c);return}let T=mr(C.credentials),V=D("Configuring S3 remote...").start(),A=await Bo(c,{name:"nemar-s3",bucket:C.s3.bucket,prefix:`${h}/objects`,region:C.s3.region,publicUrl:m.public_url},T);if(!A.success){V.fail("Failed to configure S3 remote"),console.log(u.red(` ${A.error}`)),console.log(u.dim(" Re-run with --verbose to see git-annex output.")),$i(c);return}V.succeed("S3 remote configured");let F=D("Tracking data files with git-annex...").start(),M=await lc(c);if(!M.success){F.fail("Failed to track data files"),console.log(u.red(` ${M.error}`)),console.log(u.dim(" Re-run with --verbose to see git-annex output.")),$i(c);return}F.succeed("Data files tracked by git-annex");let U=D("Uploading data files to S3...").start(),B=await Rd(c,"nemar-s3",4,T);if(await ro(c),!B.success){U.fail("S3 upload failed"),console.log(u.red(` ${B.error}`)),console.log(u.dim(" Re-run with --verbose to see git-annex output.")),$i(c);return}U.succeed(`Uploaded ${B.filesCopied} data file(s) to S3`),console.log(),console.log(u.bold("Step 6/6: Pushing to GitHub..."));let P=D("Saving and pushing...").start();try{let H=await XNt(c,"Initial sandbox training upload",k);if(!H.ok){P.fail(H.step==="save"?"Failed to save the dataset":"Failed to push to GitHub"),console.log(u.red(` ${H.error}`)),$i(c);return}if(H.warning)P.warn("Pushed to GitHub (with warning)"),console.log(u.yellow(` ${H.warning}`));else P.succeed("Pushed to GitHub")}catch(H){P.fail("Failed to save and push"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`)),$i(c);return}let O=D("Finalizing...").start();try{await GS(d),await The(d),Tn("sandboxCompleted",!0),Tn("sandboxDatasetId",d),O.succeed("Sandbox training complete!")}catch(H){O.fail("Failed to finalize"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`)),$i(c);return}$i(c),console.log(),console.log(u.green.bold("Congratulations! Sandbox training completed successfully.")),console.log(),console.log("Your setup is verified and you're ready to upload real datasets:"),console.log(u.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(u.dim(`Sandbox dataset: ${d}`))}_C.command("status").description("Check sandbox training completion status").option("--refresh","Fetch latest status from server").action(async(e)=>{if(!Ve()){console.log(u.red("Not authenticated")),console.log(u.dim("Run 'nemar auth login' first"));return}if(e.refresh){let t=D("Checking status...").start();try{let n=await WS();if(Tn("sandboxCompleted",n.sandbox_completed),n.sandbox_dataset_id)Tn("sandboxDatasetId",n.sandbox_dataset_id);if(t.stop(),n.sandbox_completed){if(console.log(u.green("Sandbox training: Completed")),console.log(u.dim(` Dataset ID: ${n.sandbox_dataset_id}`)),n.sandbox_completed_at)console.log(u.dim(` Completed: ${n.sandbox_completed_at}`))}else console.log(u.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(u.cyan(" nemar sandbox"))}catch(n){if(t.fail("Failed to check status"),n instanceof L)console.log(u.red(` ${n.message}`))}}else{let t=zt();if(t.sandboxCompleted)console.log(u.green("Sandbox training: Completed")),console.log(u.dim(` Dataset ID: ${t.sandboxDatasetId}`));else console.log(u.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(u.cyan(" nemar sandbox"))}});_C.command("reset").description("Reset sandbox training status for re-training").option(Xe,nt).option(bt,gt).action(async(e)=>{if(!Ve()){console.log(u.red("Not authenticated")),console.log(u.dim("Run 'nemar auth login' first"));return}if(!zt().sandboxCompleted){console.log(u.yellow("Sandbox training not yet completed")),console.log(u.dim("Nothing to reset"));return}let n=await De("Reset sandbox training status? You will need to complete training again.",e);if(n!=="confirmed"){console.log(u.dim(n==="declined"?"Skipped":"Cancelled"));return}let r=D("Resetting sandbox status...").start();try{await Phe(),zb("sandboxCompleted"),zb("sandboxDatasetId"),r.succeed("Sandbox status reset"),console.log(),console.log("Run sandbox training again with:"),console.log(u.cyan(" nemar sandbox"))}catch(o){if(r.fail("Failed to reset"),o instanceof L)console.log(u.red(` ${o.message}`));else console.log(u.red(` ${o instanceof Error?o.message:"Unknown error"}`))}});yo();ze();class xC extends Error{command;option;code="commander.optionMissingArgument";constructor(e,t){super(`error: option '${t.flags}' argument missing`);this.command=e;this.option=t;this.name="MissingShadowedValueError"}}class vC extends Error{command;option;code="commander.unknownOption";constructor(e,t){super(`error: option '${t.flags}' must come after '${e.name()}'`);this.command=e;this.option=t;this.name="MisplacedShadowedOptionError"}}function kAe(e){return e==="-"||!!e&&!e.startsWith("-")}function EAe(e,t){return e.commands.find((n)=>n.name()===t||n.aliases().includes(t))}function SAe(e,t){let n=new Map;for(let o of t)for(let s of o.options)if(s.long&&!n.has(s.long))n.set(s.long,s);let r=new Map;for(let o of e.options){if(!(o.required||o.optional)||!o.long)continue;let s=n.get(o.long);if(s&&!(s.required||s.optional))r.set(o.long,o)}return r}function $Ae(e,t){let n=new Set(SAe(e,t).keys());for(let r of e.commands)for(let o of $Ae(r,[...t,e]))n.add(o);return n}function DAe(e,t){let n=t.indexOf("--"),r=n<0?t.length:n,o=$Ae(e,[]),s=[],i=[],a=e,c=-1;for(let p=0;p<r;p++){let m=t[p];if(m.startsWith("-")){if(a!==e&&o.has(m)){s.push({flag:m,index:p});let g=t[p+1];if(kAe(g)&&!EAe(a,g))p++}continue}let h=EAe(a,m);if(!h)break;i.push(a),a=h,c=p}if(c<0)return t;let l=SAe(a,i);if(l.size===0)return t;for(let{flag:p,index:m}of s){let h=l.get(p);if(h&&m<c)throw new vC(a,h)}let d=t.slice(0,r).some((p)=>p==="--help"||p==="-h"),f=t.slice(0,c+1);for(let p=c+1;p<r;p++){let m=t[p],h=l.get(m);if(!h){f.push(m);continue}let g=t[p+1];if(kAe(g))f.push(`${m}=${g}`),p++;else if(!d){if(h.required)throw new xC(a,h);f.push(m)}}return f.push(...t.slice(r)),f}kk();var CAe={Default:0,NoFileComp:4},ZNt={"--task":"task","--modality":"modality","--license":"license","--bids-version":"bids-version","--hed-version":"hed-version","--electrode-system":"electrode-system"};function eFt(e){let t=ZNt[e];if(!t)return;let n=HRe();if(!n)return;if(t==="task")return n.task?.values.map((o)=>o.value);return n[t]?.map((o)=>o.value)}function tFt(e){return $a.find((t)=>t.flag===e)?.enumValues}function Q3(e){if(e.argChoices&&e.argChoices.length>0)return[...e.argChoices];let t=e.long??e.short;if(!t)return[];let n=eFt(t);if(n&&n.length>0)return n;let r=tFt(t);if(r)return[...r];return[]}function Z3(e){return e.required||e.optional}function nFt(e,t){return e.commands.find((n)=>n.name()===t||n.aliases().includes(t))}function eq(e,t){return e.options.find((n)=>n.short===t||n.long===t)}function rFt(e){return Boolean(e._hidden)}function oFt(e){let t=[];for(let n of e.commands){if(rFt(n))continue;t.push(n.name(),...n.aliases())}return t}function RAe(e){let t=[];for(let n of e.options){if(n.long)t.push(n.long);if(n.short)t.push(n.short)}return t}function Py(e,t){if(!t)return e;return e.filter((n)=>n.startsWith(t))}var sFt=/^(--[A-Za-z0-9][A-Za-z0-9-]*)=(.*)$/;function AAe(e,t){let n=t.length>0?t[t.length-1]:"",r=t.length>0?t.slice(0,-1):[],o=e,s=0;while(s<r.length){let a=nFt(o,r[s]);if(!a)break;o=a,s++}let i=n.match(sFt);if(i){let[,a,c]=i,l=eq(o,a);if(!l||!Z3(l))return[];return Py(Q3(l),c).map((d)=>`${a}=${d}`)}if(r.length>s){let a=r[r.length-1],c=eq(o,a);if(c&&Z3(c))return Py(Q3(c),n);if(a==="="&&r.length>=2){let l=eq(o,r[r.length-2]);if(l&&Z3(l))return Py(Q3(l),n)}}if(n.startsWith("-"))return Py(RAe(o),n);if(s===r.length)return Py(oFt(o),n);return Py(RAe(o),n)}var iFt=/[\u0000-\u001f\u007f]/;async function OAe(e,t){let n=t[0]==="--"?t.slice(1):t,r=[];try{r=AAe(e,n)}catch(o){if(process.env.VERBOSE)process.stderr.write(`[completion] candidate lookup failed: ${o instanceof Error?o.message:o}
|
|
2651
|
+
`).action(QNt);async function XNt(e,t,n){let r=await pl(e,t,n);if(!r.success)return{ok:!1,step:"save",error:r.error??"unknown error"};let o=await ur(e);if(!o.success)return{ok:!1,step:"push",error:o.error??"unknown error"};return{ok:!0,...o.warning?{warning:o.warning}:{}}}async function QNt(e={}){if(e.verbose)qfe(!0);if(console.log(),console.log(u.bold("NEMAR Sandbox Training")),console.log(u.dim("Verify your setup and learn the upload workflow")),e.verbose)console.log(u.dim("Verbose mode: subprocess invocations will be printed"));if(console.log(),!Ve()){console.log(u.red("Not authenticated")),console.log(u.dim("Run 'nemar auth login' first"));return}let t=await cC();if(t.status==="unknown")console.log(u.yellow("Could not confirm your training status with the server.")),console.log(u.dim(` ${t.reason}`)),console.log(u.dim(" Continuing; run 'nemar sandbox status --refresh' to re-check.")),console.log();let n=zt();if(t.status==="completed"){console.log(u.green("Sandbox training already completed!")),console.log(u.dim(`Dataset ID: ${n.sandboxDatasetId}`)),console.log(),console.log("You can upload real datasets with:"),console.log(u.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(u.dim("To re-run training, use: nemar sandbox reset"));return}console.log(u.bold("Step 1/6: Checking prerequisites..."));let r=D("Checking prerequisites...").start(),o=await C$();if(!o.allPassed){r.fail("Prerequisites check failed"),console.log(),console.log(u.red("Missing requirements:"));for(let H of o.errors)console.log(u.yellow(` - ${H}`));if(o.errors.some((H)=>H.includes("GitHub")))console.log(u.dim(" Run 'gh auth login' to authenticate with GitHub"));return}r.succeed("All prerequisites met");let s=D("Verifying GitHub CLI authentication...").start(),i=await QS(n.githubUsername);if(!i.authenticated){s.fail("GitHub CLI not authenticated"),console.log(u.red(` ${i.error}`)),console.log(),console.log("GitHub CLI is required for sandbox training. Install and authenticate:"),console.log(u.cyan(" brew install gh # or visit https://cli.github.com/")),console.log(u.cyan(" gh auth login"));return}if(n.githubUsername&&!i.matches)s.warn("GitHub CLI user mismatch"),console.log(u.yellow(` ${i.error}`)),console.log(),console.log("Your gh CLI is authenticated as a different GitHub account than your NEMAR account."),console.log("This may cause issues with repository access. To fix:"),console.log(u.cyan(` gh auth login # Login as ${n.githubUsername}`)),console.log(),console.log(u.yellow("WARNING: If upload fails with permission errors, this mismatch is the likely cause.")),console.log();else s.succeed(`GitHub CLI authenticated as ${i.username}`);console.log(),console.log(u.bold("Step 2/6: Generating test dataset..."));let a=D("Creating minimal BIDS structure...").start(),c;try{let H=xAe();c=H.root;let re=vAe(H);a.succeed(`Test dataset created (${Ut(re)})`),console.log(u.dim(` Location: ${c}`))}catch(H){a.fail("Failed to generate test dataset"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`));return}console.log(),console.log(u.bold("Step 3/6: Registering sandbox dataset..."));let l=D("Creating dataset on NEMAR...").start(),d,f,p,m,h;try{let H=await zS({name:"Sandbox Training Dataset",description:"Placeholder dataset for sandbox training",files:[{path:"sub-01/eeg/sub-01_task-rest_eeg.edf",size:512000,type:"data"},{path:"dataset_description.json",size:200,type:"metadata"},{path:"participants.tsv",size:50,type:"metadata"},{path:"README",size:500,type:"metadata"},{path:"sub-01/eeg/sub-01_task-rest_eeg.json",size:300,type:"metadata"}],sandbox:!0,attestation:XRe});d=H.dataset.dataset_id,f=H.dataset.ssh_url,p=H.dataset.github_url,m=H.s3_config,h=H.dataset.s3_prefix,l.succeed(`Sandbox dataset created: ${u.cyan(d)}`),console.log(u.dim(` GitHub: ${p}`)),await new Promise((re)=>setTimeout(re,1e4))}catch(H){if(l.fail("Failed to create sandbox dataset"),H instanceof L)console.log(u.red(` ${H.message}`));else console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`));$i(c);return}let g=D("Accepting GitHub repository invitation...").start(),y=p?.match(/github\.com\/([a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+)/),b=y?y[1].replace(/\.git$/,""):null;if(!b){g.fail("Invalid GitHub repository URL from backend"),console.log(u.red(` Received: ${p||"(empty)"}`)),console.log(u.red(" Expected format: https://github.com/owner/repo")),console.log(),console.log("This may indicate a backend issue. Please contact support."),$i(c);return}let _=await ZS(b);if(_.accepted)if(_.alreadyCollaborator)g.succeed("Already a collaborator on this repository");else g.succeed("GitHub invitation accepted");else g.warn("Could not auto-accept invitation"),console.log(u.yellow(` ${_.error}`)),console.log(),console.log("You may need to accept the invitation manually:"),console.log(u.cyan(` https://github.com/${b}/invitations`)),console.log();console.log(),console.log(u.bold("Step 4/6: Initializing repository..."));let x=D("Setting up git-annex...").start(),k=n.username&&n.email?{name:n.username,email:n.email}:void 0;try{let H=await _g(c,{author:k});if(!H.success)throw Error(H.error||"Failed to initialize dataset");await _d(c),await ac(c,f),x.succeed("Repository initialized")}catch(H){x.fail("Failed to initialize repository"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`)),$i(c);return}console.log(),console.log(u.bold("Step 5/6: Uploading to S3..."));let v=D("Requesting upload credentials...").start(),C;try{C=await Xr(d),v.succeed("Upload credentials received")}catch(H){v.fail("Could not get upload credentials"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`)),$i(c);return}let T=mr(C.credentials),V=D("Configuring S3 remote...").start(),A=await Bo(c,{name:"nemar-s3",bucket:C.s3.bucket,prefix:`${h}/objects`,region:C.s3.region,publicUrl:m.public_url},T);if(!A.success){V.fail("Failed to configure S3 remote"),console.log(u.red(` ${A.error}`)),console.log(u.dim(" Re-run with --verbose to see git-annex output.")),$i(c);return}V.succeed("S3 remote configured");let F=D("Tracking data files with git-annex...").start(),M=await lc(c);if(!M.success){F.fail("Failed to track data files"),console.log(u.red(` ${M.error}`)),console.log(u.dim(" Re-run with --verbose to see git-annex output.")),$i(c);return}F.succeed("Data files tracked by git-annex");let U=D("Uploading data files to S3...").start(),B=await Rd(c,"nemar-s3",4,T);if(await ro(c),!B.success){U.fail("S3 upload failed"),console.log(u.red(` ${B.error}`)),console.log(u.dim(" Re-run with --verbose to see git-annex output.")),$i(c);return}U.succeed(`Uploaded ${B.filesCopied} data file(s) to S3`),console.log(),console.log(u.bold("Step 6/6: Pushing to GitHub..."));let P=D("Saving and pushing...").start();try{let H=await XNt(c,"Initial sandbox training upload",k);if(!H.ok){P.fail(H.step==="save"?"Failed to save the dataset":"Failed to push to GitHub"),console.log(u.red(` ${H.error}`)),$i(c);return}if(H.warning)P.warn("Pushed to GitHub (with warning)"),console.log(u.yellow(` ${H.warning}`));else P.succeed("Pushed to GitHub")}catch(H){P.fail("Failed to save and push"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`)),$i(c);return}let O=D("Finalizing...").start();try{await GS(d),await The(d),Tn("sandboxCompleted",!0),Tn("sandboxDatasetId",d),O.succeed("Sandbox training complete!")}catch(H){O.fail("Failed to finalize"),console.log(u.red(` ${H instanceof Error?H.message:"Unknown error"}`)),$i(c);return}$i(c),console.log(),console.log(u.green.bold("Congratulations! Sandbox training completed successfully.")),console.log(),console.log("Your setup is verified and you're ready to upload real datasets:"),console.log(u.cyan(" nemar dataset upload ./your-dataset")),console.log(),console.log(u.dim(`Sandbox dataset: ${d}`))}_C.command("status").description("Check sandbox training completion status").option("--refresh","Fetch latest status from server").action(async(e)=>{if(!Ve()){console.log(u.red("Not authenticated")),console.log(u.dim("Run 'nemar auth login' first"));return}if(e.refresh){let t=D("Checking status...").start();try{let n=await WS();if(Tn("sandboxCompleted",n.sandbox_completed),n.sandbox_dataset_id)Tn("sandboxDatasetId",n.sandbox_dataset_id);if(t.stop(),n.sandbox_completed){if(console.log(u.green("Sandbox training: Completed")),console.log(u.dim(` Dataset ID: ${n.sandbox_dataset_id}`)),n.sandbox_completed_at)console.log(u.dim(` Completed: ${n.sandbox_completed_at}`))}else console.log(u.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(u.cyan(" nemar sandbox"))}catch(n){if(t.fail("Failed to check status"),n instanceof L)console.log(u.red(` ${n.message}`))}}else{let t=zt();if(t.sandboxCompleted)console.log(u.green("Sandbox training: Completed")),console.log(u.dim(` Dataset ID: ${t.sandboxDatasetId}`));else console.log(u.yellow("Sandbox training: Not completed")),console.log(),console.log("Run sandbox training with:"),console.log(u.cyan(" nemar sandbox"))}});_C.command("reset").description("Reset sandbox training status for re-training").option(Xe,nt).option(bt,gt).action(async(e)=>{if(!Ve()){console.log(u.red("Not authenticated")),console.log(u.dim("Run 'nemar auth login' first"));return}if(!zt().sandboxCompleted){console.log(u.yellow("Sandbox training not yet completed")),console.log(u.dim("Nothing to reset"));return}let n=await De("Reset sandbox training status? You will need to complete training again.",e);if(n!=="confirmed"){console.log(u.dim(n==="declined"?"Skipped":"Cancelled"));return}let r=D("Resetting sandbox status...").start();try{await Phe(),zb("sandboxCompleted"),zb("sandboxDatasetId"),r.succeed("Sandbox status reset"),console.log(),console.log("Run sandbox training again with:"),console.log(u.cyan(" nemar sandbox"))}catch(o){if(r.fail("Failed to reset"),o instanceof L)console.log(u.red(` ${o.message}`));else console.log(u.red(` ${o instanceof Error?o.message:"Unknown error"}`))}});yo();ze();class xC extends Error{command;option;code="commander.optionMissingArgument";constructor(e,t){super(`error: option '${t.flags}' argument missing`);this.command=e;this.option=t;this.name="MissingShadowedValueError"}}class vC extends Error{command;option;code="commander.unknownOption";constructor(e,t){super(`error: option '${t.flags}' must come after '${e.name()}'`);this.command=e;this.option=t;this.name="MisplacedShadowedOptionError"}}function kAe(e){return e==="-"||!!e&&!e.startsWith("-")}function EAe(e,t){return e.commands.find((n)=>n.name()===t||n.aliases().includes(t))}function SAe(e,t){let n=new Map;for(let o of t)for(let s of o.options)if(s.long&&!n.has(s.long))n.set(s.long,s);let r=new Map;for(let o of e.options){if(!(o.required||o.optional)||!o.long)continue;let s=n.get(o.long);if(s&&!(s.required||s.optional))r.set(o.long,o)}return r}function $Ae(e,t){let n=new Set(SAe(e,t).keys());for(let r of e.commands)for(let o of $Ae(r,[...t,e]))n.add(o);return n}function DAe(e,t){let n=t.indexOf("--"),r=n<0?t.length:n,o=$Ae(e,[]),s=[],i=[],a=e,c=-1;for(let p=0;p<r;p++){let m=t[p];if(m.startsWith("-")){if(a!==e&&o.has(m)){s.push({flag:m,index:p});let g=t[p+1];if(kAe(g)&&!EAe(a,g))p++}continue}let h=EAe(a,m);if(!h)break;i.push(a),a=h,c=p}if(c<0)return t;let l=SAe(a,i);if(l.size===0)return t;for(let{flag:p,index:m}of s){let h=l.get(p);if(h&&m<c)throw new vC(a,h)}let d=t.slice(0,r).some((p)=>p==="--help"||p==="-h"),f=t.slice(0,c+1);for(let p=c+1;p<r;p++){let m=t[p],h=l.get(m);if(!h){f.push(m);continue}let g=t[p+1];if(kAe(g))f.push(`${m}=${g}`),p++;else if(!d){if(h.required)throw new xC(a,h);f.push(m)}}return f.push(...t.slice(r)),f}kk();var CAe={Default:0,NoFileComp:4},ZNt={"--task":"task","--modality":"modality","--license":"license","--bids-version":"bids-version","--hed-version":"hed-version","--electrode-system":"electrode-system"};function eFt(e){let t=ZNt[e];if(!t)return;let n=HRe();if(!n)return;if(t==="task")return n.task?.values.map((o)=>o.value);return n[t]?.map((o)=>o.value)}function tFt(e){return $a.find((t)=>t.flag===e)?.enumValues}function Qq(e){if(e.argChoices&&e.argChoices.length>0)return[...e.argChoices];let t=e.long??e.short;if(!t)return[];let n=eFt(t);if(n&&n.length>0)return n;let r=tFt(t);if(r)return[...r];return[]}function Zq(e){return e.required||e.optional}function nFt(e,t){return e.commands.find((n)=>n.name()===t||n.aliases().includes(t))}function e3(e,t){return e.options.find((n)=>n.short===t||n.long===t)}function rFt(e){return Boolean(e._hidden)}function oFt(e){let t=[];for(let n of e.commands){if(rFt(n))continue;t.push(n.name(),...n.aliases())}return t}function RAe(e){let t=[];for(let n of e.options){if(n.long)t.push(n.long);if(n.short)t.push(n.short)}return t}function Py(e,t){if(!t)return e;return e.filter((n)=>n.startsWith(t))}var sFt=/^(--[A-Za-z0-9][A-Za-z0-9-]*)=(.*)$/;function AAe(e,t){let n=t.length>0?t[t.length-1]:"",r=t.length>0?t.slice(0,-1):[],o=e,s=0;while(s<r.length){let a=nFt(o,r[s]);if(!a)break;o=a,s++}let i=n.match(sFt);if(i){let[,a,c]=i,l=e3(o,a);if(!l||!Zq(l))return[];return Py(Qq(l),c).map((d)=>`${a}=${d}`)}if(r.length>s){let a=r[r.length-1],c=e3(o,a);if(c&&Zq(c))return Py(Qq(c),n);if(a==="="&&r.length>=2){let l=e3(o,r[r.length-2]);if(l&&Zq(l))return Py(Qq(l),n)}}if(n.startsWith("-"))return Py(RAe(o),n);if(s===r.length)return Py(oFt(o),n);return Py(RAe(o),n)}var iFt=/[\u0000-\u001f\u007f]/;async function OAe(e,t){let n=t[0]==="--"?t.slice(1):t,r=[];try{r=AAe(e,n)}catch(o){if(process.env.VERBOSE)process.stderr.write(`[completion] candidate lookup failed: ${o instanceof Error?o.message:o}
|
|
2652
2652
|
`);r=[]}for(let o of r){if(iFt.test(o))continue;process.stdout.write(`${o}
|
|
2653
2653
|
`)}process.stdout.write(`:${CAe.NoFileComp}
|
|
2654
2654
|
`)}fn();fN();He();xr();var TAe=100;async function PAe(){try{let{notices:e}=await Ehe();if(!e||e.length===0)return;let t=zt(),n=new Set(t.dismissedNoticeIds||[]),r=e.filter((o)=>!n.has(o.id));if(r.length===0)return;for(let o of r)aFt(o);if(Ve()){let o=["tip","announcement"],s=r.filter((i)=>o.includes(i.level)).map((i)=>i.id);if(s.length>0)cFt(s)}}catch(e){if(process.env.VERBOSE)process.stderr.write(`[notices] ${e instanceof Error?e.message:e}
|
|
@@ -2656,17 +2656,17 @@ Examples:
|
|
|
2656
2656
|
${r} ${e.message}
|
|
2657
2657
|
${o}
|
|
2658
2658
|
`)}else process.stderr.write(`${r} ${e.message}
|
|
2659
|
-
`)}function cFt(e){let r=[...zt().dismissedNoticeIds||[],...e];if(r.length>TAe)r.splice(0,r.length-TAe);Tn("dismissedNoticeIds",r)}He();Hf();var
|
|
2659
|
+
`)}function cFt(e){let r=[...zt().dismissedNoticeIds||[],...e];if(r.length>TAe)r.splice(0,r.length-TAe);Tn("dismissedNoticeIds",r)}He();Hf();var t3=et(D$(),1);import{existsSync as lFt,mkdirSync as uFt,readFileSync as dFt,writeFileSync as fFt}from"fs";import{homedir as pFt}from"os";import{join as FAe}from"path";function MAe(){return process.env.NEMAR_CONFIG_DIR||FAe(pFt(),".config","nemar")}function jAe(){return FAe(MAe(),"update-check.json")}var mFt=86400000,hFt="https://registry.npmjs.org/nemar-cli/latest",gFt=5000;function IAe(e){if(!t3.default.valid(e))return!1;return t3.default.gt(e,Ds)}function yFt(){try{let e=jAe();if(!lFt(e))return null;let t=dFt(e,"utf-8"),n=JSON.parse(t);if(typeof n.checkedAt!=="number"||typeof n.latestVersion!=="string")return null;return n}catch(e){if(process.env.VERBOSE)process.stderr.write(`[update-check] Cache read failed: ${e instanceof Error?e.message:e}
|
|
2660
2660
|
`);return null}}function LAe(e){try{uFt(MAe(),{recursive:!0});let t={checkedAt:Date.now(),latestVersion:e};fFt(jAe(),JSON.stringify(t))}catch(t){if(process.env.VERBOSE)process.stderr.write(`[update-check] Cache write failed: ${t instanceof Error?t.message:t}
|
|
2661
2661
|
`)}}async function qAe(){try{let e=await fetch(hFt,{signal:AbortSignal.timeout(gFt)});if(!e.ok){if(process.env.VERBOSE)process.stderr.write(`[update-check] npm registry returned HTTP ${e.status}
|
|
2662
2662
|
`);return null}return(await e.json()).version??null}catch(e){if(process.env.VERBOSE)process.stderr.write(`[update-check] Fetch failed: ${e instanceof Error?e.message:e}
|
|
2663
2663
|
`);return null}}function bFt(){qAe().then((e)=>{if(e)LAe(e)}).catch((e)=>{if(process.env.VERBOSE)process.stderr.write(`[update-check] Background refresh failed: ${e instanceof Error?e.message:e}
|
|
2664
2664
|
`)})}function wFt(){let e=process.argv[1]||"";if(e.includes("bunx")||e.includes(".cache/bun"))return"bunx";return"bun"}async function BAe(){if(process.env.NEMAR_NO_UPDATE_CHECK==="1")return null;let e=yFt();if(e){if(!(Date.now()-e.checkedAt<mFt))bFt();return IAe(e.latestVersion)?e.latestVersion:null}if(process.env.VERBOSE)process.stderr.write(`[update-check] First run, checking for updates...
|
|
2665
|
-
`);let t=await qAe();if(t)return LAe(t),IAe(t)?t:null;return null}var NAe=!1;function
|
|
2665
|
+
`);let t=await qAe();if(t)return LAe(t),IAe(t)?t:null;return null}var NAe=!1;function n3(e){if(NAe)return;NAe=!0;let n=wFt()==="bunx"?"bunx nemar-cli@latest":"bun update -g nemar-cli",r=u.yellow("\u2500".repeat(50)),o=["",r,`${u.yellow(" Update available: ")}${u.dim(Ds)} -> ${u.green(e)}`,`${u.yellow(" Run: ")}${u.cyan(n)}`,r,""].join(`
|
|
2666
2666
|
`);process.stderr.write(o)}Hf();function UAe(e){for(let t=0;t<e.length;t++){if(e[t].startsWith("-"))continue;return e[t]==="__complete"?t:null}return null}var Nc=process.argv.slice(2);if(kj(Nc))MR();if(epe(Nc))Zfe();var _Ft=UAe(Nc)!==null;process.on("exit",(e)=>{let t=e??0,n=_Ft?null:cpe(Nc,t);if(t===0||t===130||Nc.includes("--json")||tpe()||npe())return;if(n)process.stderr.write(`Debug log: ${n}
|
|
2667
2667
|
`);else if(ul()){let r=ape();process.stderr.write(`Debug log could not be written${r?` (${r})`:""}; attach the [debug] lines above to the issue
|
|
2668
2668
|
`)}else process.stderr.write(`Run again with --debug and attach the log to a new issue: https://github.com/nemarOrg/nemar-cli/issues/new?template=bug_report.yml
|
|
2669
|
-
`)});var
|
|
2669
|
+
`)});var r3=ERe(Nc),er=new de;er.name("nemar").description(`CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource)
|
|
2670
2670
|
|
|
2671
2671
|
NEMAR is a curated repository for neurophysiology data in BIDS format.
|
|
2672
2672
|
This CLI provides tools for uploading, downloading, and managing datasets.`).version(Ds,"-v, --version","Output the current version").option("--no-color","Disable colored output").option("--verbose","Enable verbose output").option("--help-all","Show detailed help with examples and descriptions").option("--debug","Write a diagnostic log for this run (see NEMAR_DEBUG=1); attach it to a bug report").addHelpText("after",`
|
|
@@ -2680,4 +2680,4 @@ Documentation:
|
|
|
2680
2680
|
https://docs.nemar.org
|
|
2681
2681
|
|
|
2682
2682
|
Support:
|
|
2683
|
-
https://github.com/nemarOrg/nemar-cli/issues`);er.addCommand(ao);er.addCommand(Nn);er.addCommand(_C);er.addCommand(Oe);er.addCommand(_Ae);er.addCommand(zp);er.command("login").description("Sign in with your browser (shortcut for 'auth login')").option("-k, --key <key>","Paste an existing API key instead (alternative: NEMAR_API_KEY)").option("--no-open","Print the sign-in link instead of trying to open a browser").option(Xe,nt).option(bt,gt).action(
|
|
2683
|
+
https://github.com/nemarOrg/nemar-cli/issues`);er.addCommand(ao);er.addCommand(Nn);er.addCommand(_C);er.addCommand(Oe);er.addCommand(_Ae);er.addCommand(zp);er.command("login").description("Sign in with your browser (shortcut for 'auth login')").option("-k, --key <key>","Paste an existing API key instead (alternative: NEMAR_API_KEY)").option("--no-open","Print the sign-in link instead of trying to open a browser").option(Xe,nt).option(bt,gt).action(sq);er.command("logout").description("Remove the active account (shortcut for 'auth logout')").option(Xe,nt).option(bt,gt).option("--all","Remove all stored accounts").option("--revoke-key","Revoke this machine's key even if it may be shared").option("--no-revoke-key","Never revoke the key server-side, only clear it locally").action(aq);var HAe=(e)=>e.option("--username <name>","Username to set, or to change to").option("--github <handle>","GitHub username").option("--city <city>","City").option("--country <country>","Country").option("--why <text>","What you intend to upload (20-500 characters)").option("--no-upload-access","Skip the upload-access request").option("--no-open","Print the sign-in link instead of trying to open a browser").option(Xe,nt).option(bt,gt);HAe(er.command("signup").description("Create or continue your account (shortcut for 'auth signup')")).action(X1);HAe(er.command("register").description("Create or continue your account (alias for signup)")).action(X1);er.addCommand(Yq().description("Download a dataset from NEMAR or OpenNeuro (shortcut for 'dataset download')"));er.addCommand(Jq().description("Upload a BIDS dataset to NEMAR (shortcut for 'dataset upload')"));er.command("whoami").description("Show current user (shortcut for 'auth status')").option("--refresh","Refresh user info from server").action(Q1);er.command("switch [username]").description("Switch between accounts (shortcut for 'auth switch')").action(iq);c4(er);function VAe(e){e.exitOverride(()=>Io());for(let t of e.commands)VAe(t)}VAe(er);er.hook("preAction",async()=>{if(kj(Nc))return;if(r3)return;await PAe()});if(Vf&&!r3)console.warn(u.yellow.bold("[DEV BUILD]")+u.yellow(" Connected to development backend. Not for production use."));async function xFt(){let e=UAe(Nc);if(e!==null){await OAe(er,Nc.slice(e+1));return}if(ul())await spe();let t=r3?null:await BAe();if(t)er.hook("postAction",()=>n3(t)),process.on("exit",()=>n3(t));let n;try{n=DAe(er,Nc)}catch(r){if(r instanceof xC||r instanceof vC)r.command.error(r.message,{code:r.code});throw Error(`argv pre-pass failed: ${G(r)}`,{cause:r})}await er.parseAsync(n,{from:"user"})}xFt().catch((e)=>{if(e instanceof Cu)IS(e),process.exit(1);console.error(G(e)),process.exit(1)});
|