@dsebastien/music-notation 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -5
- package/dist/chord/generate.d.ts +34 -9
- package/dist/chord/guitar.d.ts +18 -0
- package/dist/circle/circle.d.ts +8 -2
- package/dist/cli.js +1 -1
- package/dist/convert/text-tab.d.ts +56 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.js +6599 -4673
- package/dist/index.js.map +32 -30
- package/dist/keyboard/keyboard.d.ts +17 -2
- package/dist/keyboard/piano-chord.d.ts +28 -3
- package/dist/keyboard/play-voicing.d.ts +10 -0
- package/dist/keyboard/scale-fingering.d.ts +41 -0
- package/dist/keyboard/voice-leading.d.ts +55 -4
- package/dist/music-notation.css +68 -5
- package/dist/music-notation.publish.min.js +91 -28
- package/dist/music-notation.tab.min.js +72 -9
- package/dist/playback/controls.d.ts +13 -2
- package/dist/playback/player.d.ts +69 -5
- package/dist/publish/index.js +5306 -3909
- package/dist/publish/index.js.map +31 -29
- package/dist/render/dom.d.ts +25 -1
- package/dist/strum/pattern.d.ts +25 -0
- package/dist/strum/play.d.ts +46 -5
- package/dist/strum/render.d.ts +4 -1
- package/dist/tab/index.d.ts +39 -0
- package/dist/tab/index.js +683 -75
- package/dist/tab/index.js.map +6 -6
- package/dist/theory/detect.d.ts +6 -2
- package/dist/theory/find.d.ts +35 -7
- package/dist/theory/keys.d.ts +8 -2
- package/dist/theory/note-set.d.ts +5 -0
- package/dist/theory/numerals.d.ts +34 -7
- package/dist/voicings/check.d.ts +17 -0
- package/dist/voicings/curated.d.ts +10 -0
- package/dist/voicings/index.d.ts +1 -1
- package/dist/voicings/index.js +429 -109
- package/dist/voicings/index.js.map +10 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Music Notation
|
|
2
2
|
|
|
3
|
-
Chord diagrams, piano keyboards, fretboards
|
|
3
|
+
Chord diagrams, piano keyboards, fretboards, ChordPro charts, strumming patterns, progressions and the circle of fifths, rendered as SVG and HTML from small text blocks. No framework, no build step for pages that load the browser bundle. Made for [Obsidian](https://obsidian.md) (the [Music Practice](https://github.com/dsebastien/obsidian-music-practice) plugin and Obsidian Publish), usable on any web page.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
@@ -16,7 +16,8 @@ A x02220 x01230
|
|
|
16
16
|
```chord
|
|
17
17
|
C/G
|
|
18
18
|
instrument: piano
|
|
19
|
-
|
|
19
|
+
hands: left+right
|
|
20
|
+
fingering: 5 1 3 5
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
```keyboard
|
|
@@ -88,6 +89,37 @@ scales-for: G D Em C
|
|
|
88
89
|
```
|
|
89
90
|
````
|
|
90
91
|
|
|
92
|
+
Strumming patterns written the way you find them on the web, a capo, arpeggios, piano voicings, and chord diagrams above a chart:
|
|
93
|
+
|
|
94
|
+
````markdown
|
|
95
|
+
```strum
|
|
96
|
+
[G]D - D U [C]- U D U
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```chord
|
|
100
|
+
A x02220 x01230
|
|
101
|
+
capo: 2
|
|
102
|
+
sounds: yes
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```fretboard
|
|
106
|
+
arpeggio: Am7
|
|
107
|
+
positions: all
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```chord
|
|
111
|
+
Dm7
|
|
112
|
+
instrument: piano
|
|
113
|
+
voicing: rootless A
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```chords
|
|
117
|
+
{capo: 2}
|
|
118
|
+
{diagrams: on}
|
|
119
|
+
[G]Hello [Cadd9]little [Em]world
|
|
120
|
+
```
|
|
121
|
+
````
|
|
122
|
+
|
|
91
123
|

|
|
92
124
|
|
|
93
125
|

|
|
@@ -126,11 +158,11 @@ if (!result.ok) console.warn(result.error)
|
|
|
126
158
|
|
|
127
159
|
- `renderBlock(language, source, host, options)` appends the rendering to `host` and never throws. It returns `{ ok, el, error, destroy() }`.
|
|
128
160
|
- `@dsebastien/music-notation/voicings` adds about 1,800 guitar voicings, found by chord symbol (`chord` blocks with only a symbol). It's a separate entry point because the data weighs about 230 KB.
|
|
129
|
-
- **Hear the diagrams**: the `play` option adds a playback bar to each diagram, shown on hover.
|
|
161
|
+
- **Hear the diagrams**: the `play` option adds a playback bar to each diagram, shown on hover. Guitar chords strum, piano chords strike as a block, scales run from their tonic up and back, and a click plays a note. While it plays, each note lights up on the drawing when you hear it.
|
|
130
162
|
- **Strumming patterns**: `strum` blocks draw a pattern (`D DU UDU`, `D - D U - U D U`) on a beat grid with counts, accents, muted and ghost strums and chord changes; with playback on, they play over their chords, with loop, tempo and a count-in. `playStrum(pattern, { bpm, chord, tuning })` plays one from code.
|
|
131
163
|
- **Tabs and scores**: `@dsebastien/music-notation/tab` draws `tab` and `score` blocks (alphaTex, or Guitar Pro and MusicXML files) with [alphaTab](https://alphatab.net), and adds a player. It also converts score files, text tabs and chord sheets, and exports Guitar Pro 7 and MIDI.
|
|
132
164
|
- `generateVoicings(symbol, options)` finds every playable voicing of a chord on any tuning, easiest first, with fingers and shape names; `fingerVoicing(frets)` fingers any voicing.
|
|
133
|
-
- The renderers (`renderGuitarDiagram`, `renderKeyboard`, `renderFretboard`, `renderChart`), the parsers and the theory helpers (`parseChord`, `transposeChord`, `chordNoteSet`, `scaleNoteSet`…) are exported too.
|
|
165
|
+
- The renderers (`renderGuitarDiagram`, `renderKeyboard`, `renderFretboard`, `renderChart`, `renderStrum`, `renderCircle`), the parsers and the theory helpers (`parseChord`, `transposeChord`, `chordNoteSet`, `scaleNoteSet`…) are exported too.
|
|
134
166
|
- Styles: `injectStyles(document)`, or ship `@dsebastien/music-notation/music-notation.css`. Colors follow Obsidian's theme variables, with fallbacks for any page.
|
|
135
167
|
|
|
136
168
|
## Check your notes
|
|
@@ -149,7 +181,7 @@ Add this to your site's `publish.js`. It loads the bundle only on pages that hav
|
|
|
149
181
|
|
|
150
182
|
```js
|
|
151
183
|
;(() => {
|
|
152
|
-
const VERSION = '0.
|
|
184
|
+
const VERSION = '0.8.0'
|
|
153
185
|
const CDN = `https://cdn.jsdelivr.net/npm/@dsebastien/music-notation@${VERSION}/dist`
|
|
154
186
|
const selector = (languages) => languages.map((l) => `pre > code.language-${l}`).join(', ')
|
|
155
187
|
const BLOCKS = selector([
|
package/dist/chord/generate.d.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* highest string.
|
|
6
6
|
*/
|
|
7
7
|
import { type FrettedVoicing } from './guitar.js';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { type NoteSetMember } from '../theory/note-set.js';
|
|
9
|
+
/** Shape names, as guitar teachers use them: one name per CAGED shape, barre or not. */
|
|
10
|
+
export type VoicingShape = 'Open' | 'C shape' | 'A shape' | 'G shape' | 'E shape' | 'D shape' | 'Power chord' | 'Triad' | 'Shell';
|
|
10
11
|
export interface GeneratedVoicing extends FrettedVoicing {
|
|
11
12
|
fingers: (string | null)[];
|
|
12
13
|
baseFret: number;
|
|
@@ -50,20 +51,44 @@ export interface VoicingOptions {
|
|
|
50
51
|
}
|
|
51
52
|
/** Generation explores every combination: more strings than this would be slow. */
|
|
52
53
|
export declare const MAX_GENERATED_STRINGS = 8;
|
|
54
|
+
export interface Tone {
|
|
55
|
+
chroma: number;
|
|
56
|
+
/** The interval number (1, 3, 5, 7, 9…); 0 for a slash chord's bass outside the chord. */
|
|
57
|
+
number: number;
|
|
58
|
+
required: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface ChordInfo {
|
|
61
|
+
tones: Tone[];
|
|
62
|
+
members: NoteSetMember[];
|
|
63
|
+
/** A slash chord's bass. */
|
|
64
|
+
bass: number | null;
|
|
65
|
+
root: number;
|
|
66
|
+
suffix: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The chord's tones and which of them a voicing must sound: the root, the third (or the sus 2/4),
|
|
70
|
+
* sevenths and sixths, altered notes and the highest extension. The perfect fifth and lower
|
|
71
|
+
* natural extensions may be left out (and an 11th chord's major third).
|
|
72
|
+
*/
|
|
73
|
+
export declare function chordInfo(symbol: string): ChordInfo | null;
|
|
53
74
|
/**
|
|
54
|
-
* Fingers for a fretted voicing (lowest string first, as frets are):
|
|
55
|
-
* barre adjacent strings on one fret (every string under it sounding
|
|
56
|
-
*
|
|
57
|
-
*
|
|
75
|
+
* Fingers for a fretted voicing (lowest string first, as frets are): a finger holds a note, the
|
|
76
|
+
* index or the ring finger may barre adjacent strings on one fret (every string under it sounding
|
|
77
|
+
* at that fret), the pinky the two highest strings (E6/9 022122 is 0-2-3-1-4-4), only the index
|
|
78
|
+
* lies over strings fretted higher, finger numbers go up with the frets, at most four fingers.
|
|
79
|
+
* The easiest such fingering; null when a hand can't play it. Generated voicings never ask for a
|
|
80
|
+
* pinky barre.
|
|
58
81
|
*/
|
|
59
82
|
export declare function fingerVoicing(frets: readonly (number | null)[]): (string | null)[] | null;
|
|
60
83
|
/**
|
|
61
84
|
* The shape a voicing is played with: power chord, shell (root, third and seventh or sixth on three
|
|
62
85
|
* or four strings), triad (three adjacent strings, three notes), open (open strings, frets 1–4),
|
|
63
|
-
*
|
|
64
|
-
*
|
|
86
|
+
* the CAGED shapes (in standard tuning: the open C, A, G, E or D chord moved up the neck, with a
|
|
87
|
+
* barre or not). Null when it's none of them. The shape doesn't depend on the fingers: `_fingers`
|
|
88
|
+
* is accepted for callers written for 0.8.0 and ignored; tell a barre with `barreKind` or
|
|
89
|
+
* `isBarreVoicing` (an "E shape" held with a full barre is the E-shape barre chord).
|
|
65
90
|
*/
|
|
66
|
-
export declare function voicingShape(frets: readonly (number | null)[], symbol: string, tuning?: readonly number[],
|
|
91
|
+
export declare function voicingShape(frets: readonly (number | null)[], symbol: string, tuning?: readonly number[], _fingers?: readonly (string | null)[] | null): VoicingShape | null;
|
|
67
92
|
/**
|
|
68
93
|
* Every playable voicing of a chord, easiest first; empty when the chord is unknown or nothing
|
|
69
94
|
* fits the options. See VoicingOptions for the filters.
|
package/dist/chord/guitar.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type Hand, type Orientation } from '../render/layout.js';
|
|
2
2
|
/** Standard tuning, lowest string first. */
|
|
3
3
|
export declare const STANDARD_TUNING: number[];
|
|
4
|
+
/**
|
|
5
|
+
* A note name as guitar charts write it on a dot: a double sharp or flat becomes the plain note
|
|
6
|
+
* (E7#9's F## is G, Bbb is A); any other name or label stays.
|
|
7
|
+
*/
|
|
8
|
+
export declare function chartNoteName(name: string): string;
|
|
4
9
|
export interface FrettedVoicing {
|
|
5
10
|
/** Absolute frets, lowest string first: null = muted, 0 = open. */
|
|
6
11
|
frets: (number | null)[];
|
|
@@ -48,6 +53,19 @@ export declare function parseFrets(text: string): (number | null)[] | null;
|
|
|
48
53
|
export declare function parseFingers(text: string): (string | null)[];
|
|
49
54
|
/** The first fret shown: 1 when the chord fits in the first 4 frets, else its lowest fretted fret. */
|
|
50
55
|
export declare function baseFretOf(frets: (number | null)[]): number;
|
|
56
|
+
/**
|
|
57
|
+
* The barre a voicing is held with: `full` when one finger lies over four strings or more, or over
|
|
58
|
+
* strings fretted higher (F 133211, Bm7 x24232: an E-shape or A-shape barre chord), `partial` for a
|
|
59
|
+
* smaller one (F xx3211, an A shape's ring-finger barre x3555x), null when no finger holds two
|
|
60
|
+
* strings on one fret.
|
|
61
|
+
*/
|
|
62
|
+
export declare function barreKind(voicing: Pick<FrettedVoicing, 'frets' | 'fingers'>): 'full' | 'partial' | null;
|
|
63
|
+
/**
|
|
64
|
+
* Whether a finger holds two strings or more on one fret (a full or a partial barre): what told
|
|
65
|
+
* an "E-shape barre" from a "CAGED E" before shapes had one name per CAGED letter. Generated
|
|
66
|
+
* voicings say the same with `reasons.includes('barre')`.
|
|
67
|
+
*/
|
|
68
|
+
export declare const isBarreVoicing: (voicing: Pick<FrettedVoicing, "frets" | "fingers">) => boolean;
|
|
51
69
|
/** "Capo 2", "Capo 2, sounds B": what a diagram with a capo says under it. */
|
|
52
70
|
export declare const capoCaption: (capo: number, sounds?: string) => string;
|
|
53
71
|
export declare function renderGuitarDiagram(doc: Document, voicing: FrettedVoicing, options?: GuitarDiagramOptions): SVGElement;
|
package/dist/circle/circle.d.ts
CHANGED
|
@@ -5,8 +5,13 @@ export interface CircleOptions {
|
|
|
5
5
|
key?: MusicalKey;
|
|
6
6
|
/** Seventh chords instead of triads, for the marked chords. */
|
|
7
7
|
sevenths?: boolean;
|
|
8
|
-
/** Set the IV and V chords (iv and v in minor) apart; true by default. */
|
|
8
|
+
/** Set the IV and V chords (iv and V, or v, in minor) apart; true by default. */
|
|
9
9
|
neighbours?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* A minor key's dominant: `major` (default), the harmonic minor's V (B or B7 in E minor), as
|
|
12
|
+
* cadences play it; `minor`, the natural minor's v (Bm, Bm7).
|
|
13
|
+
*/
|
|
14
|
+
dominant?: 'major' | 'minor';
|
|
10
15
|
title?: string;
|
|
11
16
|
}
|
|
12
17
|
/** "F#" → "F♯", "Bbm7b5" → "B♭ø7", "Cdim" → "C°": names as the wheel shows them. */
|
|
@@ -16,6 +21,7 @@ export declare function chordPitches(symbol: string): number[];
|
|
|
16
21
|
export declare function renderCircle(doc: Document, options?: CircleOptions): SVGElement;
|
|
17
22
|
/**
|
|
18
23
|
* The `circle` block: `key:` (or a shorthand line: G, E minor, D dorian), `mode:` (major, minor or
|
|
19
|
-
* a church mode), `chords: triads | sevenths`, `neighbours: yes | no`, `
|
|
24
|
+
* a church mode), `chords: triads | sevenths`, `neighbours: yes | no`, `dominant: major | minor`
|
|
25
|
+
* (a minor key's V or v), `title:`.
|
|
20
26
|
*/
|
|
21
27
|
export declare const renderCircleBlock: Renderer;
|
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ import{createRequire}from"node:module";var __create=Object.create;var{getPrototy
|
|
|
50
50
|
)`,enabled:":is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], :selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])","read-only":"[readonly]:is(textarea, input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i]))","read-write":":not([readonly]):is(textarea, input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i]))",selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"};function compile(parsed){let a=parsed[0],b=parsed[1]-1;if(b<0&&a<=0)return falseFunc;if(a===-1)return(index)=>index<=b;if(a===0)return(index)=>index===b;if(a===1)return b<0?trueFunc:(index)=>index>=b;let absA=Math.abs(a),bModulo=(b%absA+absA)%absA;return a>1?(index)=>index>=b&&index%absA===bModulo:(index)=>index<=b&&index%absA===bModulo}var whitespace=new Set([9,10,12,13,32]);function parse2(formula){switch(formula=formula.trim().toLowerCase(),formula){case"even":return[2,0];case"odd":return[2,1]}let index=0,a=0,sign=readSign(),number=readNumber();if(index<formula.length&&formula.charAt(index)==="n")if(index++,a=sign*(number??1),skipWhitespace(),index<formula.length)sign=readSign(),skipWhitespace(),number=readNumber();else sign=number=0;if(number===null||index<formula.length)throw Error(`n-th rule couldn't be parsed ('${formula}')`);return[a,sign*number];function readSign(){switch(formula.charAt(index)){case"-":return index++,-1;case"+":{index++;break}}return 1}function readNumber(){let start=index,value=0;while(index<formula.length&&formula.charCodeAt(index)>=48&&formula.charCodeAt(index)<=57)value=value*10+(formula.charCodeAt(index)-48),index++;return index===start?null:value}function skipWhitespace(){while(index<formula.length&&whitespace.has(formula.charCodeAt(index)))index++}}function nthCheck(formula){return compile(parse2(formula))}function cacheParentResults(next,{adapter,cacheResults},matches){if(cacheResults===!1||typeof WeakMap>"u")return(element)=>next(element)&&matches(element);let resultCache=new WeakMap;function addResultToCache(element){let result=matches(element);return resultCache.set(element,result),result}return function(element){if(!next(element))return!1;if(resultCache.has(element))return resultCache.get(element)??!1;let node=element;do{let parent=getElementParent(node,adapter);if(parent===null)return addResultToCache(element);node=parent}while(!resultCache.has(node));return resultCache.get(node)?addResultToCache(element):!1}}function copyOptions(options){let{context:_,rootFunc:__,...copied}=options;return copied}function extendedFilter(tag,range){if(range[0]!=="*"&&range[0]!==tag[0])return!1;let tagIndex=1;for(let rangeIndex=1;rangeIndex<range.length;rangeIndex++){if(range[rangeIndex]==="*")continue;while(tagIndex<tag.length&&tag[tagIndex]!==range[rangeIndex])if(tag[tagIndex++].length<=1)return!1;if(tagIndex>=tag.length)return!1;tagIndex++}return!0}var nthOfRegex=/^(.+?)\s+of\s+(.+)$/is;function compileNth(reverse,ofType){return function(next,rule,options,context2,compileToken){let{adapter,equals}=options,ofMatch=ofType?null:rule.match(nthOfRegex),nthCheck2=nthCheck(ofMatch?ofMatch[1].trim():rule);if(nthCheck2===falseFunc)return falseFunc;let ofSelector=ofMatch&&compileToken?compileToken(parse(ofMatch[2].trim()),copyOptions(options),context2):void 0;if(ofSelector===falseFunc)return falseFunc;if(nthCheck2===trueFunc&&!ofSelector)return(element)=>getElementParent(element,adapter)!==null&&next(element);let shouldCount=ofSelector?(_element,sibling)=>ofSelector(sibling):ofType?(element,sibling)=>adapter.getName(sibling)===adapter.getName(element):trueFunc;if(reverse)return function(element){if(ofSelector&&!ofSelector(element))return!1;let siblings=adapter.getSiblings(element),pos=0;for(let index=siblings.length-1;index>=0;index--){let sibling=siblings[index];if(equals(element,sibling))break;if(adapter.isTag(sibling)&&shouldCount(element,sibling))pos++}return nthCheck2(pos)&&next(element)};return function(element){if(ofSelector&&!ofSelector(element))return!1;let siblings=adapter.getSiblings(element),pos=0;for(let sibling of siblings){if(equals(element,sibling))break;if(adapter.isTag(sibling)&&shouldCount(element,sibling))pos++}return nthCheck2(pos)&&next(element)}}}var filters={contains(next,text,options){let{getText}=options.adapter;return cacheParentResults(next,options,(element)=>getText(element).includes(text))},icontains(next,text,options){let itext=text.toLowerCase(),{getText}=options.adapter;return cacheParentResults(next,options,(element)=>getText(element).toLowerCase().includes(itext))},"nth-child":compileNth(!1,!1),"nth-last-child":compileNth(!0,!1),"nth-of-type":compileNth(!1,!0),"nth-last-of-type":compileNth(!0,!0),root(next,_rule,{adapter}){return(element)=>getElementParent(element,adapter)===null&&next(element)},scope(next,rule,options,context2){let{equals}=options;if(!context2||context2.length===0)return filters.root(next,rule,options);if(context2.length===1)return(element)=>equals(context2[0],element)&&next(element);return(element)=>context2.includes(element)&&next(element)},lang(next,code,{adapter}){let ranges=code.split(",").map((r)=>r.trim()).filter((r)=>r.length>0).map((r)=>r.replace(/^['"]|['"]$/g,"").toLowerCase().split("-"));return function(element){let node=element;while(node!=null){let value=adapter.getAttributeValue(node,"xml:lang")??adapter.getAttributeValue(node,"lang");if(value!=null){if(!value)return ranges.some((r)=>r[0]==="")&&next(element);let tag=value.toLowerCase().split("-");return ranges.some((r)=>extendedFilter(tag,r))&&next(element)}let parent=adapter.getParent(node);node=parent!=null&&adapter.isTag(parent)?parent:null}return ranges.some((r)=>r[0]==="")&&next(element)}},hover:dynamicStatePseudo("isHovered"),visited:dynamicStatePseudo("isVisited"),active:dynamicStatePseudo("isActive")};function dynamicStatePseudo(name){return function(next,_rule,{adapter}){let filterFunction=adapter[name];if(typeof filterFunction!=="function")return falseFunc;return function(element){return filterFunction(element)&&next(element)}}}var isDocumentWhiteSpace=/^[ \t\r\n]*$/,pseudos={empty(element,{adapter}){let children=adapter.getChildren(element);return children.every((element)=>!adapter.isTag(element))&&children.every((element)=>isDocumentWhiteSpace.test(adapter.getText(element)))},"first-child"(element,{adapter,equals}){if(adapter.prevElementSibling)return adapter.prevElementSibling(element)==null;let firstChild=adapter.getSiblings(element).find((sibling)=>adapter.isTag(sibling));return firstChild!=null&&equals(element,firstChild)},"last-child"(element,{adapter,equals}){let siblings=adapter.getSiblings(element);for(let index=siblings.length-1;index>=0;index--){if(equals(element,siblings[index]))return!0;if(adapter.isTag(siblings[index]))break}return!1},"first-of-type"(element,{adapter,equals}){let siblings=adapter.getSiblings(element),elementName=adapter.getName(element);for(let currentSibling of siblings){if(equals(element,currentSibling))return!0;if(adapter.isTag(currentSibling)&&adapter.getName(currentSibling)===elementName)break}return!1},"last-of-type"(element,{adapter,equals}){let siblings=adapter.getSiblings(element),elementName=adapter.getName(element);for(let index=siblings.length-1;index>=0;index--){let currentSibling=siblings[index];if(equals(element,currentSibling))return!0;if(adapter.isTag(currentSibling)&&adapter.getName(currentSibling)===elementName)break}return!1},"only-of-type"(element,{adapter,equals}){let elementName=adapter.getName(element);return adapter.getSiblings(element).every((sibling)=>equals(element,sibling)||!adapter.isTag(sibling)||adapter.getName(sibling)!==elementName)},"only-child"(element,{adapter,equals}){return adapter.getSiblings(element).every((sibling)=>equals(element,sibling)||!adapter.isTag(sibling))}};function verifyPseudoArguments(pseudoClassCondition,name,subselect,argumentIndex){if(subselect===null){if(pseudoClassCondition.length>argumentIndex)throw Error(`Pseudo-class :${name} requires an argument`)}else if(pseudoClassCondition.length===argumentIndex)throw Error(`Pseudo-class :${name} doesn't have any arguments`)}function isTraversal2(token){return token.type==="_flexibleDescendant"||isTraversal(token)}function sortRules(array){let ratings=array.map(getQuality);for(let index=1;index<array.length;index++){let procNew=ratings[index];if(procNew<0)continue;for(let currentIndex=index;currentIndex>0&&procNew<ratings[currentIndex-1];currentIndex--){let token=array[currentIndex];array[currentIndex]=array[currentIndex-1],array[currentIndex-1]=token,ratings[currentIndex]=ratings[currentIndex-1],ratings[currentIndex-1]=procNew}}}function getAttributeQuality(token){switch(token.action){case AttributeAction.Exists:return 10;case AttributeAction.Equals:return token.name==="id"?9:8;case AttributeAction.Not:return 7;case AttributeAction.Start:return 6;case AttributeAction.End:return 6;case AttributeAction.Any:return 5;case AttributeAction.Hyphen:return 4;case AttributeAction.Element:return 3}}function getQuality(token){switch(token.type){case SelectorType.Universal:return 50;case SelectorType.Tag:return 30;case SelectorType.Attribute:return Math.floor(getAttributeQuality(token)/(token.ignoreCase?2:1));case SelectorType.Pseudo:return token.data?token.name==="has"||token.name==="contains"||token.name==="icontains"?0:Array.isArray(token.data)?Math.max(0,Math.min(...token.data.map((d)=>Math.min(...d.map(getQuality))))):2:3;default:return-1}}function includesScopePseudo(t){return t.type===SelectorType.Pseudo&&(t.name==="scope"||Array.isArray(t.data)&&t.data.some((data)=>data.some(includesScopePseudo)))}var PLACEHOLDER_ELEMENT={};function hasDependsOnCurrentElement(selector){return selector.some((sel)=>sel.length>0&&(isTraversal2(sel[0])||sel.some(includesScopePseudo)))}var is=(next,token,options,context2,compileToken)=>{let compiledToken=compileToken(token,copyOptions(options),context2);return compiledToken===trueFunc?next:compiledToken===falseFunc?falseFunc:(element)=>compiledToken(element)&&next(element)},subselects={is,matches:is,where:is,not(next,token,options,context2,compileToken){let compiledToken=compileToken(token,copyOptions(options),context2);return compiledToken===falseFunc?next:compiledToken===trueFunc?falseFunc:(element)=>!compiledToken(element)&&next(element)},has(next,subselect,options,_context,compileToken){let{adapter}=options,copiedOptions=copyOptions(options);copiedOptions.relativeSelector=!0;let context2=subselect.some((s)=>s.some(isTraversal2))?[PLACEHOLDER_ELEMENT]:void 0,skipCache=hasDependsOnCurrentElement(subselect),compiled=compileToken(subselect,copiedOptions,context2);if(compiled===falseFunc)return falseFunc;if(context2&&compiled!==trueFunc)return skipCache?(element)=>{if(!next(element))return!1;context2[0]=element;let childs=adapter.getChildren(element);return findOne3(compiled,compiled.shouldTestNextSiblings?[...childs,...getNextSiblings(element,adapter)]:childs,options)!==null}:cacheParentResults(next,options,(element)=>(context2[0]=element,findOne3(compiled,adapter.getChildren(element),options)!==null));let hasOne=(element)=>findOne3(compiled,adapter.getChildren(element),options)!==null;return skipCache?(element)=>next(element)&&hasOne(element):cacheParentResults(next,options,hasOne)}};function compilePseudoSelector(next,selector,options,context2,compileToken){let{name,data}=selector;if(Array.isArray(data)){if(!(name in subselects))throw Error(`Unknown pseudo-class :${name}(${data})`);return subselects[name](next,data,options,context2,compileToken)}let userPseudo=options.pseudos?.[name],stringPseudo=typeof userPseudo==="string"?userPseudo:aliases[name];if(typeof stringPseudo==="string"){if(data!=null)throw Error(`Pseudo ${name} doesn't have any arguments`);let alias=parse(stringPseudo);return subselects.is(next,alias,options,context2,compileToken)}if(typeof userPseudo==="function")return verifyPseudoArguments(userPseudo,name,data,1),(element)=>userPseudo(element,data)&&next(element);if(name in filters)return filters[name](next,data,options,context2,compileToken);if(name in pseudos){let pseudo=pseudos[name];return verifyPseudoArguments(pseudo,name,data,2),(element)=>pseudo(element,options,data)&&next(element)}throw Error(`Unknown pseudo-class :${name}`)}function compileGeneralSelector(next,selector,options,context2,compileToken,hasExpensiveSubselector){let{adapter,equals,cacheResults}=options;switch(selector.type){case SelectorType.PseudoElement:throw Error("Pseudo-elements are not supported by css-select");case SelectorType.ColumnCombinator:throw Error("Column combinators are not yet supported by css-select");case SelectorType.Attribute:{if(selector.namespace!=null)throw Error("Namespaced attributes are not yet supported by css-select");if(!options.xmlMode||options.lowerCaseAttributeNames)selector.name=selector.name.toLowerCase();return attributeRules[selector.action](next,selector,options)}case SelectorType.Pseudo:return compilePseudoSelector(next,selector,options,context2,compileToken);case SelectorType.Tag:{if(selector.namespace!=null)throw Error("Namespaced tag names are not yet supported by css-select");let{name}=selector;if(!options.xmlMode||options.lowerCaseTags)name=name.toLowerCase();return function(element){return adapter.getName(element)===name&&next(element)}}case SelectorType.Descendant:{if(!hasExpensiveSubselector||cacheResults===!1||typeof WeakMap>"u")return function(element){let current=element;while(current=getElementParent(current,adapter))if(next(current))return!0;return!1};let resultCache=new WeakMap;return function(element){let current=element,result;while(current=getElementParent(current,adapter)){let cached=resultCache.get(current);if(cached===void 0){if(result??={matches:!1},result.matches=next(current),resultCache.set(current,result),result.matches)return!0}else{if(result)result.matches=cached.matches;return cached.matches}}return!1}}case"_flexibleDescendant":return function(element){let current=element;do{if(next(current))return!0;current=getElementParent(current,adapter)}while(current);return!1};case SelectorType.Parent:return function(element){return adapter.getChildren(element).some((element)=>adapter.isTag(element)&&next(element))};case SelectorType.Child:return function(element){let parent=getElementParent(element,adapter);return parent!==null&&next(parent)};case SelectorType.Sibling:return function(element){let siblings=adapter.getSiblings(element);for(let currentSibling of siblings){if(equals(element,currentSibling))break;if(adapter.isTag(currentSibling)&&next(currentSibling))return!0}return!1};case SelectorType.Adjacent:{if(adapter.prevElementSibling)return function(element){let previous=adapter.prevElementSibling(element);return previous!=null&&next(previous)};return function(element){let siblings=adapter.getSiblings(element),lastElement;for(let currentSibling of siblings){if(equals(element,currentSibling))break;if(adapter.isTag(currentSibling))lastElement=currentSibling}return!!lastElement&&next(lastElement)}}case SelectorType.Universal:{if(selector.namespace!=null&&selector.namespace!=="*")throw Error("Namespaced universal selectors are not yet supported by css-select");return next}}}var DESCENDANT_TOKEN={type:SelectorType.Descendant},FLEXIBLE_DESCENDANT_TOKEN={type:"_flexibleDescendant"},SCOPE_TOKEN={type:SelectorType.Pseudo,name:"scope",data:null};function absolutize(token,{adapter},context2){let hasContext=!!context2?.every((element)=>element===PLACEHOLDER_ELEMENT||adapter.isTag(element)&&getElementParent(element,adapter)!==null);for(let t of token){if(t.length>0&&isTraversal2(t[0])&&t[0].type!==SelectorType.Descendant);else if(hasContext&&!t.some(includesScopePseudo))t.unshift(DESCENDANT_TOKEN);else continue;t.unshift(SCOPE_TOKEN)}}function compileToken(token,options,compilationContext){for(let rules of token)sortRules(rules);let{context:context2=compilationContext,rootFunc:rootFunction=trueFunc}=options,isArrayContext=Array.isArray(context2),finalContext=context2&&(Array.isArray(context2)?context2:[context2]);if(options.relativeSelector!==!1)absolutize(token,options,finalContext);else if(token.some((t)=>t.length>0&&isTraversal2(t[0])))throw Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let shouldTestNextSiblings=!1,query=falseFunc;combineLoop:for(let rules of token){if(rules.length>=2){let[first,second]=rules;if(first.type!==SelectorType.Pseudo||first.name!=="scope");else if(isArrayContext&&second.type===SelectorType.Descendant)rules[1]=FLEXIBLE_DESCENDANT_TOKEN;else if(second.type===SelectorType.Adjacent||second.type===SelectorType.Sibling)shouldTestNextSiblings=!0}let next=rootFunction,hasExpensiveSubselector=!1;for(let rule of rules){if(next=compileGeneralSelector(next,rule,options,finalContext,compileToken,hasExpensiveSubselector),getQuality(rule)===0)hasExpensiveSubselector=!0;if(next===falseFunc)continue combineLoop}if(next===rootFunction)return rootFunction;query=query===falseFunc?next:or(query,next)}return query.shouldTestNextSiblings=shouldTestNextSiblings,query}function or(a,b){return(element)=>a(element)||b(element)}var defaultEquals=(a,b)=>a===b,defaultOptions={adapter:{...exports_dist2,isTag:isTag4},equals:defaultEquals};function convertOptionFormats(options){let finalOptions=options??defaultOptions;return finalOptions.adapter??=defaultOptions.adapter,finalOptions.equals??=finalOptions.adapter?.equals??defaultEquals,finalOptions}function compile2(selector,options,context2){let convertedOptions=convertOptionFormats(options),next=_compileUnsafe(selector,convertedOptions,context2);return next===falseFunc?falseFunc:(element)=>convertedOptions.adapter.isTag(element)&&next(element)}function _compileUnsafe(selector,options,context2){return compileToken(typeof selector==="string"?parse(selector):selector,convertOptionFormats(options),context2)}function getSelectorFunction(searchFunction){return function(query,elements,options){let convertedOptions=convertOptionFormats(options);if(typeof query!=="function")query=_compileUnsafe(query,convertedOptions,elements);let filteredElements=prepareContext(elements,convertedOptions.adapter,query.shouldTestNextSiblings);return searchFunction(query,filteredElements,convertedOptions)}}function prepareContext(elements,adapter,shouldTestNextSiblings=!1){if(shouldTestNextSiblings)elements=appendNextSiblings(elements,adapter);return Array.isArray(elements)?adapter.removeSubsets(elements):adapter.getChildren(elements)}function appendNextSiblings(element,adapter){let elements=Array.isArray(element)?[...element]:[element],elementsLength=elements.length;for(let index=0;index<elementsLength;index++){let nextSiblings=getNextSiblings(elements[index],adapter);elements.push(...nextSiblings)}return elements}var selectAll=getSelectorFunction((query,elements,options)=>query===falseFunc||!elements||elements.length===0?[]:findAll3(query,elements,options)),selectOne=getSelectorFunction((query,elements,options)=>query===falseFunc||!elements||elements.length===0?null:findOne3(query,elements,options));function is2(element,query,options){return(typeof query==="function"?query:compile2(query,options))(element)}var{isArray}=Array,isTag5=({nodeType})=>nodeType===ELEMENT_NODE,existsOne3=(test,elements)=>elements.some((element)=>isTag5(element)&&(test(element)||existsOne3(test,getChildren3(element)))),getAttributeValue3=(element,name)=>name==="class"?element.getAttributeNode("class")?.value??null:element.getAttribute(name),getChildren3=({childNodes})=>childNodes,getName3=(element)=>{let{localName}=element;return ignoreCase(element)?localName.toLowerCase():localName},getParent3=({parentNode})=>parentNode,getSiblings3=(element)=>{let{parentNode}=element;return parentNode?getChildren3(parentNode):element},getText3=(node)=>{if(isArray(node))return node.map(getText3).join("");if(isTag5(node))return getText3(getChildren3(node));if(node.nodeType===TEXT_NODE)return node.data;return""},hasAttrib3=(element,name)=>element.hasAttribute(name),removeSubsets3=(nodes)=>{let{length}=nodes;while(length--){let node=nodes[length];if(length&&-1<nodes.lastIndexOf(node,length-1)){nodes.splice(length,1);continue}for(let{parentNode}=node;parentNode;parentNode=parentNode.parentNode)if(nodes.includes(parentNode)){nodes.splice(length,1);break}}return nodes},findAll4=(test,nodes)=>{let matches=[];for(let node of nodes)if(isTag5(node)){if(test(node))matches.push(node);matches.push(...findAll4(test,getChildren3(node)))}return matches},findOne4=(test,nodes)=>{for(let node of nodes)if(test(node)||(node=findOne4(test,getChildren3(node))))return node;return null},adapter={isTag:isTag5,existsOne:existsOne3,getAttributeValue:getAttributeValue3,getChildren:getChildren3,getName:getName3,getParent:getParent3,getSiblings:getSiblings3,getText:getText3,hasAttrib:hasAttrib3,removeSubsets:removeSubsets3,findAll:findAll4,findOne:findOne4},prepareMatch=(element,selectors)=>compile2(selectors,{context:selectors.includes(":scope")?element:void 0,xmlMode:!ignoreCase(element),adapter}),matches=(element,selectors)=>is2(element,selectors,{strict:!0,context:selectors.includes(":scope")?element:void 0,xmlMode:!ignoreCase(element),adapter});class Text6 extends CharacterData{constructor(ownerDocument,data=""){super(ownerDocument,"#text",TEXT_NODE,data)}get wholeText(){let text=[],{previousSibling,nextSibling}=this;while(previousSibling){if(previousSibling.nodeType===TEXT_NODE)text.unshift(previousSibling[VALUE]);else break;previousSibling=previousSibling.previousSibling}text.push(this[VALUE]);while(nextSibling){if(nextSibling.nodeType===TEXT_NODE)text.push(nextSibling[VALUE]);else break;nextSibling=nextSibling.nextSibling}return text.join("")}cloneNode(){let{ownerDocument,[VALUE]:data}=this;return new Text6(ownerDocument,data)}toString(){return escape2(this[VALUE])}}var isNode=(node)=>node instanceof Node2,insert=(parentNode,child,nodes)=>{let{ownerDocument}=parentNode;for(let node of nodes)parentNode.insertBefore(isNode(node)?node:new Text6(ownerDocument,node),child)};class ParentNode extends Node2{constructor(ownerDocument,localName,nodeType){super(ownerDocument,localName,nodeType);this[PRIVATE]=null,this[NEXT]=this[END]={[NEXT]:null,[PREV]:this,[START]:this,nodeType:NODE_END,ownerDocument:this.ownerDocument,parentNode:null}}get childNodes(){let childNodes=new NodeList,{firstChild}=this;while(firstChild)childNodes.push(firstChild),firstChild=nextSibling(firstChild);return childNodes}get children(){let children=new NodeList,{firstElementChild}=this;while(firstElementChild)children.push(firstElementChild),firstElementChild=nextElementSibling2(firstElementChild);return children}get firstChild(){let{[NEXT]:next,[END]:end}=this;while(next.nodeType===ATTRIBUTE_NODE)next=next[NEXT];return next===end?null:next}get firstElementChild(){let{firstChild}=this;while(firstChild){if(firstChild.nodeType===ELEMENT_NODE)return firstChild;firstChild=nextSibling(firstChild)}return null}get lastChild(){let prev=this[END][PREV];switch(prev.nodeType){case NODE_END:return prev[START];case ATTRIBUTE_NODE:return null}return prev===this?null:prev}get lastElementChild(){let{lastChild}=this;while(lastChild){if(lastChild.nodeType===ELEMENT_NODE)return lastChild;lastChild=previousSibling(lastChild)}return null}get childElementCount(){return this.children.length}prepend(...nodes){insert(this,this.firstChild,nodes)}append(...nodes){insert(this,this[END],nodes)}replaceChildren(...nodes){let{[NEXT]:next,[END]:end}=this;while(next!==end&&next.nodeType===ATTRIBUTE_NODE)next=next[NEXT];while(next!==end){let after=getEnd(next)[NEXT];next.remove(),next=after}if(nodes.length)insert(this,end,nodes)}getElementsByClassName(className){let elements=new NodeList,{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&next.hasAttribute("class")&&next.classList.has(className))elements.push(next);next=next[NEXT]}return elements}getElementsByTagName(tagName){let elements=new NodeList,{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&(next.localName===tagName||localCase(next)===tagName))elements.push(next);next=next[NEXT]}return elements}querySelector(selectors){let matches=prepareMatch(this,selectors),{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&matches(next))return next;next=next.nodeType===ELEMENT_NODE&&next.localName==="template"?next[END]:next[NEXT]}return null}querySelectorAll(selectors){let matches=prepareMatch(this,selectors),elements=new NodeList,{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&matches(next))elements.push(next);next=next.nodeType===ELEMENT_NODE&&next.localName==="template"?next[END]:next[NEXT]}return elements}appendChild(node){return this.insertBefore(node,this[END])}contains(node){let parentNode=node;while(parentNode&&parentNode!==this)parentNode=parentNode.parentNode;return parentNode===this}insertBefore(node,before=null){if(node===before)return node;if(node===this)throw Error("unable to append a node to itself");let next=before||this[END];switch(node.nodeType){case ELEMENT_NODE:node.remove(),node.parentNode=this,knownBoundaries(next[PREV],node,next),moCallback(node,null),connectedCallback(node);break;case DOCUMENT_FRAGMENT_NODE:{let{[PRIVATE]:parentNode,firstChild,lastChild}=node;if(firstChild){if(knownSegment(next[PREV],firstChild,lastChild,next),knownAdjacent(node,node[END]),parentNode)parentNode.replaceChildren();do if(firstChild.parentNode=this,moCallback(firstChild,null),firstChild.nodeType===ELEMENT_NODE)connectedCallback(firstChild);while(firstChild!==lastChild&&(firstChild=nextSibling(firstChild)))}break}case TEXT_NODE:case COMMENT_NODE:case CDATA_SECTION_NODE:node.remove();default:node.parentNode=this,knownSiblings(next[PREV],node,next),moCallback(node,null);break}return node}normalize(){let{[NEXT]:next,[END]:end}=this;while(next!==end){let{[NEXT]:$next,[PREV]:$prev,nodeType}=next;if(nodeType===TEXT_NODE){if(!next[VALUE])next.remove();else if($prev&&$prev.nodeType===TEXT_NODE)$prev.textContent+=next.textContent,next.remove()}next=$next}}removeChild(node){if(node.parentNode!==this)throw Error("node is not a child");return node.remove(),node}replaceChild(node,replaced){let next=getEnd(replaced)[NEXT];return replaced.remove(),this.insertBefore(node,next),replaced}}class NonElementParentNode extends ParentNode{getElementById(id){let{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===ELEMENT_NODE&&next.id===id)return next;next=next[NEXT]}return null}cloneNode(deep){let{ownerDocument,constructor}=this,nonEPN=new constructor(ownerDocument);if(deep){let{[END]:end}=nonEPN;for(let node of this.childNodes)nonEPN.insertBefore(node.cloneNode(deep),end)}return nonEPN}toString(){let{childNodes,localName}=this;return`<${localName}>${childNodes.join("")}</${localName}>`}toJSON(){let json=[];return nonElementAsJSON(this,json),json}}class DocumentFragment extends NonElementParentNode{constructor(ownerDocument){super(ownerDocument,"#document-fragment",DOCUMENT_FRAGMENT_NODE)}}class DocumentType extends Node2{constructor(ownerDocument,name,publicId="",systemId=""){super(ownerDocument,"#document-type",DOCUMENT_TYPE_NODE);this.name=name,this.publicId=publicId,this.systemId=systemId}cloneNode(){let{ownerDocument,name,publicId,systemId}=this;return new DocumentType(ownerDocument,name,publicId,systemId)}toString(){let{name,publicId,systemId}=this,hasPublic=0<publicId.length,str=[name];if(hasPublic)str.push("PUBLIC",`"${publicId}"`);if(systemId.length){if(!hasPublic)str.push("SYSTEM");str.push(`"${systemId}"`)}return`<!DOCTYPE ${str.join(" ")}>`}toJSON(){let json=[];return documentTypeAsJSON(this,json),json}}var getInnerHtml=(node)=>node.childNodes.join(""),setInnerHtml=(node,html)=>{let{ownerDocument}=node,{constructor}=ownerDocument,document=new constructor;document[CUSTOM_ELEMENTS]=ownerDocument[CUSTOM_ELEMENTS];let{childNodes}=parseFromString(document,ignoreCase(node),html);node.replaceChildren(...childNodes.map(setOwnerDocument,ownerDocument))};function setOwnerDocument(node){switch(node.ownerDocument=this,node.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:node.childNodes.forEach(setOwnerDocument,this);break}return node}var esm_default2=(camel)=>camel.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z0-9]+)([A-Z]))/g,"$2$5-$3$6").toLowerCase();var refs=new WeakMap,key=(name)=>`data-${esm_default2(name)}`,prop=(name)=>name.slice(5).replace(/-([a-z])/g,(_,$1)=>$1.toUpperCase()),handler={get(dataset,name){if(name in dataset)return refs.get(dataset).getAttribute(key(name))},set(dataset,name,value){return dataset[name]=value,refs.get(dataset).setAttribute(key(name),value),!0},deleteProperty(dataset,name){if(name in dataset)refs.get(dataset).removeAttribute(key(name));return delete dataset[name]}};class DOMStringMap{constructor(ref){for(let{name,value}of ref.attributes)if(/^data-/.test(name))this[prop(name)]=value;return refs.set(this,ref),new Proxy(this,handler)}}setPrototypeOf(DOMStringMap.prototype,null);var{add}=Set.prototype,addTokens=(self,tokens)=>{for(let token of tokens)if(token)add.call(self,token)},update=({[OWNER_ELEMENT]:ownerElement,value})=>{let attribute=ownerElement.getAttributeNode("class");if(attribute)attribute.value=value;else setAttribute(ownerElement,new Attr(ownerElement.ownerDocument,"class",value))};class DOMTokenList extends Set{constructor(ownerElement){super();this[OWNER_ELEMENT]=ownerElement;let attribute=ownerElement.getAttributeNode("class");if(attribute)addTokens(this,attribute.value.split(/\s+/))}get length(){return this.size}get value(){return[...this].join(" ")}add(...tokens){addTokens(this,tokens),update(this)}contains(token){return this.has(token)}remove(...tokens){for(let token of tokens)this.delete(token);update(this)}toggle(token,force){if(this.has(token)){if(force)return!0;this.delete(token),update(this)}else if(force||arguments.length===1)return super.add(token),update(this),!0;return!1}replace(token,newToken){if(this.has(token))return this.delete(token),super.add(newToken),update(this),!0;return!1}supports(){return!0}}var refs2=new WeakMap,getKeys=(style)=>[...style.keys()].filter((key)=>key!==PRIVATE),updateKeys=(style)=>{let attr=refs2.get(style).getAttributeNode("style");if(!attr||attr[CHANGED]||style.get(PRIVATE)!==attr){if(style.clear(),attr){style.set(PRIVATE,attr);for(let rule of attr[VALUE].split(/\s*;\s*/)){let[key,...rest]=rule.split(":");if(rest.length>0){key=key.trim();let value=rest.join(":").trim();if(key&&value)style.set(key,value)}}}}return attr},handler2={get(style,name){if(name in prototype)return style[name];if(updateKeys(style),name==="length")return getKeys(style).length;if(/^\d+$/.test(name))return getKeys(style)[name];return style.get(esm_default2(name))??""},set(style,name,value){if(name==="cssText")style[name]=value;else{let attr=updateKeys(style);if(value==null)style.delete(esm_default2(name));else style.set(esm_default2(name),value);if(!attr){let element=refs2.get(style);attr=element.ownerDocument.createAttribute("style"),element.setAttributeNode(attr),style.set(PRIVATE,attr)}attr[CHANGED]=!1,attr[VALUE]=style.toString()}return!0}};class CSSStyleDeclaration extends Map{constructor(element){super();return refs2.set(this,element),new Proxy(this,handler2)}get cssText(){return this.toString()}set cssText(value){refs2.get(this).setAttribute("style",value)}getPropertyValue(name){let self=this[PRIVATE];return handler2.get(self,name)}setProperty(name,value){let self=this[PRIVATE];handler2.set(self,name,value)}removeProperty(name){let self=this[PRIVATE];handler2.set(self,name,null)}[Symbol.iterator](){let self=this[PRIVATE];updateKeys(self);let keys=getKeys(self),{length}=keys,i=0;return{next(){let done=i===length;return{done,value:done?null:keys[i++]}}}}get[PRIVATE](){return this}toString(){let self=this[PRIVATE];updateKeys(self);let cssText=[];return self.forEach(push,cssText),cssText.join(";")}}var{prototype}=CSSStyleDeclaration;function push(value,key){if(key!==PRIVATE)this.push(`${key}:${value}`)}function getCurrentTarget(ev){return ev.currentTarget}class GlobalEvent{static get BUBBLING_PHASE(){return 3}static get AT_TARGET(){return 2}static get CAPTURING_PHASE(){return 1}static get NONE(){return 0}constructor(type,eventInitDict={}){this.type=type,this.bubbles=!!eventInitDict.bubbles,this.cancelBubble=!1,this._stopImmediatePropagationFlag=!1,this.cancelable=!!eventInitDict.cancelable,this.eventPhase=this.NONE,this.timeStamp=Date.now(),this.defaultPrevented=!1,this.originalTarget=null,this.returnValue=null,this.srcElement=null,this.target=null,this._path=[]}get BUBBLING_PHASE(){return 3}get AT_TARGET(){return 2}get CAPTURING_PHASE(){return 1}get NONE(){return 0}preventDefault(){this.defaultPrevented=!0}composedPath(){return this._path.map(getCurrentTarget)}stopPropagation(){this.cancelBubble=!0}stopImmediatePropagation(){this.stopPropagation(),this._stopImmediatePropagationFlag=!0}}class NamedNodeMap extends Array{constructor(ownerElement){super();this.ownerElement=ownerElement}getNamedItem(name){return this.ownerElement.getAttributeNode(name)}setNamedItem(attr){this.ownerElement.setAttributeNode(attr),this.unshift(attr)}removeNamedItem(name){let item=this.getNamedItem(name);this.ownerElement.removeAttribute(name),this.splice(this.indexOf(item),1)}item(index){return index<this.length?this[index]:null}getNamedItemNS(_,name){return this.getNamedItem(name)}setNamedItemNS(_,attr){return this.setNamedItem(attr)}removeNamedItemNS(_,name){return this.removeNamedItem(name)}}class ShadowRoot extends NonElementParentNode{constructor(host){super(host.ownerDocument,"#shadow-root",DOCUMENT_FRAGMENT_NODE);this.host=host}get innerHTML(){return getInnerHtml(this)}set innerHTML(html){setInnerHtml(this,html)}}var attributesHandler={get(target,key){return key in target?target[key]:target.find(({name})=>name===key)}},create2=(ownerDocument,element,localName)=>{if("ownerSVGElement"in element){let svg=ownerDocument.createElementNS(SVG_NAMESPACE,localName);return svg.ownerSVGElement=element.ownerSVGElement,svg}return ownerDocument.createElement(localName)},isVoid=({localName,ownerDocument})=>ownerDocument[MIME].voidElements.test(localName);class Element2 extends ParentNode{constructor(ownerDocument,localName){super(ownerDocument,localName,ELEMENT_NODE);this[CLASS_LIST]=null,this[DATASET]=null,this[STYLE]=null}get isConnected(){return isConnected(this)}get parentElement(){return parentElement(this)}get previousSibling(){return previousSibling(this)}get nextSibling(){return nextSibling(this)}get namespaceURI(){return"http://www.w3.org/1999/xhtml"}get previousElementSibling(){return previousElementSibling(this)}get nextElementSibling(){return nextElementSibling2(this)}before(...nodes){before(this,nodes)}after(...nodes){after(this,nodes)}replaceWith(...nodes){replaceWith(this,nodes)}remove(){remove(this[PREV],this,this[END][NEXT])}get id(){return stringAttribute.get(this,"id")}set id(value){stringAttribute.set(this,"id",value)}get className(){return this.classList.value}set className(value){let{classList}=this;classList.clear(),classList.add(...$String(value).split(/\s+/))}get nodeName(){return localCase(this)}get tagName(){return localCase(this)}get classList(){return this[CLASS_LIST]||(this[CLASS_LIST]=new DOMTokenList(this))}get dataset(){return this[DATASET]||(this[DATASET]=new DOMStringMap(this))}getBoundingClientRect(){return{x:0,y:0,bottom:0,height:0,left:0,right:0,top:0,width:0}}get nonce(){return stringAttribute.get(this,"nonce")}set nonce(value){stringAttribute.set(this,"nonce",value)}get style(){return this[STYLE]||(this[STYLE]=new CSSStyleDeclaration(this))}get tabIndex(){return numericAttribute.get(this,"tabindex")||-1}set tabIndex(value){numericAttribute.set(this,"tabindex",value)}get slot(){return stringAttribute.get(this,"slot")}set slot(value){stringAttribute.set(this,"slot",value)}get innerText(){let text=[],{[NEXT]:next,[END]:end}=this;while(next!==end){if(next.nodeType===TEXT_NODE)text.push(next.textContent.replace(/\s+/g," "));else if(text.length&&next[NEXT]!=end&&BLOCK_ELEMENTS.has(next.tagName))text.push(`
|
|
51
51
|
`);next=next[NEXT]}return text.join("")}get textContent(){let text=[],{[NEXT]:next,[END]:end}=this;while(next!==end){let nodeType=next.nodeType;if(nodeType===TEXT_NODE||nodeType===CDATA_SECTION_NODE)text.push(next.textContent);next=next[NEXT]}return text.join("")}set textContent(text){if(this.replaceChildren(),text!=null&&text!=="")this.appendChild(new Text6(this.ownerDocument,text))}get innerHTML(){return getInnerHtml(this)}set innerHTML(html){setInnerHtml(this,html)}get outerHTML(){return this.toString()}set outerHTML(html){let template=this.ownerDocument.createElement("");template.innerHTML=html,this.replaceWith(...template.childNodes)}get attributes(){let attributes=new NamedNodeMap(this),next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE)attributes.push(next),next=next[NEXT];return new Proxy(attributes,attributesHandler)}focus(){this.dispatchEvent(new GlobalEvent("focus"))}getAttribute(name){if(name==="class")return this.className;let attribute=this.getAttributeNode(name);return attribute&&(ignoreCase(this)?attribute.value:escape2(attribute.value))}getAttributeNode(name){let next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE){if(next.name===name)return next;next=next[NEXT]}return null}getAttributeNames(){let attributes=new NodeList,next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE)attributes.push(next.name),next=next[NEXT];return attributes}hasAttribute(name){return!!this.getAttributeNode(name)}hasAttributes(){return this[NEXT].nodeType===ATTRIBUTE_NODE}removeAttribute(name){if(name==="class"&&this[CLASS_LIST])this[CLASS_LIST].clear();let next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE){if(next.name===name){removeAttribute(this,next);return}next=next[NEXT]}}removeAttributeNode(attribute){let next=this[NEXT];while(next.nodeType===ATTRIBUTE_NODE){if(next===attribute){removeAttribute(this,next);return}next=next[NEXT]}}setAttribute(name,value){if(name==="class")this.className=value;else{let attribute=this.getAttributeNode(name);if(attribute)attribute.value=value;else setAttribute(this,new Attr(this.ownerDocument,name,value))}}setAttributeNode(attribute){let{name}=attribute,previously=this.getAttributeNode(name);if(previously!==attribute){if(previously)this.removeAttributeNode(previously);let{ownerElement}=attribute;if(ownerElement)ownerElement.removeAttributeNode(attribute);setAttribute(this,attribute)}return previously}toggleAttribute(name,force){if(this.hasAttribute(name)){if(!force)return this.removeAttribute(name),!1;return!0}else if(force||arguments.length===1)return this.setAttribute(name,""),!0;return!1}get shadowRoot(){if(shadowRoots.has(this)){let{mode,shadowRoot}=shadowRoots.get(this);if(mode==="open")return shadowRoot}return null}attachShadow(init){if(shadowRoots.has(this))throw Error("operation not supported");let shadowRoot=new ShadowRoot(this);return shadowRoots.set(this,{mode:init.mode,shadowRoot}),shadowRoot}matches(selectors){return matches(this,selectors)}closest(selectors){let parentElement=this,matches=prepareMatch(parentElement,selectors);while(parentElement&&!matches(parentElement))parentElement=parentElement.parentElement;return parentElement}insertAdjacentElement(position,element){let{parentElement}=this;switch(position){case"beforebegin":if(parentElement){parentElement.insertBefore(element,this);break}return null;case"afterbegin":this.insertBefore(element,this.firstChild);break;case"beforeend":this.insertBefore(element,null);break;case"afterend":if(parentElement){parentElement.insertBefore(element,this.nextSibling);break}return null}return element}insertAdjacentHTML(position,html){this.insertAdjacentElement(position,htmlToFragment(this.ownerDocument,html))}insertAdjacentText(position,text){let node=this.ownerDocument.createTextNode(text);this.insertAdjacentElement(position,node)}cloneNode(deep=!1){let{ownerDocument,localName}=this,addNext=(next)=>{next.parentNode=parentNode,knownAdjacent($next,next),$next=next},clone=create2(ownerDocument,this,localName),parentNode=clone,$next=clone,{[NEXT]:next,[END]:prev}=this;while(next!==prev&&(deep||next.nodeType===ATTRIBUTE_NODE)){switch(next.nodeType){case NODE_END:knownAdjacent($next,parentNode[END]),$next=parentNode[END],parentNode=parentNode.parentNode;break;case ELEMENT_NODE:{let node=create2(ownerDocument,next,next.localName);addNext(node),parentNode=node;break}case ATTRIBUTE_NODE:{let attr=next.cloneNode(deep);attr.ownerElement=parentNode,addNext(attr);break}case TEXT_NODE:case COMMENT_NODE:case CDATA_SECTION_NODE:addNext(next.cloneNode(deep));break}next=next[NEXT]}return knownAdjacent($next,clone[END]),clone}toString(){let out=[],{[END]:end}=this,next={[NEXT]:this},isOpened=!1;do switch(next=next[NEXT],next.nodeType){case ATTRIBUTE_NODE:{let attr=" "+next;switch(attr){case" id":case" class":case" style":break;default:out.push(attr)}break}case NODE_END:{let start=next[START];if(isOpened){if("ownerSVGElement"in start)out.push(" />");else if(isVoid(start))out.push(ignoreCase(start)?">":" />");else out.push(`></${start.localName}>`);isOpened=!1}else out.push(`</${start.localName}>`);break}case ELEMENT_NODE:if(isOpened)out.push(">");if(next.toString!==this.toString)out.push(next.toString()),next=next[END],isOpened=!1;else out.push(`<${next.localName}`),isOpened=!0;break;case TEXT_NODE:case COMMENT_NODE:case CDATA_SECTION_NODE:out.push((isOpened?">":"")+next),isOpened=!1;break}while(next!==end);return out.join("")}toJSON(){let json=[];return elementAsJSON(this,json),json}getAttributeNS(_,name){return this.getAttribute(name)}getElementsByTagNameNS(_,name){return this.getElementsByTagName(name)}hasAttributeNS(_,name){return this.hasAttribute(name)}removeAttributeNS(_,name){this.removeAttribute(name)}setAttributeNS(_,name,value){this.setAttribute(name,value)}setAttributeNodeNS(attr){return this.setAttributeNode(attr)}}var classNames=new WeakMap,handler3={get(target,name){return target[name]},set(target,name,value){return target[name]=value,!0}};class SVGElement extends Element2{constructor(ownerDocument,localName,ownerSVGElement=null){super(ownerDocument,localName);this.ownerSVGElement=ownerSVGElement}get className(){if(!classNames.has(this))classNames.set(this,new Proxy({baseVal:"",animVal:""},handler3));return classNames.get(this)}set className(value){let{classList}=this;classList.clear(),classList.add(...$String(value).split(/\s+/))}get namespaceURI(){return"http://www.w3.org/2000/svg"}getAttribute(name){return name==="class"?[...this.classList].join(" "):super.getAttribute(name)}setAttribute(name,value){if(name==="class")this.className=value;else if(name==="style"){let{className}=this;className.baseVal=className.animVal=value}super.setAttribute(name,value)}}var illegalConstructor=()=>{throw TypeError("Illegal constructor")};function Attr2(){illegalConstructor()}setPrototypeOf(Attr2,Attr);Attr2.prototype=Attr.prototype;function CDATASection2(){illegalConstructor()}setPrototypeOf(CDATASection2,CDATASection);CDATASection2.prototype=CDATASection.prototype;function CharacterData2(){illegalConstructor()}setPrototypeOf(CharacterData2,CharacterData);CharacterData2.prototype=CharacterData.prototype;function Comment7(){illegalConstructor()}setPrototypeOf(Comment7,Comment3);Comment7.prototype=Comment3.prototype;function DocumentFragment2(){illegalConstructor()}setPrototypeOf(DocumentFragment2,DocumentFragment);DocumentFragment2.prototype=DocumentFragment.prototype;function DocumentType2(){illegalConstructor()}setPrototypeOf(DocumentType2,DocumentType);DocumentType2.prototype=DocumentType.prototype;function Element3(){illegalConstructor()}setPrototypeOf(Element3,Element2);Element3.prototype=Element2.prototype;function Node3(){illegalConstructor()}setPrototypeOf(Node3,Node2);Node3.prototype=Node2.prototype;function ShadowRoot2(){illegalConstructor()}setPrototypeOf(ShadowRoot2,ShadowRoot);ShadowRoot2.prototype=ShadowRoot.prototype;function Text7(){illegalConstructor()}setPrototypeOf(Text7,Text6);Text7.prototype=Text6.prototype;function SVGElement2(){illegalConstructor()}setPrototypeOf(SVGElement2,SVGElement);SVGElement2.prototype=SVGElement.prototype;var Facades={Attr:Attr2,CDATASection:CDATASection2,CharacterData:CharacterData2,Comment:Comment7,DocumentFragment:DocumentFragment2,DocumentType:DocumentType2,Element:Element3,Node:Node3,ShadowRoot:ShadowRoot2,Text:Text7,SVGElement:SVGElement2};var Level0=new WeakMap,level0={get(element,name){return Level0.has(element)&&Level0.get(element)[name]||null},set(element,name,value){if(!Level0.has(element))Level0.set(element,{});let handlers=Level0.get(element),type=name.slice(2);if(handlers[name])element.removeEventListener(type,handlers[name],!1);if(handlers[name]=value)element.addEventListener(type,value,!1)}};class HTMLElement extends Element2{static get observedAttributes(){return[]}constructor(ownerDocument=null,localName=""){super(ownerDocument,localName);let ownerLess=!ownerDocument,options;if(ownerLess){let{constructor:Class}=this;if(!Classes.has(Class))throw Error("unable to initialize this Custom Element");({ownerDocument,localName,options}=Classes.get(Class))}if(ownerDocument[UPGRADE]){let{element,values}=ownerDocument[UPGRADE];ownerDocument[UPGRADE]=null;for(let[key,value]of values)element[key]=value;return element}if(ownerLess){if(this.ownerDocument=this[END].ownerDocument=ownerDocument,this.localName=localName,customElements.set(this,{connected:!1}),options.is)this.setAttribute("is",options.is)}}blur(){this.dispatchEvent(new GlobalEvent("blur"))}click(){let clickEvent=new GlobalEvent("click",{bubbles:!0,cancelable:!0});clickEvent.button=0,this.dispatchEvent(clickEvent)}get accessKeyLabel(){let{accessKey}=this;return accessKey&&`Alt+Shift+${accessKey}`}get isContentEditable(){return this.hasAttribute("contenteditable")}get contentEditable(){return booleanAttribute.get(this,"contenteditable")}set contentEditable(value){booleanAttribute.set(this,"contenteditable",value)}get draggable(){return booleanAttribute.get(this,"draggable")}set draggable(value){booleanAttribute.set(this,"draggable",value)}get hidden(){return booleanAttribute.get(this,"hidden")}set hidden(value){booleanAttribute.set(this,"hidden",value)}get spellcheck(){return booleanAttribute.get(this,"spellcheck")}set spellcheck(value){booleanAttribute.set(this,"spellcheck",value)}get accessKey(){return stringAttribute.get(this,"accesskey")}set accessKey(value){stringAttribute.set(this,"accesskey",value)}get dir(){return stringAttribute.get(this,"dir")}set dir(value){stringAttribute.set(this,"dir",value)}get lang(){return stringAttribute.get(this,"lang")}set lang(value){stringAttribute.set(this,"lang",value)}get title(){return stringAttribute.get(this,"title")}set title(value){stringAttribute.set(this,"title",value)}get onabort(){return level0.get(this,"onabort")}set onabort(value){level0.set(this,"onabort",value)}get onblur(){return level0.get(this,"onblur")}set onblur(value){level0.set(this,"onblur",value)}get oncancel(){return level0.get(this,"oncancel")}set oncancel(value){level0.set(this,"oncancel",value)}get oncanplay(){return level0.get(this,"oncanplay")}set oncanplay(value){level0.set(this,"oncanplay",value)}get oncanplaythrough(){return level0.get(this,"oncanplaythrough")}set oncanplaythrough(value){level0.set(this,"oncanplaythrough",value)}get onchange(){return level0.get(this,"onchange")}set onchange(value){level0.set(this,"onchange",value)}get onclick(){return level0.get(this,"onclick")}set onclick(value){level0.set(this,"onclick",value)}get onclose(){return level0.get(this,"onclose")}set onclose(value){level0.set(this,"onclose",value)}get oncontextmenu(){return level0.get(this,"oncontextmenu")}set oncontextmenu(value){level0.set(this,"oncontextmenu",value)}get oncuechange(){return level0.get(this,"oncuechange")}set oncuechange(value){level0.set(this,"oncuechange",value)}get ondblclick(){return level0.get(this,"ondblclick")}set ondblclick(value){level0.set(this,"ondblclick",value)}get ondrag(){return level0.get(this,"ondrag")}set ondrag(value){level0.set(this,"ondrag",value)}get ondragend(){return level0.get(this,"ondragend")}set ondragend(value){level0.set(this,"ondragend",value)}get ondragenter(){return level0.get(this,"ondragenter")}set ondragenter(value){level0.set(this,"ondragenter",value)}get ondragleave(){return level0.get(this,"ondragleave")}set ondragleave(value){level0.set(this,"ondragleave",value)}get ondragover(){return level0.get(this,"ondragover")}set ondragover(value){level0.set(this,"ondragover",value)}get ondragstart(){return level0.get(this,"ondragstart")}set ondragstart(value){level0.set(this,"ondragstart",value)}get ondrop(){return level0.get(this,"ondrop")}set ondrop(value){level0.set(this,"ondrop",value)}get ondurationchange(){return level0.get(this,"ondurationchange")}set ondurationchange(value){level0.set(this,"ondurationchange",value)}get onemptied(){return level0.get(this,"onemptied")}set onemptied(value){level0.set(this,"onemptied",value)}get onended(){return level0.get(this,"onended")}set onended(value){level0.set(this,"onended",value)}get onerror(){return level0.get(this,"onerror")}set onerror(value){level0.set(this,"onerror",value)}get onfocus(){return level0.get(this,"onfocus")}set onfocus(value){level0.set(this,"onfocus",value)}get oninput(){return level0.get(this,"oninput")}set oninput(value){level0.set(this,"oninput",value)}get oninvalid(){return level0.get(this,"oninvalid")}set oninvalid(value){level0.set(this,"oninvalid",value)}get onkeydown(){return level0.get(this,"onkeydown")}set onkeydown(value){level0.set(this,"onkeydown",value)}get onkeypress(){return level0.get(this,"onkeypress")}set onkeypress(value){level0.set(this,"onkeypress",value)}get onkeyup(){return level0.get(this,"onkeyup")}set onkeyup(value){level0.set(this,"onkeyup",value)}get onload(){return level0.get(this,"onload")}set onload(value){level0.set(this,"onload",value)}get onloadeddata(){return level0.get(this,"onloadeddata")}set onloadeddata(value){level0.set(this,"onloadeddata",value)}get onloadedmetadata(){return level0.get(this,"onloadedmetadata")}set onloadedmetadata(value){level0.set(this,"onloadedmetadata",value)}get onloadstart(){return level0.get(this,"onloadstart")}set onloadstart(value){level0.set(this,"onloadstart",value)}get onmousedown(){return level0.get(this,"onmousedown")}set onmousedown(value){level0.set(this,"onmousedown",value)}get onmouseenter(){return level0.get(this,"onmouseenter")}set onmouseenter(value){level0.set(this,"onmouseenter",value)}get onmouseleave(){return level0.get(this,"onmouseleave")}set onmouseleave(value){level0.set(this,"onmouseleave",value)}get onmousemove(){return level0.get(this,"onmousemove")}set onmousemove(value){level0.set(this,"onmousemove",value)}get onmouseout(){return level0.get(this,"onmouseout")}set onmouseout(value){level0.set(this,"onmouseout",value)}get onmouseover(){return level0.get(this,"onmouseover")}set onmouseover(value){level0.set(this,"onmouseover",value)}get onmouseup(){return level0.get(this,"onmouseup")}set onmouseup(value){level0.set(this,"onmouseup",value)}get onmousewheel(){return level0.get(this,"onmousewheel")}set onmousewheel(value){level0.set(this,"onmousewheel",value)}get onpause(){return level0.get(this,"onpause")}set onpause(value){level0.set(this,"onpause",value)}get onplay(){return level0.get(this,"onplay")}set onplay(value){level0.set(this,"onplay",value)}get onplaying(){return level0.get(this,"onplaying")}set onplaying(value){level0.set(this,"onplaying",value)}get onprogress(){return level0.get(this,"onprogress")}set onprogress(value){level0.set(this,"onprogress",value)}get onratechange(){return level0.get(this,"onratechange")}set onratechange(value){level0.set(this,"onratechange",value)}get onreset(){return level0.get(this,"onreset")}set onreset(value){level0.set(this,"onreset",value)}get onresize(){return level0.get(this,"onresize")}set onresize(value){level0.set(this,"onresize",value)}get onscroll(){return level0.get(this,"onscroll")}set onscroll(value){level0.set(this,"onscroll",value)}get onseeked(){return level0.get(this,"onseeked")}set onseeked(value){level0.set(this,"onseeked",value)}get onseeking(){return level0.get(this,"onseeking")}set onseeking(value){level0.set(this,"onseeking",value)}get onselect(){return level0.get(this,"onselect")}set onselect(value){level0.set(this,"onselect",value)}get onshow(){return level0.get(this,"onshow")}set onshow(value){level0.set(this,"onshow",value)}get onstalled(){return level0.get(this,"onstalled")}set onstalled(value){level0.set(this,"onstalled",value)}get onsubmit(){return level0.get(this,"onsubmit")}set onsubmit(value){level0.set(this,"onsubmit",value)}get onsuspend(){return level0.get(this,"onsuspend")}set onsuspend(value){level0.set(this,"onsuspend",value)}get ontimeupdate(){return level0.get(this,"ontimeupdate")}set ontimeupdate(value){level0.set(this,"ontimeupdate",value)}get ontoggle(){return level0.get(this,"ontoggle")}set ontoggle(value){level0.set(this,"ontoggle",value)}get onvolumechange(){return level0.get(this,"onvolumechange")}set onvolumechange(value){level0.set(this,"onvolumechange",value)}get onwaiting(){return level0.get(this,"onwaiting")}set onwaiting(value){level0.set(this,"onwaiting",value)}get onauxclick(){return level0.get(this,"onauxclick")}set onauxclick(value){level0.set(this,"onauxclick",value)}get ongotpointercapture(){return level0.get(this,"ongotpointercapture")}set ongotpointercapture(value){level0.set(this,"ongotpointercapture",value)}get onlostpointercapture(){return level0.get(this,"onlostpointercapture")}set onlostpointercapture(value){level0.set(this,"onlostpointercapture",value)}get onpointercancel(){return level0.get(this,"onpointercancel")}set onpointercancel(value){level0.set(this,"onpointercancel",value)}get onpointerdown(){return level0.get(this,"onpointerdown")}set onpointerdown(value){level0.set(this,"onpointerdown",value)}get onpointerenter(){return level0.get(this,"onpointerenter")}set onpointerenter(value){level0.set(this,"onpointerenter",value)}get onpointerleave(){return level0.get(this,"onpointerleave")}set onpointerleave(value){level0.set(this,"onpointerleave",value)}get onpointermove(){return level0.get(this,"onpointermove")}set onpointermove(value){level0.set(this,"onpointermove",value)}get onpointerout(){return level0.get(this,"onpointerout")}set onpointerout(value){level0.set(this,"onpointerout",value)}get onpointerover(){return level0.get(this,"onpointerover")}set onpointerover(value){level0.set(this,"onpointerover",value)}get onpointerup(){return level0.get(this,"onpointerup")}set onpointerup(value){level0.set(this,"onpointerup",value)}}var tagName="template";class HTMLTemplateElement extends HTMLElement{constructor(ownerDocument){super(ownerDocument,tagName);let content=this.ownerDocument.createDocumentFragment();(this[CONTENT]=content)[PRIVATE]=this}get content(){if(this.hasChildNodes()&&!this[CONTENT].hasChildNodes())for(let node of this.childNodes)this[CONTENT].appendChild(node.cloneNode(!0));return this[CONTENT]}}registerHTMLClass(tagName,HTMLTemplateElement);class HTMLHtmlElement extends HTMLElement{constructor(ownerDocument,localName="html"){super(ownerDocument,localName)}}var{toString}=HTMLElement.prototype;class TextElement extends HTMLElement{get innerHTML(){return this.textContent}set innerHTML(html){this.textContent=html}toString(){return toString.call(this.cloneNode()).replace("><",()=>`>${this.textContent}<`)}}var tagName2="script";class HTMLScriptElement extends TextElement{constructor(ownerDocument,localName=tagName2){super(ownerDocument,localName)}get type(){return stringAttribute.get(this,"type")}set type(value){stringAttribute.set(this,"type",value)}get src(){return stringAttribute.get(this,"src")}set src(value){stringAttribute.set(this,"src",value)}get defer(){return booleanAttribute.get(this,"defer")}set defer(value){booleanAttribute.set(this,"defer",value)}get crossOrigin(){return stringAttribute.get(this,"crossorigin")}set crossOrigin(value){stringAttribute.set(this,"crossorigin",value)}get nomodule(){return booleanAttribute.get(this,"nomodule")}set nomodule(value){booleanAttribute.set(this,"nomodule",value)}get referrerPolicy(){return stringAttribute.get(this,"referrerpolicy")}set referrerPolicy(value){stringAttribute.set(this,"referrerpolicy",value)}get nonce(){return stringAttribute.get(this,"nonce")}set nonce(value){stringAttribute.set(this,"nonce",value)}get async(){return booleanAttribute.get(this,"async")}set async(value){booleanAttribute.set(this,"async",value)}get text(){return this.textContent}set text(content){this.textContent=content}}registerHTMLClass(tagName2,HTMLScriptElement);class HTMLFrameElement extends HTMLElement{constructor(ownerDocument,localName="frame"){super(ownerDocument,localName)}}var tagName3="iframe";class HTMLIFrameElement extends HTMLElement{constructor(ownerDocument,localName=tagName3){super(ownerDocument,localName)}get src(){return stringAttribute.get(this,"src")}set src(value){stringAttribute.set(this,"src",value)}get srcdoc(){return stringAttribute.get(this,"srcdoc")}set srcdoc(value){stringAttribute.set(this,"srcdoc",value)}get name(){return stringAttribute.get(this,"name")}set name(value){stringAttribute.set(this,"name",value)}get allow(){return stringAttribute.get(this,"allow")}set allow(value){stringAttribute.set(this,"allow",value)}get allowFullscreen(){return booleanAttribute.get(this,"allowfullscreen")}set allowFullscreen(value){booleanAttribute.set(this,"allowfullscreen",value)}get referrerPolicy(){return stringAttribute.get(this,"referrerpolicy")}set referrerPolicy(value){stringAttribute.set(this,"referrerpolicy",value)}get loading(){return stringAttribute.get(this,"loading")}set loading(value){stringAttribute.set(this,"loading",value)}}registerHTMLClass(tagName3,HTMLIFrameElement);class HTMLObjectElement extends HTMLElement{constructor(ownerDocument,localName="object"){super(ownerDocument,localName)}}class HTMLHeadElement extends HTMLElement{constructor(ownerDocument,localName="head"){super(ownerDocument,localName)}}class HTMLBodyElement extends HTMLElement{constructor(ownerDocument,localName="body"){super(ownerDocument,localName)}}var $setup=require_CSSOM().setup;require_errorUtils();require_regexPatterns();var $CSSStyleDeclaration=require_CSSStyleDeclaration().CSSStyleDeclaration;require_cssstyleTryCatchBlock();var $CSSRule=require_CSSRule().CSSRule,$CSSRuleList=require_CSSRuleList().CSSRuleList,$CSSNestedDeclarations=require_CSSNestedDeclarations().CSSNestedDeclarations,$CSSGroupingRule=require_CSSGroupingRule().CSSGroupingRule,$CSSCounterStyleRule=require_CSSCounterStyleRule().CSSCounterStyleRule,$CSSPropertyRule=require_CSSPropertyRule().CSSPropertyRule,$CSSConditionRule=require_CSSConditionRule().CSSConditionRule,$CSSStyleRule=require_CSSStyleRule().CSSStyleRule,$MediaList=require_MediaList().MediaList,$CSSMediaRule=require_CSSMediaRule().CSSMediaRule,$CSSContainerRule=require_CSSContainerRule().CSSContainerRule,$CSSSupportsRule=require_CSSSupportsRule().CSSSupportsRule,$CSSImportRule=require_CSSImportRule().CSSImportRule,$CSSNamespaceRule=require_CSSNamespaceRule().CSSNamespaceRule,$CSSFontFaceRule=require_CSSFontFaceRule().CSSFontFaceRule,$CSSHostRule=require_CSSHostRule().CSSHostRule,$CSSStartingStyleRule=require_CSSStartingStyleRule().CSSStartingStyleRule,$StyleSheet=require_StyleSheet().StyleSheet,$CSSStyleSheet=require_CSSStyleSheet().CSSStyleSheet,$CSSKeyframesRule=require_CSSKeyframesRule().CSSKeyframesRule,$CSSKeyframeRule=require_CSSKeyframeRule().CSSKeyframeRule,$MatcherList=require_MatcherList().MatcherList,$CSSDocumentRule=require_CSSDocumentRule().CSSDocumentRule,$CSSValue=require_CSSValue().CSSValue,$CSSValueExpression=require_CSSValueExpression().CSSValueExpression,$CSSScopeRule=require_CSSScopeRule().CSSScopeRule,$CSSLayerBlockRule=require_CSSLayerBlockRule().CSSLayerBlockRule,$CSSLayerStatementRule=require_CSSLayerStatementRule().CSSLayerStatementRule,$CSSPageRule=require_CSSPageRule().CSSPageRule,$parse=require_parse().parse,$clone=require_clone().clone;var tagName4="style";class HTMLStyleElement extends TextElement{constructor(ownerDocument,localName=tagName4){super(ownerDocument,localName);this[SHEET]=null}get sheet(){let sheet=this[SHEET];if(sheet!==null)return sheet;return this[SHEET]=$parse(this.textContent)}get innerHTML(){return super.innerHTML||""}set innerHTML(value){super.textContent=value,this[SHEET]=null}get innerText(){return super.innerText||""}set innerText(value){super.textContent=value,this[SHEET]=null}get textContent(){return super.textContent||""}set textContent(value){super.textContent=value,this[SHEET]=null}}registerHTMLClass(tagName4,HTMLStyleElement);class HTMLTimeElement extends HTMLElement{constructor(ownerDocument,localName="time"){super(ownerDocument,localName)}get dateTime(){return stringAttribute.get(this,"datetime")}set dateTime(value){stringAttribute.set(this,"datetime",value)}}registerHTMLClass("time",HTMLTimeElement);class HTMLFieldSetElement extends HTMLElement{constructor(ownerDocument,localName="fieldset"){super(ownerDocument,localName)}}class HTMLEmbedElement extends HTMLElement{constructor(ownerDocument,localName="embed"){super(ownerDocument,localName)}}class HTMLHRElement extends HTMLElement{constructor(ownerDocument,localName="hr"){super(ownerDocument,localName)}}class HTMLProgressElement extends HTMLElement{constructor(ownerDocument,localName="progress"){super(ownerDocument,localName)}}class HTMLParagraphElement extends HTMLElement{constructor(ownerDocument,localName="p"){super(ownerDocument,localName)}}class HTMLTableElement extends HTMLElement{constructor(ownerDocument,localName="table"){super(ownerDocument,localName)}}class HTMLFrameSetElement extends HTMLElement{constructor(ownerDocument,localName="frameset"){super(ownerDocument,localName)}}class HTMLLIElement extends HTMLElement{constructor(ownerDocument,localName="li"){super(ownerDocument,localName)}}class HTMLBaseElement extends HTMLElement{constructor(ownerDocument,localName="base"){super(ownerDocument,localName)}}class HTMLDataListElement extends HTMLElement{constructor(ownerDocument,localName="datalist"){super(ownerDocument,localName)}}var tagName5="input";class HTMLInputElement extends HTMLElement{constructor(ownerDocument,localName=tagName5){super(ownerDocument,localName)}get autofocus(){return booleanAttribute.get(this,"autofocus")||-1}set autofocus(value){booleanAttribute.set(this,"autofocus",value)}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}get placeholder(){return this.getAttribute("placeholder")}set placeholder(value){this.setAttribute("placeholder",value)}get type(){return this.getAttribute("type")}set type(value){this.setAttribute("type",value)}get value(){return stringAttribute.get(this,"value")}set value(value){stringAttribute.set(this,"value",value)}}registerHTMLClass(tagName5,HTMLInputElement);class HTMLParamElement extends HTMLElement{constructor(ownerDocument,localName="param"){super(ownerDocument,localName)}}class HTMLMediaElement extends HTMLElement{constructor(ownerDocument,localName="media"){super(ownerDocument,localName)}}class HTMLAudioElement extends HTMLElement{constructor(ownerDocument,localName="audio"){super(ownerDocument,localName)}}var tagName6="h1";class HTMLHeadingElement extends HTMLElement{constructor(ownerDocument,localName=tagName6){super(ownerDocument,localName)}}registerHTMLClass([tagName6,"h2","h3","h4","h5","h6"],HTMLHeadingElement);class HTMLDirectoryElement extends HTMLElement{constructor(ownerDocument,localName="dir"){super(ownerDocument,localName)}}class HTMLQuoteElement extends HTMLElement{constructor(ownerDocument,localName="quote"){super(ownerDocument,localName)}}var import_canvas=__toESM(require_canvas(),1);var{createCanvas}=import_canvas.default,tagName7="canvas";class HTMLCanvasElement extends HTMLElement{constructor(ownerDocument,localName=tagName7){super(ownerDocument,localName);this[IMAGE]=createCanvas(300,150)}get width(){return this[IMAGE].width}set width(value){numericAttribute.set(this,"width",value),this[IMAGE].width=value}get height(){return this[IMAGE].height}set height(value){numericAttribute.set(this,"height",value),this[IMAGE].height=value}getContext(type){return this[IMAGE].getContext(type)}toDataURL(...args){return this[IMAGE].toDataURL(...args)}}registerHTMLClass(tagName7,HTMLCanvasElement);class HTMLLegendElement extends HTMLElement{constructor(ownerDocument,localName="legend"){super(ownerDocument,localName)}}var tagName8="option";class HTMLOptionElement extends HTMLElement{constructor(ownerDocument,localName=tagName8){super(ownerDocument,localName)}get value(){return stringAttribute.get(this,"value")}set value(value){stringAttribute.set(this,"value",value)}get selected(){return booleanAttribute.get(this,"selected")}set selected(value){let option=this.parentElement?.querySelector("option[selected]");if(option&&option!==this)option.selected=!1;booleanAttribute.set(this,"selected",value)}}registerHTMLClass(tagName8,HTMLOptionElement);class HTMLSpanElement extends HTMLElement{constructor(ownerDocument,localName="span"){super(ownerDocument,localName)}}class HTMLMeterElement extends HTMLElement{constructor(ownerDocument,localName="meter"){super(ownerDocument,localName)}}class HTMLVideoElement extends HTMLElement{constructor(ownerDocument,localName="video"){super(ownerDocument,localName)}}class HTMLTableCellElement extends HTMLElement{constructor(ownerDocument,localName="td"){super(ownerDocument,localName)}}var tagName9="title";class HTMLTitleElement extends TextElement{constructor(ownerDocument,localName=tagName9){super(ownerDocument,localName)}}registerHTMLClass(tagName9,HTMLTitleElement);class HTMLOutputElement extends HTMLElement{constructor(ownerDocument,localName="output"){super(ownerDocument,localName)}}class HTMLTableRowElement extends HTMLElement{constructor(ownerDocument,localName="tr"){super(ownerDocument,localName)}}class HTMLDataElement extends HTMLElement{constructor(ownerDocument,localName="data"){super(ownerDocument,localName)}}class HTMLMenuElement extends HTMLElement{constructor(ownerDocument,localName="menu"){super(ownerDocument,localName)}}var tagName10="select";class HTMLSelectElement extends HTMLElement{constructor(ownerDocument,localName=tagName10){super(ownerDocument,localName)}get options(){let children=new NodeList,{firstElementChild}=this;while(firstElementChild){if(firstElementChild.tagName==="OPTGROUP")children.push(...firstElementChild.children);else children.push(firstElementChild);firstElementChild=firstElementChild.nextElementSibling}return children}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}get value(){return this.querySelector("option[selected]")?.value}}registerHTMLClass(tagName10,HTMLSelectElement);class HTMLBRElement extends HTMLElement{constructor(ownerDocument,localName="br"){super(ownerDocument,localName)}}var tagName11="button";class HTMLButtonElement extends HTMLElement{constructor(ownerDocument,localName=tagName11){super(ownerDocument,localName)}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}get type(){return this.getAttribute("type")}set type(value){this.setAttribute("type",value)}}registerHTMLClass(tagName11,HTMLButtonElement);class HTMLMapElement extends HTMLElement{constructor(ownerDocument,localName="map"){super(ownerDocument,localName)}}class HTMLOptGroupElement extends HTMLElement{constructor(ownerDocument,localName="optgroup"){super(ownerDocument,localName)}}class HTMLDListElement extends HTMLElement{constructor(ownerDocument,localName="dl"){super(ownerDocument,localName)}}var tagName12="textarea";class HTMLTextAreaElement extends TextElement{constructor(ownerDocument,localName=tagName12){super(ownerDocument,localName)}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}get placeholder(){return this.getAttribute("placeholder")}set placeholder(value){this.setAttribute("placeholder",value)}get type(){return this.getAttribute("type")}set type(value){this.setAttribute("type",value)}get value(){return this.textContent}set value(content){this.textContent=content}}registerHTMLClass(tagName12,HTMLTextAreaElement);class HTMLFontElement extends HTMLElement{constructor(ownerDocument,localName="font"){super(ownerDocument,localName)}}class HTMLDivElement extends HTMLElement{constructor(ownerDocument,localName="div"){super(ownerDocument,localName)}}var tagName13="link";class HTMLLinkElement extends HTMLElement{constructor(ownerDocument,localName=tagName13){super(ownerDocument,localName)}get disabled(){return booleanAttribute.get(this,"disabled")}set disabled(value){booleanAttribute.set(this,"disabled",value)}get href(){return stringAttribute.get(this,"href").trim()}set href(value){stringAttribute.set(this,"href",value)}get hreflang(){return stringAttribute.get(this,"hreflang")}set hreflang(value){stringAttribute.set(this,"hreflang",value)}get media(){return stringAttribute.get(this,"media")}set media(value){stringAttribute.set(this,"media",value)}get rel(){return stringAttribute.get(this,"rel")}set rel(value){stringAttribute.set(this,"rel",value)}get type(){return stringAttribute.get(this,"type")}set type(value){stringAttribute.set(this,"type",value)}}registerHTMLClass(tagName13,HTMLLinkElement);var tagName14="slot";class HTMLSlotElement extends HTMLElement{constructor(ownerDocument,localName=tagName14){super(ownerDocument,localName)}get name(){return this.getAttribute("name")}set name(value){this.setAttribute("name",value)}assign(){}assignedNodes(options){let isNamedSlot=!!this.name,hostChildNodes=this.getRootNode().host?.childNodes??[],slottables;if(isNamedSlot)slottables=[...hostChildNodes].filter((node)=>node.slot===this.name);else slottables=[...hostChildNodes].filter((node)=>!node.slot);if(options?.flatten){let result=[];for(let slottable of slottables)if(slottable.localName==="slot")result.push(...slottable.assignedNodes({flatten:!0}));else result.push(slottable);slottables=result}return slottables.length?slottables:[...this.childNodes]}assignedElements(options){let slottables=this.assignedNodes(options).filter((n)=>n.nodeType===1);return slottables.length?slottables:[...this.children]}}registerHTMLClass(tagName14,HTMLSlotElement);class HTMLFormElement extends HTMLElement{constructor(ownerDocument,localName="form"){super(ownerDocument,localName)}}var tagName15="img";class HTMLImageElement extends HTMLElement{constructor(ownerDocument,localName=tagName15){super(ownerDocument,localName)}get alt(){return stringAttribute.get(this,"alt")}set alt(value){stringAttribute.set(this,"alt",value)}get sizes(){return stringAttribute.get(this,"sizes")}set sizes(value){stringAttribute.set(this,"sizes",value)}get src(){return stringAttribute.get(this,"src")}set src(value){stringAttribute.set(this,"src",value)}get srcset(){return stringAttribute.get(this,"srcset")}set srcset(value){stringAttribute.set(this,"srcset",value)}get title(){return stringAttribute.get(this,"title")}set title(value){stringAttribute.set(this,"title",value)}get width(){return numericAttribute.get(this,"width")}set width(value){numericAttribute.set(this,"width",value)}get height(){return numericAttribute.get(this,"height")}set height(value){numericAttribute.set(this,"height",value)}}registerHTMLClass(tagName15,HTMLImageElement);class HTMLPreElement extends HTMLElement{constructor(ownerDocument,localName="pre"){super(ownerDocument,localName)}}class HTMLUListElement extends HTMLElement{constructor(ownerDocument,localName="ul"){super(ownerDocument,localName)}}var tagName16="meta";class HTMLMetaElement extends HTMLElement{constructor(ownerDocument,localName=tagName16){super(ownerDocument,localName)}get name(){return stringAttribute.get(this,"name")}set name(value){stringAttribute.set(this,"name",value)}get httpEquiv(){return stringAttribute.get(this,"http-equiv")}set httpEquiv(value){stringAttribute.set(this,"http-equiv",value)}get content(){return stringAttribute.get(this,"content")}set content(value){stringAttribute.set(this,"content",value)}get charset(){return stringAttribute.get(this,"charset")}set charset(value){stringAttribute.set(this,"charset",value)}get media(){return stringAttribute.get(this,"media")}set media(value){stringAttribute.set(this,"media",value)}}registerHTMLClass(tagName16,HTMLMetaElement);class HTMLPictureElement extends HTMLElement{constructor(ownerDocument,localName="picture"){super(ownerDocument,localName)}}class HTMLAreaElement extends HTMLElement{constructor(ownerDocument,localName="area"){super(ownerDocument,localName)}}class HTMLOListElement extends HTMLElement{constructor(ownerDocument,localName="ol"){super(ownerDocument,localName)}}class HTMLTableCaptionElement extends HTMLElement{constructor(ownerDocument,localName="caption"){super(ownerDocument,localName)}}var tagName17="a";class HTMLAnchorElement extends HTMLElement{constructor(ownerDocument,localName=tagName17){super(ownerDocument,localName)}get href(){return encodeURI(decodeURI(stringAttribute.get(this,"href"))).trim()}set href(value){stringAttribute.set(this,"href",decodeURI(value))}get download(){return encodeURI(decodeURI(stringAttribute.get(this,"download")))}set download(value){stringAttribute.set(this,"download",decodeURI(value))}get target(){return stringAttribute.get(this,"target")}set target(value){stringAttribute.set(this,"target",value)}get type(){return stringAttribute.get(this,"type")}set type(value){stringAttribute.set(this,"type",value)}get rel(){return stringAttribute.get(this,"rel")}set rel(value){stringAttribute.set(this,"rel",value)}}registerHTMLClass(tagName17,HTMLAnchorElement);class HTMLLabelElement extends HTMLElement{constructor(ownerDocument,localName="label"){super(ownerDocument,localName)}}class HTMLUnknownElement extends HTMLElement{constructor(ownerDocument,localName="unknown"){super(ownerDocument,localName)}}class HTMLModElement extends HTMLElement{constructor(ownerDocument,localName="mod"){super(ownerDocument,localName)}}class HTMLDetailsElement extends HTMLElement{constructor(ownerDocument,localName="details"){super(ownerDocument,localName)}}var tagName18="source";class HTMLSourceElement extends HTMLElement{constructor(ownerDocument,localName=tagName18){super(ownerDocument,localName)}get src(){return stringAttribute.get(this,"src")}set src(value){stringAttribute.set(this,"src",value)}get srcset(){return stringAttribute.get(this,"srcset")}set srcset(value){stringAttribute.set(this,"srcset",value)}get sizes(){return stringAttribute.get(this,"sizes")}set sizes(value){stringAttribute.set(this,"sizes",value)}get type(){return stringAttribute.get(this,"type")}set type(value){stringAttribute.set(this,"type",value)}}registerHTMLClass(tagName18,HTMLSourceElement);class HTMLTrackElement extends HTMLElement{constructor(ownerDocument,localName="track"){super(ownerDocument,localName)}}class HTMLMarqueeElement extends HTMLElement{constructor(ownerDocument,localName="marquee"){super(ownerDocument,localName)}}var HTMLClasses={HTMLElement,HTMLTemplateElement,HTMLHtmlElement,HTMLScriptElement,HTMLFrameElement,HTMLIFrameElement,HTMLObjectElement,HTMLHeadElement,HTMLBodyElement,HTMLStyleElement,HTMLTimeElement,HTMLFieldSetElement,HTMLEmbedElement,HTMLHRElement,HTMLProgressElement,HTMLParagraphElement,HTMLTableElement,HTMLFrameSetElement,HTMLLIElement,HTMLBaseElement,HTMLDataListElement,HTMLInputElement,HTMLParamElement,HTMLMediaElement,HTMLAudioElement,HTMLHeadingElement,HTMLDirectoryElement,HTMLQuoteElement,HTMLCanvasElement,HTMLLegendElement,HTMLOptionElement,HTMLSpanElement,HTMLMeterElement,HTMLVideoElement,HTMLTableCellElement,HTMLTitleElement,HTMLOutputElement,HTMLTableRowElement,HTMLDataElement,HTMLMenuElement,HTMLSelectElement,HTMLBRElement,HTMLButtonElement,HTMLMapElement,HTMLOptGroupElement,HTMLDListElement,HTMLTextAreaElement,HTMLFontElement,HTMLDivElement,HTMLLinkElement,HTMLSlotElement,HTMLFormElement,HTMLImageElement,HTMLPreElement,HTMLUListElement,HTMLMetaElement,HTMLPictureElement,HTMLAreaElement,HTMLOListElement,HTMLTableCaptionElement,HTMLAnchorElement,HTMLLabelElement,HTMLUnknownElement,HTMLModElement,HTMLDetailsElement,HTMLSourceElement,HTMLTrackElement,HTMLMarqueeElement};var voidElements3={test:()=>!0},Mime={"text/html":{docType:"<!DOCTYPE html>",ignoreCase:!0,voidElements:/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i},"image/svg+xml":{docType:'<?xml version="1.0" encoding="utf-8"?>',ignoreCase:!1,voidElements:voidElements3},"text/xml":{docType:'<?xml version="1.0" encoding="utf-8"?>',ignoreCase:!1,voidElements:voidElements3},"application/xml":{docType:'<?xml version="1.0" encoding="utf-8"?>',ignoreCase:!1,voidElements:voidElements3},"application/xhtml+xml":{docType:'<?xml version="1.0" encoding="utf-8"?>',ignoreCase:!1,voidElements:voidElements3}};class CustomEvent extends GlobalEvent{constructor(type,eventInitDict={}){super(type,eventInitDict);this.detail=eventInitDict.detail}}class InputEvent extends GlobalEvent{constructor(type,inputEventInit={}){super(type,inputEventInit);this.inputType=inputEventInit.inputType,this.data=inputEventInit.data,this.dataTransfer=inputEventInit.dataTransfer,this.isComposing=inputEventInit.isComposing||!1,this.ranges=inputEventInit.ranges}}var ImageClass=(ownerDocument)=>class extends HTMLImageElement{constructor(width,height){super(ownerDocument);switch(arguments.length){case 1:this.height=width,this.width=width;break;case 2:this.height=height,this.width=width;break}}};var deleteContents=({[START]:start,[END]:end},fragment=null)=>{setAdjacent(start[PREV],end[NEXT]);do{let after=getEnd(start),next=after===end?after:after[NEXT];if(fragment)fragment.insertBefore(start,fragment[END]);else start.remove();start=next}while(start!==end)};class Range{constructor(){this[START]=null,this[END]=null,this.commonAncestorContainer=null}insertNode(newNode){this[END].parentNode.insertBefore(newNode,this[START])}selectNode(node){this[START]=node,this[END]=getEnd(node)}selectNodeContents(node){this.selectNode(node),this.commonAncestorContainer=node}surroundContents(parentNode){parentNode.replaceChildren(this.extractContents())}setStartBefore(node){this[START]=node}setStartAfter(node){this[START]=node.nextSibling}setEndBefore(node){this[END]=getEnd(node.previousSibling)}setEndAfter(node){this[END]=getEnd(node)}cloneContents(){let{[START]:start,[END]:end}=this,fragment=start.ownerDocument.createDocumentFragment();while(start!==end)if(fragment.insertBefore(start.cloneNode(!0),fragment[END]),start=getEnd(start),start!==end)start=start[NEXT];return fragment}deleteContents(){deleteContents(this)}extractContents(){let fragment=this[START].ownerDocument.createDocumentFragment();return deleteContents(this,fragment),fragment}createContextualFragment(html){let{commonAncestorContainer:doc}=this,isSVG="ownerSVGElement"in doc,document=isSVG?doc.ownerDocument:doc,content=htmlToFragment(document,html);if(isSVG){let childNodes=[...content.childNodes];content=document.createDocumentFragment(),Object.setPrototypeOf(content,SVGElement.prototype),content.ownerSVGElement=document;for(let child of childNodes)Object.setPrototypeOf(child,SVGElement.prototype),child.ownerSVGElement=document,content.appendChild(child)}else this.selectNode(content);return content}cloneRange(){let range=new Range;return range[START]=this[START],range[END]=this[END],range}}var isOK=({nodeType},mask)=>{switch(nodeType){case ELEMENT_NODE:return mask&SHOW_ELEMENT;case TEXT_NODE:return mask&SHOW_TEXT;case COMMENT_NODE:return mask&SHOW_COMMENT;case CDATA_SECTION_NODE:return mask&SHOW_CDATA_SECTION}return 0};class TreeWalker{constructor(root,whatToShow=SHOW_ALL){this.root=root,this.currentNode=root,this.whatToShow=whatToShow;let{[NEXT]:next,[END]:end}=root;if(root.nodeType===DOCUMENT_NODE){let{documentElement}=root;next=documentElement,end=documentElement[END]}let nodes=[];while(next&&next!==end){if(isOK(next,whatToShow))nodes.push(next);next=next[NEXT]}this[PRIVATE]={i:0,nodes}}nextNode(){let $=this[PRIVATE];return this.currentNode=$.i<$.nodes.length?$.nodes[$.i++]:null,this.currentNode}}var query=(method,ownerDocument,selectors)=>{let{[NEXT]:next,[END]:end}=ownerDocument;return method.call({ownerDocument,[NEXT]:next,[END]:end},selectors)},globalExports=assign({},Facades,HTMLClasses,{CustomEvent,Event:GlobalEvent,EventTarget:DOMEventTarget,InputEvent,NamedNodeMap,NodeList}),window2=new WeakMap;class Document2 extends NonElementParentNode{constructor(type){super(null,"#document",DOCUMENT_NODE);this[CUSTOM_ELEMENTS]={active:!1,registry:null},this[MUTATION_OBSERVER]={active:!1,class:null},this[MIME]=Mime[type],this[DOCTYPE]=null,this[DOM_PARSER]=null,this[GLOBALS]=null,this[IMAGE]=null,this[UPGRADE]=null}get defaultView(){if(!window2.has(this))window2.set(this,new Proxy(globalThis,{set:(target,name,value)=>{switch(name){case"addEventListener":case"removeEventListener":case"dispatchEvent":this[EVENT_TARGET][name]=value;break;default:target[name]=value;break}return!0},get:(globalThis2,name)=>{switch(name){case"addEventListener":case"removeEventListener":case"dispatchEvent":if(!this[EVENT_TARGET]){let et=this[EVENT_TARGET]=new DOMEventTarget;et.dispatchEvent=et.dispatchEvent.bind(et),et.addEventListener=et.addEventListener.bind(et),et.removeEventListener=et.removeEventListener.bind(et)}return this[EVENT_TARGET][name];case"document":return this;case"navigator":return{userAgent:"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"};case"window":return window2.get(this);case"customElements":if(!this[CUSTOM_ELEMENTS].registry)this[CUSTOM_ELEMENTS]=new CustomElementRegistry(this);return this[CUSTOM_ELEMENTS];case"performance":return globalThis2.performance;case"DOMParser":return this[DOM_PARSER];case"Image":if(!this[IMAGE])this[IMAGE]=ImageClass(this);return this[IMAGE];case"MutationObserver":if(!this[MUTATION_OBSERVER].class)this[MUTATION_OBSERVER]=new MutationObserverClass(this);return this[MUTATION_OBSERVER].class}return this[GLOBALS]&&this[GLOBALS][name]||globalExports[name]||globalThis2[name]}}));return window2.get(this)}get doctype(){let docType=this[DOCTYPE];if(docType)return docType;let{firstChild}=this;if(firstChild&&firstChild.nodeType===DOCUMENT_TYPE_NODE)return this[DOCTYPE]=firstChild;return null}set doctype(value){if(/^([a-z:]+)(\s+system|\s+public(\s+"([^"]+)")?)?(\s+"([^"]+)")?/i.test(value)){let{$1:name,$4:publicId,$6:systemId}=RegExp;this[DOCTYPE]=new DocumentType(this,name,publicId,systemId),knownSiblings(this,this[DOCTYPE],this[NEXT])}}get documentElement(){return this.firstElementChild}get isConnected(){return!0}_getParent(){return this[EVENT_TARGET]}createAttribute(name){return new Attr(this,name)}createCDATASection(data){return new CDATASection(this,data)}createComment(textContent){return new Comment3(this,textContent)}createDocumentFragment(){return new DocumentFragment(this)}createDocumentType(name,publicId,systemId){return new DocumentType(this,name,publicId,systemId)}createElement(localName){return new Element2(this,localName)}createRange(){let range=new Range;return range.commonAncestorContainer=this,range}createTextNode(textContent){return new Text6(this,textContent)}createTreeWalker(root,whatToShow=-1){return new TreeWalker(root,whatToShow)}createNodeIterator(root,whatToShow=-1){return this.createTreeWalker(root,whatToShow)}createEvent(name){let event=create(name==="Event"?new GlobalEvent(""):new CustomEvent(""));return event.initEvent=event.initCustomEvent=(type,canBubble=!1,cancelable=!1,detail)=>{event.bubbles=!!canBubble,defineProperties(event,{type:{value:type},canBubble:{value:canBubble},cancelable:{value:cancelable},detail:{value:detail}})},event}cloneNode(deep=!1){let{constructor,[CUSTOM_ELEMENTS]:customElements,[DOCTYPE]:doctype}=this,document=new constructor;if(document[CUSTOM_ELEMENTS]=customElements,deep){let end=document[END],{childNodes}=this;for(let{length}=childNodes,i=0;i<length;i++)document.insertBefore(childNodes[i].cloneNode(!0),end);if(doctype)document[DOCTYPE]=childNodes[0]}return document}importNode(externalNode){let deep=1<arguments.length&&!!arguments[1],node=externalNode.cloneNode(deep),{[CUSTOM_ELEMENTS]:customElements}=this,{active}=customElements,upgrade=(element)=>{let{ownerDocument,nodeType}=element;if(element.ownerDocument=this,active&&ownerDocument!==this&&nodeType===ELEMENT_NODE)customElements.upgrade(element)};if(upgrade(node),deep)switch(node.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:{let{[NEXT]:next,[END]:end}=node;while(next!==end){if(next.nodeType===ELEMENT_NODE)upgrade(next);next=next[NEXT]}break}}return node}toString(){return this.childNodes.join("")}querySelector(selectors){return query(super.querySelector,this,selectors)}querySelectorAll(selectors){return query(super.querySelectorAll,this,selectors)}getElementsByTagNameNS(_,name){return this.getElementsByTagName(name)}createAttributeNS(_,name){return this.createAttribute(name)}createElementNS(nsp,localName,options){return nsp===SVG_NAMESPACE?new SVGElement(this,localName,null):this.createElement(localName,options)}}setPrototypeOf(globalExports.Document=function(){illegalConstructor()},Document2).prototype=Document2.prototype;var createHTMLElement=(ownerDocument,builtin,localName,options)=>{if(!builtin&&htmlClasses.has(localName))return new(htmlClasses.get(localName))(ownerDocument,localName);let{[CUSTOM_ELEMENTS]:{active,registry}}=ownerDocument;if(active){let ce=builtin?options.is:localName;if(registry.has(ce)){let{Class}=registry.get(ce),element=new Class(ownerDocument,localName);return customElements.set(element,{connected:!1}),element}}return new HTMLElement(ownerDocument,localName)};class HTMLDocument extends Document2{constructor(){super("text/html")}get all(){let nodeList=new NodeList,{[NEXT]:next,[END]:end}=this;while(next!==end){switch(next.nodeType){case ELEMENT_NODE:nodeList.push(next);break}next=next[NEXT]}return nodeList}get head(){let{documentElement}=this,{firstElementChild}=documentElement;if(!firstElementChild||firstElementChild.tagName!=="HEAD")firstElementChild=this.createElement("head"),documentElement.prepend(firstElementChild);return firstElementChild}get body(){let{head}=this,{nextElementSibling}=head;if(!nextElementSibling||nextElementSibling.tagName!=="BODY")nextElementSibling=this.createElement("body"),head.after(nextElementSibling);return nextElementSibling}get title(){let{head}=this;return head.getElementsByTagName("title").at(0)?.textContent||""}set title(textContent){let{head}=this,title=head.getElementsByTagName("title").at(0);if(title)title.textContent=textContent;else head.insertBefore(this.createElement("title"),head.firstChild).textContent=textContent}createElement(localName,options){let builtin=!!(options&&options.is),element=createHTMLElement(this,builtin,localName,options);if(builtin)element.setAttribute("is",options.is);return element}}class SVGDocument extends Document2{constructor(){super("image/svg+xml")}toString(){return this[MIME].docType+super.toString()}}class XMLDocument extends Document2{constructor(){super("text/xml")}toString(){return this[MIME].docType+super.toString()}}class DOMParser{parseFromString(markupLanguage,mimeType,globals=null){let isHTML=!1,document;if(mimeType==="text/html")isHTML=!0,document=new HTMLDocument;else if(mimeType==="image/svg+xml")document=new SVGDocument;else document=new XMLDocument;if(document[DOM_PARSER]=DOMParser,globals)document[GLOBALS]=globals;if(isHTML&&markupLanguage==="...")markupLanguage="<!doctype html><html><head></head><body></body></html>";return markupLanguage?parseFromString(document,isHTML,markupLanguage):document}}var{parse:parse3}=JSON;var parseHTML=(html,globals=null)=>new DOMParser().parseFromString(html,"text/html",globals).defaultView;function Document3(){illegalConstructor()}setPrototypeOf(Document3,Document2).prototype=Document2.prototype;import{readdir,readFile,stat}from"node:fs/promises";import{join,relative,resolve}from"node:path";import{isNotationLanguage,renderBlock}from"./index.js";import{parseTabSource}from"./tab/index.js";import{lookupGuitarVoicing}from"./voicings/index.js";var QUOTE2=/^[ \t]{0,3}>[ \t]?/,OPENING=/^(`{3,}|~{3,})(.*)$/,LIST_MARKER=/^(?:[-*+]|\d{1,9}[.)])[ \t]+/;function unquote(line,depth){let rest=line;for(let i=0;i<depth;i++){let m=QUOTE2.exec(rest);if(!m)return null;rest=rest.slice(m[0].length)}return rest}var dedent=(line,indent)=>{let i=0;while(i<indent&&(line[i]===" "||line[i]==="\t"))i++;return line.slice(i)},columns=(lead)=>[...lead].reduce((n,c)=>n+(c==="\t"?4-n%4:1),0);function opensComment(line){if((line.split("%%").length-1)%2===1)return!0;let html=line.lastIndexOf("<!--");return html>=0&&!line.includes("-->",html+4)}var commentEnd=(line)=>(line.split("%%").length-1)%2===1?"%%":"-->";function parseMarkdown(text){let lines=text.replace(/^\uFEFF/,"").split(/\r\n|\r|\n/),i=0,frontMatter=null;if(lines[0]?.trimEnd()==="---"){let end=lines.findIndex((l,n)=>n>0&&/^(?:---|\.\.\.)\s*$/.test(l));if(end>0)frontMatter=lines.slice(1,end).join(`
|
|
52
52
|
`),i=end+1}let blocks=[],comment=null,inList=!1;for(;i<lines.length;i++){let line=lines[i];if(comment){let end=line.indexOf(comment);if(end<0)continue;if(comment=null,opensComment(line.slice(end+2)))comment=commentEnd(line.slice(end+2));continue}let rest=line,depth=0;for(let m=QUOTE2.exec(rest);m;m=QUOTE2.exec(rest))rest=rest.slice(m[0].length),depth++;let spaces=/^[ \t]*/.exec(rest)[0].length,marker=LIST_MARKER.exec(rest.slice(spaces))?.[0].length??0,indent=spaces+marker;if(marker)inList=!0;else if(rest.trim()&&columns(rest.slice(0,spaces))===0)inList=!1;let open=OPENING.exec(rest.slice(indent));if(!open){if(opensComment(rest))comment=commentEnd(rest);continue}if(!marker&&!inList&&columns(rest.slice(0,spaces))>3)continue;let fence=open[1],info=open[2];if(fence[0]==="`"&&info.includes("`"))continue;let body=[],start=i;for(i++;i<lines.length;i++){let inner=unquote(lines[i],depth);if(inner===null){i--;break}let close=/^[ \t]*(`{3,}|~{3,})[ \t]*$/.exec(inner);if(close&&close[1][0]===fence[0]&&close[1].length>=fence.length)break;body.push(dedent(inner,indent))}blocks.push({language:info.trim().split(/\s+/)[0]??"",line:start+1,source:body.join(`
|
|
53
|
-
`)})}return{frontMatter,blocks}}import{chordNoteSet,midiOf,nameOf,noteOf}from"./index.js";var classes=(el)=>(el.getAttribute("class")??"").split(/\s+/),has=(el,cls)=>classes(el).includes(cls),text=(el)=>el?.textContent?.trim()||null,int=(value)=>value===null?null:Number(value),marksOf=(el)=>classes(el).flatMap((c)=>c==="mn-char"?["characteristic"]:c==="mn-diff"?["different"]:c==="mn-tone"?["chord tone"]:c==="mn-passing"?["passing"]:[]);function spelled(name,midi){let octave=Math.floor(midi/12)-1;for(let o of[octave,octave-1,octave+1])if(midiOf(`${name}${o}`)===midi)return`${name}${o}`;return noteOf(midi)}var labelAfter=(el,cls)=>{let next=el.nextElementSibling;return next&&has(next,cls)?text(next):null};function capoOf(svg){let capo=int(svg.getAttribute("data-mn-capo"));if(!capo)return{};return{capo,fretsFrom:svg.getAttribute("data-mn-frets-from")==="nut"?"nut":"capo"}}function guitarChord(svg){let chord=svg.getAttribute("data-mn-chord"),sounds=svg.getAttribute("data-mn-sounds"),set=sounds?chordNoteSet(sounds):chord?chordNoteSet(chord):null,strings=[...svg.querySelectorAll("[data-mn-string]")].map((el)=>{let fret=int(el.getAttribute("data-mn-fret")),midi=int(el.getAttribute("data-midi")),name=midi===null?null:set?.members.find((m)=>m.chroma===midi%12)?.name??nameOf(midi,set?.preferFlats);return{string:Number(el.getAttribute("data-mn-string")),fret,note:name!==null&&midi!==null?spelled(name,midi):null,label:fret?labelAfter(el,"mn-dot-text"):null,root:has(el,"mn-root"),mark:has(el,"mn-anchor")?"anchor":has(el,"mn-guide")?"guide":null}}),base=parseInt(text(svg.querySelector(".mn-base-fret"))??"1",10),rows=svg.querySelectorAll("line.mn-fret, line.mn-nut").length-1,frets=strings.map((s)=>s.fret===null?"x":String(s.fret));return{type:"guitar-chord",title:text(svg.querySelector(".mn-title")),chord,frets:frets.join(frets.some((f)=>f.length>1)?"-":""),fretRange:[base,base+rows-1],strings,...capoOf(svg),...sounds?{sounds}:{}}}function fretboard(svg){let range=(svg.getAttribute("data-mn-frets")??"0-0").split("-").map(Number),tuning=[...svg.querySelectorAll(".mn-string-name")].map((el)=>text(el)??"?"),dots=[...svg.querySelectorAll("circle[data-mn-string]")].map((el)=>({string:Number(el.getAttribute("data-mn-string")),fret:Number(el.getAttribute("data-mn-fret")),note:spelled(el.getAttribute("data-mn-note")??"",Number(el.getAttribute("data-midi"))),label:labelAfter(el,"mn-dot-text"),root:has(el,"mn-root"),marks:marksOf(el)})).sort((a,b)=>b.string-a.string||a.fret-b.fret),ghosts=[...svg.querySelectorAll("circle[data-mn-ghost-string]")].map((el)=>({string:Number(el.getAttribute("data-mn-ghost-string")),fret:Number(el.getAttribute("data-mn-fret")),note:spelled(el.getAttribute("data-mn-note")??"",Number(el.getAttribute("data-mn-pitch")))})).sort((a,b)=>b.string-a.string||a.fret-b.fret);return{type:"fretboard",title:text(svg.querySelector(".mn-title")),notes:svg.getAttribute("data-mn-set"),fretRange:[range[0]??0,range[1]??0],tuning:tuning.reverse(),dots,ghosts,...capoOf(svg)}}function keyboard(svg){let all=[...svg.querySelectorAll("rect[data-midi]")],midis=all.map((el)=>Number(el.getAttribute("data-midi"))),fingers=new Map([...svg.querySelectorAll(".mn-key-finger")].map((el)=>[Number(el.getAttribute("data-mn-key")),text(el)])),keys=all.filter((el)=>has(el,"mn-on")).map((el)=>{let midi=Number(el.getAttribute("data-midi"));return{midi,note:spelled(el.getAttribute("data-mn-note")??"",midi),label:labelAfter(el,"mn-key-label"),finger:fingers.get(midi)??null,root:has(el,"mn-root"),marks:marksOf(el),...has(el,"mn-hand-left")?{hand:"left"}:has(el,"mn-hand-right")?{hand:"right"}:{}}}).sort((a,b)=>a.midi-b.midi).map(({midi:_,...key})=>key);return{type:"keyboard",title:text(svg.querySelector(".mn-title")),chord:svg.getAttribute("data-mn-chord"),notes:svg.getAttribute("data-mn-set"),keyRange:[noteOf(Math.min(...midis)),noteOf(Math.max(...midis))],keys,ghosts:all.filter((el)=>has(el,"mn-ghost")).map((el)=>{let midi=Number(el.getAttribute("data-midi"));return spelled(el.getAttribute("data-mn-note")??"",midi)})}}function chart(el){let chords=[];for(let c of el.querySelectorAll(".mn-chord")){let name=text(c);if(name&&!chords.includes(name))chords.push(name)}return{type:"chart",title:text(el.querySelector(".mn-chart-title")),chords,sections:[...el.querySelectorAll(".mn-section-label")].map((s)=>text(s)??"")}}function strum(svg){let tempo=svg.getAttribute("data-mn-tempo");return{type:"strum",title:text(svg.querySelector(".mn-title")),pattern:svg.getAttribute("data-mn-strum")??"",time:svg.getAttribute("data-mn-time")??"",subdivision:svg.getAttribute("data-mn-subdivision")??"",tempo:tempo===null?null:Number(tempo),chords:[...svg.querySelectorAll("[data-mn-beat][data-mn-chord]")].map((el)=>({beat:Number(el.getAttribute("data-mn-beat")),chord:el.getAttribute("data-mn-chord")??""}))}}function describeBlock(el){return[...el.querySelectorAll("svg.mn-svg, .mn-chart, .mn-cell.mn-error")].map((d)=>{if(has(d,"mn-error"))return{type:"error",message:(text(d.querySelector(".mn-error-message"))??"").replace(/^[a-z]+, /,"")};if(has(d,"mn-chart"))return chart(d);if(has(d,"mn-circle"))return{type:"circle",key:d.getAttribute("data-mn-set"),chords:[...d.querySelectorAll(".mn-circle-chip")].map((c)=>`${text(c.querySelector("title"))?.replace(": "," ")??""}`)};if(has(d,"mn-fretboard"))return fretboard(d);if(has(d,"mn-keyboard"))return keyboard(d);if(has(d,"mn-strum"))return strum(d);return guitarChord(d)})}var quoted=(s)=>s?`"${s}"`:null,listed=(parts)=>parts.filter(Boolean).join(", "),extra=(label,root,more=[])=>[label!==null?`"${label}"`:null,root?"root":null,...more].filter(Boolean).join(" "),capoText=(capo,from)=>`capo ${capo}${from==="nut"?", frets from the nut":""}`;function formatDiagram(d,n){let head=`${n}. `,pad=" ".repeat(head.length);switch(d.type){case"error":return[`${head}error: ${d.message}`];case"circle":return[`${head}${listed(["circle of fifths",d.key,`chords ${d.chords.join(", ")}`])}`];case"strum":return[`${head}${listed(["strumming pattern",quoted(d.title),d.time,d.subdivision,d.tempo!==null&&`tempo ${d.tempo}`])}`,`${pad}${d.pattern}`];case"chart":return[`${head}${listed(["chart",quoted(d.title),d.sections.length>0&&`sections ${d.sections.join(", ")}`,`chords ${d.chords.join(" ")||"none"}`])}`];case"guitar-chord":{let strings=d.strings.map((s)=>`${s.string} ${s.fret===null?"x":[s.fret,s.note,extra(s.label,s.root,s.mark?[s.mark]:[])].filter((p)=>p!==null&&p!=="").join(" ")}`);return[`${head}${listed(["chord diagram",quoted(d.title),d.chord&&`chord ${d.chord}`,d.capo!==void 0&&capoText(d.capo,d.fretsFrom),d.sounds!==void 0&&`sounds ${d.sounds}`,`frets ${d.fretRange[0]}-${d.fretRange[1]}`,d.frets])}`,`${pad}strings: ${strings.join(" | ")}`]}case"fretboard":{let lines=[`${head}${listed(["fretboard",quoted(d.title),d.notes,d.capo!==void 0&&capoText(d.capo,d.fretsFrom),`frets ${d.fretRange[0]}-${d.fretRange[1]}`,`tuning ${d.tuning.join(" ")}`])}`],count=d.tuning.length;for(let string=count;string>=1;string--){let dots=d.dots.filter((dot)=>dot.string===string);if(!dots.length)continue;let name=d.tuning[count-string]??"?";lines.push(`${pad}string ${string} (${name}): ${dots.map((dot)=>[dot.fret,dot.note,extra(dot.label,dot.root,dot.marks)].filter((p)=>p!=="").join(" ")).join(", ")}`)}if(d.ghosts.length)lines.push(`${pad}ghosts (compared scale): ${d.ghosts.map((g)=>`string ${g.string} fret ${g.fret} ${g.note}`).join(", ")}`);return lines}case"keyboard":return[`${head}${listed(["keyboard",quoted(d.title),d.chord&&`chord ${d.chord}`,d.notes,`keys ${d.keyRange[0]}-${d.keyRange[1]}`])}`,`${pad}keys: ${d.keys.map((k)=>[k.note,extra(k.label,k.root,[...k.finger?[`finger ${k.finger}`]:[],...k.hand?[`${k.hand} hand`]:[],...k.marks])].filter(Boolean).join(" ")).join(", ")||"none"}`,...d.ghosts.length?[`${pad}ghosts (compared scale): ${d.ghosts.join(", ")}`]:[]]}}var DIAGRAM_LANGUAGES=["chord","keyboard","fretboard"],oneLine=(s)=>s.split(/[\r\n]+/).map((line)=>line.trim()).filter(Boolean).join(" ");function checkNote(file,text,doc){let note=parseMarkdown(text),reports=[];for(let block of note.blocks){let{language,line,source}=block,report=(status,message,diagrams=[])=>reports.push({file,line,language,status,message,diagrams}),isTab=language==="tab"||language==="score";if((isTab||isNotationLanguage(language))&&!source.trim()){if(note.frontMatter!==null&&DIAGRAM_LANGUAGES.includes(language))report("skipped","empty block: draws from the note's properties, not checked");else report("empty","empty block: draws nothing");continue}if(isTab){try{parseTabSource(language,source),report("skipped","alphaTex is not checked (it needs alphaTab)")}catch(e){report("error",oneLine(e instanceof Error?e.message:String(e)))}continue}if(!isNotationLanguage(language))continue;let host=doc.createElement("div"),result=renderBlock(language,source,host,{voicings:lookupGuitarVoicing}),diagrams=describeBlock(result.el);if(result.ok)report("ok",null,diagrams);else report("error",oneLine(result.error??"error"),diagrams);result.destroy()}return reports}function summarize(files,reports){let count=(status)=>reports.filter((r)=>r.status===status).length;return{files,blocks:reports.length,ok:count("ok"),errors:count("error"),skipped:count("skipped"),empty:count("empty")}}var formatError=(r)=>`${r.file}:${r.line}: ${r.language}: ${r.message}`;function formatReport(r){let where=`${r.file}:${r.line}: ${r.language}`;return r.status==="ok"?`${where}: ok`:`${where}: ${r.status}: ${r.message??""}`}function formatDescription(r){return[formatReport(r),...r.diagrams.flatMap((d,i)=>formatDiagram(d,i+1)).map((l)=>` ${l}`)]}var GLOB=/[*?[{]/;function globToRegExp(pattern){let out="";for(let i=0;i<pattern.length;i++){let c=pattern[i];if(c==="*"&&pattern[i+1]==="*"){let slash=pattern[i+2]==="/";out+=slash?"(?:.*/)?":".*",i+=slash?2:1}else if(c==="*")out+="[^/]*";else if(c==="?")out+="[^/]";else if(c==="{"){let end=pattern.indexOf("}",i);if(end<0)out+="\\{";else out+=`(?:${pattern.slice(i+1,end).split(",").map((p)=>p.replace(/[.+^$()|\\]/g,"\\$&").replace(/\*/g,"[^/]*")).join("|")})`,i=end}else if(c==="["){let end=pattern.indexOf("]",i+1);if(end<0)out+="\\[";else out+=`[${pattern.slice(i+1,end).replace(/^!/,"^").replace(/\\/g,"\\\\")}]`,i=end}else out+=c.replace(/[.+^$()|\\\]}]/g,"\\$&")}return new RegExp(`^${out}$`)}async function walk(dir){let entries=await readdir(dir,{withFileTypes:!0}),files=[];for(let entry of entries.sort((a,b)=>a.name.localeCompare(b.name))){let path=join(dir,entry.name);if(entry.isDirectory()){if(!entry.name.startsWith(".")&&entry.name!=="node_modules")files.push(...await walk(path))}else if(entry.isFile())files.push(path)}return files}var isMarkdown=(path)=>/\.(md|markdown)$/i.test(path);async function expand(arg,cwd){let pattern=arg.replace(/\\/g,"/"),path=resolve(cwd,arg),info=await stat(path).catch(()=>null);if(info)return info.isDirectory()?(await walk(path)).filter(isMarkdown):[path];if(!GLOB.test(pattern))throw Error(`${arg}: no such file or folder`);let segments=pattern.split("/"),first=segments.findIndex((s)=>GLOB.test(s)),base=resolve(cwd,segments.slice(0,first).join("/")||"."),matcher=globToRegExp(segments.slice(first).join("/"));if(!(await stat(base).catch(()=>null))?.isDirectory())return[];return(await walk(base)).filter((f)=>matcher.test(relative(base,f).replace(/\\/g,"/")))}var USAGE=`Usage: music-notation check [options] <files, folders or globs...>
|
|
53
|
+
`)})}return{frontMatter,blocks}}import{chordNoteSet,midiOf,nameOf,noteOf}from"./index.js";var classes=(el)=>(el.getAttribute("class")??"").split(/\s+/),has=(el,cls)=>classes(el).includes(cls),text=(el)=>el?.textContent?.trim()||null,int=(value)=>value===null?null:Number(value),marksOf=(el)=>classes(el).flatMap((c)=>c==="mn-char"?["characteristic"]:c==="mn-diff"?["different"]:c==="mn-tone"?["chord tone"]:c==="mn-passing"?["passing"]:[]);function spelled(name,midi){let octave=Math.floor(midi/12)-1;for(let o of[octave,octave-1,octave+1])if(midiOf(`${name}${o}`)===midi)return`${name}${o}`;return noteOf(midi)}var labelAfter=(el,cls)=>{let next=el.nextElementSibling;return next&&has(next,cls)?text(next):null};function capoOf(svg){let capo=int(svg.getAttribute("data-mn-capo"));if(!capo)return{};return{capo,fretsFrom:svg.getAttribute("data-mn-frets-from")==="nut"?"nut":"capo"}}function guitarChord(svg){let chord=svg.getAttribute("data-mn-chord"),sounds=svg.getAttribute("data-mn-sounds"),set=sounds?chordNoteSet(sounds):chord?chordNoteSet(chord):null,strings=[...svg.querySelectorAll("[data-mn-string]")].map((el)=>{let fret=int(el.getAttribute("data-mn-fret")),midi=int(el.getAttribute("data-midi")),name=midi===null?null:set?.members.find((m)=>m.chroma===midi%12)?.name??nameOf(midi,set?.preferFlats);return{string:Number(el.getAttribute("data-mn-string")),fret,note:name!==null&&midi!==null?spelled(name,midi):null,label:fret?labelAfter(el,"mn-dot-text"):null,root:has(el,"mn-root"),mark:has(el,"mn-anchor")?"anchor":has(el,"mn-guide")?"guide":null}}),base=parseInt(text(svg.querySelector(".mn-base-fret"))??"1",10),rows=svg.querySelectorAll("line.mn-fret, line.mn-nut").length-1,frets=strings.map((s)=>s.fret===null?"x":String(s.fret)),barres=[...svg.querySelectorAll(".mn-barre")].map((el)=>({finger:el.getAttribute("data-mn-finger")??"",fret:Number(el.getAttribute("data-mn-fret")),from:Number(el.getAttribute("data-mn-from")),to:Number(el.getAttribute("data-mn-to"))}));return{type:"guitar-chord",title:text(svg.querySelector(".mn-title")),chord,frets:frets.join(frets.some((f)=>f.length>1)?"-":""),fretRange:[base,base+rows-1],strings,...capoOf(svg),...sounds?{sounds}:{},...barres.length?{barres}:{}}}function fretboard(svg){let range=(svg.getAttribute("data-mn-frets")??"0-0").split("-").map(Number),tuning=[...svg.querySelectorAll(".mn-string-name")].map((el)=>text(el)??"?"),dots=[...svg.querySelectorAll("circle[data-mn-string]")].map((el)=>({string:Number(el.getAttribute("data-mn-string")),fret:Number(el.getAttribute("data-mn-fret")),note:spelled(el.getAttribute("data-mn-note")??"",Number(el.getAttribute("data-midi"))),label:labelAfter(el,"mn-dot-text"),root:has(el,"mn-root"),marks:marksOf(el)})).sort((a,b)=>b.string-a.string||a.fret-b.fret),ghosts=[...svg.querySelectorAll("circle[data-mn-ghost-string]")].map((el)=>({string:Number(el.getAttribute("data-mn-ghost-string")),fret:Number(el.getAttribute("data-mn-fret")),note:spelled(el.getAttribute("data-mn-note")??"",Number(el.getAttribute("data-mn-pitch")))})).sort((a,b)=>b.string-a.string||a.fret-b.fret);return{type:"fretboard",title:text(svg.querySelector(".mn-title")),notes:svg.getAttribute("data-mn-set"),fretRange:[range[0]??0,range[1]??0],tuning:tuning.reverse(),dots,ghosts,...capoOf(svg)}}function keyboard(svg){let all=[...svg.querySelectorAll("rect[data-midi]")],midis=all.map((el)=>Number(el.getAttribute("data-midi"))),fingers=new Map([...svg.querySelectorAll(".mn-key-finger")].map((el)=>[Number(el.getAttribute("data-mn-key")),text(el)])),keys=all.filter((el)=>has(el,"mn-on")).map((el)=>{let midi=Number(el.getAttribute("data-midi"));return{midi,note:spelled(el.getAttribute("data-mn-note")??"",midi),label:labelAfter(el,"mn-key-label"),finger:fingers.get(midi)??null,root:has(el,"mn-root"),marks:marksOf(el),...has(el,"mn-hand-left")?{hand:"left"}:has(el,"mn-hand-right")?{hand:"right"}:{}}}).sort((a,b)=>a.midi-b.midi).map(({midi:_,...key})=>key);return{type:"keyboard",title:text(svg.querySelector(".mn-title")),chord:svg.getAttribute("data-mn-chord"),notes:svg.getAttribute("data-mn-set"),keyRange:[noteOf(Math.min(...midis)),noteOf(Math.max(...midis))],keys,ghosts:all.filter((el)=>has(el,"mn-ghost")).map((el)=>{let midi=Number(el.getAttribute("data-midi"));return spelled(el.getAttribute("data-mn-note")??"",midi)})}}function chart(el){let chords=[];for(let c of el.querySelectorAll(".mn-chord")){let name=text(c);if(name&&!chords.includes(name))chords.push(name)}return{type:"chart",title:text(el.querySelector(".mn-chart-title")),chords,sections:[...el.querySelectorAll(".mn-section-label")].map((s)=>text(s)??"")}}function strum(svg){let tempo=svg.getAttribute("data-mn-tempo"),swing=svg.getAttribute("data-mn-swing");return{type:"strum",title:text(svg.querySelector(".mn-title")),pattern:svg.getAttribute("data-mn-strum")??"",time:svg.getAttribute("data-mn-time")??"",subdivision:svg.getAttribute("data-mn-subdivision")??"",tempo:tempo===null?null:Number(tempo),...swing===null?{}:{swing:Number(swing)},chords:[...svg.querySelectorAll("[data-mn-beat][data-mn-chord]")].map((el)=>({beat:Number(el.getAttribute("data-mn-beat")),chord:el.getAttribute("data-mn-chord")??""}))}}function describeBlock(el){return[...el.querySelectorAll("svg.mn-svg, .mn-chart, .mn-cell.mn-error")].map((d)=>{if(has(d,"mn-error"))return{type:"error",message:(text(d.querySelector(".mn-error-message"))??"").replace(/^[a-z]+, /,"")};if(has(d,"mn-chart"))return chart(d);if(has(d,"mn-circle"))return{type:"circle",key:d.getAttribute("data-mn-set"),chords:[...d.querySelectorAll(".mn-circle-chip")].map((c)=>`${text(c.querySelector("title"))?.replace(": "," ")??""}`)};if(has(d,"mn-fretboard"))return fretboard(d);if(has(d,"mn-keyboard"))return keyboard(d);if(has(d,"mn-strum"))return strum(d);return guitarChord(d)})}var quoted=(s)=>s?`"${s}"`:null,listed=(parts)=>parts.filter(Boolean).join(", "),extra=(label,root,more=[])=>[label!==null?`"${label}"`:null,root?"root":null,...more].filter(Boolean).join(" "),capoText=(capo,from)=>`capo ${capo}${from==="nut"?", frets from the nut":""}`;function formatDiagram(d,n){let head=`${n}. `,pad=" ".repeat(head.length);switch(d.type){case"error":return[`${head}error: ${d.message}`];case"circle":return[`${head}${listed(["circle of fifths",d.key,`chords ${d.chords.join(", ")}`])}`];case"strum":return[`${head}${listed(["strumming pattern",quoted(d.title),d.time,d.subdivision,d.swing!==void 0&&(Math.abs(d.swing-0.6666666666666666)<0.001?"swing":`swing ${Math.round(d.swing*100)}%`),d.tempo!==null&&`tempo ${d.tempo}`])}`,`${pad}${d.pattern}`];case"chart":return[`${head}${listed(["chart",quoted(d.title),d.sections.length>0&&`sections ${d.sections.join(", ")}`,`chords ${d.chords.join(" ")||"none"}`])}`];case"guitar-chord":{let strings=d.strings.map((s)=>`${s.string} ${s.fret===null?"x":[s.fret,s.note,extra(s.label,s.root,s.mark?[s.mark]:[])].filter((p)=>p!==null&&p!=="").join(" ")}`);return[`${head}${listed(["chord diagram",quoted(d.title),d.chord&&`chord ${d.chord}`,d.capo!==void 0&&capoText(d.capo,d.fretsFrom),d.sounds!==void 0&&`sounds ${d.sounds}`,`frets ${d.fretRange[0]}-${d.fretRange[1]}`,d.frets,...(d.barres??[]).map((b)=>`barre ${b.finger} at fret ${b.fret}, strings ${b.from} to ${b.to}`)])}`,`${pad}strings: ${strings.join(" | ")}`]}case"fretboard":{let lines=[`${head}${listed(["fretboard",quoted(d.title),d.notes,d.capo!==void 0&&capoText(d.capo,d.fretsFrom),`frets ${d.fretRange[0]}-${d.fretRange[1]}`,`tuning ${d.tuning.join(" ")}`])}`],count=d.tuning.length;for(let string=count;string>=1;string--){let dots=d.dots.filter((dot)=>dot.string===string);if(!dots.length)continue;let name=d.tuning[count-string]??"?";lines.push(`${pad}string ${string} (${name}): ${dots.map((dot)=>[dot.fret,dot.note,extra(dot.label,dot.root,dot.marks)].filter((p)=>p!=="").join(" ")).join(", ")}`)}if(d.ghosts.length)lines.push(`${pad}ghosts (compared scale): ${d.ghosts.map((g)=>`string ${g.string} fret ${g.fret} ${g.note}`).join(", ")}`);return lines}case"keyboard":return[`${head}${listed(["keyboard",quoted(d.title),d.chord&&`chord ${d.chord}`,d.notes,`keys ${d.keyRange[0]}-${d.keyRange[1]}`])}`,`${pad}keys: ${d.keys.map((k)=>[k.note,extra(k.label,k.root,[...k.finger?[`finger ${k.finger}`]:[],...k.hand?[`${k.hand} hand`]:[],...k.marks])].filter(Boolean).join(" ")).join(", ")||"none"}`,...d.ghosts.length?[`${pad}ghosts (compared scale): ${d.ghosts.join(", ")}`]:[]]}}var DIAGRAM_LANGUAGES=["chord","keyboard","fretboard"],oneLine=(s)=>s.split(/[\r\n]+/).map((line)=>line.trim()).filter(Boolean).join(" ");function checkNote(file,text,doc){let note=parseMarkdown(text),reports=[];for(let block of note.blocks){let{language,line,source}=block,report=(status,message,diagrams=[])=>reports.push({file,line,language,status,message,diagrams}),isTab=language==="tab"||language==="score";if((isTab||isNotationLanguage(language))&&!source.trim()){if(note.frontMatter!==null&&DIAGRAM_LANGUAGES.includes(language))report("skipped","empty block: draws from the note's properties, not checked");else report("empty","empty block: draws nothing");continue}if(isTab){try{parseTabSource(language,source),report("skipped","alphaTex is not checked (it needs alphaTab)")}catch(e){report("error",oneLine(e instanceof Error?e.message:String(e)))}continue}if(!isNotationLanguage(language))continue;let host=doc.createElement("div"),result=renderBlock(language,source,host,{voicings:lookupGuitarVoicing}),diagrams=describeBlock(result.el);if(result.ok)report("ok",null,diagrams);else report("error",oneLine(result.error??"error"),diagrams);result.destroy()}return reports}function summarize(files,reports){let count=(status)=>reports.filter((r)=>r.status===status).length;return{files,blocks:reports.length,ok:count("ok"),errors:count("error"),skipped:count("skipped"),empty:count("empty")}}var formatError=(r)=>`${r.file}:${r.line}: ${r.language}: ${r.message}`;function formatReport(r){let where=`${r.file}:${r.line}: ${r.language}`;return r.status==="ok"?`${where}: ok`:`${where}: ${r.status}: ${r.message??""}`}function formatDescription(r){return[formatReport(r),...r.diagrams.flatMap((d,i)=>formatDiagram(d,i+1)).map((l)=>` ${l}`)]}var GLOB=/[*?[{]/;function globToRegExp(pattern){let out="";for(let i=0;i<pattern.length;i++){let c=pattern[i];if(c==="*"&&pattern[i+1]==="*"){let slash=pattern[i+2]==="/";out+=slash?"(?:.*/)?":".*",i+=slash?2:1}else if(c==="*")out+="[^/]*";else if(c==="?")out+="[^/]";else if(c==="{"){let end=pattern.indexOf("}",i);if(end<0)out+="\\{";else out+=`(?:${pattern.slice(i+1,end).split(",").map((p)=>p.replace(/[.+^$()|\\]/g,"\\$&").replace(/\*/g,"[^/]*")).join("|")})`,i=end}else if(c==="["){let end=pattern.indexOf("]",i+1);if(end<0)out+="\\[";else out+=`[${pattern.slice(i+1,end).replace(/^!/,"^").replace(/\\/g,"\\\\")}]`,i=end}else out+=c.replace(/[.+^$()|\\\]}]/g,"\\$&")}return new RegExp(`^${out}$`)}async function walk(dir){let entries=await readdir(dir,{withFileTypes:!0}),files=[];for(let entry of entries.sort((a,b)=>a.name.localeCompare(b.name))){let path=join(dir,entry.name);if(entry.isDirectory()){if(!entry.name.startsWith(".")&&entry.name!=="node_modules")files.push(...await walk(path))}else if(entry.isFile())files.push(path)}return files}var isMarkdown=(path)=>/\.(md|markdown)$/i.test(path);async function expand(arg,cwd){let pattern=arg.replace(/\\/g,"/"),path=resolve(cwd,arg),info=await stat(path).catch(()=>null);if(info)return info.isDirectory()?(await walk(path)).filter(isMarkdown):[path];if(!GLOB.test(pattern))throw Error(`${arg}: no such file or folder`);let segments=pattern.split("/"),first=segments.findIndex((s)=>GLOB.test(s)),base=resolve(cwd,segments.slice(0,first).join("/")||"."),matcher=globToRegExp(segments.slice(first).join("/"));if(!(await stat(base).catch(()=>null))?.isDirectory())return[];return(await walk(base)).filter((f)=>matcher.test(relative(base,f).replace(/\\/g,"/")))}var USAGE=`Usage: music-notation check [options] <files, folders or globs...>
|
|
54
54
|
|
|
55
55
|
Renders every chord, chords, keyboard, fretboard and strum block of Markdown files
|
|
56
56
|
and reports each mistake as file:line: language: message.
|
|
@@ -1,3 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The column ranges (inclusive) a palm mute line marks: each PM through its last dash before the
|
|
3
|
+
* next PM; empty when the line isn't one.
|
|
4
|
+
*/
|
|
5
|
+
export declare function palmMutesOf(line: string): [number, number][];
|
|
6
|
+
/** A string line read in one pass (see `techniquesOf`). */
|
|
7
|
+
interface StringLine {
|
|
8
|
+
/** The frets starting at each column: the fret, and the columns it takes. */
|
|
9
|
+
frets: Map<number, {
|
|
10
|
+
fret: number;
|
|
11
|
+
width: number;
|
|
12
|
+
}>;
|
|
13
|
+
/** The alphaTex effects of the note starting at each column. */
|
|
14
|
+
effects: Map<number, string[]>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A string line's frets and techniques, read in one pass. `8b10r8p5`: 8 bent a whole tone and
|
|
18
|
+
* released, then pulled off to 5 (a bend's target and its release are not notes; `7^9` bends
|
|
19
|
+
* too). `5h7`, `7p5` hammer-on and pull-off; `5/7`, `7\5`, `5s7` slides (`/5` slides in from
|
|
20
|
+
* below, `\5` from above, `5/` out upwards, `5\` downwards); `~` or `v` vibrato; `<12>` a natural
|
|
21
|
+
* harmonic.
|
|
22
|
+
*/
|
|
23
|
+
export declare function techniquesOf(body: string): StringLine;
|
|
24
|
+
/**
|
|
25
|
+
* A meter: its time signature, a bar's and a beat's length in sixteenths, and the grids a bar's
|
|
26
|
+
* beats may sit on (divisions of the bar), coarsest first.
|
|
27
|
+
*/
|
|
28
|
+
export interface Meter {
|
|
29
|
+
ts: [number, number];
|
|
30
|
+
length: number;
|
|
31
|
+
beat: number;
|
|
32
|
+
grids: number[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Where a bar's beats fall, in sixteenths from its start, read from their columns (from the bar's
|
|
36
|
+
* start), on the coarsest grid of a bar of `meter` (4/4: whole notes to sixteenths) that fits: first within
|
|
37
|
+
* 0.4 of a column and with plain note values, then within a column (a tab written a column off),
|
|
38
|
+
* then on a grid that falls on columns, with ties. A grid step is a column wide at least, and
|
|
39
|
+
* equal gaps get equal lengths. The bar runs from `pad` (the dashes every bar starts with) to
|
|
40
|
+
* its end, or `pad` columns less; when the first beat comes later, from its start too (a rest
|
|
41
|
+
* first). Null when nothing fits (a sketch, not a rhythm).
|
|
42
|
+
*/
|
|
43
|
+
export declare function positionsOf(cols: number[], width: number, pad: number, meter?: Meter): number[] | null;
|
|
44
|
+
/** A bar's events: a beat (its index) or a rest (-1), and its length in sixteenths. */
|
|
45
|
+
export type Rhythm = {
|
|
46
|
+
beat: number;
|
|
47
|
+
sixteenths: number;
|
|
48
|
+
}[];
|
|
49
|
+
/**
|
|
50
|
+
* A bar's rhythm when no grid fits its columns (see positionsOf): the bar's most frequent gap
|
|
51
|
+
* between beats is an eighth (a sixteenth when eighths overrun the bar), other gaps a whole number
|
|
52
|
+
* of them (one at least), the last beat one, and rests fill the rest of the bar (4/4 unless
|
|
53
|
+
* `meter` says). Every beat a sixteenth when even that is too long.
|
|
54
|
+
*/
|
|
55
|
+
export declare function sketchRhythmOf(cols: number[], meter?: Meter): Rhythm;
|
|
1
56
|
/**
|
|
2
57
|
* alphaTex for a plain-text tab; null when no tab lines are found. String lines are mostly dashes
|
|
3
58
|
* with a bar line or a name; one named line is enough, unnamed ones need three. A drum tab becomes
|
|
@@ -5,3 +60,4 @@
|
|
|
5
60
|
* reads as one to fill. The tuning is written when the strings aren't a standard guitar's.
|
|
6
61
|
*/
|
|
7
62
|
export declare function textTabToAlphaTex(text: string): string | null;
|
|
63
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,16 +2,17 @@ export { renderBlock, LANGUAGES, isNotationLanguage, MAX_DIAGRAMS, type RenderRe
|
|
|
2
2
|
export { parseOrientation, parseHand, layoutDefaults, type Orientation, type Hand, type LayoutDefaults } from './render/layout.js';
|
|
3
3
|
export type { RenderOptions, NotationLanguage } from './blocks/renderers.js';
|
|
4
4
|
export { STYLES, injectStyles } from './styles.js';
|
|
5
|
-
export { renderGuitarDiagram, parseFrets, parseFingers, baseFretOf, STANDARD_TUNING, capoCaption, type FrettedVoicing, type GuitarDiagramOptions } from './chord/guitar.js';
|
|
5
|
+
export { renderGuitarDiagram, parseFrets, parseFingers, baseFretOf, barreKind, isBarreVoicing, STANDARD_TUNING, capoCaption, type FrettedVoicing, type GuitarDiagramOptions } from './chord/guitar.js';
|
|
6
6
|
export { soundingChord, soundsLike, fretsFromCapo, capoTuning, parseCapo, parseFretsFrom, MAX_CAPO, type FretsFrom } from './chord/capo.js';
|
|
7
7
|
export { generateVoicings, fingerVoicing, voicingShape, MAX_GENERATED_STRINGS, type GeneratedVoicing, type VoicingOptions, type VoicingShape } from './chord/generate.js';
|
|
8
|
-
export { sequenceOf, lengthOf, lightPlayer, pluckedString, pianoTone, DEFAULT_SEQUENCE, type NoteEvent, type NotePlayer, type PlayHandle, type PlayKind, type Sound, type SequenceOptions } from './playback/player.js';
|
|
8
|
+
export { sequenceOf, scaleRun, lengthOf, lightPlayer, pluckedString, pianoTone, DEFAULT_SEQUENCE, DEFAULT_STRUM, type NoteEvent, type NotePlayer, type PluckOptions, type PlayHandle, type PlayKind, type Sound, type SequenceOptions } from './playback/player.js';
|
|
9
9
|
export { attachPlayback, type PlayOptions } from './playback/controls.js';
|
|
10
10
|
export { followNotes, noteTargets, PLAYING_CLASS, START_WAIT, type Follower } from './playback/follow.js';
|
|
11
11
|
export { transition, smoothProgression, type TransitionStep, type TransitionOptions, type ProgressionStep, type ProgressionOptions } from './chord/transitions.js';
|
|
12
12
|
export { triadVoicings, keyTriads, parseKey, inversionName, type Triad, type TriadOptions, type KeyTriad } from './chord/triads.js';
|
|
13
13
|
export { renderKeyboard, parseKeyRange, keyRangeOf, type KeyboardOptions } from './keyboard/keyboard.js';
|
|
14
|
-
export { pianoVoicing, pianoPitches, triadFingering, type PianoVoicing, type PianoVoicingOptions, type PianoVoicingStyle, type PianoHands, type RootlessForm } from './keyboard/piano-chord.js';
|
|
14
|
+
export { pianoVoicing, pianoPitches, triadFingering, type PianoVoicing, type PianoVoicingOptions, type PianoVoicingStyle, type PianoHands, type RootlessForm, type ShellForm } from './keyboard/piano-chord.js';
|
|
15
|
+
export { standardScaleFingering, scaleFingers, type ScaleHand } from './keyboard/scale-fingering.js';
|
|
15
16
|
export { renderFretboard, type FretboardOptions } from './fretboard/fretboard.js';
|
|
16
17
|
export { parseTuning } from './fretboard/tuning.js';
|
|
17
18
|
export { parseChordPro, parseLyrics, type Song, type Section, type Line, type Segment, type ChordDefinition } from './chords/chordpro.js';
|
|
@@ -31,12 +32,12 @@ export { scalePosition, neckPositions, isArpeggio, positionCount, CAGED_SHAPES,
|
|
|
31
32
|
export { blockFromProperties, instrumentOf, DEFAULT_PROPERTY_NAMES, type PropertyNames, type Instrument } from './blocks/properties.js';
|
|
32
33
|
export { textTabToAlphaTex } from './convert/text-tab.js';
|
|
33
34
|
export { chordSheetToChordPro } from './convert/chord-sheet.js';
|
|
34
|
-
export { parseStrum, formatStrum, countOf, parseTime, parseSubdivision, MAX_STRUM_BARS, type StrumPattern, type StrumSlot, type Stroke, type Subdivision } from './strum/pattern.js';
|
|
35
|
+
export { parseStrum, formatStrum, countOf, parseTime, parseSubdivision, parseSwing, isCompound, MAX_STRUM_BARS, type StrumPattern, type StrumSlot, type Stroke, type Subdivision } from './strum/pattern.js';
|
|
35
36
|
export { renderStrum, type StrumOptions } from './strum/render.js';
|
|
36
37
|
export { strumVoicing, DEFAULT_STRUM_CHORD } from './strum/voicing.js';
|
|
37
|
-
export { playStrum, strumEvents, scoreOf, STRUM_VELOCITY, type PlayStrumOptions, type StrumEventOptions, type StrumScore } from './strum/play.js';
|
|
38
|
-
export { findScales, findKey, inKey, scalesForChord, chordsInScale, type ScaleMatch, type FindScalesOptions, type KeyCandidate, type FoundKey, type ScaleChord } from './theory/find.js';
|
|
38
|
+
export { playStrum, strumEvents, scoreOf, STRUM_VELOCITY, STRUM_STRESS, strumVelocity, tempoOf, type PlayStrumOptions, type StrumEventOptions, type StrumScore } from './strum/play.js';
|
|
39
|
+
export { findScales, findKey, inKey, scalesForChord, chordsInScale, bluesTonic, BLUES_SCALES, type ScaleMatch, type FindScalesOptions, type KeyCandidate, type FoundKey, type ScaleChord } from './theory/find.js';
|
|
39
40
|
export { readKey, keyNotes, keySignature, keyChords, parentMajor, signatureText, keyProblem, MAX_SIGNATURE, MODES, type Mode, type MusicalKey, type KeySignature, type KeyChord } from './theory/keys.js';
|
|
40
|
-
export { progressionChords, progressionChord, readNumeral, numeralOf, harmonicFunction, type ProgressionChord, type HarmonicFunction } from './theory/numerals.js';
|
|
41
|
-
export { voiceLead } from './keyboard/voice-leading.js';
|
|
41
|
+
export { progressionChords, progressionChord, readNumeral, numeralOf, harmonicFunction, isBluesIn, withTonicizations, type NumeralOptions, type ProgressionChord, type HarmonicFunction } from './theory/numerals.js';
|
|
42
|
+
export { voiceLead, voiceLeadVoicings, voiceMotion, type VoiceLeadOptions, type LedVoicing } from './keyboard/voice-leading.js';
|
|
42
43
|
export { renderCircle, type CircleOptions } from './circle/circle.js';
|