buddy-agent-harness 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/bin/buddy-agent-harness.mjs +1 -3
- package/dist/cli.mjs +15755 -3090
- package/dist/index.d.mts +219 -78
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2209 -203
- package/dist/index.mjs.map +1 -1
- package/dist/skill-scripts/doctor.mjs +247 -77
- package/dist/skill-scripts/init.mjs +247 -77
- package/dist/skill-scripts/mcp.mjs +473 -0
- package/dist/skill-scripts/reference.mjs +473 -0
- package/package.json +7 -3
- package/plugin.json +1 -1
- package/skills/doctor-buddy-agent-harness/SKILL.md +1 -1
- package/skills/doctor-buddy-agent-harness/references/harnesses/codex.md +1 -1
- package/skills/doctor-buddy-agent-harness/references/mcp.md +5 -5
- package/skills/doctor-buddy-agent-harness/scripts/doctor.mjs +247 -77
- package/skills/enhance/SKILL.md +61 -18
- package/skills/enhance/references/delegation.history.md +10 -0
- package/skills/enhance/references/delegation.md +13 -55
- package/skills/enhance/references/list-identifiers.history.md +9 -0
- package/skills/enhance/references/list-identifiers.md +67 -0
- package/skills/init-buddy-agent-harness/SKILL.md +3 -3
- package/skills/init-buddy-agent-harness/scripts/doctor.mjs +247 -77
- package/skills/init-buddy-agent-harness/scripts/init.mjs +247 -77
- package/skills/load-reference/README.md +33 -0
- package/skills/load-reference/SKILL.md +64 -0
- package/skills/load-reference/scripts/reference.mjs +473 -0
- package/skills/repair/SKILL.md +3 -3
- package/skills/repair/references/classes.md +51 -2
- package/skills/repair/scripts/doctor.mjs +247 -77
- package/skills/repair/scripts/mcp.mjs +473 -0
- package/src/cli.ts +4 -3
- package/src/config-edit/config-edit.ts +11 -0
- package/src/config-edit/jsonc-edit.ts +54 -0
- package/src/config-edit/toml-edit.ts +155 -0
- package/src/diagnose-bridges/doctor-guidance.ts +20 -12
- package/src/diagnose-bridges/doctor.command.ts +27 -29
- package/src/diagnose-mcp/diagnose-mcp.ts +4 -17
- package/src/diagnose-mcp/mcp-baseline.ts +8 -1
- package/src/diagnose-mcp/mcp-model.ts +52 -1
- package/src/diagnose-mcp/mcp-sources.ts +24 -50
- package/src/governance-overrides/governance-overrides.ts +1 -11
- package/src/governance-overrides/governance.command.ts +7 -1
- package/src/harness-registry/harness-registry.ts +41 -11
- package/src/harness-registry/mcp-config.ts +6 -1
- package/src/index.ts +21 -1
- package/src/initialize-harnesses/init.command.ts +2 -1
- package/src/initialize-harnesses/initialize-harnesses.ts +10 -6
- package/src/mcp-dialects/mcp-dialects.ts +277 -0
- package/src/mcp-inventory/mcp-inventory.ts +16 -7
- package/src/project-mcp/mcp-edit.ts +44 -0
- package/src/project-mcp/mcp.command.ts +83 -0
- package/src/project-mcp/project-mcp.ts +220 -0
- package/src/reconcile-mcp/reconcile-mcp.ts +343 -0
- package/src/reconcile-mcp/reconcile.command.ts +80 -0
- package/src/references/harness-layers.ts +150 -0
- package/src/references/load-reference-invocation.ts +25 -0
- package/src/references/reference-catalog.ts +130 -0
- package/src/references/reference-document.ts +220 -0
- package/src/references/reference-layers.ts +171 -0
- package/src/references/reference.command.ts +251 -0
- package/src/references/resolve-reference.ts +257 -0
- package/src/skill-scripts/doctor.ts +2 -4
- package/src/skill-scripts/init.ts +2 -4
- package/src/skill-scripts/launchers.ts +2 -0
- package/src/skill-scripts/mcp.ts +7 -0
- package/src/skill-scripts/reference.ts +7 -0
|
@@ -4,97 +4,94 @@
|
|
|
4
4
|
// Runs `buddy-agent-harness init` from this bundle against the current working
|
|
5
5
|
// directory. Nothing outside this file is read.
|
|
6
6
|
|
|
7
|
-
import{createRequire as e}from"node:module";import t,{cpSync as n,existsSync as r,lstatSync as i,mkdirSync as a,readFileSync as o,readdirSync as s,readlinkSync as c,realpathSync as l,rmSync as u,statSync as d,symlinkSync as f,writeFileSync as p}from"node:fs";import m,{dirname as h,extname as g,join as _,parse as v,posix as y,relative as b,resolve as x,sep as S}from"node:path";import{fileURLToPath as C,pathToFileURL as w}from"node:url";import{homedir as T,platform as E}from"node:os";import{execFileSync as ee}from"node:child_process";var te=Object.create,ne=Object.defineProperty,re=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyNames,ae=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty,D=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},O=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),se=(e,t)=>{let n={};for(var r in e)ne(n,r,{get:e[r],enumerable:!0});return t||ne(n,Symbol.toStringTag,{value:`Module`}),n},ce=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ie(t),a=0,o=i.length,s;a<o;a++)s=i[a],!oe.call(e,s)&&s!==n&&ne(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=re(t,s))||r.enumerable});return e},k=(e,t,n)=>(n=e==null?{}:te(ae(e)),ce(t||!e||!e.__esModule||!oe.call(e,`default`)?ne(n,`default`,{value:e,enumerable:!0}):n,e)),A=e(import.meta.url);function le(e){let t=e.slice(2).reduce((e,t)=>(e.args.__?e.args.__.push(t):de(t)?(ue(e)&&(e=ge(e)),e=fe(e,t)):ue(e)?e.values.push(t):t===`--`?e.args.__=[]:e.args._.push(t),e),{args:{_:[]},key:``,values:[]});return(ue(t)?ge(t):t).args}function ue(e){return!!e.key}function de(e){return e.startsWith(`-`)&&/\w+/.test(e)}function fe(e,t){return/^-\w+/.test(t)?pe(e,t):he(e,t)}function pe(e,t){let n=t.indexOf(`=`),[r,i]=n>0?[t.slice(1,n),[t.slice(n+1)]]:[t.slice(1),[]],a=r.split(``),o=a.pop();return e=me(e,a),e.key=o,e.values=i,e}function me(e,t){return t.length<=0?e:(e.key=t.pop(),e.values=[`true`],me(ge(e),t))}function he(e,t){let n=t.indexOf(`=`);return n>0?(e.key=t.slice(2,n),e.values=[t.slice(n+1)]):(e.key=t.slice(2),e.values=[]),e}function ge(e){let{key:t,values:n}=e,r={...e.args};return r[t]||(r[t]=[]),n.length===0?r[t].push(`true`):r[t].push(...n),{args:r,key:``,values:[]}}var _e=O(((e,t)=>{
|
|
8
|
-
|
|
9
|
-
* Determine if an object is a Buffer
|
|
10
|
-
*
|
|
11
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
-
* @license MIT
|
|
13
|
-
*/
|
|
14
|
-
t.exports=function(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}}));function ve(e,t,n){return ye([e,t,n],(e,t)=>({...e,...t}))}function ye(e,t){return e[0]===void 0||e[0]===null?e[0]:e.filter(e=>!!e).reduce(t,{})}function be(e,t,n){return e==null?e:[e,t,n].filter(Se).reduce((e,t)=>({...e,...xe(t)}),{})}function xe(e){return Object.keys(e).reduce((t,n)=>(Se(e[n])&&(t[n]=e[n]),t),{})}function Se(e){return e!=null}var Ce=D((()=>{}));const we={maxLength:120,references:[]};function Te(e){return typeof e.tersify==`function`}var Ee=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],De=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Oe=`·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,ke=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,Ae={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},je=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,Me={5:je,"5module":je+` export import`,6:je+` const class extends export import super`},Ne=/^in(stanceof)?$/,Pe=RegExp(`[`+ke+`]`),Fe=RegExp(`[`+ke+Oe+`]`);function Ie(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function Le(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Pe.test(String.fromCharCode(e)):t!==!1&&Ie(e,De)}function Re(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Fe.test(String.fromCharCode(e)):t===!1?!1:Ie(e,De)||Ie(e,Ee)}var j=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function ze(e,t){return new j(e,{beforeExpr:!0,binop:t})}var Be={beforeExpr:!0},Ve={startsExpr:!0},He={};function M(e,t){return t===void 0&&(t={}),t.keyword=e,He[e]=new j(e,t)}var N={num:new j(`num`,Ve),regexp:new j(`regexp`,Ve),string:new j(`string`,Ve),name:new j(`name`,Ve),privateId:new j(`privateId`,Ve),eof:new j(`eof`),bracketL:new j(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new j(`]`),braceL:new j(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new j(`}`),parenL:new j(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new j(`)`),comma:new j(`,`,Be),semi:new j(`;`,Be),colon:new j(`:`,Be),dot:new j(`.`),question:new j(`?`,Be),questionDot:new j(`?.`),arrow:new j(`=>`,Be),template:new j(`template`),invalidTemplate:new j(`invalidTemplate`),ellipsis:new j(`...`,Be),backQuote:new j("`",Ve),dollarBraceL:new j("${",{beforeExpr:!0,startsExpr:!0}),eq:new j(`=`,{beforeExpr:!0,isAssign:!0}),assign:new j(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new j(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new j(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ze(`||`,1),logicalAND:ze(`&&`,2),bitwiseOR:ze(`|`,3),bitwiseXOR:ze(`^`,4),bitwiseAND:ze(`&`,5),equality:ze(`==/!=/===/!==`,6),relational:ze(`</>/<=/>=`,7),bitShift:ze(`<</>>/>>>`,8),plusMin:new j(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ze(`%`,10),star:ze(`*`,10),slash:ze(`/`,10),starstar:new j(`**`,{beforeExpr:!0}),coalesce:ze(`??`,1),_break:M(`break`),_case:M(`case`,Be),_catch:M(`catch`),_continue:M(`continue`),_debugger:M(`debugger`),_default:M(`default`,Be),_do:M(`do`,{isLoop:!0,beforeExpr:!0}),_else:M(`else`,Be),_finally:M(`finally`),_for:M(`for`,{isLoop:!0}),_function:M(`function`,Ve),_if:M(`if`),_return:M(`return`,Be),_switch:M(`switch`),_throw:M(`throw`,Be),_try:M(`try`),_var:M(`var`),_const:M(`const`),_while:M(`while`,{isLoop:!0}),_with:M(`with`),_new:M(`new`,{beforeExpr:!0,startsExpr:!0}),_this:M(`this`,Ve),_super:M(`super`,Ve),_class:M(`class`,Ve),_extends:M(`extends`,Be),_export:M(`export`),_import:M(`import`,Ve),_null:M(`null`,Ve),_true:M(`true`,Ve),_false:M(`false`,Ve),_in:M(`in`,{beforeExpr:!0,binop:7}),_instanceof:M(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:M(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:M(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:M(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},Ue=/\r\n?|\n|\u2028|\u2029/,We=new RegExp(Ue.source,`g`);function Ge(e){return e===10||e===13||e===8232||e===8233}function Ke(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(Ge(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var qe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Je=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ye=Object.prototype,Xe=Ye.hasOwnProperty,Ze=Ye.toString,Qe=Object.hasOwn||(function(e,t){return Xe.call(e,t)}),$e=Array.isArray||(function(e){return Ze.call(e)===`[object Array]`}),et=Object.create(null);function tt(e){return et[e]||(et[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function nt(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var rt=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,it=function(e,t){this.line=e,this.column=t};it.prototype.offset=function(e){return new it(this.line,this.column+e)};var at=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function ot(e,t){for(var n=1,r=0;;){var i=Ke(e,r,t);if(i<0)return new it(n,t-r);++n,r=i}}var st={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ct=!1;function lt(e){var t={};for(var n in st)t[n]=e&&Qe(e,n)?e[n]:st[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ct&&typeof console==`object`&&console.warn&&(ct=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
15
|
-
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),$e(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if($e(t.onComment)&&(t.onComment=ut(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function ut(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new at(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var dt=1,ft=2,pt=4,mt=8,ht=16,gt=32,_t=64,vt=128,yt=256,bt=512,xt=1024,St=dt|ft|yt;function Ct(e,t){return ft|(e?pt:0)|(t?mt:0)}var wt=0,Tt=1,Et=2,Dt=3,Ot=4,kt=5,At=function(e,t,n){this.options=e=lt(e),this.sourceFile=e.sourceFile,this.keywords=tt(Me[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=Ae[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=tt(r);var i=(r?r+` `:``)+Ae.strict;this.reservedWordsStrict=tt(i),this.reservedWordsStrictBind=tt(i+` `+Ae.strictBind),this.input=String(t),this.containsEsc=!1,this.pos=n||0,this.curLine=1,e.startLocation?(this.lineStart=this.pos-e.startLocation.column,this.curLine=e.startLocation.line):n?(this.lineStart=this.input.lastIndexOf(`
|
|
16
|
-
`,n-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(Ue).length)):this.lineStart=0,this.type=N.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?ft:dt),this.regexpState=null,this.privateNameStack=[]},jt={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};At.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},jt.inFunction.get=function(){return(this.currentVarScope().flags&ft)>0},jt.inGenerator.get=function(){return(this.currentVarScope().flags&mt)>0},jt.inAsync.get=function(){return(this.currentVarScope().flags&pt)>0},jt.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(yt|bt))return!1;if(t&ft)return(t&pt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},jt.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&dt)},jt.allowSuper.get=function(){return(this.currentThisScope().flags&_t)>0||this.options.allowSuperOutsideMethod},jt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&vt)>0},jt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},jt.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(yt|bt)||t&ft&&!(t&ht))return!0}return!1},jt.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&xt||!this.inModule&&e&dt)},jt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&yt)>0},At.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},At.parse=function(e,t){return new this(t,e).parse()},At.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},At.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(At.prototype,jt);var Mt=At.prototype,Nt=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Mt.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){Je.lastIndex=e,e+=Je.exec(this.input)[0].length;var t=Nt.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){Je.lastIndex=e+t[0].length;var n=Je.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||Ue.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,Je.lastIndex=e,e+=Je.exec(this.input)[0].length,this.input[e]===`;`&&e++}},Mt.eat=function(e){return this.type===e&&(this.next(),!0)},Mt.isContextual=function(e){return this.type===N.name&&this.value===e&&!this.containsEsc},Mt.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Mt.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},Mt.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Mt.canInsertSemicolon=function(){return this.type===N.eof||this.type===N.braceR||Ue.test(this.input.slice(this.lastTokEnd,this.start))},Mt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Mt.semicolon=function(){!this.eat(N.semi)&&!this.insertSemicolon()&&this.unexpected()},Mt.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Mt.expect=function(e){this.eat(e)||this.unexpected()},Mt.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var Pt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Mt.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},Mt.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},Mt.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},Mt.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var P=At.prototype;P.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==N.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var Ft={kind:`loop`},It={kind:`switch`};P.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;Je.lastIndex=this.pos;var t=Je.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(Le(r)){var i=n;do n+=r<=65535?1:2;while(Re(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!Ne.test(a))return!0}return!1},P.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;Je.lastIndex=this.pos;var e=Je.exec(this.input),t=this.pos+e[0].length,n;return!Ue.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(Re(n=this.fullCharCodeAt(t+8))||n===92))},P.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;Je.lastIndex=this.pos;var n=Je.exec(this.input),r=this.pos+n[0].length;if(Ue.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||Re(a=this.fullCharCodeAt(i))||a===92)return!1;Je.lastIndex=i;var o=Je.exec(this.input);if(r=i+o[0].length,o&&Ue.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!Le(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(Re(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(Ne.test(l))return!1;if(t&&!e&&l===`of`){Je.lastIndex=r;var u=Je.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},P.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},P.isUsing=function(e){return this.isUsingKeyword(!1,e)},P.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=N._var,a=`let`),r){case N._break:case N._continue:return this.parseBreakContinueStatement(i,r.keyword);case N._debugger:return this.parseDebuggerStatement(i);case N._do:return this.parseDoStatement(i);case N._for:return this.parseForStatement(i);case N._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case N._class:return e&&this.unexpected(),this.parseClass(i,!0);case N._if:return this.parseIfStatement(i);case N._return:return this.parseReturnStatement(i);case N._switch:return this.parseSwitchStatement(i);case N._throw:return this.parseThrowStatement(i);case N._try:return this.parseTryStatement(i);case N._const:case N._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case N._while:return this.parseWhileStatement(i);case N._with:return this.parseWithStatement(i);case N.braceL:return this.parseBlock(!0,i);case N.semi:return this.parseEmptyStatement(i);case N._export:case N._import:if(this.options.ecmaVersion>10&&r===N._import){Je.lastIndex=this.pos;var o=Je.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===N._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===N.name&&d.type===`Identifier`&&this.eat(N.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},P.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(N.semi)||this.insertSemicolon()?e.label=null:this.type===N.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},P.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},P.parseDoStatement=function(e){return this.next(),this.labels.push(Ft),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(N._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(N.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},P.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(Ft),this.enterScope(0),this.expect(N.parenL),this.type===N.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===N._var||this.type===N._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new Pt,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===N._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===N._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},P.parseForAfterInit=function(e,t,n){return(this.type===N._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===N._in?((t.kind===`using`||t.kind===`await using`)&&!t.declarations[0].init&&this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},P.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Rt|(n?0:zt),!1,t)},P.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(N._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},P.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(N.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},P.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(N.braceL),this.labels.push(It),this.enterScope(xt);for(var t,n=!1;this.type!==N.braceR;)if(this.type===N._case||this.type===N._default){var r=this.type===N._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(N.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},P.parseThrowStatement=function(e){return this.next(),Ue.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var Lt=[];P.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?gt:0),this.checkLValPattern(e,t?Ot:Et),this.expect(N.parenR),e},P.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===N._catch){var t=this.startNode();this.next(),this.eat(N.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(N._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},P.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},P.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ft),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},P.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},P.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},P.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===N._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},P.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},P.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(N.braceL),e&&this.enterScope(0);this.type!==N.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},P.parseFor=function(e,t){return e.init=t,this.expect(N.semi),e.test=this.type===N.semi?null:this.parseExpression(),this.expect(N.semi),e.update=this.type===N.parenR?null:this.parseExpression(),this.expect(N.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},P.parseForIn=function(e,t){var n=this.type===N._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(N.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},P.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(N.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===N._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==N._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==N._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(N.comma))break}return e},P.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?Tt:Et,!1)};var Rt=1,zt=2,Bt=4;P.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===N.star&&t&zt&&this.unexpected(),e.generator=this.eat(N.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Rt&&(e.id=t&Bt&&this.type!==N.name?null:this.parseIdent(),e.id&&!(t&zt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Tt:Et:Dt));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ct(e.async,e.generator)),t&Rt||(e.id=this.type===N.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&Rt?`FunctionDeclaration`:`FunctionExpression`)},P.parseFunctionParams=function(e){this.expect(N.parenL),e.params=this.parseBindingList(N.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},P.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(N.braceL);this.type!==N.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&Vt(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},P.parseClassElement=function(e){if(this.eat(N.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(N.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===N.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===N.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(N.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===N.parenL||o!==`method`||i||a){var l=!n.static&&Ht(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},P.isClassElementNameStart=function(){return this.type===N.name||this.type===N.privateId||this.type===N.num||this.type===N.string||this.type===N.bracketL||this.type.keyword},P.parseClassElementName=function(e){this.type===N.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},P.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&Ht(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},P.parseClassField=function(e){return Ht(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&Ht(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(N.eq)?(this.enterScope(bt|_t),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},P.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(yt|_t);this.type!==N.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},P.parseClassId=function(e,t){this.type===N.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Et,!1)):(t===!0&&this.unexpected(),e.id=null)},P.parseClassSuper=function(e){e.superClass=this.eat(N._extends)?this.parseExprSubscripts(null,!1):null},P.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},P.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];Qe(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function Vt(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function Ht(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}P.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==N.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},P.parseExport=function(e,t){if(this.next(),this.eat(N.star))return this.parseExportAllDeclaration(e,t);if(this.eat(N._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==N.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},P.parseExportDeclaration=function(e){return this.parseStatement(null)},P.parseExportDefaultDeclaration=function(){var e;if(this.type===N._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Rt|Bt,!1,e)}if(this.type===N._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},P.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),Qe(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},P.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},P.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},P.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},P.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},P.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(N.braceL);!this.eat(N.braceR);){if(n)n=!1;else if(this.expect(N.comma),this.afterTrailingComma(N.braceR))break;t.push(this.parseExportSpecifier(e))}return t},P.parseImport=function(e){return this.next(),this.type===N.string?(e.specifiers=Lt,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===N.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},P.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Et),this.finishNode(e,`ImportSpecifier`)},P.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Et),this.finishNode(e,`ImportDefaultSpecifier`)},P.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,Et),this.finishNode(e,`ImportNamespaceSpecifier`)},P.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===N.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(N.comma)))return e;if(this.type===N.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(N.braceL);!this.eat(N.braceR);){if(t)t=!1;else if(this.expect(N.comma),this.afterTrailingComma(N.braceR))break;e.push(this.parseImportSpecifier())}return e},P.parseWithClause=function(){var e=[];if(!this.eat(N._with))return e;this.expect(N.braceL);for(var t={},n=!0;!this.eat(N.braceR);){if(n)n=!1;else if(this.expect(N.comma),this.afterTrailingComma(N.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;Qe(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},P.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===N.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(N.colon),this.type!==N.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},P.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===N.string){var e=this.parseLiteral(this.value);return rt.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},P.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},P.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var Ut=At.prototype;Ut.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},Ut.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},Ut.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},Ut.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==N.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},Ut.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case N.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(N.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case N.braceL:return this.parseObj(!0)}return this.parseIdent()},Ut.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(N.comma),t&&this.type===N.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===N.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===N.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},Ut.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Ut.parseBindingListItem=function(e){return e},Ut.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(N.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},Ut.checkLValSimple=function(e,t,n){t===void 0&&(t=wt);var r=t!==wt;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===Et&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(Qe(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==kt&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},Ut.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=wt),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},Ut.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=wt),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var Wt=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},F={b_stat:new Wt(`{`,!1),b_expr:new Wt(`{`,!0),b_tmpl:new Wt("${",!1),p_stat:new Wt(`(`,!1),p_expr:new Wt(`(`,!0),q_tmpl:new Wt("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Wt(`function`,!1),f_expr:new Wt(`function`,!0),f_expr_gen:new Wt(`function`,!0,!1,null,!0),f_gen:new Wt(`function`,!1,!1,null,!0)},Gt=At.prototype;Gt.initialContext=function(){return[F.b_stat]},Gt.curContext=function(){return this.context[this.context.length-1]},Gt.braceIsBlock=function(e){var t=this.curContext();return t===F.f_expr||t===F.f_stat?!0:e===N.colon&&(t===F.b_stat||t===F.b_expr)?!t.isExpr:e===N._return||e===N.name&&this.exprAllowed?Ue.test(this.input.slice(this.lastTokEnd,this.start)):e===N._else||e===N.semi||e===N.eof||e===N.parenR||e===N.arrow?!0:e===N.braceL?t===F.b_stat:e===N._var||e===N._const||e===N.name?!1:!this.exprAllowed},Gt.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},Gt.updateContext=function(e){var t,n=this.type;n.keyword&&e===N.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},Gt.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},N.parenR.updateContext=N.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===F.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},N.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?F.b_stat:F.b_expr),this.exprAllowed=!0},N.dollarBraceL.updateContext=function(){this.context.push(F.b_tmpl),this.exprAllowed=!0},N.parenL.updateContext=function(e){var t=e===N._if||e===N._for||e===N._with||e===N._while;this.context.push(t?F.p_stat:F.p_expr),this.exprAllowed=!0},N.incDec.updateContext=function(){},N._function.updateContext=N._class.updateContext=function(e){e.beforeExpr&&e!==N._else&&(e!==N.semi||this.curContext()===F.p_stat)&&!(e===N._return&&Ue.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==N.colon&&e!==N.braceL||this.curContext()!==F.b_stat)?this.context.push(F.f_expr):this.context.push(F.f_stat),this.exprAllowed=!1},N.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},N.backQuote.updateContext=function(){this.curContext()===F.q_tmpl?this.context.pop():this.context.push(F.q_tmpl),this.exprAllowed=!1},N.star.updateContext=function(e){if(e===N._function){var t=this.context.length-1;this.context[t]===F.f_expr?this.context[t]=F.f_expr_gen:this.context[t]=F.f_gen}this.exprAllowed=!0},N.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==N.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var I=At.prototype;I.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},I.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===N.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(N.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},I.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Pt,r=!0);var s=this.start,c=this.startLoc;(this.type===N.parenL||this.type===N.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===N.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===N.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},I.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(N.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(N.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},I.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},I.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==N._in)&&a>r){var o=this.type===N.logicalOR||this.type===N.logicalAND,s=this.type===N.coalesce;s&&(a=N.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===N.coalesce||s&&(this.type===N.logicalOR||this.type===N.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},I.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},I.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===N.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&Kt(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&qt(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===N.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==N._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&(o.type!==`ArrowFunctionExpression`||o.start!==i)&&this.eat(N.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function Kt(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&Kt(e.expression)}function qt(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&qt(e.expression)||e.type===`ParenthesizedExpression`&&qt(e.expression)}I.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},I.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},I.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(N.arrow)},I.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},I.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(N.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(N.bracketL);if(l||c&&this.type!==N.parenL&&this.type!==N.backQuote||this.eat(N.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(N.bracketR)):u.property=this.type===N.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(N.parenL)){var d=new Pt,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(N.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===N.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},I.parseExprAtom=function(e,t,n){this.type===N.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case N._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===N.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==N.dot&&this.type!==N.bracketL&&this.type!==N.parenL&&this.unexpected(),this.finishNode(r,`Super`);case N._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case N.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(N._function))return this.overrideContext(F.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(N.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===N.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(N.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case N.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case N.num:case N.string:return this.parseLiteral(this.value);case N._null:case N._true:case N._false:return r=this.startNode(),r.value=this.type===N._null?null:this.type===N._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case N.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case N.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(N.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case N.braceL:return this.overrideContext(F.b_expr),this.parseObj(!1,e);case N._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case N._class:return this.parseClass(this.startNode(),!1);case N._new:return this.parseNew();case N.backQuote:return this.parseTemplate();case N._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},I.parseExprAtomDefault=function(){this.unexpected()},I.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===N.parenL&&!e)return this.parseDynamicImport(t);if(this.type===N.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},I.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(N.parenR)?e.options=null:(this.expect(N.comma),this.afterTrailingComma(N.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(N.parenR)||(this.expect(N.comma),this.afterTrailingComma(N.parenR)||this.unexpected())));else if(!this.eat(N.parenR)){var t=this.start;this.eat(N.comma)&&this.eat(N.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},I.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},I.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},I.parseParenExpression=function(){this.expect(N.parenL);var e=this.parseExpression();return this.expect(N.parenR),e},I.shouldParseArrow=function(e){return!this.canInsertSemicolon()},I.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new Pt,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==N.parenR;){if(l?l=!1:this.expect(N.comma),a&&this.afterTrailingComma(N.parenR,!0)){u=!0;break}if(this.type===N.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===N.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(N.parenR),e&&this.shouldParseArrow(c)&&this.eat(N.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}return i},I.parseParenItem=function(e){return e},I.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var Jt=[];I.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===N.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),e.arguments=this.eat(N.parenL)?this.parseExprList(N.parenR,this.options.ecmaVersion>=8,!1):Jt,this.finishNode(e,`NewExpression`)},I.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===N.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
|
|
7
|
+
import{createRequire as e}from"node:module";import t,{cpSync as n,existsSync as r,lstatSync as i,mkdirSync as a,readFileSync as o,readdirSync as s,readlinkSync as c,realpathSync as l,rmSync as u,statSync as d,symlinkSync as p,writeFileSync as m}from"node:fs";import h,{dirname as g,extname as _,join as v,parse as y,posix as b,relative as x,resolve as S,sep as C,win32 as w}from"node:path";import{fileURLToPath as ee,pathToFileURL as T}from"node:url";import{homedir as E,platform as te}from"node:os";import{readFile as ne,readdir as re}from"node:fs/promises";import{execFileSync as ie}from"node:child_process";var ae=Object.create,oe=Object.defineProperty,__name=(e,t)=>oe(e,`name`,{value:t,configurable:!0}),se=Object.getOwnPropertyDescriptor,ce=Object.getOwnPropertyNames,le=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty,__esmMin=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),__exportAll=(e,t)=>{let n={};for(var r in e)oe(n,r,{get:e[r],enumerable:!0});return t||oe(n,Symbol.toStringTag,{value:`Module`}),n},__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ce(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ue.call(e,s)&&s!==n&&oe(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=se(t,s))||r.enumerable});return e},__toESM=(e,t,n)=>(n=e==null?{}:ae(le(e)),__copyProps(t||!e||!e.__esModule||!ue.call(e,`default`)?oe(n,`default`,{value:e,enumerable:!0}):n,e)),D=e(import.meta.url);const O={success:0,error:1,usage:2},de=Symbol.for(`clibuilder.CliError`);function isCliError(e){return!!e&&typeof e==`object`&&e[de]===!0}const fe={maxLength:120,references:[]};function hasTersifyFn(e){return typeof e.tersify==`function`}function isBuffer(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}function trim({raw:e,noTrim:t},n,r){if(t||e||n.length<=r)return n;let i=n.slice(0,Math.max(r,0)),a=i.length===0?``:i.length<=3?`.`:i.length===4?`..`:`...`;return i.slice(0,i.length-a.length)+a}const k=new Map;k.set(`!`,16),k.set(`~`,16),k.set(`+`,16),k.set(`-`,16),k.set(`++`,16),k.set(`--`,16),k.set(`**`,15),k.set(`*`,14),k.set(`/`,14),k.set(`%`,14),k.set(`+`,13),k.set(`-`,13),k.set(`<<`,12),k.set(`>>`,12),k.set(`>>>`,12),k.set(`<`,11),k.set(`<=`,11),k.set(`>`,11),k.set(`>=`,11),k.set(`&`,9),k.set(`^`,8),k.set(`|`,7),k.set(`&&`,6),k.set(`||`,5);function isHigherOperatorOrder(e,t){return k.get(e)>k.get(t)}var pe=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],me=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],he=`·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,ge=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,_e={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},ve=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,ye={5:ve,"5module":ve+` export import`,6:ve+` const class extends export import super`},be=/^in(stanceof)?$/,xe=RegExp(`[`+ge+`]`),Se=RegExp(`[`+ge+he+`]`);function isInAstralSet(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function isIdentifierStart(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&xe.test(String.fromCharCode(e)):t!==!1&&isInAstralSet(e,me)}function isIdentifierChar(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Se.test(String.fromCharCode(e)):t===!1?!1:isInAstralSet(e,me)||isInAstralSet(e,pe)}var A=function TokenType(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function binop(e,t){return new A(e,{beforeExpr:!0,binop:t})}var Ce={beforeExpr:!0},we={startsExpr:!0},Te={};function kw(e,t){return t===void 0&&(t={}),t.keyword=e,Te[e]=new A(e,t)}var j={num:new A(`num`,we),regexp:new A(`regexp`,we),string:new A(`string`,we),name:new A(`name`,we),privateId:new A(`privateId`,we),eof:new A(`eof`),bracketL:new A(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new A(`]`),braceL:new A(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new A(`}`),parenL:new A(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new A(`)`),comma:new A(`,`,Ce),semi:new A(`;`,Ce),colon:new A(`:`,Ce),dot:new A(`.`),question:new A(`?`,Ce),questionDot:new A(`?.`),arrow:new A(`=>`,Ce),template:new A(`template`),invalidTemplate:new A(`invalidTemplate`),ellipsis:new A(`...`,Ce),backQuote:new A("`",we),dollarBraceL:new A("${",{beforeExpr:!0,startsExpr:!0}),eq:new A(`=`,{beforeExpr:!0,isAssign:!0}),assign:new A(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new A(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new A(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:binop(`||`,1),logicalAND:binop(`&&`,2),bitwiseOR:binop(`|`,3),bitwiseXOR:binop(`^`,4),bitwiseAND:binop(`&`,5),equality:binop(`==/!=/===/!==`,6),relational:binop(`</>/<=/>=`,7),bitShift:binop(`<</>>/>>>`,8),plusMin:new A(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:binop(`%`,10),star:binop(`*`,10),slash:binop(`/`,10),starstar:new A(`**`,{beforeExpr:!0}),coalesce:binop(`??`,1),_break:kw(`break`),_case:kw(`case`,Ce),_catch:kw(`catch`),_continue:kw(`continue`),_debugger:kw(`debugger`),_default:kw(`default`,Ce),_do:kw(`do`,{isLoop:!0,beforeExpr:!0}),_else:kw(`else`,Ce),_finally:kw(`finally`),_for:kw(`for`,{isLoop:!0}),_function:kw(`function`,we),_if:kw(`if`),_return:kw(`return`,Ce),_switch:kw(`switch`),_throw:kw(`throw`,Ce),_try:kw(`try`),_var:kw(`var`),_const:kw(`const`),_while:kw(`while`,{isLoop:!0}),_with:kw(`with`),_new:kw(`new`,{beforeExpr:!0,startsExpr:!0}),_this:kw(`this`,we),_super:kw(`super`,we),_class:kw(`class`,we),_extends:kw(`extends`,Ce),_export:kw(`export`),_import:kw(`import`,we),_null:kw(`null`,we),_true:kw(`true`,we),_false:kw(`false`,we),_in:kw(`in`,{beforeExpr:!0,binop:7}),_instanceof:kw(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:kw(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:kw(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:kw(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},Ee=/\r\n?|\n|\u2028|\u2029/,De=new RegExp(Ee.source,`g`);function isNewLine(e){return e===10||e===13||e===8232||e===8233}function nextLineBreak(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(isNewLine(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var Oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,M=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ke=Object.prototype,Ae=ke.hasOwnProperty,je=ke.toString,Me=Object.hasOwn||(function(e,t){return Ae.call(e,t)}),Ne=Array.isArray||(function(e){return je.call(e)===`[object Array]`}),Pe=Object.create(null);function wordsRegexp(e){return Pe[e]||(Pe[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function codePointToString(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Fe=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ie=function Position(e,t){this.line=e,this.column=t};Ie.prototype.offset=function offset(e){return new Ie(this.line,this.column+e)};var Le=function SourceLocation(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function getLineInfo(e,t){for(var n=1,r=0;;){var i=nextLineBreak(e,r,t);if(i<0)return new Ie(n,t-r);++n,r=i}}var Re={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ze=!1;function getOptions(e){var t={};for(var n in Re)t[n]=e&&Me(e,n)?e[n]:Re[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ze&&typeof console==`object`&&console.warn&&(ze=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
8
|
+
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Ne(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(Ne(t.onComment)&&(t.onComment=pushComment(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function pushComment(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new Le(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var Be=1,Ve=2,He=4,Ue=8,We=16,Ge=32,Ke=64,qe=128,Je=256,Ye=512,Xe=1024,Ze=Be|Ve|Je;function functionFlags(e,t){return Ve|(e?He:0)|(t?Ue:0)}var Qe=0,$e=1,et=2,tt=3,nt=4,rt=5,N=function Parser(e,t,n){this.options=e=getOptions(e),this.sourceFile=e.sourceFile,this.keywords=wordsRegexp(ye[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=_e[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=wordsRegexp(r);var i=(r?r+` `:``)+_e.strict;this.reservedWordsStrict=wordsRegexp(i),this.reservedWordsStrictBind=wordsRegexp(i+` `+_e.strictBind),this.input=String(t),this.containsEsc=!1,this.pos=n||0,this.curLine=1,e.startLocation?(this.lineStart=this.pos-e.startLocation.column,this.curLine=e.startLocation.line):n?(this.lineStart=this.input.lastIndexOf(`
|
|
9
|
+
`,n-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(Ee).length)):this.lineStart=0,this.type=j.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?Ve:Be),this.regexpState=null,this.privateNameStack=[]},it={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};N.prototype.parse=function parse(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},it.inFunction.get=function(){return(this.currentVarScope().flags&Ve)>0},it.inGenerator.get=function(){return(this.currentVarScope().flags&Ue)>0},it.inAsync.get=function(){return(this.currentVarScope().flags&He)>0},it.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Je|Ye))return!1;if(t&Ve)return(t&He)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},it.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Be)},it.allowSuper.get=function(){return(this.currentThisScope().flags&Ke)>0||this.options.allowSuperOutsideMethod},it.allowDirectSuper.get=function(){return(this.currentThisScope().flags&qe)>0},it.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},it.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Je|Ye)||t&Ve&&!(t&We))return!0}return!1},it.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&Xe||!this.inModule&&e&Be)},it.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Je)>0},N.extend=function extend(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},N.parse=function parse(e,t){return new this(t,e).parse()},N.parseExpressionAt=function parseExpressionAt(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},N.tokenizer=function tokenizer(e,t){return new this(t,e)},Object.defineProperties(N.prototype,it);var P=N.prototype,ot=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;P.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){M.lastIndex=e,e+=M.exec(this.input)[0].length;var t=ot.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){M.lastIndex=e+t[0].length;var n=M.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||Ee.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,M.lastIndex=e,e+=M.exec(this.input)[0].length,this.input[e]===`;`&&e++}},P.eat=function(e){return this.type===e&&(this.next(),!0)},P.isContextual=function(e){return this.type===j.name&&this.value===e&&!this.containsEsc},P.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},P.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},P.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},P.canInsertSemicolon=function(){return this.type===j.eof||this.type===j.braceR||Ee.test(this.input.slice(this.lastTokEnd,this.start))},P.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},P.semicolon=function(){!this.eat(j.semi)&&!this.insertSemicolon()&&this.unexpected()},P.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},P.expect=function(e){this.eat(e)||this.unexpected()},P.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var st=function DestructuringErrors(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};P.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},P.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},P.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},P.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var F=N.prototype;F.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==j.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var ct={kind:`loop`},lt={kind:`switch`};F.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;M.lastIndex=this.pos;var t=M.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(isIdentifierStart(r)){var i=n;do n+=r<=65535?1:2;while(isIdentifierChar(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!be.test(a))return!0}return!1},F.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;M.lastIndex=this.pos;var e=M.exec(this.input),t=this.pos+e[0].length,n;return!Ee.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(isIdentifierChar(n=this.fullCharCodeAt(t+8))||n===92))},F.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;M.lastIndex=this.pos;var n=M.exec(this.input),r=this.pos+n[0].length;if(Ee.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||isIdentifierChar(a=this.fullCharCodeAt(i))||a===92)return!1;M.lastIndex=i;var o=M.exec(this.input);if(r=i+o[0].length,o&&Ee.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!isIdentifierStart(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(isIdentifierChar(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(be.test(l))return!1;if(t&&!e&&l===`of`){M.lastIndex=r;var u=M.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},F.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},F.isUsing=function(e){return this.isUsingKeyword(!1,e)},F.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=j._var,a=`let`),r){case j._break:case j._continue:return this.parseBreakContinueStatement(i,r.keyword);case j._debugger:return this.parseDebuggerStatement(i);case j._do:return this.parseDoStatement(i);case j._for:return this.parseForStatement(i);case j._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case j._class:return e&&this.unexpected(),this.parseClass(i,!0);case j._if:return this.parseIfStatement(i);case j._return:return this.parseReturnStatement(i);case j._switch:return this.parseSwitchStatement(i);case j._throw:return this.parseThrowStatement(i);case j._try:return this.parseTryStatement(i);case j._const:case j._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case j._while:return this.parseWhileStatement(i);case j._with:return this.parseWithStatement(i);case j.braceL:return this.parseBlock(!0,i);case j.semi:return this.parseEmptyStatement(i);case j._export:case j._import:if(this.options.ecmaVersion>10&&r===j._import){M.lastIndex=this.pos;var o=M.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===j._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===j.name&&d.type===`Identifier`&&this.eat(j.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},F.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(j.semi)||this.insertSemicolon()?e.label=null:this.type===j.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},F.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},F.parseDoStatement=function(e){return this.next(),this.labels.push(ct),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(j._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(j.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},F.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(ct),this.enterScope(0),this.expect(j.parenL),this.type===j.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===j._var||this.type===j._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new st,d=this.start,p=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===j._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===j._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(p.start===d&&!l&&p.type===`Identifier`&&p.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(p.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(p,!1,u),this.checkLValPattern(p),this.parseForIn(e,p)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,p))},F.parseForAfterInit=function(e,t,n){return(this.type===j._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===j._in?((t.kind===`using`||t.kind===`await using`)&&!t.declarations[0].init&&this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},F.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,dt|(n?0:ft),!1,t)},F.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(j._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},F.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(j.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},F.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(j.braceL),this.labels.push(lt),this.enterScope(Xe);for(var t,n=!1;this.type!==j.braceR;)if(this.type===j._case||this.type===j._default){var r=this.type===j._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(j.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},F.parseThrowStatement=function(e){return this.next(),Ee.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var ut=[];F.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?Ge:0),this.checkLValPattern(e,t?nt:et),this.expect(j.parenR),e},F.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===j._catch){var t=this.startNode();this.next(),this.eat(j.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(j._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},F.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},F.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(ct),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},F.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},F.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},F.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===j._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},F.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},F.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(j.braceL),e&&this.enterScope(0);this.type!==j.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},F.parseFor=function(e,t){return e.init=t,this.expect(j.semi),e.test=this.type===j.semi?null:this.parseExpression(),this.expect(j.semi),e.update=this.type===j.parenR?null:this.parseExpression(),this.expect(j.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},F.parseForIn=function(e,t){var n=this.type===j._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(j.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},F.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(j.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===j._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==j._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==j._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(j.comma))break}return e},F.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?$e:et,!1)};var dt=1,ft=2,pt=4;F.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===j.star&&t&ft&&this.unexpected(),e.generator=this.eat(j.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&dt&&(e.id=t&pt&&this.type!==j.name?null:this.parseIdent(),e.id&&!(t&ft)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?$e:et:tt));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(e.async,e.generator)),t&dt||(e.id=this.type===j.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&dt?`FunctionDeclaration`:`FunctionExpression`)},F.parseFunctionParams=function(e){this.expect(j.parenL),e.params=this.parseBindingList(j.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},F.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(j.braceL);this.type!==j.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&isPrivateNameConflicted(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},F.parseClassElement=function(e){if(this.eat(j.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(j.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===j.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===j.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(j.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===j.parenL||o!==`method`||i||a){var l=!n.static&&checkKeyName(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},F.isClassElementNameStart=function(){return this.type===j.name||this.type===j.privateId||this.type===j.num||this.type===j.string||this.type===j.bracketL||this.type.keyword},F.parseClassElementName=function(e){this.type===j.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},F.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&checkKeyName(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},F.parseClassField=function(e){return checkKeyName(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&checkKeyName(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(j.eq)?(this.enterScope(Ye|Ke),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},F.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Je|Ke);this.type!==j.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},F.parseClassId=function(e,t){this.type===j.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,et,!1)):(t===!0&&this.unexpected(),e.id=null)},F.parseClassSuper=function(e){e.superClass=this.eat(j._extends)?this.parseExprSubscripts(null,!1):null},F.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},F.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];Me(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function isPrivateNameConflicted(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function checkKeyName(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}F.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==j.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},F.parseExport=function(e,t){if(this.next(),this.eat(j.star))return this.parseExportAllDeclaration(e,t);if(this.eat(j._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==j.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},F.parseExportDeclaration=function(e){return this.parseStatement(null)},F.parseExportDefaultDeclaration=function(){var e;if(this.type===j._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,dt|pt,!1,e)}if(this.type===j._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},F.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),Me(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},F.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},F.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},F.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},F.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},F.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(j.braceL);!this.eat(j.braceR);){if(n)n=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;t.push(this.parseExportSpecifier(e))}return t},F.parseImport=function(e){return this.next(),this.type===j.string?(e.specifiers=ut,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===j.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},F.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,et),this.finishNode(e,`ImportSpecifier`)},F.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,et),this.finishNode(e,`ImportDefaultSpecifier`)},F.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,et),this.finishNode(e,`ImportNamespaceSpecifier`)},F.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===j.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(j.comma)))return e;if(this.type===j.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(j.braceL);!this.eat(j.braceR);){if(t)t=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;e.push(this.parseImportSpecifier())}return e},F.parseWithClause=function(){var e=[];if(!this.eat(j._with))return e;this.expect(j.braceL);for(var t={},n=!0;!this.eat(j.braceR);){if(n)n=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;Me(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},F.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===j.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(j.colon),this.type!==j.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},F.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===j.string){var e=this.parseLiteral(this.value);return Fe.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},F.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},F.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var mt=N.prototype;mt.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},mt.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},mt.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},mt.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==j.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},mt.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case j.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(j.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case j.braceL:return this.parseObj(!0)}return this.parseIdent()},mt.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(j.comma),t&&this.type===j.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===j.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===j.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},mt.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},mt.parseBindingListItem=function(e){return e},mt.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(j.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},mt.checkLValSimple=function(e,t,n){t===void 0&&(t=Qe);var r=t!==Qe;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===et&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(Me(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==rt&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},mt.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Qe),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},mt.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Qe),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var ht=function TokContext(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},I={b_stat:new ht(`{`,!1),b_expr:new ht(`{`,!0),b_tmpl:new ht("${",!1),p_stat:new ht(`(`,!1),p_expr:new ht(`(`,!0),q_tmpl:new ht("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new ht(`function`,!1),f_expr:new ht(`function`,!0),f_expr_gen:new ht(`function`,!0,!1,null,!0),f_gen:new ht(`function`,!1,!1,null,!0)},gt=N.prototype;gt.initialContext=function(){return[I.b_stat]},gt.curContext=function(){return this.context[this.context.length-1]},gt.braceIsBlock=function(e){var t=this.curContext();return t===I.f_expr||t===I.f_stat?!0:e===j.colon&&(t===I.b_stat||t===I.b_expr)?!t.isExpr:e===j._return||e===j.name&&this.exprAllowed?Ee.test(this.input.slice(this.lastTokEnd,this.start)):e===j._else||e===j.semi||e===j.eof||e===j.parenR||e===j.arrow?!0:e===j.braceL?t===I.b_stat:e===j._var||e===j._const||e===j.name?!1:!this.exprAllowed},gt.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},gt.updateContext=function(e){var t,n=this.type;n.keyword&&e===j.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},gt.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},j.parenR.updateContext=j.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===I.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},j.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?I.b_stat:I.b_expr),this.exprAllowed=!0},j.dollarBraceL.updateContext=function(){this.context.push(I.b_tmpl),this.exprAllowed=!0},j.parenL.updateContext=function(e){var t=e===j._if||e===j._for||e===j._with||e===j._while;this.context.push(t?I.p_stat:I.p_expr),this.exprAllowed=!0},j.incDec.updateContext=function(){},j._function.updateContext=j._class.updateContext=function(e){e.beforeExpr&&e!==j._else&&(e!==j.semi||this.curContext()===I.p_stat)&&!(e===j._return&&Ee.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==j.colon&&e!==j.braceL||this.curContext()!==I.b_stat)?this.context.push(I.f_expr):this.context.push(I.f_stat),this.exprAllowed=!1},j.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},j.backQuote.updateContext=function(){this.curContext()===I.q_tmpl?this.context.pop():this.context.push(I.q_tmpl),this.exprAllowed=!1},j.star.updateContext=function(e){if(e===j._function){var t=this.context.length-1;this.context[t]===I.f_expr?this.context[t]=I.f_expr_gen:this.context[t]=I.f_gen}this.exprAllowed=!0},j.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==j.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var L=N.prototype;L.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},L.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===j.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(j.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},L.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new st,r=!0);var s=this.start,c=this.startLoc;(this.type===j.parenL||this.type===j.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===j.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===j.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},L.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(j.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(j.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},L.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},L.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==j._in)&&a>r){var o=this.type===j.logicalOR||this.type===j.logicalAND,s=this.type===j.coalesce;s&&(a=j.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),p=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===j.coalesce||s&&(this.type===j.logicalOR||this.type===j.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(p,t,n,r,i)}return e},L.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},L.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===j.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&isLocalVariableAccess(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&isPrivateFieldAccess(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===j.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==j._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&(o.type!==`ArrowFunctionExpression`||o.start!==i)&&this.eat(j.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function isLocalVariableAccess(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&isLocalVariableAccess(e.expression)}function isPrivateFieldAccess(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&isPrivateFieldAccess(e.expression)||e.type===`ParenthesizedExpression`&&isPrivateFieldAccess(e.expression)}L.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},L.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},L.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(j.arrow)},L.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},L.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(j.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(j.bracketL);if(l||c&&this.type!==j.parenL&&this.type!==j.backQuote||this.eat(j.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(j.bracketR)):u.property=this.type===j.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(j.parenL)){var d=new st,p=this.yieldPos,m=this.awaitPos,h=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(j.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=p,this.awaitPos=m,this.awaitIdentPos=h,this.parseSubscriptAsyncArrow(t,n,g,o);this.checkExpressionErrors(d,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=m||this.awaitPos,this.awaitIdentPos=h||this.awaitIdentPos;var _=this.startNodeAt(t,n);_.callee=e,_.arguments=g,s&&(_.optional=c),e=this.finishNode(_,`CallExpression`)}else if(this.type===j.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var v=this.startNodeAt(t,n);v.tag=e,v.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(v,`TaggedTemplateExpression`)}return e},L.parseExprAtom=function(e,t,n){this.type===j.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case j._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===j.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==j.dot&&this.type!==j.bracketL&&this.type!==j.parenL&&this.unexpected(),this.finishNode(r,`Super`);case j._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case j.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(j._function))return this.overrideContext(I.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(j.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===j.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(j.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case j.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case j.num:case j.string:return this.parseLiteral(this.value);case j._null:case j._true:case j._false:return r=this.startNode(),r.value=this.type===j._null?null:this.type===j._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case j.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case j.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(j.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case j.braceL:return this.overrideContext(I.b_expr),this.parseObj(!1,e);case j._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case j._class:return this.parseClass(this.startNode(),!1);case j._new:return this.parseNew();case j.backQuote:return this.parseTemplate();case j._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},L.parseExprAtomDefault=function(){this.unexpected()},L.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===j.parenL&&!e)return this.parseDynamicImport(t);if(this.type===j.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},L.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(j.parenR)?e.options=null:(this.expect(j.comma),this.afterTrailingComma(j.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(j.parenR)||(this.expect(j.comma),this.afterTrailingComma(j.parenR)||this.unexpected())));else if(!this.eat(j.parenR)){var t=this.start;this.eat(j.comma)&&this.eat(j.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},L.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},L.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},L.parseParenExpression=function(){this.expect(j.parenL);var e=this.parseExpression();return this.expect(j.parenR),e},L.shouldParseArrow=function(e){return!this.canInsertSemicolon()},L.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new st,p=this.yieldPos,m=this.awaitPos,h;for(this.yieldPos=0,this.awaitPos=0;this.type!==j.parenR;){if(l?l=!1:this.expect(j.comma),a&&this.afterTrailingComma(j.parenR,!0)){u=!0;break}if(this.type===j.ellipsis){h=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===j.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,_=this.lastTokEndLoc;if(this.expect(j.parenR),e&&this.shouldParseArrow(c)&&this.eat(j.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=m,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),h&&this.unexpected(h),this.checkExpressionErrors(d,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=m||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,g,_)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(n,r);return v.expression=i,this.finishNode(v,`ParenthesizedExpression`)}return i},L.parseParenItem=function(e){return e},L.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var _t=[];L.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===j.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),e.arguments=this.eat(j.parenL)?this.parseExprList(j.parenR,this.options.ecmaVersion>=8,!1):_t,this.finishNode(e,`NewExpression`)},L.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===j.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
|
|
17
10
|
`),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
18
|
-
`),cooked:this.value},this.next(),n.tail=this.type===N.backQuote,this.finishNode(n,`TemplateElement`)},I.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===N.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(N.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(N.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},I.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===N.name||this.type===N.num||this.type===N.string||this.type===N.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===N.star)&&!Ue.test(this.input.slice(this.lastTokEnd,this.start))},I.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(N.braceR);){if(r)r=!1;else if(this.expect(N.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(N.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},I.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(N.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===N.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===N.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(N.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(N.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},I.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},I.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===N.colon&&this.unexpected(),this.eat(N.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===N.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==N.comma&&this.type!==N.braceR&&this.type!==N.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===N.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},I.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(N.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(N.bracketR),e.key;e.computed=!1}return e.key=this.type===N.num||this.type===N.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},I.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},I.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ct(t,r.generator)|_t|(n?vt:0)),this.expect(N.parenL),r.params=this.parseBindingList(N.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},I.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Ct(n,!1)|ht),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},I.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==N.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,kt),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},I.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},I.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,Tt,t?null:n)}},I.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(N.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===N.comma?o=null:this.type===N.ellipsis?(o=this.parseSpread(r),r&&this.type===N.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},I.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&St)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},I.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},I.parseIdentNode=function(){var e=this.startNode();return this.type===N.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=N.name):this.unexpected(),e},I.parsePrivateIdent=function(){var e=this.startNode();return this.type===N.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},I.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===N.semi||this.canInsertSemicolon()||this.type!==N.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(N.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},I.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var Yt=At.prototype;Yt.raise=function(e,t){var n=ot(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},Yt.raiseRecoverable=Yt.raise,Yt.curPosition=function(){if(this.options.locations)return new it(this.curLine,this.pos-this.lineStart)};var Xt=At.prototype,Zt=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};Xt.enterScope=function(e){this.scopeStack.push(new Zt(e))},Xt.exitScope=function(){this.scopeStack.pop()},Xt.treatFunctionsAsVarInScope=function(e){return e.flags&ft||!this.inModule&&e.flags&dt},Xt.declareName=function(e,t,n){var r=!1;if(t===Et){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&dt&&delete this.undefinedExports[e]}else if(t===Ot)this.currentScope().lexical.push(e);else if(t===Dt){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags>&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&dt&&delete this.undefinedExports[e],s.flags&St)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},Xt.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Xt.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Xt.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(St|bt|yt))return t}},Xt.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(St|bt|yt)&&!(t.flags&ht))return t}};var Qt=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new at(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},$t=At.prototype;$t.startNode=function(){return new Qt(this,this.start,this.startLoc)},$t.startNodeAt=function(e,t){return new Qt(this,e,t)};function en(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}$t.finishNode=function(e,t){return en.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},$t.finishNodeAt=function(e,t,n,r){return en.call(this,e,t,n,r)},$t.copyNode=function(e){var t=new Qt(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var tn=`Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz`,nn=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,rn=nn+` Extended_Pictographic`,an=rn,on=an+` EBase EComp EMod EPres ExtPict`,sn=on,cn={9:nn,10:rn,11:an,12:on,13:sn,14:sn},ln={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},un=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,dn=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,fn=dn+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,pn=fn+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,mn=pn+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,hn=mn+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,gn={9:dn,10:fn,11:pn,12:mn,13:hn,14:hn+` `+tn},_n={};function vn(e){var t=_n[e]={binary:tt(cn[e]+` `+un),binaryOfStrings:tt(ln[e]),nonBinary:{General_Category:tt(un),Script:tt(gn[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var yn=0,bn=[9,10,11,12,13,14];yn<bn.length;yn+=1){var xn=bn[yn];vn(xn)}var L=At.prototype,Sn=function(e,t){this.parent=e,this.base=t||this};Sn.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Sn.prototype.sibling=function(){return new Sn(this.parent,this.base)};var Cn=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=_n[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Cn.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Cn.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Cn.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Cn.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Cn.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Cn.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Cn.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Cn.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Cn.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},L.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function wn(e){for(var t in e)return!0;return!1}L.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&wn(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},L.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},L.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Sn(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},L.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},L.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},L.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},L.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},L.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},L.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},L.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},L.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},L.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},L.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},L.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&Tn(n);)t+=nt(n),e.advance();return t};function Tn(e){return e===105||e===109||e===115}L.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},L.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},L.regexp_eatSyntaxCharacter=function(e){var t=e.current();return En(t)?(e.lastIntValue=t,e.advance(),!0):!1};function En(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}L.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!En(n);)e.advance();return e.pos!==t},L.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124&&(e.advance(),!0)},L.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n){if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`)}t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},L.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},L.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=nt(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=nt(e.lastIntValue);return!0}return!1},L.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Dn(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Dn(e){return Le(e,!0)||e===36||e===95}L.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),On(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function On(e){return Re(e,!0)||e===36||e===95||e===8204||e===8205}L.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},L.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},L.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},L.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},L.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},L.regexp_eatZero=function(e){return e.current()===48&&!Bn(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},L.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},L.regexp_eatControlLetter=function(e){var t=e.current();return kn(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function kn(e){return e>=65&&e<=90||e>=97&&e<=122}L.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&An(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function An(e){return e>=0&&e<=1114111}L.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)&&(e.lastIntValue=t,e.advance(),!0)},L.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var jn=0,Mn=1,Nn=2;L.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Pn(t))return e.lastIntValue=-1,e.advance(),Mn;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Nn&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return jn};function Pn(e){return e===100||e===68||e===115||e===83||e===119||e===87}L.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),Mn}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return jn},L.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){Qe(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},L.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Mn;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Nn;e.raise(`Invalid property name`)},L.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;Fn(t=e.current());)e.lastStringValue+=nt(t),e.advance();return e.lastStringValue!==``};function Fn(e){return kn(e)||e===95}L.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;In(t=e.current());)e.lastStringValue+=nt(t),e.advance();return e.lastStringValue!==``};function In(e){return Fn(e)||Bn(e)}L.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},L.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Nn&&e.raise(`Negated character class may contain strings`),!0}return!1},L.regexp_classContents=function(e){return e.current()===93?Mn:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Mn)},L.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},L.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||Un(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},L.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},L.regexp_classSetExpression=function(e){var t=Mn,n;if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e)){n===Nn&&(t=Nn);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Nn&&(t=Mn);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`)}for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Nn&&(t=Nn)}},L.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},L.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Mn:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},L.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Nn&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},L.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},L.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Nn&&(t=Nn);return t},L.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Mn:Nn},L.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&Ln(n)||Rn(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function Ln(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Rn(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}L.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return zn(t)?(e.lastIntValue=t,e.advance(),!0):!1};function zn(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}L.regexp_eatClassControlLetter=function(e){var t=e.current();return Bn(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},L.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},L.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Bn(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function Bn(e){return e>=48&&e<=57}L.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Vn(n=e.current());)e.lastIntValue=16*e.lastIntValue+Hn(n),e.advance();return e.pos!==t};function Vn(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Hn(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}L.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;e.lastIntValue=t<=3&&this.regexp_eatOctalDigit(e)?t*64+n*8+e.lastIntValue:t*8+n}else e.lastIntValue=t;return!0}return!1},L.regexp_eatOctalDigit=function(e){var t=e.current();return Un(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Un(e){return e>=48&&e<=55}L.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!Vn(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+Hn(i),e.advance()}return!0};var Wn=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new at(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},R=At.prototype;R.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new Wn(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},R.getToken=function(){return this.next(),new Wn(this)},typeof Symbol<`u`&&(R[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===N.eof,value:t}}}}),R.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(N.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},R.readToken=function(e){return Le(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},R.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var n=this.input.charCodeAt(e+1);return n<=56319||n>=57344?t:(t<<10)+n-56613888},R.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},R.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=Ke(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},R.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!Ge(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},R.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&qe.test(String.fromCharCode(e)))++this.pos;else break loop}}},R.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},R.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(N.ellipsis)):(++this.pos,this.finishToken(N.dot))},R.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(N.assign,2):this.finishOp(N.slash,1)},R.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?N.star:N.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=N.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(N.assign,n+1):this.finishOp(r,n)},R.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(N.assign,3):this.finishOp(e===124?N.logicalOR:N.logicalAND,2):t===61?this.finishOp(N.assign,2):this.finishOp(e===124?N.bitwiseOR:N.bitwiseAND,1)},R.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(N.assign,2):this.finishOp(N.bitwiseXOR,1)},R.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||Ue.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(N.incDec,2):t===61?this.finishOp(N.assign,2):this.finishOp(N.plusMin,1)},R.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(N.assign,n+1):this.finishOp(N.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(N.relational,n))},R.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(N.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(N.arrow)):this.finishOp(e===61?N.eq:N.prefix,1)},R.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(N.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(N.assign,3):this.finishOp(N.coalesce,2)}return this.finishOp(N.question,1)},R.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),Le(t,!0)||t===92))return this.finishToken(N.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+nt(t)+`'`)},R.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(N.parenL);case 41:return++this.pos,this.finishToken(N.parenR);case 59:return++this.pos,this.finishToken(N.semi);case 44:return++this.pos,this.finishToken(N.comma);case 91:return++this.pos,this.finishToken(N.bracketL);case 93:return++this.pos,this.finishToken(N.bracketR);case 123:return++this.pos,this.finishToken(N.braceL);case 125:return++this.pos,this.finishToken(N.braceR);case 58:return++this.pos,this.finishToken(N.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(N.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(N.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+nt(e)+`'`)},R.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},R.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(Ue.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Cn(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(N.regexp,{pattern:i,flags:o,value:c})},R.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function Gn(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function Kn(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}R.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=Kn(this.input.slice(t,this.pos)),++this.pos):Le(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(N.num,n)},R.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=Kn(this.input.slice(t,this.pos));return++this.pos,Le(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(N.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),Le(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=Gn(this.input.slice(t,this.pos),n);return this.finishToken(N.num,a)},R.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},R.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Ge(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(N.string,t)};var qn={};R.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===qn)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},R.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw qn;this.raise(e,t)},R.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===N.template||this.type===N.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(N.dollarBraceL)):(++this.pos,this.finishToken(N.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(N.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Ge(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
19
|
-
`;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},
|
|
11
|
+
`),cooked:this.value},this.next(),n.tail=this.type===j.backQuote,this.finishNode(n,`TemplateElement`)},L.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===j.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(j.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(j.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},L.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===j.name||this.type===j.num||this.type===j.string||this.type===j.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===j.star)&&!Ee.test(this.input.slice(this.lastTokEnd,this.start))},L.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(j.braceR);){if(r)r=!1;else if(this.expect(j.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(j.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},L.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(j.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===j.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===j.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(j.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(j.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},L.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},L.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===j.colon&&this.unexpected(),this.eat(j.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===j.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==j.comma&&this.type!==j.braceR&&this.type!==j.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===j.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},L.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(j.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(j.bracketR),e.key;e.computed=!1}return e.key=this.type===j.num||this.type===j.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},L.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},L.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(t,r.generator)|Ke|(n?qe:0)),this.expect(j.parenL),r.params=this.parseBindingList(j.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},L.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(functionFlags(n,!1)|We),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},L.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==j.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,rt),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},L.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},L.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,$e,t?null:n)}},L.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(j.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===j.comma?o=null:this.type===j.ellipsis?(o=this.parseSpread(r),r&&this.type===j.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},L.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&Ze)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},L.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},L.parseIdentNode=function(){var e=this.startNode();return this.type===j.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=j.name):this.unexpected(),e},L.parsePrivateIdent=function(){var e=this.startNode();return this.type===j.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},L.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===j.semi||this.canInsertSemicolon()||this.type!==j.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(j.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},L.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var vt=N.prototype;vt.raise=function(e,t){var n=getLineInfo(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},vt.raiseRecoverable=vt.raise,vt.curPosition=function(){if(this.options.locations)return new Ie(this.curLine,this.pos-this.lineStart)};var yt=N.prototype,bt=function Scope(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};yt.enterScope=function(e){this.scopeStack.push(new bt(e))},yt.exitScope=function(){this.scopeStack.pop()},yt.treatFunctionsAsVarInScope=function(e){return e.flags&Ve||!this.inModule&&e.flags&Be},yt.declareName=function(e,t,n){var r=!1;if(t===et){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Be&&delete this.undefinedExports[e]}else if(t===nt)this.currentScope().lexical.push(e);else if(t===tt){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&Ge&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&Be&&delete this.undefinedExports[e],s.flags&Ze)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},yt.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},yt.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},yt.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ze|Ye|Je))return t}},yt.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ze|Ye|Je)&&!(t.flags&We))return t}};var xt=function Node(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new Le(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},St=N.prototype;St.startNode=function(){return new xt(this,this.start,this.startLoc)},St.startNodeAt=function(e,t){return new xt(this,e,t)};function finishNodeAt(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}St.finishNode=function(e,t){return finishNodeAt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},St.finishNodeAt=function(e,t,n,r){return finishNodeAt.call(this,e,t,n,r)},St.copyNode=function(e){var t=new xt(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var Ct=`Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz`,wt=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,Tt=wt+` Extended_Pictographic`,Et=Tt,Dt=Et+` EBase EComp EMod EPres ExtPict`,Ot=Dt,kt={9:wt,10:Tt,11:Et,12:Dt,13:Ot,14:Ot},At={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},jt=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,Mt=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,Nt=Mt+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,Pt=Nt+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,Ft=Pt+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,It=Ft+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,Lt={9:Mt,10:Nt,11:Pt,12:Ft,13:It,14:It+` `+Ct},Rt={};function buildUnicodeData(e){var t=Rt[e]={binary:wordsRegexp(kt[e]+` `+jt),binaryOfStrings:wordsRegexp(At[e]),nonBinary:{General_Category:wordsRegexp(jt),Script:wordsRegexp(Lt[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var zt=0,Bt=[9,10,11,12,13,14];zt<Bt.length;zt+=1){var Vt=Bt[zt];buildUnicodeData(Vt)}var R=N.prototype,Ht=function BranchID(e,t){this.parent=e,this.base=t||this};Ht.prototype.separatedFrom=function separatedFrom(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Ht.prototype.sibling=function sibling(){return new Ht(this.parent,this.base)};var Ut=function RegExpValidationState(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=Rt[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Ut.prototype.reset=function reset(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Ut.prototype.raise=function raise(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Ut.prototype.at=function at(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Ut.prototype.nextIndex=function nextIndex(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Ut.prototype.current=function current(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Ut.prototype.lookahead=function lookahead(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Ut.prototype.advance=function advance(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Ut.prototype.eat=function eat(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Ut.prototype.eatChars=function eatChars(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},R.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function hasProp(e){for(var t in e)return!0;return!1}R.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&hasProp(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},R.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},R.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Ht(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},R.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},R.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},R.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},R.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},R.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},R.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},R.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},R.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},R.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},R.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},R.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&isRegularExpressionModifier(n);)t+=codePointToString(n),e.advance();return t};function isRegularExpressionModifier(e){return e===105||e===109||e===115}R.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},R.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},R.regexp_eatSyntaxCharacter=function(e){var t=e.current();return isSyntaxCharacter(t)?(e.lastIntValue=t,e.advance(),!0):!1};function isSyntaxCharacter(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}R.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!isSyntaxCharacter(n);)e.advance();return e.pos!==t},R.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124&&(e.advance(),!0)},R.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n){if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`)}t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},R.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},R.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=codePointToString(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=codePointToString(e.lastIntValue);return!0}return!1},R.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),isRegExpIdentifierStart(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function isRegExpIdentifierStart(e){return isIdentifierStart(e,!0)||e===36||e===95}R.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),isRegExpIdentifierPart(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function isRegExpIdentifierPart(e){return isIdentifierChar(e,!0)||e===36||e===95||e===8204||e===8205}R.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},R.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},R.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},R.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},R.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},R.regexp_eatZero=function(e){return e.current()===48&&!isDecimalDigit(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},R.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},R.regexp_eatControlLetter=function(e){var t=e.current();return isControlLetter(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function isControlLetter(e){return e>=65&&e<=90||e>=97&&e<=122}R.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&isValidUnicode(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function isValidUnicode(e){return e>=0&&e<=1114111}R.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)&&(e.lastIntValue=t,e.advance(),!0)},R.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Wt=0,Gt=1,Kt=2;R.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(isCharacterClassEscape(t))return e.lastIntValue=-1,e.advance(),Gt;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Kt&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return Wt};function isCharacterClassEscape(e){return e===100||e===68||e===115||e===83||e===119||e===87}R.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),Gt}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Wt},R.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){Me(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},R.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Gt;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Kt;e.raise(`Invalid property name`)},R.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;isUnicodePropertyNameCharacter(t=e.current());)e.lastStringValue+=codePointToString(t),e.advance();return e.lastStringValue!==``};function isUnicodePropertyNameCharacter(e){return isControlLetter(e)||e===95}R.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;isUnicodePropertyValueCharacter(t=e.current());)e.lastStringValue+=codePointToString(t),e.advance();return e.lastStringValue!==``};function isUnicodePropertyValueCharacter(e){return isUnicodePropertyNameCharacter(e)||isDecimalDigit(e)}R.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},R.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Kt&&e.raise(`Negated character class may contain strings`),!0}return!1},R.regexp_classContents=function(e){return e.current()===93?Gt:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Gt)},R.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},R.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||isOctalDigit(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},R.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},R.regexp_classSetExpression=function(e){var t=Gt,n;if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e)){n===Kt&&(t=Kt);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Kt&&(t=Gt);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`)}for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Kt&&(t=Kt)}},R.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},R.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Gt:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},R.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Kt&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},R.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},R.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Kt&&(t=Kt);return t},R.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Gt:Kt},R.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&isClassSetReservedDoublePunctuatorCharacter(n)||isClassSetSyntaxCharacter(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function isClassSetReservedDoublePunctuatorCharacter(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function isClassSetSyntaxCharacter(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}R.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return isClassSetReservedPunctuator(t)?(e.lastIntValue=t,e.advance(),!0):!1};function isClassSetReservedPunctuator(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}R.regexp_eatClassControlLetter=function(e){var t=e.current();return isDecimalDigit(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},R.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},R.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;isDecimalDigit(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function isDecimalDigit(e){return e>=48&&e<=57}R.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;isHexDigit(n=e.current());)e.lastIntValue=16*e.lastIntValue+hexToInt(n),e.advance();return e.pos!==t};function isHexDigit(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function hexToInt(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}R.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;e.lastIntValue=t<=3&&this.regexp_eatOctalDigit(e)?t*64+n*8+e.lastIntValue:t*8+n}else e.lastIntValue=t;return!0}return!1},R.regexp_eatOctalDigit=function(e){var t=e.current();return isOctalDigit(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function isOctalDigit(e){return e>=48&&e<=55}R.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!isHexDigit(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+hexToInt(i),e.advance()}return!0};var qt=function Token(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Le(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},z=N.prototype;z.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new qt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},z.getToken=function(){return this.next(),new qt(this)},typeof Symbol<`u`&&(z[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===j.eof,value:t}}}}),z.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(j.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},z.readToken=function(e){return isIdentifierStart(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},z.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var n=this.input.charCodeAt(e+1);return n<=56319||n>=57344?t:(t<<10)+n-56613888},z.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},z.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=nextLineBreak(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},z.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!isNewLine(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},z.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&Oe.test(String.fromCharCode(e)))++this.pos;else break loop}}},z.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},z.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(j.ellipsis)):(++this.pos,this.finishToken(j.dot))},z.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(j.assign,2):this.finishOp(j.slash,1)},z.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?j.star:j.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=j.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(j.assign,n+1):this.finishOp(r,n)},z.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(j.assign,3):this.finishOp(e===124?j.logicalOR:j.logicalAND,2):t===61?this.finishOp(j.assign,2):this.finishOp(e===124?j.bitwiseOR:j.bitwiseAND,1)},z.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(j.assign,2):this.finishOp(j.bitwiseXOR,1)},z.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||Ee.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(j.incDec,2):t===61?this.finishOp(j.assign,2):this.finishOp(j.plusMin,1)},z.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(j.assign,n+1):this.finishOp(j.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(j.relational,n))},z.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(j.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(j.arrow)):this.finishOp(e===61?j.eq:j.prefix,1)},z.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(j.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(j.assign,3):this.finishOp(j.coalesce,2)}return this.finishOp(j.question,1)},z.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),isIdentifierStart(t,!0)||t===92))return this.finishToken(j.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+codePointToString(t)+`'`)},z.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(j.parenL);case 41:return++this.pos,this.finishToken(j.parenR);case 59:return++this.pos,this.finishToken(j.semi);case 44:return++this.pos,this.finishToken(j.comma);case 91:return++this.pos,this.finishToken(j.bracketL);case 93:return++this.pos,this.finishToken(j.bracketR);case 123:return++this.pos,this.finishToken(j.braceL);case 125:return++this.pos,this.finishToken(j.braceR);case 58:return++this.pos,this.finishToken(j.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(j.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(j.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+codePointToString(e)+`'`)},z.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},z.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(Ee.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Ut(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(j.regexp,{pattern:i,flags:o,value:c})},z.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function stringToNumber(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function stringToBigInt(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}z.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=stringToBigInt(this.input.slice(t,this.pos)),++this.pos):isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(j.num,n)},z.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=stringToBigInt(this.input.slice(t,this.pos));return++this.pos,isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(j.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=stringToNumber(this.input.slice(t,this.pos),n);return this.finishToken(j.num,a)},z.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},z.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(isNewLine(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(j.string,t)};var Jt={};z.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Jt)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},z.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Jt;this.raise(e,t)},z.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===j.template||this.type===j.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(j.dollarBraceL)):(++this.pos,this.finishToken(j.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(j.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(isNewLine(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
12
|
+
`;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},z.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(j.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
|
|
20
13
|
`&&++this.pos;case`
|
|
21
|
-
`:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},
|
|
22
|
-
`;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return
|
|
14
|
+
`:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},z.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
|
|
15
|
+
`;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return isNewLine(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},z.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},z.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(isIdentifierChar(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?isIdentifierStart:isIdentifierChar)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=codePointToString(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},z.readWord=function(){var e=this.readWord1(),t=j.name;return this.keywords.test(e)&&(t=Te[e]),this.finishToken(t,e)},N.acorn={Parser:N,version:`8.18.0`,defaultOptions:Re,Position:Ie,SourceLocation:Le,getLineInfo,Node:xt,TokenType:A,tokTypes:j,keywordTypes:Te,TokContext:ht,tokContexts:I,isIdentifierChar,isIdentifierStart,Token:qt,isNewLine,lineBreak:Ee,lineBreakG:De,nonASCIIwhitespace:Oe};function parseExpressionAt(e,t,n){return N.parseExpressionAt(e,t,n)}function tersifyAcorn(e,t,n){let r=getFunctionString(t),i=parseExpressionAt(`(${r})`,0,{ecmaVersion:2020});return tersifyAcornNode({...e,rawString:r},i,n)}function getFunctionString(e){let t=e.toString(),n=t.startsWith(`async `),r=n?t.slice(6):t,i=/^([^\s\\)]+)\s?\(/.exec(r);return i&&i[1]!==`function`&&i[1]!==`function*`?`${n?`async `:``}function ${t}`:t}function tersifyAcornNode(e,t,n){if(!t)return``;switch(t.type){case`Identifier`:return tersifyIdentifierNode(e,t,n);case`Literal`:return tersifyLiteralNode(e,t,n);case`AssignmentPattern`:return tersifyAssignmentPatternNode(e,t,n);case`RestElement`:case`SpreadElement`:return tersifyRestElementNode(e,t,n);case`ArrowFunctionExpression`:return tersifyArrowExpressionNode(e,t,n);case`ExpressionStatement`:return tersifyExpressionStatementNode(e,t,n);case`CallExpression`:return tersifyCallExpressionNode(e,t,n);case`MemberExpression`:return tersifyMemberExpressionNode(e,t,n);case`FunctionDeclaration`:case`FunctionExpression`:return tersifyFunctionExpressionNode(e,t,n);case`BlockStatement`:case`ClassBody`:return tersifyBlockStatementNode(e,t,n);case`ReturnStatement`:return tersifyReturnStatementNode(e,t,n);case`VariableDeclaration`:return tersifyVariableDeclarationNode(e,t,n);case`VariableDeclarator`:return tersifyVariableDeclaratorNode(e,t,n);case`NewExpression`:return tersifyNewExpressionNode(e,t,n);case`BinaryExpression`:case`LogicalExpression`:return tersifyBinaryExpressionNode(e,t,n);case`ConditionalExpression`:return tersifyConditionalExpressionNode(e,t,n);case`UnaryExpression`:return tersifyUnaryExpressionNode(e,t,n);case`UpdateExpression`:return tersifyUpdateExpressionNode(e,t,n);case`IfStatement`:return tersifyIfStatementNode(e,t,n);case`WhileStatement`:return tersifyWhileStatementNode(e,t,n);case`AssignmentExpression`:return tersifyAssignmentExpressionNode(e,t,n);case`DoWhileStatement`:return tersifyDoWhileStatementNode(e,t,n);case`EmptyStatement`:return tersifyEmptyStatementNode(e,t,n);case`ForStatement`:return tersifyForStatementNode(e,t,n);case`BreakStatement`:return tersifyBreakStatementNode(e,t,n);case`LabeledStatement`:return tersifyLabeledStatementNode(e,t,n);case`ContinueStatement`:return tersifyContinueStatementNode(e,t,n);case`SwitchStatement`:return tersifySwitchStatementNode(e,t,n);case`SwitchCase`:return tersifySwitchCaseNode(e,t,n);case`ForInStatement`:return tersifyForInStatementNode(e,t,n);case`ForOfStatement`:return tersifyForOfStatementNode(e,t,n);case`ObjectExpression`:return tersifyObjectExpressionNode(e,t,n);case`Property`:return tersifyPropertyNode(e,t,n);case`YieldExpression`:return tersifyYieldExpressionNode(e,t,n);case`AwaitExpression`:return tersifyAwaitExpressionNode(e,t,n);case`ArrayExpression`:return tersifyArrayExpressionNode(e,t,n);case`ThrowStatement`:return tersifyThrowStatementNode(e,t,n);case`TryStatement`:return tersifyTryStatementNode(e,t,n);case`CatchClause`:return tersifyCatchClauseNode(e,t,n);case`ThisExpression`:return tersifyThisExpression(e,t,n);case`ClassExpression`:return tersifyClassExpression(e,t,n);case`MethodDefinition`:return tersifyMethodDefinition(e,t,n);case`ObjectPattern`:return tersifyObjectPattern(e,t,n);case`SequenceExpression`:return tersifySequenceExpression(e,t,n);case`TemplateLiteral`:return tersifyTemplateLiteral(e,t,n);case`TaggedTemplateExpression`:return tersifyTaggedTemplateExpression(e,t,n);case`ChainExpression`:return tersifyChainExpression(e,t,n);case`MetaProperty`:return tersifyMetaProperty(e,t,n);case`Super`:return tersifySuperNode(e,t,n);default:return tersifyUnknown(t,e.rawString)}}function tersifyUnknown(e,t){let n=e.type;return console.warn(`tersify received unsupported type: ${n}. Please open an issue at https://github.com/cyberuni/tersify/issues
|
|
23
16
|
node detail:
|
|
24
17
|
${JSON.stringify(e,void 0,2)}
|
|
25
18
|
|
|
26
19
|
subject:
|
|
27
|
-
${t}`),`<unsupported: ${n}>`}function $n(e,t,n){let r=V(e,t.param,n),i=V(e,t.body,n);return`catch${r?` (${r})`:``}${i?` ${i}`:``}`}function er(e,t,n){let r=V(e,t.block,n),i=V(e,t.handler,n),a=V(e,t.finalizer,n);return`try ${r}${i?` ${i}`:``}${a?` finally ${a}`:``}`}function tr(e,t,n){return`throw ${V(e,t.argument,n)}`}function nr(e,t,n){return z(e,`[${t.elements.map(t=>V(e,t,n)).join(`, `)}]`,n)}function rr(e,t,n){return`await ${V(e,t.argument,n)}`}function ir(e,t,n){return`yield ${V(e,t.argument,n)}`}function ar(e,t,n){return`${V(e,t.meta,n)}.${V(e,t.property,n)}`}function or(e,t,n){let r=V(e,t.key,n),i=t.value;if(i.type===`FunctionExpression`)return`${i.async?`async `:``}${i.generator?`*`:``}${r}${Hr(e,i.params)} ${Ur(e,i.body)}`;if(i.type===`AssignmentPattern`)return V(e,i,n);let a=V(e,i,n);return t.computed?`[${r}]: ${a}`:r===a?r:`${r}: ${a}`}function sr(e,t,n){return`{ ${t.properties.map(t=>V(e,t,n)).join(`, `)} }`}function cr(e,t,n){return`for (${V(e,t.left,n)} of ${V(e,t.right,n)}) ${V(e,t.body,n)}`}function lr(e,t,n){return`for (${V(e,t.left,n)} in ${V(e,t.right,n)}) ${V(e,t.body,n)}`}function ur(e,t,n){let r=V(e,t.test,n),i=t.consequent.map(t=>V(e,t,n));return t.test?`case ${r}: ${i.join(` `)}`:`default: ${i.join(` `)}`}function dr(e,t,n){return`switch (${V(e,t.discriminant,n)}) { ${t.cases.map(t=>V(e,t,n)).join(`; `)} }`}function fr(e,t,n){let r=V(e,t.label,n);return r?`continue ${r}`:`continue`}function pr(e,t,n){return`${V(e,t.label,n)}: ${V(e,t.body,n)}`}function mr(e,t,n){let r=V(e,t.label,n);return r?`break ${r}`:`break`}function hr(e,t,n){let r=V(e,t.test,n),i=V(e,t.init,n),a=V(e,t.update,n),o=V(e,t.body,n);return`for (${i};${r?` ${r}`:``};${a?` ${a}`:``}) ${o}`}function gr(e,t,n){let r=V(e,t.left,n),i=V(e,t.right,n);return`${r} ${t.operator} ${i}`}function _r(e,t,n){return`while (${V(e,t.test,n)}) ${V(e,t.body,n)}`}function vr(e,t,n){let r=V(e,t.test,n),i=V(e,t.body,n);return t.body.type===`BlockStatement`?`do ${i} while (${r})`:`do ${i}; while (${r})`}function yr(e,t,n){return[`void`,`typeof`].indexOf(t.operator)===-1?t.prefix?`${t.operator}${V(e,t.argument,n)}`:`${V(e,t.argument,n)}${t.operator}`:`${t.operator} ${V(e,t.argument,n)}`}function br(e,t,n){return t.prefix?`${t.operator}${V(e,t.argument,n)}`:`${V(e,t.argument,n)}${t.operator}`}function xr(e,t,n){return`${V(e,t.test,n)} ? ${V(e,t.consequent,n)} : ${V(e,t.alternate,n)}`}function Sr(e,t,n){let r=V(e,t.test,n),i=V(e,t.consequent,n),a=V(e,t.alternate,n);return a?t.consequent.type===`BlockStatement`?`if (${r}) ${i} else ${a}`:`if (${r}) ${i}; else ${a}`:`if (${r}) ${i}`}function Cr(e,t,n){(t.left.type===`BinaryExpression`||t.left.type===`LogicalExpression`)&&Yn(t.operator,t.left.operator)&&(t.left.needParen=!0);let r=V(e,t.left,n);(t.right.type===`BinaryExpression`||t.right.type===`LogicalExpression`)&&Yn(t.operator,t.right.operator)&&(t.right.needParen=!0);let i=V(e,t.right,n);return t.needParen?`(${r} ${t.operator} ${i})`:`${r} ${t.operator} ${i}`}function wr(e,t,n){return Tr(t)||`new ${V(e,t.callee,n)}(${t.arguments.map(t=>V(e,t,n)).join(`, `)})`}function Tr(e){if(e.callee.type===`Identifier`&&e.callee.name===`Date`){let t=e.arguments;if(t.length>0&&!t.some(e=>e.type!==`Literal`)){let e=t;if(e.length===1){let t=e[0];if(typeof t.value==`string`)return new Date(t.value).toISOString()}let n=e.map(e=>e.value);return new Date(...n).toISOString()}}}function Er(e,t,n){return`${t.id.name}${t.init?` = ${V(e,t.init,n)}`:``}`}function Dr(e,t,n){return`${t.kind} ${t.declarations.map(t=>V(e,t,n)).join(`, `)}`}function Or(e,t,n){return t.name===`Symbol`?`Sym`:t.name}function kr(e,t,n){return t.raw}function Ar(e,t,n){return`...${t.argument.name}`}function jr(e,t,n){return`${t.left.name} = ${V(e,t.right,n-t.left.name.length-3)}`}function Mr(e,t,n){let r=t.async?`async `:``,i=t.generator?`*`:``,a=` => `,o=t.params.length===1&&t.params[0].type!==`ObjectPattern`,s=Br(e,t.params),c=o?s:`(${s})`,l=Nr(e,t.body),u=l?Pr(e,l):Ur(e,t.body),d=l&&l.type===`ObjectExpression`;if(d&&(u=`(${u})`),r.length+i.length+c.length+4+u.length<=n)return`${r}${i}${c}${a}${u}`;{let t=Math.max(o?1:3,n-(r.length+i.length+4+u.length)),c=o?z(e,s,t):`(${z(e,s,t-2)})`;if(r.length+i.length+t+4+u.length<=n)return`${r}${i}${c}${a}${u}`;{let t=d?6:l?0:4,o=Math.max(3,n-(r.length+i.length+c.length+4+t));return z(e,`${r}${i}${c}${a}${d?`({ ${z(e,u.slice(2,u.length-2),o-4)} })`:l?z(e,u,o):`{ ${z(e,u.slice(2,u.length-1),o)} }`}`,n)}}}function Nr(e,t){if(t.type!==`BlockStatement`)return t;if(t.body.length===1&&t.body[0].type===`ReturnStatement`)return t.body[0]}function Pr(e,t){return t.type===`ReturnStatement`?t.argument?t.argument.type===`ObjectExpression`?`(${V(e,t.argument,1/0)})`:V(e,t.argument,1/0):`{}`:V(e,t,1/0)}function Fr(e,t,n){return V(e,t.expression,n)}function Ir(e,t,n){let r=t.property.type===`Identifier`?V(e,t.property,n):`[${V(e,t.property,n)}]`;return`${V(e,t.object,n)}${t.optional?`?`:``}.${r}`}function Lr(e,t,n){if(Rr(t))return`Sym(${t.arguments[0].value})`;if(zr(t)){let r=t.arguments[1].value;return`this.${r} = ${V(e,t.arguments[2],n-5-r.length-3)}`}let r=V(e,t.callee,n),i=Hr(e,t.arguments);return`${r}${t.optional?`?.`:``}${i}`}function Rr(e){return e.callee.type===`MemberExpression`&&e.callee.object.type===`Identifier`&&e.callee.object.name===`Symbol`&&e.callee.property.type===`Identifier`&&e.callee.property.name===`for`}function zr(e){return e.callee.type===`Identifier`&&e.callee.name===`_defineProperty`&&e.arguments.length===3&&e.arguments[0].type===`ThisExpression`}function Br(e,t){return t.reduce((t,n)=>(t.push(V(e,n,1/0)),t),[]).join(`, `)}function Vr(e,t,n){let r=e.raw?`function`:`fn`,i=t.async?`async `:``,a=t.generator?`*`:``,o=t.id?` ${t.id.name}`:``,s=t.params.length>0?Hr(e,t.params):`()`,c=i.length+r.length+a.length+o.length+1,l=s.slice(1,s.length-1),u=l.length>3?`(${z(e,l,3)})`:s,d=c+u.length,f=c+s.length,p=Ur(e,t.body);if(d+p.length>n){if(d+5>n)return z(e,`${i}${r}${a}${o}${u} ${p}`,n);{let t=p.slice(2,p.length-2),s=`${i}${r}${a}${o}${u} ${t.length===0?`{}`:`{ ${z(e,t,n-d-4)} }`}`;return s.length>n?z(e,s,n):s}}return f+p.length>n?d+p.length<n?`${i}${r}${a}${o}(${z(e,l,n-p.length-c-2)}) ${p}`:z(e,`${i}${r}${a}${o}${u} ${p}`,n):z(e,`${i}${r}${a}${o}${s} ${p}`,n)}function Hr(e,t){return`(${Br(e,t)})`}function Ur(e,t){return V(e,t,1/0)}function Wr(e,t,n){if(n<=3&&t.body.length>0)return z(e,`...`,n);if(n<=4&&t.body.length>0)return z(e,`{...`,n);let r=n-4,i=[];t.body.forEach(t=>{if(r){let n=V(e,t,r);r-=n.length,n&&n!==`return`&&i.push(n)}});let a=i.join(`; `);return`{${a?` ${a} `:``}}`}function Gr(e,t,n){return t.argument?`return ${V(e,t.argument,n)}`:`return`}function Kr(e,t,n){return`this`}function qr(e,t,n){let r=z(e,`class${t.id?` ${t.id.name}`:` `}{}`,n),i=r.slice(0,Math.max(3,r.length-2)),a=V(e,t.body,n-i.length);return`${i}${n>=i.length+a.length||a.length>3?a:z(e,`...`,n-i.length)}`}function Jr(e,t,n){let r=t.static?`static `:``,i=t.value,a=i.async?`async `:``,o=i.generator?`*`:``,s=t.key.name??`[${V(e,t.key,n)}]`,c=i.params.length>0?Hr(e,i.params):`()`,l=r.length+a.length+o.length+s.length+1,u=c.slice(1,c.length-1),d=u.length>3?`(${z(e,u,3)})`:c,f=l+d.length,p=l+c.length,m=Ur(e,i.body);if(f+m.length>n){if(f+5>n)return z(e,`${r}${a}${o}${s}${d} ${m}`,n);{let t=m.slice(2,m.length-2),i=`${r}${a}${o}${s}${d} ${t.length===0?`{}`:`{ ${z(e,t,n-f-4)} }`}`;return i.length>n?z(e,i,n):i}}return p+m.length>n?f+m.length<n?`${r}${a}${o}${s}(${z(e,u,n-m.length-l-2)}) ${m}`:z(e,`${r}${a}${o}${s}${d} ${m}`,n):z(e,`${r}${a}${o}${s}${c} ${m}`,n)}function Yr(e,t,n){return`${z(e,`{ ${t.properties.map(t=>V(e,t,n)).join(`, `)} }`,n-2)}`}function Xr(e,t,n){return`(${t.expressions.map(t=>V(e,t,n)).join(`, `)})`}function Zr(e,t,n){return"`"+t.expressions.concat(t.quasis).sort((e,t)=>e.start-t.start).reduce((t,r)=>{if(n<=0)return t;if(r.type===`TemplateElement`)n-=r.value.raw.length,t+=r.value.raw;else{let i=V(e,r,n);n-=i.length,t+="${"+i+`}`}return t},``)+"`"}function Qr(e,t,n){let r=t.tag.name;return r+V(e,t.quasi,n-r.length)}function $r(e,t,n){switch(t.expression.type){case`MemberExpression`:return Ir(e,t.expression,n);case`CallExpression`:return Lr(e,t.expression,n);default:return Qn(t,e.rawString)}}function ei(e,t,n){return`Super`}function ti(e,t){let n=e.toString();if(t.raw)return n;let r=ai(n);switch(r.type){case`function`:return oi(r,t.maxLength);case`arrow`:return si(r,t.maxLength);default:return ci(r,t.maxLength)}}const ni=/^(async\s+)?function\s*(\*?)\s*(\w*)\s*\(([^)]*)\)\s*(\{.*\})$/ms,ri=/^(async\s*)?\(([^)]*)\)\s*=>(.*)$/ms,ii=/^(async\s+)?(\w+)\s*=>(.*)$/ms;function ai(e){let t=ni.exec(e);if(t){let e=di((t[5]??``).trim()).trim();return{type:`function`,async:!!t[1],generator:!!t[2],name:(t[3]??``).trim(),params:(t[4]??``).trim(),body:e}}if(t=ri.exec(e),t){let e=(t[2]??``).trim(),n=(t[3]??``).trim(),r=li(n);return n=fi(r?ui(n,1/0):di(n)).trim(),!r&&n.startsWith(`return `)&&n.endsWith(`;`)&&(r=!0,n=n.slice(7,-1),n.startsWith(`{`)&&(n=`(${n})`)),{type:`arrow`,async:!!t[1],params:e,body:n,singleParam:e.length>0&&e.indexOf(`,`)===-1,singleLineBody:r}}if(t=ii.exec(e),t){let e=(t[3]??``).trim(),n=li(e);return e=fi(n?ui(e,1/0):di(e)).trim(),!n&&e.startsWith(`return `)&&e.endsWith(`;`)&&(n=!0,e=e.slice(7,-1),e.startsWith(`{`)&&(e=`(${e})`)),{type:`arrow`,async:!!t[1],params:`${t[2]}`,body:e,singleParam:!0,singleLineBody:n}}return{type:`unknown`,value:e}}function oi(e,t){let n=`${e.async?`async `:``}fn${e.generator?`*`:``}${e.name?` `+e.name:``}(${e.params?`%1`:``}) {${e.body?` %2 `:``}}`,r=e.params&&e.body?n.length-4:e.params||e.body?n.length-2:n.length;return e.params=z({raw:!1,noTrim:!1},e.params,Math.max(3,t-r-e.body.length)),e.body=z({raw:!1,noTrim:!1},e.body,Math.max(3,t-r-e.params.length)),z({raw:!1,noTrim:!1},pi(n,e),t)}function si(e,t){let n=`${e.async?`async `:``}${e.singleParam?`%1`:`(${e.params?`%1`:``})`} => ${e.singleLineBody?`%2`:`{${e.body?` %2 `:``}}`}`,r=e.params&&e.body?n.length-4:e.params||e.body?n.length-2:n.length;return e.params=z({raw:!1,noTrim:!1},e.params,Math.max(3,t-r-e.body.length)),e.body=z({raw:!1,noTrim:!1},e.body,Math.max(3,t-r-e.params.length)),z({raw:!1,noTrim:!1},pi(n,e),t)}function ci(e,t){return z({noTrim:!1},e.value,t)}function li(e){return!e.startsWith(`{`)}function ui(e,t){let n=ai(e);switch(n.type){case`function`:return oi(n,t);case`arrow`:return si(n,t);default:return e.replace(/return;/g,``).replace(/([\s([{])Symbol\(\)/g,`$1Sym()`).replace(/([\s([{])Symbol\.for\('([\w_]*)'\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\("([\w_]*)"\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\(`([\w_]*)`\)/g,`$1Sym($2)`).replace(/{\s+}/g,`{}`)}}function di(e){let t=1;e=e.slice(1);for(let n=0;n<=e.length;n++)if(e[n]===`}`&&t--,e[n]===`{`&&t++,t===0){e=fi(e.slice(0,n)).replace(/return;/g,``).replace(/([\s([{])Symbol\(\)/g,`$1Sym()`).replace(/([\s([{])Symbol\.for\('([\w_]*)'\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\("([\w_]*)"\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\(`([\w_]*)`\)/g,`$1Sym($2)`).replace(/{\s+}/g,`{}`);break}return e}function fi(e){return e.split(`
|
|
28
|
-
`).map(e=>e.trim()).filter(e=>!!e).map((e,t,n)=>t<n.length-1&&/[^({}):;(do|else)]$/.test(e)&&/[^)}]/.test(n[t+1])?e+`;`:e).join(` `)}function pi(e,t){return t.params&&(e=e.replace(`%1`,t.params)),t.body&&(e=e.replace(`%2`,t.body)),e}function mi(e,t,n){if(!e.raw&&Te(t)&&t.tersify!==gi)return t.tersify({maxLength:e.maxLength,raw:e.raw});try{return Xn(e,t,e.maxLength)}catch(n){if(n.name!==`SyntaxError`)throw n;return ti(t,e)}}var hi=k(_e(),1);Ce();function gi(e){return _i(this,e)}function _i(e,t){let n=ve(we,t,{path:[],references:[]});return vi(n,e,n.maxLength)}function vi(e,t,n){let r=yi(t),i=bi[r];if(!i)throw Error(`Can't find fn for ${JSON.stringify(t)}`);return i(e,t,n)}function yi(e){if(e==null)return String(e);if(e instanceof RegExp)return`RegExp`;if(e instanceof Date)return`Date`;if(Array.isArray(e))return`Array`;if(e instanceof Error)return`Error`;if((0,hi.default)(e))return`Buffer`;let t=typeof e;return t===`object`&&Object.getPrototypeOf(e)!==Object.prototype?`instance`:t}const bi={undefined:xi,null:xi,boolean:xi,number:xi,bigint:Ei,instance:ji,string:wi,symbol:Ti,function:mi,object:Ai,Buffer:Oi,Date:Si,RegExp:Ci,Array:ki,Error:Di};function xi(e,t,n){return z(e,String(t),n)}function Si(e,t,n){return z(e,t.toISOString(),n)}function Ci(e,t,n){return z(e,String(t),n)}function wi(e,t,n){return z(e,`'${t}'`,n)}function Ti(e,t,n){return e.raw?t.toString():z(e,t.toString().replace(`Symbol(`,`Sym(`),n)}function Ei(e,t,n){return z(e,String(t)+`n`,n)}function Di(e,t,n){let r=t.constructor.name,i=z(e,`'${t.message}'`,n-7);return t.message?i.length===0?z(e,`${r}( )`,n):z(e,`${r}(${i})`,n):z(e,`${r}()`,n)}function Oi(e,t,n){return z(e,t.inspect(),n)}function ki(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&Te(t)&&t.tersify!==gi)return t.tersify({maxLength:n});if(t.length===0)return`[]`;let i=0,a=z(e,t.reduce((r,a,o)=>{let s=[...e.path,o],c=vi({...e,path:s},a,n-i);return i+=c.length,o!==t.length-1&&(i+=2),r.push(c),r},[]).join(`, `),n-2);return a.length===0?z(e,`[ ]`,n):`[${a}]`}function Ai(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&Te(t)&&t.tersify!==gi)return t.tersify({maxLength:n});let i=n-4,a=Object.keys(t),o=a.reduce((n,r,o)=>{if(i>0){let s=o===a.length-1,c=Mi(e,t,r,i,s);i-=c.length,n.push(c)}return n},[]),s=z(e,a.length>o.length?o.join(`, `)+` `:o.join(`, `),n-4);return a.length===0?`{}`:s.length===0?z(e,`{ }`,n):`{ ${s} }`}function ji(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&Te(t)&&t.tersify!==gi)return t.tersify({maxLength:n});if(n<=4)switch(n){case 4:return`. {}`;case 3:return`...`;case 2:return`..`;case 1:return`.`;case 0:return``}let i=Object.getPrototypeOf(t)?.constructor?.name??``,[a,o]=n<i.length+1+2?[n-1-2,2]:[i.length,n-i.length-1],s=a?`${z(e,i,a)} `:``,c=o,l=Object.keys(t),u=l.reduce((n,r,i)=>{if(c>0){let a=i===l.length-1,o=Mi(e,t,r,c,a);c-=o.length,n.push(o)}return n},[]),d=z(e,l.length>u.length?u.join(`, `)+` `:u.join(`, `),o-2-2);return l.length===0?`${s}{}`:d.length===0?z(e,`${s}{ }`,n):`${s}{ ${d} }`}function Mi(e,t,n,r,i){let a=i?0:2,o=[...e.path,n],s=Object.getOwnPropertyDescriptor(t,n),c=[];if(s.get&&c.push(`Get`),s.set&&c.push(`Set`),c.length>0)return`${Ni(n)}: [${c.join(`/`)}]`;let l=t[n];if(typeof l==`function`){if(/^(.*)\s?=>\s?/.test(l.toString())){let t=vi({...e,path:o},l,r-n.length-a-2);return`${Ni(n)}: ${t}`}{let t=vi({...e,path:o},l,r-n.length-a+2);return`${/^async fn/.test(t)?`async `:``}${/^(async )?fn\*/.test(t)?`*`:``}${Ni(n)}${t.slice(t.indexOf(`(`))}`}}{let t=vi({...e,path:o,noTrim:!0},l,r-n.length-2-a);return`${Ni(n)}: ${t}`}}function Ni(e){return e.indexOf(`-`)>=0?`'${e}'`:e}function Pi(e,t,n){return Object.keys(e).find(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function Fi(e,t,n){return Object.keys(e).forEach(t,n)}function Ii(e,t,n){return Object.keys(e).map(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function Li(e,t,n){return Object.keys(e).reduce((n,r,i,a)=>t(n,r,i,a,e),n)}const Ri=Li;function zi(e){let t=Object.create(null);return e?Object.assign(t,e):t}function Bi(e,t,n){return Object.keys(e).some(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function Vi(e){return e}var H;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(H||={});var Hi;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Hi||={});const U=H.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Ui=e=>{switch(typeof e){case`undefined`:return U.undefined;case`string`:return U.string;case`number`:return Number.isNaN(e)?U.nan:U.number;case`boolean`:return U.boolean;case`function`:return U.function;case`bigint`:return U.bigint;case`symbol`:return U.symbol;case`object`:return Array.isArray(e)?U.array:e===null?U.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?U.promise:typeof Map<`u`&&e instanceof Map?U.map:typeof Set<`u`&&e instanceof Set?U.set:typeof Date<`u`&&e instanceof Date?U.date:U.object;default:return U.unknown}},W=H.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]);var Wi=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Wi.create=e=>new Wi(e);const Gi=(e,t)=>{let n;switch(e.code){case W.invalid_type:n=e.received===U.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,H.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${H.joinValues(e.keys,`, `)}`;break;case W.invalid_union:n=`Invalid input`;break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${H.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${H.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n=`Invalid function arguments`;break;case W.invalid_return_type:n=`Invalid function return type`;break;case W.invalid_date:n=`Invalid date`;break;case W.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:H.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case W.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case W.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case W.custom:n=`Invalid input`;break;case W.invalid_intersection_types:n=`Intersection results could not be merged`;break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,H.assertNever(e)}return{message:n}};let Ki=Gi;function qi(){return Ki}const Ji=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function G(e,t){let n=qi(),r=Ji({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Gi?void 0:Gi].filter(e=>!!e)});e.common.issues.push(r)}var Yi=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return K;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return K;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};const K=Object.freeze({status:`aborted`}),Xi=e=>({status:`dirty`,value:e}),Zi=e=>({status:`valid`,value:e}),Qi=e=>e.status===`aborted`,$i=e=>e.status===`dirty`,ea=e=>e.status===`valid`,ta=e=>typeof Promise<`u`&&e instanceof Promise;var q;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(q||={});var na=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ra=(e,t)=>{if(ea(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Wi(e.common.issues);return this._error=t,this._error}}};function J(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var Y=class{get description(){return this._def.description}_getType(e){return Ui(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ui(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yi,ctx:{common:e.parent.common,data:e.data,parsedType:Ui(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ta(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ui(e)},r=this._parseSync({data:e,path:n.path,parent:n});return ra(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ui(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return ea(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>ea(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ui(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(ta(r)?r:Promise.resolve(r));return ra(n,i)}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:W.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ao({schema:this,typeName:X.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return oo.create(this,this._def)}nullable(){return so.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ba.create(this)}promise(){return io.create(this,this._def)}or(e){return Ua.create([this,e],this._def)}and(e){return qa.create(this,e,this._def)}transform(e){return new ao({...J(this._def),schema:this,typeName:X.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new co({...J(this._def),innerType:this,defaultValue:t,typeName:X.ZodDefault})}brand(){return new fo({typeName:X.ZodBranded,type:this,...J(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new lo({...J(this._def),innerType:this,catchValue:t,typeName:X.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return po.create(this,e)}readonly(){return mo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const ia=/^c[^\s-]{8,}$/i,aa=/^[0-9a-z]+$/,oa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sa=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ca=/^[a-z0-9_-]{21}$/i,la=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ua=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,da=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let fa;const pa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ma=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ha=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ga=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_a=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,va=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ya=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,ba=RegExp(`^${ya}$`);function xa(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Sa(e){return RegExp(`^${xa(e)}$`)}function Ca(e){let t=`${ya}T${xa(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function wa(e,t){return!((t!==`v4`&&t||!pa.test(e))&&(t!==`v6`&&t||!ha.test(e)))}function Ta(e,t){if(!la.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ea(e,t){return!((t!==`v4`&&t||!ma.test(e))&&(t!==`v6`&&t||!ga.test(e)))}var Da=class e extends Y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.string,received:t.parsedType}),K}let t=new Yi,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?G(n,{code:W.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&G(n,{code:W.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)da.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`email`,code:W.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)fa||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),fa.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`emoji`,code:W.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)sa.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`uuid`,code:W.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ca.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`nanoid`,code:W.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ia.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`cuid`,code:W.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)aa.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`cuid2`,code:W.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)oa.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`ulid`,code:W.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),G(n,{validation:`url`,code:W.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`regex`,code:W.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Ca(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?ba.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?Sa(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?ua.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`duration`,code:W.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?wa(e.data,r.version)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`ip`,code:W.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Ta(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`jwt`,code:W.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Ea(e.data,r.version)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`cidr`,code:W.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?_a.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`base64`,code:W.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?va.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:`base64url`,code:W.invalid_string,message:r.message}),t.dirty()):H.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:W.invalid_string,...q.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...q.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...q.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...q.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...q.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...q.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...q.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...q.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...q.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...q.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...q.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...q.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...q.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...q.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...q.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...q.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...q.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...q.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...q.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...q.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...q.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...q.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...q.errToObj(t)})}nonempty(e){return this.min(1,q.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Da.create=e=>new Da({checks:[],typeName:X.ZodString,coerce:e?.coerce??!1,...J(e)});function Oa(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var ka=class e extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==U.number){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.number,received:t.parsedType}),K}let t,n=new Yi;for(let r of this._def.checks)r.kind===`int`?H.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Oa(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_finite,message:r.message}),n.dirty()):H.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,q.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,q.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,q.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,q.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:q.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:q.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:q.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:q.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:q.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:q.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&H.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};ka.create=e=>new ka({checks:[],typeName:X.ZodNumber,coerce:e?.coerce||!1,...J(e)});var Aa=class e extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==U.bigint)return this._getInvalidInput(e);let t,n=new Yi;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):H.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.bigint,received:t.parsedType}),K}gte(e,t){return this.setLimit(`min`,e,!0,q.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,q.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,q.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,q.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:q.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:q.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Aa.create=e=>new Aa({checks:[],typeName:X.ZodBigInt,coerce:e?.coerce??!1,...J(e)});var ja=class extends Y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.boolean,received:t.parsedType}),K}return Zi(e.data)}};ja.create=e=>new ja({typeName:X.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var Ma=class e extends Y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.date,received:t.parsedType}),K}if(Number.isNaN(e.data.getTime()))return G(this._getOrReturnCtx(e),{code:W.invalid_date}),K;let t=new Yi,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):H.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:q.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:q.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Ma.create=e=>new Ma({checks:[],coerce:e?.coerce||!1,typeName:X.ZodDate,...J(e)});var Na=class extends Y{_parse(e){if(this._getType(e)!==U.symbol){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.symbol,received:t.parsedType}),K}return Zi(e.data)}};Na.create=e=>new Na({typeName:X.ZodSymbol,...J(e)});var Pa=class extends Y{_parse(e){if(this._getType(e)!==U.undefined){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.undefined,received:t.parsedType}),K}return Zi(e.data)}};Pa.create=e=>new Pa({typeName:X.ZodUndefined,...J(e)});var Fa=class extends Y{_parse(e){if(this._getType(e)!==U.null){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.null,received:t.parsedType}),K}return Zi(e.data)}};Fa.create=e=>new Fa({typeName:X.ZodNull,...J(e)});var Ia=class extends Y{constructor(){super(...arguments),this._any=!0}_parse(e){return Zi(e.data)}};Ia.create=e=>new Ia({typeName:X.ZodAny,...J(e)});var La=class extends Y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Zi(e.data)}};La.create=e=>new La({typeName:X.ZodUnknown,...J(e)});var Ra=class extends Y{_parse(e){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.never,received:t.parsedType}),K}};Ra.create=e=>new Ra({typeName:X.ZodNever,...J(e)});var za=class extends Y{_parse(e){if(this._getType(e)!==U.undefined){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.void,received:t.parsedType}),K}return Zi(e.data)}};za.create=e=>new za({typeName:X.ZodVoid,...J(e)});var Ba=class e extends Y{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==U.array)return G(t,{code:W.invalid_type,expected:U.array,received:t.parsedType}),K;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(G(t,{code:e?W.too_big:W.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(G(t,{code:W.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(G(t,{code:W.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new na(t,e,t.path,n)))).then(e=>Yi.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new na(t,e,t.path,n)));return Yi.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:q.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:q.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:q.toString(n)}})}nonempty(e){return this.min(1,e)}};Ba.create=(e,t)=>new Ba({type:e,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...J(t)});function Va(e){if(e instanceof Ha){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=oo.create(Va(r))}return new Ha({...e._def,shape:()=>t})}return e instanceof Ba?new Ba({...e._def,type:Va(e.element)}):e instanceof oo?oo.create(Va(e.unwrap())):e instanceof so?so.create(Va(e.unwrap())):e instanceof Ja?Ja.create(e.items.map(e=>Va(e))):e}var Ha=class e extends Y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=H.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==U.object){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.object,received:t.parsedType}),K}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ra&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new na(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ra){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(G(n,{code:W.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new na(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Yi.mergeObjectSync(t,e)):Yi.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return q.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:q.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:X.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of H.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of H.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Va(this)}partial(t){let n={};for(let e of H.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of H.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof oo;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return to(H.objectKeys(this.shape))}};Ha.create=(e,t)=>new Ha({shape:()=>e,unknownKeys:`strip`,catchall:Ra.create(),typeName:X.ZodObject,...J(t)}),Ha.strictCreate=(e,t)=>new Ha({shape:()=>e,unknownKeys:`strict`,catchall:Ra.create(),typeName:X.ZodObject,...J(t)}),Ha.lazycreate=(e,t)=>new Ha({shape:e,unknownKeys:`strip`,catchall:Ra.create(),typeName:X.ZodObject,...J(t)});var Ua=class extends Y{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Wi(e.ctx.common.issues));return G(t,{code:W.invalid_union,unionErrors:n}),K}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Wi(e));return G(t,{code:W.invalid_union,unionErrors:i}),K}}get options(){return this._def.options}};Ua.create=(e,t)=>new Ua({options:e,typeName:X.ZodUnion,...J(t)});const Wa=e=>e instanceof $a?Wa(e.schema):e instanceof ao?Wa(e.innerType()):e instanceof eo?[e.value]:e instanceof no?e.options:e instanceof ro?H.objectValues(e.enum):e instanceof co?Wa(e._def.innerType):e instanceof Pa?[void 0]:e instanceof Fa?[null]:e instanceof oo?[void 0,...Wa(e.unwrap())]:e instanceof so?[null,...Wa(e.unwrap())]:e instanceof fo||e instanceof mo?Wa(e.unwrap()):e instanceof lo?Wa(e._def.innerType):[];var Ga=class e extends Y{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.object)return G(t,{code:W.invalid_type,expected:U.object,received:t.parsedType}),K;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(G(t,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),K)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Wa(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:X.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...J(r)})}};function Ka(e,t){let n=Ui(e),r=Ui(t);if(e===t)return{valid:!0,data:e};if(n===U.object&&r===U.object){let n=H.objectKeys(t),r=H.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ka(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===U.array&&r===U.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ka(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===U.date&&r===U.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var qa=class extends Y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Qi(e)||Qi(r))return K;let i=Ka(e.value,r.value);return i.valid?(($i(e)||$i(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:W.invalid_intersection_types}),K)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};qa.create=(e,t,n)=>new qa({left:e,right:t,typeName:X.ZodIntersection,...J(n)});var Ja=class e extends Y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.array)return G(n,{code:W.invalid_type,expected:U.array,received:n.parsedType}),K;if(n.data.length<this._def.items.length)return G(n,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),K;!this._def.rest&&n.data.length>this._def.items.length&&(G(n,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new na(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Yi.mergeArray(t,e)):Yi.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ja.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Ja({items:e,typeName:X.ZodTuple,rest:null,...J(t)})};var Ya=class e extends Y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.object)return G(n,{code:W.invalid_type,expected:U.object,received:n.parsedType}),K;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new na(n,e,n.path,e)),value:a._parse(new na(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Yi.mergeObjectAsync(t,r):Yi.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Y?new e({keyType:t,valueType:n,typeName:X.ZodRecord,...J(r)}):new e({keyType:Da.create(),valueType:t,typeName:X.ZodRecord,...J(n)})}},Xa=class extends Y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.map)return G(n,{code:W.invalid_type,expected:U.map,received:n.parsedType}),K;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new na(n,e,n.path,[a,`key`])),value:i._parse(new na(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return K;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return K;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Xa.create=(e,t,n)=>new Xa({valueType:t,keyType:e,typeName:X.ZodMap,...J(n)});var Za=class e extends Y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.set)return G(n,{code:W.invalid_type,expected:U.set,received:n.parsedType}),K;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(G(n,{code:W.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(G(n,{code:W.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return K;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new na(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:q.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:q.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Za.create=(e,t)=>new Za({valueType:e,minSize:null,maxSize:null,typeName:X.ZodSet,...J(t)});var Qa=class e extends Y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.function)return G(t,{code:W.invalid_type,expected:U.function,received:t.parsedType}),K;function n(e,n){return Ji({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qi(),Gi].filter(e=>!!e),issueData:{code:W.invalid_arguments,argumentsError:n}})}function r(e,n){return Ji({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qi(),Gi].filter(e=>!!e),issueData:{code:W.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof io){let e=this;return Zi(async function(...t){let o=new Wi([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return Zi(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Wi([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Wi([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ja.create(t).rest(La.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Ja.create([]).rest(La.create()),returns:n||La.create(),typeName:X.ZodFunction,...J(r)})}},$a=class extends Y{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};$a.create=(e,t)=>new $a({getter:e,typeName:X.ZodLazy,...J(t)});var eo=class extends Y{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return G(t,{received:t.data,code:W.invalid_literal,expected:this._def.value}),K}return{status:`valid`,value:e.data}}get value(){return this._def.value}};eo.create=(e,t)=>new eo({value:e,typeName:X.ZodLiteral,...J(t)});function to(e,t){return new no({values:e,typeName:X.ZodEnum,...J(t)})}var no=class e extends Y{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{expected:H.joinValues(n),received:t.parsedType,code:W.invalid_type}),K}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{received:t.data,code:W.invalid_enum_value,options:n}),K}return Zi(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};no.create=to;var ro=class extends Y{_parse(e){let t=H.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==U.string&&n.parsedType!==U.number){let e=H.objectValues(t);return G(n,{expected:H.joinValues(e),received:n.parsedType,code:W.invalid_type}),K}if(this._cache||=new Set(H.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=H.objectValues(t);return G(n,{received:n.data,code:W.invalid_enum_value,options:e}),K}return Zi(e.data)}get enum(){return this._def.values}};ro.create=(e,t)=>new ro({values:e,typeName:X.ZodNativeEnum,...J(t)});var io=class extends Y{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.promise&&t.common.async===!1)return G(t,{code:W.invalid_type,expected:U.promise,received:t.parsedType}),K;let n=t.parsedType===U.promise?t.data:Promise.resolve(t.data);return Zi(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};io.create=(e,t)=>new io({type:e,typeName:X.ZodPromise,...J(t)});var ao=class extends Y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{G(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return K;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?K:r.status===`dirty`||t.value===`dirty`?Xi(r.value):r});{if(t.value===`aborted`)return K;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?K:r.status===`dirty`||t.value===`dirty`?Xi(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?K:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?K:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ea(e))return K;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>ea(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):K)}H.assertNever(r)}};ao.create=(e,t,n)=>new ao({schema:e,typeName:X.ZodEffects,effect:t,...J(n)}),ao.createWithPreprocess=(e,t,n)=>new ao({schema:t,effect:{type:`preprocess`,transform:e},typeName:X.ZodEffects,...J(n)});var oo=class extends Y{_parse(e){return this._getType(e)===U.undefined?Zi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};oo.create=(e,t)=>new oo({innerType:e,typeName:X.ZodOptional,...J(t)});var so=class extends Y{_parse(e){return this._getType(e)===U.null?Zi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};so.create=(e,t)=>new so({innerType:e,typeName:X.ZodNullable,...J(t)});var co=class extends Y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===U.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};co.create=(e,t)=>new co({innerType:e,typeName:X.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...J(t)});var lo=class extends Y{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ta(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Wi(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Wi(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};lo.create=(e,t)=>new lo({innerType:e,typeName:X.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...J(t)});var uo=class extends Y{_parse(e){if(this._getType(e)!==U.nan){let t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:U.nan,received:t.parsedType}),K}return{status:`valid`,value:e.data}}};uo.create=e=>new uo({typeName:X.ZodNaN,...J(e)});var fo=class extends Y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},po=class e extends Y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?K:e.status===`dirty`?(t.dirty(),Xi(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?K:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:X.ZodPipeline})}},mo=class extends Y{_parse(e){let t=this._def.innerType._parse(e),n=e=>(ea(e)&&(e.value=Object.freeze(e.value)),e);return ta(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};mo.create=(e,t)=>new mo({innerType:e,typeName:X.ZodReadonly,...J(t)}),Ha.lazycreate;var X;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(X||={});const ho=Da.create;ka.create,uo.create,Aa.create;const go=ja.create;Ma.create,Na.create,Pa.create,Fa.create,Ia.create,La.create,Ra.create,za.create,Ba.create,Ha.create,Ha.strictCreate,Ua.create,Ga.create,qa.create,Ja.create,Ya.create,Xa.create,Za.create,Qa.create,$a.create,eo.create;const _o=no.create;ro.create,io.create,ao.create;const Z=oo.create;so.create,ao.createWithPreprocess,po.create;function vo(e){return e.shape}function yo(e){return e&&e.element}function bo(e){return!!e&&e.isOptional()}function xo(e){return To(e,`ZodBoolean`)}function So(e){return To(e,`ZodNumber`)}function Co(e){return To(e,`ZodString`)}function wo(e){return To(e,`ZodEnum`)}function To(e,t){return Object.getPrototypeOf(e).constructor.name===t}const Eo={type:Z(_o([`toon`,`text`,`json`])),description:`Output format: 'toon' for agents, 'text' for humans, 'json' to pipe`,default:`toon`};function Do(e){return/["\\,]|^\s|\s$/.test(e)?JSON.stringify(e):e}function Oo(e,t){return`${e}[${t.length}]: ${t.map(Do).join(`,`)}`}function ko(e,t,n){return[`${e}[${n.length}]{${t.join(`,`)}}:`,...n.map(e=>` ${e.map(Do).join(`,`)}`)]}function Ao(e){return`help[1]: ${e}`}function jo(e,{noun:t,plural:n},r,i,a){if(r.length===0){e.info(`no ${t} with keywords: ${a.join(`, `)}`);return}if(r.length===1){e.info(`found one ${t}: ${i(r[0])}`);return}e.info(`found the following ${n}:`),e.info(``),r.forEach(t=>{e.info(` ${i(t)}`)})}var Mo=O((e=>{var t=A(`path`),n=process.platform===`win32`,r=A(`fs`),i=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function a(){var e;if(i){var t=Error();e=n}else e=r;return e;function n(e){e&&(t.message=e.message,e=t,r(e))}function r(e){if(e){if(process.throwDeprecation)throw e;if(!process.noDeprecation){var t=`fs: missing callback `+(e.stack||e.message);process.traceDeprecation?console.trace(t):console.error(t)}}}}function o(e){return typeof e==`function`?e:a()}if(t.normalize,n)var s=/(.*?)(?:[\/\\]+|$)/g;else var s=/(.*?)(?:[\/]+|$)/g;if(n)var c=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else var c=/^[\/]*/;e.realpathSync=function(e,i){if(e=t.resolve(e),i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];var a=e,o={},l={},u,d,f,p;m();function m(){var t=c.exec(e);u=t[0].length,d=t[0],f=t[0],p=``,n&&!l[f]&&(r.lstatSync(f),l[f]=!0)}for(;u<e.length;){s.lastIndex=u;var h=s.exec(e);if(p=d,d+=h[0],f=p+h[1],u=s.lastIndex,!(l[f]||i&&i[f]===f)){var g;if(i&&Object.prototype.hasOwnProperty.call(i,f))g=i[f];else{var _=r.lstatSync(f);if(!_.isSymbolicLink()){l[f]=!0,i&&(i[f]=f);continue}var v=null;if(!n){var y=_.dev.toString(32)+`:`+_.ino.toString(32);o.hasOwnProperty(y)&&(v=o[y])}v===null&&(r.statSync(f),v=r.readlinkSync(f)),g=t.resolve(p,v),i&&(i[f]=g),n||(o[y]=v)}e=t.resolve(g,e.slice(u)),m()}}return i&&(i[a]=e),e},e.realpath=function(e,i,a){if(typeof a!=`function`&&(a=o(i),i=null),e=t.resolve(e),i&&Object.prototype.hasOwnProperty.call(i,e))return process.nextTick(a.bind(null,null,i[e]));var l=e,u={},d={},f,p,m,h;g();function g(){var t=c.exec(e);f=t[0].length,p=t[0],m=t[0],h=``,n&&!d[m]?r.lstat(m,function(e){if(e)return a(e);d[m]=!0,_()}):process.nextTick(_)}function _(){if(f>=e.length)return i&&(i[l]=e),a(null,e);s.lastIndex=f;var t=s.exec(e);return h=p,p+=t[0],m=h+t[1],f=s.lastIndex,d[m]||i&&i[m]===m?process.nextTick(_):i&&Object.prototype.hasOwnProperty.call(i,m)?b(i[m]):r.lstat(m,v)}function v(e,t){if(e)return a(e);if(!t.isSymbolicLink())return d[m]=!0,i&&(i[m]=m),process.nextTick(_);if(!n){var o=t.dev.toString(32)+`:`+t.ino.toString(32);if(u.hasOwnProperty(o))return y(null,u[o],m)}r.stat(m,function(e){if(e)return a(e);r.readlink(m,function(e,t){n||(u[o]=t),y(e,t)})})}function y(e,n,r){if(e)return a(e);var o=t.resolve(h,n);i&&(i[r]=o),b(o)}function b(n){e=t.resolve(n,e.slice(f)),g()}}})),No=O(((e,t)=>{t.exports=l,l.realpath=l,l.sync=u,l.realpathSync=u,l.monkeypatch=d,l.unmonkeypatch=f;var n=A(`fs`),r=n.realpath,i=n.realpathSync,a=process.version,o=/^v[0-5]\./.test(a),s=Mo();function c(e){return e&&e.syscall===`realpath`&&(e.code===`ELOOP`||e.code===`ENOMEM`||e.code===`ENAMETOOLONG`)}function l(e,t,n){if(o)return r(e,t,n);typeof t==`function`&&(n=t,t=null),r(e,t,function(r,i){c(r)?s.realpath(e,t,n):n(r,i)})}function u(e,t){if(o)return i(e,t);try{return i(e,t)}catch(n){if(c(n))return s.realpathSync(e,t);throw n}}function d(){n.realpath=l,n.realpathSync=u}function f(){n.realpath=r,n.realpathSync=i}})),Po=O(((e,t)=>{t.exports=function(e,t){for(var r=[],i=0;i<e.length;i++){var a=t(e[i],i);n(a)?r.push.apply(r,a):r.push(a)}return r};var n=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`}})),Fo=O(((e,t)=>{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),Io=O(((e,t)=>{Po();var n=Fo();t.exports=m;var r=`\0SLASH`+Math.random()+`\0`,i=`\0OPEN`+Math.random()+`\0`,a=`\0CLOSE`+Math.random()+`\0`,o=`\0COMMA`+Math.random()+`\0`,s=`\0PERIOD`+Math.random()+`\0`,c=1e5,l=4e6;function u(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function d(e){return e.split(`\\\\`).join(r).split(`\\{`).join(i).split(`\\}`).join(a).split(`\\,`).join(o).split(`\\.`).join(s)}function f(e){return e.split(r).join(`\\`).split(i).join(`{`).split(a).join(`}`).split(o).join(`,`).split(s).join(`.`)}function p(e){if(!e)return[``];var t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);var i=r.pre,a=r.body,o=r.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=p(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function m(e,t){if(!e)return[];t||={};var n=t.max==null?c:t.max,r=t.maxLength==null?l:t.maxLength;return e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),x(d(e),n,r,!0).map(f)}function h(e){return`{`+e+`}`}function g(e){return/^-?0\d/.test(e)}function _(e,t){return e<=t}function v(e,t){return e>=t}function y(e,t,n,r,i,a,o,s){for(var c=[],l=0,u=0;u<e.length;u++)for(var d=0;d<r.length;d++){if(c.length>=i)return c;var f=e[u]+n+r[d];if(!(o&&f.length===t[u])){if(l+f.length>a)return c;c.push(f),s.push(t[u]),l+=f.length}}return c}function b(e,t,n,r){var i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;var o=u(i[0]),s=u(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(u(i[2])),1):1,d=_;s<o&&(l*=-1,d=v);for(var f=i.some(g),p=0,m=o;d(m,s)&&a.length<n;m+=l){var h;if(t)h=String.fromCharCode(m),h===`\\`&&(h=``);else if(h=String(m),f){var y=c-h.length;if(y>0){var b=Array(y+1).join(`0`);h=m<0?`-`+b+h.slice(1):b+h}}if(p+h.length>r)break;a.push(h),p+=h.length}return a}function x(e,t,r,i){for(var o=[``],s=[0],c=!1,l=!0,u;;){var d=n(`{`,`}`,e);if(!d)return y(o,s,e,[``],t,r,c,[]);var f=d.pre;if(/\$$/.test(f))return y(o,s,e,[``],t,r,c,[]);var m=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),_=m||g,v=d.body.indexOf(`,`)>=0;if(!_&&!v){if(d.post.match(/,(?!,).*\}/)){e=d.pre+`{`+d.body+a+d.post,i=!0,l=!0,c=!1,s=[];for(var S=0;S<o.length;S++)s.push(o[S].length);continue}return y(o,s,f+`{`+d.body+`}`+d.post,[``],t,r,c,[])}l&&=(c=i&&!_,!1);var C;if(_)C=b(d.body,g,t,r);else{var w=p(d.body);if(w.length===1&&w[0]!==void 0&&(w=x(w[0],t,r,!1).map(h),w.length===1)){if(u=[],o=y(o,s,f+w[0],[``],t,r,c&&!d.post.length,u),s=u,!d.post.length)break;e=d.post;continue}for(var T=c&&!d.post.length&&!f,E=0;T&&E<o.length;E++)o[E].length!==s[E]&&(T=!1);C=[];var ee=0;outer:for(var te=0;te<w.length;te++)for(var ne=x(w[te],t,r,!1),re=0;re<ne.length;re++){var ie=ne[re];if(!T||ie){if(C.length>=t||ee+ie.length>r)break outer;C.push(ie),ee+=ie.length}}}if(u=[],o=y(o,s,f,C,t,r,c&&!d.post.length,u),s=u,!d.post.length)break;e=d.post}return o}})),Lo=O(((e,t)=>{t.exports=h,h.Minimatch=g;var n=function(){try{return A(`path`)}catch{}}()||{sep:`/`};h.sep=n.sep;var r=h.GLOBSTAR=g.GLOBSTAR={},i=Io(),a={"!":{open:`(?:(?!(?:`,close:`))[^/]*?)`},"?":{open:`(?:`,close:`)?`},"+":{open:`(?:`,close:`)+`},"*":{open:`(?:`,close:`)*`},"@":{open:`(?:`,close:`)`}},o=`[^/]`,s=o+`*?`,c=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,l=`(?:(?!(?:\\/|^)\\.).)*?`,u=d(`().*{}+?[]^$\\!`);function d(e){return e.split(``).reduce(function(e,t){return e[t]=!0,e},{})}var f=/\/+/;h.filter=p;function p(e,t){return t||={},function(n,r,i){return h(n,e,t)}}function m(e,t){t||={};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}h.defaults=function(e){if(!e||typeof e!=`object`||!Object.keys(e).length)return h;var t=h,n=function(n,r,i){return t(n,r,m(e,i))};return n.Minimatch=function(n,r){return new t.Minimatch(n,m(e,r))},n.Minimatch.defaults=function(n){return t.defaults(m(e,n)).Minimatch},n.filter=function(n,r){return t.filter(n,m(e,r))},n.defaults=function(n){return t.defaults(m(e,n))},n.makeRe=function(n,r){return t.makeRe(n,m(e,r))},n.braceExpand=function(n,r){return t.braceExpand(n,m(e,r))},n.match=function(n,r,i){return t.match(n,r,m(e,i))},n},g.defaults=function(e){return h.defaults(e).Minimatch};function h(e,t,n){return x(t),n||={},!n.nocomment&&t.charAt(0)===`#`?!1:new g(t,n).match(e)}function g(e,t){if(!(this instanceof g))return new g(e,t);x(e),t||={},e=e.trim(),!t.allowWindowsEscape&&n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion===void 0?200:t.maxGlobstarRecursion,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}g.prototype.debug=function(){},g.prototype.make=_;function _(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(f)}),this.debug(this.pattern,n),n=n.map(function(e,t,n){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return e.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}g.prototype.parseNegate=v;function v(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,a=e.length;i<a&&e.charAt(i)===`!`;i++)t=!t,r++;r&&(this.pattern=e.substr(r)),this.negate=t}}h.braceExpand=function(e,t){return y(e,t)},g.prototype.braceExpand=y;function y(e,t){return t||=this instanceof g?this.options:{},e=e===void 0?this.pattern:e,x(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:i(e)}var b=65536,x=function(e){if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>b)throw TypeError(`pattern is too long`)};g.prototype.parse=C;var S={};function C(e,t){x(e);var n=this.options;if(e===`**`){if(n.noglobstar)e=`*`;else return r}if(e===``)return``;var i=``,c=!!n.nocase,l=!1,d=[],f=[],p,m=!1,h=-1,g=-1,_=e.charAt(0)===`.`?``:n.dot?`(?!(?:^|\\/)\\.{1,2}(?:$|\\/))`:`(?!\\.)`,v=this;function y(){if(p){switch(p){case`*`:i+=s,c=!0;break;case`?`:i+=o,c=!0;break;default:i+=`\\`+p}v.debug(`clearStateChar %j %j`,p,i),p=!1}}for(var b=0,C=e.length,w;b<C&&(w=e.charAt(b));b++){if(this.debug(`%s %s %s %j`,e,b,i,w),l&&u[w]){i+=`\\`+w,l=!1;continue}switch(w){case`/`:return!1;case`\\`:y(),l=!0;continue;case`?`:case`*`:case`+`:case`@`:case`!`:if(this.debug(`%s %s %s %j <-- stateChar`,e,b,i,w),m){this.debug(` in class`),w===`!`&&b===g+1&&(w=`^`),i+=w;continue}if(w===`*`&&p===`*`)continue;v.debug(`call clearStateChar %j`,p),y(),p=w,n.noext&&y();continue;case`(`:if(m){i+=`(`;continue}if(!p){i+=`\\(`;continue}d.push({type:p,start:b-1,reStart:i.length,open:a[p].open,close:a[p].close}),i+=p===`!`?`(?:(?!(?:`:`(?:`,this.debug(`plType %j %j`,p,i),p=!1;continue;case`)`:if(m||!d.length){i+=`\\)`;continue}y(),c=!0;var E=d.pop();i+=E.close,E.type===`!`&&f.push(E),E.reEnd=i.length;continue;case`|`:if(m||!d.length||l){i+=`\\|`,l=!1;continue}y(),i+=`|`;continue;case`[`:if(y(),m){i+=`\\`+w;continue}m=!0,g=b,h=i.length,i+=w;continue;case`]`:if(b===g+1||!m){i+=`\\`+w,l=!1;continue}var ee=e.substring(g+1,b);try{RegExp(`[`+ee+`]`)}catch{var te=this.parse(ee,S);i=i.substr(0,h)+`\\[`+te[0]+`\\]`,c||=te[1],m=!1;continue}c=!0,m=!1,i+=w;continue;default:y(),l?l=!1:u[w]&&!(w===`^`&&m)&&(i+=`\\`),i+=w}}for(m&&(ee=e.substr(g+1),te=this.parse(ee,S),i=i.substr(0,h)+`\\[`+te[0],c||=te[1]),E=d.pop();E;E=d.pop()){var ne=i.slice(E.reStart+E.open.length);this.debug(`setting tail`,i,E),ne=ne.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,n){return n||=`\\`,t+t+n+`|`}),this.debug(`tail=%j
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof p))return new p(e,t);if(c(this,e,t),this.noprocess)return this;var n=this.minimatch.set.length;this.matches=Array(n);for(var r=0;r<n;r++)this._process(this.minimatch.set[r],r,!1);this._finish()}p.prototype._finish=function(){if(a.ok(this instanceof p),this.realpath){var e=this;this.matches.forEach(function(t,r){var i=e.matches[r]=Object.create(null);for(var a in t)try{a=e._makeAbs(a);var o=n.realpathSync(a,e.realpathCache);i[o]=!0}catch(t){if(t.syscall===`stat`)i[e._makeAbs(a)]=!0;else throw t}})}s.finish(this)},p.prototype._process=function(e,t,n){a.ok(this instanceof p);for(var i=0;typeof e[i]==`string`;)i++;var s;switch(i){case e.length:this._processSimple(e.join(`/`),t);return;case 0:s=null;break;default:s=e.slice(0,i).join(`/`)}var c=e.slice(i),l;s===null?l=`.`:((o(s)||o(e.map(function(e){return typeof e==`string`?e:`[*]`}).join(`/`)))&&(!s||!o(s))&&(s=`/`+s),l=s);var d=this._makeAbs(l);u(this,l)||(c[0]===r.GLOBSTAR?this._processGlobStar(s,l,d,c,t,n):this._processReaddir(s,l,d,c,t,n))},p.prototype._processReaddir=function(e,t,n,r,a,o){var s=this._readdir(n,o);if(s){for(var c=r[0],l=!!this.minimatch.negate,u=c._glob,d=this.dot||u.charAt(0)===`.`,f=[],p=0;p<s.length;p++){var m=s[p];(m.charAt(0)!==`.`||d)&&(l&&!e?!m.match(c):m.match(c))&&f.push(m)}var h=f.length;if(h!==0){if(r.length===1&&!this.mark&&!this.stat){this.matches[a]||(this.matches[a]=Object.create(null));for(var p=0;p<h;p++){var m=f[p];e&&(m=e.slice(-1)===`/`?e+m:e+`/`+m),m.charAt(0)===`/`&&!this.nomount&&(m=i.join(this.root,m)),this._emitMatch(a,m)}return}r.shift();for(var p=0;p<h;p++){var m=f[p],g=e?[e,m]:[m];this._process(g.concat(r),a,o)}}}},p.prototype._emitMatch=function(e,t){if(!d(this,t)){var n=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=n),!this.matches[e][t]){if(this.nodir){var r=this.cache[n];if(r===`DIR`||Array.isArray(r))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}},p.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,n;try{n=this.fs.lstatSync(e)}catch(e){if(e.code===`ENOENT`)return null}var r=n&&n.isSymbolicLink();return this.symlinks[e]=r,!r&&n&&!n.isDirectory()?this.cache[e]=`FILE`:t=this._readdir(e,!1),t},p.prototype._readdir=function(e,t){if(t&&!l(this.symlinks,e))return this._readdirInGlobStar(e);if(l(this.cache,e)){var n=this.cache[e];if(!n||n===`FILE`)return null;if(Array.isArray(n))return n}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(t){return this._readdirError(e,t),null}},p.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var n=0;n<t.length;n++){var r=t[n];r=e===`/`?e+r:e+`/`+r,this.cache[r]=!0}return this.cache[e]=t,t},p.prototype._readdirError=function(e,t){switch(t.code){case`ENOTSUP`:case`ENOTDIR`:var n=this._makeAbs(e);if(this.cache[n]=`FILE`,n===this.cwdAbs){var r=Error(t.code+` invalid cwd `+this.cwd);throw r.path=this.cwd,r.code=t.code,r}break;case`ENOENT`:case`ELOOP`:case`ENAMETOOLONG`:case`UNKNOWN`:this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error(`glob error`,t)}},p.prototype._processGlobStar=function(e,t,n,r,i,a){var o=this._readdir(n,a);if(o){var s=r.slice(1),c=e?[e]:[],l=c.concat(s);this._process(l,i,!1);var u=o.length;if(!(this.symlinks[n]&&a)){for(var d=0;d<u;d++)if(o[d].charAt(0)!==`.`||this.dot){var f=c.concat(o[d],s);this._process(f,i,!0);var p=c.concat(o[d],r);this._process(p,i,!0)}}}},p.prototype._processSimple=function(e,t){var n=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),n){if(e&&o(e)&&!this.nomount){var r=/[\/\\]$/.test(e);e.charAt(0)===`/`?e=i.join(this.root,e):(e=i.resolve(this.root,e),r&&(e+=`/`))}process.platform===`win32`&&(e=e.replace(/\\/g,`/`)),this._emitMatch(t,e)}},p.prototype._stat=function(e){var t=this._makeAbs(e),n=e.slice(-1)===`/`;if(e.length>this.maxLength)return!1;if(!this.stat&&l(this.cache,t)){var r=this.cache[t];if(Array.isArray(r)&&(r=`DIR`),!n||r===`DIR`)return r;if(n&&r===`FILE`)return!1}var i=this.statCache[t];if(!i){var a;try{a=this.fs.lstatSync(t)}catch(e){if(e&&(e.code===`ENOENT`||e.code===`ENOTDIR`))return this.statCache[t]=!1,!1}if(a&&a.isSymbolicLink())try{i=this.fs.statSync(t)}catch{i=a}else i=a}this.statCache[t]=i;var r=!0;return i&&(r=i.isDirectory()?`DIR`:`FILE`),this.cache[t]=this.cache[t]||r,n&&r===`FILE`?!1:r},p.prototype._mark=function(e){return s.mark(this,e)},p.prototype._makeAbs=function(e){return s.makeAbs(this,e)}})),Uo=O(((e,t)=>{t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){r[t]=e[t]}),r;function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),Wo=O(((e,t)=>{var n=Uo();t.exports=n(r),t.exports.strict=n(i),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})});function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,t.called=!1,t}})),Go=O(((e,t)=>{var n=Uo(),r=Object.create(null),i=Wo();t.exports=n(a);function a(e,t){return r[e]?(r[e].push(t),null):(r[e]=[t],o(e))}function o(e){return i(function t(){var n=r[e],i=n.length,a=s(arguments);try{for(var o=0;o<i;o++)n[o].apply(null,a)}finally{n.length>i?(n.splice(0,i),process.nextTick(function(){t.apply(null,a)})):delete r[e]}})}function s(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r]=e[r];return n}})),Ko=O(((e,t)=>{t.exports=_;var n=No(),r=Lo();r.Minimatch;var i=zo(),a=A(`events`).EventEmitter,o=A(`path`),s=A(`assert`),c=Bo(),l=Ho(),u=Vo(),d=u.setopts,f=u.ownProp,p=Go();A(`util`);var m=u.childrenIgnored,h=u.isIgnored,g=Wo();function _(e,t,n){if(typeof t==`function`&&(n=t,t={}),t||={},t.sync){if(n)throw TypeError(`callback provided to sync glob`);return l(e,t)}return new b(e,t,n)}_.sync=l;var v=_.GlobSync=l.GlobSync;_.glob=_;function y(e,t){if(typeof t!=`object`||!t)return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}_.hasMagic=function(e,t){var n=y({},t);n.noprocess=!0;var r=new b(e,n).minimatch.set;if(!e)return!1;if(r.length>1)return!0;for(var i=0;i<r[0].length;i++)if(typeof r[0][i]!=`string`)return!0;return!1},_.Glob=b,i(b,a);function b(e,t,n){if(typeof t==`function`&&(n=t,t=null),t&&t.sync){if(n)throw TypeError(`callback provided to sync glob`);return new v(e,t)}if(!(this instanceof b))return new b(e,t,n);d(this,e,t),this._didRealPath=!1;var r=this.minimatch.set.length;this.matches=Array(r),typeof n==`function`&&(n=g(n),this.on(`error`,n),this.on(`end`,function(e){n(null,e)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(r===0)return s();for(var a=!0,o=0;o<r;o++)this._process(this.minimatch.set[o],o,!1,s);a=!1;function s(){--i._processing,i._processing<=0&&(a?process.nextTick(function(){i._finish()}):i._finish())}}b.prototype._finish=function(){if(s(this instanceof b),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();u.finish(this),this.emit(`end`,this.found)}},b.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,n=0;n<this.matches.length;n++)this._realpathSet(n,r);function r(){--e===0&&t._finish()}},b.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var i=Object.keys(r),a=this,o=i.length;if(o===0)return t();var s=this.matches[e]=Object.create(null);i.forEach(function(r,i){r=a._makeAbs(r),n.realpath(r,a.realpathCache,function(n,i){n?n.syscall===`stat`?s[r]=!0:a.emit(`error`,n):s[i]=!0,--o===0&&(a.matches[e]=s,t())})})},b.prototype._mark=function(e){return u.mark(this,e)},b.prototype._makeAbs=function(e){return u.makeAbs(this,e)},b.prototype.abort=function(){this.aborted=!0,this.emit(`abort`)},b.prototype.pause=function(){this.paused||(this.paused=!0,this.emit(`pause`))},b.prototype.resume=function(){if(this.paused){if(this.emit(`resume`),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var n=e[t];this._emitMatch(n[0],n[1])}}if(this._processQueue.length){var r=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<r.length;t++){var i=r[t];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}},b.prototype._process=function(e,t,n,i){if(s(this instanceof b),s(typeof i==`function`),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,n,i]);return}for(var a=0;typeof e[a]==`string`;)a++;var o;switch(a){case e.length:this._processSimple(e.join(`/`),t,i);return;case 0:o=null;break;default:o=e.slice(0,a).join(`/`)}var l=e.slice(a),u;o===null?u=`.`:((c(o)||c(e.map(function(e){return typeof e==`string`?e:`[*]`}).join(`/`)))&&(!o||!c(o))&&(o=`/`+o),u=o);var d=this._makeAbs(u);if(m(this,u))return i();l[0]===r.GLOBSTAR?this._processGlobStar(o,u,d,l,t,n,i):this._processReaddir(o,u,d,l,t,n,i)}},b.prototype._processReaddir=function(e,t,n,r,i,a,o){var s=this;this._readdir(n,a,function(c,l){return s._processReaddir2(e,t,n,r,i,a,l,o)})},b.prototype._processReaddir2=function(e,t,n,r,i,a,s,c){if(!s)return c();for(var l=r[0],u=!!this.minimatch.negate,d=l._glob,f=this.dot||d.charAt(0)===`.`,p=[],m=0;m<s.length;m++){var h=s[m];(h.charAt(0)!==`.`||f)&&(u&&!e?!h.match(l):h.match(l))&&p.push(h)}var g=p.length;if(g===0)return c();if(r.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var m=0;m<g;m++){var h=p[m];e&&(h=e===`/`?e+h:e+`/`+h),h.charAt(0)===`/`&&!this.nomount&&(h=o.join(this.root,h)),this._emitMatch(i,h)}return c()}r.shift();for(var m=0;m<g;m++){var h=p[m];e&&(h=e===`/`?e+h:e+`/`+h),this._process([h].concat(r),i,a,c)}c()},b.prototype._emitMatch=function(e,t){if(!this.aborted&&!h(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var n=c(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=n),!this.matches[e][t]){if(this.nodir){var r=this.cache[n];if(r===`DIR`||Array.isArray(r))return}this.matches[e][t]=!0;var i=this.statCache[n];i&&this.emit(`stat`,t,i),this.emit(`match`,t)}}},b.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var n=`lstat\0`+e,r=this,i=p(n,a);i&&r.fs.lstat(e,i);function a(n,i){if(n&&n.code===`ENOENT`)return t();var a=i&&i.isSymbolicLink();r.symlinks[e]=a,!a&&i&&!i.isDirectory()?(r.cache[e]=`FILE`,t()):r._readdir(e,!1,t)}},b.prototype._readdir=function(e,t,n){if(!this.aborted&&(n=p(`readdir\0`+e+`\0`+t,n),n)){if(t&&!f(this.symlinks,e))return this._readdirInGlobStar(e,n);if(f(this.cache,e)){var r=this.cache[e];if(!r||r===`FILE`)return n();if(Array.isArray(r))return n(null,r)}this.fs.readdir(e,x(this,e,n))}};function x(e,t,n){return function(r,i){r?e._readdirError(t,r,n):e._readdirEntries(t,i,n)}}b.prototype._readdirEntries=function(e,t,n){if(!this.aborted){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var i=t[r];i=e===`/`?e+i:e+`/`+i,this.cache[i]=!0}return this.cache[e]=t,n(null,t)}},b.prototype._readdirError=function(e,t,n){if(!this.aborted){switch(t.code){case`ENOTSUP`:case`ENOTDIR`:var r=this._makeAbs(e);if(this.cache[r]=`FILE`,r===this.cwdAbs){var i=Error(t.code+` invalid cwd `+this.cwd);i.path=this.cwd,i.code=t.code,this.emit(`error`,i),this.abort()}break;case`ENOENT`:case`ELOOP`:case`ENAMETOOLONG`:case`UNKNOWN`:this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit(`error`,t),this.abort()),this.silent||console.error(`glob error`,t)}return n()}},b.prototype._processGlobStar=function(e,t,n,r,i,a,o){var s=this;this._readdir(n,a,function(c,l){s._processGlobStar2(e,t,n,r,i,a,l,o)})},b.prototype._processGlobStar2=function(e,t,n,r,i,a,o,s){if(!o)return s();var c=r.slice(1),l=e?[e]:[],u=l.concat(c);this._process(u,i,!1,s);var d=this.symlinks[n],f=o.length;if(d&&a)return s();for(var p=0;p<f;p++)if(o[p].charAt(0)!==`.`||this.dot){var m=l.concat(o[p],c);this._process(m,i,!0,s);var h=l.concat(o[p],r);this._process(h,i,!0,s)}s()},b.prototype._processSimple=function(e,t,n){var r=this;this._stat(e,function(i,a){r._processSimple2(e,t,i,a,n)})},b.prototype._processSimple2=function(e,t,n,r,i){if(this.matches[t]||(this.matches[t]=Object.create(null)),!r)return i();if(e&&c(e)&&!this.nomount){var a=/[\/\\]$/.test(e);e.charAt(0)===`/`?e=o.join(this.root,e):(e=o.resolve(this.root,e),a&&(e+=`/`))}process.platform===`win32`&&(e=e.replace(/\\/g,`/`)),this._emitMatch(t,e),i()},b.prototype._stat=function(e,t){var n=this._makeAbs(e),r=e.slice(-1)===`/`;if(e.length>this.maxLength)return t();if(!this.stat&&f(this.cache,n)){var i=this.cache[n];if(Array.isArray(i)&&(i=`DIR`),!r||i===`DIR`)return t(null,i);if(r&&i===`FILE`)return t()}var a=this.statCache[n];if(a!==void 0){if(a===!1)return t(null,a);var o=a.isDirectory()?`DIR`:`FILE`;return r&&o===`FILE`?t():t(null,o,a)}var s=this,c=p(`stat\0`+n,l);c&&s.fs.lstat(n,c);function l(r,i){if(i&&i.isSymbolicLink())return s.fs.stat(n,function(r,a){r?s._stat2(e,n,null,i,t):s._stat2(e,n,r,a,t)});s._stat2(e,n,r,i,t)}},b.prototype._stat2=function(e,t,n,r,i){if(n&&(n.code===`ENOENT`||n.code===`ENOTDIR`))return this.statCache[t]=!1,i();var a=e.slice(-1)===`/`;if(this.statCache[t]=r,t.slice(-1)===`/`&&r&&!r.isDirectory())return i(null,!1,r);var o=!0;return r&&(o=r.isDirectory()?`DIR`:`FILE`),this.cache[t]=this.cache[t]||o,a&&o===`FILE`?i():i(null,o,r)}})),qo=O(((e,t)=>{t.exports=d,d.sync=_;var n=A(`assert`),r=A(`path`),i=A(`fs`),a=Ko(),o=438,s={nosort:!0,silent:!0},c=0,l=process.platform===`win32`;function u(e){[`unlink`,`chmod`,`stat`,`lstat`,`rmdir`,`readdir`].forEach(function(t){e[t]=e[t]||i[t],t+=`Sync`,e[t]=e[t]||i[t]}),e.maxBusyTries=e.maxBusyTries||3,e.emfileWait=e.emfileWait||1e3,e.glob===!1&&(e.disableGlob=!0),e.disableGlob=e.disableGlob||!1,e.glob=e.glob||s}function d(e,t,r){typeof t==`function`&&(r=t,t={}),n(e,`rimraf: missing path`),n.equal(typeof e,`string`,`rimraf: path should be a string`),n.equal(typeof r,`function`,`rimraf: callback function required`),n(t,`rimraf: invalid options argument provided`),n.equal(typeof t,`object`,`rimraf: options should be object`),u(t);var i=0,o=null,s=0;if(t.disableGlob||!a.hasMagic(e))return d(null,[e]);t.lstat(e,function(n,r){if(!n)return d(null,[e]);a(e,t.glob,d)});function l(e){o||=e,--s===0&&r(o)}function d(e,n){if(e)return r(e);if(s=n.length,s===0)return r();n.forEach(function(e){f(e,t,function n(r){if(r){if((r.code===`EBUSY`||r.code===`ENOTEMPTY`||r.code===`EPERM`)&&i<t.maxBusyTries){i++;var a=i*100;return setTimeout(function(){f(e,t,n)},a)}if(r.code===`EMFILE`&&c<t.emfileWait)return setTimeout(function(){f(e,t,n)},c++);r.code===`ENOENT`&&(r=null)}c=0,l(r)})})}}function f(e,t,r){n(e),n(t),n(typeof r==`function`),t.lstat(e,function(n,i){if(n&&n.code===`ENOENT`)return r(null);if(n&&n.code===`EPERM`&&l&&p(e,t,n,r),i&&i.isDirectory())return h(e,t,n,r);t.unlink(e,function(n){if(n){if(n.code===`ENOENT`)return r(null);if(n.code===`EPERM`)return l?p(e,t,n,r):h(e,t,n,r);if(n.code===`EISDIR`)return h(e,t,n,r)}return r(n)})})}function p(e,t,r,i){n(e),n(t),n(typeof i==`function`),r&&n(r instanceof Error),t.chmod(e,o,function(n){n?i(n.code===`ENOENT`?null:r):t.stat(e,function(n,a){n?i(n.code===`ENOENT`?null:r):a.isDirectory()?h(e,t,r,i):t.unlink(e,i)})})}function m(e,t,r){n(e),n(t),r&&n(r instanceof Error);try{t.chmodSync(e,o)}catch(e){if(e.code===`ENOENT`)return;throw r}try{var i=t.statSync(e)}catch(e){if(e.code===`ENOENT`)return;throw r}i.isDirectory()?v(e,t,r):t.unlinkSync(e)}function h(e,t,r,i){n(e),n(t),r&&n(r instanceof Error),n(typeof i==`function`),t.rmdir(e,function(n){n&&(n.code===`ENOTEMPTY`||n.code===`EEXIST`||n.code===`EPERM`)?g(e,t,i):n&&n.code===`ENOTDIR`?i(r):i(n)})}function g(e,t,i){n(e),n(t),n(typeof i==`function`),t.readdir(e,function(n,a){if(n)return i(n);var o=a.length;if(o===0)return t.rmdir(e,i);var s;a.forEach(function(n){d(r.join(e,n),t,function(n){if(!s){if(n)return i(s=n);--o===0&&t.rmdir(e,i)}})})})}function _(e,t){t||={},u(t),n(e,`rimraf: missing path`),n.equal(typeof e,`string`,`rimraf: path should be a string`),n(t,`rimraf: missing options`),n.equal(typeof t,`object`,`rimraf: options should be object`);var r;if(t.disableGlob||!a.hasMagic(e))r=[e];else try{t.lstatSync(e),r=[e]}catch{r=a.sync(e,t.glob)}if(r.length)for(var i=0;i<r.length;i++){var e=r[i];try{var o=t.lstatSync(e)}catch(n){if(n.code===`ENOENT`)return;n.code===`EPERM`&&l&&m(e,t,n)}try{o&&o.isDirectory()?v(e,t,null):t.unlinkSync(e)}catch(n){if(n.code===`ENOENT`)return;if(n.code===`EPERM`)return l?m(e,t,n):v(e,t,n);if(n.code!==`EISDIR`)throw n;v(e,t,n)}}}function v(e,t,r){n(e),n(t),r&&n(r instanceof Error);try{t.rmdirSync(e)}catch(n){if(n.code===`ENOENT`)return;if(n.code===`ENOTDIR`)throw r;(n.code===`ENOTEMPTY`||n.code===`EEXIST`||n.code===`EPERM`)&&y(e,t)}}function y(e,t){n(e),n(t),t.readdirSync(e).forEach(function(n){_(r.join(e,n),t)});var i=l?100:1,a=0;do{var o=!0;try{var s=t.rmdirSync(e,t);return o=!1,s}finally{if(++a<i&&o)continue}}while(1)}})),Jo=O(((e,t)=>{var n=A(`path`),r=A(`fs`),i=511;t.exports=a.mkdirp=a.mkdirP=a;function a(e,t,o,s){typeof t==`function`?(o=t,t={}):(!t||typeof t!=`object`)&&(t={mode:t});var c=t.mode,l=t.fs||r;c===void 0&&(c=i),s||=null;var u=o||function(){};e=n.resolve(e),l.mkdir(e,c,function(r){if(!r)return s||=e,u(null,s);switch(r.code){case`ENOENT`:if(n.dirname(e)===e)return u(r);a(n.dirname(e),t,function(n,r){n?u(n,r):a(e,t,u,r)});break;default:l.stat(e,function(e,t){e||!t.isDirectory()?u(r,s):u(null,s)})}})}a.sync=function e(t,a,o){(!a||typeof a!=`object`)&&(a={mode:a});var s=a.mode,c=a.fs||r;s===void 0&&(s=i),o||=null,t=n.resolve(t);try{c.mkdirSync(t,s),o||=t}catch(r){switch(r.code){case`ENOENT`:o=e(n.dirname(t),a,o),e(t,a,o);break;default:var l;try{l=c.statSync(t)}catch{throw r}if(!l.isDirectory())throw r}}return o}})),Yo=O(((e,t)=>{let n=A(`fs`),r=A(`path`),i=A(`constants`),a=A(`os`),o=qo(),s=Jo();A(`os`).tmpdir();let c=o.sync,l=r.resolve(a.tmpdir()),u=i.O_CREAT|i.O_TRUNC|i.O_RDWR|i.O_EXCL,d=function(e){if(typeof e==`function`)return[void 0,e];var t;return[new Promise(function(e,n){t=function(){var t=Array.from(arguments),r=t.shift();process.nextTick(function(){r?n(r):t.length===1?e(t[0]):e(t)})}}),t]};var f=function(e,t){var n=p(e,t),i=new Date,a=[n.prefix,i.getFullYear(),i.getMonth(),i.getDate(),`-`,process.pid,`-`,(Math.random()*4294967296+1).toString(36),n.suffix].join(``);return r.join(n.dir||l,a)},p=function(e,t){var n={prefix:null,suffix:null};if(e)switch(typeof e){case`string`:n.prefix=e;break;case`object`:n=e;break;default:throw Error(`Unknown affix declaration: `+n)}else n.prefix=t;return n},m=!1,h=function(e){return m=e!==!1,t.exports},g=!1,_=[],v=[];function y(e){if(!m)return!1;x(),_.push(e)}function b(e){if(!m)return!1;x(),v.push(e)}function x(){if(!m)return!1;g||=(process.addListener(`exit`,function(){try{E()}catch(e){throw console.warn(`Fail to clean temporary files on exit : `,e),e}}),!0)}function S(){if(!m)return!1;for(var e=0,t;(t=_.shift())!==void 0;)c(t,{maxBusyTries:6}),e++;return e}function C(e){var t=d(e),n=t[0];if(e=t[1],!m)return e(Error(`not tracking`)),n;var r=0,i=_.length;if(!i)return e(null,r),n;for(var a,s=function(t){if(i){if(t){e(t),i=0;return}r++,i--,i||e(null,r)}};(a=_.shift())!==void 0;)o(a,{maxBusyTries:6},s);return n}function w(){if(!m)return!1;for(var e=0,t;(t=v.shift())!==void 0;)c(t,{maxBusyTries:6}),e++;return e}function T(e){var t=d(e),n=t[0];if(e=t[1],!m)return e(Error(`not tracking`)),n;var r=0,i=v.length;if(!i)return e(null,r),n;for(var a,s=function(t){if(i){if(t){e(t,r),i=0;return}r++,i--,i||e(null,r)}};(a=v.shift())!==void 0;)o(a,{maxBusyTries:6},s);return n}function E(){return m?{files:S(),dirs:w()}:!1}function ee(e){var t=d(e),n=t[0];return e=t[1],m?(C(function(t,n){t?e(t,{files:n}):T(function(t,r){e(t,{files:n,dirs:r})})}),n):(e(Error(`not tracking`)),n)}e.dir=l,e.track=h,e.mkdir=(e,t)=>{let n=d(t),r=n[0];t=n[1];let i=f(e,`d-`);return s(i,448,e=>{e||b(i),t(e,i)}),r},e.mkdirSync=e=>{let t=f(e,`d-`);return s.sync(t,448),b(t),t},e.open=(e,t)=>{let r=d(t),i=r[0];t=r[1];let a=f(e,`f-`);return n.open(a,u,384,(e,n)=>{e||y(a),t(e,{path:a,fd:n})}),i},e.openSync=e=>{let t=f(e,`f-`),r=n.openSync(t,u,384);return y(t),{path:t,fd:r}},e.path=f,e.cleanup=ee,e.cleanupSync=E,e.createWriteStream=e=>{let t=f(e,`s-`),r=n.createWriteStream(t,{flags:u,mode:384});return y(t),r}})),Xo,Zo=D((()=>{Xo={"aube-lock.yaml":`aube`,"aube-workspace.yaml":`aube`,"bun.lock":`bun`,"bun.lockb":`bun`,"deno.lock":`deno`,"nub.lock":`nub`,"pnpm-lock.yaml":`pnpm`,"pnpm-workspace.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`,"npm-shrinkwrap.json":`npm`}})),Qo=se({findByKeywords:()=>ys});function $o(){return m.join(Ss.dir,Cs)}function es(e,t){return JSON.stringify({cwd:m.resolve(t),keywords:[...e].sort()})}function ts(e,t){let n=rs(),r=n[e];if(r){if(typeof r.fingerprint!=`number`||r.fingerprint<t){delete n[e],is(n);return}return r.packages}}function ns(e,t,n){let r=rs();r[e]={fingerprint:t,packages:n},is(r)}function rs(){if(ws)return ws;let e=$o();if(!t.existsSync(e))return ws={},ws;try{return ws=JSON.parse(t.readFileSync(e,{encoding:`utf-8`})),ws}catch{return ws={},ws}}function is(e){ws=e;let n=$o();t.writeFileSync(n,JSON.stringify(e))}async function as(e){try{await t.promises.access(e)}catch{return[]}return os(e,{})}async function os(e,n){let r=m.join(e,`node_modules`);if(n[r])return[];n[r]=!0;try{await t.promises.access(r)}catch{return[]}let i=await t.promises.readdir(r),a=[];return await Promise.all(i.map(async e=>{let i=m.join(r,e),o=await ss(i);if(o&&o.isDirectory()){if(n[i]=!0,e.startsWith(`@`)){if(e===`@types`)return;let o=await t.promises.readdir(i);await Promise.all(o.map(async t=>{let i=m.join(r,e,t);if(n[i])return;let o=await ss(i);if(!o||!o.isDirectory())return;n[i]=!0,a.push({name:`${e}/${t}`,ctimeMs:o.ctimeMs,path:i});let s=await os(i,n);a.push(...s)}))}else{a.push({name:e,ctimeMs:o.ctimeMs,path:i});let t=await os(i,n);a.push(...t)}}})),a}async function ss(e){try{return await t.promises.stat(e)}catch{return}}async function cs(e){let t=m.resolve(e),n=0,r=e=>{e&&e.mtimeMs>n&&(n=e.mtimeMs)};r(await ls(m.join(t,`package.json`))),r(await ls(m.join(t,`node_modules`)));let i=t;for(;;){let e=(await Promise.all(Ts.map(e=>ls(m.join(i,e))))).filter(e=>!!e);if(e.length>0){e.forEach(r);break}let t=m.dirname(i);if(t===i)break;i=t}return n}async function ls(e){try{return await t.promises.stat(e)}catch{return}}function us(e,t){let n=new Set(e);return!t.find(e=>!n.has(e))}async function ds(e){try{return await t.promises.readFile(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}async function fs(e){try{let t=await ds(m.resolve(e,`package.json`));if(!t)return;let n=JSON.parse(t);return n&&typeof n==`object`?n:void 0}catch{return}}function ps(e,t){let n=[...ms(e.dependencies),...ms(e.optionalDependencies),...ms(e.peerDependencies),...t?ms(e.devDependencies):[]];return Array.from(new Set(n))}function ms(e){return e&&typeof e==`object`&&!Array.isArray(e)?Object.keys(e):[]}async function hs(e){let t=m.resolve(e),n=await fs(t);if(!n)return;let r=ps(n,!0);if(r.length===0)return;let i=[];return await gs(t,r,new Set([t]),i),i}async function gs(e,t,n,r){await Promise.all(t.map(async t=>{if(t.indexOf(`@types/`)===0)return;let i=_s(t,e);if(!i||n.has(i))return;n.add(i);let a=await fs(i);a&&(a.name&&r.push({name:a.name,path:i,manifest:a}),await gs(i,ps(a,!1),n,r))}))}function _s(n,r){let i=e(m.join(r,`package.json`));try{return m.dirname(i.resolve(`${n}/package.json`))}catch{}try{let e=i.resolve.paths(n);if(e)for(let r of e){let e=m.join(r,n);if(t.existsSync(m.join(e,`package.json`)))return e}}catch{}try{let e=m.dirname(i.resolve(n));for(;;){if(vs(e)===n)return e;let t=m.dirname(e);if(t===e)return;e=t}}catch{}}function vs(e){try{return JSON.parse(t.readFileSync(m.join(e,`package.json`),`utf8`)).name}catch{return}}async function ys(e,t){let{cwd:n}=be({cwd:`.`},t);return bs(e,n)}async function bs(e,t){let n=es(e,t),r=await cs(t),i=ts(n,r);if(i)return i;let a=(await xs(t)).filter(t=>t.name&&us(t.keywords,e)).map(e=>e.name),o=Array.from(new Set(a));return ns(n,r,o),o}async function xs(e){let t=await hs(e);if(t)return t.map(e=>e.manifest);let n=await as(e);return(await Promise.all(n.map(e=>fs(e.path)))).filter(e=>!!e)}var Ss,Cs,ws,Ts,Es=D((()=>{Ce(),Ss=k(Yo(),1),Zo(),Cs=`.find-installed-packages.cache`,Ts=Object.keys(Xo).concat([`.pnp.cjs`,`.pnp.data.json`])}));function Ds(e,t){let n=new Set(e);return!t.find(e=>!n.has(e))}var Os=D((()=>{}));function ks(e,t,n){let r=e.filter(e=>Ds(e.keywords,t));return n?r.map(e=>n.reduce((t,n)=>(t[n]=e[n],t),{name:e.name})):r.map(e=>e.name)}var As=D((()=>{Os()}));async function js(e,t={}){let{registry:n=Ns,maxResults:r=Ps,signal:i,fetch:a=globalThis.fetch}=t;if(e.length===0)return{packages:[],truncated:!1};if(typeof a!=`function`)throw new Fs(`global fetch is not available; Node 18 or later is required`);let o=`keywords:${e.join(`,`)}`,s=[],c=1/0;for(;s.length<r&&s.length<c;){let e=Math.min(250,r-s.length),t=await a(`${Ms(n)}/-/v1/search?text=${encodeURIComponent(o)}&size=${e}&from=${s.length}`,{signal:i});if(!t.ok)throw new Fs(`npm registry search failed: ${t.status} ${t.statusText}`,t.status);let l=await t.json(),u=l?.objects??[];if(c=typeof l?.total==`number`?l.total:s.length+u.length,u.length===0)return{packages:s,truncated:!1};for(let e of u)e?.package&&s.push(e.package)}return{packages:s,truncated:c>s.length}}function Ms(e){return e.endsWith(`/`)?e.slice(0,-1):e}var Ns,Ps,Fs,Is=D((()=>{Ns=`https://registry.npmjs.org`,Ps=1e3,Fs=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`RegistrySearchError`}}}));async function Ls(e,t,n){let{packages:r}=await js(e,n);return ks(r,e,t)}var Rs=D((()=>{As(),Is()})),zs=se({DEFAULT_MAX_RESULTS:()=>Ps,DEFAULT_REGISTRY:()=>Ns,MAX_PAGE_SIZE:()=>250,RegistrySearchError:()=>Fs,fetchPackagesByKeywords:()=>js,hasAllKeywords:()=>Ds,pickPackagesWithKeywords:()=>ks,searchByKeywords:()=>Ls}),Bs=D((()=>{Os(),As(),Is(),Rs()}));const Vs=async(...e)=>(await Promise.resolve().then(()=>(Es(),Qo))).findByKeywords(...e),Hs=async(...e)=>(await Promise.resolve().then(()=>(Bs(),zs))).searchByKeywords(...e);function Us(e,t){return Vi({name:``,description:e,options:{help:{type:Z(go()),description:`Print help message`,alias:[`h`]},version:{type:Z(go()),description:`Print the CLI version`,alias:[`v`]},verbose:{type:Z(go()),description:`Turn on verbose logging`,alias:[`V`]},silent:{type:Z(go()),description:`Turn off logging`},"debug-cli":{type:Z(go()),description:`Display clibuilder debug messages`},...t?.config?{"show-config":{type:Z(go()),description:`Print the resolved config and where it was loaded from`}}:{}},commands:[],run(){this.ui.showHelp()}})}const Ws=Vi({name:`list`,alias:[`ls`],description:`List installed plugins`,options:{format:Eo},context:{findByKeywords:Vs},async run(e){let t=await this.context.findByKeywords(this.keywords,this);return Gs(this.ui,e.format,t,this.keywords),t}});function Gs(e,t,n,r){if(t===`json`){e.info(JSON.stringify({plugins:n},void 0,2));return}if(t===`text`){jo(e,{noun:`plugin`,plural:`plugins`},n,e=>e,r);return}if(n.length===0){e.info(`plugins: 0 installed plugins found with keywords: ${r.join(`, `)}`),e.info(Ao("Run `plugins search` to find plugins to install"));return}e.info(Oo(`plugins`,n)),e.info(Ao("Run `plugins search` to find more plugins on npm"))}const Ks=Vi({name:`search`,description:`Search only for available plugins`,options:{format:Eo,fields:{type:Z(ho()),description:`Extra fields to report, comma separated. Only 'keywords' is available`}},context:{searchByKeywords:Hs},async run(e){let t=Js(e.fields);if(!t){this.ui.info(`error: unknown value for --fields: ${e.fields}`),this.ui.info(Ao("The only extra field is `keywords`. Run `plugins search --fields keywords`"));return}let n=await Promise.all(this.keywords.map(e=>this.context.searchByKeywords([e]))),r=new Map;n.forEach((e,t)=>{e.forEach(e=>{let n=r.get(e);n?n.push(this.keywords[t]):r.set(e,[this.keywords[t]])})}),Ys(this.ui,e.format,t,[...r].map(qs),this.keywords)}});function qs([e,t]){return{name:e,keywords:t}}function Js(e){if(e===void 0)return{keywords:!1};let t=e.split(`,`).map(e=>e.trim());if(!t.some(e=>e!==`keywords`&&e!==`name`))return{keywords:t.includes(`keywords`)}}function Ys(e,t,n,r,i){if(t===`json`){let t=n.keywords?r:r.map(e=>e.name);e.info(JSON.stringify({packages:t},void 0,2));return}if(t===`text`){jo(e,{noun:`package`,plural:`packages`},r,e=>n.keywords?`${e.name} (${e.keywords.join(`, `)})`:e.name,i);return}if(r.length===0){e.info(`packages: 0 packages found with keywords: ${i.join(`, `)}`);return}n.keywords?ko(`packages`,[`name`,`keywords`],r.map(e=>[e.name,e.keywords.join(` `)])).forEach(t=>{e.info(t)}):e.info(Oo(`packages`,r.map(e=>e.name))),e.info(Ao("Run `plugins list` to see which of them are installed"))}const Xs=Vi({name:`plugins`,description:`Commands related to the plugins of the cli`,commands:[Ws,Ks]});function Zs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Qs={},$s={},ec={},tc;function nc(){if(tc)return ec;tc=1;function e(e){return e==null}function t(e){return typeof e==`object`&&!!e}function n(t){return Array.isArray(t)?t:e(t)?[]:[t]}function r(e,t){if(t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r+=1){let i=n[r];e[i]=t[i]}}return e}function i(e,t){let n=``;for(let r=0;r<t;r+=1)n+=e;return n}function a(e){return e===0&&1/e==-1/0}return ec.isNothing=e,ec.isObject=t,ec.toArray=n,ec.repeat=i,ec.isNegativeZero=a,ec.extend=r,ec}var rc,ic;function ac(){if(ic)return rc;ic=1;function e(e,t){let n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
|
|
20
|
+
${t}`),`<unsupported: ${n}>`}function tersifyCatchClauseNode(e,t,n){let r=tersifyAcornNode(e,t.param,n),i=tersifyAcornNode(e,t.body,n);return`catch${r?` (${r})`:``}${i?` ${i}`:``}`}function tersifyTryStatementNode(e,t,n){let r=tersifyAcornNode(e,t.block,n),i=tersifyAcornNode(e,t.handler,n),a=tersifyAcornNode(e,t.finalizer,n);return`try ${r}${i?` ${i}`:``}${a?` finally ${a}`:``}`}function tersifyThrowStatementNode(e,t,n){return`throw ${tersifyAcornNode(e,t.argument,n)}`}function tersifyArrayExpressionNode(e,t,n){return trim(e,`[${t.elements.map(t=>tersifyAcornNode(e,t,n)).join(`, `)}]`,n)}function tersifyAwaitExpressionNode(e,t,n){return`await ${tersifyAcornNode(e,t.argument,n)}`}function tersifyYieldExpressionNode(e,t,n){return`yield ${tersifyAcornNode(e,t.argument,n)}`}function tersifyMetaProperty(e,t,n){return`${tersifyAcornNode(e,t.meta,n)}.${tersifyAcornNode(e,t.property,n)}`}function tersifyPropertyNode(e,t,n){let r=tersifyAcornNode(e,t.key,n),i=t.value;if(i.type===`FunctionExpression`)return`${i.async?`async `:``}${i.generator?`*`:``}${r}${tersifyFunctionParams(e,i.params)} ${tersifyFunctionBody(e,i.body)}`;if(i.type===`AssignmentPattern`)return tersifyAcornNode(e,i,n);let a=tersifyAcornNode(e,i,n);return t.computed?`[${r}]: ${a}`:r===a?r:`${r}: ${a}`}function tersifyObjectExpressionNode(e,t,n){return`{ ${t.properties.map(t=>tersifyAcornNode(e,t,n)).join(`, `)} }`}function tersifyForOfStatementNode(e,t,n){return`for (${tersifyAcornNode(e,t.left,n)} of ${tersifyAcornNode(e,t.right,n)}) ${tersifyAcornNode(e,t.body,n)}`}function tersifyForInStatementNode(e,t,n){return`for (${tersifyAcornNode(e,t.left,n)} in ${tersifyAcornNode(e,t.right,n)}) ${tersifyAcornNode(e,t.body,n)}`}function tersifySwitchCaseNode(e,t,n){let r=tersifyAcornNode(e,t.test,n),i=t.consequent.map(t=>tersifyAcornNode(e,t,n));return t.test?`case ${r}: ${i.join(` `)}`:`default: ${i.join(` `)}`}function tersifySwitchStatementNode(e,t,n){return`switch (${tersifyAcornNode(e,t.discriminant,n)}) { ${t.cases.map(t=>tersifyAcornNode(e,t,n)).join(`; `)} }`}function tersifyContinueStatementNode(e,t,n){let r=tersifyAcornNode(e,t.label,n);return r?`continue ${r}`:`continue`}function tersifyLabeledStatementNode(e,t,n){return`${tersifyAcornNode(e,t.label,n)}: ${tersifyAcornNode(e,t.body,n)}`}function tersifyEmptyStatementNode(e,t,n){return``}function tersifyBreakStatementNode(e,t,n){let r=tersifyAcornNode(e,t.label,n);return r?`break ${r}`:`break`}function tersifyForStatementNode(e,t,n){let r=tersifyAcornNode(e,t.test,n),i=tersifyAcornNode(e,t.init,n),a=tersifyAcornNode(e,t.update,n),o=tersifyAcornNode(e,t.body,n),s=(r||``).trim(),c=(a||``).trim();return`for (${i};${s?` ${r}`:``};${c?` ${a}`:``}) ${o}`.replace(/;\s+;/g,`;;`).replace(/;;\s+\)/g,`;;)`)}function tersifyAssignmentExpressionNode(e,t,n){let r=tersifyAcornNode(e,t.left,n),i=tersifyAcornNode(e,t.right,n);return`${r} ${t.operator} ${i}`}function tersifyWhileStatementNode(e,t,n){return`while (${tersifyAcornNode(e,t.test,n)}) ${tersifyAcornNode(e,t.body,n)}`}function tersifyDoWhileStatementNode(e,t,n){let r=tersifyAcornNode(e,t.test,n),i=tersifyAcornNode(e,t.body,n);return t.body.type===`BlockStatement`?`do ${i} while (${r})`:`do ${i}; while (${r})`}function tersifyUnaryExpressionNode(e,t,n){if(t.operator===`void`){let r=tersifyAcornNode(e,t.argument,n);return r===`0`&&t.argument?.type===`Literal`&&t.argument.value===0?`undefined`:`void ${r}`}return t.operator===`typeof`?`typeof ${tersifyAcornNode(e,t.argument,n)}`:t.prefix?`${t.operator}${tersifyAcornNode(e,t.argument,n)}`:`${tersifyAcornNode(e,t.argument,n)}${t.operator}`}function tersifyUpdateExpressionNode(e,t,n){return t.prefix?`${t.operator}${tersifyAcornNode(e,t.argument,n)}`:`${tersifyAcornNode(e,t.argument,n)}${t.operator}`}function tersifyConditionalExpressionNode(e,t,n){return`${tersifyAcornNode(e,t.test,n)} ? ${tersifyAcornNode(e,t.consequent,n)} : ${tersifyAcornNode(e,t.alternate,n)}`}function tersifyIfStatementNode(e,t,n){let r=tersifyAcornNode(e,t.test,n),i=tersifyAcornNode(e,t.consequent,n),a=tersifyAcornNode(e,t.alternate,n);return a?t.consequent.type===`BlockStatement`?`if (${r}) ${i} else ${a}`:`if (${r}) ${i}; else ${a}`:`if (${r}) ${i}`}function tersifyBinaryExpressionNode(e,t,n){(t.left.type===`BinaryExpression`||t.left.type===`LogicalExpression`)&&isHigherOperatorOrder(t.operator,t.left.operator)&&(t.left.needParen=!0);let r=tersifyAcornNode(e,t.left,n);(t.right.type===`BinaryExpression`||t.right.type===`LogicalExpression`)&&isHigherOperatorOrder(t.operator,t.right.operator)&&(t.right.needParen=!0);let i=tersifyAcornNode(e,t.right,n);return t.needParen?`(${r} ${t.operator} ${i})`:`${r} ${t.operator} ${i}`}function tersifyNewExpressionNode(e,t,n){return tersifyNewDate(t)||`new ${tersifyAcornNode(e,t.callee,n)}(${t.arguments.map(t=>tersifyAcornNode(e,t,n)).join(`, `)})`}function tersifyNewDate(e){if(e.callee.type===`Identifier`&&e.callee.name===`Date`){let t=e.arguments;if(t.length>0&&!t.some(e=>e.type!==`Literal`)){let e=t;if(e.length===1){let t=e[0];if(typeof t.value==`string`)return new Date(t.value).toISOString()}let n=e.map(e=>e.value);return new Date(...n).toISOString()}}}function tersifyVariableDeclaratorNode(e,t,n){return`${t.id.name}${t.init?` = ${tersifyAcornNode(e,t.init,n)}`:``}`}function tersifyVariableDeclarationNode(e,t,n){return`${t.kind} ${t.declarations.map(t=>tersifyAcornNode(e,t,n)).join(`, `)}`}function tersifyIdentifierNode(e,t,n){return t.name===`Symbol`?`Sym`:t.name}function tersifyLiteralNode(e,t,n){return typeof t.value==`string`?`'`+t.value.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)+`'`:t.raw}function tersifyRestElementNode(e,t,n){return`...${t.argument.name}`}function tersifyAssignmentPatternNode(e,t,n){return`${t.left.name} = ${tersifyAcornNode(e,t.right,n-t.left.name.length-3)}`}function tersifyArrowExpressionNode(e,t,n){let r=t.async?`async `:``,i=t.generator?`*`:``,a=` => `,o=t.params.length===1&&t.params[0].type!==`ObjectPattern`,s=tersifyParamsBody(e,t.params),c=o?s:`(${s})`,l=getSingleStatementBodyNode(e,t.body),u=l?tersifyArrowBodyAsSingleStatement(e,l):tersifyFunctionBody(e,t.body),d=l&&l.type===`ObjectExpression`;if(d&&(u=`(${u})`),r.length+i.length+c.length+4+u.length<=n)return`${r}${i}${c}${a}${u}`;let p=Math.max(o?1:3,n-(r.length+i.length+4+u.length)),m=o?trim(e,s,p):`(${trim(e,s,p-2)})`;if(r.length+i.length+p+4+u.length<=n)return`${r}${i}${m}${a}${u}`;let h=d?6:l?0:4,g=Math.max(3,n-(r.length+i.length+m.length+4+h));return trim(e,`${r}${i}${m}${a}${d?`({ ${trim(e,u.slice(2,u.length-2),g-4)} })`:l?trim(e,u,g):`{ ${trim(e,u.slice(2,u.length-1),g)} }`}`,n)}function getSingleStatementBodyNode(e,t){if(t.type!==`BlockStatement`)return t;if(t.body.length===1&&t.body[0].type===`ReturnStatement`)return t.body[0]}function tersifyArrowBodyAsSingleStatement(e,t){return t.type===`ReturnStatement`?t.argument?t.argument.type===`ObjectExpression`?`(${tersifyAcornNode(e,t.argument,1/0)})`:tersifyAcornNode(e,t.argument,1/0):`{}`:tersifyAcornNode(e,t,1/0)}function tersifyExpressionStatementNode(e,t,n){return tersifyAcornNode(e,t.expression,n)}function tersifyMemberExpressionNode(e,t,n){let r=t.property.type===`Identifier`?tersifyAcornNode(e,t.property,n):`[${tersifyAcornNode(e,t.property,n)}]`;return`${tersifyAcornNode(e,t.object,n)}${t.optional?`?`:``}.${r}`}function tersifyCallExpressionNode(e,t,n){if(isSymbolForNode(t))return`Sym(${t.arguments[0].value})`;if(isDefineThisProperty(t)){let r=t.arguments[1].value;return`this.${r} = ${tersifyAcornNode(e,t.arguments[2],n-5-r.length-3)}`}let r=tersifyAcornNode(e,t.callee,n),i=tersifyFunctionParams(e,t.arguments);return`${r}${t.optional?`?.`:``}${i}`}function isSymbolForNode(e){return e.callee.type===`MemberExpression`&&e.callee.object.type===`Identifier`&&e.callee.object.name===`Symbol`&&e.callee.property.type===`Identifier`&&e.callee.property.name===`for`}function isDefineThisProperty(e){return e.callee.type===`Identifier`&&e.callee.name===`_defineProperty`&&e.arguments.length===3&&e.arguments[0].type===`ThisExpression`}function tersifyParamsBody(e,t){return t.reduce((t,n)=>(t.push(tersifyAcornNode(e,n,1/0)),t),[]).join(`, `)}function tersifyFunctionExpressionNode(e,t,n){let r=e.raw?`function`:`fn`,i=t.async?`async `:``,a=t.generator?`*`:``,o=t.id?` ${t.id.name}`:``,s=t.params.length>0?tersifyFunctionParams(e,t.params):`()`,c=i.length+r.length+a.length+o.length+1,l=s.slice(1,s.length-1),u=l.length>3?`(${trim(e,l,3)})`:s,d=c+u.length,p=c+s.length,m=tersifyFunctionBody(e,t.body);if(d+m.length>n){if(d+5>n)return trim(e,`${i}${r}${a}${o}${u} ${m}`,n);let t=m.slice(2,m.length-2),s=`${i}${r}${a}${o}${u} ${t.length===0?`{}`:`{ ${trim(e,t,n-d-4)} }`}`;return s.length>n?trim(e,s,n):s}return p+m.length>n?d+m.length<n?`${i}${r}${a}${o}(${trim(e,l,n-m.length-c-2)}) ${m}`:trim(e,`${i}${r}${a}${o}${u} ${m}`,n):trim(e,`${i}${r}${a}${o}${s} ${m}`,n)}function tersifyFunctionParams(e,t){return`(${tersifyParamsBody(e,t)})`}function tersifyFunctionBody(e,t){return tersifyAcornNode(e,t,1/0)}function tersifyBlockStatementNode(e,t,n){if(n<=3&&t.body.length>0)return trim(e,`...`,n);if(n<=4&&t.body.length>0)return trim(e,`{...`,n);let r=n-4,i=[];t.body.forEach(t=>{if(r){let n=tersifyAcornNode(e,t,r);r-=n.length,n&&n!==`return`&&i.push(n)}});let a=i.join(`; `);return`{${a?` ${a} `:``}}`}function tersifyReturnStatementNode(e,t,n){return t.argument?`return ${tersifyAcornNode(e,t.argument,n)}`:`return`}function tersifyThisExpression(e,t,n){return`this`}function tersifyClassExpression(e,t,n){let r=trim(e,`class${t.id?` ${t.id.name}`:` `}{}`,n),i=r.slice(0,Math.max(3,r.length-2)),a=tersifyAcornNode(e,t.body,n-i.length);return`${i}${n>=i.length+a.length||a.length>3?a:trim(e,`...`,n-i.length)}`}function tersifyMethodDefinition(e,t,n){let r=t.static?`static `:``,i=t.value,a=i.async?`async `:``,o=i.generator?`*`:``,s=t.key.name??`[${tersifyAcornNode(e,t.key,n)}]`,c=i.params.length>0?tersifyFunctionParams(e,i.params):`()`,l=r.length+a.length+o.length+s.length+1,u=c.slice(1,c.length-1),d=u.length>3?`(${trim(e,u,3)})`:c,p=l+d.length,m=l+c.length,h=tersifyFunctionBody(e,i.body);if(p+h.length>n){if(p+5>n)return trim(e,`${r}${a}${o}${s}${d} ${h}`,n);let t=h.slice(2,h.length-2),i=`${r}${a}${o}${s}${d} ${t.length===0?`{}`:`{ ${trim(e,t,n-p-4)} }`}`;return i.length>n?trim(e,i,n):i}return m+h.length>n?p+h.length<n?`${r}${a}${o}${s}(${trim(e,u,n-h.length-l-2)}) ${h}`:trim(e,`${r}${a}${o}${s}${d} ${h}`,n):trim(e,`${r}${a}${o}${s}${c} ${h}`,n)}function tersifyObjectPattern(e,t,n){return`${trim(e,`{ ${t.properties.map(t=>tersifyAcornNode(e,t,n)).join(`, `)} }`,n-2)}`}function tersifySequenceExpression(e,t,n){return`(${t.expressions.map(t=>tersifyAcornNode(e,t,n)).join(`, `)})`}function tersifyTemplateLiteral(e,t,n){return"`"+t.expressions.concat(t.quasis).sort((e,t)=>e.start-t.start).reduce((t,r)=>{if(n<=0)return t;if(r.type===`TemplateElement`)n-=r.value.raw.length,t+=r.value.raw;else{let i=tersifyAcornNode(e,r,n);n-=i.length,t+="${"+i+`}`}return t},``)+"`"}function tersifyTaggedTemplateExpression(e,t,n){let r=t.tag.name;return r+tersifyAcornNode(e,t.quasi,n-r.length)}function tersifyChainExpression(e,t,n){switch(t.expression.type){case`MemberExpression`:return tersifyMemberExpressionNode(e,t.expression,n);case`CallExpression`:return tersifyCallExpressionNode(e,t.expression,n);default:return tersifyUnknown(t,e.rawString)}}function tersifySuperNode(e,t,n){return`Super`}function tersifyFunctionByString(e,t){let n=e.toString();if(t.raw)return normalizeRawOutput(n);let r=parseFn(n);switch(r.type){case`function`:return formatFn2(r,t.maxLength);case`arrow`:return formatArrow2(r,t.maxLength);default:return formatUnknown(r,t.maxLength)}}const Yt=/^(async\s+)?function\s*(\*?)\s*(\w*)\s*\(([^)]*)\)\s*(\{.*\})$/ms,Xt=/^(async\s*)?\(([^)]*)\)\s*=>(.*)$/ms,Zt=/^(async\s+)?(\w+)\s*=>(.*)$/ms;function parseFn(e){let t=Yt.exec(e);if(t){let e=getEnclosedBody((t[5]??``).trim()).trim();return{type:`function`,async:!!t[1],generator:!!t[2],name:(t[3]??``).trim(),params:(t[4]??``).trim(),body:e}}if(t=Xt.exec(e),t){let e=(t[2]??``).trim(),n=(t[3]??``).trim(),r=isSingleLineBody(n);return n=removeLineBreaks(r?getSingleLineBody(n,1/0):getEnclosedBody(n)).trim(),!r&&n.startsWith(`return `)&&n.endsWith(`;`)&&(r=!0,n=n.slice(7,-1),n.startsWith(`{`)&&(n=`(${n})`)),{type:`arrow`,async:!!t[1],params:e,body:n,singleParam:e.length>0&&e.indexOf(`,`)===-1,singleLineBody:r}}if(t=Zt.exec(e),t){let e=(t[3]??``).trim(),n=isSingleLineBody(e);return e=removeLineBreaks(n?getSingleLineBody(e,1/0):getEnclosedBody(e)).trim(),!n&&e.startsWith(`return `)&&e.endsWith(`;`)&&(n=!0,e=e.slice(7,-1),e.startsWith(`{`)&&(e=`(${e})`)),{type:`arrow`,async:!!t[1],params:`${t[2]}`,body:e,singleParam:!0,singleLineBody:n}}return{type:`unknown`,value:e}}function normalizeBody(e){return e.replace(/\bfunction\s*\*\s*\(/g,`function* (`).replace(/\bfunction\s*\(/g,`function (`).replace(/\basync\s+function\s*\*\s*\(/g,`async function* (`).replace(/\basync\s+function\s*\(/g,`async function (`).replace(/\)=>/g,`) =>`).replace(/=>\s*\{/g,`=> {`).replace(/\bwhile\s*\(/g,`while (`).replace(/\bfor\s*\(/g,`for (`).replace(/\bswitch\s*\(/g,`switch (`).replace(/\}\s*while\s*\(/g,`} while (`).replace(/(\}\s*while\s*\([^)]+\))\s*\}/g,`$1; }`).replace(/(\}\s*while\s*\([^)]+\))\s*$/g,`$1;`).replace(/(while\s*\([^)]+\))\s*$/g,`$1;`).replace(/\b(while\s*\([^)]+\))(\s*)(\w)/g,(e,t,n,r)=>n?e:`${t} ${r}`).replace(/\b(for\s*\([^)]+\))(\s*)(\w)/g,(e,t,n,r)=>n?e:`${t} ${r}`).replace(/\b(switch\s*\([^)]+\))(\s*)(\w)/g,(e,t,n,r)=>n?e:`${t} ${r}`).replace(/\b(in\s+\w+)\)(\w)/g,`$1) $2`).replace(/\b(of\s+\w+)\)(\w)/g,`$1) $2`).replace(/\bfinally\s*\{/g,`finally {`).replace(/\bcatch\s*\{/g,`catch {`).replace(/\)\s*\{/g,`) {`).replace(/(\{\s*|,\s*)((?:async\s+)?)(\*\s*)?(\w+)\s+\(/g,(e,t,n,r,i)=>t+n+(r?`*`:``)+i+`(`).replace(/\[\s*;/g,`[`).replace(/\[\s+/g,`[`).replace(/\s+\]/g,`]`).replace(/;\s+;/g,`;;`).replace(/;;\s+\)/g,`;;)`).replace(/;\s+\)/g,`;)`).replace(/\}\s*;\s*(?=\s*return\b)/g,`} `).replace(/\bvoid\s+0\b/g,`undefined`).replace(/\/\*\s*@__PURE__\s*\*\/\s*/g,``).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(e,t,n)=>`'`+t.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)+`'`)}function normalizeRawOutput(e){return e.replace(/\)=>/g,`) =>`).replace(/=>(\S)/g,`=> $1`)}function normalizeStringQuotes(e){return e.replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(e,t)=>`'`+t.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)+`'`)}function formatFn2(e,t){e.params&&=normalizeStringQuotes(e.params),e.body&&=normalizeBody(e.body);let n=`${e.async?`async `:``}fn${e.generator?`*`:``}${e.name?` `+e.name:``}(${e.params?`%1`:``}) {${e.body?` %2 `:``}}`,r=e.params&&e.body?n.length-4:e.params||e.body?n.length-2:n.length;return e.params=trim({raw:!1,noTrim:!1},e.params,Math.max(3,t-r-e.body.length)),e.body=trim({raw:!1,noTrim:!1},e.body,Math.max(3,t-r-e.params.length)),trim({raw:!1,noTrim:!1},applyTemplate(n,e),t)}function formatArrow2(e,t){e.params&&=normalizeStringQuotes(e.params),e.body&&=normalizeBody(e.body);let n=`${e.async?`async `:``}${e.singleParam?`%1`:`(${e.params?`%1`:``})`} => ${e.singleLineBody?`%2`:`{${e.body?` %2 `:``}}`}`,r=e.params&&e.body?n.length-4:e.params||e.body?n.length-2:n.length;return e.params=trim({raw:!1,noTrim:!1},e.params,Math.max(3,t-r-e.body.length)),e.body=trim({raw:!1,noTrim:!1},e.body,Math.max(3,t-r-e.params.length)),trim({raw:!1,noTrim:!1},applyTemplate(n,e),t)}function formatUnknown(e,t){return trim({noTrim:!1},e.value,t)}function isSingleLineBody(e){return!e.startsWith(`{`)}function getSingleLineBody(e,t){let n=parseFn(e);switch(n.type){case`function`:return formatFn2(n,t);case`arrow`:return formatArrow2(n,t);default:return e.replace(/return;/g,``).replace(/([\s([{])Symbol\(\)/g,`$1Sym()`).replace(/([\s([{])Symbol\.for\('([\w_]*)'\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\("([\w_]*)"\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\(`([\w_]*)`\)/g,`$1Sym($2)`).replace(/{\s+}/g,`{}`)}}function getEnclosedBody(e){let t=1;e=e.slice(1);for(let n=0;n<=e.length;n++)if(e[n]===`}`&&t--,e[n]===`{`&&t++,t===0){e=removeLineBreaks(e.slice(0,n)).replace(/return;/g,``).replace(/([\s([{])Symbol\(\)/g,`$1Sym()`).replace(/([\s([{])Symbol\.for\('([\w_]*)'\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\("([\w_]*)"\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\(`([\w_]*)`\)/g,`$1Sym($2)`).replace(/{\s+}/g,`{}`);break}return e}function removeLineBreaks(e){return e.split(`
|
|
21
|
+
`).map(e=>e.trim()).filter(e=>!!e).map((e,t,n)=>t>=n.length-1||/,\s*$/.test(e)||/\[$/.test(e)||/^[}\]]\s*;?\s*$/.test(n[t+1].trim())||!/[^({}):;(do|else)]$/.test(e)||!/[^)}]/.test(n[t+1])?e:e+`;`).join(` `)}function applyTemplate(e,t){return t.params&&(e=e.replace(`%1`,t.params)),t.body&&(e=e.replace(`%2`,t.body)),e}function tersifyFunction(e,t,n){if(!e.raw&&hasTersifyFn(t)&&t.tersify!==e.defaultTersify)return t.tersify({maxLength:e.maxLength,raw:e.raw});try{return tersifyAcorn(e,t,e.maxLength)}catch(n){if(n.name!==`SyntaxError`)throw n;return tersifyFunctionByString(t,e)}}function required$1(e,t,n){return merge$2([e,t,n],(e,t)=>({...e,...t}))}__name(required$1,`required`);function merge$2(e,t){return e[0]===void 0||e[0]===null?e[0]:e.filter(e=>!!e).reduce(t,{})}__name(merge$2,`merge`);function unpartial$1(e,t,n){return e==null?e:[e,t,n].filter(notNil$1).reduce((e,t)=>({...e,...trimNilProps$1(t)}),{})}__name(unpartial$1,`unpartial`);function trimNilProps$1(e){return Object.keys(e).reduce((t,n)=>(notNil$1(e[n])&&(t[n]=e[n]),t),{})}__name(trimNilProps$1,`trimNilProps`);function notNil$1(e){return e!=null}__name(notNil$1,`notNil`);function defaultTersify(e){return tersify(this,e)}function hasIndent(e){return e.indent===`tab`||typeof e.indent==`number`}function tersify(e,t){let n=required$1(fe,t,{path:[],references:[],defaultTersify,...t?.indent===`tab`||typeof t?.indent==`number`?{indentDepth:0}:{}});return tersifyValue(n,e,n.maxLength)}function tersifyValue(e,t,n){let r=getType(t),i=Qt[r];if(!i)throw Error(`Can't find fn for ${JSON.stringify(t)}`);return i(e,t,n)}function getIndent(e,t){return e.indent===`tab`?` `.repeat(t):typeof e.indent==`number`?` `.repeat(t*e.indent):` `.repeat(t)}function getType(e){if(e==null)return String(e);if(e instanceof RegExp)return`RegExp`;if(e instanceof Date)return`Date`;if(Array.isArray(e))return`Array`;if(e instanceof Error)return`Error`;if(isBuffer(e))return`Buffer`;let t=typeof e;return t===`object`&&Object.getPrototypeOf(e)!==Object.prototype?`instance`:t}const Qt={undefined:tersifyLiteral,null:tersifyLiteral,boolean:tersifyLiteral,number:tersifyLiteral,bigint:tersifyBigint,instance:tersifyInstance,string:tersifyString,symbol:tersifySymbol,function:tersifyFunction,object:tersifyObject,Buffer:tersifyBuffer,Date:tersifyDate,RegExp:tersifyRegExp,Array:tersifyArray,Error:tersifyError};function tersifyLiteral(e,t,n){return trim(e,String(t),n)}function tersifyDate(e,t,n){return trim(e,t.toISOString(),n)}function tersifyRegExp(e,t,n){return trim(e,String(t),n)}function tersifyString(e,t,n){return trim(e,`'${t}'`,n)}function tersifySymbol(e,t,n){return e.raw?t.toString():trim(e,t.toString().replace(`Symbol(`,`Sym(`),n)}function tersifyBigint(e,t,n){return trim(e,String(t)+`n`,n)}function tersifyError(e,t,n){let r=t.constructor.name,i=trim(e,`'${t.message}'`,n-7);return t.message?i.length===0?trim(e,`${r}( )`,n):trim(e,`${r}(${i})`,n):trim(e,`${r}()`,n)}function tersifyBuffer(e,t,n){return trim(e,t.inspect(),n)}function tersifyArray(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&hasTersifyFn(t)&&t.tersify!==e.defaultTersify)return t.tersify({maxLength:n});if(t.length===0)return`[]`;if(hasIndent(e)){let n=e.indentDepth??0,r={...e,path:e.path,indentDepth:n+1},i=e.maxLength;return`[\n${t.map((t,n)=>tersifyValue({...r,path:[...e.path,n]},t,i)).map(t=>getIndent(e,n+1)+t).join(`,
|
|
22
|
+
`)}\n${getIndent(e,n)}]`}let i=0,a=trim(e,t.reduce((r,a,o)=>{let s=[...e.path,o],c=tersifyValue({...e,path:s},a,n-i);return i+=c.length,o!==t.length-1&&(i+=2),r.push(c),r},[]).join(`, `),n-2);return a.length===0?trim(e,`[ ]`,n):`[${a}]`}function tersifyObject(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&hasTersifyFn(t)&&t.tersify!==e.defaultTersify)return t.tersify({maxLength:n});if(hasIndent(e)){let n=Object.keys(t);if(n.length===0)return`{}`;let r=e.indentDepth??0,i={...e,indentDepth:r+1},a=e.maxLength;return`{\n${n.map((o,s)=>{let c=s===n.length-1,l=getPropStr(i,t,o,a,c);return getIndent(e,r+1)+l}).join(`,
|
|
23
|
+
`)}\n${getIndent(e,r)}}`}let i=n-4,a=Object.keys(t),o=a.reduce((n,r,o)=>{if(i>0){let s=o===a.length-1,c=getPropStr(e,t,r,i,s);i-=c.length,n.push(c)}return n},[]),s=trim(e,a.length>o.length?o.join(`, `)+` `:o.join(`, `),n-4);return a.length===0?`{}`:s.length===0?trim(e,`{ }`,n):`{ ${s} }`}function tersifyInstance(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&hasTersifyFn(t)&&t.tersify!==e.defaultTersify)return t.tersify({maxLength:n});if(n<=4)switch(n){case 4:return`. {}`;case 3:return`...`;case 2:return`..`;case 1:return`.`;case 0:return``}let i=Object.getPrototypeOf(t)?.constructor?.name??``;if(hasIndent(e)){let n=Object.keys(t);if(n.length===0)return`${i} {}`;let r=e.indentDepth??0,a={...e,indentDepth:r+1},o=e.maxLength;return`${i} {\n${n.map((i,s)=>{let c=s===n.length-1,l=getPropStr(a,t,i,o,c);return getIndent(e,r+1)+l}).join(`,
|
|
24
|
+
`)}\n${getIndent(e,r)}}`}let[a,o]=n<i.length+1+2?[n-1-2,2]:[i.length,n-i.length-1],s=a?`${trim(e,i,a)} `:``,c=o,l=Object.keys(t),u=l.reduce((n,r,i)=>{if(c>0){let a=i===l.length-1,o=getPropStr(e,t,r,c,a);c-=o.length,n.push(o)}return n},[]),d=trim(e,l.length>u.length?u.join(`, `)+` `:u.join(`, `),o-2-2);return l.length===0?`${s}{}`:d.length===0?trim(e,`${s}{ }`,n):`${s}{ ${d} }`}function getPropStr(e,t,n,r,i){let a=i?0:2,o=[...e.path,n],s=Object.getOwnPropertyDescriptor(t,n),c=[];if(s.get&&c.push(`Get`),s.set&&c.push(`Set`),c.length>0)return`${getPropKey(n)}: [${c.join(`/`)}]`;let l=t[n];if(typeof l==`function`){if(/^(.*)\s?=>\s?/.test(l.toString())){let t=tersifyValue({...e,path:o},l,r-n.length-a-2);return`${getPropKey(n)}: ${t}`}let t=tersifyValue({...e,path:o},l,r-n.length-a+2);return`${/^async fn/.test(t)?`async `:``}${/^(async )?fn\*/.test(t)?`*`:``}${getPropKey(n)}${t.slice(t.indexOf(`(`))}`}let u=tersifyValue({...e,path:o,noTrim:!0},l,r-n.length-2-a);return`${getPropKey(n)}: ${u}`}function getPropKey(e){return e.indexOf(`-`)>=0?`'${e}'`:e}function findKey(e,t,n){return Object.keys(e).find(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function forEachKey(e,t,n){Object.keys(e).forEach(t,n)}function mapKey(e,t,n){return Object.keys(e).map(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function reduceByKey(e,t,n){return Object.keys(e).reduce((n,r,i,a)=>t(n,r,i,a,e),n)}const $t=reduceByKey;function record(e){let t=Object.create(null);return e?Object.assign(t,e):t}function someKey(e,t,n){return Object.keys(e).some(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function command(e){return e}var B;(function(e){e.assertEqual=e=>{};function assertIs(e){}e.assertIs=assertIs;function assertNever(e){throw Error()}e.assertNever=assertNever,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function joinValues(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=joinValues,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(B||={});var en;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(en||={});const V=B.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),getParsedType=e=>{switch(typeof e){case`undefined`:return V.undefined;case`string`:return V.string;case`number`:return Number.isNaN(e)?V.nan:V.number;case`boolean`:return V.boolean;case`function`:return V.function;case`bigint`:return V.bigint;case`symbol`:return V.symbol;case`object`:return Array.isArray(e)?V.array:e===null?V.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?V.promise:typeof Map<`u`&&e instanceof Map?V.map:typeof Set<`u`&&e instanceof Set?V.set:typeof Date<`u`&&e instanceof Date?V.date:V.object;default:return V.unknown}},H=B.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]);var tn=class ZodError extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},processError=e=>{for(let r of e.issues)if(r.code===`invalid_union`)r.unionErrors.map(processError);else if(r.code===`invalid_return_type`)processError(r.returnTypeError);else if(r.code===`invalid_arguments`)processError(r.argumentsError);else if(r.path.length===0)n._errors.push(t(r));else{let e=n,i=0;for(;i<r.path.length;){let n=r.path[i];i===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],i++}}};return processError(this),n}static assert(e){if(!(e instanceof ZodError))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};tn.create=e=>new tn(e);const errorMap=(e,t)=>{let n;switch(e.code){case H.invalid_type:n=e.received===V.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,B.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:n=`Unrecognized key(s) in object: ${B.joinValues(e.keys,`, `)}`;break;case H.invalid_union:n=`Invalid input`;break;case H.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${B.joinValues(e.options)}`;break;case H.invalid_enum_value:n=`Invalid enum value. Expected ${B.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:n=`Invalid function arguments`;break;case H.invalid_return_type:n=`Invalid function return type`;break;case H.invalid_date:n=`Invalid date`;break;case H.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:B.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case H.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case H.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case H.custom:n=`Invalid input`;break;case H.invalid_intersection_types:n=`Intersection results could not be merged`;break;case H.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,B.assertNever(e)}return{message:n}};let nn=errorMap;function getErrorMap(){return nn}const makeIssue=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function addIssueToContext(e,t){let n=getErrorMap(),r=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===errorMap?void 0:errorMap].filter(e=>!!e)});e.common.issues.push(r)}var rn=class ParseStatus{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return U;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let e of t){let t=await e.key,r=await e.value;n.push({key:t,value:r})}return ParseStatus.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return U;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};const U=Object.freeze({status:`aborted`}),DIRTY=e=>({status:`dirty`,value:e}),OK=e=>({status:`valid`,value:e}),isAborted=e=>e.status===`aborted`,isDirty=e=>e.status===`dirty`,isValid=e=>e.status===`valid`,isAsync=e=>typeof Promise<`u`&&e instanceof Promise;var W;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(W||={});var ParseInputLazyPath=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new tn(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:i};let customMap=(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}};return{errorMap:customMap,description:i}}var ZodType=class{get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rn,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(isAsync(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},r=this._parseSync({data:e,path:n.path,parent:n});return handleResult(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return isValid(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>isValid(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(isAsync(r)?r:Promise.resolve(r));return handleResult(n,i)}refine(e,t){let getIssueProperties=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,n)=>{let r=e(t),setError=()=>n.addIssue({code:H.custom,...getIssueProperties(t)});return typeof Promise<`u`&&r instanceof Promise?r.then(e=>e?!0:(setError(),!1)):r?!0:(setError(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ZodEffects({schema:this,typeName:G.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return En.create(this)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:G.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:G.ZodDefault})}brand(){return new ZodBranded({typeName:G.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:G.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Pn.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const an=/^c[^\s-]{8,}$/i,on=/^[0-9a-z]+$/,sn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ln=/^[a-z0-9_-]{21}$/i,un=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,fn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let pn;const mn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,gn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,_n=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bn=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,xn=RegExp(`^${bn}$`);function timeRegexSource(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function timeRegex(e){return RegExp(`^${timeRegexSource(e)}$`)}function datetimeRegex(e){let t=`${bn}T${timeRegexSource(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function isValidIP(e,t){return!((t!==`v4`&&t||!mn.test(e))&&(t!==`v6`&&t||!gn.test(e)))}function isValidJWT(e,t){if(!un.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function isValidCidr(e,t){return!((t!==`v4`&&t||!hn.test(e))&&(t!==`v6`&&t||!_n.test(e)))}var Sn=class ZodString extends ZodType{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==V.string){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.string,received:t.parsedType}),U}let t=new rn,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?addIssueToContext(n,{code:H.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&addIssueToContext(n,{code:H.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)fn.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`email`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)pn||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),pn.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`emoji`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)cn.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`uuid`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ln.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`nanoid`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)an.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`cuid`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)on.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`cuid2`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)sn.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`ulid`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`url`,code:H.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`regex`,code:H.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?datetimeRegex(r).test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?xn.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?timeRegex(r).test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?dn.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`duration`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?isValidIP(e.data,r.version)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`ip`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?isValidJWT(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`jwt`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?isValidCidr(e.data,r.version)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`cidr`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?vn.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`base64`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?yn.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:`base64url`,code:H.invalid_string,message:r.message}),t.dirty()):B.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:H.invalid_string,...W.errToObj(n)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:`email`,...W.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...W.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...W.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...W.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...W.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...W.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...W.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...W.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...W.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...W.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...W.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...W.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...W.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...W.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...W.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...W.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...W.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...W.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...W.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...W.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...W.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...W.errToObj(t)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Sn.create=e=>new Sn({checks:[],typeName:G.ZodString,coerce:e?.coerce??!1,...processCreateParams(e)});function floatSafeRemainder(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Cn=class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==V.number){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.number,received:t.parsedType}),U}let t,n=new rn;for(let r of this._def.checks)r.kind===`int`?B.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:H.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:H.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:H.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?floatSafeRemainder(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:H.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:H.not_finite,message:r.message}),n.dirty()):B.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,W.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,W.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,W.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,W.toString(t))}setLimit(e,t,n,r){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:W.toString(r)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:`int`,message:W.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:W.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:W.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:W.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:W.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&B.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Cn.create=e=>new Cn({checks:[],typeName:G.ZodNumber,coerce:e?.coerce||!1,...processCreateParams(e)});var wn=class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==V.bigint)return this._getInvalidInput(e);let t,n=new rn;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:H.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:H.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:H.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):B.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.bigint,received:t.parsedType}),U}gte(e,t){return this.setLimit(`min`,e,!0,W.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,W.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,W.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,W.toString(t))}setLimit(e,t,n,r){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:W.toString(r)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:W.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};wn.create=e=>new wn({checks:[],typeName:G.ZodBigInt,coerce:e?.coerce??!1,...processCreateParams(e)});var ZodBoolean=class extends ZodType{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==V.boolean){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.boolean,received:t.parsedType}),U}return OK(e.data)}};ZodBoolean.create=e=>new ZodBoolean({typeName:G.ZodBoolean,coerce:e?.coerce||!1,...processCreateParams(e)});var Tn=class ZodDate extends ZodType{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==V.date){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.date,received:t.parsedType}),U}if(Number.isNaN(e.data.getTime()))return addIssueToContext(this._getOrReturnCtx(e),{code:H.invalid_date}),U;let t=new rn,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:H.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):B.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:W.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:W.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Tn.create=e=>new Tn({checks:[],coerce:e?.coerce||!1,typeName:G.ZodDate,...processCreateParams(e)});var ZodSymbol=class extends ZodType{_parse(e){if(this._getType(e)!==V.symbol){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.symbol,received:t.parsedType}),U}return OK(e.data)}};ZodSymbol.create=e=>new ZodSymbol({typeName:G.ZodSymbol,...processCreateParams(e)});var ZodUndefined=class extends ZodType{_parse(e){if(this._getType(e)!==V.undefined){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.undefined,received:t.parsedType}),U}return OK(e.data)}};ZodUndefined.create=e=>new ZodUndefined({typeName:G.ZodUndefined,...processCreateParams(e)});var ZodNull=class extends ZodType{_parse(e){if(this._getType(e)!==V.null){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.null,received:t.parsedType}),U}return OK(e.data)}};ZodNull.create=e=>new ZodNull({typeName:G.ZodNull,...processCreateParams(e)});var ZodAny=class extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}};ZodAny.create=e=>new ZodAny({typeName:G.ZodAny,...processCreateParams(e)});var ZodUnknown=class extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}};ZodUnknown.create=e=>new ZodUnknown({typeName:G.ZodUnknown,...processCreateParams(e)});var ZodNever=class extends ZodType{_parse(e){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.never,received:t.parsedType}),U}};ZodNever.create=e=>new ZodNever({typeName:G.ZodNever,...processCreateParams(e)});var ZodVoid=class extends ZodType{_parse(e){if(this._getType(e)!==V.undefined){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.void,received:t.parsedType}),U}return OK(e.data)}};ZodVoid.create=e=>new ZodVoid({typeName:G.ZodVoid,...processCreateParams(e)});var En=class ZodArray extends ZodType{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==V.array)return addIssueToContext(t,{code:H.invalid_type,expected:V.array,received:t.parsedType}),U;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?H.too_big:H.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(addIssueToContext(t,{code:H.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(addIssueToContext(t,{code:H.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new ParseInputLazyPath(t,e,t.path,n)))).then(e=>rn.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new ParseInputLazyPath(t,e,t.path,n)));return rn.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:W.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:W.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:W.toString(t)}})}nonempty(e){return this.min(1,e)}};En.create=(e,t)=>new En({type:e,minLength:null,maxLength:null,exactLength:null,typeName:G.ZodArray,...processCreateParams(t)});function deepPartialify(e){if(e instanceof Dn){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=ZodOptional.create(deepPartialify(r))}return new Dn({...e._def,shape:()=>t})}return e instanceof En?new En({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof kn?kn.create(e.items.map(e=>deepPartialify(e))):e}var Dn=class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=B.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==V.object){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.object,received:t.parsedType}),U}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new ParseInputLazyPath(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ZodNever){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(addIssueToContext(n,{code:H.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new ParseInputLazyPath(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>rn.mergeObjectSync(t,e)):rn.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new ZodObject({...this._def,unknownKeys:`strict`,...e===void 0?{}:{errorMap:(t,n)=>{let r=this._def.errorMap?.(t,n).message??n.defaultError;return t.code===`unrecognized_keys`?{message:W.errToObj(e).message??r}:{message:r}}}})}strip(){return new ZodObject({...this._def,unknownKeys:`strip`})}passthrough(){return new ZodObject({...this._def,unknownKeys:`passthrough`})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:G.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){let t={};for(let n of B.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new ZodObject({...this._def,shape:()=>t})}omit(e){let t={};for(let n of B.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){let t={};for(let n of B.objectKeys(this.shape)){let r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()}return new ZodObject({...this._def,shape:()=>t})}required(e){let t={};for(let n of B.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ZodOptional;)e=e._def.innerType;t[n]=e}return new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(B.objectKeys(this.shape))}};Dn.create=(e,t)=>new Dn({shape:()=>e,unknownKeys:`strip`,catchall:ZodNever.create(),typeName:G.ZodObject,...processCreateParams(t)}),Dn.strictCreate=(e,t)=>new Dn({shape:()=>e,unknownKeys:`strict`,catchall:ZodNever.create(),typeName:G.ZodObject,...processCreateParams(t)}),Dn.lazycreate=(e,t)=>new Dn({shape:e,unknownKeys:`strip`,catchall:ZodNever.create(),typeName:G.ZodObject,...processCreateParams(t)});var ZodUnion=class extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function handleResults(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new tn(e.ctx.common.issues));return addIssueToContext(t,{code:H.invalid_union,unionErrors:n}),U}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(handleResults);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new tn(e));return addIssueToContext(t,{code:H.invalid_union,unionErrors:i}),U}}get options(){return this._def.options}};ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:G.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof Nn?e.options:e instanceof ZodNativeEnum?B.objectValues(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:e instanceof ZodOptional?[void 0,...getDiscriminator(e.unwrap())]:e instanceof ZodNullable?[null,...getDiscriminator(e.unwrap())]:e instanceof ZodBranded||e instanceof ZodReadonly?getDiscriminator(e.unwrap()):e instanceof ZodCatch?getDiscriminator(e._def.innerType):[];var On=class ZodDiscriminatedUnion extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==V.object)return addIssueToContext(t,{code:H.invalid_type,expected:V.object,received:t.parsedType}),U;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let n of t){let t=getDiscriminator(n.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(r.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new ZodDiscriminatedUnion({typeName:G.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...processCreateParams(n)})}};function mergeValues(e,t){let n=getParsedType(e),r=getParsedType(t);if(e===t)return{valid:!0,data:e};if(n===V.object&&r===V.object){let n=B.objectKeys(t),r=B.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=mergeValues(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===V.array&&r===V.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=mergeValues(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===V.date&&r===V.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ZodIntersection=class extends ZodType{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),handleParsed=(e,r)=>{if(isAborted(e)||isAborted(r))return U;let i=mergeValues(e.value,r.value);return i.valid?((isDirty(e)||isDirty(r))&&t.dirty(),{status:t.value,value:i.data}):(addIssueToContext(n,{code:H.invalid_intersection_types}),U)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>handleParsed(e,t)):handleParsed(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ZodIntersection.create=(e,t,n)=>new ZodIntersection({left:e,right:t,typeName:G.ZodIntersection,...processCreateParams(n)});var kn=class ZodTuple extends ZodType{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.array)return addIssueToContext(n,{code:H.invalid_type,expected:V.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return addIssueToContext(n,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),U;!this._def.rest&&n.data.length>this._def.items.length&&(addIssueToContext(n,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new ParseInputLazyPath(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>rn.mergeArray(t,e)):rn.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}};kn.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new kn({items:e,typeName:G.ZodTuple,rest:null,...processCreateParams(t)})};var An=class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.object)return addIssueToContext(n,{code:H.invalid_type,expected:V.object,received:n.parsedType}),U;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new ParseInputLazyPath(n,e,n.path,e)),value:a._parse(new ParseInputLazyPath(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?rn.mergeObjectAsync(t,r):rn.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ZodType?new ZodRecord({keyType:e,valueType:t,typeName:G.ZodRecord,...processCreateParams(n)}):new ZodRecord({keyType:Sn.create(),valueType:e,typeName:G.ZodRecord,...processCreateParams(t)})}},ZodMap=class extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.map)return addIssueToContext(n,{code:H.invalid_type,expected:V.map,received:n.parsedType}),U;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new ParseInputLazyPath(n,e,n.path,[a,`key`])),value:i._parse(new ParseInputLazyPath(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return U;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return U;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};ZodMap.create=(e,t,n)=>new ZodMap({valueType:t,keyType:e,typeName:G.ZodMap,...processCreateParams(n)});var jn=class ZodSet extends ZodType{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.set)return addIssueToContext(n,{code:H.invalid_type,expected:V.set,received:n.parsedType}),U;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(addIssueToContext(n,{code:H.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(addIssueToContext(n,{code:H.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function finalizeSet(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return U;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let a=[...n.data.values()].map((e,t)=>i._parse(new ParseInputLazyPath(n,e,n.path,t)));return n.common.async?Promise.all(a).then(e=>finalizeSet(e)):finalizeSet(a)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:W.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:W.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};jn.create=(e,t)=>new jn({valueType:e,minSize:null,maxSize:null,typeName:G.ZodSet,...processCreateParams(t)});var Mn=class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==V.function)return addIssueToContext(t,{code:H.invalid_type,expected:V.function,received:t.parsedType}),U;function makeArgsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter(e=>!!e),issueData:{code:H.invalid_arguments,argumentsError:n}})}function makeReturnsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter(e=>!!e),issueData:{code:H.invalid_return_type,returnTypeError:n}})}let n={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof ZodPromise){let e=this;return OK(async function(...t){let i=new tn([]),a=await e._def.args.parseAsync(t,n).catch(e=>{throw i.addIssue(makeArgsIssue(t,e)),i}),o=await Reflect.apply(r,this,a);return await e._def.returns._def.type.parseAsync(o,n).catch(e=>{throw i.addIssue(makeReturnsIssue(o,e)),i})})}{let e=this;return OK(function(...t){let i=e._def.args.safeParse(t,n);if(!i.success)throw new tn([makeArgsIssue(t,i.error)]);let a=Reflect.apply(r,this,i.data),o=e._def.returns.safeParse(a,n);if(!o.success)throw new tn([makeReturnsIssue(a,o.error)]);return o.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:kn.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ZodFunction({args:e||kn.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:G.ZodFunction,...processCreateParams(n)})}},ZodLazy=class extends ZodType{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:G.ZodLazy,...processCreateParams(t)});var ZodLiteral=class extends ZodType{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:H.invalid_literal,expected:this._def.value}),U}return{status:`valid`,value:e.data}}get value(){return this._def.value}};ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:G.ZodLiteral,...processCreateParams(t)});function createZodEnum(e,t){return new Nn({values:e,typeName:G.ZodEnum,...processCreateParams(t)})}var Nn=class ZodEnum extends ZodType{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return addIssueToContext(t,{expected:B.joinValues(n),received:t.parsedType,code:H.invalid_type}),U}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return addIssueToContext(t,{received:t.data,code:H.invalid_enum_value,options:n}),U}return OK(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}};Nn.create=createZodEnum;var ZodNativeEnum=class extends ZodType{_parse(e){let t=B.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==V.string&&n.parsedType!==V.number){let e=B.objectValues(t);return addIssueToContext(n,{expected:B.joinValues(e),received:n.parsedType,code:H.invalid_type}),U}if(this._cache||=new Set(B.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=B.objectValues(t);return addIssueToContext(n,{received:n.data,code:H.invalid_enum_value,options:e}),U}return OK(e.data)}get enum(){return this._def.values}};ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:G.ZodNativeEnum,...processCreateParams(t)});var ZodPromise=class extends ZodType{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==V.promise&&t.common.async===!1)return addIssueToContext(t,{code:H.invalid_type,expected:V.promise,received:t.parsedType}),U;let n=t.parsedType===V.promise?t.data:Promise.resolve(t.data);return OK(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:G.ZodPromise,...processCreateParams(t)});var ZodEffects=class extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===G.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{addIssueToContext(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return U;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?U:r.status===`dirty`||t.value===`dirty`?DIRTY(r.value):r});{if(t.value===`aborted`)return U;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?U:r.status===`dirty`||t.value===`dirty`?DIRTY(r.value):r}}if(r.type===`refinement`){let executeRefinement=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?U:(e.status===`dirty`&&t.dirty(),executeRefinement(e.value),{status:t.value,value:e.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>e.status===`aborted`?U:(e.status===`dirty`&&t.dirty(),executeRefinement(e.value).then(()=>({status:t.value,value:e.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!isValid(e))return U;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>isValid(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):U)}B.assertNever(r)}};ZodEffects.create=(e,t,n)=>new ZodEffects({schema:e,typeName:G.ZodEffects,effect:t,...processCreateParams(n)}),ZodEffects.createWithPreprocess=(e,t,n)=>new ZodEffects({schema:t,effect:{type:`preprocess`,transform:e},typeName:G.ZodEffects,...processCreateParams(n)});var ZodOptional=class extends ZodType{_parse(e){return this._getType(e)===V.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:G.ZodOptional,...processCreateParams(t)});var ZodNullable=class extends ZodType{_parse(e){return this._getType(e)===V.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:G.ZodNullable,...processCreateParams(t)});var ZodDefault=class extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===V.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:G.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...processCreateParams(t)});var ZodCatch=class extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return isAsync(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new tn(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new tn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:G.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...processCreateParams(t)});var ZodNaN=class extends ZodType{_parse(e){if(this._getType(e)!==V.nan){let t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:H.invalid_type,expected:V.nan,received:t.parsedType}),U}return{status:`valid`,value:e.data}}};ZodNaN.create=e=>new ZodNaN({typeName:G.ZodNaN,...processCreateParams(e)});var ZodBranded=class extends ZodType{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Pn=class ZodPipeline extends ZodType{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){let handleAsync=async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?U:e.status===`dirty`?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})};return handleAsync()}{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?U:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:G.ZodPipeline})}},ZodReadonly=class extends ZodType{_parse(e){let t=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then(e=>freeze(e)):freeze(t)}unwrap(){return this._def.innerType}};ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:G.ZodReadonly,...processCreateParams(t)}),Dn.lazycreate;var G;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(G||={});const K=Sn.create;Cn.create,ZodNaN.create,wn.create;const Fn=ZodBoolean.create;Tn.create,ZodSymbol.create,ZodUndefined.create,ZodNull.create,ZodAny.create,ZodUnknown.create,ZodNever.create,ZodVoid.create;const In=En.create;Dn.create,Dn.strictCreate,ZodUnion.create,On.create,ZodIntersection.create,kn.create,An.create,ZodMap.create,jn.create,Mn.create,ZodLazy.create,ZodLiteral.create;const Ln=Nn.create;ZodNativeEnum.create,ZodPromise.create,ZodEffects.create;const q=ZodOptional.create;ZodNullable.create,ZodEffects.createWithPreprocess,Pn.create;function isZodObject(e){return e.shape}function isZodArray(e){return e&&e.element}function isZodOptional(e){return!!e&&e.isOptional()}function isZodBoolean(e){return isZodType(e,`ZodBoolean`)}function isZodNumber(e){return isZodType(e,`ZodNumber`)}function isZodString(e){return isZodType(e,`ZodString`)}function isZodEnum(e){return isZodType(e,`ZodEnum`)}function isZodType(e,t){return Object.getPrototypeOf(e).constructor.name===t}function getBaseCommand(e,t){return command({name:``,description:e,options:{help:{type:q(Fn()),description:`Print help message`,alias:[`h`]},version:{type:q(Fn()),description:`Print the CLI version`,alias:[`v`]},verbose:{type:q(Fn()),description:`Turn on verbose logging`,alias:[`V`]},silent:{type:q(Fn()),description:`Turn off logging`},"debug-cli":{type:q(Fn()),description:`Display clibuilder debug messages`},...t?.config?{"show-config":{type:q(Fn()),description:`Print the resolved config and where it was loaded from`}}:{}},commands:[]})}const Rn={type:q(Ln([`toon`,`text`,`json`])),description:`Output format: 'toon' for agents, 'text' for humans, 'json' to pipe`,default:`toon`};function toonValue(e){return/["\\,]|^\s|\s$/.test(e)?JSON.stringify(e):e}function toonArray(e,t){return`${e}[${t.length}]: ${t.map(toonValue).join(`,`)}`}function toonTable(e,t,n){return[`${e}[${n.length}]{${t.join(`,`)}}:`,...n.map(e=>` ${e.map(toonValue).join(`,`)}`)]}function toonHelp(e){return`help[1]: ${e}`}function reportProse(e,{noun:t,plural:n},r,i,a){if(r.length===0){e.info(`no ${t} with keywords: ${a.join(`, `)}`);return}if(r.length===1){e.info(`found one ${t}: ${i(r[0])}`);return}e.info(`found the following ${n}:`),e.info(``),r.forEach(t=>{e.info(` ${i(t)}`)})}function required(e,t,n){return merge$1([e,t,n],(e,t)=>({...e,...t}))}function merge$1(e,t){return e[0]===void 0||e[0]===null?e[0]:e.filter(e=>!!e).reduce(t,{})}function unpartial(e,t,n){return e==null?e:[e,t,n].filter(notNil).reduce((e,t)=>({...e,...trimNilProps(t)}),{})}function trimNilProps(e){return Object.keys(e).reduce((t,n)=>(notNil(e[n])&&(t[n]=e[n]),t),{})}function notNil(e){return e!=null}var zn=__esmMin((()=>{__name(merge$1,`merge`)})),Bn=__commonJSMin((e=>{var t=D(`path`),n=process.platform===`win32`,r=D(`fs`),i=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function rethrow(){var e;if(i){var t=Error();e=debugCallback}else e=missingCallback;return e;function debugCallback(e){e&&(t.message=e.message,e=t,missingCallback(e))}function missingCallback(e){if(e){if(process.throwDeprecation)throw e;if(!process.noDeprecation){var t=`fs: missing callback `+(e.stack||e.message);process.traceDeprecation?console.trace(t):console.error(t)}}}}function maybeCallback(e){return typeof e==`function`?e:rethrow()}if(t.normalize,n)var a=/(.*?)(?:[\/\\]+|$)/g;else var a=/(.*?)(?:[\/]+|$)/g;if(n)var o=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else var o=/^[\/]*/;e.realpathSync=function realpathSync(e,i){if(e=t.resolve(e),i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];var s=e,c={},l={},u,d,p,m;start();function start(){var t=o.exec(e);u=t[0].length,d=t[0],p=t[0],m=``,n&&!l[p]&&(r.lstatSync(p),l[p]=!0)}for(;u<e.length;){a.lastIndex=u;var h=a.exec(e);if(m=d,d+=h[0],p=m+h[1],u=a.lastIndex,!(l[p]||i&&i[p]===p)){var g;if(i&&Object.prototype.hasOwnProperty.call(i,p))g=i[p];else{var _=r.lstatSync(p);if(!_.isSymbolicLink()){l[p]=!0,i&&(i[p]=p);continue}var v=null;if(!n){var y=_.dev.toString(32)+`:`+_.ino.toString(32);c.hasOwnProperty(y)&&(v=c[y])}v===null&&(r.statSync(p),v=r.readlinkSync(p)),g=t.resolve(m,v),i&&(i[p]=g),n||(c[y]=v)}e=t.resolve(g,e.slice(u)),start()}}return i&&(i[s]=e),e},e.realpath=function realpath(e,i,s){if(typeof s!=`function`&&(s=maybeCallback(i),i=null),e=t.resolve(e),i&&Object.prototype.hasOwnProperty.call(i,e))return process.nextTick(s.bind(null,null,i[e]));var c=e,l={},u={},d,p,m,h;start();function start(){var t=o.exec(e);d=t[0].length,p=t[0],m=t[0],h=``,n&&!u[m]?r.lstat(m,function(e){if(e)return s(e);u[m]=!0,LOOP()}):process.nextTick(LOOP)}function LOOP(){if(d>=e.length)return i&&(i[c]=e),s(null,e);a.lastIndex=d;var t=a.exec(e);return h=p,p+=t[0],m=h+t[1],d=a.lastIndex,u[m]||i&&i[m]===m?process.nextTick(LOOP):i&&Object.prototype.hasOwnProperty.call(i,m)?gotResolvedLink(i[m]):r.lstat(m,gotStat)}function gotStat(e,t){if(e)return s(e);if(!t.isSymbolicLink())return u[m]=!0,i&&(i[m]=m),process.nextTick(LOOP);if(!n){var a=t.dev.toString(32)+`:`+t.ino.toString(32);if(l.hasOwnProperty(a))return gotTarget(null,l[a],m)}r.stat(m,function(e){if(e)return s(e);r.readlink(m,function(e,t){n||(l[a]=t),gotTarget(e,t)})})}function gotTarget(e,n,r){if(e)return s(e);var a=t.resolve(h,n);i&&(i[r]=a),gotResolvedLink(a)}function gotResolvedLink(n){e=t.resolve(n,e.slice(d)),start()}}})),Vn=__commonJSMin(((e,t)=>{t.exports=realpath,realpath.realpath=realpath,realpath.sync=realpathSync,realpath.realpathSync=realpathSync,realpath.monkeypatch=monkeypatch,realpath.unmonkeypatch=unmonkeypatch;var n=D(`fs`),r=n.realpath,i=n.realpathSync,a=process.version,o=/^v[0-5]\./.test(a),s=Bn();function newError(e){return e&&e.syscall===`realpath`&&(e.code===`ELOOP`||e.code===`ENOMEM`||e.code===`ENAMETOOLONG`)}function realpath(e,t,n){if(o)return r(e,t,n);typeof t==`function`&&(n=t,t=null),r(e,t,function(r,i){newError(r)?s.realpath(e,t,n):n(r,i)})}function realpathSync(e,t){if(o)return i(e,t);try{return i(e,t)}catch(n){if(newError(n))return s.realpathSync(e,t);throw n}}function monkeypatch(){n.realpath=realpath,n.realpathSync=realpathSync}function unmonkeypatch(){n.realpath=r,n.realpathSync=i}})),Hn=__commonJSMin(((e,t)=>{t.exports=function(e,t){for(var r=[],i=0;i<e.length;i++){var a=t(e[i],i);n(a)?r.push.apply(r,a):r.push(a)}return r};var n=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`}})),Un=__commonJSMin(((e,t)=>{t.exports=balanced;function balanced(e,t,n){e instanceof RegExp&&(e=maybeMatch(e,n)),t instanceof RegExp&&(t=maybeMatch(t,n));var r=range(e,t,n);return r&&{start:r[0],end:r[1],pre:n.slice(0,r[0]),body:n.slice(r[0]+e.length,r[1]),post:n.slice(r[1]+t.length)}}function maybeMatch(e,t){var n=t.match(e);return n?n[0]:null}balanced.range=range;function range(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),Wn=__commonJSMin(((e,t)=>{Hn();var n=Un();t.exports=expandTop;var r=`\0SLASH`+Math.random()+`\0`,i=`\0OPEN`+Math.random()+`\0`,a=`\0CLOSE`+Math.random()+`\0`,o=`\0COMMA`+Math.random()+`\0`,s=`\0PERIOD`+Math.random()+`\0`,c=1e5,l=4e6;function numeric(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function escapeBraces(e){return e.split(`\\\\`).join(r).split(`\\{`).join(i).split(`\\}`).join(a).split(`\\,`).join(o).split(`\\.`).join(s)}function unescapeBraces(e){return e.split(r).join(`\\`).split(i).join(`{`).split(a).join(`}`).split(o).join(`,`).split(s).join(`.`)}function parseCommaParts(e){if(!e)return[``];var t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);var i=r.pre,a=r.body,o=r.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=parseCommaParts(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function expandTop(e,t){if(!e)return[];t||={};var n=t.max==null?c:t.max,r=t.maxLength==null?l:t.maxLength;return e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),expand(escapeBraces(e),n,r,!0).map(unescapeBraces)}function embrace(e){return`{`+e+`}`}function isPadded(e){return/^-?0\d/.test(e)}function lte(e,t){return e<=t}function gte(e,t){return e>=t}function combine(e,t,n,r,i,a,o,s){for(var c=[],l=0,u=0;u<e.length;u++)for(var d=0;d<r.length;d++){if(c.length>=i)return c;var p=e[u]+n+r[d];if(!(o&&p.length===t[u])){if(l+p.length>a)return c;c.push(p),s.push(t[u]),l+=p.length}}return c}function expandSequence(e,t,n,r){var i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;var o=numeric(i[0]),s=numeric(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(numeric(i[2])),1):1,u=lte;s<o&&(l*=-1,u=gte);for(var d=i.some(isPadded),p=0,m=o;u(m,s)&&a.length<n;m+=l){var h;if(t)h=String.fromCharCode(m),h===`\\`&&(h=``);else if(h=String(m),d){var g=c-h.length;if(g>0){var _=Array(g+1).join(`0`);h=m<0?`-`+_+h.slice(1):_+h}}if(p+h.length>r)break;a.push(h),p+=h.length}return a}function expand(e,t,r,i){for(var o=[``],s=[0],c=!1,l=!0,u;;){var d=n(`{`,`}`,e);if(!d)return combine(o,s,e,[``],t,r,c,[]);var p=d.pre;if(/\$$/.test(p))return combine(o,s,e,[``],t,r,c,[]);var m=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),g=m||h,_=d.body.indexOf(`,`)>=0;if(!g&&!_){if(d.post.match(/,(?!,).*\}/)){e=d.pre+`{`+d.body+a+d.post,i=!0,l=!0,c=!1,s=[];for(var v=0;v<o.length;v++)s.push(o[v].length);continue}return combine(o,s,p+`{`+d.body+`}`+d.post,[``],t,r,c,[])}l&&=(c=i&&!g,!1);var y;if(g)y=expandSequence(d.body,h,t,r);else{var b=parseCommaParts(d.body);if(b.length===1&&b[0]!==void 0&&(b=expand(b[0],t,r,!1).map(embrace),b.length===1)){if(u=[],o=combine(o,s,p+b[0],[``],t,r,c&&!d.post.length,u),s=u,!d.post.length)break;e=d.post;continue}for(var x=c&&!d.post.length&&!p,S=0;x&&S<o.length;S++)o[S].length!==s[S]&&(x=!1);y=[];var C=0;outer:for(var w=0;w<b.length;w++)for(var ee=expand(b[w],t,r,!1),T=0;T<ee.length;T++){var E=ee[T];if(!x||E){if(y.length>=t||C+E.length>r)break outer;y.push(E),C+=E.length}}}if(u=[],o=combine(o,s,p,y,t,r,c&&!d.post.length,u),s=u,!d.post.length)break;e=d.post}return o}})),Gn=__commonJSMin(((e,t)=>{t.exports=minimatch,minimatch.Minimatch=Minimatch;var n=function(){try{return D(`path`)}catch{}}()||{sep:`/`};minimatch.sep=n.sep;var r=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={},i=Wn(),a={"!":{open:`(?:(?!(?:`,close:`))[^/]*?)`},"?":{open:`(?:`,close:`)?`},"+":{open:`(?:`,close:`)+`},"*":{open:`(?:`,close:`)*`},"@":{open:`(?:`,close:`)`}},o=`[^/]`,s=o+`*?`,c=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,l=`(?:(?!(?:\\/|^)\\.).)*?`,u=charSet(`().*{}+?[]^$\\!`);function charSet(e){return e.split(``).reduce(function(e,t){return e[t]=!0,e},{})}var d=/\/+/;minimatch.filter=filter;function filter(e,t){return t||={},function(n,r,i){return minimatch(n,e,t)}}function ext(e,t){t||={};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}minimatch.defaults=function(e){if(!e||typeof e!=`object`||!Object.keys(e).length)return minimatch;var t=minimatch,n=function minimatch(n,r,i){return t(n,r,ext(e,i))};return n.Minimatch=function Minimatch(n,r){return new t.Minimatch(n,ext(e,r))},n.Minimatch.defaults=function defaults(n){return t.defaults(ext(e,n)).Minimatch},n.filter=function filter(n,r){return t.filter(n,ext(e,r))},n.defaults=function defaults(n){return t.defaults(ext(e,n))},n.makeRe=function makeRe(n,r){return t.makeRe(n,ext(e,r))},n.braceExpand=function braceExpand(n,r){return t.braceExpand(n,ext(e,r))},n.match=function(n,r,i){return t.match(n,r,ext(e,i))},n},Minimatch.defaults=function(e){return minimatch.defaults(e).Minimatch};function minimatch(e,t,n){return assertValidPattern(t),n||={},!n.nocomment&&t.charAt(0)===`#`?!1:new Minimatch(t,n).match(e)}function Minimatch(e,t){if(!(this instanceof Minimatch))return new Minimatch(e,t);assertValidPattern(e),t||={},e=e.trim(),!t.allowWindowsEscape&&n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion===void 0?200:t.maxGlobstarRecursion,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}Minimatch.prototype.debug=function(){},Minimatch.prototype.make=make;function make(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function debug(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(d)}),this.debug(this.pattern,n),n=n.map(function(e,t,n){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return e.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}Minimatch.prototype.parseNegate=parseNegate;function parseNegate(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,a=e.length;i<a&&e.charAt(i)===`!`;i++)t=!t,r++;r&&(this.pattern=e.substr(r)),this.negate=t}}minimatch.braceExpand=function(e,t){return braceExpand(e,t)},Minimatch.prototype.braceExpand=braceExpand;function braceExpand(e,t){return t||=this instanceof Minimatch?this.options:{},e=e===void 0?this.pattern:e,assertValidPattern(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:i(e)}var p=65536,assertValidPattern=function(e){if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>p)throw TypeError(`pattern is too long`)};Minimatch.prototype.parse=parse;var m={};function parse(e,t){assertValidPattern(e);var n=this.options;if(e===`**`){if(n.noglobstar)e=`*`;else return r}if(e===``)return``;var i=``,c=!!n.nocase,l=!1,d=[],p=[],h,g=!1,_=-1,v=-1,y=e.charAt(0)===`.`?``:n.dot?`(?!(?:^|\\/)\\.{1,2}(?:$|\\/))`:`(?!\\.)`,b=this;function clearStateChar(){if(h){switch(h){case`*`:i+=s,c=!0;break;case`?`:i+=o,c=!0;break;default:i+=`\\`+h}b.debug(`clearStateChar %j %j`,h,i),h=!1}}for(var x=0,S=e.length,C;x<S&&(C=e.charAt(x));x++){if(this.debug(`%s %s %s %j`,e,x,i,C),l&&u[C]){i+=`\\`+C,l=!1;continue}switch(C){case`/`:return!1;case`\\`:clearStateChar(),l=!0;continue;case`?`:case`*`:case`+`:case`@`:case`!`:if(this.debug(`%s %s %s %j <-- stateChar`,e,x,i,C),g){this.debug(` in class`),C===`!`&&x===v+1&&(C=`^`),i+=C;continue}if(C===`*`&&h===`*`)continue;b.debug(`call clearStateChar %j`,h),clearStateChar(),h=C,n.noext&&clearStateChar();continue;case`(`:if(g){i+=`(`;continue}if(!h){i+=`\\(`;continue}d.push({type:h,start:x-1,reStart:i.length,open:a[h].open,close:a[h].close}),i+=h===`!`?`(?:(?!(?:`:`(?:`,this.debug(`plType %j %j`,h,i),h=!1;continue;case`)`:if(g||!d.length){i+=`\\)`;continue}clearStateChar(),c=!0;var w=d.pop();i+=w.close,w.type===`!`&&p.push(w),w.reEnd=i.length;continue;case`|`:if(g||!d.length||l){i+=`\\|`,l=!1;continue}clearStateChar(),i+=`|`;continue;case`[`:if(clearStateChar(),g){i+=`\\`+C;continue}g=!0,v=x,_=i.length,i+=C;continue;case`]`:if(x===v+1||!g){i+=`\\`+C,l=!1;continue}var ee=e.substring(v+1,x);try{RegExp(`[`+ee+`]`)}catch{var T=this.parse(ee,m);i=i.substr(0,_)+`\\[`+T[0]+`\\]`,c||=T[1],g=!1;continue}c=!0,g=!1,i+=C;continue;default:clearStateChar(),l?l=!1:u[C]&&!(C===`^`&&g)&&(i+=`\\`),i+=C}}for(g&&(ee=e.substr(v+1),T=this.parse(ee,m),i=i.substr(0,_)+`\\[`+T[0],c||=T[1]),w=d.pop();w;w=d.pop()){var E=i.slice(w.reStart+w.open.length);this.debug(`setting tail`,i,w),E=E.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,n){return n||=`\\`,t+t+n+`|`}),this.debug(`tail=%j
|
|
25
|
+
%s`,E,E,w,i);var te=w.type===`*`?s:w.type===`?`?o:`\\`+w.type;c=!0,i=i.slice(0,w.reStart)+te+`\\(`+E}clearStateChar(),l&&(i+=`\\\\`);var ne=!1;switch(i.charAt(0)){case`[`:case`.`:case`(`:ne=!0}for(var re=p.length-1;re>-1;re--){var ie=p[re],ae=i.slice(0,ie.reStart),oe=i.slice(ie.reStart,ie.reEnd-8),se=i.slice(ie.reEnd-8,ie.reEnd),ce=i.slice(ie.reEnd);se+=ce;var le=ae.split(`(`).length-1,ue=ce;for(x=0;x<le;x++)ue=ue.replace(/\)[+*?]?/,``);ce=ue;var D=``;ce===``&&t!==m&&(D=`$`),i=ae+oe+ce+D+se}if(i!==``&&c&&(i=`(?=.)`+i),ne&&(i=y+i),t===m)return[i,c];if(!c)return globUnescape(e);var O=n.nocase?`i`:``;try{var de=RegExp(`^`+i+`$`,O)}catch{return RegExp(`$.`)}return de._glob=e,de._src=i,de}minimatch.makeRe=function(e,t){return new Minimatch(e,t||{}).makeRe()},Minimatch.prototype.makeRe=makeRe;function makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,n=t.noglobstar?s:t.dot?c:l,i=t.nocase?`i`:``,a=e.map(function(e){return e.map(function(e){return e===r?n:typeof e==`string`?regExpEscape(e):e._src}).join(`\\/`)}).join(`|`);a=`^(?:`+a+`)$`,this.negate&&(a=`^(?!`+a+`).*$`);try{this.regexp=new RegExp(a,i)}catch{this.regexp=!1}return this.regexp}minimatch.match=function(e,t,n){n||={};var r=new Minimatch(t,n);return e=e.filter(function(e){return r.match(e)}),r.options.nonull&&!e.length&&e.push(t),e},Minimatch.prototype.match=function match(e,t){if(t===void 0&&(t=this.partial),this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;var r=this.options;n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),e=e.split(d),this.debug(this.pattern,`split`,e);var i=this.set;this.debug(this.pattern,`set`,i);for(var a,o=e.length-1;o>=0&&(a=e[o],!a);o--);for(o=0;o<i.length;o++){var s=i[o],c=e;if(r.matchBase&&s.length===1&&(c=[a]),this.matchOne(c,s,t))return r.flipNegate?!0:!this.negate}return!r.flipNegate&&this.negate},Minimatch.prototype.matchOne=function(e,t,n){return t.indexOf(r)===-1?this._matchOne(e,t,n,0,0):this._matchGlobstar(e,t,n,0,0)},Minimatch.prototype._matchGlobstar=function(e,t,n,i,a){var o,s=-1;for(o=a;o<t.length;o++)if(t[o]===r){s=o;break}var c=-1;for(o=t.length-1;o>=0;o--)if(t[o]===r){c=o;break}var l=t.slice(a,s),u=n?t.slice(s+1):t.slice(s+1,c),d=n?[]:t.slice(c+1);if(l.length){var p=e.slice(i,i+l.length);if(!this._matchOne(p,l,n,0,0))return!1;i+=l.length}var m=0;if(d.length){if(d.length+i>e.length)return!1;var h=e.length-d.length;if(this._matchOne(e,d,n,h,0))m=d.length;else{if(e[e.length-1]!==``||i+d.length===e.length||(h--,!this._matchOne(e,d,n,h,0)))return!1;m=d.length+1}}if(!u.length){var g=!!m;for(o=i;o<e.length-m;o++){var _=String(e[o]);if(g=!0,_===`.`||_===`..`||!this.options.dot&&_.charAt(0)===`.`)return!1}return n||g}for(var v=[[[],0]],y=v[0],b=0,x=[0],S=0;S<u.length;S++){var C=u[S];C===r?(x.push(b),y=[[],0],v.push(y)):(y[0].push(C),b++)}for(var w=v.length-1,ee=e.length-m,T=0;T<v.length;T++)v[T][1]=ee-(x[w--]+v[T][0].length);return!!this._matchGlobStarBodySections(e,v,i,0,n,0,!!m)},Minimatch.prototype._matchGlobStarBodySections=function(e,t,n,r,i,a,o){var s=t[r];if(!s){for(var c=n;c<e.length;c++){o=!0;var l=e[c];if(l===`.`||l===`..`||!this.options.dot&&l.charAt(0)===`.`)return!1}return o}for(var u=s[0],d=s[1];n<=d;){if(this._matchOne(e.slice(0,n+u.length),u,i,n,0)&&a<this.maxGlobstarRecursion){var p=this._matchGlobStarBodySections(e,t,n+u.length,r+1,i,a+1,o);if(p!==!1)return p}var l=e[n];if(l===`.`||l===`..`||!this.options.dot&&l.charAt(0)===`.`)return!1;n++}return i||null},Minimatch.prototype._matchOne=function(e,t,n,i,a){for(var o=i,s=a,c=e.length,l=t.length;o<c&&s<l;o++,s++){this.debug(`matchOne loop`);var u=t[s],d=e[o];if(this.debug(t,u,d),u===!1||u===r)return!1;var p;if(typeof u==`string`?(p=d===u,this.debug(`string match`,u,d,p)):(p=d.match(u),this.debug(`pattern match`,u,d,p)),!p)return!1}if(o===c&&s===l)return!0;if(o===c)return n;if(s===l)return o===c-1&&e[o]===``;throw Error(`wtf?`)};function globUnescape(e){return e.replace(/\\(.)/g,`$1`)}function regExpEscape(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`)}})),Kn=__commonJSMin(((e,t)=>{t.exports=typeof Object.create==`function`?function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}})),qn=__commonJSMin(((e,t)=>{try{var n=D(`util`);if(typeof n.inherits!=`function`)throw``;t.exports=n.inherits}catch{t.exports=Kn()}})),Jn=__commonJSMin(((e,t)=>{function posix(e){return e.charAt(0)===`/`}function win32(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(e),n=t[1]||``,r=!!(n&&n.charAt(1)!==`:`);return!!(t[2]||r)}t.exports=process.platform===`win32`?win32:posix,t.exports.posix=posix,t.exports.win32=win32})),Yn=__commonJSMin((e=>{e.setopts=setopts,e.ownProp=ownProp,e.makeAbs=makeAbs,e.finish=finish,e.mark=mark,e.isIgnored=isIgnored,e.childrenIgnored=childrenIgnored;function ownProp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var t=D(`fs`),n=D(`path`),r=Gn(),i=Jn(),a=r.Minimatch;function alphasort(e,t){return e.localeCompare(t,`en`)}function setupIgnores(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]),e.ignore.length&&(e.ignore=e.ignore.map(ignoreMap))}function ignoreMap(e){var t=null;return e.slice(-3)===`/**`&&(t=new a(e.replace(/(\/\*\*)+$/,``),{dot:!0})),{matcher:new a(e,{dot:!0}),gmatcher:t}}function setopts(e,r,o){if(o||={},o.matchBase&&r.indexOf(`/`)===-1){if(o.noglobstar)throw Error(`base matching requires globstar`);r=`**/`+r}e.silent=!!o.silent,e.pattern=r,e.strict=o.strict!==!1,e.realpath=!!o.realpath,e.realpathCache=o.realpathCache||Object.create(null),e.follow=!!o.follow,e.dot=!!o.dot,e.mark=!!o.mark,e.nodir=!!o.nodir,e.nodir&&(e.mark=!0),e.sync=!!o.sync,e.nounique=!!o.nounique,e.nonull=!!o.nonull,e.nosort=!!o.nosort,e.nocase=!!o.nocase,e.stat=!!o.stat,e.noprocess=!!o.noprocess,e.absolute=!!o.absolute,e.fs=o.fs||t,e.maxLength=o.maxLength||1/0,e.cache=o.cache||Object.create(null),e.statCache=o.statCache||Object.create(null),e.symlinks=o.symlinks||Object.create(null),setupIgnores(e,o),e.changedCwd=!1;var s=process.cwd();ownProp(o,`cwd`)?(e.cwd=n.resolve(o.cwd),e.changedCwd=e.cwd!==s):e.cwd=s,e.root=o.root||n.resolve(e.cwd,`/`),e.root=n.resolve(e.root),process.platform===`win32`&&(e.root=e.root.replace(/\\/g,`/`)),e.cwdAbs=i(e.cwd)?e.cwd:makeAbs(e,e.cwd),process.platform===`win32`&&(e.cwdAbs=e.cwdAbs.replace(/\\/g,`/`)),e.nomount=!!o.nomount,o.nonegate=!0,o.nocomment=!0,o.allowWindowsEscape=!1,e.minimatch=new a(r,o),e.options=e.minimatch.options}function finish(e){for(var t=e.nounique,n=t?[]:Object.create(null),r=0,i=e.matches.length;r<i;r++){var a=e.matches[r];if(!a||Object.keys(a).length===0){if(e.nonull){var o=e.minimatch.globSet[r];t?n.push(o):n[o]=!0}}else{var s=Object.keys(a);t?n.push.apply(n,s):s.forEach(function(e){n[e]=!0})}}if(t||(n=Object.keys(n)),e.nosort||(n=n.sort(alphasort)),e.mark){for(var r=0;r<n.length;r++)n[r]=e._mark(n[r]);e.nodir&&(n=n.filter(function(t){var n=!/\/$/.test(t),r=e.cache[t]||e.cache[makeAbs(e,t)];return n&&r&&(n=r!==`DIR`&&!Array.isArray(r)),n}))}e.ignore.length&&(n=n.filter(function(t){return!isIgnored(e,t)})),e.found=n}function mark(e,t){var n=makeAbs(e,t),r=e.cache[n],i=t;if(r){var a=r===`DIR`||Array.isArray(r),o=t.slice(-1)===`/`;if(a&&!o?i+=`/`:!a&&o&&(i=i.slice(0,-1)),i!==t){var s=makeAbs(e,i);e.statCache[s]=e.statCache[n],e.cache[s]=e.cache[n]}}return i}function makeAbs(e,t){var r=t;return r=t.charAt(0)===`/`?n.join(e.root,t):i(t)||t===``?t:e.changedCwd?n.resolve(e.cwd,t):n.resolve(t),process.platform===`win32`&&(r=r.replace(/\\/g,`/`)),r}function isIgnored(e,t){return e.ignore.length?e.ignore.some(function(e){return e.matcher.match(t)||!!(e.gmatcher&&e.gmatcher.match(t))}):!1}function childrenIgnored(e,t){return e.ignore.length?e.ignore.some(function(e){return!!(e.gmatcher&&e.gmatcher.match(t))}):!1}})),Xn=__commonJSMin(((e,t)=>{t.exports=globSync,globSync.GlobSync=GlobSync;var n=Vn(),r=Gn();r.Minimatch,er().Glob,D(`util`);var i=D(`path`),a=D(`assert`),o=Jn(),s=Yn(),c=s.setopts,l=s.ownProp,u=s.childrenIgnored,d=s.isIgnored;function globSync(e,t){if(typeof t==`function`||arguments.length===3)throw TypeError(`callback provided to sync glob
|
|
26
|
+
See: https://github.com/isaacs/node-glob/issues/167`);return new GlobSync(e,t).found}function GlobSync(e,t){if(!e)throw Error(`must provide pattern`);if(typeof t==`function`||arguments.length===3)throw TypeError(`callback provided to sync glob
|
|
27
|
+
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof GlobSync))return new GlobSync(e,t);if(c(this,e,t),this.noprocess)return this;var n=this.minimatch.set.length;this.matches=Array(n);for(var r=0;r<n;r++)this._process(this.minimatch.set[r],r,!1);this._finish()}GlobSync.prototype._finish=function(){if(a.ok(this instanceof GlobSync),this.realpath){var e=this;this.matches.forEach(function(t,r){var i=e.matches[r]=Object.create(null);for(var a in t)try{a=e._makeAbs(a);var o=n.realpathSync(a,e.realpathCache);i[o]=!0}catch(t){if(t.syscall===`stat`)i[e._makeAbs(a)]=!0;else throw t}})}s.finish(this)},GlobSync.prototype._process=function(e,t,n){a.ok(this instanceof GlobSync);for(var i=0;typeof e[i]==`string`;)i++;var s;switch(i){case e.length:this._processSimple(e.join(`/`),t);return;case 0:s=null;break;default:s=e.slice(0,i).join(`/`)}var c=e.slice(i),l;s===null?l=`.`:((o(s)||o(e.map(function(e){return typeof e==`string`?e:`[*]`}).join(`/`)))&&(!s||!o(s))&&(s=`/`+s),l=s);var d=this._makeAbs(l);u(this,l)||(c[0]===r.GLOBSTAR?this._processGlobStar(s,l,d,c,t,n):this._processReaddir(s,l,d,c,t,n))},GlobSync.prototype._processReaddir=function(e,t,n,r,a,o){var s=this._readdir(n,o);if(s){for(var c=r[0],l=!!this.minimatch.negate,u=c._glob,d=this.dot||u.charAt(0)===`.`,p=[],m=0;m<s.length;m++){var h=s[m];(h.charAt(0)!==`.`||d)&&(l&&!e?!h.match(c):h.match(c))&&p.push(h)}var g=p.length;if(g!==0){if(r.length===1&&!this.mark&&!this.stat){this.matches[a]||(this.matches[a]=Object.create(null));for(var m=0;m<g;m++){var h=p[m];e&&(h=e.slice(-1)===`/`?e+h:e+`/`+h),h.charAt(0)===`/`&&!this.nomount&&(h=i.join(this.root,h)),this._emitMatch(a,h)}return}r.shift();for(var m=0;m<g;m++){var h=p[m],_=e?[e,h]:[h];this._process(_.concat(r),a,o)}}}},GlobSync.prototype._emitMatch=function(e,t){if(!d(this,t)){var n=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=n),!this.matches[e][t]){if(this.nodir){var r=this.cache[n];if(r===`DIR`||Array.isArray(r))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}},GlobSync.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,n;try{n=this.fs.lstatSync(e)}catch(e){if(e.code===`ENOENT`)return null}var r=n&&n.isSymbolicLink();return this.symlinks[e]=r,!r&&n&&!n.isDirectory()?this.cache[e]=`FILE`:t=this._readdir(e,!1),t},GlobSync.prototype._readdir=function(e,t){if(t&&!l(this.symlinks,e))return this._readdirInGlobStar(e);if(l(this.cache,e)){var n=this.cache[e];if(!n||n===`FILE`)return null;if(Array.isArray(n))return n}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(t){return this._readdirError(e,t),null}},GlobSync.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var n=0;n<t.length;n++){var r=t[n];r=e===`/`?e+r:e+`/`+r,this.cache[r]=!0}return this.cache[e]=t,t},GlobSync.prototype._readdirError=function(e,t){switch(t.code){case`ENOTSUP`:case`ENOTDIR`:var n=this._makeAbs(e);if(this.cache[n]=`FILE`,n===this.cwdAbs){var r=Error(t.code+` invalid cwd `+this.cwd);throw r.path=this.cwd,r.code=t.code,r}break;case`ENOENT`:case`ELOOP`:case`ENAMETOOLONG`:case`UNKNOWN`:this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error(`glob error`,t)}},GlobSync.prototype._processGlobStar=function(e,t,n,r,i,a){var o=this._readdir(n,a);if(o){var s=r.slice(1),c=e?[e]:[],l=c.concat(s);this._process(l,i,!1);var u=o.length;if(!(this.symlinks[n]&&a)){for(var d=0;d<u;d++)if(o[d].charAt(0)!==`.`||this.dot){var p=c.concat(o[d],s);this._process(p,i,!0);var m=c.concat(o[d],r);this._process(m,i,!0)}}}},GlobSync.prototype._processSimple=function(e,t){var n=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),n){if(e&&o(e)&&!this.nomount){var r=/[\/\\]$/.test(e);e.charAt(0)===`/`?e=i.join(this.root,e):(e=i.resolve(this.root,e),r&&(e+=`/`))}process.platform===`win32`&&(e=e.replace(/\\/g,`/`)),this._emitMatch(t,e)}},GlobSync.prototype._stat=function(e){var t=this._makeAbs(e),n=e.slice(-1)===`/`;if(e.length>this.maxLength)return!1;if(!this.stat&&l(this.cache,t)){var r=this.cache[t];if(Array.isArray(r)&&(r=`DIR`),!n||r===`DIR`)return r;if(n&&r===`FILE`)return!1}var i=this.statCache[t];if(!i){var a;try{a=this.fs.lstatSync(t)}catch(e){if(e&&(e.code===`ENOENT`||e.code===`ENOTDIR`))return this.statCache[t]=!1,!1}if(a&&a.isSymbolicLink())try{i=this.fs.statSync(t)}catch{i=a}else i=a}this.statCache[t]=i;var r=!0;return i&&(r=i.isDirectory()?`DIR`:`FILE`),this.cache[t]=this.cache[t]||r,n&&r===`FILE`?!1:r},GlobSync.prototype._mark=function(e){return s.mark(this,e)},GlobSync.prototype._makeAbs=function(e){return s.makeAbs(this,e)}})),Zn=__commonJSMin(((e,t)=>{t.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){wrapper[t]=e[t]}),wrapper;function wrapper(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),Qn=__commonJSMin(((e,t)=>{var n=Zn();t.exports=n(once),t.exports.strict=n(onceStrict),once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})});function once(e){var f=function(){return f.called?f.value:(f.called=!0,f.value=e.apply(this,arguments))};return f.called=!1,f}function onceStrict(e){var f=function(){if(f.called)throw Error(f.onceError);return f.called=!0,f.value=e.apply(this,arguments)};return f.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,f.called=!1,f}})),$n=__commonJSMin(((e,t)=>{var n=Zn(),r=Object.create(null),i=Qn();t.exports=n(inflight);function inflight(e,t){return r[e]?(r[e].push(t),null):(r[e]=[t],makeres(e))}function makeres(e){return i(function RES(){var t=r[e],n=t.length,i=slice(arguments);try{for(var a=0;a<n;a++)t[a].apply(null,i)}finally{t.length>n?(t.splice(0,n),process.nextTick(function(){RES.apply(null,i)})):delete r[e]}})}function slice(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r]=e[r];return n}})),er=__commonJSMin(((e,t)=>{t.exports=glob;var n=Vn(),r=Gn();r.Minimatch;var i=qn(),a=D(`events`).EventEmitter,o=D(`path`),s=D(`assert`),c=Jn(),l=Xn(),u=Yn(),d=u.setopts,p=u.ownProp,m=$n();D(`util`);var h=u.childrenIgnored,g=u.isIgnored,_=Qn();function glob(e,t,n){if(typeof t==`function`&&(n=t,t={}),t||={},t.sync){if(n)throw TypeError(`callback provided to sync glob`);return l(e,t)}return new Glob(e,t,n)}glob.sync=l;var v=glob.GlobSync=l.GlobSync;glob.glob=glob;function extend(e,t){if(typeof t!=`object`||!t)return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}glob.hasMagic=function(e,t){var n=extend({},t);n.noprocess=!0;var r=new Glob(e,n).minimatch.set;if(!e)return!1;if(r.length>1)return!0;for(var i=0;i<r[0].length;i++)if(typeof r[0][i]!=`string`)return!0;return!1},glob.Glob=Glob,i(Glob,a);function Glob(e,t,n){if(typeof t==`function`&&(n=t,t=null),t&&t.sync){if(n)throw TypeError(`callback provided to sync glob`);return new v(e,t)}if(!(this instanceof Glob))return new Glob(e,t,n);d(this,e,t),this._didRealPath=!1;var r=this.minimatch.set.length;this.matches=Array(r),typeof n==`function`&&(n=_(n),this.on(`error`,n),this.on(`end`,function(e){n(null,e)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(r===0)return done();for(var a=!0,o=0;o<r;o++)this._process(this.minimatch.set[o],o,!1,done);a=!1;function done(){--i._processing,i._processing<=0&&(a?process.nextTick(function(){i._finish()}):i._finish())}}Glob.prototype._finish=function(){if(s(this instanceof Glob),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();u.finish(this),this.emit(`end`,this.found)}},Glob.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,n=0;n<this.matches.length;n++)this._realpathSet(n,next);function next(){--e===0&&t._finish()}},Glob.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var i=Object.keys(r),a=this,o=i.length;if(o===0)return t();var s=this.matches[e]=Object.create(null);i.forEach(function(r,i){r=a._makeAbs(r),n.realpath(r,a.realpathCache,function(n,i){n?n.syscall===`stat`?s[r]=!0:a.emit(`error`,n):s[i]=!0,--o===0&&(a.matches[e]=s,t())})})},Glob.prototype._mark=function(e){return u.mark(this,e)},Glob.prototype._makeAbs=function(e){return u.makeAbs(this,e)},Glob.prototype.abort=function(){this.aborted=!0,this.emit(`abort`)},Glob.prototype.pause=function(){this.paused||(this.paused=!0,this.emit(`pause`))},Glob.prototype.resume=function(){if(this.paused){if(this.emit(`resume`),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var n=e[t];this._emitMatch(n[0],n[1])}}if(this._processQueue.length){var r=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<r.length;t++){var i=r[t];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}},Glob.prototype._process=function(e,t,n,i){if(s(this instanceof Glob),s(typeof i==`function`),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,n,i]);return}for(var a=0;typeof e[a]==`string`;)a++;var o;switch(a){case e.length:this._processSimple(e.join(`/`),t,i);return;case 0:o=null;break;default:o=e.slice(0,a).join(`/`)}var l=e.slice(a),u;o===null?u=`.`:((c(o)||c(e.map(function(e){return typeof e==`string`?e:`[*]`}).join(`/`)))&&(!o||!c(o))&&(o=`/`+o),u=o);var d=this._makeAbs(u);if(h(this,u))return i();l[0]===r.GLOBSTAR?this._processGlobStar(o,u,d,l,t,n,i):this._processReaddir(o,u,d,l,t,n,i)}},Glob.prototype._processReaddir=function(e,t,n,r,i,a,o){var s=this;this._readdir(n,a,function(c,l){return s._processReaddir2(e,t,n,r,i,a,l,o)})},Glob.prototype._processReaddir2=function(e,t,n,r,i,a,s,c){if(!s)return c();for(var l=r[0],u=!!this.minimatch.negate,d=l._glob,p=this.dot||d.charAt(0)===`.`,m=[],h=0;h<s.length;h++){var g=s[h];(g.charAt(0)!==`.`||p)&&(u&&!e?!g.match(l):g.match(l))&&m.push(g)}var _=m.length;if(_===0)return c();if(r.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var h=0;h<_;h++){var g=m[h];e&&(g=e===`/`?e+g:e+`/`+g),g.charAt(0)===`/`&&!this.nomount&&(g=o.join(this.root,g)),this._emitMatch(i,g)}return c()}r.shift();for(var h=0;h<_;h++){var g=m[h];e&&(g=e===`/`?e+g:e+`/`+g),this._process([g].concat(r),i,a,c)}c()},Glob.prototype._emitMatch=function(e,t){if(!this.aborted&&!g(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var n=c(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=n),!this.matches[e][t]){if(this.nodir){var r=this.cache[n];if(r===`DIR`||Array.isArray(r))return}this.matches[e][t]=!0;var i=this.statCache[n];i&&this.emit(`stat`,t,i),this.emit(`match`,t)}}},Glob.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var n=`lstat\0`+e,r=this,i=m(n,lstatcb_);i&&r.fs.lstat(e,i);function lstatcb_(n,i){if(n&&n.code===`ENOENT`)return t();var a=i&&i.isSymbolicLink();r.symlinks[e]=a,!a&&i&&!i.isDirectory()?(r.cache[e]=`FILE`,t()):r._readdir(e,!1,t)}},Glob.prototype._readdir=function(e,t,n){if(!this.aborted&&(n=m(`readdir\0`+e+`\0`+t,n),n)){if(t&&!p(this.symlinks,e))return this._readdirInGlobStar(e,n);if(p(this.cache,e)){var r=this.cache[e];if(!r||r===`FILE`)return n();if(Array.isArray(r))return n(null,r)}this.fs.readdir(e,readdirCb(this,e,n))}};function readdirCb(e,t,n){return function(r,i){r?e._readdirError(t,r,n):e._readdirEntries(t,i,n)}}Glob.prototype._readdirEntries=function(e,t,n){if(!this.aborted){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var i=t[r];i=e===`/`?e+i:e+`/`+i,this.cache[i]=!0}return this.cache[e]=t,n(null,t)}},Glob.prototype._readdirError=function(e,t,n){if(!this.aborted){switch(t.code){case`ENOTSUP`:case`ENOTDIR`:var r=this._makeAbs(e);if(this.cache[r]=`FILE`,r===this.cwdAbs){var i=Error(t.code+` invalid cwd `+this.cwd);i.path=this.cwd,i.code=t.code,this.emit(`error`,i),this.abort()}break;case`ENOENT`:case`ELOOP`:case`ENAMETOOLONG`:case`UNKNOWN`:this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit(`error`,t),this.abort()),this.silent||console.error(`glob error`,t)}return n()}},Glob.prototype._processGlobStar=function(e,t,n,r,i,a,o){var s=this;this._readdir(n,a,function(c,l){s._processGlobStar2(e,t,n,r,i,a,l,o)})},Glob.prototype._processGlobStar2=function(e,t,n,r,i,a,o,s){if(!o)return s();var c=r.slice(1),l=e?[e]:[],u=l.concat(c);this._process(u,i,!1,s);var d=this.symlinks[n],p=o.length;if(d&&a)return s();for(var m=0;m<p;m++)if(o[m].charAt(0)!==`.`||this.dot){var h=l.concat(o[m],c);this._process(h,i,!0,s);var g=l.concat(o[m],r);this._process(g,i,!0,s)}s()},Glob.prototype._processSimple=function(e,t,n){var r=this;this._stat(e,function(i,a){r._processSimple2(e,t,i,a,n)})},Glob.prototype._processSimple2=function(e,t,n,r,i){if(this.matches[t]||(this.matches[t]=Object.create(null)),!r)return i();if(e&&c(e)&&!this.nomount){var a=/[\/\\]$/.test(e);e.charAt(0)===`/`?e=o.join(this.root,e):(e=o.resolve(this.root,e),a&&(e+=`/`))}process.platform===`win32`&&(e=e.replace(/\\/g,`/`)),this._emitMatch(t,e),i()},Glob.prototype._stat=function(e,t){var n=this._makeAbs(e),r=e.slice(-1)===`/`;if(e.length>this.maxLength)return t();if(!this.stat&&p(this.cache,n)){var i=this.cache[n];if(Array.isArray(i)&&(i=`DIR`),!r||i===`DIR`)return t(null,i);if(r&&i===`FILE`)return t()}var a=this.statCache[n];if(a!==void 0){if(a===!1)return t(null,a);var o=a.isDirectory()?`DIR`:`FILE`;return r&&o===`FILE`?t():t(null,o,a)}var s=this,c=m(`stat\0`+n,lstatcb_);c&&s.fs.lstat(n,c);function lstatcb_(r,i){if(i&&i.isSymbolicLink())return s.fs.stat(n,function(r,a){r?s._stat2(e,n,null,i,t):s._stat2(e,n,r,a,t)});s._stat2(e,n,r,i,t)}},Glob.prototype._stat2=function(e,t,n,r,i){if(n&&(n.code===`ENOENT`||n.code===`ENOTDIR`))return this.statCache[t]=!1,i();var a=e.slice(-1)===`/`;if(this.statCache[t]=r,t.slice(-1)===`/`&&r&&!r.isDirectory())return i(null,!1,r);var o=!0;return r&&(o=r.isDirectory()?`DIR`:`FILE`),this.cache[t]=this.cache[t]||o,a&&o===`FILE`?i():i(null,o,r)}})),tr=__commonJSMin(((e,t)=>{t.exports=rimraf,rimraf.sync=rimrafSync;var n=D(`assert`),r=D(`path`),i=D(`fs`),a=er(),o=438,s={nosort:!0,silent:!0},c=0,l=process.platform===`win32`;function defaults(e){[`unlink`,`chmod`,`stat`,`lstat`,`rmdir`,`readdir`].forEach(function(t){e[t]=e[t]||i[t],t+=`Sync`,e[t]=e[t]||i[t]}),e.maxBusyTries=e.maxBusyTries||3,e.emfileWait=e.emfileWait||1e3,e.glob===!1&&(e.disableGlob=!0),e.disableGlob=e.disableGlob||!1,e.glob=e.glob||s}function rimraf(e,t,r){typeof t==`function`&&(r=t,t={}),n(e,`rimraf: missing path`),n.equal(typeof e,`string`,`rimraf: path should be a string`),n.equal(typeof r,`function`,`rimraf: callback function required`),n(t,`rimraf: invalid options argument provided`),n.equal(typeof t,`object`,`rimraf: options should be object`),defaults(t);var i=0,o=null,s=0;if(t.disableGlob||!a.hasMagic(e))return afterGlob(null,[e]);t.lstat(e,function(n,r){if(!n)return afterGlob(null,[e]);a(e,t.glob,afterGlob)});function next(e){o||=e,--s===0&&r(o)}function afterGlob(e,n){if(e)return r(e);if(s=n.length,s===0)return r();n.forEach(function(e){rimraf_(e,t,function CB(n){if(n){if((n.code===`EBUSY`||n.code===`ENOTEMPTY`||n.code===`EPERM`)&&i<t.maxBusyTries){i++;var r=i*100;return setTimeout(function(){rimraf_(e,t,CB)},r)}if(n.code===`EMFILE`&&c<t.emfileWait)return setTimeout(function(){rimraf_(e,t,CB)},c++);n.code===`ENOENT`&&(n=null)}c=0,next(n)})})}}function rimraf_(e,t,r){n(e),n(t),n(typeof r==`function`),t.lstat(e,function(n,i){if(n&&n.code===`ENOENT`)return r(null);if(n&&n.code===`EPERM`&&l&&fixWinEPERM(e,t,n,r),i&&i.isDirectory())return rmdir(e,t,n,r);t.unlink(e,function(n){if(n){if(n.code===`ENOENT`)return r(null);if(n.code===`EPERM`)return l?fixWinEPERM(e,t,n,r):rmdir(e,t,n,r);if(n.code===`EISDIR`)return rmdir(e,t,n,r)}return r(n)})})}function fixWinEPERM(e,t,r,i){n(e),n(t),n(typeof i==`function`),r&&n(r instanceof Error),t.chmod(e,o,function(n){n?i(n.code===`ENOENT`?null:r):t.stat(e,function(n,a){n?i(n.code===`ENOENT`?null:r):a.isDirectory()?rmdir(e,t,r,i):t.unlink(e,i)})})}function fixWinEPERMSync(e,t,r){n(e),n(t),r&&n(r instanceof Error);try{t.chmodSync(e,o)}catch(e){if(e.code===`ENOENT`)return;throw r}try{var i=t.statSync(e)}catch(e){if(e.code===`ENOENT`)return;throw r}i.isDirectory()?rmdirSync(e,t,r):t.unlinkSync(e)}function rmdir(e,t,r,i){n(e),n(t),r&&n(r instanceof Error),n(typeof i==`function`),t.rmdir(e,function(n){n&&(n.code===`ENOTEMPTY`||n.code===`EEXIST`||n.code===`EPERM`)?rmkids(e,t,i):n&&n.code===`ENOTDIR`?i(r):i(n)})}function rmkids(e,t,i){n(e),n(t),n(typeof i==`function`),t.readdir(e,function(n,a){if(n)return i(n);var o=a.length;if(o===0)return t.rmdir(e,i);var s;a.forEach(function(n){rimraf(r.join(e,n),t,function(n){if(!s){if(n)return i(s=n);--o===0&&t.rmdir(e,i)}})})})}function rimrafSync(e,t){t||={},defaults(t),n(e,`rimraf: missing path`),n.equal(typeof e,`string`,`rimraf: path should be a string`),n(t,`rimraf: missing options`),n.equal(typeof t,`object`,`rimraf: options should be object`);var r;if(t.disableGlob||!a.hasMagic(e))r=[e];else try{t.lstatSync(e),r=[e]}catch{r=a.sync(e,t.glob)}if(r.length)for(var i=0;i<r.length;i++){var e=r[i];try{var o=t.lstatSync(e)}catch(n){if(n.code===`ENOENT`)return;n.code===`EPERM`&&l&&fixWinEPERMSync(e,t,n)}try{o&&o.isDirectory()?rmdirSync(e,t,null):t.unlinkSync(e)}catch(n){if(n.code===`ENOENT`)return;if(n.code===`EPERM`)return l?fixWinEPERMSync(e,t,n):rmdirSync(e,t,n);if(n.code!==`EISDIR`)throw n;rmdirSync(e,t,n)}}}function rmdirSync(e,t,r){n(e),n(t),r&&n(r instanceof Error);try{t.rmdirSync(e)}catch(n){if(n.code===`ENOENT`)return;if(n.code===`ENOTDIR`)throw r;(n.code===`ENOTEMPTY`||n.code===`EEXIST`||n.code===`EPERM`)&&rmkidsSync(e,t)}}function rmkidsSync(e,t){n(e),n(t),t.readdirSync(e).forEach(function(n){rimrafSync(r.join(e,n),t)});var i=l?100:1,a=0;do{var o=!0;try{var s=t.rmdirSync(e,t);return o=!1,s}finally{if(++a<i&&o)continue}}while(1)}})),nr=__commonJSMin(((e,t)=>{var n=D(`path`),r=D(`fs`),i=511;t.exports=mkdirP.mkdirp=mkdirP.mkdirP=mkdirP;function mkdirP(e,t,a,o){typeof t==`function`?(a=t,t={}):(!t||typeof t!=`object`)&&(t={mode:t});var s=t.mode,c=t.fs||r;s===void 0&&(s=i),o||=null;var l=a||function(){};e=n.resolve(e),c.mkdir(e,s,function(r){if(!r)return o||=e,l(null,o);switch(r.code){case`ENOENT`:if(n.dirname(e)===e)return l(r);mkdirP(n.dirname(e),t,function(n,r){n?l(n,r):mkdirP(e,t,l,r)});break;default:c.stat(e,function(e,t){e||!t.isDirectory()?l(r,o):l(null,o)})}})}mkdirP.sync=function sync(e,t,a){(!t||typeof t!=`object`)&&(t={mode:t});var o=t.mode,s=t.fs||r;o===void 0&&(o=i),a||=null,e=n.resolve(e);try{s.mkdirSync(e,o),a||=e}catch(r){switch(r.code){case`ENOENT`:a=sync(n.dirname(e),t,a),sync(e,t,a);break;default:var c;try{c=s.statSync(e)}catch{throw r}if(!c.isDirectory())throw r}}return a}})),rr=__commonJSMin(((e,t)=>{let n=D(`fs`),r=D(`path`),i=D(`constants`),a=D(`os`),o=tr(),s=nr();D(`os`).tmpdir();let c=o.sync,l=r.resolve(a.tmpdir()),u=i.O_CREAT|i.O_TRUNC|i.O_RDWR|i.O_EXCL,promisify=function(e){if(typeof e==`function`)return[void 0,e];var promiseCallback;return[new Promise(function(e,t){promiseCallback=function(){var n=Array.from(arguments),r=n.shift();process.nextTick(function(){r?t(r):n.length===1?e(n[0]):e(n)})}}),promiseCallback]};var generateName=function(e,t){var n=parseAffixes(e,t),i=new Date,a=[n.prefix,i.getFullYear(),i.getMonth(),i.getDate(),`-`,process.pid,`-`,(Math.random()*4294967296+1).toString(36),n.suffix].join(``);return r.join(n.dir||l,a)},parseAffixes=function(e,t){var n={prefix:null,suffix:null};if(e)switch(typeof e){case`string`:n.prefix=e;break;case`object`:n=e;break;default:throw Error(`Unknown affix declaration: `+n)}else n.prefix=t;return n},d=!1,track=function(e){return d=e!==!1,t.exports},p=!1,m=[],h=[];function deleteFileOnExit(e){if(!d)return!1;attachExitListener(),m.push(e)}function deleteDirOnExit(e){if(!d)return!1;attachExitListener(),h.push(e)}function attachExitListener(){if(!d)return!1;p||=(process.addListener(`exit`,function(){try{cleanupSync()}catch(e){throw console.warn(`Fail to clean temporary files on exit : `,e),e}}),!0)}function cleanupFilesSync(){if(!d)return!1;for(var e=0,t;(t=m.shift())!==void 0;)c(t,{maxBusyTries:6}),e++;return e}function cleanupFiles(e){var t=promisify(e),n=t[0];if(e=t[1],!d)return e(Error(`not tracking`)),n;var r=0,i=m.length;if(!i)return e(null,r),n;for(var a,rimrafCallback=function(t){if(i){if(t){e(t),i=0;return}r++,i--,i||e(null,r)}};(a=m.shift())!==void 0;)o(a,{maxBusyTries:6},rimrafCallback);return n}function cleanupDirsSync(){if(!d)return!1;for(var e=0,t;(t=h.shift())!==void 0;)c(t,{maxBusyTries:6}),e++;return e}function cleanupDirs(e){var t=promisify(e),n=t[0];if(e=t[1],!d)return e(Error(`not tracking`)),n;var r=0,i=h.length;if(!i)return e(null,r),n;for(var a,rimrafCallback=function(t){if(i){if(t){e(t,r),i=0;return}r++,i--,i||e(null,r)}};(a=h.shift())!==void 0;)o(a,{maxBusyTries:6},rimrafCallback);return n}function cleanupSync(){return d?{files:cleanupFilesSync(),dirs:cleanupDirsSync()}:!1}function cleanup(e){var t=promisify(e),n=t[0];return e=t[1],d?(cleanupFiles(function(t,n){t?e(t,{files:n}):cleanupDirs(function(t,r){e(t,{files:n,dirs:r})})}),n):(e(Error(`not tracking`)),n)}let mkdir=(e,t)=>{let n=promisify(t),r=n[0];t=n[1];let i=generateName(e,`d-`);return s(i,448,e=>{e||deleteDirOnExit(i),t(e,i)}),r},mkdirSync=e=>{let t=generateName(e,`d-`);return s.sync(t,448),deleteDirOnExit(t),t},open=(e,t)=>{let r=promisify(t),i=r[0];t=r[1];let a=generateName(e,`f-`);return n.open(a,u,384,(e,n)=>{e||deleteFileOnExit(a),t(e,{path:a,fd:n})}),i},openSync=e=>{let t=generateName(e,`f-`),r=n.openSync(t,u,384);return deleteFileOnExit(t),{path:t,fd:r}},createWriteStream=e=>{let t=generateName(e,`s-`),r=n.createWriteStream(t,{flags:u,mode:384});return deleteFileOnExit(t),r};e.dir=l,e.track=track,e.mkdir=mkdir,e.mkdirSync=mkdirSync,e.open=open,e.openSync=openSync,e.path=generateName,e.cleanup=cleanup,e.cleanupSync=cleanupSync,e.createWriteStream=createWriteStream})),ir,ar=__esmMin((()=>{ir={"aube-lock.yaml":`aube`,"aube-workspace.yaml":`aube`,"bun.lock":`bun`,"bun.lockb":`bun`,"deno.lock":`deno`,"nub.lock":`nub`,"pnpm-lock.yaml":`pnpm`,"pnpm-workspace.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`,"npm-shrinkwrap.json":`npm`}})),or=__exportAll({findByKeywords:()=>findByKeywords$1});function getCacheFilepath(){return h.join(sr.dir,cr)}function getCacheKey(e,t){return JSON.stringify({cwd:h.resolve(t),keywords:[...e].sort()})}function getCachedPackages(e,t){let n=loadCache(),r=n[e];if(r){if(typeof r.fingerprint!=`number`||r.fingerprint<t){delete n[e],saveCache(n);return}return r.packages}}function setCachedPackages(e,t,n){let r=loadCache();r[e]={fingerprint:t,packages:n},saveCache(r)}function loadCache(){if(lr)return lr;let e=getCacheFilepath();if(!t.existsSync(e))return lr={},lr;try{return lr=JSON.parse(t.readFileSync(e,{encoding:`utf-8`})),lr}catch{return lr={},lr}}function saveCache(e){lr=e;let n=getCacheFilepath();t.writeFileSync(n,JSON.stringify(e))}async function findPackagesInfo(e){try{await t.promises.access(e)}catch{return[]}return recurseFind(e,{})}async function recurseFind(e,n){let r=h.join(e,`node_modules`);if(n[r])return[];n[r]=!0;try{await t.promises.access(r)}catch{return[]}let i=await t.promises.readdir(r),a=[];return await Promise.all(i.map(async e=>{let i=h.join(r,e),o=await tryStatAsync(i);if(o&&o.isDirectory()){if(n[i]=!0,e.startsWith(`@`)){if(e===`@types`)return;let o=await t.promises.readdir(i);await Promise.all(o.map(async t=>{let i=h.join(r,e,t);if(n[i])return;let o=await tryStatAsync(i);if(!o||!o.isDirectory())return;n[i]=!0,a.push({name:`${e}/${t}`,ctimeMs:o.ctimeMs,path:i});let s=await recurseFind(i,n);a.push(...s)}))}else{a.push({name:e,ctimeMs:o.ctimeMs,path:i});let t=await recurseFind(i,n);a.push(...t)}}})),a}async function tryStatAsync(e){try{return await t.promises.stat(e)}catch{return}}async function getFingerprint(e){let t=h.resolve(e),n=0,bump=e=>{e&&e.mtimeMs>n&&(n=e.mtimeMs)};bump(await statSafe(h.join(t,`package.json`))),bump(await statSafe(h.join(t,`node_modules`)));let r=t;for(;;){let e=(await Promise.all(ur.map(e=>statSafe(h.join(r,e))))).filter(e=>!!e);if(e.length>0){e.forEach(bump);break}let t=h.dirname(r);if(t===r)break;r=t}return n}async function statSafe(e){try{return await t.promises.stat(e)}catch{return}}function hasAllKeywords$1(e,t){let n=new Set(e);return!t.find(e=>!n.has(e))}async function readFileSafe(e){try{return await t.promises.readFile(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}async function readManifest$1(e){try{let t=await readFileSafe(h.resolve(e,`package.json`));if(!t)return;let n=JSON.parse(t);return n&&typeof n==`object`?n:void 0}catch{return}}function dependencyNames(e,t){let n=[...keysOf(e.dependencies),...keysOf(e.optionalDependencies),...keysOf(e.peerDependencies),...t?keysOf(e.devDependencies):[]];return Array.from(new Set(n))}function keysOf(e){return e&&typeof e==`object`&&!Array.isArray(e)?Object.keys(e):[]}async function resolvePackagesInfo(e){let t=h.resolve(e),n=await readManifest$1(t);if(!n)return;let r=dependencyNames(n,!0);if(r.length===0)return;let i=[];return await walk(t,r,new Set([t]),i),i}async function walk(e,t,n,r){await Promise.all(t.map(async t=>{if(t.indexOf(`@types/`)===0)return;let i=resolvePackageDir(t,e);if(!i||n.has(i))return;n.add(i);let a=await readManifest$1(i);a&&(a.name&&r.push({name:a.name,path:i,manifest:a}),await walk(i,dependencyNames(a,!1),n,r))}))}function resolvePackageDir(n,r){let i=e(h.join(r,`package.json`));try{return h.dirname(i.resolve(`${n}/package.json`))}catch{}try{let e=i.resolve.paths(n);if(e)for(let r of e){let e=h.join(r,n);if(t.existsSync(h.join(e,`package.json`)))return e}}catch{}try{let e=h.dirname(i.resolve(n));for(;;){if(readNameSync(e)===n)return e;let t=h.dirname(e);if(t===e)return;e=t}}catch{}}function readNameSync(e){try{return JSON.parse(t.readFileSync(h.join(e,`package.json`),`utf8`)).name}catch{return}}async function findByKeywords$1(e,t){let{cwd:n}=unpartial({cwd:`.`},t);return getPackages(e,n)}async function getPackages(e,t){let n=getCacheKey(e,t),r=await getFingerprint(t),i=getCachedPackages(n,r);if(i)return i;let a=(await collectManifests(t)).filter(t=>t.name&&hasAllKeywords$1(t.keywords,e)).map(e=>e.name),o=Array.from(new Set(a));return setCachedPackages(n,r,o),o}async function collectManifests(e){let t=await resolvePackagesInfo(e);if(t)return t.map(e=>e.manifest);let n=await findPackagesInfo(e);return(await Promise.all(n.map(e=>readManifest$1(e.path)))).filter(e=>!!e)}var sr,cr,lr,ur,dr=__esmMin((()=>{zn(),sr=__toESM(rr(),1),ar(),cr=`.find-installed-packages.cache`,ur=Object.keys(ir).concat([`.pnp.cjs`,`.pnp.data.json`]),__name(hasAllKeywords$1,`hasAllKeywords`),__name(readManifest$1,`readManifest`),__name(findByKeywords$1,`findByKeywords`)}));function hasAllKeywords(e,t){let n=new Set(e);return!t.find(e=>!n.has(e))}var fr=__esmMin((()=>{}));function pickPackagesWithKeywords(e,t,n){let r=e.filter(e=>hasAllKeywords(e.keywords,t));return n?r.map(e=>n.reduce((t,n)=>(t[n]=e[n],t),{name:e.name})):r.map(e=>e.name)}var pr=__esmMin((()=>{fr()}));async function fetchPackagesByKeywords(e,t={}){let{registry:n=mr,maxResults:r=hr,signal:i,fetch:a=globalThis.fetch}=t;if(e.length===0)return{packages:[],truncated:!1};if(typeof a!=`function`)throw new RegistrySearchError(`global fetch is not available; Node 18 or later is required`);let o=`keywords:${e.join(`,`)}`,s=[],c=1/0;for(;s.length<r&&s.length<c;){let e=Math.min(250,r-s.length),t=await a(`${trimTrailingSlash(n)}/-/v1/search?text=${encodeURIComponent(o)}&size=${e}&from=${s.length}`,{signal:i});if(!t.ok)throw new RegistrySearchError(`npm registry search failed: ${t.status} ${t.statusText}`,t.status);let l=await t.json(),u=l?.objects??[];if(c=typeof l?.total==`number`?l.total:s.length+u.length,u.length===0)return{packages:s,truncated:!1};for(let e of u)e?.package&&s.push(e.package)}return{packages:s,truncated:c>s.length}}function trimTrailingSlash(e){return e.endsWith(`/`)?e.slice(0,-1):e}var mr,hr,RegistrySearchError,gr=__esmMin((()=>{mr=`https://registry.npmjs.org`,hr=1e3,RegistrySearchError=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`RegistrySearchError`}}}));async function searchByKeywords$1(e,t,n){let{packages:r}=await fetchPackagesByKeywords(e,n);return pickPackagesWithKeywords(r,e,t)}var _r=__esmMin((()=>{pr(),gr(),__name(searchByKeywords$1,`searchByKeywords`)})),vr=__exportAll({DEFAULT_MAX_RESULTS:()=>hr,DEFAULT_REGISTRY:()=>mr,MAX_PAGE_SIZE:()=>250,RegistrySearchError:()=>RegistrySearchError,fetchPackagesByKeywords:()=>fetchPackagesByKeywords,hasAllKeywords:()=>hasAllKeywords,pickPackagesWithKeywords:()=>pickPackagesWithKeywords,searchByKeywords:()=>searchByKeywords$1}),yr=__esmMin((()=>{fr(),pr(),gr(),_r()}));const findByKeywords=async(...e)=>(await Promise.resolve().then(()=>(dr(),or))).findByKeywords(...e),searchByKeywords=async(...e)=>(await Promise.resolve().then(()=>(yr(),vr))).searchByKeywords(...e),br=command({name:`list`,alias:[`ls`],description:`List installed plugins`,options:{format:Rn},context:{findByKeywords},async run(e){let t=await this.context.findByKeywords(this.keywords,this);return reportPlugins(this.ui,e.format,t,this.keywords),t}});function reportPlugins(e,t,n,r){if(t===`json`){e.info(JSON.stringify({plugins:n},void 0,2));return}if(t===`text`){reportProse(e,{noun:`plugin`,plural:`plugins`},n,e=>e,r);return}if(n.length===0){e.info(`plugins: 0 installed plugins found with keywords: ${r.join(`, `)}`),e.info(toonHelp("Run `plugins search` to find plugins to install"));return}e.info(toonArray(`plugins`,n)),e.info(toonHelp("Run `plugins search` to find more plugins on npm"))}const xr=command({name:`search`,description:`Search only for available plugins`,options:{format:Rn,fields:{type:q(K()),description:`Extra fields to report, comma separated. Only 'keywords' is available`}},context:{searchByKeywords},async run(e){let t=parseFields(e.fields);if(!t){this.ui.info(`error: unknown value for --fields: ${e.fields}`),this.ui.info(toonHelp("The only extra field is `keywords`. Run `plugins search --fields keywords`"));return}let n=await Promise.all(this.keywords.map(e=>this.context.searchByKeywords([e]))),r=new Map;n.forEach((e,t)=>{e.forEach(e=>{let n=r.get(e);n?n.push(this.keywords[t]):r.set(e,[this.keywords[t]])})}),reportPackages(this.ui,e.format,t,[...r].map(toPackage),this.keywords)}});function toPackage([e,t]){return{name:e,keywords:t}}function parseFields(e){if(e===void 0)return{keywords:!1};let t=e.split(`,`).map(e=>e.trim());if(!t.some(e=>e!==`keywords`&&e!==`name`))return{keywords:t.includes(`keywords`)}}function reportPackages(e,t,n,r,i){if(t===`json`){let t=n.keywords?r:r.map(e=>e.name);e.info(JSON.stringify({packages:t},void 0,2));return}if(t===`text`){let describe=e=>n.keywords?`${e.name} (${e.keywords.join(`, `)})`:e.name;reportProse(e,{noun:`package`,plural:`packages`},r,describe,i);return}if(r.length===0){e.info(`packages: 0 packages found with keywords: ${i.join(`, `)}`);return}n.keywords?toonTable(`packages`,[`name`,`keywords`],r.map(e=>[e.name,e.keywords.join(` `)])).forEach(t=>{e.info(t)}):e.info(toonArray(`packages`,r.map(e=>e.name))),e.info(toonHelp("Run `plugins list` to see which of them are installed"))}const Sr=command({name:`plugins`,description:`Commands related to the plugins of the cli`,commands:[br,xr]});function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var J={},Cr={},wr={},Tr;function requireCommon(){if(Tr)return wr;Tr=1;function isNothing(e){return e==null}function isObject(e){return typeof e==`object`&&!!e}function toArray(e){return Array.isArray(e)?e:isNothing(e)?[]:[e]}function extend(e,t){if(t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r+=1){let i=n[r];e[i]=t[i]}}return e}function repeat(e,t){let n=``;for(let r=0;r<t;r+=1)n+=e;return n}function isNegativeZero(e){return e===0&&1/e==-1/0}return wr.isNothing=isNothing,wr.isObject=isObject,wr.toArray=toArray,wr.repeat=repeat,wr.isNegativeZero=isNegativeZero,wr.extend=extend,wr}var Er,Dr;function requireException(){if(Dr)return Er;Dr=1;function formatError(e,t){let n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
|
|
32
28
|
|
|
33
|
-
`+e.mark.snippet),r+` `+n):r}function
|
|
34
|
-
`+
|
|
35
|
-
`,
|
|
36
|
-
`;for(let
|
|
37
|
-
`}return u.replace(/\n$/,``)}return oc=r,oc}var lc,uc;function dc(){if(uc)return lc;uc=1;let e=ac(),t=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],n=[`scalar`,`sequence`,`mapping`];function r(e){let t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function i(i,a){if(a||={},Object.keys(a).forEach(function(n){if(t.indexOf(n)===-1)throw new e(`Unknown option "`+n+`" is met in definition of "`+i+`" YAML type.`)}),this.options=a,this.tag=i,this.kind=a.kind||null,this.resolve=a.resolve||function(){return!0},this.construct=a.construct||function(e){return e},this.instanceOf=a.instanceOf||null,this.predicate=a.predicate||null,this.represent=a.represent||null,this.representName=a.representName||null,this.defaultStyle=a.defaultStyle||null,this.multi=a.multi||!1,this.styleAliases=r(a.styleAliases||null),n.indexOf(this.kind)===-1)throw new e(`Unknown kind "`+this.kind+`" is specified for "`+i+`" YAML type.`)}return lc=i,lc}var fc,pc;function mc(){if(pc)return fc;pc=1;let e=ac(),t=dc();function n(e,t){let n=[];return e[t].forEach(function(e){let t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function r(){let e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function t(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(let e=0,n=arguments.length;e<n;e+=1)arguments[e].forEach(t);return e}function i(e){return this.extend(e)}return i.prototype.extend=function(a){let o=[],s=[];if(a instanceof t)s.push(a);else if(Array.isArray(a))s=s.concat(a);else if(a&&(Array.isArray(a.implicit)||Array.isArray(a.explicit)))a.implicit&&(o=o.concat(a.implicit)),a.explicit&&(s=s.concat(a.explicit));else throw new e(`Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })`);o.forEach(function(n){if(!(n instanceof t))throw new e(`Specified list of YAML types (or a single Type object) contains a non-Type object.`);if(n.loadKind&&n.loadKind!==`scalar`)throw new e(`There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.`);if(n.multi)throw new e(`There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.`)}),s.forEach(function(n){if(!(n instanceof t))throw new e(`Specified list of YAML types (or a single Type object) contains a non-Type object.`)});let c=Object.create(i.prototype);return c.implicit=(this.implicit||[]).concat(o),c.explicit=(this.explicit||[]).concat(s),c.compiledImplicit=n(c,`implicit`),c.compiledExplicit=n(c,`explicit`),c.compiledTypeMap=r(c.compiledImplicit,c.compiledExplicit),c},fc=i,fc}var hc,gc;function _c(){return gc?hc:(gc=1,hc=new(dc())(`tag:yaml.org,2002:str`,{kind:`scalar`,construct:function(e){return e===null?``:e}}),hc)}var vc,yc;function bc(){return yc?vc:(yc=1,vc=new(dc())(`tag:yaml.org,2002:seq`,{kind:`sequence`,construct:function(e){return e===null?[]:e}}),vc)}var xc,Sc;function Cc(){return Sc?xc:(Sc=1,xc=new(dc())(`tag:yaml.org,2002:map`,{kind:`mapping`,construct:function(e){return e===null?{}:e}}),xc)}var wc,Tc;function Ec(){return Tc?wc:(Tc=1,wc=new(mc())({explicit:[_c(),bc(),Cc()]}),wc)}var Dc,Oc;function kc(){if(Oc)return Dc;Oc=1;let e=dc();function t(e){if(e===null)return!0;let t=e.length;return t===1&&e===`~`||t===4&&(e===`null`||e===`Null`||e===`NULL`)}function n(){return null}function r(e){return e===null}return Dc=new e(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:t,construct:n,predicate:r,represent:{canonical:function(){return`~`},lowercase:function(){return`null`},uppercase:function(){return`NULL`},camelcase:function(){return`Null`},empty:function(){return``}},defaultStyle:`lowercase`}),Dc}var Ac,jc;function Mc(){if(jc)return Ac;jc=1;let e=dc();function t(e){if(e===null)return!1;let t=e.length;return t===4&&(e===`true`||e===`True`||e===`TRUE`)||t===5&&(e===`false`||e===`False`||e===`FALSE`)}function n(e){return e===`true`||e===`True`||e===`TRUE`}function r(e){return Object.prototype.toString.call(e)===`[object Boolean]`}return Ac=new e(`tag:yaml.org,2002:bool`,{kind:`scalar`,resolve:t,construct:n,predicate:r,represent:{lowercase:function(e){return e?`true`:`false`},uppercase:function(e){return e?`TRUE`:`FALSE`},camelcase:function(e){return e?`True`:`False`}},defaultStyle:`lowercase`}),Ac}var Nc,Pc;function Fc(){if(Pc)return Nc;Pc=1;let e=nc(),t=dc();function n(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function r(e){return e>=48&&e<=55}function i(e){return e>=48&&e<=57}function a(e){if(e===null)return!1;let t=e.length,a=0,s=!1;if(!t)return!1;let c=e[a];if((c===`-`||c===`+`)&&(c=e[++a]),c===`0`){if(a+1===t)return!0;if(c=e[++a],c===`b`){for(a++;a<t;a++){if(c=e[a],c!==`0`&&c!==`1`)return!1;s=!0}return s&&isFinite(o(e))}if(c===`x`){for(a++;a<t;a++){if(!n(e.charCodeAt(a)))return!1;s=!0}return s&&isFinite(o(e))}if(c===`o`){for(a++;a<t;a++){if(!r(e.charCodeAt(a)))return!1;s=!0}return s&&isFinite(o(e))}}for(;a<t;a++){if(!i(e.charCodeAt(a)))return!1;s=!0}return s?isFinite(o(e)):!1}function o(e){let t=e,n=1,r=t[0];if((r===`-`||r===`+`)&&(r===`-`&&(n=-1),t=t.slice(1),r=t[0]),t===`0`)return 0;if(r===`0`){if(t[1]===`b`)return n*parseInt(t.slice(2),2);if(t[1]===`x`)return n*parseInt(t.slice(2),16);if(t[1]===`o`)return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function s(e){return o(e)}function c(t){return Object.prototype.toString.call(t)===`[object Number]`&&t%1==0&&!e.isNegativeZero(t)}return Nc=new t(`tag:yaml.org,2002:int`,{kind:`scalar`,resolve:a,construct:s,predicate:c,represent:{binary:function(e){return e>=0?`0b`+e.toString(2):`-0b`+e.toString(2).slice(1)},octal:function(e){return e>=0?`0o`+e.toString(8):`-0o`+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?`0x`+e.toString(16).toUpperCase():`-0x`+e.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}}),Nc}var Ic,Lc;function Rc(){if(Lc)return Ic;Lc=1;let e=nc(),t=dc(),n=RegExp(`^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),r=RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function i(e){return e===null||!n.test(e)?!1:isFinite(parseFloat(e,10))?!0:r.test(e)}function a(e){let t=e.toLowerCase(),n=t[0]===`-`?-1:1;return`+-`.indexOf(t[0])>=0&&(t=t.slice(1)),t===`.inf`?n===1?1/0:-1/0:t===`.nan`?NaN:n*parseFloat(t,10)}let o=/^[-+]?[0-9]+e/;function s(t,n){if(isNaN(t))switch(n){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(t===1/0)switch(n){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(t===-1/0)switch(n){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(e.isNegativeZero(t))return`-0.0`;let r=t.toString(10);return o.test(r)?r.replace(`e`,`.e`):r}function c(t){return Object.prototype.toString.call(t)===`[object Number]`&&(t%1!=0||e.isNegativeZero(t))}return Ic=new t(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:i,construct:a,predicate:c,represent:s,defaultStyle:`lowercase`}),Ic}var zc,Bc;function Vc(){return Bc?zc:(Bc=1,zc=Ec().extend({implicit:[kc(),Mc(),Fc(),Rc()]}),zc)}var Hc,Uc;function Wc(){return Uc?Hc:(Uc=1,Hc=Vc(),Hc)}var Gc,Kc;function qc(){if(Kc)return Gc;Kc=1;let e=dc(),t=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),n=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function r(e){return e===null?!1:t.exec(e)!==null||n.exec(e)!==null}function i(e){let r=0,i=null,a=t.exec(e);if(a===null&&(a=n.exec(e)),a===null)throw Error(`Date resolve error`);let o=+a[1],s=a[2]-1,c=+a[3];if(!a[4])return new Date(Date.UTC(o,s,c));let l=+a[4],u=+a[5],d=+a[6];if(a[7]){for(r=a[7].slice(0,3);r.length<3;)r+=`0`;r=+r}if(a[9]){let e=+a[10],t=+(a[11]||0);i=(e*60+t)*6e4,a[9]===`-`&&(i=-i)}let f=new Date(Date.UTC(o,s,c,l,u,d,r));return i&&f.setTime(f.getTime()-i),f}function a(e){return e.toISOString()}return Gc=new e(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:r,construct:i,instanceOf:Date,represent:a}),Gc}var Jc,Yc;function Xc(){if(Yc)return Jc;Yc=1;let e=dc();function t(e){return e===`<<`||e===null}return Jc=new e(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:t}),Jc}var Zc,Qc;function $c(){if(Qc)return Zc;Qc=1;let e=dc();function t(e){if(e===null)return!1;let t=0,n=e.length;for(let r=0;r<n;r++){let n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
38
|
-
\r`.indexOf(e.charAt(r));if(!(n>64)){if(n<0)return!1;t+=6}}return t%8==0}function
|
|
39
|
-
\r`.indexOf(t.charAt(e));let a=n%4*6;return a===0?(i.push(r>>16&255),i.push(r>>8&255),i.push(r&255)):a===18?(i.push(r>>10&255),i.push(r>>2&255)):a===12&&i.push(r>>4&255),new Uint8Array(i)}function
|
|
40
|
-
\r`;for(let a=0;a<r;a++)a%3==0&&a&&(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]),n=(n<<8)+e[a];let a=r%3;return a===0?(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]):a===2?(t+=i[n>>10&63],t+=i[n>>4&63],t+=i[n<<2&63],t+=i[64]):a===1&&(t+=i[n>>2&63],t+=i[n<<4&63],t+=i[64],t+=i[64]),t}function
|
|
41
|
-
`;case 118:return`\v`;case 102:return`\f`;case 114:return`\r`;case 101:return`\x1B`;case 32:return` `;case 34:return`"`;case 47:return`/`;case 92:return`\\`;case 78:return`
`;case 95:return`\xA0`;case 76:return`\u2028`;case 80:return`\u2029`;default:return``}}function
|
|
42
|
-
`,n-1))}function
|
|
29
|
+
`+e.mark.snippet),r+` `+n):r}function YAMLException2(e,t){Error.call(this),this.name=`YAMLException`,this.reason=e,this.mark=t,this.message=formatError(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack||``}return YAMLException2.prototype=Object.create(Error.prototype),YAMLException2.prototype.constructor=YAMLException2,YAMLException2.prototype.toString=function toString(e){return this.name+`: `+formatError(this,e)},Er=YAMLException2,Er}var Or,kr;function requireSnippet(){if(kr)return Or;kr=1;let e=requireCommon();function getLine(e,t,n,r,i){let a=``,o=``,s=Math.floor(i/2)-1;return r-t>s&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function padStart(t,n){return e.repeat(` `,n-t.length)+t}function makeSnippet(t,n){if(n=Object.create(n||null),!t.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!=`number`&&(n.indent=1),typeof n.linesBefore!=`number`&&(n.linesBefore=3),typeof n.linesAfter!=`number`&&(n.linesAfter=2);let r=/\r?\n|\r|\0/g,i=[0],a=[],o,s=-1;for(;o=r.exec(t.buffer);)a.push(o.index),i.push(o.index+o[0].length),t.position<=o.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);let c=``,l=Math.min(t.line+n.linesAfter,a.length).toString().length,u=n.maxLength-(n.indent+l+3);for(let r=1;r<=n.linesBefore&&!(s-r<0);r++){let o=getLine(t.buffer,i[s-r],a[s-r],t.position-(i[s]-i[s-r]),u);c=e.repeat(` `,n.indent)+padStart((t.line-r+1).toString(),l)+` | `+o.str+`
|
|
30
|
+
`+c}let d=getLine(t.buffer,i[s],a[s],t.position,u);c+=e.repeat(` `,n.indent)+padStart((t.line+1).toString(),l)+` | `+d.str+`
|
|
31
|
+
`,c+=e.repeat(`-`,n.indent+l+3+d.pos)+`^
|
|
32
|
+
`;for(let r=1;r<=n.linesAfter&&!(s+r>=a.length);r++){let o=getLine(t.buffer,i[s+r],a[s+r],t.position-(i[s]-i[s+r]),u);c+=e.repeat(` `,n.indent)+padStart((t.line+r+1).toString(),l)+` | `+o.str+`
|
|
33
|
+
`}return c.replace(/\n$/,``)}return Or=makeSnippet,Or}var Ar,jr;function requireType(){if(jr)return Ar;jr=1;let e=requireException(),t=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],n=[`scalar`,`sequence`,`mapping`];function compileStyleAliases(e){let t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function Type2(r,i){if(i||={},Object.keys(i).forEach(function(n){if(t.indexOf(n)===-1)throw new e(`Unknown option "`+n+`" is met in definition of "`+r+`" YAML type.`)}),this.options=i,this.tag=r,this.kind=i.kind||null,this.resolve=i.resolve||function(){return!0},this.construct=i.construct||function(e){return e},this.instanceOf=i.instanceOf||null,this.predicate=i.predicate||null,this.represent=i.represent||null,this.representName=i.representName||null,this.defaultStyle=i.defaultStyle||null,this.multi=i.multi||!1,this.styleAliases=compileStyleAliases(i.styleAliases||null),n.indexOf(this.kind)===-1)throw new e(`Unknown kind "`+this.kind+`" is specified for "`+r+`" YAML type.`)}return Ar=Type2,Ar}var Mr,Nr;function requireSchema(){if(Nr)return Mr;Nr=1;let e=requireException(),t=requireType();function compileList(e,t){let n=[];return e[t].forEach(function(e){let t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function compileMap(){let e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function collectType(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(let e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(collectType);return e}function Schema2(e){return this.extend(e)}return Schema2.prototype.extend=function extend(n){let r=[],i=[];if(n instanceof t)i.push(n);else if(Array.isArray(n))i=i.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(r=r.concat(n.implicit)),n.explicit&&(i=i.concat(n.explicit));else throw new e(`Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })`);r.forEach(function(n){if(!(n instanceof t))throw new e(`Specified list of YAML types (or a single Type object) contains a non-Type object.`);if(n.loadKind&&n.loadKind!==`scalar`)throw new e(`There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.`);if(n.multi)throw new e(`There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.`)}),i.forEach(function(n){if(!(n instanceof t))throw new e(`Specified list of YAML types (or a single Type object) contains a non-Type object.`)});let a=Object.create(Schema2.prototype);return a.implicit=(this.implicit||[]).concat(r),a.explicit=(this.explicit||[]).concat(i),a.compiledImplicit=compileList(a,`implicit`),a.compiledExplicit=compileList(a,`explicit`),a.compiledTypeMap=compileMap(a.compiledImplicit,a.compiledExplicit),a},Mr=Schema2,Mr}var Pr,Fr;function requireStr(){return Fr?Pr:(Fr=1,Pr=new(requireType())(`tag:yaml.org,2002:str`,{kind:`scalar`,construct:function(e){return e===null?``:e}}),Pr)}var Ir,Lr;function requireSeq(){return Lr?Ir:(Lr=1,Ir=new(requireType())(`tag:yaml.org,2002:seq`,{kind:`sequence`,construct:function(e){return e===null?[]:e}}),Ir)}var Rr,zr;function requireMap(){return zr?Rr:(zr=1,Rr=new(requireType())(`tag:yaml.org,2002:map`,{kind:`mapping`,construct:function(e){return e===null?{}:e}}),Rr)}var Br,Vr;function requireFailsafe(){return Vr?Br:(Vr=1,Br=new(requireSchema())({explicit:[requireStr(),requireSeq(),requireMap()]}),Br)}var Hr,Ur;function require_null$1(){if(Ur)return Hr;Ur=1;let e=requireType();function resolveYamlNull(e){if(e===null)return!0;let t=e.length;return t===1&&e===`~`||t===4&&(e===`null`||e===`Null`||e===`NULL`)}function constructYamlNull(){return null}function isNull(e){return e===null}return Hr=new e(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:resolveYamlNull,construct:constructYamlNull,predicate:isNull,represent:{canonical:function(){return`~`},lowercase:function(){return`null`},uppercase:function(){return`NULL`},camelcase:function(){return`Null`},empty:function(){return``}},defaultStyle:`lowercase`}),Hr}__name(require_null$1,`require_null`);var Wr,Gr;function requireBool(){if(Gr)return Wr;Gr=1;let e=requireType();function resolveYamlBoolean(e){if(e===null)return!1;let t=e.length;return t===4&&(e===`true`||e===`True`||e===`TRUE`)||t===5&&(e===`false`||e===`False`||e===`FALSE`)}function constructYamlBoolean(e){return e===`true`||e===`True`||e===`TRUE`}function isBoolean(e){return Object.prototype.toString.call(e)===`[object Boolean]`}return Wr=new e(`tag:yaml.org,2002:bool`,{kind:`scalar`,resolve:resolveYamlBoolean,construct:constructYamlBoolean,predicate:isBoolean,represent:{lowercase:function(e){return e?`true`:`false`},uppercase:function(e){return e?`TRUE`:`FALSE`},camelcase:function(e){return e?`True`:`False`}},defaultStyle:`lowercase`}),Wr}var Kr,qr;function requireInt(){if(qr)return Kr;qr=1;let e=requireCommon(),t=requireType();function isHexCode(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function isOctCode(e){return e>=48&&e<=55}function isDecCode(e){return e>=48&&e<=57}function resolveYamlInteger(e){if(e===null)return!1;let t=e.length,n=0,r=!1;if(!t)return!1;let i=e[n];if((i===`-`||i===`+`)&&(i=e[++n]),i===`0`){if(n+1===t)return!0;if(i=e[++n],i===`b`){for(n++;n<t;n++){if(i=e[n],i!==`0`&&i!==`1`)return!1;r=!0}return r&&isFinite(parseYamlInteger(e))}if(i===`x`){for(n++;n<t;n++){if(!isHexCode(e.charCodeAt(n)))return!1;r=!0}return r&&isFinite(parseYamlInteger(e))}if(i===`o`){for(n++;n<t;n++){if(!isOctCode(e.charCodeAt(n)))return!1;r=!0}return r&&isFinite(parseYamlInteger(e))}}for(;n<t;n++){if(!isDecCode(e.charCodeAt(n)))return!1;r=!0}return r?isFinite(parseYamlInteger(e)):!1}function parseYamlInteger(e){let t=e,n=1,r=t[0];if((r===`-`||r===`+`)&&(r===`-`&&(n=-1),t=t.slice(1),r=t[0]),t===`0`)return 0;if(r===`0`){if(t[1]===`b`)return n*parseInt(t.slice(2),2);if(t[1]===`x`)return n*parseInt(t.slice(2),16);if(t[1]===`o`)return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function constructYamlInteger(e){return parseYamlInteger(e)}function isInteger(t){return Object.prototype.toString.call(t)===`[object Number]`&&t%1==0&&!e.isNegativeZero(t)}return Kr=new t(`tag:yaml.org,2002:int`,{kind:`scalar`,resolve:resolveYamlInteger,construct:constructYamlInteger,predicate:isInteger,represent:{binary:function(e){return e>=0?`0b`+e.toString(2):`-0b`+e.toString(2).slice(1)},octal:function(e){return e>=0?`0o`+e.toString(8):`-0o`+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?`0x`+e.toString(16).toUpperCase():`-0x`+e.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}}),Kr}var Jr,Yr;function requireFloat(){if(Yr)return Jr;Yr=1;let e=requireCommon(),t=requireType(),n=RegExp(`^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),r=RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function resolveYamlFloat(e){return e===null||!n.test(e)?!1:isFinite(parseFloat(e,10))?!0:r.test(e)}function constructYamlFloat(e){let t=e.toLowerCase(),n=t[0]===`-`?-1:1;return`+-`.indexOf(t[0])>=0&&(t=t.slice(1)),t===`.inf`?n===1?1/0:-1/0:t===`.nan`?NaN:n*parseFloat(t,10)}let i=/^[-+]?[0-9]+e/;function representYamlFloat(t,n){if(isNaN(t))switch(n){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(t===1/0)switch(n){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(t===-1/0)switch(n){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(e.isNegativeZero(t))return`-0.0`;let r=t.toString(10);return i.test(r)?r.replace(`e`,`.e`):r}function isFloat(t){return Object.prototype.toString.call(t)===`[object Number]`&&(t%1!=0||e.isNegativeZero(t))}return Jr=new t(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:resolveYamlFloat,construct:constructYamlFloat,predicate:isFloat,represent:representYamlFloat,defaultStyle:`lowercase`}),Jr}var Xr,Zr;function requireJson(){return Zr?Xr:(Zr=1,Xr=requireFailsafe().extend({implicit:[require_null$1(),requireBool(),requireInt(),requireFloat()]}),Xr)}var Qr,$r;function requireCore(){return $r?Qr:($r=1,Qr=requireJson(),Qr)}var ei,ti;function requireTimestamp(){if(ti)return ei;ti=1;let e=requireType(),t=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),n=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function resolveYamlTimestamp(e){return e===null?!1:t.exec(e)!==null||n.exec(e)!==null}function constructYamlTimestamp(e){let r=0,i=null,a=t.exec(e);if(a===null&&(a=n.exec(e)),a===null)throw Error(`Date resolve error`);let o=+a[1],s=a[2]-1,c=+a[3];if(!a[4])return new Date(Date.UTC(o,s,c));let l=+a[4],u=+a[5],d=+a[6];if(a[7]){for(r=a[7].slice(0,3);r.length<3;)r+=`0`;r=+r}if(a[9]){let e=+a[10],t=+(a[11]||0);i=(e*60+t)*6e4,a[9]===`-`&&(i=-i)}let p=new Date(Date.UTC(o,s,c,l,u,d,r));return i&&p.setTime(p.getTime()-i),p}function representYamlTimestamp(e){return e.toISOString()}return ei=new e(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:resolveYamlTimestamp,construct:constructYamlTimestamp,instanceOf:Date,represent:representYamlTimestamp}),ei}var ni,ri;function requireMerge(){if(ri)return ni;ri=1;let e=requireType();function resolveYamlMerge(e){return e===`<<`||e===null}return ni=new e(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:resolveYamlMerge}),ni}var ii,ai;function requireBinary(){if(ai)return ii;ai=1;let e=requireType();function resolveYamlBinary(e){if(e===null)return!1;let t=0,n=e.length;for(let r=0;r<n;r++){let n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
34
|
+
\r`.indexOf(e.charAt(r));if(!(n>64)){if(n<0)return!1;t+=6}}return t%8==0}function constructYamlBinary(e){let t=e.replace(/[\r\n=]/g,``),n=t.length,r=0,i=[];for(let e=0;e<n;e++)e%4==0&&e&&(i.push(r>>16&255),i.push(r>>8&255),i.push(r&255)),r=r<<6|`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
35
|
+
\r`.indexOf(t.charAt(e));let a=n%4*6;return a===0?(i.push(r>>16&255),i.push(r>>8&255),i.push(r&255)):a===18?(i.push(r>>10&255),i.push(r>>2&255)):a===12&&i.push(r>>4&255),new Uint8Array(i)}function representYamlBinary(e){let t=``,n=0,r=e.length,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
36
|
+
\r`;for(let a=0;a<r;a++)a%3==0&&a&&(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]),n=(n<<8)+e[a];let a=r%3;return a===0?(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]):a===2?(t+=i[n>>10&63],t+=i[n>>4&63],t+=i[n<<2&63],t+=i[64]):a===1&&(t+=i[n>>2&63],t+=i[n<<4&63],t+=i[64],t+=i[64]),t}function isBinary(e){return Object.prototype.toString.call(e)===`[object Uint8Array]`}return ii=new e(`tag:yaml.org,2002:binary`,{kind:`scalar`,resolve:resolveYamlBinary,construct:constructYamlBinary,predicate:isBinary,represent:representYamlBinary}),ii}var oi,si;function requireOmap(){if(si)return oi;si=1;let e=requireType(),t=Object.prototype.hasOwnProperty,n=Object.prototype.toString;function resolveYamlOmap(e){if(e===null)return!0;let r={},i=e;for(let e=0,a=i.length;e<a;e+=1){let a=i[e],o=!1;if(n.call(a)!==`[object Object]`)return!1;let s;for(s in a)if(t.call(a,s)){if(!o)o=!0;else return!1}if(!o||t.call(r,s))return!1;Object.defineProperty(r,s,{value:!0})}return!0}function constructYamlOmap(e){return e===null?[]:e}return oi=new e(`tag:yaml.org,2002:omap`,{kind:`sequence`,resolve:resolveYamlOmap,construct:constructYamlOmap}),oi}var ci,li;function requirePairs(){if(li)return ci;li=1;let e=requireType(),t=Object.prototype.toString;function resolveYamlPairs(e){if(e===null)return!0;let n=e,r=Array(n.length);for(let e=0,i=n.length;e<i;e+=1){let i=n[e];if(t.call(i)!==`[object Object]`)return!1;let a=Object.keys(i);if(a.length!==1)return!1;r[e]=[a[0],i[a[0]]]}return!0}function constructYamlPairs(e){if(e===null)return[];let t=e,n=Array(t.length);for(let e=0,r=t.length;e<r;e+=1){let r=t[e],i=Object.keys(r);n[e]=[i[0],r[i[0]]]}return n}return ci=new e(`tag:yaml.org,2002:pairs`,{kind:`sequence`,resolve:resolveYamlPairs,construct:constructYamlPairs}),ci}var ui,di;function requireSet(){if(di)return ui;di=1;let e=requireType(),t=Object.prototype.hasOwnProperty;function resolveYamlSet(e){if(e===null)return!0;let n=e;for(let e in n)if(t.call(n,e)&&n[e]!==null)return!1;return!0}function constructYamlSet(e){return e===null?{}:e}return ui=new e(`tag:yaml.org,2002:set`,{kind:`mapping`,resolve:resolveYamlSet,construct:constructYamlSet}),ui}var fi,pi;function require_default(){return pi?fi:(pi=1,fi=requireCore().extend({implicit:[requireTimestamp(),requireMerge()],explicit:[requireBinary(),requireOmap(),requirePairs(),requireSet()]}),fi)}var mi;function requireLoader(){if(mi)return Cr;mi=1;let e=requireCommon(),t=requireException(),n=requireSnippet(),r=require_default(),i=Object.prototype.hasOwnProperty,a=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=/[\x85\u2028\u2029]/,s=/[,\[\]{}]/,c=/^(?:!|!!|![0-9A-Za-z-]+!)$/,l=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function _class(e){return Object.prototype.toString.call(e)}function isEol(e){return e===10||e===13}function isWhiteSpace(e){return e===9||e===32}function isWsOrEol(e){return e===9||e===32||e===10||e===13}function isFlowIndicator(e){return e===44||e===91||e===93||e===123||e===125}function fromHexCode(e){if(e>=48&&e<=57)return e-48;let t=e|32;return t>=97&&t<=102?t-97+10:-1}function escapedHexLen(e){return e===120?2:e===117?4:e===85?8:0}function fromDecimalCode(e){return e>=48&&e<=57?e-48:-1}function simpleEscapeSequence(e){switch(e){case 48:return`\0`;case 97:return`\x07`;case 98:return`\b`;case 116:return` `;case 9:return` `;case 110:return`
|
|
37
|
+
`;case 118:return`\v`;case 102:return`\f`;case 114:return`\r`;case 101:return`\x1B`;case 32:return` `;case 34:return`"`;case 47:return`/`;case 92:return`\\`;case 78:return`
`;case 95:return`\xA0`;case 76:return`\u2028`;case 80:return`\u2029`;default:return``}}function charFromCodepoint(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function setProperty(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}let u=Array(256),d=Array(256);for(let e=0;e<256;e++)u[e]=+!!simpleEscapeSequence(e),d[e]=simpleEscapeSequence(e);function State(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||r,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:100,this.maxTotalMergeKeys=typeof t.maxTotalMergeKeys==`number`?t.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function generateError(e,r){let i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=n(i),new t(r,i)}function throwError(e,t){throw generateError(e,t)}function throwWarning(e,t){e.onWarning&&e.onWarning.call(null,generateError(e,t))}function storeAnchor(e,t,n){let r=e.anchorMapTransactions;if(r.length!==0){let n=r[r.length-1];i.call(n,t)||(n[t]={existed:i.call(e.anchorMap,t),value:e.anchorMap[t]})}e.anchorMap[t]=n}function beginAnchorTransaction(e){e.anchorMapTransactions.push(Object.create(null))}function commitAnchorTransaction(e){let t=e.anchorMapTransactions.pop(),n=e.anchorMapTransactions;if(n.length===0)return;let r=n[n.length-1],a=Object.keys(t);for(let e=0,n=a.length;e<n;e+=1){let n=a[e];i.call(r,n)||(r[n]=t[n])}}function rollbackAnchorTransaction(e){let t=e.anchorMapTransactions.pop(),n=Object.keys(t);for(let r=n.length-1;r>=0;--r){let i=t[n[r]];i.existed?e.anchorMap[n[r]]=i.value:delete e.anchorMap[n[r]]}}function snapshotState(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function restoreState(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.tag=t.tag,e.anchor=t.anchor,e.kind=t.kind,e.result=t.result}let p={YAML:function handleYamlDirective(e,t,n){e.version!==null&&throwError(e,`duplication of %YAML directive`),n.length!==1&&throwError(e,`YAML directive accepts exactly one argument`);let r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);r===null&&throwError(e,`ill-formed argument of the YAML directive`);let i=parseInt(r[1],10),a=parseInt(r[2],10);i!==1&&throwError(e,`unacceptable YAML version of the document`),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&throwWarning(e,`unsupported YAML version of the document`)},TAG:function handleTagDirective(e,t,n){let r;n.length!==2&&throwError(e,`TAG directive accepts exactly two arguments`);let a=n[0];r=n[1],c.test(a)||throwError(e,`ill-formed tag handle (first argument) of the TAG directive`),i.call(e.tagMap,a)&&throwError(e,`there is a previously declared suffix for "`+a+`" tag handle`),l.test(r)||throwError(e,`ill-formed tag prefix (second argument) of the TAG directive`);try{r=decodeURIComponent(r)}catch{throwError(e,`tag prefix is malformed: `+r)}e.tagMap[a]=r}};function captureSegment(e,t,n,r){if(t<n){let i=e.input.slice(t,n);if(r)for(let t=0,n=i.length;t<n;t+=1){let n=i.charCodeAt(t);n===9||n>=32&&n<=1114111||throwError(e,`expected valid JSON character`)}else a.test(i)&&throwError(e,`the stream contains non-printable characters`);e.result+=i}}function chargeMergeWork(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&throwError(e,`merge keys exceeded maxTotalMergeKeys (`+e.maxTotalMergeKeys+`)`)}function mergeMappings(t,n,r,a){e.isObject(r)||throwError(t,`cannot merge mappings; the provided source object is unacceptable`),chargeMergeWork(t);let o=Object.keys(r);for(let e=0,s=o.length;e<s;e+=1){let s=o[e];chargeMergeWork(t),i.call(n,s)||(setProperty(n,s,r[s]),a[s]=!0)}}function storeMappingPair(e,t,n,r,a,o,s,c,l){if(Array.isArray(a)){a=Array.prototype.slice.call(a);for(let t=0,n=a.length;t<n;t+=1)Array.isArray(a[t])&&throwError(e,`nested arrays are not supported inside keys`),typeof a==`object`&&_class(a[t])===`[object Object]`&&(a[t]=`[object Object]`)}if(typeof a==`object`&&_class(a)===`[object Object]`&&(a=`[object Object]`),a=String(a),t===null&&(t={}),r===`tag:yaml.org,2002:merge`){if(Array.isArray(o)){o.length>100&&throwError(e,`abnormal merge sequence size`);for(let r=0,i=o.length;r<i;r+=1)mergeMappings(e,t,o[r],n)}else mergeMappings(e,t,o,n)}else!e.json&&!i.call(n,a)&&i.call(t,a)&&(e.line=s||e.line,e.lineStart=c||e.lineStart,e.position=l||e.position,throwError(e,`duplicated mapping key`)),setProperty(t,a,o),delete n[a];return t}function readLineBreak(e){let t=e.input.charCodeAt(e.position);t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):throwError(e,`a line break is expected`),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function skipSeparationSpace(e,t,n){let r=0,i=e.input.charCodeAt(e.position);for(;i!==0;){for(;isWhiteSpace(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(isEol(i))for(readLineBreak(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&throwWarning(e,`deficient indentation`),r}function testDocumentSeparator(e){let t=e.position,n=e.input.charCodeAt(t);return!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||isWsOrEol(n)))}function writeFoldedLines(t,n){n===1?t.result+=` `:n>1&&(t.result+=e.repeat(`
|
|
38
|
+
`,n-1))}function readPlainScalar(e,t,n){let r,i,a,o,s,c,l=e.kind,u=e.result,d=e.input.charCodeAt(e.position);if(isWsOrEol(d)||isFlowIndicator(d)||d===35||d===38||d===42||d===33||d===124||d===62||d===39||d===34||d===37||d===64||d===96)return!1;if(d===63||d===45){let t=e.input.charCodeAt(e.position+1);if(isWsOrEol(t)||n&&isFlowIndicator(t))return!1}for(e.kind=`scalar`,e.result=``,r=i=e.position,a=!1;d!==0;){if(d===58){let t=e.input.charCodeAt(e.position+1);if(isWsOrEol(t)||n&&isFlowIndicator(t))break}else if(d===35){if(isWsOrEol(e.input.charCodeAt(e.position-1)))break}else if(e.position===e.lineStart&&testDocumentSeparator(e)||n&&isFlowIndicator(d))break;else if(isEol(d)){if(o=e.line,s=e.lineStart,c=e.lineIndent,skipSeparationSpace(e,!1,-1),e.lineIndent>=t){a=!0,d=e.input.charCodeAt(e.position);continue}e.position=i,e.line=o,e.lineStart=s,e.lineIndent=c;break}a&&=(captureSegment(e,r,i,!1),writeFoldedLines(e,e.line-o),r=i=e.position,!1),isWhiteSpace(d)||(i=e.position+1),d=e.input.charCodeAt(++e.position)}return captureSegment(e,r,i,!1),e.result?!0:(e.kind=l,e.result=u,!1)}function readSingleQuotedScalar(e,t){let n,r,i=e.input.charCodeAt(e.position);if(i!==39)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39){if(captureSegment(e,n,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)n=e.position,e.position++,r=e.position;else return!0}else isEol(i)?(captureSegment(e,n,r,!0),writeFoldedLines(e,skipSeparationSpace(e,!1,t)),n=r=e.position):e.position===e.lineStart&&testDocumentSeparator(e)?throwError(e,`unexpected end of the document within a single quoted scalar`):(e.position++,isWhiteSpace(i)||(r=e.position));throwError(e,`unexpected end of the stream within a single quoted scalar`)}function readDoubleQuotedScalar(e,t){let n,r,i,a=e.input.charCodeAt(e.position);if(a!==34)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(a=e.input.charCodeAt(e.position))!==0;)if(a===34)return captureSegment(e,n,e.position,!0),e.position++,!0;else if(a===92){if(captureSegment(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),isEol(a))skipSeparationSpace(e,!1,t);else if(a<256&&u[a])e.result+=d[a],e.position++;else if((i=escapedHexLen(a))>0){let t=i,n=0;for(;t>0;t--)a=e.input.charCodeAt(++e.position),(i=fromHexCode(a))>=0?n=(n<<4)+i:throwError(e,`expected hexadecimal character`);e.result+=charFromCodepoint(n),e.position++}else throwError(e,`unknown escape sequence`);n=r=e.position}else isEol(a)?(captureSegment(e,n,r,!0),writeFoldedLines(e,skipSeparationSpace(e,!1,t)),n=r=e.position):e.position===e.lineStart&&testDocumentSeparator(e)?throwError(e,`unexpected end of the document within a double quoted scalar`):(e.position++,isWhiteSpace(a)||(r=e.position));throwError(e,`unexpected end of the stream within a double quoted scalar`)}function readFlowCollection(e,t){let n=!0,r,i,a,o=e.tag,s,c=e.anchor,l,u,d,p,m=Object.create(null),h,g,_,v=e.input.charCodeAt(e.position);if(v===91)l=93,p=!1,s=[];else if(v===123)l=125,p=!0,s={};else return!1;for(e.anchor!==null&&storeAnchor(e,e.anchor,s),v=e.input.charCodeAt(++e.position);v!==0;){if(skipSeparationSpace(e,!0,t),v=e.input.charCodeAt(e.position),v===l)return e.position++,e.tag=o,e.anchor=c,e.kind=p?`mapping`:`sequence`,e.result=s,!0;n?v===44&&throwError(e,`expected the node content, but found ','`):throwError(e,`missed comma between flow collection entries`),g=h=_=null,u=d=!1,v===63&&isWsOrEol(e.input.charCodeAt(e.position+1))&&(u=d=!0,e.position++,skipSeparationSpace(e,!0,t)),r=e.line,i=e.lineStart,a=e.position,composeNode(e,t,1,!1,!0),g=e.tag,h=e.result,skipSeparationSpace(e,!0,t),v=e.input.charCodeAt(e.position),(d||e.line===r)&&v===58&&(u=!0,v=e.input.charCodeAt(++e.position),skipSeparationSpace(e,!0,t),composeNode(e,t,1,!1,!0),_=e.result),p?storeMappingPair(e,s,m,g,h,_,r,i,a):u?s.push(storeMappingPair(e,null,m,g,h,_,r,i,a)):s.push(h),skipSeparationSpace(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}throwError(e,`unexpected end of the stream within a flow collection`)}function readBlockScalar(t,n){let r,i=1,a=!1,o=!1,s=n,c=0,l=!1,u,d=t.input.charCodeAt(t.position);if(d===124)r=!1;else if(d===62)r=!0;else return!1;for(t.kind=`scalar`,t.result=``;d!==0;)if(d=t.input.charCodeAt(++t.position),d===43||d===45)i===1?i=d===43?3:2:throwError(t,`repeat of a chomping mode identifier`);else if((u=fromDecimalCode(d))>=0)u===0?throwError(t,`bad explicit indentation width of a block scalar; it cannot be less than one`):o?throwError(t,`repeat of an indentation width identifier`):(s=n+u-1,o=!0);else break;if(isWhiteSpace(d)){do d=t.input.charCodeAt(++t.position);while(isWhiteSpace(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!isEol(d)&&d!==0)}for(;d!==0;){for(readLineBreak(t),t.lineIndent=0,d=t.input.charCodeAt(t.position);(!o||t.lineIndent<s)&&d===32;)t.lineIndent++,d=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>s&&(s=t.lineIndent),isEol(d)){c++;continue}if(!o&&s===0&&throwError(t,`missing indentation for block scalar`),t.lineIndent<s){i===3?t.result+=e.repeat(`
|
|
43
39
|
`,a?1+c:c):i===1&&a&&(t.result+=`
|
|
44
|
-
`);break}r?
|
|
40
|
+
`);break}r?isWhiteSpace(d)?(l=!0,t.result+=e.repeat(`
|
|
45
41
|
`,a?1+c:c)):l?(l=!1,t.result+=e.repeat(`
|
|
46
42
|
`,c+1)):c===0?a&&(t.result+=` `):t.result+=e.repeat(`
|
|
47
43
|
`,c):t.result+=e.repeat(`
|
|
48
|
-
`,a?1+c:c),a=!0,o=!0,c=0;let n=t.position;for(;!d
|
|
49
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));let n=new
|
|
44
|
+
`,a?1+c:c),a=!0,o=!0,c=0;let n=t.position;for(;!isEol(d)&&d!==0;)d=t.input.charCodeAt(++t.position);captureSegment(t,n,t.position,!1)}return!0}function readBlockSequence(e,t){let n=e.tag,r=e.anchor,i=[],a=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&storeAnchor(e,e.anchor,i);let o=e.input.charCodeAt(e.position);for(;o!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,throwError(e,`tab characters must not be used in indentation`)),o===45&&isWsOrEol(e.input.charCodeAt(e.position+1)));){if(a=!0,e.position++,skipSeparationSpace(e,!0,-1)&&e.lineIndent<=t){i.push(null),o=e.input.charCodeAt(e.position);continue}let n=e.line;if(composeNode(e,t,3,!1,!0),i.push(e.result),skipSeparationSpace(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&o!==0)throwError(e,`bad indentation of a sequence entry`);else if(e.lineIndent<t)break}return a?(e.tag=n,e.anchor=r,e.kind=`sequence`,e.result=i,!0):!1}function readBlockMapping(e,t,n){let r,i,a,o,s=e.tag,c=e.anchor,l={},u=Object.create(null),d=null,p=null,m=null,h=!1,g=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&storeAnchor(e,e.anchor,l);let _=e.input.charCodeAt(e.position);for(;_!==0;){!h&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,throwError(e,`tab characters must not be used in indentation`));let v=e.input.charCodeAt(e.position+1),y=e.line;if((_===63||_===58)&&isWsOrEol(v))_===63?(h&&(storeMappingPair(e,l,u,d,p,null,i,a,o),d=p=m=null),g=!0,h=!0,r=!0):h?(h=!1,r=!0):throwError(e,`incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line`),e.position+=1,_=v;else{if(i=e.line,a=e.lineStart,o=e.position,!composeNode(e,n,2,!1,!0))break;if(e.line===y){for(_=e.input.charCodeAt(e.position);isWhiteSpace(_);)_=e.input.charCodeAt(++e.position);if(_===58)_=e.input.charCodeAt(++e.position),isWsOrEol(_)||throwError(e,`a whitespace character is expected after the key-value separator within a block mapping`),h&&(storeMappingPair(e,l,u,d,p,null,i,a,o),d=p=m=null),g=!0,h=!1,r=!1,d=e.tag,p=e.result;else if(g)throwError(e,`can not read an implicit mapping pair; a colon is missed`);else return e.tag=s,e.anchor=c,!0}else if(g)throwError(e,`can not read a block mapping entry; a multiline key may not be an implicit key`);else return e.tag=s,e.anchor=c,!0}if((e.line===y||e.lineIndent>t)&&(h&&(i=e.line,a=e.lineStart,o=e.position),composeNode(e,t,4,!0,r)&&(h?p=e.result:m=e.result),h||(storeMappingPair(e,l,u,d,p,m,i,a,o),d=p=m=null),skipSeparationSpace(e,!0,-1),_=e.input.charCodeAt(e.position)),(e.line===y||e.lineIndent>t)&&_!==0)throwError(e,`bad indentation of a mapping entry`);else if(e.lineIndent<t)break}return h&&storeMappingPair(e,l,u,d,p,null,i,a,o),g&&(e.tag=s,e.anchor=c,e.kind=`mapping`,e.result=l),g}function readTagProperty(e){let t=!1,n=!1,r,a,o=e.input.charCodeAt(e.position);if(o!==33)return!1;e.tag!==null&&throwError(e,`duplication of a tag property`),o=e.input.charCodeAt(++e.position),o===60?(t=!0,o=e.input.charCodeAt(++e.position)):o===33?(n=!0,r=`!!`,o=e.input.charCodeAt(++e.position)):r=`!`;let u=e.position;if(t){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(a=e.input.slice(u,e.position),o=e.input.charCodeAt(++e.position)):throwError(e,`unexpected end of the stream within a verbatim tag`)}else{for(;o!==0&&!isWsOrEol(o);)o===33&&(n?throwError(e,`tag suffix cannot contain exclamation marks`):(r=e.input.slice(u-1,e.position+1),c.test(r)||throwError(e,`named tag handle cannot contain such characters`),n=!0,u=e.position+1)),o=e.input.charCodeAt(++e.position);a=e.input.slice(u,e.position),s.test(a)&&throwError(e,`tag suffix cannot contain flow indicator characters`)}a&&!l.test(a)&&throwError(e,`tag name cannot contain such characters: `+a);try{a=decodeURIComponent(a)}catch{throwError(e,`tag name is malformed: `+a)}return t?e.tag=a:i.call(e.tagMap,r)?e.tag=e.tagMap[r]+a:r===`!`?e.tag=`!`+a:r===`!!`?e.tag=`tag:yaml.org,2002:`+a:throwError(e,`undeclared tag handle "`+r+`"`),!0}function readAnchorProperty(e){let t=e.input.charCodeAt(e.position);if(t!==38)return!1;e.anchor!==null&&throwError(e,`duplication of an anchor property`),t=e.input.charCodeAt(++e.position);let n=e.position;for(;t!==0&&!isWsOrEol(t)&&!isFlowIndicator(t);)t=e.input.charCodeAt(++e.position);return e.position===n&&throwError(e,`name of an anchor node must contain at least one character`),e.anchor=e.input.slice(n,e.position),!0}function readAlias(e){let t=e.input.charCodeAt(e.position);if(t!==42)return!1;t=e.input.charCodeAt(++e.position);let n=e.position;for(;t!==0&&!isWsOrEol(t)&&!isFlowIndicator(t);)t=e.input.charCodeAt(++e.position);e.position===n&&throwError(e,`name of an alias node must contain at least one character`);let r=e.input.slice(n,e.position);return i.call(e.anchorMap,r)||throwError(e,`unidentified alias "`+r+`"`),e.result=e.anchorMap[r],skipSeparationSpace(e,!0,-1),!0}function tryReadBlockMappingFromProperty(e,t,n,r){let i=snapshotState(e);return beginAnchorTransaction(e),restoreState(e,t),e.tag=null,e.anchor=null,e.kind=null,e.result=null,readBlockMapping(e,n,r)&&e.kind===`mapping`?(commitAnchorTransaction(e),!0):(rollbackAnchorTransaction(e),restoreState(e,i),!1)}function composeNode(e,t,n,r,a){let o,s,c=1,l=!1,u=!1,d=null,p,m,h;e.depth>=e.maxDepth&&throwError(e,`nesting exceeded maxDepth (`+e.maxDepth+`)`),e.depth+=1,e.listener!==null&&e.listener(`open`,e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;let g=o=s=n===4||n===3;if(r&&skipSeparationSpace(e,!0,-1)&&(l=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;;){let n=e.input.charCodeAt(e.position),r=snapshotState(e);if(l&&(n===33&&e.tag!==null||n===38&&e.anchor!==null)||!readTagProperty(e)&&!readAnchorProperty(e))break;d===null&&(d=r),skipSeparationSpace(e,!0,-1)?(l=!0,s=g,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):s=!1}if(s&&=l||a,c===1||n===4){if(m=n===1||n===2?t:t+1,h=e.position-e.lineStart,c===1){if(s&&(readBlockSequence(e,h)||readBlockMapping(e,h,m))||readFlowCollection(e,m))u=!0;else{let t=e.input.charCodeAt(e.position);d!==null&&g&&!s&&t!==124&&t!==62&&tryReadBlockMappingFromProperty(e,d,d.position-d.lineStart,m)||o&&readBlockScalar(e,m)||readSingleQuotedScalar(e,m)||readDoubleQuotedScalar(e,m)?u=!0:readAlias(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&throwError(e,`alias node should not have any properties`)):readPlainScalar(e,m,n===1)&&(u=!0,e.tag===null&&(e.tag=`?`)),e.anchor!==null&&storeAnchor(e,e.anchor,e.result)}}else c===0&&(u=s&&readBlockSequence(e,h))}if(e.tag===null)e.anchor!==null&&storeAnchor(e,e.anchor,e.result);else if(e.tag===`?`){e.result!==null&&e.kind!==`scalar`&&throwError(e,`unacceptable node kind for !<?> tag; it should be "scalar", not "`+e.kind+`"`);for(let t=0,n=e.implicitTypes.length;t<n;t+=1)if(p=e.implicitTypes[t],p.resolve(e.result)){e.result=p.construct(e.result),e.tag=p.tag,e.anchor!==null&&storeAnchor(e,e.anchor,e.result);break}}else if(e.tag!==`!`){if(i.call(e.typeMap[e.kind||`fallback`],e.tag))p=e.typeMap[e.kind||`fallback`][e.tag];else{p=null;let t=e.typeMap.multi[e.kind||`fallback`];for(let n=0,r=t.length;n<r;n+=1)if(e.tag.slice(0,t[n].tag.length)===t[n].tag){p=t[n];break}}p||throwError(e,`unknown tag !<`+e.tag+`>`),e.result!==null&&p.kind!==e.kind&&throwError(e,`unacceptable node kind for !<`+e.tag+`> tag; it should be "`+p.kind+`", not "`+e.kind+`"`),p.resolve(e.result,e.tag)?(e.result=p.construct(e.result,e.tag),e.anchor!==null&&storeAnchor(e,e.anchor,e.result)):throwError(e,`cannot resolve a node with !<`+e.tag+`> explicit tag`)}return e.listener!==null&&e.listener(`close`,e),--e.depth,e.tag!==null||e.anchor!==null||u}function readDocument(e){let t=e.position,n=!1,r;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(r=e.input.charCodeAt(e.position))!==0&&(skipSeparationSpace(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||r!==37));){n=!0,r=e.input.charCodeAt(++e.position);let t=e.position;for(;r!==0&&!isWsOrEol(r);)r=e.input.charCodeAt(++e.position);let a=e.input.slice(t,e.position),o=[];for(a.length<1&&throwError(e,`directive name must not be less than one character in length`);r!==0;){for(;isWhiteSpace(r);)r=e.input.charCodeAt(++e.position);if(r===35){do r=e.input.charCodeAt(++e.position);while(r!==0&&!isEol(r));break}if(isEol(r))break;for(t=e.position;r!==0&&!isWsOrEol(r);)r=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}r!==0&&readLineBreak(e),i.call(p,a)?p[a](e,a,o):throwWarning(e,`unknown document directive "`+a+`"`)}if(skipSeparationSpace(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,skipSeparationSpace(e,!0,-1)):n&&throwError(e,`directives end mark is expected`),composeNode(e,e.lineIndent-1,4,!1,!0),skipSeparationSpace(e,!0,-1),e.checkLineBreaks&&o.test(e.input.slice(t,e.position))&&throwWarning(e,`non-ASCII line breaks are interpreted as content`),e.documents.push(e.result),e.position===e.lineStart&&testDocumentSeparator(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,skipSeparationSpace(e,!0,-1));return}e.position<e.length-1&&throwError(e,`end of the stream or a document separator is expected`)}function loadDocuments(e,t){e=String(e),t||={},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
45
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));let n=new State(e,t),r=e.indexOf(`\0`);for(r!==-1&&(n.position=r,throwError(n,`null byte is not allowed in input`)),n.input+=`\0`;n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)readDocument(n);return n.documents}function loadAll2(e,t,n){typeof t==`object`&&t&&n===void 0&&(n=t,t=null);let r=loadDocuments(e,n);if(typeof t!=`function`)return r;for(let e=0,n=r.length;e<n;e+=1)t(r[e])}function load2(e,n){let r=loadDocuments(e,n);if(r.length!==0){if(r.length===1)return r[0];throw new t(`expected a single document in the stream, but found more`)}}return Cr.loadAll=loadAll2,Cr.load=load2,Cr}var hi={},gi;function requireDumper(){if(gi)return hi;gi=1;let e=requireCommon(),t=requireException(),n=require_default(),r=Object.prototype.toString,i=Object.prototype.hasOwnProperty,a=65279,o={};o[0]=`\\0`,o[7]=`\\a`,o[8]=`\\b`,o[9]=`\\t`,o[10]=`\\n`,o[11]=`\\v`,o[12]=`\\f`,o[13]=`\\r`,o[27]=`\\e`,o[34]=`\\"`,o[92]=`\\\\`,o[133]=`\\N`,o[160]=`\\_`,o[8232]=`\\L`,o[8233]=`\\P`;let s=[`y`,`Y`,`yes`,`Yes`,`YES`,`on`,`On`,`ON`,`n`,`N`,`no`,`No`,`NO`,`off`,`Off`,`OFF`],c=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function compileStyleMap(e,t){if(t===null)return{};let n={},r=Object.keys(t);for(let a=0,o=r.length;a<o;a+=1){let o=r[a],s=String(t[o]);o.slice(0,2)===`!!`&&(o=`tag:yaml.org,2002:`+o.slice(2));let c=e.compiledTypeMap.fallback[o];c&&i.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[o]=s}return n}function encodeHex(n){let r,i,a=n.toString(16).toUpperCase();if(n<=255)r=`x`,i=2;else if(n<=65535)r=`u`,i=4;else if(n<=4294967295)r=`U`,i=8;else throw new t(`code point within a string may not be greater than 0xFFFFFFFF`);return`\\`+r+e.repeat(`0`,i-a.length)+a}function State(t){this.schema=t.schema||n,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=e.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=compileStyleMap(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType===`"`?2:1,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer==`function`?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result=``,this.duplicates=[],this.usedDuplicates=null}function indentString(t,n){let r=e.repeat(` `,n),i=0,a=``,o=t.length;for(;i<o;){let e,n=t.indexOf(`
|
|
50
46
|
`,i);n===-1?(e=t.slice(i),i=o):(e=t.slice(i,n+1),i=n+1),e.length&&e!==`
|
|
51
|
-
`&&(a+=r),a+=e}return a}function
|
|
52
|
-
`+e.repeat(` `,t.indent*n)}function
|
|
47
|
+
`&&(a+=r),a+=e}return a}function generateNextLine(t,n){return`
|
|
48
|
+
`+e.repeat(` `,t.indent*n)}function testImplicitResolving(e,t){for(let n=0,r=e.implicitTypes.length;n<r;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}function isWhitespace(e){return e===32||e===9}function isPrintable(e){return e>=32&&e<=126||e>=161&&e<=55295&&e!==8232&&e!==8233||e>=57344&&e<=65533&&e!==a||e>=65536&&e<=1114111}function isNsCharOrWhitespace(e){return isPrintable(e)&&e!==a&&e!==13&&e!==10}function isPlainSafe(e,t,n){let r=isNsCharOrWhitespace(e),i=r&&!isWhitespace(e);return(n?r:r&&e!==44&&e!==91&&e!==93&&e!==123&&e!==125)&&e!==35&&!(t===58&&!i)||isNsCharOrWhitespace(t)&&!isWhitespace(t)&&e===35||t===58&&i}function isPlainSafeFirst(e){return isPrintable(e)&&e!==a&&!isWhitespace(e)&&e!==45&&e!==63&&e!==58&&e!==44&&e!==91&&e!==93&&e!==123&&e!==125&&e!==35&&e!==38&&e!==42&&e!==33&&e!==124&&e!==61&&e!==62&&e!==39&&e!==34&&e!==37&&e!==64&&e!==96}function isPlainSafeLast(e){return!isWhitespace(e)&&e!==58}function codePointAt(e,t){let n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function needIndentIndicator(e){return/^\n* /.test(e)}function chooseScalarStyle(e,t,n,r,i,a,o,s){let c,l=0,u=null,d=!1,p=!1,m=r!==-1,h=-1,g=isPlainSafeFirst(codePointAt(e,0))&&isPlainSafeLast(codePointAt(e,e.length-1));if(t||o)for(c=0;c<e.length;l>=65536?c+=2:c++){if(l=codePointAt(e,c),!isPrintable(l))return 5;g&&=isPlainSafe(l,u,s),u=l}else{for(c=0;c<e.length;l>=65536?c+=2:c++){if(l=codePointAt(e,c),l===10)d=!0,m&&(p||=c-h-1>r&&e[h+1]!==` `,h=c);else if(!isPrintable(l))return 5;g&&=isPlainSafe(l,u,s),u=l}p||=m&&c-h-1>r&&e[h+1]!==` `}return!d&&!p?g&&!o&&!i(e)?1:a===2?5:2:n>9&&needIndentIndicator(e)?5:o?a===2?5:2:p?4:3}function writeScalar(e,n,r,i,a){e.dump=(function(){if(n.length===0)return e.quotingType===2?`""`:`''`;if(!e.noCompatMode&&(s.indexOf(n)!==-1||c.test(n)))return e.quotingType===2?`"`+n+`"`:`'`+n+`'`;let o=e.indent*Math.max(1,r),l=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),u=i||e.flowLevel>-1&&r>=e.flowLevel;function testAmbiguity(t){return testImplicitResolving(e,t)}switch(chooseScalarStyle(n,u,e.indent,l,testAmbiguity,e.quotingType,e.forceQuotes&&!i,a)){case 1:return n;case 2:return`'`+n.replace(/'/g,`''`)+`'`;case 3:return`|`+blockHeader(n,e.indent)+dropEndingNewline(indentString(n,o));case 4:return`>`+blockHeader(n,e.indent)+dropEndingNewline(indentString(foldString(n,l),o));case 5:return`"`+escapeString(n)+`"`;default:throw new t(`impossible error: invalid scalar style`)}})()}function blockHeader(e,t){let n=needIndentIndicator(e)?String(t):``,r=e[e.length-1]===`
|
|
53
49
|
`;return n+(r&&(e[e.length-2]===`
|
|
54
50
|
`||e===`
|
|
55
51
|
`)?`+`:r?``:`-`)+`
|
|
56
|
-
`}function
|
|
57
|
-
`?e.slice(0,-1):e}function
|
|
58
|
-
`);return r=r===-1?e.length:r,n.lastIndex=r,
|
|
52
|
+
`}function dropEndingNewline(e){return e[e.length-1]===`
|
|
53
|
+
`?e.slice(0,-1):e}function foldString(e,t){let n=/(\n+)([^\n]*)/g,r=(function(){let r=e.indexOf(`
|
|
54
|
+
`);return r=r===-1?e.length:r,n.lastIndex=r,foldLine(e.slice(0,r),t)})(),i=e[0]===`
|
|
59
55
|
`||e[0]===` `,a,o;for(;o=n.exec(e);){let e=o[1],n=o[2];a=n[0]===` `,r+=e+(!i&&!a&&n!==``?`
|
|
60
|
-
`:``)+
|
|
56
|
+
`:``)+foldLine(n,t),i=a}return r}function foldLine(e,t){if(e===``||e[0]===` `)return e;let n=/ [^ ]/g,r,i=0,a,o=0,s=0,c=``;for(;r=n.exec(e);)s=r.index,s-i>t&&(a=o>i?o:s,c+=`
|
|
61
57
|
`+e.slice(i,a),i=a+1),o=s;return c+=`
|
|
62
58
|
`,e.length-i>t&&o>i?c+=e.slice(i,o)+`
|
|
63
|
-
`+e.slice(o+1):c+=e.slice(i),c.slice(1)}function
|
|
64
|
-
`:``}return
|
|
65
|
-
`;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=
|
|
66
|
-
`),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=
|
|
59
|
+
`+e.slice(o+1):c+=e.slice(i),c.slice(1)}function escapeString(e){let t=``,n=0;for(let r=0;r<e.length;n>=65536?r+=2:r++){n=codePointAt(e,r);let i=o[n];!i&&isPrintable(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||encodeHex(n)}return t}function writeFlowSequence(e,t,n){let r=``,i=e.tag;for(let i=0,a=n.length;i<a;i+=1){let a=n[i];e.replacer&&(a=e.replacer.call(n,String(i),a)),(writeNode(e,t,a,!1,!1)||a===void 0&&writeNode(e,t,null,!1,!1))&&(r!==``&&(r+=`,`+(e.condenseFlow?``:` `)),r+=e.dump)}e.tag=i,e.dump=`[`+r+`]`}function writeBlockSequence(e,t,n,r){let i=``,a=e.tag;for(let a=0,o=n.length;a<o;a+=1){let o=n[a];e.replacer&&(o=e.replacer.call(n,String(a),o)),(writeNode(e,t+1,o,!0,!0,!1,!0)||o===void 0&&writeNode(e,t+1,null,!0,!0,!1,!0))&&((!r||i!==``)&&(i+=generateNextLine(e,t)),e.dump&&e.dump.charCodeAt(0)===10?i+=`-`:i+=`- `,i+=e.dump)}e.tag=a,e.dump=i||`[]`}function writeFlowMapping(e,t,n){let r=``,i=e.tag,a=Object.keys(n);for(let i=0,o=a.length;i<o;i+=1){let o=``;r!==``&&(o+=`, `),e.condenseFlow&&(o+=`"`);let s=a[i],c=n[s];e.replacer&&(c=e.replacer.call(n,s,c)),writeNode(e,t,s,!1,!1)&&(e.dump.length>1024&&(o+=`? `),o+=e.dump+(e.condenseFlow?`"`:``)+`:`+(e.condenseFlow?``:` `),writeNode(e,t,c,!1,!1)&&(o+=e.dump,r+=o))}e.tag=i,e.dump=`{`+r+`}`}function writeBlockMapping(e,n,r,i){let a=``,o=e.tag,s=Object.keys(r);if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys==`function`)s.sort(e.sortKeys);else if(e.sortKeys)throw new t(`sortKeys must be a boolean or a function`);for(let t=0,o=s.length;t<o;t+=1){let o=``;(!i||a!==``)&&(o+=generateNextLine(e,n));let c=s[t],l=r[c];if(e.replacer&&(l=e.replacer.call(r,c,l)),!writeNode(e,n+1,c,!0,!0,!0))continue;let u=e.tag!==null&&e.tag!==`?`||e.dump&&e.dump.length>1024;u&&(e.dump&&e.dump.charCodeAt(0)===10?o+=`?`:o+=`? `),o+=e.dump,u&&(o+=generateNextLine(e,n)),writeNode(e,n+1,l,!0,u)&&(e.dump&&e.dump.charCodeAt(0)===10?o+=`:`:o+=`: `,o+=e.dump,a+=o)}e.tag=o,e.dump=a||`{}`}function detectType(e,n,a){let o=a?e.explicitTypes:e.implicitTypes;for(let s=0,c=o.length;s<c;s+=1){let c=o[s];if((c.instanceOf||c.predicate)&&(!c.instanceOf||typeof n==`object`&&n instanceof c.instanceOf)&&(!c.predicate||c.predicate(n))){if(e.tag=a?c.multi&&c.representName?c.representName(n):c.tag:`?`,c.represent){let a=e.styleMap[c.tag]||c.defaultStyle,o;if(r.call(c.represent)===`[object Function]`)o=c.represent(n,a);else if(i.call(c.represent,a))o=c.represent[a](n,a);else throw new t(`!<`+c.tag+`> tag resolver accepts not "`+a+`" style`);e.dump=o}return!0}}return!1}function writeNode(e,n,i,a,o,s,c){e.tag=null,e.dump=i,detectType(e,i,!1)||detectType(e,i,!0);let l=r.call(e.dump),u=a;a&&=e.flowLevel<0||e.flowLevel>n;let d=l===`[object Object]`||l===`[object Array]`,p,m;if(d&&(p=e.duplicates.indexOf(i),m=p!==-1),(e.tag!==null&&e.tag!==`?`||m||e.indent!==2&&n>0)&&(o=!1),m&&e.usedDuplicates[p])e.dump=`*ref_`+p;else{if(d&&m&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),l===`[object Object]`)a&&Object.keys(e.dump).length!==0?(writeBlockMapping(e,n,e.dump,o),m&&(e.dump=`&ref_`+p+e.dump)):(writeFlowMapping(e,n,e.dump),m&&(e.dump=`&ref_`+p+` `+e.dump));else if(l===`[object Array]`)a&&e.dump.length!==0?(e.noArrayIndent&&!c&&n>0?writeBlockSequence(e,n-1,e.dump,o):writeBlockSequence(e,n,e.dump,o),m&&(e.dump=`&ref_`+p+e.dump)):(writeFlowSequence(e,n,e.dump),m&&(e.dump=`&ref_`+p+` `+e.dump));else if(l===`[object String]`)e.tag!==`?`&&writeScalar(e,e.dump,n,s,u);else if(l===`[object Undefined]`)return!1;else{if(e.skipInvalid)return!1;throw new t(`unacceptable kind of an object to dump `+l)}if(e.tag!==null&&e.tag!==`?`){let t=encodeURI(e.tag[0]===`!`?e.tag.slice(1):e.tag).replace(/!/g,`%21`);t=e.tag[0]===`!`?`!`+t:t.slice(0,18)===`tag:yaml.org,2002:`?`!!`+t.slice(18):`!<`+t+`>`,e.dump=t+` `+e.dump}}return!0}function getDuplicateReferences(e,t){let n=[],r=[];inspectNode(e,n,r);let i=r.length;for(let e=0;e<i;e+=1)t.duplicates.push(n[r[e]]);t.usedDuplicates=Array(i)}function inspectNode(e,t,n){if(typeof e==`object`&&e){let r=t.indexOf(e);if(r!==-1)n.indexOf(r)===-1&&n.push(r);else if(t.push(e),Array.isArray(e))for(let r=0,i=e.length;r<i;r+=1)inspectNode(e[r],t,n);else{let r=Object.keys(e);for(let i=0,a=r.length;i<a;i+=1)inspectNode(e[r[i]],t,n)}}}function dump2(e,t){t||={};let n=new State(t);n.noRefs||getDuplicateReferences(e,n);let r=e;return n.replacer&&(r=n.replacer.call({"":r},``,r)),writeNode(n,0,r,!0,!0)?n.dump+`
|
|
60
|
+
`:``}return hi.dump=dump2,hi}var _i;function requireJsYaml(){if(_i)return J;_i=1;let e=requireLoader(),t=requireDumper();function renamed(e,t){return function(){throw Error(`Function yaml.`+e+` is removed in js-yaml 4. Use yaml.`+t+` instead, which is now safe by default.`)}}return J.Type=requireType(),J.Schema=requireSchema(),J.FAILSAFE_SCHEMA=requireFailsafe(),J.JSON_SCHEMA=requireJson(),J.CORE_SCHEMA=requireCore(),J.DEFAULT_SCHEMA=require_default(),J.load=e.load,J.loadAll=e.loadAll,J.dump=t.dump,J.YAMLException=requireException(),J.types={binary:requireBinary(),float:requireFloat(),map:requireMap(),null:require_null$1(),pairs:requirePairs(),set:requireSet(),timestamp:requireTimestamp(),bool:requireBool(),int:requireInt(),merge:requireMerge(),omap:requireOmap(),seq:requireSeq(),str:requireStr()},J.safeLoad=renamed(`safeLoad`,`load`),J.safeLoadAll=renamed(`safeLoadAll`,`loadAll`),J.safeDump=renamed(`safeDump`,`dump`),J}const vi=getDefaultExportFromCjs(requireJsYaml()),{Type:yi,Schema:bi,FAILSAFE_SCHEMA:xi,JSON_SCHEMA:Si,CORE_SCHEMA:Ci,DEFAULT_SCHEMA:wi,load:Ti,loadAll:Ei,dump:Di,YAMLException:Oi,types:ki,safeLoad:Ai,safeLoadAll:ji,safeDump:Mi}=vi;function createScanner(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function scanHexDigits(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function setPosition(e){r=e,i=``,a=0,o=16,d=0}function scanNumber(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&isDigit$1(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&isDigit$1(e.charCodeAt(r)))for(r++;r<e.length&&isDigit$1(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r)}let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101)){if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&isDigit$1(e.charCodeAt(r))){for(r++;r<e.length&&isDigit$1(e.charCodeAt(r));)r++;n=r}else d=3}return e.substring(t,n)}function scanString(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
|
|
61
|
+
`;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=scanHexDigits(4,!0);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31){if(isLineBreak(a)){t+=e.substring(i,r),d=2;break}d=6}r++}return t}function scanNext(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(isWhiteSpace(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(isWhiteSpace(t));return o=15}if(isLineBreak(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
|
|
62
|
+
`),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=scanString(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!isLineBreak(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,isLineBreak(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!isDigit$1(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=scanNumber(),o=11;default:for(;r<n&&isUnknownContentCharacter(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function isUnknownContentCharacter(e){if(isWhiteSpace(e)||isLineBreak(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function scanNextNonTrivia(){let e;do e=scanNext();while(e>=12&&e<=15);return e}return{setPosition,getPosition:()=>r,scan:t?scanNextNonTrivia:scanNext,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function isWhiteSpace(e){return e===32||e===9}function isLineBreak(e){return e===10||e===13}function isDigit$1(e){return e>=48&&e<=57}__name(isDigit$1,`isDigit`);var Ni;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(Ni||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
|
|
67
63
|
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
|
|
68
64
|
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
|
|
69
65
|
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
|
|
70
|
-
`+` `.repeat(t));var zl;(function(e){e.DEFAULT={allowTrailingComma:!1}})(zl||={});function Bl(e,t=[],n=zl.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return Vl(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function Vl(e,t,n=zl.DEFAULT){let r=Pl(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16)}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),ne()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function ee(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function te(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,ne()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function ne(){switch(r.getToken()){case 3:return te();case 1:return ee();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):ne()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}var Hl;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(Hl||={});var Ul;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(Ul||={});const Wl=Bl;var Gl;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(Gl||={});function Kl(e){switch(e){case 1:return`InvalidSymbol`;case 2:return`InvalidNumberFormat`;case 3:return`PropertyNameExpected`;case 4:return`ValueExpected`;case 5:return`ColonExpected`;case 6:return`CommaExpected`;case 7:return`CloseBraceExpected`;case 8:return`CloseBracketExpected`;case 9:return`EndOfFileExpected`;case 10:return`InvalidCommentToken`;case 11:return`UnexpectedEndOfComment`;case 12:return`UnexpectedEndOfString`;case 13:return`UnexpectedEndOfNumber`;case 14:return`InvalidUnicode`;case 15:return`InvalidEscapeCharacter`;case 16:return`InvalidCharacter`}return`<unknown ParseErrorCode>`}const ql={platform:process.platform};function Jl(){return ql.platform===`darwin`||ql.platform===`win32`}function Yl(e,t){for(let n of Zl(e)){let e=_(n,t);if(tu(e))return e}}function Xl(e,t){let n=Jl();for(let r of Zl(e)){let e=Ql(r,n);if(e)for(let i of t){let t=$l(e,i,n);if(t&&eu(r,t))return _(r,t.name)}}}function*Zl(e){let t=x(e),{root:n}=v(t);for(;;){if(yield t,t===n)return;t=h(t)}}function Ql(e,t){let n;try{n=s(e,{withFileTypes:!0})}catch{return}let r=new Map;for(let e of n)if(r.set(e.name,e),t){let t=e.name.toLowerCase();r.has(t)||r.set(t,e)}return r}function $l(e,t,n){let r=e.get(t);return r||!n?r:e.get(t.toLowerCase())}function eu(e,t){return t.isFile()?!0:t.isSymbolicLink()?tu(_(e,t.name)):!1}function tu(e){return d(e,{throwIfNoEntry:!1})?.isFile()??!1}process.platform;function nu(e){return Yl(e,`package.json`)}function ru(e){return JSON.parse(o(e,`utf-8`))}const iu={findPackageJson:nu,getPackageJson:ru};function au({cwd:e},t){let n=cu(t),r=Xl(e,n);if(r)return{source:{type:`file`,path:r,format:lu(r)},candidates:n};let i=iu.findPackageJson(e);return i&&iu.getPackageJson(i)[t]?{source:{type:`package.json`,path:i,property:t},candidates:n}:{source:{type:`none`},candidates:n}}async function ou({cwd:e,ui:t},n){let{source:r,candidates:i}=au({cwd:e},n);if(r.type===`file`){t.debug(`load config from: ${r.path}`);let e=await uu(r.path);return t.debug(`config: ${JSON.stringify(e,void 0,2)}`),{config:e,source:r,candidates:i}}if(r.type===`package.json`){t.debug(`load config from package.json: ${r.path}`);let e=iu.getPackageJson(r.path)[r.property];return t.debug(`config: ${JSON.stringify(e,void 0,2)}`),{config:e,source:r,candidates:i}}return t.warn(`no config found under '${e}':\n ${i.join(`
|
|
71
|
-
`)}`),{config:void 0,source:r,candidates:i}}function su(e){switch(e.type){case`file`:return e.path;case`package.json`:return`${e.path} (property "${e.property}")`;default:return`not found`}}function cu(e){let t=[e,`${e}.cjs`,`${e}.mjs`,`${e}.js`,`${e}.json`,`${e}.jsonc`,`${e}.yml`,`${e}.yaml`,`${e}rc.cjs`,`${e}rc.mjs`,`${e}rc.js`,`${e}rc.json`,`${e}rc.jsonc`,`${e}rc.yml`,`${e}rc.yaml`,`${e}rc`];return e.startsWith(`.`)?t:t.flatMap(e=>[e,`.${e}`])}function lu(e){switch(g(e).toLowerCase()){case`.json`:case`.jsonc`:return`jsonc`;case`.yml`:case`.yaml`:return`yaml`;case`.js`:case`.cjs`:case`.mjs`:return`module`;default:return`unknown`}}async function uu(e){let t=lu(e);if(t===`module`)return du(e);let n=o(e,`utf-8`);if(t===`jsonc`)return fu(n,e);if(t===`yaml`)return yl.load(n);try{return fu(n,e)}catch{try{return yl.load(n)}catch{return du(e)}}}async function du(e){let t=await import(w(e).href);return t.activate?t:t.default}function fu(e,t){let n=[],r=Wl(e,n,{allowTrailingComma:!0,disallowComments:!1});if(n.length>0){let[{error:e,offset:r}]=n;throw Error(`Unable to parse ${t} as JSON: ${Kl(e)} at offset ${r}`)}return r}const pu={success:0,error:1,usage:2},mu=Symbol.for(`clibuilder.CliError`);function hu(e){return!!e&&typeof e==`object`&&e[mu]===!0}function gu(e,t){switch(e.type){case`invalid-key`:return`unknown option ${vu(e.key)}`;case`missing-argument`:return`missing required argument <${e.name}>`;case`extra-arguments`:return`unexpected argument${e.values.length>1?`s`:``}: ${e.values.join(`, `)}`;case`invalid-value`:return`invalid value for ${_u(e.key,t)}: ${e.message}, received "${e.value}"`;case`expect-single`:return`${_u(e.key,t)} expects a single value, received: ${yu(e.value).join(`, `)}`}}function _u(e,t){return t.arguments?.some(t=>t.name===e)?`argument <${e}>`:`option ${vu(e)}`}function vu(e){return e.length===1?`-${e}`:`--${e}`}function yu(e){return Array.isArray(e)?e:[e]}function bu(e,t){let n=xu(e,t);return Su(n[0],n[1])}function xu(e,t){if(e.commands){let n=e.commands;for(let e=n.length-1;e>=0;e--){let r=n[e];if(!r.name)return[r,t];if(t._[0]===r.name||r.alias?.includes(t._[0]))return t._.shift(),r.commands&&xu(r,t)||[r,t]}}return[e,t]}function Su(e,t){return Tu(wu(Cu({command:e,rawArgs:t,args:{_:[]},errors:[]})))}function Cu(e){let t=e.command,n=[...e.rawArgs._];return e.args=(t.arguments||[]).reduce((t,r)=>{let i=r.type??ho();if(n.length===0)return bo(i)||e.errors.push({type:`missing-argument`,name:r.name}),t;let a=yo(Du(i))?n.splice(0):[n.shift()],[o,s]=Ou(i,r.name,a);return e.errors.push(...s),t.args[r.name]=o,t},{args:{_:[]}}).args,n.length>0&&e.errors.push({type:`extra-arguments`,name:t.name,values:n}),e}function wu(e){return Li(e.rawArgs,(t,n)=>{if(n===`_`)return t;if(/^-/.test(n))return t.errors.push({type:`invalid-key`,key:n}),t;let[r,i]=Eu(e.command,n);if(!r)return t.errors.push({type:`invalid-key`,key:n}),t;let[a,o]=Ou(i.type||Z(go()),n,e.rawArgs[n]);return o&&t.errors.push(...o),t.args[r]=a,t},e)}function Tu(e){let t=e.command.options||{};return Li(t,(e,n)=>{if(e.args[n])return e;let r=t[n];return typeof r==`string`||r.default===void 0||(e.args[n]=yo(r.type)&&!Array.isArray(r.default)?[r.default]:r.default),e},e)}function Eu(e,t){let n=e.options;if(!n)return[];let r=n[t];if(r)return[t,r];let i=Pi(n,e=>{let r=n[e];return r.alias?r.alias.some(e=>e===t||e.alias===t):!1});return i?[i,n[i]]:[]}function Du(e){return bo(e)?e._def.innerType:e}function Ou(e,t,n){let[r,i]=Au(e,t,n);return r.success?[r.data,i]:(i.length===0&&i.push({type:`invalid-value`,key:t,value:n[n.length-1],message:ku(e,r.error)}),[void 0,i])}function ku(e,t){let n=Du(e);return wo(n)?`expected one of: ${n.options.join(`, `)}`:t.issues[0].message}function Au(e,t,n){let[r,i]=ju(e,t,n,[]);return[e.safeParse(r),i]}function ju(e,t,n,r){if(bo(e))return ju(e._def.innerType,t,n,r);if(xo(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),Mu(t,n[n.length-1],r);if(So(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),Nu(t,n[n.length-1],r);if(Co(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),[n[n.length-1],r];if(yo(e)){let i=e.element;if(xo(i))return n.reduce(([e,n],r)=>{let[i,a]=Mu(t,r,n);return e.push(i),[e,a]},[[],r]);if(So(i))return n.reduce(([e,n],r)=>{let[i,a]=Nu(t,r,n);return e.push(i),[e,a]},[[],r]);if(Co(i))return[n,r]}return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),[n[n.length-1],r]}function Mu(e,t,n){return t.toLowerCase()===`true`?[!0,n]:t.toLowerCase()===`false`?[!1,n]:(n.push({type:`invalid-value`,key:e,value:t,message:`expected to be boolean`}),[void 0,n])}function Nu(e,t,n){let r=+t;return typeof r==`number`&&!Number.isNaN(r)?[r,n]:(n.push({type:`invalid-value`,key:e,value:t,message:`expected to be number`}),[void 0,n])}function Pu(){let e=new Map,t=new Map;function n(n){return n.kind===`collection`?t.get(n.id)??[]:e.get(n.id)?.value}return{register(n,r,i){if(r.kind===`collection`){let e=t.get(r.id)??[];return e.push({source:n,value:i}),t.set(r.id,e),{accepted:!0}}let a=e.get(r.id);return a?{accepted:!1,source:a.source}:(e.set(r.id,{source:n,value:i}),{accepted:!0})},get:n,has(n){return n.kind===`collection`?t.has(n.id):e.has(n.id)},describe(n){if(n.kind===`collection`)return(t.get(n.id)??[]).map(({source:e})=>e);let r=e.get(n.id)?.source;return r?[r]:[]}}}function Fu(e){let{name:t,description:n=``,version:r,config:i,keywords:a=[]}=e;i&&a.length===0&&a.push(t);let o=typeof i==`string`?i:i?t:void 0;return{name:t,description:n,version:r,configName:o,keywords:a,displayLevel:`info`,command:Us(n,{config:!!o})}}function Iu(e,t){let n=Fu(t),r=n.description,i=[],a=Pu(),o=n.configName?e.loadConfig(n.configName):void 0,s=n.configName||n.keywords.length>0;return s&&n.command.commands.push(zu(n.command,Xs)),o&&i.push((async()=>{let t=await o;if(n.config=t,t?.plugins){let r=await e.loadPlugins(t.plugins,a,{name:n.name,version:n.version||``});n.command.commands.push(...r.map(e=>zu(n.command,e)))}})()),{name:n.name,version:n.version||``,description:r,parse:s?c:void 0,default(e){return n.command=zu(n.command,{...n.command,...e}),delete this.default,{...this,parse:c}},command(e){return n.command.commands.push(zu(n.command,e)),{...this,parse:c}}};async function c(t){await Promise.all(i),e.ui.debug(`argv:`,t.join(` `));let r=le(t),o=Us(n.description,{config:!!n.configName}),{args:s}=bu(o,r);if(s.silent&&(delete r.silent,n.displayLevel=`none`),s.verbose&&(delete r.verbose,n.displayLevel=`debug`),s[`debug-cli`]&&(delete r[`debug-cli`],n.displayLevel=`trace`),e.ui.displayLevel=n.displayLevel,e.ui.dump(),n.configName&&s[`show-config`])return l(n.configName);let c=bu(n.command,r),{args:d,command:f}=c;if(s.version||d.version)return Lu(e,n,c.command,a).ui.showVersion();if(s.help||d.help)return Lu(e,n,c.command,a).ui.showHelp();let p=c.errors.filter(e=>!(e.type===`invalid-key`&&Eu(o,e.key)[0]));if(p.length>0){let t=Lu(e,n,c.command,a).ui;for(let e of p)t.error(gu(e,f));return t.showHelp(),e.exit(pu.usage)}if(f.config){let t=typeof n.configName==`string`?n.configName:n.name,{config:r,errors:i}=u(f.config,await e.loadConfig(t));if(n.config=r,i)return e.ui.error(`config fails validation:`),Fi(i,t=>e.ui.error(` ${String(t)}: ${i[t]}`)),Lu(e,n,c.command,a).ui.showHelp(),e.exit(pu.error);n.config=r}let m=Lu(e,n,f,a);if(!m.run)return m.ui.showHelp();try{return await m.run(d)}catch(t){if(!hu(t))throw t;m.ui.error(t.message);for(let e of t.help)m.ui.error(e);return e.exit(t.exitCode)}}async function l(t){let{config:r,source:i}=await e.resolveConfig(t),a=Ru(e,n,n.command);a.info(`config: ${su(i)}`),i.type!==`none`&&a.info(JSON.stringify(r,void 0,2))}function u(e,t){let n=e.safeParse(t);return n.success?{config:t}:{errors:n.error.flatten().fieldErrors}}}function Lu(e,t,n,r){return{...n,run:n.run,ui:Ru(e,t,n),config:t.config,keywords:t.keywords,cwd:e.cwd,registry:r}}function Ru(e,t,n){let r=e.createCommandUI(n.name||t.name);return r.displayLevel=t.displayLevel,{...r,showVersion:()=>r.showVersion(t.version),showHelp:()=>r.showHelp(t.name,n)}}function zu(e,t){return t.name&&(t.parent=e),t.commands&&=t.commands.map(e=>zu(t,e)),t}var Bu=O(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}));const Vu={none:0,emergency:100,alert:200,critical:300,error:400,warn:500,notice:600,info:700,debug:800,trace:900,planck:1/0,all:1/0};function Hu(e){return e<=100?`emergency`:e<=200?`alert`:e<=300?`critical`:e<=400?`error`:e<=500?`warn`:e<=600?`notice`:e<=700?`info`:e<=800?`debug`:e<=900?`trace`:`planck`}function Uu(e){return Vu[e.toLocaleLowerCase()]}const Wu=[`emergency`,`alert`,`critical`,`error`,`warn`,`notice`,`info`,`debug`,`trace`,`planck`];var Gu=k(Bu(),1);function Ku(e){switch(e){case`none`:return e=>void 0;case`iso`:return e=>e.toISOString();case`elapsed`:{let e;return t=>{let n=t.getTime(),r=(0,Gu.default)(e===void 0?0:n-e);return e=n,r}}}}function qu({args:e}){return e}const Ju=zi();function Yu(e){switch(!0){case e<=0:return`debug`;case e<=Vu.error:return`error`;case e<=Vu.warn:return`warn`;case e<=Vu.info:return`info`;default:return`debug`}}function Xu(){return console.log.bind?{debug:(typeof console.info==`function`?console.debug:console.log).bind(console),info:(typeof console.info==`function`?console.info:console.log).bind(console),warn:(typeof console.warn==`function`?console.warn:console.log).bind(console),error:(typeof console.error==`function`?console.error:console.log).bind(console)}:{debug:Zu(typeof console.debug==`function`?`debug`:`log`),info:Zu(typeof console.info==`function`?`info`:`log`),warn:Zu(typeof console.warn==`function`?`warn`:`log`),error:Zu(typeof console.error==`function`?`error`:`log`)}}function Zu(e){return function(...t){console[e](...t)}}function Qu(e){let{id:t,formatter:n,filter:r}=be({id:`console`,formatter:qu},e);return Ju.console||=Xu(),Object.freeze({id:t,isConsoleReporter:!0,get formatter(){return n},get filter(){return r},console:Ju.console,write(e){if(r&&!r(e))return;let t=n(e),i=Yu(e.level);this.console[i](...t)}})}function $u(e){return{loggers:zi(),nonConsoleLoggers:zi(),reporters:e.reporters||[Qu()],logLevel:e.logLevel,logLevelStore:ed(e)}}function ed(e){let t=e.customLevels||zi(),n={customLevels:t,customLevelsReverse:Li(t,(e,n)=>(e[t[n]]=n,e),{})};return{getName(e){return n.customLevelsReverse[e]??Hu(e)},getLevel(e){return n.customLevels[e]??Uu(e)},getAllLevels(){return Ri(Vu,(e,t)=>(t!==`none`&&t!==`all`&&e.push({name:t,level:Vu[t]}),e),Ii(n.customLevels,e=>({name:e,level:n.customLevels[e]})))}}}function td(e,t,n){t=nd(t);let r=n?.writeTo??(()=>!0),[i,a]=typeof r==`string`?[e=>e===r,e.reporters]:r instanceof RegExp?[e=>r.test(e),e.reporters]:typeof r==`function`?[r,e.reporters]:[()=>!0,[r]];function o(e){rd(a,e,i)}let s={level:n?.level,write:o};return Object.defineProperties(s,{id:{value:t,writable:!1},count:{writable:!1,value:(n=>(...r)=>{id(e,Vu.debug,s.level)&&o({id:t,level:Vu.debug,args:[++n,...r],timestamp:new Date})})(0)},on:{writable:!1,value:(t,n)=>{let r=typeof t==`string`?e.logLevelStore.getLevel(t):t;if(id(e,r,s.level)){let t=e.logLevelStore.getName(r),i=s[t].bind(s),a=n(i,s.level??e.logLevel);a&&i(a)}}}}),e.logLevelStore.getAllLevels().forEach(function({name:n,level:r}){Object.defineProperty(s,n,{writable:!1,value:(...n)=>{id(e,r,s.level)&&o({id:t,level:r,args:n,timestamp:new Date})}})}),s}function nd(e){return e.replace(/[`~!#$%^&*()=+[\]{},|<>?]/g,`-`)}function rd(e,t,n){e.filter(e=>n(e.id)).forEach(e=>e.write(t))}function id(e,t,n){return t<=(n===void 0?e.logLevel:n)}const ad=zi();function od(e){let t=cd(e);return(e?.reporters)?.some(e=>!e.id)&&t.standardLog.getLogger(`standard-log`).critical(`Detected reporter with empty id. This is not allowed as it will create problems with feature like 'getNonConsoleLogger()'. Please add an id to your reporter.`),ad.gsl||=t,t.standardLog}function sd(){}function cd(e){let t=$u(ve({logLevel:Vu.info},e)),n=(e?.reporters)?.filter(e=>!e.isConsoleReporter).map(e=>e.id)??[],r=Wu.concat(Object.keys(e?.customLevels??{})).concat([`on`,`count`,`write`]);return{store:t,standardLog:{get logLevel(){return t.logLevel},toLogLevelName(e){return t.logLevelStore.getName(e)},toLogLevel(e){return t.logLevelStore.getLevel(e)},getLogger(e,n){return t.loggers[e]?t.loggers[e]:t.loggers[e]=td(t,e,{ssf:this.getLogger,...n})},getNonConsoleLogger(e,i){return t.nonConsoleLoggers[e]?t.nonConsoleLoggers[e]:t.loggers[e]?(this.getLogger(`standard-log`).warn(`attempt to create a non-console logger with existing id ('${e}'), ignoring`),t.nonConsoleLoggers[e]=ld(r)):t.nonConsoleLoggers[e]=n.length===0?ld(r):td(t,e,{ssf:this.getNonConsoleLogger,...i,writeTo(e){return n.indexOf(e)>=0}})}}}}function ld(e){return e.reduce((e,t)=>(e[t]=sd,e),zi())}var ud=O(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),dd=k(O(((e,t)=>{let n=A(`os`),r=A(`tty`),i=ud(),{env:a}=process,o;i(`no-color`)||i(`no-colors`)||i(`color=false`)||i(`color=never`)?o=0:(i(`color`)||i(`colors`)||i(`color=true`)||i(`color=always`))&&(o=1);function s(){if(`FORCE_COLOR`in a)return a.FORCE_COLOR===`true`?1:a.FORCE_COLOR===`false`?0:a.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(a.FORCE_COLOR,10),3)}function c(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let c=s();c!==void 0&&(o=c);let l=r?o:c;if(l===0)return 0;if(r){if(i(`color=16m`)||i(`color=full`)||i(`color=truecolor`))return 3;if(i(`color=256`))return 2}if(e&&!t&&l===void 0)return 0;let u=l||0;if(a.TERM===`dumb`)return u;if(process.platform===`win32`){let e=n.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in a)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`,`DRONE`].some(e=>e in a)||a.CI_NAME===`codeship`?1:u;if(`TEAMCITY_VERSION`in a)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION);if(a.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in a){let e=Number.parseInt((a.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(a.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||`COLORTERM`in a?1:u}function u(e,t={}){return c(l(e,{streamIsTTY:e&&e.isTTY,...t}))}t.exports={supportsColor:u,stdout:u({isTTY:r.isatty(1)}),stderr:u({isTTY:r.isatty(2)})}}))(),1),fd;(function(e){e[e.DISABLED=0]=`DISABLED`,e[e.BASIC=1]=`BASIC`,e[e.ANSI=2]=`ANSI`,e[e.TRUE=3]=`TRUE`})(fd=fd||={});let pd;function md(){return pd||={stderr:dd.default.stderr?dd.default.stderr.level:fd.DISABLED,stdout:dd.default.stdout?dd.default.stdout.level:fd.DISABLED}}function hd(e,t){return`\u001B[${t.join(`;`)}m${e}\u001B[0m`}function gd(e={timestamp:`none`}){let t=Ku(e.timestamp);return function(e){let n=Yu(e.level);return[vd(n,e.id),..._d(t,n,e)]}}function _d(e,t,n){let r=[...n.args],i=e(n.timestamp);i!==void 0&&r.push(i);let a=t===`error`?[31]:t===`warn`?[33]:void 0;return a?r.map(e=>hd(e,a)):r}function vd(e,t){let n=md();return yd(e===`error`?n.stderr:n.stdout)(t)}function yd(e){switch(e){case fd.DISABLED:return e=>e;case fd.BASIC:return bd;case fd.ANSI:return wd;case fd.TRUE:return Td}}function bd(e){let t=Cd(e);return hd(` ${e} `,t)}const xd={counter:0,list:[[37,41],[30,42],[30,43],[37,44],[37,45],[30,46],[37,40],[37,41,1],[30,42,1],[30,43,1],[37,44,1],[37,45,1],[30,46,1],[37,40,1],[37,41,4],[30,42,4],[30,43,4],[37,44,4],[37,45,4],[30,46,4],[37,40,4],[37,41,1,4],[30,42,1,4],[30,43,1,4],[37,44,1,4],[37,45,1,4],[30,46,1,4],[37,40,1,4]]},Sd=Object.create(null);function Cd(e){return Sd[e]=Sd[e]||xd.list[xd.counter++%xd.list.length]}function wd(e){return bd(e)}function Td(e){return bd(e)}Ce();function Ed(e){return Qu(ve({formatter:gd()},e))}async function Dd({cwd:e,ui:t,registry:n,host:r},i){return Od(e,t,n,r,i)}async function Od(e,t,n,r,i){let a=await Promise.all(i.map(async n=>(t.debug(`loading plugin`,n),{name:n,pluginModule:await kd(e,t,n)}))),o=[];for(let{name:e,pluginModule:i}of a){if(!Ad(i)){t.warn(`not a valid plugin`,e);continue}t.debug(`activating plugin`,e),(await jd(i,n,r,e,t)).forEach(e=>{t.debug(`adding command`,e.name),o.push(e)}),t.debug(`activated plugin`,e)}return o}async function kd(e,t,n){try{return await import(n)}catch(r){t.warn(`Unable to load plugin from ${n}. Please let the plugin author knows about it.`),t.warn(`cwd: ${e}`),t.warn(`error: `,r.message||r);return}}function Ad(e){return e&&typeof e.activate==`function`}async function jd(e,t,n,r,i){let a=[];return await e.activate({addCommand:e=>a.push(e),register:(e,n)=>{let a=t.register(r,e,n);a.accepted||i.warn(`plugin ${r} could not register ${e.id}; it is already registered by ${a.source}`)},get:t.get,has:t.has,host:n}),a}
|
|
66
|
+
`+` `.repeat(t));var Pi;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Pi||={});function parse$5(e,t=[],n=Pi.DEFAULT){let r=null,i=[],a=[];function onValue(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return visit(e,{onObjectBegin:()=>{let e={};onValue(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];onValue(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:onValue,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}__name(parse$5,`parse`);function parseTree$1(e,t=[],n=Pi.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function ensurePropertyComplete(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function onValue(e){return r.children.push(e),e}visit(e,{onObjectBegin:e=>{r=onValue({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=onValue({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{ensurePropertyComplete(e+t),r.length=e+t-r.offset,r=r.parent,ensurePropertyComplete(e+t)},onArrayBegin:(e,t)=>{r=onValue({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,ensurePropertyComplete(e+t)},onLiteralValue:(e,t,n)=>{onValue({type:getNodeType(e),offset:t,length:n,parent:r,value:e}),ensurePropertyComplete(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&ensurePropertyComplete(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let i=r.children[0];return i&&delete i.parent,i}__name(parseTree$1,`parseTree`);function findNodeAtLocation$1(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}__name(findNodeAtLocation$1,`findNodeAtLocation`);function visit(e,t,n=Pi.DEFAULT){let r=createScanner(e,!1),i=[],a=0;function toNoArgVisit(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function toOneArgVisit(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function toOneArgVisitWithPath(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function toBeginVisit(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function toEndVisit(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let o=toBeginVisit(t.onObjectBegin),s=toOneArgVisitWithPath(t.onObjectProperty),c=toEndVisit(t.onObjectEnd),l=toBeginVisit(t.onArrayBegin),u=toEndVisit(t.onArrayEnd),d=toOneArgVisitWithPath(t.onLiteralValue),p=toOneArgVisit(t.onSeparator),m=toNoArgVisit(t.onComment),h=toOneArgVisit(t.onError),g=n&&n.disallowComments,_=n&&n.allowTrailingComma;function scanNext(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:handleError(14);break;case 5:handleError(15);break;case 3:handleError(13);break;case 1:g||handleError(11);break;case 2:handleError(12);break;case 6:handleError(16)}switch(e){case 12:case 13:g?handleError(10):m();break;case 16:handleError(1);break;case 15:case 14:break;default:return e}}}function handleError(e,t=[],n=[]){if(h(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){scanNext();break}if(n.indexOf(e)!==-1)break;e=scanNext()}}}function parseString(e){let t=r.getTokenValue();return e?d(t):(s(t),i.push(t)),scanNext(),!0}function parseLiteral(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(handleError(2),t=0),d(t);break;case 7:d(null);break;case 8:d(!0);break;case 9:d(!1);break;default:return!1}return scanNext(),!0}function parseProperty(){return r.getToken()===10?(parseString(!1),r.getToken()===6?(p(`:`),scanNext(),parseValue()||handleError(4,[],[2,5])):handleError(5,[],[2,5]),i.pop(),!0):(handleError(3,[],[2,5]),!1)}function parseObject(){o(),scanNext();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||handleError(4,[],[]),p(`,`),scanNext(),r.getToken()===2&&_)break}else e&&handleError(6,[],[]);parseProperty()||handleError(4,[],[2,5]),e=!0}return c(),r.getToken()===2?scanNext():handleError(7,[2],[]),!0}function parseArray(){l(),scanNext();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||handleError(4,[],[]),p(`,`),scanNext(),r.getToken()===4&&_)break}else t&&handleError(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,parseValue()||handleError(4,[],[4,5]),t=!0}return u(),e||i.pop(),r.getToken()===4?scanNext():handleError(8,[4],[]),!0}function parseValue(){switch(r.getToken()){case 3:return parseArray();case 1:return parseObject();case 10:return parseString(!0);default:return parseLiteral()}}return scanNext(),r.getToken()===17?n.allowEmptyContent?!0:(handleError(4,[],[]),!1):parseValue()?(r.getToken()!==17&&handleError(9,[],[]),!0):(handleError(4,[],[]),!1)}function getNodeType(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}var Fi;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(Fi||={});var Ii;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(Ii||={});const Li=parse$5,Ri=parseTree$1,zi=findNodeAtLocation$1;var Bi;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(Bi||={});function printParseErrorCode(e){switch(e){case 1:return`InvalidSymbol`;case 2:return`InvalidNumberFormat`;case 3:return`PropertyNameExpected`;case 4:return`ValueExpected`;case 5:return`ColonExpected`;case 6:return`CommaExpected`;case 7:return`CloseBraceExpected`;case 8:return`CloseBracketExpected`;case 9:return`EndOfFileExpected`;case 10:return`InvalidCommentToken`;case 11:return`UnexpectedEndOfComment`;case 12:return`UnexpectedEndOfString`;case 13:return`UnexpectedEndOfNumber`;case 14:return`InvalidUnicode`;case 15:return`InvalidEscapeCharacter`;case 16:return`InvalidCharacter`}return`<unknown ParseErrorCode>`}const Vi={platform:process.platform};function isCaseInsensitiveFs(){return Vi.platform===`darwin`||Vi.platform===`win32`}function findFileUp(e,t){for(let n of ancestors(e)){let e=v(n,t);if(isFile(e))return e}}function findAnyFileUp(e,t){let n=isCaseInsensitiveFs();for(let r of ancestors(e)){let e=readEntries(r,n);if(e)for(let i of t){let t=lookup(e,i,n);if(t&&isFileEntry(r,t))return v(r,t.name)}}}function*ancestors(e){let t=S(e),{root:n}=y(t);for(;;){if(yield t,t===n)return;t=g(t)}}function readEntries(e,t){let n;try{n=s(e,{withFileTypes:!0})}catch{return}let r=new Map;for(let e of n)if(r.set(e.name,e),t){let t=e.name.toLowerCase();r.has(t)||r.set(t,e)}return r}function lookup(e,t,n){let r=e.get(t);return r||!n?r:e.get(t.toLowerCase())}function isFileEntry(e,t){return t.isFile()?!0:t.isSymbolicLink()?isFile(v(e,t.name)):!1}function isFile(e){return d(e,{throwIfNoEntry:!1})?.isFile()??!1}function findPackageJson(e){return findFileUp(e,`package.json`)}function getPackageJson(e){return JSON.parse(o(e,`utf-8`))}function readTextFile(e){return o(e,`utf-8`)}async function importModule(e){return import(T(e).href)}const Hi={findPackageJson,getPackageJson};function lookupConfig({cwd:e},t){let n=getConfigFilenames(t),r=findAnyFileUp(e,n);if(r)return{source:{type:`file`,path:r,format:getConfigFormat(r)},candidates:n};let i=Hi.findPackageJson(e);return i&&Hi.getPackageJson(i)[t]?{source:{type:`package.json`,path:i,property:t},candidates:n}:{source:{type:`none`},candidates:n}}async function resolveConfig({cwd:e,ui:t},n){let{source:r,candidates:i}=lookupConfig({cwd:e},n);if(r.type===`file`){t.debug(`load config from: ${r.path}`);let e=await readConfigFile(r.path);return t.debug(`config: ${JSON.stringify(e,void 0,2)}`),{config:e,source:r,candidates:i}}if(r.type===`package.json`){t.debug(`load config from package.json: ${r.path}`);let e=Hi.getPackageJson(r.path)[r.property];return t.debug(`config: ${JSON.stringify(e,void 0,2)}`),{config:e,source:r,candidates:i}}return t.warn(`no config found under '${e}':\n ${i.join(`
|
|
67
|
+
`)}`),{config:void 0,source:r,candidates:i}}function describeConfigSource(e){switch(e.type){case`file`:return e.path;case`package.json`:return`${e.path} (property "${e.property}")`;default:return`not found`}}function getConfigFilenames(e){let t=[e,`${e}.cjs`,`${e}.mjs`,`${e}.js`,`${e}.json`,`${e}.jsonc`,`${e}.yml`,`${e}.yaml`,`${e}rc.cjs`,`${e}rc.mjs`,`${e}rc.js`,`${e}rc.json`,`${e}rc.jsonc`,`${e}rc.yml`,`${e}rc.yaml`,`${e}rc`];return e.startsWith(`.`)?t:t.flatMap(e=>[e,`.${e}`])}function getConfigFormat(e){switch(_(e).toLowerCase()){case`.json`:case`.jsonc`:return`jsonc`;case`.yml`:case`.yaml`:return`yaml`;case`.js`:case`.cjs`:case`.mjs`:return`module`;default:return`unknown`}}async function readConfigFile(e){let t=getConfigFormat(e);if(t===`module`)return readModuleConfig(e);let n=readTextFile(e);if(t===`jsonc`)return parseJsoncOrThrow(n,e);if(t===`yaml`)return vi.load(n);try{return parseJsoncOrThrow(n,e)}catch{try{return vi.load(n)}catch{return readModuleConfig(e)}}}async function readModuleConfig(e){let t=await importModule(e);return t.activate?t:t.default}function parseJsoncOrThrow(e,t){let n=[],r=Li(e,n,{allowTrailingComma:!0,disallowComments:!1});if(n.length>0){let[{error:e,offset:r}]=n;throw Error(`Unable to parse ${t} as JSON: ${printParseErrorCode(e)} at offset ${r}`)}return r}const Ui=new WeakMap;function parseArgv(e){let t=[],n=e.slice(2).reduce((e,n)=>(e.args.__?e.args.__.push(n):isOption(n)?(isInOptionState(e)&&(e=endOption(e)),e=startOption(e,n,t)):isInOptionState(e)?(e.values.push(n),t[t.length-1].following.push(n)):n===`--`?e.args.__=[]:e.args._.push(n),e),{args:{_:[]},key:``,values:[]}),r=(isInOptionState(n)?endOption(n):n).args;return Ui.set(r,t),r}function isInOptionState(e){return!!e.key}function isOption(e){return e.startsWith(`-`)&&/\w+/.test(e)}function startOption(e,t,n){return e=/^-\w+/.test(t)?startSingleCharacterOptions(e,t,n):startMultiCharacterOptions(e,t),n.push({key:e.key,inline:[...e.values],following:[]}),e}function startSingleCharacterOptions(e,t,n){let r=t.indexOf(`=`),[i,a]=r>0?[t.slice(1,r),[t.slice(r+1)]]:[t.slice(1),[]],o=i.split(``),s=o.pop();for(let e of o)n.push({key:e,inline:[`true`],following:[]});return e=addBooleanOptions(e,o),e.key=s,e.values=a,e}function addBooleanOptions(e,t){return t.length<=0?e:(e.key=t.pop(),e.values=[`true`],addBooleanOptions(endOption(e),t))}function startMultiCharacterOptions(e,t){let n=t.indexOf(`=`);return n>0?(e.key=t.slice(2,n),e.values=[t.slice(n+1)]):(e.key=t.slice(2),e.values=[]),e}function endOption(e){let{key:t,values:n}=e,r={...e.args};return r[t]||(r[t]=[]),n.length===0?r[t].push(`true`):r[t].push(...n),{args:r,key:``,values:[]}}function lookupCommand(e,t,n){let r=matchCommand(e,t);return processCommand(r[0],assignOptionValues(r[1],r[0],n))}function matchCommand(e,t){if(e.commands){let n=e.commands;for(let e=n.length-1;e>=0;e--){let r=n[e];if(!r.name)return[r,t];if(t._[0]===r.name||r.alias?.includes(t._[0]))return t._.shift(),r.commands&&matchCommand(r,t)||[r,t]}}return[e,t]}function assignOptionValues(e,t,n){let r=Ui.get(e);if(!r)return e;let i={},a=[];for(let e of r){let r=countFollowing(lookupOptions(t,e.key)[1]??(n&&lookupOptions(n,e.key)[1]),e),o=e.following.slice(0,r);a.push(...e.following.slice(r));let s=e.inline.length+o.length>0?[...e.inline,...o]:[`true`];i[e.key]=[...i[e.key]??[],...s]}let o={...e,_:[...e._,...a]};for(let t of Object.keys(i))e[t]&&(o[t]=i[t]);return o}function countFollowing(e,t){if(!e)return t.following.length;let n=unwrapOptional(e.type??Fn());return isZodArray(n)?t.following.length:t.inline.length>0?0:isZodBoolean(n)?+!!/^(true|false)$/i.test(t.following[0]??``):1}function processCommand(e,t){return fillDefaultOptions(checkConflicts(fillInputOptions(fillArguments({command:e,rawArgs:t,args:{_:[]},errors:[]}))))}function fillArguments(e){let t=e.command,n=[...e.rawArgs._];return e.args=(t.arguments||[]).reduce((t,r)=>{let i=r.type??K();if(n.length===0)return isZodOptional(i)||e.errors.push({type:`missing-argument`,name:r.name}),t;let a=isZodArray(unwrapOptional(i))?n.splice(0):[n.shift()],[o,s]=convertValue(i,r.name,a);return e.errors.push(...s),t.args[r.name]=o,t},{args:{_:[]}}).args,n.length>0&&e.errors.push({type:`extra-arguments`,name:t.name,values:n}),e}function fillInputOptions(e){return reduceByKey(e.rawArgs,(t,n)=>{if(n===`_`)return t;if(/^-/.test(n))return t.errors.push({type:`invalid-key`,key:n}),t;let[r,i]=lookupOptions(e.command,n);if(!r)return t.errors.push({type:`invalid-key`,key:n}),t;let[a,o]=convertValue(i.type||q(Fn()),n,e.rawArgs[n]);return o&&t.errors.push(...o),t.args[r]=a,t},e)}function checkConflicts(e){let t=e.command.options;if(!t)return e;let n=new Map;for(let t of Object.keys(e.rawArgs)){let[r]=lookupOptions(e.command,t);r&&!n.has(r)&&n.set(r,t)}let r=[...n.keys()];for(let i=0;i<r.length;i++)for(let a=i+1;a<r.length;a++){let[o,s]=[r[i],r[a]];if(!t[o].conflicts?.includes(s)&&!t[s].conflicts?.includes(o))continue;let[c,l]=t[o].conflicts?.includes(s)?[o,s]:[s,o];e.errors.push({type:`conflicting-options`,key:n.get(c),conflictsWith:n.get(l)})}return e}function fillDefaultOptions(e){let t=e.command.options||{};return reduceByKey(t,(e,n)=>{if(e.args[n]!==void 0)return e;let r=t[n];return typeof r==`string`||r.default===void 0||(e.args[n]=isZodArray(r.type)&&!Array.isArray(r.default)?[r.default]:r.default),e},e)}function lookupOptions(e,t){let n=e.options;if(!n)return[];let r=n[t];if(r)return[t,r];let i=findKey(n,e=>{let r=n[e];return r.alias?r.alias.some(e=>e===t||e.alias===t):!1});return i?[i,n[i]]:[]}function unwrapOptional(e){return isZodOptional(e)?e._def.innerType:e}function convertValue(e,t,n){let[r,i]=parse$3(e,t,n);return r.success?[r.data,i]:(i.length===0&&i.push({type:`invalid-value`,key:t,value:n[n.length-1],message:describeValue(e,r.error)}),[void 0,i])}function describeValue(e,t){let n=unwrapOptional(e);return isZodEnum(n)?`expected one of: ${n.options.join(`, `)}`:t.issues[0].message}function parse$3(e,t,n){let[r,i]=toParsable(e,t,n,[]);return[e.safeParse(r),i]}__name(parse$3,`parse`);function toParsable(e,t,n,r){if(isZodOptional(e))return toParsable(e._def.innerType,t,n,r);if(isZodBoolean(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),toBoolean(t,n[n.length-1],r);if(isZodNumber(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),toNumber(t,n[n.length-1],r);if(isZodString(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),[n[n.length-1],r];if(isZodArray(e)){let i=e.element;if(isZodBoolean(i))return n.reduce(([e,n],r)=>{let[i,a]=toBoolean(t,r,n);return e.push(i),[e,a]},[[],r]);if(isZodNumber(i))return n.reduce(([e,n],r)=>{let[i,a]=toNumber(t,r,n);return e.push(i),[e,a]},[[],r]);if(isZodString(i))return[n,r]}return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),[n[n.length-1],r]}function toBoolean(e,t,n){return t.toLowerCase()===`true`?[!0,n]:t.toLowerCase()===`false`?[!1,n]:(n.push({type:`invalid-value`,key:e,value:t,message:`expected to be boolean`}),[void 0,n])}function toNumber(e,t,n){let r=+t;return typeof r==`number`&&!Number.isNaN(r)?[r,n]:(n.push({type:`invalid-value`,key:e,value:t,message:`expected to be number`}),[void 0,n])}function createRegistry(){let e=new Map,t=new Map;function get(n){return n.kind===`collection`?t.get(n.id)??[]:e.get(n.id)?.value}return{register(n,r,i){if(r.kind===`collection`){let e=t.get(r.id)??[];return e.push({source:n,value:i}),t.set(r.id,e),{accepted:!0}}let a=e.get(r.id);return a?{accepted:!1,source:a.source}:(e.set(r.id,{source:n,value:i}),{accepted:!0})},get,has(n){return n.kind===`collection`?t.has(n.id):e.has(n.id)},describe(n){if(n.kind===`collection`)return(t.get(n.id)??[]).map(({source:e})=>e);let r=e.get(n.id)?.source;return r?[r]:[]}}}function formatLookupError(e,t){switch(e.type){case`invalid-key`:return`unknown option ${formatOption(e.key)}`;case`missing-argument`:return`missing required argument <${e.name}>`;case`extra-arguments`:return`unexpected argument${e.values.length>1?`s`:``}: ${e.values.join(`, `)}`;case`invalid-value`:return`invalid value for ${formatKey(e.key,t)}: ${e.message}, received "${e.value}"`;case`conflicting-options`:return`option ${formatOption(e.key)} cannot be used with option ${formatOption(e.conflictsWith)}`;case`expect-single`:return`${formatKey(e.key,t)} expects a single value, received: ${toArray(e.value).join(`, `)}`}}function formatKey(e,t){return t.arguments?.some(t=>t.name===e)?`argument <${e}>`:`option ${formatOption(e)}`}function formatOption(e){return e.length===1?`-${e}`:`--${e}`}function toArray(e){return Array.isArray(e)?e:[e]}function state(e){let{name:t,description:n=``,version:r,config:i,keywords:a=[]}=e;i&&a.length===0&&a.push(t);let o=typeof i==`string`?i:i?t:void 0;return{name:t,description:n,version:r,configName:o,keywords:a,displayLevel:`info`,command:getBaseCommand(n,{config:!!o})}}function builder(e,t){let n=state(t),r=n.description,i=[],a=createRegistry(),o=n.configName?e.loadConfig(n.configName):void 0,s=n.configName||n.keywords.length>0;return s&&n.command.commands.push(adjustCommand(n.command,Sr)),o&&i.push((async()=>{let t=await o;if(n.config=t,t?.plugins){let r=await e.loadPlugins(t.plugins,a,{name:n.name,version:n.version||``});n.command.commands.push(...r.map(e=>adjustCommand(n.command,e)))}})()),{name:n.name,version:n.version||``,description:r,parse:s?parse:void 0,default(e){return n.command=adjustCommand(n.command,{...n.command,...e}),delete this.default,{...this,parse}},command(e){return n.command.commands.push(adjustCommand(n.command,e)),{...this,parse}}};async function parse(r){await Promise.all(i),e.ui.debug(`argv:`,r.join(` `));let o=parseArgv(r),s=getBaseCommand(n.description,{config:!!n.configName}),{args:c}=lookupCommand(s,o);if(c.silent&&(delete o.silent,n.displayLevel=`none`),c.verbose&&(delete o.verbose,n.displayLevel=`debug`),c[`debug-cli`]&&(delete o[`debug-cli`],n.displayLevel=`trace`),e.ui.displayLevel=n.displayLevel,e.ui.dump(),n.configName&&c[`show-config`])return showConfig(n.configName);let l=lookupCommand(n.command,o,s),{args:u,command:d}=l;if(c.version||u.version)return createCommandInstance(e,n,l.command,a).ui.showVersion();if(c.help||u.help)return createCommandInstance(e,n,l.command,a).ui.showHelp();let p=l.errors.filter(e=>!(e.type===`invalid-key`&&lookupOptions(s,e.key)[0]));if(p.length>0){let r=createCommandInstance(e,n,l.command,a).ui,i=findUsageErrorHandler(d)??t.onUsageError;if(i){let e=await i(p,{command:d,ui:r});return exit(typeof e==`number`?e:O.usage)}for(let e of p)r.error(formatLookupError(e,d));return r.showHelp(),exit(O.usage)}if(d.config){let t=typeof n.configName==`string`?n.configName:n.name,{config:r,errors:i}=parseConfig(d.config,await e.loadConfig(t));if(n.config=r,i)return e.ui.error(`config fails validation:`),forEachKey(i,t=>e.ui.error(` ${String(t)}: ${i[t]}`)),createCommandInstance(e,n,l.command,a).ui.showHelp(),exit(O.error);n.config=r}let m=createCommandInstance(e,n,d,a);if(!m.run)return m.ui.showHelp(),exit(O.usage);try{return await m.run(u)}catch(e){if(!isCliError(e))throw e;m.ui.error(e.message);for(let t of e.help)m.ui.error(t);return exit(e.exitCode)}}async function showConfig(t){let{config:r,source:i}=await e.resolveConfig(t),a=createCommandUI(e,n,n.command);a.info(`config: ${describeConfigSource(i)}`),i.type!==`none`&&a.info(JSON.stringify(r,void 0,2))}function exit(t){return e.exit(t),t}function parseConfig(e,t){let n=e.safeParse(t);return n.success?{config:t}:{errors:n.error.flatten().fieldErrors}}}function findUsageErrorHandler(e){for(let t=e;t;t=t.parent)if(t.onUsageError)return t.onUsageError}function createCommandInstance(e,t,n,r){return{...n,run:n.run,ui:createCommandUI(e,t,n),config:t.config,keywords:t.keywords,cwd:e.cwd,registry:r}}function createCommandUI(e,t,n){let r=e.createCommandUI(n.name||t.name);return r.displayLevel=t.displayLevel,{...r,showVersion:()=>r.showVersion(t.version),showHelp:()=>r.showHelp(t.name,n)}}function adjustCommand(e,t){return t.name&&(t.parent=e),t.commands&&=t.commands.map(e=>adjustCommand(t,e)),t}const Y={none:0,emergency:100,alert:200,critical:300,error:400,warn:500,notice:600,info:700,debug:800,trace:900,planck:1/0,all:1/0};function toLogLevelName(e){return e<=100?`emergency`:e<=200?`alert`:e<=300?`critical`:e<=400?`error`:e<=500?`warn`:e<=600?`notice`:e<=700?`info`:e<=800?`debug`:e<=900?`trace`:`planck`}function toLogLevel(e){return Y[e.toLocaleLowerCase()]}const Wi=[`emergency`,`alert`,`critical`,`error`,`warn`,`notice`,`info`,`debug`,`trace`,`planck`];var Gi=__toESM(__commonJSMin(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return parse(e);if(n===`number`&&isFinite(e))return t.long?fmtLong(e):fmtShort(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function parse(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function fmtShort(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function fmtLong(e){var t=Math.abs(e);return t>=a?plural(e,t,a,`day`):t>=i?plural(e,t,i,`hour`):t>=r?plural(e,t,r,`minute`):t>=n?plural(e,t,n,`second`):e+` ms`}function plural(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}))(),1);function createTimestampFormatter(e){switch(e){case`none`:return e=>void 0;case`iso`:return e=>e.toISOString();case`elapsed`:{let e;return t=>{let n=t.getTime(),r=(0,Gi.default)(e===void 0?0:n-e);return e=n,r}}}}function consoleFormatter({args:e}){return e}const Ki=record();function toConsoleMethod(e){switch(!0){case e<=0:return`debug`;case e<=Y.error:return`error`;case e<=Y.warn:return`warn`;case e<=Y.info:return`info`;default:return`debug`}}function buildPolyfillConsole(){return console.log.bind?{debug:(typeof console.info==`function`?console.debug:console.log).bind(console),info:(typeof console.info==`function`?console.info:console.log).bind(console),warn:(typeof console.warn==`function`?console.warn:console.log).bind(console),error:(typeof console.error==`function`?console.error:console.log).bind(console)}:{debug:buildFn(typeof console.debug==`function`?`debug`:`log`),info:buildFn(typeof console.info==`function`?`info`:`log`),warn:buildFn(typeof console.warn==`function`?`warn`:`log`),error:buildFn(typeof console.error==`function`?`error`:`log`)}}function buildFn(e){return(...t)=>{console[e](...t)}}function createConsoleLogReporter(e){let{id:t,formatter:n,filter:r}=unpartial$1({id:`console`,formatter:consoleFormatter},e);return Ki.console||=buildPolyfillConsole(),Object.freeze({id:t,isConsoleReporter:!0,get formatter(){return n},get filter(){return r},console:Ki.console,write(e){if(r&&!r(e))return;let t=n(e),i=toConsoleMethod(e.level);this.console[i](...t)}})}function createLogStore(e){return{loggers:record(),nonConsoleLoggers:record(),reporters:e.reporters||[createConsoleLogReporter()],logLevel:e.logLevel,logLevelStore:logLevelStore(e)}}function logLevelStore(e){let t=e.customLevels||record(),n={customLevels:t,customLevelsReverse:reduceByKey(t,(e,n)=>(e[t[n]]=n,e),{})};return{getName(e){return n.customLevelsReverse[e]??toLogLevelName(e)},getLevel(e){return n.customLevels[e]??toLogLevel(e)},getAllLevels(){return $t(Y,(e,t)=>(t!==`none`&&t!==`all`&&e.push({name:t,level:Y[t]}),e),mapKey(n.customLevels,e=>({name:e,level:n.customLevels[e]})))}}}function createLogger(e,t,n){t=sanitizeId(t);let r=n?.writeTo??(()=>!0),[i,a]=typeof r==`string`?[e=>e===r,e.reporters]:r instanceof RegExp?[e=>r.test(e),e.reporters]:typeof r==`function`?[r,e.reporters]:[()=>!0,[r]];function write(e){writeToReporters(a,e,i)}let o={level:n?.level,write};return Object.defineProperties(o,{id:{value:t,writable:!1},count:{writable:!1,value:(n=>(...r)=>{shouldLog(e,Y.debug,o.level)&&write({id:t,level:Y.debug,args:[++n,...r],timestamp:new Date})})(0)},on:{writable:!1,value:(t,n)=>{let r=typeof t==`string`?e.logLevelStore.getLevel(t):t;if(shouldLog(e,r,o.level)){let t=e.logLevelStore.getName(r),i=o[t].bind(o),a=n(i,o.level??e.logLevel);a&&i(a)}}}}),e.logLevelStore.getAllLevels().forEach(function addMethod({name:n,level:r}){Object.defineProperty(o,n,{writable:!1,value:(...n)=>{shouldLog(e,r,o.level)&&write({id:t,level:r,args:n,timestamp:new Date})}})}),o}function sanitizeId(e){return e.replace(/[`~!#$%^&*()=+[\]{},|<>?]/g,`-`)}function writeToReporters(e,t,n){e.filter(e=>n(e.id)).forEach(e=>e.write(t))}function shouldLog(e,t,n){return t<=(n===void 0?e.logLevel:n)}const qi=record();function createStandardLog(e){let t=createStandardLogClosure(e);return e?.reporters?.some(e=>!e.id)&&t.standardLog.getLogger(`standard-log`).critical(`Detected reporter with empty id. This is not allowed as it will create problems with feature like 'getNonConsoleLogger()'. Please add an id to your reporter.`),qi.gsl||=t,t.standardLog}function noop(){}function createStandardLogClosure(e){let t=createLogStore(required$1({logLevel:Y.info},e)),n=e?.reporters?.filter(e=>!e.isConsoleReporter).map(e=>e.id)??[],r=Wi.concat(Object.keys(e?.customLevels??{})).concat([`on`,`count`,`write`]);return{store:t,standardLog:{get logLevel(){return t.logLevel},toLogLevelName(e){return t.logLevelStore.getName(e)},toLogLevel(e){return t.logLevelStore.getLevel(e)},getLogger(e,n){return t.loggers[e]?t.loggers[e]:t.loggers[e]=createLogger(t,e,{ssf:this.getLogger,...n})},getNonConsoleLogger(e,i){return t.nonConsoleLoggers[e]?t.nonConsoleLoggers[e]:t.loggers[e]?(this.getLogger(`standard-log`).warn(`attempt to create a non-console logger with existing id ('${e}'), ignoring`),t.nonConsoleLoggers[e]=createDummyLogger(r)):t.nonConsoleLoggers[e]=n.length===0?createDummyLogger(r):createLogger(t,e,{ssf:this.getNonConsoleLogger,...i,writeTo(e){return n.indexOf(e)>=0}})}}}}function createDummyLogger(e){return e.reduce((e,t)=>(e[t]=noop,e),record())}function wrapAnsi(e,t){return`\u001B[${t.join(`;`)}m${e}\u001B[0m`}var Ji=__commonJSMin(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),Yi=__toESM(__commonJSMin(((e,t)=>{let n=D(`os`),r=D(`tty`),i=Ji(),{env:a}=process,o;i(`no-color`)||i(`no-colors`)||i(`color=false`)||i(`color=never`)?o=0:(i(`color`)||i(`colors`)||i(`color=true`)||i(`color=always`))&&(o=1);function envForceColor(){if(`FORCE_COLOR`in a)return a.FORCE_COLOR===`true`?1:a.FORCE_COLOR===`false`?0:a.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(a.FORCE_COLOR,10),3)}function translateLevel(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function supportsColor(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let s=envForceColor();s!==void 0&&(o=s);let c=r?o:s;if(c===0)return 0;if(r){if(i(`color=16m`)||i(`color=full`)||i(`color=truecolor`))return 3;if(i(`color=256`))return 2}if(e&&!t&&c===void 0)return 0;let l=c||0;if(a.TERM===`dumb`)return l;if(process.platform===`win32`){let e=n.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in a)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`,`DRONE`].some(e=>e in a)||a.CI_NAME===`codeship`?1:l;if(`TEAMCITY_VERSION`in a)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION);if(a.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in a){let e=Number.parseInt((a.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(a.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||`COLORTERM`in a?1:l}function getSupportLevel(e,t={}){return translateLevel(supportsColor(e,{streamIsTTY:e&&e.isTTY,...t}))}t.exports={supportsColor:getSupportLevel,stdout:getSupportLevel({isTTY:r.isatty(1)}),stderr:getSupportLevel({isTTY:r.isatty(2)})}}))(),1);let Xi;function supportColor(){return Xi||={stderr:Yi.default.stderr?Yi.default.stderr.level:0,stdout:Yi.default.stdout?Yi.default.stdout.level:0}}function createAnsiFormatter(e={timestamp:`none`}){let t=createTimestampFormatter(e.timestamp);return function ansiFormatter(e){let n=toConsoleMethod(e.level);return[formatID(n,e.id),...formatArgs(t,n,e)]}}function formatArgs(e,t,n){let r=[...n.args],i=e(n.timestamp);i!==void 0&&r.push(i);let a=t===`error`?[31]:t===`warn`?[33]:void 0;return a?r.map(e=>wrapAnsi(e,a)):r}function formatID(e,t){let n=supportColor();return toIDFormatter(e===`error`?n.stderr:n.stdout)(t)}function toIDFormatter(e){switch(e){case 0:return e=>e;case 1:return basicIDFormatter;case 2:return ansiIDFormatter;case 3:return truecolorIDFormatter}}function basicIDFormatter(e){let t=getAnsiColor(e);return wrapAnsi(` ${e} `,t)}const Zi={counter:0,list:[[37,41],[30,42],[30,43],[37,44],[37,45],[30,46],[37,40],[37,41,1],[30,42,1],[30,43,1],[37,44,1],[37,45,1],[30,46,1],[37,40,1],[37,41,4],[30,42,4],[30,43,4],[37,44,4],[37,45,4],[30,46,4],[37,40,4],[37,41,1,4],[30,42,1,4],[30,43,1,4],[37,44,1,4],[37,45,1,4],[30,46,1,4],[37,40,1,4]]},Qi=Object.create(null);function getAnsiColor(e){return Qi[e]=Qi[e]||Zi.list[Zi.counter++%Zi.list.length]}function ansiIDFormatter(e){return basicIDFormatter(e)}function truecolorIDFormatter(e){return basicIDFormatter(e)}zn();function createColorLogReporter(e){return createConsoleLogReporter(required({formatter:createAnsiFormatter()},e))}async function loadPlugins({cwd:e,ui:t,registry:n,host:r},i){return activatePlugins(e,t,n,r,i)}async function activatePlugins(e,t,n,r,i){let a=await Promise.all(i.map(async n=>(t.debug(`loading plugin`,n),{name:n,pluginModule:await loadModule(e,t,n)}))),o=[];for(let{name:e,pluginModule:i}of a){if(!isValidPlugin(i)){t.warn(`not a valid plugin`,e);continue}t.debug(`activating plugin`,e),(await activatePlugin(i,n,r,e,t)).forEach(e=>{t.debug(`adding command`,e.name),o.push(e)}),t.debug(`activated plugin`,e)}return o}async function loadModule(e,t,n){try{return await import(n)}catch(r){t.warn(`Unable to load plugin from ${n}. Please let the plugin author knows about it.`),t.warn(`cwd: ${e}`),t.warn(`error: `,r.message||r);return}}function isValidPlugin(e){return e&&typeof e.activate==`function`}async function activatePlugin(e,t,n,r,i){let a=[];return await e.activate({addCommand:e=>a.push(e),register:(e,n)=>{let a=t.register(r,e,n);a.accepted||i.warn(`plugin ${r} could not register ${e.id}; it is already registered by ${a.source}`)},get:t.get,has:t.has,host:n}),a}
|
|
72
68
|
/*!
|
|
73
69
|
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
|
74
70
|
*
|
|
75
71
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|
76
72
|
* Licensed under the MIT License.
|
|
77
73
|
*/
|
|
78
|
-
var
|
|
79
|
-
`)}};n.soft=n,n.hard=function(e,t){return n(e,t,{mode:`hard`})}})),
|
|
80
|
-
${[
|
|
74
|
+
var $i=__commonJSMin(((e,t)=>{var n=``,r;t.exports=repeat;function repeat(e,t){if(typeof e!=`string`)throw TypeError(`expected a string`);if(t===1)return e;if(t===2)return e+e;var i=e.length*t;if(r!==e||r===void 0)r=e,n=``;else if(n.length>=i)return n.substr(0,i);for(;i>n.length&&t>1;)t&1&&(n+=e),t>>=1,e+=e;return n+=e,n=n.substr(0,i),n}})),ea=__commonJSMin(((e,t)=>{var n=$i();t.exports=function padLeft(e,t,r){var i=``,a=t-e.length;if(a<=5&&!r)i=`00000`;else if(a<=25&&!r)i=`000000000000000000000000000`;else return e+n(r||`0`,a);return e+i.slice(0,a)}})),ta=__commonJSMin(((e,t)=>{var n=t.exports=function(e,t,n){typeof e==`object`&&(n=e,e=n.start,t=n.stop),typeof t==`object`&&(n=t,e||=n.start,t=void 0),t||(t=e,e=0),n||={};var r=n.mode||`soft`,i=r===`hard`?/\b/:/(\S+\s+)/;return function(n){return n.toString().split(i).reduce(function(n,i){if(r===`hard`)for(var a=0;a<i.length;a+=t-e)n.push(i.slice(a,a+t-e));else n.push(i);return n},[]).reduce(function(n,r){if(r===``)return n;var i=r.replace(/\t/g,` `),a=n.length-1;if(n[a].length+i.length>t)n[a]=n[a].replace(/\s+$/,``),i.split(/\n/).forEach(function(t){n.push(Array(e+1).join(` `)+t.replace(/^\s+/,``))});else if(i.match(/\n/)){var o=i.split(/\n/);n[a]+=o.shift(),o.forEach(function(t){n.push(Array(e+1).join(` `)+t.replace(/^\s+/,``))})}else n[a]+=i;return n},[Array(e+1).join(` `)]).join(`
|
|
75
|
+
`)}};n.soft=n,n.hard=function(e,t){return n(e,t,{mode:`hard`})}})),na=__toESM(ea(),1);const ra=(0,__toESM(ta(),1).default)(80);function generateHelpMessage(e,t){return`
|
|
76
|
+
${[generateUsageSection(e,t),generateDescriptionSection(t),generateCommandsSection(t),generateArgumentsSection(t),generateOptionsSection(t),generateAliasSection(t),generateConfigSection(t)].filter(e=>!!e).join(`
|
|
81
77
|
|
|
82
78
|
`)}
|
|
83
|
-
`}function
|
|
84
|
-
${
|
|
79
|
+
`}function generateUsageSection(e,t){let n=getCommandNameChain(e,t),r=t.commands&&t.commands.length>0,i=`Usage: ${n.join(` `)}${r?` <command>`:``}`;return t.arguments&&(i+=t.arguments.some(e=>isRequired(e,!0))?` <arguments>`:` [arguments]`),t.options&&(i+=someKey(t.options,e=>isRequired(t.options[e],!1))?` <options>`:` [options]`),i}function isRequired({type:e},t){return e?!e.isOptional():t}function generateDescriptionSection(e){return e.description?` ${e.description}`:``}function getCommandNameChain(e,t){let n=[t];for(;t.parent;)n.unshift(t.parent),t=t.parent;return[e,...n.map(e=>e.name).filter(e=>e)]}function generateCommandsSection(e){let t=getCommandsNamesAndAlias(e.commands);return t.length===0?``:`Commands:
|
|
80
|
+
${ra(t.join(`, `))}
|
|
85
81
|
|
|
86
|
-
${(0,
|
|
87
|
-
`,n=[],r=0;e.arguments.forEach(e=>{let t=
|
|
88
|
-
`),t}function
|
|
89
|
-
`,n=[],r=0;for(let t in e.options){let i=e.options[t],a=
|
|
90
|
-
`),t}function
|
|
91
|
-
${
|
|
92
|
-
${ef(e.config)}`:``}function ef(e){return _i(tf(e),{maxLength:1/0}).replace(/'/g,``)}function tf(e){if(vo(e)){let t=e.shape;return Li(t,(e,n)=>{let r=t[n];return bo(r)?e[`${n}?`]=tf(r._def.innerType):e[n]=tf(r),e},{})}return Co(e)?`string`:xo(e)?`boolean`:So(e)?`number`:yo(e)?vo(e.element)?`Array<${ef(e.element)}>`:`${ef(e.element)}[]`:``}function nf(){let e=process.cwd(),t=od({logLevel:Vu.all,reporters:[Qu()]}),n,r;return{async loadConfig(e){return(await this.resolveConfig(e)).config},async resolveConfig(t){return n||=ou({cwd:e,ui:this.ui},t)},async loadPlugins(t,n,i){return r||=Dd({cwd:e,ui:this.ui,registry:n,host:i},t)},cwd:e,exit(e){process.exitCode=e},createCommandUI(e){return Rd(t.getLogger(e))},ui:Ld(Rd(t.getLogger(`clibuilder`,{writeTo:Ed()})))}}function rf(e){return Iu(nf(),e)}const af={comma:`,`,tab:` `,pipe:`|`},of=af.comma;function sf(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/\t/g,`\\t`).replace(/[\u0000-\u001F]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function cf(e){return e===`true`||e===`false`||e===`null`}function lf(e,t,n){if(t===`__proto__`){Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0});return}e[t]=n}const uf=RegExp(`(?:^?|\\n) *#`);var df=class{constructor(e){if(uf.test(e))throw TypeError(`Raw string must not contain a line starting with "#": ${JSON.stringify(e)}`);this.value=e}};function ff(e){return e instanceof df}const pf=/[\uD800-\uDFFF]/;function mf(e){if(e===null)return null;if(ff(e))return e;if(typeof e==`object`&&e&&`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();if(t!==e)return mf(t)}if(typeof e==`string`)return hf(e,`string value`),e;if(typeof e==`boolean`)return e;if(typeof e==`number`)return Object.is(e,-0)?0:Number.isFinite(e)?e:null;if(typeof e==`bigint`)return e>=-(2**53-1)&&e<=2**53-1?Number(e):e.toString();if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(mf);if(e instanceof Set)return Array.from(e).map(mf);if(e instanceof Map)return Object.fromEntries(Array.from(e,([e,t])=>[String(e),mf(t)]));if(xf(e)){let t={};for(let n in e)Object.hasOwn(e,n)&&(hf(n,`object key`),lf(t,n,mf(e[n])));return t}return null}function hf(e,t){if(pf.test(e))for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<55296||r>57343)continue;let i=r<=56319,a=e.charCodeAt(n+1);if(i&&a>=56320&&a<=57343){n++;continue}throw TypeError(`Cannot encode ${t} containing an unpaired surrogate U+${r.toString(16).toUpperCase()} at index ${n}`)}}function gf(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function _f(e){return gf(e)||ff(e)}function vf(e){return Array.isArray(e)}function yf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!ff(e)}function bf(e){return Object.keys(e).length===0}function xf(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Sf(e){return e.length===0||e.every(e=>_f(e))}function Cf(e){return e.length===0||e.every(e=>vf(e))}function wf(e){return e.length===0||e.every(e=>yf(e))}const Tf=/^[+-]?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i;function Ef(e){if(!Object.values(af).includes(e))throw TypeError(`Invalid delimiter ${JSON.stringify(e)}. Valid delimiters are: comma (,), tab (\\t), pipe (|)`)}function Df(e){return/^[A-Z_][\w.]*$/i.test(e)}function Of(e,t=of){return!(!e||/^[ \t]|[ \t]$/.test(e)||cf(e)||kf(e)||e.includes(`:`)||e.includes(`"`)||e.includes(`\\`)||/[[\]{}]/.test(e)||/[\u0000-\u001F]/.test(e)||e.includes(t)||e.startsWith(`-`)||e.startsWith(`#`))}function kf(e){return Tf.test(e)}function Af(e,t){return ff(e)?e.value:e===null?`null`:typeof e==`boolean`||typeof e==`number`?String(e):jf(e,t)}function jf(e,t=of){return Of(e,t)?e:`"${sf(e)}"`}function Mf(e){return Df(e)?e:`"${sf(e)}"`}function Nf(e,t=of){return e.map(e=>Af(e,t)).join(t)}function Pf(e,t){let n=t?.key,r=t?.fields,i=t?.delimiter??`,`,a=``;return n!=null&&(a+=Mf(n)),a+=`[${e}${t?.keyed?`:`:``}${i===of?``:i}]`,r&&(a+=`{${Ff(r,i)}}`),a+=`:`,a}function Ff(e,t){return e.map(e=>Mf(e.name)+(e.children?`{${Ff(e.children,t)}}`:``)).join(t)}function If(e){if(e.length===0)return;let t=Object.keys(e[0]);if(t.length===0)return;for(let n of e){if(Object.keys(n).length!==t.length)return;for(let e of t)if(!Object.hasOwn(n,e))return}let n=[];for(let r of t){let t=zf(r,e.map(e=>e[r]));if(!t)return;n.push(t)}return n}function Lf(e){let t=Object.values(e);if(!(t.length<2)&&t.every(e=>yf(e)&&!bf(e)))return If(t)}function Rf(e,t){let n=[];return Bf(e,t,n),n}function zf(e,t){if(t.every(e=>_f(e)))return{name:e};if(!t.every(e=>yf(e)&&!bf(e)))return;let n=If(t);if(n)return{name:e,children:n}}function Bf(e,t,n){for(let r of t){let t=e[r.name];r.children?Bf(t,r.children,n):n.push(t)}}function*Vf(e,t,n){if(_f(e)){let n=Af(e,t.delimiter);n!==``&&(yield n);return}if(vf(e))yield*Kf(void 0,e,n,t);else if(yf(e)){let r=Lf(e);if(r){yield*Wf(void 0,e,r,n,t);return}yield*Hf(e,n,t)}}function*Hf(e,t,n){for(let[r,i]of Object.entries(e))yield*Uf(r,i,t,n)}function*Uf(e,t,n,r){let i=Mf(e);if(_f(t))yield ep(n,`${i}: ${Af(t,r.delimiter)}`,r.indentSize);else if(vf(t))yield*Kf(e,t,n,r);else if(yf(t)){let a=Lf(t);if(a){yield*Wf(e,t,a,n,r);return}yield ep(n,`${i}:`,r.indentSize),bf(t)||(yield*Hf(t,n+1,r))}}function*Wf(e,t,n,r,i){let a=Object.entries(t);yield ep(r,Pf(a.length,{key:e,fields:n,delimiter:i.delimiter,keyed:!0}),i.indentSize),yield*Gf(a,n,r+1,i)}function*Gf(e,t,n,r){for(let[i,a]of e){let e=Rf(a,t);yield ep(n,`${Mf(i)}: ${Nf(e,r.delimiter)}`,r.indentSize)}}function*Kf(e,t,n,r){if(t.length===0){yield ep(n,e==null?`[]`:`${Mf(e)}: []`,r.indentSize);return}if(Sf(t)){yield ep(n,Jf(t,r.delimiter,e),r.indentSize);return}if(Cf(t)&&t.every(e=>Sf(e))){yield*qf(e,t,n,r);return}if(wf(t)){let i=If(t);i?yield*Yf(e,t,i,n,r):yield*Zf(e,t,n,r);return}yield*Zf(e,t,n,r)}function*qf(e,t,n,r){yield ep(n,Pf(t.length,{key:e,delimiter:r.delimiter}),r.indentSize);for(let e of t)if(Sf(e)){let t=Jf(e,r.delimiter);yield tp(n+1,t,r.indentSize)}}function Jf(e,t,n){let r=Pf(e.length,{key:n,delimiter:t}),i=Nf(e,t);return e.length===0?r:`${r} ${i}`}function*Yf(e,t,n,r,i){yield ep(r,Pf(t.length,{key:e,fields:n,delimiter:i.delimiter}),i.indentSize),yield*Xf(t,n,r+1,i)}function*Xf(e,t,n,r){for(let i of e)yield ep(n,Nf(Rf(i,t),r.delimiter),r.indentSize)}function*Zf(e,t,n,r){yield ep(n,Pf(t.length,{key:e,delimiter:r.delimiter}),r.indentSize);for(let e of t)yield*$f(e,n+1,r)}function*Qf(e,t,n){if(bf(e)){yield ep(t,`-`,n.indentSize);return}let r=Object.entries(e),[i,a]=r[0],o=r.slice(1);if(vf(a)&&wf(a)){let e=If(a);if(e){yield tp(t,Pf(a.length,{key:i,fields:e,delimiter:n.delimiter}),n.indentSize),yield*Xf(a,e,t+2,n),o.length>0&&(yield*Hf(Object.fromEntries(o),t+1,n));return}}if(yf(a)){let e=Lf(a);if(e){let r=Object.entries(a);yield tp(t,Pf(r.length,{key:i,fields:e,delimiter:n.delimiter,keyed:!0}),n.indentSize),yield*Gf(r,e,t+2,n),o.length>0&&(yield*Hf(Object.fromEntries(o),t+1,n));return}}let s=Mf(i);if(_f(a))yield tp(t,`${s}: ${Af(a,n.delimiter)}`,n.indentSize);else if(vf(a)){if(a.length===0)yield tp(t,`${s}: []`,n.indentSize);else if(Sf(a))yield tp(t,`${s}${Jf(a,n.delimiter)}`,n.indentSize);else{yield tp(t,`${s}${Pf(a.length,{delimiter:n.delimiter})}`,n.indentSize);for(let e of a)yield*$f(e,t+2,n)}}else yf(a)&&(yield tp(t,`${s}:`,n.indentSize),bf(a)||(yield*Hf(a,t+2,n)));o.length>0&&(yield*Hf(Object.fromEntries(o),t+1,n))}function*$f(e,t,n){if(_f(e))yield tp(t,Af(e,n.delimiter),n.indentSize);else if(vf(e)){if(Sf(e))yield tp(t,Jf(e,n.delimiter),n.indentSize);else{yield tp(t,Pf(e.length,{delimiter:n.delimiter}),n.indentSize);for(let r of e)yield*$f(r,t+1,n)}}else yf(e)&&(yield*Qf(e,t,n))}function ep(e,t,n){return` `.repeat(n*e)+t}function tp(e,t,n){return ep(e,`- `+t,n)}function np(e,t){let n=t(``,e,[]);return n===void 0?ip(e,t,[]):rp(e,n,t,[])}function rp(e,t,n,r){return ff(t)&&!_f(e)?ip(e,n,r):ip(mf(t),n,r)}function ip(e,t,n){return yf(e)?ap(e,t,n):vf(e)?op(e,t,n):e}function ap(e,t,n){let r={};for(let[i,a]of Object.entries(e)){let e=[...n,i],o=t(i,a,e);o!==void 0&&lf(r,i,rp(a,o,t,e))}return r}function op(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=[...n,i],s=t(String(i),a,o);s!==void 0&&r.push(rp(a,s,t,o))}return r}function sp(e,t){return Array.from(cp(e,t)).join(`
|
|
93
|
-
`)}function
|
|
94
|
-
`)?e:`${e}\n`)}function
|
|
95
|
-
`)}function
|
|
96
|
-
`)){let t=/^\s*\[marketplaces\.(?:"([^"]+)"|([^\]]+))\]\s*$/.exec(e);if(t){a={name:t[1]??t[2],path:``},r.push(a);continue}if(/^\s*\[/.test(e)){a=void 0;continue}let n=a?/^\s*source\s*=\s*"([^"]*)"\s*$/.exec(e):void 0;n?.[1]&&a&&(a.path=n[1])}return{installed:n,marketplaces:r}}const Gp=[Hp,{name:`codex`,scoped:!1,installedOnMachine:(e,t=process.env)=>r(Up(e,t)),state:(e,t=process.env)=>Wp(Up(e,t)),register:e=>`codex plugin marketplace add ./${e}`,install:e=>`codex plugin add ${e}`,update:e=>`codex plugin add ${e}`,uninstall:e=>`codex plugin remove ${e}`,refreshMarketplace:()=>``}];function Kp(e,t,n,r){let i=`@${t}`;return e.filter(e=>e.id.endsWith(i)&&(!r||e.projectPath===n))}function qp({catalog:e,catalogDir:t,root:n,installed:r,marketplaces:i,scoped:a=!0}){let o=i.find(t=>t.name===e.name),s=[],c=t.split(/[\\/]/).filter(Boolean),l=o?c.every(e=>o.path.includes(e)):!1,u=o&&!l?o.path:void 0;o||s.push({kind:`register`,subject:e.name,detail:`marketplace is not registered with this harness`});let d=Kp(r,e.name,n,a),f=new Map(d.map(e=>[e.id,e]));for(let t of e.plugins){let n=`${t.name}@${e.name}`,r=f.get(n);if(!r){s.push({kind:`install`,subject:n,detail:`not installed; catalog pins ${t.source.version}`});continue}r.version!==t.source.version&&s.push({kind:`update`,subject:n,detail:`installed ${r.version}, catalog pins ${t.source.version}`})}let p=new Set(e.plugins.map(t=>`${t.name}@${e.name}`));for(let e of d)p.has(e.id)||s.push({kind:`uninstall`,subject:e.id,detail:`installed but no longer in the catalog; it will report a load failure until removed`});return{actions:s,...u?{collision:u}:{},unregistered:!o}}function Jp(e,t,n){switch(t.kind){case`register`:return e.register(Mp);case`install`:return e.install(t.subject);case`update`:{let r=e.refreshMarketplace(n),i=e.update(t.subject);return r?`${r} && ${i}`:i}case`uninstall`:return e.uninstall(t.subject)}}function Yp(e){let t=[];e.pnp&&t.push(`Yarn Plug’n’Play is active: dependencies live inside zip archives, so no harness can install from them. Set nodeLinker: node-modules, or unplug the plugin dependencies.`),e.genericName&&t.push(`Marketplace name "${e.catalog.name}" is generic. Registering a second marketplace under a name already in use replaces the first silently, and the install that follows reports "already installed" — the repository then runs the other one's versions.`);for(let{package:n}of e.unresolved)t.push(`Declared dependency "${n}" is not installed; install dependencies before generating.`);return t}const Xp=Vi({name:`dep-plugins`,description:`Derive the marketplace catalog for plugins shipped by this repository’s dependencies, so a harness can install them. Writes the catalog; installing is the harness’s own job.`,options:{root:{description:`Repository directory. Defaults to the current directory.`,type:Z(ho())},check:{description:`Report whether the catalog is current without writing it. For CI and postinstall.`,type:Z(go())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:Z(ho()),default:`toon`}},run(e){try{let t=fp(e.format),n=e.root??process.cwd(),r=Fp(n),i=e.check?Ip(n,r.catalog)===`unchanged`?`current`:`would-change`:Lp(n,r.catalog),a=T(),o=Yp(r),s=Gp.filter(e=>e.installedOnMachine(a)),c=[],l=[];for(let e of s){let t=e.state(a),i=qp({catalog:r.catalog,catalogDir:Mp,root:x(n),installed:t.installed,marketplaces:t.marketplaces,scoped:e.scoped});i.collision&&o.push(`${e.name}: marketplace "${r.catalog.name}" is already registered against ${i.collision}. Registering over it replaces the other repository's silently, and the install that follows reports "already installed" — rename this repository's marketplace instead.`),c.push({runtime:e.name,status:i.actions.length?`${i.actions.length} to apply`:`in sync`});for(let t of i.actions)l.push({runtime:e.name,do:Jp(e,t,r.catalog.name),subject:t.subject,why:t.detail})}return r.plugins.length&&o.push(`Copilot CLI rejects an npm marketplace source, so it cannot install from this catalog. It needs a path-sourced catalog, which cannot reach node_modules from a subdirectory.`),pp({catalog:Np,marketplace:r.catalog.name,outcome:i,plugins:r.plugins.length?r.plugins.map(({plugin:e,package:t,version:n})=>({name:e,package:t,version:n})):`0 dependencies ship a plugin — nothing to install`,harness:c.length?c:`no supported harness detected on this machine`,actions:l.length?l:`0 actions — every detected harness matches the catalog`,...o.length?{notes:o}:{}},t),i===`would-change`?pu.error:pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Catalog generation failed.`}\n`),pu.error}}});function Zp(e){try{return s(e,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(t=>b(e,_(t.parentPath,t.name)).split(S).join(y.sep)).sort()}catch{return[]}}const Qp=[{name:`claude-code`,project:{detect:`.claude`,skillsDirectory:`.claude/skills`,shadowedBy:[`CLAUDE.md`,`.claude/CLAUDE.md`,`CLAUDE.local.md`],mcpConfig:{path:`.mcp.json`,key:`mcpServers`,format:`json`},nonstandard:[{path:`.claude/commands`,shape:`directory`,kind:`command`},{path:`.claude/rules`,shape:`directory`,kind:`rule`},{path:`.claude/agents`,shape:`directory`,kind:`subagent`}]},user:{detect:`.claude`,skillsDirectory:`.claude/skills`}},{name:`cursor`,project:{detect:`.cursor`,mcpConfig:{path:`.cursor/mcp.json`,key:`mcpServers`,format:`json`},nonstandard:[{path:`.cursorrules`,shape:`file`,kind:`instructions`},{path:`.cursor/rules`,shape:`directory`,kind:`rule`},{path:`.cursor/commands`,shape:`directory`,kind:`command`},{path:`.cursor/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.cursor`}},{name:`codex`,project:{detect:`.codex`,mcpConfig:{path:`.codex/config.toml`,key:`mcp_servers`,format:`toml`},nonstandard:[{path:`.codex/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.codex`}},{name:`copilot-cli`,project:{detect:`.github/skills`,nonstandard:[{path:`.github/copilot-instructions.md`,shape:`file`,kind:`instructions`},{path:`.github/instructions`,shape:`directory`,kind:`instructions`},{path:`.github/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.copilot`}},{name:`gemini-cli`,project:{detect:`.gemini`,instructionBridge:{kind:`settings-entry`,path:`.gemini/settings.json`,key:`context.fileName`},mcpConfig:{path:`.gemini/settings.json`,key:`mcpServers`,format:`json`,shared:!0},nonstandard:[{path:`GEMINI.md`,shape:`file`,kind:`instructions`},{path:`.gemini/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.gemini`}},{name:`devin-desktop`,project:{detect:`.devin`}},{name:`windsurf`,project:{detect:`.windsurf`,skillsDirectory:`.windsurf/skills`,nonstandard:[{path:`.windsurfrules`,shape:`file`,kind:`instructions`},{path:`.windsurf/rules`,shape:`directory`,kind:`rule`}]},deprecated:`devin-desktop`}],$p=new Set(Qp.map(e=>e.name));function em(e){return $p.has(e)}function tm(e){let t=(e??``).split(`,`).map(e=>e.trim()).filter(Boolean),n=t.filter(e=>!em(e));if(n.length)throw Error(`Unsupported harness: ${n.join(`, `)}. Supported: ${Qp.map(e=>e.name).join(`, `)}.`);return t.filter(em)}const nm=[`claude-code`,`cursor`];function rm(e){try{return i(e).isDirectory()}catch{return!1}}function im(e,t){let n=new Set([...nm,...t]);return Qp.filter(t=>n.has(t.name)||rm(_(e,t.project.detect)))}function am({file:e,server:t,field:n,position:r}){return r?`${e}#L${r.line}:${r.column}`:t===void 0?e:`${e}#servers.${t}${n===void 0?``:`.${n}`}`}function om(e){return Object.entries(e).map(([e,t])=>({problem:e,...t}))}const sm=`buddy-agent-harness`,cm=`/buddy-agent-harness:repair`,Q=`/buddy-agent-harness:init-buddy-agent-harness`,lm=`.agents/buddy-agent-harness/mcp.toml`,um={"no-canonical":{detail:`the canonical skill directory does not exist, so no bridge can resolve`,repair:(e,t)=>({command:`${t} init`,instruction:`run \`${t} init\` to create .agents/skills and the bridges into it`}),skillRepair:()=>`run \`${Q}\`, which creates \`.agents/skills\` and the bridges`},missing:{detail:`no bridge at this path — the harness sees zero project skills`,repair:({file:e},t)=>({command:`${t} init`,instruction:`run \`${t} init\` to create the bridge at ${e}`}),skillRepair:()=>`run \`${Q}\``},degraded:{detail:`expected a directory but found a regular file — checkout without core.symlinks`,repair:({file:e},t)=>({command:`${t} init --copy --force ${e}`,instruction:`run \`${t} init --copy --force ${e}\` to rebuild ${e} as a real directory`}),skillRepair:({file:e})=>`run \`${Q} --copy --force ${e}\``},stale:{detail:`symlink does not resolve to .agents/skills`,repair:({file:e},t)=>({command:`${t} init --force ${e}`,instruction:`run \`${t} init --force ${e}\` to repoint ${e} at .agents/skills`}),skillRepair:({file:e})=>`run \`${Q} --force ${e}\``},"diverged-bridge":{detail:`only the bridge changed since the two last agreed — an agent wrote through the copy`,repair:({file:e},t)=>({command:``,instruction:`replace .agents/skills with ${e} to keep the newer edit, then run \`${t} init --force ${e}\``}),skillRepair:({file:e})=>`replace .agents/skills with ${e} to keep the newer edit, then run \`${Q} --force ${e}\``},"diverged-canonical":{detail:`only .agents/skills changed since the two last agreed — the copy is stale`,repair:({file:e},t)=>({command:`${t} init --copy --force ${e}`,instruction:`run \`${t} init --copy --force ${e}\` to rebuild ${e} from the newer .agents/skills`}),skillRepair:({file:e})=>`run \`${Q} --copy --force ${e}\``},"diverged-both":{detail:`both sides changed since they last agreed — rebuilding would discard one of them`,repair:({file:e})=>({command:``,instruction:`reconcile .agents/skills with ${e} by hand — rebuilding would discard one of them; \`git diff --no-index .agents/skills ${e}\` shows what differs`}),skillRepair:({file:e})=>`run \`git diff --no-index .agents/skills ${e}\` and reconcile by hand`},"diverged-unknown":{detail:`contents differ and no commit where they agreed was found — which side moved is unknown`,repair:({file:e})=>({command:``,instruction:`reconcile .agents/skills with ${e} by hand — which side moved is unknown; \`git diff --no-index .agents/skills ${e}\` shows what differs`}),skillRepair:({file:e})=>`run \`git diff --no-index .agents/skills ${e}\` and reconcile by hand`},"unpinned-copy":{detail:`tracked copy without the skip-worktree bit — the tree is dirty with content that must not be committed`,repair:({file:e})=>({command:`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree`,instruction:`run \`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree\` to restore the skip-worktree bit`}),skillRepair:({file:e})=>`run \`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree\``}};om(um);const dm={"no-instructions":{detail:`no AGENTS.md at the repository root, so the instructions this repository has reach one harness at most`,repair:()=>({command:``,instruction:`hand this to \`${Q}\`, which consolidates what the repository has into AGENTS.md, or derives it`}),skillRepair:()=>`run \`${Q}\`, which consolidates or derives AGENTS.md`},"instructions-missing":{detail:`no instruction bridge at this path — the harness reads none of AGENTS.md`,repair:({file:e})=>({command:``,instruction:`hand ${e} to \`${Q}\`, which writes the bridge into it`}),skillRepair:()=>`run \`${Q}\``},"instructions-unbridged":{detail:`the file is present but names AGENTS.md nowhere — the harness reads none of it`,repair:({file:e})=>({command:``,instruction:`hand ${e} to \`${Q}\`, which adds the bridge without discarding what the file already says`}),skillRepair:()=>`run \`${Q}\`, which adds the bridge without discarding what the file already says`},"instructions-shadowing":{detail:`this file suppresses the AGENTS.md beside it — the harness reads this instead, and none of AGENTS.md`,repair:({file:e})=>({command:``,instruction:`hand ${e} to \`${Q}\`, which consolidates what it says into AGENTS.md, or adds an @AGENTS.md import above it where the file has to stay`}),skillRepair:()=>`run \`${Q}\`, which consolidates the file into AGENTS.md or imports AGENTS.md from it`},"instructions-superseded":{detail:`a bridge from before the harness read AGENTS.md itself — it still works, and nothing needs it`,repair:({file:e})=>({command:``,instruction:`remove ${e}, or keep it for sessions that cannot read AGENTS.md directly — \`${Q}\` offers the choice`}),skillRepair:()=>`run \`${Q}\`, which offers to remove it`},"instructions-unreadable":{detail:`the settings file does not parse, so the harness reads none of it`,repair:({file:e})=>({command:``,instruction:`fix the JSON in ${e} by hand, then hand it to \`${Q}\``}),skillRepair:()=>`fix the JSON by hand, then run \`${Q}\``}};om(dm);const fm={"deprecated-harness":{detail:`a projection under a harness name that has been superseded — the replacement reads .agents/skills natively and needs no projection at all`,repair:({file:e})=>({command:``,instruction:`remove ${e} and enable the harness that replaced it — \`${cm}\` offers the correction`}),skillRepair:()=>`run \`${cm}\``},"ignored-bridge":{detail:`a .gitignore rule matches this bridge — an untracked bridge swallows a real edit silently`,repair:({file:e})=>({command:``,instruction:`narrow or remove the .gitignore rule matching ${e} — \`${cm}\` offers the correction`}),skillRepair:()=>`run \`${cm}\``},"unread-local-override":{detail:`no harness reads this filename, so everything in it is invisible to every agent`,repair:({file:e})=>({command:``,instruction:`move ${e} to CLAUDE.local.md, or consolidate it into AGENTS.md — \`${cm}\` offers the correction`}),skillRepair:()=>`run \`${cm}\``},"unloadable-skill":{detail:`frontmatter that does not parse, or no description — either one makes a harness skip the skill outright`,repair:({file:e})=>({command:``,instruction:`quote the description in ${e}, or add one — \`${cm}\` offers the correction`}),skillRepair:()=>`run \`${cm}\``}};om(fm);const pm={"mcp-golden-unreadable":{detail:`the golden MCP set does not parse — the locator gives the line and column, and nothing else can be said about it`,repair:e=>({command:``,instruction:`fix the TOML at ${am(e)}`}),skillRepair:e=>`fix the TOML at ${am(e)} by hand — the reported line and column are all that can be quoted, because the parser's own message repeats the offending line and that line is the one holding the credential`},"mcp-target-unreadable":{detail:`this harness config does not parse, so the harness starts none of its servers and nothing in it can be compared`,repair:e=>({command:``,instruction:`fix the syntax of ${am(e)}`}),skillRepair:e=>`fix the syntax of ${am(e)} by hand`},"mcp-unprojected":{detail:`the golden set declares this server and the harness config does not carry it`,repair:({file:e,server:t})=>({command:``,instruction:`add the server ${t} to ${e}, or drop it from the golden set`}),skillRepair:e=>`add the server at ${am(e)} to that file from its golden entry, or drop it from the golden set`},"mcp-undeclared":{detail:`the harness config carries this server and the golden set does not declare it`,repair:({file:e,server:t})=>({command:``,instruction:`add the server ${t} to ${lm}, or drop it from ${e}`}),skillRepair:e=>`copy the server at ${am(e)} into ${lm}, refusing any literal credential it carries, or drop it from ${e.file}`},"mcp-diverged-target":{detail:`only the harness config changed since the two last agreed — the edit was made through the copy`,repair:e=>({command:``,instruction:`reconcile the value at ${am(e)} back into ${lm}`}),skillRepair:e=>`reconcile the value at ${am(e)} back into ${lm}, field by field`},"mcp-diverged-golden":{detail:`only the golden set changed since the two last agreed — the harness copy is stale`,repair:e=>({command:``,instruction:`update ${am(e)} from the golden entry`}),skillRepair:e=>`update ${am(e)} from the golden entry`},"mcp-diverged-both":{detail:`both sides changed since they last agreed — merging either way would discard the other`,repair:e=>({command:``,instruction:`reconcile ${am(e)} against ${lm} by hand`}),skillRepair:e=>`reconcile ${am(e)} against ${lm} by hand — never merge a three-way conflict automatically`},"mcp-diverged-unknown":{detail:`the two disagree and no baseline says which side moved — neither history nor a last-projected record covers this server`,repair:e=>({command:``,instruction:`compare ${am(e)} against ${lm} by hand`}),skillRepair:e=>`compare ${am(e)} against ${lm} by hand`},"mcp-literal-secret":{detail:`a credential-bearing field holds a literal rather than a reference to an environment variable`,repair:e=>({command:``,instruction:`move the value at ${am(e)} into an environment variable and reference it`}),skillRepair:e=>`move the value at ${am(e)} into an environment variable and reference it — read the value from the file, never from this report, and never repeat it back`},"mcp-committed-secret":{detail:`a credential-bearing field holds a literal in a git-tracked file — the credential is committed, and moving it does not un-commit it`,repair:e=>({command:``,instruction:`rotate the credential behind ${am(e)}, then reference it from an environment variable`}),skillRepair:e=>`rotate the credential behind ${am(e)} at its issuer, then reference it from an environment variable — it is in the repository's history, so moving it is not enough`}};om(pm);const mm={"nonstandard-instructions":{detail:`instruction content only one harness reads — AGENTS.md carries the same prose to all of them`,repair:({file:e})=>({command:``,instruction:`consolidate ${e} into AGENTS.md and leave a generated bridge in its place — \`${Q}\` offers the consolidation`}),skillRepair:({file:e})=>`hand ${e} to \`${Q}\`, which consolidates it into AGENTS.md`},"nonstandard-rule":{detail:`a path-scoped rule only one harness reads — a skill reaches every harness where the scoping is incidental`,repair:({file:e})=>({command:``,instruction:`convert ${e} into a skill under .agents/skills where its guidance is not tied to the paths it names — \`${Q}\` offers the conversion; keep it where the path scoping is the point`}),skillRepair:({file:e})=>`hand ${e} to \`${Q}\` to convert into a skill, unless the path scoping is load-bearing`},"nonstandard-command":{detail:`a harness command file — a skill is the portable form, and this harness reads skills too`,repair:({file:e})=>({command:``,instruction:`move ${e} to .agents/skills/<name>/SKILL.md — \`${Q}\` offers the move`}),skillRepair:({file:e})=>`hand ${e} to \`${Q}\`, which moves it to .agents/skills`},"nonstandard-skill":{detail:`a skill under a harness directory rather than the canonical one, where only that harness finds it`,repair:({file:e})=>({command:``,instruction:`move ${e} to .agents/skills and project it back where the harness needs one — \`${Q}\` offers the move`}),skillRepair:({file:e})=>`hand ${e} to \`${Q}\`, which moves it to .agents/skills`},"nonstandard-subagent":{detail:`a subagent definition with no cross-harness form — nothing outside this harness can read it, and no canonical form exists yet`,repair:({file:e})=>({command:``,instruction:`leave ${e} where it is and record that it reaches one harness only — no portable form exists to convert it to`}),skillRepair:({file:e})=>`leave ${e} in place — no portable form exists yet, so this is work for a person rather than a skill`}};om(mm);const hm={...um,...dm,...fm,...pm,...mm};om(hm);function gm(e){return{problem:e,...hm[e]}}const _m=`.agents/skills`,vm=`AGENTS.local.md`;function ym(e){let t=/^---\n([\s\S]*?)\n---/.exec(e);if(!t)return`unparseable`;let n=/^description:[ \t]*(.*)$/m.exec(t[1])?.[1]?.trim();if(!n)return`no-description`;if(!/^(['"]).*\1$/.test(n)&&/:\s/.test(n))return`unparseable`}function bm({root:e,git:t,cli:n}){let i=[],a=(e,t)=>{let{detail:r,repair:a}=gm(t);i.push({path:e,problem:t,detail:r,repair:a({file:e},n)})},s=im(e,[]);for(let t of s){let n=t.project.skillsDirectory;t.deprecated&&n&&r(_(e,n))&&a(n,`deprecated-harness`)}for(let n of s){let i=n.project.skillsDirectory;i&&r(_(e,i))&&t.isIgnored(i)&&a(i,`ignored-bridge`)}r(_(e,vm))&&a(vm,`unread-local-override`);for(let t of Zp(_(e,_m)).filter(e=>e.endsWith(`SKILL.md`)))ym(o(_(e,_m,t),`utf8`))&&a(`${_m}/${t}`,`unloadable-skill`);return i}function xm(e){let t=``,n=0,r=!1,i=!1;for(;n<e.length;){let a=e[n];if(r){t+=a,i?i=!1:a===`\\`?i=!0:a===`"`&&(r=!1),n+=1;continue}if(a===`"`){r=!0,t+=a,n+=1;continue}if(a===`/`&&e[n+1]===`/`){for(;n<e.length&&e[n]!==`
|
|
97
|
-
`;)n+=1;continue}if(a===`/`&&e[n+1]===`*`){for(n+=2;n<e.length&&(e[n]!==`*`||e[n+1]!==`/`);)n+=1;n+=2;continue}t+=a,n+=1}return t}function Sm(e){try{return JSON.parse(xm(e))}catch{return}}const Cm=[`transport`,`command`,`args`,`env`,`url`,`headers`,`description`,`enabled`,`timeout`,`source`],wm=new Set([`env`,`headers`]);function Tm(e,t,n){if(wm.has(e)&&up(t)&&up(n)){let e=Object.keys(t);return e.length===Object.keys(n).length&&e.every(e=>t[e]===n[e])}return JSON.stringify(t)===JSON.stringify(n)}function Em(e,t){return Cm.filter(n=>{let r=e[n];if(r===void 0)return!1;if(wm.has(n)&&up(r)&&up(t[n])){let e=t[n];return Object.keys(r).some(t=>r[t]!==e[t])}return!Tm(n,r,t[n])})}function Dm(e,t,n){return Tm(e,t?.[e],n?.[e])}
|
|
82
|
+
${(0,na.default)(e.name?`${e.name} <command> -h`:` <command> -h`,25,` `)}Get help for <command>`}function getCommandsNamesAndAlias(e){let t=[];return e&&e.forEach(e=>{e.alias?t.push(`${e.name} (${e.alias.join(`|`)})`):t.push(e.name)}),t}function generateArgumentsSection(e){if(!e.arguments)return``;let t=`Arguments:
|
|
83
|
+
`,n=[],r=0;e.arguments.forEach(e=>{let t=formatSignature(e.name,e.type,{defaultRequired:!0,booleanIsFlag:!1});r=Math.max(r,t.length),n.push([t,e.description||``])});let i=Math.max(23,r+2);return t+=n.map(e=>` ${(0,na.default)(e[0],i,` `)}${e[1]}`.trimEnd()).join(`
|
|
84
|
+
`),t}function generateOptionsSection(e){if(!e.options)return``;let t=`Options:
|
|
85
|
+
`,n=[],r=0;for(let t in e.options){let i=e.options[t],a=formatKeyValue(t,i),o=formatDescription(i,conflictsOf(t,e.options));n.push([a,o]),r=Math.max(r,a.length)}let i=Math.max(23,r+2);return t+=n.map(e=>` ${(0,na.default)(e[0],i,` `)}${e[1]}`).join(`
|
|
86
|
+
`),t}function formatKeyValue(e,t){return formatSignature([...t.alias?t.alias.map(e=>typeof e==`string`?e:e.hidden?void 0:e.alias).filter(e=>e):[],e].sort((e,t)=>e.length-t.length).map(e=>e.length===1?`-${e}`:`--${e}`).join(`|`),t.type,{defaultRequired:!1,booleanIsFlag:!0})}function formatSignature(e,t,{defaultRequired:n,booleanIsFlag:r}){let i=t?!isZodOptional(t):n,a=`${e}${formatTypeHint(t,r)}`;return i?`<${a}>`:`[${a}]`}function formatTypeHint(e,t){if(!e)return``;let n=isZodOptional(e)?e._def.innerType:e,r=isZodArray(n),i=r?n.element:n,a=isZodString(i)?`string`:isZodNumber(i)?`number`:isZodBoolean(i)?`boolean`:``;return r?a?`=${a}...`:`...`:!a||t&&a===`boolean`?``:`=${a}`}function formatDescription(e,t){let n=e.type&&isZodString(e.type)?`'${e.default}'`:e.default,r=e.default?`${e.description} (default ${n})`:e.description;return t.length===0?r:`${r} (conflicts with ${t.map(e=>e.length===1?`-${e}`:`--${e}`).join(`, `)})`}function conflictsOf(e,t){return Object.keys(t).filter(n=>n!==e&&(t[e].conflicts?.includes(n)||t[n].conflicts?.includes(e)))}function generateAliasSection(e){return e.alias?`Alias:
|
|
87
|
+
${ra(e.alias.join(`, `))}`:``}function generateConfigSection(e){return e.config?`Config:
|
|
88
|
+
${toPrettyType(e.config)}`:``}function toPrettyType(e){return tersify(toTypeObject(e),{maxLength:1/0}).replace(/'/g,``)}function toTypeObject(e){if(isZodObject(e)){let t=e.shape;return reduceByKey(t,(e,n)=>{let r=t[n];return isZodOptional(r)?e[`${n}?`]=toTypeObject(r._def.innerType):e[n]=toTypeObject(r),e},{})}return isZodString(e)?`string`:isZodBoolean(e)?`boolean`:isZodNumber(e)?`number`:isZodArray(e)?isZodObject(e.element)?`Array<${toPrettyType(e.element)}>`:`${toPrettyType(e.element)}[]`:``}function createBuilderUI(e){let t=!0,n=[];return{...e,get displayLevel(){return e.displayLevel},set displayLevel(t){e.displayLevel=t},debug:(...r)=>t?n.push([`debug`,r]):e.debug(...r),info:(...r)=>t?n.push([`info`,r]):e.info(...r),warn:(...r)=>t?n.push([`warn`,r]):e.warn(...r),error:(...r)=>t?n.push([`error`,r]):e.error(...r),dump:()=>{t=!1,n.forEach(([t,n])=>{e[t](...n)})}}}function createUI(e){return e.level=Y.info,{get displayLevel(){return e.level<=Y.none?`none`:e.level<=Y.info?`info`:e.level<=Y.debug?`debug`:`trace`},set displayLevel(t){switch(t){case`none`:e.level=Y.none;break;case`debug`:e.level=Y.debug;break;case`trace`:e.level=Y.trace}},debug:(...t)=>e.debug(...t),info:(...t)=>e.info(...t),warn:(...t)=>e.warn(...t),error:(...t)=>e.error(...t),showHelp:(t,n)=>{let r=generateHelpMessage(t,n);e.info(r)},showVersion(t){e.info(t||`not versioned`)}}}function context(){let e=process.cwd(),t=createStandardLog({logLevel:Y.all,reporters:[createConsoleLogReporter()]}),n,r;return{async loadConfig(e){return(await this.resolveConfig(e)).config},async resolveConfig(t){return n||=resolveConfig({cwd:e,ui:this.ui},t)},async loadPlugins(t,n,i){return r||=loadPlugins({cwd:e,ui:this.ui,registry:n,host:i},t)},cwd:e,exit(e){process.exitCode=e},createCommandUI(e){return createUI(t.getLogger(e))},ui:createBuilderUI(createUI(t.getLogger(`clibuilder`,{writeTo:createColorLogReporter()})))}}function cli(e){return builder(context(),e)}const ia={comma:`,`,tab:` `,pipe:`|`},aa=ia.comma;function escapeString(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/\t/g,`\\t`).replace(/[\u0000-\u001F]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function isBooleanOrNullLiteral(e){return e===`true`||e===`false`||e===`null`}function setOwnProperty(e,t,n){if(t===`__proto__`){Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0});return}e[t]=n}const oa=RegExp(`(?:^?|\\n) *#`);var RawString=class{constructor(e){if(oa.test(e))throw TypeError(`Raw string must not contain a line starting with "#": ${JSON.stringify(e)}`);this.value=e}};function isRawString(e){return e instanceof RawString}const sa=/[\uD800-\uDFFF]/;function normalizeValue(e){if(e===null)return null;if(isRawString(e))return e;if(typeof e==`object`&&e&&`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();if(t!==e)return normalizeValue(t)}if(typeof e==`string`)return assertNoLoneSurrogate(e,`string value`),e;if(typeof e==`boolean`)return e;if(typeof e==`number`)return Object.is(e,-0)?0:Number.isFinite(e)?e:null;if(typeof e==`bigint`)return e>=-(2**53-1)&&e<=2**53-1?Number(e):e.toString();if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(normalizeValue);if(e instanceof Set)return Array.from(e).map(normalizeValue);if(e instanceof Map)return Object.fromEntries(Array.from(e,([e,t])=>[String(e),normalizeValue(t)]));if(isPlainObject(e)){let t={};for(let n in e)Object.hasOwn(e,n)&&(assertNoLoneSurrogate(n,`object key`),setOwnProperty(t,n,normalizeValue(e[n])));return t}return null}function assertNoLoneSurrogate(e,t){if(sa.test(e))for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<55296||r>57343)continue;let i=r<=56319,a=e.charCodeAt(n+1);if(i&&a>=56320&&a<=57343){n++;continue}throw TypeError(`Cannot encode ${t} containing an unpaired surrogate U+${r.toString(16).toUpperCase()} at index ${n}`)}}function isJsonPrimitive(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function isEncodablePrimitive(e){return isJsonPrimitive(e)||isRawString(e)}function isJsonArray(e){return Array.isArray(e)}function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!isRawString(e)}function isEmptyObject(e){return Object.keys(e).length===0}function isPlainObject(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function isArrayOfPrimitives(e){return e.length===0||e.every(e=>isEncodablePrimitive(e))}function isArrayOfArrays(e){return e.length===0||e.every(e=>isJsonArray(e))}function isArrayOfObjects(e){return e.length===0||e.every(e=>isJsonObject(e))}const ca=/^[+-]?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i;function assertValidDelimiter(e){if(!Object.values(ia).includes(e))throw TypeError(`Invalid delimiter ${JSON.stringify(e)}. Valid delimiters are: comma (,), tab (\\t), pipe (|)`)}function isValidUnquotedKey(e){return/^[A-Z_][\w.]*$/i.test(e)}function isSafeUnquoted(e,t=aa){return!(!e||/^[ \t]|[ \t]$/.test(e)||isBooleanOrNullLiteral(e)||isNumericLike(e)||e.includes(`:`)||e.includes(`"`)||e.includes(`\\`)||/[[\]{}]/.test(e)||/[\u0000-\u001F]/.test(e)||e.includes(t)||e.startsWith(`-`)||e.startsWith(`#`))}function isNumericLike(e){return ca.test(e)}function encodePrimitive(e,t){return isRawString(e)?e.value:e===null?`null`:typeof e==`boolean`||typeof e==`number`?String(e):encodeStringLiteral(e,t)}function encodeStringLiteral(e,t=aa){return isSafeUnquoted(e,t)?e:`"${escapeString(e)}"`}function encodeKey(e){return isValidUnquotedKey(e)?e:`"${escapeString(e)}"`}function encodeAndJoinPrimitives(e,t=aa){return e.map(e=>encodePrimitive(e,t)).join(t)}function formatHeader(e,t){let n=t?.key,r=t?.fields,i=t?.delimiter??`,`,a=``;return n!=null&&(a+=encodeKey(n)),a+=`[${e}${t?.keyed?`:`:``}${i===aa?``:i}]`,r&&(a+=`{${formatFieldSegment(r,i)}}`),a+=`:`,a}function formatFieldSegment(e,t){return e.map(e=>encodeKey(e.name)+(e.children?`{${formatFieldSegment(e.children,t)}}`:``)).join(t)}function extractTabularFields(e){if(e.length===0)return;let t=Object.keys(e[0]);if(t.length===0)return;for(let n of e){if(Object.keys(n).length!==t.length)return;for(let e of t)if(!Object.hasOwn(n,e))return}let n=[];for(let r of t){let t=classifyColumn(r,e.map(e=>e[r]));if(!t)return;n.push(t)}return n}function extractKeyedTabularFields(e){let t=Object.values(e);if(!(t.length<2)&&t.every(e=>isJsonObject(e)&&!isEmptyObject(e)))return extractTabularFields(t)}function collectRowLeaves(e,t){let n=[];return collectLeafValues(e,t,n),n}function classifyColumn(e,t){if(t.every(e=>isEncodablePrimitive(e)))return{name:e};if(!t.every(e=>isJsonObject(e)&&!isEmptyObject(e)))return;let n=extractTabularFields(t);if(n)return{name:e,children:n}}function collectLeafValues(e,t,n){for(let r of t){let t=e[r.name];r.children?collectLeafValues(t,r.children,n):n.push(t)}}function*encodeJsonValue(e,t,n){if(isEncodablePrimitive(e)){let n=encodePrimitive(e,t.delimiter);n!==``&&(yield n);return}if(isJsonArray(e))yield*encodeArrayLines(void 0,e,n,t);else if(isJsonObject(e)){let r=extractKeyedTabularFields(e);if(r){yield*encodeKeyedObjectLines(void 0,e,r,n,t);return}yield*encodeObjectLines(e,n,t)}}function*encodeObjectLines(e,t,n){for(let[r,i]of Object.entries(e))yield*encodeKeyValuePairLines(r,i,t,n)}function*encodeKeyValuePairLines(e,t,n,r){let i=encodeKey(e);if(isEncodablePrimitive(t))yield indentedLine(n,`${i}: ${encodePrimitive(t,r.delimiter)}`,r.indentSize);else if(isJsonArray(t))yield*encodeArrayLines(e,t,n,r);else if(isJsonObject(t)){let a=extractKeyedTabularFields(t);if(a){yield*encodeKeyedObjectLines(e,t,a,n,r);return}yield indentedLine(n,`${i}:`,r.indentSize),isEmptyObject(t)||(yield*encodeObjectLines(t,n+1,r))}}function*encodeKeyedObjectLines(e,t,n,r,i){let a=Object.entries(t);yield indentedLine(r,formatHeader(a.length,{key:e,fields:n,delimiter:i.delimiter,keyed:!0}),i.indentSize),yield*encodeKeyedEntryRowsLines(a,n,r+1,i)}function*encodeKeyedEntryRowsLines(e,t,n,r){for(let[i,a]of e){let e=collectRowLeaves(a,t);yield indentedLine(n,`${encodeKey(i)}: ${encodeAndJoinPrimitives(e,r.delimiter)}`,r.indentSize)}}function*encodeArrayLines(e,t,n,r){if(t.length===0){yield indentedLine(n,e==null?`[]`:`${encodeKey(e)}: []`,r.indentSize);return}if(isArrayOfPrimitives(t)){yield indentedLine(n,encodeInlineArrayLine(t,r.delimiter,e),r.indentSize);return}if(isArrayOfArrays(t)&&t.every(e=>isArrayOfPrimitives(e))){yield*encodeArrayOfArraysAsListItemsLines(e,t,n,r);return}if(isArrayOfObjects(t)){let i=extractTabularFields(t);i?yield*encodeArrayOfObjectsAsTabularLines(e,t,i,n,r):yield*encodeMixedArrayAsListItemsLines(e,t,n,r);return}yield*encodeMixedArrayAsListItemsLines(e,t,n,r)}function*encodeArrayOfArraysAsListItemsLines(e,t,n,r){yield indentedLine(n,formatHeader(t.length,{key:e,delimiter:r.delimiter}),r.indentSize);for(let e of t)if(isArrayOfPrimitives(e)){let t=encodeInlineArrayLine(e,r.delimiter);yield indentedListItem(n+1,t,r.indentSize)}}function encodeInlineArrayLine(e,t,n){let r=formatHeader(e.length,{key:n,delimiter:t}),i=encodeAndJoinPrimitives(e,t);return e.length===0?r:`${r} ${i}`}function*encodeArrayOfObjectsAsTabularLines(e,t,n,r,i){yield indentedLine(r,formatHeader(t.length,{key:e,fields:n,delimiter:i.delimiter}),i.indentSize),yield*writeTabularRowsLines(t,n,r+1,i)}function*writeTabularRowsLines(e,t,n,r){for(let i of e)yield indentedLine(n,encodeAndJoinPrimitives(collectRowLeaves(i,t),r.delimiter),r.indentSize)}function*encodeMixedArrayAsListItemsLines(e,t,n,r){yield indentedLine(n,formatHeader(t.length,{key:e,delimiter:r.delimiter}),r.indentSize);for(let e of t)yield*encodeListItemValueLines(e,n+1,r)}function*encodeObjectAsListItemLines(e,t,n){if(isEmptyObject(e)){yield indentedLine(t,`-`,n.indentSize);return}let r=Object.entries(e),[i,a]=r[0],o=r.slice(1);if(isJsonArray(a)&&isArrayOfObjects(a)){let e=extractTabularFields(a);if(e){yield indentedListItem(t,formatHeader(a.length,{key:i,fields:e,delimiter:n.delimiter}),n.indentSize),yield*writeTabularRowsLines(a,e,t+2,n),o.length>0&&(yield*encodeObjectLines(Object.fromEntries(o),t+1,n));return}}if(isJsonObject(a)){let e=extractKeyedTabularFields(a);if(e){let r=Object.entries(a);yield indentedListItem(t,formatHeader(r.length,{key:i,fields:e,delimiter:n.delimiter,keyed:!0}),n.indentSize),yield*encodeKeyedEntryRowsLines(r,e,t+2,n),o.length>0&&(yield*encodeObjectLines(Object.fromEntries(o),t+1,n));return}}let s=encodeKey(i);if(isEncodablePrimitive(a))yield indentedListItem(t,`${s}: ${encodePrimitive(a,n.delimiter)}`,n.indentSize);else if(isJsonArray(a)){if(a.length===0)yield indentedListItem(t,`${s}: []`,n.indentSize);else if(isArrayOfPrimitives(a))yield indentedListItem(t,`${s}${encodeInlineArrayLine(a,n.delimiter)}`,n.indentSize);else{yield indentedListItem(t,`${s}${formatHeader(a.length,{delimiter:n.delimiter})}`,n.indentSize);for(let e of a)yield*encodeListItemValueLines(e,t+2,n)}}else isJsonObject(a)&&(yield indentedListItem(t,`${s}:`,n.indentSize),isEmptyObject(a)||(yield*encodeObjectLines(a,t+2,n)));o.length>0&&(yield*encodeObjectLines(Object.fromEntries(o),t+1,n))}function*encodeListItemValueLines(e,t,n){if(isEncodablePrimitive(e))yield indentedListItem(t,encodePrimitive(e,n.delimiter),n.indentSize);else if(isJsonArray(e)){if(isArrayOfPrimitives(e))yield indentedListItem(t,encodeInlineArrayLine(e,n.delimiter),n.indentSize);else{yield indentedListItem(t,formatHeader(e.length,{delimiter:n.delimiter}),n.indentSize);for(let r of e)yield*encodeListItemValueLines(r,t+1,n)}}else isJsonObject(e)&&(yield*encodeObjectAsListItemLines(e,t,n))}function indentedLine(e,t,n){return` `.repeat(n*e)+t}function indentedListItem(e,t,n){return indentedLine(e,`- `+t,n)}function applyReplacer(e,t){let n=t(``,e,[]);return n===void 0?transformChildren(e,t,[]):transformReplaced(e,n,t,[])}function transformReplaced(e,t,n,r){return isRawString(t)&&!isEncodablePrimitive(e)?transformChildren(e,n,r):transformChildren(normalizeValue(t),n,r)}function transformChildren(e,t,n){return isJsonObject(e)?transformObject(e,t,n):isJsonArray(e)?transformArray(e,t,n):e}function transformObject(e,t,n){let r={};for(let[i,a]of Object.entries(e)){let e=[...n,i],o=t(i,a,e);o!==void 0&&setOwnProperty(r,i,transformReplaced(a,o,t,e))}return r}function transformArray(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=[...n,i],s=t(String(i),a,o);s!==void 0&&r.push(transformReplaced(a,s,t,o))}return r}function encode(e,t){return Array.from(encodeLines(e,t)).join(`
|
|
89
|
+
`)}function encodeLines(e,t){let n=normalizeValue(e),r=resolveOptions(t);return encodeJsonValue(r.replacer?applyReplacer(n,r.replacer):n,r,0)}function resolveOptions(e){let t=e?.delimiter??aa;return assertValidDelimiter(t),{indentSize:e?.indentSize??e?.indent??2,delimiter:t,replacer:e?.replacer}}function isRecord$1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}__name(isRecord$1,`isRecord`);const la=[`toon`,`json`,`text`];function parseFormat(e){if(!la.includes(e))throw Error(`--format must be toon, json, or text.`);return e}function writeResult(e,t){process.stdout.write(`${encodeResult(e,t)}\n`)}function writeDocument(e){process.stdout.write(e.endsWith(`
|
|
90
|
+
`)?e:`${e}\n`)}function encodeResult(e,t){return t===`json`?JSON.stringify(e):t===`text`?renderText(e):encode(e)}function cell(e){return e===void 0?``:String(e)}function table(e){let t=[...new Set(e.flatMap(e=>Object.keys(e)))],n=t.map(t=>Math.max(t.length,...e.map(e=>cell(e[t]).length))),line=e=>` ${e.map((e,t)=>e.padEnd(n[t])).join(` `)}`.trimEnd();return[line(t),...e.map(e=>line(t.map(t=>cell(e[t]))))]}function renderText(e){let t=Object.entries(e).map(([e,t])=>{if(!Array.isArray(t))return[`${e}: ${isRecord$1(t)?JSON.stringify(t):String(t)}`];if(!t.length)return[`${e}: (none)`];let n=t.every(isRecord$1)?table(t):t.map(e=>` - ${String(e)}`);return[`${e}:`,...n]});return t.flatMap((e,n)=>{let r=t[n-1];return r&&(r.length>1||e.length>1)?[``,...e]:e}).join(`
|
|
91
|
+
`)}function collapseHome(e,t){return e&&t.startsWith(e+C)?`~${t.slice(e.length)}`:t}function displayBinPath(e,t){return t?collapseHome(e,t):`buddy-agent-harness`}const ua=new Set([`deps`,`dependencies`,`local`,`plugins`,`marketplace`,`plugin`,`default`]);function isGenericName(e){return ua.has(e.toLowerCase())}function marketplaceName$1(e){return e.replace(/^@/,``).replace(/\//g,`-`).replace(/[^a-zA-Z0-9-_.]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)||`agent-plugins`}__name(marketplaceName$1,`marketplaceName`);function declaredDependencies(e){if(!e||typeof e!=`object`)return[];let t=e,n=new Set;for(let e of[`dependencies`,`devDependencies`]){let r=t[e];if(r&&typeof r==`object`)for(let e of Object.keys(r))n.add(e)}return[...n].sort()}function buildCatalog({name:e,owner:t,plugins:n}){let r=[...n].sort((e,t)=>e.plugin.localeCompare(t.plugin)).map(({plugin:e,package:t,version:n,description:r})=>{let i={source:`npm`,package:t,version:n};return r?{name:e,source:i,description:r}:{name:e,source:i}});return{name:e,owner:{name:t},description:`Plugins provided by this repository’s dependencies. Generated — do not edit.`,plugins:r}}function serializeCatalog(e){return`${JSON.stringify(e,null,` `)}\n`}function readJson$2(e){try{return JSON.parse(o(e,`utf8`))}catch{return}}__name(readJson$2,`readJson`);function ancestorCandidates(e,t){let n=t.split(`/`),r=[],i=e;for(;;){r.push(v(i,`node_modules`,...n));let e=g(i);if(e===i)break;i=e}return r}function packageDir(t,n){try{let r=e(n);return g(r.resolve(`${t}/package.json`))}catch{}for(let e of ancestorCandidates(g(n),t))if(r(v(e,`package.json`)))return e}function readDepPlugin(e,t){let n=packageDir(e,t);if(!n)return{ok:!1,package:e,reason:`unresolved`};let r=readJson$2(v(n,`plugin.json`));if(!r||typeof r!=`object`)return{ok:!1,package:e,reason:`no-manifest`};let i=r,a=typeof i.name==`string`?i.name:void 0;if(!a)return{ok:!1,package:e,reason:`unnamed`};let o=readJson$2(v(n,`package.json`)),s=typeof o?.version==`string`?o.version:void 0;if(!s)return{ok:!1,package:e,reason:`no-manifest`};let c=typeof i.description==`string`?i.description:void 0;return{ok:!0,plugin:c?{package:e,plugin:a,version:s,description:c}:{package:e,plugin:a,version:s}}}function isPnp(){return!!process.versions.pnp}const da=v(`.agents`,`buddy-agent-harness`),fa=v(da,`.claude-plugin`,`marketplace.json`);function readManifest(e){return JSON.parse(o(e,`utf8`))}function deriveCatalog(e){let t=v(e,`package.json`),n=readManifest(t),r=[],i=[];for(let e of declaredDependencies(n)){let n=readDepPlugin(e,t);n.ok?r.push(n.plugin):n.reason===`unresolved`&&i.push({package:e,reason:n.reason})}let a=typeof n.name==`string`?n.name:`unknown`,o=marketplaceName$1(a);return{catalog:buildCatalog({name:o,owner:a,plugins:r}),plugins:r,unresolved:i,genericName:isGenericName(o),pnp:isPnp()}}function catalogStatus(e,t){let n;try{n=o(v(e,fa),`utf8`)}catch{n=void 0}return n===serializeCatalog(t)?`unchanged`:n===void 0?`created`:`updated`}function writeCatalog(e,t){let n=catalogStatus(e,t);if(n===`unchanged`)return n;let r=v(e,fa);return a(g(r),{recursive:!0}),m(r,serializeCatalog(t)),n}function readJson$1(e){try{return JSON.parse(o(e,`utf8`))}catch{return}}__name(readJson$1,`readJson`);function directories$1(e){try{return s(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)}catch{return[]}}__name(directories$1,`directories`);function claudeConfigDir(e,t=process.env){return t.CLAUDE_CONFIG_DIR||v(e,`.claude`)}function readClaudeState(e){let t=readJson$1(v(e,`plugins`,`installed_plugins.json`)),n=[];for(let[e,r]of Object.entries(t?.plugins??{}))if(Array.isArray(r))for(let t of r){if(!t||typeof t!=`object`)continue;let r=t,i=typeof r.version==`string`?r.version:void 0,a=typeof r.scope==`string`?r.scope:void 0;if(!i||!a)continue;let o=typeof r.projectPath==`string`?r.projectPath:void 0;n.push(o?{id:e,version:i,scope:a,projectPath:o}:{id:e,version:i,scope:a})}let r=readJson$1(v(e,`plugins`,`known_marketplaces.json`)),i=[];for(let[e,t]of Object.entries(r??{}))i.push({name:e,path:typeof t?.source?.path==`string`?t.source.path:``});return{installed:n,marketplaces:i}}const pa={name:`claude-code`,scoped:!0,installedOnMachine:(e,t=process.env)=>r(claudeConfigDir(e,t)),state:(e,t=process.env)=>readClaudeState(claudeConfigDir(e,t)),register:e=>`claude plugin marketplace add ./${e} --scope project`,install:e=>`claude plugin install ${e} --scope project`,update:e=>`claude plugin update ${e} --scope project`,uninstall:e=>`claude plugin uninstall ${e} --scope project`,refreshMarketplace:e=>`claude plugin marketplace update ${e}`};function codexHome(e,t=process.env){return t.CODEX_HOME||v(e,`.codex`)}function readCodexState(e){let t=v(e,`plugins`,`cache`),n=[];for(let e of directories$1(t))for(let r of directories$1(v(t,e)))for(let i of directories$1(v(t,e,r)))n.push({id:`${r}@${e}`,version:i,scope:`user`});let r=[],i=``;try{i=o(v(e,`config.toml`),`utf8`)}catch{i=``}let a;for(let e of i.split(`
|
|
92
|
+
`)){let t=/^\s*\[marketplaces\.(?:"([^"]+)"|([^\]]+))\]\s*$/.exec(e);if(t){a={name:t[1]??t[2],path:``},r.push(a);continue}if(/^\s*\[/.test(e)){a=void 0;continue}let n=a?/^\s*source\s*=\s*"([^"]*)"\s*$/.exec(e):void 0;n?.[1]&&a&&(a.path=n[1])}return{installed:n,marketplaces:r}}const ma=[pa,{name:`codex`,scoped:!1,installedOnMachine:(e,t=process.env)=>r(codexHome(e,t)),state:(e,t=process.env)=>readCodexState(codexHome(e,t)),register:e=>`codex plugin marketplace add ./${e}`,install:e=>`codex plugin add ${e}`,update:e=>`codex plugin add ${e}`,uninstall:e=>`codex plugin remove ${e}`,refreshMarketplace:()=>``}];function ours(e,t,n,r){let i=`@${t}`;return e.filter(e=>e.id.endsWith(i)&&(!r||e.projectPath===n))}function reconcile({catalog:e,catalogDir:t,root:n,installed:r,marketplaces:i,scoped:a=!0}){let o=i.find(t=>t.name===e.name),s=[],c=t.split(/[\\/]/).filter(Boolean),l=o?c.every(e=>o.path.includes(e)):!1,u=o&&!l?o.path:void 0;o||s.push({kind:`register`,subject:e.name,detail:`marketplace is not registered with this harness`});let d=ours(r,e.name,n,a),p=new Map(d.map(e=>[e.id,e]));for(let t of e.plugins){let n=`${t.name}@${e.name}`,r=p.get(n);if(!r){s.push({kind:`install`,subject:n,detail:`not installed; catalog pins ${t.source.version}`});continue}r.version!==t.source.version&&s.push({kind:`update`,subject:n,detail:`installed ${r.version}, catalog pins ${t.source.version}`})}let m=new Set(e.plugins.map(t=>`${t.name}@${e.name}`));for(let e of d)m.has(e.id)||s.push({kind:`uninstall`,subject:e.id,detail:`installed but no longer in the catalog; it will report a load failure until removed`});return{actions:s,...u?{collision:u}:{},unregistered:!o}}function commandFor(e,t,n){switch(t.kind){case`register`:return e.register(da);case`install`:return e.install(t.subject);case`update`:{let r=e.refreshMarketplace(n),i=e.update(t.subject);return r?`${r} && ${i}`:i}case`uninstall`:return e.uninstall(t.subject)}}function notesFor(e){let t=[];e.pnp&&t.push(`Yarn Plug’n’Play is active: dependencies live inside zip archives, so no harness can install from them. Set nodeLinker: node-modules, or unplug the plugin dependencies.`),e.genericName&&t.push(`Marketplace name "${e.catalog.name}" is generic. Registering a second marketplace under a name already in use replaces the first silently, and the install that follows reports "already installed" — the repository then runs the other one's versions.`);for(let{package:n}of e.unresolved)t.push(`Declared dependency "${n}" is not installed; install dependencies before generating.`);return t}const ha=command({name:`dep-plugins`,description:`Derive the marketplace catalog for plugins shipped by this repository’s dependencies, so a harness can install them. Writes the catalog; installing is the harness’s own job.`,options:{root:{description:`Repository directory. Defaults to the current directory.`,type:q(K())},check:{description:`Report whether the catalog is current without writing it. For CI and postinstall.`,type:q(Fn())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:q(K()),default:`toon`}},run(e){try{let t=parseFormat(e.format),n=e.root??process.cwd(),r=deriveCatalog(n),i=e.check?catalogStatus(n,r.catalog)===`unchanged`?`current`:`would-change`:writeCatalog(n,r.catalog),a=E(),o=notesFor(r),s=ma.filter(e=>e.installedOnMachine(a)),c=[],l=[];for(let e of s){let t=e.state(a),i=reconcile({catalog:r.catalog,catalogDir:da,root:S(n),installed:t.installed,marketplaces:t.marketplaces,scoped:e.scoped});i.collision&&o.push(`${e.name}: marketplace "${r.catalog.name}" is already registered against ${i.collision}. Registering over it replaces the other repository's silently, and the install that follows reports "already installed" — rename this repository's marketplace instead.`),c.push({runtime:e.name,status:i.actions.length?`${i.actions.length} to apply`:`in sync`});for(let t of i.actions)l.push({runtime:e.name,do:commandFor(e,t,r.catalog.name),subject:t.subject,why:t.detail})}return r.plugins.length&&o.push(`Copilot CLI rejects an npm marketplace source, so it cannot install from this catalog. It needs a path-sourced catalog, which cannot reach node_modules from a subdirectory.`),writeResult({catalog:fa,marketplace:r.catalog.name,outcome:i,plugins:r.plugins.length?r.plugins.map(({plugin:e,package:t,version:n})=>({name:e,package:t,version:n})):`0 dependencies ship a plugin — nothing to install`,harness:c.length?c:`no supported harness detected on this machine`,actions:l.length?l:`0 actions — every detected harness matches the catalog`,...o.length?{notes:o}:{}},t),i===`would-change`?O.error:O.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Catalog generation failed.`}\n`),O.error}}});function filesUnder(e){try{return s(e,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(t=>x(e,v(t.parentPath,t.name)).split(C).join(b.sep)).sort()}catch{return[]}}const isOne=e=>e===`1`,isSet=e=>e!==``,ga={name:`CLAUDECODE`,matches:isOne,description:`Claude Code sets CLAUDECODE=1 in subprocesses it spawns; IDE extensions also set it in integrated terminals`,research:`E-CC-D1`},_a=[{harness:`claude-code`,all:[ga,{name:`CLAUDE_CODE_CHILD_SESSION`,matches:isOne,description:`Claude Code sets CLAUDE_CODE_CHILD_SESSION=1 for tool, hook, and status line subprocesses`,research:`E-CC-D3`}]},{harness:`claude-code`,all:[ga,{name:`CLAUDE_CODE_SESSION_ID`,matches:isSet,description:`Claude Code sets CLAUDE_CODE_SESSION_ID in tool, hook, and stdio MCP server subprocesses`,research:`E-CC-D6`}]},{harness:`cursor`,all:[{name:`CURSOR_AGENT`,matches:isOne,description:`Cursor sets CURSOR_AGENT=1 on terminal commands its agent runs`,research:`E-CUR-D1`}]},{harness:`cursor`,all:[{name:`CURSOR_VERSION`,matches:isSet,description:`Cursor sets CURSOR_VERSION for hook commands`,research:`E-CUR-D10`},{name:`CURSOR_PROJECT_DIR`,matches:isSet,description:`Cursor sets CURSOR_PROJECT_DIR for hook commands`,research:`E-CUR-D10`}]},{harness:`codex`,all:[{name:`CODEX_THREAD_ID`,matches:isSet,description:`Codex injects CODEX_THREAD_ID into shell tool commands, even under a restrictive shell env policy`,research:`E-CODEX-D2`}]},{harness:`copilot-cli`,all:[{name:`COPILOT_CLI`,matches:isOne,description:`Copilot CLI sets COPILOT_CLI=1 in its subprocesses`,research:`E-COPILOT-D1`}]},{harness:`copilot-cli`,all:[{name:`COPILOT_AGENT_SESSION_ID`,matches:isSet,description:`Copilot CLI passes COPILOT_AGENT_SESSION_ID to shell commands and MCP servers`,research:`E-COPILOT-D2`}]},{harness:`copilot-cli`,all:[{name:`COPILOT_PLUGIN_ROOT`,matches:isSet,description:`Copilot CLI passes COPILOT_PLUGIN_ROOT to plugin hooks`,research:`E-COPILOT-D6`}]},{harness:`opencode`,all:[{name:`OPENCODE`,matches:isOne,description:`OpenCode sets OPENCODE=1 for shell tool commands and MCP servers; Kilo Code, its fork, sets it too`,research:`E-OC-D1`},{name:`OPENCODE_PID`,matches:isSet,description:`OpenCode sets OPENCODE_PID for shell tool commands and MCP servers; Kilo Code sets KILO_PID instead`,research:`E-OC-D2`}]},{harness:`kilo`,all:[{name:`KILO`,matches:isOne,description:`Kilo Code sets KILO=1 for shell tool commands and MCP servers`,research:`E-KILO-D2`},{name:`KILO_PID`,matches:isSet,description:`Kilo Code sets KILO_PID for shell tool commands and MCP servers`,research:`E-KILO-D1`}]},{harness:`gemini-cli`,all:[{name:`GEMINI_CLI`,matches:isOne,description:`Gemini CLI sets GEMINI_CLI=1 for shell tool commands and MCP stdio servers`,research:`E-GEM-D1`}]},{harness:`qwen-code`,all:[{name:`QWEN_CODE`,matches:isOne,description:`Qwen Code sets QWEN_CODE=1 for shell tool commands, not for MCP servers or hooks`,research:`E-QWEN-D1`}]},{harness:`vscode-copilot`,all:[{name:`COPILOT_AGENT`,matches:isOne,description:`VS Code 1.121+ sets COPILOT_AGENT=1 on terminals its Copilot agent runs commands in`,research:`E-VSC-D1`}]},{harness:`cline`,all:[{name:`CLINE_ACTIVE`,matches:e=>e===`true`,description:`Cline's VS Code extension sets CLINE_ACTIVE=true on the terminals it creates; the Cline CLI does not`,research:`E-CLINE-D1`}]},{harness:`crush`,all:[{name:`CRUSH`,matches:isOne,description:`Crush sets CRUSH=1 for bash tool and hook commands, not for MCP servers`,research:`E-CRUSH-D1`}]},{harness:`openhands`,all:[{name:`AI_AGENT`,matches:e=>e===`openhands`,description:`OpenHands sets AI_AGENT=openhands for terminal tool and hook commands when AI_AGENT is unset; other vendors use the name with other values`,research:`E-OH-D1`}]},{harness:`openhands`,all:[{name:`OPENHANDS_EVENT_TYPE`,matches:isSet,description:`OpenHands sets OPENHANDS_EVENT_TYPE for hook commands`,research:`E-OH-D4`},{name:`OPENHANDS_PROJECT_DIR`,matches:isSet,description:`OpenHands sets OPENHANDS_PROJECT_DIR for hook commands`,research:`E-OH-D4`}]},{harness:`augment`,all:[{name:`AUGMENT_HOOK_EVENT`,matches:isSet,description:`The Auggie CLI sets AUGMENT_HOOK_EVENT for hook commands; its shell commands carry no marker`,research:`E-AUG-D3`},{name:`AUGMENT_PROJECT_DIR`,matches:isSet,description:`The Auggie CLI sets AUGMENT_PROJECT_DIR for hook commands`,research:`E-AUG-D3`}]}];function detectHarness(e={}){let t=e.env??process.env,n=[],r=[];for(let e of _a){let i=e.all.filter(e=>{let n=t[e.name];return n!==void 0&&e.matches(n)});for(let t of i)n.some(n=>n.harness===e.harness&&n.signal===t.name)||n.push({harness:e.harness,signal:t.name,description:t.description,research:t.research});i.length===e.all.length&&!r.includes(e.harness)&&r.push(e.harness)}return{harness:r.length===1?r[0]:`unknown`,evidence:n,candidates:r}}function managedPolicyLocations(e,t={}){let n=t.platform??process.platform,r=t.env??process.env;return va[e](n,r)}const joinFor=e=>e===`win32`?w.join:b.join,dirnameFor=e=>e===`win32`?w.dirname:b.dirname;function opencodeFamily(e,t,n,r){let i={darwin:`/Library/Application Support/${n}`,linux:`/etc/${n}`,win32:w.join(t.ProgramData??`C:\\ProgramData`,n)}[e];return[...when(e===`darwin`,{kind:`macos-managed-preferences`,location:`ai.opencode.managed`,description:`MDM configuration profile; outranks the managed config folder`,research:r.preferences}),...when(i!==void 0,{kind:`directory`,location:i??``,description:`Managed config files; outrank user and project config`,research:r.directory})]}function geminiFamily(e,t,n){let r=e===`darwin`||e===`win32`?n.dirs[e]:n.dirs.linux,i=t[n.settingsVariable]||joinFor(e)(r,`settings.json`),a=t[n.defaultsVariable]||joinFor(e)(dirnameFor(e)(i),`system-defaults.json`);return[{kind:`file`,location:i,description:`System settings; outrank user and workspace settings. ${n.settingsVariable} overrides the path`,research:n.research},{kind:`file`,location:a,description:`System defaults; user and workspace settings override them. ${n.defaultsVariable} overrides the path`,research:n.research}]}const when=(e,...t)=>e?t:[],va={"claude-code":e=>{let t={darwin:`/Library/Application Support/ClaudeCode`,linux:`/etc/claude-code`,win32:`C:\\Program Files\\ClaudeCode`}[e],n=joinFor(e);return[{kind:`server`,location:`claude.ai admin console or a self-hosted Claude apps gateway`,description:`Server-managed settings; the highest-ranked managed source`,research:`E-CC-M6`},...when(e===`darwin`,{kind:`macos-managed-preferences`,location:`com.anthropic.claudecode`,description:`MDM configuration profile with the same top-level keys as managed-settings.json`,research:`E-CC-M6`}),...when(e===`win32`,{kind:`windows-registry`,location:`HKLM\\SOFTWARE\\Policies\\ClaudeCode`,description:`MDM or Group Policy; the Settings value holds managed-settings JSON`,research:`E-CC-M6`}),...when(t!==void 0,{kind:`file`,location:n(t??``,`managed-settings.json`),description:`Managed settings, same shape as settings.json`,research:`E-CC-M1`},{kind:`directory`,location:n(t??``,`managed-settings.d`),description:`Drop-in managed settings files, merged with managed-settings.json`,research:`E-CC-M1`},{kind:`file`,location:n(t??``,`managed-mcp.json`),description:`Managed MCP servers`,research:`E-CC-M1`}),...when(e===`win32`,{kind:`windows-registry`,location:`HKCU\\SOFTWARE\\Policies\\ClaudeCode`,description:`User-writable; used only when no other managed source delivers a policy key`,research:`E-CC-M6`})]},cursor:e=>{let t={darwin:`/Library/Application Support/Cursor/hooks.json`,linux:`/etc/cursor/hooks.json`,win32:`C:\\ProgramData\\Cursor\\hooks.json`}[e];return[...when(t!==void 0,{kind:`file`,location:t??``,description:`Enterprise hooks deployed by MDM; hooks only, not other enterprise settings`,research:`E-CUR-M1`}),{kind:`server`,location:`Cursor dashboard`,description:`Team hooks and other enterprise settings, synced from the dashboard`,research:`E-CUR-M1`}]},codex:(e,t)=>{let n={kind:`server`,location:`ChatGPT workspace admin settings`,description:`Cloud-managed requirements; outrank every local source`,research:`E-CODEX-M8`};return e===`win32`?[n,{kind:`file`,location:w.join(t.ProgramData??`C:\\ProgramData`,`OpenAI`,`Codex`,`requirements.toml`),description:`Admin-enforced requirements users cannot override`,research:`E-CODEX-M4`}]:[n,...when(e===`darwin`,{kind:`macos-managed-preferences`,location:`com.openai.codex`,description:`MDM keys requirements_toml_base64 (enforced) and config_toml_base64 (managed defaults)`,research:`E-CODEX-M6`}),{kind:`file`,location:`/etc/codex/requirements.toml`,description:`Admin-enforced requirements users cannot override`,research:`E-CODEX-M3`},{kind:`file`,location:`/etc/codex/managed_config.toml`,description:`Managed defaults; a user can override them within a session`,research:`E-CODEX-M2`},{kind:`file`,location:`/etc/codex/config.toml`,description:`System-wide config`,research:`E-CODEX-M1`}]},"copilot-cli":(e,t)=>{let n={darwin:`/Library/Application Support/GitHubCopilot/managed-settings.json`,linux:`/etc/github-copilot/managed-settings.json`,win32:w.join(t.ProgramFiles??`C:\\Program Files`,`GitHubCopilot`,`managed-settings.json`)}[e];return[...when(e===`darwin`,{kind:`macos-managed-preferences`,location:`com.github.copilot`,description:`MDM-managed settings; the highest-ranked source`,research:`E-COPILOT-M2`}),...when(e===`win32`,{kind:`windows-registry`,location:`HKLM\\SOFTWARE\\Policies\\GitHubCopilot`,description:`MDM-managed settings as REG_SZ values; the highest-ranked source`,research:`E-COPILOT-M2`}),{kind:`server`,location:`copilot/managed-settings.json in the enterprise's .github-private repository`,description:`Server-managed settings, fetched for the signed-in account`,research:`E-COPILOT-M3`},...when(n!==void 0,{kind:`file`,location:n??``,description:`File-based managed settings; on macOS and Linux it must be a root-owned regular file`,research:`E-COPILOT-M1`})]},opencode:(e,t)=>[...opencodeFamily(e,t,`opencode`,{directory:`E-OC-M1`,preferences:`E-OC-M1`}),{kind:`server`,location:`Remote config at the organization domain /.well-known/opencode`,description:`Organization defaults; the lowest-ranked config source, so user config overrides them`,research:`E-OC-M2`}],kilo:(e,t)=>opencodeFamily(e,t,`kilo`,{directory:`E-KILO-M1`,preferences:`E-KILO-M2`}),"gemini-cli":(e,t)=>geminiFamily(e,t,{settingsVariable:`GEMINI_CLI_SYSTEM_SETTINGS_PATH`,defaultsVariable:`GEMINI_CLI_SYSTEM_DEFAULTS_PATH`,dirs:{darwin:`/Library/Application Support/GeminiCli`,linux:`/etc/gemini-cli`,win32:`C:\\ProgramData\\gemini-cli`},research:`E-GEM-M1`}),"qwen-code":(e,t)=>geminiFamily(e,t,{settingsVariable:`QWEN_CODE_SYSTEM_SETTINGS_PATH`,defaultsVariable:`QWEN_CODE_SYSTEM_DEFAULTS_PATH`,dirs:{darwin:`/Library/Application Support/QwenCode`,linux:`/etc/qwen-code`,win32:`C:\\ProgramData\\qwen-code`},research:`E-QWEN-M1`}),"vscode-copilot":e=>[...when(e===`win32`,{kind:`windows-registry`,location:`Software\\Policies\\Microsoft\\VSCode`,description:`VS Code policies set by Group Policy (ADMX templates ship with VS Code)`,research:`E-VSC-M1`}),...when(e===`linux`,{kind:`file`,location:`/etc/vscode/policy.json`,description:`VS Code policies as JSON, read by VS Code 1.106 and later`,research:`E-VSC-M3`})],cline:()=>[{kind:`server`,location:`Cline Enterprise admin console`,description:`Provider, model, and tool policy pushed to clients; no local policy file is documented`,research:`E-CLINE-M1`}],crush:e=>when(e!==`win32`,{kind:`file`,location:`/etc/crush/crush.json`,description:`System config; the lowest-ranked source, so user and project config override it`,research:`E-CRUSH-M1`}),openhands:()=>[{kind:`server`,location:`OpenHands Cloud or Enterprise deployment`,description:`Organization controls held server-side; no local policy file is known`,research:`E-OH-D8`}],augment:(e,t)=>[{kind:`file`,location:e===`win32`?w.join(t.ProgramData||`C:\\ProgramData`,`augment`,`settings.json`):`/etc/augment/settings.json`,description:`System settings, read from the Auggie CLI bundle; its rank against user settings is not documented`,research:`E-AUG-M1`}]};function resolveHarnessEnvironment(e={}){return{env:e.env??process.env,homedir:e.homedir??E(),cwd:e.cwd??process.cwd(),platform:e.platform??process.platform}}async function readText(e){try{return await ne(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function stripJsonComments$1(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===`"`){let r=n+1;for(;r<e.length&&e[r]!==`"`;)r+=e[r]===`\\`?2:1;t+=e.slice(n,r+1),n=r+1}else if(r===`/`&&e[n+1]===`/`)for(;n<e.length&&e[n]!==`
|
|
93
|
+
`;)n++;else if(r===`/`&&e[n+1]===`*`){let t=e.indexOf(`*/`,n+2);n=t===-1?e.length:t+2}else t+=r,n++}return t.replace(/,(\s*[}\]])/g,`$1`)}__name(stripJsonComments$1,`stripJsonComments`);function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pluginStorage(e,t={}){return ya[e](resolveHarnessEnvironment(t))}const xdgConfig=({env:e,homedir:t})=>e.XDG_CONFIG_HOME||v(t,`.config`);function vscodeAgentPlugins({env:e,homedir:t,platform:n}){if(n===`win32`){let n=w.join(e.APPDATA||w.join(t,`AppData`,`Roaming`),`Code`);return{configDir:n,path:w.join(n,`agentPlugins`)}}let r=n===`darwin`?v(t,`Library`,`Application Support`,`Code`):v(t,`.config`,`Code`);return{configDir:r,path:v(r,`agentPlugins`)}}const ya={"claude-code":({env:e,homedir:t})=>{let n=e.CLAUDE_CONFIG_DIR||v(t,`.claude`),r=v(n,`plugins`);return{harness:`claude-code`,configDir:n,locations:[{kind:`plugin-cache`,path:v(r,`cache`),description:`Installed plugins as <marketplace>/<plugin>/<version>/`,research:`E-CC-P1`},{kind:`marketplaces`,path:v(r,`marketplaces`),description:`Marketplace checkouts`,research:`E-CC-P1`},{kind:`install-record`,path:v(r,`installed_plugins.json`),description:`Installs keyed by plugin@marketplace, each with scope, installPath, and version`,research:`E-CC-P2`},{kind:`enabled-record`,path:v(n,`settings.json`),description:`User settings; enabledPlugins maps plugin@marketplace to a boolean`,research:`E-CC-P3`}]}},cursor:({homedir:e})=>{let t=v(e,`.cursor`);return{harness:`cursor`,configDir:t,locations:[{kind:`local-plugins`,path:v(t,`plugins`,`local`),description:`Plugins under development, one folder each`,research:`E-CUR-P2`},{kind:`marketplaces`,path:v(t,`plugins`,`marketplaces`),description:`Marketplace checkouts`,research:`E-CUR-P3`}]}},codex:({env:e,homedir:t})=>{let n=e.CODEX_HOME||v(t,`.codex`);return{harness:`codex`,configDir:n,locations:[{kind:`plugin-cache`,path:v(n,`plugins`,`cache`),description:`Installed plugins as <marketplace>/<plugin>/<version>/`,research:`E-CODEX-P3`},{kind:`enabled-record`,path:v(n,`config.toml`),description:`User config; [plugins."<plugin>@<marketplace>"] tables carry enabled = <bool>`,research:`E-CODEX-P2`}]}},"copilot-cli":({env:e,homedir:t})=>{let n=e.COPILOT_HOME||v(t,`.copilot`);return{harness:`copilot-cli`,configDir:n,locations:[{kind:`installed-plugins`,path:v(n,`installed-plugins`),description:`Installed plugins as <marketplace>/<plugin>/, or _direct/<source-id>/ for direct installs`,research:`E-COPILOT-P9`},{kind:`install-record`,path:v(n,`config.json`),description:`Application state, including installedPlugins`,research:`E-COPILOT-P9`},{kind:`enabled-record`,path:v(n,`settings.json`),description:`User settings (JSON with comments); enabledPlugins maps plugin specs to a boolean`,research:`E-COPILOT-P4`}]}},opencode:e=>{let t=v(xdgConfig(e),`opencode`);return{harness:`opencode`,configDir:t,locations:[{kind:`local-plugins`,path:v(t,`plugins`),description:`JS/TS plugin modules loaded at startup; npm plugins are named in the plugin config array`,research:`E-OC-P2`}]}},kilo:e=>{let t=v(xdgConfig(e),`kilo`);return{harness:`kilo`,configDir:t,locations:[{kind:`local-plugins`,path:v(t,`plugin`),description:`JS/TS plugin modules loaded at startup; npm plugins are named in the plugin config array`,research:`E-KILO-P2`}]}},"gemini-cli":({env:e,homedir:t})=>{let n=v(e.GEMINI_CLI_HOME||t,`.gemini`),r=v(n,`extensions`);return{harness:`gemini-cli`,configDir:n,locations:[{kind:`installed-plugins`,path:r,description:`Installed extensions, one folder each with a gemini-extension.json manifest`,research:`E-GEM-P1`},{kind:`enabled-record`,path:v(r,`extension-enablement.json`),description:`Per-extension path-glob overrides that enable or disable it by folder, not a boolean`,research:`E-GEM-P3`}]}},"qwen-code":({env:e,homedir:t})=>{let n=e.QWEN_HOME||v(t,`.qwen`),r=v(n,`extensions`);return{harness:`qwen-code`,configDir:n,locations:[{kind:`installed-plugins`,path:r,description:`Installed extensions, one folder each with a qwen-extension.json manifest`,research:`E-QWEN-P1`},{kind:`enabled-record`,path:v(r,`extension-enablement.json`),description:`Extension enable/disable state, inherited from Gemini CLI's format`,research:`E-QWEN-P2`}]}},"vscode-copilot":e=>{let{configDir:t,path:n}=vscodeAgentPlugins(e);return{harness:`vscode-copilot`,configDir:t,locations:[{kind:`installed-plugins`,path:n,description:`Installed agent plugins as <host>/<org>/<repo>/`,research:`E-VSC-P3`}]}},cline:({homedir:e})=>{let t=v(e,`.cline`);return{harness:`cline`,configDir:t,locations:[{kind:`installed-plugins`,path:v(t,`plugins`,`_installed`),description:`Installed plugins, grouped by source: npm, git, remote, or local`,research:`E-CLINE-P3`}]}},crush:({env:e,homedir:t})=>({harness:`crush`,configDir:e.CRUSH_GLOBAL_CONFIG||v(e.XDG_CONFIG_HOME||v(t,`.config`),`crush`),locations:[]}),openhands:({env:e,homedir:t})=>{let n=e.OH_PERSISTENCE_DIR||e.OPENHANDS_PERSISTENCE_DIR||v(t,`.openhands`),r=v(n,`plugins`,`installed`);return{harness:`openhands`,configDir:n,locations:[{kind:`installed-plugins`,path:r,description:`Installed plugins, one folder each`,research:`E-OH-P3`},{kind:`enabled-record`,path:v(r,`.installed.json`),description:`Install metadata keyed by plugin name, each with enabled: <bool>`,research:`E-OH-P4`}]}},augment:({homedir:e})=>{let t=v(e,`.augment`);return{harness:`augment`,configDir:t,locations:[{kind:`marketplaces`,path:v(t,`plugins`,`marketplaces`),description:`Marketplace checkouts`,research:`E-AUG-P2`},{kind:`enabled-record`,path:v(t,`settings.json`),description:`User settings; enabledPlugins maps plugin@marketplace to a boolean`,research:`E-AUG-P4`}]}}};async function enabledPlugins(e,t={}){let n=Ca[e](resolveHarnessEnvironment(t),t.managedSettingsPath),r=new Map,i=[];for(let e of n.sources){let t;try{let n=await readText(e.path);if(n===void 0){i.push({scope:e.scope,path:e.path,found:!1});continue}t=e.parse(n)}catch(t){i.push({scope:e.scope,path:e.path,found:!0,error:String(t)});continue}i.push({scope:e.scope,path:e.path,found:!0});for(let[n,i]of Object.entries(t))r.has(n)||r.set(n,{id:n,enabled:i,scope:e.scope,source:e.path})}return{harness:e,supported:n.supported,plugins:[...r.values()],sources:i,unread:n.unread,research:n.research}}function jsonEnabledPlugins(e){let t=JSON.parse(e),n=isRecord(t)?t.enabledPlugins:void 0;return isRecord(n)?Object.fromEntries(Object.entries(n).filter(e=>typeof e[1]==`boolean`)):{}}const ba=/^\[\s*plugins\s*\.\s*(?:"([^"]*)"|'([^']*)'|([A-Za-z0-9_-]+))\s*\]\s*(?:#.*)?$/,xa=/^enabled\s*=\s*(true|false)\s*(?:#.*)?$/;function tomlEnabledPlugins(e){let t={},n;for(let r of e.split(/\r?\n/)){let e=r.trim();if(e.startsWith(`[`)){let t=ba.exec(e);n=t?t[1]??t[2]??t[3]:void 0;continue}let i=n===void 0?null:xa.exec(e);n!==void 0&&i&&(t[n]=i[1]===`true`)}return t}const Sa={server:`server-managed settings`,"macos-managed-preferences":`MDM managed preferences`,"windows-registry":`Windows registry policy`,directory:`drop-in managed settings`,file:`managed file`};function unreadPolicy(e,t,n=[]){return e.filter(e=>e.location!==t&&!n.some(t=>e.location.endsWith(t))).map(e=>`${Sa[e.kind]} (${e.location})`)}function managedFile(e,t){return e.find(e=>e.kind===`file`&&e.location.endsWith(t))?.location}function jsoncEnabledPlugins(e){return jsonEnabledPlugins(stripJsonComments$1(e))}const unsupported$1=(...e)=>({supported:!1,sources:[],unread:[],research:e}),Ca={"claude-code":(e,t)=>{let{configDir:n}=pluginStorage(`claude-code`,e),r=managedPolicyLocations(`claude-code`,e),i=managedFile(r,`managed-settings.json`),a=t??i,o=v(e.cwd,`.claude`);return{supported:!0,sources:[...a===void 0?[]:[{scope:`managed`,path:a,parse:jsonEnabledPlugins}],{scope:`local`,path:v(o,`settings.local.json`),parse:jsonEnabledPlugins},{scope:`project`,path:v(o,`settings.json`),parse:jsonEnabledPlugins},{scope:`user`,path:v(n,`settings.json`),parse:jsonEnabledPlugins}],unread:unreadPolicy(r,i,[`managed-mcp.json`]),research:[`E-CC-P3`,`E-CC-P7`,`E-CC-M1`,`E-CC-M6`]}},cursor:()=>unsupported$1(),opencode:()=>unsupported$1(`E-OC-P3`),kilo:()=>unsupported$1(`E-KILO-P3`),"gemini-cli":()=>unsupported$1(`E-GEM-P3`),"qwen-code":()=>unsupported$1(`E-QWEN-P2`),"vscode-copilot":()=>unsupported$1(`E-VSC-P4`),cline:()=>unsupported$1(`E-CLINE-P4`),crush:()=>unsupported$1(`E-CRUSH-P2`),openhands:()=>unsupported$1(`E-OH-P4`),augment:()=>unsupported$1(`E-AUG-P4`),codex:e=>{let t=pluginStorage(`codex`,e);return{supported:!0,sources:[{scope:`user`,path:v(t.configDir,`config.toml`),parse:tomlEnabledPlugins}],unread:unreadPolicy(managedPolicyLocations(`codex`,e),void 0),research:[`E-CODEX-P2`,`E-CODEX-M7`]}},"copilot-cli":(e,t)=>{let n=pluginStorage(`copilot-cli`,e),r=managedPolicyLocations(`copilot-cli`,e),i=managedFile(r,`managed-settings.json`),a=t??i,o=v(e.cwd,`.github`,`copilot`),s=v(e.cwd,`.claude`);return{supported:!0,sources:[...a===void 0?[]:[{scope:`managed`,path:a,parse:jsoncEnabledPlugins}],{scope:`local`,path:v(o,`settings.local.json`),parse:jsoncEnabledPlugins},{scope:`project`,path:v(o,`settings.json`),parse:jsoncEnabledPlugins},{scope:`user`,path:v(n.configDir,`settings.json`),parse:jsoncEnabledPlugins}],unread:[...unreadPolicy(r,i),`Claude Code project settings (${v(s,`settings.json`)})`,`Claude Code local settings (${v(s,`settings.local.json`)})`],research:[`E-COPILOT-P4`,`E-COPILOT-M1`,`E-COPILOT-M2`,`E-COPILOT-M4`]}}};async function installedPlugins(e,t={}){let n=Ma[e](resolveHarnessEnvironment(t)),r={harness:e,supported:n.supported,unread:n.unread,research:n.research};if(n.source===void 0)return{...r,plugins:[],unresolved:[],sources:[]};let i=n.source;try{let e=await n.read(i);return e===void 0?{...r,plugins:[],unresolved:[],sources:[{path:i,found:!1}]}:{...r,plugins:e.plugins,unresolved:e.unresolved??[],sources:[{path:i,found:!0}]}}catch(e){return{...r,plugins:[],unresolved:[],sources:[{path:i,found:!0,error:String(e)}]}}}const wa=[`managed`,`local`,`project`,`user`],optionalString=e=>typeof e==`string`&&e!==``?e:void 0;async function readClaudeInstalls(e){let t=await readText(e);if(t===void 0)return;let n=JSON.parse(t),r=isRecord(n)?n.plugins:void 0;if(!isRecord(r))return{plugins:[]};let i=[];for(let[e,t]of Object.entries(r))if(Array.isArray(t))for(let n of t){let t=isRecord(n)?optionalString(n.installPath):void 0;if(!isRecord(n)||t===void 0)continue;let r=optionalString(n.version),a=typeof n.scope==`string`&&wa.includes(n.scope)?n.scope:void 0,o=optionalString(n.projectPath);i.push({id:e,path:t,...r===void 0?{}:{version:r},...a===void 0?{}:{scope:a},...o===void 0?{}:{projectPath:o},research:[`E-CC-P2`]})}return{plugins:i}}async function readCopilotInstalls(e){let t=await readText(e);if(t===void 0)return;let n=JSON.parse(stripJsonComments$1(t)),r=isRecord(n)?n.installedPlugins:void 0;if(!Array.isArray(r))return{plugins:[]};let i=[];for(let e of r){if(!isRecord(e))continue;let t=optionalString(e.name),n=optionalString(e.cache_path);if(t===void 0||n===void 0)continue;let r=optionalString(e.marketplace),a=optionalString(e.version);i.push({id:r===void 0?t:`${t}@${r}`,path:n,...a===void 0?{}:{version:a},research:r===void 0?[`E-COPILOT-P10`,`E-COPILOT-P11`]:[`E-COPILOT-P10`]})}return{plugins:i}}const Ta=`local`,Ea=/^[A-Za-z0-9_-]+$/,Da=/^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/,Oa=/^[A-Za-z0-9._+-]+$/;async function readCodexInstalls(e){let t=await directories(e);if(t===void 0)return;let n=[],r=[];for(let i of t.filter(e=>Ea.test(e)))for(let t of await directories(v(e,i))??[]){if(!Da.test(t))continue;let a=`${t}@${i}`,o=(await directories(v(e,i,t))??[]).filter(e=>Oa.test(e)&&e!==`.`&&e!==`..`);if(o.length===0)continue;let s=activeCodexVersion(o);if(s===void 0){r.push(a);continue}n.push({id:a,path:v(e,i,t,s),version:s,research:[`E-CODEX-P3`,`E-CODEX-P8`]})}return{plugins:n,unresolved:r}}function activeCodexVersion(e){if(e.includes(Ta))return Ta;let t=e.filter(e=>parseSemver(e)!==void 0).length;if(!(e.length>2&&t!==0&&t!==e.length))return[...e].sort(compareCodexVersions).at(-1)}async function directories(e){try{return(await re(e,{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name)}catch(e){if(e.code===`ENOENT`)return;throw e}}const ka=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;function parseSemver(e){let t=ka.exec(e);if(t)return{core:[t[1],t[2],t[3]],pre:t[4]===void 0?[]:t[4].split(`.`),build:t[5]===void 0?[]:t[5].split(`.`)}}function compareCodexVersions(e,t){let n=parseSemver(e),r=parseSemver(t);if(n===void 0||r===void 0)return compareStrings(e,t);for(let e=0;e<3;e++){let t=compareNumeric(n.core[e],r.core[e]);if(t!==0)return t}let i=n.pre.length===0||r.pre.length===0?r.pre.length-n.pre.length:compareIdentifiers(n.pre,r.pre);return i===0?compareIdentifiers(n.build,r.build):Math.sign(i)}const Aa=/^\d+$/;function compareIdentifiers(e,t){for(let n=0;n<Math.min(e.length,t.length);n++){let r=e[n],i=t[n],a=Aa.test(r),o=Aa.test(i),s=a&&o?compareNumeric(r,i):a===o?compareStrings(r,i):a?-1:1;if(s!==0)return s}return e.length-t.length}function compareNumeric(e,t){let n=e.replace(/^0+(?=\d)/,``),r=t.replace(/^0+(?=\d)/,``);return n.length-r.length||compareStrings(n,r)||e.length-t.length}const compareStrings=(e,t)=>e<t?-1:+(e>t),ja={supported:!1,read:async()=>void 0,unread:[],research:[]},Ma={"claude-code":e=>({supported:!0,source:v(pluginStorage(`claude-code`,e).configDir,`plugins`,`installed_plugins.json`),read:readClaudeInstalls,unread:[],research:[`E-CC-P2`]}),codex:e=>({supported:!0,source:v(pluginStorage(`codex`,e).configDir,`plugins`,`cache`),read:readCodexInstalls,unread:[],research:[`E-CODEX-P3`,`E-CODEX-P8`]}),"copilot-cli":e=>{let{configDir:t}=pluginStorage(`copilot-cli`,e);return{supported:!0,source:v(t,`config.json`),read:readCopilotInstalls,unread:[`plugins from marketplaces added by local path (extraKnownMarketplaces in ${v(t,`settings.json`)})`],research:[`E-COPILOT-P10`,`E-COPILOT-P11`,`E-COPILOT-P12`,`E-COPILOT-P13`]}},cursor:()=>ja,opencode:()=>ja,kilo:()=>ja,"gemini-cli":()=>ja,"qwen-code":()=>ja,"vscode-copilot":()=>ja,cline:()=>ja,crush:()=>ja,openhands:()=>ja,augment:()=>ja};function skillsDirectories(e){switch(e){case`claude-code`:return{project:[`.claude/skills`],user:[`.claude/skills`],research:[`E-CC-L1`]};case`cursor`:return{project:[`.agents/skills`,`.cursor/skills`,`.claude/skills`,`.codex/skills`],user:[`.agents/skills`,`.cursor/skills`,`.claude/skills`,`.codex/skills`],research:[`E-CUR-L1`]};case`codex`:return{project:[`.agents/skills`],user:[`.agents/skills`],research:[`E-CODEX-L1`]};case`copilot-cli`:return{project:[`.github/skills`,`.agents/skills`,`.claude/skills`],user:[`.copilot/skills`,`.agents/skills`],research:[`E-COPILOT-S5`]};case`vscode-copilot`:return{project:[`.github/skills`,`.claude/skills`,`.agents/skills`],user:[`.copilot/skills`,`.claude/skills`,`.agents/skills`],research:[`E-VSC-P1`]};case`opencode`:return{project:[`.opencode/skills`,`.claude/skills`,`.agents/skills`],user:[`.config/opencode/skills`,`.claude/skills`,`.agents/skills`],research:[`E-OC-S1`]};case`gemini-cli`:return{project:[`.agents/skills`,`.gemini/skills`],user:[`.agents/skills`,`.gemini/skills`],research:[`E-GEM-L1`]};case`cline`:return{project:[`.cline/skills`,`.clinerules/skills`,`.claude/skills`],user:[`.cline/skills`],research:[`E-CLINE-S1`]};case`augment`:return{project:[`.augment/skills`],user:[`.augment/skills`],research:[`E-AUG-S1`]};case`kilo`:case`qwen-code`:case`crush`:case`openhands`:return}}function skillsProjection(e,t,n=skillsDirectories(e)?.[t]){let r=n??[],[i]=r;if(i===void 0)throw Error(`@cyberuni/agent-harness records no ${t} skills directories for ${e}.`);return r.includes(`.agents/skills`)?{}:{skillsDirectory:i}}const Na=[{name:`claude-code`,project:{detect:`.claude`,...skillsProjection(`claude-code`,`project`),shadowedBy:[`CLAUDE.md`,`.claude/CLAUDE.md`,`CLAUDE.local.md`],mcpConfig:{path:`.mcp.json`,key:`mcpServers`,format:`json`,dialect:`claude-code`},nonstandard:[{path:`.claude/commands`,shape:`directory`,kind:`command`},{path:`.claude/rules`,shape:`directory`,kind:`rule`},{path:`.claude/agents`,shape:`directory`,kind:`subagent`}]},user:{detect:`.claude`,...skillsProjection(`claude-code`,`user`)}},{name:`cursor`,project:{detect:`.cursor`,...skillsProjection(`cursor`,`project`),mcpConfig:{path:`.cursor/mcp.json`,key:`mcpServers`,format:`json`,dialect:`cursor`},nonstandard:[{path:`.cursorrules`,shape:`file`,kind:`instructions`},{path:`.cursor/rules`,shape:`directory`,kind:`rule`},{path:`.cursor/commands`,shape:`directory`,kind:`command`},{path:`.cursor/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.cursor`,...skillsProjection(`cursor`,`user`)}},{name:`codex`,project:{detect:`.codex`,...skillsProjection(`codex`,`project`),mcpConfig:{path:`.codex/config.toml`,key:`mcp_servers`,format:`toml`,dialect:`codex`,shared:!0},nonstandard:[{path:`.codex/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.codex`,...skillsProjection(`codex`,`user`)}},{name:`copilot-cli`,project:{detect:`.github/skills`,...skillsProjection(`copilot-cli`,`project`),nonstandard:[{path:`.github/copilot-instructions.md`,shape:`file`,kind:`instructions`},{path:`.github/instructions`,shape:`directory`,kind:`instructions`},{path:`.github/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.copilot`,...skillsProjection(`copilot-cli`,`user`)}},{name:`gemini-cli`,project:{detect:`.gemini`,...skillsProjection(`gemini-cli`,`project`),instructionBridge:{kind:`settings-entry`,path:`.gemini/settings.json`,key:`context.fileName`},mcpConfig:{path:`.gemini/settings.json`,key:`mcpServers`,format:`json`,dialect:`gemini-cli`,shared:!0},nonstandard:[{path:`GEMINI.md`,shape:`file`,kind:`instructions`},{path:`.gemini/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.gemini`,...skillsProjection(`gemini-cli`,`user`)}},{name:`devin-desktop`,project:{detect:`.devin`}},{name:`windsurf`,project:{detect:`.windsurf`,skillsDirectory:`.windsurf/skills`,nonstandard:[{path:`.windsurfrules`,shape:`file`,kind:`instructions`},{path:`.windsurf/rules`,shape:`directory`,kind:`rule`}]},deprecated:`devin-desktop`}],Pa=new Set(Na.map(e=>e.name));function isHarnessName(e){return Pa.has(e)}function parseHarnesses(e){let t=(e??``).split(`,`).map(e=>e.trim()).filter(Boolean),n=t.filter(e=>!isHarnessName(e));if(n.length)throw Error(`Unsupported harness: ${n.join(`, `)}. Supported: ${Na.map(e=>e.name).join(`, `)}.`);return t.filter(isHarnessName)}const Fa=[`claude-code`,`cursor`];function directoryExists(e){try{return i(e).isDirectory()}catch{return!1}}function selectHarnesses(e,t){let n=new Set([...Fa,...t]);return Na.filter(t=>n.has(t.name)||directoryExists(v(e,t.project.detect)))}function locatorText({file:e,server:t,field:n,position:r}){return r?`${e}#L${r.line}:${r.column}`:t===void 0?e:`${e}#servers.${t}${n===void 0?``:`.${n}`}`}function repairsOf(e){return Object.entries(e).map(([e,t])=>({problem:e,...t}))}const Ia=`buddy-agent-harness`,La=`/buddy-agent-harness:repair`,X=`/buddy-agent-harness:init-buddy-agent-harness`,Ra=`.agents/buddy-agent-harness/mcp.toml`,za={"no-canonical":{detail:`the canonical skill directory does not exist, so no bridge can resolve`,repair:(e,t)=>({command:`${t} init`,instruction:`run \`${t} init\` to create .agents/skills and the bridges into it`}),skillRepair:()=>`run \`${X}\`, which creates \`.agents/skills\` and the bridges`},missing:{detail:`no bridge at this path — the harness sees zero project skills`,repair:({file:e},t)=>({command:`${t} init`,instruction:`run \`${t} init\` to create the bridge at ${e}`}),skillRepair:()=>`run \`${X}\``},degraded:{detail:`expected a directory but found a regular file — checkout without core.symlinks`,repair:({file:e},t)=>({command:`${t} init --copy --force ${e}`,instruction:`run \`${t} init --copy --force ${e}\` to rebuild ${e} as a real directory`}),skillRepair:({file:e})=>`run \`${X} --copy --force ${e}\``},stale:{detail:`symlink does not resolve to .agents/skills`,repair:({file:e},t)=>({command:`${t} init --force ${e}`,instruction:`run \`${t} init --force ${e}\` to repoint ${e} at .agents/skills`}),skillRepair:({file:e})=>`run \`${X} --force ${e}\``},"diverged-bridge":{detail:`only the bridge changed since the two last agreed — an agent wrote through the copy`,repair:({file:e},t)=>({command:``,instruction:`replace .agents/skills with ${e} to keep the newer edit, then run \`${t} init --force ${e}\``}),skillRepair:({file:e})=>`replace .agents/skills with ${e} to keep the newer edit, then run \`${X} --force ${e}\``},"diverged-canonical":{detail:`only .agents/skills changed since the two last agreed — the copy is stale`,repair:({file:e},t)=>({command:`${t} init --copy --force ${e}`,instruction:`run \`${t} init --copy --force ${e}\` to rebuild ${e} from the newer .agents/skills`}),skillRepair:({file:e})=>`run \`${X} --copy --force ${e}\``},"diverged-both":{detail:`both sides changed since they last agreed — rebuilding would discard one of them`,repair:({file:e})=>({command:``,instruction:`reconcile .agents/skills with ${e} by hand — rebuilding would discard one of them; \`git diff --no-index .agents/skills ${e}\` shows what differs`}),skillRepair:({file:e})=>`run \`git diff --no-index .agents/skills ${e}\` and reconcile by hand`},"diverged-unknown":{detail:`contents differ and no commit where they agreed was found — which side moved is unknown`,repair:({file:e})=>({command:``,instruction:`reconcile .agents/skills with ${e} by hand — which side moved is unknown; \`git diff --no-index .agents/skills ${e}\` shows what differs`}),skillRepair:({file:e})=>`run \`git diff --no-index .agents/skills ${e}\` and reconcile by hand`},"unpinned-copy":{detail:`tracked copy without the skip-worktree bit — the tree is dirty with content that must not be committed`,repair:({file:e})=>({command:`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree`,instruction:`run \`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree\` to restore the skip-worktree bit`}),skillRepair:({file:e})=>`run \`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree\``}};repairsOf(za);const Ba={"no-instructions":{detail:`no AGENTS.md at the repository root, so the instructions this repository has reach one harness at most`,repair:()=>({command:``,instruction:`hand this to \`${X}\`, which consolidates what the repository has into AGENTS.md, or derives it`}),skillRepair:()=>`run \`${X}\`, which consolidates or derives AGENTS.md`},"instructions-missing":{detail:`no instruction bridge at this path — the harness reads none of AGENTS.md`,repair:({file:e})=>({command:``,instruction:`hand ${e} to \`${X}\`, which writes the bridge into it`}),skillRepair:()=>`run \`${X}\``},"instructions-unbridged":{detail:`the file is present but names AGENTS.md nowhere — the harness reads none of it`,repair:({file:e})=>({command:``,instruction:`hand ${e} to \`${X}\`, which adds the bridge without discarding what the file already says`}),skillRepair:()=>`run \`${X}\`, which adds the bridge without discarding what the file already says`},"instructions-shadowing":{detail:`this file suppresses the AGENTS.md beside it — the harness reads this instead, and none of AGENTS.md`,repair:({file:e})=>({command:``,instruction:`hand ${e} to \`${X}\`, which consolidates what it says into AGENTS.md, or adds an @AGENTS.md import above it where the file has to stay`}),skillRepair:()=>`run \`${X}\`, which consolidates the file into AGENTS.md or imports AGENTS.md from it`},"instructions-superseded":{detail:`a bridge from before the harness read AGENTS.md itself — it still works, and nothing needs it`,repair:({file:e})=>({command:``,instruction:`remove ${e}, or keep it for sessions that cannot read AGENTS.md directly — \`${X}\` offers the choice`}),skillRepair:()=>`run \`${X}\`, which offers to remove it`},"instructions-unreadable":{detail:`the settings file does not parse, so the harness reads none of it`,repair:({file:e})=>({command:``,instruction:`fix the JSON in ${e} by hand, then hand it to \`${X}\``}),skillRepair:()=>`fix the JSON by hand, then run \`${X}\``}};repairsOf(Ba);const Va={"deprecated-harness":{detail:`a projection under a harness name that has been superseded — the replacement reads .agents/skills natively and needs no projection at all`,repair:({file:e})=>({command:``,instruction:`remove ${e} and enable the harness that replaced it — \`${La}\` offers the correction`}),skillRepair:()=>`run \`${La}\``},"ignored-bridge":{detail:`a .gitignore rule matches this bridge — an untracked bridge swallows a real edit silently`,repair:({file:e})=>({command:``,instruction:`narrow or remove the .gitignore rule matching ${e} — \`${La}\` offers the correction`}),skillRepair:()=>`run \`${La}\``},"unread-local-override":{detail:`no harness reads this filename, so everything in it is invisible to every agent`,repair:({file:e})=>({command:``,instruction:`move ${e} to CLAUDE.local.md, or consolidate it into AGENTS.md — \`${La}\` offers the correction`}),skillRepair:()=>`run \`${La}\``},"unloadable-skill":{detail:`frontmatter that does not parse, or no description — either one makes a harness skip the skill outright`,repair:({file:e})=>({command:``,instruction:`quote the description in ${e}, or add one — \`${La}\` offers the correction`}),skillRepair:()=>`run \`${La}\``}};repairsOf(Va);const Ha={"mcp-golden-unreadable":{detail:`the golden MCP set does not parse — the locator gives the line and column, and nothing else can be said about it`,repair:e=>({command:``,instruction:`fix the TOML at ${locatorText(e)}`}),skillRepair:e=>`fix the TOML at ${locatorText(e)} by hand — the reported line and column are all that can be quoted, because the parser's own message repeats the offending line and that line is the one holding the credential`},"mcp-target-unreadable":{detail:`this harness config does not parse, so the harness starts none of its servers and nothing in it can be compared`,repair:e=>({command:``,instruction:`fix the syntax of ${locatorText(e)}`}),skillRepair:e=>`fix the syntax of ${locatorText(e)} by hand`},"mcp-unprojected":{detail:`the golden set declares this server and the harness config does not carry it`,repair:({file:e,server:t})=>({command:``,instruction:`add the server ${t} to ${e}, or drop it from the golden set — \`${La}\` offers the correction`}),skillRepair:e=>`hand ${locatorText(e)} to \`${La}\`, which projects it from its golden entry with \`mcp project\` — or drop it from the golden set`},"mcp-undeclared":{detail:`the harness config carries this server and the golden set does not declare it`,repair:({file:e,server:t})=>({command:``,instruction:`add the server ${t} to ${Ra}, or drop it from ${e} — \`${La}\` offers the import`}),skillRepair:e=>`hand ${locatorText(e)} to \`${La}\`, which imports it field by field with \`mcp reconcile\`, refusing any literal credential — or drop it from ${e.file}`},"mcp-diverged-target":{detail:`only the harness config changed since the two last agreed — the edit was made through the copy`,repair:e=>({command:``,instruction:`reconcile the value at ${locatorText(e)} back into ${Ra} — \`${La}\` offers the import`}),skillRepair:e=>`hand ${locatorText(e)} to \`${La}\`, which imports the field into ${Ra} with \`mcp reconcile\` once approved`},"mcp-diverged-golden":{detail:`only the golden set changed since the two last agreed — the harness copy is stale`,repair:e=>({command:``,instruction:`update ${locatorText(e)} from the golden entry — \`${La}\` offers the correction`}),skillRepair:e=>`hand ${locatorText(e)} to \`${La}\`, which updates it from the golden entry with \`mcp project\``},"mcp-diverged-both":{detail:`both sides changed since they last agreed — merging either way would discard the other`,repair:e=>({command:``,instruction:`reconcile ${locatorText(e)} against ${Ra} by hand`}),skillRepair:e=>`reconcile ${locatorText(e)} against ${Ra} by hand — never merge a three-way conflict automatically`},"mcp-diverged-unknown":{detail:`the two disagree and no baseline says which side moved — neither history nor a last-projected record covers this server`,repair:e=>({command:``,instruction:`compare ${locatorText(e)} against ${Ra} by hand`}),skillRepair:e=>`compare ${locatorText(e)} against ${Ra} by hand`},"mcp-literal-secret":{detail:`a credential-bearing field holds a literal rather than a reference to an environment variable`,repair:e=>({command:``,instruction:`move the value at ${locatorText(e)} into an environment variable and reference it`}),skillRepair:e=>`move the value at ${locatorText(e)} into an environment variable and reference it — read the value from the file, never from this report, and never repeat it back`},"mcp-committed-secret":{detail:`a credential-bearing field holds a literal in a git-tracked file — the credential is committed, and moving it does not un-commit it`,repair:e=>({command:``,instruction:`rotate the credential behind ${locatorText(e)}, then reference it from an environment variable`}),skillRepair:e=>`rotate the credential behind ${locatorText(e)} at its issuer, then reference it from an environment variable — it is in the repository's history, so moving it is not enough`}};repairsOf(Ha);const Ua={"nonstandard-instructions":{detail:`instruction content only one harness reads — AGENTS.md carries the same prose to all of them`,repair:({file:e})=>({command:``,instruction:`consolidate ${e} into AGENTS.md and leave a generated bridge in its place — \`${X}\` offers the consolidation`}),skillRepair:({file:e})=>`hand ${e} to \`${X}\`, which consolidates it into AGENTS.md`},"nonstandard-rule":{detail:`a path-scoped rule only one harness reads — a skill reaches every harness where the scoping is incidental`,repair:({file:e})=>({command:``,instruction:`convert ${e} into a skill under .agents/skills where its guidance is not tied to the paths it names — \`${X}\` offers the conversion; keep it where the path scoping is the point`}),skillRepair:({file:e})=>`hand ${e} to \`${X}\` to convert into a skill, unless the path scoping is load-bearing`},"nonstandard-command":{detail:`a harness command file — a skill is the portable form, and this harness reads skills too`,repair:({file:e})=>({command:``,instruction:`move ${e} to .agents/skills/<name>/SKILL.md — \`${X}\` offers the move`}),skillRepair:({file:e})=>`hand ${e} to \`${X}\`, which moves it to .agents/skills`},"nonstandard-skill":{detail:`a skill under a harness directory rather than the canonical one, where only that harness finds it`,repair:({file:e})=>({command:``,instruction:`move ${e} to .agents/skills and project it back where the harness needs one — \`${X}\` offers the move`}),skillRepair:({file:e})=>`hand ${e} to \`${X}\`, which moves it to .agents/skills`},"nonstandard-subagent":{detail:`a subagent definition with no cross-harness form — nothing outside this harness can read it, and no canonical form exists yet`,repair:({file:e})=>({command:``,instruction:`leave ${e} where it is and record that it reaches one harness only — no portable form exists to convert it to`}),skillRepair:({file:e})=>`leave ${e} in place — no portable form exists yet, so this is work for a person rather than a skill`}};repairsOf(Ua);const Wa={...za,...Ba,...Va,...Ha,...Ua};repairsOf(Wa);function repairFor(e){return{problem:e,...Wa[e]}}const Ga=`.agents/skills`,Ka=`AGENTS.local.md`;function frontmatterFault(e){let t=/^---\n([\s\S]*?)\n---/.exec(e);if(!t)return`unparseable`;let n=/^description:[ \t]*(.*)$/m.exec(t[1])?.[1]?.trim();if(!n)return`no-description`;if(!/^(['"]).*\1$/.test(n)&&/:\s/.test(n))return`unparseable`}function diagnoseConfiguration({root:e,git:t,cli:n}){let i=[],add=(e,t)=>{let{detail:r,repair:a}=repairFor(t);i.push({path:e,problem:t,detail:r,repair:a({file:e},n)})},a=selectHarnesses(e,[]);for(let t of a){let n=t.project.skillsDirectory;t.deprecated&&n&&r(v(e,n))&&add(n,`deprecated-harness`)}for(let n of a){let i=n.project.skillsDirectory;i&&r(v(e,i))&&t.isIgnored(i)&&add(i,`ignored-bridge`)}r(v(e,Ka))&&add(Ka,`unread-local-override`);for(let t of filesUnder(v(e,Ga)).filter(e=>e.endsWith(`SKILL.md`)))frontmatterFault(o(v(e,Ga,t),`utf8`))&&add(`${Ga}/${t}`,`unloadable-skill`);return i}const qa=[`transport`,`command`,`args`,`env`,`url`,`headers`,`description`,`enabled`,`timeout`,`source`],Ja=new Set([`env`,`headers`]);function sameValue(e,t,n){if(Ja.has(e)&&isRecord$1(t)&&isRecord$1(n)){let e=Object.keys(t);return e.length===Object.keys(n).length&&e.every(e=>t[e]===n[e])}return JSON.stringify(t)===JSON.stringify(n)}function divergingFields(e,t,n=new Set(qa)){return qa.filter(r=>{if(!n.has(r))return!1;let i=e[r];if(i===void 0)return!1;if(Ja.has(r)&&isRecord$1(i)&&isRecord$1(t[r])){let e=t[r];return Object.keys(i).some(t=>i[t]!==e[t])}return!sameValue(r,i,t[r])})}function sameField(e,t,n){return sameValue(e,t?.[e],n?.[e])}function stringMap(e){if(!isRecord$1(e))return;let t=Object.entries(e).filter(([,e])=>typeof e==`string`);return t.length?Object.fromEntries(t):void 0}const Ya=new Set([`stdio`,`http`,`sse`]);function transportOf(e){let t=e.type??e.transport;if(typeof t==`string`&&Ya.has(t))return t;if(typeof e.url==`string`)return`http`;if(typeof e.command==`string`)return`stdio`}function serverFrom(e){let t=Array.isArray(e.args)&&e.args.every(e=>typeof e==`string`),n=transportOf(e),r=stringMap(e.env),i=stringMap(e.headers);return{...n?{transport:n}:{},...typeof e.command==`string`?{command:e.command}:{},...t?{args:e.args}:{},...r?{env:r}:{},...typeof e.url==`string`?{url:e.url}:{},...i?{headers:i}:{},...typeof e.description==`string`?{description:e.description}:{},...typeof e.enabled==`boolean`?{enabled:e.enabled}:{},...typeof e.timeout==`number`?{timeout:e.timeout}:{},...typeof e.source==`string`?{source:e.source}:{}}}const Xa=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/,Za=/\$\{[^}]*\}|\$[A-Za-z_]/;var Refusal=class extends Error{field;reason;constructor(e,t){super(t),this.field=e,this.reason=t}};function refuse(e,t){throw new Refusal(e,t)}function rendering(e){try{return{kind:`entry`,entry:e()}}catch(e){if(!(e instanceof Refusal))throw e;return{kind:`refused`,field:e.field,reason:e.reason}}}function assertRunnable(e){(e.transport===`stdio`?!e.command:!e.url)&&refuse(e.transport===`stdio`?`command`:`url`,`the golden set leaves it unset and the target requires it`)}function defined(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function mapValues(e,t){return e&&Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]))}function noReferenceIn(e,t,n){for(let r of t){let t=e[r];(Array.isArray(t)?t:[t]).some(e=>typeof e==`string`&&Za.test(e))&&refuse(r,`${n} documents no reference expansion here`)}}const Qa={fields:new Set([`transport`,`command`,`args`,`env`,`url`,`headers`,`description`,`timeout`]),read:serverFrom,write:e=>rendering(()=>(assertRunnable(e),defined({type:e.transport,command:e.command,args:e.args,env:e.env,url:e.url,headers:e.headers,description:e.description,timeout:e.timeout})))};function toCursor(e,t){return e.replace(/\$\{([^}]*)\}|\$[A-Za-z_]/g,(e,n)=>((n===void 0||!Xa.test(e))&&refuse(t,`Cursor expands only a plain variable reference, with no default`),`\${env:${n}}`))}function fromCursor(e){return e.replace(/\$\{env:([A-Za-z_][A-Za-z0-9_]*)\}/g,(e,t)=>`\${${t}}`)}function fromCursorEntry(e){let strings=e=>typeof e==`string`?fromCursor(e):e,map=e=>isRecord$1(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,strings(t)])):e;return{...e,command:strings(e.command),args:Array.isArray(e.args)?e.args.map(strings):e.args,env:map(e.env),url:strings(e.url),headers:map(e.headers)}}const $a={fields:new Set([`command`,`args`,`env`,`url`,`headers`]),read:e=>serverFrom(fromCursorEntry(e)),write:e=>rendering(()=>(assertRunnable(e),defined({type:e.transport===`stdio`?`stdio`:void 0,command:e.command&&toCursor(e.command,`command`),args:e.args?.map(e=>toCursor(e,`args`)),env:mapValues(e.env,e=>toCursor(e,`env`)),url:e.url&&toCursor(e.url,`url`),headers:mapValues(e.headers,e=>toCursor(e,`headers`))})))},eo=/^Bearer \$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function codexEnv(e){let t={},n=[];for(let[r,i]of Object.entries(e??{}))Xa.exec(i)?.[1]===r?n.push(r):Za.test(i)?refuse(`env`,`Codex passes a variable through only under its own name`):t[r]=i;return defined({env:Object.keys(t).length?t:void 0,env_vars:n.length?n:void 0})}function codexHeaders(e){let t={},n={},r;for(let[i,a]of Object.entries(e??{})){let e=Xa.exec(a)?.[1],o=eo.exec(a)?.[1];o&&i===`Authorization`?r=o:e?n[i]=e:Za.test(a)?refuse(`headers`,`Codex fills a header only from a whole variable reference, or Bearer and one`):t[i]=a}return defined({http_headers:Object.keys(t).length?t:void 0,env_http_headers:Object.keys(n).length?n:void 0,bearer_token_env_var:r})}function stringRecord(e){return isRecord$1(e)?Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`)):{}}function fromCodex(e){let t=Array.isArray(e.env_vars)?e.env_vars.filter(e=>typeof e==`string`):[],n={...stringRecord(e.env),...Object.fromEntries(t.map(e=>[e,`\${${e}}`]))},r=e.bearer_token_env_var,i={...stringRecord(e.http_headers),...Object.fromEntries(Object.entries(stringRecord(e.env_http_headers)).map(([e,t])=>[e,`\${${t}}`])),...typeof r==`string`?{Authorization:`Bearer \${${r}}`}:{}},a=e.tool_timeout_sec;return{command:e.command,args:e.args,env:n,url:e.url,headers:i,enabled:e.enabled,timeout:typeof a==`number`?Math.round(a*1e3):void 0}}const to={fields:new Set([`transport`,`command`,`args`,`env`,`url`,`headers`,`enabled`,`timeout`]),defaults:{timeout:6e4},read:e=>serverFrom(fromCodex(e)),write:e=>rendering(()=>(e.transport===`sse`&&refuse(`transport`,`Codex supports no SSE transport`),assertRunnable(e),noReferenceIn(e,[`command`,`args`,`url`],`Codex`),defined({command:e.command,args:e.args,...codexEnv(e.env),url:e.url,...codexHeaders(e.headers),enabled:e.enabled,tool_timeout_sec:e.timeout===void 0?void 0:e.timeout/1e3})))};function fromGemini(e){let{httpUrl:t,url:n,...r}=e;return typeof t==`string`?{...r,type:`http`,url:t}:typeof n==`string`?{...r,type:`sse`,url:n}:r}const no={"claude-code":Qa,cursor:$a,codex:to,"gemini-cli":{fields:new Set([`transport`,`command`,`args`,`env`,`url`,`headers`,`timeout`]),defaults:{timeout:6e5},read:e=>serverFrom(fromGemini(e)),write:e=>rendering(()=>(assertRunnable(e),defined({command:e.command,args:e.args,env:e.env,url:e.transport===`sse`?e.url:void 0,httpUrl:e.transport===`http`?e.url:void 0,headers:e.headers,timeout:e.timeout})))}};function stripJsonComments(e){let t=``,n=0,r=!1,i=!1;for(;n<e.length;){let a=e[n];if(r){t+=a,i?i=!1:a===`\\`?i=!0:a===`"`&&(r=!1),n+=1;continue}if(a===`"`){r=!0,t+=a,n+=1;continue}if(a===`/`&&e[n+1]===`/`){for(;n<e.length&&e[n]!==`
|
|
94
|
+
`;)n+=1;continue}if(a===`/`&&e[n+1]===`*`){for(n+=2;n<e.length&&(e[n]!==`*`||e[n+1]!==`/`);)n+=1;n+=2;continue}t+=a,n+=1}return t}function parseJsonWithComments(e){try{return JSON.parse(stripJsonComments(e))}catch{return}}
|
|
98
95
|
/*!
|
|
99
96
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
100
97
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -122,7 +119,7 @@ ${ef(e.config)}`:``}function ef(e){return _i(tf(e),{maxLength:1/0}).replace(/'/g
|
|
|
122
119
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
123
120
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
124
121
|
*/
|
|
125
|
-
let
|
|
122
|
+
let ro=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var io=class TomlDate extends Date{#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(ro);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(e,t=`Z`){let n=new TomlDate(e);return n.#n=t,n}static wrapAsLocalDateTime(e){let t=new TomlDate(e);return t.#n=null,t}static wrapAsLocalDate(e){let t=new TomlDate(e);return t.#t=!1,t.#n=null,t}static wrapAsLocalTime(e){let t=new TomlDate(e);return t.#e=!1,t.#n=null,t}};
|
|
126
123
|
/*!
|
|
127
124
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
128
125
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -150,9 +147,38 @@ let Om=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]
|
|
|
150
147
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
151
148
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
152
149
|
*/
|
|
153
|
-
function
|
|
150
|
+
function getLineColFromPtr(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function makeCodeBlock(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
|
|
154
151
|
`,e===t&&(i+=` `.repeat(a+n+2),i+=`^
|
|
155
|
-
`))}return i}var
|
|
152
|
+
`))}return i}var TomlError=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=getLineColFromPtr(t.toml,t.ptr),i=makeCodeBlock(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
|
|
153
|
+
/*!
|
|
154
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
155
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
156
|
+
*
|
|
157
|
+
* Redistribution and use in source and binary forms, with or without
|
|
158
|
+
* modification, are permitted provided that the following conditions are met:
|
|
159
|
+
*
|
|
160
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
161
|
+
* list of conditions and the following disclaimer.
|
|
162
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
163
|
+
* this list of conditions and the following disclaimer in the
|
|
164
|
+
* documentation and/or other materials provided with the distribution.
|
|
165
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
166
|
+
* may be used to endorse or promote products derived from this software without
|
|
167
|
+
* specific prior written permission.
|
|
168
|
+
*
|
|
169
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
170
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
171
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
172
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
173
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
174
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
175
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
176
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
177
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
178
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
179
|
+
*/
|
|
180
|
+
function indexOfNewline(e,t=0){let n=e.indexOf(`
|
|
181
|
+
`,t);return e.charCodeAt(n-1)===13&&n--,n}function skipComment(e){for(;e.p<e.s.length;e.p++){let t=e.s.charCodeAt(e.p);if(t===10)break;if(t===13&&e.s.charCodeAt(e.p+1)===10){e.p++;break}if(t<32&&t!==9||t===127)throw new TomlError(`control characters are not allowed in comments`,{toml:e.s,ptr:e.p})}}function skipVoid(e,t,n){let r;for(;;){for(;(r=e.s.charCodeAt(e.p))===32||r===9||!t&&(r===10||r===13&&e.s.charCodeAt(e.p+1)===10);)e.p++;if(n||r!==35)break;skipComment(e)}}function skipUntil(e,t,n){let r=e.p;if(!n){r=indexOfNewline(e.s,r),e.p=r<0?e.s.length:r;return}for(;e.p<e.s.length;e.p++){let r=e.s.charCodeAt(e.p);if(r===35)skipComment(e);else if(r===n||r===t)return}throw new TomlError(`cannot find end of structure`,{toml:e.s,ptr:r})}
|
|
156
182
|
/*!
|
|
157
183
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
158
184
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -180,8 +206,8 @@ function Am(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop()
|
|
|
180
206
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
181
207
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
182
208
|
*/
|
|
183
|
-
function
|
|
184
|
-
|
|
209
|
+
let ao=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,oo=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,so=/^[+-]?0[0-9_]/;function parseString(e){let t=e.p,n=e.s.charCodeAt(e.p++),r=n,i=n===39,a=n===e.s.charCodeAt(e.p)&&n===e.s.charCodeAt(e.p+1);a&&((n=e.s.charCodeAt(e.p+=2))===10?e.p++:n===13&&e.s.charCodeAt(e.p+1)===10&&(e.p+=2));let o=``,s=e.p,c=0;for(;e.p<e.s.length;e.p++)if(n=e.s.charCodeAt(e.p),a&&(n===10||n===13&&e.s.charCodeAt(e.p+1)===10))c&&=3;else if(n<32&&n!==9||n===127)throw new TomlError(`control characters are not allowed in strings`,{toml:e.s,ptr:e.p});else if((!c||c===3)&&n===r&&(!a||e.s.charCodeAt(e.p+1)===r&&e.s.charCodeAt(e.p+2)===r))return a&&(e.s.charCodeAt(e.p+3)===r&&e.p++,e.s.charCodeAt(e.p+3)===r&&e.p++),c||(o+=e.s.slice(s,e.p)),e.p+=a?3:1,o;else if(!c)!i&&n===92&&(o+=e.s.slice(s,s=e.p),c=1);else if(c===1){if(n===120||n===117||n===85){let t=0,r=n===120?2:n===117?4:8;for(let n=0;n<r;n++,e.p++){let n=e.s.charCodeAt(e.p+1),r=n>=48&&n<=57?n-48:n>=65&&n<=70?n-65+10:n>=97&&n<=102?n-97+10:-1;if(r<0)throw new TomlError(`invalid non-hex character in unicode escape`,{toml:e.s,ptr:e.p+1});t=t<<4|r}if(t<0||t>1114111||t>=55296&&t<=57343)throw new TomlError(`invalid unicode escape`,{toml:e.s,ptr:e.p});o+=String.fromCodePoint(t),s=e.p+1,c=0}else if(n===32||n===9)c=2;else{if(n===98)o+=`\b`;else if(n===116)o+=` `;else if(n===110)o+=`
|
|
210
|
+
`;else if(n===102)o+=`\f`;else if(n===114)o+=`\r`;else if(n===101)o+=`\x1B`;else if(n===34)o+=`"`;else if(n===92)o+=`\\`;else throw new TomlError(`unrecognized escape sequence`,{toml:e.s,ptr:e.p});s=e.p+1,c=0}}else if(n!==32&&n!==9){if(c===2)throw new TomlError(`invalid escape: only line-ending whitespace may be escaped`,{toml:e.s,ptr:s});c=+(!i&&n===92),s=e.p}throw new TomlError(`unfinished string`,{toml:e.s,ptr:t})}function sliceAndTrimEndOf(e,t,n){let r=e.s.slice(t,n),i=r.indexOf(`#`);return i>0&&(skipComment({s:r,p:i,d:0}),r=r.slice(0,i)),r.trimEnd()}function parseValue(e,t,n){let r=e.p,i={toml:e.s,ptr:r};skipUntil(e,44,n);let a=sliceAndTrimEndOf(e,r,e.p);if(!a)throw new TomlError(`incomplete declaration: value expected`,i);if(a===`-inf`)return-1/0;if(a===`inf`||a===`+inf`)return 1/0;if(a===`nan`||a===`+nan`||a===`-nan`)return NaN;if(a===`-0`)return t?0n:0;let o=ao.test(a);if(o||oo.test(a)){if(so.test(a))throw new TomlError(`leading zeroes are not allowed`,i);a=a.replace(/_/g,``);let e=+a;if(isNaN(e))throw new TomlError(`invalid number`,i);if(o){if((o=!Number.isSafeInteger(e))&&!t)throw new TomlError(`integer value cannot be represented losslessly`,i);(o||t===!0)&&(e=BigInt(a))}return e}let s=new io(a);if(!s.isValid())throw new TomlError(`invalid value`,i);return s}
|
|
185
211
|
/*!
|
|
186
212
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
187
213
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -209,8 +235,7 @@ function Mm(e,t=0){let n=e.indexOf(`
|
|
|
209
235
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
210
236
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
211
237
|
*/
|
|
212
|
-
|
|
213
|
-
`;else if(n===102)o+=`\f`;else if(n===114)o+=`\r`;else if(n===101)o+=`\x1B`;else if(n===34)o+=`"`;else if(n===92)o+=`\\`;else throw new $(`unrecognized escape sequence`,{toml:e.s,ptr:e.p});s=e.p+1,c=0}}else if(n!==32&&n!==9){if(c===2)throw new $(`invalid escape: only line-ending whitespace may be escaped`,{toml:e.s,ptr:s});c=+(!i&&n===92),s=e.p}throw new $(`unfinished string`,{toml:e.s,ptr:t})}function Bm(e,t,n){let r=e.s.slice(t,n),i=r.indexOf(`#`);return i>0&&(Nm({s:r,p:i,d:0}),r=r.slice(0,i)),r.trimEnd()}function Vm(e,t,n){let r=e.p,i={toml:e.s,ptr:r};Fm(e,44,n);let a=Bm(e,r,e.p);if(!a)throw new $(`incomplete declaration: value expected`,i);if(a===`-inf`)return-1/0;if(a===`inf`||a===`+inf`)return 1/0;if(a===`nan`||a===`+nan`||a===`-nan`)return NaN;if(a===`-0`)return t?0n:0;let o=Im.test(a);if(o||Lm.test(a)){if(Rm.test(a))throw new $(`leading zeroes are not allowed`,i);a=a.replace(/_/g,``);let e=+a;if(isNaN(e))throw new $(`invalid number`,i);if(o){if((o=!Number.isSafeInteger(e))&&!t)throw new $(`integer value cannot be represented losslessly`,i);(o||t===!0)&&(e=BigInt(a))}return e}let s=new km(a);if(!s.isValid())throw new $(`invalid value`,i);return s}
|
|
238
|
+
function extractValue(e,t,n){let r=e.p,i=e.s.charCodeAt(r);if(i===91||i===123){if(!e.d--)throw new TomlError(`document contains excessively nested structures. aborting.`,{toml:e.s,ptr:r});let t=i===91?parseArray(e,n):parseInlineTable(e,n);return e.d++,t}if(i===34||i===39)return parseString(e);if(i===116){if(e.s.charCodeAt(++e.p)!==114||e.s.charCodeAt(++e.p)!==117||e.s.charCodeAt(++e.p)!==101)throw new TomlError(`invalid value`,{toml:e.s,ptr:r});return e.p++,!0}if(i===102){if(e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==108||e.s.charCodeAt(++e.p)!==115||e.s.charCodeAt(++e.p)!==101)throw new TomlError(`invalid value`,{toml:e.s,ptr:r});return e.p++,!1}return parseValue(e,n,t)}
|
|
214
239
|
/*!
|
|
215
240
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
216
241
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -238,7 +263,7 @@ let Im=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Lm=/^[+-]?
|
|
|
238
263
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
239
264
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
240
265
|
*/
|
|
241
|
-
function
|
|
266
|
+
let co=/^[a-zA-Z0-9-_]+[ \t]*$/;function parseKey(e,t=`=`){let n=e.p,r=n-1,i=[],a=e.s.indexOf(t,n);if(a<0)throw new TomlError(`incomplete key-value: cannot find end of key`,{toml:e.s,ptr:n});do{let o=e.s.charCodeAt(e.p=++r);if(o!==32&&o!==9){if(o===34||o===39){if(o===e.s.charCodeAt(e.p+1)&&o===e.s.charCodeAt(e.p+2))throw new TomlError(`multiline strings are not allowed in keys`,{toml:e.s,ptr:e.p});let s=parseString(e);r=e.s.indexOf(`.`,e.p);let c=e.s.slice(e.p,r<0||r>a?a:r),l=indexOfNewline(c);if(l>-1)throw new TomlError(`newlines are not allowed in keys`,{toml:e.s,ptr:l});if(c.trimStart())throw new TomlError(`found extra tokens after the string part`,{toml:e.s,ptr:e.p});if(a<e.p&&(a=e.s.indexOf(t,e.p),a<0))throw new TomlError(`incomplete key-value: cannot find end of key`,{toml:e.s,ptr:n});i.push(s)}else{r=e.s.indexOf(`.`,e.p);let t=e.s.slice(e.p,r<0||r>a?a:r);if(!co.test(t))throw new TomlError(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e.s,ptr:e.p});i.push(t.trimEnd())}}}while(r+1&&r<a);return e.p=a+1,skipVoid(e,!0,!0),i}function parseInlineTable(e,t){let n={},r=new Set,i;for(e.p++;e.p<e.s.length;){if(skipVoid(e),(i=e.s.charCodeAt(e.p))===125)return e.p++,n;let a,o=n,s=!1,c=e.p,l=parseKey(e);for(let t=0;t<l.length;t++){if(t&&(o=s?o[a]:o[a]={}),a=l[t],(s=Object.hasOwn(o,a))&&(typeof o[a]!=`object`||r.has(o[a])))throw new TomlError(`trying to redefine an already defined value`,{toml:e.s,ptr:c});!s&&a===`__proto__`&&Object.defineProperty(o,a,{enumerable:!0,configurable:!0,writable:!0})}if(s)throw new TomlError(`trying to redefine an already defined value`,{toml:e.s,ptr:e.p});let u=extractValue(e,125,t);if(r.add(o[a]=u),skipVoid(e),(i=e.s.charCodeAt(e.p++))===125)return n;if(i!==44)throw new TomlError(`expected comma or end of structure`,{toml:e.s,ptr:e.p-1})}throw new TomlError(`unfinished table encountered`,{toml:e.s,ptr:e.p})}function parseArray(e,t){let n=[],r;for(e.p++;e.p<e.s.length;){if(skipVoid(e),(r=e.s.charCodeAt(e.p))===93)return e.p++,n;if(n.push(extractValue(e,93,t)),skipVoid(e),(r=e.s.charCodeAt(e.p++))===93)return n;if(r!==44)throw new TomlError(`expected comma or end of structure`,{toml:e.s,ptr:e.p-1})}throw new TomlError(`unfinished array encountered`,{toml:e.s,ptr:e.p})}
|
|
242
267
|
/*!
|
|
243
268
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
244
269
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -266,7 +291,7 @@ function Hm(e,t,n){let r=e.p,i=e.s.charCodeAt(r);if(i===91||i===123){if(!e.d--)t
|
|
|
266
291
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
267
292
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
268
293
|
*/
|
|
269
|
-
|
|
294
|
+
function peekTable(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&(r!==1||c.t!==3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}function parse$2(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={s:e,p:0,d:t},i={},a={},o,s=i,c=a;for(skipVoid(r);r.p<e.length;){if(e.charCodeAt(r.p)===91){let t=e.charCodeAt(++r.p)===91;o=r.p+=+t;let n=parseKey(r,`]`);if(t){if(e.charCodeAt(r.p-1)!==93)throw new TomlError(`expected end of table declaration`,{toml:e,ptr:r.p-1});r.p++}let l=peekTable(n,i,a,t?2:1);if(!l)throw new TomlError(`trying to redefine an already defined table or value`,{toml:e,ptr:o});c=l[2],s=l[1]}else{o=r.p;let t=peekTable(parseKey(r),s,c,0);if(!t)throw new TomlError(`trying to redefine an already defined table or value`,{toml:e,ptr:o});t[1][t[0]]=extractValue(r,void 0,n)}if(skipVoid(r,!0),r.p<e.length&&(o=e.charCodeAt(r.p))!==10&&o!==13)throw new TomlError(`each key-value declaration must be followed by an end-of-line`,{toml:e,ptr:r.p});skipVoid(r)}return i}__name(parse$2,`parse`);
|
|
270
295
|
/*!
|
|
271
296
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
272
297
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -294,10 +319,155 @@ let Um=/^[a-zA-Z0-9-_]+[ \t]*$/;function Wm(e,t=`=`){let n=e.p,r=n-1,i=[],a=e.s.
|
|
|
294
319
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
295
320
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
296
321
|
*/
|
|
297
|
-
function
|
|
298
|
-
`
|
|
299
|
-
`)
|
|
300
|
-
`)
|
|
301
|
-
`
|
|
302
|
-
|
|
303
|
-
`)));return i.length===r.length&&r.every((e,t)=>n.get(e)===i[t])}};const ig=`.agents/skills`;function ag(e){try{let t=i(e);return t.isSymbolicLink()?`symlink`:t.isDirectory()?`directory`:`file`}catch{return`missing`}}function og(e){try{return d(e).isDirectory()}catch{return!1}}function sg(e,t){let n=Zp(e),r=Zp(t);return n.length===r.length&&n.every((n,i)=>r[i]===n&&o(_(e,n)).equals(o(_(t,n))))}function cg(e,t,n,r){switch(ag(e)){case`missing`:return{kind:`none`,status:`missing`,problem:`missing`};case`file`:return{kind:`file`,status:`degraded`,problem:`degraded`};case`symlink`:return Vh(e,n)?{kind:`symlink`,status:`ok`}:{kind:`symlink`,status:`stale`,problem:`stale`};default:if(!sg(e,n)){let e=r.directionOf(t,ig);return{kind:`copy`,status:`diverged`,problem:`diverged-${e}`,direction:e}}return r.trackingOf(t)===`tracked`?{kind:`copy`,status:`ok`,problem:`unpinned-copy`}:{kind:`copy`,status:`ok`}}}function lg({root:e,harnesses:t=[],cli:n}){let r=_(e,`.agents`,`skills`),i=new rg(e),a=im(e,t),o=a.map(e=>({name:e.name,skillsDirectory:e.project.skillsDirectory})).filter(e=>!!e.skillsDirectory),s=[],c=[],l=[];if(!og(r)){let{detail:e,repair:t}=gm(`no-canonical`);l.push({path:ig,problem:`no-canonical`,detail:e,repair:t({file:ig},n)})}for(let t of o){let a=t.skillsDirectory,o=cg(_(e,a),a,r,i);if(s.push({harness:t.name,path:a,kind:o.kind,status:o.status}),o.direction&&c.push({path:a,direction:o.direction}),o.problem){let{detail:e,repair:t}=gm(o.problem);l.push({path:a,problem:o.problem,detail:e,repair:t({file:a},n)})}}let u=eg(e,a,n);return l.push(...u.findings),{bridges:s,instructions:u.instructions,divergence:c,findings:l}}function ug(e,t,n=[],r=[]){let i=[...t.findings,...n],a=r.length?r:`0 governance overrides — no .agents/governances at project, user, or machine scope`;if(!i.length){let n=t.bridges.length+t.instructions.length,r=n===1?`the 1 bridge resolves`:`all ${n} bridges resolve`;return{bin:e,bridges:t.bridges,instructions:t.instructions,governances:a,findings:`0 problems found — ${r} and the configuration around them is current`}}return{bin:e,bridges:t.bridges,instructions:t.instructions,governances:a,...t.divergence.length?{divergence:t.divergence}:{},findings:i.map(({path:e,problem:t,detail:n})=>({path:e,problem:t,detail:n})),help:[...new Map(i.map(e=>[`${e.repair.command}\u0000${e.repair.instruction}`,e.repair])).values()]}}const dg=Vi({name:`doctor`,description:`Report whether this repository's harness bridges still resolve — skills into .agents/skills, instructions into AGENTS.md. Read-only.`,options:{root:{description:`Repository or package directory. Defaults to the current directory.`,type:Z(ho())},harness:{description:`Comma-separated harnesses to check in addition to Claude Code and Cursor, e.g. codex,gemini-cli.`,type:Z(ho())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:Z(ho()),default:`toon`}},run(e){try{let t=fp(e.format),n=tm(e.harness),r=e.root??process.cwd(),i=T(),a=lg({root:r,...n.length?{harnesses:n}:{},cli:sm}),o=new rg(r),s=[...bm({root:r,git:o,cli:sm}),...vh({root:r,git:o,cli:sm}),...wh({root:r,cli:sm})],c=Lh(jh(Ah({root:r,home:i,platform:process.platform,programData:process.env.ProgramData}))).map(({name:e,scope:t,path:n})=>({name:e,scope:t,path:yp(i,n)}));return pp(ug(bp(i,process.argv[1]),a,s,c),t),pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Harness diagnosis failed.`}\n`),pu.error}}});function fg(e){let t=Ah({root:e.root??process.cwd(),home:T(),platform:process.platform,programData:process.env.ProgramData});return e[`overrides-only`]?jh(t):t}const pg={description:`Repository or package directory. Defaults to the current directory.`,type:Z(ho())},mg={description:`Resolve only the project, user, and machine-wide layers. Never returns a governance this package ships, and exits non-zero when no layer has one.`,type:Z(go())},hg=Vi({name:`governance`,description:`Read the governance documents the project, user, and machine-wide override layers hold. Read-only.`,commands:[Vi({name:`list`,description:`List every governance the override layers hold, each at the layer that would win.`,options:{root:pg,"overrides-only":mg,format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:Z(ho()),default:`toon`}},run(e){try{let t=fp(e.format),n=T(),r=fg(e),i=Lh(r);return pp({layers:r.map(({scope:e,dir:t})=>({scope:e,path:yp(n,t),status:e===`managed-deprecated`?`deprecated — move these documents to the managed layer above`:``})),governances:i.length?i.map(({name:e,scope:t,path:r})=>({name:e,scope:t,path:yp(n,r)})):`0 governances — no layer holds one`},t),pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Governance listing failed.`}\n`),pu.error}}}),Vi({name:`show`,description:`Print one governance document, resolved through the layers in order.`,arguments:[{name:`name`,description:"The governance name, without the `.md` extension.",type:ho()}],options:{root:pg,"overrides-only":mg,format:{description:`Output format: text (default) writes the document itself; toon and json wrap it with the layer it came from.`,type:Z(ho()),default:`text`}},run(e){try{let t=fp(e.format),n=Nh(e.name),r=Ih(n,fg(e));return r?(t===`text`?mp(r.content):pp({name:r.name,scope:r.scope,path:yp(T(),r.path),content:r.content},t),pu.success):(process.stderr.write(e[`overrides-only`]?`error: no override for governance "${n}" in the project, user, or machine-wide layer.\n`:`error: no governance named "${n}" in any layer.\n`),pu.error)}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Governance lookup failed.`}\n`),pu.error}}})]});function gg({root:e,harnesses:t=[],copy:n=!1,force:r=!1}){let i=_(e,`.agents`,`skills`),a=Hh(i),o=Rh(e),s=im(e,t),{linked:c,skipped:l}=Kh({root:e,canonicalSkills:i,harnesses:s,copy:n,force:r});return{root:e,harnesses:s.map(e=>e.name),native:s.filter(e=>!e.project.skillsDirectory).map(e=>e.name),linked:c,skipped:l,deprecated:s.filter(e=>e.deprecated).map(e=>({name:e.name,replacedBy:e.deprecated})),skills:a,governances:o,copied:n}}const _g=Vi({name:`init`,description:`Set up canonical agent skills for the harnesses already enabled in a repository.`,options:{root:{description:`Repository or package directory. Defaults to the current directory.`,type:Z(ho())},harness:{description:`Comma-separated harnesses to enable in addition to Claude Code and Cursor, e.g. codex,gemini-cli.`,type:Z(ho())},copy:{description:`Copy skills instead of linking them.`,type:Z(go())},force:{description:`Replace conflicting target skill directories. Names the targets to replace, comma-separated (e.g. .claude/skills); given alone it replaces every conflicting target.`,type:Z(ho())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:Z(ho()),default:`toon`}},run(e){try{let t=fp(e.format),n=tm(e.harness);return pp(gg({root:e.root??process.cwd(),...n.length?{harnesses:n}:{},...e.copy===void 0?{}:{copy:e.copy},...e.force===void 0?{}:{force:Wh(e.force)}}),t),pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Harness initialization failed.`}\n`),pu.error}}});function vg(){return rf({name:`buddy-agent-harness`,version:`0.12.0`,description:`Initialize agent harness skill compatibility in consumer repositories.`}).command(_g).command(dg).command(Xp).command(hg)}async function yg(e){try{let t=await vg().parse(e);return typeof t==`number`?t:pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Invalid command.`}\n`),pu.usage}}const bg=await yg([...process.argv.slice(0,2),`init`,...process.argv.slice(2)]);bg!==0&&(process.exitCode=bg);export{};
|
|
322
|
+
let lo=/^[a-z0-9-_]+$/i;function extendedTypeOf(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(typeof e?.getUTCDate==`function`&&e instanceof Date)return`date`;if(globalThis.Temporal&&typeof e?.since==`function`&&(e instanceof Temporal.Instant||e instanceof Temporal.PlainDate||e instanceof Temporal.PlainDateTime||e instanceof Temporal.PlainTime||e instanceof Temporal.ZonedDateTime))return`temporal`}return t}function isArrayOfTables(e){for(let t=0;t<e.length;t++)if(extendedTypeOf(e[t])!==`object`)return!1;return e.length!=0}function formatString(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}function stringifyTemporal(e){return e.toString({calendarName:`never`,timeZoneName:`never`})}function stringifyValue(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);switch(t){case`number`:if(isNaN(e))return`nan`;if(e===1/0)return`inf`;if(e===-1/0)return`-inf`;if(Number.isInteger(e)&&(r||!Number.isSafeInteger(e)))return e.toFixed(1);case`bigint`:case`boolean`:return e.toString();case`string`:return formatString(e);case`date`:if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString();case`object`:return stringifyInlineTable(e,n,r);case`array`:return stringifyArray(e,n,r);case`temporal`:return stringifyTemporal(e)}}function stringifyInlineTable(e,t,n){let r=Object.keys(e);if(r.length===0)return`{}`;let i=`{ `;for(let a=0;a<r.length;a++){let o=r[a];a&&(i+=`, `),i+=lo.test(o)?o:formatString(o),i+=` = `,i+=stringifyValue(e[o],extendedTypeOf(e[o]),t-1,n)}return i+` }`}function stringifyArray(e,t,n){if(e.length===0)return`[]`;let r=`[ `;for(let i=0;i<e.length;i++){if(i&&(r+=`, `),e[i]===null||e[i]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);r+=stringifyValue(e[i],extendedTypeOf(e[i]),t-1,n)}return r+` ]`}function stringifyArrayTable(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let i=``;for(let a=0;a<e.length;a++)i+=`${i&&`
|
|
323
|
+
`}[[${t}]]\n`,i+=stringifyTable(0,e[a],t,n,r);return i}function stringifyTable(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=extendedTypeOf(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=lo.test(c)?c:formatString(c);if(e===`array`&&isArrayOfTables(t[c]))o+=(o&&`
|
|
324
|
+
`)+stringifyArrayTable(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
|
|
325
|
+
`)+stringifyTable(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=stringifyValue(t[c],e,r,i),a+=`
|
|
326
|
+
`}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function stringify(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(extendedTypeOf(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=stringifyTable(0,e,``,t,n);return r[r.length-1]===`
|
|
327
|
+
`?r:r+`
|
|
328
|
+
`}const uo=`.agents/buddy-agent-harness/mcp.toml`;function mcpTargets(e){let t=new Set;return selectHarnesses(e,[]).map(e=>e.project.mcpConfig).filter(e=>e!==void 0).filter(e=>!t.has(e.path)&&t.add(e.path))}function serversUnder(e,t,n=serverFrom){let r=isRecord$1(e)?e[t]:void 0;return isRecord$1(r)?new Map(Object.entries(r).filter(([,e])=>isRecord$1(e)).map(([e,t])=>[e,n(t)])):new Map}function positionOf(e){if(!isRecord$1(e))return;let{line:t,column:n}=e;return typeof t==`number`&&typeof n==`number`?{line:t,column:n}:void 0}function parseGoldenSet(e){if(e===void 0)return{kind:`absent`};try{return{kind:`servers`,servers:serversUnder(parse$2(e),`servers`)}}catch(e){return{kind:`unreadable`,position:positionOf(e)}}}function parseTarget(e,t){if(t===void 0)return{kind:`absent`};if(e.format===`toml`)try{return{kind:`servers`,servers:serversUnder(parse$2(t),e.key,no[e.dialect].read)}}catch{return{kind:`unreadable`}}let n=parseJsonWithComments(t);return n===void 0?{kind:`unreadable`}:{kind:`servers`,servers:serversUnder(n,e.key,no[e.dialect].read)}}const fo=`.agents/buddy-agent-harness/mcp.projected.json`;function parseProjectionRecord(e){let t=e===void 0?void 0:parseJsonWithComments(e),n=isRecord$1(t)?t.targets:void 0;return isRecord$1(n)?new Map(Object.entries(n).filter(([,e])=>isRecord$1(e)).map(([e,t])=>[e,new Map(Object.entries(t).filter(([,e])=>isRecord$1(e)).map(([e,t])=>[e,t]))])):new Map}function formatProjectionRecord(e){let t=Object.fromEntries([...e].map(([e,t])=>[e,Object.fromEntries(t)]));return`${JSON.stringify({targets:t},null,2)}\n`}var McpBaseline=class{options;constructor(e){this.options=e}parsed=new Map;walked=new Map;directionOf(e,t,n,r,i){let a=this.baseFor(e,t,n);if(a===void 0)return`unknown`;let o=!sameField(n,r,a),s=!sameField(n,i,a);return o&&s?`both`:s?`target`:`golden`}baseFor(e,t,n){return this.options.record.get(e.path)?.get(t)||this.lastAgreed(e,t,n)}lastAgreed(e,t,n){for(let r of this.commitsTouching(e)){let i=this.parseAt(r,uo,parseGoldenSet),a=this.parseAt(r,e.path,t=>parseTarget(e,t));if(i.kind!==`servers`||a.kind!==`servers`)continue;let o=i.servers.get(t),s=a.servers.get(t);if(o&&s&&sameField(n,o,s))return o}}commitsTouching(e){let t=this.walked.get(e.path);if(t)return t;let n=this.options.git.commitsTouching([uo,e.path]);return this.walked.set(e.path,n),n}parseAt(e,t,n){let r=`${e}\u0000${t}`,i=this.parsed.get(r);if(i)return i;let a=n(this.options.git.contentAt(e,t));return this.parsed.set(r,a),a}};const po=/token|secret|password|passwd|credential/i,mo=new Set([`key`,`apikey`,`auth`,`authorization`,`bearer`]);function segmentsOf(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).split(/[^A-Za-z0-9]+/).filter(Boolean).map(e=>e.toLowerCase())}const ho=/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/;function holdsLiteral(e){return!ho.test(e)}function credentialKey(e){return po.test(e)||segmentsOf(e).some(e=>mo.has(e))}function urlHoldsCredential(e){let t;try{t=new URL(e)}catch{return!1}if(t.password)return!0;for(let[e,n]of t.searchParams)if(credentialKey(e)&&holdsLiteral(n))return!0;return!1}function literalsIn$1(e,t){return Object.entries(t??{}).filter(([e,t])=>credentialKey(e)&&holdsLiteral(t)).map(([t])=>`${e}.${t}`)}__name(literalsIn$1,`literalsIn`);function credentialFields(e){return[...literalsIn$1(`env`,e.env),...literalsIn$1(`headers`,e.headers),...e.url&&urlHoldsCredential(e.url)?[`url`]:[]]}function nonSecretArgs(e){return(e??[]).filter(e=>{let t=e.indexOf(`=`);return t===-1||!(credentialKey(e.slice(0,t))&&holdsLiteral(e.slice(t+1)))})}function read$2(e,t){let n=v(e,t);return r(n)?o(n,`utf8`):void 0}__name(read$2,`read`);const go={target:`mcp-diverged-target`,golden:`mcp-diverged-golden`,both:`mcp-diverged-both`,unknown:`mcp-diverged-unknown`};function diagnoseMcp({root:e,git:t,cli:n}){let r=[],add=(e,t)=>{let{detail:i,repair:a}=repairFor(t);r.push({path:locatorText(e),problem:t,detail:i,repair:a(e,n)})},reportSecrets=(e,n)=>{let r=t.trackingOf(e)!==`untracked`;for(let[t,i]of n)for(let n of credentialFields(i))add({file:e,server:t,field:n},r?`mcp-committed-secret`:`mcp-literal-secret`)},i=new Map,a=[];for(let t of mcpTargets(e)){let n=parseTarget(t,read$2(e,t.path));if(n.kind===`unreadable`){add({file:t.path},`mcp-target-unreadable`);continue}n.kind!==`absent`&&(reportSecrets(t.path,n.servers),i.set(t.path,n.servers),a.push(t))}let o=parseGoldenSet(read$2(e,uo));if(o.kind===`unreadable`)return add({file:uo,position:o.position},`mcp-golden-unreadable`),r;if(o.kind===`absent`)return r;reportSecrets(uo,o.servers);let s=new McpBaseline({git:t,record:parseProjectionRecord(read$2(e,fo))});for(let e of a){let t=i.get(e.path);for(let[n,r]of o.servers){let i=t.get(n);if(!i){add({file:e.path,server:n},`mcp-unprojected`);continue}for(let t of divergingFields(r,i,no[e.dialect].fields))add({file:e.path,server:n,field:t},go[s.directionOf(e,n,t,r,i)])}for(let n of t.keys())o.servers.has(n)||add({file:e.path,server:n},`mcp-undeclared`)}return r}const _o={instructions:`nonstandard-instructions`,rule:`nonstandard-rule`,command:`nonstandard-command`,skill:`nonstandard-skill`,subagent:`nonstandard-subagent`};function scopedByGlobs(e){let t=/^---\n([\s\S]*?)\n---/.exec(e);if(!t)return!1;let n=/^globs:[ \t]*(.*)$/m.exec(t[1])?.[1]?.trim();return n!==void 0&&n.length>0&&n!==`[]`}function skillFiles(e){return filesUnder(e).filter(e=>e.endsWith(`SKILL.md`))}function authoredHere(e){try{return!i(e).isSymbolicLink()}catch{return!1}}function artifactFiles(e,t){let n=v(e,t.path);return authoredHere(n)?t.shape===`file`?[t.path]:(t.kind===`skill`?skillFiles(n):filesUnder(n)).map(e=>b.join(t.path,e)):[]}function diagnoseNonstandard({root:e,cli:t}){let n=[];for(let r of Na)for(let i of r.project.nonstandard??[])for(let r of artifactFiles(e,i)){let a=i.kind===`rule`&&r.endsWith(`.mdc`)&&!scopedByGlobs(o(v(e,r),`utf8`))?`instructions`:i.kind,s=_o[a],{detail:c,repair:l}=repairFor(s);n.push({path:r,problem:s,detail:c,repair:l({file:r},t)})}return n.sort((e,t)=>e.path.localeCompare(t.path))}var Z=__commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}let hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor;e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=hasAnchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),vo=__commonJSMin((e=>{var t=Z();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e<r.items.length;++e){let t=visit_(e,r.items[e],a,o);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){o=Object.freeze(o.concat(r));let e=visit_(`key`,r.key,a,o);if(e===n)return n;e===i&&(r.key=null);let t=visit_(`value`,r.value,a,o);if(t===n)return n;t===i&&(r.value=null)}}return s}async function visitAsync(e,n){let r=initVisitor(n);t.isDocument(e)?await visitAsync_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):await visitAsync_(null,e,r,Object.freeze([]))}visitAsync.BREAK=n,visitAsync.SKIP=r,visitAsync.REMOVE=i;async function visitAsync_(e,r,a,o){let s=await callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visitAsync_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e<r.items.length;++e){let t=await visitAsync_(e,r.items[e],a,o);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){o=Object.freeze(o.concat(r));let e=await visitAsync_(`key`,r.key,a,o);if(e===n)return n;e===i&&(r.key=null);let t=await visitAsync_(`value`,r.value,a,o);if(t===n)return n;t===i&&(r.value=null)}}return s}function initVisitor(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function callVisitor(e,n,r,i){if(typeof r==`function`)return r(e,n,i);if(t.isMap(n))return r.Map?.(e,n,i);if(t.isSeq(n))return r.Seq?.(e,n,i);if(t.isPair(n))return r.Pair?.(e,n,i);if(t.isScalar(n))return r.Scalar?.(e,n,i);if(t.isAlias(n))return r.Alias?.(e,n,i)}function replaceNode(e,n,r){let i=n[n.length-1];if(t.isCollection(i))i.items[e]=r;else if(t.isPair(i))e===`key`?i.key=r:i.value=r;else if(t.isDocument(i))i.contents=r;else{let e=t.isAlias(i)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}e.visit=visit,e.visitAsync=visitAsync})),yo=__commonJSMin((e=>{var t=Z(),n=vo();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(`
|
|
329
|
+
`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),bo=__commonJSMin((e=>{var t=Z(),n=vo();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),xo=__commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=applyReviver(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=applyReviver(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=applyReviver(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=applyReviver(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}e.applyReviver=applyReviver})),So=__commonJSMin((e=>{var t=Z();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),Co=__commonJSMin((e=>{var t=xo(),n=Z(),r=So(),NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}};e.NodeBase=NodeBase})),wo=__commonJSMin((e=>{var t=bo(),n=vo(),r=Z(),i=Co(),a=So(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let a;for(let e of i){if(e===this)break;e.anchor===this.source&&(a=e)}return a}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,o=this.resolve(r,t);if(!o){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let s=n.get(o);if(s||=(a.toJS(o,null,t),n.get(o)),s?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(s.count+=1,s.aliasCount===0&&(s.aliasCount=getAliasCount(r,o,n)),s.count*s.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return s.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),Q=__commonJSMin((e=>{var t=Z(),n=Co(),r=So();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),To=__commonJSMin((e=>{var t=wo(),n=Z(),r=Q();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let p=findTagObject(e,i,l.tags);if(!p){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}p=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(p),delete a.onTagObj);let m=p?.createNode?p.createNode(a.schema,e,a):typeof p?.nodeClass?.from==`function`?p.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?m.tag=i:p.default||(m.tag=p.tag),d&&(d.node=m),m}e.createNode=createNode})),Eo=__commonJSMin((e=>{var t=To(),n=Z(),r=Co();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};e.Collection=Collection,e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),Do=__commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}let lineComment=(e,t,n)=>e.endsWith(`
|
|
330
|
+
`)?indentComment(n,t):n.includes(`
|
|
331
|
+
`)?`
|
|
332
|
+
`+indentComment(n,t):(e.endsWith(` `)?``:` `)+n;e.indentComment=indentComment,e.lineComment=lineComment,e.stringifyComment=stringifyComment})),Oo=__commonJSMin((e=>{let t=`block`,n=`quoted`;function foldFlowLines(e,r,i=`flow`,{indentAtStart:a,lineWidth:o=80,minContentWidth:s=20,onFold:c,onOverflow:l}={}){if(!o||o<0)return e;o<s&&(s=0);let u=Math.max(1+s,1+o-r.length);if(e.length<=u)return e;let d=[],p={},m=o-r.length;typeof a==`number`&&(a>o-Math.max(2,s)?d.push(0):m=o-a);let h,g,_=!1,v=-1,y=-1,b=-1;i===t&&(v=consumeMoreIndentedLines(e,v,r.length),v!==-1&&(m=v+u));for(let a;a=e[v+=1];){if(i===n&&a===`\\`){switch(y=v,e[v+1]){case`x`:v+=3;break;case`u`:v+=5;break;case`U`:v+=9;break;default:v+=1}b=v}if(a===`
|
|
333
|
+
`)i===t&&(v=consumeMoreIndentedLines(e,v,r.length)),m=v+r.length+u,h=void 0;else{if(a===` `&&g&&g!==` `&&g!==`
|
|
334
|
+
`&&g!==` `){let t=e[v+1];t&&t!==` `&&t!==`
|
|
335
|
+
`&&t!==` `&&(h=v)}if(v>=m){if(h)d.push(h),m=h+u,h=void 0;else if(i===n){for(;g===` `||g===` `;)g=a,a=e[v+=1],_=!0;let t=v>b+1?v-2:y-1;if(p[t])return e;d.push(t),p[t]=!0,m=t+u,h=void 0}else _=!0}}g=a}if(_&&l&&l(),d.length===0)return e;c&&c();let x=e.slice(0,d[0]);for(let t=0;t<d.length;++t){let a=d[t],o=d[t+1]||e.length;a===0?x=`\n${r}${e.slice(0,o)}`:(i===n&&p[a]&&(x+=`${e[a]}\\`),x+=`\n${r}${e.slice(a+1,o)}`)}return x}function consumeMoreIndentedLines(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
336
|
+
`);r=t,i=t+1,a=e[i]}return r}e.FOLD_BLOCK=t,e.FOLD_FLOW=`flow`,e.FOLD_QUOTED=n,e.foldFlowLines=foldFlowLines})),ko=__commonJSMin((e=>{var t=Q(),n=Oo();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
337
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function doubleQuotedString(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,a=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(containsDocumentMarker(e)?` `:``),s=``,c=0;for(let e=0,t=r[e];t;t=r[++e])if(t===` `&&r[e+1]===`\\`&&r[e+2]===`n`&&(s+=r.slice(c,e)+`\\ `,e+=1,c=e,t=`\\`),t===`\\`)switch(r[e+1]){case`u`:{s+=r.slice(c,e);let t=r.substr(e+2,4);switch(t){case`0000`:s+=`\\0`;break;case`0007`:s+=`\\a`;break;case`000b`:s+=`\\v`;break;case`001b`:s+=`\\e`;break;case`0085`:s+=`\\N`;break;case`00a0`:s+=`\\_`;break;case`2028`:s+=`\\L`;break;case`2029`:s+=`\\P`;break;default:t.substr(0,2)===`00`?s+=`\\x`+t.substr(2):s+=r.substr(e,6)}e+=5,c=e+1}break;case`n`:if(i||r[e+2]===`"`||r.length<a)e+=1;else{for(s+=r.slice(c,e)+`
|
|
338
|
+
|
|
339
|
+
`;r[e+2]===`\\`&&r[e+3]===`n`&&r[e+4]!==`"`;)s+=`
|
|
340
|
+
`,e+=2;s+=o,r[e+2]===` `&&(s+=`\\`),e+=1,c=e+1}break;default:e+=1}return s=c?s+r.slice(c):r,i?s:n.foldFlowLines(s,o,n.FOLD_QUOTED,getFoldOptions(t,!1))}function singleQuotedString(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
341
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return doubleQuotedString(e,t);let r=t.indent||(containsDocumentMarker(e)?` `:``),i=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${r}`)+`'`;return t.implicitKey?i:n.foldFlowLines(i,r,n.FOLD_FLOW,getFoldOptions(t,!1))}function quotedString(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=doubleQuotedString;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?singleQuotedString:i&&!t?doubleQuotedString:n?singleQuotedString:doubleQuotedString}return r(e,t)}let r;try{r=RegExp(`(^|(?<!
|
|
342
|
+
))
|
|
343
|
+
+(?!
|
|
344
|
+
|$)`,`g`)}catch{r=/\n+(?!\n|$)/g}function blockString({comment:e,type:i,value:a},o,s,c){let{blockQuote:l,commentString:u,lineWidth:d}=o.options;if(!l||/\n[\t ]+$/.test(a))return quotedString(a,o);let p=o.indent||(o.forceBlockIndent||containsDocumentMarker(a)?` `:``),m=l===`literal`?!0:l===`folded`||i===t.Scalar.BLOCK_FOLDED?!1:i===t.Scalar.BLOCK_LITERAL||!lineLengthOverLimit(a,d,p.length);if(!a)return m?`|
|
|
345
|
+
`:`>
|
|
346
|
+
`;let h,g;for(g=a.length;g>0;--g){let e=a[g-1];if(e!==`
|
|
347
|
+
`&&e!==` `&&e!==` `)break}let _=a.substring(g),v=_.indexOf(`
|
|
348
|
+
`);v===-1?h=`-`:a===_||v!==_.length-1?(h=`+`,c&&c()):h=``,_&&=(a=a.slice(0,-_.length),_[_.length-1]===`
|
|
349
|
+
`&&(_=_.slice(0,-1)),_.replace(r,`$&${p}`));let y=!1,b,x=-1;for(b=0;b<a.length;++b){let e=a[b];if(e===` `)y=!0;else if(e===`
|
|
350
|
+
`)x=b;else break}let S=a.substring(0,x<b?x+1:b);S&&=(a=a.substring(S.length),S.replace(/\n+/g,`$&${p}`));let C=(y?p?`2`:`1`:``)+h;if(e&&(C+=` `+u(e.replace(/ ?[\r\n]+/g,` `)),s&&s()),!m){let e=a.replace(/\n+/g,`
|
|
351
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${p}`),r=!1,s=getFoldOptions(o,!0);l!==`folded`&&i!==t.Scalar.BLOCK_FOLDED&&(s.onOverflow=()=>{r=!0});let c=n.foldFlowLines(`${S}${e}${_}`,p,n.FOLD_BLOCK,s);if(!r)return`>${C}\n${p}${c}`}return a=a.replace(/\n+/g,`$&${p}`),`|${C}\n${p}${S}${a}${_}`}function plainString(e,r,i,a){let{type:o,value:s}=e,{actualString:c,implicitKey:l,indent:u,indentStep:d,inFlow:p}=r;if(l&&s.includes(`
|
|
352
|
+
`)||p&&/[[\]{},]/.test(s))return quotedString(s,r);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||p||!s.includes(`
|
|
353
|
+
`)?quotedString(s,r):blockString(e,r,i,a);if(!l&&!p&&o!==t.Scalar.PLAIN&&s.includes(`
|
|
354
|
+
`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let m=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(m),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?m:n.foldFlowLines(m,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),Ao=__commonJSMin((e=>{var t=bo(),n=Z(),r=Do(),i=ko();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),jo=__commonJSMin((e=>{var t=Z(),n=Q(),r=Ao(),i=Do();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:p,options:{commentString:m,indentSeq:h,simpleKeys:g}}=o,_=t.isNode(e)&&e.comment||null;if(g){if(_)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let v=!g&&(!e||_&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!v&&(g||!l),indent:d+p});let y=!1,b=!1,x=r.stringify(e,o,()=>y=!0,()=>b=!0);if(!v&&!o.inFlow&&x.length>1024){if(g)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);v=!0}if(o.inFlow){if(l||a==null)return y&&s&&s(),x===``?`?`:v?`? ${x}`:x}else if(l&&!g||a==null&&v)return x=`? ${x}`,_&&!y?x+=i.lineComment(x,o.indent,m(_)):b&&c&&c(),x;y&&(_=null),v?(_&&(x+=i.lineComment(x,o.indent,m(_))),x=`? ${x}\n${d}:`):(x=`${x}:`,_&&(x+=i.lineComment(x,o.indent,m(_))));let S,C,w;t.isNode(a)?(S=!!a.spaceBefore,C=a.commentBefore,w=a.comment):(S=!1,C=null,w=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!v&&!_&&t.isScalar(a)&&(o.indentAtStart=x.length+1),b=!1,!h&&p.length>=2&&!o.inFlow&&!v&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let ee=!1,T=r.stringify(a,o,()=>ee=!0,()=>b=!0),E=` `;if(_||S||C){if(E=S?`
|
|
355
|
+
`:``,C){let e=m(C);E+=`\n${i.indentComment(e,o.indent)}`}T===``&&!o.inFlow?E===`
|
|
356
|
+
`&&w&&(E=`
|
|
357
|
+
|
|
358
|
+
`):E+=`\n${o.indent}`}else if(!v&&t.isCollection(a)){let e=T[0],t=T.indexOf(`
|
|
359
|
+
`),n=t!==-1,r=o.inFlow??a.flow??a.items.length===0;if(n||!r){let r=!1;if(n&&(e===`&`||e===`!`)){let n=T.indexOf(` `);e===`&`&&n!==-1&&n<t&&T[n+1]===`!`&&(n=T.indexOf(` `,n+1)),(n===-1||t<n)&&(r=!0)}r||(E=`\n${o.indent}`)}}else(T===``||T[0]===`
|
|
360
|
+
`)&&(E=``);return x+=E+T,o.inFlow?ee&&s&&s():w&&!ee?x+=i.lineComment(x,o.indent,m(w)):b&&c&&c(),x}e.stringifyPair=stringifyPair})),Mo=__commonJSMin((e=>{var t=D(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),No=__commonJSMin((e=>{var t=Z(),n=Q();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),Po=__commonJSMin((e=>{var t=Mo(),n=No(),r=Ao(),i=Z(),a=So();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),Fo=__commonJSMin((e=>{var t=To(),n=jo(),r=Po(),i=Z();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),Io=__commonJSMin((e=>{var t=Z(),n=Ao(),r=Do();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:p}}=a,m=Object.assign({},a,{indent:c,type:null}),h=!1,g=[];for(let e=0;e<i.length;++e){let s=i[e],l=null;if(t.isNode(s))!h&&s.spaceBefore&&g.push(``),addCommentBefore(a,g,s.commentBefore,h),s.comment&&(l=s.comment);else if(t.isPair(s)){let e=t.isNode(s.key)?s.key:null;e&&(!h&&e.spaceBefore&&g.push(``),addCommentBefore(a,g,e.commentBefore,h))}h=!1;let u=n.stringify(s,m,()=>l=null,()=>h=!0);l&&(u+=r.lineComment(u,c,p(l))),h&&l&&(h=!1),g.push(o+u)}let _;if(g.length===0)_=s.start+s.end;else{_=g[0];for(let e=1;e<g.length;++e){let t=g[e];_+=t?`\n${d}${t}`:`
|
|
361
|
+
`}}return e?(_+=`
|
|
362
|
+
`+r.indentComment(p(e),d),u&&u()):h&&l&&l(),_}function stringifyFlowCollection({items:e},i,{flowChars:a,itemIndent:o}){let{indent:s,indentStep:c,flowCollectionPadding:l,options:{commentString:u}}=i;o+=c;let d=Object.assign({},i,{indent:o,inFlow:!0,type:null}),p=!1,m=0,h=[];for(let a=0;a<e.length;++a){let s=e[a],c=null;if(t.isNode(s))s.spaceBefore&&h.push(``),addCommentBefore(i,h,s.commentBefore,!1),s.comment&&(c=s.comment);else if(t.isPair(s)){let e=t.isNode(s.key)?s.key:null;e&&(e.spaceBefore&&h.push(``),addCommentBefore(i,h,e.commentBefore,!1),e.comment&&(p=!0));let n=t.isNode(s.value)?s.value:null;n?(n.comment&&(c=n.comment),n.commentBefore&&(p=!0)):s.value==null&&e?.comment&&(c=e.comment)}c&&(p=!0);let l=n.stringify(s,d,()=>c=null);p||=h.length>m||l.includes(`
|
|
363
|
+
`),a<e.length-1?l+=`,`:i.options.trailingComma&&(i.options.lineWidth>0&&(p||=h.reduce((e,t)=>e+t.length+2,2)+(l.length+2)>i.options.lineWidth),p&&(l+=`,`)),c&&(l+=r.lineComment(l,o,u(c))),h.push(l),m=h.length}let{start:g,end:_}=a;if(h.length===0)return g+_;if(!p){let e=h.reduce((e,t)=>e+t.length+2,2);p=i.options.lineWidth>0&&e>i.options.lineWidth}if(p){let e=g;for(let t of h)e+=t?`\n${c}${s}${t}`:`
|
|
364
|
+
`;return`${e}\n${s}${_}`}return`${g}${l}${h.join(` `)}${l}${_}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),Lo=__commonJSMin((e=>{var t=Io(),n=Po(),r=Eo(),i=Z(),a=Fo(),o=Q();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}var YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}};e.YAMLMap=YAMLMap,e.findPair=findPair})),Ro=__commonJSMin((e=>{var t=Z(),n=Lo();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),zo=__commonJSMin((e=>{var t=To(),n=Io(),r=Eo(),i=Z(),a=Q(),o=So(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=asItemIndex(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];i.isScalar(r)&&a.isScalarValue(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(o.toJS(e,String(r++),t));return n}toString(e,t,r){return e?n.stringifyCollection(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:r,onComment:t}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,a=new this(e);if(n&&Symbol.iterator in Object(n)){let e=0;for(let o of n){if(typeof i==`function`){let t=n instanceof Set?o:String(e++);o=i.call(n,t,o)}a.items.push(t.createNode(o,void 0,r))}}return a}};function asItemIndex(e){let t=i.isScalar(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}e.YAMLSeq=YAMLSeq})),Bo=__commonJSMin((e=>{var t=Z(),n=zo();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),Vo=__commonJSMin((e=>{var t=ko();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),Ho=__commonJSMin((e=>{var t=Q();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),Uo=__commonJSMin((e=>{var t=Q();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),Wo=__commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),Go=__commonJSMin((e=>{var t=Q(),n=Wo();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),Ko=__commonJSMin((e=>{var t=Wo();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),qo=__commonJSMin((e=>{var t=Ro(),n=Ho(),r=Bo(),i=Vo(),a=Uo(),o=Go(),s=Ko();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),Jo=__commonJSMin((e=>{var t=Q(),n=Ro(),r=Bo();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),Yo=__commonJSMin((e=>{var t=D(`buffer`),n=Q(),r=ko();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return n(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:i,value:a},o,s,c){if(!a)return``;let l=a,u;if(typeof t.Buffer==`function`)u=l instanceof t.Buffer?l.toString(`base64`):t.Buffer.from(l.buffer).toString(`base64`);else if(typeof btoa==`function`){let e=``;for(let t=0;t<l.length;++t)e+=String.fromCharCode(l[t]);u=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(i??=n.Scalar.BLOCK_LITERAL,i!==n.Scalar.QUOTE_DOUBLE){let e=Math.max(o.options.lineWidth-o.indent.length,o.options.minContentWidth),t=Math.ceil(u.length/e),r=Array(t);for(let n=0,i=0;n<t;++n,i+=e)r[n]=u.substr(i,e);u=r.join(i===n.Scalar.BLOCK_LITERAL?`
|
|
365
|
+
`:` `)}return r.stringifyString({comment:e,type:i,value:u},o,s,c)}}})),Xo=__commonJSMin((e=>{var t=Z(),n=Fo(),r=Q(),i=zo();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a<e.items.length;++a){let o=e.items[a];if(!t.isPair(o)){if(t.isMap(o)){o.items.length>1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),Zo=__commonJSMin((e=>{var t=Z(),n=So(),r=Lo(),i=zo(),a=Xo(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),Qo=__commonJSMin((e=>{var t=Q();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),$o=__commonJSMin((e=>{var t=Q(),n=Wo();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),es=__commonJSMin((e=>{var t=Wo();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),ts=__commonJSMin((e=>{var t=Z(),n=Fo(),r=Lo(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),ns=__commonJSMin((e=>{var t=Wo();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),rs=__commonJSMin((e=>{var t=Ro(),n=Ho(),r=Bo(),i=Vo(),a=Yo(),o=Qo(),s=$o(),c=es(),l=No(),u=Zo(),d=Xo(),p=ts(),m=ns();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,p.set,m.intTime,m.floatTime,m.timestamp]})),is=__commonJSMin((e=>{var t=Ro(),n=Ho(),r=Bo(),i=Vo(),a=Uo(),o=Go(),s=Ko(),c=qo(),l=Jo(),u=Yo(),d=No(),p=Zo(),m=Xo(),h=rs(),g=ts(),_=ns();let v=new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,h.schema],[`yaml-1.1`,h.schema]]),y={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:_.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:_.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:p.omap,pairs:m.pairs,seq:r.seq,set:g.set,timestamp:_.timestamp},b={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":p.omap,"tag:yaml.org,2002:pairs":m.pairs,"tag:yaml.org,2002:set":g.set,"tag:yaml.org,2002:timestamp":_.timestamp};function getTags(e,t,n){let r=v.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(v.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?y[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(y).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=b,e.getTags=getTags})),as=__commonJSMin((e=>{var t=Z(),n=Ro(),r=Bo(),i=Vo(),a=is();let sortMapEntriesByKey=(e,t)=>e.key<t.key?-1:+(e.key>t.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),os=__commonJSMin((e=>{var t=Z(),n=Ao(),r=Do();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(`
|
|
366
|
+
`)?(a.push(`...`),a.push(r.indentComment(t,``))):a.push(`... ${t}`)}else a.push(`...`)}else{let t=e.comment;t&&l&&(t=t.replace(/^\n+/,``)),t&&((!l||u)&&a[a.length-1]!==``&&a.push(``),a.push(r.indentComment(c(t),``)))}return a.join(`
|
|
367
|
+
`)+`
|
|
368
|
+
`}e.stringifyDocument=stringifyDocument})),ss=__commonJSMin((e=>{var t=wo(),n=Eo(),r=Z(),i=Fo(),a=So(),o=as(),s=os(),c=bo(),l=xo(),u=To(),d=yo(),p=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let keyToStr=e=>typeof e==`number`||e instanceof String||e instanceof Number,e=t.filter(keyToStr).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:p}=n??{},{onAnchor:m,setAnchors:h,sourceObjects:g}=c.createNodeAnchors(this,o||`a`),_={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:m,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:g},v=u.createNode(e,p,_);return s&&r.isCollection(v)&&(v.flow=!0),h(),v}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=p})),cs=__commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};let prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
|
|
369
|
+
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=prettifyError})),ls=__commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,p=``,m=!1,h=!1,g=null,_=null,v=null,y=null,b=null,x=null,S=null;for(let i of e)switch(h&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),g&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(g,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(g=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=p+e:d=e,p=``,l=!1;break}case`newline`:l?d?d+=i.source:(!x||n!==`seq-item-ind`)&&(c=!0):p+=i.source,l=!0,m=!0,(_||v)&&(y=i),u=!0;break;case`anchor`:_&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),_=i,S??=i.offset,l=!1,u=!1,h=!0;break;case`tag`:v&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),v=i,S??=i.offset,l=!1,u=!1,h=!0;break;case n:(_||v)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),x&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),x=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),b=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let C=e[e.length-1],w=C?C.offset+C.source.length:i;return h&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),g&&(l&&g.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(g,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:b,found:x,spaceBefore:c,comment:d,hasNewline:m,anchor:_,tag:v,newlineAfterProp:y,end:w,start:S??w}}e.resolveProps=resolveProps})),us=__commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
|
|
370
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),ds=__commonJSMin((e=>{var t=us();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),fs=__commonJSMin((e=>{var t=Z();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),ps=__commonJSMin((e=>{var t=Fo(),n=Lo(),r=ls(),i=us(),a=ds(),o=fs();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,p){let m=new((p?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let h=u.offset,g=null;for(let n of u.items){let{start:p,key:_,sep:v,value:y}=n,b=r.resolveProps(p,{indicator:`explicit-key-ind`,next:_??v?.[0],offset:h,onError:d,parentIndent:u.indent,startOnNewline:!0}),x=!b.found;if(x){if(_&&(_.type===`block-seq`?d(h,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in _&&_.indent!==u.indent&&d(h,`BAD_INDENT`,s)),!b.anchor&&!b.tag&&!v){g=b.end,b.comment&&(m.comment?m.comment+=`
|
|
371
|
+
`+b.comment:m.comment=b.comment);continue}(b.newlineAfterProp||i.containsNewline(_))&&d(_??p[p.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else b.found?.indent!==u.indent&&d(h,`BAD_INDENT`,s);l.atKey=!0;let S=b.end,C=_?e(l,_,b,d):c(l,S,p,null,b,d);l.schema.compat&&a.flowIndentCheck(u.indent,_,d),l.atKey=!1,o.mapIncludes(l,m.items,C)&&d(S,`DUPLICATE_KEY`,`Map keys must be unique`);let w=r.resolveProps(v??[],{indicator:`map-value-ind`,next:y,offset:C.range[2],onError:d,parentIndent:u.indent,startOnNewline:!_||_.type===`block-scalar`});if(h=w.end,w.found){x&&(y?.type===`block-map`&&!w.hasNewline&&d(h,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),l.options.strict&&b.start<w.found.offset-1024&&d(C.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let r=y?e(l,y,w,d):c(l,h,v,null,w,d);l.schema.compat&&a.flowIndentCheck(u.indent,y,d),h=r.range[2];let i=new t.Pair(C,r);l.options.keepSourceTokens&&(i.srcToken=n),m.items.push(i)}else{x&&d(C.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),w.comment&&(C.comment?C.comment+=`
|
|
372
|
+
`+w.comment:C.comment=w.comment);let e=new t.Pair(C);l.options.keepSourceTokens&&(e.srcToken=n),m.items.push(e)}}return g&&g<h&&d(g,`IMPOSSIBLE`,`Map comment with trailing content`),m.range=[u.offset,h,g??h],m}e.resolveBlockMap=resolveBlockMap})),ms=__commonJSMin((e=>{var t=zo(),n=ls(),r=ds();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let p=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!p.found){if(p.anchor||p.tag||c)c?.type===`block-seq`?s(p.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=p.end,p.comment&&(l.comment=p.comment);continue}}let m=c?e(a,c,p,s):i(a,p.end,t,null,p,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=m.range[2],l.items.push(m)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),hs=__commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),gs=__commonJSMin((e=>{var t=Z(),n=Fo(),r=Lo(),i=zo(),a=hs(),o=ls(),s=us(),c=fs();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,p,m,h){let g=p.start.source===`{`,_=g?`flow map`:`flow sequence`,v=new((h?.nodeClass)??(g?r.YAMLMap:i.YAMLSeq))(d.schema);v.flow=!0;let y=d.atRoot;y&&(d.atRoot=!1),d.atKey&&=!1;let b=p.offset+p.start.source.length;for(let i=0;i<p.items.length;++i){let a=p.items[i],{start:h,key:y,sep:x,value:S}=a,C=o.resolveProps(h,{flow:_,indicator:`explicit-key-ind`,next:y??x?.[0],offset:b,onError:m,parentIndent:p.indent,startOnNewline:!1});if(!C.found){if(!C.anchor&&!C.tag&&!x&&!S){i===0&&C.comma?m(C.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${_}`):i<p.items.length-1&&m(C.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${_}`),C.comment&&(v.comment?v.comment+=`
|
|
373
|
+
`+C.comment:v.comment=C.comment),b=C.end;continue}!g&&d.options.strict&&s.containsNewline(y)&&m(y,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(i===0)C.comma&&m(C.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${_}`);else if(C.comma||m(C.start,`MISSING_CHAR`,`Missing , between ${_} items`),C.comment){let e=``;loop:for(let t of h)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let n=v.items[v.items.length-1];t.isPair(n)&&(n=n.value??n.key),n.comment?n.comment+=`
|
|
374
|
+
`+e:n.comment=e,C.comment=C.comment.substring(e.length+1)}}if(!g&&!x&&!C.found){let t=S?e(d,S,C,m):u(d,C.end,x,null,C,m);v.items.push(t),b=t.range[2],isBlock(S)&&m(t.range,`BLOCK_IN_FLOW`,l)}else{d.atKey=!0;let t=C.end,i=y?e(d,y,C,m):u(d,t,h,null,C,m);isBlock(y)&&m(i.range,`BLOCK_IN_FLOW`,l),d.atKey=!1;let s=o.resolveProps(x??[],{flow:_,indicator:`map-value-ind`,next:S,offset:i.range[2],onError:m,parentIndent:p.indent,startOnNewline:!1});if(s.found){if(!g&&!C.found&&d.options.strict){if(x)for(let e of x){if(e===s.found)break;if(e.type===`newline`){m(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}C.start<s.found.offset-1024&&m(s.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else S&&(`source`in S&&S.source?.[0]===`:`?m(S,`MISSING_CHAR`,`Missing space after : in ${_}`):m(s.start,`MISSING_CHAR`,`Missing , or : between ${_} items`));let w=S?e(d,S,s,m):s.found?u(d,s.end,x,null,s,m):null;w?isBlock(S)&&m(w.range,`BLOCK_IN_FLOW`,l):s.comment&&(i.comment?i.comment+=`
|
|
375
|
+
`+s.comment:i.comment=s.comment);let ee=new n.Pair(i,w);if(d.options.keepSourceTokens&&(ee.srcToken=a),g){let e=v;c.mapIncludes(d,e.items,i)&&m(t,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(ee)}else{let e=new r.YAMLMap(d.schema);e.flow=!0,e.items.push(ee);let t=(w??i).range;e.range=[i.range[0],t[1],t[2]],v.items.push(e)}b=w?w.range[2]:s.end}}let x=g?`}`:`]`,[S,...C]=p.end,w=b;if(S?.source===x)w=S.offset+S.source.length;else{let e=_[0].toUpperCase()+_.substring(1),t=y?`${e} must end with a ${x}`:`${e} in block collection must be sufficiently indented and end with a ${x}`;m(b,y?`MISSING_CHAR`:`BAD_INDENT`,t),S&&S.source.length!==1&&C.unshift(S)}if(C.length>0){let e=a.resolveEnd(C,w,d.options.strict,m);e.comment&&(v.comment?v.comment+=`
|
|
376
|
+
`+e.comment:v.comment=e.comment),v.range=[p.offset,w,e.offset]}else v.range=[p.offset,w,w];return v}e.resolveFlowCollection=resolveFlowCollection})),_s=__commonJSMin((e=>{var t=Z(),n=Q(),r=Lo(),i=zo(),a=ps(),o=ms(),s=gs();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offset<n.offset)&&c(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let d=o.type===`block-map`?`map`:o.type===`block-seq`?`seq`:o.start.source===`{`?`map`:`seq`;if(!l||!u||u===`!`||u===r.YAMLMap.tagName&&d===`map`||u===i.YAMLSeq.tagName&&d===`seq`)return resolveCollection(e,a,o,c,u);let p=a.schema.tags.find(e=>e.tag===u&&e.collection===d);if(!p){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),p=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let m=resolveCollection(e,a,o,c,u,p),h=p.resolve?.(m,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??m,g=t.isNode(h)?h:new n.Scalar(h);return g.range=m.range,g.tag=u,p?.format&&(g.format=p.format),g}e.composeCollection=composeCollection})),vs=__commonJSMin((e=>{var t=Q();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?`
|
|
377
|
+
`.repeat(Math.max(1,s.length-1)):``,t=i+a.length;return n.source&&(t+=n.source.length),{value:e,type:o,comment:a.comment,range:[i,t,t]}}let l=n.indent+a.indent,u=n.offset+a.length,d=0;for(let t=0;t<c;++t){let[n,i]=s[t];if(i===``||i===`\r`)a.indent===0&&n.length>l&&(l=n.length);else{n.length<l&&r(u+n.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),a.indent===0&&(l=n.length),d=t,l===0&&!e.atRoot&&r(u,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}u+=n.length+i.length+1}for(let e=s.length-1;e>=c;--e)s[e][0].length>l&&(c=e+1);let p=``,m=``,h=!1;for(let e=0;e<d;++e)p+=s[e][0].slice(l)+`
|
|
378
|
+
`;for(let e=d;e<c;++e){let[n,i]=s[e];u+=n.length+i.length+1;let c=i[i.length-1]===`\r`;if(c&&(i=i.slice(0,-1)),i&&n.length<l){let e=`Block scalar lines must not be less indented than their ${a.indent?`explicit indentation indicator`:`first line`}`;r(u-i.length-(c?2:1),`BAD_INDENT`,e),n=``}o===t.Scalar.BLOCK_LITERAL?(p+=m+n.slice(l)+i,m=`
|
|
379
|
+
`):n.length>l||i[0]===` `?(m===` `?m=`
|
|
380
|
+
`:!h&&m===`
|
|
381
|
+
`&&(m=`
|
|
382
|
+
|
|
383
|
+
`),p+=m+n.slice(l)+i,m=`
|
|
384
|
+
`,h=!0):i===``?m===`
|
|
385
|
+
`?p+=`
|
|
386
|
+
`:m=`
|
|
387
|
+
`:(p+=m+i,m=` `,h=!1)}switch(a.chomp){case`-`:break;case`+`:for(let e=c;e<s.length;++e)p+=`
|
|
388
|
+
`+s[e][0].slice(l);p[p.length-1]!==`
|
|
389
|
+
`&&(p+=`
|
|
390
|
+
`);break;default:p+=`
|
|
391
|
+
`}let g=i+a.length+n.source.length;return{value:p,type:o,comment:a.comment,range:[i,g,g]}}function parseBlockScalarHeader({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function splitLines(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}e.resolveBlockScalar=resolveBlockScalar})),ys=__commonJSMin((e=>{var t=Q(),n=hs();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break;default:return i(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${o}`),{value:``,type:null,comment:``,range:[a,a+s.length,a+s.length]}}let d=a+s.length,p=n.resolveEnd(c,d,r,i);return{value:u,type:l,comment:p.comment,range:[a,d,p.offset]}}function plainValue(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),foldLines(e)}function singleQuotedValue(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),foldLines(e.slice(1,-1)).replace(/''/g,`'`)}function foldLines(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
392
|
+
`,`sy`),n=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
393
|
+
`,`sy`)}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],a=` `,o=t.lastIndex;for(n.lastIndex=o;r=n.exec(e);)r[1]===``?a===`
|
|
394
|
+
`?i+=a:a=`
|
|
395
|
+
`:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function doubleQuotedValue(e,t){let n=``;for(let i=1;i<e.length-1;++i){let a=e[i];if(a!==`\r`||e[i+1]!==`
|
|
396
|
+
`){if(a===`
|
|
397
|
+
`){let{fold:t,offset:r}=foldNewline(e,i);n+=t,i=r}else if(a===`\\`){let a=e[++i],o=r[a];if(o)n+=o;else if(a===`
|
|
398
|
+
`)for(a=e[i+1];a===` `||a===` `;)a=e[++i+1];else if(a===`\r`&&e[i+1]===`
|
|
399
|
+
`)for(a=e[++i+1];a===` `||a===` `;)a=e[++i+1];else if(a===`x`||a===`u`||a===`U`){let r=a===`x`?2:a===`u`?4:8;n+=parseCharCode(e,i+1,r,t),i+=r}else{let r=e.substr(i-1,2);t(i-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${r}`),n+=r}}else if(a===` `||a===` `){let t=i,r=e[i+1];for(;r===` `||r===` `;)r=e[++i+1];r!==`
|
|
400
|
+
`&&(r!==`\r`||e[i+2]!==`
|
|
401
|
+
`)&&(n+=i>t?e.slice(t,i+1):a)}else n+=a}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function foldNewline(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
|
|
402
|
+
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
|
|
403
|
+
`);)r===`
|
|
404
|
+
`&&(n+=`
|
|
405
|
+
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}let r={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
406
|
+
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function parseCharCode(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}e.resolveFlowScalar=resolveFlowScalar})),bs=__commonJSMin((e=>{var t=Z(),n=Q(),r=vs(),i=ys();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),p=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,m;m=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:p?findScalarTagByName(e.schema,c,p,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let h;try{let r=m.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);h=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),h=new n.Scalar(c)}return h.range=d,h.source=c,l&&(h.type=l),p&&(h.tag=p),m.format&&(h.format=m.format),u&&(h.comment=u),h}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),xs=__commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),Ss=__commonJSMin((e=>{var t=wo(),n=Z(),r=_s(),i=bs(),a=hs(),o=xs();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:p}=a,m,h=!0;switch(t.type){case`alias`:m=composeAlias(e,t,o),(d||p)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:m=i.composeScalar(e,t,p,o),d&&(m.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{m=r.composeCollection(s,e,t,a,o),d&&(m.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),h=!1}return m??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&m.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(m)||typeof m.value!=`string`||m.tag&&m.tag!==`tag:yaml.org,2002:str`)&&o(p??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(m.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?m.comment=u:m.commentBefore=u),e.options.keepSourceTokens&&h&&(m.srcToken=t),m}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let p={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},m=i.composeScalar(e,p,l,d);return c&&(m.anchor=c.source.substring(1),m.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(m.spaceBefore=!0),s&&(m.comment=s,m.range[2]=u),m}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Cs=__commonJSMin((e=>{var t=ss(),n=Ss(),r=hs(),i=ls();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),p=new t.Document(void 0,d),m={atKey:!1,atRoot:!0,directives:p.directives,options:p.options,schema:p.schema},h=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});h.found&&(p.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!h.hasNewline&&u(h.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),p.contents=c?n.composeNode(m,c,h,u):n.composeEmptyNode(m,h.end,s,null,h,u);let g=p.contents.range[2],_=r.resolveEnd(l,g,!1,u);return _.comment&&(p.comment=_.comment),p.range=[o,g,_.offset],p}e.composeDoc=composeDoc})),ws=__commonJSMin((e=>{var t=D(`process`),n=yo(),r=ss(),i=cs(),a=Z(),o=Cs(),s=hs();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
|
|
407
|
+
|
|
408
|
+
`:`
|
|
409
|
+
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Composer=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:parsePrelude(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(t.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}};e.Composer=Composer})),Ts=__commonJSMin((e=>{var t=vs(),n=ys(),r=cs(),i=ko();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:`
|
|
410
|
+
`}];switch(c[0]){case`|`:case`>`:{let e=c.indexOf(`
|
|
411
|
+
`),t=c.substring(0,e),n=c.substring(e+1)+`
|
|
412
|
+
`,i=[{type:`block-scalar-header`,offset:o,indent:r,source:t}];return addEndtoBlockProps(i,l)||i.push({type:`newline`,offset:-1,indent:r,source:`
|
|
413
|
+
`}),{type:`block-scalar`,offset:o,indent:r,props:i,source:n}}case`"`:return{type:`double-quoted-scalar`,offset:o,indent:r,source:c,end:l};case`'`:return{type:`single-quoted-scalar`,offset:o,indent:r,source:c,end:l};default:return{type:`scalar`,offset:o,indent:r,source:c,end:l}}}function setScalarValue(e,t,n={}){let{afterKey:r=!1,implicitKey:a=!1,inFlow:o=!1,type:s}=n,c=`indent`in e?e.indent:null;if(r&&typeof c==`number`&&(c+=2),!s)switch(e.type){case`single-quoted-scalar`:s=`QUOTE_SINGLE`;break;case`double-quoted-scalar`:s=`QUOTE_DOUBLE`;break;case`block-scalar`:{let t=e.props[0];if(t.type!==`block-scalar-header`)throw Error(`Invalid block scalar header`);s=t.source[0]===`>`?`BLOCK_FOLDED`:`BLOCK_LITERAL`;break}default:s=`PLAIN`}let l=i.stringifyString({type:s,value:t},{implicitKey:a||c===null,indent:c!==null&&c>0?` `.repeat(c):``,inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case`|`:case`>`:setBlockScalarValue(e,l);break;case`"`:setFlowScalarValue(e,l,`double-quoted-scalar`);break;case`'`:setFlowScalarValue(e,l,`single-quoted-scalar`);break;default:setFlowScalarValue(e,l,`scalar`)}}function setBlockScalarValue(e,t){let n=t.indexOf(`
|
|
414
|
+
`),r=t.substring(0,n),i=t.substring(n+1)+`
|
|
415
|
+
`;if(e.type===`block-scalar`){let t=e.props[0];if(t.type!==`block-scalar-header`)throw Error(`Invalid block scalar header`);t.source=r,e.source=i}else{let{offset:t}=e,n=`indent`in e?e.indent:-1,a=[{type:`block-scalar-header`,offset:t,indent:n,source:r}];addEndtoBlockProps(a,`end`in e?e.end:void 0)||a.push({type:`newline`,offset:-1,indent:n,source:`
|
|
416
|
+
`});for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:`block-scalar`,indent:n,props:a,source:i})}}function addEndtoBlockProps(e,t){if(t)for(let n of t)switch(n.type){case`space`:case`comment`:e.push(n);break;case`newline`:return e.push(n),!0}return!1}function setFlowScalarValue(e,t,n){switch(e.type){case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:e.type=n,e.source=t;break;case`block-scalar`:{let r=e.props.slice(1),i=t.length;e.props[0].type===`block-scalar-header`&&(i-=e.props[0].source.length);for(let e of r)e.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case`block-map`:case`block-seq`:{let r={type:`newline`,offset:e.offset+t.length,indent:e.indent,source:`
|
|
417
|
+
`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let r=`indent`in e?e.indent:-1,i=`end`in e&&Array.isArray(e.end)?e.end.filter(e=>e.type===`space`||e.type===`comment`||e.type===`newline`):[];for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}e.createScalarToken=createScalarToken,e.resolveAsScalar=resolveAsScalar,e.setScalarValue=setScalarValue})),Es=__commonJSMin((e=>{let stringify=e=>`type`in e?stringifyToken(e):stringifyItem(e);function stringifyToken(e){switch(e.type){case`block-scalar`:{let t=``;for(let n of e.props)t+=stringifyToken(n);return t+e.source}case`block-map`:case`block-seq`:{let t=``;for(let n of e.items)t+=stringifyItem(n);return t}case`flow-collection`:{let t=e.start.source;for(let n of e.items)t+=stringifyItem(n);for(let n of e.end)t+=n.source;return t}case`document`:{let t=stringifyItem(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if(`end`in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function stringifyItem({start:e,key:t,sep:n,value:r}){let i=``;for(let t of e)i+=t.source;if(t&&(i+=stringifyToken(t)),n)for(let e of n)i+=e.source;return r&&(i+=stringifyToken(r)),i}e.stringify=stringify})),Ds=__commonJSMin((e=>{let t=Symbol(`break visit`),n=Symbol(`skip children`),r=Symbol(`remove item`);function visit(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),_visit(Object.freeze([]),e,t)}visit.BREAK=t,visit.SKIP=n,visit.REMOVE=r,visit.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},visit.parentCollection=(e,t)=>{let n=visit.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function _visit(e,n,i){let a=i(n,e);if(typeof a==`symbol`)return a;for(let o of[`key`,`value`]){let s=n[o];if(s&&`items`in s){for(let n=0;n<s.items.length;++n){let a=_visit(Object.freeze(e.concat([[o,n]])),s.items[n],i);if(typeof a==`number`)n=a-1;else if(a===t)return t;else a===r&&(s.items.splice(n,1),--n)}typeof a==`function`&&o===`key`&&(a=a(n,e))}}return typeof a==`function`?a(n,e):a}e.visit=visit})),Os=__commonJSMin((e=>{var t=Ts(),n=Es(),r=Ds();let isCollection=e=>!!e&&`items`in e,isScalar=e=>!!e&&(e.type===`scalar`||e.type===`single-quoted-scalar`||e.type===`double-quoted-scalar`||e.type===`block-scalar`);function prettyToken(e){switch(e){case``:return`<BOM>`;case``:return`<DOC>`;case``:return`<FLOW_END>`;case``:return`<SCALAR>`;default:return JSON.stringify(e)}}function tokenType(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
|
|
418
|
+
`:case`\r
|
|
419
|
+
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}e.createScalarToken=t.createScalarToken,e.resolveAsScalar=t.resolveAsScalar,e.setScalarValue=t.setScalarValue,e.stringify=n.stringify,e.visit=r.visit,e.BOM=``,e.DOCUMENT=``,e.FLOW_END=``,e.SCALAR=``,e.isCollection=isCollection,e.isScalar=isScalar,e.prettyToken=prettyToken,e.tokenType=tokenType})),ks=__commonJSMin((e=>{var t=Os();function isEmpty(e){switch(e){case void 0:case` `:case`
|
|
420
|
+
`:case`\r`:case` `:return!0;default:return!1}}let n=new Set(`0123456789ABCDEFabcdef`),r=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),i=new Set(`,[]{}`),a=new Set(` ,[]{}
|
|
421
|
+
\r `),isNotAnchorChar=e=>!e||a.has(e);var Lexer=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
|
|
422
|
+
`||t===`\r`&&this.buffer[e+1]===`
|
|
423
|
+
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
|
|
424
|
+
`||!t&&!this.atEnd)return e+n+1}return t===`
|
|
425
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&isEmpty(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
426
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===t.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield t.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&isEmpty(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!isEmpty(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&isEmpty(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(isNotAnchorChar),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext(`flow`);if((r!==-1&&r<this.indentNext&&i[0]!==`#`||r===0&&(i.startsWith(`---`)||i.startsWith(`...`))&&isEmpty(i[3]))&&(r!==this.indentNext-1||this.flowLevel!==1||i[0]!==`]`&&i[0]!==`}`))return this.flowLevel=0,yield t.FLOW_END,yield*this.parseLineStart();let a=0;for(;i[a]===`,`;)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),i[a]){case void 0:return`flow`;case`#`:return yield*this.pushCount(i.length-a),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(isNotAnchorChar),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||isEmpty(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
|
|
427
|
+
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
|
|
428
|
+
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>isEmpty(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,n=0,r;loop:for(let t=this.pos;r=this.buffer[t];++t)switch(r){case` `:n+=1;break;case`
|
|
429
|
+
`:e=t,n=0;break;case`\r`:{let e=this.buffer[t+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
|
|
430
|
+
`)break}default:break loop}if(!r&&!this.atEnd)return this.setNext(`block-scalar`);if(n>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?n:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
|
|
431
|
+
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let i=e+1;for(r=this.buffer[i];r===` `;)r=this.buffer[++i];if(r===` `){for(;r===` `||r===` `||r===`\r`||r===`
|
|
432
|
+
`;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let t=e-1,r=this.buffer[t];r===`\r`&&(r=this.buffer[--t]);let i=t;for(;r===` `;)r=this.buffer[--t];if(r===`
|
|
433
|
+
`&&t>=this.pos&&t+1+n>i)e=t;else break}while(1);return yield t.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,a;for(;a=this.buffer[++r];)if(a===`:`){let t=this.buffer[r+1];if(isEmpty(t)||e&&i.has(t))break;n=r}else if(isEmpty(a)){let t=this.buffer[r+1];if(a===`\r`&&(t===`
|
|
434
|
+
`?(r+=1,a=`
|
|
435
|
+
`,t=this.buffer[r+1]):n=r),t===`#`||e&&i.has(t))break;if(a===`
|
|
436
|
+
`){let e=this.continueScalar(r+1);if(e===-1)break;r=Math.max(r,e-2)}}else{if(e&&i.has(a))break;n=r}return!a&&!this.atEnd?this.setNext(`plain-scalar`):(yield t.SCALAR,yield*this.pushToIndex(n+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(isNotAnchorChar),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(isEmpty(n)||t&&i.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!isEmpty(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(r.has(t))t=this.buffer[++e];else if(t===`%`&&n.has(this.buffer[e+1])&&n.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
437
|
+
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
|
|
438
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};e.Lexer=Lexer})),As=__commonJSMin((e=>{var LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};e.LineCounter=LineCounter})),js=__commonJSMin((e=>{var t=D(`process`),n=Os(),r=ks();function includesToken(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function findNonEmptyIndex(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function isFlowToken(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function getPrevProps(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function getFirstKeyStartProps(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function arrayPushArray(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function fixFlowSeqItems(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!includesToken(t.start,`explicit-key-ind`)&&!includesToken(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,isFlowToken(t.value)?t.value.end?arrayPushArray(t.value.end,t.sep):t.value.end=t.sep:arrayPushArray(t.start,t.sep),delete t.sep)}var Parser=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new r.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,t.env.LOG_TOKENS&&console.log(`|`,n.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=n.tokenType(e);if(!r){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(r===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=r,yield*this.step(),r){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&fixFlowSeqItems(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&findNonEmptyIndex(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:findNonEmptyIndex(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=getFirstKeyStartProps(getPrevProps(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
|
|
439
|
+
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
440
|
+
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){arrayPushArray(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(includesToken(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=getFirstKeyStartProps(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(includesToken(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(isFlowToken(t.key)&&!includesToken(t.sep,`newline`)){let e=getFirstKeyStartProps(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):includesToken(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!includesToken(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){arrayPushArray(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||includesToken(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
441
|
+
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
442
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};e.Parser=Parser})),Ms=__commonJSMin((e=>{var t=ws(),n=ss(),r=cs(),i=Mo(),a=Z(),o=As(),s=js();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Ns=__commonJSMin((e=>{var t=ws(),n=ss(),r=as(),i=cs(),a=wo(),o=Z(),s=Fo(),c=Q(),l=Lo(),u=zo();Os();var d=ks(),p=As(),m=js(),h=Ms(),g=vo();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=p.LineCounter,e.Parser=m.Parser,e.parse=h.parse,e.parseAllDocuments=h.parseAllDocuments,e.parseDocument=h.parseDocument,e.stringify=h.stringify,e.visit=g.visit,e.visitAsync=g.visitAsync}))();const Ps=[`first-wins`,`combine`,`merge-sections`],Fs=/^---[ \t]*\r?\n([\s\S]*?)\r?\n(?:---|\.\.\.)[ \t]*(?:\r?\n|$)/;function parseDocument(e,t){let n=Fs.exec(e);if(!n)return{metadata:{},body:e};let r=e.slice(n[0].length);try{let e=(0,Ns.parse)(n[1]);if(e==null)return{metadata:{},body:r};if(isRecord$1(e))return{metadata:e,body:r}}catch{}return t(`frontmatter is not a YAML mapping; it is ignored`),{metadata:{},body:r}}function readMergeMode(e,t){let n=e.merge;return n===void 0?`first-wins`:Ps.includes(n)?n:(t(`unknown merge mode "${String(n)}"; read as first-wins`),`first-wins`)}const Is=/^\s*<!--\s*merge:\s*([\w-]*)\s*-->\s*$/,Ls=/^ {0,3}(#{1,6})(?:[ \t]+(.*?))?(?:[ \t]+#+)?[ \t]*$/,Rs=/^ {0,3}(`{3,}|~{3,})/;function fenceTracker(){let e;return t=>{if(e)return RegExp(`^ {0,3}${e[0]==="`"?"`":`~`}{${e.length},}\\s*$`).test(t)&&(e=void 0),!0;let n=Rs.exec(t);return n?(e=n[1],!0):!1}}function stripMergeComments(e){let t=fenceTracker();return e.split(`
|
|
443
|
+
`).filter(e=>t(e)||!Is.test(e)).join(`
|
|
444
|
+
`)}function sectionKey(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function displayHeading(e){return`${`#`.repeat(e.level)} ${e.title}`}function parseSections(e,t){let n={preamble:[],children:[]},r=[],i=fenceTracker(),a;for(let o of e.split(`
|
|
445
|
+
`)){let e=r.at(-1),s=i(o),c=s?null:Ls.exec(o);if(c){let e=c[1].length,t={level:e,title:(c[2]??``).trim(),heading:o.trimEnd(),op:`replace`,body:[],children:[]};for(;(r.at(-1)?.level??0)>=e;)r.pop();(r.at(-1)?.children??n.children).push(t),r.push(t),a=t;continue}if(a&&!s){if(!o.trim())continue;let e=Is.exec(o);if(e){let n=e[1];n===`replace`||n===`combine`||n===`remove`?a.op=n:t(`unknown section merge "${n}" under "${displayHeading(a)}"; read as replace`),a=void 0;continue}}a=void 0,(e?.body??n.preamble).push(o)}return n}function trimBlank(e){let t=0,n=e.length;for(;t<n&&!e[t].trim();)t++;for(;n>t&&!e[n-1].trim();)n--;return e.slice(t,n)}function warnDuplicates(e,t,n,r){let i=new Set;for(let a of e){let e=sectionKey(a.title);i.has(e)&&r(`heading path "${t}${displayHeading(a)}" appears more than once in ${n}; the first is matched`),i.add(e)}}function warnUnmatched(e,t,n,r){r(`"<!-- merge: ${e.op} -->" on "${t}${displayHeading(e)}" in ${n} matches no section below`)}function place(e,t,n,r){let i=`${t}${displayHeading(e)} > `,a=e.children.flatMap(e=>(e.op!==`replace`&&warnUnmatched(e,i,n,r),e.op===`remove`?[]:[place(e,i,n,r)]));return{...e,children:a}}function mergeChildren(e,t,n,r,i){warnDuplicates(e,n,`the layers below`,i),warnDuplicates(t,n,r,i);let a=[...e],o=[],s=new Set;for(let c of t){let t=sectionKey(c.title),l=e.findIndex((e,n)=>!s.has(n)&§ionKey(e.title)===t);if(l===-1){c.op!==`replace`&&warnUnmatched(c,n,r,i),c.op!==`remove`&&o.push(place(c,n,r,i));continue}for(let n=0;n<e.length;n++)sectionKey(e[n].title)===t&&s.add(n);let u=e[l];if(c.op===`remove`)a[l]=void 0;else if(c.op===`combine`){let e=trimBlank(u.body),t=trimBlank(c.body);a[l]={...u,body:e.length&&t.length?[...e,``,...t]:[...e,...t],children:mergeChildren(u.children,c.children,`${n}${displayHeading(u)} > `,r,i)}}else a[l]=place(c,n,r,i)}return[...a.filter(e=>e!==void 0),...o]}function mergeSections(e,t,n,r){let i=trimBlank(t.preamble);return{preamble:i.length?i:e.preamble,children:mergeChildren(e.children,t.children,``,n,r)}}function renderSections(e){let t=[],n=trimBlank(e.preamble);n.length&&t.push(n.join(`
|
|
446
|
+
`));let visit=e=>{let n=trimBlank(e.body);t.push(n.length?`${e.heading}\n\n${n.join(`
|
|
447
|
+
`)}`:e.heading);for(let t of e.children)visit(t)};for(let t of e.children)visit(t);return`${t.join(`
|
|
448
|
+
|
|
449
|
+
`)}\n`}const zs=/^[a-z0-9]+(?:[-.][a-z0-9]+)*$/i,Bs=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i;function parseReferenceName(e){if(e.endsWith(`.md`))throw Error(`"${e}" names a file. Ask for the reference by name, without the .md extension.`);let t=e.lastIndexOf(`/`),n=t===-1?e:e.slice(t+1),r=t===-1?void 0:e.slice(0,t);if(!zs.test(n)||r!==void 0&&!Bs.test(r))throw Error(`"${e}" is not a reference name. A name is letters, digits, hyphens, and dots, optionally after "<plugin>/" — not a path.`);return{name:n,plugin:r,raw:e}}const Vs=[`README.md`,`index.md`,`SKILL.md`];function candidateFiles(e){return[`${e}.md`,...Vs.map(t=>`${e}/${t}`)]}function tryRead(e){try{return o(e,`utf8`)}catch{return}}function pluginLabel(e){return e.plugins[0]??``}function layerName(e){return e.tier===`plugin`?`plugin ${pluginLabel(e)}`:e.tier}function layersFor$2(e,t){let n=e.plugin;if(n===void 0)return[...t];let r=t.filter(e=>e.tier!==`plugin`||e.plugins.includes(n));return r.some(e=>e.tier===`plugin`)?r:[...r,{tier:`plugin`,dir:`(no dependency named ${n})`,plugins:[n],status:``}]}__name(layersFor$2,`layersFor`);function resolveReference(e,t,{display:n=e=>e}={}){let r=[],i=[],a=[];for(let o of layersFor$2(e,t)){let t={tier:o.tier,plugin:pluginLabel(o),path:o.dir,found:!1,candidate:``,merge:``,outcome:`missing`,description:``};if(i.push(t),o.skipped){t.outcome=o.skipped;continue}let[s,...c]=candidateFiles(e.name).flatMap(e=>{let t=tryRead(v(o.dir,e));return t===void 0?[]:[{candidate:e,raw:t}]});if(!s)continue;for(let e of c)r.push(`${n(v(o.dir,e.candidate))} is ignored: ${s.candidate} answers first in that folder`);let l=v(o.dir,s.candidate),warn=e=>r.push(`${n(l)}: ${e}`),{metadata:u,body:d}=parseDocument(s.raw,warn),p=readMergeMode(u,warn),m=typeof u.description==`string`?u.description:``;Object.assign(t,{path:l,found:!0,candidate:s.candidate,merge:p,outcome:``,description:m}),a.push({layer:o,entry:t,metadata:u,body:d,merge:p})}let o={name:e.raw,status:`missing`,layers:[],warnings:r,plugins:[],trace:i},s=a.findIndex(({merge:e})=>e===`first-wins`),c=s===-1?a:a.slice(0,s+1),l=s===-1?[]:a.slice(s+1),u=c.at(-1),d=[...new Set(a.filter(({layer:e})=>e.tier===`plugin`).map(({entry:e})=>e.plugin))];if(e.plugin===void 0&&d.length>1&&c.some(({layer:e})=>e.tier===`plugin`)){for(let{entry:e}of a)e.outcome=`ambiguous`;return o.status=`ambiguous`,o.plugins=d.map(t=>`${t}/${e.name}`),o}for(let e of l)e.entry.outcome=`shadowed by ${u.layer.tier} (first-wins)`;if(!u)return o;for(let{entry:e}of c)e.outcome=`used`;let p=c[0];return{...o,status:`found`,tier:p.layer.tier,plugin:p.entry.plugin,path:p.entry.path,merge:p.merge,metadata:Object.assign({},...[...c].reverse().map(({metadata:e})=>e)),content:withNewline(stripMergeComments(fold(c,n,e=>r.push(e)))),layers:c.map(({layer:e,entry:t,merge:n})=>({tier:e.tier,plugin:t.plugin,path:t.path,merge:n}))}}function fold(e,t,n){let label=({layer:e,entry:n})=>`${layerName(e)} ${t(n.path)}`,[r,...i]=[...e].reverse(),a=[{labels:[label(r)],body:r.body}];for(let e of i){if(e.merge===`combine`){a=[{labels:[label(e)],body:e.body},...a];continue}let t=mergeSections(parseSections(a.map(({body:e})=>e.trim()).join(`
|
|
450
|
+
|
|
451
|
+
`),n),parseSections(e.body,n),label(e),n);a=[{labels:[label(e),...a.flatMap(({labels:e})=>e)],body:renderSections(t)}]}return a.length===1?a[0].body:[`> Combined from ${a.length} layers, highest precedence first. Where they conflict, the first layer wins.`,...a.map(({labels:e,body:t})=>`<!-- layer: ${e.join(`, `)} -->\n\n${t.trim()}`)].join(`
|
|
452
|
+
|
|
453
|
+
`)}function withNewline(e){return e.endsWith(`
|
|
454
|
+
`)?e:`${e}\n`}function layerNames(e){let t;try{t=s(e,{withFileTypes:!0})}catch{return[]}let n=new Set;for(let r of t){let t=r.isFile()&&r.name.endsWith(`.md`)?r.name.slice(0,-3):r.name;zs.test(t)&&(r.isFile()?r.name.endsWith(`.md`):Vs.some(n=>tryRead(v(e,t,n))!==void 0))&&n.add(t)}return[...n]}function referenceNames(e){return[...new Set(e.flatMap(({dir:e,skipped:t})=>t?[]:layerNames(e)))].sort((e,t)=>e.localeCompare(t))}function listReferences(e,t={}){let n=[],r=new Set;for(let i of referenceNames(e)){let a=resolveReference(parseReferenceName(i),e,t);for(let e of a.warnings)r.add(e);for(let e of a.trace)e.found&&n.push({name:i,tier:e.tier,plugin:e.plugin,path:e.path,status:e.outcome===`ambiguous`?`ambiguous — ask for one of ${a.plugins.join(`, `)}`:e.outcome,description:e.description})}return{rows:n,warnings:[...r]}}const Hs=[`name`,`prefix`,`close name`,`description`,`heading`,`body`];function distance(e,t){let n=Array.from({length:t.length+1},(e,t)=>t);for(let r=1;r<=e.length;r++){let i=[r];for(let a=1;a<=t.length;a++){let o=n[a-1]+(e[r-1]===t[a-1]?0:1);i.push(Math.min(n[a]+1,i[a-1]+1,o))}n=i}return n[t.length]}function headings(e){let t=!1,n=[];for(let r of e.split(`
|
|
455
|
+
`))/^ {0,3}(`{3,}|~{3,})/.test(r)?t=!t:!t&&/^ {0,3}#{1,6}\s/.test(r)&&n.push(r);return n.join(`
|
|
456
|
+
`)}function tagText(e){return Array.isArray(e)?e.map(String).join(` `):typeof e==`string`?e:``}function matchKind(e,t,n){let r=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(r===n||e.toLowerCase()===n)return`name`;if(r.startsWith(n))return`prefix`;if(r.includes(n)||distance(r,n)<=Math.max(1,Math.floor(n.length/4)))return`close name`;let i=n.split(/\s+/),holds=e=>{let t=e.toLowerCase();return i.every(e=>t.includes(e))},a=t.metadata;if(holds(`${typeof a.description==`string`?a.description:``} ${tagText(a.tags)}`))return`description`;let o=t.content;if(holds(headings(o)))return`heading`;if(holds(o))return`body`}function searchReferences(e,t,n={}){let r=e.trim().toLowerCase(),i=[];for(let e of referenceNames(t)){let a=resolveReference(parseReferenceName(e),t,n),o=a.status===`ambiguous`?a.plugins.map(e=>resolveReference(parseReferenceName(e),t,n)):[a];for(let e of o.filter(({status:e})=>e===`found`)){let t=matchKind(e.name,e,r);if(!t)continue;let n=e.metadata.description;i.push({name:e.name,tier:e.tier,match:t,description:typeof n==`string`&&n.split(`
|
|
457
|
+
`)[0]?.trim()||``})}}return i.sort((e,t)=>Hs.indexOf(e.match)-Hs.indexOf(t.match)||e.name.localeCompare(t.name))}function managedGovernancesDir(e,t){return e===`darwin`?`/Library/Application Support/BuddyAgentHarness/governances`:e===`win32`?v(t||`C:\\ProgramData`,`BuddyAgentHarness`,`governances`):`/etc/buddy-agent-harness/governances`}function deprecatedManagedGovernancesDir(e,t){return e===`darwin`?`/Library/Application Support/UniPlugin/governances`:e===`win32`?v(t||`C:\\ProgramData`,`UniPlugin`,`governances`):`/etc/universal-plugin/governances`}function projectGovernancesDir(e){return v(e,`.agents`,`governances`)}function userGovernancesDir(e){return v(e,`.agents`,`governances`)}function packageGovernancesDir(e=ee(import.meta.url)){let t=g(e);for(;;){if(r(v(t,`package.json`)))return v(t,`governances`);let e=g(t);if(e===t)return v(t,`governances`);t=e}}function governanceLayers({root:e,home:t,platform:n,programData:r}){return[{scope:`project`,dir:projectGovernancesDir(e)},{scope:`user`,dir:userGovernancesDir(t)},{scope:`managed`,dir:managedGovernancesDir(n,r)},{scope:`managed-deprecated`,dir:deprecatedManagedGovernancesDir(n,r)},{scope:`package`,dir:packageGovernancesDir()}]}function overrideLayers(e){return e.filter(e=>e.scope!==`package`)}const Us=/^[a-z0-9]+(?:[-.][a-z0-9]+)*$/i;function parseGovernanceName(e){if(e.endsWith(`.md`))throw Error(`"${e}" names a file. Ask for the governance by name, without the .md extension.`);if(!Us.test(e))throw Error(`"${e}" is not a governance name. A name is letters, digits, hyphens, and dots — not a path.`);return e}function tryReadDocument(e){try{return o(e,`utf8`)}catch{return}}function documentNames(e){try{return s(e,{withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>e.name.slice(0,-3))}catch{return[]}}function resolveGovernance(e,t){for(let{scope:n,dir:r}of t){let t=v(r,`${e}.md`),i=tryReadDocument(t);if(i!==void 0)return{name:e,scope:n,path:t,content:i}}}function listGovernances(e){let t=new Map;for(let{scope:n,dir:r}of e)for(let e of documentNames(r))t.has(e)||t.set(e,{name:e,scope:n,path:v(r,`${e}.md`)});return[...t.values()].sort((e,t)=>e.name.localeCompare(t.name))}function detectedHarnesses(e){return detectHarness({env:e}).candidates}const Ws={"macos-managed-preferences":`a macOS managed-preferences domain delivered by MDM`,"windows-registry":`a Windows registry key delivered by MDM or Group Policy`,server:`server-side settings`};function skippedLayer(e,t,n,r=[]){return{tier:e,dir:t,plugins:r,status:n,skipped:n}}function managedFolders(e,t,n){let r=t===`win32`?w:b,i=managedPolicyLocations(e,{platform:t,env:n}),a=[...new Set(i.flatMap(({kind:e,location:t})=>e===`file`?[r.dirname(t)]:e===`directory`?[t]:[]))];return{read:a.filter(e=>!a.some(t=>e.startsWith(t+r.sep))).map(e=>r.join(e,`references`)),unread:i.flatMap(({kind:t,location:n})=>{let r=Ws[t];return r?[{location:n,reason:`not read — ${e} keeps this policy in ${r}, which cannot be read locally`}]:[]})}}function harnessManagedLayers(e,t,n){return e.length?e.flatMap(e=>{let{read:r,unread:i}=managedFolders(e,t,n);return[...r.map(e=>({tier:`managed`,dir:e,plugins:[],status:``})),...i.map(({location:e,reason:t})=>skippedLayer(`managed`,e,t))]}):[skippedLayer(`managed`,`(no harness detected)`,`not read — no harness detected, so no harness managed folder`)]}function activeInstall(e,t){for(let n of t){let t=e.find(({projectPath:e})=>e===n);if(t)return t}return e.find(({projectPath:e})=>e===void 0)}async function enabledPluginLayers(e,t,n){let r=[];for(let i of e){let[e,a]=await Promise.all([enabledPlugins(i,n),installedPlugins(i,n)]);if(!e.supported){r.push(skippedLayer(`plugin`,`(${i} enabled plugins)`,`not read — ${i} keeps no readable record of enabled plugins`));continue}e.unread.length&&r.push(skippedLayer(`plugin`,`(${i} plugin policy)`,`not read — ${e.unread.join(`; `)} may also enable or disable ${i} plugins`));for(let{id:n,enabled:o}of e.plugins){if(!o)continue;let e=n.split(`@`)[0],s=activeInstall(a.plugins.filter(e=>e.id===n),t);if(s){r.push({tier:`plugin`,dir:v(s.path,`references`),plugins:[e],status:``});continue}r.push(skippedLayer(`plugin`,`(${n})`,`not read — enabled in ${i}, but no install folder for this project is recorded`,[e]))}}return r}const Gs=`legacy — move these documents to references/ beside it`;function managedReferencesDir(e,t){return v(g(managedGovernancesDir(e,t)),`references`)}function projectReferencesDir(e){return v(e,`.agents`,`references`)}function projectReferenceLayers(e){return[{tier:`project`,dir:projectReferencesDir(e),plugins:[],status:``},{tier:`project`,dir:v(e,`.agents`,`governances`),plugins:[],status:Gs}]}function readJson(e){try{return JSON.parse(o(e,`utf8`))}catch{return}}function isRepositoryRoot(e){if(r(v(e,`.git`))||r(v(e,`pnpm-workspace.yaml`)))return!0;let t=readJson(v(e,`package.json`));return isRecord$1(t)&&t.workspaces!==void 0}function projectChain(e){let t=S(e),n=[],r=t;for(;;){if(n.push(r),isRepositoryRoot(r))return n;let e=g(r);if(e===r)return[t];r=e}}function isDirectory$1(e){try{return d(e).isDirectory()}catch{return!1}}__name(isDirectory$1,`isDirectory`);function nearestManifest(e){let t=e;for(;;){let e=v(t,`package.json`);if(r(e))return e;let n=g(t);if(n===t)return;t=n}}function canonical(e){try{return l(e)}catch{return e}}function dependencyLayers(e,t){let n=nearestManifest(e);if(!n)return[];let r=[];for(let e of declaredDependencies(readJson(n))){let i=packageDir(e,n);if(!i||t.has(canonical(i)))continue;let a=v(i,`references`);if(!isDirectory$1(a))continue;let o=readJson(v(i,`plugin.json`)),s=isRecord$1(o)&&typeof o.name==`string`?o.name:void 0,c=s&&s!==e?[e,s]:[e];r.push({tier:`plugin`,dir:a,plugins:c,status:``})}return r}async function referenceLayers({root:e,home:t,platform:n,programData:r,packageRoot:i=g(packageGovernancesDir()),env:a=process.env}){let layer=(e,t,n=``)=>({tier:e,dir:t,plugins:[],status:n}),o=[`buddy-agent-harness`],s=detectedHarnesses(a),c=projectChain(e),l=canonical(i),u=await enabledPluginLayers(s,c,{env:a,homedir:t,cwd:S(e),platform:n}),d=[layer(`managed`,managedReferencesDir(n,r)),...harnessManagedLayers(s,n,a),layer(`managed`,managedGovernancesDir(n,r),Gs),layer(`managed`,deprecatedManagedGovernancesDir(n,r),`deprecated — move these documents to the managed references/ layer`),...c.flatMap(projectReferenceLayers),layer(`user`,v(t,`.agents`,`references`)),layer(`user`,v(t,`.agents`,`governances`),Gs),{tier:`plugin`,dir:v(i,`references`),plugins:o,status:``},{tier:`plugin`,dir:v(i,`governances`),plugins:o,status:Gs},...u.filter(({dir:e,skipped:t})=>t||isDirectory$1(e)&&canonical(g(e))!==l),...dependencyLayers(e,new Set([l]))],p=new Set;return d.filter(({dir:e})=>!p.has(e)&&p.add(e))}function skillNames(e){return s(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name).sort()}function pathOccupied(e){try{return i(e),!0}catch{return!1}}function linksTo(e,t){try{return i(e).isSymbolicLink()?l(e)===l(t):!1}catch{return!1}}function countSkills(e){return a(e,{recursive:!0}),skillNames(e).length}function linkTarget(e,t){return te()===`win32`?S(t):x(g(e),t)}function parseForce(e){return e===`true`||e!==`false`&&e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function namesTarget(e,t,n){return S(e,n)===S(t)}function projectSkills({root:e,canonicalSkills:t,harnesses:r,copy:i,force:o}){let s=r.filter(e=>e.project.skillsDirectory).map(t=>({harness:t,target:v(e,t.project.skillsDirectory)})),c=Array.isArray(o)?o:[],l=c.filter(t=>!s.some(({target:n})=>namesTarget(e,n,t)));if(l.length)throw Error(`No skill target matches:\n${l.map(e=>`- ${e}`).join(`
|
|
458
|
+
`)}\nTargets for the enabled harnesses:\n${s.map(({target:t})=>`- ${x(e,t)}`).join(`
|
|
459
|
+
`)}`);let forces=t=>o===!0||c.some(n=>namesTarget(e,t,n)),d=s.filter(({target:e})=>pathOccupied(e)&&!linksTo(e,t)).filter(({target:e})=>!forces(e));if(d.length&&c.length===0)throw Error(`Refusing to replace existing skill targets:\n${d.map(({target:t})=>`- ${x(e,t)}`).join(`
|
|
460
|
+
`)}`);let m=new Set(d.map(({harness:e})=>e.name));for(let{harness:e,target:r}of s)if(!m.has(e.name)&&(a(g(r),{recursive:!0}),!linksTo(r,t))){if(pathOccupied(r)&&u(r,{recursive:!0,force:!0}),i){n(t,r,{recursive:!0});continue}try{p(linkTarget(r,t),r,te()===`win32`?`junction`:void 0)}catch(e){if(pathOccupied(r))throw e;n(t,r,{recursive:!0})}}return{linked:s.filter(({harness:e})=>!m.has(e.name)).map(({harness:e})=>e.name),skipped:s.filter(({harness:e})=>m.has(e.name)).map(({harness:e})=>e.name)}}const Ks=new Set([`node_modules`]);function agentsFileDirectories(e){let t=[],walk=n=>{r(v(e,n,`AGENTS.md`))&&t.push(n);let i;try{i=s(v(e,n),{withFileTypes:!0})}catch{return}for(let e of i)!e.isDirectory()||e.name.startsWith(`.`)||Ks.has(e.name)||walk(n?b.join(n,e.name):e.name)};return walk(``),t.sort()}const qs=`AGENTS.md`;function valueAt(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}function exists(e){try{return i(e),!0}catch{return!1}}function inspectSettingsEntry(e,t){let n;try{n=o(e,`utf8`)}catch{return{kind:`none`,status:`missing`,problem:`instructions-missing`}}let r=parseJsonWithComments(n);if(r===void 0)return{kind:`file`,status:`unreadable`,problem:`instructions-unreadable`};let i=valueAt(r,t);return Array.isArray(i)&&i.includes(`AGENTS.md`)?{kind:`settings-entry`,status:`ok`}:{kind:`file`,status:`unbridged`,problem:`instructions-unbridged`}}function inspectShadow(e){let t;try{t=i(e)}catch{return}if(t.isSymbolicLink())return c(e)===`AGENTS.md`?{kind:`symlink`,status:`superseded`,problem:`instructions-superseded`}:{kind:`symlink`,status:`shadowing`,problem:`instructions-shadowing`};let n;try{n=o(e,`utf8`)}catch{return{kind:`file`,status:`unreadable`,problem:`instructions-unreadable`}}return n.split(`
|
|
461
|
+
`).some(e=>e.trim()===`@AGENTS.md`)?{kind:`import`,status:`superseded`,problem:`instructions-superseded`}:{kind:`file`,status:`shadowing`,problem:`instructions-shadowing`}}function diagnoseInstructions(e,t,n){let r=t.map(e=>({name:e.name,bridge:e.project.instructionBridge})).filter(e=>!!e.bridge),i=[],a=[],o=agentsFileDirectories(e),s=t.some(t=>(t.project.shadowedBy??[]).some(t=>exists(v(e,t))));if((r.length||s)&&!o.includes(``)){let{detail:e,repair:t}=repairFor(`no-instructions`);a.push({path:qs,problem:`no-instructions`,detail:e,repair:t({file:qs},n)})}for(let{name:t,bridge:o}of r){let r=inspectSettingsEntry(v(e,o.path),o.key);if(i.push({harness:t,path:o.path,kind:r.kind,status:r.status}),r.problem){let{detail:e,repair:t}=repairFor(r.problem);a.push({path:o.path,problem:r.problem,detail:e,repair:t({file:o.path},n)})}}for(let r of t)for(let t of r.project.shadowedBy??[])for(let s of o){let o=s?b.join(s,t):t,c=inspectShadow(v(e,o));if(!c)continue;i.push({harness:r.name,path:o,kind:c.kind,status:c.status});let{detail:l,repair:u}=repairFor(c.problem);a.push({path:o,problem:c.problem,detail:l,repair:u({file:o},n)})}return{instructions:i,findings:a}}function git(e,t,n){try{return ie(`git`,t,{cwd:e,encoding:`utf8`,...n===void 0?{}:{input:n},stdio:[`pipe`,`pipe`,`pipe`]})}catch{return}}function lines(e){return(e??``).split(`
|
|
462
|
+
`).filter(Boolean)}var GitBridgeState=class{root;repoRootPrefix;constructor(e){this.root=e,this.repoRootPrefix=git(e,[`rev-parse`,`--show-prefix`])?.trim()}trackingOf(e){if(this.repoRootPrefix===void 0)return`untracked`;let t=lines(git(this.root,[`ls-files`,`-v`,`--`,e]));return t.length?t.every(e=>e.startsWith(`S`))?`skip-worktree`:`tracked`:`untracked`}isIgnored(e){return this.repoRootPrefix!==void 0&&git(this.root,[`check-ignore`,`-q`,`--`,e])!==void 0}commitsTouching(e){return this.repoRootPrefix===void 0?[]:lines(git(this.root,[`rev-list`,`-n`,`200`,`HEAD`,`--`,...e]))}contentAt(e,t){if(this.repoRootPrefix!==void 0)return git(this.root,[`show`,`${e}:${this.repoRootPrefix}${t}`])}directionOf(e,t){if(this.repoRootPrefix===void 0)return`unknown`;let n=this.lastAgreedTree(e,t);if(n===void 0)return`unknown`;let r=!this.matchesTree(e,n),i=!this.matchesTree(t,n);return r&&i?`both`:r?`bridge`:`canonical`}lastAgreedTree(e,t){for(let n of lines(git(this.root,[`rev-list`,`-n`,`200`,`HEAD`,`--`,e,t]))){let r=git(this.root,[`rev-parse`,`-q`,`--verify`,`${n}:${this.repoRootPrefix}${e}`])?.trim();if(r&&r===git(this.root,[`rev-parse`,`-q`,`--verify`,`${n}:${this.repoRootPrefix}${t}`])?.trim())return r}}matchesTree(e,t){let n=new Map(lines(git(this.root,[`ls-tree`,`-r`,t])).map(e=>{let[t,n]=e.split(` `);return[n,t.split(` `)[2]]})),r=filesUnder(v(this.root,e));if(r.length!==n.size||r.some(e=>!n.has(e)))return!1;let i=lines(git(this.root,[`hash-object`,`--stdin-paths`],r.map(t=>v(e,t)).join(`
|
|
463
|
+
`)));return i.length===r.length&&r.every((e,t)=>n.get(e)===i[t])}};const Js=`.agents/skills`;function pathState(e){try{let t=i(e);return t.isSymbolicLink()?`symlink`:t.isDirectory()?`directory`:`file`}catch{return`missing`}}function isDirectory(e){try{return d(e).isDirectory()}catch{return!1}}function sameContent(e,t){let n=filesUnder(e),r=filesUnder(t);return n.length===r.length&&n.every((n,i)=>r[i]===n&&o(v(e,n)).equals(o(v(t,n))))}function inspect(e,t,n,r){switch(pathState(e)){case`missing`:return{kind:`none`,status:`missing`,problem:`missing`};case`file`:return{kind:`file`,status:`degraded`,problem:`degraded`};case`symlink`:return linksTo(e,n)?{kind:`symlink`,status:`ok`}:{kind:`symlink`,status:`stale`,problem:`stale`};default:if(!sameContent(e,n)){let e=r.directionOf(t,Js);return{kind:`copy`,status:`diverged`,problem:`diverged-${e}`,direction:e}}return r.trackingOf(t)===`tracked`?{kind:`copy`,status:`ok`,problem:`unpinned-copy`}:{kind:`copy`,status:`ok`}}}function diagnoseBridges({root:e,harnesses:t=[],cli:n}){let r=v(e,`.agents`,`skills`),i=new GitBridgeState(e),a=selectHarnesses(e,t),o=a.map(e=>({name:e.name,skillsDirectory:e.project.skillsDirectory})).filter(e=>!!e.skillsDirectory),s=[],c=[],l=[];if(!isDirectory(r)){let{detail:e,repair:t}=repairFor(`no-canonical`);l.push({path:Js,problem:`no-canonical`,detail:e,repair:t({file:Js},n)})}for(let t of o){let a=t.skillsDirectory,o=inspect(v(e,a),a,r,i);if(s.push({harness:t.name,path:a,kind:o.kind,status:o.status}),o.direction&&c.push({path:a,direction:o.direction}),o.problem){let{detail:e,repair:t}=repairFor(o.problem);l.push({path:a,problem:o.problem,detail:e,repair:t({file:a},n)})}}let u=diagnoseInstructions(e,a,n);return l.push(...u.findings),{bridges:s,instructions:u.instructions,divergence:c,findings:l}}function buildDoctorReport(e,t,n=[],r=[]){let i=[...t.findings,...n],a=r.length?r:`0 references — no layer outside the plugin tier holds one`;if(!i.length){let n=t.bridges.length+t.instructions.length,r=n===1?`the 1 bridge resolves`:`all ${n} bridges resolve`;return{bin:e,bridges:t.bridges,instructions:t.instructions,references:a,findings:`0 problems found — ${r} and the configuration around them is current`}}return{bin:e,bridges:t.bridges,instructions:t.instructions,references:a,...t.divergence.length?{divergence:t.divergence}:{},findings:i.map(({path:e,problem:t,detail:n})=>({path:e,problem:t,detail:n})),help:[...new Map(i.map(e=>[`${e.repair.command}\u0000${e.repair.instruction}`,e.repair])).values()]}}const Ys=command({name:`doctor`,description:`Report whether this repository's harness bridges still resolve — skills into .agents/skills, instructions into AGENTS.md. Read-only.`,options:{root:{description:`Repository or package directory. Defaults to the current directory.`,type:q(K())},harness:{description:`Comma-separated harnesses to check in addition to Claude Code and Cursor, e.g. codex,gemini-cli.`,type:q(K())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:q(K()),default:`toon`}},async run(e){try{let t=parseFormat(e.format),n=parseHarnesses(e.harness),r=e.root??process.cwd(),i=E(),a=diagnoseBridges({root:r,...n.length?{harnesses:n}:{},cli:Ia}),o=new GitBridgeState(r),s=[...diagnoseConfiguration({root:r,git:o,cli:Ia}),...diagnoseMcp({root:r,git:o,cli:Ia}),...diagnoseNonstandard({root:r,cli:Ia})],{rows:c}=listReferences(await referenceLayers({root:r,home:i,platform:process.platform,programData:process.env.ProgramData,env:process.env})),l=c.filter(({tier:e})=>e!==`plugin`).map(({name:e,tier:t,path:n,status:r})=>({name:e,tier:t,path:collapseHome(i,n),status:r}));return writeResult(buildDoctorReport(displayBinPath(i,process.argv[1]),a,s,l),t),O.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Harness diagnosis failed.`}\n`),O.error}}});function layersFor$1(e){let t=governanceLayers({root:e.root??process.cwd(),home:E(),platform:process.platform,programData:process.env.ProgramData});return e[`overrides-only`]?overrideLayers(t):t}__name(layersFor$1,`layersFor`);const Xs=`warning: "governance" is deprecated and will be removed in the next major version; use "reference show|list" instead.
|
|
464
|
+
`,Zs={description:`Repository or package directory. Defaults to the current directory.`,type:q(K())},Qs={description:`Resolve only the project, user, and machine-wide layers. Never returns a governance this package ships, and exits non-zero when no layer has one.`,type:q(Fn())},$s=command({name:`governance`,description:"Deprecated: use `reference`. Read the governance documents the project, user, and machine-wide override layers hold. Read-only.",commands:[command({name:`list`,description:`List every governance the override layers hold, each at the layer that would win.`,options:{root:Zs,"overrides-only":Qs,format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:q(K()),default:`toon`}},run(e){process.stderr.write(Xs);try{let t=parseFormat(e.format),n=E(),r=layersFor$1(e),i=listGovernances(r);return writeResult({layers:r.map(({scope:e,dir:t})=>({scope:e,path:collapseHome(n,t),status:e===`managed-deprecated`?`deprecated — move these documents to the managed layer above`:``})),governances:i.length?i.map(({name:e,scope:t,path:r})=>({name:e,scope:t,path:collapseHome(n,r)})):`0 governances — no layer holds one`},t),O.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Governance listing failed.`}\n`),O.error}}}),command({name:`show`,description:`Print one governance document, resolved through the layers in order.`,arguments:[{name:`name`,description:"The governance name, without the `.md` extension.",type:K()}],options:{root:Zs,"overrides-only":Qs,format:{description:`Output format: text (default) writes the document itself; toon and json wrap it with the layer it came from.`,type:q(K()),default:`text`}},run(e){process.stderr.write(Xs);try{let t=parseFormat(e.format),n=parseGovernanceName(e.name),r=resolveGovernance(n,layersFor$1(e));return r?(t===`text`?writeDocument(r.content):writeResult({name:r.name,scope:r.scope,path:collapseHome(E(),r.path),content:r.content},t),O.success):(process.stderr.write(e[`overrides-only`]?`error: no override for governance "${n}" in the project, user, or machine-wide layer.\n`:`error: no governance named "${n}" in any layer.\n`),O.error)}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Governance lookup failed.`}\n`),O.error}}})]}),ec={description:`Directory the project tier is read from, and each folder above it up to the repository root. Defaults to the current directory.`,type:q(K())};function layersFor(e,t){return referenceLayers({root:e.root??process.cwd(),home:t,platform:process.platform,programData:process.env.ProgramData,env:process.env})}function fail(e,t){return process.stderr.write(`error: ${e instanceof Error?e.message:t}\n`),O.error}function showEntry(e,t,n,r){let i={name:e.name,status:e.status,warnings:[]};return e.status===`found`&&Object.assign(i,{tier:e.tier,plugin:e.plugin,path:collapseHome(t,e.path),merge:e.merge,metadata:e.metadata,content:e.content,layers:e.layers.map(e=>({...e,path:collapseHome(t,e.path)}))}),e.status===`missing`&&(i.suggestions=n),e.status===`ambiguous`&&(i.plugins=e.plugins),i.warnings=e.warnings,r&&(i.trace=e.trace.map(({description:e,...n})=>({...n,path:collapseHome(t,n.path)}))),i}function missReason(e){if(e.status===`ambiguous`)return`"${e.name}" is held by more than one plugin; ask for one of ${e.plugins.join(`, `)}.`;let t=e.suggestions?.length?` Did you mean: ${e.suggestions.join(`, `)}?`:``;return`no reference named "${e.name}" in any tier.${t}`}function writeShowText(e){if(e.length===1){let[t]=e;t.content!==void 0&&writeDocument(t.content);return}writeDocument(e.map(e=>e.content===void 0?`<reference name="${e.name}" status="${e.status}" />`:`<reference name="${e.name}" tier="${e.tier}">\n${e.content}</reference>`).join(`
|
|
465
|
+
|
|
466
|
+
`))}function writeShowStderr(e,t){for(let n of e){if(t===`text`){for(let e of n.warnings)process.stderr.write(`warning: ${e}\n`);n.trace&&process.stderr.write(`${renderText({[`trace ${n.name}`]:n.trace})}\n`)}n.status!==`found`&&process.stderr.write(`error: ${missReason(n)}\n`)}}const tc=command({name:`show`,description:`Print one or more references, each resolved through the tiers and combined as its layers ask.`,arguments:[{name:`names`,description:"Reference names, without the `.md` extension; `<plugin>/<name>` picks one plugin.",type:In(K())}],options:{root:ec,trace:{description:`Report every path checked, the file that matched, the merge mode, and why a layer was dropped.`,type:q(Fn())},format:{description:`Output format: text (default) writes the documents themselves; toon and json return an array with metadata.`,type:q(K()),default:`text`}},async run(e){try{let t=parseFormat(e.format),n=e.names.map(parseReferenceName);if(!n.length)throw Error(`Name at least one reference.`);let r=E(),i=await layersFor(e,r),display=e=>collapseHome(r,e),a=n.map(t=>{let n=resolveReference(t,i,{display}),a=n.status===`missing`?searchReferences(t.name,i,{display}).slice(0,3).map(e=>e.name):[];return showEntry(n,r,a,!!e.trace)});return t===`text`?writeShowText(a):writeResult(a,t),writeShowStderr(a,t),a.every(e=>e.status===`found`)?O.success:O.error}catch(e){return fail(e,`Reference lookup failed.`)}}}),nc={description:`Output format: toon (default), json, or text for a human-readable report.`,type:q(K()),default:`toon`},rc=command({name:`reference`,description:`Read on-demand reference documents by name, layered across the managed, project, user, and plugin tiers. Read-only.`,commands:[tc,command({name:`list`,description:`List every layer, and every reference at every layer that holds it, marked used or shadowed.`,options:{root:ec,format:nc},async run(e){try{let t=parseFormat(e.format),n=E(),r=await layersFor(e,n),{rows:i,warnings:a}=listReferences(r,{display:e=>collapseHome(n,e)}),o={layers:r.map(({tier:e,plugins:t,dir:r,status:i})=>({tier:e,plugin:t[0]??``,path:collapseHome(n,r),status:i})),references:i.length?i.map(e=>({...e,path:collapseHome(n,e.path)})):`0 references — no layer holds one`};return a.length&&(o.warnings=a),writeResult(o,t),O.success}catch(e){return fail(e,`Reference listing failed.`)}}}),command({name:`search`,description:`Find references by name, description, tags, headings, or body, best match first.`,arguments:[{name:`query`,description:`What the reference is about.`,type:K()}],options:{root:ec,format:nc},async run(e){try{let t=parseFormat(e.format),n=e.query.trim();if(!n)throw Error(`Search needs a query.`);let r=E(),i=searchReferences(n,await layersFor(e,r),{display:e=>collapseHome(r,e)});return writeResult({query:n,references:i.length?i:`0 references match "${n}"`},t),O.success}catch(e){return fail(e,`Reference search failed.`)}}})]});function initializeHarnesses({root:e,harnesses:t=[],copy:n=!1,force:r=!1}){let i=v(e,`.agents`,`skills`),o=countSkills(i);a(projectReferencesDir(e),{recursive:!0});let s=referenceNames(projectReferenceLayers(e)).length,c=selectHarnesses(e,t),{linked:l,skipped:u}=projectSkills({root:e,canonicalSkills:i,harnesses:c,copy:n,force:r});return{root:e,harnesses:c.map(e=>e.name),native:c.filter(e=>!e.project.skillsDirectory).map(e=>e.name),linked:l,skipped:u,deprecated:c.filter(e=>e.deprecated).map(e=>({name:e.name,replacedBy:e.deprecated})),skills:o,references:s,copied:n}}const ic=command({name:`init`,description:`Set up canonical agent skills for the harnesses already enabled in a repository.`,options:{root:{description:`Repository or package directory. Defaults to the current directory.`,type:q(K())},harness:{description:`Comma-separated harnesses to enable in addition to Claude Code and Cursor, e.g. codex,gemini-cli.`,type:q(K())},copy:{description:`Copy skills instead of linking them.`,type:q(Fn())},force:{description:`Replace conflicting target skill directories. Names the targets to replace, comma-separated (e.g. .claude/skills); given alone it replaces every conflicting target.`,type:q(K())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:q(K()),default:`toon`}},run(e){try{let t=parseFormat(e.format),n=parseHarnesses(e.harness);return writeResult(initializeHarnesses({root:e.root??process.cwd(),...n.length?{harnesses:n}:{},...e.copy===void 0?{}:{copy:e.copy},...e.force===void 0?{}:{force:parseForce(e.force)}}),t),O.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Harness initialization failed.`}\n`),O.error}}}),ac={ArrayExpression:[`elements`],ArrayPattern:[`elements`],ArrowFunctionExpression:[`params`,`body`],AssignmentExpression:[`left`,`right`],AssignmentPattern:[`left`,`right`],AwaitExpression:[`argument`],BinaryExpression:[`left`,`right`],BlockStatement:[`body`],BreakStatement:[`label`],CallExpression:[`callee`,`arguments`],CatchClause:[`param`,`body`],ChainExpression:[`expression`],ClassBody:[`body`],ClassDeclaration:[`id`,`superClass`,`body`],ClassExpression:[`id`,`superClass`,`body`],ConditionalExpression:[`test`,`consequent`,`alternate`],ContinueStatement:[`label`],DebuggerStatement:[],DoWhileStatement:[`body`,`test`],EmptyStatement:[],ExperimentalRestProperty:[`argument`],ExperimentalSpreadProperty:[`argument`],ExportAllDeclaration:[`exported`,`source`,`attributes`],ExportDefaultDeclaration:[`declaration`],ExportNamedDeclaration:[`declaration`,`specifiers`,`source`,`attributes`],ExportSpecifier:[`local`,`exported`],ExpressionStatement:[`expression`],ForInStatement:[`left`,`right`,`body`],ForOfStatement:[`left`,`right`,`body`],ForStatement:[`init`,`test`,`update`,`body`],FunctionDeclaration:[`id`,`params`,`body`],FunctionExpression:[`id`,`params`,`body`],Identifier:[],IfStatement:[`test`,`consequent`,`alternate`],ImportAttribute:[`key`,`value`],ImportDeclaration:[`specifiers`,`source`,`attributes`],ImportDefaultSpecifier:[`local`],ImportExpression:[`source`,`options`],ImportNamespaceSpecifier:[`local`],ImportSpecifier:[`imported`,`local`],JSXAttribute:[`name`,`value`],JSXClosingElement:[`name`],JSXClosingFragment:[],JSXElement:[`openingElement`,`children`,`closingElement`],JSXEmptyExpression:[],JSXExpressionContainer:[`expression`],JSXFragment:[`openingFragment`,`children`,`closingFragment`],JSXIdentifier:[],JSXMemberExpression:[`object`,`property`],JSXNamespacedName:[`namespace`,`name`],JSXOpeningElement:[`name`,`attributes`],JSXOpeningFragment:[],JSXSpreadAttribute:[`argument`],JSXSpreadChild:[`expression`],JSXText:[],LabeledStatement:[`label`,`body`],Literal:[],LogicalExpression:[`left`,`right`],MemberExpression:[`object`,`property`],MetaProperty:[`meta`,`property`],MethodDefinition:[`key`,`value`],NewExpression:[`callee`,`arguments`],ObjectExpression:[`properties`],ObjectPattern:[`properties`],PrivateIdentifier:[],Program:[`body`],Property:[`key`,`value`],PropertyDefinition:[`key`,`value`],RestElement:[`argument`],ReturnStatement:[`argument`],SequenceExpression:[`expressions`],SpreadElement:[`argument`],StaticBlock:[`body`],Super:[],SwitchCase:[`test`,`consequent`],SwitchStatement:[`discriminant`,`cases`],TaggedTemplateExpression:[`tag`,`quasi`],TemplateElement:[],TemplateLiteral:[`quasis`,`expressions`],ThisExpression:[],ThrowStatement:[`argument`],TryStatement:[`block`,`handler`,`finalizer`],UnaryExpression:[`argument`],UpdateExpression:[`argument`],VariableDeclaration:[`declarations`],VariableDeclarator:[`id`,`init`],WhileStatement:[`test`,`body`],WithStatement:[`object`,`body`],YieldExpression:[`argument`]},oc=Object.keys(ac);for(let e of oc)Object.freeze(ac[e]);Object.freeze(ac);function unionWith(e){let t=Object.assign({},ac);for(let n of Object.keys(e))if(Object.hasOwn(t,n)){let r=new Set(e[n]);for(let e of t[n])r.add(e);t[n]=Object.freeze(Array.from(r))}else t[n]=Object.freeze(Array.from(e[n]));return Object.freeze(t)}function last(e){return e[e.length-1]??null}function toKeyName(e){return e.type===`TOMLBare`?e.name:e.value}var TOMLVerImpl=class{constructor(e,t){this.major=e,this.minor=t}lt(e,t){return this.major<e||this.major===e&&this.minor<t}gte(e,t){return this.major>e||this.major===e&&this.minor>=t}};const sc=new TOMLVerImpl(1,0),cc=new TOMLVerImpl(1,1),lc=cc,uc={"1.0":sc,"1.0.0":sc,"1.1":cc,"1.1.0":cc,latest:cc,next:cc};function getTOMLVer(e){return e&&uc[e]||lc}const dc={"unterminated-string":`Unterminated string constant`,"unterminated-table-key":`Unterminated table-key`,"unterminated-array":`Unterminated array`,"unterminated-inline-table":`Unterminated inline table`,"missing-key":`Empty bare keys are not allowed`,"missing-newline":`Must be a newline`,"missing-equals-sign":`Expected equal (=) token`,"missing-value":`Unspecified values are invalid`,"missing-comma":`Expected comma (,) token`,"dupe-keys":`Defining a key multiple times is invalid`,"unexpected-char":`Unexpected character`,"unexpected-token":`Unexpected token`,"invalid-control-character":`Control characters (codes < 0x1f and 0x7f) are not allowed`,"invalid-comment-character":`Invalid code point {{cp}} within comments`,"invalid-key-value-newline":`The key, equals sign, and value must be on the same line`,"invalid-inline-table-newline":`No newlines are allowed between the curly braces unless they are valid within a value`,"invalid-underscore":`Underscores are allowed between digits`,"invalid-space":`Unexpected spaces`,"invalid-three-quotes":`Three or more quotes are not permitted`,"invalid-date":`Unexpected invalid date`,"invalid-time":`Unexpected invalid time`,"invalid-leading-zero":`Leading zeros are not allowed`,"invalid-trailing-comma-in-inline-table":`Trailing comma is not permitted in an inline table`,"invalid-char-in-escape-sequence":`Invalid character in escape sequence`,"invalid-consecutive-dots-in-key":`Consecutive dots are not permitted in keys`,"invalid-code-point":`Invalid code point {{cp}}`,"invalid-trailing-dot-in-key":`Keys cannot end with a dot`,"invalid-leading-dot-in-key":`Keys cannot start with a dot`};function getMessage(e,t){return t?dc[e].replace(/\{\{(.*?)\}\}/gu,(e,n)=>n in t?t[n]:`{{${n}}}`):dc[e]}var ParseError=class extends SyntaxError{constructor(e,t,n,r,i){super(getMessage(e,i)),this.index=t,this.lineNumber=n,this.column=r}};const $={EOF:-1,NULL:0,SOH:1,BACKSPACE:8,TABULATION:9,LINE_FEED:10,FORM_FEED:12,CARRIAGE_RETURN:13,ESCAPE:27,SO:14,US:31,SPACE:32,QUOTATION_MARK:34,HASH:35,SINGLE_QUOTE:39,PLUS_SIGN:43,COMMA:44,DASH:45,DOT:46,DIGIT_0:48,DIGIT_1:49,DIGIT_2:50,DIGIT_3:51,DIGIT_7:55,DIGIT_9:57,COLON:58,EQUALS_SIGN:61,LATIN_CAPITAL_A:65,LATIN_CAPITAL_E:69,LATIN_CAPITAL_F:70,LATIN_CAPITAL_T:84,LATIN_CAPITAL_U:85,LATIN_CAPITAL_Z:90,LEFT_BRACKET:91,BACKSLASH:92,RIGHT_BRACKET:93,UNDERSCORE:95,LATIN_SMALL_A:97,LATIN_SMALL_B:98,LATIN_SMALL_E:101,LATIN_SMALL_F:102,LATIN_SMALL_I:105,LATIN_SMALL_L:108,LATIN_SMALL_N:110,LATIN_SMALL_O:111,LATIN_SMALL_R:114,LATIN_SMALL_S:115,LATIN_SMALL_T:116,LATIN_SMALL_U:117,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,LEFT_BRACE:123,RIGHT_BRACE:125,TILDE:126,DELETE:127,PAD:128,SUPERSCRIPT_TWO:178,SUPERSCRIPT_THREE:179,SUPERSCRIPT_ONE:185,VULGAR_FRACTION_ONE_QUARTER:188,VULGAR_FRACTION_THREE_QUARTERS:190,LATIN_CAPITAL_LETTER_A_WITH_GRAVE:192,LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS:214,LATIN_CAPITAL_LETTER_O_WITH_STROKE:216,LATIN_SMALL_LETTER_O_WITH_DIAERESIS:246,LATIN_SMALL_LETTER_O_WITH_STROKE:248,GREEK_SMALL_REVERSED_DOTTED_LUNATE_SIGMA_SYMBOL:891,GREEK_CAPITAL_LETTER_YOT:895,CP_1FFF:8191,ZERO_WIDTH_NON_JOINER:8204,ZERO_WIDTH_JOINER:8205,UNDERTIE:8255,CHARACTER_TIE:8256,SUPERSCRIPT_ZERO:8304,CP_218F:8591,CIRCLED_DIGIT_ONE:9312,NEGATIVE_CIRCLED_DIGIT_ZERO:9471,GLAGOLITIC_CAPITAL_LETTER_AZU:11264,CP_2FEF:12271,IDEOGRAPHIC_COMMA:12289,CP_D7FF:55295,CP_E000:57344,CJK_COMPATIBILITY_IDEOGRAPH_F900:63744,ARABIC_LIGATURE_SALAAMUHU_ALAYNAA:64975,ARABIC_LIGATURE_SALLA_USED_AS_KORANIC_STOP_SIGN_ISOLATED_FORM:65008,REPLACEMENT_CHARACTER:65533,LINEAR_B_SYLLABLE_B008_A:65536,CP_EFFFF:983039,CP_10FFFF:1114111};function isControl(e){return e>=$.NULL&&e<=$.US}function isWhitespace(e){return e===$.TABULATION||e===$.SPACE}function isEOL(e){return e===$.LINE_FEED||e===$.CARRIAGE_RETURN}function isUpperLetter(e){return e>=$.LATIN_CAPITAL_A&&e<=$.LATIN_CAPITAL_Z}function isLowerLetter(e){return e>=$.LATIN_SMALL_A&&e<=$.LATIN_SMALL_Z}function isLetter(e){return isLowerLetter(e)||isUpperLetter(e)}function isDigit(e){return e>=$.DIGIT_0&&e<=$.DIGIT_9}function isHexDig(e){return isDigit(e)||e>=$.LATIN_SMALL_A&&e<=$.LATIN_SMALL_F||e>=$.LATIN_CAPITAL_A&&e<=$.LATIN_CAPITAL_F}function isOctalDig(e){return e>=$.DIGIT_0&&e<=$.DIGIT_7}function isUnicodeScalarValue(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function sortedLastIndex(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1,a=e[i];if(a===t)return i+1;a<t?n=i+1:r=i}return n}var Locations=class{constructor(){this.offsets=[]}addOffset(e){for(let t=this.offsets.length-1;t>=0;t--){let n=this.offsets[t];if(n===e)return;if(n<e)break}this.offsets.push(e)}getLocFromIndex(e){let t=sortedLastIndex(this.offsets,e)+1;return{line:t,column:e-(t===1?0:this.offsets[t-2])}}},CodePointIterator=class{constructor(e){this.locs=new Locations,this.lastCodePoint=$.NULL,this.start=-1,this.end=0,this.text=e}next(){return this.lastCodePoint===$.EOF?$.EOF:this.lastCodePoint=this.moveAt(this.end)}getLocFromIndex(e){return this.locs.getLocFromIndex(e)}eat(e){return this.text.codePointAt(this.end)===e&&(this.next(),!0)}moveAt(e){this.start=this.end=e;let t=this.text.codePointAt(this.start)??$.EOF;if(t===$.EOF)return this.end=this.start,t;if(this.end+=t>=65536?2:1,t===$.LINE_FEED)this.locs.addOffset(this.end);else if(t===$.CARRIAGE_RETURN)return this.text.codePointAt(this.end)===$.LINE_FEED&&(this.end++,this.locs.addOffset(this.end)),$.LINE_FEED;return t}};const fc=typeof BigInt<`u`,pc={16:`0x`,10:``,8:`0o`,2:`0b`},mc={[$.QUOTATION_MARK]:$.QUOTATION_MARK,[$.BACKSLASH]:$.BACKSLASH,[$.LATIN_SMALL_B]:$.BACKSPACE,[$.LATIN_SMALL_F]:$.FORM_FEED,[$.LATIN_SMALL_N]:$.LINE_FEED,[$.LATIN_SMALL_R]:$.CARRIAGE_RETURN,[$.LATIN_SMALL_T]:$.TABULATION},hc={...mc,[$.LATIN_SMALL_E]:$.ESCAPE};var Tokenizer=class{constructor(e,t){this.backCode=!1,this.lastCodePoint=$.NULL,this.state=`DATA`,this.token=null,this.tokenStart=-1,this.valuesEnabled=!1,this.text=e,this.parserOptions=t||{},this.codePointIterator=new CodePointIterator(e),this.tomlVersion=getTOMLVer(this.parserOptions.tomlVersion),this.ESCAPES=this.tomlVersion.gte(1,1)?hc:mc}get start(){return this.codePointIterator.start}get end(){return this.codePointIterator.end}getLocFromIndex(e){return this.codePointIterator.getLocFromIndex(e)}reportParseError(e,t){let n=this.codePointIterator.start,r=this.codePointIterator.getLocFromIndex(n);throw new ParseError(e,n,r.line,r.column,t)}nextToken(){let e=this.token;if(e!=null)return this.token=null,e;let t=this.lastCodePoint;for(;t!==$.EOF&&!this.token;){t=this.nextCode();let e=this[this.state](t);if(!e)throw Error(`Unknown error: pre state=${this.state}`);this.state=e}return e=this.token,this.token=null,e}nextCode(){return this.lastCodePoint===$.EOF?$.EOF:this.backCode?(this.backCode=!1,this.lastCodePoint):this.lastCodePoint=this.codePointIterator.next()}eatCode(e){return this.lastCodePoint===$.EOF?!1:this.backCode?this.lastCodePoint===e&&(this.backCode=!1,!0):this.codePointIterator.eat(e)}moveAt(e){this.backCode&&=!1,this.lastCodePoint=this.codePointIterator.moveAt(e)}back(e){return this.backCode=!0,e}punctuatorToken(){this.startToken(),this.endToken(`Punctuator`,`end`)}startToken(){this.tokenStart=this.codePointIterator.start}endToken(e,t,n,r){let{tokenStart:i}=this,a=this.codePointIterator[t],o=[i,a],s={start:this.codePointIterator.getLocFromIndex(i),end:this.codePointIterator.getLocFromIndex(a)};if(e===`Block`)this.token={type:e,value:this.text.slice(i+1,a),range:o,loc:s};else{let t,c=this.text.slice(i,a);if(e===`BasicString`||e===`LiteralString`||e===`MultiLineBasicString`||e===`MultiLineLiteralString`)t={type:e,value:c,string:n,range:o,loc:s};else if(e===`Integer`){let i=n;t={type:e,value:c,number:parseInt(i,r),bigint:fc?BigInt(pc[r]+i):null,range:o,loc:s}}else t=e===`Float`?{type:e,value:c,number:n,range:o,loc:s}:e===`Boolean`?{type:e,value:c,boolean:n,range:o,loc:s}:e===`LocalDate`||e===`LocalTime`||e===`LocalDateTime`||e===`OffsetDateTime`?{type:e,value:c,date:n,range:o,loc:s}:{type:e,value:c,range:o,loc:s};this.token=t}}DATA(e){for(;isWhitespace(e)||isEOL(e);)e=this.nextCode();if(e===$.HASH)return this.startToken(),`COMMENT`;if(e===$.QUOTATION_MARK)return this.startToken(),`BASIC_STRING`;if(e===$.SINGLE_QUOTE)return this.startToken(),`LITERAL_STRING`;if(e===$.DOT||e===$.EQUALS_SIGN||e===$.LEFT_BRACKET||e===$.RIGHT_BRACKET||e===$.LEFT_BRACE||e===$.RIGHT_BRACE||e===$.COMMA)return this.punctuatorToken(),`DATA`;if(this.valuesEnabled){if(e===$.DASH||e===$.PLUS_SIGN)return this.startToken(),`SIGN`;if(e===$.LATIN_SMALL_N||e===$.LATIN_SMALL_I)return this.startToken(),this.back(`NAN_OR_INF`);if(isDigit(e))return this.startToken(),this.back(`NUMBER`);if(e===$.LATIN_SMALL_T||e===$.LATIN_SMALL_F)return this.startToken(),this.back(`BOOLEAN`)}else if(isUnquotedKeyChar(e,this.tomlVersion))return this.startToken(),`BARE`;return e===$.EOF?`DATA`:this.reportParseError(`unexpected-char`)}COMMENT(e){let t=this.tomlVersion.gte(1,1)?e=>{isNonEOL(e)||this.reportParseError(`invalid-comment-character`,{cp:JSON.stringify(String.fromCodePoint(e)).slice(1,-1)})}:e=>{isControlOtherThanTab(e)&&this.reportParseErrorControlChar()};for(;!isEOL(e)&&e!==$.EOF;)t(e),e=this.nextCode();return this.endToken(`Block`,`start`),`DATA`}BARE(e){for(;isUnquotedKeyChar(e,this.tomlVersion);)e=this.nextCode();return this.endToken(`Bare`,`start`),this.back(`DATA`)}BASIC_STRING(e){if(e===$.QUOTATION_MARK)return e=this.nextCode(),e===$.QUOTATION_MARK?`MULTI_LINE_BASIC_STRING`:(this.endToken(`BasicString`,`start`,``),this.back(`DATA`));let t=[];for(;e!==$.QUOTATION_MARK&&e!==$.EOF&&e!==$.LINE_FEED;){if(isControlOtherThanTab(e))return this.reportParseErrorControlChar();if(e===$.BACKSLASH){e=this.nextCode();let n=this.ESCAPES[e];if(n){t.push(n),e=this.nextCode();continue}if(e===$.LATIN_SMALL_U){let n=this.parseUnicode(4);t.push(n),e=this.nextCode();continue}if(e===$.LATIN_CAPITAL_U){let n=this.parseUnicode(8);t.push(n),e=this.nextCode();continue}if(e===$.LATIN_SMALL_X&&this.tomlVersion.gte(1,1)){let n=this.parseUnicode(2);t.push(n),e=this.nextCode();continue}return this.reportParseError(`invalid-char-in-escape-sequence`)}t.push(e),e=this.nextCode()}return e===$.QUOTATION_MARK?(this.endToken(`BasicString`,`end`,String.fromCodePoint(...t)),`DATA`):this.reportParseError(`unterminated-string`)}MULTI_LINE_BASIC_STRING(e){let t=[];for(e===$.LINE_FEED&&(e=this.nextCode());e!==$.EOF;){if(e!==$.LINE_FEED&&isControlOtherThanTab(e))return this.reportParseErrorControlChar();if(e===$.QUOTATION_MARK){let e=this.codePointIterator.start;if(this.eatCode($.QUOTATION_MARK)&&this.eatCode($.QUOTATION_MARK))return this.eatCode($.QUOTATION_MARK)&&(t.push($.QUOTATION_MARK),this.eatCode($.QUOTATION_MARK)&&(t.push($.QUOTATION_MARK),this.eatCode($.QUOTATION_MARK)))?(this.moveAt(e),this.reportParseError(`invalid-three-quotes`)):(this.endToken(`MultiLineBasicString`,`end`,String.fromCodePoint(...t)),`DATA`);this.moveAt(e)}if(e===$.BACKSLASH){e=this.nextCode();let n=this.ESCAPES[e];if(n){t.push(n),e=this.nextCode();continue}if(e===$.LATIN_SMALL_U){let n=this.parseUnicode(4);t.push(n),e=this.nextCode();continue}if(e===$.LATIN_CAPITAL_U){let n=this.parseUnicode(8);t.push(n),e=this.nextCode();continue}if(e===$.LATIN_SMALL_X&&this.tomlVersion.gte(1,1)){let n=this.parseUnicode(2);t.push(n),e=this.nextCode();continue}if(e===$.LINE_FEED){for(e=this.nextCode();isWhitespace(e)||e===$.LINE_FEED;)e=this.nextCode();continue}if(isWhitespace(e)){let t=!0,n=this.codePointIterator.start,r;for(;(r=this.nextCode())!==$.EOF&&r!==$.LINE_FEED;)if(!isWhitespace(r)){this.moveAt(n),t=!1;break}if(t){for(e=this.nextCode();isWhitespace(e)||e===$.LINE_FEED;)e=this.nextCode();continue}}return this.reportParseError(`invalid-char-in-escape-sequence`)}t.push(e),e=this.nextCode()}return this.reportParseError(`unterminated-string`)}LITERAL_STRING(e){if(e===$.SINGLE_QUOTE)return e=this.nextCode(),e===$.SINGLE_QUOTE?`MULTI_LINE_LITERAL_STRING`:(this.endToken(`LiteralString`,`start`,``),this.back(`DATA`));let t=[];for(;e!==$.SINGLE_QUOTE&&e!==$.EOF&&e!==$.LINE_FEED;){if(isControlOtherThanTab(e))return this.reportParseErrorControlChar();t.push(e),e=this.nextCode()}return e===$.SINGLE_QUOTE?(this.endToken(`LiteralString`,`end`,String.fromCodePoint(...t)),`DATA`):this.reportParseError(`unterminated-string`)}MULTI_LINE_LITERAL_STRING(e){let t=[];for(e===$.LINE_FEED&&(e=this.nextCode());e!==$.EOF;){if(e!==$.LINE_FEED&&isControlOtherThanTab(e))return this.reportParseErrorControlChar();if(e===$.SINGLE_QUOTE){let e=this.codePointIterator.start;if(this.eatCode($.SINGLE_QUOTE)&&this.eatCode($.SINGLE_QUOTE))return this.eatCode($.SINGLE_QUOTE)&&(t.push($.SINGLE_QUOTE),this.eatCode($.SINGLE_QUOTE)&&(t.push($.SINGLE_QUOTE),this.eatCode($.SINGLE_QUOTE)))?(this.moveAt(e),this.reportParseError(`invalid-three-quotes`)):(this.endToken(`MultiLineLiteralString`,`end`,String.fromCodePoint(...t)),`DATA`);this.moveAt(e)}t.push(e),e=this.nextCode()}return this.reportParseError(`unterminated-string`)}SIGN(e){return e===$.LATIN_SMALL_N||e===$.LATIN_SMALL_I?this.back(`NAN_OR_INF`):isDigit(e)?this.back(`NUMBER`):this.reportParseError(`unexpected-char`)}NAN_OR_INF(e){if(e===$.LATIN_SMALL_N){let e=this.codePointIterator.start;if(this.eatCode($.LATIN_SMALL_A)&&this.eatCode($.LATIN_SMALL_N))return this.endToken(`Float`,`end`,NaN),`DATA`;this.moveAt(e)}else if(e===$.LATIN_SMALL_I){let e=this.codePointIterator.start;if(this.eatCode($.LATIN_SMALL_N)&&this.eatCode($.LATIN_SMALL_F))return this.endToken(`Float`,`end`,this.text[this.tokenStart]===`-`?-1/0:1/0),`DATA`;this.moveAt(e)}return this.reportParseError(`unexpected-char`)}NUMBER(e){let t=this.text[this.tokenStart],n=t===`+`?$.PLUS_SIGN:t===`-`?$.DASH:$.NULL;if(e===$.DIGIT_0){if(n===$.NULL){let e=this.codePointIterator.start,t=this.nextCode();if(isDigit(t)){let n=this.nextCode();if(n===$.COLON)return this.data={hasDate:!1,year:0,month:0,day:0,hour:Number(String.fromCodePoint($.DIGIT_0,t)),minute:0,second:0},`TIME_MINUTE`;if(isDigit(n)){let e=this.nextCode();if(isDigit(e)&&this.eatCode($.DASH))return this.data={hasDate:!0,year:Number(String.fromCodePoint($.DIGIT_0,t,n,e)),month:0,day:0,hour:0,minute:0,second:0},`DATE_MONTH`}return this.moveAt(e),this.reportParseError(`invalid-leading-zero`)}this.moveAt(e)}return e=this.nextCode(),e===$.LATIN_SMALL_X||e===$.LATIN_SMALL_O||e===$.LATIN_SMALL_B?n===$.NULL?e===$.LATIN_SMALL_X?`HEX`:e===$.LATIN_SMALL_O?`OCTAL`:`BINARY`:this.reportParseError(`unexpected-char`):e===$.LATIN_SMALL_E||e===$.LATIN_CAPITAL_E?(this.data={minus:n===$.DASH,left:[$.DIGIT_0]},`EXPONENT_RIGHT`):e===$.DOT?(this.data={minus:n===$.DASH,absInt:[$.DIGIT_0]},`FRACTIONAL_RIGHT`):(this.endToken(`Integer`,`start`,`0`,10),this.back(`DATA`))}let{out:r,nextCp:i,hasUnderscore:a}=this.parseDigits(e,isDigit);return i===$.DASH&&n===$.NULL&&!a&&r.length===4?(this.data={hasDate:!0,year:Number(String.fromCodePoint(...r)),month:0,day:0,hour:0,minute:0,second:0},`DATE_MONTH`):i===$.COLON&&n===$.NULL&&!a&&r.length===2?(this.data={hasDate:!1,year:0,month:0,day:0,hour:Number(String.fromCodePoint(...r)),minute:0,second:0},`TIME_MINUTE`):i===$.LATIN_SMALL_E||i===$.LATIN_CAPITAL_E?(this.data={minus:n===$.DASH,left:r},`EXPONENT_RIGHT`):i===$.DOT?(this.data={minus:n===$.DASH,absInt:r},`FRACTIONAL_RIGHT`):(this.endToken(`Integer`,`start`,n===$.DASH?String.fromCodePoint($.DASH,...r):String.fromCodePoint(...r),10),this.back(`DATA`))}HEX(e){let{out:t}=this.parseDigits(e,isHexDig);return this.endToken(`Integer`,`start`,String.fromCodePoint(...t),16),this.back(`DATA`)}OCTAL(e){let{out:t}=this.parseDigits(e,isOctalDig);return this.endToken(`Integer`,`start`,String.fromCodePoint(...t),8),this.back(`DATA`)}BINARY(e){let{out:t}=this.parseDigits(e,e=>e===$.DIGIT_0||e===$.DIGIT_1);return this.endToken(`Integer`,`start`,String.fromCodePoint(...t),2),this.back(`DATA`)}FRACTIONAL_RIGHT(e){let{minus:t,absInt:n}=this.data,{out:r,nextCp:i}=this.parseDigits(e,isDigit),a=[...n,$.DOT,...r];if(i===$.LATIN_SMALL_E||i===$.LATIN_CAPITAL_E)return this.data={minus:t,left:a},`EXPONENT_RIGHT`;let o=Number(t?String.fromCodePoint($.DASH,...a):String.fromCodePoint(...a));return this.endToken(`Float`,`start`,o),this.back(`DATA`)}EXPONENT_RIGHT(e){let{left:t,minus:n}=this.data,r=!1;(e===$.DASH||e===$.PLUS_SIGN)&&(r=e===$.DASH,e=this.nextCode());let{out:i}=this.parseDigits(e,isDigit),a=i;r&&a.unshift($.DASH);let o=Number(n?String.fromCodePoint($.DASH,...t,$.LATIN_SMALL_E,...a):String.fromCodePoint(...t,$.LATIN_SMALL_E,...a));return this.endToken(`Float`,`start`,o),this.back(`DATA`)}BOOLEAN(e){if(e===$.LATIN_SMALL_T){let e=this.codePointIterator.start;if(this.eatCode($.LATIN_SMALL_R)&&this.eatCode($.LATIN_SMALL_U)&&this.eatCode($.LATIN_SMALL_E))return this.endToken(`Boolean`,`end`,!0),`DATA`;this.moveAt(e)}else if(e===$.LATIN_SMALL_F){let e=this.codePointIterator.start;if(this.eatCode($.LATIN_SMALL_A)&&this.eatCode($.LATIN_SMALL_L)&&this.eatCode($.LATIN_SMALL_S)&&this.eatCode($.LATIN_SMALL_E))return this.endToken(`Boolean`,`end`,!1),`DATA`;this.moveAt(e)}return this.reportParseError(`unexpected-char`)}DATE_MONTH(e){let t=this.codePointIterator.start;if(!isDigit(e)||(e=this.nextCode(),!isDigit(e))||(e=this.nextCode(),e!==$.DASH))return this.reportParseError(`unexpected-char`);let n=this.codePointIterator.start,r=this.data;return r.month=Number(this.text.slice(t,n)),`DATE_DAY`}DATE_DAY(e){let t=this.codePointIterator.start;if(!isDigit(e)||(e=this.nextCode(),!isDigit(e)))return this.reportParseError(`unexpected-char`);let n=this.codePointIterator.end,r=this.data;if(r.day=Number(this.text.slice(t,n)),!isValidDate(r.year,r.month,r.day))return this.reportParseError(`invalid-date`);if(e=this.nextCode(),e===$.LATIN_CAPITAL_T||e===$.LATIN_SMALL_T)return`TIME_HOUR`;if(e===$.SPACE){let e=this.codePointIterator.start;if(isDigit(this.nextCode())&&isDigit(this.nextCode()))return this.moveAt(e),`TIME_HOUR`;this.moveAt(e)}let i=getDateFromDateTimeData(r,``);return this.endToken(`LocalDate`,`start`,i),this.back(`DATA`)}TIME_HOUR(e){let t=this.codePointIterator.start;if(!isDigit(e)||(e=this.nextCode(),!isDigit(e))||(e=this.nextCode(),e!==$.COLON))return this.reportParseError(`unexpected-char`);let n=this.codePointIterator.start,r=this.data;return r.hour=Number(this.text.slice(t,n)),`TIME_MINUTE`}TIME_MINUTE(e){let t=this.codePointIterator.start;if(!isDigit(e)||(e=this.nextCode(),!isDigit(e)))return this.reportParseError(`unexpected-char`);let n=this.codePointIterator.end,r=this.data;return r.minute=Number(this.text.slice(t,n)),e=this.nextCode(),e===$.COLON?`TIME_SECOND`:this.tomlVersion.lt(1,1)?this.reportParseError(`unexpected-char`):isValidTime(r.hour,r.minute,r.second)?this.processTimeEnd(e,r):this.reportParseError(`invalid-time`)}TIME_SECOND(e){let t=this.codePointIterator.start;if(!isDigit(e)||(e=this.nextCode(),!isDigit(e)))return this.reportParseError(`unexpected-char`);let n=this.codePointIterator.end,r=this.data;return r.second=Number(this.text.slice(t,n)),isValidTime(r.hour,r.minute,r.second)?(e=this.nextCode(),e===$.DOT?`TIME_SEC_FRAC`:this.processTimeEnd(e,r)):this.reportParseError(`invalid-time`)}TIME_SEC_FRAC(e){if(!isDigit(e))return this.reportParseError(`unexpected-char`);let t=this.codePointIterator.start;for(;isDigit(e);)e=this.nextCode();let n=this.codePointIterator.start,r=this.data;return r.frac=this.text.slice(t,n),this.processTimeEnd(e,r)}processTimeEnd(e,t){if(t.hasDate){if(e===$.DASH||e===$.PLUS_SIGN)return t.offsetSign=e,`TIME_OFFSET`;if(e===$.LATIN_CAPITAL_Z||e===$.LATIN_SMALL_Z){let e=getDateFromDateTimeData(t,`Z`);return this.endToken(`OffsetDateTime`,`end`,e),`DATA`}let n=getDateFromDateTimeData(t,``);return this.endToken(`LocalDateTime`,`start`,n),this.back(`DATA`)}let n=getDateFromDateTimeData(t,``);return this.endToken(`LocalTime`,`start`,n),this.back(`DATA`)}TIME_OFFSET(e){if(!isDigit(e))return this.reportParseError(`unexpected-char`);let t=this.codePointIterator.start;if(e=this.nextCode(),!isDigit(e)||(e=this.nextCode(),e!==$.COLON))return this.reportParseError(`unexpected-char`);let n=this.codePointIterator.start;e=this.nextCode();let r=this.codePointIterator.start;if(!isDigit(e)||(e=this.nextCode(),!isDigit(e)))return this.reportParseError(`unexpected-char`);let i=this.codePointIterator.end,a=Number(this.text.slice(t,n)),o=Number(this.text.slice(r,i));if(!isValidTime(a,o,0))return this.reportParseError(`invalid-time`);let s=this.data,c=getDateFromDateTimeData(s,`${String.fromCodePoint(s.offsetSign)}${padStart(a,2)}:${padStart(o,2)}`);return this.endToken(`OffsetDateTime`,`end`,c),`DATA`}parseDigits(e,t){if(e===$.UNDERSCORE)return this.reportParseError(`invalid-underscore`);if(!t(e))return this.reportParseError(`unexpected-char`);let n=[],r=$.NULL,i=!1;for(;t(e)||e===$.UNDERSCORE;){if(e===$.UNDERSCORE){if(i=!0,r===$.UNDERSCORE)return this.reportParseError(`invalid-underscore`)}else n.push(e);r=e,e=this.nextCode()}return r===$.UNDERSCORE?this.reportParseError(`invalid-underscore`):{out:n,nextCp:e,hasUnderscore:i}}parseUnicode(e){let t=this.codePointIterator.start,n=this.codePointIterator.end,r=0,i;for(;(i=this.nextCode())!==$.EOF;){if(!isHexDig(i))return this.moveAt(t),this.reportParseError(`invalid-char-in-escape-sequence`);if(r++,r>=e)break}let a=this.codePointIterator.end,o=this.text.slice(n,a),s=parseInt(o,16);return isUnicodeScalarValue(s)?s:this.reportParseError(`invalid-code-point`,{cp:o})}reportParseErrorControlChar(){return this.reportParseError(`invalid-control-character`)}};function isUnquotedKeyChar(e,t){return isLetter(e)||isDigit(e)||e===$.UNDERSCORE||e===$.DASH?!0:(t.lt(1,1),!1)}function isControlOtherThanTab(e){return isControl(e)&&e!==$.TABULATION||e===$.DELETE}function isNonEOL(e){return e===$.TABULATION||$.SPACE<=e&&e<=$.TILDE||isNonAscii(e)}function isNonAscii(e){return $.PAD<=e&&e<=$.CP_D7FF||$.CP_E000<=e&&e<=$.CP_10FFFF}function isValidDate(e,t,n){return e>=0&&t<=12&&t>=1&&n>=1&&n<=(t===2?e&3||!(e%25)&&e&15?28:29:30+(t+(t>>3)&1))}function isValidTime(e,t,n){return!(e>=24||e<0||t>59||t<0||n>60||n<0)}function getDateFromDateTimeData(e,t){let n=padStart(e.year,4),r=e.month?padStart(e.month,2):`01`,i=e.day?padStart(e.day,2):`01`,a=padStart(e.hour,2),o=padStart(e.minute,2),s=padStart(e.second,2),c=`${n}-${r}-${i}`,l=e.frac?`.${e.frac}`:``,u=new Date(`${c}T${a}:${o}:${s}${l}${t}`);return!isNaN(u.getTime())||e.second!==60?u:new Date(`${c}T${a}:${o}:59${l}${t}`)}function padStart(e,t){return String(e).padStart(t,`0`)}const gc=Symbol(`VALUE_KIND_VALUE`),_c=Symbol(`VALUE_KIND_INTERMEDIATE`);var KeysResolver=class{constructor(e){this.rootKeys=new Map,this.tables=[],this.ctx=e}applyResolveKeyForTable(e){let t=this.rootKeys,n=e.key.keys.length-1;for(let r=0;r<n;r++){let n=e.key.keys[r],i=toKeyName(n);e.resolvedKey.push(i);let a=t.get(i);if(!a)a={node:n,keys:new Map},t.set(i,a);else if(a.table===`array`){let t=a.peekIndex;e.resolvedKey.push(t),a=a.keys.get(t)}t=a.keys}let r=e.key.keys[n],i=toKeyName(r);e.resolvedKey.push(i);let a=t.get(i);if(!a){if(e.kind===`array`){e.resolvedKey.push(0);let n={node:r,keys:new Map};t.set(i,{table:e.kind,node:r,keys:new Map([[0,n]]),peekIndex:0}),this.tables.push({node:e,keys:n.keys})}else{let n={table:e.kind,node:r,keys:new Map};t.set(i,n),this.tables.push({node:e,keys:n.keys})}}else if(!a.table){if(e.kind===`array`)this.ctx.reportParseError(`dupe-keys`,r);else{let n={table:e.kind,node:r,keys:a.keys};t.set(i,n),this.tables.push({node:e,keys:n.keys})}}else if(a.table===`array`){if(e.kind===`array`){let t={node:r,keys:new Map},n=a.peekIndex+1;e.resolvedKey.push(n),a.keys.set(n,t),a.peekIndex=n,this.tables.push({node:e,keys:t.keys})}else this.ctx.reportParseError(`dupe-keys`,r)}else this.ctx.reportParseError(`dupe-keys`,r)}verifyDuplicateKeys(e){for(let t of e.body)t.type===`TOMLKeyValue`&&verifyDuplicateKeysForKeyValue(this.ctx,this.rootKeys,t);for(let{node:e,keys:t}of this.tables)for(let n of e.body)verifyDuplicateKeysForKeyValue(this.ctx,t,n)}};function verifyDuplicateKeysForKeyValue(e,t,n){let r=t,i=last(n.key.keys);for(let t of n.key.keys){let n=toKeyName(t),a=r.get(n);a?((a.value===gc||i===t||a.table)&&e.reportParseError(`dupe-keys`,getAfterNode(t,a.node)),a.value=_c):(a=i===t?{value:gc,node:t,keys:new Map}:{value:_c,node:t,keys:new Map},r.set(n,a)),r=a.keys}n.value.type===`TOMLInlineTable`?verifyDuplicateKeysForInlineTable(e,r,n.value):n.value.type===`TOMLArray`&&verifyDuplicateKeysForArray(e,r,n.value)}function verifyDuplicateKeysForInlineTable(e,t,n){for(let r of n.body)verifyDuplicateKeysForKeyValue(e,t,r)}function verifyDuplicateKeysForArray(e,t,n){let r=t;for(let i=0;i<n.elements.length;i++){let a=n.elements[i],o=r.get(i);o?e.reportParseError(`dupe-keys`,getAfterNode(a,o.node)):(o={value:gc,node:a,keys:new Map},t.set(i,o),a.type===`TOMLInlineTable`?verifyDuplicateKeysForInlineTable(e,o.keys,a):a.type===`TOMLArray`&&verifyDuplicateKeysForArray(e,o.keys,a))}}function getAfterNode(e,t){return e.range[0]<=t.range[0]?t:e}var Context=class{constructor(e){this.tokens=[],this.comments=[],this.back=null,this.stateStack=[],this.needNewLine=!1,this.needSameLine=!1,this.currToken=null,this.prevToken=null,this.valueContainerStack=[],this.tokenizer=new Tokenizer(e.text,e.parserOptions),this.topLevelTable=e.topLevelTable,this.table=e.topLevelTable,this.keysResolver=new KeysResolver(this)}nextToken(e){if(this.prevToken=this.currToken,this.back?(this.currToken=this.back,this.back=null):this.currToken=this._nextTokenFromTokenizer(e),(this.needNewLine||this.needSameLine||e?.needSameLine)&&this.prevToken&&this.currToken){if(this.prevToken.loc.end.line===this.currToken.loc.start.line){if(this.needNewLine)return this.reportParseError(`missing-newline`,this.currToken)}else{let t=this.needSameLine||e?.needSameLine;if(t)return this.reportParseError(t,this.currToken)}}return this.needNewLine=!1,this.needSameLine=!1,this.currToken}_nextTokenFromTokenizer(e){let t=this.tokenizer.valuesEnabled;e?.valuesEnabled&&(this.tokenizer.valuesEnabled=e.valuesEnabled);let n=this.tokenizer.nextToken();for(;n&&n.type===`Block`;)this.comments.push(n),n=this.tokenizer.nextToken();return n&&this.tokens.push(n),this.tokenizer.valuesEnabled=t,n}backToken(){if(this.back)throw Error(`Illegal state`);this.back=this.currToken,this.currToken=this.prevToken}addValueContainer(e){this.valueContainerStack.push(e),this.tokenizer.valuesEnabled=!0}consumeValueContainer(){let e=this.valueContainerStack.pop();return this.tokenizer.valuesEnabled=this.valueContainerStack.length>0,e}applyResolveKeyForTable(e){this.keysResolver.applyResolveKeyForTable(e)}verifyDuplicateKeys(){this.keysResolver.verifyDuplicateKeys(this.topLevelTable)}reportParseError(e,t){let n,r,i;if(t)n=t.range[0],r=t.loc.start.line,i=t.loc.start.column;else{n=this.tokenizer.start;let e=this.tokenizer.getLocFromIndex(n);r=e.line,i=e.column}throw new ParseError(e,n,r,i)}};const vc={VALUE:`missing-value`},yc={BasicString:`basic`,MultiLineBasicString:`basic`,LiteralString:`literal`,MultiLineLiteralString:`literal`},bc={BasicString:`basic`,LiteralString:`literal`},xc={OffsetDateTime:`offset-date-time`,LocalDateTime:`local-date-time`,LocalDate:`local-date`,LocalTime:`local-time`};var TOMLParser=class{constructor(e,t){this.text=e,this.parserOptions=t||{},this.tomlVersion=getTOMLVer(this.parserOptions.tomlVersion)}parse(){let e={type:`Program`,body:[],sourceType:`module`,tokens:[],comments:[],parent:null,range:[0,0],loc:{start:{line:1,column:0},end:{line:1,column:0}}},t={type:`TOMLTopLevelTable`,body:[],parent:e,range:cloneRange(e.range),loc:cloneLoc(e.loc)};e.body=[t];let n=new Context({text:this.text,parserOptions:this.parserOptions,topLevelTable:t}),r=n.nextToken();if(r){for(t.range[0]=r.range[0],t.loc.start=clonePos(r.loc.start);r;){let e=n.stateStack.pop()||`TABLE`;n.stateStack.push(...this[e](r,n)),r=n.nextToken()}let e=n.stateStack.pop()||`TABLE`;if(e in vc)return n.reportParseError(vc[e],null);n.table.type===`TOMLTable`&&applyEndLoc(n.table,last(n.table.body)),applyEndLoc(t,last(t.body))}n.verifyDuplicateKeys(),e.tokens=n.tokens,e.comments=n.comments;let i=n.tokenizer.end,a=n.tokenizer.getLocFromIndex(i);return e.range[1]=i,e.loc.end={line:a.line,column:a.column},e}TABLE(e,t){return isBare(e)||isString(e)?this.processKeyValue(e,t.table,t):isLeftBracket(e)?this.processTable(e,t.topLevelTable,t):t.reportParseError(`unexpected-token`,e)}VALUE(e,t){return isString(e)||isMultiLineString(e)?this.processStringValue(e,t):isNumber(e)?this.processNumberValue(e,t):isBoolean(e)?this.processBooleanValue(e,t):isDateTime(e)?this.processDateTimeValue(e,t):isLeftBracket(e)?this.processArray(e,t):isLeftBrace(e)?this.processInlineTable(e,t):t.reportParseError(`unexpected-token`,e)}processTable(e,t,n){let r={type:`TOMLTable`,kind:`standard`,key:null,resolvedKey:[],body:[],parent:t,range:cloneRange(e.range),loc:cloneLoc(e.loc)};n.table.type===`TOMLTable`&&applyEndLoc(n.table,last(n.table.body)),t.body.push(r),n.table=r;let i=n.nextToken({needSameLine:`invalid-key-value-newline`});if(isLeftBracket(i)){if(e.range[1]<i.range[0])return n.reportParseError(`invalid-space`,i);r.kind=`array`,i=n.nextToken({needSameLine:`invalid-key-value-newline`})}if(isRightBracket(i))return n.reportParseError(`missing-key`,i);if(!i)return n.reportParseError(`unterminated-table-key`,null);if(i=this.processKeyNode(i,r,n).nextToken,!isRightBracket(i))return n.reportParseError(`unterminated-table-key`,i);if(r.kind===`array`){let e=i;if(i=n.nextToken({needSameLine:`invalid-key-value-newline`}),!isRightBracket(i))return n.reportParseError(`unterminated-table-key`,i);if(e.range[1]<i.range[0])return n.reportParseError(`invalid-space`,i)}return applyEndLoc(r,i),n.applyResolveKeyForTable(r),n.needNewLine=!0,[]}processKeyValue(e,t,n){let r={type:`TOMLKeyValue`,key:null,value:null,parent:t,range:cloneRange(e.range),loc:cloneLoc(e.loc)};t.body.push(r);let{nextToken:i}=this.processKeyNode(e,r,n);return isEq(i)?(n.addValueContainer({parent:r,set:e=>(r.value=e,applyEndLoc(r,e),n.needNewLine=!0,[])}),n.needSameLine=`invalid-key-value-newline`,[`VALUE`]):n.reportParseError(`missing-equals-sign`,i)}processKeyNode(e,t,n){isDot(e)&&n.reportParseError(`invalid-leading-dot-in-key`,e);let r={type:`TOMLKey`,keys:[],parent:t,range:cloneRange(e.range),loc:cloneLoc(e.loc)};t.key=r;let i=e,a=null;do{if(isBare(i))this.processBareKey(i,r);else if(isString(i))this.processStringKey(i,r);else break;if(a=null,i=n.nextToken({needSameLine:`invalid-key-value-newline`}),!isDot(i))break;a=i,i=n.nextToken({needSameLine:`invalid-key-value-newline`})}while(i);return a&&n.reportParseError(isDot(i)?`invalid-consecutive-dots-in-key`:`invalid-trailing-dot-in-key`,a),applyEndLoc(r,last(r.keys)),{keyNode:r,nextToken:i}}processBareKey(e,t){let n={type:`TOMLBare`,name:e.value,parent:t,range:cloneRange(e.range),loc:cloneLoc(e.loc)};t.keys.push(n)}processStringKey(e,t){let n={type:`TOMLQuoted`,kind:`string`,value:e.string,style:bc[e.type],multiline:!1,parent:t,range:cloneRange(e.range),loc:cloneLoc(e.loc)};t.keys.push(n)}processStringValue(e,t){let n=t.consumeValueContainer(),r={type:`TOMLValue`,kind:`string`,value:e.string,style:yc[e.type],multiline:isMultiLineString(e),parent:n.parent,range:cloneRange(e.range),loc:cloneLoc(e.loc)};return n.set(r)}processNumberValue(e,t){let n=t.consumeValueContainer(),r=this.text,[i,a]=e.range,o=null,getNumberText=()=>o??=r.slice(i,a).replace(/_/g,``),s;return s=e.type===`Integer`?{type:`TOMLValue`,kind:`integer`,value:e.number,bigint:e.bigint,get number(){return getNumberText()},parent:n.parent,range:cloneRange(e.range),loc:cloneLoc(e.loc)}:{type:`TOMLValue`,kind:`float`,value:e.number,get number(){return getNumberText()},parent:n.parent,range:cloneRange(e.range),loc:cloneLoc(e.loc)},n.set(s)}processBooleanValue(e,t){let n=t.consumeValueContainer(),r={type:`TOMLValue`,kind:`boolean`,value:e.boolean,parent:n.parent,range:cloneRange(e.range),loc:cloneLoc(e.loc)};return n.set(r)}processDateTimeValue(e,t){let n=t.consumeValueContainer(),r={type:`TOMLValue`,kind:xc[e.type],value:e.date,datetime:e.value,parent:n.parent,range:cloneRange(e.range),loc:cloneLoc(e.loc)};return n.set(r)}processArray(e,t){let n=t.consumeValueContainer(),r={type:`TOMLArray`,elements:[],parent:n.parent,range:cloneRange(e.range),loc:cloneLoc(e.loc)},i=t.nextToken({valuesEnabled:!0});return isRightBracket(i)?(applyEndLoc(r,i),n.set(r)):(t.backToken(),this.processArrayValue(r,n,t))}processArrayValue(e,t,n){return n.addValueContainer({parent:e,set:r=>{e.elements.push(r);let i=n.nextToken({valuesEnabled:!0}),a=isComma(i);return a&&(i=n.nextToken({valuesEnabled:!0})),isRightBracket(i)?(applyEndLoc(e,i),t.set(e)):a?(n.backToken(),this.processArrayValue(e,t,n)):n.reportParseError(i?`missing-comma`:`unterminated-array`,i)}}),[`VALUE`]}processInlineTable(e,t){let n=t.consumeValueContainer(),r={type:`TOMLInlineTable`,body:[],parent:n.parent,range:cloneRange(e.range),loc:cloneLoc(e.loc)},i=this.tomlVersion.gte(1,1)?void 0:`invalid-inline-table-newline`,a=t.nextToken({needSameLine:i});if(a){if(isBare(a)||isString(a))return this.processInlineTableKeyValue(a,r,n,t);if(isRightBrace(a))return applyEndLoc(r,a),n.set(r)}return t.reportParseError(`unexpected-token`,a)}processInlineTableKeyValue(e,t,n,r){let i={type:`TOMLKeyValue`,key:null,value:null,parent:t,range:cloneRange(e.range),loc:cloneLoc(e.loc)};t.body.push(i);let{nextToken:a}=this.processKeyNode(e,i,r);if(!isEq(a))return r.reportParseError(`missing-equals-sign`,a);let o=this.tomlVersion.gte(1,1)?void 0:`invalid-inline-table-newline`;return r.addValueContainer({parent:i,set:e=>{i.value=e,applyEndLoc(i,e);let a=r.nextToken({needSameLine:o});if(isComma(a)){if(a=r.nextToken({needSameLine:o}),a&&(isBare(a)||isString(a)))return this.processInlineTableKeyValue(a,t,n,r);if(isRightBrace(a)){if(this.tomlVersion.lt(1,1))return r.reportParseError(`invalid-trailing-comma-in-inline-table`,a)}else return r.reportParseError(a?`unexpected-token`:`unterminated-inline-table`,a)}return isRightBrace(a)?(applyEndLoc(t,a),n.set(t)):r.reportParseError(a?`missing-comma`:`unterminated-inline-table`,a)}}),r.needSameLine=`invalid-key-value-newline`,[`VALUE`]}};function isDot(e){return isPunctuator(e)&&e.value===`.`}function isEq(e){return isPunctuator(e)&&e.value===`=`}function isLeftBracket(e){return isPunctuator(e)&&e.value===`[`}function isRightBracket(e){return isPunctuator(e)&&e.value===`]`}function isLeftBrace(e){return isPunctuator(e)&&e.value===`{`}function isRightBrace(e){return isPunctuator(e)&&e.value===`}`}function isComma(e){return isPunctuator(e)&&e.value===`,`}function isPunctuator(e){return!!(e&&e.type===`Punctuator`)}function isBare(e){return e.type===`Bare`}function isString(e){return e.type===`BasicString`||e.type===`LiteralString`}function isMultiLineString(e){return e.type===`MultiLineBasicString`||e.type===`MultiLineLiteralString`}function isNumber(e){return e.type===`Integer`||e.type===`Float`}function isBoolean(e){return e.type===`Boolean`}function isDateTime(e){return e.type===`OffsetDateTime`||e.type===`LocalDateTime`||e.type===`LocalDate`||e.type===`LocalTime`}function applyEndLoc(e,t){t&&(e.range[1]=t.range[1],e.loc.end=clonePos(t.loc.end))}function cloneRange(e){return[e[0],e[1]]}function cloneLoc(e){return{start:clonePos(e.start),end:clonePos(e.end)}}function clonePos(e){return{line:e.line,column:e.column}}const Sc=unionWith({Program:[`body`],TOMLTopLevelTable:[`body`],TOMLTable:[`key`,`body`],TOMLKeyValue:[`key`,`value`],TOMLKey:[`keys`],TOMLArray:[`elements`],TOMLInlineTable:[`body`],TOMLBare:[],TOMLQuoted:[],TOMLValue:[]});function parseForESLint(e,t){return{ast:new TOMLParser(e,t).parse(),visitorKeys:Sc,services:{isTOML:!0}}}function parseTOML(e,t){return parseForESLint(e,t).ast}function nested(e,t){return e.reduceRight((e,t)=>({[t]:e}),t)}function renderTomlTable(e,t){return stringify(nested(e,t))}function appendTomlTable(e,t,n){return`${e}${e===``||e.endsWith(`
|
|
467
|
+
`)?``:`
|
|
468
|
+
`}\n${renderTomlTable(t,n)}`}function keyNames(e){return e.keys.map(e=>e.type===`TOMLBare`?e.name:e.value)}function startsWith(e,t){return t.length<=e.length&&t.every((t,n)=>e[n]===t)}function overlaps(e,t){return startsWith(e,t)||startsWith(t,e)}function replaceTomlTable(e,t,n){let r;try{r=parseTOML(e)}catch{return{kind:`refused`,reason:`unreadable`}}let i=[];for(let e of r.body[0].body){if(e.type===`TOMLKeyValue`){if(overlaps(keyNames(e.key),t))return{kind:`refused`,reason:`shape`};continue}if(startsWith(e.resolvedKey,t)){if(e.kind===`array`)return{kind:`refused`,reason:`shape`};i.push(e);continue}let n=e.resolvedKey;if(e.body.some(e=>overlaps([...n,...keyNames(e.key)],t)))return{kind:`refused`,reason:`shape`}}if(!i.length)return{kind:`refused`,reason:`absent`};if(!i.some(e=>e.resolvedKey.length===t.length))return{kind:`refused`,reason:`shape`};let a=i.map(t=>{let n=e.slice(t.range[1]).search(/\r?\n/);return[t.range[0],n<0?e.length:t.range[1]+n]}),inside=e=>a.some(([t,n])=>t<=e&&e<n);if(r.comments.some(e=>inside(e.range[0])))return{kind:`refused`,reason:`comment`};let[o,...s]=a,c=e;for(let[e,t]of s.reverse()){let n=c.slice(0,e),r=c.slice(t).replace(/^\r?\n/,``);c=/\n\r?\n$/.test(n)?`${n}${r.replace(/^\r?\n/,``)}`:`${n}${r}`}let l=renderTomlTable(t,n).trimEnd();return{kind:`edited`,text:`${c.slice(0,o[0])}${l}${c.slice(o[1])}`}}const Cc=/^[A-Za-z0-9_-]+$/;function tomlKey(e){return Cc.test(e)?e:JSON.stringify(e)}function renderTomlInline(e){return typeof e==`object`&&e&&!Array.isArray(e)?`{ ${Object.entries(e).map(([e,t])=>`${tomlKey(e)} = ${renderTomlInline(t)}`).join(`, `)} }`:stringify({v:e}).slice(4).trimEnd()}function appendInlineTomlTable(e,t,n){let r=e===``||e.endsWith(`
|
|
469
|
+
`)?``:`
|
|
470
|
+
`,i=Object.entries(n).map(([e,t])=>`${tomlKey(e)} = ${renderTomlInline(t)}\n`);return`${e}${r}\n[${t.map(tomlKey).join(`.`)}]\n${i.join(``)}`}function lineEndAt(e,t){let n=e.indexOf(`
|
|
471
|
+
`,t);return n===-1?e.length:n}function setTomlKey(e,t,n,r){let i;try{i=parseTOML(e)}catch{return{kind:`refused`,reason:`unreadable`}}let a=i.body[0].body.filter(e=>e.type===`TOMLTable`),o=a.find(e=>e.kind===`standard`&&e.resolvedKey.length===t.length&&startsWith(e.resolvedKey,t));if(!o)return{kind:`refused`,reason:`absent`};let s=o.body;if(a.some(e=>startsWith(e.resolvedKey,[...t,n]))||s.some(e=>keyNames(e.key)[0]===n&&e.key.keys.length>1))return{kind:`refused`,reason:`shape`};let c=s.find(e=>e.key.keys.length===1&&keyNames(e.key)[0]===n);if(c&&r!==void 0)return{kind:`edited`,text:`${e.slice(0,c.value.range[0])}${renderTomlInline(r)}${e.slice(c.value.range[1])}`};if(c){let t=e.lastIndexOf(`
|
|
472
|
+
`,c.range[0]-1)+1,n=lineEndAt(e,c.range[1]);return{kind:`edited`,text:`${e.slice(0,t)}${e.slice(Math.min(n+1,e.length))}`}}if(r===void 0)return{kind:`edited`,text:e};let l=lineEndAt(e,s.at(-1)?.range[1]??o.range[0]);return{kind:`edited`,text:`${e.slice(0,l)}\n${tomlKey(n)} = ${renderTomlInline(r)}${e.slice(l)}`}}function read$1(e,t){let n=v(e,t);return r(n)?o(n,`utf8`):void 0}__name(read$1,`read`);const wc={both:`both sides changed since the last projection — a three-way conflict for a person to settle, never imported`,unknown:`no baseline says which side changed — compare the two by hand; never imported`};function inferredTransport(e){return e.url===void 0?`stdio`:`http`}function mapValue(e,t){let n=Object.entries(e).flatMap(([e])=>{let n=isRecord$1(t)?t[e]:void 0;return typeof n==`string`?[[e,n]]:[]});return n.length?Object.fromEntries(n):void 0}function reconcileMcp({root:e,git:t,accept:n}){let r=read$1(e,uo),i=parseGoldenSet(r);if(i.kind!==`servers`)return i;let a=parseProjectionRecord(read$1(e,fo)),o=new McpBaseline({git:t,record:a}),s=[],c=[];for(let t of mcpTargets(e)){let n=parseTarget(t,read$1(e,t.path));if(n.kind===`unreadable`){s.push({path:t.path,action:`refuse`,detail:`the target does not parse`});continue}if(n.kind===`absent`)continue;let r=no[t.dialect];for(let[e,a]of n.servers){let n=i.servers.get(e),at=n=>locatorText({file:t.path,server:e,field:n}),offer=(i,o)=>{let l=literalsIn(i,o);for(let e of l)s.push({path:at(e),action:`refuse`,detail:`${e} holds a literal credential, which never enters the golden set — set it in the environment and reference it as \${VAR}`});let u=withoutLiterals(i,o,l,n);if(l.length&&(u===void 0||sameField(i,{[i]:u},n)))return;let d=r.defaults?.[i];if(d!==void 0&&sameField(i,{[i]:u},{[i]:d})){s.push({path:at(i),action:`skip`,detail:`${t.dialect} fills this in by default, so it may not be the user's — set it in the golden set by hand if it is`});return}let p={path:at(i),action:`import`,detail:n?`only the harness changed it — approve to take it into the golden set`:`the golden set does not declare this server — approve each field to add it`,value:u===void 0?`(unset)`:`${i} = ${renderTomlInline(u)}`};s.push(p),c.push({row:p,config:t,server:e,field:i,value:u,carried:a,adds:!n})};if(!n){for(let e of qa)r.fields.has(e)&&a[e]!==void 0&&(e!==`transport`||a.transport!==inferredTransport(a))&&offer(e,a[e]);continue}for(let i of divergingFields(n,a,r.fields)){let r=o.directionOf(t,e,i,n,a);r!==`golden`&&(r===`target`?offer(i,i===`env`||i===`headers`?mapValue(n[i],a[i]):a[i]):s.push({path:at(i),action:`skip`,detail:wc[r]}))}}}if(!n.length)return{kind:`planned`,rows:s,written:!1};let l=approve(c,s,n);if(l.kind===`rejected`)return l;let u=r,d=[];for(let[e,t]of groupByServer(l.offers)){if(t[0]?.adds){let n=Object.fromEntries(qa.flatMap(e=>{let n=t.find(t=>t.field===e);return n?[[e,n.value]]:[]}));u=land(u,appendInlineTomlTable(u,[`servers`,e],n),e,n,t,d);continue}for(let n of t){let t={...parseGoldenSet(u).servers.get(e),[n.field]:n.value};n.value===void 0&&delete t[n.field];let r=setTomlKey(u,[`servers`,e],n.field,n.value);u=land(u,r.kind===`edited`?r.text:void 0,e,t,[n],d)}}return u!==r&&(m(v(e,uo),u),writeRecord$1(e,a,o,d,parseGoldenSet(u))),{kind:`planned`,rows:s,written:!0}}function literalsIn(e,t){return t===void 0?[]:e===`args`?nonSecretArgs(t).length===t.length?[]:[`args`]:e!==`env`&&e!==`headers`&&e!==`url`?[]:credentialFields({[e]:t})}function withoutLiterals(e,t,n,r){if(!n.length)return t;if(e!==`env`&&e!==`headers`)return;let i={...t};for(let t of n){let n=t.slice(e.length+1),a=r?.[e]?.[n];a===void 0?delete i[n]:i[n]=a}return Object.keys(i).length?i:void 0}function approve(e,t,n){let r=[],i=[];for(let a of new Set(n)){let n=e.find(e=>e.row.path===a);if(n)i.push(n);else{let e=t.find(e=>e.path===a);r.push(e?`${a} is ${e.action}, not importable: ${e.detail}`:`${a} names no importable field`)}}for(let[e,t]of groupByServer(i)){for(let n of new Set(t.map(e=>e.field))){let i=t.filter(e=>e.field===n);i.some(e=>!sameField(n,{[n]:e.value},{[n]:i[0]?.value}))&&r.push(`servers.${e}.${n} is approved from more than one target with different values — approve one`)}t[0]?.adds&&!t.some(e=>e.field===`command`||e.field===`url`)&&r.push(`servers.${e} would be added with nothing to run — approve its command or url too`)}return r.length?{kind:`rejected`,reasons:r}:{kind:`approved`,offers:i}}function groupByServer(e){let t=new Map;for(let n of e)t.set(n.server,[...t.get(n.server)??[],n]);return t}function land(e,t,n,r,i,a){let o=parseGoldenSet(e),s=t===void 0?void 0:parseGoldenSet(t),c=s?.kind===`servers`&&qa.every(e=>e===`transport`&&r.transport===void 0||sameField(e,s.servers.get(n),r))&&[...o.servers].every(([e,t])=>e===n||JSON.stringify(s.servers.get(e))===JSON.stringify(t));for(let e of i)e.row.action=c?`imported`:`edit`,e.row.detail=c?`written into the golden set`:`the golden set writes this server in a shape that cannot be edited byte-safely — apply the value by hand`;return c?(a.push(...i),t):e}function writeRecord$1(e,t,n,r,i){for(let e of r){let r=t.get(e.config.path)??new Map,a=r.get(e.server),o=a?{...a,[e.field]:e.value}:baseEntry(e,n,i.servers.get(e.server));o&&(e.value===void 0&&delete o[e.field],r.set(e.server,o),t.set(e.config.path,r))}let o=v(e,fo);a(g(o),{recursive:!0}),m(o,formatProjectionRecord(t))}__name(writeRecord$1,`writeRecord`);function baseEntry(e,t,n){if(e.adds)return{...n};let r={};for(let i of no[e.config.dialect].fields){if(n[i]===void 0)continue;if(sameField(i,n,e.carried)){r[i]=n[i];continue}let a=t.baseFor(e.config,e.server,i);if(!a)return;r[i]=a[i]}return r}const Tc=command({name:`reconcile`,description:`Import a harness-side MCP change into the golden set, one approved field at a time. A dry run unless --accept names a field.`,options:{root:{description:`Repository or package directory. Defaults to the current directory.`,type:q(K())},accept:{description:`Approve one field by the path a dry run lists for it; repeat for each field. There is no approve-all.`,type:q(In(K()))},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:q(K()),default:`toon`}},run(e){try{let t=parseFormat(e.format),n=e.root??process.cwd(),r=e.accept??[],i=reconcileMcp({root:n,git:new GitBridgeState(n),accept:r});if(i.kind===`unreadable`){let e=i.position?` at line ${i.position.line}, column ${i.position.column}`:``;return process.stderr.write(`error: ${uo} does not parse${e}.\n`),O.error}return i.kind===`rejected`?(process.stderr.write(`error: nothing written.\n${i.reasons.map(e=>`- ${e}\n`).join(``)}`),O.error):i.kind===`absent`?(writeResult({golden:`0 servers — no golden set at ${uo}`,mode:`nothing to reconcile into`,fields:`0 fields`,record:`not written`},t),O.success):(writeResult({golden:uo,mode:i.written?`written — only the fields named by --accept`:`dry run — nothing written; re-run with --accept <path> for each approved field`,fields:i.rows.length?i.rows:`0 fields — no harness holds a change the golden set lacks`,record:i.written?fo:`not written — dry run`},t),O.success)}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`MCP reconcile failed.`}\n`),O.error}}});function indentUnit(e){let t=/\n([ \t]+)\S/.exec(e);return t?t[1]:` `}function jsonAt(e,t,n){return JSON.stringify(e,null,t).replaceAll(`
|
|
473
|
+
`,`\n${t.repeat(n)}`)}function objectAt(e,t){let n=e&&(t.length?zi(e,t):e);return n?.type===`object`?n:void 0}function insertJsonProperty(e,t,n,r){let i=objectAt(Ri(e),t);if(!i||zi(i,[n]))return;let a=t.length+1,o=indentUnit(e),s=`${o.repeat(a)}${JSON.stringify(n)}: ${jsonAt(r,o,a)}`,c=i.children?.at(-1);if(c){let t=c.offset+c.length;return`${e.slice(0,t)},\n${s}${e.slice(t)}`}let l=i.offset+1,u=i.offset+i.length-1;return`${e.slice(0,l)}\n${s}\n${o.repeat(a-1)}${e.slice(u)}`}function replaceJsonValue(e,t,n){let r=Ri(e),i=r&&zi(r,t);if(!i)return{kind:`refused`,reason:`absent`};let a=i.offset+i.length,o=e.slice(i.offset,a);return stripJsonComments(o)===o?{kind:`edited`,text:`${e.slice(0,i.offset)}${jsonAt(n,indentUnit(e),t.length)}${e.slice(a)}`}:{kind:`refused`,reason:`comment`}}function createFile(e,t,n){return e.format===`toml`?renderTomlTable([e.key,t],n):`${JSON.stringify({[e.key]:{[t]:n}},null,2)}\n`}function appendServer(e,t,n,r){return e.format===`toml`?appendTomlTable(t,[e.key,n],r):insertJsonProperty(t,[e.key],n,r)??insertJsonProperty(t,[],e.key,{[n]:r})}function replaceServer(e,t,n,r){let i=e.format===`toml`?replaceTomlTable(t,[e.key,n],r):replaceJsonValue(t,[e.key,n],r);return i.kind===`edited`?i.text:void 0}function renderEntry(e,t,n){return e.format===`toml`?renderTomlTable([e.key,t],n):JSON.stringify({[t]:n},null,2)}function read(e,t){let n=v(e,t);return r(n)?o(n,`utf8`):void 0}const Ec={target:`the target changed since the last projection — reconcile it into the golden set first`,both:`both sides changed since the last projection — a three-way conflict for a person to settle`,unknown:`no baseline says which side changed — compare the two by hand`};function heldBack(e){return[`both`,`unknown`,`target`].find(t=>e.includes(t))}function projectMcp({root:e,git:t,write:n}){let r=parseGoldenSet(read(e,uo));if(r.kind!==`servers`)return r;let i=parseProjectionRecord(read(e,fo)),a=new McpBaseline({git:t,record:i}),o=[],s=[],c=[];for(let t of mcpTargets(e)){let n=read(e,t.path),i=parseTarget(t,n);if(i.kind===`unreadable`){o.push({target:t.path,server:``,action:`refuse`,detail:`the target does not parse`});continue}let l={config:t,source:n,created:n===void 0,servers:i.kind===`servers`?i.servers:new Map,agreed:new Map};c.push(l);let u=no[t.dialect];for(let[e,n]of r.servers){let row=(n,r)=>o.push({target:t.path,server:e,action:n,detail:r}),r=credentialFields(n)[0];if(r){row(`refuse`,`the golden set holds a literal credential at ${r} — reference it as \${VAR} first`);continue}let i=u.write(n);if(i.kind===`refused`){row(`refuse`,`${i.field}: ${i.reason}`);continue}let c=l.servers.get(e);if(!c){let r=l.source===void 0?createFile(t,e,i.entry):appendServer(t,l.source,e,i.entry);apply(l,e,n,i.entry,r,l.created?`creates the file`:`appends the server`,row,s);continue}let d=divergingFields(n,c,u.fields);if(!d.length){l.agreed.set(e,n);continue}let p=heldBack(d.map(r=>a.directionOf(t,e,r,n,c)));if(p){row(`skip`,Ec[p]);continue}let m=replaceServer(t,l.source,e,i.entry);apply(l,e,n,i.entry,m,`replaces ${d.join(`, `)}`,row,s)}}if(n){for(let t of c)t.source!==void 0&&t.source!==read(e,t.config.path)&&writeTarget(e,t);writeRecord(e,i,c)}return{kind:`planned`,rows:o,entries:s,written:n}}function apply(e,t,n,r,i,a,o,s){let c=!e.servers.has(t),l=i!==void 0&&readsBack(e,t,n,i),u=l?c?`add`:`update`:`edit`;if(s.push({target:e.config.path,server:t,action:u,entry:renderEntry(e.config,t,r)}),!l){o(`edit`,c?`the file has no safe place to add it — apply the entry by hand`:`an in-place change here is applied by hand`);return}e.source=i,e.servers=parseTarget(e.config,i).servers,e.agreed.set(t,n),o(u,a)}function readsBack(e,t,n,r){let i=parseTarget(e.config,r);if(i.kind!==`servers`)return!1;let a=i.servers.get(t),o=no[e.config.dialect].fields;return!a||divergingFields(n,a,o).length?!1:[...e.servers].every(([e,n])=>{if(e===t)return!0;let r=i.servers.get(e);return r!==void 0&&JSON.stringify(r)===JSON.stringify(n)})}function writeTarget(e,t){let n=v(e,t.config.path);a(g(n),{recursive:!0}),m(n,t.source)}function writeRecord(e,t,n){for(let e of n){let n=t.get(e.config.path)??new Map;for(let[t,r]of e.agreed)n.set(t,r);n.size&&t.set(e.config.path,n)}let r=v(e,fo);a(g(r),{recursive:!0}),m(r,formatProjectionRecord(t))}const Dc=command({name:`mcp`,description:`Work with the golden MCP server set at .agents/buddy-agent-harness/mcp.toml.`,commands:[command({name:`project`,description:`Project the golden MCP server set into each enabled harness. A dry run unless --write; never overwrites a change made on the harness side.`,options:{root:{description:`Repository or package directory. Defaults to the current directory.`,type:q(K())},write:{description:`Apply the plan and record what was projected. Without it nothing on disk changes.`,type:q(Fn())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:q(K()),default:`toon`}},run(e){try{let t=parseFormat(e.format),n=e.root??process.cwd(),r=e.write===!0,i=projectMcp({root:n,git:new GitBridgeState(n),write:r});if(i.kind===`unreadable`){let e=i.position?` at line ${i.position.line}, column ${i.position.column}`:``;return process.stderr.write(`error: ${uo} does not parse${e}.\n`),O.error}return i.kind===`absent`?(writeResult({golden:`0 servers — no golden set at ${uo}`,mode:`nothing to project`,actions:`0 changes`,record:`not written`},t),O.success):(writeResult({golden:uo,mode:r?`written`:`dry run — nothing written; re-run with --write to apply`,actions:i.rows.length?i.rows:`0 changes — every enabled harness already carries the golden set`,...i.entries.length?{entries:i.entries}:{},record:r?fo:`not written — dry run`},t),O.success)}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`MCP projection failed.`}\n`),O.error}}}),Tc]});function app(){return cli({name:`buddy-agent-harness`,version:`0.13.0`,description:`Initialize agent harness skill compatibility in consumer repositories.`}).command(ic).command(Ys).command(Dc).command(ha).command(rc).command($s)}async function run(e){try{let t=await app().parse(e);return typeof t==`number`?t:O.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Invalid command.`}\n`),O.usage}}process.exitCode=await run([...process.argv.slice(0,2),`init`,...process.argv.slice(2)]);export{};
|