strings-le 0.0.0-stage → 2.6.1
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/LICENSE +21 -0
- package/README.md +67 -2
- package/cli.js +110 -0
- package/package.json +47 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 nolindnaidoo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,68 @@
|
|
|
1
|
-
#
|
|
1
|
+
# string-le
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Get every string value in a codebase out into one place a person can read:
|
|
4
|
+
the QA lead checking messages, the reviewer looking for a claim the product
|
|
5
|
+
may not make, the localisation owner finding what never reached a catalog.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx strings-le src/
|
|
9
|
+
npx strings-le --values --dedupe src/ > strings.txt
|
|
10
|
+
cat config.toml | npx strings-le --stdin --format toml
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This is the same command line as the Rust crate
|
|
14
|
+
[`string-le`](https://crates.io/crates/string-le), and it behaves identically:
|
|
15
|
+
same flags, same walk, same output, same exit codes. Install whichever
|
|
16
|
+
toolchain you already have. The one difference is the words a parser uses to
|
|
17
|
+
refuse a broken document: both report it as unparsed under the same
|
|
18
|
+
`Invalid JSON: ` prefix, and the rest is each parser's own description.
|
|
19
|
+
|
|
20
|
+
The package is `strings-le` because npm holds `string-le` too close to an
|
|
21
|
+
older name. The command it installs is `string-le`, the same as the crate's.
|
|
22
|
+
|
|
23
|
+
## What it reads
|
|
24
|
+
|
|
25
|
+
Every file. JSON, JSONC, YAML, CSV, TSV, TOML, INI and dotenv are parsed;
|
|
26
|
+
Python, Rust, Go, shell, PHP, Ruby, Perl, C#, JavaScript and TypeScript are
|
|
27
|
+
read by their own string syntax; anything else falls back to quoted runs and
|
|
28
|
+
is reported as format `fallback`. Keys are never values. Directories are
|
|
29
|
+
walked the way ripgrep walks them: `.gitignore`, `.ignore` and hidden files
|
|
30
|
+
are respected unless you pass `--no-ignore` or `--hidden`. A binary file is
|
|
31
|
+
passed over and counted in the summary.
|
|
32
|
+
|
|
33
|
+
It reports what is there and nothing else. Which strings matter is yours to
|
|
34
|
+
decide.
|
|
35
|
+
|
|
36
|
+
## Output
|
|
37
|
+
|
|
38
|
+
stdout carries one JSON report per file whenever it is piped or redirected,
|
|
39
|
+
and nothing when it is a terminal. stderr carries the human summary.
|
|
40
|
+
`--values` prints just the values, one per line, wherever stdout goes.
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{"file":"src/messages.ts","format":"typescript","strings":[{"value":"Delete this file?","line":1,"column":25},{"value":"Saved ${count} items","line":2,"column":22}],"diagnostics":[],"summary":{"strings":2,"unlocated":0}}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Columns count UTF-16 code units, as an editor does. A value the source never
|
|
47
|
+
spells literally, such as a resolved escape or a folded YAML block, carries
|
|
48
|
+
no `line` or `column`, and `summary.unlocated` counts them.
|
|
49
|
+
|
|
50
|
+
## Exit codes
|
|
51
|
+
|
|
52
|
+
grep's convention:
|
|
53
|
+
|
|
54
|
+
- **0**: strings found.
|
|
55
|
+
- **1**: none found. That is an answer, not an error.
|
|
56
|
+
- **2**: the question was malformed, or `--strict` and a text file could not
|
|
57
|
+
be read.
|
|
58
|
+
|
|
59
|
+
## For agents
|
|
60
|
+
|
|
61
|
+
`string-le mcp` serves the Model Context Protocol on stdio with two tools:
|
|
62
|
+
`extract_strings` for a document's text and `string_le_scan` for files and
|
|
63
|
+
directories. Hosts that want the server alone can install
|
|
64
|
+
[`string-le-mcp`](https://www.npmjs.com/package/string-le-mcp).
|
|
65
|
+
|
|
66
|
+
`string-le --help` lists every option.
|
|
67
|
+
|
|
68
|
+
MIT licensed. Part of [letools](https://letools.dev/tools/string-le).
|
package/cli.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";var hs=Object.create;var Tr=Object.defineProperty;var ds=Object.getOwnPropertyDescriptor;var ps=Object.getOwnPropertyNames;var ms=Object.getPrototypeOf,gs=Object.prototype.hasOwnProperty;var k=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var _s=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ps(t))!gs.call(e,i)&&i!==r&&Tr(e,i,{get:()=>t[i],enumerable:!(n=ds(t,i))||n.enumerable});return e};var At=(e,t,r)=>(r=e!=null?hs(ms(e)):{},_s(t||!e||!e.__esModule?Tr(r,"default",{value:e,enumerable:!0}):r,e));var qr=k((If,jr)=>{var{hasOwnProperty:It}=Object.prototype,Rt=(e,t={})=>{typeof t=="string"&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;let r=t.platform==="win32"?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,n=t.whitespace?" = ":"=",i=[],s=t.sort?Object.keys(e).sort():Object.keys(e),o=0;t.align&&(o=J(s.filter(l=>e[l]===null||Array.isArray(e[l])||typeof e[l]!="object").map(l=>Array.isArray(e[l])?`${l}[]`:l).concat([""]).reduce((l,u)=>J(l).length>=J(u).length?l:u)).length);let a="",c=t.bracketedArray?"[]":"";for(let l of s){let u=e[l];if(u&&Array.isArray(u))for(let f of u)a+=J(`${l}${c}`).padEnd(o," ")+n+J(f)+r;else u&&typeof u=="object"?i.push(l):a+=J(l).padEnd(o," ")+n+J(u)+r}t.section&&a.length&&(a="["+J(t.section)+"]"+(t.newline?r+r:r)+a);for(let l of i){let u=Br(l,".").join("\\."),f=(t.section?t.section+".":"")+u,h=Rt(e[l],{...t,section:f});a.length&&h.length&&(a+=r),a+=h}return a};function Br(e,t){var r=0,n=0,i=0,s=[];do if(i=e.indexOf(t,r),i!==-1){if(r=i+t.length,i>0&&e[i-1]==="\\")continue;s.push(e.slice(n,i)),n=i+t.length}while(i!==-1);return s.push(e.slice(n)),s}var Hr=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;let r=Object.create(null),n=r,i=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g),a={};for(let l of o){if(!l||l.match(/^\s*[;#]/)||l.match(/^\s*$/))continue;let u=l.match(s);if(!u)continue;if(u[1]!==void 0){if(i=je(u[1]),i==="__proto__"){n=Object.create(null);continue}n=r[i]=r[i]||Object.create(null);continue}let f=je(u[2]),h;t.bracketedArray?h=f.length>2&&f.slice(-2)==="[]":(a[f]=(a?.[f]||0)+1,h=a[f]>1);let d=h&&f.endsWith("[]")?f.slice(0,-2):f;if(d==="__proto__")continue;let p=u[3]?je(u[4]):!0,g=p==="true"||p==="false"||p==="null"?JSON.parse(p):p;h&&(It.call(n,d)?Array.isArray(n[d])||(n[d]=[n[d]]):n[d]=[]),Array.isArray(n[d])?n[d].push(g):n[d]=g}let c=[];for(let l of Object.keys(r)){if(!It.call(r,l)||typeof r[l]!="object"||Array.isArray(r[l]))continue;let u=Br(l,".");n=r;let f=u.pop(),h=f.replace(/\\\./g,".");for(let d of u)d!=="__proto__"&&((!It.call(n,d)||typeof n[d]!="object")&&(n[d]=Object.create(null)),n=n[d]);n===r&&h===f||(n[h]=r[l],c.push(l))}for(let l of c)delete r[l];return r},Ur=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),J=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&Ur(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),je=e=>{if(e=(e||"").trim(),Ur(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,r="";for(let n=0,i=e.length;n<i;n++){let s=e.charAt(n);if(t)"\\;#".indexOf(s)!==-1?r+=s:r+="\\"+s,t=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?t=!0:r+=s}}return t&&(r+="\\"),r.trim()}return e};jr.exports={parse:Hr,decode:Hr,stringify:Rt,encode:Rt,safe:J,unsafe:je}});var en=k((Hf,Zr)=>{"use strict";var le=class e extends Error{constructor(t,r,n){super("[ParserError] "+t,r,n),this.name="ParserError",this.code="ParserError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}},Ke=class{constructor(t){this.parser=t,this.buf="",this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}},ve=class{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf="",this.char=null,this.ii=0,this.state=new Ke(this.parseStart)}parse(t){if(t.length===0||t.length==null)return;this._buf=String(t),this.ii=-1,this.char=-1;let r;for(;r===!1||this.nextChar();)r=this.runOne();this._buf=null}nextChar(){return this.char===10&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=1114112;let t;do t=this.state.parser,this.runOne();while(this.state.parser!==t);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(t){if(typeof t!="function")throw new le("Tried to set state to non-existent state: "+JSON.stringify(t));this.state.parser=t}goto(t){return this.next(t),this.runOne()}call(t,r){r&&this.next(r),this.stack.push(this.state),this.state=new Ke(t)}callNow(t,r){return this.call(t,r),this.runOne()}return(t){if(this.stack.length===0)throw this.error(new le("Stack underflow"));t===void 0&&(t=this.state.buf),this.state=this.stack.pop(),this.state.returned=t}returnNow(t){return this.return(t),this.runOne()}consume(){if(this.char===1114112)throw this.error(new le("Unexpected end-of-buffer"));this.state.buf+=this._buf[this.ii]}error(t){return t.line=this.line,t.col=this.col,t.pos=this.pos,t}parseStart(){throw new le("Must declare a parseStart method")}};ve.END=1114112;ve.Error=le;Zr.exports=ve});var rn=k((Bf,tn)=>{"use strict";tn.exports=e=>{let t=new Date(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var Ve=k((Uf,nn)=>{"use strict";nn.exports=(e,t)=>{for(t=String(t);t.length<e;)t="0"+t;return t}});var on=k((jf,sn)=>{"use strict";var _e=Ve(),kt=class extends Date{constructor(t){super(t+"Z"),this.isFloating=!0}toISOString(){let t=`${this.getUTCFullYear()}-${_e(2,this.getUTCMonth()+1)}-${_e(2,this.getUTCDate())}`,r=`${_e(2,this.getUTCHours())}:${_e(2,this.getUTCMinutes())}:${_e(2,this.getUTCSeconds())}.${_e(3,this.getUTCMilliseconds())}`;return`${t}T${r}`}};sn.exports=e=>{let t=new kt(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var cn=k((qf,ln)=>{"use strict";var an=Ve(),wo=global.Date,Dt=class extends wo{constructor(t){super(t),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${an(2,this.getUTCMonth()+1)}-${an(2,this.getUTCDate())}`}};ln.exports=e=>{let t=new Dt(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var fn=k((Kf,un)=>{"use strict";var We=Ve(),Ft=class extends Date{constructor(t){super(`0000-01-01T${t}Z`),this.isTime=!0}toISOString(){return`${We(2,this.getUTCHours())}:${We(2,this.getUTCMinutes())}:${We(2,this.getUTCSeconds())}.${We(3,this.getUTCMilliseconds())}`}};un.exports=e=>{let t=new Ft(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t}});var ze=k((exports,module)=>{"use strict";module.exports=makeParserClass(en());module.exports.makeParserClass=makeParserClass;var TomlError=class e extends Error{constructor(t){super(t),this.name="TomlError",Error.captureStackTrace&&Error.captureStackTrace(this,e),this.fromTOML=!0,this.wrapped=null}};TomlError.wrap=e=>{let t=new TomlError(e.message);return t.code=e.code,t.wrapped=e,t};module.exports.TomlError=TomlError;var createDateTime=rn(),createDateTimeFloat=on(),createDate=cn(),createTime=fn(),CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:"\b",[CHAR_t]:" ",[CHAR_n]:`
|
|
5
|
+
`,[CHAR_f]:"\f",[CHAR_r]:"\r",[CHAR_QUOT]:'"',[CHAR_BSOL]:"\\"};function isDigit(e){return e>=CHAR_0&&e<=CHAR_9}function isHexit(e){return e>=CHAR_A&&e<=CHAR_F||e>=CHAR_a&&e<=CHAR_f||e>=CHAR_0&&e<=CHAR_9}function isBit(e){return e===CHAR_1||e===CHAR_0}function isOctit(e){return e>=CHAR_0&&e<=CHAR_7}function isAlphaNumQuoteHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_APOS||e===CHAR_QUOT||e===CHAR_LOWBAR||e===CHAR_HYPHEN}function isAlphaNumHyphen(e){return e>=CHAR_A&&e<=CHAR_Z||e>=CHAR_a&&e<=CHAR_z||e>=CHAR_0&&e<=CHAR_9||e===CHAR_LOWBAR||e===CHAR_HYPHEN}var _type=Symbol("type"),_declared=Symbol("declared"),hasOwnProperty=Object.prototype.hasOwnProperty,defineProperty=Object.defineProperty,descriptor={configurable:!0,enumerable:!0,writable:!0,value:void 0};function hasKey(e,t){return hasOwnProperty.call(e,t)?!0:(t==="__proto__"&&defineProperty(e,"__proto__",descriptor),!1)}var INLINE_TABLE=Symbol("inline-table");function InlineTable(){return Object.defineProperties({},{[_type]:{value:INLINE_TABLE}})}function isInlineTable(e){return e===null||typeof e!="object"?!1:e[_type]===INLINE_TABLE}var TABLE=Symbol("table");function Table(){return Object.defineProperties({},{[_type]:{value:TABLE},[_declared]:{value:!1,writable:!0}})}function isTable(e){return e===null||typeof e!="object"?!1:e[_type]===TABLE}var _contentType=Symbol("content-type"),INLINE_LIST=Symbol("inline-list");function InlineList(e){return Object.defineProperties([],{[_type]:{value:INLINE_LIST},[_contentType]:{value:e}})}function isInlineList(e){return e===null||typeof e!="object"?!1:e[_type]===INLINE_LIST}var LIST=Symbol("list");function List(){return Object.defineProperties([],{[_type]:{value:LIST}})}function isList(e){return e===null||typeof e!="object"?!1:e[_type]===LIST}var _custom;try{let utilInspect=eval("require('util').inspect");_custom=utilInspect.custom}catch(e){}var _inspect=_custom||"inspect",BoxedBigInt=class{constructor(t){try{this.value=global.BigInt.asIntN(64,t)}catch{this.value=null}Object.defineProperty(this,_type,{value:INTEGER})}isNaN(){return this.value===null}toString(){return String(this.value)}[_inspect](){return`[BigInt: ${this.toString()}]}`}valueOf(){return this.value}},INTEGER=Symbol("integer");function Integer(e){let t=Number(e);return Object.is(t,-0)&&(t=0),global.BigInt&&!Number.isSafeInteger(t)?new BoxedBigInt(e):Object.defineProperties(new Number(t),{isNaN:{value:function(){return isNaN(this)}},[_type]:{value:INTEGER},[_inspect]:{value:()=>`[Integer: ${e}]`}})}function isInteger(e){return e===null||typeof e!="object"?!1:e[_type]===INTEGER}var FLOAT=Symbol("float");function Float(e){return Object.defineProperties(new Number(e),{[_type]:{value:FLOAT},[_inspect]:{value:()=>`[Float: ${e}]`}})}function isFloat(e){return e===null||typeof e!="object"?!1:e[_type]===FLOAT}function tomlType(e){let t=typeof e;if(t==="object"){if(e===null)return"null";if(e instanceof Date)return"datetime";if(_type in e)switch(e[_type]){case INLINE_TABLE:return"inline-table";case INLINE_LIST:return"inline-list";case TABLE:return"table";case LIST:return"list";case FLOAT:return"float";case INTEGER:return"integer"}}return t}function makeParserClass(e){class t extends e{constructor(){super(),this.ctx=this.obj=Table()}atEndOfWord(){return this.char===CHAR_NUM||this.char===CTRL_I||this.char===CHAR_SP||this.atEndOfLine()}atEndOfLine(){return this.char===e.END||this.char===CTRL_J||this.char===CTRL_M}parseStart(){if(this.char===e.END)return null;if(this.char===CHAR_LSQB)return this.call(this.parseTableOrList);if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(isAlphaNumQuoteHyphen(this.char))return this.callNow(this.parseAssignStatement);throw this.error(new TomlError(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(this.char===CHAR_NUM)return this.goto(this.parseComment);if(this.char===e.END||this.char===CTRL_J)return this.return();throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(n){let i=this.ctx,s=n.key.pop();for(let o of n.key){if(hasKey(i,o)&&(!isTable(i[o])||i[o][_declared]))throw this.error(new TomlError("Can't redefine existing key"));i=i[o]=i[o]||Table()}if(hasKey(i,s))throw this.error(new TomlError("Can't redefine existing key"));return isInteger(n.value)||isFloat(n.value)?i[s]=n.value.valueOf():i[s]=n.value,this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(n){return this.state.resultTable?this.state.resultTable.push(n):this.state.resultTable=[n],this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){if(this.char===CHAR_PERIOD)return this.next(this.parseAssignKeywordPostDot);if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.goto(this.parseAssignEqual)}parseAssignKeywordPostDot(){if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===CHAR_EQUALS)return this.next(this.parseAssignPreValue);throw this.error(new TomlError('Invalid character, expected "="'))}parseAssignPreValue(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(n){return this.returnNow({key:this.state.resultTable,value:n})}parseComment(){do if(this.char===e.END||this.char===CTRL_J)return this.return();while(this.nextChar())}parseTableOrList(){if(this.char===CHAR_LSQB)this.next(this.parseList);else return this.goto(this.parseTable)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(n){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,n)&&(!isTable(this.ctx[n])||this.ctx[n][_declared]))throw this.error(new TomlError("Can't redefine existing key"));return this.ctx=this.ctx[n]=this.ctx[n]||Table(),this.ctx[_declared]=!0,this.next(this.parseWhitespaceToEOL)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,n))this.ctx=this.ctx[n]=Table();else if(isTable(this.ctx[n]))this.ctx=this.ctx[n];else if(isList(this.ctx[n]))this.ctx=this.ctx[n][this.ctx[n].length-1];else throw this.error(new TomlError("Can't redefine existing key"));return this.next(this.parseTableNext)}else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(n){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,n)||(this.ctx[n]=List()),isInlineList(this.ctx[n]))throw this.error(new TomlError("Can't extend an inline array"));if(isList(this.ctx[n])){let i=Table();this.ctx[n].push(i),this.ctx=i}else throw this.error(new TomlError("Can't redefine an existing key"));return this.next(this.parseListEnd)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,n))this.ctx=this.ctx[n]=Table();else{if(isInlineList(this.ctx[n]))throw this.error(new TomlError("Can't extend an inline array"));if(isInlineTable(this.ctx[n]))throw this.error(new TomlError("Can't extend an inline table"));if(isList(this.ctx[n]))this.ctx=this.ctx[n][this.ctx[n].length-1];else if(isTable(this.ctx[n]))this.ctx=this.ctx[n];else throw this.error(new TomlError("Can't redefine an existing key"))}return this.next(this.parseListNext)}else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseListEnd(n){if(this.char===CHAR_RSQB)return this.next(this.parseWhitespaceToEOL);throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseValue(){if(this.char===e.END)throw this.error(new TomlError("Key without value"));if(this.char===CHAR_QUOT)return this.next(this.parseDoubleString);if(this.char===CHAR_APOS)return this.next(this.parseSingleString);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)return this.goto(this.parseNumberSign);if(this.char===CHAR_i)return this.next(this.parseInf);if(this.char===CHAR_n)return this.next(this.parseNan);if(isDigit(this.char))return this.goto(this.parseNumberOrDateTime);if(this.char===CHAR_t||this.char===CHAR_f)return this.goto(this.parseBoolean);if(this.char===CHAR_LSQB)return this.call(this.parseInlineList,this.recordValue);if(this.char===CHAR_LCUB)return this.call(this.parseInlineTable,this.recordValue);throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"))}recordValue(n){return this.returnNow(n)}parseInf(){if(this.char===CHAR_n)return this.next(this.parseInf2);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseInf2(){if(this.char===CHAR_f)return this.state.buf==="-"?this.return(-1/0):this.return(1/0);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseNan(){if(this.char===CHAR_a)return this.next(this.parseNan2);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseNan2(){if(this.char===CHAR_n)return this.return(NaN);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseKeyword(){return this.char===CHAR_QUOT?this.next(this.parseBasicString):this.char===CHAR_APOS?this.next(this.parseLiteralString):this.goto(this.parseBareKey)}parseBareKey(){do{if(this.char===e.END)throw this.error(new TomlError("Key ended without value"));if(isAlphaNumHyphen(this.char))this.consume();else{if(this.state.buf.length===0)throw this.error(new TomlError("Empty bare keys are not allowed"));return this.returnNow()}}while(this.nextChar())}parseSingleString(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiStringMaybe):this.goto(this.parseLiteralString)}parseLiteralString(){do{if(this.char===CHAR_APOS)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiStringMaybe(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiString):this.returnNow()}parseLiteralMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseLiteralMultiStringContent):this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do{if(this.char===CHAR_APOS)return this.next(this.parseLiteralMultiEnd);if(this.char===e.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiEnd(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd2):(this.state.buf+="'",this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd2(){return this.char===CHAR_APOS?this.return():(this.state.buf+="''",this.goto(this.parseLiteralMultiStringContent))}parseDoubleString(){return this.char===CHAR_QUOT?this.next(this.parseMultiStringMaybe):this.goto(this.parseBasicString)}parseBasicString(){do{if(this.char===CHAR_BSOL)return this.call(this.parseEscape,this.recordEscapeReplacement);if(this.char===CHAR_QUOT)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}recordEscapeReplacement(n){return this.state.buf+=n,this.goto(this.parseBasicString)}parseMultiStringMaybe(){return this.char===CHAR_QUOT?this.next(this.parseMultiString):this.returnNow()}parseMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseMultiStringContent):this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do{if(this.char===CHAR_BSOL)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);if(this.char===CHAR_QUOT)return this.next(this.parseMultiEnd);if(this.char===e.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}errorControlCharInString(){let n="\\u00";return this.char<16&&(n+="0"),n+=this.char.toString(16),this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${n} instead`))}recordMultiEscapeReplacement(n){return this.state.buf+=n,this.goto(this.parseMultiStringContent)}parseMultiEnd(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd2):(this.state.buf+='"',this.goto(this.parseMultiStringContent))}parseMultiEnd2(){return this.char===CHAR_QUOT?this.return():(this.state.buf+='""',this.goto(this.parseMultiStringContent))}parseMultiEscape(){return this.char===CTRL_M||this.char===CTRL_J?this.next(this.parseMultiTrim):this.char===CHAR_SP||this.char===CTRL_I?this.next(this.parsePreMultiTrim):this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CTRL_M||this.char===CTRL_J)return this.next(this.parseMultiTrim);throw this.error(new TomlError("Can't escape whitespace"))}parseMultiTrim(){return this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M?null:this.returnNow()}parseEscape(){if(this.char in escapes)return this.return(escapes[this.char]);if(this.char===CHAR_u)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);if(this.char===CHAR_U)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);throw this.error(new TomlError("Unknown escape character: "+this.char))}parseUnicodeReturn(n){try{let i=parseInt(n,16);if(i>=SURROGATE_FIRST&&i<=SURROGATE_LAST)throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));return this.returnNow(String.fromCodePoint(i))}catch(i){throw this.error(TomlError.wrap(i))}}parseSmallUnicode(){if(isHexit(this.char)){if(this.consume(),this.state.buf.length>=4)return this.return()}else throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"))}parseLargeUnicode(){if(isHexit(this.char)){if(this.consume(),this.state.buf.length>=8)return this.return()}else throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"))}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){return this.char===CHAR_i?this.next(this.parseInf):this.char===CHAR_n?this.next(this.parseNan):this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal)):this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){return this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Integer(this.state.buf))}parseNumberInteger(){if(isDigit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);{let n=Integer(this.state.buf);if(n.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(n)}}}parseNoUnder(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD||this.char===CHAR_E||this.char===CHAR_e)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNumberFloat(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberFloat);if(isDigit(this.char))this.consume();else return this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Float(this.state.buf))}parseNumberExponentSign(){if(isDigit(this.char))return this.goto(this.parseNumberExponent);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent);else throw this.error(new TomlError("Unexpected character, expected -, + or digit"))}parseNumberExponent(){if(isDigit(this.char))this.consume();else return this.char===CHAR_LOWBAR?this.call(this.parseNoUnder):this.returnNow(Float(this.state.buf))}parseNumberOrDateTime(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberBaseOrDateTime)):this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberInteger);if(isDigit(this.char))this.consume(),this.state.buf.length>4&&this.next(this.parseNumberInteger);else return this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_HYPHEN?this.goto(this.parseDateTime):this.char===CHAR_COLON?this.goto(this.parseOnlyTimeHour):this.returnNow(Integer(this.state.buf))}parseDateTimeOnly(){if(this.state.buf.length<4){if(isDigit(this.char))return this.consume();if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);throw this.error(new TomlError("Expected digit while parsing year part of a date"))}else{if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"))}}parseNumberBaseOrDateTime(){return this.char===CHAR_b?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin)):this.char===CHAR_o?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct)):this.char===CHAR_x?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex)):this.char===CHAR_PERIOD?this.goto(this.parseNumberInteger):isDigit(this.char)?this.goto(this.parseDateTimeOnly):this.returnNow(Integer(this.state.buf))}parseIntegerHex(){if(isHexit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{let n=Integer(this.state.buf);if(n.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(n)}}}parseIntegerOct(){if(isOctit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{let n=Integer(this.state.buf);if(n.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(n)}}}parseIntegerBin(){if(isBit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{let n=Integer(this.state.buf);if(n.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(n)}}}parseDateTime(){if(this.state.buf.length<4)throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===CHAR_HYPHEN){if(this.state.buf.length<2)throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseDateDay)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}parseDateDay(){if(this.char===CHAR_T||this.char===CHAR_SP){if(this.state.buf.length<2)throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseStartTimeHour)}else{if(this.atEndOfWord())return this.returnNow(createDate(this.state.result+"-"+this.state.buf));if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}}parseStartTimeHour(){return this.atEndOfWord()?this.returnNow(createDate(this.state.result)):this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result+="T"+this.state.buf,this.state.buf="",this.next(this.parseTimeMin)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}parseTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else{if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeSec);throw this.error(new TomlError("Incomplete datetime"))}}parseTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeZoneOrFraction)}else throw this.error(new TomlError("Incomplete datetime"))}parseOnlyTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeMin)}else throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else{if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeSec);throw this.error(new TomlError("Incomplete time"))}}parseOnlyTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.next(this.parseOnlyTimeFractionMaybe)}else throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeFractionMaybe(){if(this.state.result+=":"+this.state.buf,this.char===CHAR_PERIOD)this.state.buf="",this.next(this.parseOnlyTimeFraction);else return this.return(createTime(this.state.result))}parseOnlyTimeFraction(){if(isDigit(this.char))this.consume();else if(this.atEndOfWord()){if(this.state.buf.length===0)throw this.error(new TomlError("Expected digit in milliseconds"));return this.returnNow(createTime(this.state.result+"."+this.state.buf))}else throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}parseTimeZoneOrFraction(){if(this.char===CHAR_PERIOD)this.consume(),this.next(this.parseDateTimeFraction);else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else{if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}}parseDateTimeFraction(){if(isDigit(this.char))this.consume();else{if(this.state.buf.length===1)throw this.error(new TomlError("Expected digit in milliseconds"));if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else{if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}}}parseTimeZoneHour(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}else throw this.error(new TomlError("Unexpected character in datetime, expected digit"))}parseTimeZoneSep(){if(this.char===CHAR_COLON)this.consume(),this.next(this.parseTimeZoneMin);else throw this.error(new TomlError("Unexpected character in datetime, expected colon"))}parseTimeZoneMin(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(createDateTime(this.state.result+this.state.buf))}else throw this.error(new TomlError("Unexpected character in datetime, expected digit"))}parseBoolean(){if(this.char===CHAR_t)return this.consume(),this.next(this.parseTrue_r);if(this.char===CHAR_f)return this.consume(),this.next(this.parseFalse_a)}parseTrue_r(){if(this.char===CHAR_r)return this.consume(),this.next(this.parseTrue_u);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_u(){if(this.char===CHAR_u)return this.consume(),this.next(this.parseTrue_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_e(){if(this.char===CHAR_e)return this.return(!0);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_a(){if(this.char===CHAR_a)return this.consume(),this.next(this.parseFalse_l);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_l(){if(this.char===CHAR_l)return this.consume(),this.next(this.parseFalse_s);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_s(){if(this.char===CHAR_s)return this.consume(),this.next(this.parseFalse_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_e(){if(this.char===CHAR_e)return this.return(!1);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseInlineList(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===e.END)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_NUM?this.call(this.parseComment):this.char===CHAR_RSQB?this.return(this.state.resultArr||InlineList()):this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(n){if(this.state.resultArr){let i=this.state.resultArr[_contentType],s=tomlType(n);if(i!==s)throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${i} and ${s}`))}else this.state.resultArr=InlineList(tomlType(n));return isFloat(n)||isInteger(n)?this.state.resultArr.push(n.valueOf()):this.state.resultArr.push(n),this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CHAR_COMMA)return this.next(this.parseInlineList);if(this.char===CHAR_RSQB)return this.goto(this.parseInlineList);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}parseInlineTable(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_RCUB?this.return(this.state.resultTable||InlineTable()):(this.state.resultTable||(this.state.resultTable=InlineTable()),this.callNow(this.parseAssign,this.recordInlineTableValue))}recordInlineTableValue(n){let i=this.state.resultTable,s=n.key.pop();for(let o of n.key){if(hasKey(i,o)&&(!isTable(i[o])||i[o][_declared]))throw this.error(new TomlError("Can't redefine existing key"));i=i[o]=i[o]||Table()}if(hasKey(i,s))throw this.error(new TomlError("Can't redefine existing key"));return isInteger(n.value)||isFloat(n.value)?i[s]=n.value.valueOf():i[s]=n.value,this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));if(this.char===CHAR_COMMA)return this.next(this.parseInlineTable);if(this.char===CHAR_RCUB)return this.goto(this.parseInlineTable);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}}return t}});var Ye=k((Vf,hn)=>{"use strict";hn.exports=No;function No(e,t){if(e.pos==null||e.line==null)return e;let r=e.message;if(r+=` at row ${e.line+1}, col ${e.col+1}, pos ${e.pos}:
|
|
6
|
+
`,t&&t.split){let n=t.split(/\n/),i=String(Math.min(n.length,e.line+3)).length,s=" ";for(;s.length<i;)s+=" ";for(let o=Math.max(0,e.line-1);o<Math.min(n.length,e.line+2);++o){let a=String(o+1);if(a.length<i&&(a=" "+a),e.line===o){r+=a+"> "+n[o]+`
|
|
7
|
+
`,r+=s+" ";for(let c=0;c<e.col;++c)r+=" ";r+=`^
|
|
8
|
+
`}else r+=a+": "+n[o]+`
|
|
9
|
+
`}}return e.message=r+`
|
|
10
|
+
`,e}});var pn=k((Wf,dn)=>{"use strict";dn.exports=ko;var Lo=ze(),vo=Ye();function ko(e){global.Buffer&&global.Buffer.isBuffer(e)&&(e=e.toString("utf8"));let t=new Lo;try{return t.parse(e),t.finish()}catch(r){throw vo(r,e)}}});var _n=k((zf,gn)=>{"use strict";gn.exports=Fo;var Do=ze(),mn=Ye();function Fo(e,t){t||(t={});let r=0,n=t.blocksize||40960,i=new Do;return new Promise((o,a)=>{setImmediate(s,r,n,o,a)});function s(o,a,c,l){if(o>=e.length)try{return c(i.finish())}catch(u){return l(mn(u,e))}try{i.parse(e.slice(o,o+a)),setImmediate(s,o+a,a,c,l)}catch(u){l(mn(u,e))}}}});var Sn=k((Yf,En)=>{"use strict";En.exports=$o;var Po=require("stream"),yn=ze();function $o(e){return e?Mo(e):Ho(e)}function Mo(e){let t=new yn;return e.setEncoding("utf8"),new Promise((r,n)=>{let i,s=!1,o=!1;function a(){if(s=!0,!i)try{r(t.finish())}catch(u){n(u)}}function c(u){o=!0,n(u)}e.once("end",a),e.once("error",c),l();function l(){i=!0;let u;for(;(u=e.read())!==null;)try{t.parse(u)}catch(f){return c(f)}if(i=!1,s)return a();o||e.once("readable",l)}})}function Ho(){let e=new yn;return new Po.Transform({objectMode:!0,transform(t,r,n){try{e.parse(t.toString(r))}catch(i){this.emit("error",i)}n()},flush(t){try{this.push(e.finish())}catch(r){this.emit("error",r)}t()}})}});var bn=k((Gf,ke)=>{"use strict";ke.exports=pn();ke.exports.async=_n();ke.exports.stream=Sn();ke.exports.prettyError=Ye()});var wn=k((Jf,Mt)=>{"use strict";Mt.exports=Bo;Mt.exports.value=$t;function Bo(e){if(e===null)throw ce("null");if(e===void 0)throw ce("undefined");if(typeof e!="object")throw ce(typeof e);if(typeof e.toJSON=="function"&&(e=e.toJSON()),e==null)return null;let t=M(e);if(t!=="table")throw ce(t);return Pt("","",e)}function ce(e){return new Error("Can only stringify objects, not "+e)}function Uo(){return new Error("Array values can't have mixed types")}function An(e){return Object.keys(e).filter(t=>Tn(e[t]))}function jo(e){return Object.keys(e).filter(t=>!Tn(e[t]))}function Ge(e){let t=Array.isArray(e)?[]:Object.prototype.hasOwnProperty.call(e,"__proto__")?{["__proto__"]:void 0}:{};for(let r of Object.keys(e))e[r]&&typeof e[r].toJSON=="function"&&!("toISOString"in e[r])?t[r]=e[r].toJSON():t[r]=e[r];return t}function Pt(e,t,r){r=Ge(r);var n,i;n=An(r),i=jo(r);var s=[],o=t||"";n.forEach(c=>{var l=M(r[c]);l!=="undefined"&&l!=="null"&&s.push(o+Je(c)+" = "+On(r[c],!0))}),s.length>0&&s.push("");var a=e&&n.length>0?t+" ":"";return i.forEach(c=>{s.push(Zo(e,a,c,r[c]))}),s.join(`
|
|
11
|
+
`)}function Tn(e){switch(M(e)){case"undefined":case"null":case"integer":case"nan":case"float":case"boolean":case"string":case"datetime":return!0;case"array":return e.length===0||M(e[0])!=="table";case"table":return Object.keys(e).length===0;default:return!1}}function M(e){return e===void 0?"undefined":e===null?"null":typeof e=="bigint"||Number.isInteger(e)&&!Object.is(e,-0)?"integer":typeof e=="number"?"float":typeof e=="boolean"?"boolean":typeof e=="string"?"string":"toISOString"in e?isNaN(e)?"undefined":"datetime":Array.isArray(e)?"array":"table"}function Je(e){var t=String(e);return/^[-A-Za-z0-9_]+$/.test(t)?t:Cn(t)}function Cn(e){return'"'+xn(e).replace(/"/g,'\\"')+'"'}function qo(e){return"'"+e+"'"}function Ko(e,t){for(;t.length<e;)t="0"+t;return t}function xn(e){return e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/([\u0000-\u001f\u007f])/,t=>"\\u"+Ko(4,t.codePointAt(0).toString(16)))}function Vo(e){let t=e.split(/\n/).map(r=>xn(r).replace(/"(?="")/g,'\\"')).join(`
|
|
12
|
+
`);return t.slice(-1)==='"'&&(t+=`\\
|
|
13
|
+
`),`"""
|
|
14
|
+
`+t+'"""'}function On(e,t){let r=M(e);return r==="string"&&(t&&/\n/.test(e)?r="string-multiline":!/[\b\t\n\f\r']/.test(e)&&/"/.test(e)&&(r="string-literal")),$t(e,r)}function $t(e,t){switch(t||(t=M(e)),t){case"string-multiline":return Vo(e);case"string":return Cn(e);case"string-literal":return qo(e);case"integer":return In(e);case"float":return Wo(e);case"boolean":return zo(e);case"datetime":return Yo(e);case"array":return Qo(e.filter(r=>M(r)!=="null"&&M(r)!=="undefined"&&M(r)!=="nan"));case"table":return Xo(e);default:throw ce(t)}}function In(e){return String(e).replace(/\B(?=(\d{3})+(?!\d))/g,"_")}function Wo(e){if(e===1/0)return"inf";if(e===-1/0)return"-inf";if(Object.is(e,NaN))return"nan";if(Object.is(e,-0))return"-0.0";var t=String(e).split("."),r=t[0],n=t[1]||0;return In(r)+"."+n}function zo(e){return String(e)}function Yo(e){return e.toISOString()}function Go(e){return e==="float"||e==="integer"}function Jo(e){var t=M(e[0]);return e.every(r=>M(r)===t)?t:e.every(r=>Go(M(r)))?"float":"mixed"}function Rn(e){let t=Jo(e);if(t==="mixed")throw Uo();return t}function Qo(e){e=Ge(e);let t=Rn(e);var r="[",n=e.map(i=>$t(i,t));return n.join(", ").length>60||/\n/.test(n)?r+=`
|
|
15
|
+
`+n.join(`,
|
|
16
|
+
`)+`
|
|
17
|
+
`:r+=" "+n.join(", ")+(n.length>0?" ":""),r+"]"}function Xo(e){e=Ge(e);var t=[];return Object.keys(e).forEach(r=>{t.push(Je(r)+" = "+On(e[r],!1))}),"{ "+t.join(", ")+(t.length>0?" ":"")+"}"}function Zo(e,t,r,n){var i=M(n);if(i==="array")return ea(e,t,r,n);if(i==="table")return ta(e,t,r,n);throw ce(i)}function ea(e,t,r,n){n=Ge(n),Rn(n);var i=M(n[0]);if(i!=="table")throw ce(i);var s=e+Je(r),o="";return n.forEach(a=>{o.length>0&&(o+=`
|
|
18
|
+
`),o+=t+"[["+s+`]]
|
|
19
|
+
`,o+=Pt(s+".",t,a)}),o}function ta(e,t,r,n){var i=e+Je(r),s="";return An(n).length>0&&(s+=t+"["+i+`]
|
|
20
|
+
`),s+Pt(i+".",t,n)}});var Nn=k(Ht=>{"use strict";Ht.parse=bn();Ht.stringify=wn()});var Gi=k((ad,dt)=>{function qi(e){return Array.isArray(e)?e:[e]}var Vc=void 0,mr="",Ui=" ",pr="\\",Wc=/^\s+$/,zc=/(?:[^\\]|^)\\$/,Yc=/^\\!/,Gc=/^\\#/,Jc=/\r?\n/g,Qc=/^\.{0,2}\/|^\.{1,2}$/,Xc=/\/$/,Ce="/",Ki="node-ignore";typeof Symbol<"u"&&(Ki=Symbol.for("node-ignore"));var Vi=Ki,xe=(e,t,r)=>(Object.defineProperty(e,t,{value:r}),r),Zc=/([0-z])-([0-z])/g,Wi=()=>!1,eu=e=>e.replace(Zc,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:mr),tu=e=>{let{length:t}=e;return e.slice(0,t-t%2)},ru=[[/^\uFEFF/,()=>mr],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,r)=>t+(r.indexOf("\\")===0?Ui:mr)],[/(\\+?)\s/g,(e,t)=>{let{length:r}=t;return t.slice(0,r-r%2)+Ui}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,r)=>t+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return t+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>pr],[/\\\\/g,()=>pr],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,r,n,i)=>t===pr?`\\[${r}${tu(n)}${i}`:i==="]"&&n.length%2===0?`[${eu(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],nu=/(^|\\\/)?\\\*$/,Pe="regex",ft="checkRegex",ji="_",iu={[Pe](e,t){return`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`},[ft](e,t){return`${t?`${t}[^/]*`:"[^/]*"}(?=$|\\/$)`}},su=e=>ru.reduce((t,[r,n])=>t.replace(r,n.bind(e)),e),ht=e=>typeof e=="string",ou=e=>e&&ht(e)&&!Wc.test(e)&&!zc.test(e)&&e.indexOf("#")!==0,au=e=>e.split(Jc).filter(Boolean),gr=class{constructor(t,r,n,i,s,o){this.pattern=t,this.mark=r,this.negative=s,xe(this,"body",n),xe(this,"ignoreCase",i),xe(this,"regexPrefix",o)}get regex(){let t=ji+Pe;return this[t]?this[t]:this._make(Pe,t)}get checkRegex(){let t=ji+ft;return this[t]?this[t]:this._make(ft,t)}_make(t,r){let n=this.regexPrefix.replace(nu,iu[t]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return xe(this,r,i)}},lu=({pattern:e,mark:t},r)=>{let n=!1,i=e;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(Yc,"!").replace(Gc,"#");let s=su(i);return new gr(e,t,i,r,n,s)},_r=class{constructor(t){this._ignoreCase=t,this._rules=[]}_add(t){if(t&&t[Vi]){this._rules=this._rules.concat(t._rules._rules),this._added=!0;return}if(ht(t)&&(t={pattern:t}),ou(t.pattern)){let r=lu(t,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(t){return this._added=!1,qi(ht(t)?au(t):t).forEach(this._add,this),this._added}test(t,r,n){let i=!1,s=!1,o;this._rules.forEach(c=>{let{negative:l}=c;s===l&&i!==s||l&&!i&&!s&&!r||!c[n].test(t)||(i=!l,s=l,o=l?Vc:c)});let a={ignored:i,unignored:s};return o&&(a.rule=o),a}},cu=(e,t)=>{throw new t(e)},X=(e,t,r)=>ht(e)?e?X.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${t}\``,TypeError),zi=e=>Qc.test(e);X.isNotRelative=zi;X.convert=e=>e;var yr=class{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){xe(this,Vi,!0),this._rules=new _r(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(t){return this._rules.add(t)&&this._initCache(),this}addPattern(t){return this.add(t)}_test(t,r,n,i){let s=t&&X.convert(t);return X(s,t,this._strictPathCheck?cu:Wi),this._t(s,r,n,i)}checkIgnore(t){if(!Xc.test(t))return this.test(t);let r=t.split(Ce).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(Ce)+Ce,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(t,!1,ft)}_t(t,r,n,i){if(t in r)return r[t];if(i||(i=t.split(Ce).filter(Boolean)),i.pop(),!i.length)return r[t]=this._rules.test(t,n,Pe);let s=this._t(i.join(Ce)+Ce,r,n,i);return r[t]=s.ignored?s:this._rules.test(t,n,Pe)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return qi(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},Er=e=>new yr(e),uu=e=>X(e&&X.convert(e),e,Wi),Yi=()=>{let e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");X.convert=e;let t=/^[a-z]:\//i;X.isNotRelative=r=>t.test(r)||zi(r)};typeof process<"u"&&process.platform==="win32"&&Yi();dt.exports=Er;Er.default=Er;dt.exports.isPathValid=uu;xe(dt.exports,Symbol.for("setupWindows"),Yi)});var Cr="string-le",Tt="2.6.1";var me=function(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)};var y=class e extends Error{constructor(t,r,n,...i){Array.isArray(r)&&(r=r.join(" ").trim()),super(r),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,e),this.code=t;for(let s of i)for(let o in s){let a=s[o];this[o]=Buffer.isBuffer(a)?a.toString(n.encoding):a==null?a:JSON.parse(JSON.stringify(a))}}};var Ue=function(e){let t=[];for(let r=0,n=e.length;r<n;r++){let i=e[r];if(i==null||i===!1)t[r]={disabled:!0};else if(typeof i=="string"||typeof i=="number")t[r]={name:`${i}`};else if(me(i)){if(typeof i.name!="string")throw new y("CSV_OPTION_COLUMNS_MISSING_NAME",["Option columns missing name:",`property "name" is required at position ${r}`,"when column is an object literal"]);t[r]=i}else throw new y("CSV_INVALID_COLUMN_DEFINITION",["Invalid column definition:","expect a string or a literal object,",`got ${JSON.stringify(i)} at position ${r}`])}return t};var Ct=class{constructor(t=100){this.size=t,this.length=0,this.buf=Buffer.allocUnsafe(t)}prepend(t){if(Buffer.isBuffer(t)){let r=this.length+t.length;if(r>=this.size&&(this.resize(),r>=this.size))throw Error("INVALID_BUFFER_STATE");let n=this.buf;this.buf=Buffer.allocUnsafe(this.size),t.copy(this.buf,0),n.copy(this.buf,t.length),this.length+=t.length}else{let r=this.length++;r===this.size&&this.resize();let n=this.clone();this.buf[0]=t,n.copy(this.buf,1,0,r)}}append(t){let r=this.length++;r===this.size&&this.resize(),this.buf[r]=t}clone(){return Buffer.from(this.buf.slice(0,this.length))}resize(){let t=this.length;this.size=this.size*2;let r=Buffer.allocUnsafe(this.size);this.buf.copy(r,0,0,t),this.buf=r}toString(t){return t?this.buf.toString(t,0,this.length):Uint8Array.prototype.slice.call(this.buf.slice(0,this.length))}toJSON(){return this.toString("utf8")}reset(){this.length=0}},xt=Ct;var xr=function(e){let t=[32,9,10,13,12,11,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288,65279].reduce((n,i)=>{let s=Buffer.from(String.fromCharCode(i),e.encoding);return i!==63&&s.length===1&&s[0]===63||n.push(s),n},[]),r=new Uint8Array(256);for(let n of t)r[n[0]]=1;return{bomSkipped:!1,bufBytesStart:0,castField:e.cast_function,commenting:!1,delimiterBufPrevious:void 0,delimiterDiscovered:!1,error:void 0,enabled:e.from_line===1,escaping:!1,escapeIsQuote:Buffer.isBuffer(e.escape)&&Buffer.isBuffer(e.quote)&&Buffer.compare(e.escape,e.quote)===0,expectedRecordLength:Array.isArray(e.columns)?e.columns.length:void 0,field:new xt(20),firstLineToHeaders:e.cast_first_line_to_header,needMoreDataSize:Math.max(e.comment!==null?e.comment.length:0,...e.delimiter?e.delimiter.map(n=>n.length):[],e.delimiter_auto?1:0,e.quote!==null?e.quote.length:0,...t.map(n=>n.length)),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new xt(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:e.record_delimiter.length===0?0:Math.max(...e.record_delimiter.map(n=>n.length)),trimChars:[Buffer.from(" ",e.encoding)[0],Buffer.from(" ",e.encoding)[0]],wasQuoting:!1,wasRowDelimiter:!1,timchars:t,timcharFirstBytes:r}};var Or=function(e){return e.replace(/([A-Z])/g,function(t,r){return"_"+r.toLowerCase()})};var oe=function(e){let t={};for(let n in e)t[Or(n)]=e[n];if(t.encoding===void 0||t.encoding===!0)t.encoding="utf8";else if(t.encoding===null||t.encoding===!1)t.encoding=null;else if(typeof t.encoding!="string"&&t.encoding!==null)throw new y("CSV_INVALID_OPTION_ENCODING",["Invalid option encoding:","encoding must be a string or null to return a buffer,",`got ${JSON.stringify(t.encoding)}`],t);if(t.bom===void 0||t.bom===null||t.bom===!1)t.bom=!1;else if(t.bom!==!0)throw new y("CSV_INVALID_OPTION_BOM",["Invalid option bom:","bom must be true,",`got ${JSON.stringify(t.bom)}`],t);if(t.cast_function=null,t.cast===void 0||t.cast===null||t.cast===!1||t.cast==="")t.cast=void 0;else if(typeof t.cast=="function")t.cast_function=t.cast,t.cast=!0;else if(t.cast!==!0)throw new y("CSV_INVALID_OPTION_CAST",["Invalid option cast:","cast must be true or a function,",`got ${JSON.stringify(t.cast)}`],t);if(t.cast_date===void 0||t.cast_date===null||t.cast_date===!1||t.cast_date==="")t.cast_date=!1;else if(t.cast_date===!0)t.cast_date=function(n){let i=Date.parse(n);return isNaN(i)?n:new Date(i)};else if(typeof t.cast_date!="function")throw new y("CSV_INVALID_OPTION_CAST_DATE",["Invalid option cast_date:","cast_date must be true or a function,",`got ${JSON.stringify(t.cast_date)}`],t);if(t.cast_first_line_to_header=void 0,t.columns===!0)t.cast_first_line_to_header=void 0;else if(typeof t.columns=="function")t.cast_first_line_to_header=t.columns,t.columns=!0;else if(Array.isArray(t.columns))t.columns=Ue(t.columns);else if(t.columns===void 0||t.columns===null||t.columns===!1)t.columns=!1;else throw new y("CSV_INVALID_OPTION_COLUMNS",["Invalid option columns:","expect an array, a function or true,",`got ${JSON.stringify(t.columns)}`],t);if(t.group_columns_by_name===void 0||t.group_columns_by_name===null||t.group_columns_by_name===!1)t.group_columns_by_name=!1;else{if(t.group_columns_by_name!==!0)throw new y("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",["Invalid option group_columns_by_name:","expect an boolean,",`got ${JSON.stringify(t.group_columns_by_name)}`],t);if(t.columns===!1)throw new y("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",["Invalid option group_columns_by_name:","the `columns` mode must be activated."],t)}if(t.comment===void 0||t.comment===null||t.comment===!1||t.comment==="")t.comment=null;else if(typeof t.comment=="string"&&(t.comment=Buffer.from(t.comment,t.encoding)),!Buffer.isBuffer(t.comment))throw new y("CSV_INVALID_OPTION_COMMENT",["Invalid option comment:","comment must be a buffer or a string,",`got ${JSON.stringify(t.comment)}`],t);if(t.comment_no_infix===void 0||t.comment_no_infix===null||t.comment_no_infix===!1)t.comment_no_infix=!1;else if(t.comment_no_infix!==!0)throw new y("CSV_INVALID_OPTION_COMMENT",["Invalid option comment_no_infix:","value must be a boolean,",`got ${JSON.stringify(t.comment_no_infix)}`],t);if(t.delimiter_auto===void 0||t.delimiter_auto===null||t.delimiter_auto===!1)t.delimiter_auto=!1;else if(t.delimiter_auto===!0)t.delimiter_auto={};else if(!me(t.delimiter_auto))throw new y("CSV_INVALID_OPTION_DELIMITER_AUTO",["Invalid option delimiter_auto:","delimiter_auto must be a boolean or a configuration object,",`got ${JSON.stringify(t.delimiter_auto)}`],t);if(t.delimiter_auto){if(t.delimiter_auto.preferred===void 0)t.delimiter_auto.preferred={44:1.8,9:1.8,59:1.6,32:1.6,58:1.5,46:1.4,47:1.4};else if(!me(t.delimiter_auto.preferred))throw new y("CSV_INVALID_OPTION_DELIMITER_AUTO",["Invalid option delimiter_auto:","preferred must be an object,",`got ${JSON.stringify(t.delimiter_auto.preferred)}`],t);if(t.delimiter_auto.score===void 0)t.delimiter_auto.score=(n,i)=>(n.total-n.std)*(i.preferred[n.char_code]||1);else if(typeof t.delimiter_auto.score!="function")throw new y("CSV_INVALID_OPTION_DELIMITER_AUTO",["Invalid option delimiter_auto:","score must be a function,",`got ${JSON.stringify(t.delimiter_auto.score)}`],t);if(t.delimiter_auto.size===void 0)t.delimiter_auto.size=2048;else if(typeof t.delimiter_auto.size!="number")throw new y("CSV_INVALID_OPTION_DELIMITER_AUTO",["Invalid option delimiter_auto:","size must be a number,",`got ${JSON.stringify(t.delimiter_auto.size)}`],t)}let r=JSON.stringify(t.delimiter);if(t.delimiter_auto!==!1&&(t.delimiter=[]),Array.isArray(t.delimiter)||((t.delimiter===void 0||t.delimiter===null||t.delimiter===!1)&&(t.delimiter=Buffer.from(",",t.encoding)),t.delimiter=[t.delimiter]),t.delimiter=t.delimiter.map(function(n){if(typeof n=="string"&&(n=Buffer.from(n,t.encoding)),!Buffer.isBuffer(n)||n.length===0)throw new y("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${r}`],t);return n}),t.escape===void 0||t.escape===!0?t.escape=Buffer.from('"',t.encoding):typeof t.escape=="string"?t.escape=Buffer.from(t.escape,t.encoding):(t.escape===null||t.escape===!1)&&(t.escape=null),t.escape!==null&&!Buffer.isBuffer(t.escape))throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(t.escape)}`);if(t.from===void 0||t.from===null)t.from=1;else if(typeof t.from=="string"&&/\d+/.test(t.from)&&(t.from=parseInt(t.from)),Number.isInteger(t.from)){if(t.from<0)throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(e.from)}`)}else throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(t.from)}`);if(t.from_line===void 0||t.from_line===null)t.from_line=1;else if(typeof t.from_line=="string"&&/\d+/.test(t.from_line)&&(t.from_line=parseInt(t.from_line)),Number.isInteger(t.from_line)){if(t.from_line<=0)throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(e.from_line)}`)}else throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(e.from_line)}`);if(t.ignore_last_delimiters===void 0||t.ignore_last_delimiters===null)t.ignore_last_delimiters=!1;else if(typeof t.ignore_last_delimiters=="number")t.ignore_last_delimiters=Math.floor(t.ignore_last_delimiters),t.ignore_last_delimiters===0&&(t.ignore_last_delimiters=!1);else if(typeof t.ignore_last_delimiters!="boolean")throw new y("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",["Invalid option `ignore_last_delimiters`:","the value must be a boolean value or an integer,",`got ${JSON.stringify(t.ignore_last_delimiters)}`],t);if(t.ignore_last_delimiters===!0&&t.columns===!1)throw new y("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",["The option `ignore_last_delimiters`","requires the activation of the `columns` option"],t);if(t.info===void 0||t.info===null||t.info===!1)t.info=!1;else if(t.info!==!0)throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(t.info)}`);if(t.max_record_size===void 0||t.max_record_size===null||t.max_record_size===!1)t.max_record_size=0;else if(!(Number.isInteger(t.max_record_size)&&t.max_record_size>=0))if(typeof t.max_record_size=="string"&&/\d+/.test(t.max_record_size))t.max_record_size=parseInt(t.max_record_size);else throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(t.max_record_size)}`);if(t.objname===void 0||t.objname===null||t.objname===!1)t.objname=void 0;else if(Buffer.isBuffer(t.objname)){if(t.objname.length===0)throw new Error("Invalid Option: objname must be a non empty buffer");t.encoding===null||(t.objname=t.objname.toString(t.encoding))}else if(typeof t.objname=="string"){if(t.objname.length===0)throw new Error("Invalid Option: objname must be a non empty string")}else if(typeof t.objname!="number")throw new Error(`Invalid Option: objname must be a string or a buffer, got ${t.objname}`);if(t.objname!==void 0){if(typeof t.objname=="number"){if(t.columns!==!1)throw Error("Invalid Option: objname index cannot be combined with columns or be defined as a field")}else if(t.columns===!1)throw Error("Invalid Option: objname field must be combined with columns or be defined as an index")}if(t.on_record===void 0||t.on_record===null)t.on_record=void 0;else if(typeof t.on_record!="function")throw new y("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,",`got ${JSON.stringify(t.on_record)}`],t);if(t.on_skip!==void 0&&t.on_skip!==null&&typeof t.on_skip!="function")throw new Error(`Invalid Option: on_skip must be a function, got ${JSON.stringify(t.on_skip)}`);if(t.quote===null||t.quote===!1||t.quote==="")t.quote=null;else if(t.quote===void 0||t.quote===!0?t.quote=Buffer.from('"',t.encoding):typeof t.quote=="string"&&(t.quote=Buffer.from(t.quote,t.encoding)),!Buffer.isBuffer(t.quote))throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(t.quote)}`);if(t.raw===void 0||t.raw===null||t.raw===!1)t.raw=!1;else if(t.raw!==!0)throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(t.raw)}`);if(t.record_delimiter===void 0)t.record_delimiter=[];else if(typeof t.record_delimiter=="string"||Buffer.isBuffer(t.record_delimiter)){if(t.record_delimiter.length===0)throw new y("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a non empty string or buffer,",`got ${JSON.stringify(t.record_delimiter)}`],t);t.record_delimiter=[t.record_delimiter]}else if(!Array.isArray(t.record_delimiter))throw new y("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a string, a buffer or array of string|buffer,",`got ${JSON.stringify(t.record_delimiter)}`],t);if(t.record_delimiter=t.record_delimiter.map(function(n,i){if(typeof n!="string"&&!Buffer.isBuffer(n))throw new y("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a string, a buffer or array of string|buffer",`at index ${i},`,`got ${JSON.stringify(n)}`],t);if(n.length===0)throw new y("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a non empty string or buffer",`at index ${i},`,`got ${JSON.stringify(n)}`],t);return typeof n=="string"&&(n=Buffer.from(n,t.encoding)),n}),typeof t.relax_column_count!="boolean")if(t.relax_column_count===void 0||t.relax_column_count===null)t.relax_column_count=!1;else throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(t.relax_column_count)}`);if(typeof t.relax_column_count_less!="boolean")if(t.relax_column_count_less===void 0||t.relax_column_count_less===null)t.relax_column_count_less=!1;else throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(t.relax_column_count_less)}`);if(typeof t.relax_column_count_more!="boolean")if(t.relax_column_count_more===void 0||t.relax_column_count_more===null)t.relax_column_count_more=!1;else throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(t.relax_column_count_more)}`);if(typeof t.relax_quotes!="boolean")if(t.relax_quotes===void 0||t.relax_quotes===null)t.relax_quotes=!1;else throw new Error(`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(t.relax_quotes)}`);if(typeof t.skip_empty_lines!="boolean")if(t.skip_empty_lines===void 0||t.skip_empty_lines===null)t.skip_empty_lines=!1;else throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(t.skip_empty_lines)}`);if(typeof t.skip_records_with_empty_values!="boolean")if(t.skip_records_with_empty_values===void 0||t.skip_records_with_empty_values===null)t.skip_records_with_empty_values=!1;else throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(t.skip_records_with_empty_values)}`);if(typeof t.skip_records_with_error!="boolean")if(t.skip_records_with_error===void 0||t.skip_records_with_error===null)t.skip_records_with_error=!1;else throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(t.skip_records_with_error)}`);if(t.rtrim===void 0||t.rtrim===null||t.rtrim===!1)t.rtrim=!1;else if(t.rtrim!==!0)throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(t.rtrim)}`);if(t.ltrim===void 0||t.ltrim===null||t.ltrim===!1)t.ltrim=!1;else if(t.ltrim!==!0)throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(t.ltrim)}`);if(t.trim===void 0||t.trim===null||t.trim===!1)t.trim=!1;else if(t.trim!==!0)throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(t.trim)}`);if(t.trim===!0&&e.ltrim!==!1?t.ltrim=!0:t.ltrim!==!0&&(t.ltrim=!1),t.trim===!0&&e.rtrim!==!1?t.rtrim=!0:t.rtrim!==!0&&(t.rtrim=!1),t.to===void 0||t.to===null)t.to=-1;else if(t.to!==-1)if(typeof t.to=="string"&&/\d+/.test(t.to)&&(t.to=parseInt(t.to)),Number.isInteger(t.to)){if(t.to<=0)throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(e.to)}`)}else throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(e.to)}`);if(t.to_line===void 0||t.to_line===null)t.to_line=-1;else if(t.to_line!==-1)if(typeof t.to_line=="string"&&/\d+/.test(t.to_line)&&(t.to_line=parseInt(t.to_line)),Number.isInteger(t.to_line)){if(t.to_line<=0)throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(e.to_line)}`)}else throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(e.to_line)}`);return t};var Ir=function(e,t){t||({delimiter_auto:t}=oe({delimiter_auto:!0})),typeof e=="string"&&(e=Buffer.from(e)),Buffer.isBuffer(e)&&(e=(i=>{let s=[],o=Re({delimiter:[]}),a=u=>s.push(u),c=()=>{},l=o.parse(i,!0,a,c);if(l!==void 0)throw l;return s})(e));let r=Array(127).fill().map(()=>({lines:[]}));e.map(([i],s)=>{for(let o=0,a=i.length;o<a;o++){let c=i.charCodeAt(o);r[c].lines[s]===void 0&&(r[c].lines[s]=0),r[c].lines[s]++}}),r.map((i,s)=>{i.char_code=s,i.std=ys(i.lines),i.total=i.lines.reduce((o,a)=>o+a,0),i.preferred=!!t.preferred[s],i.score=t.score(i,t)});let n=r.reduce((i,s)=>i.score>s.score?i:s,{});return String.fromCharCode(n.char_code)},ys=function(e){let t=e.length;if(t===0)return 0;let r=e.reduce((n,i)=>n+i)/t;return Math.sqrt(e.map(n=>Math.pow(n-r,2)).reduce((n,i)=>n+i)/t)};var Rr=function(e){return e.every(t=>t==null||t.toString&&t.toString().trim()==="")},Es=13,Ss=10,ge={utf8:Buffer.from([239,187,191]),utf16le:Buffer.from([255,254])},Re=function(e={}){let t={bytes:0,bytes_records:0,comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},r=oe(e);return{info:t,original_options:e,options:r,state:xr(r),__needMoreData:function(n,i,s){if(s)return!1;let{encoding:o,escape:a,quote:c}=this.options,{quoting:l,needMoreDataSize:u,recordDelimiterMaxLength:f}=this.state,h=i-n-1,d=Math.max(u,f===0?Buffer.from(`\r
|
|
21
|
+
`,o).length:f,l?(a===null?0:a.length)+c.length:0,l?c.length+f:0);return h<d},parse:function(n,i,s,o){let{bom:a,comment_no_infix:c,delimiter_auto:l,encoding:u,from_line:f,ltrim:h,max_record_size:d,raw:p,relax_quotes:g,rtrim:R,skip_empty_lines:N,to:x,to_line:O}=this.options,{comment:W,escape:Y,quote:q,record_delimiter:St}=this.options,{bomSkipped:ls,delimiterDiscovered:cs,delimiterBufPrevious:$e,rawBuffer:us,escapeIsQuote:fs}=this.state;if(!cs&&l){let C;if($e===void 0?C=n:$e!==void 0&&n===void 0?C=$e:C=Buffer.concat([$e,n]),n=void 0,i||C.length>l.size)this.options.delimiter=[Buffer.from(Ir(C,this.options.delimiter_auto))],this.state.previousBuf=C,this.state.delimiterBufPrevious=void 0,this.state.delimiterDiscovered=!0;else{this.state.delimiterBufPrevious=C;return}}let{previousBuf:Me}=this.state,A;if(Me===void 0)if(n===void 0){o();return}else A=n;else Me!==void 0&&n===void 0?A=Me:A=Buffer.concat([Me,n]);if(ls===!1)if(a===!1)this.state.bomSkipped=!0;else if(A.length<3){if(i===!1){this.state.previousBuf=A;return}}else{for(let C in ge)if(ge[C].compare(A,0,ge[C].length)===0){let Z=ge[C].length;this.state.bufBytesStart+=Z,A=A.slice(Z);let He=oe({...this.original_options,encoding:C});for(let w in He)this.options[w]=He[w];({comment:W,escape:Y,quote:q}=this.options);break}this.state.bomSkipped=!0}let bt=A.length,_;for(_=0;_<bt&&!this.__needMoreData(_,bt,i);_++){if(this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1),O!==-1&&this.info.lines>O){this.state.stop=!0,o();return}this.state.quoting===!1&&St.length===0&&this.__autoDiscoverRecordDelimiter(A,_)&&(St=this.options.record_delimiter);let C=A[_];if(p===!0&&us.append(C),(C===Es||C===Ss)&&this.state.wasRowDelimiter===!1&&(this.state.wasRowDelimiter=!0),this.state.escaping===!0)this.state.escaping=!1;else{if(Y!==null&&this.state.quoting===!0&&this.__isEscape(A,_,C)&&_+Y.length<bt)if(fs){if(this.__isQuote(A,_+Y.length)){this.state.escaping=!0,_+=Y.length-1;continue}}else{this.state.escaping=!0,_+=Y.length-1;continue}if(this.state.commenting===!1&&this.__isQuote(A,_))if(this.state.quoting===!0){let w=A[_+q.length],ie=R&&this.__isCharTrimable(A,_+q.length),G=W!==null&&this.__compareBytes(W,A,_+q.length,w),se=this.__isDelimiter(A,_+q.length,w),Be=St.length===0?this.__autoDiscoverRecordDelimiter(A,_+q.length):this.__isRecordDelimiter(w,A,_+q.length);if(Y!==null&&this.__isEscape(A,_,C)&&this.__isQuote(A,_+Y.length))_+=Y.length-1;else if(!w||se||Be||G||ie){this.state.quoting=!1,this.state.wasQuoting=!0,_+=q.length-1;continue}else if(g===!1){let Ar=this.__error(new y("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(w)}"`,`at line ${this.info.lines}`,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(Ar!==void 0)return Ar}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(q),_+=q.length-1}else if(this.state.field.length!==0){if(g===!1){let w=this.__infoField(),ie=Object.keys(ge).map(se=>ge[se].equals(this.state.field.toString())?se:!1).filter(Boolean)[0],G=this.__error(new y("INVALID_OPENING_QUOTE",["Invalid Opening Quote:",`a quote is found on field ${JSON.stringify(w.column)} at line ${w.lines}, value is ${JSON.stringify(this.state.field.toString(u))}`,ie?`(${ie} bom)`:void 0],this.options,w,{field:this.state.field}));if(G!==void 0)return G}}else{this.state.quoting=!0,_+=q.length-1;continue}if(this.state.quoting===!1){let w=this.__isRecordDelimiter(C,A,_);if(w!==0){if(this.state.commenting&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0)this.info.comment_lines++;else{if(this.state.enabled===!1&&this.info.lines+(this.state.wasRowDelimiter===!0?1:0)>=f){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),_+=w-1;continue}if(N===!0&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0){this.info.empty_lines++,_+=w-1;continue}this.info.bytes=this.state.bufBytesStart+_;let se=this.__onField();if(se!==void 0)return se;this.info.bytes=this.state.bufBytesStart+_+w;let Be=this.__onRecord(s);if(Be!==void 0)return Be;if(x!==-1&&this.info.records>=x){this.state.stop=!0,o();return}}this.state.commenting=!1,_+=w-1;continue}if(this.state.commenting)continue;if(W!==null&&(c===!1||this.state.record.length===0&&this.state.field.length===0)&&this.__compareBytes(W,A,_,C)!==0){this.state.commenting=!0;continue}let ie=this.__isDelimiter(A,_,C);if(ie!==0){this.info.bytes=this.state.bufBytesStart+_;let G=this.__onField();if(G!==void 0)return G;_+=ie-1;continue}}}if(this.state.commenting===!1&&d!==0&&this.state.record_length+this.state.field.length>d)return this.__error(new y("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes",`of ${d}`,`at line ${this.info.lines}`],this.options,this.__infoField()));let Z=h===!1||this.state.quoting===!0||this.state.field.length!==0||!this.__isCharTrimable(A,_),He=R===!1||this.state.wasQuoting===!1;if(Z===!0&&He===!0)this.state.field.append(C);else{if(R===!0&&!this.__isCharTrimable(A,_))return this.__error(new y("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote",`at line ${this.info.lines}`],this.options,this.__infoField()));Z===!1&&(_+=this.__isCharTrimable(A,_)-1);continue}}if(i===!0)if(this.state.quoting===!0){let C=this.__error(new y("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:",`the parsing is finished with an opening quote at line ${this.info.lines}`],this.options,this.__infoField()));if(C!==void 0)return C}else if(this.state.wasQuoting===!0||this.state.record.length!==0||this.state.field.length!==0){this.info.bytes=this.state.bufBytesStart+_;let C=this.__onField();if(C!==void 0)return C;let Z=this.__onRecord(s);if(Z!==void 0)return Z}else this.state.wasRowDelimiter===!0?this.info.empty_lines++:this.state.commenting===!0&&this.info.comment_lines++;else this.state.bufBytesStart+=_,this.state.previousBuf=A.slice(_);this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1)},__onRecord:function(n){let{columns:i,group_columns_by_name:s,encoding:o,info:a,from:c,relax_column_count:l,relax_column_count_less:u,relax_column_count_more:f,raw:h,skip_records_with_empty_values:d}=this.options,{enabled:p,record:g}=this.state;if(p===!1)return this.__resetRecord();let R=g.length;if(i===!0){if(d===!0&&Rr(g)){this.__resetRecord();return}return this.__firstLineToColumns(g)}if(i===!1&&this.info.records===0&&(this.state.expectedRecordLength=R),R!==this.state.expectedRecordLength){let N=i===!1?new y("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${R} on line ${this.info.lines}`],this.options,this.__infoField(),{record:g}):new y("CSV_RECORD_INCONSISTENT_COLUMNS",["Invalid Record Length:",`columns length is ${i.length},`,`got ${R} on line ${this.info.lines}`],this.options,this.__infoField(),{record:g});if(l===!0||u===!0&&R<this.state.expectedRecordLength||f===!0&&R>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=N;else{let x=this.__error(N);if(x)return x}}if(d===!0&&Rr(g)){this.__resetRecord();return}if(this.state.recordHasError===!0){this.__resetRecord(),this.state.recordHasError=!1;return}if(this.info.records++,c===1||this.info.records>=c){let{objname:N}=this.options;if(i!==!1){let x={};for(let O=0,W=g.length;O<W;O++)i[O]===void 0||i[O].disabled||(s===!0&&Object.hasOwn(x,i[O].name)?Array.isArray(x[i[O].name])?x[i[O].name]=x[i[O].name].concat(g[O]):x[i[O].name]=[x[i[O].name],g[O]]:Object.defineProperty(x,i[O].name,{value:g[O],enumerable:!0,writable:!0,configurable:!0}));if(h===!0||a===!0){let O=Object.assign({record:x},h===!0?{raw:this.state.rawBuffer.toString(o)}:{},a===!0?{info:this.__infoRecord()}:{}),W=this.__push(N===void 0?O:[x[N],O],n);if(W)return W}else{let O=this.__push(N===void 0?x:[x[N],x],n);if(O)return O}}else if(h===!0||a===!0){let x=Object.assign({record:g},h===!0?{raw:this.state.rawBuffer.toString(o)}:{},a===!0?{info:this.__infoRecord()}:{}),O=this.__push(N===void 0?x:[g[N],x],n);if(O)return O}else{let x=this.__push(N===void 0?g:[g[N],g],n);if(x)return x}}this.__resetRecord()},__firstLineToColumns:function(n){let{firstLineToHeaders:i}=this.state;try{let s=i===void 0?n:i.call(null,n);if(!Array.isArray(s))return this.__error(new y("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,",`got ${JSON.stringify(s)}`],this.options,this.__infoField(),{headers:s}));let o=Ue(s);this.state.expectedRecordLength=o.length,this.options.columns=o,this.__resetRecord();return}catch(s){return s}},__resetRecord:function(){this.options.raw===!0&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0},__onField:function(){let{cast:n,encoding:i,rtrim:s,max_record_size:o}=this.options,{enabled:a,wasQuoting:c}=this.state;if(a===!1)return this.__resetField();let l=this.state.field.toString(i);if(s===!0&&c===!1&&(l=l.trimRight()),n===!0){let[u,f]=this.__cast(l);if(u!==void 0)return u;l=f}this.state.record.push(l),o!==0&&typeof l=="string"&&(this.state.record_length+=l.length),this.__resetField()},__resetField:function(){this.state.field.reset(),this.state.wasQuoting=!1},__push:function(n,i){let{on_record:s}=this.options;if(s!==void 0){let o=this.__infoRecord();try{n=s.call(null,n,o)}catch(a){return a}if(n==null)return}this.info.bytes_records+=this.info.bytes,i(n)},__cast:function(n){let{columns:i,relax_column_count:s}=this.options;if(Array.isArray(i)===!0&&s&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(this.state.castField!==null)try{let a=this.__infoField();return[void 0,this.state.castField.call(null,n,a)]}catch(a){return[a]}if(this.__isFloat(n))return[void 0,parseFloat(n)];if(this.options.cast_date!==!1){let a=this.__infoField();return[void 0,this.options.cast_date.call(null,n,a)]}return[void 0,n]},__compareBytes:function(n,i,s,o){if(n[0]!==o)return 0;let a=n.length;for(let c=1;c<a;c++)if(n[c]!==i[s+c])return 0;return a},__isCharTrimable:function(n,i){let{timchars:s,timcharFirstBytes:o}=this.state,a=n[i];if(a===void 0||o[a]===0)return 0;e:for(let c=0;c<s.length;c++){let l=s[c];for(let u=0;u<l.length;u++)if(l[u]!==n[i+u])continue e;return l.length}return 0},__isDelimiter:function(n,i,s){let{delimiter:o,ignore_last_delimiters:a}=this.options;if(a===!0&&this.state.record.length===this.options.columns.length-1)return 0;if(a!==!1&&typeof a=="number"&&this.state.record.length===a-1)return 0;e:for(let c=0;c<o.length;c++){let l=o[c];if(l[0]===s){for(let u=1;u<l.length;u++)if(l[u]!==n[i+u])continue e;return l.length}}return 0},__isEscape:function(n,i,s){let{escape:o}=this.options;if(o===null)return!1;let a=o.length;if(o[0]===s){for(let c=0;c<a;c++)if(o[c]!==n[i+c])return!1;return!0}return!1},__isFloat:function(n){return n-parseFloat(n)+1>=0},__isQuote:function(n,i){let{quote:s}=this.options;if(s===null)return!1;let o=s.length;for(let a=0;a<o;a++)if(s[a]!==n[i+a])return!1;return!0},__isRecordDelimiter:function(n,i,s){let{record_delimiter:o}=this.options,a=o.length;e:for(let c=0;c<a;c++){let l=o[c],u=l.length;if(l[0]===n){for(let f=1;f<u;f++)if(l[f]!==i[s+f])continue e;return l.length}}return 0},__autoDiscoverRecordDelimiter:function(n,i){let{encoding:s}=this.options,o=[Buffer.from(`\r
|
|
22
|
+
`,s),Buffer.from(`
|
|
23
|
+
`,s),Buffer.from("\r",s)];e:for(let a=0;a<o.length;a++){let c=o[a].length;for(let l=0;l<c;l++)if(o[a][l]!==n[i+l])continue e;return this.options.record_delimiter.push(o[a]),this.state.recordDelimiterMaxLength=o[a].length,o[a].length}return 0},__error:function(n){let{encoding:i,raw:s,skip_records_with_error:o}=this.options,a=typeof n=="string"?new Error(n):n;if(o){if(this.state.recordHasError=!0,this.options.on_skip!==void 0)try{this.options.on_skip(a,s?this.state.rawBuffer.toString(i):void 0)}catch(c){return c}return}else return a},__infoDataSet:function(){return{...this.info,columns:this.options.columns}},__infoRecord:function(){let{columns:n,raw:i,encoding:s}=this.options;return{...this.__infoDataSet(),bytes_records:this.info.bytes,error:this.state.error,header:n===!0,index:this.state.record.length,raw:i?this.state.rawBuffer.toString(s):void 0}},__infoField:function(){let{columns:n}=this.options,i=Array.isArray(n),s=this.info.bytes_records;return{...this.__infoRecord(),bytes_records:s,column:i===!0?n.length>this.state.record.length?n[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting}}}};var wr=function(e,t={}){typeof e=="string"&&(e=Buffer.from(e));let r=t&&t.objname?Object.create(null):[],n=Re(t),i=a=>{n.options.objname===void 0?r.push(a):r[a[0]]=a[1]},s=()=>{},o=n.parse(e,!0,i,s);if(o!==void 0)throw o;return r};var Nr=Object.freeze([]),bs={columns:!1,bom:!0,skip_empty_lines:!0,relax_quotes:!0,relax_column_count:!0,trim:!0},Lr=(e,t)=>kr(e,",",t),vr=(e,t)=>kr(e," ",t);function kr(e,t,r){if(e.trim().length===0)return Nr;let n;try{n=As(e,t)}catch(a){return a instanceof Error&&r?.onParseError?.(`Invalid CSV: ${a.message}`),Nr}let i=!!r?.csvHasHeader,s=r?.csvColumnIndex,o=Ts(n,i,s);return Object.freeze(o)}function As(e,t){return wr(e,{...bs,delimiter:t})}function Ts(e,t,r){let n=t?1:0;return r!==void 0?Cs(e,n,r):xs(e,n)}function Cs(e,t,r){let n=[];for(let i=t;i<e.length;i++){let o=((e[i]??[])[r]??"").trim();o.length>0&&n.push(o)}return n}function xs(e,t){let r=[];for(let n=t;n<e.length;n++){let i=e[n]??[];for(let s of i){let o=(s??"").trim();o.length>0&&r.push(o)}}return r}var Dr=(e,t)=>{let r=e.split(/\r?\n/),n=[];for(let i of r){let s=Os(i);s&&n.push(s)}return Object.freeze(n)};function Os(e){let t=e.trim();if(!t||t.startsWith("#"))return null;let r=Is(t),n=r.indexOf("=");if(n===-1)return null;let i=r.slice(n+1).trim();if(!i)return null;let s=Rs(i);return ws(s)||null}function Is(e){return e.startsWith("export ")?e.slice(7).trim():e}function Rs(e){if(e.startsWith('"')||e.startsWith("'"))return e;let t=e.indexOf("#");return t!==-1?e.slice(0,t).trim():e}function ws(e){let t=e.startsWith('"')&&e.endsWith('"'),r=e.startsWith("'")&&e.endsWith("'");return t||r?e.slice(1,-1):e}var Fr=/(["'`])(?:(?=(\\?))\2.)*?\1/g,Ns=/(["'`])(?:(?=(\\?))\2[\s\S])*?\1/g,Ls=Object.freeze([]),we=(e,t)=>{let r=t?.multiline?e.match(Ns)??[]:Mr(e);if(r.length===0)return Ls;let n=vs(r);return Object.freeze(n)};function Pr(e){return Mr(e).map(Ot)}function $r(e){return[...e.matchAll(Fr)].map(t=>({value:Ot(t[0]),index:t.index}))}function Mr(e){return e.match(Fr)??[]}function vs(e){return e.map(Ot).map(ks).filter(Ds)}function Ot(e){return e.slice(1,-1)}function ks(e){return e.trim()}function Ds(e){return e.length>0}var Kr=At(qr());function U(e,t=[],r=0){if(r>1e3||e==null)return t;if(typeof e=="string"){let n=e.trim();return n&&t.push(n),t}if(Array.isArray(e)){for(let n of e)U(n,t,r+1);return t}if(typeof e=="object"){for(let n of Object.values(e))U(n,t,r+1);return t}return t}var Fs=Object.freeze([]),Vr=(e,t)=>{let r=Ps(e,t?.onParseError);if(r===null)return Fs;let n=U(r);return Object.freeze(n)};function Ps(e,t){try{return(0,Kr.parse)(e)}catch(r){return t&&r instanceof Error&&t(`Invalid INI: ${r.message}`),null}}var Wr=Object.freeze({JSON:512,TOML:80,YAML:98});function $s(e){let t=0,r=0,n;for(let i=0;i<e.length;i++){let s=e[i];if(n!==void 0){if(s==="\\"&&n==='"'){i++;continue}s===n&&(n=void 0);continue}if(s==='"'||s==="'"){n=s;continue}if(s==="["||s==="{"){t++,t>r&&(r=t);continue}(s==="]"||s==="}")&&t>0&&t--}return r}function ee(e){return`Invalid ${e}: nested deeper than ${Wr[e]} levels`}function z(e,t){return $s(e)>Wr[t]}var zr=Object.freeze([]),wt=(e,t)=>{if(z(e,"JSON"))return t?.onParseError?.(ee("JSON")),zr;let r=Ms(e,t?.onParseError);if(r===null)return zr;let n=U(r);return Object.freeze(n)};function Ms(e,t){try{return JSON.parse(e)}catch(r){return t&&r instanceof Error&&t(`Invalid JSON: ${r.message}`),null}}function qe(e){let t=[],r=!1;for(let n=0;n<e.length;n++){let i=e.charAt(n);if(r){t.push(i),i==="\\"&&n+1<e.length?(n++,t.push(e.charAt(n))):i==='"'&&(r=!1);continue}if(i==='"'){r=!0,t.push(i);continue}let s=e.charAt(n+1);if(i==="/"&&s==="/"){for(;n<e.length&&e.charAt(n)!==`
|
|
24
|
+
`;)t.push(" "),n++;n<e.length&&t.push(`
|
|
25
|
+
`);continue}if(i==="/"&&s==="*"){let o=e.indexOf("*/",n+2);if(o===-1)return e;for(let a of e.slice(n,o+2))t.push(a===`
|
|
26
|
+
`?`
|
|
27
|
+
`:" ");n=o+1;continue}t.push(i)}return Hs(t.join(""))}function Hs(e){let t=[...e],r=!1;for(let n=0;n<t.length;n++){let i=t[n];if(r){i==="\\"?n++:i==='"'&&(r=!1);continue}if(i==='"'){r=!0;continue}if(i!==",")continue;let s=n+1;for(;s<t.length&&/\s/.test(t[s]);)s++;(t[s]==="}"||t[s]==="]")&&(t[n]=" ")}return t.join("")}var Bs=Object.freeze({python:"python",py:"python",rust:"rust",rs:"rust",go:"go",shellscript:"shell",sh:"shell",bash:"shell",zsh:"shell",php:"php",ruby:"ruby",rb:"ruby",perl:"perl",pl:"perl",pm:"perl",csharp:"csharp",cs:"csharp",javascript:"javascript",javascriptreact:"javascript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",typescript:"javascript",typescriptreact:"javascript",ts:"javascript",tsx:"javascript",mts:"javascript",cts:"javascript"}),Gr=Object.freeze(Object.fromEntries(Object.entries(Bs).map(([e,t])=>[e,Us(t)])));function Us(e){return t=>Object.freeze(U(Js(t,e).values))}var js=64,qs=14,Ks="rRbBuUfF",Lt=/[\p{Alphabetic}\p{N}_]/u,Vs=/^[\p{Alphabetic}\p{N}_]*/u,Ws=new RegExp("\\p{Alphabetic}","u"),zs=new RegExp("\\p{Uppercase}","u"),Ys=/\s/u,Gs=new Set([";","&","|","(",")"]);function Js(e,t,r=!1){let n={chars:Array.from(e),language:t,values:[],offsets:r?[]:null,heredocs:[],unclosed:new Set,closable:null,at:0};return Qs(n),n}function Qs(e){for(;e.at<e.chars.length;){if(e.chars[e.at]===`
|
|
28
|
+
`&&e.heredocs.length>0){Eo(e);continue}Xs(e)||Zs(e)||eo(e)||to(e)||(e.at+=1)}}function Xs(e){let t=Io[e.language](e);if(t===null)return!1;let r=te(e,e.at,t);if(e.offsets===null)for(let n of Pr(r))e.values.push(n);else for(let n of $r(r))e.values.push(n.value),e.offsets.push(e.at+Array.from(r.slice(0,n.index)).length);return e.at=t,!0}function Zs(e){let t=Oo[e.language](e);return t?(e.values.push(t.value),e.offsets?.push(e.at),e.at=t.end,!0):!1}function eo(e){if(!xo.has(e.language)||T(e,e.at)!=="'")return!1;let t=co(e);return t===null?!1:(e.at=t,!0)}function to(e){let t=Ro[e.language];if(!t)return!1;let r=t(e);return r?(e.heredocs.push(r.pending),e.at=r.end,!0):!1}function ro(e){let t=e.at,r=t;for(;r<t+2;){let s=T(e,r);if(!s||!Ks.includes(s))break;r+=1}let n=T(e,r);if(n!=='"'&&n!=="'"||r>t&&Xr(e,t))return null;let i=n.repeat(3);return j(e,r,i)?H(e,r+3,i,"backslash",!0):H(e,r+1,n,"backslash",!1)}function no(e){let t=e.at,r=t,n=T(e,r);(n==="b"||n==="c")&&(r+=1);let i=T(e,r)==="r",s=0;if(i)for(r+=1;T(e,r)==="#";)s+=1,r+=1;return T(e,r)!=='"'||r>t&&Xr(e,t)?null:i?H(e,r+1,`"${"#".repeat(s)}`,"none",!0):H(e,r+1,'"',"backslash",!0)}function io(e){let t=T(e,e.at);return t==='"'?H(e,e.at+1,'"',"backslash",!1):t==="`"?H(e,e.at+1,"`","none",!0):null}function so(e){let t=T(e,e.at);return t==='"'?H(e,e.at+1,'"',"backslash",!0):t==="'"?H(e,e.at+1,"'","none",!0):null}function Nt(e){let t=T(e,e.at);return t!=='"'&&t!=="'"?null:H(e,e.at+1,t,"backslash",!0)}function oo(e){let t=e.at,r=!1;for(let n=0;n<2;n+=1){let i=T(e,t);if(i==="@"){r=!0,t+=1;continue}if(i!=="$")break;t+=1}return T(e,t)!=='"'?null:r?H(e,t+1,'"',"doubled",!0):H(e,t+1,'"',"backslash",!1)}function ao(e){let t=T(e,e.at);return t==='"'||t==="'"?H(e,e.at+1,t,"backslash",!1):t==="`"?lo(e):null}function lo(e){let t=e.at+1,r=t,n=[0];for(;r<e.chars.length;){let i=n[n.length-1],s=e.chars[r],o=n.length-1;if(s==="\\"){r+=2;continue}if(s==="`"&&i===0&&n.length===1)return{value:te(e,t,r),end:r+1};if(s==="`"&&i===0){n.pop(),r+=1;continue}if(s==="`"&&n.length>=js)return null;if(s==="`"){n.push(0),r+=1;continue}if(s==="$"&&i===0&&T(e,r+1)==="{"){n[o]=1,r+=2;continue}if(s==="{"&&i>0){n[o]=i+1,r+=1;continue}if(s==="}"&&i>0){n[o]=i-1,r+=1;continue}if((s==='"'||s==="'")&&i>0){let a=H(e,r+1,s,"backslash",!1);r=a?a.end:r+1;continue}r+=1}return null}function H(e,t,r,n,i){let s=t;for(;s<e.chars.length;){let o=e.chars[s];if(n==="backslash"&&o==="\\"){s+=2;continue}if(!i&&o===`
|
|
29
|
+
`)return null;if(!j(e,s,r)){s+=1;continue}if(n==="doubled"&&j(e,s+r.length,r)){s+=r.length*2;continue}return{value:te(e,t,s),end:s+r.length}}return null}function co(e){let t=e.at+1,r=Math.min(e.at+qs,e.chars.length);for(;t<r;){let n=e.chars[t];if(n==="\\"){t+=2;continue}if(n===`
|
|
30
|
+
`)return null;if(n==="'")return t+1;t+=1}return null}function Le(e,t){return T(e,e.at)!=="#"||!t&&!Co(e)?null:ae(e,e.at)}function uo(e){let t=mo(e,"=begin","=end");return t!==null?t:Le(e,!0)}function fo(e){let t=go(e);if(t!==null)return t;let r=T(e,e.at-1);return r==="$"||r==="@"||r==="%"?null:Le(e,!0)}function ho(e){let t=Ne(e,!1);return t!==null?t:Le(e,!0)}function Ne(e,t){return j(e,e.at,"//")?ae(e,e.at):j(e,e.at,"/*")?po(e,t):null}function po(e,t){let r=e.at+2,n=1;for(;r<e.chars.length;){if(t&&j(e,r,"/*")){n+=1,r+=2;continue}if(!j(e,r,"*/")){r+=1;continue}if(n-=1,r+=2,n===0)return r}return e.chars.length}function mo(e,t,r){return!Qr(e)||!j(e,e.at,t)?null:Jr(e,r)}function go(e){if(!Qr(e)||T(e,e.at)!=="=")return null;let t=T(e,e.at+1);return!t||!/[A-Za-z]/.test(t)?null:Jr(e,"=cut")}function Jr(e,t){let r=ae(e,e.at)+1;for(;r<e.chars.length;){if(j(e,r,t))return ae(e,r);r=ae(e,r)+1}return e.chars.length}function _o(e){if(!j(e,e.at,"<<"))return null;let t=e.at+2,r=T(e,t)==="-";for(r&&(t+=1);T(e,t)===" ";)t+=1;let n=vt(e,t);return n?{pending:{tag:n.tag,indented:r},end:n.end}:null}function yo(e){if(!j(e,e.at,"<<<"))return null;let t=e.at+3;for(;T(e,t)===" ";)t+=1;let r=vt(e,t);return r?{pending:{tag:r.tag,indented:!0},end:r.end}:null}function Yr(e){if(!j(e,e.at,"<<"))return null;let t=e.at+2,r=T(e,t),n=r==="~"||r==="-";n&&(t+=1);let i=T(e,t),s=i==="'"||i==='"',o=vt(e,t);if(!o)return null;let a=zs.test(o.tag[0])||o.tag[0]==="_";return!n&&!s&&!a?null:{pending:{tag:o.tag,indented:!0},end:o.end}}function vt(e,t){let r=T(e,t),n=r==="'"||r==='"'?r:null,i=t+(n?1:0),s=T(e,i);if(!s||!(Ws.test(s)||s==="_"))return null;let o=i;for(;o<e.chars.length;){let c=e.chars[o];if(!Lt.test(c))break;o+=1}let a=te(e,i,o);return n?T(e,o)!==n?null:{tag:a,end:o+1}:{tag:a,end:o}}function Eo(e){e.at+=1;let t=e.heredocs.splice(0,e.heredocs.length);for(let r of t){let n=So(e,r);if(!n)return;e.values.push(n.value),e.offsets?.push(e.at),e.at=n.end}}function So(e,t){if(!bo(e).has(t.tag))return null;let r=`${t.tag}\0${t.indented}`;if(e.unclosed.has(r))return null;let n=e.at;for(;n<=e.chars.length;){let i=ae(e,n);if(To(e,n,i,t))return{value:te(e,e.at,n),end:Math.min(i+1,e.chars.length)};n=i+1}return e.unclosed.add(r),null}function bo(e){if(e.closable)return e.closable;let t=new Set,r=0;for(;r<=e.chars.length;){let n=ae(e,r);t.add(Ao(e,te(e,r,n))),r=n+1}return e.closable=t,t}function Ao(e,t){return e.language!=="php"?t.trim():Vs.exec(t.trimStart())?.[0]??""}function To(e,t,r,n){let i=te(e,t,r).replace(/\r+$/,""),s=n.indented?i.trimStart():i;if(e.language!=="php")return s.trimEnd()===n.tag;if(!s.startsWith(n.tag))return!1;let o=s.slice(n.tag.length);return o.length===0?!0:!Lt.test(o[0])}function T(e,t){if(!(t<0||t>=e.chars.length))return e.chars[t]}function te(e,t,r){return e.chars.slice(t,r).join("")}function j(e,t,r){let n=Array.from(r).length;return t<0||t+n>e.chars.length?!1:te(e,t,t+n)===r}function ae(e,t){for(let r=Math.max(t,0);r<e.chars.length;r+=1)if(e.chars[r]===`
|
|
31
|
+
`)return r;return e.chars.length}function Qr(e){return e.at===0||T(e,e.at-1)===`
|
|
32
|
+
`}function Co(e){if(e.at===0)return!0;let t=T(e,e.at-1);return t?Ys.test(t)||Gs.has(t):!0}function Xr(e,t){let r=T(e,t-1);return r?Lt.test(r):!1}var xo=new Set(["rust","go","csharp"]),Oo=Object.freeze({python:ro,rust:no,go:io,shell:so,php:Nt,ruby:Nt,perl:Nt,csharp:oo,javascript:ao}),Io=Object.freeze({python:e=>Le(e,!0),shell:e=>Le(e,!1),ruby:uo,perl:fo,php:ho,rust:e=>Ne(e,!0),go:e=>Ne(e,!1),csharp:e=>Ne(e,!1),javascript:e=>Ne(e,!1)}),Ro=Object.freeze({shell:_o,php:yo,ruby:Yr,perl:Yr});var vn=At(Nn());var Ln=Object.freeze([]),kn=(e,t)=>{if(z(e,"TOML"))return t?.onParseError?.(ee("TOML")),Ln;let r=ra(e,t?.onParseError);if(r===null)return Ln;let n=U(r);return Object.freeze(n)};function ra(e,t){try{return(0,vn.parse)(e)}catch(r){return t&&r instanceof Error&&t(`Invalid TOML: ${r.message}`),null}}var S=Symbol("NOT_RESOLVED");function F(e,t){return{tagName:e,nodeKind:"scalar",implicit:t.implicit??!1,matchByTagPrefix:t.matchByTagPrefix??!1,implicitFirstChars:t.implicitFirstChars??null,resolve:t.resolve,identify:t.identify,represent:t.represent??(r=>String(r)),representTagName:t.representTagName??(()=>e)}}function Zt(e,t){let r=t.finalize===void 0;return{tagName:e,nodeKind:"sequence",implicit:!1,matchByTagPrefix:t.matchByTagPrefix??!1,create:t.create,addItem:t.addItem,finalize:t.finalize??(n=>n),carrierIsResult:r,identify:t.identify,represent:t.represent??(n=>n),representTagName:t.representTagName??(()=>e)}}function et(e,t){let r=t.finalize===void 0;return{tagName:e,nodeKind:"mapping",implicit:!1,matchByTagPrefix:t.matchByTagPrefix??!1,create:t.create,addPair:t.addPair,has:t.has,keys:t.keys,get:t.get,finalize:t.finalize??(n=>n),carrierIsResult:r,identify:t.identify,represent:t.represent??(n=>n),representTagName:t.representTagName??(()=>e)}}var na=F("tag:yaml.org,2002:str",{resolve:e=>e,identify:e=>typeof e=="string"}),ia=["","~","null","Null","NULL"],sa=F("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>ia.indexOf(e)!==-1?null:S,identify:e=>e===null,represent:()=>"null"}),oa=F("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["n"],resolve:(e,t)=>e==="null"||t&&e===""?null:S,identify:e=>e===null,represent:()=>"null"}),aa=["","~","null","Null","NULL"],la=F("tag:yaml.org,2002:null",{implicit:!0,implicitFirstChars:["","~","n","N"],resolve:e=>aa.indexOf(e)!==-1?null:S,identify:e=>e===null,represent:()=>"null"}),ca=["true","True","TRUE"],ua=["false","False","FALSE"],fa=F("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","T","f","F"],resolve:e=>ca.indexOf(e)!==-1?!0:ua.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),ha=["true"],da=["false"],pa=F("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["t","f"],resolve:e=>ha.indexOf(e)!==-1?!0:da.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),ma=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"],ga=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"],_a=F("tag:yaml.org,2002:bool",{implicit:!0,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:e=>ma.indexOf(e)!==-1?!0:ga.indexOf(e)!==-1?!1:S,identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"}),ya=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$"),Ea=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function Sa(e){let t=e,r=1;return(t[0]==="-"||t[0]==="+")&&(t[0]==="-"&&(r=-1),t=t.slice(1)),t.startsWith("0b")?r*parseInt(t.slice(2),2):t.startsWith("0o")?r*parseInt(t.slice(2),8):t.startsWith("0x")?r*parseInt(t.slice(2),16):r*parseInt(t,10)}function ba(e,t){if(t){if(!Ea.test(e))return S}else if(!ya.test(e))return S;let r=Sa(e);return Number.isFinite(r)?r:S}var Yn=F("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:ba,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),Aa=new RegExp("^-?(?:0|[1-9][0-9]*)$"),Ta=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function Ca(e){let t=e,r=1;return(t[0]==="-"||t[0]==="+")&&(t[0]==="-"&&(r=-1),t=t.slice(1)),t.startsWith("0b")?r*parseInt(t.slice(2),2):t.startsWith("0o")?r*parseInt(t.slice(2),8):t.startsWith("0x")?r*parseInt(t.slice(2),16):r*parseInt(t,10)}function xa(e,t){if(t){if(!Ta.test(e))return S}else if(!Aa.test(e))return S;let r=Ca(e);return Number.isFinite(r)?r:S}var Oa=F("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:xa,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),Ia=new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");function Ra(e){let t=e.replace(/_/g,""),r=1;if((t[0]==="-"||t[0]==="+")&&(t[0]==="-"&&(r=-1),t=t.slice(1)),t.startsWith("0b"))return r*parseInt(t.slice(2),2);if(t.startsWith("0x"))return r*parseInt(t.slice(2),16);if(t.includes(":")){let n=0;for(let i of t.split(":"))n=n*60+Number(i);return r*n}return t!=="0"&&t[0]==="0"?r*parseInt(t,8):r*parseInt(t,10)}function wa(e){if(!Ia.test(e))return S;let t=Ra(e);return Number.isFinite(t)?t:S}var Vt=F("tag:yaml.org,2002:int",{implicit:!0,implicitFirstChars:["-","+",..."0123456789"],resolve:wa,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)}),Na=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),La=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function va(e){if(!Na.test(e))return S;let t=e.toLowerCase(),r=t[0]==="-"?-1:1;if("+-".includes(t[0])&&(t=t.slice(1)),t===".inf")return r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(t===".nan")return NaN;let n=r*parseFloat(t);return Number.isFinite(n)||La.test(e)?n:S}function ka(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}var Gn=F("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:va,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:ka}),Da=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$"),Fa=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Pa(e,t){if(t){if(!Fa.test(e))return S;let n=e.toLowerCase(),i=n[0]==="-"?-1:1;if("+-".includes(n[0])&&(n=n.slice(1)),n===".inf")return i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(n===".nan")return NaN;let s=i*parseFloat(n);return Number.isFinite(s)?s:S}if(!Da.test(e))return S;let r=Number(e);return Number.isFinite(r)?r:S}function $a(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}var Ma=F("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-",..."0123456789"],resolve:Pa,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:$a}),Ha=new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Ba=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Ua(e){if(!Ha.test(e))return S;let t=e.toLowerCase().replace(/_/g,""),r=t[0]==="-"?-1:1;if("+-".includes(t[0])&&(t=t.slice(1)),t===".inf")return r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(t===".nan")return NaN;let n=0;if(t.includes(":")){for(let i of t.split(":"))n=n*60+Number(i);n*=r}else n=r*parseFloat(t);return Number.isFinite(n)||Ba.test(e)?n:S}function ja(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";let t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}var Wt=F("tag:yaml.org,2002:float",{implicit:!0,implicitFirstChars:["-","+",".",..."0123456789"],resolve:Ua,identify:e=>typeof e=="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:ja}),qa=F("tag:yaml.org,2002:merge",{implicit:!0,implicitFirstChars:["<"],resolve:(e,t)=>e==="<<"||t&&e===""?"<<":S,identify:()=>!1}),Ka=/^[A-Za-z0-9+/]*={0,2}$/;function Va(e){let t=e.replace(/\s/g,"");if(t.length%4!==0||!Ka.test(t))return S;let r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return n}function Wa(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}var za=F("tag:yaml.org,2002:binary",{resolve:Va,identify:e=>Object.prototype.toString.call(e)==="[object Uint8Array]",represent:Wa}),Ya=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Ga=new 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 Dn(e,t,r,n=0,i=0,s=0,o=0){let a=new Date(Date.UTC(e,t,r,n,i,s,o));return a.setUTCFullYear(e,t,r),a}function Ja(e){let t=Ya.exec(e);if(t===null&&(t=Ga.exec(e)),t===null)return S;let r=+t[1],n=+t[2]-1,i=+t[3];if(!t[4]){let u=Dn(r,n,i);return u.getUTCFullYear()!==r||u.getUTCMonth()!==n||u.getUTCDate()!==i?S:u}let s=+t[4],o=+t[5],a=+t[6],c=0;if(s>23||o>59||a>59)return S;if(t[7]){let u=t[7].slice(0,3);for(;u.length<3;)u+="0";c=+u}let l=Dn(r,n,i,s,o,a,c);if(l.getUTCFullYear()!==r||l.getUTCMonth()!==n||l.getUTCDate()!==i)return S;if(t[9]){let u=+t[10],f=+(t[11]||0);if(u>23||f>59)return S;let h=(u*60+f)*6e4;l.setTime(l.getTime()-(t[9]==="-"?-h:h))}return l}var Qa=F("tag:yaml.org,2002:timestamp",{implicit:!0,implicitFirstChars:[..."0123456789"],resolve:Ja,identify:e=>e instanceof Date,represent:e=>e.toISOString()}),Xa=Zt("tag:yaml.org,2002:seq",{create:()=>[],addItem:(e,t)=>{e.push(t)},identify:Array.isArray});function tt(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Fn(e,t){let r={};for(let n of t)e[n]!==void 0&&(r[n]=e[n]);return r}var Za=Zt("tag:yaml.org,2002:omap",{create:()=>({list:[],seen:new Set}),addItem:(e,t)=>{let r;if(t instanceof Map){if(t.size!==1)return"cannot resolve an ordered map item";r=t.keys().next().value}else if(tt(t)){let n=Object.keys(t);if(n.length!==1)return"cannot resolve an ordered map item";r=n[0]}else return"cannot resolve an ordered map item";return e.seen.has(r)?"duplicate key in ordered map":(e.seen.add(r),e.list.push(t),"")},finalize:e=>e.list,identify:()=>!1}),el=Zt("tag:yaml.org,2002:pairs",{create:()=>[],addItem:(e,t)=>{if(t instanceof Map)return t.size!==1?"cannot resolve a pairs item":(e.push(t.entries().next().value),"");if(Object.prototype.toString.call(t)!=="[object Object]")return"cannot resolve a pairs item";let r=t,n=Object.keys(r);return n.length!==1?"cannot resolve a pairs item":(e.push([n[0],r[n[0]]]),"")},identify:()=>!1}),tl=et("tag:yaml.org,2002:map",{create:()=>({}),identify:tt,represent:e=>{let t=new Map;for(let r of Object.keys(e))t.set(r,e[r]);return t},addPair:(e,t,r)=>{if(t!==null&&typeof t=="object")return"object-based map does not support complex keys";let n=String(t);return n==="__proto__"?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,""},has:(e,t)=>t!==null&&typeof t=="object"?!1:Object.prototype.hasOwnProperty.call(e,String(t)),keys:e=>Object.keys(e),get:(e,t)=>{let r=String(t);return Object.prototype.hasOwnProperty.call(e,r)?e[r]:null}}),rl=et("tag:yaml.org,2002:set",{create:()=>new Set,identify:e=>e instanceof Set,represent:e=>{let t=new Map;for(let r of e)t.set(r,null);return t},addPair:(e,t,r)=>r!==null?"cannot resolve a set item":(e.add(t),""),has:(e,t)=>e.has(t),keys:e=>e.keys(),get:()=>null});function nl(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function il(){return{scalar:[],sequence:[],mapping:[]}}function sl(e){let t=[];for(let r of e){let n=t.length;for(let i=0;i<t.length;i++){let s=t[i];if(s.nodeKind===r.nodeKind&&s.tagName===r.tagName&&s.matchByTagPrefix===r.matchByTagPrefix){n=i;break}}t[n]=r}return t}var rt=class Jn{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(t){let r=sl(t),n=[],i=nl(),s=il();for(let u of r){if(u.nodeKind==="scalar"&&u.implicit){if(u.matchByTagPrefix)throw new Error("Implicit scalar tags cannot match by tag prefix");n.push(u)}switch(u.nodeKind){case"scalar":u.matchByTagPrefix?s.scalar.push(u):i.scalar[u.tagName]=u;break;case"sequence":u.matchByTagPrefix?s.sequence.push(u):i.sequence[u.tagName]=u;break;case"mapping":u.matchByTagPrefix?s.mapping.push(u):i.mapping[u.tagName]=u;break}}let o=n.filter(u=>u.implicitFirstChars===null),a=new Set;for(let u of n)if(u.implicitFirstChars!==null)for(let f of u.implicitFirstChars)a.add(f);let c=new Map;for(let u of a)c.set(u,n.filter(f=>f.implicitFirstChars===null||f.implicitFirstChars.indexOf(u)!==-1));let l=i.scalar["tag:yaml.org,2002:str"];if(!l)throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=r,this.implicitScalarTags=n,this.implicitScalarByFirstChar=c,this.implicitScalarAnyFirstChar=o,this.defaultScalarTag=l,this.defaultSequenceTag=i.sequence["tag:yaml.org,2002:seq"],this.defaultMappingTag=i.mapping["tag:yaml.org,2002:map"],this.exact=i,this.prefix=s}lookupScalarTag(t){let r=this.exact.scalar[t];if(r)return r;for(let n of this.prefix.scalar)if(t.startsWith(n.tagName))return n}lookupSequenceTag(t){let r=this.exact.sequence[t];if(r)return r;for(let n of this.prefix.sequence)if(t.startsWith(n.tagName))return n}lookupMappingTag(t){let r=this.exact.mapping[t];if(r)return r;for(let n of this.prefix.mapping)if(t.startsWith(n.tagName))return n}resolveImplicitScalarTag(t){let r=this.implicitScalarByFirstChar.get(t.charAt(0))??this.implicitScalarAnyFirstChar;for(let i of r){let s=i.resolve(t,!1,i.tagName);if(s!==S)return{value:s,tag:i}}let n=this.defaultScalarTag;return{value:n.resolve(t,!1,n.tagName),tag:n}}withTags(...t){let r=[];for(let n of t)r=r.concat(n);return new Jn([...this.tags,...r])}},er=new rt([na,Xa,tl]),th=new rt([...er.tags,oa,pa,Oa,Ma]),ol=new rt([...er.tags,sa,fa,Yn,Gn]),al=new rt([...er.tags,la,_a,Vt,Wt,Qa,qa,za,Za,el,rl]),ll=al.withTags({...Vt,resolve:(e,t,r)=>{let n=Vt.resolve(e,t,r);return n===S?Yn.resolve(e,t,r):n}},{...Wt,resolve:(e,t,r)=>{let n=Wt.resolve(e,t,r);return n===S?Gn.resolve(e,t,r):n}}),rh=et("tag:yaml.org,2002:map",{create:()=>new Map,addPair:(e,t,r)=>(e.set(t,r),""),has:(e,t)=>e.has(t),keys:e=>e.keys(),get:(e,t)=>e.get(t),identify:e=>e instanceof Map||tt(e),represent:e=>{if(e instanceof Map)return e;let t=new Map,r=e;for(let n of Object.keys(r))t.set(n,r[n]);return t}});function Pn(e){if(Array.isArray(e)){let t=Array.prototype.slice.call(e);for(let r=0;r<t.length;r++){if(Array.isArray(t[r]))return null;typeof t[r]=="object"&&Object.prototype.toString.call(t[r])==="[object Object]"&&(t[r]="[object Object]")}return String(t)}return typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"?"[object Object]":String(e)}var nh=et("tag:yaml.org,2002:map",{create:()=>({}),identify:tt,represent:e=>{let t=new Map;for(let r of Object.keys(e))t.set(r,e[r]);return t},addPair:(e,t,r)=>{let n=Pn(t);return n===null?"nested arrays are not supported inside keys":(n==="__proto__"?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,"")},has:(e,t)=>{let r=Pn(t);return r!==null&&Object.prototype.hasOwnProperty.call(e,r)},keys:e=>Object.keys(e),get:(e,t)=>{let r=String(t);return Object.prototype.hasOwnProperty.call(e,r)?e[r]:null}}),cl={maxLength:79,indent:1,linesBefore:3,linesAfter:2};function Bt(e,t,r,n,i){let s="",o="",a=Math.floor(i/2)-1;return n-t>a&&(s=" ... ",t=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+e.slice(t,r).replace(/\t/g,"\u2192")+o,pos:n-t+s.length}}function Ut(e,t){return" ".repeat(Math.max(t-e.length,0))+e}function ul(e,t){if(!e.buffer)return null;let r={...cl,...t},n=/\r?\n|\r|\0/g,i=[0],s=[],o,a=-1;for(;o=n.exec(e.buffer);)s.push(o.index),i.push(o.index+o[0].length),e.position<=o.index&&a<0&&(a=i.length-2);a<0&&(a=i.length-1);let c="",l=Math.min(e.line+r.linesAfter,s.length).toString().length,u=r.maxLength-(r.indent+l+3);for(let h=1;h<=r.linesBefore&&!(a-h<0);h++){let d=Bt(e.buffer,i[a-h],s[a-h],e.position-(i[a]-i[a-h]),u);c=`${" ".repeat(r.indent)}${Ut((e.line-h+1).toString(),l)} | ${d.str}
|
|
33
|
+
${c}`}let f=Bt(e.buffer,i[a],s[a],e.position,u);c+=`${" ".repeat(r.indent)}${Ut((e.line+1).toString(),l)} | ${f.str}
|
|
34
|
+
`,c+=`${"-".repeat(r.indent+l+3+f.pos)}^
|
|
35
|
+
`;for(let h=1;h<=r.linesAfter&&!(a+h>=s.length);h++){let d=Bt(e.buffer,i[a+h],s[a+h],e.position-(i[a]-i[a+h]),u);c+=`${" ".repeat(r.indent)}${Ut((e.line+h+1).toString(),l)} | ${d.str}
|
|
36
|
+
`}return c.replace(/\n$/,"")}function $n(e,t){let r="";return e.mark?(e.mark.name&&(r+=`in "${e.mark.name}" `),r+=`(${e.mark.line+1}:${e.mark.column+1})`,!t&&e.mark.snippet&&(r+=`
|
|
37
|
+
|
|
38
|
+
${e.mark.snippet}`),`${e.reason} ${r}`):e.reason}var Fe=class Qn extends Error{reason;mark;constructor(t,r){super(),this.name="YAMLException",this.reason=t,this.mark=r,this.message=$n(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(t){return`${this.name}: ${$n(this,t)}`}static throwAt(t,r,n,i=""){let s=0,o=0;for(let c=0;c<r;c++){let l=t.charCodeAt(c);l===10?(s++,o=c+1):l===13&&(s++,t.charCodeAt(c+1)===10&&c++,o=c+1)}let a={name:i,buffer:t,position:r,line:s,column:r-o};throw a.snippet=ul(a),new Qn(n,a)}},I={DOCUMENT:1,SEQUENCE:2,MAPPING:3,SCALAR:4,ALIAS:5,POP:6},E={PLAIN:1,SINGLE_QUOTED:2,DOUBLE_QUOTED:3,LITERAL_BLOCK:4,FOLDED_BLOCK:5},re={BLOCK:1,FLOW:2},B={CLIP:1,STRIP:2,KEEP:3},fl=-1;function Mn(e){switch(e){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
39
|
+
`;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"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}var Xn=new Array(256),Zn=new Array(256);for(let e=0;e<256;e++)Xn[e]=Mn(e)?1:0,Zn[e]=Mn(e);function hl(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function dl(e){return e>=48&&e<=57?e-48:(e|32)-97+10}function pl(e){return e===120?2:e===117?4:8}function Qe(e,t,r){let n=0;for(;t<r;){let i=e.charCodeAt(t);if(i===10)n++,t++;else if(i===13)n++,t++,e.charCodeAt(t)===10&&t++;else if(i===32||i===9)t++;else break}return{position:t,breaks:n}}function tr(e){return e===1?" ":`
|
|
40
|
+
`.repeat(e-1)}function ml(e,t,r){let n="",i=t,s=t,o=t;for(;i<r;){let a=e.charCodeAt(i);if(a===10||a===13){n+=e.slice(s,o);let c=Qe(e,i,r);n+=tr(c.breaks),i=s=o=c.position}else i++,a!==32&&a!==9&&(o=i)}return n+e.slice(s,o)}function gl(e,t,r){let n="",i=t,s=t,o=t;for(;i<r;){let a=e.charCodeAt(i);if(a===39)n+=e.slice(s,i)+"'",i+=2,s=o=i;else if(a===10||a===13){n+=e.slice(s,o);let c=Qe(e,i,r);n+=tr(c.breaks),i=s=o=c.position}else i++,a!==32&&a!==9&&(o=i)}return n+e.slice(s,r)}function _l(e,t,r){let n="",i=t,s=t,o=t;for(;i<r;){let a=e.charCodeAt(i);if(a===92){n+=e.slice(s,i),i++;let c=e.charCodeAt(i);if(c===10||c===13)i=Qe(e,i,r).position;else if(c<256&&Xn[c])n+=Zn[c],i++;else{let l=pl(c),u=0;for(;l>0;l--){i++;let f=dl(e.charCodeAt(i));u=(u<<4)+f}n+=hl(u),i++}s=o=i}else if(a===10||a===13){n+=e.slice(s,o);let c=Qe(e,i,r);n+=tr(c.breaks),i=s=o=c.position}else i++,a!==32&&a!==9&&(o=i)}return n+e.slice(s,r)}function Hn(e,t,r,n,i,s){let o=n<0?0:n,a=e.slice(t,r).replace(/\r\n?/g,`
|
|
41
|
+
`),c=a===""?[]:(a.endsWith(`
|
|
42
|
+
`)?a.slice(0,-1):a).split(`
|
|
43
|
+
`),l="",u=!1,f=0,h=!1;for(let d of c){let p=0;for(;p<o&&d.charCodeAt(p)===32;)p++;if(n<0||p>=d.length){f++;continue}let g=d.slice(o),R=g.charCodeAt(0);s?R===32||R===9?(h=!0,l+=`
|
|
44
|
+
`.repeat(u?1+f:f)):h?(h=!1,l+=`
|
|
45
|
+
`.repeat(f+1)):f===0?u&&(l+=" "):l+=`
|
|
46
|
+
`.repeat(f):l+=`
|
|
47
|
+
`.repeat(u?1+f:f),l+=g,u=!0,f=0}return i===B.KEEP?l+=`
|
|
48
|
+
`.repeat(u?1+f:f):i!==B.STRIP&&u&&(l+=`
|
|
49
|
+
`),l}function yl(e,t){if(t.valueStart===fl)return"";let{valueStart:r,valueEnd:n}=t;if(t.fast)return e.slice(r,n);switch(t.style){case E.SINGLE_QUOTED:return gl(e,r,n);case E.DOUBLE_QUOTED:return _l(e,r,n);case E.LITERAL_BLOCK:return Hn(e,r,n,t.indent,t.chomping,!1);case E.FOLDED_BLOCK:return Hn(e,r,n,t.indent,t.chomping,!0);default:return ml(e,r,n)}}var El=Object.assign(Object.create(null),{"!":"!","!!":"tag:yaml.org,2002:"});function ei(e,t){if(e.startsWith("!<")&&e.endsWith(">"))return decodeURIComponent(e.slice(2,-1));let r=e.indexOf("!",1),n=r===-1?"!":e.slice(0,r+1),i=t?.[n]??El[n]??n;return decodeURIComponent(i)+decodeURIComponent(e.slice(n.length))}var ye=-1,Sl="tag:yaml.org,2002:merge",rr={filename:"",schema:ol,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function bl(e){return"tagStart"in e&&e.tagStart!==ye?e.tagStart:"anchorStart"in e&&e.anchorStart!==ye?e.anchorStart:"valueStart"in e&&e.valueStart!==ye?e.valueStart:"start"in e?e.start:0}function v(e,t){Fe.throwAt(e.source,e.position,t,e.filename)}function ti(e,t,r,n){try{return r.finalize(n)}catch(i){if(i instanceof Fe)throw i;Fe.throwAt(e.source,t,i instanceof Error?i.message:String(i),e.filename)}}function Al(e,t){let r=yl(e.source,t),n=t.tagStart===ye?"":e.source.slice(t.tagStart,t.tagEnd),i=e.schema.defaultScalarTag;if(n!==""){if(n==="!")return{value:r,tag:i};let s=ei(n,e.tagHandlers),o=e.schema.lookupScalarTag(s);if(o){let c=o.resolve(r,!0,s);return c===S&&v(e,`cannot resolve a node with !<${s}> explicit tag`),{value:c,tag:o}}let a=e.schema.lookupMappingTag(s)??e.schema.lookupSequenceTag(s);if(a){r!==""&&v(e,`cannot resolve a node with !<${s}> explicit tag`);let c=a.create(s);return{value:a.carrierIsResult?c:ti(e,e.position,a,c),tag:a}}v(e,`unknown scalar tag !<${s}>`)}return t.style===E.PLAIN?e.schema.resolveImplicitScalarTag(r):{value:i.resolve(r,!1,i.tagName),tag:i}}function Bn(e,t,r){let n=t.tagStart===ye?"":e.source.slice(t.tagStart,t.tagEnd);return n===""||n==="!"?r:ei(n,e.tagHandlers)}function ri(e){return e.nodeKind==="mapping"}function Un(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&v(e,`merge keys exceeded maxTotalMergeKeys (${e.maxTotalMergeKeys})`)}function jn(e,t,r,n){Un(e);for(let i of n.keys(r)){if(Un(e),t.tag.has(t.value,i))continue;let s=t.tag.addPair(t.value,i,n.get(r,i));s&&v(e,s),t.overridable??=new Set,t.overridable.add(i)}}function Tl(e,t,r,n){if(e.position=t.keyPosition,ri(n))jn(e,t,r,n);else if(n.nodeKind==="sequence"&&Array.isArray(r)){r.length>100&&v(e,"abnormal merge sequence size");for(let i of r){let s=e.nodeTags.get(i);s||v(e,"cannot merge mappings; the provided source object is unacceptable"),jn(e,t,i,s)}}else v(e,"cannot merge mappings; the provided source object is unacceptable")}function Cl(e,t,r,n,i){if(e.position=t.keyPosition,t.keyIsMerge){Tl(e,t,n,i);return}!e.json&&t.tag.has(t.value,r)&&!t.overridable?.has(r)&&v(e,"duplicated mapping key");let s=t.tag.addPair(t.value,r,n);s&&v(e,s),t.overridable?.delete(r)}function jt(e,t,r){let n=e.frames[e.frames.length-1];if(n.kind==="document")n.value=t,n.hasValue=!0;else if(n.kind==="sequence"){ri(r)&&e.nodeTags.set(t,r);let i=n.tag.addItem(n.value,t,n.index++);i&&v(e,i)}else if(n.hasKey){let i=n.key;n.key=void 0,n.hasKey=!1,Cl(e,n,i,t,r)}else n.key=t,n.keyPosition=e.position,n.hasKey=!0,n.keyIsMerge=r.tagName===Sl}function qt(e,t,r,n,i){if(t.anchorStart!==ye){let s={value:r,tag:n,isValueFinal:i};return e.anchors.set(e.source.slice(t.anchorStart,t.anchorEnd),s),s}return null}function xl(e,t){let r={...rr,...t,events:e,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,nodeTags:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;r.eventIndex<r.events.length;){let n=r.events[r.eventIndex++];switch(r.position=bl(n),n.type){case I.DOCUMENT:r.anchors=new Map,r.nodeTags=new Map,r.aliasCount=0,r.tagHandlers=Object.create(null);for(let i of n.directives)i.kind==="tag"&&(r.tagHandlers[i.handle]=i.prefix);r.frames.push({kind:"document",position:r.position,value:void 0,hasValue:!1});break;case I.SCALAR:{let{value:i,tag:s}=Al(r,n);qt(r,n,i,s,!0),jt(r,i,s);break}case I.SEQUENCE:{let i=Bn(r,n,"tag:yaml.org,2002:seq"),s=r.schema.lookupSequenceTag(i);s||v(r,`unknown sequence tag !<${i}>`);let o=s.create(i),a=qt(r,n,o,s,s.carrierIsResult);r.frames.push({kind:"sequence",position:r.position,value:o,tag:s,anchor:a,index:0});break}case I.MAPPING:{let i=Bn(r,n,"tag:yaml.org,2002:map"),s=r.schema.lookupMappingTag(i);s||v(r,`unknown mapping tag !<${i}>`);let o=s.create(i),a=qt(r,n,o,s,s.carrierIsResult);r.frames.push({kind:"mapping",position:r.position,value:o,tag:s,anchor:a,key:void 0,keyPosition:r.position,hasKey:!1,keyIsMerge:!1,overridable:null});break}case I.ALIAS:{r.maxAliases!==-1&&++r.aliasCount>r.maxAliases&&v(r,`aliases exceeded maxAliases (${r.maxAliases})`);let i=r.source.slice(n.anchorStart,n.anchorEnd),s=r.anchors.get(i);s||v(r,`unidentified alias "${i}"`),s.isValueFinal||v(r,`recursive alias "${i}" is not supported for tag ${s.tag.tagName} because it uses finalize()`),jt(r,s.value,s.tag);break}case I.POP:{let i=r.frames.pop();if(i.kind==="mapping"&&i.hasKey&&(r.position=i.keyPosition,v(r,"incomplete mapping pair in event stream")),i.kind==="document")r.documents.push(i.value);else{let s=i.tag.carrierIsResult?i.value:ti(r,i.position,i.tag,i.value);i.anchor&&(i.anchor.value=s,i.anchor.isValueFinal=!0),jt(r,s,i.tag)}break}}}return r.documents}var b=-1,ni=Object.prototype.hasOwnProperty,be=1,zt=2,ii=3,Xe=4,Ol=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Il=/[,\[\]{}]/,si=/^(?:!|!!|![0-9A-Za-z-]+!)$/,Yt=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,oi=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`,Rl=new RegExp(`^(?:${Yt})*$`),wl=new RegExp(`^(?:${oi})+$`),Nl=new RegExp(`^(?:!(?:${Yt})*|${oi}(?:${Yt})*)$`),nr={filename:"",maxDepth:100};function Ll(e,t,r){e.events.push({type:I.DOCUMENT,explicitStart:t,explicitEnd:r,directives:e.directives})}function ai(e,t,r,n,i,s,o){e.events.push({type:I.SEQUENCE,start:t,anchorStart:r,anchorEnd:n,tagStart:i,tagEnd:s,style:o})}function Gt(e,t,r,n,i,s,o){e.events.push({type:I.MAPPING,start:t,anchorStart:r,anchorEnd:n,tagStart:i,tagEnd:s,style:o})}function qn(e,t){e.events.splice(t.eventsLength,0,{type:I.MAPPING,start:t.position,anchorStart:b,anchorEnd:b,tagStart:b,tagEnd:b,style:re.FLOW})}function Te(e,t,r,n,i,s,o,a,c=B.CLIP,l=-1,u=!1){e.events.push({type:I.SCALAR,valueStart:t,valueEnd:r,anchorStart:n,anchorEnd:i,tagStart:s,tagEnd:o,style:a,chomping:c,indent:l,fast:u})}function vl(e,t,r){e.events.push({type:I.ALIAS,anchorStart:t,anchorEnd:r})}function Ee(e){e.events.push({type:I.POP})}function $(e){Te(e,b,b,b,b,b,b,E.PLAIN)}function Kn(){return{anchorStart:b,anchorEnd:b,tagStart:b,tagEnd:b}}function Se(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,eventsLength:e.events.length}}function ue(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.events.length=t.eventsLength}function m(e,t){Fe.throwAt(e.input.slice(0,e.length),e.position,t,e.filename)}function L(e){return e===10||e===13}function he(e){return e===9||e===32}function K(e){return he(e)||L(e)}function Q(e){return e===0||K(e)}function de(e){return e===44||e===91||e===93||e===123||e===125}function kl(e){return e>=48&&e<=57?e-48:-1}function Dl(e){if(e>=48&&e<=57)return e-48;let t=e|32;return t>=97&&t<=102?t-97+10:-1}function Fl(e){return e===120?2:e===117?4:e===85?8:0}function Pl(e){return e===48||e===97||e===98||e===116||e===9||e===110||e===118||e===102||e===114||e===101||e===32||e===34||e===47||e===92||e===78||e===95||e===76||e===80}function Ze(e){e.input.charCodeAt(e.position)===10?e.position++:(e.position++,e.input.charCodeAt(e.position)===10&&e.position++),e.line++,e.lineStart=e.position,e.lineIndent=0,e.firstTabInLine=-1}function D(e,t){let r=0,n=e.input.charCodeAt(e.position),i=e.position===e.lineStart||K(e.input.charCodeAt(e.position-1));for(;n!==0;){for(;he(n);)i=!0,n===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),n=e.input.charCodeAt(++e.position);if(t&&i&&n===35)do n=e.input.charCodeAt(++e.position);while(!L(n)&&n!==0);if(!L(n))break;for(Ze(e),r++,i=!0,n=e.input.charCodeAt(e.position);n===32;)e.lineIndent++,n=e.input.charCodeAt(++e.position)}return r}function Ae(e,t=e.position){let r=e.input.charCodeAt(t);if((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)){let n=e.input.charCodeAt(t+3);return n===0||K(n)}return!1}function li(e){e.position===e.lineStart&&e.input.charCodeAt(e.position)===65279&&(e.position++,e.lineStart=e.position)}function ir(e){if(e.position!==e.lineStart)return!1;if(Ae(e))return!0;if(e.input.charCodeAt(e.position)!==65279)return!1;let t=Se(e);li(e),D(e,!0);let r=e.input.charCodeAt(e.position),n=e.position===e.lineStart&&(r===37||r===45&&Ae(e));return ue(e,t),n}function Vn(e){let t=e.input.charCodeAt(e.position);for(;t!==0&&!L(t);)t=e.input.charCodeAt(++e.position)}function ci(e,t,r){Ol.test(e.input.slice(t,r))&&m(e,"the stream contains non-printable characters")}function $l(e,t,r){if(e.input.charCodeAt(e.position)!==33)return!1;t.tagStart!==b&&m(e,"duplication of a tag property");let n=e.position,i=!1,s=!1,o="!",a=e.input.charCodeAt(++e.position);a===60?(i=!0,a=e.input.charCodeAt(++e.position)):a===33&&(s=!0,o="!!",a=e.input.charCodeAt(++e.position));let c=e.position,l;if(i){for(;a!==0&&a!==62;)a=e.input.charCodeAt(++e.position);a!==62&&m(e,"unexpected end of the stream within a verbatim tag"),l=e.input.slice(c,e.position),e.position++}else{for(;a!==0&&!K(a)&&!(r&&de(a));)a===33&&(s?m(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(c-1,e.position+1),si.test(o)||m(e,"named tag handle cannot contain such characters"),s=!0,c=e.position+1)),a=e.input.charCodeAt(++e.position);l=e.input.slice(c,e.position),Il.test(l)&&m(e,"tag suffix cannot contain flow indicator characters")}return l&&!(i?Rl.test(l):wl.test(l))&&m(e,`tag name cannot contain such characters: ${l}`),!i&&o!=="!"&&o!=="!!"&&!ni.call(e.tagHandlers,o)&&m(e,`undeclared tag handle "${o}"`),t.tagStart=n,t.tagEnd=e.position,!0}function Ml(e,t){if(e.input.charCodeAt(e.position)!==38)return!1;t.anchorStart!==b&&m(e,"duplication of an anchor property"),e.position++;let r=e.position;for(;e.input.charCodeAt(e.position)!==0&&!K(e.input.charCodeAt(e.position))&&!de(e.input.charCodeAt(e.position));)e.position++;return e.position===r&&m(e,"name of an anchor node must contain at least one character"),t.anchorStart=r,t.anchorEnd=e.position,!0}function Hl(e,t){if(e.input.charCodeAt(e.position)!==42)return!1;(t.anchorStart!==b||t.tagStart!==b)&&m(e,"alias node should not have any properties"),e.position++;let r=e.position;for(;e.input.charCodeAt(e.position)!==0&&!K(e.input.charCodeAt(e.position))&&!de(e.input.charCodeAt(e.position));)e.position++;return e.position===r&&m(e,"name of an alias node must contain at least one character"),vl(e,r,e.position),!0}function Jt(e,t){D(e,!1),e.lineIndent<t&&m(e,"deficient indentation")}function Bl(e,t,r){if(e.input.charCodeAt(e.position)!==39)return!1;e.position++;let n=e.position,i=!0;for(;e.input.charCodeAt(e.position)!==0;){let s=e.input.charCodeAt(e.position);if(s===39){if(e.input.charCodeAt(e.position+1)===39){i=!1,e.position+=2;continue}let o=e.position;return e.position++,Te(e,n,o,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,E.SINGLE_QUOTED,B.CLIP,-1,i),!0}L(s)?(i=!1,Jt(e,t)):e.position===e.lineStart&&Ae(e)?m(e,"unexpected end of the document within a single quoted scalar"):s!==9&&s<32?m(e,"expected valid JSON character"):e.position++}m(e,"unexpected end of the stream within a single quoted scalar")}function Ul(e,t,r){if(e.input.charCodeAt(e.position)!==34)return!1;e.position++;let n=e.position,i=!0;for(;e.input.charCodeAt(e.position)!==0;){let s=e.input.charCodeAt(e.position);if(s===34){let o=e.position;return e.position++,Te(e,n,o,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,E.DOUBLE_QUOTED,B.CLIP,-1,i),!0}if(s===92){i=!1;let o=e.input.charCodeAt(++e.position);if(L(o))Jt(e,t);else if(Pl(o))e.position++;else{let a=Fl(o);for(a===0&&m(e,"unknown escape sequence");a-- >0;)e.position++,Dl(e.input.charCodeAt(e.position))<0&&m(e,"expected hexadecimal character");e.position++}}else L(s)?(i=!1,Jt(e,t)):e.position===e.lineStart&&Ae(e)?m(e,"unexpected end of the document within a double quoted scalar"):s!==9&&s<32?m(e,"expected valid JSON character"):e.position++}m(e,"unexpected end of the stream within a double quoted scalar")}function jl(e,t,r){let n=e.input.charCodeAt(e.position),i=B.CLIP,s=-1,o=!1;if(n!==124&&n!==62)return!1;let a=n===124?E.LITERAL_BLOCK:E.FOLDED_BLOCK;for(e.position++;e.input.charCodeAt(e.position)!==0;){let d=e.input.charCodeAt(e.position),p=kl(d);if(d===43||d===45)i!==B.CLIP&&m(e,"repeat of a chomping mode identifier"),i=d===43?B.KEEP:B.STRIP,e.position++;else if(p>=0)p===0&&m(e,"bad explicit indentation width of a block scalar; it cannot be less than one"),o&&m(e,"repeat of an indentation width identifier"),s=t+p-1,o=!0,e.position++;else break}let c=!1;for(;he(e.input.charCodeAt(e.position));)c=!0,e.position++;c&&e.input.charCodeAt(e.position)===35&&Vn(e),L(e.input.charCodeAt(e.position))?Ze(e):e.input.charCodeAt(e.position)!==0&&m(e,"a line break is expected");let l=o?s:-1,u=0,f=e.position,h=e.position;for(;e.input.charCodeAt(e.position)!==0;){let d=e.position,p=0;for(;e.input.charCodeAt(d+p)===32;)p++;let g=e.input.charCodeAt(d+p);if(g===0){l>=0?p>l&&(h=d+p):p>0&&(h=d+p);break}if(ir(e))break;if(!o&&l===-1&&L(g)&&(u=Math.max(u,p)),!o&&l===-1&&!L(g)&&(g===9&&p<t&&(e.position=d+p,m(e,"tab characters must not be used in indentation")),p<u&&(e.position=d+p,m(e,"bad indentation of a mapping entry"))),l===-1&&g!==0&&!L(g)&&p<t){e.lineIndent=p,e.position=d+p;break}!o&&g!==0&&!L(g)&&l===-1&&(l=p);let R=l===-1?t+1:l;if(g!==0&&!L(g)&&p<R){e.lineIndent=p,e.position=d+p;break}Vn(e),h=e.position,L(e.input.charCodeAt(e.position))&&(Ze(e),h=e.position)}return ci(e,f,h),Te(e,f,h,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,a,i,l),!0}function ql(e,t){let r=e.input.charCodeAt(e.position),n=t===be;if(r===0||K(r)||r===35||r===38||r===42||r===33||r===124||r===62||r===39||r===34||r===37||r===64||r===96||n&&de(r))return!1;if(r===63||r===45){let i=e.input.charCodeAt(e.position+1);if(Q(i)||n&&de(i))return!1}return!0}function Kl(e,t,r,n){if(!ql(e,r))return!1;let i=e.position,s=e.position,o=e.input.charCodeAt(e.position),a=r===be,c=!1;for(;o!==0&&!ir(e);){if(o===58){let l=e.input.charCodeAt(e.position+1);if(Q(l)||a&&de(l))break}else if(o===35){if(K(e.input.charCodeAt(e.position-1)))break}else{if(a&&de(o))break;if(L(o)){let l=e.position,u=e.line,f=e.lineStart,h=e.lineIndent;if(D(e,!1),e.lineIndent>=t){c=!0,o=e.input.charCodeAt(e.position);continue}e.position=l,e.line=u,e.lineStart=f,e.lineIndent=h;break}}he(o)||(s=e.position+1),o=e.input.charCodeAt(++e.position)}return s===i?!1:(ci(e,i,s),Te(e,i,s,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,E.PLAIN,B.CLIP,-1,!c),!0)}function De(e,t){let r=e.line;D(e,!0),(e.line>r&&e.lineIndent<t||e.firstTabInLine!==-1&&e.lineIndent<t)&&m(e,"deficient indentation")}function Vl(e,t,r){let n=e.input.charCodeAt(e.position),i=n===123,s=e.position,o=!0;if(n!==91&&n!==123)return!1;let a=i?125:93;for(i?Gt(e,s,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,re.FLOW):ai(e,s,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,re.FLOW),e.position++;e.input.charCodeAt(e.position)!==0;){De(e,t);let c=e.input.charCodeAt(e.position);if(c===a)return e.position++,Ee(e),!0;o?c===44&&m(e,"expected the node content, but found ','"):m(e,"missed comma between flow collection entries");let l=!1,u=!1;c===63&&K(e.input.charCodeAt(e.position+1))&&(l=u=!0,e.position+=1,De(e,t));let f=e.line,h=Se(e),d=fe(e,t,be,!1,!0);De(e,t),c=e.input.charCodeAt(e.position),(i||u||e.line===f)&&c===58?(l=!0,e.position++,De(e,t),i||qn(e,h),d||$(e),fe(e,t,be,!1,!0)||$(e),De(e,t),i||Ee(e)):i&&l?(d||$(e),$(e)):i?$(e):l&&(qn(e,h),d||$(e),$(e),Ee(e)),c=e.input.charCodeAt(e.position),c===44?(o=!0,e.position++):o=!1}m(e,"unexpected end of the stream within a flow collection")}function Wn(e,t,r){if(e.firstTabInLine!==-1||e.input.charCodeAt(e.position)!==45||!Q(e.input.charCodeAt(e.position+1)))return!1;for(ai(e,e.position,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,re.BLOCK);e.input.charCodeAt(e.position)===45&&Q(e.input.charCodeAt(e.position+1));){e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,m(e,"tab characters must not be used in indentation"));let n=e.line;e.position++;let i=D(e,!0)>0;if(e.firstTabInLine!==-1&&e.input.charCodeAt(e.position)===45&&Q(e.input.charCodeAt(e.position+1))&&m(e,"bad indentation of a sequence entry"),i&&e.lineIndent<=t?$(e):fe(e,t,ii,!1,!0),D(e,!0),e.lineIndent<t||e.position>=e.length)break;e.lineIndent>t&&m(e,"bad indentation of a sequence entry"),e.line===n&&e.input.charCodeAt(e.position)===45&&Q(e.input.charCodeAt(e.position+1))&&m(e,"bad indentation of a sequence entry")}return Ee(e),!0}function Kt(e,t,r,n){let i=!1,s=!1,o=!1,a=!1;if(e.firstTabInLine!==-1)return!1;let c=e.input.charCodeAt(e.position);for(;c!==0;){!i&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,m(e,"tab characters must not be used in indentation"));let l=e.input.charCodeAt(e.position+1),u=e.line;if((c===63||c===58)&&Q(l))o||(Gt(e,e.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,re.BLOCK),o=!0),c===63?(i&&$(e),s=!0,i=!0):(i||($(e),s=!0),i=!1),e.position+=1,a=!0;else{i&&($(e),i=!1);let f=Se(e);if(!fe(e,r,zt,!1,!0))break;if(e.line===u){for(c=e.input.charCodeAt(e.position);he(c);)c=e.input.charCodeAt(++e.position);if(c===58){if(c=e.input.charCodeAt(++e.position),Q(c)||m(e,"a whitespace character is expected after the key-value separator within a block mapping"),!o){for(ue(e,f),Gt(e,f.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,re.BLOCK),o=!0,fe(e,r,zt,!1,!0),c=e.input.charCodeAt(e.position);he(c);)c=e.input.charCodeAt(++e.position);e.position++}s=!0,i=!1,a=!1}else if(s)m(e,"expected ':' after a mapping key");else return n.anchorStart!==b||n.tagStart!==b?(ue(e,f),!1):!0}else if(s)m(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.anchorStart!==b||n.tagStart!==b?(ue(e,f),!1):!0}if(fe(e,t,Xe,!0,a)&&(a=!1),i||a&&($(e),a=!1),D(e,!0),c=e.input.charCodeAt(e.position),(e.line===u||e.lineIndent>t)&&c!==0)m(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return s?(i&&$(e),o&&Ee(e),!0):!1}function fe(e,t,r,n,i,s=!0){e.depth>=e.maxDepth&&m(e,`nesting exceeded maxDepth (${e.maxDepth})`),e.depth++;let o=1,a=!1,c=!1,l=null,u=Kn(),f=r===Xe||r===ii,h=f,d=f;if(n&&D(e,!0)&&(a=!0,e.lineIndent>t?o=1:e.lineIndent===t?o=0:o=-1),o===1)for(;;){let p=e.input.charCodeAt(e.position),g=Se(e);if(a&&o!==1&&(p===33||p===38))break;if(a&&d&&(u.tagStart!==b||u.anchorStart!==b)&&(p===33||p===38)){let R=Se(e),N=t+1;if(Kt(e,e.position-e.lineStart,N,u)&&e.events[R.eventsLength]?.type===I.MAPPING)return e.depth--,!0;ue(e,R)}if(a&&(p===33&&u.tagStart!==b||p===38&&u.anchorStart!==b)||!$l(e,u,r===be)&&!Ml(e,u))break;l===null&&(l=g),D(e,!0)?(a=!0,h=d,e.lineIndent>t?o=1:e.lineIndent===t?o=0:o=-1):h=!1}if(h&&(h=a||i),o===1||r===Xe){let p=r===be||r===zt?t:t+1,g=e.position-e.lineStart;if(o===1)if(h&&(Wn(e,g,u)||Kt(e,g,p,u))||Vl(e,p,u))c=!0;else{let R=e.input.charCodeAt(e.position);if(l!==null&&s&&d&&!h&&R!==124&&R!==62){let N=Se(e),x=l.position-l.lineStart;ue(e,l),Kt(e,x,p,Kn())&&e.events[N.eventsLength]?.type===I.MAPPING?c=!0:ue(e,N)}!c&&(f&&jl(e,p,u)||Bl(e,p,u)||Ul(e,p,u)||Hl(e,u)||Kl(e,p,r,u))&&(c=!0)}else o===0&&(c=h&&Wn(e,g,u))}return f=f&&!c,!c&&(u.anchorStart!==b||u.tagStart!==b||f)&&(Te(e,b,b,u.anchorStart,u.anchorEnd,u.tagStart,u.tagEnd,E.PLAIN),c=!0),e.depth--,c||u.anchorStart!==b||u.tagStart!==b}function Wl(e){if(e.lineIndent>0||e.input.charCodeAt(e.position)!==37)return!1;e.position++;let t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!K(e.input.charCodeAt(e.position));)e.position++;let r=e.input.slice(t,e.position),n=[];for(r.length===0&&m(e,"directive name must not be less than one character in length");e.input.charCodeAt(e.position)!==0&&!L(e.input.charCodeAt(e.position));){for(;he(e.input.charCodeAt(e.position));)e.position++;if(e.input.charCodeAt(e.position)===35||L(e.input.charCodeAt(e.position))||e.input.charCodeAt(e.position)===0)break;let i=e.position;for(;e.input.charCodeAt(e.position)!==0&&!K(e.input.charCodeAt(e.position));)e.position++;n.push(e.input.slice(i,e.position))}if(L(e.input.charCodeAt(e.position))&&Ze(e),r==="YAML"){e.directives.some(s=>s.kind==="yaml")&&m(e,"duplication of %YAML directive"),n.length!==1&&m(e,"YAML directive accepts exactly one argument");let i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);i===null&&m(e,"ill-formed argument of the YAML directive"),parseInt(i[1],10)!==1&&m(e,"unacceptable YAML version of the document"),e.directives.push({kind:"yaml",version:n[0]})}else if(r==="TAG"){n.length!==2&&m(e,"TAG directive accepts exactly two arguments");let[i,s]=n;si.test(i)||m(e,"ill-formed tag handle (first argument) of the TAG directive"),ni.call(e.tagHandlers,i)&&m(e,`there is a previously declared suffix for "${i}" tag handle`),Nl.test(s)||m(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagHandlers[i]=s,e.directives.push({kind:"tag",handle:i,prefix:s})}return!0}function zl(e){e.directives=[],e.tagHandlers=Object.create(null);let t=!1;for(D(e,!0);Wl(e);)t=!0,D(e,!0);let r=!1,n=!1,i=!0;if(e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45&&Q(e.input.charCodeAt(e.position+3))){r=!0;let a=e.line;e.position+=3,D(e,!0),i=e.line>a}else t&&m(e,"directives end mark is expected");let s=e.events.length;if(!r&&e.position===e.lineStart&&e.input.charCodeAt(e.position)===46&&Ae(e)){e.position+=3,D(e,!0);return}if(Ll(e,r,!1),fe(e,e.lineIndent-1,Xe,!1,i,i)||$(e),D(e,!0),e.position===e.lineStart&&Ae(e)&&(n=e.input.charCodeAt(e.position)===46,n)){let a=e.line;e.position+=3,D(e,!0),e.line===a&&e.position<e.length&&m(e,"end of the stream or a document separator is expected")}let o=e.events[s];o?.type===I.DOCUMENT&&(o.explicitEnd=n),Ee(e),!n&&e.position<e.length&&!ir(e)&&m(e,"end of the stream or a document separator is expected")}function Yl(e,t){let r=e.length,n={...nr,...t,input:`${e}\0`,length:r,position:0,line:0,lineStart:0,lineIndent:0,firstTabInLine:-1,depth:0,directives:[],tagHandlers:Object.create(null),events:[]},i=e.indexOf("\0");for(i!==-1&&Fe.throwAt(e,i,"null byte is not allowed in input",n.filename);n.position<n.length&&(li(n),D(n,!0),!(n.position>=n.length));){let s=n.position;zl(n),n.position===s&&m(n,"can not read a document")}return n.events}var Gl={...nr,...rr};function Jl(e,t={}){let r={...Gl,...t},n=String(e),i=Object.keys(nr),s=Object.keys(rr);return xl(Yl(n,Fn(r,i)),{...Fn(r,s),source:n})}function ui(e,t,r){let n=null;typeof t=="function"?n=t:t!==null&&typeof t=="object"&&(r=t);let i=Jl(e,r);if(n===null)return i;for(let s of i)n(s)}function nt(e,t){return(e&1<<t)!==0}var zn={applyQuoteFlowKeysOption:Ql,doubleQuoteForInvisibles:Xl,doubleQuoteWhitespaceOnly:Zl,applyForceQuotesOption:ec,tryLongOrMultilineAsBlock:tc,quoteInvalidPlain:rc,fallbackToDoubleQuoted:nc};function fi(e){return e.presenterOptions.quoteStyle==="single"&&nt(e.allowedStylesMask,E.SINGLE_QUOTED)?E.SINGLE_QUOTED:E.DOUBLE_QUOTED}function Ql(e){e.presenterOptions.quoteFlowKeys&&(!e.isKey||!e.flowOnly||e.style!==E.PLAIN||(e.style=E.DOUBLE_QUOTED))}function Xl(e){e.style===E.PLAIN&&/[\t\x7F-\xA0\u2028\u2029\uFEFF\uFFFE\uFFFF]/.test(e.node.value)&&(e.style=E.DOUBLE_QUOTED)}function Zl(e){e.style===E.PLAIN&&/^\s+$/.test(e.node.value)&&(e.style=E.DOUBLE_QUOTED)}function ec(e){e.presenterOptions.forceQuotes&&(e.isKey||e.style!==E.PLAIN||e.node.tag===e.presenterOptions.schema.defaultScalarTag.tagName&&(e.style=e.node.value.includes(`
|
|
50
|
+
`)?E.DOUBLE_QUOTED:fi(e)))}function tc(e){if(e.style!==E.PLAIN||e.isKey)return;let t=e.node.value,r=t.indexOf(`
|
|
51
|
+
`)!==-1;if(!nt(e.allowedStylesMask,E.LITERAL_BLOCK)){r&&(e.style=E.DOUBLE_QUOTED);return}let n=e.presenterOptions.lineWidth;if(n===-1){r&&(e.style=E.LITERAL_BLOCK);return}let i=Math.max(Math.min(n,40),n-e.shiftOfContent),s=0,o=!1;for(;s<=t.length;){let a=t.length,c=t.indexOf(`
|
|
52
|
+
`,s);c!==-1&&(a=c);let l=t.slice(s,a);if(l.length>i&&l[0]!==" "&&/ [^ \t]/.test(l)&&(o=!0),c===-1)break;s=c+1}o?e.style=E.FOLDED_BLOCK:r&&(e.style=E.LITERAL_BLOCK)}function rc(e){e.style===E.PLAIN&&!nt(e.allowedStylesMask,E.PLAIN)&&(e.style=fi(e))}function nc(e){nt(e.allowedStylesMask,e.style)||(e.style=E.DOUBLE_QUOTED)}var ic="[\\x09\\x0A\\x0D\\x20-\\x7E\\x85\\xA0-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]",sc="[\\n\\r]",oc="\\uFEFF",sr="[ \\t]",hi=`(?:(?!(?:${sc}|${oc}))${ic})`,it=`(?:(?!${sr})${hi})`,di="[\\x09\\x20-\\uD7FF\\uE000-\\uFFFF\\u{10000}-\\u{10FFFF}]",pi="[-?:,\\[\\]{}#&*!|>'\"%@`]",ac="[,\\[\\]{}]",Qt=it,Xt=`(?:(?!${ac})${it})`,lc=`(?:(?:(?!${pi})${it})|[?:-](?=${Qt}))`,cc=`(?:(?:(?!${pi})${it})|[?:-](?=${Xt}))`,mi=`(?:(?:(?![:#])${Qt})|:(?=${Qt}))#*`,gi=`(?:(?:(?![:#])${Xt})|:(?=${Xt}))#*`,_i=`(?:${sr}*${mi})*`,yi=`(?:${sr}*${gi})*`,Ei=`${lc}#*${_i}`,Si=`${cc}#*${yi}`,uc=Ei,fc=Si,hc=`\\n+${mi}${_i}`,dc=`\\n+${gi}${yi}`,pc=`${Ei}(?:${hc})*`,mc=`${Si}(?:${dc})*`,ih=new RegExp(`^(?:${pc})$`,"u"),sh=new RegExp(`^(?:${mc})$`,"u"),oh=new RegExp(`^(?:${uc})$`,"u"),ah=new RegExp(`^(?:${fc})$`,"u"),lh=new RegExp(`^(?:${di})*$`,"u"),ch=new RegExp(`^(?:${di}|\\n)*$`,"u"),uh=new RegExp(`^(?:${hi}|\\n)*$`,"u");var gc={indent:2,seqNoIndent:!1,seqInlineFirst:!0,lineWidth:80,flowBracketPadding:!1,flowSkipCommaSpace:!1,flowSkipColonSpace:!1,quoteFlowKeys:!1,quoteStyle:"single",forceQuotes:!1,scalarStyleRules:Object.keys(zn).map(e=>Reflect.get(zn,e)),tagBeforeAnchor:!1};var fh={...gc,schema:ll,skipInvalid:!1,noRefs:!1,flowLevel:-1,sortKeys:!1,transform:()=>{}};var hh=I.DOCUMENT,dh=I.SEQUENCE,ph=I.MAPPING,mh=I.SCALAR,gh=I.ALIAS,_h=I.POP,yh=E.PLAIN,Eh=E.SINGLE_QUOTED,Sh=E.DOUBLE_QUOTED,bh=E.LITERAL_BLOCK,Ah=E.FOLDED_BLOCK,Th=re.BLOCK,Ch=re.FLOW,xh=B.CLIP,Oh=B.STRIP,Ih=B.KEEP;var bi=Object.freeze([]),or=(e,t)=>{if(z(e,"YAML"))return t?.onParseError?.(ee("YAML")),bi;let r=_c(e,t?.onParseError);if(r===null)return bi;let n=[];for(let i of r)U(i,n);return Object.freeze(n)};function _c(e,t){try{return ui(e)}catch(r){return t&&r instanceof Error&&t(`Invalid YAML: ${r.message}`),null}}var yc=(e,t)=>{if(z(e,"JSON"))return t?.onParseError?.(ee("JSON")),ar;let r=qe(e);return r.trim().length===0?ar:wt(r,t)},Ai=Object.freeze({json:wt,jsonc:yc,yaml:or,yml:or,csv:Lr,tsv:vr,toml:kn,ini:Vr,env:Dr,markdown:we,md:we,fallback:we,...Gr}),ar=Object.freeze([]);function st(e,t,r){let n=e.trim();if(n.length===0)return ar;let i=Ec(t);return Sc(i)(n,r)}function Ec(e){return e.trim().toLowerCase()}function Sc(e){return Object.hasOwn(Ai,e)?Ai[e]:we}function bc(e){return!e.some(t=>t.severity==="error")}function Ti(){let e=[];return{onParseError:t=>{e.push({severity:"error",code:"parsing",message:t})},diagnostics:()=>e}}function Ci(e,t){return e.length<=t?{items:e,truncated:!1}:{items:e.slice(0,t),truncated:!0}}function ot(e,t,r,n,i){return{ok:bc(n),data:t,diagnostics:n,meta:{tool:e,count:r,truncated:i}}}function xi(e){let t=e.maxResults;if(t===void 0)return 500;if(typeof t!="number"||!Number.isInteger(t)||t<1)throw new Error("maxResults must be a positive integer");return Math.min(t,5e3)}function Oi(e,t){let r=e[t];if(typeof r!="string")throw new Error(`${t} is required and must be a string`);return r}var lr=new Map([["json","json"],["jsonc","jsonc"],["yaml","yaml"],["yml","yaml"],["csv","csv"],["tsv","tsv"],["toml","toml"],["ini","ini"],["env","env"],["dotenv","env"],["python","python"],["py","python"],["rust","rust"],["rs","rust"],["go","go"],["shellscript","shellscript"],["sh","shellscript"],["bash","shellscript"],["zsh","shellscript"],["php","php"],["ruby","ruby"],["rb","ruby"],["perl","perl"],["pl","perl"],["pm","perl"],["csharp","csharp"],["cs","csharp"],["javascript","javascript"],["javascriptreact","javascript"],["js","javascript"],["jsx","javascript"],["mjs","javascript"],["cjs","javascript"],["typescript","typescript"],["typescriptreact","typescript"],["ts","typescript"],["tsx","typescript"],["mts","typescript"],["cts","typescript"],["markdown","fallback"],["md","fallback"]]),Ii=Object.freeze(["json","jsonc","yaml","csv","tsv","toml","ini","env","python","rust","go","shellscript","php","ruby","perl","csharp","javascript","typescript","fallback"]),ur="fallback";function cr(e){return e.trim().toLowerCase().replace(/^\./,"")}function ne(e,t){if(e){let r=lr.get(cr(e));if(r)return r}if(t){let r=Ac(t),n=cr(r),i=lr.get(n.startsWith(".")?n.slice(1):n);if(i)return i;if(Tc(r.trim().toLowerCase()))return"env";let s=r.includes(".")?r.slice(r.lastIndexOf(".")+1):"",o=lr.get(cr(s));if(o)return o}return ur}function Ac(e){return e.slice(Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"))+1)}function Tc(e){return e===".env"||e.startsWith(".env.")?!0:e.endsWith(".env")&&e.length>4}var xc={type:"integer",minimum:1,maximum:5e3,default:500,description:`Cap on returned strings (default ${500}). meta.truncated reports whether any were dropped.`};function Oc(e){let t=Oi(e,"content"),r=xi(e),n=typeof e.format=="string"?e.format:void 0,i=typeof e.filename=="string"?e.filename:void 0,s=ne(n,i),o=Ti(),a=st(t,s,{onParseError:o.onParseError,multiline:e.multiline===!0}),c=e.dedupe===!0?[...new Set(a)]:a,{items:l,truncated:u}=Ci(c,r);return Promise.resolve(ot("extract_strings",{strings:l,fileType:s},l.length,o.diagnostics(),u))}var wi=Object.freeze([Object.freeze({name:"extract_strings",description:"Extract every string value from a document. Parses JSON, YAML, CSV, TOML, INI and dotenv; for any other format it falls back to quoted strings \u2014 single, double or backtick \u2014 so a format is optional but unquoted prose yields nothing. Returns the values themselves, in document order, not their positions.",inputSchema:{type:"object",properties:{content:{type:"string",description:"The document text to scan."},format:{type:"string",enum:Ii,description:"Document format. Optional \u2014 an unrecognised or absent format falls back to extracting quoted strings."},filename:{type:"string",description:'Filename used to infer the format when `format` is absent, e.g. "config.toml".'},dedupe:{type:"boolean",default:!1,description:"Collapse repeated values to their first occurrence."},multiline:{type:"boolean",default:!1,description:"For a format nothing here parses, let a quoted run span lines, so a multi-line template literal or message is read too. Languages whose own strings span lines are read that way regardless."},maxResults:xc},required:["content"],additionalProperties:!1},handler:Oc})]);var Ic="2025-06-18";function Rc(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.jsonrpc==="2.0"&&typeof t.method=="string"}function wc(e,t){let r=new Map(t.map(s=>[s.name,s])),n=t.map(s=>({name:s.name,description:s.description,inputSchema:s.inputSchema}));async function i(s){let o=s?.name;if(typeof o!="string")throw Object.assign(new Error("tools/call requires a string `name`"),{code:-32602});let a=r.get(o);if(!a)throw Object.assign(new Error(`Unknown tool: ${o}`),{code:-32602});let c=s?.arguments??{};try{let l=await a.handler(c);return{content:[{type:"text",text:JSON.stringify(l,null,2)}],structuredContent:l,isError:!1}}catch(l){return{content:[{type:"text",text:l instanceof Error?l.message:String(l)}],isError:!0}}}return async function(o){let{method:a,params:c}=o,l=o.id??null,u=o.id===void 0||o.id===null;try{if(a==="initialize"){let f=c?.protocolVersion;return{jsonrpc:"2.0",id:l,result:{protocolVersion:typeof f=="string"?f:Ic,capabilities:{tools:{listChanged:!1}},serverInfo:e}}}return a==="notifications/initialized"||u?null:a==="ping"?{jsonrpc:"2.0",id:l,result:{}}:a==="tools/list"?{jsonrpc:"2.0",id:l,result:{tools:n}}:a==="tools/call"?{jsonrpc:"2.0",id:l,result:await i(c)}:{jsonrpc:"2.0",id:l,error:{code:-32601,message:`Unknown method: ${a}`}}}catch(f){let h=typeof f?.code=="number"?f.code:-32603,d=f instanceof Error?f.message:String(f);return{jsonrpc:"2.0",id:l,error:{code:h,message:d}}}}}function Ni(e,t,r=process.stdin,n=process.stdout){let i=wc(e,t),s="",o=!1,a=l=>{n.write(`${JSON.stringify(l)}
|
|
53
|
+
`)},c=()=>({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Message exceeds the 16777216 byte frame limit"}});r.setEncoding?.("utf8"),r.on("data",l=>{let u=l;if(o){let h=u.indexOf(`
|
|
54
|
+
`);if(h===-1)return;o=!1,u=u.slice(h+1)}s+=u;let f=s.indexOf(`
|
|
55
|
+
`);for(;f!==-1;){let h=s.slice(0,f).trim();if(s=s.slice(f+1),f=s.indexOf(`
|
|
56
|
+
`),!h)continue;if(h.length>16777216){a(c());continue}let d;try{d=JSON.parse(h)}catch{a({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Invalid JSON"}});continue}if(!Rc(d)){a({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Not a JSON-RPC 2.0 request"}});continue}i(d).then(p=>{p&&a(p)})}s.length>16777216&&(s="",o=!0,a(c()))})}var Pi=require("node:fs"),lt=require("node:path");var Nc=Object.freeze({ENOENT:"No such file or directory",EACCES:"Permission denied",EPERM:"Operation not permitted",ENOTDIR:"Not a directory",EISDIR:"Is a directory",ELOOP:"Too many levels of symbolic links",ENAMETOOLONG:"File name too long",EBUSY:"Resource busy",EIO:"Input/output error"}),Li="INVALID_UTF8";function at(e){try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(e)}catch{throw Object.assign(new Error("stream did not contain valid UTF-8"),{code:Li})}}function vi(e){return e.startsWith("\uFEFF")?e.slice(1):e}function pe(e){let t=Lc(e);if(t===Li)return"stream did not contain valid UTF-8";let r=vc(e),n=t&&Nc[t]||kc(e);return r===void 0?n:`${n} (os error ${r})`}function Lc(e){if(typeof e!="object"||e===null)return;let t=e.code;return typeof t=="string"?t:void 0}function vc(e){if(typeof e!="object"||e===null)return;let t=e.errno;return typeof t=="number"?Math.abs(t):void 0}function kc(e){let r=(e instanceof Error?e.message:String(e)).replace(/^[A-Z]+: /,"").replace(/, \w+ '.*'$/,"");return r.charAt(0).toUpperCase()+r.slice(1)}function ki(e,t){let r=fr(e),n=0;return t.map(i=>{let s=e.indexOf(i,n);return s===-1?{value:i,position:null}:(n=s+i.length,{value:i,position:r(s)})})}function Di(e,t){if(z(e,"JSON"))return[];let r=t?qe(e):e;if(!Dc(r))return[];let n=[],i=/"(?:[^"\\]|\\.)*"/y,s=0;for(;s<r.length;){if(r[s]!=='"'){s+=1;continue}i.lastIndex=s;let o=i.exec(r)?.[0];if(o===void 0)return[];let a=JSON.parse(o).trim();!Fc(r,s+o.length)&&a.length>0&&n.push({value:a,offset:s+1}),s+=o.length}return n}function Dc(e){if(e.trim().length===0)return!1;try{return JSON.parse(e),!0}catch{return!1}}function Fc(e,t){let r=t;for(;/\s/.test(e[r]??"");)r+=1;return e[r]===":"}function fr(e){let t=[0];for(let r=0;r<e.length;r++)e[r]===`
|
|
57
|
+
`&&t.push(r+1);return r=>{let n=Math.min(r,e.length),i=0,s=t.length-1;for(;i<s;){let o=i+s+1>>1;t[o]<=n?i=o:s=o-1}return{line:i+1,column:n-t[i]+1}}}var ct=Object.freeze({dedupe:!1,extract:Object.freeze({csvHasHeader:!1,csvColumn:null,multiline:!1}),format:null}),Pc=8*1024;function ut(e,t){let r=Kc(e),n=t.format??ne(void 0,(0,lt.basename)(e)),i;try{i=(0,Pi.readFileSync)(e)}catch(o){return hr(Fi(r,n,pe(o)))}if(jc(i))return{kind:"binary"};let s=qc(i);return hr(s===null?Fi(r,n,"not UTF-8 text"):dr(vi(s),r,n,t))}function dr(e,t,r,n){let{found:i,parseError:s}=$c(e,r,n.extract),o=n.dedupe?Hc(i):i,a=s===null?[]:[{severity:"warning",code:"unparsed",message:s}];return Object.freeze({file:t,format:r,strings:Object.freeze(o.map(Mc)),diagnostics:Object.freeze(a),summary:Object.freeze({strings:o.length,unlocated:o.filter(c=>c.position===null).length})})}function $i(e,t){return e.some(Bc)||t&&e.some(Uc)?2:e.some(r=>r.summary.strings>0)?0:1}function Mi(e,t){return t.line===void 0?`${e.file}:- ${t.value}`:`${e.file}:${t.line}:${t.column} ${t.value}`}function $c(e,t,r){let n=e.trim();if(n.length===0)return{found:[],parseError:null};let i=null,s=st(e,t,{csvHasHeader:r.csvHasHeader,...r.csvColumn===null?{}:{csvColumnIndex:r.csvColumn},multiline:r.multiline,onParseError:l=>{i??=l}});if(t!=="json"&&t!=="jsonc")return{found:ki(e,s),parseError:i};let o=e.length-e.trimStart().length,a=fr(e);return{found:Di(n,t==="jsonc").map(l=>({value:l.value,position:a(l.offset+o)})),parseError:i}}function Mc(e){return e.position===null?{value:e.value}:{value:e.value,line:e.position.line,column:e.position.column}}function Hc(e){let t=new Set;return e.filter(r=>t.has(r.value)?!1:(t.add(r.value),!0))}function Bc(e){return e.diagnostics.some(t=>t.severity==="error")}function Uc(e){return e.diagnostics.some(t=>t.code==="skipped")}function hr(e){return{kind:"text",report:e}}function Fi(e,t,r){return Object.freeze({file:e,format:t,strings:Object.freeze([]),diagnostics:Object.freeze([{severity:"warning",code:"skipped",message:r}]),summary:Object.freeze({strings:0,unlocated:0})})}function jc(e){return e.subarray(0,Pc).includes(0)}function qc(e){try{return at(e)}catch{return null}}function Kc(e){return lt.sep!=="\\"?e:e.replaceAll("\\","/")}var Hi=`usage: string-le [options] <file|dir>...
|
|
58
|
+
string-le [options] --stdin [--format <format>]
|
|
59
|
+
string-le mcp
|
|
60
|
+
string-le --version | --help
|
|
61
|
+
|
|
62
|
+
Gets every string value out of a tree and into one place a person can
|
|
63
|
+
read: JSON, YAML, CSV, TOML, INI and dotenv are parsed, ten source
|
|
64
|
+
languages are read by their own literal syntax, and anything else falls
|
|
65
|
+
back to quoted runs \u2014 so a .py or .rs file yields the copy in it rather
|
|
66
|
+
than fragments of it.
|
|
67
|
+
|
|
68
|
+
It reports what is there and nothing else. Which strings matter is yours
|
|
69
|
+
to decide.
|
|
70
|
+
|
|
71
|
+
One JSON report per line on stdout when it is piped or redirected, human
|
|
72
|
+
summary on stderr. At a terminal stdout stays silent, except that
|
|
73
|
+
--values always prints the values.
|
|
74
|
+
|
|
75
|
+
Options:
|
|
76
|
+
--dedupe collapse repeated values to their first occurrence
|
|
77
|
+
--format <format> force a format instead of inferring it from the
|
|
78
|
+
file name; an unknown name falls back rather than
|
|
79
|
+
failing
|
|
80
|
+
--values print only the values, one per line, for piping
|
|
81
|
+
--multiline let a *fallback* quoted run span lines. A language
|
|
82
|
+
whose own syntax spans lines needs no flag; this
|
|
83
|
+
is for the formats nothing here parses
|
|
84
|
+
--csv-header skip the first CSV row
|
|
85
|
+
--csv-column <n> take only this 0-based CSV column
|
|
86
|
+
--strict exit 2 if any file could not be read, rather than
|
|
87
|
+
reporting it and carrying on
|
|
88
|
+
--stdin read one document from stdin
|
|
89
|
+
--hidden walk hidden files and directories too
|
|
90
|
+
--no-ignore walk files that .gitignore excludes
|
|
91
|
+
|
|
92
|
+
A binary file \u2014 a NUL byte in its first 8KB \u2014 was never a text
|
|
93
|
+
candidate: it gets no report line and cannot fail --strict, and the
|
|
94
|
+
summary counts how many. A file that IS text and could not be read is
|
|
95
|
+
named on stderr and carried in the report, and does not by itself fail
|
|
96
|
+
the run; --strict turns that back into a failure.
|
|
97
|
+
|
|
98
|
+
Exit codes follow grep: 0 strings found \xB7 1 none found \xB7 2 malformed
|
|
99
|
+
question. Finding none is an answer, not an error.`,Bi=Object.freeze(["--strict","--dedupe","--format","--values","--multiline","--csv-header","--csv-column","--stdin","--hidden","--no-ignore"]);var _t=require("node:fs"),V=require("node:path");var Oe=require("node:fs"),pt=require("node:os"),P=require("node:path"),Qi=At(Gi());function gt(e,t){return Object.freeze({dir:e,dotIgnore:mt((0,P.join)(e,".ignore")),gitIgnore:t?mt((0,P.join)(e,".gitignore")):null})}function Ie(e){if((0,Oe.existsSync)((0,P.join)(e,".git")))return e;let t=(0,P.dirname)(e);return t===e?null:Ie(t)}function Xi(e){return Object.freeze({root:e,exclude:mt((0,P.join)(e,".git","info","exclude")),global:fu()})}function Zi(e,t,r,n){let i=[...r].reverse(),s=[Ji(i.map(o=>[o.dir,o.dotIgnore]),e,t),Ji(i.map(o=>[o.dir,o.gitIgnore]),e,t)];return n&&(s.push(Sr(n.exclude,n.root,e,t)),s.push(Sr(n.global,n.root,e,t))),s.find(o=>o!=="silent")==="ignored"}function Ji(e,t,r){for(let[n,i]of e){let s=Sr(i,n,t,r);if(s!=="silent")return s}return"silent"}function Sr(e,t,r,n){if(!e)return"silent";let i=(0,P.relative)(t,r);if(!i||i.startsWith(".."))return"silent";let s=i.split(P.sep).join("/"),o=e.test(n?`${s}/`:s);return o.ignored?"ignored":o.unignored?"kept":"silent"}function mt(e){let t=es(e);return t===null?null:(0,Qi.default)({allowRelativePaths:!0}).add(t)}function es(e){try{return(0,Oe.statSync)(e).isFile()?(0,Oe.readFileSync)(e,"utf8"):null}catch{return null}}function fu(){let e=process.env.XDG_CONFIG_HOME||(0,P.join)((0,pt.homedir)(),".config"),t=[(0,P.join)((0,pt.homedir)(),".gitconfig"),(0,P.join)(e,"git","config")].map(hu).find(r=>!!r);return mt(t??(0,P.join)(e,"git","ignore"))}function hu(e){let t=es(e);if(t===null)return null;let r=!1,n=null;for(let i of t.split(/\r?\n/)){let s=i.trim(),o=/^\[\s*([^\]\s"]+)[^\]]*\]/.exec(s);o&&(r=(o[1]??"").toLowerCase()==="core");let a=r?/^excludesfile\s*=\s*(.+)$/i.exec(s):null;a&&(n=pu(du((a[1]??"").trim())))}return n}function du(e){return e.replace(/^"(.*)"$/,"$1")}function pu(e){return e.startsWith("~/")?(0,P.join)((0,pt.homedir)(),e.slice(2)):e}var rs=Object.freeze({hidden:!1,respectIgnore:!0});function yt(e,t){let r=[];for(let n of e)r.push(...mu(n,t));return Object.freeze(Tu(r))}function mu(e,t){let r;try{r=(0,_t.statSync)(e).isFile()}catch(n){throw new Error(`${e}: ${pe(n)}`)}return r?[e]:gu(e,t)}function gu(e,t){let r=(0,V.resolve)(e),n=t.respectIgnore?Ie(r):null,i={root:e,options:t,repository:n?Xi(n):null,files:[]};return ns(i,e,r,_u(r,t)),i.files}function _u(e,t){if(!t.respectIgnore)return[];let r=[],n=(0,V.dirname)(e);for(;n!==(0,V.dirname)(n);)r.unshift(gt(n,Ie(n)!==null)),n=(0,V.dirname)(n);return r.unshift(gt(n,Ie(n)!==null)),r}function ns(e,t,r,n){let i=e.options.respectIgnore?[...n,gt(r,Ie(r)!==null)]:n;for(let s of Eu(e,t,r))yu(e,s,Su(t,s.name),`${r}${V.sep}${s.name}`,i)}function yu(e,t,r,n,i){if(!e.options.hidden&&t.name.startsWith("."))return;let s=t.isDirectory();if(!(!s&&!t.isFile())&&!(e.options.respectIgnore&&Zi(n,s,i,e.repository))){if(s){ns(e,r,n,i);return}e.files.push(r)}}function Eu(e,t,r){try{return(0,_t.readdirSync)(r,{withFileTypes:!0})}catch(n){throw new Error(`${e.root}: ${t}: IO error for operation on ${t}: ${pe(n)}`)}}function Su(e,t){return e.endsWith("/")||e.endsWith(V.sep)?`${e}${t}`:`${e}${V.sep}${t}`}function bu(e){let t=V.sep==="\\"?/[\\/]/:/\//,r=e.split(t),n=[];return r[0]===""&&r.length>1&&n.push([1,Buffer.alloc(0)]),r.forEach((i,s)=>{if(i){if(i==="."){s===0&&n.push([2,Buffer.alloc(0)]);return}n.push([i===".."?3:4,Buffer.from(i)])}}),n}function ts(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=Au(e[n],t[n]);if(i!==0)return i}return e.length-t.length}function Au(e,t){return e[0]!==t[0]?e[0]-t[0]:Buffer.compare(e[1],t[1])}function Tu(e){let t=e.map(r=>({file:r,key:bu(r)}));return t.sort((r,n)=>ts(r.key,n.key)),t.filter((r,n)=>{let i=t[n-1];return!i||ts(i.key,r.key)!==0}).map(r=>r.file)}var Cu=Object.freeze(["--format","--csv-column"]);function is(e){let t={strict:!1,inputs:[],stdin:!1,valuesOnly:!1,scan:ct,walk:rs};for(let r=0;r<e.length;r++){let n=e[r];if(n.startsWith("-")&&!Bi.includes(n))throw new Error(`${n} is not an option. Try --help.`);let i=Cu.includes(n)?e[++r]:void 0;Ou(t,n,i)}if(t.stdin&&t.inputs.length>0)throw new Error("reading from stdin takes no file arguments");if(!t.stdin&&t.inputs.length===0)throw new Error("name a file or a directory to read. Try --help.");return Object.freeze(t)}var xu=Object.freeze({"--dedupe":e=>{e.scan={...e.scan,dedupe:!0}},"--values":e=>{e.valuesOnly=!0},"--multiline":e=>{e.scan={...e.scan,extract:{...e.scan.extract,multiline:!0}}},"--csv-header":e=>{e.scan={...e.scan,extract:{...e.scan.extract,csvHasHeader:!0}}},"--stdin":e=>{e.stdin=!0},"--strict":e=>{e.strict=!0},"--hidden":e=>{e.walk={...e.walk,hidden:!0}},"--no-ignore":e=>{e.walk={...e.walk,respectIgnore:!1}}});function Ou(e,t,r){let n=xu[t];if(n){n(e);return}if(t==="--format"){if(r===void 0)throw new Error("--format needs a format");e.scan={...e.scan,format:ne(r,void 0)};return}if(t==="--csv-column"){if(r===void 0)throw new Error("--csv-column needs a column number");e.scan={...e.scan,extract:{...e.scan.extract,csvColumn:Ru(r)}};return}e.inputs=[...e.inputs,t]}var Iu=2n**64n-1n;function Ru(e){if(!/^\+?[0-9]+$/.test(e)||BigInt(e)>Iu)throw new Error(`${e} is not a column number`);return Number(e)}async function ss(e,t){let r=e[0];if(r==="--help"||r==="-h")return t.stdout(`${Hi}
|
|
100
|
+
`),0;if(r==="--version"||r==="-V")return t.stdout(`string-le ${t.version}
|
|
101
|
+
`),0;try{return await wu(e,t)}catch(n){return t.stderr(`string-le: ${n instanceof Error?n.message:String(n)}
|
|
102
|
+
`),2}}async function wu(e,t){let r=is(e),{reports:n,binary:i}=r.stdin?{reports:[await Lu(r,t)],binary:0}:Nu(r);return t.stdout(r.valuesOnly?ku(n):vu(n,t.stdoutIsTerminal)),t.stderr(Du(n,i,r.valuesOnly)),$i(n,r.strict)}function Nu(e){let t=[],r=0;for(let n of yt(e.inputs,e.walk)){let i=ut(n,e.scan);if(i.kind==="binary"){r+=1;continue}t.push(i.report)}return{reports:t,binary:r}}async function Lu(e,t){let r;try{r=at(await t.readStdin())}catch(i){throw new Error(`could not read stdin: ${pe(i)}`)}let n=e.scan.format??ur;return dr(r,"<stdin>",n,e.scan)}function vu(e,t){return t?"":e.map(r=>`${JSON.stringify(r)}
|
|
103
|
+
`).join("")}function ku(e){return e.flatMap(t=>t.strings.map(r=>`${r.value}
|
|
104
|
+
`)).join("")}function Du(e,t,r){let n=[];for(let a of e){for(let c of a.diagnostics)n.push(`${a.file}: ${c.message}`);if(!r)for(let c of a.strings)n.push(Mi(a,c))}let i=e.reduce((a,c)=>a+c.summary.strings,0),s=e.reduce((a,c)=>a+c.summary.unlocated,0),o=t===0?"":`, ${Et(t,"binary file","binary files")} skipped`;return n.push(`${Et(i,"string","strings")} in ${Et(e.length,"file","files")}${o}`),s>0&&n.push(`${Et(s,"value","values")} could not be located in the source`),n.map(a=>`${a}
|
|
105
|
+
`).join("")}function Et(e,t,r){return`${e} ${e===1?t:r}`}var Fu="Extract every string value from files or directories, with the file it came from and, where it can be located, its line and column. Reads the filesystem; never writes to it, and never judges a string.";async function Pu(e){let t=$u(e),r=u=>e[u]===!0,n={dedupe:r("dedupe"),extract:{...ct.extract,multiline:r("multiline")},format:typeof e.format=="string"?ne(e.format,void 0):null},i=yt(t,{hidden:r("hidden"),respectIgnore:!r("ignored")}),s=[];for(let u of i){let f=ut(u,n);f.kind==="text"&&s.push(f.report)}let o=i.length-s.length,a=os(s,u=>u.summary.strings),c=os(s,u=>u.summary.unlocated),l=s.filter(u=>u.diagnostics.some(f=>f.severity==="error")).map(u=>br("unreadable",`${u.file} could not be read, so this scan does not cover it`));return c>0&&l.push(br("unlocated",`${c} values could not be located in their source`)),o>0&&l.push(br("binary",`${o} files were not text and were not read`)),ot("string_le_scan",{reports:s,strings:a,binaryFiles:o},s.length,l,!1)}function os(e,t){return e.reduce((r,n)=>r+t(n),0)}function br(e,t){return{severity:"warning",code:e,message:t}}function $u(e){if(typeof e.path=="string")return[e.path];if(!Array.isArray(e.paths))throw new Error("no file or directory was supplied to read");let t=e.paths.filter(r=>typeof r=="string");if(t.length===0)throw new Error("the list of paths was empty");return t}var as=Object.freeze({name:"string_le_scan",description:Fu,inputSchema:{type:"object",properties:{path:{type:"string",description:"a file or directory to read"},paths:{type:"array",items:{type:"string"},description:"several files or directories, instead of `path`"},format:{type:"string",description:"Force a format for every file instead of inferring one per file name. An unrecognised name falls back to quoted strings."},dedupe:{type:"boolean",default:!1,description:"Collapse repeated values to their first occurrence."},multiline:{type:"boolean",default:!1,description:"Let a quoted run span lines, so a multi-line template literal is read too, as the extension's `string-le.fallback.multiline` setting does."},hidden:{type:"boolean",default:!1,description:"Walk hidden files and directories too."},ignored:{type:"boolean",default:!1,description:"Walk files excluded by .gitignore too."}}},handler:Pu});async function Mu(){let e=[];for await(let t of process.stdin)e.push(Buffer.from(t));return Buffer.concat(e)}function Hu(e){process.stdout.write("",()=>process.exit(e))}function Bu(e){if(e[0]==="mcp"){Ni({name:Cr,version:Tt},[...wi,as]);return}ss(e,{stdout:t=>process.stdout.write(t),stderr:t=>process.stderr.write(t),stdoutIsTerminal:process.stdout.isTTY===!0,readStdin:Mu,version:Tt}).then(Hu)}Bu(process.argv.slice(2));
|
|
106
|
+
/*! Bundled license information:
|
|
107
|
+
|
|
108
|
+
js-yaml/dist/js-yaml.mjs:
|
|
109
|
+
(*! js-yaml 5.4.2 https://github.com/nodeca/js-yaml @license MIT *)
|
|
110
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "strings-le",
|
|
3
|
+
"version": "2.6.1",
|
|
4
|
+
"description": "Get every string value out of a codebase and into one place a person can read.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"strings",
|
|
7
|
+
"copy",
|
|
8
|
+
"i18n",
|
|
9
|
+
"localization",
|
|
10
|
+
"audit",
|
|
11
|
+
"json",
|
|
12
|
+
"yaml",
|
|
13
|
+
"cli",
|
|
14
|
+
"string-le",
|
|
15
|
+
"nolindnaidoo",
|
|
16
|
+
"letools"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "Nolin Naidoo",
|
|
21
|
+
"url": "https://nolindnaidoo.com"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://letools.dev/tools/string-le",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/nolindnaidoo/string-le.git",
|
|
27
|
+
"directory": "cli"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/nolindnaidoo/string-le/issues"
|
|
31
|
+
},
|
|
32
|
+
"type": "commonjs",
|
|
33
|
+
"bin": {
|
|
34
|
+
"string-le": "cli.js"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"cli.js",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public",
|
|
46
|
+
"provenance": true
|
|
47
|
+
}
|
|
48
|
+
}
|