From ce1ccfdc026137f299fb1bfdef590fbf0f457208 Mon Sep 17 00:00:00 2001 From: Neta London Date: Mon, 9 Oct 2023 14:31:40 +0300 Subject: [PATCH] Build for GitHub Pages --- build/.gitignore | 1 + build/asset-manifest.json | 37 +++++++++ build/chip/index.html | 1 + build/favicon.svg | 51 ++++++++++++ build/guide/index.html | 1 + build/index.html | 1 + build/manifest.json | 25 ++++++ build/robots.txt | 3 + build/root.css | 4 + build/static/css/605.17e509d9.chunk.css | 2 + build/static/css/605.17e509d9.chunk.css.map | 1 + build/static/css/main.2f41c32c.css | 2 + build/static/css/main.2f41c32c.css.map | 1 + build/static/js/2.0c1eab19.chunk.js | 2 + build/static/js/2.0c1eab19.chunk.js.map | 1 + build/static/js/277.355c3689.chunk.js | 2 + build/static/js/277.355c3689.chunk.js.map | 1 + build/static/js/356.1228c852.chunk.js | 2 + build/static/js/356.1228c852.chunk.js.map | 1 + build/static/js/506.f6bf6957.chunk.js | 2 + build/static/js/506.f6bf6957.chunk.js.map | 1 + build/static/js/512.9c0d1032.chunk.js | 2 + build/static/js/512.9c0d1032.chunk.js.map | 1 + build/static/js/568.4e6a571b.chunk.js | 2 + build/static/js/568.4e6a571b.chunk.js.map | 1 + build/static/js/600.6e4176cb.chunk.js | 2 + build/static/js/600.6e4176cb.chunk.js.map | 1 + build/static/js/605.b27434d9.chunk.js | 2 + build/static/js/605.b27434d9.chunk.js.map | 1 + build/static/js/681.59527346.chunk.js | 2 + build/static/js/681.59527346.chunk.js.map | 1 + build/static/js/813.65f1d443.chunk.js | 3 + .../js/813.65f1d443.chunk.js.LICENSE.txt | 16 ++++ build/static/js/813.65f1d443.chunk.js.map | 1 + build/static/js/949.77b4b684.chunk.js | 2 + build/static/js/949.77b4b684.chunk.js.map | 1 + build/static/js/main.1a8f3959.js | 3 + build/static/js/main.1a8f3959.js.LICENSE.txt | 74 ++++++++++++++++++ build/static/js/main.1a8f3959.js.map | 1 + build/user_guide/01_chip_empty.png | Bin 0 -> 138772 bytes build/user_guide/02_chip_simple_nand.png | Bin 0 -> 140189 bytes build/user_guide/03_chip_complex.png | Bin 0 -> 158359 bytes .../04_chip_complex_implemented.png | Bin 0 -> 162108 bytes .../05_chip_complex_failed_test.png | Bin 0 -> 166648 bytes .../06_chip_complex_passed_test.png | Bin 0 -> 166462 bytes build/user_guide/07_settings.png | Bin 0 -> 124581 bytes build/util/index.html | 1 + web/build/.gitignore | 1 + web/build/asset-manifest.json | 37 +++++++++ web/build/chip/index.html | 1 + web/build/favicon.svg | 51 ++++++++++++ web/build/guide/index.html | 1 + web/build/index.html | 1 + web/build/manifest.json | 25 ++++++ web/build/robots.txt | 3 + web/build/root.css | 4 + web/build/static/css/605.17e509d9.chunk.css | 2 + .../static/css/605.17e509d9.chunk.css.map | 1 + web/build/static/css/main.2f41c32c.css | 2 + web/build/static/css/main.2f41c32c.css.map | 1 + web/build/static/js/2.0c1eab19.chunk.js | 2 + web/build/static/js/2.0c1eab19.chunk.js.map | 1 + web/build/static/js/277.355c3689.chunk.js | 2 + web/build/static/js/277.355c3689.chunk.js.map | 1 + web/build/static/js/356.1228c852.chunk.js | 2 + web/build/static/js/356.1228c852.chunk.js.map | 1 + web/build/static/js/506.f6bf6957.chunk.js | 2 + web/build/static/js/506.f6bf6957.chunk.js.map | 1 + web/build/static/js/512.9c0d1032.chunk.js | 2 + web/build/static/js/512.9c0d1032.chunk.js.map | 1 + web/build/static/js/568.4e6a571b.chunk.js | 2 + web/build/static/js/568.4e6a571b.chunk.js.map | 1 + web/build/static/js/600.6e4176cb.chunk.js | 2 + web/build/static/js/600.6e4176cb.chunk.js.map | 1 + web/build/static/js/605.b27434d9.chunk.js | 2 + web/build/static/js/605.b27434d9.chunk.js.map | 1 + web/build/static/js/681.59527346.chunk.js | 2 + web/build/static/js/681.59527346.chunk.js.map | 1 + web/build/static/js/813.65f1d443.chunk.js | 3 + .../js/813.65f1d443.chunk.js.LICENSE.txt | 16 ++++ web/build/static/js/813.65f1d443.chunk.js.map | 1 + web/build/static/js/949.77b4b684.chunk.js | 2 + web/build/static/js/949.77b4b684.chunk.js.map | 1 + web/build/static/js/main.1a8f3959.js | 3 + .../static/js/main.1a8f3959.js.LICENSE.txt | 74 ++++++++++++++++++ web/build/static/js/main.1a8f3959.js.map | 1 + web/build/user_guide/01_chip_empty.png | Bin 0 -> 138772 bytes web/build/user_guide/02_chip_simple_nand.png | Bin 0 -> 140189 bytes web/build/user_guide/03_chip_complex.png | Bin 0 -> 158359 bytes .../04_chip_complex_implemented.png | Bin 0 -> 162108 bytes .../05_chip_complex_failed_test.png | Bin 0 -> 166648 bytes .../06_chip_complex_passed_test.png | Bin 0 -> 166462 bytes web/build/user_guide/07_settings.png | Bin 0 -> 124581 bytes web/build/util/index.html | 1 + 94 files changed, 518 insertions(+) create mode 100644 build/.gitignore create mode 100644 build/asset-manifest.json create mode 100644 build/chip/index.html create mode 100644 build/favicon.svg create mode 100644 build/guide/index.html create mode 100644 build/index.html create mode 100644 build/manifest.json create mode 100644 build/robots.txt create mode 100644 build/root.css create mode 100644 build/static/css/605.17e509d9.chunk.css create mode 100644 build/static/css/605.17e509d9.chunk.css.map create mode 100644 build/static/css/main.2f41c32c.css create mode 100644 build/static/css/main.2f41c32c.css.map create mode 100644 build/static/js/2.0c1eab19.chunk.js create mode 100644 build/static/js/2.0c1eab19.chunk.js.map create mode 100644 build/static/js/277.355c3689.chunk.js create mode 100644 build/static/js/277.355c3689.chunk.js.map create mode 100644 build/static/js/356.1228c852.chunk.js create mode 100644 build/static/js/356.1228c852.chunk.js.map create mode 100644 build/static/js/506.f6bf6957.chunk.js create mode 100644 build/static/js/506.f6bf6957.chunk.js.map create mode 100644 build/static/js/512.9c0d1032.chunk.js create mode 100644 build/static/js/512.9c0d1032.chunk.js.map create mode 100644 build/static/js/568.4e6a571b.chunk.js create mode 100644 build/static/js/568.4e6a571b.chunk.js.map create mode 100644 build/static/js/600.6e4176cb.chunk.js create mode 100644 build/static/js/600.6e4176cb.chunk.js.map create mode 100644 build/static/js/605.b27434d9.chunk.js create mode 100644 build/static/js/605.b27434d9.chunk.js.map create mode 100644 build/static/js/681.59527346.chunk.js create mode 100644 build/static/js/681.59527346.chunk.js.map create mode 100644 build/static/js/813.65f1d443.chunk.js create mode 100644 build/static/js/813.65f1d443.chunk.js.LICENSE.txt create mode 100644 build/static/js/813.65f1d443.chunk.js.map create mode 100644 build/static/js/949.77b4b684.chunk.js create mode 100644 build/static/js/949.77b4b684.chunk.js.map create mode 100644 build/static/js/main.1a8f3959.js create mode 100644 build/static/js/main.1a8f3959.js.LICENSE.txt create mode 100644 build/static/js/main.1a8f3959.js.map create mode 100644 build/user_guide/01_chip_empty.png create mode 100644 build/user_guide/02_chip_simple_nand.png create mode 100644 build/user_guide/03_chip_complex.png create mode 100644 build/user_guide/04_chip_complex_implemented.png create mode 100644 build/user_guide/05_chip_complex_failed_test.png create mode 100644 build/user_guide/06_chip_complex_passed_test.png create mode 100644 build/user_guide/07_settings.png create mode 100644 build/util/index.html create mode 100644 web/build/.gitignore create mode 100644 web/build/asset-manifest.json create mode 100644 web/build/chip/index.html create mode 100644 web/build/favicon.svg create mode 100644 web/build/guide/index.html create mode 100644 web/build/index.html create mode 100644 web/build/manifest.json create mode 100644 web/build/robots.txt create mode 100644 web/build/root.css create mode 100644 web/build/static/css/605.17e509d9.chunk.css create mode 100644 web/build/static/css/605.17e509d9.chunk.css.map create mode 100644 web/build/static/css/main.2f41c32c.css create mode 100644 web/build/static/css/main.2f41c32c.css.map create mode 100644 web/build/static/js/2.0c1eab19.chunk.js create mode 100644 web/build/static/js/2.0c1eab19.chunk.js.map create mode 100644 web/build/static/js/277.355c3689.chunk.js create mode 100644 web/build/static/js/277.355c3689.chunk.js.map create mode 100644 web/build/static/js/356.1228c852.chunk.js create mode 100644 web/build/static/js/356.1228c852.chunk.js.map create mode 100644 web/build/static/js/506.f6bf6957.chunk.js create mode 100644 web/build/static/js/506.f6bf6957.chunk.js.map create mode 100644 web/build/static/js/512.9c0d1032.chunk.js create mode 100644 web/build/static/js/512.9c0d1032.chunk.js.map create mode 100644 web/build/static/js/568.4e6a571b.chunk.js create mode 100644 web/build/static/js/568.4e6a571b.chunk.js.map create mode 100644 web/build/static/js/600.6e4176cb.chunk.js create mode 100644 web/build/static/js/600.6e4176cb.chunk.js.map create mode 100644 web/build/static/js/605.b27434d9.chunk.js create mode 100644 web/build/static/js/605.b27434d9.chunk.js.map create mode 100644 web/build/static/js/681.59527346.chunk.js create mode 100644 web/build/static/js/681.59527346.chunk.js.map create mode 100644 web/build/static/js/813.65f1d443.chunk.js create mode 100644 web/build/static/js/813.65f1d443.chunk.js.LICENSE.txt create mode 100644 web/build/static/js/813.65f1d443.chunk.js.map create mode 100644 web/build/static/js/949.77b4b684.chunk.js create mode 100644 web/build/static/js/949.77b4b684.chunk.js.map create mode 100644 web/build/static/js/main.1a8f3959.js create mode 100644 web/build/static/js/main.1a8f3959.js.LICENSE.txt create mode 100644 web/build/static/js/main.1a8f3959.js.map create mode 100644 web/build/user_guide/01_chip_empty.png create mode 100644 web/build/user_guide/02_chip_simple_nand.png create mode 100644 web/build/user_guide/03_chip_complex.png create mode 100644 web/build/user_guide/04_chip_complex_implemented.png create mode 100644 web/build/user_guide/05_chip_complex_failed_test.png create mode 100644 web/build/user_guide/06_chip_complex_passed_test.png create mode 100644 web/build/user_guide/07_settings.png create mode 100644 web/build/util/index.html diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 000000000..1f619d05e --- /dev/null +++ b/build/.gitignore @@ -0,0 +1 @@ +pico.css diff --git a/build/asset-manifest.json b/build/asset-manifest.json new file mode 100644 index 000000000..e043d60bc --- /dev/null +++ b/build/asset-manifest.json @@ -0,0 +1,37 @@ +{ + "files": { + "main.css": "/web-ide/static/css/main.2f41c32c.css", + "main.js": "/web-ide/static/js/main.1a8f3959.js", + "static/js/2.0c1eab19.chunk.js": "/web-ide/static/js/2.0c1eab19.chunk.js", + "static/css/605.17e509d9.chunk.css": "/web-ide/static/css/605.17e509d9.chunk.css", + "static/js/605.b27434d9.chunk.js": "/web-ide/static/js/605.b27434d9.chunk.js", + "static/js/506.f6bf6957.chunk.js": "/web-ide/static/js/506.f6bf6957.chunk.js", + "static/js/568.4e6a571b.chunk.js": "/web-ide/static/js/568.4e6a571b.chunk.js", + "static/js/277.355c3689.chunk.js": "/web-ide/static/js/277.355c3689.chunk.js", + "static/js/949.77b4b684.chunk.js": "/web-ide/static/js/949.77b4b684.chunk.js", + "static/js/681.59527346.chunk.js": "/web-ide/static/js/681.59527346.chunk.js", + "static/js/512.9c0d1032.chunk.js": "/web-ide/static/js/512.9c0d1032.chunk.js", + "static/js/600.6e4176cb.chunk.js": "/web-ide/static/js/600.6e4176cb.chunk.js", + "static/js/813.65f1d443.chunk.js": "/web-ide/static/js/813.65f1d443.chunk.js", + "static/js/356.1228c852.chunk.js": "/web-ide/static/js/356.1228c852.chunk.js", + "index.html": "/web-ide/index.html", + "main.2f41c32c.css.map": "/web-ide/static/css/main.2f41c32c.css.map", + "main.1a8f3959.js.map": "/web-ide/static/js/main.1a8f3959.js.map", + "2.0c1eab19.chunk.js.map": "/web-ide/static/js/2.0c1eab19.chunk.js.map", + "605.17e509d9.chunk.css.map": "/web-ide/static/css/605.17e509d9.chunk.css.map", + "605.b27434d9.chunk.js.map": "/web-ide/static/js/605.b27434d9.chunk.js.map", + "506.f6bf6957.chunk.js.map": "/web-ide/static/js/506.f6bf6957.chunk.js.map", + "568.4e6a571b.chunk.js.map": "/web-ide/static/js/568.4e6a571b.chunk.js.map", + "277.355c3689.chunk.js.map": "/web-ide/static/js/277.355c3689.chunk.js.map", + "949.77b4b684.chunk.js.map": "/web-ide/static/js/949.77b4b684.chunk.js.map", + "681.59527346.chunk.js.map": "/web-ide/static/js/681.59527346.chunk.js.map", + "512.9c0d1032.chunk.js.map": "/web-ide/static/js/512.9c0d1032.chunk.js.map", + "600.6e4176cb.chunk.js.map": "/web-ide/static/js/600.6e4176cb.chunk.js.map", + "813.65f1d443.chunk.js.map": "/web-ide/static/js/813.65f1d443.chunk.js.map", + "356.1228c852.chunk.js.map": "/web-ide/static/js/356.1228c852.chunk.js.map" + }, + "entrypoints": [ + "static/css/main.2f41c32c.css", + "static/js/main.1a8f3959.js" + ] +} \ No newline at end of file diff --git a/build/chip/index.html b/build/chip/index.html new file mode 100644 index 000000000..8ae826d83 --- /dev/null +++ b/build/chip/index.html @@ -0,0 +1 @@ +NAND2Tetris
\ No newline at end of file diff --git a/build/favicon.svg b/build/favicon.svg new file mode 100644 index 000000000..cee1b79a6 --- /dev/null +++ b/build/favicon.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/guide/index.html b/build/guide/index.html new file mode 100644 index 000000000..8ae826d83 --- /dev/null +++ b/build/guide/index.html @@ -0,0 +1 @@ +NAND2Tetris
\ No newline at end of file diff --git a/build/index.html b/build/index.html new file mode 100644 index 000000000..8ae826d83 --- /dev/null +++ b/build/index.html @@ -0,0 +1 @@ +NAND2Tetris
\ No newline at end of file diff --git a/build/manifest.json b/build/manifest.json new file mode 100644 index 000000000..57fc1da07 --- /dev/null +++ b/build/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "NAND2Tetris", + "name": "NAND2Tetris Web IDE", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/build/robots.txt b/build/robots.txt new file mode 100644 index 000000000..e9e57dc4d --- /dev/null +++ b/build/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/build/root.css b/build/root.css new file mode 100644 index 000000000..4fb1f916f --- /dev/null +++ b/build/root.css @@ -0,0 +1,4 @@ +@import "https://unpkg.com/@picocss/pico@latest/css/pico.min.css" layer(pico); +@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono&family=Poppins:wght@400;700&display=swap"); + +@layer pico component user; diff --git a/build/static/css/605.17e509d9.chunk.css b/build/static/css/605.17e509d9.chunk.css new file mode 100644 index 000000000..52cfcd57c --- /dev/null +++ b/build/static/css/605.17e509d9.chunk.css @@ -0,0 +1,2 @@ +[role=group]{display:flex;flex-direction:row;margin:0}[role=group] [role=button],[role=group] button,[role=group] input,[role=group] select{margin:0}[role=group] [role=button]:not(:first-child),[role=group] button:not(:first-child),[role=group] input:not(:first-child),[role=group] select:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}[role=group] [role=button]:not(:last-child),[role=group] button:not(:last-child),[role=group] input:not(:last-child),[role=group] select:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}[role=group] [role=button][aria-current=true],[role=group] button[aria-current=true],[role=group] input[aria-current=true],[role=group] select[aria-current=true]{background-color:var(--primary-inverse);color:var(--primary)}[role=group] [role=button] input[type=checkbox],[role=group] [role=button] input[type=radio],[role=group] button input[type=checkbox],[role=group] button input[type=radio],[role=group] input input[type=checkbox],[role=group] input input[type=radio],[role=group] select input[type=checkbox],[role=group] select input[type=radio]{display:none}[role=tablist]{--border-style:solid;--border:var(--border-width) var(--border-style) var(--card-border-color);--border-empty:var(--border-width) var(--border-style) var(--card-background-color);--tab-count:5;--spacing-tab-edge:calc(var(--block-spacing-horizontal)/2);display:grid;grid-template:-webkit-min-content 1fr/var(--spacing-tab-edge) repeat(var(--tab-count),-webkit-min-content) 1fr;grid-template:min-content 1fr/var(--spacing-tab-edge) repeat(var(--tab-count),min-content) 1fr;height:100%}[role=tablist]:after,[role=tablist]:before{border-bottom:var(--border);content:"";display:block;grid-row:1;min-width:var(--spacing-tab-edge)}[role=tablist]:before{order:-1}[role=tablist]:after{grid-column-end:-1;order:1}[role=tab]{border:var(--border-empty);border-bottom:var(--border);grid-row:1;height:-webkit-min-content;height:min-content;order:0}[role=tab] label,label[role=tab]{padding:var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal) calc(var(--form-element-spacing-vertical)/2)}[role=tab]:hover{--border-color:var(--secondary-color);border:var(--border)}[role=tab]:has(:focus){--border-style:dotted}[role=tab]:has(:active){--border-style:dotted}[role=tab] [type=radio]{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px}[role=tab][aria-selected=true]{border:var(--border);border-bottom:var(--border-empty)}[role=tab]:has(:checked){border:var(--border);border-bottom:var(--border-empty)}[role=tabpanel]{display:none;grid-area:2/1/span 1/-1}[role=tab][aria-selected=true]+[role=tabpanel]{display:block;flex-basis:100%}[role=tab]:has(:checked)+[role=tabpanel]{display:block;flex-basis:100%}.ChipPage{--screen-size:calc(512px + var(--block-spacing-horizontal)*5);gap:0;grid-template-areas:"hdl prt tst";grid-template-columns:1fr var(--screen-size) 1fr;grid-template-rows:1fr;height:100%;margin:0}.ChipPage h2{margin:0 var(--nav-element-spacing-horizontal)}.ChipPage ._hdl_panel{grid-area:hdl;min-height:calc(var(--line-height)*10rem)}.ChipPage ._test_panel{grid-area:tst}.ChipPage ._test_panel main [role=tab]{white-space:nowrap}.ChipPage ._parts_panel{grid-area:prt}@media(max-width:1616px){.ChipPage{grid-template-areas:"hdl prt" "tst tst";grid-template-columns:1fr var(--screen-size);grid-template-rows:3fr 2fr}.ChipPage ._test_panel{grid-area:tst}.ChipPage ._test_panel main>.Editor{max-height:50%}}@media(max-width:1074px){.ChipPage{grid-template-areas:"hdl" "prt" "tst";grid-template-columns:1fr;grid-template-rows:1fr 1fr 1fr}.ChipPage ._test_panel{grid-area:tst}.ChipPage ._test_panel main>.Editor{max-height:40%}}.Editor{height:100%;position:relative;width:100%}.Editor .monaco-editor{position:absolute}.Editor .highlight{background-color:var(--mark-background-color)}.Editor textarea{flex:1 1}.Editor:has(.overlay){position:relative}.Editor .overlay{background-color:var(--form-element-disabled-background-color);inset:0;opacity:var(--form-element-disabled-opacity);position:absolute} +/*# sourceMappingURL=605.17e509d9.chunk.css.map*/ \ No newline at end of file diff --git a/build/static/css/605.17e509d9.chunk.css.map b/build/static/css/605.17e509d9.chunk.css.map new file mode 100644 index 000000000..125090d83 --- /dev/null +++ b/build/static/css/605.17e509d9.chunk.css.map @@ -0,0 +1 @@ +{"version":3,"file":"static/css/605.17e509d9.chunk.css","mappings":"AAAA,aAEE,aACA,mBAFA,QAEA,CAEA,sFAIE,SAEA,8JAEE,2BAA0B,CAD1B,wBACA,CAGF,0JAEE,4BAA2B,CAD3B,yBACA,CAGF,kKACE,wCACA,qBAGF,wUAEE,aC5BN,eACE,oBAAqB,CACrB,yEAA0E,CAC1E,oFAEA,aAAc,CACd,0DAA6D,CAC7D,aACA,8GACE,CADF,8FACE,CAEF,YAGF,2CAIE,4BAFA,WACA,cAGA,UAAS,CADT,iCACA,CAGF,sBACE,SAGF,qBAGE,mBAFA,OAEA,CAGF,WACE,2BACA,4BAGA,UAAS,CADT,8CADA,OAEA,CAGF,iCAME,iIAGF,iBACE,qCAAsC,CACtC,qBAGF,uBACE,qBAAsB,CAGxB,wBACE,qBAAsB,CAGxB,wBAEE,2BAEA,WAEA,gBAHA,4BAEA,SACA,CAGF,+BAIE,uDAGF,yBAIE,uDAGF,gBACE,aAEA,wBAGF,+CACE,cACA,gBAGF,yCACE,cACA,gBChGF,UAKE,6DAAsE,CAOtE,MAEA,kCAJA,iDADA,uBAFA,YAIA,QAGA,CAbA,aACE,+CAcF,sBACE,cACA,0CAGF,uBACE,cAGE,uCACE,mBAKN,wBACE,cAIJ,yBACE,UAIE,wCAFA,6CADA,0BAIE,CAGF,uBACE,cAGE,oCACE,gBAOV,yBACE,UAIE,sCAFA,0BADA,8BAIE,CAIF,uBACE,cAGE,oCACE,gBC3EV,QACE,YAgBA,kBAfA,UAeA,CAbA,uBAEE,kBAGF,mBACE,8CAGF,iBACE,SAIF,sBAEE,kBAGF,iBAGE,+DADA,QAEA,6CAHA,iBAGA","sources":["pico/button-group.scss","shell/tab.scss","pages/chip.scss","shell/editor.scss"],"sourcesContent":["[role=\"group\"] {\n margin: 0;\n display: flex;\n flex-direction: row;\n\n button,\n [role=\"button\"],\n input,\n select {\n margin: 0;\n\n &:not(:first-child) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n &:not(:last-child) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n &[aria-current=\"true\"] {\n background-color: var(--primary-inverse);\n color: var(--primary);\n }\n\n input[type=\"radio\"],\n input[type=\"checkbox\"] {\n display: none;\n }\n }\n}\n","[role=\"tablist\"] {\n --border-style: solid;\n --border: var(--border-width) var(--border-style) var(--card-border-color);\n --border-empty: var(--border-width) var(--border-style)\n var(--card-background-color);\n --tab-count: 5;\n --spacing-tab-edge: calc(var(--block-spacing-horizontal) / 2);\n display: grid;\n grid-template:\n min-content 1fr /\n var(--spacing-tab-edge) repeat(var(--tab-count), min-content) 1fr;\n height: 100%;\n}\n\n[role=\"tablist\"]::after,\n[role=\"tablist\"]::before {\n content: \"\";\n display: block;\n border-bottom: var(--border);\n min-width: var(--spacing-tab-edge);\n grid-row: 1;\n}\n\n[role=\"tablist\"]::before {\n order: -1;\n}\n\n[role=\"tablist\"]::after {\n order: 1;\n // flex: 1;\n grid-column-end: -1;\n}\n\n[role=\"tab\"] {\n border: var(--border-empty);\n border-bottom: var(--border);\n order: 0;\n height: min-content;\n grid-row: 1;\n}\n\nlabel[role=\"tab\"],\n[role=\"tab\"] label {\n /* Ensure the padding is on the label, so the entire area is clickable */\n padding-top: var(--form-element-spacing-vertical);\n padding-bottom: calc(var(--form-element-spacing-vertical) / 2);\n padding-left: var(--form-element-spacing-horizontal);\n padding-right: var(--form-element-spacing-horizontal);\n}\n\n[role=\"tab\"]:hover {\n --border-color: var(--secondary-color);\n border: var(--border);\n}\n\n[role=\"tab\"]:has(:focus) {\n --border-style: dotted;\n}\n\n[role=\"tab\"]:has(:active) {\n --border-style: dotted;\n}\n\n[role=\"tab\"] [type=\"radio\"] {\n /* Leave the radio button focusable, but not visible. Copied from .screen-reader-text */\n clip: rect(1px, 1px, 1px, 1px);\n position: absolute !important;\n height: 1px;\n width: 1px;\n overflow: hidden;\n}\n\n[role=\"tab\"][aria-selected=\"true\"] {\n border-top: var(--border);\n border-left: var(--border);\n border-right: var(--border);\n border-bottom: var(--border-empty);\n}\n\n[role=\"tab\"]:has(:checked) {\n border-top: var(--border);\n border-left: var(--border);\n border-right: var(--border);\n border-bottom: var(--border-empty);\n}\n\n[role=\"tabpanel\"] {\n display: none;\n // order: 2;\n grid-area: 2 / 1 / span 1 / -1;\n}\n\n[role=\"tab\"][aria-selected=\"true\"] + [role=\"tabpanel\"] {\n display: block;\n flex-basis: 100%;\n}\n\n[role=\"tab\"]:has(:checked) + [role=\"tabpanel\"] {\n display: block;\n flex-basis: 100%;\n}\n","@use \"../pico/button-group.scss\";\n@use \"../shell/tab.scss\";\n\n.ChipPage {\n h2 {\n margin: 0 var(--nav-element-spacing-horizontal);\n }\n\n --screen-size: calc(512px + calc(var(--block-spacing-horizontal) * 5));\n\n height: 100%;\n\n grid-template-rows: 1fr;\n grid-template-columns: 1fr var(--screen-size) 1fr;\n margin: 0px;\n gap: 0;\n\n grid-template-areas: \"hdl prt tst\";\n\n ._hdl_panel {\n grid-area: hdl;\n min-height: calc(var(--line-height) * 10rem);\n }\n\n ._test_panel {\n grid-area: tst;\n\n main {\n [role=\"tab\"] {\n white-space: nowrap;\n }\n }\n }\n\n ._parts_panel {\n grid-area: prt;\n }\n}\n\n@media (max-width: 1616px) {\n .ChipPage {\n grid-template-rows: 3fr 2fr;\n grid-template-columns: 1fr var(--screen-size);\n\n grid-template-areas:\n \"hdl prt\"\n \"tst tst\";\n\n ._test_panel {\n grid-area: tst;\n\n main {\n > .Editor {\n max-height: 50%;\n }\n }\n }\n }\n}\n\n@media (max-width: 1074px) {\n .ChipPage {\n grid-template-rows: 1fr 1fr 1fr;\n grid-template-columns: 1fr;\n\n grid-template-areas:\n \"hdl\"\n \"prt\"\n \"tst\";\n\n ._test_panel {\n grid-area: tst;\n\n main {\n > .Editor {\n max-height: 40%;\n }\n }\n }\n }\n}\n",".Editor {\n height: 100%;\n width: 100%;\n\n .monaco-editor {\n // Magic\n position: absolute;\n }\n\n .highlight {\n background-color: var(--mark-background-color);\n }\n\n textarea {\n flex: 1;\n }\n\n position: relative; // For \".overlay\", below.\n &:has(.overlay) {\n // Available in chrome 105\n position: relative;\n }\n\n .overlay {\n position: absolute;\n inset: 0;\n background-color: var(--form-element-disabled-background-color);\n opacity: var(--form-element-disabled-opacity);\n }\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/css/main.2f41c32c.css b/build/static/css/main.2f41c32c.css new file mode 100644 index 000000000..8640bccdb --- /dev/null +++ b/build/static/css/main.2f41c32c.css @@ -0,0 +1,2 @@ +@import url(https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200);@layer user{body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:root{--line-height:1.25;--spacing:0.25rem;--typography-spacing-vertical:1.15rem;--grid-spacing-horizontal:var(--spacing);--grid-spacing-vertical:var(--spacing);--form-element-spacing-vertical:0.15rem;--form-element-spacing-horizontal:0.25rem;--font-family:Poppins,system-ui,-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-size-monospace:16px;--font-family-monospace:"JetBrains Mono",source-code-pro,Menlo,Monaco,Consolas,"Roboto Mono","Ubuntu Monospace","Noto Mono","Oxygen Mono","Liberation Mono",monospace,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--card-border-color:#000}@media only screen and (prefers-color-scheme:dark){:root:not([data-theme=light]){--card-border-color:#fff}}[data-theme=dark]{--card-border-color:#fff}}@layer component{.scroll-x{overflow-x:auto}.scroll-y{overflow-y:auto}.font-monospace,code,kbd{font-family:var(--font-family-monospace);font-size:var(--font-size-monospace)}del{text-decoration:none}textarea{font-family:var(--font-family-monospace);font-size:var(--font-size-monospace);overflow:scroll;white-space:pre}article.fill{margin:0;padding:0}article.no-shadow{box-shadow:none}article.panel{border:solid var(--border-width) var(--card-border-color);border-radius:0;box-shadow:none;display:flex;flex-direction:column;margin:0;overflow-y:auto;padding:0}article.panel>header{border-radius:0;font-weight:700;margin:0;padding:0}article.panel>header>:first-child{padding:0 var(--block-spacing-vertical)}article.panel main{flex:1 1}details{margin-bottom:0;padding-bottom:0}details>summary{align-items:baseline;background-color:var(--card-sectionning-background-color);display:flex;flex-direction:row;font-weight:700;padding:calc(var(--block-spacing-vertical)*.66) var(--block-spacing-horizontal)}details>summary>:first-child{flex:1 1;padding:0 var(--block-spacing-horizontal)}#root{display:flex;flex-direction:column;inset:0;position:absolute}#root header{align-items:baseline;display:flex;flex-direction:row;justify-content:space-between}#root>main{overflow:hidden}#root>footer{align-items:baseline;background-color:var(--card-background-color);border-top:1px solid var(--card-border-color);padding-left:var(--block-spacing-horizontal);padding-top:calc(var(--block-spacing-vertical)/2)}nav ol,nav ul{margin-right:0}nav li{padding:0 var(--nav-link-spacing-horizontal)}td{vertical-align:top}}.material-symbols-outlined{font-variation-settings:"FILL" 0,"wght" 400,"GRAD" 0,"opsz" 24}ul.icon-list li{--raise:-20px;--time:0.33s;align-items:center;display:flex;flex-direction:column}ul.icon-list li a,ul.icon-list li span{position:relative;top:0;transition:var(--time)}ul.icon-list li a{opacity:0}ul.icon-list li:hover a,ul.icon-list li:hover span{top:var(--raise)}ul.icon-list li:hover a{opacity:1}#trackingBanner{background-color:#f8f8ff;border-top:1px solid #000;bottom:0;left:0;padding:var(--spacing);position:absolute;right:0}#trackingBanner [role=button].accept{background-color:#90ee90;color:#000}#trackingBanner [role=button].reject{background-color:#ffb6c1;color:#000}[role=group]{display:flex;flex-direction:row;margin:0}[role=group] [role=button],[role=group] button,[role=group] input,[role=group] select{margin:0}[role=group] [role=button]:not(:first-child),[role=group] button:not(:first-child),[role=group] input:not(:first-child),[role=group] select:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}[role=group] [role=button]:not(:last-child),[role=group] button:not(:last-child),[role=group] input:not(:last-child),[role=group] select:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}[role=group] [role=button][aria-current=true],[role=group] button[aria-current=true],[role=group] input[aria-current=true],[role=group] select[aria-current=true]{background-color:var(--primary-inverse);color:var(--primary)}[role=group] [role=button] input[type=checkbox],[role=group] [role=button] input[type=radio],[role=group] button input[type=checkbox],[role=group] button input[type=radio],[role=group] input input[type=checkbox],[role=group] input input[type=radio],[role=group] select input[type=checkbox],[role=group] select input[type=radio]{display:none}dl{display:grid;grid-template-columns:minmax(-webkit-max-content,1fr) minmax(auto,2fr);grid-template-columns:minmax(max-content,1fr) minmax(auto,2fr)}dl>header{background-color:var(--muted-color);color:var(--primary-inverse);font-weight:700;grid-column:1/span 2;padding:var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal)}dl dt{grid-column-start:1}dl dd{grid-column-start:2;margin:0}dl dd,dl dt{border:1px solid var(--muted-border-color);padding:var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal)}dl dd:nth-of-type(2n),dl dt:nth-of-type(2n){background-color:var(--table-row-stripped-background-color)}.flex{display:flex;flex-direction:column}.flex.row{flex-direction:row}.flex.row.inline>*{display:inline-block}.flex.justify-around{justify-content:space-around}.flex.justify-between{justify-content:space-between}.flex.justify-center{justify-content:center}.flex.align-baseline{align-items:baseline}.flex.align-center{align-items:center}.flex.align-stretch{align-items:stretch}.flex.align-end{align-items:end}.flex-0{flex-basis:0}.flex-1{flex:1 1}.flex-2{flex:2 1}.flex-3{flex:3 1}.flex-4{flex:4 1} +/*# sourceMappingURL=main.2f41c32c.css.map*/ \ No newline at end of file diff --git a/build/static/css/main.2f41c32c.css.map b/build/static/css/main.2f41c32c.css.map new file mode 100644 index 000000000..b0070f1e3 --- /dev/null +++ b/build/static/css/main.2f41c32c.css.map @@ -0,0 +1 @@ +{"version":3,"file":"static/css/main.2f41c32c.css","mappings":"kIAAA,YACE,KACE,mCACA,kCAGF,MACE,kBAAmB,CAEnB,iBAAkB,CAElB,qCAAsC,CAEtC,wCAAyC,CACzC,sCAAuC,CACvC,uCAAwC,CAExC,yCAA0C,CAE1C,yLAGA,0BAA2B,CAC3B,gPAIA,wBAA0B,CAG5B,mDACE,8BACE,wBAA0B,CAA1B,CAIJ,kBACE,wBAA0B,CAA1B,CAIJ,iBACE,UACE,gBAGF,UACE,gBAGF,yBAGE,yCACA,qCAGF,IACE,qBAGF,SAGE,yCACA,qCAHA,gBACA,eAEA,CAGF,aAEE,QAAO,CADP,SACA,CAGF,kBACE,gBAIF,cACE,0DAGA,gBACA,gBACA,aACA,sBAJA,SAKA,gBANA,SAMA,CAEA,qBAIE,eAAc,CADd,gBADA,SADA,SAGA,CAGF,kCACE,wCAGF,mBACE,SAKJ,QACE,gBACA,iBAEA,gBAGE,qBACA,0DAHA,aACA,mBAKA,gBAFA,+EAEA,CAGF,6BACE,SACA,0CAIJ,MAGE,aACA,sBAFA,QADA,iBAGA,CAEA,aAIE,qBAHA,aACA,mBACA,6BACA,CAGF,WACE,gBAGF,aAKE,qBAHA,8CADA,8CAGA,6CADA,iDAEA,CAIJ,cAEE,eAGF,OACE,6CAGF,GACE,oBChKJ,2BACE,+DAIA,gBAKE,aAAc,CACd,YAAY,CAHZ,mBAFA,aACA,qBAIa,CAEb,uCAEE,kBACA,MACA,uBAGF,kBACE,UAIA,mDAEE,iBAGF,wBACE,UChCR,gBACE,yBACA,0BAGA,SACA,OAFA,uBADA,kBAIA,QAGE,qCAEE,yBADA,UACA,CAGF,qCAEE,yBADA,UACA,CCjBN,aAEE,aACA,mBAFA,QAEA,CAEA,sFAIE,SAEA,8JAEE,2BAA0B,CAD1B,wBACA,CAGF,0JAEE,4BAA2B,CAD3B,yBACA,CAGF,kKACE,wCACA,qBAGF,wUAEE,aC5BN,GACE,aACA,sIAEA,UAGE,oCACA,6BAFA,gBADA,qBAIA,oFAIF,MACE,oBAGF,MACE,oBACA,SAGF,YAIE,2CAFA,mFAEA,CAEA,4CACE,4DC7BN,MACE,aACA,sBAEA,UACE,mBAEA,mBACE,qBAIJ,qBACE,6BAGF,sBACE,8BAGF,qBACE,uBAGF,qBACE,qBAGF,mBACE,mBAGF,oBACE,oBAGF,gBACE,gBAIJ,QACE,aAIA,QACE,QAFS,CACX,QACE,QAFS,CACX,QACE,QAFS,CACX,QACE,QAFS","sources":["pico/pico.scss","pico/icon.scss","tracking.scss","pico/button-group.scss","pico/property.scss","pico/flex.scss"],"sourcesContent":["@layer user {\n body {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n :root {\n --line-height: 1.25;\n /* 1.5 */\n --spacing: 0.25rem;\n /* 1rem */\n --typography-spacing-vertical: 1.15rem;\n /* 1.5rem */\n --grid-spacing-horizontal: var(--spacing);\n --grid-spacing-vertical: var(--spacing);\n --form-element-spacing-vertical: 0.15rem;\n /* .75rem */\n --form-element-spacing-horizontal: 0.25rem;\n /* 1rem */\n --font-family: Poppins, system-ui, -apple-system, \"Segoe UI\", Roboto, Oxygen,\n Ubuntu, Cantarell, \"Noto Sans\", sans-serif, \"Apple Color Emoji\",\n \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n --font-size-monospace: 16px;\n --font-family-monospace: \"JetBrains Mono\", source-code-pro, Menlo, Monaco,\n Consolas, \"Roboto Mono\", \"Ubuntu Monospace\", \"Noto Mono\", \"Oxygen Mono\",\n \"Liberation Mono\", monospace, \"Apple Color Emoji\", \"Segoe UI Emoji\",\n \"Segoe UI Symbol\", \"Noto Color Emoji\";\n --card-border-color: black;\n }\n\n @media only screen and (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --card-border-color: white;\n }\n }\n\n [data-theme=\"dark\"] {\n --card-border-color: white;\n }\n}\n\n@layer component {\n .scroll-x {\n overflow-x: auto;\n }\n\n .scroll-y {\n overflow-y: auto;\n }\n\n code,\n kbd,\n .font-monospace {\n font-family: var(--font-family-monospace);\n font-size: var(--font-size-monospace);\n }\n\n del {\n text-decoration: none;\n }\n\n textarea {\n overflow: scroll;\n white-space: pre;\n font-family: var(--font-family-monospace);\n font-size: var(--font-size-monospace);\n }\n\n article.fill {\n padding: 0;\n margin: 0;\n }\n\n article.no-shadow {\n box-shadow: none;\n }\n\n // Tighten up panel articles\n article.panel {\n border: solid var(--border-width) var(--card-border-color);\n padding: 0;\n margin: 0;\n border-radius: 0;\n box-shadow: none;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n\n > header {\n padding: 0;\n margin: 0;\n font-weight: bold;\n border-radius: 0;\n }\n\n > header > *:first-child {\n padding: 0 var(--block-spacing-vertical);\n }\n\n main {\n flex: 1;\n }\n }\n\n // Tighten up accordian headers\n details {\n margin-bottom: 0;\n padding-bottom: 0;\n\n > summary {\n display: flex;\n flex-direction: row;\n align-items: baseline;\n background-color: var(--card-sectionning-background-color);\n padding: calc(var(--block-spacing-vertical) * 0.66)\n var(--block-spacing-horizontal);\n font-weight: bold;\n }\n\n > summary > *:first-child {\n flex: 1;\n padding: 0 var(--block-spacing-horizontal);\n }\n }\n\n #root {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n\n header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: baseline;\n }\n\n > main {\n overflow: hidden;\n }\n\n > footer {\n border-top: 1px solid var(--card-border-color);\n background-color: var(--card-background-color);\n padding-top: calc(var(--block-spacing-vertical) / 2);\n padding-left: var(--block-spacing-horizontal);\n align-items: baseline;\n }\n }\n\n nav ol,\n nav ul {\n margin-right: 0;\n }\n\n nav li {\n padding: 0 var(--nav-link-spacing-horizontal);\n }\n\n td {\n vertical-align: top;\n }\n}\n","@import url(\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\");\n.material-symbols-outlined {\n font-variation-settings: \"FILL\" 0, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24;\n}\n\nul.icon-list {\n li {\n display: flex;\n flex-direction: column;\n align-items: center;\n\n --raise: -20px;\n --time: 0.33s;\n\n span,\n a {\n position: relative;\n top: 0;\n transition: var(--time);\n }\n\n a {\n opacity: 0;\n }\n\n &:hover {\n span,\n a {\n top: var(--raise);\n }\n\n a {\n opacity: 1;\n }\n }\n }\n}\n","#trackingBanner {\n background-color: ghostwhite;\n border-top: 1px solid black;\n position: absolute;\n padding: var(--spacing);\n bottom: 0;\n left: 0;\n right: 0;\n\n [role=\"button\"] {\n &.accept {\n color: black;\n background-color: lightgreen;\n }\n\n &.reject {\n color: black;\n background-color: lightpink;\n }\n }\n}\n","[role=\"group\"] {\n margin: 0;\n display: flex;\n flex-direction: row;\n\n button,\n [role=\"button\"],\n input,\n select {\n margin: 0;\n\n &:not(:first-child) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n &:not(:last-child) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n &[aria-current=\"true\"] {\n background-color: var(--primary-inverse);\n color: var(--primary);\n }\n\n input[type=\"radio\"],\n input[type=\"checkbox\"] {\n display: none;\n }\n }\n}\n","dl {\n display: grid;\n grid-template-columns: minmax(max-content, 1fr) minmax(auto, 2fr);\n\n > header {\n grid-column: 1 / span 2;\n font-weight: bold;\n background-color: var(--muted-color);\n color: var(--primary-inverse);\n padding: var(--form-element-spacing-vertical)\n var(--form-element-spacing-horizontal);\n }\n\n dt {\n grid-column-start: 1;\n }\n\n dd {\n grid-column-start: 2;\n margin: 0;\n }\n\n dd,\n dt {\n padding: var(--form-element-spacing-vertical)\n var(--form-element-spacing-horizontal);\n border: 1px solid var(--muted-border-color);\n\n &:nth-of-type(even) {\n background-color: var(--table-row-stripped-background-color);\n }\n }\n}\n",".flex {\n display: flex;\n flex-direction: column;\n\n &.row {\n flex-direction: row;\n\n &.inline > * {\n display: inline-block;\n }\n }\n\n &.justify-around {\n justify-content: space-around;\n }\n\n &.justify-between {\n justify-content: space-between;\n }\n\n &.justify-center {\n justify-content: center;\n }\n\n &.align-baseline {\n align-items: baseline;\n }\n\n &.align-center {\n align-items: center;\n }\n\n &.align-stretch {\n align-items: stretch;\n }\n\n &.align-end {\n align-items: end;\n }\n}\n\n.flex-0 {\n flex-basis: 0;\n}\n\n@for $i from 1 through 4 {\n .flex-#{$i} {\n flex: $i;\n }\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/2.0c1eab19.chunk.js b/build/static/js/2.0c1eab19.chunk.js new file mode 100644 index 000000000..9ab3da7cc --- /dev/null +++ b/build/static/js/2.0c1eab19.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[2],{5002:function(e,r,t){t.r(r),t.d(r,{default:function(){return D}});var n=t(1092),a=t(189),s=t(9422),u=t(649),i=t(1026),c=t(7791),o=t(8061),p=t(8698),f=t(8582),l=t(1277),d=t(4625),m=t(8090),h=t(9647),x=t(691),Z=t(3389),v=function(e){var r=m.Gq.parse(e.hdl),t=h.qH.parse(e.tst);return(0,a.Z)((0,a.Z)({},e),{},{maybeParsedHDL:r,maybeParsedTST:t})},b=function(e,r){var t=function(e){return function(){var r=(0,c.Z)((0,n.Z)().mark((function r(t){var s,u,i;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(0,d.dZ)(t.maybeChip)){r.next=2;break}return r.abrupt("return",(0,a.Z)((0,a.Z)({},t),{},{pass:!1,out:(0,d.UG)(t.maybeChip).message}));case 2:if(!(0,d.dZ)(t.maybeTest)){r.next=4;break}return r.abrupt("return",(0,a.Z)((0,a.Z)({},t),{},{pass:!1,out:(0,d.UG)(t.maybeTest).message}));case 4:return s=(0,d.Ok)(t.maybeTest).with((0,d.Ok)(t.maybeChip)).setFileSystem(e),r.next=7,s.run();case 7:return u=s.log(),i=u.trim()===t.cmp.trim(),r.abrupt("return",(0,a.Z)((0,a.Z)({},t),{},{out:u,pass:i}));case 10:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}()}(e),s=function(e){return function(){var r=(0,c.Z)((0,n.Z)().mark((function r(t){var s,u;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(0,d.IY)(t.maybeParsedHDL)){r.next=6;break}return r.next=3,(0,x.J_)((0,d.Ok)(t.maybeParsedHDL),e);case 3:r.t0=r.sent,r.next=7;break;case 6:r.t0=(0,d.UG)(new Error("HDL Was not parsed"));case 7:return s=r.t0,u=(0,d.IY)(t.maybeParsedTST)?(0,d.Ok)(Z.l1.from((0,d.Ok)(t.maybeParsedTST))):(0,d.UG)(new Error("TST Was not parsed")),r.abrupt("return",(0,a.Z)((0,a.Z)({},t),{},{maybeChip:s,maybeTest:u}));case 10:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}()}(e);return function(){var e=(0,c.Z)((0,n.Z)().mark((function e(u){var o,p,f,l,d,m;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(){var e=(0,c.Z)((0,n.Z)().mark((function e(){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=t,e.t1=s,e.next=4,v(u);case 4:return e.t2=e.sent,e.next=7,(0,e.t1)(e.t2);case 7:return e.t3=e.sent,e.abrupt("return",(0,e.t0)(e.t3));case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=(0,c.Z)((0,n.Z)().mark((function e(){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null===r||void 0===r?void 0:r.hdl(u));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.next=4,Promise.all([o(),p()]);case 4:return f=e.sent,l=(0,i.Z)(f,2),d=l[0],m=l[1],e.abrupt("return",(0,a.Z)((0,a.Z)({},d),{},{shadow:m}));case 9:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}()};function w(e,r,t,n){return y.apply(this,arguments)}function y(){return y=(0,c.Z)((0,n.Z)().mark((function e(r,t,a,s){var u;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=b(a,s),e.abrupt("return",Promise.all(r.map(t).map(function(){var e=(0,c.Z)((0,n.Z)().mark((function e(r){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=u,e.next=3,r;case 3:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1));case 5:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}())));case 2:case"end":return e.stop()}}),e)}))),y.apply(this,arguments)}var k=t(6167),j=t(7878);function g(e){var r=e.name,t=e.ext;return void 0!==l.Assignments[r]&&".hdl"===t}var T=function(e){return(0,j.jsxs)("details",{children:[(0,j.jsxs)("summary",{children:[e.name," ",e.pass?(0,j.jsx)(o.cC,{id:"Passed"}):(0,j.jsx)(o.cC,{id:"Failed"})]}),(0,j.jsxs)("div",{className:"flex row",children:[(0,j.jsx)("pre",{children:(0,j.jsx)("code",{children:e.hdl})}),(0,j.jsx)("pre",{children:(0,j.jsx)("code",{children:e.tst})})]}),(0,j.jsx)(f.M,{cmp:e.cmp,out:e.out})]})};function P(e){return C.apply(this,arguments)}function C(){return C=(0,c.Z)((0,n.Z)().mark((function e(r){var t,s,u,i,c,o;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=l.Assignments[r.name],e.next=3,null===(s=r.file)||void 0===s?void 0:s.text();case 3:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=7;break}e.t0=void 0!==t;case 7:if(!e.t0){e.next=11;break}e.t2=t,e.next=12;break;case 11:e.t2="";case 12:return i=e.t2,c=u["".concat(r.name,".tst")],o=u["".concat(r.name,".cmp")],e.abrupt("return",(0,a.Z)((0,a.Z)({},r),{},{hdl:i,tst:c,cmp:o}));case 16:case"end":return e.stop()}}),e)}))),C.apply(this,arguments)}var D=function(){var e=(0,k.useState)([]),r=(0,i.Z)(e,2),t=r[0],o=r[1],f=(0,p.Q)().fs,l=(0,k.useCallback)(function(){var e=(0,c.Z)((0,n.Z)().mark((function e(r){var t,i,p,l;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.target,e.next=3,Promise.all((0,u.Z)(null!==(t=i.files)&&void 0!==t?t:[]).filter((function(e){return e.name.endsWith(".hdl")})).map((function(e){var r,t,n,a,u=null!==(r=null===(t=e.name.match((0,s.Z)(/^((.*)(\.[^.]*))?$/,{base:1,name:2,ext:3})))||void 0===t?void 0:t.groups)&&void 0!==r?r:{},i=u.name,c=u.base;return{name:i,base:c,ext:u.ext,dir:null!==(n="/"+(null===(a=e.webkitRelativePath)||void 0===a?void 0:a.replace(c,"")))&&void 0!==n?n:"",root:"/",file:e}})).filter(g).map(function(){var e=(0,c.Z)((0,n.Z)().mark((function e(r){var t;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.file.text();case 2:return t=e.sent,e.abrupt("return",(0,a.Z)((0,a.Z)({},r),{},{hdl:t}));case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}()));case 3:return p=e.sent,e.next=6,w(p,P,f);case 6:l=e.sent,f.pushd("/samples"),o(l),f.popd();case 10:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),[o,f]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:"NAND2Tetris Web IDE"}),(0,j.jsx)("form",{children:(0,j.jsxs)("fieldset",{children:[(0,j.jsx)("legend",{children:"Files for grading:"}),(0,j.jsx)("input",{type:"file",multiple:!0,directory:"",webkitdirectory:"",onChange:l})]})}),(0,j.jsx)("figure",{children:t.length>0?t.map((function(e,r){return(0,j.jsx)(T,(0,a.Z)({},e),e.name)})):(0,j.jsx)(j.Fragment,{})})]})}}}]); +//# sourceMappingURL=2.0c1eab19.chunk.js.map \ No newline at end of file diff --git a/build/static/js/2.0c1eab19.chunk.js.map b/build/static/js/2.0c1eab19.chunk.js.map new file mode 100644 index 000000000..8fdce7f4c --- /dev/null +++ b/build/static/js/2.0c1eab19.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/2.0c1eab19.chunk.js","mappings":"2TAkDaA,EAAa,SAACC,GACzB,IAAMC,EAAiBC,EAAAA,GAAAA,MAAUF,EAAKG,KAChCC,EAAiBC,EAAAA,GAAAA,MAAUL,EAAKM,KACtC,OAAO,kBAAKN,GAAI,IAAEC,eAAAA,EAAgBG,eAAAA,GACpC,EA2CaG,EAAS,SAACC,EAAgBC,GACrC,IAAMC,EA3BN,SAACF,GAAc,gDACf,WAAOG,GAA2B,qFAC5BC,EAAAA,EAAAA,IAAMD,EAAWE,WAAY,CAAF,2DAExBF,GAAU,IACbG,MAAM,EACNC,KAAKC,EAAAA,EAAAA,IAAIL,EAAWE,WAAWI,WAAO,YAGtCL,EAAAA,EAAAA,IAAMD,EAAWO,WAAY,CAAF,2DAExBP,GAAU,IACbG,MAAM,EACNC,KAAKC,EAAAA,EAAAA,IAAIL,EAAWO,WAAWD,WAAO,OAKtB,OAFdE,GAAOC,EAAAA,EAAAA,IAAGT,EAAWO,WACxBG,MAAKD,EAAAA,EAAAA,IAAGT,EAAWE,YACnBS,cAAcd,GAAG,SACdW,EAAKI,MAAK,OAEiC,OAD3CR,EAAMI,EAAKK,MACXV,EAAOC,EAAIU,SAAWd,EAAWe,IAAID,OAAM,qCACrCd,GAAU,IAAEI,IAAAA,EAAKD,KAAAA,KAAI,4CAClC,mDAvBc,EAuBd,CAIoBa,CAAOnB,GACtBoB,EAzCN,SAACpB,GAAc,gDACf,WAAOR,GAAqB,mFACR6B,EAAAA,EAAAA,IAAK7B,EAAKC,gBAAe,iCACjC6B,EAAAA,EAAAA,KAAUV,EAAAA,EAAAA,IAAGp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EAAM,YAAG,QAAI,GAElCI,KAHlB,IAGwBpE,KAAAA,EACvC,IACC4D,OAAOhB,GACPD,IAAG,yCAAC,WAAO3C,GAAI,4FACIA,EAAKA,KAAKoD,OAAO,KAAD,EAAzB,OAAHjD,EAAG,4CACGH,GAAI,IAAEG,IAAAA,KAAG,2CACtB,mDAHG,KAIN,KAAD,EAlBU,OAALsC,EAAK,gBAoBSD,EAASC,EAAOC,EAAgBlC,GAAI,KAAD,EAAjD8C,EAAK,OAEX9C,EAAG6D,MAAM,YACTd,EAASD,GACT9C,EAAG8D,OAAO,4CACX,mDA3ByB,GA4B1B,CAACf,EAAU/C,IAGb,OACE,iCACE,wBAAI,yBACJ,2BACE,iCACE,4BAAQ,wBACR,kBACE+D,KAAK,OACLC,UAAQ,EACRC,UAAU,GACVC,gBAAgB,GAChBjB,SAAUA,UAIhB,4BACGH,EAAMqB,OAAS,EACdrB,EAAMX,KAAI,SAACiC,EAAGC,GAAC,OAAK,SAAC5B,GAAU,UAAkB2B,GAAZA,EAAE/B,KAAe,KAEtD,4BAKV,C","sources":["../../simulator/src/projects/runner.ts","pages/home.tsx"],"sourcesContent":["import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport {\n isOk,\n Ok,\n Err,\n isErr,\n Result,\n} from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { Assignments, Assignment } from \"@nand2tetris/projects/index.js\";\nimport type { Runner, RunResult } from \"@nand2tetris/runner/types.js\";\nimport { HDL, HdlParse } from \"../languages/hdl.js\";\nimport { Tst, TST } from \"../languages/tst.js\";\nimport { build as buildChip } from \"../chip/builder.js\";\nimport { ChipTest } from \"../tst.js\";\nimport { ParseError } from \"../languages/base.js\";\nimport { Chip } from \"../chip/chip.js\";\n\nexport interface AssignmentFiles extends Assignment {\n hdl: string;\n tst: string;\n cmp: string;\n}\n\nexport interface AssignmentParse extends AssignmentFiles {\n maybeParsedHDL: Result;\n maybeParsedTST: Result;\n}\n\nexport interface AssignmentBuild extends AssignmentParse {\n maybeChip: Result;\n maybeTest: Result;\n}\n\nexport interface AssignmentRun extends AssignmentBuild {\n pass: boolean;\n out: string;\n shadow?: RunResult;\n}\n\nexport const hasTest = ({\n name,\n ext,\n}: {\n name: string;\n ext: string;\n}): boolean =>\n Assignments[name as keyof typeof Assignments] !== undefined &&\n [\".hdl\", \".tst\"].includes(ext);\n\n/** Try parsing the loaded files. */\nexport const maybeParse = (file: AssignmentFiles): AssignmentParse => {\n const maybeParsedHDL = HDL.parse(file.hdl);\n const maybeParsedTST = TST.parse(file.tst);\n return { ...file, maybeParsedHDL, maybeParsedTST };\n};\n\n/** After parsing the assignment, compile the Chip and Tst. */\nexport const maybeBuild =\n (fs: FileSystem) =>\n async (file: AssignmentParse): Promise => {\n const maybeChip = isOk(file.maybeParsedHDL)\n ? await buildChip(Ok(file.maybeParsedHDL), fs)\n : Err(new Error(\"HDL Was not parsed\"));\n const maybeTest = isOk(file.maybeParsedTST)\n ? Ok(ChipTest.from(Ok(file.maybeParsedTST)))\n : Err(new Error(\"TST Was not parsed\"));\n return { ...file, maybeChip, maybeTest };\n };\n\n/** If the assignment parsed, run it! */\nexport const tryRun =\n (fs: FileSystem) =>\n async (assignment: AssignmentBuild): Promise => {\n if (isErr(assignment.maybeChip)) {\n return {\n ...assignment,\n pass: false,\n out: Err(assignment.maybeChip).message,\n };\n }\n if (isErr(assignment.maybeTest)) {\n return {\n ...assignment,\n pass: false,\n out: Err(assignment.maybeTest).message,\n };\n }\n const test = Ok(assignment.maybeTest)\n .with(Ok(assignment.maybeChip))\n .setFileSystem(fs);\n await test.run();\n const out = test.log();\n const pass = out.trim() === assignment.cmp.trim();\n return { ...assignment, out, pass };\n };\n\n/** Parse & execute a Nand2tetris assignment, possibly also including the Java output in shadow mode. */\nexport const runner = (fs: FileSystem, ideRunner?: Runner) => {\n const tryRunWithFs = tryRun(fs);\n const maybeBuildWithFs = maybeBuild(fs);\n return async (assignment: AssignmentFiles): Promise => {\n const jsRunner = async () =>\n tryRunWithFs(await maybeBuildWithFs(await maybeParse(assignment)));\n const javaRunner = async () => ideRunner?.hdl(assignment);\n\n const [jsRun, shadow] = await Promise.all([jsRunner(), javaRunner()]);\n return { ...jsRun, shadow };\n };\n};\n\n/** Run all tests for a given Nand2Tetris project. */\nexport async function runTests(\n files: Array,\n loadAssignment: (file: Assignment) => Promise,\n fs: FileSystem,\n ideRunner?: Runner\n): Promise {\n const run = runner(fs, ideRunner);\n return Promise.all(\n files.map(loadAssignment).map(async (assignment) => run(await assignment))\n );\n}\n","import { useBaseContext } from \"@nand2tetris/components/stores/base.context\";\nimport { DiffTable } from \"@nand2tetris/components/difftable\";\nimport { Assignments, ParsedPath } from \"@nand2tetris/projects/index.js\";\nimport { runTests } from \"@nand2tetris/simulator/projects/runner.js\";\nimport { Trans } from \"@lingui/macro\";\nimport { ChangeEventHandler, useCallback, useState } from \"react\";\n// import { parse, ParsedPath } from \"node:path\";\n\nfunction hasTest({ name, ext }: { name: string; ext: string }) {\n return (\n Assignments[name as keyof typeof Assignments] !== undefined &&\n ext === \".hdl\"\n );\n}\n\nconst TestResult = (props: {\n name: string;\n pass: boolean;\n hdl: string;\n tst: string;\n cmp: string;\n out: string;\n}) => (\n
\n \n {props.name} {props.pass ? Passed : Failed}\n \n
\n
\n        {props.hdl}\n      
\n
\n        {props.tst}\n      
\n
\n \n
\n);\n\nasync function loadAssignment(file: ParsedPath & { file?: File }) {\n const assignment = Assignments[file.name as keyof typeof Assignments];\n const hdl = (await file.file?.text()) ?? \"\";\n const tst = assignment[\n `${file.name}.tst` as keyof typeof assignment\n ] as string;\n const cmp = assignment[\n `${file.name}.cmp` as keyof typeof assignment\n ] as string;\n return { ...file, hdl, tst, cmp };\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line\n interface HTMLAttributes {\n // extends React's HTMLAttributes\n directory?: string;\n webkitdirectory?: string;\n }\n}\n\nconst Home = () => {\n const [tests, setTests] = useState(\n [] as Array[0]>\n );\n const { fs } = useBaseContext();\n\n const onChange = useCallback>(\n async ({ target }) => {\n const files = await Promise.all(\n [...(target.files ?? [])]\n .filter((file) => file.name.endsWith(\".hdl\"))\n .map((file) => {\n const { name, base, ext } =\n file.name.match(/^(?(?.*)(?\\.[^.]*))?$/)\n ?.groups ?? {};\n\n const root = \"/\";\n const dir = root + file.webkitRelativePath?.replace(base, \"\") ?? \"\";\n\n return { name, base, ext, dir, root, file };\n })\n .filter(hasTest)\n .map(async (file) => {\n const hdl = await file.file.text();\n return { ...file, hdl };\n })\n );\n\n const tests = await runTests(files, loadAssignment, fs);\n\n fs.pushd(\"/samples\");\n setTests(tests);\n fs.popd();\n },\n [setTests, fs]\n );\n\n return (\n <>\n

NAND2Tetris Web IDE

\n
\n
\n Files for grading:\n \n
\n
\n
\n {tests.length > 0 ? (\n tests.map((t, i) => )\n ) : (\n <>\n )}\n
\n \n );\n};\n\nexport default Home;\n"],"names":["maybeParse","file","maybeParsedHDL","HDL","hdl","maybeParsedTST","TST","tst","runner","fs","ideRunner","tryRunWithFs","assignment","isErr","maybeChip","pass","out","Err","message","maybeTest","test","Ok","with","setFileSystem","run","log","trim","cmp","tryRun","maybeBuildWithFs","isOk","buildChip","Error","ChipTest","maybeBuild","jsRunner","javaRunner","Promise","all","jsRun","shadow","runTests","files","loadAssignment","map","hasTest","name","ext","undefined","Assignments","TestResult","props","className","text","useState","tests","setTests","useBaseContext","onChange","useCallback","target","filter","endsWith","match","groups","base","dir","webkitRelativePath","replace","root","pushd","popd","type","multiple","directory","webkitdirectory","length","t","i"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/277.355c3689.chunk.js b/build/static/js/277.355c3689.chunk.js new file mode 100644 index 000000000..d3354033f --- /dev/null +++ b/build/static/js/277.355c3689.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[277],{1277:function(t,n,e){e.r(n),e.d(n,{ASM_PROJECTS:function(){return R},Assignments:function(){return D},CHIP_PROJECTS:function(){return w},ChipProjects:function(){return C},resetFiles:function(){return g}});var s={};e.r(s),e.d(s,{CHIPS:function(){return i},resetFiles:function(){return c}});var u={};e.r(u),e.d(u,{CHIPS:function(){return k},resetFiles:function(){return v}});var o={};e.r(o),e.d(o,{CHIPS:function(){return f},resetFiles:function(){return h}});var a={};e.r(a),e.d(a,{CHIPS:function(){return z},resetFiles:function(){return b}});var d=e(189),p=e(1092),l=e(7791),r=e(9956),i={Not:{"Not.hdl":"// Not gate: out = not in\n\nCHIP Not {\n IN in;\n OUT out;\n\n PARTS:\n}","Not.tst":"output-list in%B3.1.3 out%B3.1.3;\n\nset in 0, eval, output;\nset in 1, eval, output;","Not.cmp":"| in | out |\n| 0 | 1 |\n| 1 | 0 |"},And:{"And.hdl":"/**\n * And gate: out = 1 if {a==1 and b==1}, 0 otherwise\n * And gate: if {a==1 and b==1} then out = 1 else out = 0\n */\n\nCHIP And {\n IN a, b;\n OUT out;\n\n PARTS:\n}","And.tst":"output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;","And.cmp":"| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 0 |\n| 1 | 0 | 0 |\n| 1 | 1 | 1 |"},Or:{"Or.hdl":"/**\n * Or gate: out = 1 if {a==1 or b==1}, 0 otherwise\n */\n\nCHIP Or {\n IN a, b;\n OUT out;\n\n PARTS:\n}","Or.tst":"output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;","Or.cmp":"| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 1 |\n| 1 | 0 | 1 |\n| 1 | 1 | 1 |"},XOr:{"XOr.hdl":"/**\n * Exclusive-or gate: out = !(a == b).\n */\n\nCHIP XOr {\n IN a, b;\n OUT out;\n\n PARTS:\n}","XOr.tst":"output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;","XOr.cmp":"| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 1 |\n| 1 | 0 | 1 |\n| 1 | 1 | 0 |"},Mux:{"Mux.hdl":"// Multiplexor. If sel==1 then out=b else out=a.\n\nCHIP Mux {\n IN a, b, sel;\n OUT out;\n\n PARTS:\n}","Mux.tst":"output-list a%B3.1.3 b%B3.1.3 sel%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 0, set b 1, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 1, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 1, set b 1, set sel 0, eval, output;\nset sel 1, eval, output;","Mux.cmp":"| a | b | sel | out |\n| 0 | 0 | 0 | 0 |\n| 0 | 0 | 1 | 0 |\n| 0 | 1 | 0 | 0 |\n| 0 | 1 | 1 | 1 |\n| 1 | 0 | 0 | 1 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |\n| 1 | 1 | 1 | 1 |"},DMux:{"DMux.hdl":"/**\n * Demultiplexor.\n * {a,b} = {in,0} if sel==0\n * {0,in} if sel==1\n */\n\nCHIP DMux {\n IN in, sel;\n OUT a, b;\n\n PARTS:\n}","DMux.tst":"output-list in%B3.1.3 sel%B3.1.3 a%B3.1.3 b%B3.1.3;\n\nset in 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset in 1, set sel 0, eval, output;\nset sel 1, eval, output;","DMux.cmp":"| in | sel | a | b |\n| 0 | 0 | 0 | 0 |\n| 0 | 1 | 0 | 0 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |"},Not16:{"Not16.hdl":"// 16-bit Not gate: for i=0..15: out[i] = not in[i]\n\nCHIP Not16 {\n IN in[16];\n OUT out[16];\n\n PARTS:\n}","Not16.tst":"output-list in%B1.16.1 out%B1.16.1;\nset in %B0000000000000000, eval, output;\nset in %B1111111111111111, eval, output;\nset in %B1010101010101010, eval, output;\nset in %B0011110011000011, eval, output;\nset in %B0001001000110100, eval, output;","Not16.cmp":"| in | out |\n| 0000000000000000 | 1111111111111111 |\n| 1111111111111111 | 0000000000000000 |\n| 1010101010101010 | 0101010101010101 |\n| 0011110011000011 | 1100001100111100 |\n| 0001001000110100 | 1110110111001011 |"},And16:{"And16.hdl":"// 16-bit-wise and gate: for i = 0..15: out[i] = a[i] and b[i]\n\nCHIP And16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}","And16.tst":"output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\n\nset a %B0000000000000000, set b %B0000000000000000, eval, output;\nset a %B0000000000000000, set b %B1111111111111111, eval, output;\nset a %B1111111111111111, set b %B1111111111111111, eval, output;\nset a %B1010101010101010, set b %B0101010101010101, eval, output;\nset a %B0011110011000011, set b %B0000111111110000, eval, output;\nset a %B0001001000110100, set b %B1001100001110110, eval, output;","And16.cmp":"| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0000000000000000 |\n| 1111111111111111 | 1111111111111111 | 1111111111111111 |\n| 1010101010101010 | 0101010101010101 | 0000000000000000 |\n| 0011110011000011 | 0000111111110000 | 0000110011000000 |\n| 0001001000110100 | 1001100001110110 | 0001000000110100 |"},Or16:{"Or16.hdl":"// 16-bit bitwise Or gate: for i=0..15 out[i] = a[i] or b[i].\n\nCHIP Or16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}","Or16.tst":"output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\nset a %B0000000000000000, set b %B0000000000000000, eval, output;\nset a %B0000000000000000, set b %B1111111111111111, eval, output;\nset a %B1111111111111111, set b %B1111111111111111, eval, output;\nset a %B1010101010101010, set b %B0101010101010101, eval, output;\nset a %B0011110011000011, set b %B0000111111110000, eval, output;\nset a %B0001001000110100, set b %B1001100001110110, eval, output;","Or16.cmp":"| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1111111111111111 |\n| 1111111111111111 | 1111111111111111 | 1111111111111111 |\n| 1010101010101010 | 0101010101010101 | 1111111111111111 |\n| 0011110011000011 | 0000111111110000 | 0011111111110011 |\n| 0001001000110100 | 1001100001110110 | 1001101001110110 |"},Mux16:{"Mux16.hdl":"// 16 bit multiplexor. If sel==1 then out=b else out=a.\n\nCHIP Mux16 {\n IN a[16], b[16], sel;\n OUT out[16];\n\n PARTS:\n}","Mux16.tst":"output-list a%B1.16.1 b%B1.16.1 sel%D2.1.2 out%B1.16.1;\n\nset a 0, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B0000000000000000, set b %B0001001000110100, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B1001100001110110, set b %B0000000000000000, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B1010101010101010, set b %B0101010101010101, set sel 0, eval, output;\nset sel 1, eval, output;","Mux16.cmp":"| a | b | sel | out |\n| 0000000000000000 | 0000000000000000 | 0 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 1 | 0000000000000000 |\n| 0000000000000000 | 0001001000110100 | 0 | 0000000000000000 |\n| 0000000000000000 | 0001001000110100 | 1 | 0001001000110100 |\n| 1001100001110110 | 0000000000000000 | 0 | 1001100001110110 |\n| 1001100001110110 | 0000000000000000 | 1 | 0000000000000000 |\n| 1010101010101010 | 0101010101010101 | 0 | 1010101010101010 |\n| 1010101010101010 | 0101010101010101 | 1 | 0101010101010101 |"},Mux4Way16:{"Mux4Way16.hdl":"/**\n * 4-way 16-bit multiplexor.\n * out = a if sel==00\n * b if sel==01\n * c if sel==10\n * d if sel==11\n */\n\nCHIP Mux4Way16 {\n IN a[16], b[16], c[16], d[16], sel[2];\n OUT out[16];\n\n PARTS:\n}","Mux4Way16.tst":"output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 sel%B2.2.2 out%B1.16.1;\n\nset a 0, set b 0, set c 0, set d 0, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\n\nset a %B0001001000110100, set b %B1001100001110110, set c %B1010101010101010, set d %B0101010101010101, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;","Mux4Way16.cmp":"| a | b | c | d | sel | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 00 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 01 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 10 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 11 | 0000000000000000 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 00 | 0001001000110100 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 01 | 1001100001110110 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 10 | 1010101010101010 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 11 | 0101010101010101 |"},Mux8Way16:{"Mux8Way16.hdl":"/**\n * 8-way 16-bit multiplexor.\n * out = a if sel==000\n * b if sel==001\n * etc.\n * h if sel==111\n */\n\nCHIP Mux8Way16 {\n IN a[16], b[16], c[16], d[16],\n e[16], f[16], g[16], h[16],\n sel[3];\n OUT out[16];\n\n PARTS:\n}","Mux8Way16.tst":"output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 e%B1.16.1 f%B1.16.1 g%B1.16.1 h%B1.16.1 sel%B2.3.2 out%B1.16.1;\n\nset a 0, set b 0, set c 0, set d 0, set e 0, set f 0, set g 0, set h 0, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\nset sel 4, eval, output;\nset sel 5, eval, output;\nset sel 6, eval, output;\nset sel 7, eval, output;\n\nset a %B0001001000110100, set b %B0010001101000101, set c %B0011010001010110, set d %B0100010101100111, set e %B0101011001111000, set f %B0110011110001001, set g %B0111100010011010, set h %B1000100110101011, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\nset sel 4, eval, output;\nset sel 5, eval, output;\nset sel 6, eval, output;\nset sel 7, eval, output;","Mux8Way16.cmp":"| a | b | c | d | e | f | g | h | sel | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 000 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 001 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 010 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 011 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 100 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 101 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 110 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 111 | 0000000000000000 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 000 | 0001001000110100 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0011010001010110 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 011 | 0100010101100111 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 100 | 0101011001111000 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 101 | 0110011110001001 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 110 | 0111100010011010 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 111 | 1000100110101011 |"},DMux4Way:{"DMux4Way.hdl":"/**\n * 4-way demultiplexor.\n * {a,b,c,d} = {in,0,0,0} if sel==00\n * {0,in,0,0} if sel==01\n * {0,0,in,0} if sel==10\n * {0,0,0,in} if sel==11\n */\n\nCHIP DMux4Way {\n IN in, sel[2];\n OUT a, b, c, d;\n\n PARTS:\n}","DMux4Way.tst":"output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2;\n\nset in 0, set sel %B00, eval, output;\nset sel %B01, eval, output;\nset sel %B10, eval, output;\nset sel %B11, eval, output;\n\nset in 1, set sel %B00, eval, output;\nset sel %B01, eval, output;\nset sel %B10, eval, output;\nset sel %B11, eval, output;","DMux4Way.cmp":"| in | sel | a | b | c | d |\n| 0 | 00 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 1 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 1 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 1 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 1 |"},DMux8Way:{"DMux8Way.hdl":"/**\n * 8-way demultiplexor.\n * {a,b,c,d,e,f,g,h} = {in,0,0,0,0,0,0,0} if sel==000\n * {0,in,0,0,0,0,0,0} if sel==001\n * etc.\n * {0,0,0,0,0,0,0,in} if sel==111\n */\n\n\nCHIP DMux8Way {\n IN in, sel[3];\n OUT a, b, c, d, e, f, g, h;\n\n PARTS:\n}","DMux8Way.tst":"output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2 e%B2.1.2 f%B2.1.2 g%B2.1.2 h%B2.1.2;\n\nset in 0, set sel %B000, eval, output;\nset sel %B001, eval, output;\nset sel %B010, eval, output;\nset sel %B011, eval, output;\nset sel %B100, eval, output;\nset sel %B101, eval, output;\nset sel %B110, eval, output;\nset sel %B111, eval, output;\n\nset in 1, set sel %B000, eval, output;\nset sel %B001, eval, output;\nset sel %B010, eval, output;\nset sel %B011, eval, output;\nset sel %B100, eval, output;\nset sel %B101, eval, output;\nset sel %B110, eval, output;\nset sel %B111, eval, output;","DMux8Way.cmp":"| in | sel | a | b | c | d | e | f | g | h |\n| 0 | 00 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 00 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |"},Or8Way:{"Or8Way.hdl":"/**\n * 8-way or gate: out = in[0] or in[1] or ... or in[7].\n */\n\nCHIP Or8Way {\n IN in[8];\n OUT out;\n\n PARTS:\n}","Or8Way.tst":"output-list in%B2.8.2 out%B2.1.2;\n\nset in %B00000000, eval, output;\nset in %B11111111, eval, output;\nset in %B00010000, eval, output;\nset in %B00000001, eval, output;\nset in %B00100110, eval, output;","Or8Way.cmp":"| in | out |\n| 00000000 | 0 |\n| 11111111 | 1 |\n| 00010000 | 1 |\n| 00000001 | 1 |\n| 00100110 | 1 |"}};function c(t){return B.apply(this,arguments)}function B(){return(B=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.pushd("/projects/01");case 2:return t.next=4,(0,r.mc)(n,i);case 4:return t.next=6,n.popd();case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var k={HalfAdder:{"HalfAdder.hdl":"// Computes the sum of two bits.\n\nCHIP HalfAdder {\n IN a, b; // 1-bit inputs\n OUT sum, // Right bit of a + b \n carry; // Left bit of a + b\n\n PARTS:\n}","HalfAdder.tst":"output-list a%B3.1.3 b%B3.1.3 sum%B3.1.3 carry%B3.1.3;\n\nset a 0,\nset b 0,\neval,\noutput;\n\nset a 0,\nset b 1,\neval,\noutput;\n\nset a 1,\nset b 0,\neval,\noutput;\n\nset a 1,\nset b 1,\neval,\noutput;","HalfAdder.cmp":"| a | b | sum | carry |\n| 0 | 0 | 0 | 0 |\n| 0 | 1 | 1 | 0 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |"},FullAdder:{"FullAdder.hdl":"// Computes the sum of three bits.\n\nCHIP FullAdder {\n IN a, b, c; // 1-bit inputs\n OUT sum, // Right bit of a + b + c\n carry; // Left bit of a + b + c\n\n PARTS:\n}","FullAdder.tst":"output-list a%B3.1.3 b%B3.1.3 c%B3.1.3 sum%B3.1.3 carry%B3.1.3;\n\nset a 0,\nset b 0,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset b 1,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset a 1,\nset b 0,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset b 1,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;","FullAdder.cmp":"| a | b | c | sum | carry |\n| 0 | 0 | 0 | 0 | 0 |\n| 0 | 0 | 1 | 1 | 0 |\n| 0 | 1 | 0 | 1 | 0 |\n| 0 | 1 | 1 | 0 | 1 |\n| 1 | 0 | 0 | 1 | 0 |\n| 1 | 0 | 1 | 0 | 1 |\n| 1 | 1 | 0 | 0 | 1 |\n| 1 | 1 | 1 | 1 | 1 |"},Add16:{"Add16.hdl":"/**\n* Adds two 16-bit values.\n* The most significant carry bit is ignored.\n*/\n\nCHIP Add16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}","Add16.tst":"output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\n\nset a %B0000000000000000,\nset b %B0000000000000000,\neval,\noutput;\n\nset a %B0000000000000000,\nset b %B1111111111111111,\neval,\noutput;\n\nset a %B1111111111111111,\nset b %B1111111111111111,\neval,\noutput;\n\nset a %B1010101010101010,\nset b %B0101010101010101,\neval,\noutput;\n\nset a %B0011110011000011,\nset b %B0000111111110000,\neval,\noutput;\n\nset a %B0001001000110100,\nset b %B1001100001110110,\neval,\noutput;","Add16.cmp":"| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1111111111111111 |\n| 1111111111111111 | 1111111111111111 | 1111111111111110 |\n| 1010101010101010 | 0101010101010101 | 1111111111111111 |\n| 0011110011000011 | 0000111111110000 | 0100110010110011 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 |"},Inc16:{"Inc16.hdl":"/**\n* 16-bit incrementer:\n* out = in + 1 (arithmetic addition)\n*/\n\nCHIP Inc16 {\n IN in[16];\n OUT out[16];\n\n PARTS:\n}","Inc16.tst":"output-list in%B1.16.1 out%B1.16.1;\n\nset in %B0000000000000000, // in = 0\neval,\noutput;\n\nset in %B1111111111111111, // in = -1\neval,\noutput;\n\nset in %B0000000000000101, // in = 5\neval,\noutput;\n\nset in %B1111111111111011, // in = -5\neval,\noutput;","Inc16.cmp":"| in | out |\n| 0000000000000000 | 0000000000000001 |\n| 1111111111111111 | 0000000000000000 |\n| 0000000000000101 | 0000000000000110 |\n| 1111111111111011 | 1111111111111100 |\n"},AluNoStat:{"AluNoStat.hdl":"/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16]; // 16-bit output\n\n PARTS:\n}","AluNoStat.tst":"\n// ALU no stat tst provides a partial test of the ALU chip.\n// It IS NOT a replacement for ALU.tst.\n\n// ALU-nostat.tst tests only the computation part of the ALU.\n// The 'zr' and 'ng' status outputs are ignored.\n\n// This test lets you concentrate on getting the ALU computation right without the\n// additional task of handling the status outputs.\n\n// Once your ALU passes ALU-nostat.tst you need to test it with ALU.tst.\n// This way, any comparison failures during ALU.tst will be caused by errors in\n// the handling of the 'zr' and 'ng' status outputs.\n\noutput-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \n ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1;\n\nset x %B0000000000000000,\nset y %B1111111111111111,\n\nset zx 1,\nset nx 0,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset x %B101101110100000,\nset y %B001111011010010,\n\nset zx 1,\nset nx 0,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;","AluNoStat.cmp":"| x | y |zx |nx |zy |ny | f |no | out |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 |\n| 0101101110100000 | 0001111011010010 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 0 | 0101101110100000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 0 | 0001111011010010 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 1 | 1010010001011111 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 1 | 1110000100101101 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 1 | 1010010001100000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 1 | 1110000100101110 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 1 | 1 | 1 | 1 | 0101101110100001 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 1 | 1 | 1 | 0001111011010011 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 0 | 0101101110011111 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 0 | 0001111011010001 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 1 | 0 | 0111101001110010 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011110011001110 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100001100110010 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 0 | 0 | 0001101010000000 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 1 | 0 | 1 | 0101111111110010 |\n"},ALU:{"ALU.hdl":"/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16], // 16-bit output\n zr, // 1 if (out == 0), 0 otherwise\n ng; // 1 if (out < 0), 0 otherwise\n\n PARTS:\n}","ALU.tst":"output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \nny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1\nng%B1.1.1;\n\nset x %B0000000000000000, // x = 0\nset y %B1111111111111111; // y = -1\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;\n\nset x %B000000000010001, // x = 17\nset y %B000000000000011; // y = 3\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;","ALU.cmp":"| x | y |zx |nx |zy |ny | f |no | out |zr |ng |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |"},ALUAll:{"ALUAll.hdl":"/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * \n * All operations:\n * Ensure your solution handles these undocumented opcodes:\n * \n * -2, !(x&y), !(x|y), !x&y, !(!x&y), !(x&!y), x&!y\n * x+y+1, x-y-1, -(x+2), -(y+2), -(x+y+2), -(x+y+1), -(x-y+1)\n * \n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\n// Testing: the test script below has tests for the undocumented instructions\n// listed first, and then has the tests for the documented ALU instructions.\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16], // 16-bit output\n zr, // 1 if (out == 0), 0 otherwise\n ng; // 1 if (out < 0), 0 otherwise\n\n PARTS:\n // Put you code here:\n}","ALUAll.tst":"output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \nny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1\nng%B1.1.1;\n\n// Compute -2 \nset x %B0000000000000000,\nset y %B0000000000000000,\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\nset x %B0000000000000011,\nset y %B0000000000000101;\n\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 1, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 0, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 0, set no 0, eval, output;\n\nset x %B0000000000001101, // x = 13\nset y %B0000000000010011; // y = 19\n\nset zx 0, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 0, eval, output;\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 1, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\nset x %B0000000000000000, // x = 0\nset y %B1111111111111111; // y = -1\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;\n\nset x %B000000000010001, // x = 17\nset y %B000000000000011; // y = 3\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;","ALUAll.cmp":"| x | y |zx |nx |zy |ny | f |no | out |zr |ng |\n| 0000000000000000 | 0000000000000000 | 1 | 1 | 1 | 1 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 0 | 0 | 1 | 1111111111111110 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 1 | 0 | 0 | 1111111111111000 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 0 | 0 | 0 | 1111111111110100 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 0 | 0 | 1 | 1111111111111011 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 1 | 0 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 1 | 0 | 0 | 1111111111110010 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 1 | 1 | 1 | 0000000000100001 | 0 | 0 |\n| 0000000000001101 | 0000000000010011 | 0 | 0 | 0 | 1 | 1 | 0 | 1111111111111001 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 1 | 1 | 1 | 0 | 1111111111110001 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 1 | 1 | 0 | 1 | 1 | 0 | 1111111111101011 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 1 | 1 | 0 | 1111111111011110 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 0 | 0 | 0 | 1 | 1 | 1111111111011111 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 0 | 1 | 0 | 0000000000000101 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |"}};function v(t){return y.apply(this,arguments)}function y(){return(y=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.pushd("/projects/02");case 2:return t.next=4,(0,r.mc)(n,k);case 4:return t.next=6,n.popd();case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var x=e(1026),f={Bit:{"Bit.hdl":"/**\n * 1-bit register:\n * If load[t] == 1 then out[t+1] = in[t]\n * else out does not change (out[t+1] = out[t])\n */\n\nCHIP Bit {\n IN in, load;\n OUT out;\n\n PARTS:\n}","Bit.tst":"output-list time%S1.4.1 in%B2.1.2 load%B2.1.2 out%B2.1.2;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 1, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 1, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;","Bit.cmp":"| time | in |load | out |\n| 0+ | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 |\n| 2 | 0 | 1 | 0 |\n| 2+ | 1 | 0 | 0 |\n| 3 | 1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If load[t] == 1 then out[t+1] = in[t]\n * else out does not change\n */\n\nCHIP Register {\n IN in[16], load;\n OUT out[16];\n\n PARTS:\n}","Register.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 out%D1.6.1;\n"+[[0,0],[0,1],[-32123,0],[11111,0],[-32123,1],[-32123,1],[-32123,0],[12345,1],[0,0],[0,1]].map((function(t){var n=(0,x.Z)(t,2),e=n[0],s=n[1];return"set in ".concat(e,", set load ").concat(s,", tick, output; tock, output;")})).join("\n")+"\n"+["%B0000000000000001","%B0000000000000010","%B0000000000000100","%B0000000000001000","%B0000000000010000","%B0000000000100000","%B0000000001000000","%B0000000010000000","%B0000000100000000","%B0000001000000000","%B0000010000000000","%B0000100000000000","%B0001000000000000","%B0010000000000000","%B0100000000000000","%B1000000000000000","%B1111111111111110","%B1111111111111101","%B1111111111111011","%B1111111111110111","%B1111111111101111","%B1111111111011111","%B1111111110111111","%B1111111101111111","%B1111111011111111","%B1111110111111111","%B1111101111111111","%B1111011111111111","%B1110111111111111","%B1101111111111111","%B1011111111111111","%B0111111111111111"].map((function(t){return"set in ".concat(t,", set load 0, tick, output; tock, output; set load 1, tick, output; tock, output;")})).join("\n"),"Register.cmp":"| time | in |load | out |\n| 0+ | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 |\n| 2 | 0 | 1 | 0 |\n| 2+ | -32123 | 0 | 0 |\n| 3 | -32123 | 0 | 0 |\n| 3+ | 11111 | 0 | 0 |\n| 4 | 11111 | 0 | 0 |\n| 4+ | -32123 | 1 | 0 |\n| 5 | -32123 | 1 | -32123 |\n| 5+ | -32123 | 1 | -32123 |\n| 6 | -32123 | 1 | -32123 |\n| 6+ | -32123 | 0 | -32123 |\n| 7 | -32123 | 0 | -32123 |\n| 7+ | 12345 | 1 | -32123 |\n| 8 | 12345 | 1 | 12345 |\n| 8+ | 0 | 0 | 12345 |\n| 9 | 0 | 0 | 12345 |\n| 9+ | 0 | 1 | 12345 |\n| 10 | 0 | 1 | 0 |\n| 10+ | 1 | 0 | 0 |\n| 11 | 1 | 0 | 0 |\n| 11+ | 1 | 1 | 0 |\n| 12 | 1 | 1 | 1 |\n| 12+ | 2 | 0 | 1 |\n| 13 | 2 | 0 | 1 |\n| 13+ | 2 | 1 | 1 |\n| 14 | 2 | 1 | 2 |\n| 14+ | 4 | 0 | 2 |\n| 15 | 4 | 0 | 2 |\n| 15+ | 4 | 1 | 2 |\n| 16 | 4 | 1 | 4 |\n| 16+ | 8 | 0 | 4 |\n| 17 | 8 | 0 | 4 |\n| 17+ | 8 | 1 | 4 |\n| 18 | 8 | 1 | 8 |\n| 18+ | 16 | 0 | 8 |\n| 19 | 16 | 0 | 8 |\n| 19+ | 16 | 1 | 8 |\n| 20 | 16 | 1 | 16 |\n| 20+ | 32 | 0 | 16 |\n| 21 | 32 | 0 | 16 |\n| 21+ | 32 | 1 | 16 |\n| 22 | 32 | 1 | 32 |\n| 22+ | 64 | 0 | 32 |\n| 23 | 64 | 0 | 32 |\n| 23+ | 64 | 1 | 32 |\n| 24 | 64 | 1 | 64 |\n| 24+ | 128 | 0 | 64 |\n| 25 | 128 | 0 | 64 |\n| 25+ | 128 | 1 | 64 |\n| 26 | 128 | 1 | 128 |\n| 26+ | 256 | 0 | 128 |\n| 27 | 256 | 0 | 128 |\n| 27+ | 256 | 1 | 128 |\n| 28 | 256 | 1 | 256 |\n| 28+ | 512 | 0 | 256 |\n| 29 | 512 | 0 | 256 |\n| 29+ | 512 | 1 | 256 |\n| 30 | 512 | 1 | 512 |\n| 30+ | 1024 | 0 | 512 |\n| 31 | 1024 | 0 | 512 |\n| 31+ | 1024 | 1 | 512 |\n| 32 | 1024 | 1 | 1024 |\n| 32+ | 2048 | 0 | 1024 |\n| 33 | 2048 | 0 | 1024 |\n| 33+ | 2048 | 1 | 1024 |\n| 34 | 2048 | 1 | 2048 |\n| 34+ | 4096 | 0 | 2048 |\n| 35 | 4096 | 0 | 2048 |\n| 35+ | 4096 | 1 | 2048 |\n| 36 | 4096 | 1 | 4096 |\n| 36+ | 8192 | 0 | 4096 |\n| 37 | 8192 | 0 | 4096 |\n| 37+ | 8192 | 1 | 4096 |\n| 38 | 8192 | 1 | 8192 |\n| 38+ | 16384 | 0 | 8192 |\n| 39 | 16384 | 0 | 8192 |\n| 39+ | 16384 | 1 | 8192 |\n| 40 | 16384 | 1 | 16384 |\n| 40+ | -32768 | 0 | 16384 |\n| 41 | -32768 | 0 | 16384 |\n| 41+ | -32768 | 1 | 16384 |\n| 42 | -32768 | 1 | -32768 |\n| 42+ | -2 | 0 | -32768 |\n| 43 | -2 | 0 | -32768 |\n| 43+ | -2 | 1 | -32768 |\n| 44 | -2 | 1 | -2 |\n| 44+ | -3 | 0 | -2 |\n| 45 | -3 | 0 | -2 |\n| 45+ | -3 | 1 | -2 |\n| 46 | -3 | 1 | -3 |\n| 46+ | -5 | 0 | -3 |\n| 47 | -5 | 0 | -3 |\n| 47+ | -5 | 1 | -3 |\n| 48 | -5 | 1 | -5 |\n| 48+ | -9 | 0 | -5 |\n| 49 | -9 | 0 | -5 |\n| 49+ | -9 | 1 | -5 |\n| 50 | -9 | 1 | -9 |\n| 50+ | -17 | 0 | -9 |\n| 51 | -17 | 0 | -9 |\n| 51+ | -17 | 1 | -9 |\n| 52 | -17 | 1 | -17 |\n| 52+ | -33 | 0 | -17 |\n| 53 | -33 | 0 | -17 |\n| 53+ | -33 | 1 | -17 |\n| 54 | -33 | 1 | -33 |\n| 54+ | -65 | 0 | -33 |\n| 55 | -65 | 0 | -33 |\n| 55+ | -65 | 1 | -33 |\n| 56 | -65 | 1 | -65 |\n| 56+ | -129 | 0 | -65 |\n| 57 | -129 | 0 | -65 |\n| 57+ | -129 | 1 | -65 |\n| 58 | -129 | 1 | -129 |\n| 58+ | -257 | 0 | -129 |\n| 59 | -257 | 0 | -129 |\n| 59+ | -257 | 1 | -129 |\n| 60 | -257 | 1 | -257 |\n| 60+ | -513 | 0 | -257 |\n| 61 | -513 | 0 | -257 |\n| 61+ | -513 | 1 | -257 |\n| 62 | -513 | 1 | -513 |\n| 62+ | -1025 | 0 | -513 |\n| 63 | -1025 | 0 | -513 |\n| 63+ | -1025 | 1 | -513 |\n| 64 | -1025 | 1 | -1025 |\n| 64+ | -2049 | 0 | -1025 |\n| 65 | -2049 | 0 | -1025 |\n| 65+ | -2049 | 1 | -1025 |\n| 66 | -2049 | 1 | -2049 |\n| 66+ | -4097 | 0 | -2049 |\n| 67 | -4097 | 0 | -2049 |\n| 67+ | -4097 | 1 | -2049 |\n| 68 | -4097 | 1 | -4097 |\n| 68+ | -8193 | 0 | -4097 |\n| 69 | -8193 | 0 | -4097 |\n| 69+ | -8193 | 1 | -4097 |\n| 70 | -8193 | 1 | -8193 |\n| 70+ | -16385 | 0 | -8193 |\n| 71 | -16385 | 0 | -8193 |\n| 71+ | -16385 | 1 | -8193 |\n| 72 | -16385 | 1 | -16385 |\n| 72+ | 32767 | 0 | -16385 |\n| 73 | 32767 | 0 | -16385 |\n| 73+ | 32767 | 1 | -16385 |\n| 74 | 32767 | 1 | 32767 |"},PC:{"PC.hdl":"/**\n * A 16-bit counter with load and reset control bits.\n * if (reset[t] == 1) out[t+1] = 0\n * else if (load[t] == 1) out[t+1] = in[t]\n * else if (inc[t] == 1) out[t+1] = out[t] + 1 (integer addition)\n * else out[t+1] = out[t]\n */\n\nCHIP PC {\n IN in[16], load, inc, reset;\n OUT out[16];\n\n PARTS:\n}","PC.tst":"output-list time%S1.4.1 in%D1.6.1 reset%B2.1.2 load%B2.1.2 inc%B2.1.2 out%D1.6.1;\n\nset in 0, set reset 0, set load 0, set inc 0, tick, output;\ntock, output;\n\nset inc 1, tick, output; tock, output;\nset in -32123, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\ntick, output; tock, output;\nset in 12345, set load 1, set inc 0, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset reset 0, set inc 1, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset reset 0, set load 0, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset in 0, set reset 0, set load 1, tick, output; tock, output;\nset load 0, set inc 1, tick, output; tock, output;\nset in 22222, set reset 1, set inc 0, tick, output; tock, output;","PC.cmp":"| time | in |reset|load | inc | out |\n| 0+ | 0 | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 0 | 0 | 1 | 0 |\n| 2 | 0 | 0 | 0 | 1 | 1 |\n| 2+ | -32123 | 0 | 0 | 1 | 1 |\n| 3 | -32123 | 0 | 0 | 1 | 2 |\n| 3+ | -32123 | 0 | 1 | 1 | 2 |\n| 4 | -32123 | 0 | 1 | 1 | -32123 |\n| 4+ | -32123 | 0 | 0 | 1 | -32123 |\n| 5 | -32123 | 0 | 0 | 1 | -32122 |\n| 5+ | -32123 | 0 | 0 | 1 | -32122 |\n| 6 | -32123 | 0 | 0 | 1 | -32121 |\n| 6+ | 12345 | 0 | 1 | 0 | -32121 |\n| 7 | 12345 | 0 | 1 | 0 | 12345 |\n| 7+ | 12345 | 1 | 1 | 0 | 12345 |\n| 8 | 12345 | 1 | 1 | 0 | 0 |\n| 8+ | 12345 | 0 | 1 | 1 | 0 |\n| 9 | 12345 | 0 | 1 | 1 | 12345 |\n| 9+ | 12345 | 1 | 1 | 1 | 12345 |\n| 10 | 12345 | 1 | 1 | 1 | 0 |\n| 10+ | 12345 | 0 | 0 | 1 | 0 |\n| 11 | 12345 | 0 | 0 | 1 | 1 |\n| 11+ | 12345 | 1 | 0 | 1 | 1 |\n| 12 | 12345 | 1 | 0 | 1 | 0 |\n| 12+ | 0 | 0 | 1 | 1 | 0 |\n| 13 | 0 | 0 | 1 | 1 | 0 |\n| 13+ | 0 | 0 | 0 | 1 | 0 |\n| 14 | 0 | 0 | 0 | 1 | 1 |\n| 14+ | 22222 | 1 | 0 | 0 | 1 |\n| 15 | 22222 | 1 | 0 | 0 | 0 |"},RAM8:{"RAM8.hdl":"/**\n * Memory of 8 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM8 {\n IN in[16], load, address[3];\n OUT out[16];\n\n PARTS:\n}","RAM8.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D3.1.3 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 11111, set load 0, tick, output; tock, output;\nset load 1, set address 1, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 3333, set address 3, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 1, eval, output;\n\nset in 7777, tick, output; tock, output;\nset load 1, set address 7, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 3, eval, output;\nset address 7, eval, output;\n\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set in %B0101010101010101, set address 0, tick, output; tock, output;\nset address 1, tick, output, tock, output;\nset address 2, tick, output, tock, output;\nset address 3, tick, output, tock, output;\nset address 4, tick, output, tock, output;\nset address 5, tick, output, tock, output;\nset address 6, tick, output, tock, output;\nset address 7, tick, output, tock, output;\n\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 0, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 0, set in %B0101010101010101, tick, output, tock, output;\nset address 1, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 1, set in %B0101010101010101, tick, output, tock, output;\nset address 2, set in %B1010101010101010, tick, output;\ntock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 2, set in %B0101010101010101, tick, output, tock, output;\nset address 3, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 3, set in %B0101010101010101, tick, output, tock, output;\nset address 4, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 4, set in %B0101010101010101, tick, output, tock, output;\nset address 5, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 5, set in %B0101010101010101, tick, output, tock, output;\nset address 6, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 6, set in %B0101010101010101, tick, output, tock, output;\nset address 7, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 7, set in %B0101010101010101, tick, output, tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;","RAM8.cmp":"| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 11111 | 0 | 0 | 0 |\n| 3 | 11111 | 0 | 0 | 0 |\n| 3+ | 11111 | 1 | 1 | 0 |\n| 4 | 11111 | 1 | 1 | 11111 |\n| 4+ | 11111 | 0 | 0 | 0 |\n| 5 | 11111 | 0 | 0 | 0 |\n| 5+ | 3333 | 0 | 3 | 0 |\n| 6 | 3333 | 0 | 3 | 0 |\n| 6+ | 3333 | 1 | 3 | 0 |\n| 7 | 3333 | 1 | 3 | 3333 |\n| 7+ | 3333 | 0 | 3 | 3333 |\n| 8 | 3333 | 0 | 3 | 3333 |\n| 8 | 3333 | 0 | 1 | 11111 |\n| 8+ | 7777 | 0 | 1 | 11111 |\n| 9 | 7777 | 0 | 1 | 11111 |\n| 9+ | 7777 | 1 | 7 | 0 |\n| 10 | 7777 | 1 | 7 | 7777 |\n| 10+ | 7777 | 0 | 7 | 7777 |\n| 11 | 7777 | 0 | 7 | 7777 |\n| 11 | 7777 | 0 | 3 | 3333 |\n| 11 | 7777 | 0 | 7 | 7777 |\n| 11+ | 7777 | 0 | 0 | 0 |\n| 12 | 7777 | 0 | 0 | 0 |\n| 12 | 7777 | 0 | 1 | 11111 |\n| 12 | 7777 | 0 | 2 | 0 |\n| 12 | 7777 | 0 | 3 | 3333 |\n| 12 | 7777 | 0 | 4 | 0 |\n| 12 | 7777 | 0 | 5 | 0 |\n| 12 | 7777 | 0 | 6 | 0 |\n| 12 | 7777 | 0 | 7 | 7777 |\n| 12+ | 21845 | 1 | 0 | 0 |\n| 13 | 21845 | 1 | 0 | 21845 |\n| 13+ | 21845 | 1 | 1 | 11111 |\n| 14 | 21845 | 1 | 1 | 21845 |\n| 14+ | 21845 | 1 | 2 | 0 |\n| 15 | 21845 | 1 | 2 | 21845 |\n| 15+ | 21845 | 1 | 3 | 3333 |\n| 16 | 21845 | 1 | 3 | 21845 |\n| 16+ | 21845 | 1 | 4 | 0 |\n| 17 | 21845 | 1 | 4 | 21845 |\n| 17+ | 21845 | 1 | 5 | 0 |\n| 18 | 21845 | 1 | 5 | 21845 |\n| 18+ | 21845 | 1 | 6 | 0 |\n| 19 | 21845 | 1 | 6 | 21845 |\n| 19+ | 21845 | 1 | 7 | 7777 |\n| 20 | 21845 | 1 | 7 | 21845 |\n| 20+ | 21845 | 0 | 0 | 21845 |\n| 21 | 21845 | 0 | 0 | 21845 |\n| 21 | 21845 | 0 | 1 | 21845 |\n| 21 | 21845 | 0 | 2 | 21845 |\n| 21 | 21845 | 0 | 3 | 21845 |\n| 21 | 21845 | 0 | 4 | 21845 |\n| 21 | 21845 | 0 | 5 | 21845 |\n| 21 | 21845 | 0 | 6 | 21845 |\n| 21 | 21845 | 0 | 7 | 21845 |\n| 21+ | -21846 | 1 | 0 | 21845 |\n| 22 | -21846 | 1 | 0 | -21846 |\n| 22+ | -21846 | 0 | 0 | -21846 |\n| 23 | -21846 | 0 | 0 | -21846 |\n| 23 | -21846 | 0 | 1 | 21845 |\n| 23 | -21846 | 0 | 2 | 21845 |\n| 23 | -21846 | 0 | 3 | 21845 |\n| 23 | -21846 | 0 | 4 | 21845 |\n| 23 | -21846 | 0 | 5 | 21845 |\n| 23 | -21846 | 0 | 6 | 21845 |\n| 23 | -21846 | 0 | 7 | 21845 |\n| 23+ | 21845 | 1 | 0 | -21846 |\n| 24 | 21845 | 1 | 0 | 21845 |\n| 24+ | -21846 | 1 | 1 | 21845 |\n| 25 | -21846 | 1 | 1 | -21846 |\n| 25+ | -21846 | 0 | 0 | 21845 |\n| 26 | -21846 | 0 | 0 | 21845 |\n| 26 | -21846 | 0 | 1 | -21846 |\n| 26 | -21846 | 0 | 2 | 21845 |\n| 26 | -21846 | 0 | 3 | 21845 |\n| 26 | -21846 | 0 | 4 | 21845 |\n| 26 | -21846 | 0 | 5 | 21845 |\n| 26 | -21846 | 0 | 6 | 21845 |\n| 26 | -21846 | 0 | 7 | 21845 |\n| 26+ | 21845 | 1 | 1 | -21846 |\n| 27 | 21845 | 1 | 1 | 21845 |\n| 27+ | -21846 | 1 | 2 | 21845 |\n| 28 | -21846 | 1 | 2 | -21846 |\n| 28+ | -21846 | 0 | 0 | 21845 |\n| 29 | -21846 | 0 | 0 | 21845 |\n| 29 | -21846 | 0 | 1 | 21845 |\n| 29 | -21846 | 0 | 2 | -21846 |\n| 29 | -21846 | 0 | 3 | 21845 |\n| 29 | -21846 | 0 | 4 | 21845 |\n| 29 | -21846 | 0 | 5 | 21845 |\n| 29 | -21846 | 0 | 6 | 21845 |\n| 29 | -21846 | 0 | 7 | 21845 |\n| 29+ | 21845 | 1 | 2 | -21846 |\n| 30 | 21845 | 1 | 2 | 21845 |\n| 30+ | -21846 | 1 | 3 | 21845 |\n| 31 | -21846 | 1 | 3 | -21846 |\n| 31+ | -21846 | 0 | 0 | 21845 |\n| 32 | -21846 | 0 | 0 | 21845 |\n| 32 | -21846 | 0 | 1 | 21845 |\n| 32 | -21846 | 0 | 2 | 21845 |\n| 32 | -21846 | 0 | 3 | -21846 |\n| 32 | -21846 | 0 | 4 | 21845 |\n| 32 | -21846 | 0 | 5 | 21845 |\n| 32 | -21846 | 0 | 6 | 21845 |\n| 32 | -21846 | 0 | 7 | 21845 |\n| 32+ | 21845 | 1 | 3 | -21846 |\n| 33 | 21845 | 1 | 3 | 21845 |\n| 33+ | -21846 | 1 | 4 | 21845 |\n| 34 | -21846 | 1 | 4 | -21846 |\n| 34+ | -21846 | 0 | 0 | 21845 |\n| 35 | -21846 | 0 | 0 | 21845 |\n| 35 | -21846 | 0 | 1 | 21845 |\n| 35 | -21846 | 0 | 2 | 21845 |\n| 35 | -21846 | 0 | 3 | 21845 |\n| 35 | -21846 | 0 | 4 | -21846 |\n| 35 | -21846 | 0 | 5 | 21845 |\n| 35 | -21846 | 0 | 6 | 21845 |\n| 35 | -21846 | 0 | 7 | 21845 |\n| 35+ | 21845 | 1 | 4 | -21846 |\n| 36 | 21845 | 1 | 4 | 21845 |\n| 36+ | -21846 | 1 | 5 | 21845 |\n| 37 | -21846 | 1 | 5 | -21846 |\n| 37+ | -21846 | 0 | 0 | 21845 |\n| 38 | -21846 | 0 | 0 | 21845 |\n| 38 | -21846 | 0 | 1 | 21845 |\n| 38 | -21846 | 0 | 2 | 21845 |\n| 38 | -21846 | 0 | 3 | 21845 |\n| 38 | -21846 | 0 | 4 | 21845 |\n| 38 | -21846 | 0 | 5 | -21846 |\n| 38 | -21846 | 0 | 6 | 21845 |\n| 38 | -21846 | 0 | 7 | 21845 |\n| 38+ | 21845 | 1 | 5 | -21846 |\n| 39 | 21845 | 1 | 5 | 21845 |\n| 39+ | -21846 | 1 | 6 | 21845 |\n| 40 | -21846 | 1 | 6 | -21846 |\n| 40+ | -21846 | 0 | 0 | 21845 |\n| 41 | -21846 | 0 | 0 | 21845 |\n| 41 | -21846 | 0 | 1 | 21845 |\n| 41 | -21846 | 0 | 2 | 21845 |\n| 41 | -21846 | 0 | 3 | 21845 |\n| 41 | -21846 | 0 | 4 | 21845 |\n| 41 | -21846 | 0 | 5 | 21845 |\n| 41 | -21846 | 0 | 6 | -21846 |\n| 41 | -21846 | 0 | 7 | 21845 |\n| 41+ | 21845 | 1 | 6 | -21846 |\n| 42 | 21845 | 1 | 6 | 21845 |\n| 42+ | -21846 | 1 | 7 | 21845 |\n| 43 | -21846 | 1 | 7 | -21846 |\n| 43+ | -21846 | 0 | 0 | 21845 |\n| 44 | -21846 | 0 | 0 | 21845 |\n| 44 | -21846 | 0 | 1 | 21845 |\n| 44 | -21846 | 0 | 2 | 21845 |\n| 44 | -21846 | 0 | 3 | 21845 |\n| 44 | -21846 | 0 | 4 | 21845 |\n| 44 | -21846 | 0 | 5 | 21845 |\n| 44 | -21846 | 0 | 6 | 21845 |\n| 44 | -21846 | 0 | 7 | -21846 |\n| 44+ | 21845 | 1 | 7 | -21846 |\n| 45 | 21845 | 1 | 7 | 21845 |\n| 45+ | 21845 | 0 | 0 | 21845 |\n| 46 | 21845 | 0 | 0 | 21845 |\n| 46 | 21845 | 0 | 1 | 21845 |\n| 46 | 21845 | 0 | 2 | 21845 |\n| 46 | 21845 | 0 | 3 | 21845 |\n| 46 | 21845 | 0 | 4 | 21845 |\n| 46 | 21845 | 0 | 5 | 21845 |\n| 46 | 21845 | 0 | 6 | 21845 |\n| 46 | 21845 | 0 | 7 | 21845 |"},RAM64:{"RAM64.hdl":"/**\n * Memory of 64 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM64 {\n IN in[16], load, address[6];\n OUT out[16];\n \n PARTS:\n}","RAM64.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1;\n\nset in 0, set load 0,\nset address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset in 1313, set load 0, tick, output; tock, output;\nset load 1,\nset address 13, tick, output; tock, output;\nset load 0,\nset address 0, tick, output; tock, output;\nset in 4747, set address 47, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 13, eval, output;\n\nset in 6363, tick, output; tock, output;\nset load 1,\nset address 63, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 47, eval, output;\n\nset address 63, eval, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B101000, tick, output; tock, output;\nset address %B101001, tick, output, tock, output;\nset address %B101010, tick, output, tock, output;\nset address %B101011, tick, output, tock, output;\nset address %B101100, tick, output, tock, output;\nset address %B101101, tick, output, tock, output;\nset address %B101110, tick, output, tock, output;\nset address %B101111, tick, output, tock, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101000, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B101001, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101011, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B101100, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B101111, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101, tick, output; tock, output;\nset address %B001101, tick, output, tock, output;\nset address %B010101, tick, output, tock, output;\nset address %B011101, tick, output, tock, output;\nset address %B100101, tick, output, tock, output;\nset address %B101101, tick, output, tock, output;\nset address %B110101, tick, output, tock, output;\nset address %B111101, tick, output, tock, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B000101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B000101, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B001101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B011101, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B100101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B110101, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B111101, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;","RAM64.cmp":"| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 1313 | 0 | 0 | 0 |\n| 3 | 1313 | 0 | 0 | 0 |\n| 3+ | 1313 | 1 | 13 | 0 |\n| 4 | 1313 | 1 | 13 | 1313 |\n| 4+ | 1313 | 0 | 0 | 0 |\n| 5 | 1313 | 0 | 0 | 0 |\n| 5+ | 4747 | 0 | 47 | 0 |\n| 6 | 4747 | 0 | 47 | 0 |\n| 6+ | 4747 | 1 | 47 | 0 |\n| 7 | 4747 | 1 | 47 | 4747 |\n| 7+ | 4747 | 0 | 47 | 4747 |\n| 8 | 4747 | 0 | 47 | 4747 |\n| 8 | 4747 | 0 | 13 | 1313 |\n| 8+ | 6363 | 0 | 13 | 1313 |\n| 9 | 6363 | 0 | 13 | 1313 |\n| 9+ | 6363 | 1 | 63 | 0 |\n| 10 | 6363 | 1 | 63 | 6363 |\n| 10+ | 6363 | 0 | 63 | 6363 |\n| 11 | 6363 | 0 | 63 | 6363 |\n| 11 | 6363 | 0 | 47 | 4747 |\n| 11 | 6363 | 0 | 63 | 6363 |\n| 11+ | 6363 | 0 | 40 | 0 |\n| 12 | 6363 | 0 | 40 | 0 |\n| 12 | 6363 | 0 | 41 | 0 |\n| 12 | 6363 | 0 | 42 | 0 |\n| 12 | 6363 | 0 | 43 | 0 |\n| 12 | 6363 | 0 | 44 | 0 |\n| 12 | 6363 | 0 | 45 | 0 |\n| 12 | 6363 | 0 | 46 | 0 |\n| 12 | 6363 | 0 | 47 | 4747 |\n| 12+ | 21845 | 1 | 40 | 0 |\n| 13 | 21845 | 1 | 40 | 21845 |\n| 13+ | 21845 | 1 | 41 | 0 |\n| 14 | 21845 | 1 | 41 | 21845 |\n| 14+ | 21845 | 1 | 42 | 0 |\n| 15 | 21845 | 1 | 42 | 21845 |\n| 15+ | 21845 | 1 | 43 | 0 |\n| 16 | 21845 | 1 | 43 | 21845 |\n| 16+ | 21845 | 1 | 44 | 0 |\n| 17 | 21845 | 1 | 44 | 21845 |\n| 17+ | 21845 | 1 | 45 | 0 |\n| 18 | 21845 | 1 | 45 | 21845 |\n| 18+ | 21845 | 1 | 46 | 0 |\n| 19 | 21845 | 1 | 46 | 21845 |\n| 19+ | 21845 | 1 | 47 | 4747 |\n| 20 | 21845 | 1 | 47 | 21845 |\n| 20+ | 21845 | 0 | 40 | 21845 |\n| 21 | 21845 | 0 | 40 | 21845 |\n| 21 | 21845 | 0 | 41 | 21845 |\n| 21 | 21845 | 0 | 42 | 21845 |\n| 21 | 21845 | 0 | 43 | 21845 |\n| 21 | 21845 | 0 | 44 | 21845 |\n| 21 | 21845 | 0 | 45 | 21845 |\n| 21 | 21845 | 0 | 46 | 21845 |\n| 21 | 21845 | 0 | 47 | 21845 |\n| 21+ | -21846 | 1 | 40 | 21845 |\n| 22 | -21846 | 1 | 40 | -21846 |\n| 22+ | -21846 | 0 | 40 | -21846 |\n| 23 | -21846 | 0 | 40 | -21846 |\n| 23 | -21846 | 0 | 41 | 21845 |\n| 23 | -21846 | 0 | 42 | 21845 |\n| 23 | -21846 | 0 | 43 | 21845 |\n| 23 | -21846 | 0 | 44 | 21845 |\n| 23 | -21846 | 0 | 45 | 21845 |\n| 23 | -21846 | 0 | 46 | 21845 |\n| 23 | -21846 | 0 | 47 | 21845 |\n| 23+ | 21845 | 1 | 40 | -21846 |\n| 24 | 21845 | 1 | 40 | 21845 |\n| 24+ | -21846 | 1 | 41 | 21845 |\n| 25 | -21846 | 1 | 41 | -21846 |\n| 25+ | -21846 | 0 | 40 | 21845 |\n| 26 | -21846 | 0 | 40 | 21845 |\n| 26 | -21846 | 0 | 41 | -21846 |\n| 26 | -21846 | 0 | 42 | 21845 |\n| 26 | -21846 | 0 | 43 | 21845 |\n| 26 | -21846 | 0 | 44 | 21845 |\n| 26 | -21846 | 0 | 45 | 21845 |\n| 26 | -21846 | 0 | 46 | 21845 |\n| 26 | -21846 | 0 | 47 | 21845 |\n| 26+ | 21845 | 1 | 41 | -21846 |\n| 27 | 21845 | 1 | 41 | 21845 |\n| 27+ | -21846 | 1 | 42 | 21845 |\n| 28 | -21846 | 1 | 42 | -21846 |\n| 28+ | -21846 | 0 | 40 | 21845 |\n| 29 | -21846 | 0 | 40 | 21845 |\n| 29 | -21846 | 0 | 41 | 21845 |\n| 29 | -21846 | 0 | 42 | -21846 |\n| 29 | -21846 | 0 | 43 | 21845 |\n| 29 | -21846 | 0 | 44 | 21845 |\n| 29 | -21846 | 0 | 45 | 21845 |\n| 29 | -21846 | 0 | 46 | 21845 |\n| 29 | -21846 | 0 | 47 | 21845 |\n| 29+ | 21845 | 1 | 42 | -21846 |\n| 30 | 21845 | 1 | 42 | 21845 |\n| 30+ | -21846 | 1 | 43 | 21845 |\n| 31 | -21846 | 1 | 43 | -21846 |\n| 31+ | -21846 | 0 | 40 | 21845 |\n| 32 | -21846 | 0 | 40 | 21845 |\n| 32 | -21846 | 0 | 41 | 21845 |\n| 32 | -21846 | 0 | 42 | 21845 |\n| 32 | -21846 | 0 | 43 | -21846 |\n| 32 | -21846 | 0 | 44 | 21845 |\n| 32 | -21846 | 0 | 45 | 21845 |\n| 32 | -21846 | 0 | 46 | 21845 |\n| 32 | -21846 | 0 | 47 | 21845 |\n| 32+ | 21845 | 1 | 43 | -21846 |\n| 33 | 21845 | 1 | 43 | 21845 |\n| 33+ | -21846 | 1 | 44 | 21845 |\n| 34 | -21846 | 1 | 44 | -21846 |\n| 34+ | -21846 | 0 | 40 | 21845 |\n| 35 | -21846 | 0 | 40 | 21845 |\n| 35 | -21846 | 0 | 41 | 21845 |\n| 35 | -21846 | 0 | 42 | 21845 |\n| 35 | -21846 | 0 | 43 | 21845 |\n| 35 | -21846 | 0 | 44 | -21846 |\n| 35 | -21846 | 0 | 45 | 21845 |\n| 35 | -21846 | 0 | 46 | 21845 |\n| 35 | -21846 | 0 | 47 | 21845 |\n| 35+ | 21845 | 1 | 44 | -21846 |\n| 36 | 21845 | 1 | 44 | 21845 |\n| 36+ | -21846 | 1 | 45 | 21845 |\n| 37 | -21846 | 1 | 45 | -21846 |\n| 37+ | -21846 | 0 | 40 | 21845 |\n| 38 | -21846 | 0 | 40 | 21845 |\n| 38 | -21846 | 0 | 41 | 21845 |\n| 38 | -21846 | 0 | 42 | 21845 |\n| 38 | -21846 | 0 | 43 | 21845 |\n| 38 | -21846 | 0 | 44 | 21845 |\n| 38 | -21846 | 0 | 45 | -21846 |\n| 38 | -21846 | 0 | 46 | 21845 |\n| 38 | -21846 | 0 | 47 | 21845 |\n| 38+ | 21845 | 1 | 45 | -21846 |\n| 39 | 21845 | 1 | 45 | 21845 |\n| 39+ | -21846 | 1 | 46 | 21845 |\n| 40 | -21846 | 1 | 46 | -21846 |\n| 40+ | -21846 | 0 | 40 | 21845 |\n| 41 | -21846 | 0 | 40 | 21845 |\n| 41 | -21846 | 0 | 41 | 21845 |\n| 41 | -21846 | 0 | 42 | 21845 |\n| 41 | -21846 | 0 | 43 | 21845 |\n| 41 | -21846 | 0 | 44 | 21845 |\n| 41 | -21846 | 0 | 45 | 21845 |\n| 41 | -21846 | 0 | 46 | -21846 |\n| 41 | -21846 | 0 | 47 | 21845 |\n| 41+ | 21845 | 1 | 46 | -21846 |\n| 42 | 21845 | 1 | 46 | 21845 |\n| 42+ | -21846 | 1 | 47 | 21845 |\n| 43 | -21846 | 1 | 47 | -21846 |\n| 43+ | -21846 | 0 | 40 | 21845 |\n| 44 | -21846 | 0 | 40 | 21845 |\n| 44 | -21846 | 0 | 41 | 21845 |\n| 44 | -21846 | 0 | 42 | 21845 |\n| 44 | -21846 | 0 | 43 | 21845 |\n| 44 | -21846 | 0 | 44 | 21845 |\n| 44 | -21846 | 0 | 45 | 21845 |\n| 44 | -21846 | 0 | 46 | 21845 |\n| 44 | -21846 | 0 | 47 | -21846 |\n| 44+ | 21845 | 1 | 47 | -21846 |\n| 45 | 21845 | 1 | 47 | 21845 |\n| 45+ | 21845 | 0 | 40 | 21845 |\n| 46 | 21845 | 0 | 40 | 21845 |\n| 46 | 21845 | 0 | 41 | 21845 |\n| 46 | 21845 | 0 | 42 | 21845 |\n| 46 | 21845 | 0 | 43 | 21845 |\n| 46 | 21845 | 0 | 44 | 21845 |\n| 46 | 21845 | 0 | 45 | 21845 |\n| 46 | 21845 | 0 | 46 | 21845 |\n| 46 | 21845 | 0 | 47 | 21845 |\n| 46+ | 21845 | 0 | 5 | 0 |\n| 47 | 21845 | 0 | 5 | 0 |\n| 47 | 21845 | 0 | 13 | 1313 |\n| 47 | 21845 | 0 | 21 | 0 |\n| 47 | 21845 | 0 | 29 | 0 |\n| 47 | 21845 | 0 | 37 | 0 |\n| 47 | 21845 | 0 | 45 | 21845 |\n| 47 | 21845 | 0 | 53 | 0 |\n| 47 | 21845 | 0 | 61 | 0 |\n| 47+ | 21845 | 1 | 5 | 0 |\n| 48 | 21845 | 1 | 5 | 21845 |\n| 48+ | 21845 | 1 | 13 | 1313 |\n| 49 | 21845 | 1 | 13 | 21845 |\n| 49+ | 21845 | 1 | 21 | 0 |\n| 50 | 21845 | 1 | 21 | 21845 |\n| 50+ | 21845 | 1 | 29 | 0 |\n| 51 | 21845 | 1 | 29 | 21845 |\n| 51+ | 21845 | 1 | 37 | 0 |\n| 52 | 21845 | 1 | 37 | 21845 |\n| 52+ | 21845 | 1 | 45 | 21845 |\n| 53 | 21845 | 1 | 45 | 21845 |\n| 53+ | 21845 | 1 | 53 | 0 |\n| 54 | 21845 | 1 | 53 | 21845 |\n| 54+ | 21845 | 1 | 61 | 0 |\n| 55 | 21845 | 1 | 61 | 21845 |\n| 55+ | 21845 | 0 | 5 | 21845 |\n| 56 | 21845 | 0 | 5 | 21845 |\n| 56 | 21845 | 0 | 13 | 21845 |\n| 56 | 21845 | 0 | 21 | 21845 |\n| 56 | 21845 | 0 | 29 | 21845 |\n| 56 | 21845 | 0 | 37 | 21845 |\n| 56 | 21845 | 0 | 45 | 21845 |\n| 56 | 21845 | 0 | 53 | 21845 |\n| 56 | 21845 | 0 | 61 | 21845 |\n| 56+ | -21846 | 1 | 5 | 21845 |\n| 57 | -21846 | 1 | 5 | -21846 |\n| 57+ | -21846 | 0 | 5 | -21846 |\n| 58 | -21846 | 0 | 5 | -21846 |\n| 58 | -21846 | 0 | 13 | 21845 |\n| 58 | -21846 | 0 | 21 | 21845 |\n| 58 | -21846 | 0 | 29 | 21845 |\n| 58 | -21846 | 0 | 37 | 21845 |\n| 58 | -21846 | 0 | 45 | 21845 |\n| 58 | -21846 | 0 | 53 | 21845 |\n| 58 | -21846 | 0 | 61 | 21845 |\n| 58+ | 21845 | 1 | 5 | -21846 |\n| 59 | 21845 | 1 | 5 | 21845 |\n| 59+ | -21846 | 1 | 13 | 21845 |\n| 60 | -21846 | 1 | 13 | -21846 |\n| 60+ | -21846 | 0 | 5 | 21845 |\n| 61 | -21846 | 0 | 5 | 21845 |\n| 61 | -21846 | 0 | 13 | -21846 |\n| 61 | -21846 | 0 | 21 | 21845 |\n| 61 | -21846 | 0 | 29 | 21845 |\n| 61 | -21846 | 0 | 37 | 21845 |\n| 61 | -21846 | 0 | 45 | 21845 |\n| 61 | -21846 | 0 | 53 | 21845 |\n| 61 | -21846 | 0 | 61 | 21845 |\n| 61+ | 21845 | 1 | 13 | -21846 |\n| 62 | 21845 | 1 | 13 | 21845 |\n| 62+ | -21846 | 1 | 21 | 21845 |\n| 63 | -21846 | 1 | 21 | -21846 |\n| 63+ | -21846 | 0 | 5 | 21845 |\n| 64 | -21846 | 0 | 5 | 21845 |\n| 64 | -21846 | 0 | 13 | 21845 |\n| 64 | -21846 | 0 | 21 | -21846 |\n| 64 | -21846 | 0 | 29 | 21845 |\n| 64 | -21846 | 0 | 37 | 21845 |\n| 64 | -21846 | 0 | 45 | 21845 |\n| 64 | -21846 | 0 | 53 | 21845 |\n| 64 | -21846 | 0 | 61 | 21845 |\n| 64+ | 21845 | 1 | 21 | -21846 |\n| 65 | 21845 | 1 | 21 | 21845 |\n| 65+ | -21846 | 1 | 29 | 21845 |\n| 66 | -21846 | 1 | 29 | -21846 |\n| 66+ | -21846 | 0 | 5 | 21845 |\n| 67 | -21846 | 0 | 5 | 21845 |\n| 67 | -21846 | 0 | 13 | 21845 |\n| 67 | -21846 | 0 | 21 | 21845 |\n| 67 | -21846 | 0 | 29 | -21846 |\n| 67 | -21846 | 0 | 37 | 21845 |\n| 67 | -21846 | 0 | 45 | 21845 |\n| 67 | -21846 | 0 | 53 | 21845 |\n| 67 | -21846 | 0 | 61 | 21845 |\n| 67+ | 21845 | 1 | 29 | -21846 |\n| 68 | 21845 | 1 | 29 | 21845 |\n| 68+ | -21846 | 1 | 37 | 21845 |\n| 69 | -21846 | 1 | 37 | -21846 |\n| 69+ | -21846 | 0 | 5 | 21845 |\n| 70 | -21846 | 0 | 5 | 21845 |\n| 70 | -21846 | 0 | 13 | 21845 |\n| 70 | -21846 | 0 | 21 | 21845 |\n| 70 | -21846 | 0 | 29 | 21845 |\n| 70 | -21846 | 0 | 37 | -21846 |\n| 70 | -21846 | 0 | 45 | 21845 |\n| 70 | -21846 | 0 | 53 | 21845 |\n| 70 | -21846 | 0 | 61 | 21845 |\n| 70+ | 21845 | 1 | 37 | -21846 |\n| 71 | 21845 | 1 | 37 | 21845 |\n| 71+ | -21846 | 1 | 45 | 21845 |\n| 72 | -21846 | 1 | 45 | -21846 |\n| 72+ | -21846 | 0 | 5 | 21845 |\n| 73 | -21846 | 0 | 5 | 21845 |\n| 73 | -21846 | 0 | 13 | 21845 |\n| 73 | -21846 | 0 | 21 | 21845 |\n| 73 | -21846 | 0 | 29 | 21845 |\n| 73 | -21846 | 0 | 37 | 21845 |\n| 73 | -21846 | 0 | 45 | -21846 |\n| 73 | -21846 | 0 | 53 | 21845 |\n| 73 | -21846 | 0 | 61 | 21845 |\n| 73+ | 21845 | 1 | 45 | -21846 |\n| 74 | 21845 | 1 | 45 | 21845 |\n| 74+ | -21846 | 1 | 53 | 21845 |\n| 75 | -21846 | 1 | 53 | -21846 |\n| 75+ | -21846 | 0 | 5 | 21845 |\n| 76 | -21846 | 0 | 5 | 21845 |\n| 76 | -21846 | 0 | 13 | 21845 |\n| 76 | -21846 | 0 | 21 | 21845 |\n| 76 | -21846 | 0 | 29 | 21845 |\n| 76 | -21846 | 0 | 37 | 21845 |\n| 76 | -21846 | 0 | 45 | 21845 |\n| 76 | -21846 | 0 | 53 | -21846 |\n| 76 | -21846 | 0 | 61 | 21845 |\n| 76+ | 21845 | 1 | 53 | -21846 |\n| 77 | 21845 | 1 | 53 | 21845 |\n| 77+ | -21846 | 1 | 61 | 21845 |\n| 78 | -21846 | 1 | 61 | -21846 |\n| 78+ | -21846 | 0 | 5 | 21845 |\n| 79 | -21846 | 0 | 5 | 21845 |\n| 79 | -21846 | 0 | 13 | 21845 |\n| 79 | -21846 | 0 | 21 | 21845 |\n| 79 | -21846 | 0 | 29 | 21845 |\n| 79 | -21846 | 0 | 37 | 21845 |\n| 79 | -21846 | 0 | 45 | 21845 |\n| 79 | -21846 | 0 | 53 | 21845 |\n| 79 | -21846 | 0 | 61 | -21846 |\n| 79+ | 21845 | 1 | 61 | -21846 |\n| 80 | 21845 | 1 | 61 | 21845 |\n| 80+ | 21845 | 0 | 5 | 21845 |\n| 81 | 21845 | 0 | 5 | 21845 |\n| 81 | 21845 | 0 | 13 | 21845 |\n| 81 | 21845 | 0 | 21 | 21845 |\n| 81 | 21845 | 0 | 29 | 21845 |\n| 81 | 21845 | 0 | 37 | 21845 |\n| 81 | 21845 | 0 | 45 | 21845 |\n| 81 | 21845 | 0 | 53 | 21845 |\n| 81 | 21845 | 0 | 61 | 21845 |"},RAM512:{"RAM512.hdl":"/**\n * Memory of 512 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM512 {\n IN in[16], load, address[9];\n OUT out[16];\n \n PARTS:\n}","RAM512.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 13099, set load 0, tick, output; tock, output;\nset load 1, set address 130, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 4729, set address 472, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 130, eval, output;\n\nset in 5119, tick, output; tock, output;\nset load 1, set address 511, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 472, eval, output;\nset address 511, eval, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B010101000, tick, output; tock, output;\nset address %B010101001, tick, output, tock, output;\nset address %B010101010, tick, output, tock, output;\nset address %B010101011, tick, output, tock, output;\nset address %B010101100, tick, output, tock, output;\nset address %B010101101, tick, output, tock, output;\nset address %B010101110, tick, output, tock, output;\nset address %B010101111, tick, output, tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101000, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101001, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101011, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101100, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101110, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101111, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101010, tick, output; tock, output;\nset address %B001101010, tick, output, tock, output;\nset address %B010101010, tick, output, tock, output;\nset address %B011101010, tick, output, tock, output;\nset address %B100101010, tick, output, tock, output;\nset address %B101101010, tick, output, tock, output;\nset address %B110101010, tick, output, tock, output;\nset address %B111101010, tick, output, tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B000101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B000101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B001101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B011101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B100101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B101101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B110101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B111101010, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;","RAM512.cmp":"| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 13099 | 0 | 0 | 0 |\n| 3 | 13099 | 0 | 0 | 0 |\n| 3+ | 13099 | 1 | 130 | 0 |\n| 4 | 13099 | 1 | 130 | 13099 |\n| 4+ | 13099 | 0 | 0 | 0 |\n| 5 | 13099 | 0 | 0 | 0 |\n| 5+ | 4729 | 0 | 472 | 0 |\n| 6 | 4729 | 0 | 472 | 0 |\n| 6+ | 4729 | 1 | 472 | 0 |\n| 7 | 4729 | 1 | 472 | 4729 |\n| 7+ | 4729 | 0 | 472 | 4729 |\n| 8 | 4729 | 0 | 472 | 4729 |\n| 8 | 4729 | 0 | 130 | 13099 |\n| 8+ | 5119 | 0 | 130 | 13099 |\n| 9 | 5119 | 0 | 130 | 13099 |\n| 9+ | 5119 | 1 | 511 | 0 |\n| 10 | 5119 | 1 | 511 | 5119 |\n| 10+ | 5119 | 0 | 511 | 5119 |\n| 11 | 5119 | 0 | 511 | 5119 |\n| 11 | 5119 | 0 | 472 | 4729 |\n| 11 | 5119 | 0 | 511 | 5119 |\n| 11+ | 5119 | 0 | 168 | 0 |\n| 12 | 5119 | 0 | 168 | 0 |\n| 12 | 5119 | 0 | 169 | 0 |\n| 12 | 5119 | 0 | 170 | 0 |\n| 12 | 5119 | 0 | 171 | 0 |\n| 12 | 5119 | 0 | 172 | 0 |\n| 12 | 5119 | 0 | 173 | 0 |\n| 12 | 5119 | 0 | 174 | 0 |\n| 12 | 5119 | 0 | 175 | 0 |\n| 12+ | 21845 | 1 | 168 | 0 |\n| 13 | 21845 | 1 | 168 | 21845 |\n| 13+ | 21845 | 1 | 169 | 0 |\n| 14 | 21845 | 1 | 169 | 21845 |\n| 14+ | 21845 | 1 | 170 | 0 |\n| 15 | 21845 | 1 | 170 | 21845 |\n| 15+ | 21845 | 1 | 171 | 0 |\n| 16 | 21845 | 1 | 171 | 21845 |\n| 16+ | 21845 | 1 | 172 | 0 |\n| 17 | 21845 | 1 | 172 | 21845 |\n| 17+ | 21845 | 1 | 173 | 0 |\n| 18 | 21845 | 1 | 173 | 21845 |\n| 18+ | 21845 | 1 | 174 | 0 |\n| 19 | 21845 | 1 | 174 | 21845 |\n| 19+ | 21845 | 1 | 175 | 0 |\n| 20 | 21845 | 1 | 175 | 21845 |\n| 20+ | 21845 | 0 | 168 | 21845 |\n| 21 | 21845 | 0 | 168 | 21845 |\n| 21 | 21845 | 0 | 169 | 21845 |\n| 21 | 21845 | 0 | 170 | 21845 |\n| 21 | 21845 | 0 | 171 | 21845 |\n| 21 | 21845 | 0 | 172 | 21845 |\n| 21 | 21845 | 0 | 173 | 21845 |\n| 21 | 21845 | 0 | 174 | 21845 |\n| 21 | 21845 | 0 | 175 | 21845 |\n| 21+ | -21846 | 1 | 168 | 21845 |\n| 22 | -21846 | 1 | 168 | -21846 |\n| 22+ | -21846 | 0 | 168 | -21846 |\n| 23 | -21846 | 0 | 168 | -21846 |\n| 23 | -21846 | 0 | 169 | 21845 |\n| 23 | -21846 | 0 | 170 | 21845 |\n| 23 | -21846 | 0 | 171 | 21845 |\n| 23 | -21846 | 0 | 172 | 21845 |\n| 23 | -21846 | 0 | 173 | 21845 |\n| 23 | -21846 | 0 | 174 | 21845 |\n| 23 | -21846 | 0 | 175 | 21845 |\n| 23+ | 21845 | 1 | 168 | -21846 |\n| 24 | 21845 | 1 | 168 | 21845 |\n| 24+ | -21846 | 1 | 169 | 21845 |\n| 25 | -21846 | 1 | 169 | -21846 |\n| 25+ | -21846 | 0 | 168 | 21845 |\n| 26 | -21846 | 0 | 168 | 21845 |\n| 26 | -21846 | 0 | 169 | -21846 |\n| 26 | -21846 | 0 | 170 | 21845 |\n| 26 | -21846 | 0 | 171 | 21845 |\n| 26 | -21846 | 0 | 172 | 21845 |\n| 26 | -21846 | 0 | 173 | 21845 |\n| 26 | -21846 | 0 | 174 | 21845 |\n| 26 | -21846 | 0 | 175 | 21845 |\n| 26+ | 21845 | 1 | 169 | -21846 |\n| 27 | 21845 | 1 | 169 | 21845 |\n| 27+ | -21846 | 1 | 170 | 21845 |\n| 28 | -21846 | 1 | 170 | -21846 |\n| 28+ | -21846 | 0 | 168 | 21845 |\n| 29 | -21846 | 0 | 168 | 21845 |\n| 29 | -21846 | 0 | 169 | 21845 |\n| 29 | -21846 | 0 | 170 | -21846 |\n| 29 | -21846 | 0 | 171 | 21845 |\n| 29 | -21846 | 0 | 172 | 21845 |\n| 29 | -21846 | 0 | 173 | 21845 |\n| 29 | -21846 | 0 | 174 | 21845 |\n| 29 | -21846 | 0 | 175 | 21845 |\n| 29+ | 21845 | 1 | 170 | -21846 |\n| 30 | 21845 | 1 | 170 | 21845 |\n| 30+ | -21846 | 1 | 171 | 21845 |\n| 31 | -21846 | 1 | 171 | -21846 |\n| 31+ | -21846 | 0 | 168 | 21845 |\n| 32 | -21846 | 0 | 168 | 21845 |\n| 32 | -21846 | 0 | 169 | 21845 |\n| 32 | -21846 | 0 | 170 | 21845 |\n| 32 | -21846 | 0 | 171 | -21846 |\n| 32 | -21846 | 0 | 172 | 21845 |\n| 32 | -21846 | 0 | 173 | 21845 |\n| 32 | -21846 | 0 | 174 | 21845 |\n| 32 | -21846 | 0 | 175 | 21845 |\n| 32+ | 21845 | 1 | 171 | -21846 |\n| 33 | 21845 | 1 | 171 | 21845 |\n| 33+ | -21846 | 1 | 172 | 21845 |\n| 34 | -21846 | 1 | 172 | -21846 |\n| 34+ | -21846 | 0 | 168 | 21845 |\n| 35 | -21846 | 0 | 168 | 21845 |\n| 35 | -21846 | 0 | 169 | 21845 |\n| 35 | -21846 | 0 | 170 | 21845 |\n| 35 | -21846 | 0 | 171 | 21845 |\n| 35 | -21846 | 0 | 172 | -21846 |\n| 35 | -21846 | 0 | 173 | 21845 |\n| 35 | -21846 | 0 | 174 | 21845 |\n| 35 | -21846 | 0 | 175 | 21845 |\n| 35+ | 21845 | 1 | 172 | -21846 |\n| 36 | 21845 | 1 | 172 | 21845 |\n| 36+ | -21846 | 1 | 173 | 21845 |\n| 37 | -21846 | 1 | 173 | -21846 |\n| 37+ | -21846 | 0 | 168 | 21845 |\n| 38 | -21846 | 0 | 168 | 21845 |\n| 38 | -21846 | 0 | 169 | 21845 |\n| 38 | -21846 | 0 | 170 | 21845 |\n| 38 | -21846 | 0 | 171 | 21845 |\n| 38 | -21846 | 0 | 172 | 21845 |\n| 38 | -21846 | 0 | 173 | -21846 |\n| 38 | -21846 | 0 | 174 | 21845 |\n| 38 | -21846 | 0 | 175 | 21845 |\n| 38+ | 21845 | 1 | 173 | -21846 |\n| 39 | 21845 | 1 | 173 | 21845 |\n| 39+ | -21846 | 1 | 174 | 21845 |\n| 40 | -21846 | 1 | 174 | -21846 |\n| 40+ | -21846 | 0 | 168 | 21845 |\n| 41 | -21846 | 0 | 168 | 21845 |\n| 41 | -21846 | 0 | 169 | 21845 |\n| 41 | -21846 | 0 | 170 | 21845 |\n| 41 | -21846 | 0 | 171 | 21845 |\n| 41 | -21846 | 0 | 172 | 21845 |\n| 41 | -21846 | 0 | 173 | 21845 |\n| 41 | -21846 | 0 | 174 | -21846 |\n| 41 | -21846 | 0 | 175 | 21845 |\n| 41+ | 21845 | 1 | 174 | -21846 |\n| 42 | 21845 | 1 | 174 | 21845 |\n| 42+ | -21846 | 1 | 175 | 21845 |\n| 43 | -21846 | 1 | 175 | -21846 |\n| 43+ | -21846 | 0 | 168 | 21845 |\n| 44 | -21846 | 0 | 168 | 21845 |\n| 44 | -21846 | 0 | 169 | 21845 |\n| 44 | -21846 | 0 | 170 | 21845 |\n| 44 | -21846 | 0 | 171 | 21845 |\n| 44 | -21846 | 0 | 172 | 21845 |\n| 44 | -21846 | 0 | 173 | 21845 |\n| 44 | -21846 | 0 | 174 | 21845 |\n| 44 | -21846 | 0 | 175 | -21846 |\n| 44+ | 21845 | 1 | 175 | -21846 |\n| 45 | 21845 | 1 | 175 | 21845 |\n| 45+ | 21845 | 0 | 168 | 21845 |\n| 46 | 21845 | 0 | 168 | 21845 |\n| 46 | 21845 | 0 | 169 | 21845 |\n| 46 | 21845 | 0 | 170 | 21845 |\n| 46 | 21845 | 0 | 171 | 21845 |\n| 46 | 21845 | 0 | 172 | 21845 |\n| 46 | 21845 | 0 | 173 | 21845 |\n| 46 | 21845 | 0 | 174 | 21845 |\n| 46 | 21845 | 0 | 175 | 21845 |\n| 46+ | 21845 | 0 | 42 | 0 |\n| 47 | 21845 | 0 | 42 | 0 |\n| 47 | 21845 | 0 | 106 | 0 |\n| 47 | 21845 | 0 | 170 | 21845 |\n| 47 | 21845 | 0 | 234 | 0 |\n| 47 | 21845 | 0 | 298 | 0 |\n| 47 | 21845 | 0 | 362 | 0 |\n| 47 | 21845 | 0 | 426 | 0 |\n| 47 | 21845 | 0 | 490 | 0 |\n| 47+ | 21845 | 1 | 42 | 0 |\n| 48 | 21845 | 1 | 42 | 21845 |\n| 48+ | 21845 | 1 | 106 | 0 |\n| 49 | 21845 | 1 | 106 | 21845 |\n| 49+ | 21845 | 1 | 170 | 21845 |\n| 50 | 21845 | 1 | 170 | 21845 |\n| 50+ | 21845 | 1 | 234 | 0 |\n| 51 | 21845 | 1 | 234 | 21845 |\n| 51+ | 21845 | 1 | 298 | 0 |\n| 52 | 21845 | 1 | 298 | 21845 |\n| 52+ | 21845 | 1 | 362 | 0 |\n| 53 | 21845 | 1 | 362 | 21845 |\n| 53+ | 21845 | 1 | 426 | 0 |\n| 54 | 21845 | 1 | 426 | 21845 |\n| 54+ | 21845 | 1 | 490 | 0 |\n| 55 | 21845 | 1 | 490 | 21845 |\n| 55+ | 21845 | 0 | 42 | 21845 |\n| 56 | 21845 | 0 | 42 | 21845 |\n| 56 | 21845 | 0 | 106 | 21845 |\n| 56 | 21845 | 0 | 170 | 21845 |\n| 56 | 21845 | 0 | 234 | 21845 |\n| 56 | 21845 | 0 | 298 | 21845 |\n| 56 | 21845 | 0 | 362 | 21845 |\n| 56 | 21845 | 0 | 426 | 21845 |\n| 56 | 21845 | 0 | 490 | 21845 |\n| 56+ | -21846 | 1 | 42 | 21845 |\n| 57 | -21846 | 1 | 42 | -21846 |\n| 57+ | -21846 | 0 | 42 | -21846 |\n| 58 | -21846 | 0 | 42 | -21846 |\n| 58 | -21846 | 0 | 106 | 21845 |\n| 58 | -21846 | 0 | 170 | 21845 |\n| 58 | -21846 | 0 | 234 | 21845 |\n| 58 | -21846 | 0 | 298 | 21845 |\n| 58 | -21846 | 0 | 362 | 21845 |\n| 58 | -21846 | 0 | 426 | 21845 |\n| 58 | -21846 | 0 | 490 | 21845 |\n| 58+ | 21845 | 1 | 42 | -21846 |\n| 59 | 21845 | 1 | 42 | 21845 |\n| 59+ | -21846 | 1 | 106 | 21845 |\n| 60 | -21846 | 1 | 106 | -21846 |\n| 60+ | -21846 | 0 | 42 | 21845 |\n| 61 | -21846 | 0 | 42 | 21845 |\n| 61 | -21846 | 0 | 106 | -21846 |\n| 61 | -21846 | 0 | 170 | 21845 |\n| 61 | -21846 | 0 | 234 | 21845 |\n| 61 | -21846 | 0 | 298 | 21845 |\n| 61 | -21846 | 0 | 362 | 21845 |\n| 61 | -21846 | 0 | 426 | 21845 |\n| 61 | -21846 | 0 | 490 | 21845 |\n| 61+ | 21845 | 1 | 106 | -21846 |\n| 62 | 21845 | 1 | 106 | 21845 |\n| 62+ | -21846 | 1 | 170 | 21845 |\n| 63 | -21846 | 1 | 170 | -21846 |\n| 63+ | -21846 | 0 | 42 | 21845 |\n| 64 | -21846 | 0 | 42 | 21845 |\n| 64 | -21846 | 0 | 106 | 21845 |\n| 64 | -21846 | 0 | 170 | -21846 |\n| 64 | -21846 | 0 | 234 | 21845 |\n| 64 | -21846 | 0 | 298 | 21845 |\n| 64 | -21846 | 0 | 362 | 21845 |\n| 64 | -21846 | 0 | 426 | 21845 |\n| 64 | -21846 | 0 | 490 | 21845 |\n| 64+ | 21845 | 1 | 170 | -21846 |\n| 65 | 21845 | 1 | 170 | 21845 |\n| 65+ | -21846 | 1 | 234 | 21845 |\n| 66 | -21846 | 1 | 234 | -21846 |\n| 66+ | -21846 | 0 | 42 | 21845 |\n| 67 | -21846 | 0 | 42 | 21845 |\n| 67 | -21846 | 0 | 106 | 21845 |\n| 67 | -21846 | 0 | 170 | 21845 |\n| 67 | -21846 | 0 | 234 | -21846 |\n| 67 | -21846 | 0 | 298 | 21845 |\n| 67 | -21846 | 0 | 362 | 21845 |\n| 67 | -21846 | 0 | 426 | 21845 |\n| 67 | -21846 | 0 | 490 | 21845 |\n| 67+ | 21845 | 1 | 234 | -21846 |\n| 68 | 21845 | 1 | 234 | 21845 |\n| 68+ | -21846 | 1 | 298 | 21845 |\n| 69 | -21846 | 1 | 298 | -21846 |\n| 69+ | -21846 | 0 | 42 | 21845 |\n| 70 | -21846 | 0 | 42 | 21845 |\n| 70 | -21846 | 0 | 106 | 21845 |\n| 70 | -21846 | 0 | 170 | 21845 |\n| 70 | -21846 | 0 | 234 | 21845 |\n| 70 | -21846 | 0 | 298 | -21846 |\n| 70 | -21846 | 0 | 362 | 21845 |\n| 70 | -21846 | 0 | 426 | 21845 |\n| 70 | -21846 | 0 | 490 | 21845 |\n| 70+ | 21845 | 1 | 298 | -21846 |\n| 71 | 21845 | 1 | 298 | 21845 |\n| 71+ | -21846 | 1 | 362 | 21845 |\n| 72 | -21846 | 1 | 362 | -21846 |\n| 72+ | -21846 | 0 | 42 | 21845 |\n| 73 | -21846 | 0 | 42 | 21845 |\n| 73 | -21846 | 0 | 106 | 21845 |\n| 73 | -21846 | 0 | 170 | 21845 |\n| 73 | -21846 | 0 | 234 | 21845 |\n| 73 | -21846 | 0 | 298 | 21845 |\n| 73 | -21846 | 0 | 362 | -21846 |\n| 73 | -21846 | 0 | 426 | 21845 |\n| 73 | -21846 | 0 | 490 | 21845 |\n| 73+ | 21845 | 1 | 362 | -21846 |\n| 74 | 21845 | 1 | 362 | 21845 |\n| 74+ | -21846 | 1 | 426 | 21845 |\n| 75 | -21846 | 1 | 426 | -21846 |\n| 75+ | -21846 | 0 | 42 | 21845 |\n| 76 | -21846 | 0 | 42 | 21845 |\n| 76 | -21846 | 0 | 106 | 21845 |\n| 76 | -21846 | 0 | 170 | 21845 |\n| 76 | -21846 | 0 | 234 | 21845 |\n| 76 | -21846 | 0 | 298 | 21845 |\n| 76 | -21846 | 0 | 362 | 21845 |\n| 76 | -21846 | 0 | 426 | -21846 |\n| 76 | -21846 | 0 | 490 | 21845 |\n| 76+ | 21845 | 1 | 426 | -21846 |\n| 77 | 21845 | 1 | 426 | 21845 |\n| 77+ | -21846 | 1 | 490 | 21845 |\n| 78 | -21846 | 1 | 490 | -21846 |\n| 78+ | -21846 | 0 | 42 | 21845 |\n| 79 | -21846 | 0 | 42 | 21845 |\n| 79 | -21846 | 0 | 106 | 21845 |\n| 79 | -21846 | 0 | 170 | 21845 |\n| 79 | -21846 | 0 | 234 | 21845 |\n| 79 | -21846 | 0 | 298 | 21845 |\n| 79 | -21846 | 0 | 362 | 21845 |\n| 79 | -21846 | 0 | 426 | 21845 |\n| 79 | -21846 | 0 | 490 | -21846 |\n| 79+ | 21845 | 1 | 490 | -21846 |\n| 80 | 21845 | 1 | 490 | 21845 |\n| 80+ | 21845 | 0 | 42 | 21845 |\n| 81 | 21845 | 0 | 42 | 21845 |\n| 81 | 21845 | 0 | 106 | 21845 |\n| 81 | 21845 | 0 | 170 | 21845 |\n| 81 | 21845 | 0 | 234 | 21845 |\n| 81 | 21845 | 0 | 298 | 21845 |\n| 81 | 21845 | 0 | 362 | 21845 |\n| 81 | 21845 | 0 | 426 | 21845 |\n| 81 | 21845 | 0 | 490 | 21845 |"},RAM4k:{"RAM4k.hdl":"/**\n * Memory of 4K registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM4K {\n IN in[16], load, address[12];\n OUT out[16];\n\n PARTS:\n}","RAM4k.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.4.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset in 1111, set load 0, tick, output; tock, output;\nset load 1, set address 1111, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset in 3513, set address 3513, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 1111, eval, output;\n\nset in 4095, tick, output; tock, output;\nset load 1, set address 4095, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 3513, eval, output;\n\nset address 4095, eval, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B101010101000, tick, output; tock, output;\nset address %B101010101001, tick, output, tock, output;\nset address %B101010101010, tick, output, tock, output;\nset address %B101010101011, tick, output, tock, output;\nset address %B101010101100, tick, output, tock, output;\nset address %B101010101101, tick, output, tock, output;\nset address %B101010101110, tick, output, tock, output;\nset address %B101010101111, tick, output, tock, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101000, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101001, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101010, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101011, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101100, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101111, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101010101, tick, output; tock, output;\nset address %B001101010101, tick, output, tock, output;\nset address %B010101010101, tick, output, tock, output;\nset address %B011101010101, tick, output, tock, output;\nset address %B100101010101, tick, output, tock, output;\nset address %B101101010101, tick, output, tock, output;\nset address %B110101010101, tick, output, tock, output;\nset address %B111101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B000101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B000101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B001101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B011101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B100101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B101101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B111101010101, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;","RAM4k.cmp":"| time | in |load |address | out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 1111 | 0 | 0 | 0 |\n| 3 | 1111 | 0 | 0 | 0 |\n| 3+ | 1111 | 1 | 1111 | 0 |\n| 4 | 1111 | 1 | 1111 | 1111 |\n| 4+ | 1111 | 0 | 0 | 0 |\n| 5 | 1111 | 0 | 0 | 0 |\n| 5+ | 3513 | 0 | 3513 | 0 |\n| 6 | 3513 | 0 | 3513 | 0 |\n| 6+ | 3513 | 1 | 3513 | 0 |\n| 7 | 3513 | 1 | 3513 | 3513 |\n| 7+ | 3513 | 0 | 3513 | 3513 |\n| 8 | 3513 | 0 | 3513 | 3513 |\n| 8 | 3513 | 0 | 1111 | 1111 |\n| 8+ | 4095 | 0 | 1111 | 1111 |\n| 9 | 4095 | 0 | 1111 | 1111 |\n| 9+ | 4095 | 1 | 4095 | 0 |\n| 10 | 4095 | 1 | 4095 | 4095 |\n| 10+ | 4095 | 0 | 4095 | 4095 |\n| 11 | 4095 | 0 | 4095 | 4095 |\n| 11 | 4095 | 0 | 3513 | 3513 |\n| 11 | 4095 | 0 | 4095 | 4095 |\n| 11+ | 4095 | 0 | 2728 | 0 |\n| 12 | 4095 | 0 | 2728 | 0 |\n| 12 | 4095 | 0 | 2729 | 0 |\n| 12 | 4095 | 0 | 2730 | 0 |\n| 12 | 4095 | 0 | 2731 | 0 |\n| 12 | 4095 | 0 | 2732 | 0 |\n| 12 | 4095 | 0 | 2733 | 0 |\n| 12 | 4095 | 0 | 2734 | 0 |\n| 12 | 4095 | 0 | 2735 | 0 |\n| 12+ | 21845 | 1 | 2728 | 0 |\n| 13 | 21845 | 1 | 2728 | 21845 |\n| 13+ | 21845 | 1 | 2729 | 0 |\n| 14 | 21845 | 1 | 2729 | 21845 |\n| 14+ | 21845 | 1 | 2730 | 0 |\n| 15 | 21845 | 1 | 2730 | 21845 |\n| 15+ | 21845 | 1 | 2731 | 0 |\n| 16 | 21845 | 1 | 2731 | 21845 |\n| 16+ | 21845 | 1 | 2732 | 0 |\n| 17 | 21845 | 1 | 2732 | 21845 |\n| 17+ | 21845 | 1 | 2733 | 0 |\n| 18 | 21845 | 1 | 2733 | 21845 |\n| 18+ | 21845 | 1 | 2734 | 0 |\n| 19 | 21845 | 1 | 2734 | 21845 |\n| 19+ | 21845 | 1 | 2735 | 0 |\n| 20 | 21845 | 1 | 2735 | 21845 |\n| 20+ | 21845 | 0 | 2728 | 21845 |\n| 21 | 21845 | 0 | 2728 | 21845 |\n| 21 | 21845 | 0 | 2729 | 21845 |\n| 21 | 21845 | 0 | 2730 | 21845 |\n| 21 | 21845 | 0 | 2731 | 21845 |\n| 21 | 21845 | 0 | 2732 | 21845 |\n| 21 | 21845 | 0 | 2733 | 21845 |\n| 21 | 21845 | 0 | 2734 | 21845 |\n| 21 | 21845 | 0 | 2735 | 21845 |\n| 21+ | -21846 | 1 | 2728 | 21845 |\n| 22 | -21846 | 1 | 2728 | -21846 |\n| 22+ | -21846 | 0 | 2728 | -21846 |\n| 23 | -21846 | 0 | 2728 | -21846 |\n| 23 | -21846 | 0 | 2729 | 21845 |\n| 23 | -21846 | 0 | 2730 | 21845 |\n| 23 | -21846 | 0 | 2731 | 21845 |\n| 23 | -21846 | 0 | 2732 | 21845 |\n| 23 | -21846 | 0 | 2733 | 21845 |\n| 23 | -21846 | 0 | 2734 | 21845 |\n| 23 | -21846 | 0 | 2735 | 21845 |\n| 23+ | 21845 | 1 | 2728 | -21846 |\n| 24 | 21845 | 1 | 2728 | 21845 |\n| 24+ | -21846 | 1 | 2729 | 21845 |\n| 25 | -21846 | 1 | 2729 | -21846 |\n| 25+ | -21846 | 0 | 2728 | 21845 |\n| 26 | -21846 | 0 | 2728 | 21845 |\n| 26 | -21846 | 0 | 2729 | -21846 |\n| 26 | -21846 | 0 | 2730 | 21845 |\n| 26 | -21846 | 0 | 2731 | 21845 |\n| 26 | -21846 | 0 | 2732 | 21845 |\n| 26 | -21846 | 0 | 2733 | 21845 |\n| 26 | -21846 | 0 | 2734 | 21845 |\n| 26 | -21846 | 0 | 2735 | 21845 |\n| 26+ | 21845 | 1 | 2729 | -21846 |\n| 27 | 21845 | 1 | 2729 | 21845 |\n| 27+ | -21846 | 1 | 2730 | 21845 |\n| 28 | -21846 | 1 | 2730 | -21846 |\n| 28+ | -21846 | 0 | 2728 | 21845 |\n| 29 | -21846 | 0 | 2728 | 21845 |\n| 29 | -21846 | 0 | 2729 | 21845 |\n| 29 | -21846 | 0 | 2730 | -21846 |\n| 29 | -21846 | 0 | 2731 | 21845 |\n| 29 | -21846 | 0 | 2732 | 21845 |\n| 29 | -21846 | 0 | 2733 | 21845 |\n| 29 | -21846 | 0 | 2734 | 21845 |\n| 29 | -21846 | 0 | 2735 | 21845 |\n| 29+ | 21845 | 1 | 2730 | -21846 |\n| 30 | 21845 | 1 | 2730 | 21845 |\n| 30+ | -21846 | 1 | 2731 | 21845 |\n| 31 | -21846 | 1 | 2731 | -21846 |\n| 31+ | -21846 | 0 | 2728 | 21845 |\n| 32 | -21846 | 0 | 2728 | 21845 |\n| 32 | -21846 | 0 | 2729 | 21845 |\n| 32 | -21846 | 0 | 2730 | 21845 |\n| 32 | -21846 | 0 | 2731 | -21846 |\n| 32 | -21846 | 0 | 2732 | 21845 |\n| 32 | -21846 | 0 | 2733 | 21845 |\n| 32 | -21846 | 0 | 2734 | 21845 |\n| 32 | -21846 | 0 | 2735 | 21845 |\n| 32+ | 21845 | 1 | 2731 | -21846 |\n| 33 | 21845 | 1 | 2731 | 21845 |\n| 33+ | -21846 | 1 | 2732 | 21845 |\n| 34 | -21846 | 1 | 2732 | -21846 |\n| 34+ | -21846 | 0 | 2728 | 21845 |\n| 35 | -21846 | 0 | 2728 | 21845 |\n| 35 | -21846 | 0 | 2729 | 21845 |\n| 35 | -21846 | 0 | 2730 | 21845 |\n| 35 | -21846 | 0 | 2731 | 21845 |\n| 35 | -21846 | 0 | 2732 | -21846 |\n| 35 | -21846 | 0 | 2733 | 21845 |\n| 35 | -21846 | 0 | 2734 | 21845 |\n| 35 | -21846 | 0 | 2735 | 21845 |\n| 35+ | 21845 | 1 | 2732 | -21846 |\n| 36 | 21845 | 1 | 2732 | 21845 |\n| 36+ | -21846 | 1 | 2733 | 21845 |\n| 37 | -21846 | 1 | 2733 | -21846 |\n| 37+ | -21846 | 0 | 2728 | 21845 |\n| 38 | -21846 | 0 | 2728 | 21845 |\n| 38 | -21846 | 0 | 2729 | 21845 |\n| 38 | -21846 | 0 | 2730 | 21845 |\n| 38 | -21846 | 0 | 2731 | 21845 |\n| 38 | -21846 | 0 | 2732 | 21845 |\n| 38 | -21846 | 0 | 2733 | -21846 |\n| 38 | -21846 | 0 | 2734 | 21845 |\n| 38 | -21846 | 0 | 2735 | 21845 |\n| 38+ | 21845 | 1 | 2733 | -21846 |\n| 39 | 21845 | 1 | 2733 | 21845 |\n| 39+ | -21846 | 1 | 2734 | 21845 |\n| 40 | -21846 | 1 | 2734 | -21846 |\n| 40+ | -21846 | 0 | 2728 | 21845 |\n| 41 | -21846 | 0 | 2728 | 21845 |\n| 41 | -21846 | 0 | 2729 | 21845 |\n| 41 | -21846 | 0 | 2730 | 21845 |\n| 41 | -21846 | 0 | 2731 | 21845 |\n| 41 | -21846 | 0 | 2732 | 21845 |\n| 41 | -21846 | 0 | 2733 | 21845 |\n| 41 | -21846 | 0 | 2734 | -21846 |\n| 41 | -21846 | 0 | 2735 | 21845 |\n| 41+ | 21845 | 1 | 2734 | -21846 |\n| 42 | 21845 | 1 | 2734 | 21845 |\n| 42+ | -21846 | 1 | 2735 | 21845 |\n| 43 | -21846 | 1 | 2735 | -21846 |\n| 43+ | -21846 | 0 | 2728 | 21845 |\n| 44 | -21846 | 0 | 2728 | 21845 |\n| 44 | -21846 | 0 | 2729 | 21845 |\n| 44 | -21846 | 0 | 2730 | 21845 |\n| 44 | -21846 | 0 | 2731 | 21845 |\n| 44 | -21846 | 0 | 2732 | 21845 |\n| 44 | -21846 | 0 | 2733 | 21845 |\n| 44 | -21846 | 0 | 2734 | 21845 |\n| 44 | -21846 | 0 | 2735 | -21846 |\n| 44+ | 21845 | 1 | 2735 | -21846 |\n| 45 | 21845 | 1 | 2735 | 21845 |\n| 45+ | 21845 | 0 | 2728 | 21845 |\n| 46 | 21845 | 0 | 2728 | 21845 |\n| 46 | 21845 | 0 | 2729 | 21845 |\n| 46 | 21845 | 0 | 2730 | 21845 |\n| 46 | 21845 | 0 | 2731 | 21845 |\n| 46 | 21845 | 0 | 2732 | 21845 |\n| 46 | 21845 | 0 | 2733 | 21845 |\n| 46 | 21845 | 0 | 2734 | 21845 |\n| 46 | 21845 | 0 | 2735 | 21845 |\n| 46+ | 21845 | 0 | 341 | 0 |\n| 47 | 21845 | 0 | 341 | 0 |\n| 47 | 21845 | 0 | 853 | 0 |\n| 47 | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 1877 | 0 |\n| 47 | 21845 | 0 | 2389 | 0 |\n| 47 | 21845 | 0 | 2901 | 0 |\n| 47 | 21845 | 0 | 3413 | 0 |\n| 47 | 21845 | 0 | 3925 | 0 |\n| 47+ | 21845 | 1 | 341 | 0 |\n| 48 | 21845 | 1 | 341 | 21845 |\n| 48+ | 21845 | 1 | 853 | 0 |\n| 49 | 21845 | 1 | 853 | 21845 |\n| 49+ | 21845 | 1 | 1365 | 0 |\n| 50 | 21845 | 1 | 1365 | 21845 |\n| 50+ | 21845 | 1 | 1877 | 0 |\n| 51 | 21845 | 1 | 1877 | 21845 |\n| 51+ | 21845 | 1 | 2389 | 0 |\n| 52 | 21845 | 1 | 2389 | 21845 |\n| 52+ | 21845 | 1 | 2901 | 0 |\n| 53 | 21845 | 1 | 2901 | 21845 |\n| 53+ | 21845 | 1 | 3413 | 0 |\n| 54 | 21845 | 1 | 3413 | 21845 |\n| 54+ | 21845 | 1 | 3925 | 0 |\n| 55 | 21845 | 1 | 3925 | 21845 |\n| 55+ | 21845 | 0 | 341 | 21845 |\n| 56 | 21845 | 0 | 341 | 21845 |\n| 56 | 21845 | 0 | 853 | 21845 |\n| 56 | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 1877 | 21845 |\n| 56 | 21845 | 0 | 2389 | 21845 |\n| 56 | 21845 | 0 | 2901 | 21845 |\n| 56 | 21845 | 0 | 3413 | 21845 |\n| 56 | 21845 | 0 | 3925 | 21845 |\n| 56+ | -21846 | 1 | 341 | 21845 |\n| 57 | -21846 | 1 | 341 | -21846 |\n| 57+ | -21846 | 0 | 341 | -21846 |\n| 58 | -21846 | 0 | 341 | -21846 |\n| 58 | -21846 | 0 | 853 | 21845 |\n| 58 | -21846 | 0 | 1365 | 21845 |\n| 58 | -21846 | 0 | 1877 | 21845 |\n| 58 | -21846 | 0 | 2389 | 21845 |\n| 58 | -21846 | 0 | 2901 | 21845 |\n| 58 | -21846 | 0 | 3413 | 21845 |\n| 58 | -21846 | 0 | 3925 | 21845 |\n| 58+ | 21845 | 1 | 341 | -21846 |\n| 59 | 21845 | 1 | 341 | 21845 |\n| 59+ | -21846 | 1 | 853 | 21845 |\n| 60 | -21846 | 1 | 853 | -21846 |\n| 60+ | -21846 | 0 | 341 | 21845 |\n| 61 | -21846 | 0 | 341 | 21845 |\n| 61 | -21846 | 0 | 853 | -21846 |\n| 61 | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 1877 | 21845 |\n| 61 | -21846 | 0 | 2389 | 21845 |\n| 61 | -21846 | 0 | 2901 | 21845 |\n| 61 | -21846 | 0 | 3413 | 21845 |\n| 61 | -21846 | 0 | 3925 | 21845 |\n| 61+ | 21845 | 1 | 853 | -21846 |\n| 62 | 21845 | 1 | 853 | 21845 |\n| 62+ | -21846 | 1 | 1365 | 21845 |\n| 63 | -21846 | 1 | 1365 | -21846 |\n| 63+ | -21846 | 0 | 341 | 21845 |\n| 64 | -21846 | 0 | 341 | 21845 |\n| 64 | -21846 | 0 | 853 | 21845 |\n| 64 | -21846 | 0 | 1365 | -21846 |\n| 64 | -21846 | 0 | 1877 | 21845 |\n| 64 | -21846 | 0 | 2389 | 21845 |\n| 64 | -21846 | 0 | 2901 | 21845 |\n| 64 | -21846 | 0 | 3413 | 21845 |\n| 64 | -21846 | 0 | 3925 | 21845 |\n| 64+ | 21845 | 1 | 1365 | -21846 |\n| 65 | 21845 | 1 | 1365 | 21845 |\n| 65+ | -21846 | 1 | 1877 | 21845 |\n| 66 | -21846 | 1 | 1877 | -21846 |\n| 66+ | -21846 | 0 | 341 | 21845 |\n| 67 | -21846 | 0 | 341 | 21845 |\n| 67 | -21846 | 0 | 853 | 21845 |\n| 67 | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 1877 | -21846 |\n| 67 | -21846 | 0 | 2389 | 21845 |\n| 67 | -21846 | 0 | 2901 | 21845 |\n| 67 | -21846 | 0 | 3413 | 21845 |\n| 67 | -21846 | 0 | 3925 | 21845 |\n| 67+ | 21845 | 1 | 1877 | -21846 |\n| 68 | 21845 | 1 | 1877 | 21845 |\n| 68+ | -21846 | 1 | 2389 | 21845 |\n| 69 | -21846 | 1 | 2389 | -21846 |\n| 69+ | -21846 | 0 | 341 | 21845 |\n| 70 | -21846 | 0 | 341 | 21845 |\n| 70 | -21846 | 0 | 853 | 21845 |\n| 70 | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 1877 | 21845 |\n| 70 | -21846 | 0 | 2389 | -21846 |\n| 70 | -21846 | 0 | 2901 | 21845 |\n| 70 | -21846 | 0 | 3413 | 21845 |\n| 70 | -21846 | 0 | 3925 | 21845 |\n| 70+ | 21845 | 1 | 2389 | -21846 |\n| 71 | 21845 | 1 | 2389 | 21845 |\n| 71+ | -21846 | 1 | 2901 | 21845 |\n| 72 | -21846 | 1 | 2901 | -21846 |\n| 72+ | -21846 | 0 | 341 | 21845 |\n| 73 | -21846 | 0 | 341 | 21845 |\n| 73 | -21846 | 0 | 853 | 21845 |\n| 73 | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 1877 | 21845 |\n| 73 | -21846 | 0 | 2389 | 21845 |\n| 73 | -21846 | 0 | 2901 | -21846 |\n| 73 | -21846 | 0 | 3413 | 21845 |\n| 73 | -21846 | 0 | 3925 | 21845 |\n| 73+ | 21845 | 1 | 2901 | -21846 |\n| 74 | 21845 | 1 | 2901 | 21845 |\n| 74+ | -21846 | 1 | 3413 | 21845 |\n| 75 | -21846 | 1 | 3413 | -21846 |\n| 75+ | -21846 | 0 | 341 | 21845 |\n| 76 | -21846 | 0 | 341 | 21845 |\n| 76 | -21846 | 0 | 853 | 21845 |\n| 76 | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 1877 | 21845 |\n| 76 | -21846 | 0 | 2389 | 21845 |\n| 76 | -21846 | 0 | 2901 | 21845 |\n| 76 | -21846 | 0 | 3413 | -21846 |\n| 76 | -21846 | 0 | 3925 | 21845 |\n| 76+ | 21845 | 1 | 3413 | -21846 |\n| 77 | 21845 | 1 | 3413 | 21845 |\n| 77+ | -21846 | 1 | 3925 | 21845 |\n| 78 | -21846 | 1 | 3925 | -21846 |\n| 78+ | -21846 | 0 | 341 | 21845 |\n| 79 | -21846 | 0 | 341 | 21845 |\n| 79 | -21846 | 0 | 853 | 21845 |\n| 79 | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 1877 | 21845 |\n| 79 | -21846 | 0 | 2389 | 21845 |\n| 79 | -21846 | 0 | 2901 | 21845 |\n| 79 | -21846 | 0 | 3413 | 21845 |\n| 79 | -21846 | 0 | 3925 | -21846 |\n| 79+ | 21845 | 1 | 3925 | -21846 |\n| 80 | 21845 | 1 | 3925 | 21845 |\n| 80+ | 21845 | 0 | 341 | 21845 |\n| 81 | 21845 | 0 | 341 | 21845 |\n| 81 | 21845 | 0 | 853 | 21845 |\n| 81 | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 1877 | 21845 |\n| 81 | 21845 | 0 | 2389 | 21845 |\n| 81 | 21845 | 0 | 2901 | 21845 |\n| 81 | 21845 | 0 | 3413 | 21845 |\n| 81 | 21845 | 0 | 3925 | 21845 |"},RAM16k:{"RAM16k.hdl":"\nCHIP RAM16K {\n IN in[16], load, address[14];\n OUT out[16];\n\n PARTS:\n}","RAM16k.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.5.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 4321, set load 0, tick, output; tock, output;\nset load 1, set address 4321, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 12345, set address 12345, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 4321, eval, output;\n\nset in 16383, tick, output; tock, output;\nset load 1, set address 16383, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 12345, eval, output;\nset address 16383, eval, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set in %B0101010101010101, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, tick, output, tock, output;\nset address %B10101010101010, tick, output, tock, output;\nset address %B10101010101011, tick, output, tock, output;\nset address %B10101010101100, tick, output, tock, output;\nset address %B10101010101101, tick, output, tock, output;\nset address %B10101010101110, tick, output, tock, output;\nset address %B10101010101111, tick, output, tock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101000, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101001, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101010, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1;\nset address %B10101010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101011, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0, set address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101100, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101111, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101111, set in %B0101010101010101, tick, output, tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, tick, output, tock, output;\nset address %B01010101010101, tick, output, tock, output;\nset address %B01110101010101, tick, output, tock, output;\nset address %B10010101010101, tick, output, tock, output;\nset address %B10110101010101, tick, output, tock, output;\nset address %B11010101010101, tick, output, tock, output;\nset address %B11110101010101, tick, output, tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00010101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B00110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B01010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B01010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B01110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B01110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B10010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B10110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B11010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B11010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B11110101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B11110101010101, set in %B0101010101010101, tick, output, tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;","RAM16k.cmp":"| time | in |load | address | out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 4321 | 0 | 0 | 0 |\n| 3 | 4321 | 0 | 0 | 0 |\n| 3+ | 4321 | 1 | 4321 | 0 |\n| 4 | 4321 | 1 | 4321 | 4321 |\n| 4+ | 4321 | 0 | 0 | 0 |\n| 5 | 4321 | 0 | 0 | 0 |\n| 5+ | 12345 | 0 | 12345 | 0 |\n| 6 | 12345 | 0 | 12345 | 0 |\n| 6+ | 12345 | 1 | 12345 | 0 |\n| 7 | 12345 | 1 | 12345 | 12345 |\n| 7+ | 12345 | 0 | 12345 | 12345 |\n| 8 | 12345 | 0 | 12345 | 12345 |\n| 8 | 12345 | 0 | 4321 | 4321 |\n| 8+ | 16383 | 0 | 4321 | 4321 |\n| 9 | 16383 | 0 | 4321 | 4321 |\n| 9+ | 16383 | 1 | 16383 | 0 |\n| 10 | 16383 | 1 | 16383 | 16383 |\n| 10+ | 16383 | 0 | 16383 | 16383 |\n| 11 | 16383 | 0 | 16383 | 16383 |\n| 11 | 16383 | 0 | 12345 | 12345 |\n| 11 | 16383 | 0 | 16383 | 16383 |\n| 11+ | 16383 | 0 | 10920 | 0 |\n| 12 | 16383 | 0 | 10920 | 0 |\n| 12 | 16383 | 0 | 10921 | 0 |\n| 12 | 16383 | 0 | 10922 | 0 |\n| 12 | 16383 | 0 | 10923 | 0 |\n| 12 | 16383 | 0 | 10924 | 0 |\n| 12 | 16383 | 0 | 10925 | 0 |\n| 12 | 16383 | 0 | 10926 | 0 |\n| 12 | 16383 | 0 | 10927 | 0 |\n| 12+ | 21845 | 1 | 10920 | 0 |\n| 13 | 21845 | 1 | 10920 | 21845 |\n| 13+ | 21845 | 1 | 10921 | 0 |\n| 14 | 21845 | 1 | 10921 | 21845 |\n| 14+ | 21845 | 1 | 10922 | 0 |\n| 15 | 21845 | 1 | 10922 | 21845 |\n| 15+ | 21845 | 1 | 10923 | 0 |\n| 16 | 21845 | 1 | 10923 | 21845 |\n| 16+ | 21845 | 1 | 10924 | 0 |\n| 17 | 21845 | 1 | 10924 | 21845 |\n| 17+ | 21845 | 1 | 10925 | 0 |\n| 18 | 21845 | 1 | 10925 | 21845 |\n| 18+ | 21845 | 1 | 10926 | 0 |\n| 19 | 21845 | 1 | 10926 | 21845 |\n| 19+ | 21845 | 1 | 10927 | 0 |\n| 20 | 21845 | 1 | 10927 | 21845 |\n| 20+ | 21845 | 0 | 10920 | 21845 |\n| 21 | 21845 | 0 | 10920 | 21845 |\n| 21 | 21845 | 0 | 10921 | 21845 |\n| 21 | 21845 | 0 | 10922 | 21845 |\n| 21 | 21845 | 0 | 10923 | 21845 |\n| 21 | 21845 | 0 | 10924 | 21845 |\n| 21 | 21845 | 0 | 10925 | 21845 |\n| 21 | 21845 | 0 | 10926 | 21845 |\n| 21 | 21845 | 0 | 10927 | 21845 |\n| 21+ | -21846 | 1 | 10920 | 21845 |\n| 22 | -21846 | 1 | 10920 | -21846 |\n| 22+ | -21846 | 0 | 10920 | -21846 |\n| 23 | -21846 | 0 | 10920 | -21846 |\n| 23 | -21846 | 0 | 10921 | 21845 |\n| 23 | -21846 | 0 | 10922 | 21845 |\n| 23 | -21846 | 0 | 10923 | 21845 |\n| 23 | -21846 | 0 | 10924 | 21845 |\n| 23 | -21846 | 0 | 10925 | 21845 |\n| 23 | -21846 | 0 | 10926 | 21845 |\n| 23 | -21846 | 0 | 10927 | 21845 |\n| 23+ | 21845 | 1 | 10920 | -21846 |\n| 24 | 21845 | 1 | 10920 | 21845 |\n| 24+ | -21846 | 1 | 10921 | 21845 |\n| 25 | -21846 | 1 | 10921 | -21846 |\n| 25+ | -21846 | 0 | 10920 | 21845 |\n| 26 | -21846 | 0 | 10920 | 21845 |\n| 26 | -21846 | 0 | 10921 | -21846 |\n| 26 | -21846 | 0 | 10922 | 21845 |\n| 26 | -21846 | 0 | 10923 | 21845 |\n| 26 | -21846 | 0 | 10924 | 21845 |\n| 26 | -21846 | 0 | 10925 | 21845 |\n| 26 | -21846 | 0 | 10926 | 21845 |\n| 26 | -21846 | 0 | 10927 | 21845 |\n| 26+ | 21845 | 1 | 10921 | -21846 |\n| 27 | 21845 | 1 | 10921 | 21845 |\n| 27+ | -21846 | 1 | 10922 | 21845 |\n| 28 | -21846 | 1 | 10922 | -21846 |\n| 28+ | -21846 | 0 | 10920 | 21845 |\n| 29 | -21846 | 0 | 10920 | 21845 |\n| 29 | -21846 | 0 | 10921 | 21845 |\n| 29 | -21846 | 0 | 10922 | -21846 |\n| 29 | -21846 | 0 | 10923 | 21845 |\n| 29 | -21846 | 0 | 10924 | 21845 |\n| 29 | -21846 | 0 | 10925 | 21845 |\n| 29 | -21846 | 0 | 10926 | 21845 |\n| 29 | -21846 | 0 | 10927 | 21845 |\n| 29+ | 21845 | 1 | 10922 | -21846 |\n| 30 | 21845 | 1 | 10922 | 21845 |\n| 30+ | -21846 | 1 | 10923 | 21845 |\n| 31 | -21846 | 1 | 10923 | -21846 |\n| 31+ | -21846 | 0 | 10920 | 21845 |\n| 32 | -21846 | 0 | 10920 | 21845 |\n| 32 | -21846 | 0 | 10921 | 21845 |\n| 32 | -21846 | 0 | 10922 | 21845 |\n| 32 | -21846 | 0 | 10923 | -21846 |\n| 32 | -21846 | 0 | 10924 | 21845 |\n| 32 | -21846 | 0 | 10925 | 21845 |\n| 32 | -21846 | 0 | 10926 | 21845 |\n| 32 | -21846 | 0 | 10927 | 21845 |\n| 32+ | 21845 | 1 | 10923 | -21846 |\n| 33 | 21845 | 1 | 10923 | 21845 |\n| 33+ | -21846 | 1 | 10924 | 21845 |\n| 34 | -21846 | 1 | 10924 | -21846 |\n| 34+ | -21846 | 0 | 10920 | 21845 |\n| 35 | -21846 | 0 | 10920 | 21845 |\n| 35 | -21846 | 0 | 10921 | 21845 |\n| 35 | -21846 | 0 | 10922 | 21845 |\n| 35 | -21846 | 0 | 10923 | 21845 |\n| 35 | -21846 | 0 | 10924 | -21846 |\n| 35 | -21846 | 0 | 10925 | 21845 |\n| 35 | -21846 | 0 | 10926 | 21845 |\n| 35 | -21846 | 0 | 10927 | 21845 |\n| 35+ | 21845 | 1 | 10924 | -21846 |\n| 36 | 21845 | 1 | 10924 | 21845 |\n| 36+ | -21846 | 1 | 10925 | 21845 |\n| 37 | -21846 | 1 | 10925 | -21846 |\n| 37+ | -21846 | 0 | 10920 | 21845 |\n| 38 | -21846 | 0 | 10920 | 21845 |\n| 38 | -21846 | 0 | 10921 | 21845 |\n| 38 | -21846 | 0 | 10922 | 21845 |\n| 38 | -21846 | 0 | 10923 | 21845 |\n| 38 | -21846 | 0 | 10924 | 21845 |\n| 38 | -21846 | 0 | 10925 | -21846 |\n| 38 | -21846 | 0 | 10926 | 21845 |\n| 38 | -21846 | 0 | 10927 | 21845 |\n| 38+ | 21845 | 1 | 10925 | -21846 |\n| 39 | 21845 | 1 | 10925 | 21845 |\n| 39+ | -21846 | 1 | 10926 | 21845 |\n| 40 | -21846 | 1 | 10926 | -21846 |\n| 40+ | -21846 | 0 | 10920 | 21845 |\n| 41 | -21846 | 0 | 10920 | 21845 |\n| 41 | -21846 | 0 | 10921 | 21845 |\n| 41 | -21846 | 0 | 10922 | 21845 |\n| 41 | -21846 | 0 | 10923 | 21845 |\n| 41 | -21846 | 0 | 10924 | 21845 |\n| 41 | -21846 | 0 | 10925 | 21845 |\n| 41 | -21846 | 0 | 10926 | -21846 |\n| 41 | -21846 | 0 | 10927 | 21845 |\n| 41+ | 21845 | 1 | 10926 | -21846 |\n| 42 | 21845 | 1 | 10926 | 21845 |\n| 42+ | -21846 | 1 | 10927 | 21845 |\n| 43 | -21846 | 1 | 10927 | -21846 |\n| 43+ | -21846 | 0 | 10920 | 21845 |\n| 44 | -21846 | 0 | 10920 | 21845 |\n| 44 | -21846 | 0 | 10921 | 21845 |\n| 44 | -21846 | 0 | 10922 | 21845 |\n| 44 | -21846 | 0 | 10923 | 21845 |\n| 44 | -21846 | 0 | 10924 | 21845 |\n| 44 | -21846 | 0 | 10925 | 21845 |\n| 44 | -21846 | 0 | 10926 | 21845 |\n| 44 | -21846 | 0 | 10927 | -21846 |\n| 44+ | 21845 | 1 | 10927 | -21846 |\n| 45 | 21845 | 1 | 10927 | 21845 |\n| 45+ | 21845 | 0 | 10920 | 21845 |\n| 46 | 21845 | 0 | 10920 | 21845 |\n| 46 | 21845 | 0 | 10921 | 21845 |\n| 46 | 21845 | 0 | 10922 | 21845 |\n| 46 | 21845 | 0 | 10923 | 21845 |\n| 46 | 21845 | 0 | 10924 | 21845 |\n| 46 | 21845 | 0 | 10925 | 21845 |\n| 46 | 21845 | 0 | 10926 | 21845 |\n| 46 | 21845 | 0 | 10927 | 21845 |\n| 46+ | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 3413 | 0 |\n| 47 | 21845 | 0 | 5461 | 0 |\n| 47 | 21845 | 0 | 7509 | 0 |\n| 47 | 21845 | 0 | 9557 | 0 |\n| 47 | 21845 | 0 | 11605 | 0 |\n| 47 | 21845 | 0 | 13653 | 0 |\n| 47 | 21845 | 0 | 15701 | 0 |\n| 47+ | 21845 | 1 | 1365 | 0 |\n| 48 | 21845 | 1 | 1365 | 21845 |\n| 48+ | 21845 | 1 | 3413 | 0 |\n| 49 | 21845 | 1 | 3413 | 21845 |\n| 49+ | 21845 | 1 | 5461 | 0 |\n| 50 | 21845 | 1 | 5461 | 21845 |\n| 50+ | 21845 | 1 | 7509 | 0 |\n| 51 | 21845 | 1 | 7509 | 21845 |\n| 51+ | 21845 | 1 | 9557 | 0 |\n| 52 | 21845 | 1 | 9557 | 21845 |\n| 52+ | 21845 | 1 | 11605 | 0 |\n| 53 | 21845 | 1 | 11605 | 21845 |\n| 53+ | 21845 | 1 | 13653 | 0 |\n| 54 | 21845 | 1 | 13653 | 21845 |\n| 54+ | 21845 | 1 | 15701 | 0 |\n| 55 | 21845 | 1 | 15701 | 21845 |\n| 55+ | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 3413 | 21845 |\n| 56 | 21845 | 0 | 5461 | 21845 |\n| 56 | 21845 | 0 | 7509 | 21845 |\n| 56 | 21845 | 0 | 9557 | 21845 |\n| 56 | 21845 | 0 | 11605 | 21845 |\n| 56 | 21845 | 0 | 13653 | 21845 |\n| 56 | 21845 | 0 | 15701 | 21845 |\n| 56+ | -21846 | 1 | 1365 | 21845 |\n| 57 | -21846 | 1 | 1365 | -21846 |\n| 57+ | -21846 | 0 | 1365 | -21846 |\n| 58 | -21846 | 0 | 1365 | -21846 |\n| 58 | -21846 | 0 | 3413 | 21845 |\n| 58 | -21846 | 0 | 5461 | 21845 |\n| 58 | -21846 | 0 | 7509 | 21845 |\n| 58 | -21846 | 0 | 9557 | 21845 |\n| 58 | -21846 | 0 | 11605 | 21845 |\n| 58 | -21846 | 0 | 13653 | 21845 |\n| 58 | -21846 | 0 | 15701 | 21845 |\n| 58+ | 21845 | 1 | 1365 | -21846 |\n| 59 | 21845 | 1 | 1365 | 21845 |\n| 59+ | -21846 | 1 | 3413 | 21845 |\n| 60 | -21846 | 1 | 3413 | -21846 |\n| 60+ | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 3413 | -21846 |\n| 61 | -21846 | 0 | 5461 | 21845 |\n| 61 | -21846 | 0 | 7509 | 21845 |\n| 61 | -21846 | 0 | 9557 | 21845 |\n| 61 | -21846 | 0 | 11605 | 21845 |\n| 61 | -21846 | 0 | 13653 | 21845 |\n| 61 | -21846 | 0 | 15701 | 21845 |\n| 61+ | 21845 | 1 | 3413 | -21846 |\n| 62 | 21845 | 1 | 3413 | 21845 |\n| 62+ | -21846 | 1 | 5461 | 21845 |\n| 63 | -21846 | 1 | 5461 | -21846 |\n| 63+ | -21846 | 0 | 1365 | 21845 |\n| 64 | -21846 | 0 | 1365 | 21845 |\n| 64 | -21846 | 0 | 3413 | 21845 |\n| 64 | -21846 | 0 | 5461 | -21846 |\n| 64 | -21846 | 0 | 7509 | 21845 |\n| 64 | -21846 | 0 | 9557 | 21845 |\n| 64 | -21846 | 0 | 11605 | 21845 |\n| 64 | -21846 | 0 | 13653 | 21845 |\n| 64 | -21846 | 0 | 15701 | 21845 |\n| 64+ | 21845 | 1 | 5461 | -21846 |\n| 65 | 21845 | 1 | 5461 | 21845 |\n| 65+ | -21846 | 1 | 7509 | 21845 |\n| 66 | -21846 | 1 | 7509 | -21846 |\n| 66+ | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 3413 | 21845 |\n| 67 | -21846 | 0 | 5461 | 21845 |\n| 67 | -21846 | 0 | 7509 | -21846 |\n| 67 | -21846 | 0 | 9557 | 21845 |\n| 67 | -21846 | 0 | 11605 | 21845 |\n| 67 | -21846 | 0 | 13653 | 21845 |\n| 67 | -21846 | 0 | 15701 | 21845 |\n| 67+ | 21845 | 1 | 7509 | -21846 |\n| 68 | 21845 | 1 | 7509 | 21845 |\n| 68+ | -21846 | 1 | 9557 | 21845 |\n| 69 | -21846 | 1 | 9557 | -21846 |\n| 69+ | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 3413 | 21845 |\n| 70 | -21846 | 0 | 5461 | 21845 |\n| 70 | -21846 | 0 | 7509 | 21845 |\n| 70 | -21846 | 0 | 9557 | -21846 |\n| 70 | -21846 | 0 | 11605 | 21845 |\n| 70 | -21846 | 0 | 13653 | 21845 |\n| 70 | -21846 | 0 | 15701 | 21845 |\n| 70+ | 21845 | 1 | 9557 | -21846 |\n| 71 | 21845 | 1 | 9557 | 21845 |\n| 71+ | -21846 | 1 | 11605 | 21845 |\n| 72 | -21846 | 1 | 11605 | -21846 |\n| 72+ | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 3413 | 21845 |\n| 73 | -21846 | 0 | 5461 | 21845 |\n| 73 | -21846 | 0 | 7509 | 21845 |\n| 73 | -21846 | 0 | 9557 | 21845 |\n| 73 | -21846 | 0 | 11605 | -21846 |\n| 73 | -21846 | 0 | 13653 | 21845 |\n| 73 | -21846 | 0 | 15701 | 21845 |\n| 73+ | 21845 | 1 | 11605 | -21846 |\n| 74 | 21845 | 1 | 11605 | 21845 |\n| 74+ | -21846 | 1 | 13653 | 21845 |\n| 75 | -21846 | 1 | 13653 | -21846 |\n| 75+ | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 3413 | 21845 |\n| 76 | -21846 | 0 | 5461 | 21845 |\n| 76 | -21846 | 0 | 7509 | 21845 |\n| 76 | -21846 | 0 | 9557 | 21845 |\n| 76 | -21846 | 0 | 11605 | 21845 |\n| 76 | -21846 | 0 | 13653 | -21846 |\n| 76 | -21846 | 0 | 15701 | 21845 |\n| 76+ | 21845 | 1 | 13653 | -21846 |\n| 77 | 21845 | 1 | 13653 | 21845 |\n| 77+ | -21846 | 1 | 15701 | 21845 |\n| 78 | -21846 | 1 | 15701 | -21846 |\n| 78+ | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 3413 | 21845 |\n| 79 | -21846 | 0 | 5461 | 21845 |\n| 79 | -21846 | 0 | 7509 | 21845 |\n| 79 | -21846 | 0 | 9557 | 21845 |\n| 79 | -21846 | 0 | 11605 | 21845 |\n| 79 | -21846 | 0 | 13653 | 21845 |\n| 79 | -21846 | 0 | 15701 | -21846 |\n| 79+ | 21845 | 1 | 15701 | -21846 |\n| 80 | 21845 | 1 | 15701 | 21845 |\n| 80+ | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 3413 | 21845 |\n| 81 | 21845 | 0 | 5461 | 21845 |\n| 81 | 21845 | 0 | 7509 | 21845 |\n| 81 | 21845 | 0 | 9557 | 21845 |\n| 81 | 21845 | 0 | 11605 | 21845 |\n| 81 | 21845 | 0 | 13653 | 21845 |\n| 81 | 21845 | 0 | 15701 | 21845 |"}};function h(t){return m.apply(this,arguments)}function m(){return(m=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.pushd("/projects/03");case 2:return t.next=4,(0,r.mc)(n,f);case 4:return t.next=6,n.popd();case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var z={Memory:{"Memory.hdl":"/**\n * The complete address space of the Hack computer's memory,\n * including RAM and memory-mapped I/O. \n * The chip facilitates read and write operations, as follows:\n * Read: out(t) = Memory[address(t)](t)\n * Write: if load(t-1) then Memory[address(t-1)](t) = in(t-1)\n * In words: the chip always outputs the value stored at the memory \n * location specified by address. If load==1, the in value is loaded \n * into the memory location specified by address. This value becomes \n * available through the out output from the next time step onward.\n * Address space rules:\n * Only the upper 16K+8K+1 words of the Memory chip are used. \n * Access to address>0x6000 is invalid. Access to any address in \n * the range 0x4000-0x5FFF results in accessing the screen memory \n * map. Access to address 0x6000 results in accessing the keyboard \n * memory map. The behavior in these addresses is described in the \n * Screen and Keyboard chip specifications given in the book.\n */\n\nCHIP Memory {\n IN in[16], load, address[15];\n OUT out[16];\n\n PARTS:\n}","Memory.tst":"output-list in%D1.6.1 load%B2.1.2 address%B1.15.1 out%D1.6.1;\n\n// Set RAM[0] = -1\nset address 0,\nset in -1, set load 1, tick, output; tock, output;\n\n// RAM[0] holds value\nset in 9999, set load 0, tick, output; tock, output;\n\n// Did not also write to upper RAM or Screen\nset address %X2000, eval, output;\nset address %X4000, eval, output;\n\n// Set RAM[0x2000] = 2222\nset address %X2000,\nset in 2222, set load 1, tick, output; tock, output;\n\n// RAM[0x2000] holds value\nset in 9999, set load 0, tick, output; tock, output;\n\n// Did not also write to lower RAM or Screen\nset address 0, eval, output;\nset address %X4000, eval, output;\n\nset load 0,\t// Low order address bits connected\nset address %X0001, eval, output;\nset address %X0002, eval, output;\nset address %X0004, eval, output;\nset address %X0008, eval, output;\nset address %X0010, eval, output;\nset address %X0020, eval, output;\nset address %X0040, eval, output;\nset address %X0080, eval, output;\nset address %X0100, eval, output;\nset address %X0200, eval, output;\nset address %X0400, eval, output;\nset address %X0800, eval, output;\nset address %X1000, eval, output;\nset address %X2000, eval, output;\n\n// RAM[1234] = 1234\nset address %X1234,\nset in 1234, set load 1, tick, output; tock, output;\n\n// Did not also write to upper RAM or Screen \nset load 0,\nset address %X2234, eval, output;\nset address %X6234, eval, output;\n\n// RAM[0x2345] = 2345\nset address %X2345,\nset in 2345, set load 1, tick, output; tock, output;\n\n// Did not also write to lower RAM or Screen \nset load 0,\nset address %X0345, eval, output;\nset address %X4345, eval, output;\n\n// Keyboard test\n\n// set address 24576,\n// echo \"Click the Keyboard icon and hold down the 'K' key (uppercase) until you see the next message (it should appear shortly after that) ...\",\n// It's important to keep holding the key down since if the system is busy,\n// the memory will zero itself before being outputted.\n\n/*\nset Keyboard 'K';\nwhile out <> 75 {\n eval,\n}\nclear-echo, output;\noutput;\n*/\n\n// Screen test\n\nset load 1, set in -1, set address %X4FCF, tick, tock, output;\nset address %X504F, tick, tock, output;\n\n// Did not also write to lower or upper RAM\nset address %X0FCF, eval, output;\nset address %X2FCF, eval, output;\n\nset load 0,\t\t\t\t// Low order address bits connected\nset address %X4FCE, eval, output;\nset address %X4FCD, eval, output;\nset address %X4FCB, eval, output;\nset address %X4FC7, eval, output;\nset address %X4FDF, eval, output;\nset address %X4FEF, eval, output;\nset address %X4F8F, eval, output;\nset address %X4F4F, eval, output;\nset address %X4ECF, eval, output;\nset address %X4DCF, eval, output;\nset address %X4BCF, eval, output;\nset address %X47CF, eval, output;\nset address %X5FCF, eval, output;\n\n\nset load 0, set address 24576,\necho \"Make sure you see ONLY two horizontal lines in the middle of the screen. Change Keyboard to 'Y' (uppercase) to continue ...\";\n\n/*\nwhile out <> 89 {\n eval;\n}\n*/\nclear-echo;","Memory.cmp":"| in |load | address | out |\n| -1 | 1 | 000000000000000 | 0 |\n| -1 | 1 | 000000000000000 | -1 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 010000000000000 | 0 |\n| 9999 | 0 | 100000000000000 | 0 |\n| 2222 | 1 | 010000000000000 | 0 |\n| 2222 | 1 | 010000000000000 | 2222 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 100000000000000 | 0 |\n| 9999 | 0 | 000000000000001 | 0 |\n| 9999 | 0 | 000000000000010 | 0 |\n| 9999 | 0 | 000000000000100 | 0 |\n| 9999 | 0 | 000000000001000 | 0 |\n| 9999 | 0 | 000000000010000 | 0 |\n| 9999 | 0 | 000000000100000 | 0 |\n| 9999 | 0 | 000000001000000 | 0 |\n| 9999 | 0 | 000000010000000 | 0 |\n| 9999 | 0 | 000000100000000 | 0 |\n| 9999 | 0 | 000001000000000 | 0 |\n| 9999 | 0 | 000010000000000 | 0 |\n| 9999 | 0 | 000100000000000 | 0 |\n| 9999 | 0 | 001000000000000 | 0 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 1234 | 1 | 001001000110100 | 0 |\n| 1234 | 1 | 001001000110100 | 1234 |\n| 1234 | 0 | 010001000110100 | 0 |\n| 1234 | 0 | 110001000110100 | 0 |\n| 2345 | 1 | 010001101000101 | 0 |\n| 2345 | 1 | 010001101000101 | 2345 |\n| 2345 | 0 | 000001101000101 | 0 |\n| 2345 | 0 | 100001101000101 | 0 |\n| -1 | 1 | 100111111001111 | -1 |\n| -1 | 1 | 101000001001111 | -1 |\n| -1 | 1 | 000111111001111 | 0 |\n| -1 | 1 | 010111111001111 | 0 |\n| -1 | 0 | 100111111001110 | 0 |\n| -1 | 0 | 100111111001101 | 0 |\n| -1 | 0 | 100111111001011 | 0 |\n| -1 | 0 | 100111111000111 | 0 |\n| -1 | 0 | 100111111011111 | 0 |\n| -1 | 0 | 100111111101111 | 0 |\n| -1 | 0 | 100111110001111 | 0 |\n| -1 | 0 | 100111101001111 | 0 |\n| -1 | 0 | 100111011001111 | 0 |\n| -1 | 0 | 100110111001111 | 0 |\n| -1 | 0 | 100101111001111 | 0 |\n| -1 | 0 | 100011111001111 | 0 |\n| -1 | 0 | 101111111001111 | 0 |"},CPU:{"CPU.hdl":"/**\n * The Hack CPU (Central Processing unit), consisting of an ALU,\n * two registers named A and D, and a program counter named PC.\n * The CPU is designed to fetch and execute instructions written in \n * the Hack machine language. In particular, functions as follows:\n * Executes the inputted instruction according to the Hack machine \n * language specification. The D and A in the language specification\n * refer to CPU-resident registers, while M refers to the external\n * memory location addressed by A, i.e. to Memory[A]. The inM input \n * holds the value of this location. If the current instruction needs \n * to write a value to M, the value is placed in outM, the address \n * of the target location is placed in the addressM output, and the \n * writeM control bit is asserted. (When writeM==0, any value may \n * appear in outM). The outM and writeM outputs are combinational: \n * they are affected instantaneously by the execution of the current \n * instruction. The addressM and pc outputs are clocked: although they \n * are affected by the execution of the current instruction, they commit \n * to their new values only in the next time step. If reset==1 then the \n * CPU jumps to address 0 (i.e. pc is set to 0 in next time step) rather \n * than to the address resulting from executing the current instruction. \n */\n\nCHIP CPU {\n\n IN inM[16], // M value input (M = contents of RAM[A])\n instruction[16], // Instruction for execution\n reset; // Signals whether to re-start the current\n // program (reset==1) or continue executing\n // the current program (reset==0).\n\n OUT outM[16], // M value output\n writeM, // Write to M? \n addressM[15], // Address in data memory (of M)\n pc[15]; // address of next instruction\n\n PARTS:\n}","CPU.tst":"output-list time%S0.4.0 inM%D0.6.0 instruction%B0.16.0 reset%B2.1.2 outM%D1.6.0 writeM%B3.1.3 addressM%D0.5.0 pc%D0.5.0 DRegister[]%D1.6.1;\n\n\nset instruction %B0011000000111001, // @12345\ntick, output, tock, output;\n\nset instruction %B1110110000010000, // D=A\ntick, output, tock, output;\n\nset instruction %B0101101110100000, // @23456\ntick, output, tock, output;\n\nset instruction %B1110000111010000, // D=A-D\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1110001100001000, // M=D\ntick, output, tock, output;\n\nset instruction %B0000001111101001, // @1001\ntick, output, tock, output;\n\nset instruction %B1110001110011000, // MD=D-1\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1111010011010000, // D=D-M\nset inM 11111,\ntick, output, tock, output;\n\nset instruction %B0000000000001110, // @14\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;jlt\ntick, output, tock, output;\n\nset instruction %B0000001111100111, // @999\ntick, output, tock, output;\n\nset instruction %B1110110111100000, // A=A+1\ntick, output, tock, output;\n\nset instruction %B1110001100001000, // M=D\ntick, output, tock, output;\n\nset instruction %B0000000000010101, // @21\ntick, output, tock, output;\n\nset instruction %B1110011111000010, // D+1;jeq\ntick, output, tock, output;\n\nset instruction %B0000000000000010, // @2\ntick, output, tock, output;\n\nset instruction %B1110000010010000, // D=D+A\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1110111010010000, // D=-1\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset instruction %B1110101010010000, // D=0\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset instruction %B1110111111010000, // D=1\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset reset 1;\ntick, output, tock, output;\n\nset instruction %B0111111111111111, // @32767\nset reset 0;\ntick, output, tock, output;","CPU.cmp":"|time| inM | instruction |reset| outM |writeM |addre| pc |DRegiste|\n|0+ | 0|0011000000111001| 0 |*******| 0 | 0| 0| 0 |\n|1 | 0|0011000000111001| 0 |*******| 0 |12345| 1| 0 |\n|1+ | 0|1110110000010000| 0 |*******| 0 |12345| 1| 0 |\n|2 | 0|1110110000010000| 0 |*******| 0 |12345| 2| 12345 |\n|2+ | 0|0101101110100000| 0 |*******| 0 |12345| 2| 12345 |\n|3 | 0|0101101110100000| 0 |*******| 0 |23456| 3| 12345 |\n|3+ | 0|1110000111010000| 0 |*******| 0 |23456| 3| 12345 |\n|4 | 0|1110000111010000| 0 |*******| 0 |23456| 4| 11111 |\n|4+ | 0|0000001111101000| 0 |*******| 0 |23456| 4| 11111 |\n|5 | 0|0000001111101000| 0 |*******| 0 | 1000| 5| 11111 |\n|5+ | 0|1110001100001000| 0 | 11111| 1 | 1000| 5| 11111 |\n|6 | 0|1110001100001000| 0 | 11111| 1 | 1000| 6| 11111 |\n|6+ | 0|0000001111101001| 0 |*******| 0 | 1000| 6| 11111 |\n|7 | 0|0000001111101001| 0 |*******| 0 | 1001| 7| 11111 |\n|7+ | 0|1110001110011000| 0 | 11110| 1 | 1001| 7| 11111 |\n|8 | 0|1110001110011000| 0 | 11109| 1 | 1001| 8| 11110 |\n|8+ | 0|0000001111101000| 0 |*******| 0 | 1001| 8| 11110 |\n|9 | 0|0000001111101000| 0 |*******| 0 | 1000| 9| 11110 |\n|9+ | 11111|1111010011010000| 0 |*******| 0 | 1000| 9| 11110 |\n|10 | 11111|1111010011010000| 0 |*******| 0 | 1000| 10| -1 |\n|10+ | 11111|0000000000001110| 0 |*******| 0 | 1000| 10| -1 |\n|11 | 11111|0000000000001110| 0 |*******| 0 | 14| 11| -1 |\n|11+ | 11111|1110001100000100| 0 |*******| 0 | 14| 11| -1 |\n|12 | 11111|1110001100000100| 0 |*******| 0 | 14| 14| -1 |\n|12+ | 11111|0000001111100111| 0 |*******| 0 | 14| 14| -1 |\n|13 | 11111|0000001111100111| 0 |*******| 0 | 999| 15| -1 |\n|13+ | 11111|1110110111100000| 0 |*******| 0 | 999| 15| -1 |\n|14 | 11111|1110110111100000| 0 |*******| 0 | 1000| 16| -1 |\n|14+ | 11111|1110001100001000| 0 | -1| 1 | 1000| 16| -1 |\n|15 | 11111|1110001100001000| 0 | -1| 1 | 1000| 17| -1 |\n|15+ | 11111|0000000000010101| 0 |*******| 0 | 1000| 17| -1 |\n|16 | 11111|0000000000010101| 0 |*******| 0 | 21| 18| -1 |\n|16+ | 11111|1110011111000010| 0 |*******| 0 | 21| 18| -1 |\n|17 | 11111|1110011111000010| 0 |*******| 0 | 21| 21| -1 |\n|17+ | 11111|0000000000000010| 0 |*******| 0 | 21| 21| -1 |\n|18 | 11111|0000000000000010| 0 |*******| 0 | 2| 22| -1 |\n|18+ | 11111|1110000010010000| 0 |*******| 0 | 2| 22| -1 |\n|19 | 11111|1110000010010000| 0 |*******| 0 | 2| 23| 1 |\n|19+ | 11111|0000001111101000| 0 |*******| 0 | 2| 23| 1 |\n|20 | 11111|0000001111101000| 0 |*******| 0 | 1000| 24| 1 |\n|20+ | 11111|1110111010010000| 0 |*******| 0 | 1000| 24| 1 |\n|21 | 11111|1110111010010000| 0 |*******| 0 | 1000| 25| -1 |\n|21+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 25| -1 |\n|22 | 11111|1110001100000001| 0 |*******| 0 | 1000| 26| -1 |\n|22+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 26| -1 |\n|23 | 11111|1110001100000010| 0 |*******| 0 | 1000| 27| -1 |\n|23+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 27| -1 |\n|24 | 11111|1110001100000011| 0 |*******| 0 | 1000| 28| -1 |\n|24+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 28| -1 |\n|25 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| -1 |\n|25+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 |\n|26 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 |\n|26+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 |\n|27 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 |\n|27+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 |\n|28 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 |\n|28+ | 11111|1110101010010000| 0 |*******| 0 | 1000| 1000| -1 |\n|29 | 11111|1110101010010000| 0 |*******| 0 | 1000| 1001| 0 |\n|29+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 0 |\n|30 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1002| 0 |\n|30+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1002| 0 |\n|31 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 0 |\n|31+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 |\n|32 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 |\n|32+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 0 |\n|33 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 0 |\n|33+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 0 |\n|34 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1002| 0 |\n|34+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1002| 0 |\n|35 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 0 |\n|35+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 |\n|36 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 |\n|36+ | 11111|1110111111010000| 0 |*******| 0 | 1000| 1000| 0 |\n|37 | 11111|1110111111010000| 0 |*******| 0 | 1000| 1001| 1 |\n|37+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 1 |\n|38 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1000| 1 |\n|38+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 1 |\n|39 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1001| 1 |\n|39+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1001| 1 |\n|40 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 1 |\n|40+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 1 |\n|41 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 1 |\n|41+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 1 |\n|42 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| 1 |\n|42+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 1 |\n|43 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1001| 1 |\n|43+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1001| 1 |\n|44 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 1 |\n|44+ | 11111|1110001100000111| 1 |*******| 0 | 1000| 1000| 1 |\n|45 | 11111|1110001100000111| 1 |*******| 0 | 1000| 0| 1 |\n|45+ | 11111|0111111111111111| 0 |*******| 0 | 1000| 0| 1 |\n|46 | 11111|0111111111111111| 0 |*******| 0 |32767| 1| 1 |"},Computer:{"Computer.hdl":'/**\n * The HACK computer, including CPU, ROM and RAM.\n * When reset is 0, the program stored in the computer\'s ROM executes.\n * When reset is 1, the execution of the program restarts. \n * Thus, to start a program\'s execution, reset must be pushed "up" (1)\n * and "down" (0). From this point onward the user is at the mercy of \n * the software. In particular, depending on the program\'s code, the \n * screen may show some output and the user may be able to interact \n * with the computer via the keyboard.\n */\n\nCHIP Computer {\n\n IN reset;\n\n PARTS:\n}',"Computer.tst":"output-list time%S1.4.1 reset%B2.1.2 ARegister[]%D1.7.1 DRegister[]%D1.7.1 PC[]%D0.4.0 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1;\n\n// Load a program written in the Hack machine language.\n// The program computes the maximum of RAM[0] and RAM[1] \n// and writes the result in RAM[2].\n\nROM32K load Max.hack,\n\n// first run: compute max(3,5)\nset Memory[0] 3,\nset Memory[1] 5,\noutput;\n\nrepeat 14 {\n tick, tock, output;\n}\n\n// reset the PC\nset reset 1,\ntick, tock, output;\n\n// second run: compute max(23456,12345)\nset reset 0,\nset Memory[0] 23456,\nset Memory[1] 12345,\noutput;\n\n// The run on these inputs needs less cycles (different branching)\nrepeat 10 {\n tick, tock, output;\n}\n","Computer.cmp":"| time |reset|ARegister|DRegister|PC[]|RAM16K[0]|RAM16K[1]|RAM16K[2]|\n| 0 | 0 | 0 | 0 | 0| 3 | 5 | 0 |\n| 1 | 0 | 0 | 0 | 1| 3 | 5 | 0 |\n| 2 | 0 | 0 | 3 | 2| 3 | 5 | 0 |\n| 3 | 0 | 1 | 3 | 3| 3 | 5 | 0 |\n| 4 | 0 | 1 | -2 | 4| 3 | 5 | 0 |\n| 5 | 0 | 10 | -2 | 5| 3 | 5 | 0 |\n| 6 | 0 | 10 | -2 | 6| 3 | 5 | 0 |\n| 7 | 0 | 1 | -2 | 7| 3 | 5 | 0 |\n| 8 | 0 | 1 | 5 | 8| 3 | 5 | 0 |\n| 9 | 0 | 12 | 5 | 9| 3 | 5 | 0 |\n| 10 | 0 | 12 | 5 | 12| 3 | 5 | 0 |\n| 11 | 0 | 2 | 5 | 13| 3 | 5 | 0 |\n| 12 | 0 | 2 | 5 | 14| 3 | 5 | 5 |\n| 13 | 0 | 14 | 5 | 15| 3 | 5 | 5 |\n| 14 | 0 | 14 | 5 | 14| 3 | 5 | 5 |\n| 15 | 1 | 14 | 5 | 0| 3 | 5 | 5 |\n| 15 | 0 | 14 | 5 | 0| 23456 | 12345 | 5 |\n| 16 | 0 | 0 | 5 | 1| 23456 | 12345 | 5 |\n| 17 | 0 | 0 | 23456 | 2| 23456 | 12345 | 5 |\n| 18 | 0 | 1 | 23456 | 3| 23456 | 12345 | 5 |\n| 19 | 0 | 1 | 11111 | 4| 23456 | 12345 | 5 |\n| 20 | 0 | 10 | 11111 | 5| 23456 | 12345 | 5 |\n| 21 | 0 | 10 | 11111 | 10| 23456 | 12345 | 5 |\n| 22 | 0 | 0 | 11111 | 11| 23456 | 12345 | 5 |\n| 23 | 0 | 0 | 23456 | 12| 23456 | 12345 | 5 |\n| 24 | 0 | 2 | 23456 | 13| 23456 | 12345 | 5 |\n| 25 | 0 | 2 | 23456 | 14| 23456 | 12345 | 23456 |","Max.hack":"0000000000000000\n1111110000010000\n0000000000000001\n1111010011010000\n0000000000001010\n1110001100000001\n0000000000000001\n1111110000010000\n0000000000001100\n1110101010000111\n0000000000000000\n1111110000010000\n0000000000000010\n1110001100001000\n0000000000001110\n1110101010000111"}};function b(t){return A.apply(this,arguments)}function A(){return(A=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.pushd("/projects/05");case 2:return t.next=4,(0,r.mc)(n,z);case 4:return t.next=6,n.popd();case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var C={"01":s,"02":u,"03":o,"05":a},M=!1,g=function(){var t=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!M){t.next=2;break}return t.abrupt("return");case 2:return M=!0,t.next=5,c(n);case 5:return t.next=7,v(n);case 7:return t.next=9,h(n);case 9:return t.next=11,b(n);case 11:M=!1;case 12:case"end":return t.stop()}}),t)})));return function(n){return t.apply(this,arguments)}}(),w={"01":["Not","And","Or","XOr","Mux","DMux","Not16","And16","Or16","Mux16","Mux4Way16","Mux8Way16","DMux4Way","DMux8Way","Or8Way"],"02":["HalfAdder","FullAdder","Add16","Inc16","AluNoStat","ALU"],"03":["Bit","Register","PC","RAM8","RAM64","RAM512","RAM4k","RAM16k"],"05":["Memory","CPU","Computer"]},R={"06":["Add","Max","Rectangle","Pong"]},D=(0,d.Z)((0,d.Z)((0,d.Z)((0,d.Z)({},i),k),f),z)}}]); +//# sourceMappingURL=277.355c3689.chunk.js.map \ No newline at end of file diff --git a/build/static/js/277.355c3689.chunk.js.map b/build/static/js/277.355c3689.chunk.js.map new file mode 100644 index 000000000..dfd5776a9 --- /dev/null +++ b/build/static/js/277.355c3689.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/277.355c3689.chunk.js","mappings":"4qBAkBaA,EAAQ,CACnBC,IAAK,CACH,UCjBe,qFDkBf,UCVe,wFDWf,UCtBe,2DDwBjBC,IAAK,CACH,UEzBe,uLF0Bf,UEfe,gLFgBf,UEVe,yIFYjBC,GAAI,CACF,SGzBe,yHH0Bf,SGhBe,kLHiBf,SGhCe,yIHkCjBC,IAAK,CACH,UI9Be,+GJ+Bf,UIrBe,kLJsBf,UIrCe,yIJuCjBC,IAAK,CACH,UK/Be,mHLgCf,UKxBe,uVLyBf,UK1Ce,6TL4CjBC,KAAM,CACJ,WM7Ce,wJN8Cf,WMlCe,sLNmCf,WM3Be,iLN6BjBC,MAAO,CACL,YOlDe,sHPmDf,YO3Ce,wPP4Cf,YOtCe,wPPwCjBC,MAAO,CACL,YQvDe,0IRwD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CSf,aDgBe,m/FCff,aD2He,syECzHjBC,IAAK,CACH,UCbe,q3DDcf,UCuBe,ulHDtBf,UCoKe,i0NDlKjBC,SAAU,CACR,eElBe,gkBFmBf,eEFe,gtBFGf,eE6Ce,q8DF5Cf,WE4BgB,mSFxBb,SAAe3B,EAAW,GAAD,+BAI/B,8CAJM,WAA0BC,GAAc,sFACvCA,EAAGC,MAAM,gBAAe,wBACxBC,EAAAA,EAAAA,IAAMF,EAAIjB,GAAM,uBAChBiB,EAAGG,OAAM,4CAChB,sBGHM,IAAMwB,EAAe,CAC1B,KAAMC,EACN,KAAMC,EACN,KAAMC,EACN,KAAMC,GAGJ7B,GAAQ,EACCH,EAAU,yCAAG,WAAOC,GAAc,0EACzCE,EAAO,CAAF,gDACI,OAAbA,GAAQ,EAAK,SACP0B,EAAsB5B,GAAG,uBACzB6B,EAAsB7B,GAAG,uBACzB8B,EAAsB9B,GAAG,wBACzB+B,EAAsB/B,GAAG,QAC/BE,GAAQ,EAAM,4CACf,gBARsB,sCAUV8B,EAA6D,CACxE,KAAM,CACJ,MACA,MACA,KACA,MACA,MACA,OACA,QACA,QACA,OACA,QACA,YACA,YACA,WACA,WACA,UAEF,KAAM,CACJ,YACA,YACA,QACA,QACA,YACA,OAGF,KAAM,CAAC,MAAO,WAAY,KAAM,OAAQ,QAAS,SAAU,QAAS,UACpE,KAAM,CAAC,SAAU,MAAO,aAGbC,EAAuC,CAClD,KAAM,CAAC,MAAO,MAAO,YAAa,SAGvBC,GAAc,kCACtBN,GACAC,GACAC,GACAC,E","sources":["../../projects/src/project_01/index.ts","../../projects/src/project_01/01_not.ts","../../projects/src/project_01/02_and.ts","../../projects/src/project_01/03_or.ts","../../projects/src/project_01/04_xor.ts","../../projects/src/project_01/05_mux.ts","../../projects/src/project_01/06_dmux.ts","../../projects/src/project_01/07_not16.ts","../../projects/src/project_01/08_and16.ts","../../projects/src/project_01/09_or16.ts","../../projects/src/project_01/10_mux16.ts","../../projects/src/project_01/11_mux4way16.ts","../../projects/src/project_01/12_mux8way16.ts","../../projects/src/project_01/13_dmux4way.ts","../../projects/src/project_01/14_dmux8way.ts","../../projects/src/project_01/15_or8way.ts","../../projects/src/project_02/01_half_adder.ts","../../projects/src/project_02/index.ts","../../projects/src/project_02/02_full_adder.ts","../../projects/src/project_02/03_add16.ts","../../projects/src/project_02/04_inc16.ts","../../projects/src/project_02/05_alu_no_stat.ts","../../projects/src/project_02/06_alu.ts","../../projects/src/project_02/06_alu_all.ts","../../projects/src/project_03/01_bit.ts","../../projects/src/project_03/index.ts","../../projects/src/project_03/02_register.ts","../../projects/src/project_03/03_pc.ts","../../projects/src/project_03/04_ram8.ts","../../projects/src/project_03/05_ram64.ts","../../projects/src/project_03/06_ram512.ts","../../projects/src/project_03/07_ram4k.ts","../../projects/src/project_03/08_ram16k.ts","../../projects/src/project_05/01_memory.ts","../../projects/src/project_05/index.ts","../../projects/src/project_05/02_cpu.ts","../../projects/src/project_05/03_computer.ts","../../projects/src/index.ts"],"sourcesContent":["import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Not from \"./01_not.js\";\nimport * as And from \"./02_and.js\";\nimport * as Or from \"./03_or.js\";\nimport * as Xor from \"./04_xor.js\";\nimport * as Mux from \"./05_mux.js\";\nimport * as DMux from \"./06_dmux.js\";\nimport * as Not16 from \"./07_not16.js\";\nimport * as And16 from \"./08_and16.js\";\nimport * as Or16 from \"./09_or16.js\";\nimport * as Mux16 from \"./10_mux16.js\";\nimport * as Mux4Way16 from \"./11_mux4way16.js\";\nimport * as Mux8Way16 from \"./12_mux8way16.js\";\nimport * as DMux4Way from \"./13_dmux4way.js\";\nimport * as DMux8Way from \"./14_dmux8way.js\";\nimport * as Or8Way from \"./15_or8way.js\";\n\nexport const CHIPS = {\n Not: {\n \"Not.hdl\": Not.hdl,\n \"Not.tst\": Not.tst,\n \"Not.cmp\": Not.cmp,\n },\n And: {\n \"And.hdl\": And.hdl,\n \"And.tst\": And.tst,\n \"And.cmp\": And.cmp,\n },\n Or: {\n \"Or.hdl\": Or.hdl,\n \"Or.tst\": Or.tst,\n \"Or.cmp\": Or.cmp,\n },\n XOr: {\n \"XOr.hdl\": Xor.hdl,\n \"XOr.tst\": Xor.tst,\n \"XOr.cmp\": Xor.cmp,\n },\n Mux: {\n \"Mux.hdl\": Mux.hdl,\n \"Mux.tst\": Mux.tst,\n \"Mux.cmp\": Mux.cmp,\n },\n DMux: {\n \"DMux.hdl\": DMux.hdl,\n \"DMux.tst\": DMux.tst,\n \"DMux.cmp\": DMux.cmp,\n },\n Not16: {\n \"Not16.hdl\": Not16.hdl,\n \"Not16.tst\": Not16.tst,\n \"Not16.cmp\": Not16.cmp,\n },\n And16: {\n \"And16.hdl\": And16.hdl,\n \"And16.tst\": And16.tst,\n \"And16.cmp\": And16.cmp,\n },\n Or16: {\n \"Or16.hdl\": Or16.hdl,\n \"Or16.tst\": Or16.tst,\n \"Or16.cmp\": Or16.cmp,\n },\n Mux16: {\n \"Mux16.hdl\": Mux16.hdl,\n \"Mux16.tst\": Mux16.tst,\n \"Mux16.cmp\": Mux16.cmp,\n },\n Mux4Way16: {\n \"Mux4Way16.hdl\": Mux4Way16.hdl,\n \"Mux4Way16.tst\": Mux4Way16.tst,\n \"Mux4Way16.cmp\": Mux4Way16.cmp,\n },\n Mux8Way16: {\n \"Mux8Way16.hdl\": Mux8Way16.hdl,\n \"Mux8Way16.tst\": Mux8Way16.tst,\n \"Mux8Way16.cmp\": Mux8Way16.cmp,\n },\n DMux4Way: {\n \"DMux4Way.hdl\": DMux4Way.hdl,\n \"DMux4Way.tst\": DMux4Way.tst,\n \"DMux4Way.cmp\": DMux4Way.cmp,\n },\n DMux8Way: {\n \"DMux8Way.hdl\": DMux8Way.hdl,\n \"DMux8Way.tst\": DMux8Way.tst,\n \"DMux8Way.cmp\": DMux8Way.cmp,\n },\n Or8Way: {\n \"Or8Way.hdl\": Or8Way.hdl,\n \"Or8Way.tst\": Or8Way.tst,\n \"Or8Way.cmp\": Or8Way.cmp,\n },\n};\n\nexport async function resetFiles(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/01\");\n await reset(fs, CHIPS);\n await fs.popd();\n}\n","export const cmp = `| in | out |\n| 0 | 1 |\n| 1 | 0 |`;\nexport const hdl = `// Not gate: out = not in\n\nCHIP Not {\n IN in;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list in%B3.1.3 out%B3.1.3;\n\nset in 0, eval, output;\nset in 1, eval, output;`;\n","export const hdl = `/**\n * And gate: out = 1 if {a==1 and b==1}, 0 otherwise\n * And gate: if {a==1 and b==1} then out = 1 else out = 0\n */\n\nCHIP And {\n IN a, b;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;`;\n\nexport const cmp = `| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 0 |\n| 1 | 0 | 0 |\n| 1 | 1 | 1 |`;\n","export const cmp = `| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 1 |\n| 1 | 0 | 1 |\n| 1 | 1 | 1 |`;\nexport const hdl = `/**\n * Or gate: out = 1 if {a==1 or b==1}, 0 otherwise\n */\n\nCHIP Or {\n IN a, b;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;`;\n","export const cmp = `| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 1 |\n| 1 | 0 | 1 |\n| 1 | 1 | 0 |`;\nexport const hdl = `/**\n * Exclusive-or gate: out = !(a == b).\n */\n\nCHIP XOr {\n IN a, b;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;`;\n","export const cmp = `| a | b | sel | out |\n| 0 | 0 | 0 | 0 |\n| 0 | 0 | 1 | 0 |\n| 0 | 1 | 0 | 0 |\n| 0 | 1 | 1 | 1 |\n| 1 | 0 | 0 | 1 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |\n| 1 | 1 | 1 | 1 |`;\nexport const hdl = `// Multiplexor. If sel==1 then out=b else out=a.\n\nCHIP Mux {\n IN a, b, sel;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 sel%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 0, set b 1, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 1, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 1, set b 1, set sel 0, eval, output;\nset sel 1, eval, output;`;\n","export const hdl = `/**\n * Demultiplexor.\n * {a,b} = {in,0} if sel==0\n * {0,in} if sel==1\n */\n\nCHIP DMux {\n IN in, sel;\n OUT a, b;\n\n PARTS:\n}`;\nexport const tst = `output-list in%B3.1.3 sel%B3.1.3 a%B3.1.3 b%B3.1.3;\n\nset in 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset in 1, set sel 0, eval, output;\nset sel 1, eval, output;`;\n\nexport const cmp = `| in | sel | a | b |\n| 0 | 0 | 0 | 0 |\n| 0 | 1 | 0 | 0 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |`;\n","export const hdl = `// 16-bit Not gate: for i=0..15: out[i] = not in[i]\n\nCHIP Not16 {\n IN in[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list in%B1.16.1 out%B1.16.1;\nset in %B0000000000000000, eval, output;\nset in %B1111111111111111, eval, output;\nset in %B1010101010101010, eval, output;\nset in %B0011110011000011, eval, output;\nset in %B0001001000110100, eval, output;`;\nexport const cmp = `| in | out |\n| 0000000000000000 | 1111111111111111 |\n| 1111111111111111 | 0000000000000000 |\n| 1010101010101010 | 0101010101010101 |\n| 0011110011000011 | 1100001100111100 |\n| 0001001000110100 | 1110110111001011 |`;\n","export const hdl = `// 16-bit-wise and gate: for i = 0..15: out[i] = a[i] and b[i]\n\nCHIP And16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\n\nset a %B0000000000000000, set b %B0000000000000000, eval, output;\nset a %B0000000000000000, set b %B1111111111111111, eval, output;\nset a %B1111111111111111, set b %B1111111111111111, eval, output;\nset a %B1010101010101010, set b %B0101010101010101, eval, output;\nset a %B0011110011000011, set b %B0000111111110000, eval, output;\nset a %B0001001000110100, set b %B1001100001110110, eval, output;`;\n\nexport const cmp = `| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0000000000000000 |\n| 1111111111111111 | 1111111111111111 | 1111111111111111 |\n| 1010101010101010 | 0101010101010101 | 0000000000000000 |\n| 0011110011000011 | 0000111111110000 | 0000110011000000 |\n| 0001001000110100 | 1001100001110110 | 0001000000110100 |`;\n","export const cmp = `| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1111111111111111 |\n| 1111111111111111 | 1111111111111111 | 1111111111111111 |\n| 1010101010101010 | 0101010101010101 | 1111111111111111 |\n| 0011110011000011 | 0000111111110000 | 0011111111110011 |\n| 0001001000110100 | 1001100001110110 | 1001101001110110 |`;\nexport const hdl = `// 16-bit bitwise Or gate: for i=0..15 out[i] = a[i] or b[i].\n\nCHIP Or16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\nset a %B0000000000000000, set b %B0000000000000000, eval, output;\nset a %B0000000000000000, set b %B1111111111111111, eval, output;\nset a %B1111111111111111, set b %B1111111111111111, eval, output;\nset a %B1010101010101010, set b %B0101010101010101, eval, output;\nset a %B0011110011000011, set b %B0000111111110000, eval, output;\nset a %B0001001000110100, set b %B1001100001110110, eval, output;`;\n","export const cmp = `| a | b | sel | out |\n| 0000000000000000 | 0000000000000000 | 0 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 1 | 0000000000000000 |\n| 0000000000000000 | 0001001000110100 | 0 | 0000000000000000 |\n| 0000000000000000 | 0001001000110100 | 1 | 0001001000110100 |\n| 1001100001110110 | 0000000000000000 | 0 | 1001100001110110 |\n| 1001100001110110 | 0000000000000000 | 1 | 0000000000000000 |\n| 1010101010101010 | 0101010101010101 | 0 | 1010101010101010 |\n| 1010101010101010 | 0101010101010101 | 1 | 0101010101010101 |`;\nexport const hdl = `// 16 bit multiplexor. If sel==1 then out=b else out=a.\n\nCHIP Mux16 {\n IN a[16], b[16], sel;\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 sel%D2.1.2 out%B1.16.1;\n\nset a 0, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B0000000000000000, set b %B0001001000110100, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B1001100001110110, set b %B0000000000000000, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B1010101010101010, set b %B0101010101010101, set sel 0, eval, output;\nset sel 1, eval, output;`;\n","export const cmp = `| a | b | c | d | sel | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 00 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 01 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 10 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 11 | 0000000000000000 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 00 | 0001001000110100 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 01 | 1001100001110110 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 10 | 1010101010101010 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 11 | 0101010101010101 |`;\nexport const hdl = `/**\n * 4-way 16-bit multiplexor.\n * out = a if sel==00\n * b if sel==01\n * c if sel==10\n * d if sel==11\n */\n\nCHIP Mux4Way16 {\n IN a[16], b[16], c[16], d[16], sel[2];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 sel%B2.2.2 out%B1.16.1;\n\nset a 0, set b 0, set c 0, set d 0, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\n\nset a %B0001001000110100, set b %B1001100001110110, set c %B1010101010101010, set d %B0101010101010101, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;`;\n","export const cmp = `| a | b | c | d | e | f | g | h | sel | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 000 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 001 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 010 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 011 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 100 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 101 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 110 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 111 | 0000000000000000 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 000 | 0001001000110100 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0011010001010110 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 011 | 0100010101100111 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 100 | 0101011001111000 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 101 | 0110011110001001 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 110 | 0111100010011010 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 111 | 1000100110101011 |`;\nexport const hdl = `/**\n * 8-way 16-bit multiplexor.\n * out = a if sel==000\n * b if sel==001\n * etc.\n * h if sel==111\n */\n\nCHIP Mux8Way16 {\n IN a[16], b[16], c[16], d[16],\n e[16], f[16], g[16], h[16],\n sel[3];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 e%B1.16.1 f%B1.16.1 g%B1.16.1 h%B1.16.1 sel%B2.3.2 out%B1.16.1;\n\nset a 0, set b 0, set c 0, set d 0, set e 0, set f 0, set g 0, set h 0, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\nset sel 4, eval, output;\nset sel 5, eval, output;\nset sel 6, eval, output;\nset sel 7, eval, output;\n\nset a %B0001001000110100, set b %B0010001101000101, set c %B0011010001010110, set d %B0100010101100111, set e %B0101011001111000, set f %B0110011110001001, set g %B0111100010011010, set h %B1000100110101011, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\nset sel 4, eval, output;\nset sel 5, eval, output;\nset sel 6, eval, output;\nset sel 7, eval, output;`;\n","export const hdl = `/**\n * 4-way demultiplexor.\n * {a,b,c,d} = {in,0,0,0} if sel==00\n * {0,in,0,0} if sel==01\n * {0,0,in,0} if sel==10\n * {0,0,0,in} if sel==11\n */\n\nCHIP DMux4Way {\n IN in, sel[2];\n OUT a, b, c, d;\n\n PARTS:\n}`;\nexport const tst = `output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2;\n\nset in 0, set sel %B00, eval, output;\nset sel %B01, eval, output;\nset sel %B10, eval, output;\nset sel %B11, eval, output;\n\nset in 1, set sel %B00, eval, output;\nset sel %B01, eval, output;\nset sel %B10, eval, output;\nset sel %B11, eval, output;`;\n\nexport const cmp = `| in | sel | a | b | c | d |\n| 0 | 00 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 1 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 1 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 1 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 1 |`;\n","export const hdl = `/**\n * 8-way demultiplexor.\n * {a,b,c,d,e,f,g,h} = {in,0,0,0,0,0,0,0} if sel==000\n * {0,in,0,0,0,0,0,0} if sel==001\n * etc.\n * {0,0,0,0,0,0,0,in} if sel==111\n */\n\n\nCHIP DMux8Way {\n IN in, sel[3];\n OUT a, b, c, d, e, f, g, h;\n\n PARTS:\n}`;\n\nexport const tst = `output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2 e%B2.1.2 f%B2.1.2 g%B2.1.2 h%B2.1.2;\n\nset in 0, set sel %B000, eval, output;\nset sel %B001, eval, output;\nset sel %B010, eval, output;\nset sel %B011, eval, output;\nset sel %B100, eval, output;\nset sel %B101, eval, output;\nset sel %B110, eval, output;\nset sel %B111, eval, output;\n\nset in 1, set sel %B000, eval, output;\nset sel %B001, eval, output;\nset sel %B010, eval, output;\nset sel %B011, eval, output;\nset sel %B100, eval, output;\nset sel %B101, eval, output;\nset sel %B110, eval, output;\nset sel %B111, eval, output;`;\n\nexport const cmp = `| in | sel | a | b | c | d | e | f | g | h |\n| 0 | 00 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 00 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |`;\n","export const cmp = `| in | out |\n| 00000000 | 0 |\n| 11111111 | 1 |\n| 00010000 | 1 |\n| 00000001 | 1 |\n| 00100110 | 1 |`;\nexport const hdl = `/**\n * 8-way or gate: out = in[0] or in[1] or ... or in[7].\n */\n\nCHIP Or8Way {\n IN in[8];\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list in%B2.8.2 out%B2.1.2;\n\nset in %B00000000, eval, output;\nset in %B11111111, eval, output;\nset in %B00010000, eval, output;\nset in %B00000001, eval, output;\nset in %B00100110, eval, output;`;\n","export const hdl = `// Computes the sum of two bits.\n\nCHIP HalfAdder {\n IN a, b; // 1-bit inputs\n OUT sum, // Right bit of a + b \n carry; // Left bit of a + b\n\n PARTS:\n}`;\nexport const cmp = `| a | b | sum | carry |\n| 0 | 0 | 0 | 0 |\n| 0 | 1 | 1 | 0 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 sum%B3.1.3 carry%B3.1.3;\n\nset a 0,\nset b 0,\neval,\noutput;\n\nset a 0,\nset b 1,\neval,\noutput;\n\nset a 1,\nset b 0,\neval,\noutput;\n\nset a 1,\nset b 1,\neval,\noutput;`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as HalfAdder from \"./01_half_adder.js\";\nimport * as FullAdder from \"./02_full_adder.js\";\nimport * as Add16 from \"./03_add16.js\";\nimport * as Inc16 from \"./04_inc16.js\";\nimport * as Alu from \"./05_alu_no_stat.js\";\nimport * as AluStatus from \"./06_alu.js\";\nimport * as AluAll from \"./06_alu_all.js\";\n\nexport const CHIPS = {\n HalfAdder: {\n \"HalfAdder.hdl\": HalfAdder.hdl,\n \"HalfAdder.tst\": HalfAdder.tst,\n \"HalfAdder.cmp\": HalfAdder.cmp,\n },\n FullAdder: {\n \"FullAdder.hdl\": FullAdder.hdl,\n \"FullAdder.tst\": FullAdder.tst,\n \"FullAdder.cmp\": FullAdder.cmp,\n },\n Add16: {\n \"Add16.hdl\": Add16.hdl,\n \"Add16.tst\": Add16.tst,\n \"Add16.cmp\": Add16.cmp,\n },\n Inc16: {\n \"Inc16.hdl\": Inc16.hdl,\n \"Inc16.tst\": Inc16.tst,\n \"Inc16.cmp\": Inc16.cmp,\n },\n AluNoStat: {\n \"AluNoStat.hdl\": Alu.hdl,\n \"AluNoStat.tst\": Alu.tst,\n \"AluNoStat.cmp\": Alu.cmp,\n },\n ALU: {\n \"ALU.hdl\": AluStatus.hdl,\n \"ALU.tst\": AluStatus.tst,\n \"ALU.cmp\": AluStatus.cmp,\n },\n ALUAll: {\n \"ALUAll.hdl\": AluAll.hdl,\n \"ALUAll.tst\": AluAll.tst,\n \"ALUAll.cmp\": AluAll.cmp,\n },\n};\n\nexport async function resetFiles(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/02\");\n await reset(fs, CHIPS);\n await fs.popd();\n}\n","export const hdl = `// Computes the sum of three bits.\n\nCHIP FullAdder {\n IN a, b, c; // 1-bit inputs\n OUT sum, // Right bit of a + b + c\n carry; // Left bit of a + b + c\n\n PARTS:\n}`;\nexport const cmp = `| a | b | c | sum | carry |\n| 0 | 0 | 0 | 0 | 0 |\n| 0 | 0 | 1 | 1 | 0 |\n| 0 | 1 | 0 | 1 | 0 |\n| 0 | 1 | 1 | 0 | 1 |\n| 1 | 0 | 0 | 1 | 0 |\n| 1 | 0 | 1 | 0 | 1 |\n| 1 | 1 | 0 | 0 | 1 |\n| 1 | 1 | 1 | 1 | 1 |`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 c%B3.1.3 sum%B3.1.3 carry%B3.1.3;\n\nset a 0,\nset b 0,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset b 1,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset a 1,\nset b 0,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset b 1,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;`;\n","export const hdl = `/**\n* Adds two 16-bit values.\n* The most significant carry bit is ignored.\n*/\n\nCHIP Add16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const cmp = `| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1111111111111111 |\n| 1111111111111111 | 1111111111111111 | 1111111111111110 |\n| 1010101010101010 | 0101010101010101 | 1111111111111111 |\n| 0011110011000011 | 0000111111110000 | 0100110010110011 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 |`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\n\nset a %B0000000000000000,\nset b %B0000000000000000,\neval,\noutput;\n\nset a %B0000000000000000,\nset b %B1111111111111111,\neval,\noutput;\n\nset a %B1111111111111111,\nset b %B1111111111111111,\neval,\noutput;\n\nset a %B1010101010101010,\nset b %B0101010101010101,\neval,\noutput;\n\nset a %B0011110011000011,\nset b %B0000111111110000,\neval,\noutput;\n\nset a %B0001001000110100,\nset b %B1001100001110110,\neval,\noutput;`;\n","export const hdl = `/**\n* 16-bit incrementer:\n* out = in + 1 (arithmetic addition)\n*/\n\nCHIP Inc16 {\n IN in[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const cmp = `| in | out |\n| 0000000000000000 | 0000000000000001 |\n| 1111111111111111 | 0000000000000000 |\n| 0000000000000101 | 0000000000000110 |\n| 1111111111111011 | 1111111111111100 |\n`;\nexport const tst = `output-list in%B1.16.1 out%B1.16.1;\n\nset in %B0000000000000000, // in = 0\neval,\noutput;\n\nset in %B1111111111111111, // in = -1\neval,\noutput;\n\nset in %B0000000000000101, // in = 5\neval,\noutput;\n\nset in %B1111111111111011, // in = -5\neval,\noutput;`;\n","export const hdl = `/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16]; // 16-bit output\n\n PARTS:\n}`;\nexport const cmp = `| x | y |zx |nx |zy |ny | f |no | out |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 |\n| 0101101110100000 | 0001111011010010 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 0 | 0101101110100000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 0 | 0001111011010010 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 1 | 1010010001011111 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 1 | 1110000100101101 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 1 | 1010010001100000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 1 | 1110000100101110 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 1 | 1 | 1 | 1 | 0101101110100001 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 1 | 1 | 1 | 0001111011010011 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 0 | 0101101110011111 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 0 | 0001111011010001 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 1 | 0 | 0111101001110010 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011110011001110 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100001100110010 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 0 | 0 | 0001101010000000 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 1 | 0 | 1 | 0101111111110010 |\n`;\nexport const tst = `\n// ALU no stat tst provides a partial test of the ALU chip.\n// It IS NOT a replacement for ALU.tst.\n\n// ALU-nostat.tst tests only the computation part of the ALU.\n// The 'zr' and 'ng' status outputs are ignored.\n\n// This test lets you concentrate on getting the ALU computation right without the\n// additional task of handling the status outputs.\n\n// Once your ALU passes ALU-nostat.tst you need to test it with ALU.tst.\n// This way, any comparison failures during ALU.tst will be caused by errors in\n// the handling of the 'zr' and 'ng' status outputs.\n\noutput-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \n ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1;\n\nset x %B0000000000000000,\nset y %B1111111111111111,\n\nset zx 1,\nset nx 0,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset x %B101101110100000,\nset y %B001111011010010,\n\nset zx 1,\nset nx 0,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;`;\n","export const hdl = `/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16], // 16-bit output\n zr, // 1 if (out == 0), 0 otherwise\n ng; // 1 if (out < 0), 0 otherwise\n\n PARTS:\n}`;\nexport const cmp = `| x | y |zx |nx |zy |ny | f |no | out |zr |ng |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |`;\nexport const tst = `output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \nny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1\nng%B1.1.1;\n\nset x %B0000000000000000, // x = 0\nset y %B1111111111111111; // y = -1\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;\n\nset x %B000000000010001, // x = 17\nset y %B000000000000011; // y = 3\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;`;\n","export const hdl = `/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * \n * All operations:\n * Ensure your solution handles these undocumented opcodes:\n * \n * -2, !(x&y), !(x|y), !x&y, !(!x&y), !(x&!y), x&!y\n * x+y+1, x-y-1, -(x+2), -(y+2), -(x+y+2), -(x+y+1), -(x-y+1)\n * \n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\n// Testing: the test script below has tests for the undocumented instructions\n// listed first, and then has the tests for the documented ALU instructions.\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16], // 16-bit output\n zr, // 1 if (out == 0), 0 otherwise\n ng; // 1 if (out < 0), 0 otherwise\n\n PARTS:\n // Put you code here:\n}`;\nexport const cmp = `| x | y |zx |nx |zy |ny | f |no | out |zr |ng |\n| 0000000000000000 | 0000000000000000 | 1 | 1 | 1 | 1 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 0 | 0 | 1 | 1111111111111110 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 1 | 0 | 0 | 1111111111111000 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 0 | 0 | 0 | 1111111111110100 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 0 | 0 | 1 | 1111111111111011 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 1 | 0 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 1 | 0 | 0 | 1111111111110010 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 1 | 1 | 1 | 0000000000100001 | 0 | 0 |\n| 0000000000001101 | 0000000000010011 | 0 | 0 | 0 | 1 | 1 | 0 | 1111111111111001 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 1 | 1 | 1 | 0 | 1111111111110001 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 1 | 1 | 0 | 1 | 1 | 0 | 1111111111101011 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 1 | 1 | 0 | 1111111111011110 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 0 | 0 | 0 | 1 | 1 | 1111111111011111 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 0 | 1 | 0 | 0000000000000101 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |`;\nexport const tst = `output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \nny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1\nng%B1.1.1;\n\n// Compute -2 \nset x %B0000000000000000,\nset y %B0000000000000000,\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\nset x %B0000000000000011,\nset y %B0000000000000101;\n\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 1, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 0, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 0, set no 0, eval, output;\n\nset x %B0000000000001101, // x = 13\nset y %B0000000000010011; // y = 19\n\nset zx 0, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 0, eval, output;\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 1, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\nset x %B0000000000000000, // x = 0\nset y %B1111111111111111; // y = -1\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;\n\nset x %B000000000010001, // x = 17\nset y %B000000000000011; // y = 3\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;`;\n","export const hdl = `/**\n * 1-bit register:\n * If load[t] == 1 then out[t+1] = in[t]\n * else out does not change (out[t+1] = out[t])\n */\n\nCHIP Bit {\n IN in, load;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%B2.1.2 load%B2.1.2 out%B2.1.2;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 1, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 1, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;`;\nexport const cmp = `| time | in |load | out |\n| 0+ | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 |\n| 2 | 0 | 1 | 0 |\n| 2+ | 1 | 0 | 0 |\n| 3 | 1 | 0 | 0 |\n| 3+ | 1 | 1 | 0 |\n| 4 | 1 | 1 | 1 |\n| 4+ | 0 | 0 | 1 |\n| 5 | 0 | 0 | 1 |\n| 5+ | 1 | 0 | 1 |\n| 6 | 1 | 0 | 1 |\n| 6+ | 0 | 1 | 1 |\n| 7 | 0 | 1 | 0 |\n| 7+ | 1 | 1 | 0 |\n| 8 | 1 | 1 | 1 |\n| 8+ | 0 | 0 | 1 |\n| 9 | 0 | 0 | 1 |\n| 9+ | 0 | 0 | 1 |\n| 10 | 0 | 0 | 1 |\n| 10+ | 0 | 0 | 1 |\n| 11 | 0 | 0 | 1 |\n| 11+ | 0 | 0 | 1 |\n| 12 | 0 | 0 | 1 |\n| 12+ | 0 | 0 | 1 |\n| 13 | 0 | 0 | 1 |\n| 13+ | 0 | 0 | 1 |\n| 14 | 0 | 0 | 1 |\n| 14+ | 0 | 0 | 1 |\n| 15 | 0 | 0 | 1 |\n| 15+ | 0 | 0 | 1 |\n| 16 | 0 | 0 | 1 |\n| 16+ | 0 | 0 | 1 |\n| 17 | 0 | 0 | 1 |\n| 17+ | 0 | 0 | 1 |\n| 18 | 0 | 0 | 1 |\n| 18+ | 0 | 0 | 1 |\n| 19 | 0 | 0 | 1 |\n| 19+ | 0 | 0 | 1 |\n| 20 | 0 | 0 | 1 |\n| 20+ | 0 | 0 | 1 |\n| 21 | 0 | 0 | 1 |\n| 21+ | 0 | 0 | 1 |\n| 22 | 0 | 0 | 1 |\n| 22+ | 0 | 0 | 1 |\n|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 | 0 |\n| 102 | 1 | 0 | 0 |\n| 102+ | 1 | 0 | 0 |\n| 103 | 1 | 0 | 0 |\n| 103+ | 1 | 0 | 0 |\n| 104 | 1 | 0 | 0 |\n| 104+ | 1 | 0 | 0 |\n| 105 | 1 | 0 | 0 |\n| 105+ | 1 | 0 | 0 |\n| 106 | 1 | 0 | 0 |\n| 106+ | 1 | 0 | 0 |\n| 107 | 1 | 0 | 0 |`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Bit from \"./01_bit.js\";\nimport * as Register from \"./02_register.js\";\nimport * as PC from \"./03_pc.js\";\nimport * as RAM8 from \"./04_ram8.js\";\nimport * as RAM64 from \"./05_ram64.js\";\nimport * as RAM512 from \"./06_ram512.js\";\nimport * as RAM4k from \"./07_ram4k.js\";\nimport * as RAM16k from \"./08_ram16k.js\";\n\nexport const CHIPS = {\n Bit: {\n \"Bit.hdl\": Bit.hdl,\n \"Bit.tst\": Bit.tst,\n \"Bit.cmp\": Bit.cmp,\n },\n Register: {\n \"Register.hdl\": Register.hdl,\n \"Register.tst\": Register.tst,\n \"Register.cmp\": Register.cmp,\n },\n PC: {\n \"PC.hdl\": PC.hdl,\n \"PC.tst\": PC.tst,\n \"PC.cmp\": PC.cmp,\n },\n RAM8: {\n \"RAM8.hdl\": RAM8.hdl,\n \"RAM8.tst\": RAM8.tst,\n \"RAM8.cmp\": RAM8.cmp,\n },\n RAM64: {\n \"RAM64.hdl\": RAM64.hdl,\n \"RAM64.tst\": RAM64.tst,\n \"RAM64.cmp\": RAM64.cmp,\n },\n RAM512: {\n \"RAM512.hdl\": RAM512.hdl,\n \"RAM512.tst\": RAM512.tst,\n \"RAM512.cmp\": RAM512.cmp,\n },\n RAM4k: {\n \"RAM4k.hdl\": RAM4k.hdl,\n \"RAM4k.tst\": RAM4k.tst,\n \"RAM4k.cmp\": RAM4k.cmp,\n },\n RAM16k: {\n \"RAM16k.hdl\": RAM16k.hdl,\n \"RAM16k.tst\": RAM16k.tst,\n \"RAM16k.cmp\": RAM16k.cmp,\n },\n};\n\nexport async function resetFiles(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/03\");\n await reset(fs, CHIPS);\n await fs.popd();\n}\n","export const hdl = `/**\n * 16-bit register:\n * If load[t] == 1 then out[t+1] = in[t]\n * else out does not change\n */\n\nCHIP Register {\n IN in[16], load;\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst =\n `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 out%D1.6.1;\\n` +\n [\n [0, 0],\n [0, 1],\n [-32123, 0],\n [11111, 0],\n [-32123, 1],\n [-32123, 1],\n [-32123, 0],\n [12345, 1],\n [0, 0],\n [0, 1],\n ]\n .map(\n ([inn, load]) =>\n `set in ${inn}, set load ${load}, tick, output; tock, output;`\n )\n .join(\"\\n\") +\n \"\\n\" +\n [\n \"%B0000000000000001\",\n \"%B0000000000000010\",\n \"%B0000000000000100\",\n \"%B0000000000001000\",\n \"%B0000000000010000\",\n \"%B0000000000100000\",\n \"%B0000000001000000\",\n \"%B0000000010000000\",\n \"%B0000000100000000\",\n \"%B0000001000000000\",\n \"%B0000010000000000\",\n \"%B0000100000000000\",\n \"%B0001000000000000\",\n \"%B0010000000000000\",\n \"%B0100000000000000\",\n \"%B1000000000000000\",\n \"%B1111111111111110\",\n \"%B1111111111111101\",\n \"%B1111111111111011\",\n \"%B1111111111110111\",\n \"%B1111111111101111\",\n \"%B1111111111011111\",\n \"%B1111111110111111\",\n \"%B1111111101111111\",\n \"%B1111111011111111\",\n \"%B1111110111111111\",\n \"%B1111101111111111\",\n \"%B1111011111111111\",\n \"%B1110111111111111\",\n \"%B1101111111111111\",\n \"%B1011111111111111\",\n \"%B0111111111111111\",\n ]\n .map(\n (n) =>\n `set in ${n}, set load 0, tick, output; tock, output; set load 1, tick, output; tock, output;`\n )\n .join(\"\\n\");\n\nexport const cmp = `| time | in |load | out |\n| 0+ | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 |\n| 2 | 0 | 1 | 0 |\n| 2+ | -32123 | 0 | 0 |\n| 3 | -32123 | 0 | 0 |\n| 3+ | 11111 | 0 | 0 |\n| 4 | 11111 | 0 | 0 |\n| 4+ | -32123 | 1 | 0 |\n| 5 | -32123 | 1 | -32123 |\n| 5+ | -32123 | 1 | -32123 |\n| 6 | -32123 | 1 | -32123 |\n| 6+ | -32123 | 0 | -32123 |\n| 7 | -32123 | 0 | -32123 |\n| 7+ | 12345 | 1 | -32123 |\n| 8 | 12345 | 1 | 12345 |\n| 8+ | 0 | 0 | 12345 |\n| 9 | 0 | 0 | 12345 |\n| 9+ | 0 | 1 | 12345 |\n| 10 | 0 | 1 | 0 |\n| 10+ | 1 | 0 | 0 |\n| 11 | 1 | 0 | 0 |\n| 11+ | 1 | 1 | 0 |\n| 12 | 1 | 1 | 1 |\n| 12+ | 2 | 0 | 1 |\n| 13 | 2 | 0 | 1 |\n| 13+ | 2 | 1 | 1 |\n| 14 | 2 | 1 | 2 |\n| 14+ | 4 | 0 | 2 |\n| 15 | 4 | 0 | 2 |\n| 15+ | 4 | 1 | 2 |\n| 16 | 4 | 1 | 4 |\n| 16+ | 8 | 0 | 4 |\n| 17 | 8 | 0 | 4 |\n| 17+ | 8 | 1 | 4 |\n| 18 | 8 | 1 | 8 |\n| 18+ | 16 | 0 | 8 |\n| 19 | 16 | 0 | 8 |\n| 19+ | 16 | 1 | 8 |\n| 20 | 16 | 1 | 16 |\n| 20+ | 32 | 0 | 16 |\n| 21 | 32 | 0 | 16 |\n| 21+ | 32 | 1 | 16 |\n| 22 | 32 | 1 | 32 |\n| 22+ | 64 | 0 | 32 |\n| 23 | 64 | 0 | 32 |\n| 23+ | 64 | 1 | 32 |\n| 24 | 64 | 1 | 64 |\n| 24+ | 128 | 0 | 64 |\n| 25 | 128 | 0 | 64 |\n| 25+ | 128 | 1 | 64 |\n| 26 | 128 | 1 | 128 |\n| 26+ | 256 | 0 | 128 |\n| 27 | 256 | 0 | 128 |\n| 27+ | 256 | 1 | 128 |\n| 28 | 256 | 1 | 256 |\n| 28+ | 512 | 0 | 256 |\n| 29 | 512 | 0 | 256 |\n| 29+ | 512 | 1 | 256 |\n| 30 | 512 | 1 | 512 |\n| 30+ | 1024 | 0 | 512 |\n| 31 | 1024 | 0 | 512 |\n| 31+ | 1024 | 1 | 512 |\n| 32 | 1024 | 1 | 1024 |\n| 32+ | 2048 | 0 | 1024 |\n| 33 | 2048 | 0 | 1024 |\n| 33+ | 2048 | 1 | 1024 |\n| 34 | 2048 | 1 | 2048 |\n| 34+ | 4096 | 0 | 2048 |\n| 35 | 4096 | 0 | 2048 |\n| 35+ | 4096 | 1 | 2048 |\n| 36 | 4096 | 1 | 4096 |\n| 36+ | 8192 | 0 | 4096 |\n| 37 | 8192 | 0 | 4096 |\n| 37+ | 8192 | 1 | 4096 |\n| 38 | 8192 | 1 | 8192 |\n| 38+ | 16384 | 0 | 8192 |\n| 39 | 16384 | 0 | 8192 |\n| 39+ | 16384 | 1 | 8192 |\n| 40 | 16384 | 1 | 16384 |\n| 40+ | -32768 | 0 | 16384 |\n| 41 | -32768 | 0 | 16384 |\n| 41+ | -32768 | 1 | 16384 |\n| 42 | -32768 | 1 | -32768 |\n| 42+ | -2 | 0 | -32768 |\n| 43 | -2 | 0 | -32768 |\n| 43+ | -2 | 1 | -32768 |\n| 44 | -2 | 1 | -2 |\n| 44+ | -3 | 0 | -2 |\n| 45 | -3 | 0 | -2 |\n| 45+ | -3 | 1 | -2 |\n| 46 | -3 | 1 | -3 |\n| 46+ | -5 | 0 | -3 |\n| 47 | -5 | 0 | -3 |\n| 47+ | -5 | 1 | -3 |\n| 48 | -5 | 1 | -5 |\n| 48+ | -9 | 0 | -5 |\n| 49 | -9 | 0 | -5 |\n| 49+ | -9 | 1 | -5 |\n| 50 | -9 | 1 | -9 |\n| 50+ | -17 | 0 | -9 |\n| 51 | -17 | 0 | -9 |\n| 51+ | -17 | 1 | -9 |\n| 52 | -17 | 1 | -17 |\n| 52+ | -33 | 0 | -17 |\n| 53 | -33 | 0 | -17 |\n| 53+ | -33 | 1 | -17 |\n| 54 | -33 | 1 | -33 |\n| 54+ | -65 | 0 | -33 |\n| 55 | -65 | 0 | -33 |\n| 55+ | -65 | 1 | -33 |\n| 56 | -65 | 1 | -65 |\n| 56+ | -129 | 0 | -65 |\n| 57 | -129 | 0 | -65 |\n| 57+ | -129 | 1 | -65 |\n| 58 | -129 | 1 | -129 |\n| 58+ | -257 | 0 | -129 |\n| 59 | -257 | 0 | -129 |\n| 59+ | -257 | 1 | -129 |\n| 60 | -257 | 1 | -257 |\n| 60+ | -513 | 0 | -257 |\n| 61 | -513 | 0 | -257 |\n| 61+ | -513 | 1 | -257 |\n| 62 | -513 | 1 | -513 |\n| 62+ | -1025 | 0 | -513 |\n| 63 | -1025 | 0 | -513 |\n| 63+ | -1025 | 1 | -513 |\n| 64 | -1025 | 1 | -1025 |\n| 64+ | -2049 | 0 | -1025 |\n| 65 | -2049 | 0 | -1025 |\n| 65+ | -2049 | 1 | -1025 |\n| 66 | -2049 | 1 | -2049 |\n| 66+ | -4097 | 0 | -2049 |\n| 67 | -4097 | 0 | -2049 |\n| 67+ | -4097 | 1 | -2049 |\n| 68 | -4097 | 1 | -4097 |\n| 68+ | -8193 | 0 | -4097 |\n| 69 | -8193 | 0 | -4097 |\n| 69+ | -8193 | 1 | -4097 |\n| 70 | -8193 | 1 | -8193 |\n| 70+ | -16385 | 0 | -8193 |\n| 71 | -16385 | 0 | -8193 |\n| 71+ | -16385 | 1 | -8193 |\n| 72 | -16385 | 1 | -16385 |\n| 72+ | 32767 | 0 | -16385 |\n| 73 | 32767 | 0 | -16385 |\n| 73+ | 32767 | 1 | -16385 |\n| 74 | 32767 | 1 | 32767 |`;\n","export const hdl = `/**\n * A 16-bit counter with load and reset control bits.\n * if (reset[t] == 1) out[t+1] = 0\n * else if (load[t] == 1) out[t+1] = in[t]\n * else if (inc[t] == 1) out[t+1] = out[t] + 1 (integer addition)\n * else out[t+1] = out[t]\n */\n\nCHIP PC {\n IN in[16], load, inc, reset;\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 reset%B2.1.2 load%B2.1.2 inc%B2.1.2 out%D1.6.1;\n\nset in 0, set reset 0, set load 0, set inc 0, tick, output;\ntock, output;\n\nset inc 1, tick, output; tock, output;\nset in -32123, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\ntick, output; tock, output;\nset in 12345, set load 1, set inc 0, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset reset 0, set inc 1, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset reset 0, set load 0, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset in 0, set reset 0, set load 1, tick, output; tock, output;\nset load 0, set inc 1, tick, output; tock, output;\nset in 22222, set reset 1, set inc 0, tick, output; tock, output;`;\nexport const cmp = `| time | in |reset|load | inc | out |\n| 0+ | 0 | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 0 | 0 | 1 | 0 |\n| 2 | 0 | 0 | 0 | 1 | 1 |\n| 2+ | -32123 | 0 | 0 | 1 | 1 |\n| 3 | -32123 | 0 | 0 | 1 | 2 |\n| 3+ | -32123 | 0 | 1 | 1 | 2 |\n| 4 | -32123 | 0 | 1 | 1 | -32123 |\n| 4+ | -32123 | 0 | 0 | 1 | -32123 |\n| 5 | -32123 | 0 | 0 | 1 | -32122 |\n| 5+ | -32123 | 0 | 0 | 1 | -32122 |\n| 6 | -32123 | 0 | 0 | 1 | -32121 |\n| 6+ | 12345 | 0 | 1 | 0 | -32121 |\n| 7 | 12345 | 0 | 1 | 0 | 12345 |\n| 7+ | 12345 | 1 | 1 | 0 | 12345 |\n| 8 | 12345 | 1 | 1 | 0 | 0 |\n| 8+ | 12345 | 0 | 1 | 1 | 0 |\n| 9 | 12345 | 0 | 1 | 1 | 12345 |\n| 9+ | 12345 | 1 | 1 | 1 | 12345 |\n| 10 | 12345 | 1 | 1 | 1 | 0 |\n| 10+ | 12345 | 0 | 0 | 1 | 0 |\n| 11 | 12345 | 0 | 0 | 1 | 1 |\n| 11+ | 12345 | 1 | 0 | 1 | 1 |\n| 12 | 12345 | 1 | 0 | 1 | 0 |\n| 12+ | 0 | 0 | 1 | 1 | 0 |\n| 13 | 0 | 0 | 1 | 1 | 0 |\n| 13+ | 0 | 0 | 0 | 1 | 0 |\n| 14 | 0 | 0 | 0 | 1 | 1 |\n| 14+ | 22222 | 1 | 0 | 0 | 1 |\n| 15 | 22222 | 1 | 0 | 0 | 0 |`;\n","export const hdl = `/**\n * Memory of 8 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM8 {\n IN in[16], load, address[3];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D3.1.3 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 11111, set load 0, tick, output; tock, output;\nset load 1, set address 1, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 3333, set address 3, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 1, eval, output;\n\nset in 7777, tick, output; tock, output;\nset load 1, set address 7, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 3, eval, output;\nset address 7, eval, output;\n\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set in %B0101010101010101, set address 0, tick, output; tock, output;\nset address 1, tick, output, tock, output;\nset address 2, tick, output, tock, output;\nset address 3, tick, output, tock, output;\nset address 4, tick, output, tock, output;\nset address 5, tick, output, tock, output;\nset address 6, tick, output, tock, output;\nset address 7, tick, output, tock, output;\n\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 0, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 0, set in %B0101010101010101, tick, output, tock, output;\nset address 1, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 1, set in %B0101010101010101, tick, output, tock, output;\nset address 2, set in %B1010101010101010, tick, output;\ntock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 2, set in %B0101010101010101, tick, output, tock, output;\nset address 3, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 3, set in %B0101010101010101, tick, output, tock, output;\nset address 4, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 4, set in %B0101010101010101, tick, output, tock, output;\nset address 5, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 5, set in %B0101010101010101, tick, output, tock, output;\nset address 6, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 6, set in %B0101010101010101, tick, output, tock, output;\nset address 7, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 7, set in %B0101010101010101, tick, output, tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;`;\nexport const cmp = `| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 11111 | 0 | 0 | 0 |\n| 3 | 11111 | 0 | 0 | 0 |\n| 3+ | 11111 | 1 | 1 | 0 |\n| 4 | 11111 | 1 | 1 | 11111 |\n| 4+ | 11111 | 0 | 0 | 0 |\n| 5 | 11111 | 0 | 0 | 0 |\n| 5+ | 3333 | 0 | 3 | 0 |\n| 6 | 3333 | 0 | 3 | 0 |\n| 6+ | 3333 | 1 | 3 | 0 |\n| 7 | 3333 | 1 | 3 | 3333 |\n| 7+ | 3333 | 0 | 3 | 3333 |\n| 8 | 3333 | 0 | 3 | 3333 |\n| 8 | 3333 | 0 | 1 | 11111 |\n| 8+ | 7777 | 0 | 1 | 11111 |\n| 9 | 7777 | 0 | 1 | 11111 |\n| 9+ | 7777 | 1 | 7 | 0 |\n| 10 | 7777 | 1 | 7 | 7777 |\n| 10+ | 7777 | 0 | 7 | 7777 |\n| 11 | 7777 | 0 | 7 | 7777 |\n| 11 | 7777 | 0 | 3 | 3333 |\n| 11 | 7777 | 0 | 7 | 7777 |\n| 11+ | 7777 | 0 | 0 | 0 |\n| 12 | 7777 | 0 | 0 | 0 |\n| 12 | 7777 | 0 | 1 | 11111 |\n| 12 | 7777 | 0 | 2 | 0 |\n| 12 | 7777 | 0 | 3 | 3333 |\n| 12 | 7777 | 0 | 4 | 0 |\n| 12 | 7777 | 0 | 5 | 0 |\n| 12 | 7777 | 0 | 6 | 0 |\n| 12 | 7777 | 0 | 7 | 7777 |\n| 12+ | 21845 | 1 | 0 | 0 |\n| 13 | 21845 | 1 | 0 | 21845 |\n| 13+ | 21845 | 1 | 1 | 11111 |\n| 14 | 21845 | 1 | 1 | 21845 |\n| 14+ | 21845 | 1 | 2 | 0 |\n| 15 | 21845 | 1 | 2 | 21845 |\n| 15+ | 21845 | 1 | 3 | 3333 |\n| 16 | 21845 | 1 | 3 | 21845 |\n| 16+ | 21845 | 1 | 4 | 0 |\n| 17 | 21845 | 1 | 4 | 21845 |\n| 17+ | 21845 | 1 | 5 | 0 |\n| 18 | 21845 | 1 | 5 | 21845 |\n| 18+ | 21845 | 1 | 6 | 0 |\n| 19 | 21845 | 1 | 6 | 21845 |\n| 19+ | 21845 | 1 | 7 | 7777 |\n| 20 | 21845 | 1 | 7 | 21845 |\n| 20+ | 21845 | 0 | 0 | 21845 |\n| 21 | 21845 | 0 | 0 | 21845 |\n| 21 | 21845 | 0 | 1 | 21845 |\n| 21 | 21845 | 0 | 2 | 21845 |\n| 21 | 21845 | 0 | 3 | 21845 |\n| 21 | 21845 | 0 | 4 | 21845 |\n| 21 | 21845 | 0 | 5 | 21845 |\n| 21 | 21845 | 0 | 6 | 21845 |\n| 21 | 21845 | 0 | 7 | 21845 |\n| 21+ | -21846 | 1 | 0 | 21845 |\n| 22 | -21846 | 1 | 0 | -21846 |\n| 22+ | -21846 | 0 | 0 | -21846 |\n| 23 | -21846 | 0 | 0 | -21846 |\n| 23 | -21846 | 0 | 1 | 21845 |\n| 23 | -21846 | 0 | 2 | 21845 |\n| 23 | -21846 | 0 | 3 | 21845 |\n| 23 | -21846 | 0 | 4 | 21845 |\n| 23 | -21846 | 0 | 5 | 21845 |\n| 23 | -21846 | 0 | 6 | 21845 |\n| 23 | -21846 | 0 | 7 | 21845 |\n| 23+ | 21845 | 1 | 0 | -21846 |\n| 24 | 21845 | 1 | 0 | 21845 |\n| 24+ | -21846 | 1 | 1 | 21845 |\n| 25 | -21846 | 1 | 1 | -21846 |\n| 25+ | -21846 | 0 | 0 | 21845 |\n| 26 | -21846 | 0 | 0 | 21845 |\n| 26 | -21846 | 0 | 1 | -21846 |\n| 26 | -21846 | 0 | 2 | 21845 |\n| 26 | -21846 | 0 | 3 | 21845 |\n| 26 | -21846 | 0 | 4 | 21845 |\n| 26 | -21846 | 0 | 5 | 21845 |\n| 26 | -21846 | 0 | 6 | 21845 |\n| 26 | -21846 | 0 | 7 | 21845 |\n| 26+ | 21845 | 1 | 1 | -21846 |\n| 27 | 21845 | 1 | 1 | 21845 |\n| 27+ | -21846 | 1 | 2 | 21845 |\n| 28 | -21846 | 1 | 2 | -21846 |\n| 28+ | -21846 | 0 | 0 | 21845 |\n| 29 | -21846 | 0 | 0 | 21845 |\n| 29 | -21846 | 0 | 1 | 21845 |\n| 29 | -21846 | 0 | 2 | -21846 |\n| 29 | -21846 | 0 | 3 | 21845 |\n| 29 | -21846 | 0 | 4 | 21845 |\n| 29 | -21846 | 0 | 5 | 21845 |\n| 29 | -21846 | 0 | 6 | 21845 |\n| 29 | -21846 | 0 | 7 | 21845 |\n| 29+ | 21845 | 1 | 2 | -21846 |\n| 30 | 21845 | 1 | 2 | 21845 |\n| 30+ | -21846 | 1 | 3 | 21845 |\n| 31 | -21846 | 1 | 3 | -21846 |\n| 31+ | -21846 | 0 | 0 | 21845 |\n| 32 | -21846 | 0 | 0 | 21845 |\n| 32 | -21846 | 0 | 1 | 21845 |\n| 32 | -21846 | 0 | 2 | 21845 |\n| 32 | -21846 | 0 | 3 | -21846 |\n| 32 | -21846 | 0 | 4 | 21845 |\n| 32 | -21846 | 0 | 5 | 21845 |\n| 32 | -21846 | 0 | 6 | 21845 |\n| 32 | -21846 | 0 | 7 | 21845 |\n| 32+ | 21845 | 1 | 3 | -21846 |\n| 33 | 21845 | 1 | 3 | 21845 |\n| 33+ | -21846 | 1 | 4 | 21845 |\n| 34 | -21846 | 1 | 4 | -21846 |\n| 34+ | -21846 | 0 | 0 | 21845 |\n| 35 | -21846 | 0 | 0 | 21845 |\n| 35 | -21846 | 0 | 1 | 21845 |\n| 35 | -21846 | 0 | 2 | 21845 |\n| 35 | -21846 | 0 | 3 | 21845 |\n| 35 | -21846 | 0 | 4 | -21846 |\n| 35 | -21846 | 0 | 5 | 21845 |\n| 35 | -21846 | 0 | 6 | 21845 |\n| 35 | -21846 | 0 | 7 | 21845 |\n| 35+ | 21845 | 1 | 4 | -21846 |\n| 36 | 21845 | 1 | 4 | 21845 |\n| 36+ | -21846 | 1 | 5 | 21845 |\n| 37 | -21846 | 1 | 5 | -21846 |\n| 37+ | -21846 | 0 | 0 | 21845 |\n| 38 | -21846 | 0 | 0 | 21845 |\n| 38 | -21846 | 0 | 1 | 21845 |\n| 38 | -21846 | 0 | 2 | 21845 |\n| 38 | -21846 | 0 | 3 | 21845 |\n| 38 | -21846 | 0 | 4 | 21845 |\n| 38 | -21846 | 0 | 5 | -21846 |\n| 38 | -21846 | 0 | 6 | 21845 |\n| 38 | -21846 | 0 | 7 | 21845 |\n| 38+ | 21845 | 1 | 5 | -21846 |\n| 39 | 21845 | 1 | 5 | 21845 |\n| 39+ | -21846 | 1 | 6 | 21845 |\n| 40 | -21846 | 1 | 6 | -21846 |\n| 40+ | -21846 | 0 | 0 | 21845 |\n| 41 | -21846 | 0 | 0 | 21845 |\n| 41 | -21846 | 0 | 1 | 21845 |\n| 41 | -21846 | 0 | 2 | 21845 |\n| 41 | -21846 | 0 | 3 | 21845 |\n| 41 | -21846 | 0 | 4 | 21845 |\n| 41 | -21846 | 0 | 5 | 21845 |\n| 41 | -21846 | 0 | 6 | -21846 |\n| 41 | -21846 | 0 | 7 | 21845 |\n| 41+ | 21845 | 1 | 6 | -21846 |\n| 42 | 21845 | 1 | 6 | 21845 |\n| 42+ | -21846 | 1 | 7 | 21845 |\n| 43 | -21846 | 1 | 7 | -21846 |\n| 43+ | -21846 | 0 | 0 | 21845 |\n| 44 | -21846 | 0 | 0 | 21845 |\n| 44 | -21846 | 0 | 1 | 21845 |\n| 44 | -21846 | 0 | 2 | 21845 |\n| 44 | -21846 | 0 | 3 | 21845 |\n| 44 | -21846 | 0 | 4 | 21845 |\n| 44 | -21846 | 0 | 5 | 21845 |\n| 44 | -21846 | 0 | 6 | 21845 |\n| 44 | -21846 | 0 | 7 | -21846 |\n| 44+ | 21845 | 1 | 7 | -21846 |\n| 45 | 21845 | 1 | 7 | 21845 |\n| 45+ | 21845 | 0 | 0 | 21845 |\n| 46 | 21845 | 0 | 0 | 21845 |\n| 46 | 21845 | 0 | 1 | 21845 |\n| 46 | 21845 | 0 | 2 | 21845 |\n| 46 | 21845 | 0 | 3 | 21845 |\n| 46 | 21845 | 0 | 4 | 21845 |\n| 46 | 21845 | 0 | 5 | 21845 |\n| 46 | 21845 | 0 | 6 | 21845 |\n| 46 | 21845 | 0 | 7 | 21845 |`;\n","export const hdl = `/**\n * Memory of 64 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM64 {\n IN in[16], load, address[6];\n OUT out[16];\n \n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1;\n\nset in 0, set load 0,\nset address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset in 1313, set load 0, tick, output; tock, output;\nset load 1,\nset address 13, tick, output; tock, output;\nset load 0,\nset address 0, tick, output; tock, output;\nset in 4747, set address 47, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 13, eval, output;\n\nset in 6363, tick, output; tock, output;\nset load 1,\nset address 63, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 47, eval, output;\n\nset address 63, eval, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B101000, tick, output; tock, output;\nset address %B101001, tick, output, tock, output;\nset address %B101010, tick, output, tock, output;\nset address %B101011, tick, output, tock, output;\nset address %B101100, tick, output, tock, output;\nset address %B101101, tick, output, tock, output;\nset address %B101110, tick, output, tock, output;\nset address %B101111, tick, output, tock, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101000, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B101001, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101011, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B101100, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B101111, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101, tick, output; tock, output;\nset address %B001101, tick, output, tock, output;\nset address %B010101, tick, output, tock, output;\nset address %B011101, tick, output, tock, output;\nset address %B100101, tick, output, tock, output;\nset address %B101101, tick, output, tock, output;\nset address %B110101, tick, output, tock, output;\nset address %B111101, tick, output, tock, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B000101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B000101, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B001101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B011101, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B100101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B110101, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B111101, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;`;\n\nexport const cmp = `| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 1313 | 0 | 0 | 0 |\n| 3 | 1313 | 0 | 0 | 0 |\n| 3+ | 1313 | 1 | 13 | 0 |\n| 4 | 1313 | 1 | 13 | 1313 |\n| 4+ | 1313 | 0 | 0 | 0 |\n| 5 | 1313 | 0 | 0 | 0 |\n| 5+ | 4747 | 0 | 47 | 0 |\n| 6 | 4747 | 0 | 47 | 0 |\n| 6+ | 4747 | 1 | 47 | 0 |\n| 7 | 4747 | 1 | 47 | 4747 |\n| 7+ | 4747 | 0 | 47 | 4747 |\n| 8 | 4747 | 0 | 47 | 4747 |\n| 8 | 4747 | 0 | 13 | 1313 |\n| 8+ | 6363 | 0 | 13 | 1313 |\n| 9 | 6363 | 0 | 13 | 1313 |\n| 9+ | 6363 | 1 | 63 | 0 |\n| 10 | 6363 | 1 | 63 | 6363 |\n| 10+ | 6363 | 0 | 63 | 6363 |\n| 11 | 6363 | 0 | 63 | 6363 |\n| 11 | 6363 | 0 | 47 | 4747 |\n| 11 | 6363 | 0 | 63 | 6363 |\n| 11+ | 6363 | 0 | 40 | 0 |\n| 12 | 6363 | 0 | 40 | 0 |\n| 12 | 6363 | 0 | 41 | 0 |\n| 12 | 6363 | 0 | 42 | 0 |\n| 12 | 6363 | 0 | 43 | 0 |\n| 12 | 6363 | 0 | 44 | 0 |\n| 12 | 6363 | 0 | 45 | 0 |\n| 12 | 6363 | 0 | 46 | 0 |\n| 12 | 6363 | 0 | 47 | 4747 |\n| 12+ | 21845 | 1 | 40 | 0 |\n| 13 | 21845 | 1 | 40 | 21845 |\n| 13+ | 21845 | 1 | 41 | 0 |\n| 14 | 21845 | 1 | 41 | 21845 |\n| 14+ | 21845 | 1 | 42 | 0 |\n| 15 | 21845 | 1 | 42 | 21845 |\n| 15+ | 21845 | 1 | 43 | 0 |\n| 16 | 21845 | 1 | 43 | 21845 |\n| 16+ | 21845 | 1 | 44 | 0 |\n| 17 | 21845 | 1 | 44 | 21845 |\n| 17+ | 21845 | 1 | 45 | 0 |\n| 18 | 21845 | 1 | 45 | 21845 |\n| 18+ | 21845 | 1 | 46 | 0 |\n| 19 | 21845 | 1 | 46 | 21845 |\n| 19+ | 21845 | 1 | 47 | 4747 |\n| 20 | 21845 | 1 | 47 | 21845 |\n| 20+ | 21845 | 0 | 40 | 21845 |\n| 21 | 21845 | 0 | 40 | 21845 |\n| 21 | 21845 | 0 | 41 | 21845 |\n| 21 | 21845 | 0 | 42 | 21845 |\n| 21 | 21845 | 0 | 43 | 21845 |\n| 21 | 21845 | 0 | 44 | 21845 |\n| 21 | 21845 | 0 | 45 | 21845 |\n| 21 | 21845 | 0 | 46 | 21845 |\n| 21 | 21845 | 0 | 47 | 21845 |\n| 21+ | -21846 | 1 | 40 | 21845 |\n| 22 | -21846 | 1 | 40 | -21846 |\n| 22+ | -21846 | 0 | 40 | -21846 |\n| 23 | -21846 | 0 | 40 | -21846 |\n| 23 | -21846 | 0 | 41 | 21845 |\n| 23 | -21846 | 0 | 42 | 21845 |\n| 23 | -21846 | 0 | 43 | 21845 |\n| 23 | -21846 | 0 | 44 | 21845 |\n| 23 | -21846 | 0 | 45 | 21845 |\n| 23 | -21846 | 0 | 46 | 21845 |\n| 23 | -21846 | 0 | 47 | 21845 |\n| 23+ | 21845 | 1 | 40 | -21846 |\n| 24 | 21845 | 1 | 40 | 21845 |\n| 24+ | -21846 | 1 | 41 | 21845 |\n| 25 | -21846 | 1 | 41 | -21846 |\n| 25+ | -21846 | 0 | 40 | 21845 |\n| 26 | -21846 | 0 | 40 | 21845 |\n| 26 | -21846 | 0 | 41 | -21846 |\n| 26 | -21846 | 0 | 42 | 21845 |\n| 26 | -21846 | 0 | 43 | 21845 |\n| 26 | -21846 | 0 | 44 | 21845 |\n| 26 | -21846 | 0 | 45 | 21845 |\n| 26 | -21846 | 0 | 46 | 21845 |\n| 26 | -21846 | 0 | 47 | 21845 |\n| 26+ | 21845 | 1 | 41 | -21846 |\n| 27 | 21845 | 1 | 41 | 21845 |\n| 27+ | -21846 | 1 | 42 | 21845 |\n| 28 | -21846 | 1 | 42 | -21846 |\n| 28+ | -21846 | 0 | 40 | 21845 |\n| 29 | -21846 | 0 | 40 | 21845 |\n| 29 | -21846 | 0 | 41 | 21845 |\n| 29 | -21846 | 0 | 42 | -21846 |\n| 29 | -21846 | 0 | 43 | 21845 |\n| 29 | -21846 | 0 | 44 | 21845 |\n| 29 | -21846 | 0 | 45 | 21845 |\n| 29 | -21846 | 0 | 46 | 21845 |\n| 29 | -21846 | 0 | 47 | 21845 |\n| 29+ | 21845 | 1 | 42 | -21846 |\n| 30 | 21845 | 1 | 42 | 21845 |\n| 30+ | -21846 | 1 | 43 | 21845 |\n| 31 | -21846 | 1 | 43 | -21846 |\n| 31+ | -21846 | 0 | 40 | 21845 |\n| 32 | -21846 | 0 | 40 | 21845 |\n| 32 | -21846 | 0 | 41 | 21845 |\n| 32 | -21846 | 0 | 42 | 21845 |\n| 32 | -21846 | 0 | 43 | -21846 |\n| 32 | -21846 | 0 | 44 | 21845 |\n| 32 | -21846 | 0 | 45 | 21845 |\n| 32 | -21846 | 0 | 46 | 21845 |\n| 32 | -21846 | 0 | 47 | 21845 |\n| 32+ | 21845 | 1 | 43 | -21846 |\n| 33 | 21845 | 1 | 43 | 21845 |\n| 33+ | -21846 | 1 | 44 | 21845 |\n| 34 | -21846 | 1 | 44 | -21846 |\n| 34+ | -21846 | 0 | 40 | 21845 |\n| 35 | -21846 | 0 | 40 | 21845 |\n| 35 | -21846 | 0 | 41 | 21845 |\n| 35 | -21846 | 0 | 42 | 21845 |\n| 35 | -21846 | 0 | 43 | 21845 |\n| 35 | -21846 | 0 | 44 | -21846 |\n| 35 | -21846 | 0 | 45 | 21845 |\n| 35 | -21846 | 0 | 46 | 21845 |\n| 35 | -21846 | 0 | 47 | 21845 |\n| 35+ | 21845 | 1 | 44 | -21846 |\n| 36 | 21845 | 1 | 44 | 21845 |\n| 36+ | -21846 | 1 | 45 | 21845 |\n| 37 | -21846 | 1 | 45 | -21846 |\n| 37+ | -21846 | 0 | 40 | 21845 |\n| 38 | -21846 | 0 | 40 | 21845 |\n| 38 | -21846 | 0 | 41 | 21845 |\n| 38 | -21846 | 0 | 42 | 21845 |\n| 38 | -21846 | 0 | 43 | 21845 |\n| 38 | -21846 | 0 | 44 | 21845 |\n| 38 | -21846 | 0 | 45 | -21846 |\n| 38 | -21846 | 0 | 46 | 21845 |\n| 38 | -21846 | 0 | 47 | 21845 |\n| 38+ | 21845 | 1 | 45 | -21846 |\n| 39 | 21845 | 1 | 45 | 21845 |\n| 39+ | -21846 | 1 | 46 | 21845 |\n| 40 | -21846 | 1 | 46 | -21846 |\n| 40+ | -21846 | 0 | 40 | 21845 |\n| 41 | -21846 | 0 | 40 | 21845 |\n| 41 | -21846 | 0 | 41 | 21845 |\n| 41 | -21846 | 0 | 42 | 21845 |\n| 41 | -21846 | 0 | 43 | 21845 |\n| 41 | -21846 | 0 | 44 | 21845 |\n| 41 | -21846 | 0 | 45 | 21845 |\n| 41 | -21846 | 0 | 46 | -21846 |\n| 41 | -21846 | 0 | 47 | 21845 |\n| 41+ | 21845 | 1 | 46 | -21846 |\n| 42 | 21845 | 1 | 46 | 21845 |\n| 42+ | -21846 | 1 | 47 | 21845 |\n| 43 | -21846 | 1 | 47 | -21846 |\n| 43+ | -21846 | 0 | 40 | 21845 |\n| 44 | -21846 | 0 | 40 | 21845 |\n| 44 | -21846 | 0 | 41 | 21845 |\n| 44 | -21846 | 0 | 42 | 21845 |\n| 44 | -21846 | 0 | 43 | 21845 |\n| 44 | -21846 | 0 | 44 | 21845 |\n| 44 | -21846 | 0 | 45 | 21845 |\n| 44 | -21846 | 0 | 46 | 21845 |\n| 44 | -21846 | 0 | 47 | -21846 |\n| 44+ | 21845 | 1 | 47 | -21846 |\n| 45 | 21845 | 1 | 47 | 21845 |\n| 45+ | 21845 | 0 | 40 | 21845 |\n| 46 | 21845 | 0 | 40 | 21845 |\n| 46 | 21845 | 0 | 41 | 21845 |\n| 46 | 21845 | 0 | 42 | 21845 |\n| 46 | 21845 | 0 | 43 | 21845 |\n| 46 | 21845 | 0 | 44 | 21845 |\n| 46 | 21845 | 0 | 45 | 21845 |\n| 46 | 21845 | 0 | 46 | 21845 |\n| 46 | 21845 | 0 | 47 | 21845 |\n| 46+ | 21845 | 0 | 5 | 0 |\n| 47 | 21845 | 0 | 5 | 0 |\n| 47 | 21845 | 0 | 13 | 1313 |\n| 47 | 21845 | 0 | 21 | 0 |\n| 47 | 21845 | 0 | 29 | 0 |\n| 47 | 21845 | 0 | 37 | 0 |\n| 47 | 21845 | 0 | 45 | 21845 |\n| 47 | 21845 | 0 | 53 | 0 |\n| 47 | 21845 | 0 | 61 | 0 |\n| 47+ | 21845 | 1 | 5 | 0 |\n| 48 | 21845 | 1 | 5 | 21845 |\n| 48+ | 21845 | 1 | 13 | 1313 |\n| 49 | 21845 | 1 | 13 | 21845 |\n| 49+ | 21845 | 1 | 21 | 0 |\n| 50 | 21845 | 1 | 21 | 21845 |\n| 50+ | 21845 | 1 | 29 | 0 |\n| 51 | 21845 | 1 | 29 | 21845 |\n| 51+ | 21845 | 1 | 37 | 0 |\n| 52 | 21845 | 1 | 37 | 21845 |\n| 52+ | 21845 | 1 | 45 | 21845 |\n| 53 | 21845 | 1 | 45 | 21845 |\n| 53+ | 21845 | 1 | 53 | 0 |\n| 54 | 21845 | 1 | 53 | 21845 |\n| 54+ | 21845 | 1 | 61 | 0 |\n| 55 | 21845 | 1 | 61 | 21845 |\n| 55+ | 21845 | 0 | 5 | 21845 |\n| 56 | 21845 | 0 | 5 | 21845 |\n| 56 | 21845 | 0 | 13 | 21845 |\n| 56 | 21845 | 0 | 21 | 21845 |\n| 56 | 21845 | 0 | 29 | 21845 |\n| 56 | 21845 | 0 | 37 | 21845 |\n| 56 | 21845 | 0 | 45 | 21845 |\n| 56 | 21845 | 0 | 53 | 21845 |\n| 56 | 21845 | 0 | 61 | 21845 |\n| 56+ | -21846 | 1 | 5 | 21845 |\n| 57 | -21846 | 1 | 5 | -21846 |\n| 57+ | -21846 | 0 | 5 | -21846 |\n| 58 | -21846 | 0 | 5 | -21846 |\n| 58 | -21846 | 0 | 13 | 21845 |\n| 58 | -21846 | 0 | 21 | 21845 |\n| 58 | -21846 | 0 | 29 | 21845 |\n| 58 | -21846 | 0 | 37 | 21845 |\n| 58 | -21846 | 0 | 45 | 21845 |\n| 58 | -21846 | 0 | 53 | 21845 |\n| 58 | -21846 | 0 | 61 | 21845 |\n| 58+ | 21845 | 1 | 5 | -21846 |\n| 59 | 21845 | 1 | 5 | 21845 |\n| 59+ | -21846 | 1 | 13 | 21845 |\n| 60 | -21846 | 1 | 13 | -21846 |\n| 60+ | -21846 | 0 | 5 | 21845 |\n| 61 | -21846 | 0 | 5 | 21845 |\n| 61 | -21846 | 0 | 13 | -21846 |\n| 61 | -21846 | 0 | 21 | 21845 |\n| 61 | -21846 | 0 | 29 | 21845 |\n| 61 | -21846 | 0 | 37 | 21845 |\n| 61 | -21846 | 0 | 45 | 21845 |\n| 61 | -21846 | 0 | 53 | 21845 |\n| 61 | -21846 | 0 | 61 | 21845 |\n| 61+ | 21845 | 1 | 13 | -21846 |\n| 62 | 21845 | 1 | 13 | 21845 |\n| 62+ | -21846 | 1 | 21 | 21845 |\n| 63 | -21846 | 1 | 21 | -21846 |\n| 63+ | -21846 | 0 | 5 | 21845 |\n| 64 | -21846 | 0 | 5 | 21845 |\n| 64 | -21846 | 0 | 13 | 21845 |\n| 64 | -21846 | 0 | 21 | -21846 |\n| 64 | -21846 | 0 | 29 | 21845 |\n| 64 | -21846 | 0 | 37 | 21845 |\n| 64 | -21846 | 0 | 45 | 21845 |\n| 64 | -21846 | 0 | 53 | 21845 |\n| 64 | -21846 | 0 | 61 | 21845 |\n| 64+ | 21845 | 1 | 21 | -21846 |\n| 65 | 21845 | 1 | 21 | 21845 |\n| 65+ | -21846 | 1 | 29 | 21845 |\n| 66 | -21846 | 1 | 29 | -21846 |\n| 66+ | -21846 | 0 | 5 | 21845 |\n| 67 | -21846 | 0 | 5 | 21845 |\n| 67 | -21846 | 0 | 13 | 21845 |\n| 67 | -21846 | 0 | 21 | 21845 |\n| 67 | -21846 | 0 | 29 | -21846 |\n| 67 | -21846 | 0 | 37 | 21845 |\n| 67 | -21846 | 0 | 45 | 21845 |\n| 67 | -21846 | 0 | 53 | 21845 |\n| 67 | -21846 | 0 | 61 | 21845 |\n| 67+ | 21845 | 1 | 29 | -21846 |\n| 68 | 21845 | 1 | 29 | 21845 |\n| 68+ | -21846 | 1 | 37 | 21845 |\n| 69 | -21846 | 1 | 37 | -21846 |\n| 69+ | -21846 | 0 | 5 | 21845 |\n| 70 | -21846 | 0 | 5 | 21845 |\n| 70 | -21846 | 0 | 13 | 21845 |\n| 70 | -21846 | 0 | 21 | 21845 |\n| 70 | -21846 | 0 | 29 | 21845 |\n| 70 | -21846 | 0 | 37 | -21846 |\n| 70 | -21846 | 0 | 45 | 21845 |\n| 70 | -21846 | 0 | 53 | 21845 |\n| 70 | -21846 | 0 | 61 | 21845 |\n| 70+ | 21845 | 1 | 37 | -21846 |\n| 71 | 21845 | 1 | 37 | 21845 |\n| 71+ | -21846 | 1 | 45 | 21845 |\n| 72 | -21846 | 1 | 45 | -21846 |\n| 72+ | -21846 | 0 | 5 | 21845 |\n| 73 | -21846 | 0 | 5 | 21845 |\n| 73 | -21846 | 0 | 13 | 21845 |\n| 73 | -21846 | 0 | 21 | 21845 |\n| 73 | -21846 | 0 | 29 | 21845 |\n| 73 | -21846 | 0 | 37 | 21845 |\n| 73 | -21846 | 0 | 45 | -21846 |\n| 73 | -21846 | 0 | 53 | 21845 |\n| 73 | -21846 | 0 | 61 | 21845 |\n| 73+ | 21845 | 1 | 45 | -21846 |\n| 74 | 21845 | 1 | 45 | 21845 |\n| 74+ | -21846 | 1 | 53 | 21845 |\n| 75 | -21846 | 1 | 53 | -21846 |\n| 75+ | -21846 | 0 | 5 | 21845 |\n| 76 | -21846 | 0 | 5 | 21845 |\n| 76 | -21846 | 0 | 13 | 21845 |\n| 76 | -21846 | 0 | 21 | 21845 |\n| 76 | -21846 | 0 | 29 | 21845 |\n| 76 | -21846 | 0 | 37 | 21845 |\n| 76 | -21846 | 0 | 45 | 21845 |\n| 76 | -21846 | 0 | 53 | -21846 |\n| 76 | -21846 | 0 | 61 | 21845 |\n| 76+ | 21845 | 1 | 53 | -21846 |\n| 77 | 21845 | 1 | 53 | 21845 |\n| 77+ | -21846 | 1 | 61 | 21845 |\n| 78 | -21846 | 1 | 61 | -21846 |\n| 78+ | -21846 | 0 | 5 | 21845 |\n| 79 | -21846 | 0 | 5 | 21845 |\n| 79 | -21846 | 0 | 13 | 21845 |\n| 79 | -21846 | 0 | 21 | 21845 |\n| 79 | -21846 | 0 | 29 | 21845 |\n| 79 | -21846 | 0 | 37 | 21845 |\n| 79 | -21846 | 0 | 45 | 21845 |\n| 79 | -21846 | 0 | 53 | 21845 |\n| 79 | -21846 | 0 | 61 | -21846 |\n| 79+ | 21845 | 1 | 61 | -21846 |\n| 80 | 21845 | 1 | 61 | 21845 |\n| 80+ | 21845 | 0 | 5 | 21845 |\n| 81 | 21845 | 0 | 5 | 21845 |\n| 81 | 21845 | 0 | 13 | 21845 |\n| 81 | 21845 | 0 | 21 | 21845 |\n| 81 | 21845 | 0 | 29 | 21845 |\n| 81 | 21845 | 0 | 37 | 21845 |\n| 81 | 21845 | 0 | 45 | 21845 |\n| 81 | 21845 | 0 | 53 | 21845 |\n| 81 | 21845 | 0 | 61 | 21845 |`;\n","export const hdl = `/**\n * Memory of 512 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM512 {\n IN in[16], load, address[9];\n OUT out[16];\n \n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 13099, set load 0, tick, output; tock, output;\nset load 1, set address 130, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 4729, set address 472, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 130, eval, output;\n\nset in 5119, tick, output; tock, output;\nset load 1, set address 511, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 472, eval, output;\nset address 511, eval, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B010101000, tick, output; tock, output;\nset address %B010101001, tick, output, tock, output;\nset address %B010101010, tick, output, tock, output;\nset address %B010101011, tick, output, tock, output;\nset address %B010101100, tick, output, tock, output;\nset address %B010101101, tick, output, tock, output;\nset address %B010101110, tick, output, tock, output;\nset address %B010101111, tick, output, tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101000, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101001, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101011, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101100, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101110, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101111, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101010, tick, output; tock, output;\nset address %B001101010, tick, output, tock, output;\nset address %B010101010, tick, output, tock, output;\nset address %B011101010, tick, output, tock, output;\nset address %B100101010, tick, output, tock, output;\nset address %B101101010, tick, output, tock, output;\nset address %B110101010, tick, output, tock, output;\nset address %B111101010, tick, output, tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B000101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B000101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B001101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B011101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B100101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B101101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B110101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B111101010, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;`;\nexport const cmp = `| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 13099 | 0 | 0 | 0 |\n| 3 | 13099 | 0 | 0 | 0 |\n| 3+ | 13099 | 1 | 130 | 0 |\n| 4 | 13099 | 1 | 130 | 13099 |\n| 4+ | 13099 | 0 | 0 | 0 |\n| 5 | 13099 | 0 | 0 | 0 |\n| 5+ | 4729 | 0 | 472 | 0 |\n| 6 | 4729 | 0 | 472 | 0 |\n| 6+ | 4729 | 1 | 472 | 0 |\n| 7 | 4729 | 1 | 472 | 4729 |\n| 7+ | 4729 | 0 | 472 | 4729 |\n| 8 | 4729 | 0 | 472 | 4729 |\n| 8 | 4729 | 0 | 130 | 13099 |\n| 8+ | 5119 | 0 | 130 | 13099 |\n| 9 | 5119 | 0 | 130 | 13099 |\n| 9+ | 5119 | 1 | 511 | 0 |\n| 10 | 5119 | 1 | 511 | 5119 |\n| 10+ | 5119 | 0 | 511 | 5119 |\n| 11 | 5119 | 0 | 511 | 5119 |\n| 11 | 5119 | 0 | 472 | 4729 |\n| 11 | 5119 | 0 | 511 | 5119 |\n| 11+ | 5119 | 0 | 168 | 0 |\n| 12 | 5119 | 0 | 168 | 0 |\n| 12 | 5119 | 0 | 169 | 0 |\n| 12 | 5119 | 0 | 170 | 0 |\n| 12 | 5119 | 0 | 171 | 0 |\n| 12 | 5119 | 0 | 172 | 0 |\n| 12 | 5119 | 0 | 173 | 0 |\n| 12 | 5119 | 0 | 174 | 0 |\n| 12 | 5119 | 0 | 175 | 0 |\n| 12+ | 21845 | 1 | 168 | 0 |\n| 13 | 21845 | 1 | 168 | 21845 |\n| 13+ | 21845 | 1 | 169 | 0 |\n| 14 | 21845 | 1 | 169 | 21845 |\n| 14+ | 21845 | 1 | 170 | 0 |\n| 15 | 21845 | 1 | 170 | 21845 |\n| 15+ | 21845 | 1 | 171 | 0 |\n| 16 | 21845 | 1 | 171 | 21845 |\n| 16+ | 21845 | 1 | 172 | 0 |\n| 17 | 21845 | 1 | 172 | 21845 |\n| 17+ | 21845 | 1 | 173 | 0 |\n| 18 | 21845 | 1 | 173 | 21845 |\n| 18+ | 21845 | 1 | 174 | 0 |\n| 19 | 21845 | 1 | 174 | 21845 |\n| 19+ | 21845 | 1 | 175 | 0 |\n| 20 | 21845 | 1 | 175 | 21845 |\n| 20+ | 21845 | 0 | 168 | 21845 |\n| 21 | 21845 | 0 | 168 | 21845 |\n| 21 | 21845 | 0 | 169 | 21845 |\n| 21 | 21845 | 0 | 170 | 21845 |\n| 21 | 21845 | 0 | 171 | 21845 |\n| 21 | 21845 | 0 | 172 | 21845 |\n| 21 | 21845 | 0 | 173 | 21845 |\n| 21 | 21845 | 0 | 174 | 21845 |\n| 21 | 21845 | 0 | 175 | 21845 |\n| 21+ | -21846 | 1 | 168 | 21845 |\n| 22 | -21846 | 1 | 168 | -21846 |\n| 22+ | -21846 | 0 | 168 | -21846 |\n| 23 | -21846 | 0 | 168 | -21846 |\n| 23 | -21846 | 0 | 169 | 21845 |\n| 23 | -21846 | 0 | 170 | 21845 |\n| 23 | -21846 | 0 | 171 | 21845 |\n| 23 | -21846 | 0 | 172 | 21845 |\n| 23 | -21846 | 0 | 173 | 21845 |\n| 23 | -21846 | 0 | 174 | 21845 |\n| 23 | -21846 | 0 | 175 | 21845 |\n| 23+ | 21845 | 1 | 168 | -21846 |\n| 24 | 21845 | 1 | 168 | 21845 |\n| 24+ | -21846 | 1 | 169 | 21845 |\n| 25 | -21846 | 1 | 169 | -21846 |\n| 25+ | -21846 | 0 | 168 | 21845 |\n| 26 | -21846 | 0 | 168 | 21845 |\n| 26 | -21846 | 0 | 169 | -21846 |\n| 26 | -21846 | 0 | 170 | 21845 |\n| 26 | -21846 | 0 | 171 | 21845 |\n| 26 | -21846 | 0 | 172 | 21845 |\n| 26 | -21846 | 0 | 173 | 21845 |\n| 26 | -21846 | 0 | 174 | 21845 |\n| 26 | -21846 | 0 | 175 | 21845 |\n| 26+ | 21845 | 1 | 169 | -21846 |\n| 27 | 21845 | 1 | 169 | 21845 |\n| 27+ | -21846 | 1 | 170 | 21845 |\n| 28 | -21846 | 1 | 170 | -21846 |\n| 28+ | -21846 | 0 | 168 | 21845 |\n| 29 | -21846 | 0 | 168 | 21845 |\n| 29 | -21846 | 0 | 169 | 21845 |\n| 29 | -21846 | 0 | 170 | -21846 |\n| 29 | -21846 | 0 | 171 | 21845 |\n| 29 | -21846 | 0 | 172 | 21845 |\n| 29 | -21846 | 0 | 173 | 21845 |\n| 29 | -21846 | 0 | 174 | 21845 |\n| 29 | -21846 | 0 | 175 | 21845 |\n| 29+ | 21845 | 1 | 170 | -21846 |\n| 30 | 21845 | 1 | 170 | 21845 |\n| 30+ | -21846 | 1 | 171 | 21845 |\n| 31 | -21846 | 1 | 171 | -21846 |\n| 31+ | -21846 | 0 | 168 | 21845 |\n| 32 | -21846 | 0 | 168 | 21845 |\n| 32 | -21846 | 0 | 169 | 21845 |\n| 32 | -21846 | 0 | 170 | 21845 |\n| 32 | -21846 | 0 | 171 | -21846 |\n| 32 | -21846 | 0 | 172 | 21845 |\n| 32 | -21846 | 0 | 173 | 21845 |\n| 32 | -21846 | 0 | 174 | 21845 |\n| 32 | -21846 | 0 | 175 | 21845 |\n| 32+ | 21845 | 1 | 171 | -21846 |\n| 33 | 21845 | 1 | 171 | 21845 |\n| 33+ | -21846 | 1 | 172 | 21845 |\n| 34 | -21846 | 1 | 172 | -21846 |\n| 34+ | -21846 | 0 | 168 | 21845 |\n| 35 | -21846 | 0 | 168 | 21845 |\n| 35 | -21846 | 0 | 169 | 21845 |\n| 35 | -21846 | 0 | 170 | 21845 |\n| 35 | -21846 | 0 | 171 | 21845 |\n| 35 | -21846 | 0 | 172 | -21846 |\n| 35 | -21846 | 0 | 173 | 21845 |\n| 35 | -21846 | 0 | 174 | 21845 |\n| 35 | -21846 | 0 | 175 | 21845 |\n| 35+ | 21845 | 1 | 172 | -21846 |\n| 36 | 21845 | 1 | 172 | 21845 |\n| 36+ | -21846 | 1 | 173 | 21845 |\n| 37 | -21846 | 1 | 173 | -21846 |\n| 37+ | -21846 | 0 | 168 | 21845 |\n| 38 | -21846 | 0 | 168 | 21845 |\n| 38 | -21846 | 0 | 169 | 21845 |\n| 38 | -21846 | 0 | 170 | 21845 |\n| 38 | -21846 | 0 | 171 | 21845 |\n| 38 | -21846 | 0 | 172 | 21845 |\n| 38 | -21846 | 0 | 173 | -21846 |\n| 38 | -21846 | 0 | 174 | 21845 |\n| 38 | -21846 | 0 | 175 | 21845 |\n| 38+ | 21845 | 1 | 173 | -21846 |\n| 39 | 21845 | 1 | 173 | 21845 |\n| 39+ | -21846 | 1 | 174 | 21845 |\n| 40 | -21846 | 1 | 174 | -21846 |\n| 40+ | -21846 | 0 | 168 | 21845 |\n| 41 | -21846 | 0 | 168 | 21845 |\n| 41 | -21846 | 0 | 169 | 21845 |\n| 41 | -21846 | 0 | 170 | 21845 |\n| 41 | -21846 | 0 | 171 | 21845 |\n| 41 | -21846 | 0 | 172 | 21845 |\n| 41 | -21846 | 0 | 173 | 21845 |\n| 41 | -21846 | 0 | 174 | -21846 |\n| 41 | -21846 | 0 | 175 | 21845 |\n| 41+ | 21845 | 1 | 174 | -21846 |\n| 42 | 21845 | 1 | 174 | 21845 |\n| 42+ | -21846 | 1 | 175 | 21845 |\n| 43 | -21846 | 1 | 175 | -21846 |\n| 43+ | -21846 | 0 | 168 | 21845 |\n| 44 | -21846 | 0 | 168 | 21845 |\n| 44 | -21846 | 0 | 169 | 21845 |\n| 44 | -21846 | 0 | 170 | 21845 |\n| 44 | -21846 | 0 | 171 | 21845 |\n| 44 | -21846 | 0 | 172 | 21845 |\n| 44 | -21846 | 0 | 173 | 21845 |\n| 44 | -21846 | 0 | 174 | 21845 |\n| 44 | -21846 | 0 | 175 | -21846 |\n| 44+ | 21845 | 1 | 175 | -21846 |\n| 45 | 21845 | 1 | 175 | 21845 |\n| 45+ | 21845 | 0 | 168 | 21845 |\n| 46 | 21845 | 0 | 168 | 21845 |\n| 46 | 21845 | 0 | 169 | 21845 |\n| 46 | 21845 | 0 | 170 | 21845 |\n| 46 | 21845 | 0 | 171 | 21845 |\n| 46 | 21845 | 0 | 172 | 21845 |\n| 46 | 21845 | 0 | 173 | 21845 |\n| 46 | 21845 | 0 | 174 | 21845 |\n| 46 | 21845 | 0 | 175 | 21845 |\n| 46+ | 21845 | 0 | 42 | 0 |\n| 47 | 21845 | 0 | 42 | 0 |\n| 47 | 21845 | 0 | 106 | 0 |\n| 47 | 21845 | 0 | 170 | 21845 |\n| 47 | 21845 | 0 | 234 | 0 |\n| 47 | 21845 | 0 | 298 | 0 |\n| 47 | 21845 | 0 | 362 | 0 |\n| 47 | 21845 | 0 | 426 | 0 |\n| 47 | 21845 | 0 | 490 | 0 |\n| 47+ | 21845 | 1 | 42 | 0 |\n| 48 | 21845 | 1 | 42 | 21845 |\n| 48+ | 21845 | 1 | 106 | 0 |\n| 49 | 21845 | 1 | 106 | 21845 |\n| 49+ | 21845 | 1 | 170 | 21845 |\n| 50 | 21845 | 1 | 170 | 21845 |\n| 50+ | 21845 | 1 | 234 | 0 |\n| 51 | 21845 | 1 | 234 | 21845 |\n| 51+ | 21845 | 1 | 298 | 0 |\n| 52 | 21845 | 1 | 298 | 21845 |\n| 52+ | 21845 | 1 | 362 | 0 |\n| 53 | 21845 | 1 | 362 | 21845 |\n| 53+ | 21845 | 1 | 426 | 0 |\n| 54 | 21845 | 1 | 426 | 21845 |\n| 54+ | 21845 | 1 | 490 | 0 |\n| 55 | 21845 | 1 | 490 | 21845 |\n| 55+ | 21845 | 0 | 42 | 21845 |\n| 56 | 21845 | 0 | 42 | 21845 |\n| 56 | 21845 | 0 | 106 | 21845 |\n| 56 | 21845 | 0 | 170 | 21845 |\n| 56 | 21845 | 0 | 234 | 21845 |\n| 56 | 21845 | 0 | 298 | 21845 |\n| 56 | 21845 | 0 | 362 | 21845 |\n| 56 | 21845 | 0 | 426 | 21845 |\n| 56 | 21845 | 0 | 490 | 21845 |\n| 56+ | -21846 | 1 | 42 | 21845 |\n| 57 | -21846 | 1 | 42 | -21846 |\n| 57+ | -21846 | 0 | 42 | -21846 |\n| 58 | -21846 | 0 | 42 | -21846 |\n| 58 | -21846 | 0 | 106 | 21845 |\n| 58 | -21846 | 0 | 170 | 21845 |\n| 58 | -21846 | 0 | 234 | 21845 |\n| 58 | -21846 | 0 | 298 | 21845 |\n| 58 | -21846 | 0 | 362 | 21845 |\n| 58 | -21846 | 0 | 426 | 21845 |\n| 58 | -21846 | 0 | 490 | 21845 |\n| 58+ | 21845 | 1 | 42 | -21846 |\n| 59 | 21845 | 1 | 42 | 21845 |\n| 59+ | -21846 | 1 | 106 | 21845 |\n| 60 | -21846 | 1 | 106 | -21846 |\n| 60+ | -21846 | 0 | 42 | 21845 |\n| 61 | -21846 | 0 | 42 | 21845 |\n| 61 | -21846 | 0 | 106 | -21846 |\n| 61 | -21846 | 0 | 170 | 21845 |\n| 61 | -21846 | 0 | 234 | 21845 |\n| 61 | -21846 | 0 | 298 | 21845 |\n| 61 | -21846 | 0 | 362 | 21845 |\n| 61 | -21846 | 0 | 426 | 21845 |\n| 61 | -21846 | 0 | 490 | 21845 |\n| 61+ | 21845 | 1 | 106 | -21846 |\n| 62 | 21845 | 1 | 106 | 21845 |\n| 62+ | -21846 | 1 | 170 | 21845 |\n| 63 | -21846 | 1 | 170 | -21846 |\n| 63+ | -21846 | 0 | 42 | 21845 |\n| 64 | -21846 | 0 | 42 | 21845 |\n| 64 | -21846 | 0 | 106 | 21845 |\n| 64 | -21846 | 0 | 170 | -21846 |\n| 64 | -21846 | 0 | 234 | 21845 |\n| 64 | -21846 | 0 | 298 | 21845 |\n| 64 | -21846 | 0 | 362 | 21845 |\n| 64 | -21846 | 0 | 426 | 21845 |\n| 64 | -21846 | 0 | 490 | 21845 |\n| 64+ | 21845 | 1 | 170 | -21846 |\n| 65 | 21845 | 1 | 170 | 21845 |\n| 65+ | -21846 | 1 | 234 | 21845 |\n| 66 | -21846 | 1 | 234 | -21846 |\n| 66+ | -21846 | 0 | 42 | 21845 |\n| 67 | -21846 | 0 | 42 | 21845 |\n| 67 | -21846 | 0 | 106 | 21845 |\n| 67 | -21846 | 0 | 170 | 21845 |\n| 67 | -21846 | 0 | 234 | -21846 |\n| 67 | -21846 | 0 | 298 | 21845 |\n| 67 | -21846 | 0 | 362 | 21845 |\n| 67 | -21846 | 0 | 426 | 21845 |\n| 67 | -21846 | 0 | 490 | 21845 |\n| 67+ | 21845 | 1 | 234 | -21846 |\n| 68 | 21845 | 1 | 234 | 21845 |\n| 68+ | -21846 | 1 | 298 | 21845 |\n| 69 | -21846 | 1 | 298 | -21846 |\n| 69+ | -21846 | 0 | 42 | 21845 |\n| 70 | -21846 | 0 | 42 | 21845 |\n| 70 | -21846 | 0 | 106 | 21845 |\n| 70 | -21846 | 0 | 170 | 21845 |\n| 70 | -21846 | 0 | 234 | 21845 |\n| 70 | -21846 | 0 | 298 | -21846 |\n| 70 | -21846 | 0 | 362 | 21845 |\n| 70 | -21846 | 0 | 426 | 21845 |\n| 70 | -21846 | 0 | 490 | 21845 |\n| 70+ | 21845 | 1 | 298 | -21846 |\n| 71 | 21845 | 1 | 298 | 21845 |\n| 71+ | -21846 | 1 | 362 | 21845 |\n| 72 | -21846 | 1 | 362 | -21846 |\n| 72+ | -21846 | 0 | 42 | 21845 |\n| 73 | -21846 | 0 | 42 | 21845 |\n| 73 | -21846 | 0 | 106 | 21845 |\n| 73 | -21846 | 0 | 170 | 21845 |\n| 73 | -21846 | 0 | 234 | 21845 |\n| 73 | -21846 | 0 | 298 | 21845 |\n| 73 | -21846 | 0 | 362 | -21846 |\n| 73 | -21846 | 0 | 426 | 21845 |\n| 73 | -21846 | 0 | 490 | 21845 |\n| 73+ | 21845 | 1 | 362 | -21846 |\n| 74 | 21845 | 1 | 362 | 21845 |\n| 74+ | -21846 | 1 | 426 | 21845 |\n| 75 | -21846 | 1 | 426 | -21846 |\n| 75+ | -21846 | 0 | 42 | 21845 |\n| 76 | -21846 | 0 | 42 | 21845 |\n| 76 | -21846 | 0 | 106 | 21845 |\n| 76 | -21846 | 0 | 170 | 21845 |\n| 76 | -21846 | 0 | 234 | 21845 |\n| 76 | -21846 | 0 | 298 | 21845 |\n| 76 | -21846 | 0 | 362 | 21845 |\n| 76 | -21846 | 0 | 426 | -21846 |\n| 76 | -21846 | 0 | 490 | 21845 |\n| 76+ | 21845 | 1 | 426 | -21846 |\n| 77 | 21845 | 1 | 426 | 21845 |\n| 77+ | -21846 | 1 | 490 | 21845 |\n| 78 | -21846 | 1 | 490 | -21846 |\n| 78+ | -21846 | 0 | 42 | 21845 |\n| 79 | -21846 | 0 | 42 | 21845 |\n| 79 | -21846 | 0 | 106 | 21845 |\n| 79 | -21846 | 0 | 170 | 21845 |\n| 79 | -21846 | 0 | 234 | 21845 |\n| 79 | -21846 | 0 | 298 | 21845 |\n| 79 | -21846 | 0 | 362 | 21845 |\n| 79 | -21846 | 0 | 426 | 21845 |\n| 79 | -21846 | 0 | 490 | -21846 |\n| 79+ | 21845 | 1 | 490 | -21846 |\n| 80 | 21845 | 1 | 490 | 21845 |\n| 80+ | 21845 | 0 | 42 | 21845 |\n| 81 | 21845 | 0 | 42 | 21845 |\n| 81 | 21845 | 0 | 106 | 21845 |\n| 81 | 21845 | 0 | 170 | 21845 |\n| 81 | 21845 | 0 | 234 | 21845 |\n| 81 | 21845 | 0 | 298 | 21845 |\n| 81 | 21845 | 0 | 362 | 21845 |\n| 81 | 21845 | 0 | 426 | 21845 |\n| 81 | 21845 | 0 | 490 | 21845 |`;\n","export const hdl = `/**\n * Memory of 4K registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM4K {\n IN in[16], load, address[12];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.4.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset in 1111, set load 0, tick, output; tock, output;\nset load 1, set address 1111, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset in 3513, set address 3513, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 1111, eval, output;\n\nset in 4095, tick, output; tock, output;\nset load 1, set address 4095, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 3513, eval, output;\n\nset address 4095, eval, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B101010101000, tick, output; tock, output;\nset address %B101010101001, tick, output, tock, output;\nset address %B101010101010, tick, output, tock, output;\nset address %B101010101011, tick, output, tock, output;\nset address %B101010101100, tick, output, tock, output;\nset address %B101010101101, tick, output, tock, output;\nset address %B101010101110, tick, output, tock, output;\nset address %B101010101111, tick, output, tock, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101000, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101001, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101010, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101011, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101100, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101111, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101010101, tick, output; tock, output;\nset address %B001101010101, tick, output, tock, output;\nset address %B010101010101, tick, output, tock, output;\nset address %B011101010101, tick, output, tock, output;\nset address %B100101010101, tick, output, tock, output;\nset address %B101101010101, tick, output, tock, output;\nset address %B110101010101, tick, output, tock, output;\nset address %B111101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B000101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B000101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B001101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B011101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B100101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B101101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B111101010101, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;`;\nexport const cmp = `| time | in |load |address | out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 1111 | 0 | 0 | 0 |\n| 3 | 1111 | 0 | 0 | 0 |\n| 3+ | 1111 | 1 | 1111 | 0 |\n| 4 | 1111 | 1 | 1111 | 1111 |\n| 4+ | 1111 | 0 | 0 | 0 |\n| 5 | 1111 | 0 | 0 | 0 |\n| 5+ | 3513 | 0 | 3513 | 0 |\n| 6 | 3513 | 0 | 3513 | 0 |\n| 6+ | 3513 | 1 | 3513 | 0 |\n| 7 | 3513 | 1 | 3513 | 3513 |\n| 7+ | 3513 | 0 | 3513 | 3513 |\n| 8 | 3513 | 0 | 3513 | 3513 |\n| 8 | 3513 | 0 | 1111 | 1111 |\n| 8+ | 4095 | 0 | 1111 | 1111 |\n| 9 | 4095 | 0 | 1111 | 1111 |\n| 9+ | 4095 | 1 | 4095 | 0 |\n| 10 | 4095 | 1 | 4095 | 4095 |\n| 10+ | 4095 | 0 | 4095 | 4095 |\n| 11 | 4095 | 0 | 4095 | 4095 |\n| 11 | 4095 | 0 | 3513 | 3513 |\n| 11 | 4095 | 0 | 4095 | 4095 |\n| 11+ | 4095 | 0 | 2728 | 0 |\n| 12 | 4095 | 0 | 2728 | 0 |\n| 12 | 4095 | 0 | 2729 | 0 |\n| 12 | 4095 | 0 | 2730 | 0 |\n| 12 | 4095 | 0 | 2731 | 0 |\n| 12 | 4095 | 0 | 2732 | 0 |\n| 12 | 4095 | 0 | 2733 | 0 |\n| 12 | 4095 | 0 | 2734 | 0 |\n| 12 | 4095 | 0 | 2735 | 0 |\n| 12+ | 21845 | 1 | 2728 | 0 |\n| 13 | 21845 | 1 | 2728 | 21845 |\n| 13+ | 21845 | 1 | 2729 | 0 |\n| 14 | 21845 | 1 | 2729 | 21845 |\n| 14+ | 21845 | 1 | 2730 | 0 |\n| 15 | 21845 | 1 | 2730 | 21845 |\n| 15+ | 21845 | 1 | 2731 | 0 |\n| 16 | 21845 | 1 | 2731 | 21845 |\n| 16+ | 21845 | 1 | 2732 | 0 |\n| 17 | 21845 | 1 | 2732 | 21845 |\n| 17+ | 21845 | 1 | 2733 | 0 |\n| 18 | 21845 | 1 | 2733 | 21845 |\n| 18+ | 21845 | 1 | 2734 | 0 |\n| 19 | 21845 | 1 | 2734 | 21845 |\n| 19+ | 21845 | 1 | 2735 | 0 |\n| 20 | 21845 | 1 | 2735 | 21845 |\n| 20+ | 21845 | 0 | 2728 | 21845 |\n| 21 | 21845 | 0 | 2728 | 21845 |\n| 21 | 21845 | 0 | 2729 | 21845 |\n| 21 | 21845 | 0 | 2730 | 21845 |\n| 21 | 21845 | 0 | 2731 | 21845 |\n| 21 | 21845 | 0 | 2732 | 21845 |\n| 21 | 21845 | 0 | 2733 | 21845 |\n| 21 | 21845 | 0 | 2734 | 21845 |\n| 21 | 21845 | 0 | 2735 | 21845 |\n| 21+ | -21846 | 1 | 2728 | 21845 |\n| 22 | -21846 | 1 | 2728 | -21846 |\n| 22+ | -21846 | 0 | 2728 | -21846 |\n| 23 | -21846 | 0 | 2728 | -21846 |\n| 23 | -21846 | 0 | 2729 | 21845 |\n| 23 | -21846 | 0 | 2730 | 21845 |\n| 23 | -21846 | 0 | 2731 | 21845 |\n| 23 | -21846 | 0 | 2732 | 21845 |\n| 23 | -21846 | 0 | 2733 | 21845 |\n| 23 | -21846 | 0 | 2734 | 21845 |\n| 23 | -21846 | 0 | 2735 | 21845 |\n| 23+ | 21845 | 1 | 2728 | -21846 |\n| 24 | 21845 | 1 | 2728 | 21845 |\n| 24+ | -21846 | 1 | 2729 | 21845 |\n| 25 | -21846 | 1 | 2729 | -21846 |\n| 25+ | -21846 | 0 | 2728 | 21845 |\n| 26 | -21846 | 0 | 2728 | 21845 |\n| 26 | -21846 | 0 | 2729 | -21846 |\n| 26 | -21846 | 0 | 2730 | 21845 |\n| 26 | -21846 | 0 | 2731 | 21845 |\n| 26 | -21846 | 0 | 2732 | 21845 |\n| 26 | -21846 | 0 | 2733 | 21845 |\n| 26 | -21846 | 0 | 2734 | 21845 |\n| 26 | -21846 | 0 | 2735 | 21845 |\n| 26+ | 21845 | 1 | 2729 | -21846 |\n| 27 | 21845 | 1 | 2729 | 21845 |\n| 27+ | -21846 | 1 | 2730 | 21845 |\n| 28 | -21846 | 1 | 2730 | -21846 |\n| 28+ | -21846 | 0 | 2728 | 21845 |\n| 29 | -21846 | 0 | 2728 | 21845 |\n| 29 | -21846 | 0 | 2729 | 21845 |\n| 29 | -21846 | 0 | 2730 | -21846 |\n| 29 | -21846 | 0 | 2731 | 21845 |\n| 29 | -21846 | 0 | 2732 | 21845 |\n| 29 | -21846 | 0 | 2733 | 21845 |\n| 29 | -21846 | 0 | 2734 | 21845 |\n| 29 | -21846 | 0 | 2735 | 21845 |\n| 29+ | 21845 | 1 | 2730 | -21846 |\n| 30 | 21845 | 1 | 2730 | 21845 |\n| 30+ | -21846 | 1 | 2731 | 21845 |\n| 31 | -21846 | 1 | 2731 | -21846 |\n| 31+ | -21846 | 0 | 2728 | 21845 |\n| 32 | -21846 | 0 | 2728 | 21845 |\n| 32 | -21846 | 0 | 2729 | 21845 |\n| 32 | -21846 | 0 | 2730 | 21845 |\n| 32 | -21846 | 0 | 2731 | -21846 |\n| 32 | -21846 | 0 | 2732 | 21845 |\n| 32 | -21846 | 0 | 2733 | 21845 |\n| 32 | -21846 | 0 | 2734 | 21845 |\n| 32 | -21846 | 0 | 2735 | 21845 |\n| 32+ | 21845 | 1 | 2731 | -21846 |\n| 33 | 21845 | 1 | 2731 | 21845 |\n| 33+ | -21846 | 1 | 2732 | 21845 |\n| 34 | -21846 | 1 | 2732 | -21846 |\n| 34+ | -21846 | 0 | 2728 | 21845 |\n| 35 | -21846 | 0 | 2728 | 21845 |\n| 35 | -21846 | 0 | 2729 | 21845 |\n| 35 | -21846 | 0 | 2730 | 21845 |\n| 35 | -21846 | 0 | 2731 | 21845 |\n| 35 | -21846 | 0 | 2732 | -21846 |\n| 35 | -21846 | 0 | 2733 | 21845 |\n| 35 | -21846 | 0 | 2734 | 21845 |\n| 35 | -21846 | 0 | 2735 | 21845 |\n| 35+ | 21845 | 1 | 2732 | -21846 |\n| 36 | 21845 | 1 | 2732 | 21845 |\n| 36+ | -21846 | 1 | 2733 | 21845 |\n| 37 | -21846 | 1 | 2733 | -21846 |\n| 37+ | -21846 | 0 | 2728 | 21845 |\n| 38 | -21846 | 0 | 2728 | 21845 |\n| 38 | -21846 | 0 | 2729 | 21845 |\n| 38 | -21846 | 0 | 2730 | 21845 |\n| 38 | -21846 | 0 | 2731 | 21845 |\n| 38 | -21846 | 0 | 2732 | 21845 |\n| 38 | -21846 | 0 | 2733 | -21846 |\n| 38 | -21846 | 0 | 2734 | 21845 |\n| 38 | -21846 | 0 | 2735 | 21845 |\n| 38+ | 21845 | 1 | 2733 | -21846 |\n| 39 | 21845 | 1 | 2733 | 21845 |\n| 39+ | -21846 | 1 | 2734 | 21845 |\n| 40 | -21846 | 1 | 2734 | -21846 |\n| 40+ | -21846 | 0 | 2728 | 21845 |\n| 41 | -21846 | 0 | 2728 | 21845 |\n| 41 | -21846 | 0 | 2729 | 21845 |\n| 41 | -21846 | 0 | 2730 | 21845 |\n| 41 | -21846 | 0 | 2731 | 21845 |\n| 41 | -21846 | 0 | 2732 | 21845 |\n| 41 | -21846 | 0 | 2733 | 21845 |\n| 41 | -21846 | 0 | 2734 | -21846 |\n| 41 | -21846 | 0 | 2735 | 21845 |\n| 41+ | 21845 | 1 | 2734 | -21846 |\n| 42 | 21845 | 1 | 2734 | 21845 |\n| 42+ | -21846 | 1 | 2735 | 21845 |\n| 43 | -21846 | 1 | 2735 | -21846 |\n| 43+ | -21846 | 0 | 2728 | 21845 |\n| 44 | -21846 | 0 | 2728 | 21845 |\n| 44 | -21846 | 0 | 2729 | 21845 |\n| 44 | -21846 | 0 | 2730 | 21845 |\n| 44 | -21846 | 0 | 2731 | 21845 |\n| 44 | -21846 | 0 | 2732 | 21845 |\n| 44 | -21846 | 0 | 2733 | 21845 |\n| 44 | -21846 | 0 | 2734 | 21845 |\n| 44 | -21846 | 0 | 2735 | -21846 |\n| 44+ | 21845 | 1 | 2735 | -21846 |\n| 45 | 21845 | 1 | 2735 | 21845 |\n| 45+ | 21845 | 0 | 2728 | 21845 |\n| 46 | 21845 | 0 | 2728 | 21845 |\n| 46 | 21845 | 0 | 2729 | 21845 |\n| 46 | 21845 | 0 | 2730 | 21845 |\n| 46 | 21845 | 0 | 2731 | 21845 |\n| 46 | 21845 | 0 | 2732 | 21845 |\n| 46 | 21845 | 0 | 2733 | 21845 |\n| 46 | 21845 | 0 | 2734 | 21845 |\n| 46 | 21845 | 0 | 2735 | 21845 |\n| 46+ | 21845 | 0 | 341 | 0 |\n| 47 | 21845 | 0 | 341 | 0 |\n| 47 | 21845 | 0 | 853 | 0 |\n| 47 | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 1877 | 0 |\n| 47 | 21845 | 0 | 2389 | 0 |\n| 47 | 21845 | 0 | 2901 | 0 |\n| 47 | 21845 | 0 | 3413 | 0 |\n| 47 | 21845 | 0 | 3925 | 0 |\n| 47+ | 21845 | 1 | 341 | 0 |\n| 48 | 21845 | 1 | 341 | 21845 |\n| 48+ | 21845 | 1 | 853 | 0 |\n| 49 | 21845 | 1 | 853 | 21845 |\n| 49+ | 21845 | 1 | 1365 | 0 |\n| 50 | 21845 | 1 | 1365 | 21845 |\n| 50+ | 21845 | 1 | 1877 | 0 |\n| 51 | 21845 | 1 | 1877 | 21845 |\n| 51+ | 21845 | 1 | 2389 | 0 |\n| 52 | 21845 | 1 | 2389 | 21845 |\n| 52+ | 21845 | 1 | 2901 | 0 |\n| 53 | 21845 | 1 | 2901 | 21845 |\n| 53+ | 21845 | 1 | 3413 | 0 |\n| 54 | 21845 | 1 | 3413 | 21845 |\n| 54+ | 21845 | 1 | 3925 | 0 |\n| 55 | 21845 | 1 | 3925 | 21845 |\n| 55+ | 21845 | 0 | 341 | 21845 |\n| 56 | 21845 | 0 | 341 | 21845 |\n| 56 | 21845 | 0 | 853 | 21845 |\n| 56 | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 1877 | 21845 |\n| 56 | 21845 | 0 | 2389 | 21845 |\n| 56 | 21845 | 0 | 2901 | 21845 |\n| 56 | 21845 | 0 | 3413 | 21845 |\n| 56 | 21845 | 0 | 3925 | 21845 |\n| 56+ | -21846 | 1 | 341 | 21845 |\n| 57 | -21846 | 1 | 341 | -21846 |\n| 57+ | -21846 | 0 | 341 | -21846 |\n| 58 | -21846 | 0 | 341 | -21846 |\n| 58 | -21846 | 0 | 853 | 21845 |\n| 58 | -21846 | 0 | 1365 | 21845 |\n| 58 | -21846 | 0 | 1877 | 21845 |\n| 58 | -21846 | 0 | 2389 | 21845 |\n| 58 | -21846 | 0 | 2901 | 21845 |\n| 58 | -21846 | 0 | 3413 | 21845 |\n| 58 | -21846 | 0 | 3925 | 21845 |\n| 58+ | 21845 | 1 | 341 | -21846 |\n| 59 | 21845 | 1 | 341 | 21845 |\n| 59+ | -21846 | 1 | 853 | 21845 |\n| 60 | -21846 | 1 | 853 | -21846 |\n| 60+ | -21846 | 0 | 341 | 21845 |\n| 61 | -21846 | 0 | 341 | 21845 |\n| 61 | -21846 | 0 | 853 | -21846 |\n| 61 | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 1877 | 21845 |\n| 61 | -21846 | 0 | 2389 | 21845 |\n| 61 | -21846 | 0 | 2901 | 21845 |\n| 61 | -21846 | 0 | 3413 | 21845 |\n| 61 | -21846 | 0 | 3925 | 21845 |\n| 61+ | 21845 | 1 | 853 | -21846 |\n| 62 | 21845 | 1 | 853 | 21845 |\n| 62+ | -21846 | 1 | 1365 | 21845 |\n| 63 | -21846 | 1 | 1365 | -21846 |\n| 63+ | -21846 | 0 | 341 | 21845 |\n| 64 | -21846 | 0 | 341 | 21845 |\n| 64 | -21846 | 0 | 853 | 21845 |\n| 64 | -21846 | 0 | 1365 | -21846 |\n| 64 | -21846 | 0 | 1877 | 21845 |\n| 64 | -21846 | 0 | 2389 | 21845 |\n| 64 | -21846 | 0 | 2901 | 21845 |\n| 64 | -21846 | 0 | 3413 | 21845 |\n| 64 | -21846 | 0 | 3925 | 21845 |\n| 64+ | 21845 | 1 | 1365 | -21846 |\n| 65 | 21845 | 1 | 1365 | 21845 |\n| 65+ | -21846 | 1 | 1877 | 21845 |\n| 66 | -21846 | 1 | 1877 | -21846 |\n| 66+ | -21846 | 0 | 341 | 21845 |\n| 67 | -21846 | 0 | 341 | 21845 |\n| 67 | -21846 | 0 | 853 | 21845 |\n| 67 | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 1877 | -21846 |\n| 67 | -21846 | 0 | 2389 | 21845 |\n| 67 | -21846 | 0 | 2901 | 21845 |\n| 67 | -21846 | 0 | 3413 | 21845 |\n| 67 | -21846 | 0 | 3925 | 21845 |\n| 67+ | 21845 | 1 | 1877 | -21846 |\n| 68 | 21845 | 1 | 1877 | 21845 |\n| 68+ | -21846 | 1 | 2389 | 21845 |\n| 69 | -21846 | 1 | 2389 | -21846 |\n| 69+ | -21846 | 0 | 341 | 21845 |\n| 70 | -21846 | 0 | 341 | 21845 |\n| 70 | -21846 | 0 | 853 | 21845 |\n| 70 | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 1877 | 21845 |\n| 70 | -21846 | 0 | 2389 | -21846 |\n| 70 | -21846 | 0 | 2901 | 21845 |\n| 70 | -21846 | 0 | 3413 | 21845 |\n| 70 | -21846 | 0 | 3925 | 21845 |\n| 70+ | 21845 | 1 | 2389 | -21846 |\n| 71 | 21845 | 1 | 2389 | 21845 |\n| 71+ | -21846 | 1 | 2901 | 21845 |\n| 72 | -21846 | 1 | 2901 | -21846 |\n| 72+ | -21846 | 0 | 341 | 21845 |\n| 73 | -21846 | 0 | 341 | 21845 |\n| 73 | -21846 | 0 | 853 | 21845 |\n| 73 | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 1877 | 21845 |\n| 73 | -21846 | 0 | 2389 | 21845 |\n| 73 | -21846 | 0 | 2901 | -21846 |\n| 73 | -21846 | 0 | 3413 | 21845 |\n| 73 | -21846 | 0 | 3925 | 21845 |\n| 73+ | 21845 | 1 | 2901 | -21846 |\n| 74 | 21845 | 1 | 2901 | 21845 |\n| 74+ | -21846 | 1 | 3413 | 21845 |\n| 75 | -21846 | 1 | 3413 | -21846 |\n| 75+ | -21846 | 0 | 341 | 21845 |\n| 76 | -21846 | 0 | 341 | 21845 |\n| 76 | -21846 | 0 | 853 | 21845 |\n| 76 | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 1877 | 21845 |\n| 76 | -21846 | 0 | 2389 | 21845 |\n| 76 | -21846 | 0 | 2901 | 21845 |\n| 76 | -21846 | 0 | 3413 | -21846 |\n| 76 | -21846 | 0 | 3925 | 21845 |\n| 76+ | 21845 | 1 | 3413 | -21846 |\n| 77 | 21845 | 1 | 3413 | 21845 |\n| 77+ | -21846 | 1 | 3925 | 21845 |\n| 78 | -21846 | 1 | 3925 | -21846 |\n| 78+ | -21846 | 0 | 341 | 21845 |\n| 79 | -21846 | 0 | 341 | 21845 |\n| 79 | -21846 | 0 | 853 | 21845 |\n| 79 | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 1877 | 21845 |\n| 79 | -21846 | 0 | 2389 | 21845 |\n| 79 | -21846 | 0 | 2901 | 21845 |\n| 79 | -21846 | 0 | 3413 | 21845 |\n| 79 | -21846 | 0 | 3925 | -21846 |\n| 79+ | 21845 | 1 | 3925 | -21846 |\n| 80 | 21845 | 1 | 3925 | 21845 |\n| 80+ | 21845 | 0 | 341 | 21845 |\n| 81 | 21845 | 0 | 341 | 21845 |\n| 81 | 21845 | 0 | 853 | 21845 |\n| 81 | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 1877 | 21845 |\n| 81 | 21845 | 0 | 2389 | 21845 |\n| 81 | 21845 | 0 | 2901 | 21845 |\n| 81 | 21845 | 0 | 3413 | 21845 |\n| 81 | 21845 | 0 | 3925 | 21845 |`;\n","export const hdl = `\nCHIP RAM16K {\n IN in[16], load, address[14];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.5.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 4321, set load 0, tick, output; tock, output;\nset load 1, set address 4321, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 12345, set address 12345, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 4321, eval, output;\n\nset in 16383, tick, output; tock, output;\nset load 1, set address 16383, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 12345, eval, output;\nset address 16383, eval, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set in %B0101010101010101, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, tick, output, tock, output;\nset address %B10101010101010, tick, output, tock, output;\nset address %B10101010101011, tick, output, tock, output;\nset address %B10101010101100, tick, output, tock, output;\nset address %B10101010101101, tick, output, tock, output;\nset address %B10101010101110, tick, output, tock, output;\nset address %B10101010101111, tick, output, tock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101000, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101001, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101010, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1;\nset address %B10101010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101011, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0, set address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101100, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101111, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101111, set in %B0101010101010101, tick, output, tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, tick, output, tock, output;\nset address %B01010101010101, tick, output, tock, output;\nset address %B01110101010101, tick, output, tock, output;\nset address %B10010101010101, tick, output, tock, output;\nset address %B10110101010101, tick, output, tock, output;\nset address %B11010101010101, tick, output, tock, output;\nset address %B11110101010101, tick, output, tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00010101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B00110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B01010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B01010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B01110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B01110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B10010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B10110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B11010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B11010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B11110101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B11110101010101, set in %B0101010101010101, tick, output, tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;`;\nexport const cmp = `| time | in |load | address | out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 4321 | 0 | 0 | 0 |\n| 3 | 4321 | 0 | 0 | 0 |\n| 3+ | 4321 | 1 | 4321 | 0 |\n| 4 | 4321 | 1 | 4321 | 4321 |\n| 4+ | 4321 | 0 | 0 | 0 |\n| 5 | 4321 | 0 | 0 | 0 |\n| 5+ | 12345 | 0 | 12345 | 0 |\n| 6 | 12345 | 0 | 12345 | 0 |\n| 6+ | 12345 | 1 | 12345 | 0 |\n| 7 | 12345 | 1 | 12345 | 12345 |\n| 7+ | 12345 | 0 | 12345 | 12345 |\n| 8 | 12345 | 0 | 12345 | 12345 |\n| 8 | 12345 | 0 | 4321 | 4321 |\n| 8+ | 16383 | 0 | 4321 | 4321 |\n| 9 | 16383 | 0 | 4321 | 4321 |\n| 9+ | 16383 | 1 | 16383 | 0 |\n| 10 | 16383 | 1 | 16383 | 16383 |\n| 10+ | 16383 | 0 | 16383 | 16383 |\n| 11 | 16383 | 0 | 16383 | 16383 |\n| 11 | 16383 | 0 | 12345 | 12345 |\n| 11 | 16383 | 0 | 16383 | 16383 |\n| 11+ | 16383 | 0 | 10920 | 0 |\n| 12 | 16383 | 0 | 10920 | 0 |\n| 12 | 16383 | 0 | 10921 | 0 |\n| 12 | 16383 | 0 | 10922 | 0 |\n| 12 | 16383 | 0 | 10923 | 0 |\n| 12 | 16383 | 0 | 10924 | 0 |\n| 12 | 16383 | 0 | 10925 | 0 |\n| 12 | 16383 | 0 | 10926 | 0 |\n| 12 | 16383 | 0 | 10927 | 0 |\n| 12+ | 21845 | 1 | 10920 | 0 |\n| 13 | 21845 | 1 | 10920 | 21845 |\n| 13+ | 21845 | 1 | 10921 | 0 |\n| 14 | 21845 | 1 | 10921 | 21845 |\n| 14+ | 21845 | 1 | 10922 | 0 |\n| 15 | 21845 | 1 | 10922 | 21845 |\n| 15+ | 21845 | 1 | 10923 | 0 |\n| 16 | 21845 | 1 | 10923 | 21845 |\n| 16+ | 21845 | 1 | 10924 | 0 |\n| 17 | 21845 | 1 | 10924 | 21845 |\n| 17+ | 21845 | 1 | 10925 | 0 |\n| 18 | 21845 | 1 | 10925 | 21845 |\n| 18+ | 21845 | 1 | 10926 | 0 |\n| 19 | 21845 | 1 | 10926 | 21845 |\n| 19+ | 21845 | 1 | 10927 | 0 |\n| 20 | 21845 | 1 | 10927 | 21845 |\n| 20+ | 21845 | 0 | 10920 | 21845 |\n| 21 | 21845 | 0 | 10920 | 21845 |\n| 21 | 21845 | 0 | 10921 | 21845 |\n| 21 | 21845 | 0 | 10922 | 21845 |\n| 21 | 21845 | 0 | 10923 | 21845 |\n| 21 | 21845 | 0 | 10924 | 21845 |\n| 21 | 21845 | 0 | 10925 | 21845 |\n| 21 | 21845 | 0 | 10926 | 21845 |\n| 21 | 21845 | 0 | 10927 | 21845 |\n| 21+ | -21846 | 1 | 10920 | 21845 |\n| 22 | -21846 | 1 | 10920 | -21846 |\n| 22+ | -21846 | 0 | 10920 | -21846 |\n| 23 | -21846 | 0 | 10920 | -21846 |\n| 23 | -21846 | 0 | 10921 | 21845 |\n| 23 | -21846 | 0 | 10922 | 21845 |\n| 23 | -21846 | 0 | 10923 | 21845 |\n| 23 | -21846 | 0 | 10924 | 21845 |\n| 23 | -21846 | 0 | 10925 | 21845 |\n| 23 | -21846 | 0 | 10926 | 21845 |\n| 23 | -21846 | 0 | 10927 | 21845 |\n| 23+ | 21845 | 1 | 10920 | -21846 |\n| 24 | 21845 | 1 | 10920 | 21845 |\n| 24+ | -21846 | 1 | 10921 | 21845 |\n| 25 | -21846 | 1 | 10921 | -21846 |\n| 25+ | -21846 | 0 | 10920 | 21845 |\n| 26 | -21846 | 0 | 10920 | 21845 |\n| 26 | -21846 | 0 | 10921 | -21846 |\n| 26 | -21846 | 0 | 10922 | 21845 |\n| 26 | -21846 | 0 | 10923 | 21845 |\n| 26 | -21846 | 0 | 10924 | 21845 |\n| 26 | -21846 | 0 | 10925 | 21845 |\n| 26 | -21846 | 0 | 10926 | 21845 |\n| 26 | -21846 | 0 | 10927 | 21845 |\n| 26+ | 21845 | 1 | 10921 | -21846 |\n| 27 | 21845 | 1 | 10921 | 21845 |\n| 27+ | -21846 | 1 | 10922 | 21845 |\n| 28 | -21846 | 1 | 10922 | -21846 |\n| 28+ | -21846 | 0 | 10920 | 21845 |\n| 29 | -21846 | 0 | 10920 | 21845 |\n| 29 | -21846 | 0 | 10921 | 21845 |\n| 29 | -21846 | 0 | 10922 | -21846 |\n| 29 | -21846 | 0 | 10923 | 21845 |\n| 29 | -21846 | 0 | 10924 | 21845 |\n| 29 | -21846 | 0 | 10925 | 21845 |\n| 29 | -21846 | 0 | 10926 | 21845 |\n| 29 | -21846 | 0 | 10927 | 21845 |\n| 29+ | 21845 | 1 | 10922 | -21846 |\n| 30 | 21845 | 1 | 10922 | 21845 |\n| 30+ | -21846 | 1 | 10923 | 21845 |\n| 31 | -21846 | 1 | 10923 | -21846 |\n| 31+ | -21846 | 0 | 10920 | 21845 |\n| 32 | -21846 | 0 | 10920 | 21845 |\n| 32 | -21846 | 0 | 10921 | 21845 |\n| 32 | -21846 | 0 | 10922 | 21845 |\n| 32 | -21846 | 0 | 10923 | -21846 |\n| 32 | -21846 | 0 | 10924 | 21845 |\n| 32 | -21846 | 0 | 10925 | 21845 |\n| 32 | -21846 | 0 | 10926 | 21845 |\n| 32 | -21846 | 0 | 10927 | 21845 |\n| 32+ | 21845 | 1 | 10923 | -21846 |\n| 33 | 21845 | 1 | 10923 | 21845 |\n| 33+ | -21846 | 1 | 10924 | 21845 |\n| 34 | -21846 | 1 | 10924 | -21846 |\n| 34+ | -21846 | 0 | 10920 | 21845 |\n| 35 | -21846 | 0 | 10920 | 21845 |\n| 35 | -21846 | 0 | 10921 | 21845 |\n| 35 | -21846 | 0 | 10922 | 21845 |\n| 35 | -21846 | 0 | 10923 | 21845 |\n| 35 | -21846 | 0 | 10924 | -21846 |\n| 35 | -21846 | 0 | 10925 | 21845 |\n| 35 | -21846 | 0 | 10926 | 21845 |\n| 35 | -21846 | 0 | 10927 | 21845 |\n| 35+ | 21845 | 1 | 10924 | -21846 |\n| 36 | 21845 | 1 | 10924 | 21845 |\n| 36+ | -21846 | 1 | 10925 | 21845 |\n| 37 | -21846 | 1 | 10925 | -21846 |\n| 37+ | -21846 | 0 | 10920 | 21845 |\n| 38 | -21846 | 0 | 10920 | 21845 |\n| 38 | -21846 | 0 | 10921 | 21845 |\n| 38 | -21846 | 0 | 10922 | 21845 |\n| 38 | -21846 | 0 | 10923 | 21845 |\n| 38 | -21846 | 0 | 10924 | 21845 |\n| 38 | -21846 | 0 | 10925 | -21846 |\n| 38 | -21846 | 0 | 10926 | 21845 |\n| 38 | -21846 | 0 | 10927 | 21845 |\n| 38+ | 21845 | 1 | 10925 | -21846 |\n| 39 | 21845 | 1 | 10925 | 21845 |\n| 39+ | -21846 | 1 | 10926 | 21845 |\n| 40 | -21846 | 1 | 10926 | -21846 |\n| 40+ | -21846 | 0 | 10920 | 21845 |\n| 41 | -21846 | 0 | 10920 | 21845 |\n| 41 | -21846 | 0 | 10921 | 21845 |\n| 41 | -21846 | 0 | 10922 | 21845 |\n| 41 | -21846 | 0 | 10923 | 21845 |\n| 41 | -21846 | 0 | 10924 | 21845 |\n| 41 | -21846 | 0 | 10925 | 21845 |\n| 41 | -21846 | 0 | 10926 | -21846 |\n| 41 | -21846 | 0 | 10927 | 21845 |\n| 41+ | 21845 | 1 | 10926 | -21846 |\n| 42 | 21845 | 1 | 10926 | 21845 |\n| 42+ | -21846 | 1 | 10927 | 21845 |\n| 43 | -21846 | 1 | 10927 | -21846 |\n| 43+ | -21846 | 0 | 10920 | 21845 |\n| 44 | -21846 | 0 | 10920 | 21845 |\n| 44 | -21846 | 0 | 10921 | 21845 |\n| 44 | -21846 | 0 | 10922 | 21845 |\n| 44 | -21846 | 0 | 10923 | 21845 |\n| 44 | -21846 | 0 | 10924 | 21845 |\n| 44 | -21846 | 0 | 10925 | 21845 |\n| 44 | -21846 | 0 | 10926 | 21845 |\n| 44 | -21846 | 0 | 10927 | -21846 |\n| 44+ | 21845 | 1 | 10927 | -21846 |\n| 45 | 21845 | 1 | 10927 | 21845 |\n| 45+ | 21845 | 0 | 10920 | 21845 |\n| 46 | 21845 | 0 | 10920 | 21845 |\n| 46 | 21845 | 0 | 10921 | 21845 |\n| 46 | 21845 | 0 | 10922 | 21845 |\n| 46 | 21845 | 0 | 10923 | 21845 |\n| 46 | 21845 | 0 | 10924 | 21845 |\n| 46 | 21845 | 0 | 10925 | 21845 |\n| 46 | 21845 | 0 | 10926 | 21845 |\n| 46 | 21845 | 0 | 10927 | 21845 |\n| 46+ | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 3413 | 0 |\n| 47 | 21845 | 0 | 5461 | 0 |\n| 47 | 21845 | 0 | 7509 | 0 |\n| 47 | 21845 | 0 | 9557 | 0 |\n| 47 | 21845 | 0 | 11605 | 0 |\n| 47 | 21845 | 0 | 13653 | 0 |\n| 47 | 21845 | 0 | 15701 | 0 |\n| 47+ | 21845 | 1 | 1365 | 0 |\n| 48 | 21845 | 1 | 1365 | 21845 |\n| 48+ | 21845 | 1 | 3413 | 0 |\n| 49 | 21845 | 1 | 3413 | 21845 |\n| 49+ | 21845 | 1 | 5461 | 0 |\n| 50 | 21845 | 1 | 5461 | 21845 |\n| 50+ | 21845 | 1 | 7509 | 0 |\n| 51 | 21845 | 1 | 7509 | 21845 |\n| 51+ | 21845 | 1 | 9557 | 0 |\n| 52 | 21845 | 1 | 9557 | 21845 |\n| 52+ | 21845 | 1 | 11605 | 0 |\n| 53 | 21845 | 1 | 11605 | 21845 |\n| 53+ | 21845 | 1 | 13653 | 0 |\n| 54 | 21845 | 1 | 13653 | 21845 |\n| 54+ | 21845 | 1 | 15701 | 0 |\n| 55 | 21845 | 1 | 15701 | 21845 |\n| 55+ | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 3413 | 21845 |\n| 56 | 21845 | 0 | 5461 | 21845 |\n| 56 | 21845 | 0 | 7509 | 21845 |\n| 56 | 21845 | 0 | 9557 | 21845 |\n| 56 | 21845 | 0 | 11605 | 21845 |\n| 56 | 21845 | 0 | 13653 | 21845 |\n| 56 | 21845 | 0 | 15701 | 21845 |\n| 56+ | -21846 | 1 | 1365 | 21845 |\n| 57 | -21846 | 1 | 1365 | -21846 |\n| 57+ | -21846 | 0 | 1365 | -21846 |\n| 58 | -21846 | 0 | 1365 | -21846 |\n| 58 | -21846 | 0 | 3413 | 21845 |\n| 58 | -21846 | 0 | 5461 | 21845 |\n| 58 | -21846 | 0 | 7509 | 21845 |\n| 58 | -21846 | 0 | 9557 | 21845 |\n| 58 | -21846 | 0 | 11605 | 21845 |\n| 58 | -21846 | 0 | 13653 | 21845 |\n| 58 | -21846 | 0 | 15701 | 21845 |\n| 58+ | 21845 | 1 | 1365 | -21846 |\n| 59 | 21845 | 1 | 1365 | 21845 |\n| 59+ | -21846 | 1 | 3413 | 21845 |\n| 60 | -21846 | 1 | 3413 | -21846 |\n| 60+ | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 3413 | -21846 |\n| 61 | -21846 | 0 | 5461 | 21845 |\n| 61 | -21846 | 0 | 7509 | 21845 |\n| 61 | -21846 | 0 | 9557 | 21845 |\n| 61 | -21846 | 0 | 11605 | 21845 |\n| 61 | -21846 | 0 | 13653 | 21845 |\n| 61 | -21846 | 0 | 15701 | 21845 |\n| 61+ | 21845 | 1 | 3413 | -21846 |\n| 62 | 21845 | 1 | 3413 | 21845 |\n| 62+ | -21846 | 1 | 5461 | 21845 |\n| 63 | -21846 | 1 | 5461 | -21846 |\n| 63+ | -21846 | 0 | 1365 | 21845 |\n| 64 | -21846 | 0 | 1365 | 21845 |\n| 64 | -21846 | 0 | 3413 | 21845 |\n| 64 | -21846 | 0 | 5461 | -21846 |\n| 64 | -21846 | 0 | 7509 | 21845 |\n| 64 | -21846 | 0 | 9557 | 21845 |\n| 64 | -21846 | 0 | 11605 | 21845 |\n| 64 | -21846 | 0 | 13653 | 21845 |\n| 64 | -21846 | 0 | 15701 | 21845 |\n| 64+ | 21845 | 1 | 5461 | -21846 |\n| 65 | 21845 | 1 | 5461 | 21845 |\n| 65+ | -21846 | 1 | 7509 | 21845 |\n| 66 | -21846 | 1 | 7509 | -21846 |\n| 66+ | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 3413 | 21845 |\n| 67 | -21846 | 0 | 5461 | 21845 |\n| 67 | -21846 | 0 | 7509 | -21846 |\n| 67 | -21846 | 0 | 9557 | 21845 |\n| 67 | -21846 | 0 | 11605 | 21845 |\n| 67 | -21846 | 0 | 13653 | 21845 |\n| 67 | -21846 | 0 | 15701 | 21845 |\n| 67+ | 21845 | 1 | 7509 | -21846 |\n| 68 | 21845 | 1 | 7509 | 21845 |\n| 68+ | -21846 | 1 | 9557 | 21845 |\n| 69 | -21846 | 1 | 9557 | -21846 |\n| 69+ | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 3413 | 21845 |\n| 70 | -21846 | 0 | 5461 | 21845 |\n| 70 | -21846 | 0 | 7509 | 21845 |\n| 70 | -21846 | 0 | 9557 | -21846 |\n| 70 | -21846 | 0 | 11605 | 21845 |\n| 70 | -21846 | 0 | 13653 | 21845 |\n| 70 | -21846 | 0 | 15701 | 21845 |\n| 70+ | 21845 | 1 | 9557 | -21846 |\n| 71 | 21845 | 1 | 9557 | 21845 |\n| 71+ | -21846 | 1 | 11605 | 21845 |\n| 72 | -21846 | 1 | 11605 | -21846 |\n| 72+ | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 3413 | 21845 |\n| 73 | -21846 | 0 | 5461 | 21845 |\n| 73 | -21846 | 0 | 7509 | 21845 |\n| 73 | -21846 | 0 | 9557 | 21845 |\n| 73 | -21846 | 0 | 11605 | -21846 |\n| 73 | -21846 | 0 | 13653 | 21845 |\n| 73 | -21846 | 0 | 15701 | 21845 |\n| 73+ | 21845 | 1 | 11605 | -21846 |\n| 74 | 21845 | 1 | 11605 | 21845 |\n| 74+ | -21846 | 1 | 13653 | 21845 |\n| 75 | -21846 | 1 | 13653 | -21846 |\n| 75+ | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 3413 | 21845 |\n| 76 | -21846 | 0 | 5461 | 21845 |\n| 76 | -21846 | 0 | 7509 | 21845 |\n| 76 | -21846 | 0 | 9557 | 21845 |\n| 76 | -21846 | 0 | 11605 | 21845 |\n| 76 | -21846 | 0 | 13653 | -21846 |\n| 76 | -21846 | 0 | 15701 | 21845 |\n| 76+ | 21845 | 1 | 13653 | -21846 |\n| 77 | 21845 | 1 | 13653 | 21845 |\n| 77+ | -21846 | 1 | 15701 | 21845 |\n| 78 | -21846 | 1 | 15701 | -21846 |\n| 78+ | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 3413 | 21845 |\n| 79 | -21846 | 0 | 5461 | 21845 |\n| 79 | -21846 | 0 | 7509 | 21845 |\n| 79 | -21846 | 0 | 9557 | 21845 |\n| 79 | -21846 | 0 | 11605 | 21845 |\n| 79 | -21846 | 0 | 13653 | 21845 |\n| 79 | -21846 | 0 | 15701 | -21846 |\n| 79+ | 21845 | 1 | 15701 | -21846 |\n| 80 | 21845 | 1 | 15701 | 21845 |\n| 80+ | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 3413 | 21845 |\n| 81 | 21845 | 0 | 5461 | 21845 |\n| 81 | 21845 | 0 | 7509 | 21845 |\n| 81 | 21845 | 0 | 9557 | 21845 |\n| 81 | 21845 | 0 | 11605 | 21845 |\n| 81 | 21845 | 0 | 13653 | 21845 |\n| 81 | 21845 | 0 | 15701 | 21845 |`;\n","export const hdl = `/**\n * The complete address space of the Hack computer's memory,\n * including RAM and memory-mapped I/O. \n * The chip facilitates read and write operations, as follows:\n * Read: out(t) = Memory[address(t)](t)\n * Write: if load(t-1) then Memory[address(t-1)](t) = in(t-1)\n * In words: the chip always outputs the value stored at the memory \n * location specified by address. If load==1, the in value is loaded \n * into the memory location specified by address. This value becomes \n * available through the out output from the next time step onward.\n * Address space rules:\n * Only the upper 16K+8K+1 words of the Memory chip are used. \n * Access to address>0x6000 is invalid. Access to any address in \n * the range 0x4000-0x5FFF results in accessing the screen memory \n * map. Access to address 0x6000 results in accessing the keyboard \n * memory map. The behavior in these addresses is described in the \n * Screen and Keyboard chip specifications given in the book.\n */\n\nCHIP Memory {\n IN in[16], load, address[15];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list in%D1.6.1 load%B2.1.2 address%B1.15.1 out%D1.6.1;\n\n// Set RAM[0] = -1\nset address 0,\nset in -1, set load 1, tick, output; tock, output;\n\n// RAM[0] holds value\nset in 9999, set load 0, tick, output; tock, output;\n\n// Did not also write to upper RAM or Screen\nset address %X2000, eval, output;\nset address %X4000, eval, output;\n\n// Set RAM[0x2000] = 2222\nset address %X2000,\nset in 2222, set load 1, tick, output; tock, output;\n\n// RAM[0x2000] holds value\nset in 9999, set load 0, tick, output; tock, output;\n\n// Did not also write to lower RAM or Screen\nset address 0, eval, output;\nset address %X4000, eval, output;\n\nset load 0,\t// Low order address bits connected\nset address %X0001, eval, output;\nset address %X0002, eval, output;\nset address %X0004, eval, output;\nset address %X0008, eval, output;\nset address %X0010, eval, output;\nset address %X0020, eval, output;\nset address %X0040, eval, output;\nset address %X0080, eval, output;\nset address %X0100, eval, output;\nset address %X0200, eval, output;\nset address %X0400, eval, output;\nset address %X0800, eval, output;\nset address %X1000, eval, output;\nset address %X2000, eval, output;\n\n// RAM[1234] = 1234\nset address %X1234,\nset in 1234, set load 1, tick, output; tock, output;\n\n// Did not also write to upper RAM or Screen \nset load 0,\nset address %X2234, eval, output;\nset address %X6234, eval, output;\n\n// RAM[0x2345] = 2345\nset address %X2345,\nset in 2345, set load 1, tick, output; tock, output;\n\n// Did not also write to lower RAM or Screen \nset load 0,\nset address %X0345, eval, output;\nset address %X4345, eval, output;\n\n// Keyboard test\n\n// set address 24576,\n// echo \"Click the Keyboard icon and hold down the 'K' key (uppercase) until you see the next message (it should appear shortly after that) ...\",\n// It's important to keep holding the key down since if the system is busy,\n// the memory will zero itself before being outputted.\n\n/*\nset Keyboard 'K';\nwhile out <> 75 {\n eval,\n}\nclear-echo, output;\noutput;\n*/\n\n// Screen test\n\nset load 1, set in -1, set address %X4FCF, tick, tock, output;\nset address %X504F, tick, tock, output;\n\n// Did not also write to lower or upper RAM\nset address %X0FCF, eval, output;\nset address %X2FCF, eval, output;\n\nset load 0,\t\t\t\t// Low order address bits connected\nset address %X4FCE, eval, output;\nset address %X4FCD, eval, output;\nset address %X4FCB, eval, output;\nset address %X4FC7, eval, output;\nset address %X4FDF, eval, output;\nset address %X4FEF, eval, output;\nset address %X4F8F, eval, output;\nset address %X4F4F, eval, output;\nset address %X4ECF, eval, output;\nset address %X4DCF, eval, output;\nset address %X4BCF, eval, output;\nset address %X47CF, eval, output;\nset address %X5FCF, eval, output;\n\n\nset load 0, set address 24576,\necho \"Make sure you see ONLY two horizontal lines in the middle of the screen. Change Keyboard to 'Y' (uppercase) to continue ...\";\n\n/*\nwhile out <> 89 {\n eval;\n}\n*/\nclear-echo;`;\nexport const cmp = `| in |load | address | out |\n| -1 | 1 | 000000000000000 | 0 |\n| -1 | 1 | 000000000000000 | -1 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 010000000000000 | 0 |\n| 9999 | 0 | 100000000000000 | 0 |\n| 2222 | 1 | 010000000000000 | 0 |\n| 2222 | 1 | 010000000000000 | 2222 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 100000000000000 | 0 |\n| 9999 | 0 | 000000000000001 | 0 |\n| 9999 | 0 | 000000000000010 | 0 |\n| 9999 | 0 | 000000000000100 | 0 |\n| 9999 | 0 | 000000000001000 | 0 |\n| 9999 | 0 | 000000000010000 | 0 |\n| 9999 | 0 | 000000000100000 | 0 |\n| 9999 | 0 | 000000001000000 | 0 |\n| 9999 | 0 | 000000010000000 | 0 |\n| 9999 | 0 | 000000100000000 | 0 |\n| 9999 | 0 | 000001000000000 | 0 |\n| 9999 | 0 | 000010000000000 | 0 |\n| 9999 | 0 | 000100000000000 | 0 |\n| 9999 | 0 | 001000000000000 | 0 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 1234 | 1 | 001001000110100 | 0 |\n| 1234 | 1 | 001001000110100 | 1234 |\n| 1234 | 0 | 010001000110100 | 0 |\n| 1234 | 0 | 110001000110100 | 0 |\n| 2345 | 1 | 010001101000101 | 0 |\n| 2345 | 1 | 010001101000101 | 2345 |\n| 2345 | 0 | 000001101000101 | 0 |\n| 2345 | 0 | 100001101000101 | 0 |\n| -1 | 1 | 100111111001111 | -1 |\n| -1 | 1 | 101000001001111 | -1 |\n| -1 | 1 | 000111111001111 | 0 |\n| -1 | 1 | 010111111001111 | 0 |\n| -1 | 0 | 100111111001110 | 0 |\n| -1 | 0 | 100111111001101 | 0 |\n| -1 | 0 | 100111111001011 | 0 |\n| -1 | 0 | 100111111000111 | 0 |\n| -1 | 0 | 100111111011111 | 0 |\n| -1 | 0 | 100111111101111 | 0 |\n| -1 | 0 | 100111110001111 | 0 |\n| -1 | 0 | 100111101001111 | 0 |\n| -1 | 0 | 100111011001111 | 0 |\n| -1 | 0 | 100110111001111 | 0 |\n| -1 | 0 | 100101111001111 | 0 |\n| -1 | 0 | 100011111001111 | 0 |\n| -1 | 0 | 101111111001111 | 0 |`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Memory from \"./01_memory.js\";\nimport * as CPU from \"./02_cpu.js\";\nimport * as Computer from \"./03_computer.js\";\n\nexport const CHIPS = {\n Memory: {\n \"Memory.hdl\": Memory.hdl,\n \"Memory.tst\": Memory.tst,\n \"Memory.cmp\": Memory.cmp,\n },\n CPU: {\n \"CPU.hdl\": CPU.hdl,\n \"CPU.tst\": CPU.tst,\n \"CPU.cmp\": CPU.cmp,\n },\n Computer: {\n \"Computer.hdl\": Computer.hdl,\n \"Computer.tst\": Computer.tst,\n \"Computer.cmp\": Computer.cmp,\n \"Max.hack\": Computer.hack,\n },\n};\n\nexport async function resetFiles(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/05\");\n await reset(fs, CHIPS);\n await fs.popd();\n}\n","export const hdl = `/**\n * The Hack CPU (Central Processing unit), consisting of an ALU,\n * two registers named A and D, and a program counter named PC.\n * The CPU is designed to fetch and execute instructions written in \n * the Hack machine language. In particular, functions as follows:\n * Executes the inputted instruction according to the Hack machine \n * language specification. The D and A in the language specification\n * refer to CPU-resident registers, while M refers to the external\n * memory location addressed by A, i.e. to Memory[A]. The inM input \n * holds the value of this location. If the current instruction needs \n * to write a value to M, the value is placed in outM, the address \n * of the target location is placed in the addressM output, and the \n * writeM control bit is asserted. (When writeM==0, any value may \n * appear in outM). The outM and writeM outputs are combinational: \n * they are affected instantaneously by the execution of the current \n * instruction. The addressM and pc outputs are clocked: although they \n * are affected by the execution of the current instruction, they commit \n * to their new values only in the next time step. If reset==1 then the \n * CPU jumps to address 0 (i.e. pc is set to 0 in next time step) rather \n * than to the address resulting from executing the current instruction. \n */\n\nCHIP CPU {\n\n IN inM[16], // M value input (M = contents of RAM[A])\n instruction[16], // Instruction for execution\n reset; // Signals whether to re-start the current\n // program (reset==1) or continue executing\n // the current program (reset==0).\n\n OUT outM[16], // M value output\n writeM, // Write to M? \n addressM[15], // Address in data memory (of M)\n pc[15]; // address of next instruction\n\n PARTS:\n}`;\nexport const tst = `output-list time%S0.4.0 inM%D0.6.0 instruction%B0.16.0 reset%B2.1.2 outM%D1.6.0 writeM%B3.1.3 addressM%D0.5.0 pc%D0.5.0 DRegister[]%D1.6.1;\n\n\nset instruction %B0011000000111001, // @12345\ntick, output, tock, output;\n\nset instruction %B1110110000010000, // D=A\ntick, output, tock, output;\n\nset instruction %B0101101110100000, // @23456\ntick, output, tock, output;\n\nset instruction %B1110000111010000, // D=A-D\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1110001100001000, // M=D\ntick, output, tock, output;\n\nset instruction %B0000001111101001, // @1001\ntick, output, tock, output;\n\nset instruction %B1110001110011000, // MD=D-1\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1111010011010000, // D=D-M\nset inM 11111,\ntick, output, tock, output;\n\nset instruction %B0000000000001110, // @14\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;jlt\ntick, output, tock, output;\n\nset instruction %B0000001111100111, // @999\ntick, output, tock, output;\n\nset instruction %B1110110111100000, // A=A+1\ntick, output, tock, output;\n\nset instruction %B1110001100001000, // M=D\ntick, output, tock, output;\n\nset instruction %B0000000000010101, // @21\ntick, output, tock, output;\n\nset instruction %B1110011111000010, // D+1;jeq\ntick, output, tock, output;\n\nset instruction %B0000000000000010, // @2\ntick, output, tock, output;\n\nset instruction %B1110000010010000, // D=D+A\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1110111010010000, // D=-1\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset instruction %B1110101010010000, // D=0\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset instruction %B1110111111010000, // D=1\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset reset 1;\ntick, output, tock, output;\n\nset instruction %B0111111111111111, // @32767\nset reset 0;\ntick, output, tock, output;`;\nexport const cmp = `|time| inM | instruction |reset| outM |writeM |addre| pc |DRegiste|\n|0+ | 0|0011000000111001| 0 |*******| 0 | 0| 0| 0 |\n|1 | 0|0011000000111001| 0 |*******| 0 |12345| 1| 0 |\n|1+ | 0|1110110000010000| 0 |*******| 0 |12345| 1| 0 |\n|2 | 0|1110110000010000| 0 |*******| 0 |12345| 2| 12345 |\n|2+ | 0|0101101110100000| 0 |*******| 0 |12345| 2| 12345 |\n|3 | 0|0101101110100000| 0 |*******| 0 |23456| 3| 12345 |\n|3+ | 0|1110000111010000| 0 |*******| 0 |23456| 3| 12345 |\n|4 | 0|1110000111010000| 0 |*******| 0 |23456| 4| 11111 |\n|4+ | 0|0000001111101000| 0 |*******| 0 |23456| 4| 11111 |\n|5 | 0|0000001111101000| 0 |*******| 0 | 1000| 5| 11111 |\n|5+ | 0|1110001100001000| 0 | 11111| 1 | 1000| 5| 11111 |\n|6 | 0|1110001100001000| 0 | 11111| 1 | 1000| 6| 11111 |\n|6+ | 0|0000001111101001| 0 |*******| 0 | 1000| 6| 11111 |\n|7 | 0|0000001111101001| 0 |*******| 0 | 1001| 7| 11111 |\n|7+ | 0|1110001110011000| 0 | 11110| 1 | 1001| 7| 11111 |\n|8 | 0|1110001110011000| 0 | 11109| 1 | 1001| 8| 11110 |\n|8+ | 0|0000001111101000| 0 |*******| 0 | 1001| 8| 11110 |\n|9 | 0|0000001111101000| 0 |*******| 0 | 1000| 9| 11110 |\n|9+ | 11111|1111010011010000| 0 |*******| 0 | 1000| 9| 11110 |\n|10 | 11111|1111010011010000| 0 |*******| 0 | 1000| 10| -1 |\n|10+ | 11111|0000000000001110| 0 |*******| 0 | 1000| 10| -1 |\n|11 | 11111|0000000000001110| 0 |*******| 0 | 14| 11| -1 |\n|11+ | 11111|1110001100000100| 0 |*******| 0 | 14| 11| -1 |\n|12 | 11111|1110001100000100| 0 |*******| 0 | 14| 14| -1 |\n|12+ | 11111|0000001111100111| 0 |*******| 0 | 14| 14| -1 |\n|13 | 11111|0000001111100111| 0 |*******| 0 | 999| 15| -1 |\n|13+ | 11111|1110110111100000| 0 |*******| 0 | 999| 15| -1 |\n|14 | 11111|1110110111100000| 0 |*******| 0 | 1000| 16| -1 |\n|14+ | 11111|1110001100001000| 0 | -1| 1 | 1000| 16| -1 |\n|15 | 11111|1110001100001000| 0 | -1| 1 | 1000| 17| -1 |\n|15+ | 11111|0000000000010101| 0 |*******| 0 | 1000| 17| -1 |\n|16 | 11111|0000000000010101| 0 |*******| 0 | 21| 18| -1 |\n|16+ | 11111|1110011111000010| 0 |*******| 0 | 21| 18| -1 |\n|17 | 11111|1110011111000010| 0 |*******| 0 | 21| 21| -1 |\n|17+ | 11111|0000000000000010| 0 |*******| 0 | 21| 21| -1 |\n|18 | 11111|0000000000000010| 0 |*******| 0 | 2| 22| -1 |\n|18+ | 11111|1110000010010000| 0 |*******| 0 | 2| 22| -1 |\n|19 | 11111|1110000010010000| 0 |*******| 0 | 2| 23| 1 |\n|19+ | 11111|0000001111101000| 0 |*******| 0 | 2| 23| 1 |\n|20 | 11111|0000001111101000| 0 |*******| 0 | 1000| 24| 1 |\n|20+ | 11111|1110111010010000| 0 |*******| 0 | 1000| 24| 1 |\n|21 | 11111|1110111010010000| 0 |*******| 0 | 1000| 25| -1 |\n|21+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 25| -1 |\n|22 | 11111|1110001100000001| 0 |*******| 0 | 1000| 26| -1 |\n|22+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 26| -1 |\n|23 | 11111|1110001100000010| 0 |*******| 0 | 1000| 27| -1 |\n|23+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 27| -1 |\n|24 | 11111|1110001100000011| 0 |*******| 0 | 1000| 28| -1 |\n|24+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 28| -1 |\n|25 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| -1 |\n|25+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 |\n|26 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 |\n|26+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 |\n|27 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 |\n|27+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 |\n|28 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 |\n|28+ | 11111|1110101010010000| 0 |*******| 0 | 1000| 1000| -1 |\n|29 | 11111|1110101010010000| 0 |*******| 0 | 1000| 1001| 0 |\n|29+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 0 |\n|30 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1002| 0 |\n|30+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1002| 0 |\n|31 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 0 |\n|31+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 |\n|32 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 |\n|32+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 0 |\n|33 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 0 |\n|33+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 0 |\n|34 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1002| 0 |\n|34+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1002| 0 |\n|35 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 0 |\n|35+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 |\n|36 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 |\n|36+ | 11111|1110111111010000| 0 |*******| 0 | 1000| 1000| 0 |\n|37 | 11111|1110111111010000| 0 |*******| 0 | 1000| 1001| 1 |\n|37+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 1 |\n|38 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1000| 1 |\n|38+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 1 |\n|39 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1001| 1 |\n|39+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1001| 1 |\n|40 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 1 |\n|40+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 1 |\n|41 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 1 |\n|41+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 1 |\n|42 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| 1 |\n|42+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 1 |\n|43 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1001| 1 |\n|43+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1001| 1 |\n|44 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 1 |\n|44+ | 11111|1110001100000111| 1 |*******| 0 | 1000| 1000| 1 |\n|45 | 11111|1110001100000111| 1 |*******| 0 | 1000| 0| 1 |\n|45+ | 11111|0111111111111111| 0 |*******| 0 | 1000| 0| 1 |\n|46 | 11111|0111111111111111| 0 |*******| 0 |32767| 1| 1 |`;\n","export const hdl = `/**\n * The HACK computer, including CPU, ROM and RAM.\n * When reset is 0, the program stored in the computer's ROM executes.\n * When reset is 1, the execution of the program restarts. \n * Thus, to start a program's execution, reset must be pushed \"up\" (1)\n * and \"down\" (0). From this point onward the user is at the mercy of \n * the software. In particular, depending on the program's code, the \n * screen may show some output and the user may be able to interact \n * with the computer via the keyboard.\n */\n\nCHIP Computer {\n\n IN reset;\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 reset%B2.1.2 ARegister[]%D1.7.1 DRegister[]%D1.7.1 PC[]%D0.4.0 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1;\n\n// Load a program written in the Hack machine language.\n// The program computes the maximum of RAM[0] and RAM[1] \n// and writes the result in RAM[2].\n\nROM32K load Max.hack,\n\n// first run: compute max(3,5)\nset Memory[0] 3,\nset Memory[1] 5,\noutput;\n\nrepeat 14 {\n tick, tock, output;\n}\n\n// reset the PC\nset reset 1,\ntick, tock, output;\n\n// second run: compute max(23456,12345)\nset reset 0,\nset Memory[0] 23456,\nset Memory[1] 12345,\noutput;\n\n// The run on these inputs needs less cycles (different branching)\nrepeat 10 {\n tick, tock, output;\n}\n`;\nexport const hack = `0000000000000000\n1111110000010000\n0000000000000001\n1111010011010000\n0000000000001010\n1110001100000001\n0000000000000001\n1111110000010000\n0000000000001100\n1110101010000111\n0000000000000000\n1111110000010000\n0000000000000010\n1110001100001000\n0000000000001110\n1110101010000111`;\nexport const cmp = `| time |reset|ARegister|DRegister|PC[]|RAM16K[0]|RAM16K[1]|RAM16K[2]|\n| 0 | 0 | 0 | 0 | 0| 3 | 5 | 0 |\n| 1 | 0 | 0 | 0 | 1| 3 | 5 | 0 |\n| 2 | 0 | 0 | 3 | 2| 3 | 5 | 0 |\n| 3 | 0 | 1 | 3 | 3| 3 | 5 | 0 |\n| 4 | 0 | 1 | -2 | 4| 3 | 5 | 0 |\n| 5 | 0 | 10 | -2 | 5| 3 | 5 | 0 |\n| 6 | 0 | 10 | -2 | 6| 3 | 5 | 0 |\n| 7 | 0 | 1 | -2 | 7| 3 | 5 | 0 |\n| 8 | 0 | 1 | 5 | 8| 3 | 5 | 0 |\n| 9 | 0 | 12 | 5 | 9| 3 | 5 | 0 |\n| 10 | 0 | 12 | 5 | 12| 3 | 5 | 0 |\n| 11 | 0 | 2 | 5 | 13| 3 | 5 | 0 |\n| 12 | 0 | 2 | 5 | 14| 3 | 5 | 5 |\n| 13 | 0 | 14 | 5 | 15| 3 | 5 | 5 |\n| 14 | 0 | 14 | 5 | 14| 3 | 5 | 5 |\n| 15 | 1 | 14 | 5 | 0| 3 | 5 | 5 |\n| 15 | 0 | 14 | 5 | 0| 23456 | 12345 | 5 |\n| 16 | 0 | 0 | 5 | 1| 23456 | 12345 | 5 |\n| 17 | 0 | 0 | 23456 | 2| 23456 | 12345 | 5 |\n| 18 | 0 | 1 | 23456 | 3| 23456 | 12345 | 5 |\n| 19 | 0 | 1 | 11111 | 4| 23456 | 12345 | 5 |\n| 20 | 0 | 10 | 11111 | 5| 23456 | 12345 | 5 |\n| 21 | 0 | 10 | 11111 | 10| 23456 | 12345 | 5 |\n| 22 | 0 | 0 | 11111 | 11| 23456 | 12345 | 5 |\n| 23 | 0 | 0 | 23456 | 12| 23456 | 12345 | 5 |\n| 24 | 0 | 2 | 23456 | 13| 23456 | 12345 | 5 |\n| 25 | 0 | 2 | 23456 | 14| 23456 | 12345 | 23456 |`;\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as project_01 from \"./project_01/index.js\";\nimport * as project_02 from \"./project_02/index.js\";\nimport * as project_03 from \"./project_03/index.js\";\nimport * as project_05 from \"./project_05/index.js\";\n\n/**\n * Duplicated for web from node:path.\n * A parsed path object generated by path.parse() or consumed by path.format().\n */\nexport interface ParsedPath {\n /** The root of the path such as '/' or 'c:\\' */\n root: string;\n /** The full directory path such as '/home/user/dir' or 'c:\\path\\dir' */\n dir: string;\n /** The file name including extension (if any) such as 'index.html' */\n base: string;\n /** The file extension (if any) such as '.html' */\n ext: string;\n /** The file name without extension (if any) such as 'index' */\n name: string;\n}\n\nexport type Assignment = ParsedPath;\n\nexport const ChipProjects = {\n \"01\": project_01,\n \"02\": project_02,\n \"03\": project_03,\n \"05\": project_05,\n};\n\nlet reset = false;\nexport const resetFiles = async (fs: FileSystem) => {\n if (reset) return; // React will double-render a call to resetFiles in useEffect.\n reset = true;\n await project_01.resetFiles(fs);\n await project_02.resetFiles(fs);\n await project_03.resetFiles(fs);\n await project_05.resetFiles(fs);\n reset = false;\n};\n\nexport const CHIP_PROJECTS: Record<\"01\" | \"02\" | \"03\" | \"05\", string[]> = {\n \"01\": [\n \"Not\",\n \"And\",\n \"Or\",\n \"XOr\",\n \"Mux\",\n \"DMux\",\n \"Not16\",\n \"And16\",\n \"Or16\",\n \"Mux16\",\n \"Mux4Way16\",\n \"Mux8Way16\",\n \"DMux4Way\",\n \"DMux8Way\",\n \"Or8Way\",\n ],\n \"02\": [\n \"HalfAdder\",\n \"FullAdder\",\n \"Add16\",\n \"Inc16\",\n \"AluNoStat\",\n \"ALU\",\n // \"ALUAll\", // Special secret undocumented ALU tests\n ],\n \"03\": [\"Bit\", \"Register\", \"PC\", \"RAM8\", \"RAM64\", \"RAM512\", \"RAM4k\", \"RAM16k\"],\n \"05\": [\"Memory\", \"CPU\", \"Computer\"],\n};\n\nexport const ASM_PROJECTS: Record<\"06\", string[]> = {\n \"06\": [\"Add\", \"Max\", \"Rectangle\", \"Pong\"],\n};\n\nexport const Assignments = {\n ...project_01.CHIPS,\n ...project_02.CHIPS,\n ...project_03.CHIPS,\n ...project_05.CHIPS,\n};\n"],"names":["CHIPS","Not","And","Or","XOr","Mux","DMux","Not16","And16","Or16","Mux16","Mux4Way16","Mux8Way16","DMux4Way","DMux8Way","Or8Way","resetFiles","fs","pushd","reset","popd","HalfAdder","FullAdder","Add16","Inc16","AluNoStat","ALU","ALUAll","Bit","Register","map","inn","load","join","n","PC","RAM8","RAM64","RAM512","RAM4k","RAM16k","Memory","CPU","Computer","ChipProjects","project_01","project_02","project_03","project_05","CHIP_PROJECTS","ASM_PROJECTS","Assignments"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/356.1228c852.chunk.js b/build/static/js/356.1228c852.chunk.js new file mode 100644 index 000000000..86451beee --- /dev/null +++ b/build/static/js/356.1228c852.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[356],{8582:function(t,n,e){e.d(n,{M:function(){return c}});var i=e(1026),r=e(7878),u=e(8365),a=e(4408),s=e(1585),o=e(4625),c=function(t){var n=t.className,e=void 0===n?"":n,c=t.out,h=t.cmp,v=t.zeroState,d=u.lA.parse(c),f=u.lA.parse(h);if((0,o.dZ)(d))return(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{children:"Failed to parse output"}),(0,r.jsx)("pre",{children:(0,a.j)((0,o.UG)(d))}),(0,r.jsx)("code",{children:(0,r.jsx)("pre",{children:c})})]});if((0,o.dZ)(f))return(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{children:"Failed to parse compare"}),(0,r.jsxs)("code",{children:[(0,r.jsx)("pre",{children:(0,a.j)((0,o.UG)(f))}),(0,r.jsx)("pre",{children:h})]})]});var p=(0,o.Ok)(f),Z=(0,o.Ok)(d),m=0,b=(0,s.w)(0,Math.min(p.length,Z.length)).map((function(t){var n,e,r=null!==(n=p[t])&&void 0!==n?n:[],u=null!==(e=Z[t])&&void 0!==e?e:[];return(0,s.w)(0,Math.max(r.length,u.length)).map((function(t,n){var e,i;return[null!==(e=r[n])&&void 0!==e?e:"",null!==(i=u[n])&&void 0!==i?i:""]})).map((function(t){var n=(0,i.Z)(t,2),e=n[0],r=n[1],u={cmp:null!==e&&void 0!==e?e:'"',out:null!==r&&void 0!==r?r:'"',pass:null!==(null===e||void 0===e?void 0:e.trim().match(/^\*+$/))||(null===r||void 0===r?void 0:r.trim())===(null===e||void 0===e?void 0:e.trim())};return u.pass||(m+=1),u}))}));return(0,r.jsxs)("div",{className:"scroll-x "+e,children:[m>0&&(0,r.jsxs)("p",{children:[m," failure",1===m?"":"s"]}),b.length>0?(0,r.jsx)("table",{style:{fontFamily:"var(--font-family-monospace)",marginBottom:"none"},children:(0,r.jsx)("tbody",{children:b.map((function(t,n){return(0,r.jsx)("tr",{children:t.map((function(t,n){var e=t.cmp,i=t.out,u=t.pass;return(0,r.jsx)(l,{cmp:e,out:i,pass:u},n)}))},n)}))})}):null!==v&&void 0!==v?v:(0,r.jsx)("p",{children:"Execute test script to compare output."})]})},l=function(t){var n=t.cmp,e=t.out;return t.pass?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("td",{children:n})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("td",{children:[(0,r.jsx)("ins",{children:n}),(0,r.jsx)("br",{}),(0,r.jsx)("del",{children:e})]})})}},691:function(t,n,e){e.d(n,{J_:function(){return d}});var i=e(726),r=e(1092),u=e(7791),a=e(4625),s=e(8090),o=e(3118),c=e(6329);function l(t,n){if(void 0!==n){if(n>=t)return n-t+1;if(t>0&&0===n)return 1;throw new Error("Bus specification has start > end (".concat(t," > ").concat(n,")"))}}function h(t,n){return v.apply(this,arguments)}function v(){return(v=(0,u.Z)((0,r.Z)().mark((function t(n,e){var i,u,c;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(0,o._c)(n)&&void 0!==e){t.next=2;break}return t.abrupt("return",(0,o.cT)(n));case 2:return t.prev=2,t.next=5,e.readFile("".concat(n,".hdl"));case 5:return i=t.sent,u=s.Gq.parse(i),c=(0,a.IY)(u)?d((0,a.Ok)(u),e):(0,a.UG)(new Error("HDL Was not parsed")),t.abrupt("return",c);case 11:return t.prev=11,t.t0=t.catch(2),t.abrupt("return",(0,a.UG)(new Error("Could not load chip ".concat(n,".hdl"))));case 14:case"end":return t.stop()}}),t,null,[[2,11]])})))).apply(this,arguments)}function d(t,n){return f.apply(this,arguments)}function f(){return(f=(0,u.Z)((0,r.Z)().mark((function t(n,e){var u,s,v,d,f,p,Z;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("BUILTIN"!==n.parts){t.next=2;break}return t.abrupt("return",(0,o.cT)(n.name.toString()));case 2:u=new c.Af(n.ins.map((function(t){var n=t.pin,e=t.width;return{pin:n.toString(),width:e}})),n.outs.map((function(t){var n=t.pin,e=t.width;return{pin:n.toString(),width:e}})),n.name.toString(),[],n.clocked),s=(0,i.Z)(n.parts),t.prev=4,s.s();case 6:if((v=s.n()).done){t.next=24;break}return d=v.value,t.next=10,h(d.name.toString(),e);case 10:if(f=t.sent,!(0,a.dZ)(f)){t.next=13;break}return t.abrupt("return",f);case 13:p=(0,a.Ok)(f),Z=d.wires.map((function(t){var n,e,i,r,u=t.lhs,a=t.rhs;return{to:{name:u.pin.toString(),start:null!==(n=u.start)&&void 0!==n?n:0,width:l(null!==(e=u.start)&&void 0!==e?e:0,u.end)},from:{name:a.pin.toString(),start:null!==(i=a.start)&&void 0!==i?i:0,width:l(null!==(r=a.start)&&void 0!==r?r:0,a.end)}}})),t.prev=15,u.wire(p,Z),t.next=22;break;case 19:return t.prev=19,t.t0=t.catch(15),t.abrupt("return",(0,a.UG)(t.t0));case 22:t.next=6;break;case 24:t.next=29;break;case 26:t.prev=26,t.t1=t.catch(4),s.e(t.t1);case 29:return t.prev=29,s.f(),t.finish(29);case 32:return t.abrupt("return",(0,a.Ok)(u));case 33:case"end":return t.stop()}}),t,null,[[4,26,29,32],[15,19]])})))).apply(this,arguments)}},3300:function(t,n,e){e.d(n,{N1:function(){return S},Z9:function(){return P},ar:function(){return D},lL:function(){return A},m1:function(){return x},zp:function(){return M}});var i=e(7538),r=e(3943),u=e(1026),a=e(9422),s=e(7169),o=e(3243),c=e(7597),l=e(4649),h=e(1092),v=e(7791),d=e(2951),f=e(1976),p=e(7591),Z=e(4337),m=e(6329),b=e(3116),y=e(134),g=e(326),k=e(9600),w=e(5838),x=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){return(0,d.Z)(this,e),n.call(this,16,"ROM")}return(0,f.Z)(e,[{key:"load",value:function(){var t=(0,v.Z)((0,h.Z)().mark((function t(n,e){var i=this;return(0,h.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,(0,k.zD)(n,e);case 3:t.sent.map((function(t,n){return i.at(n).busVoltage=t})),t.next=9;break;case 6:throw t.prev=6,t.t0=t.catch(0),new Error("ROM32K Failed to load file ".concat(e));case 9:case"end":return t.stop()}}),t,null,[[0,6]])})));return function(n,e){return t.apply(this,arguments)}}()}]),e}(b.FH),A=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){return(0,d.Z)(this,e),n.call(this,13,"Screen")}return(0,f.Z)(e)}(b.FH);(0,l.Z)(A,"OFFSET",w.qJ);var S=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){return(0,d.Z)(this,e),n.call(this,[],["out[16]"],"Keyboard")}return(0,f.Z)(e,[{key:"setKey",value:function(t){this.out().busVoltage=65535&t}},{key:"clearKey",value:function(){this.out().busVoltage=0}}]),e}(m.Af);(0,l.Z)(S,"OFFSET",w.sd);var M=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){var t;return(0,d.Z)(this,e),t=n.call(this,["in[16]","load","address[15])"],["out[16]"],"Memory"),(0,l.Z)((0,s.Z)(t),"ram",new b.xs),(0,l.Z)((0,s.Z)(t),"screen",new A),(0,l.Z)((0,s.Z)(t),"keyboard",new S),(0,l.Z)((0,s.Z)(t),"address",0),t.parts.add(t.keyboard),t.parts.add(t.screen),t.parts.add(t.ram),t}return(0,f.Z)(e,[{key:"tick",value:function(){var t=this.in("load").voltage();if(this.address=this.in("address").busVoltage,t){var n=this.in().busVoltage;this.address>=S.OFFSET||(this.address>=A.OFFSET?this.screen.at(this.address-A.OFFSET).busVoltage=n:this.ram.at(this.address).busVoltage=n)}}},{key:"tock",value:function(){this.eval()}},{key:"eval",value:function(){if(this.ram){this.address=this.in("address").busVoltage;var t,n,e=0;if(this.address>=S.OFFSET)e=null!==(t=null===(n=this.keyboard)||void 0===n?void 0:n.out().busVoltage)&&void 0!==t?t:0;else if(this.address>=A.OFFSET){var i,r;e=null!==(i=null===(r=this.screen)||void 0===r?void 0:r.at(this.address-A.OFFSET).busVoltage)&&void 0!==i?i:0}else{var u,a;e=null!==(u=null===(a=this.ram)||void 0===a?void 0:a.at(this.address).busVoltage)&&void 0!==u?u:0}this.out().busVoltage=e}}},{key:"in",value:function(t){if(null!==t&&void 0!==t&&t.startsWith("RAM16K")){var n,i,r,u=(0,g.o5)(null!==(n=null===(i=t.match((0,a.Z)(/\[(\d+)\]/,{idx:1})))||void 0===i||null===(r=i.groups)||void 0===r?void 0:r.idx)&&void 0!==n?n:"0");return this.ram.at(u)}if(null!==t&&void 0!==t&&t.startsWith("Screen")){var s,l,h,v=(0,g.o5)(null!==(s=null===(l=t.match((0,a.Z)(/\[(\d+)\]/,{idx:1})))||void 0===l||null===(h=l.groups)||void 0===h?void 0:h.idx)&&void 0!==s?s:"0");return this.screen.at(v)}return(0,o.Z)((0,c.Z)(e.prototype),"in",this).call(this,t)}},{key:"get",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.startsWith("RAM16K")?this.at(16383&n):t.startsWith("Screen")?this.at(n&8191+A.OFFSET):t.startsWith("Keyboard")?this.at(S.OFFSET):t.startsWith("Memory")?this.at(n):(0,o.Z)((0,c.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"at",value:function(t){return t>=S.OFFSET?this.keyboard.out():t>=A.OFFSET?this.screen.at(t-A.OFFSET):this.ram.at(t)}}]),e}(m.tI),P=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){var t;return(0,d.Z)(this,e),t=n.call(this,["inM[16]","instruction[16]","reset"],["outM[16]","writeM","addressM[15]","pc[15]"]),(0,l.Z)((0,s.Z)(t),"_state",(0,y.Zu)()),t}return(0,f.Z)(e,[{key:"state",get:function(){return this._state}},{key:"tick",value:function(){var t,n=(0,y.aL)(this.cpuInput(),this._state),e=(0,u.Z)(n,2),i=e[0],r=e[1];this._state=i,this.out("writeM").pull(r?m.lj:m.yE),this.out("outM").busVoltage=null!==(t=this._state.ALU)&&void 0!==t?t:0}},{key:"tock",value:function(){var t,n,e,i;if(this._state){var r=(0,y.Ff)(this.cpuInput(),this._state),a=(0,u.Z)(r,2),s=a[0],o=a[1];this._state=o,this.out("addressM").busVoltage=null!==(t=s.addressM)&&void 0!==t?t:0,this.out("outM").busVoltage=null!==(n=s.outM)&&void 0!==n?n:0,this.out("writeM").pull(s.writeM?m.lj:m.yE),this.out("pc").busVoltage=null!==(e=null===(i=this._state)||void 0===i?void 0:i.PC)&&void 0!==e?e:0}}},{key:"cpuInput",value:function(){return{inM:this.in("inM").busVoltage,instruction:this.in("instruction").busVoltage,reset:1===this.in("reset").busVoltage}}},{key:"get",value:function(t,n){return null!==t&&void 0!==t&&t.startsWith("ARegister")?new m.qP("ARegister",this._state.A):null!==t&&void 0!==t&&t.startsWith("DRegister")?new m.qP("DRegister",this._state.D):null!==t&&void 0!==t&&t.startsWith("PC")?new m.qP("PC",this._state.PC):(0,o.Z)((0,c.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"reset",value:function(){this._state=(0,y.Zu)(),(0,o.Z)((0,c.Z)(e.prototype),"reset",this).call(this)}}]),e}(m.tI),V=new WeakMap,E=new WeakMap,O=new WeakMap,D=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){var t;return(0,d.Z)(this,e),t=n.call(this,["reset"],[]),(0,i.Z)((0,s.Z)(t),V,{writable:!0,value:new M}),(0,i.Z)((0,s.Z)(t),E,{writable:!0,value:new x}),(0,i.Z)((0,s.Z)(t),O,{writable:!0,value:new P}),t.wire((0,r.Z)((0,s.Z)(t),O),[{from:{name:"reset",start:0},to:{name:"reset",start:0}},{from:{name:"instruction",start:0},to:{name:"instruction",start:0}},{from:{name:"outM",start:0},to:{name:"inM",start:0}},{from:{name:"writeM",start:0},to:{name:"writeM",start:0}},{from:{name:"addressM",start:0},to:{name:"addressM",start:0}}]),t.wire((0,r.Z)((0,s.Z)(t),E),[{from:{name:"pc",start:0},to:{name:"address",start:0}},{from:{name:"instruction",start:0},to:{name:"out",start:0}}]),t.wire((0,r.Z)((0,s.Z)(t),V),[{from:{name:"inM",start:0},to:{name:"in",start:0}},{from:{name:"writeM",start:0},to:{name:"load",start:0}},{from:{name:"addressM",start:0},to:{name:"address",start:0}},{from:{name:"outM",start:0},to:{name:"out",start:0}}]),t}return(0,f.Z)(e,[{key:"eval",value:function(){(0,o.Z)((0,c.Z)(e.prototype),"eval",this).call(this)}},{key:"get",value:function(t,n){return t.startsWith("PC")||t.startsWith("ARegister")||t.startsWith("DRegister")?(0,r.Z)(this,O).get(t):t.startsWith("RAM16K")?(0,r.Z)(this,V).get(t,n):(0,o.Z)((0,c.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"load",value:function(t,n){return(0,r.Z)(this,E).load(t,n)}}]),e}(m.Af)},3118:function(t,n,e){e.d(n,{JU:function(){return T},zZ:function(){return z},cT:function(){return K},_c:function(){return q}});var i=e(1026),r=e(4625),u=e(2951),a=e(1976),s=e(7591),o=e(4337),c=e(6329);var l=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[1===t&&1===n?c.lj:c.yE]}(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),h=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[t&n&65535]}(this.in("a").busVoltage,this.in("b").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af);var v=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in","sel"],["a","b"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[n===c.yE&&t===c.lj?c.lj:c.yE,n===c.lj&&t===c.lj?c.lj:c.yE]}(this.in("in").voltage(),this.in("sel").voltage()),n=(0,i.Z)(t,2),e=n[0],r=n[1];this.out("a").pull(e),this.out("b").pull(r)}}]),e}(c.Af),d=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in","sel[2]"],["a","b","c","d"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[0===n&&t===c.lj?c.lj:c.yE,1===n&&t===c.lj?c.lj:c.yE,2===n&&t===c.lj?c.lj:c.yE,3===n&&t===c.lj?c.lj:c.yE]}(this.in("in").voltage(),this.in("sel").busVoltage),n=(0,i.Z)(t,4),e=n[0],r=n[1],u=n[2],a=n[3];this.out("a").pull(e),this.out("b").pull(r),this.out("c").pull(u),this.out("d").pull(a)}}]),e}(c.Af),f=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in","sel[3]"],["a","b","c","d","e","f","g","h"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[0===n&&t===c.lj?c.lj:c.yE,1===n&&t===c.lj?c.lj:c.yE,2===n&&t===c.lj?c.lj:c.yE,3===n&&t===c.lj?c.lj:c.yE,4===n&&t===c.lj?c.lj:c.yE,5===n&&t===c.lj?c.lj:c.yE,6===n&&t===c.lj?c.lj:c.yE,7===n&&t===c.lj?c.lj:c.yE]}(this.in("in").voltage(),this.in("sel").busVoltage),n=(0,i.Z)(t,8),e=n[0],r=n[1],u=n[2],a=n[3],s=n[4],o=n[5],l=n[6],h=n[7];this.out("a").pull(e),this.out("b").pull(r),this.out("c").pull(u),this.out("d").pull(a),this.out("e").pull(s),this.out("f").pull(o),this.out("g").pull(l),this.out("h").pull(h)}}]),e}(c.Af);function p(t,n,e){return[e===c.yE?t:n]}function Z(t,n,e,i,r){var u=1&r;return 0===(2&r)?p(t,n,u):p(e,i,u)}var m=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b","sel"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n,e){return[e===c.yE?t:n]}(this.in("a").voltage(),this.in("b").voltage(),this.in("sel").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),b=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]","sel"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=p(this.in("a").busVoltage,this.in("b").busVoltage,this.in("sel").voltage()),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),y=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]","c[16]","d[16]","sel[2]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=Z(this.in("a").busVoltage,this.in("b").busVoltage,this.in("c").busVoltage,this.in("d").busVoltage,this.in("sel").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),g=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]","c[16]","d[16]","e[16]","f[16]","g[16]","h[16]","sel[3]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n,e,i,r,u,a,s,o){var c=3&o;return 0===(4&o)?Z(t,n,e,i,c):Z(r,u,a,s,c)}(this.in("a").busVoltage,this.in("b").busVoltage,this.in("c").busVoltage,this.in("d").busVoltage,this.in("e").busVoltage,this.in("f").busVoltage,this.in("g").busVoltage,this.in("h").busVoltage,this.in("sel").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),k=e(326);var w=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[1===t&&1===n?c.yE:c.lj]}(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),x=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in("a").busVoltage,n=this.in("b").busVoltage;this.out().busVoltage=(0,k.C2)(t,n)}}]),e}(c.Af);var A=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in("in").voltage(),n=[t===c.yE?c.lj:c.yE],e=(0,i.Z)(n,1)[0];this.out().pull(e)}}]),e}(c.Af),S=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=[65535&~this.in().busVoltage],n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af);function M(t,n){return[1===t||1===n?c.lj:c.yE]}var P=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=M(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),V=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[65535&(t|n)]}(this.in("a").busVoltage,this.in("b").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),E=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in[8]"],["out"],"Or8way")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in().busVoltage,n=[0===(255&t)?c.yE:c.lj],e=(0,i.Z)(n,1)[0];this.out().pull(e)}}]),e}(c.Af);var O=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[t===c.lj&&n===c.yE||t===c.yE&&n===c.lj?c.lj:c.yE]}(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),D=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[65535&(t^n)]}(this.in("a").busVoltage,this.in("b").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af);function j(t,n){return[t+n&65535]}var C=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"],"Add16")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=j(this.in("a").busVoltage,this.in("b").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),L=e(6693),R=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["x[16]","y[16]","zx","nx","zy","ny","f","no"],["out[16]"],"ALU")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in("x").busVoltage,n=this.in("y").busVoltage,e=(this.in("zx").busVoltage<<5)+(this.in("nx").busVoltage<<4)+(this.in("zy").busVoltage<<3)+(this.in("ny").busVoltage<<2)+(this.in("f").busVoltage<<1)+(this.in("no").busVoltage<<0),r=(0,L.Bb)(e,t,n),u=(0,i.Z)(r,1)[0];this.out().busVoltage=u}}]),e}(c.Af),T=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["x[16]","y[16]","zx","nx","zy","ny","f","no"],["out[16]","zr","ng"],"ALU")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in("x").busVoltage,n=this.in("y").busVoltage,e=(this.in("zx").busVoltage<<5)+(this.in("nx").busVoltage<<4)+(this.in("zy").busVoltage<<3)+(this.in("ny").busVoltage<<2)+(this.in("f").busVoltage<<1)+(this.in("no").busVoltage<<0),r=(0,L.Bb)(e,t,n),u=(0,i.Z)(r,2),a=u[0],s=u[1],o=s===L.vU.Negative?c.lj:c.yE,l=s===L.vU.Zero?c.lj:c.yE;this.out("out").busVoltage=a,this.out("ng").pull(o),this.out("zr").pull(l)}},{key:"op",value:function(){var t=(this.in("zx").busVoltage<<5)+(this.in("nx").busVoltage<<4)+(this.in("zy").busVoltage<<3)+(this.in("ny").busVoltage<<2)+(this.in("f").busVoltage<<1)+(this.in("no").busVoltage<<0);return t}}]),e}(c.Af);function I(t,n){return[1===t&&0===n||0===t&&1===n?c.lj:c.yE,1===t&&1===n?c.lj:c.yE]}var _=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["sum","carry"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=I(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,2),e=n[0],r=n[1];this.out("sum").pull(e),this.out("carry").pull(r)}}]),e}(c.Af);var F=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b","c"],["sum","carry"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n,e){var r=I(t,n),u=(0,i.Z)(r,2),a=u[0],s=u[1],o=I(a,e),c=(0,i.Z)(o,2),l=c[0],h=M(s,c[1]);return[l,(0,i.Z)(h,1)[0]]}(this.in("a").voltage(),this.in("b").voltage(),this.in("c").voltage()),n=(0,i.Z)(t,2),e=n[0],r=n[1];this.out("sum").pull(e),this.out("carry").pull(r)}}]),e}(c.Af);var B=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in[16]"],["out[16]"],"Inc16")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in().busVoltage,n=j(t,1),e=(0,i.Z)(n,1)[0];this.out().busVoltage=e}}]),e}(c.Af),W=e(3300),N=e(7039),U=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(t){return(0,u.Z)(this,e),n.call(this,["in"],["out"],t,["t"])}return(0,a.Z)(e,[{key:"tick",value:function(){var t=this.in().voltage();this.pin("t").pull(t)}},{key:"tock",value:function(){var t=this.pin("t").voltage();this.out().pull(t)}}]),e}(c.tI),J=e(3116),z=new Map([["Nand",w],["Nand16",x],["Not",A],["Not16",S],["And",l],["And16",h],["Or",P],["Or16",V],["Or8Way",E],["XOr",O],["XOr16",D],["Xor",O],["Xor16",D],["Mux",m],["Mux16",b],["Mux4Way16",y],["Mux8Way16",g],["DMux",v],["DMux4Way",d],["DMux8Way",f],["HalfAdder",_],["FullAdder",F],["Add16",C],["Inc16",B],["ALU",T],["ALUNoStat",R],["DFF",U],["Bit",N.sU],["Register",N.aX],["ARegister",N.aX],["DRegister",N.aX],["PC",N.PC],["RAM8",J.HX],["RAM64",J.IH],["RAM512",J.OB],["RAM4K",J.rS],["RAM16K",J.xs],["ROM32K",W.m1],["Screen",W.lL],["Keyboard",W.N1],["CPU",W.Z9],["Computer",W.ar],["Memory",W.zp],["ARegister",N.l0],["DRegister",N.l0]].map((function(t){var n=(0,i.Z)(t,2),e=n[0],r=n[1];return[e,function(){var t=new r;return t.name=e,t}]})));function q(t){return z.has(t)}function K(t){var n=z.get(t);return n?(0,r.Ok)(n()):(0,r.UG)(new Error("Chip ".concat(t," not in builtin registry")))}},7039:function(t,n,e){e.d(n,{PC:function(){return p},aX:function(){return d},l0:function(){return f},sU:function(){return v}});var i=e(3243),r=e(7597),u=e(2951),a=e(1976),s=e(7169),o=e(7591),c=e(4337),l=e(4649),h=e(6329),v=function(t){(0,o.Z)(e,t);var n=(0,c.Z)(e);function e(t){var i;return(0,u.Z)(this,e),i=n.call(this,["in","load"],["out"],t),(0,l.Z)((0,s.Z)(i),"bit",h.yE),i}return(0,a.Z)(e,[{key:"tick",value:function(){this.in("load").voltage()===h.lj&&(this.bit=this.in().voltage())}},{key:"tock",value:function(){var t;this.out().pull(null!==(t=this.bit)&&void 0!==t?t:0)}},{key:"reset",value:function(){this.bit=h.yE}}]),e}(h.tI),d=function(t){(0,o.Z)(e,t);var n=(0,c.Z)(e);function e(t){var i;return(0,u.Z)(this,e),i=n.call(this,["in[16]","load"],["out[16]"],t),(0,l.Z)((0,s.Z)(i),"bits",0),i}return(0,a.Z)(e,[{key:"tick",value:function(){this.in("load").voltage()===h.lj&&(this.bits=65535&this.in().busVoltage)}},{key:"tock",value:function(){this.out().busVoltage=65535&this.bits}},{key:"get",value:function(t,n){return t===this.name?this.out():(0,i.Z)((0,r.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"reset",value:function(){this.bits=0}}]),e}(h.tI),f=function(t){(0,o.Z)(e,t);var n=(0,c.Z)(e);function e(){return(0,u.Z)(this,e),n.apply(this,arguments)}return(0,a.Z)(e)}(d),p=function(t){(0,o.Z)(e,t);var n=(0,c.Z)(e);function e(t){var i;return(0,u.Z)(this,e),i=n.call(this,["in[16]","load","inc","reset"],["out[16]"],t),(0,l.Z)((0,s.Z)(i),"bits",0),i}return(0,a.Z)(e,[{key:"tick",value:function(){this.in("reset").voltage()===h.lj?this.bits=0:this.in("load").voltage()===h.lj?this.bits=65535&this.in().busVoltage:this.in("inc").voltage()===h.lj&&(this.bits+=1)}},{key:"tock",value:function(){this.out().busVoltage=65535&this.bits}},{key:"get",value:function(t,n){return t===this.name?this.out():(0,i.Z)((0,r.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"reset",value:function(){this.bits=0}}]),e}(h.tI)},3116:function(t,n,e){e.d(n,{FH:function(){return v},HX:function(){return f},IH:function(){return p},OB:function(){return Z},rS:function(){return m},xs:function(){return b}});var i=e(2951),r=e(1976),u=e(7169),a=e(7591),s=e(4337),o=e(4649),c=e(6329),l=e(5541),h=e(5838),v=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t,r){var a;return(0,i.Z)(this,e),a=n.call(this,["in[16]","load","address[".concat(t,"]")],["out[16]"],r),(0,o.Z)((0,u.Z)(a),"width",void 0),(0,o.Z)((0,u.Z)(a),"_memory",void 0),(0,o.Z)((0,u.Z)(a),"_nextData",0),(0,o.Z)((0,u.Z)(a),"_address",0),a.width=t,a._memory=new h.zp(Math.pow(2,a.width)),a}return(0,r.Z)(e,[{key:"memory",get:function(){return this._memory}},{key:"address",get:function(){return this._address}},{key:"tick",value:function(){var t=this.in("load").voltage();this._address=this.in("address").busVoltage,t&&(this._nextData=this.in().busVoltage,this._memory.set(this._address,this._nextData))}},{key:"tock",value:function(){var t,n;this.out().busVoltage=null!==(t=null===(n=this._memory)||void 0===n?void 0:n.get(this._address))&&void 0!==t?t:0}},{key:"eval",value:function(){var t,n,e=this.in("address").busVoltage;this.out().busVoltage=null!==(t=null===(n=this._memory)||void 0===n?void 0:n.get(e))&&void 0!==t?t:0}},{key:"at",value:function(t){var n=this;return(0,l.hu)(t= ").concat(n._memory.size,")")})),new d("".concat(this.name,"[").concat(t,"]"),t,this._memory)}}]),e}(c.tI),d=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t,r,a){var s;return(0,i.Z)(this,e),s=n.call(this,t),(0,o.Z)((0,u.Z)(s),"index",void 0),(0,o.Z)((0,u.Z)(s),"ram",void 0),s.index=r,s.ram=a,s}return(0,r.Z)(e,[{key:"busVoltage",get:function(){return this.ram.get(this.index)},set:function(t){this.ram.set(this.index,t)}}]),e}(c.Gc),f=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,3,t)}return(0,r.Z)(e)}(v),p=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,6,t)}return(0,r.Z)(e)}(v),Z=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,9,t)}return(0,r.Z)(e)}(v),m=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,12,t)}return(0,r.Z)(e)}(v),b=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,14,t)}return(0,r.Z)(e)}(v)},6329:function(t,n,e){e.d(n,{Af:function(){return L},Gc:function(){return S},P9:function(){return R},lj:function(){return x},qP:function(){return V},tI:function(){return I},yE:function(){return A}});var i,r=e(3243),u=e(7597),a=e(7538),s=e(3943),o=e(1092),c=e(7791),l=e(1026),h=e(9422),v=e(7169),d=e(7591),f=e(4337),p=e(726),Z=e(649),m=e(2951),b=e(1976),y=e(4649),g=e(5541),k=e(1585),w=e(6531),x=1,A=0,S=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;(0,m.Z)(this,t),(0,y.Z)(this,"name",void 0),(0,y.Z)(this,"width",void 0),(0,y.Z)(this,"state",void 0),(0,y.Z)(this,"next",[]),this.name=n,this.width=e,this.state=(0,k.w)(0,this.width).map((function(){return A}))}return(0,b.Z)(t,[{key:"ensureWidth",value:function(t){(0,g.hu)(t<=16,"Cannot widen past 16 to ".concat(t," bits")),this.width1&&void 0!==arguments[1]?arguments[1]:0;(0,g.hu)(n>=0&&n0&&void 0!==arguments[0]?arguments[0]:0;return(0,g.hu)(t>=0&&t>r}}catch(u){i.e(u)}finally{i.f()}this.next.forEach((function(t){return t.busVoltage=e.busVoltage}))}},{key:"toggle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=this.voltage(t)===A?x:A;this.pull(n,t)}}]),t}(),M=function(t){(0,d.Z)(e,t);var n=(0,f.Z)(e);function e(t,i){var r,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return(0,m.Z)(this,e),r=n.call(this,t.name),(0,y.Z)((0,v.Z)(r),"bus",void 0),(0,y.Z)((0,v.Z)(r),"start",void 0),(0,y.Z)((0,v.Z)(r),"width",void 0),r.bus=t,r.start=i,r.width=u,(0,g.hu)(i>=0&&i+u<=t.width,"Mismatched InSubBus dimensions on ".concat(t.name," (").concat(u," + ").concat(i," > ").concat(t.width,")")),r.connect(t),r}return(0,b.Z)(e,[{key:"pull",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(0,g.hu)(n>=0&&n0&&void 0!==arguments[0]?arguments[0]:0;return(0,g.hu)(t>=0&&t>this.start&_(this.width)},set:function(t){var n=this.bus.busVoltage&~_(this.width+this.start),e=this.bus.busVoltage&_(this.start),i=(t&_(this.width))<2&&void 0!==arguments[2]?arguments[2]:1;return(0,m.Z)(this,e),r=n.call(this,t.name),(0,y.Z)((0,v.Z)(r),"bus",void 0),(0,y.Z)((0,v.Z)(r),"start",void 0),(0,y.Z)((0,v.Z)(r),"width",void 0),r.bus=t,r.start=i,r.width=u,(0,g.hu)(i>=0&&u<=t.width,"Mismatched OutSubBus dimensions"),r.connect(t),r}return(0,b.Z)(e,[{key:"busVoltage",get:function(){return this.bus.busVoltage&_(this.width)},set:function(t){this.bus.busVoltage=(t&_(this.width+this.start))>>this.start}},{key:"connect",value:function(t){(0,g.hu)(this.width<=t.width,"Mismatched OutSubBus connection dimensions"),this.bus=t}}]),e}(S),V=function(t){(0,d.Z)(e,t);var n=(0,f.Z)(e);function e(t,i){var r;return(0,m.Z)(this,e),r=n.call(this,t,16),(0,y.Z)((0,v.Z)(r),"value",void 0),r.value=i,r}return(0,b.Z)(e,[{key:"pullHigh",value:function(){}},{key:"pullLow",value:function(){}},{key:"voltage",value:function(){return 1&this.busVoltage}},{key:"busVoltage",get:function(){return this.value},set:function(t){}}]),e}(S),E=new V("true",65535),O=new V("false",0);function D(t){var n,e=null===(n=t.match((0,h.Z)(/([a-zA-Z]+)(\[(\d+)\])?/,{pin:1,w:3})))||void 0===n?void 0:n.groups,i=e.pin,r=e.w;return{pin:i,width:r?Number(r):1}}i=Symbol.iterator;var j=function(){function t(){(0,m.Z)(this,t),(0,y.Z)(this,"map",new Map)}return(0,b.Z)(t,[{key:"insert",value:function(t){var n=t.name;(0,g.hu)(!this.map.has(n),"Pins already has ".concat(n,"!")),this.map.set(n,t)}},{key:"emplace",value:function(t,n){if(this.has(t))return this.get(t);var e=new S(t,n);return this.insert(e),e}},{key:"has",value:function(t){return this.map.has(t)}},{key:"get",value:function(t){return this.map.get(t)}},{key:"entries",value:function(){return this.map.values()}},{key:i,value:function(){return this.map[Symbol.iterator]()}}]),t}(),C=0,L=function(){function t(n,e,i){var r=this,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];(0,m.Z)(this,t),(0,y.Z)(this,"name",void 0),(0,y.Z)(this,"id",C++),(0,y.Z)(this,"ins",new j),(0,y.Z)(this,"outs",new j),(0,y.Z)(this,"pins",new j),(0,y.Z)(this,"parts",new Set),(0,y.Z)(this,"clockedPins",void 0),this.name=i;var s,o=(0,p.Z)(n);try{for(o.s();!(s=o.n()).done;){var c=s.value,l=void 0!==c.pin?c:D(c),h=l.pin,v=l.width,d=void 0===v?1:v;this.ins.insert(new S(h,d))}}catch(T){o.e(T)}finally{o.f()}var f,Z=(0,p.Z)(e);try{for(Z.s();!(f=Z.n()).done;){var b=f.value,g=void 0!==b.pin?b:D(b),k=g.pin,x=g.width,A=void 0===x?1:x;this.outs.insert(new S(k,A))}}catch(T){Z.e(T)}finally{Z.f()}var M,P=(0,p.Z)(u);try{for(P.s();!(M=P.n()).done;){var V=M.value,E=void 0!==V.pin?V:D(V),O=E.pin,L=E.width,R=void 0===L?1:L;this.pins.insert(new S(O,R))}}catch(T){P.e(T)}finally{P.f()}this.clockedPins=new Set(a),w.S.get().$.subscribe((function(){return r.eval()}))}return(0,b.Z)(t,[{key:"clocked",get:function(){if(this.clockedPins.size>0)return!0;var t,n=(0,p.Z)(this.parts);try{for(n.s();!(t=n.n()).done;){if(t.value.clocked)return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"reset",value:function(){var t,n=(0,p.Z)(this.ins);try{for(n.s();!(t=n.n()).done;){var e=(0,l.Z)(t.value,2);e[0];e[1].busVoltage=0}}catch(u){n.e(u)}finally{n.f()}var i,r=(0,p.Z)(this.parts);try{for(r.s();!(i=r.n()).done;){i.value.reset()}}catch(u){r.e(u)}finally{r.f()}this.eval()}},{key:"in",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"in";return(0,g.hu)(this.hasIn(t),"No in pin ".concat(t)),this.ins.get(t)}},{key:"out",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"out";return(0,g.hu)(this.hasOut(t),"No in pin ".concat(t)),this.outs.get(t)}},{key:"hasIn",value:function(t){return this.ins.has(t)}},{key:"hasOut",value:function(t){return this.outs.has(t)}},{key:"pin",value:function(t){return(0,g.hu)(this.pins.has(t)),this.pins.get(t)}},{key:"get",value:function(t,n){return this.ins.has(t)?this.ins.get(t):this.outs.has(t)?this.outs.get(t):this.pins.has(t)?this.pins.get(t):this.getBuiltin(t,n)}},{key:"getBuiltin",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(F.includes(t)){var e,i=(0,p.Z)(this.parts);try{for(i.s();!(e=i.n()).done;){var r=e.value,u=r.get(t,n);if(u)return u}}catch(a){i.e(a)}finally{i.f()}}}},{key:"isOutPin",value:function(t){return this.outs.has(t)}},{key:"wire",value:function(t,n){this.parts.add(t);var e,i=(0,p.Z)(n);try{for(i.s();!(e=i.n()).done;){var r=e.value,u=r.to,a=r.from;t.isOutPin(u.name)?this.wireOutPin(t,u,a):this.wireInPin(t,u,a)}}catch(s){i.e(s)}finally{i.f()}}},{key:"findPin",value:function(t,n){return"true"===t.toLowerCase()||"1"===t?E:"false"===t.toLowerCase()||"0"===t?O:this.ins.has(t)?this.ins.get(t):this.outs.has(t)?this.outs.get(t):this.pins.emplace(t,n)}},{key:"wireOutPin",value:function(t,n,e){var i,r,u,a=(0,g.kP)(t.outs.get(n.name),(function(){return"Cannot wire to missing pin ".concat(n.name)}));null!==(i=n.width)&&void 0!==i||(n.width=a.width);var s=this.findPin(e.name,null!==(r=e.width)&&void 0!==r?r:n.width),o=this.pins.has(s.name);if(null!==(u=e.width)&&void 0!==u||(e.width=s.width),s instanceof V)throw new Error("Cannot wire to constant bus");o&&s instanceof S&&s.ensureWidth(e.start+e.width),(e.start>0||e.width!==s.width)&&(s=new M(s,e.start,e.width)),(n.start>0||n.width!==s.width)&&(s=new P(s,n.start,n.width)),a.connect(s)}},{key:"wireInPin",value:function(t,n,e){var i,r,u,a=(0,g.kP)(t.ins.get(n.name),(function(){return"Cannot wire to missing pin ".concat(n.name)}));null!==(i=n.width)&&void 0!==i||(n.width=a.width);var s=this.findPin(e.name,null!==(r=e.width)&&void 0!==r?r:n.width);null!==(u=e.width)&&void 0!==u||(e.width=s.width),(n.start>0||n.width!==s.width)&&(a=new M(a,n.start,n.width)),["true","false"].includes(s.name)||(e.start>0||e.width!==s.width)&&(a=new P(a,e.start,e.width)),s.connect(a)}},{key:"eval",value:function(){var t,n=(0,p.Z)(this.parts);try{for(n.s();!(t=n.n()).done;){t.value.eval()}}catch(e){n.e(e)}finally{n.f()}}},{key:"tick",value:function(){this.eval()}},{key:"tock",value:function(){this.eval()}},{key:"remove",value:function(){var t,n=(0,p.Z)(this.parts);try{for(n.s();!(t=n.n()).done;){t.value.remove()}}catch(e){n.e(e)}finally{n.f()}}},{key:"load",value:function(){var t=(0,c.Z)((0,o.Z)().mark((function t(n,e){var i,r,u;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=(0,p.Z)(this.parts),t.prev=1,i.s();case 3:if((r=i.n()).done){t.next=10;break}if("ROM32K"!==(u=r.value).name){t.next=8;break}return t.next=8,u.load(n,e);case 8:t.next=3;break;case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(1),i.e(t.t0);case 15:return t.prev=15,i.f(),t.finish(15);case 18:case"end":return t.stop()}}),t,this,[[1,12,15,18]])})));return function(n,e){return t.apply(this,arguments)}}()}]),t}(),R=function(t){(0,d.Z)(e,t);var n=(0,f.Z)(e);function e(){var t;return(0,m.Z)(this,e),(t=n.call(this,[],[])).outs.insert(O),t}return(0,b.Z)(e)}(L),T=new WeakMap,I=function(t){(0,d.Z)(e,t);var n=(0,f.Z)(e);function e(){var t;(0,m.Z)(this,e);for(var i=arguments.length,r=new Array(i),u=0;u>6,d1:n(b),d2:n(y),d3:n(g),j1:n(k),j2:n(w),j3:n(x)}}function S(t,n){var e=t.inM,i=t.instruction,r=n.A,u=n.D,a=n.PC,s=A(i),o=s.am?e:r,h=(0,l.Bb)(s.op,u,o),v=(0,c.Z)(h,2);return[{A:r,D:u,PC:a+1,ALU:v[0],flag:v[1]},s.d3]}function M(t,n){var e=t.inM,i=t.instruction,r=t.reset,u=n.A,a=n.D,s=n.PC,o=n.ALU,c=n.flag,h=A(i),v=h.j1&&c===l.vU.Positive,d=h.j2&&c===l.vU.Zero,f=h.j3&&c===l.vU.Negative;s=r?0:v||d||f?u:s,h.d2&&(a=o),h.c?h.d1&&(u=o):u=32767&i;var p=h.am?e:u,Z=(0,l.Bb)(h.op,a,p);return o=Z[0],c=Z[1],[{addressM:u,outM:o,writeM:h.d3},{A:u,D:a,ALU:o,flag:c,PC:s}]}var P=new WeakMap,V=new WeakMap,E=new WeakMap,O=new WeakMap,D=function(){function t(n){var e=n.RAM,r=void 0===e?new h.zp(32767):e,s=n.ROM;(0,i.Z)(this,t),(0,a.Z)(this,"RAM",void 0),(0,a.Z)(this,"ROM",void 0),(0,u.Z)(this,P,{writable:!0,value:0}),(0,u.Z)(this,V,{writable:!0,value:0}),(0,u.Z)(this,E,{writable:!0,value:0}),(0,u.Z)(this,O,{writable:!0,value:{A:0,D:0,PC:0,ALU:0,flag:l.vU.Zero}}),this.RAM=r,this.ROM=s}return(0,r.Z)(t,[{key:"state",get:function(){return(0,o.Z)(this,O)}},{key:"PC",get:function(){return(0,o.Z)(this,P)}},{key:"A",get:function(){return(0,o.Z)(this,V)}},{key:"D",get:function(){return(0,o.Z)(this,E)}},{key:"reset",value:function(){(0,s.Z)(this,P,0),(0,s.Z)(this,V,0),(0,s.Z)(this,E,0)}},{key:"tick",value:function(){var t=function(t,n){var e=S(t,n),i=(0,c.Z)(e,2),r=i[0];return i[1],M(t,r)}({inM:this.RAM.get((0,o.Z)(this,V)),instruction:this.ROM.get((0,o.Z)(this,P)),reset:!1},{A:(0,o.Z)(this,V),D:(0,o.Z)(this,E),PC:(0,o.Z)(this,P),ALU:(0,o.Z)(this,E),flag:l.vU.Zero}),n=(0,c.Z)(t,2),e=n[0],i=e.addressM,r=e.outM,u=e.writeM,a=n[1],h=a.A,v=a.D,d=a.PC;(0,s.Z)(this,V,h),(0,s.Z)(this,E,v),(0,s.Z)(this,P,d),u&&this.RAM.set(i,r)}}]),t}()},5838:function(t,n,e){e.d(n,{I2:function(){return m},qJ:function(){return b},sd:function(){return y},zp:function(){return k}});var i=e(649),r=e(1092),u=e(7791),a=e(2951),s=e(1976),o=e(4649),c=e(7538),l=e(2648),h=e(3943),v=e(5541),d=e(9810),f=e(7693),p=e(326),Z=e(9600),m=["bin","dec","hex","asm"],b=16384,y=24576,g=new WeakMap,k=function(){function t(n){(0,a.Z)(this,t),(0,c.Z)(this,g,{writable:!0,value:void 0}),(0,o.Z)(this,"updates",new d.x),(0,l.Z)(this,g,new Int16Array(n))}return(0,s.Z)(t,[{key:"size",get:function(){return(0,h.Z)(this,g).length}},{key:"get",value:function(t){var n;return t<0||t>=this.size?65535:null!==(n=(0,h.Z)(this,g)[t])&&void 0!==n?n:0}},{key:"set",value:function(t,n){t>=0&&t0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;return(0,i.Z)((0,h.Z)(this,g).slice(t,n))}},{key:"map",value:function(t){var n=this,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.size;return(0,r.Z)().mark((function u(){var a;return(0,r.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:(0,v.hu)(e = NonemptyListOf sep?\n EmptyList = EmptyList sep?\n}')},o=s.Base.createSemantics();function c(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t.root};return function(i){try{var r,s,o=t.match(i);if(o.succeeded()){var c=n(o),l=e(c);return(0,u.Ok)(l)}return(0,u.UG)({message:null!==(r=o.message)&&void 0!==r?r:a,shortMessage:null!==(s=o.shortMessage)&&void 0!==s?s:a})}catch(h){return(0,u.UG)(h)}}}o.extendOperation("asIteration",{List:function(t,n){return t.asIteration()}}),o.addAttribute("value",{decNumber:function(t,n){return(0,r.o5)(n.sourceString)},wholeDec:function(t,n){return(0,r.o5)(n.sourceString)},binNumber:function(t,n){return(0,r.C$)(n.sourceString)},hexNumber:function(t,n){return(0,r.Af)(n.sourceString)},Number:function(t){return t.value},Name:function(t){return t.name},identifier:function(t,n){return this.sourceString}}),o.addAttribute("name",{identifier:function(t,n){return this.sourceString},Name:function(t){var n;return null===(n=this.child(0))||void 0===n?void 0:n.name}}),o.addAttribute("String",{String:function(t,n,e){return n.sourceString}})},8365:function(t,n,e){e.d(n,{lA:function(){return o}});var i=e(5640),r=e(1510),u="\nCmp <: Base {\n Root := line*\n line = bar cell+ newline?\n cell = cellvalue bar\n cellvalue = (~(bar|newline) any)*\n}",a=i.Z.grammar(u,r.y1),s=a.extendSemantics(r.rJ);s.addAttribute("cell",{cell:function(t,n){return t.sourceString}}),s.addAttribute("line",{line:function(t,n,e){return n.children.map((function(t){return t.cell}))}}),s.addAttribute("root",{Root:function(t){return t.children.map((function(t){return t.line}))}});var o={grammar:u,semantics:s,parser:a,parse:(0,r.Pz)(a,s)}},8090:function(t,n,e){e.d(n,{Gq:function(){return o}});var i=e(5640),r=e(1510),u='\nHdl <: Base{\n Root := Chip\n Chip = "CHIP" Name OpenBrace ChipBody CloseBrace\n ChipBody = InList? OutList? PartList ClockedList?\n InList = "IN" PinList Semi\n OutList = "OUT" PinList Semi\n PartList = BuiltinPart | Parts\n PinList = List\n PinDecl = Name PinWidth?\n PinWidth = OpenSquare decNumber CloseSquare\n BuiltinPart = "BUILTIN" Semi\n Parts = "PARTS:" Part*\n Part = Name "(" Wires ")" Semi\n Wires = List\n Wire = WireSide Equal (WireSide | True | False) \n WireSide = Name SubBus? \n SubBus = OpenSquare decNumber subBusRest? CloseSquare\n subBusRest = ".." decNumber\n ClockedList = "CLOCKED" SimplePinList Semi\n SimplePinList = List\n}',a=i.Z.grammar(u,r.y1),s=a.extendSemantics(r.rJ);s.addAttribute("SubBus",{SubBus:function(t,n,e,i){var r,u,a,s=n.value;return{start:s,end:null!==(r=null===(u=e.child(0))||void 0===u||null===(a=u.child(1))||void 0===a?void 0:a.value)&&void 0!==r?r:s}}}),s.addAttribute("WireSide",{WireSide:function(t,n){var e,i,r=t.name,u=null!==(e=null===(i=n.child(0))||void 0===i?void 0:i.SubBus)&&void 0!==e?e:{start:void 0,end:void 0};return{pin:r,start:u.start,end:u.end}}}),s.addAttribute("Wire",{Wire:function(t,n,e){var i=e.isTerminal()?{pin:e.sourceString}:e.WireSide;return{lhs:t.WireSide,rhs:i}}}),s.addAttribute("Wires",{Wires:function(t){return t.asIteration().children.map((function(t){return t.Wire}))}}),s.addAttribute("Part",{Part:function(t,n,e,i,r){return{name:t.name,wires:e.Wires}}}),s.addAttribute("Parts",{Parts:function(t,n){return n.children.map((function(t){return t.Part}))},BuiltinPart:function(t,n){return"BUILTIN"}}),s.addAttribute("PartList",{PartList:function(t){return t.Parts}}),s.addAttribute("Clocked",{ClockedList:function(t,n,e){var i;return null!==(i=n.asIteration().children.map((function(t){return t.sourceString})))&&void 0!==i?i:[]}}),s.addAttribute("PinDecl",{PinDecl:function(t,n){var e,i,r;return{pin:t.name,width:null!==(e=null===(i=n.child(0))||void 0===i||null===(r=i.child(1))||void 0===r?void 0:r.value)&&void 0!==e?e:1}}}),s.addAttribute("PinList",{PinList:function(t){return t.asIteration().children.map((function(t){return t.PinDecl}))}}),s.addAttribute("Chip",{Chip:function(t,n,e,i,r){var u,a,s,o,c,l,h,v;return{name:n.name,ins:null!==(u=null===(a=i.child(0).child(0))||void 0===a||null===(s=a.child(1))||void 0===s?void 0:s.PinList)&&void 0!==u?u:[],outs:null!==(o=null===(c=i.child(1).child(0))||void 0===c||null===(l=c.child(1))||void 0===l?void 0:l.PinList)&&void 0!==o?o:[],parts:null!==(h=i.child(2).PartList)&&void 0!==h?h:[],clocked:null===(v=i.child(3).child(0))||void 0===v?void 0:v.Clocked}}}),s.addAttribute("Root",{Root:function(t){var n;return null===(n=t.child(0))||void 0===n?void 0:n.Chip}});var o={parser:a,grammar:u,semantics:s,parse:(0,r.Pz)(a,s,(function(t){return t.Chip}))}},9647:function(t,n,e){e.d(n,{qH:function(){return o}});var i=e(5640),r=e(1510),u='\nTst <: Base {\n Root := Tst\n Tst = (TstStatement | TstRepeat | TstWhile)+\n\n TstRepeat = Repeat Number? OpenBrace TstStatement+ CloseBrace\n TstWhile = While Condition OpenBrace TstStatement+ CloseBrace\n TstStatement = List (Semi | Bang)\n\n TstOperation =\n | TstFileOperation\n | TstOutputListOperation\n | TstEvalOperation\n | TstSetOperation\n | TstOutputOperation\n | TstEchoOperation\n | TstClearEchoOperation\n | TstLoadROMOperation\n\n TstLoadROMOperation = ROM32K Load FileName\n TstFileOperation = FileOperation FileName\n TstOutputListOperation = "output-list" OutputFormat+\n OutputFormat = Name Index? percent FormatStyle wholeDec dot wholeDec dot wholeDec\n TstSetOperation = Set Name Index? Number\n Index = OpenSquare wholeDec? CloseSquare\n Condition = Value CompareOp Value\n TstEvalOperation = Eval | Tick | Tock\n TstOutputOperation = Output\n TstEchoOperation = Echo String\n TstClearEchoOperation = ClearEcho\n\n FileName = Name\n FileOperation = "load" | "output-file" | "compare-to"\n\n Set = "set"\n Eval = "eval"\n Tick = "tick"\n Tock = "tock"\n Echo = "echo"\n Repeat = "repeat"\n ClearEcho = "clear-echo"\n Output = "output"\n OutputList = "output-list"\n FormatStyle = "B"|"D"|"S"|"X"\n ROM32K = "ROM32K"\n Load = "load"\n While = "while"\n\n CompareOp = "<>" | "<=" | ">=" | "=" | "<" | ">"\n}',a=i.Z.grammar(u,r.y1),s=a.extendSemantics(r.rJ);s.extendAttribute("value",{Index:function(t,n,e){var i,r;return null!==(i=null===n||void 0===n||null===(r=n.child(0))||void 0===r?void 0:r.value)&&void 0!==i?i:-1}}),s.extendAttribute("name",{FileName:function(t){return t.name}}),s.addAttribute("index",{Index:function(t,n,e){var i,r;return null!==(i=null===(r=n.child(0))||void 0===r?void 0:r.value)&&void 0!==i?i:0}}),s.addAttribute("format",{OutputFormat:function(t,n,e,i,r,u,a,s,o){var c,l,h=t.name,v=i.sourceString,d=r.value,f=a.value,p=o.value;return{id:h,builtin:void 0!==(null===n||void 0===n?void 0:n.child(0)),address:null!==(c=null===n||void 0===n||null===(l=n.child(0))||void 0===l?void 0:l.value)&&void 0!==c?c:-1,style:v,width:f,lpad:d,rpad:p}}}),s.addAttribute("operation",{TstEvalOperation:function(t){return{op:t.sourceString}},TstOutputOperation:function(t){return{op:"output"}},TstOutputListOperation:function(t,n){return{op:"output-list",spec:n.children.map((function(t){return t.format}))}},TstSetOperation:function(t,n,e,i){var r,u,a={op:"set",id:n.name,value:i.value},s=null===(r=e.child(0))||void 0===r||null===(u=r.child(1))||void 0===u?void 0:u.child(0);return s&&(a.index=s.value),a},TstEchoOperation:function(t,n){return{op:"echo",message:n.String}},TstClearEchoOperation:function(t){return{op:"clear-echo"}},TstLoadROMOperation:function(t,n,e){return{op:"loadRom",file:e.name}},TstFileOperation:function(t,n){return{op:t.sourceString,file:n.sourceString}}}),s.addAttribute("condition",{Condition:function(t,n,e){var i=t.value,r=n.sourceString;return{left:i,right:e.value,op:r}}}),s.addAttribute("statement",{TstWhile:function(t,n,e,i,r){return{statements:i.children.map((function(t){return t.statement})),condition:n.condition,span:{start:t.source.startIdx,end:n.source.endIdx}}},TstRepeat:function(t,n,e,i,r){var u,a;return{statements:i.children.map((function(t){return t.statement})),count:null!==(u=null===(a=n.child(0))||void 0===a?void 0:a.value)&&void 0!==u?u:-1,span:{start:t.source.startIdx,end:n.source.endIdx}}},TstStatement:function(t,n){var e={ops:t.asIteration().children.map((function(t){return t.operation})),span:{start:this.source.startIdx,end:this.source.endIdx}};return"!"===n.sourceString&&(e.break=!0),e}}),s.addAttribute("tst",{Tst:function(t){return{lines:t.children.map((function(t){return t.statement}))}}}),s.addAttribute("root",{Root:function(t){return t.tst}});var o={grammar:u,semantics:s,parser:a,parse:(0,r.Pz)(a,s)}},3389:function(t,n,e){e.d(n,{l1:function(){return A}});var i=e(7169),r=e(3243),u=e(7597),a=e(7591),s=e(4337),o=e(726),c=e(1092),l=e(7791),h=e(2951),v=e(1976),d=e(4649),f=e(5541),p=e(9956),Z=e(6329),m=e(6531),b=e(9422),y=e(326),g=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"%B1.1.1",i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0;if((0,h.Z)(this,t),(0,d.Z)(this,"variable",void 0),(0,d.Z)(this,"fmt",void 0),(0,d.Z)(this,"lPad",void 0),(0,d.Z)(this,"rPad",void 0),(0,d.Z)(this,"len",void 0),(0,d.Z)(this,"index",void 0),(0,d.Z)(this,"builtin",void 0),this.variable=n,e.startsWith("%")&&void 0===i&&void 0===r&&void 0===u){var o,c=null===(o=e.match((0,b.Z)(/^%([BDXS])(\d+)\.(\d+)\.(\d+)$/,{fmt:1,lPad:2,len:3,rPad:4})))||void 0===o?void 0:o.groups,l=c.fmt,v=c.lPad,p=c.rPad,Z=c.len;this.fmt=l,this.lPad=parseInt(v),this.rPad=parseInt(p),this.len=parseInt(Z),this.builtin=!1,this.index=-1}else(0,f.hu)(["B","X","D","S"].includes(e[0])),this.fmt=e[0],this.len=null!==i&&void 0!==i?i:3,this.lPad=null!==r&&void 0!==r?r:1,this.rPad=null!==u&&void 0!==u?u:1,this.builtin=null!==a&&void 0!==a&&a,this.index=null!==s&&void 0!==s?s:-1}return(0,v.Z)(t,[{key:"header",value:function(t){var n="".concat(this.variable);if(this.builtin){var e=this.index>=0?this.index:"";n="".concat(n,"[").concat(e,"]")}return n.length>this.len+this.lPad+this.rPad?n.substring(0,this.len+this.lPad+this.rPad):this.padCenter(n)}},{key:"print",value:function(t){var n=t.getVar(this.variable,this.index);if("S"===this.fmt)return this.padLeft(n);var e=(0,{B:y.Ly,D:y.E_,X:y.$v}[this.fmt])(n);return"D"===this.fmt?this.padRight(e):this.padCenter(e.slice(e.length-this.len))}},{key:"padCenter",value:function(t){var n=this.lPad+this.len+this.rPad,e=Math.floor((n-t.length)/2),i=n-e-t.length,r=e+t.length,u=r+i;return t=(t=t.padStart(r)).padEnd(u)}},{key:"padLeft",value:function(t){t=t.substring(0,this.len);var n=this.rPad+this.len,e=this.lPad+n;return t=(t=t.padEnd(n)).padStart(e)}},{key:"padRight",value:function(t){t=t.substring(0,this.len);var n=this.lPad+this.len,e=this.rPad+n;return t=(t=t.padStart(n)).padEnd(e)}}]),t}(),k=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"instructions",[]),(0,d.Z)(this,"_outputList",[]),(0,d.Z)(this,"_log",""),(0,d.Z)(this,"fs",new p.Wd),(0,d.Z)(this,"_steps",void 0),(0,d.Z)(this,"_step",void 0),(0,d.Z)(this,"breakpoints",new Map)}return(0,v.Z)(t,[{key:"setFileSystem",value:function(t){return this.fs=t,this}},{key:"echo",value:function(t){}},{key:"clearEcho",value:function(){}},{key:"load",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(n){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",void 0);case 1:case"end":return t.stop()}}),t)})));return function(n){return t.apply(this,arguments)}}()},{key:"compareTo",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(n){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",void 0);case 1:case"end":return t.stop()}}),t)})));return function(n){return t.apply(this,arguments)}}()},{key:"outputFile",value:function(t){}},{key:"outputList",value:function(t){this._outputList=t}},{key:"addInstruction",value:function(t){this.instructions.push(t)}},{key:"reset",value:function(){return this._steps=(0,c.Z)().mark((function t(n){var e,i,r;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=(0,o.Z)(n.instructions),t.prev=1,e.s();case 3:if((i=e.n()).done){t.next=8;break}return r=i.value,t.delegateYield(r.steps(n),"t0",6);case 6:t.next=3;break;case 8:t.next=13;break;case 10:t.prev=10,t.t1=t.catch(1),e.e(t.t1);case 13:return t.prev=13,e.f(),t.finish(13);case 16:case"end":return t.stop()}}),t,null,[[1,10,13,16]])}))(this),this._step=this._steps.next(),this._step,this._log="",this}},{key:"steps",get:function(){return void 0===this._steps&&(this.reset(),this._steps=(0,f.kP)(this._steps,"Reset did not initialize steps"),this._step=(0,f.kP)(this._step,"Reset did not find first step")),this._steps}},{key:"currentStep",get:function(){var t;return null===(t=this._step)||void 0===t?void 0:t.value}},{key:"done",get:function(){var t,n;return null!==(t=null===(n=this._step)||void 0===n?void 0:n.done)&&void 0!==t&&t}},{key:"step",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._step.done){t.next=5;break}return t.next=3,this._step.value.do(this);case 3:return this._step=this.steps.next(),t.abrupt("return",!1);case 5:return t.abrupt("return",!0);case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"run",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.reset();case 1:return t.next=3,this.step();case 3:if(t.sent){t.next=7;break}t.next=1;break;case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"addBreakpoint",value:function(t,n){this.breakpoints.set(t,n)}},{key:"clearBreakpoints",value:function(){this.breakpoints.clear()}},{key:"output",value:function(){var t=this,n=this._outputList.map((function(n){return n.print(t)}));this._log+="|".concat(n.join("|"),"|\n")}},{key:"header",value:function(){var t=this,n=this._outputList.map((function(n){return n.header(t)}));this._log+="|".concat(n.join("|"),"|\n")}},{key:"log",value:function(){return this._log}}]),t}();function w(t){return void 0!==t.ops}function x(t){return void 0!==t.condition}var A=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(){var t;(0,h.Z)(this,e);for(var r=arguments.length,u=new Array(r),a=0;a0&&void 0!==arguments[0]?arguments[0]:[];(0,h.Z)(this,t),(0,d.Z)(this,"outputs",[]);var e,i=(0,o.Z)(n);try{for(i.s();!(e=i.n()).done;){var r=e.value;this.addOutput(r)}}catch(u){i.e(u)}finally{i.f()}}return(0,v.Z)(t,[{key:"addOutput",value:function(t){this.outputs.push(new g(t.id,t.style,t.width,t.lpad,t.rpad,t.builtin,t.address))}},{key:"do",value:function(t){t.outputList(this.outputs),t.header()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),V=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"instructions",[]),(0,d.Z)(this,"span",void 0)}return(0,v.Z)(t,[{key:"addInstruction",value:function(t){this.instructions.push(t)}},{key:"do",value:function(t){var n,e=(0,o.Z)(this.instructions);try{for(e.s();!(n=e.n()).done;){n.value.do(t)}}catch(i){e.e(i)}finally{e.f()}}},{key:"steps",value:(0,c.Z)().mark((function t(n){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),E=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){var r;return(0,h.Z)(this,e),r=n.call(this),(0,d.Z)((0,i.Z)(r),"repeat",void 0),r.repeat=t,r}return(0,v.Z)(e,[{key:"do",value:function(){}},{key:"innerSteps",value:(0,c.Z)().mark((function t(n){var e,i,r;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=(0,o.Z)(this.instructions),t.prev=1,e.s();case 3:if((i=e.n()).done){t.next=8;break}return r=i.value,t.delegateYield(r.steps(n),"t0",6);case 6:t.next=3;break;case 8:t.next=13;break;case 10:t.prev=10,t.t1=t.catch(1),e.e(t.t1);case 13:return t.prev=13,e.f(),t.finish(13);case 16:case"end":return t.stop()}}),t,this,[[1,10,13,16]])}))},{key:"steps",value:(0,c.Z)().mark((function t(n){var e;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(-1!==this.repeat){t.next=9;break}return t.next=3,this;case 3:return t.delegateYield(this.innerSteps(n),"t0",5);case 5:t.next=3;break;case 7:t.next=17;break;case 9:e=0;case 10:if(!(e":return"".concat(n)!=="".concat(e)}else switch(this.op){case"<":return n":return n>e;case">=":return n>=e;case"=":return n===e;case"<>":return n!==e}return!1}}]),t}(),D=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){var r;return(0,h.Z)(this,e),r=n.call(this),(0,d.Z)((0,i.Z)(r),"condition",void 0),r.condition=t,r}return(0,v.Z)(e,[{key:"steps",value:(0,c.Z)().mark((function t(n){var e,i,r;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.condition.check(n)){t.next=21;break}return t.next=3,this;case 3:e=(0,o.Z)(this.instructions),t.prev=4,e.s();case 6:if((i=e.n()).done){t.next=11;break}return r=i.value,t.delegateYield(r.steps(n),"t0",9);case 9:t.next=6;break;case 11:t.next=16;break;case 13:t.prev=13,t.t1=t.catch(4),e.e(t.t1);case 16:return t.prev=16,e.f(),t.finish(16);case 19:t.next=0;break;case 21:case"end":return t.stop()}}),t,this,[[4,13,16,19]])}))}]),e}(V),j=function(){function t(n){(0,h.Z)(this,t),(0,d.Z)(this,"content",void 0),this.content=n}return(0,v.Z)(t,[{key:"do",value:function(t){t.echo(this.content)}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),C=function(){function t(){(0,h.Z)(this,t)}return(0,v.Z)(t,[{key:"do",value:function(t){t.clearEcho()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),L=function(){function t(n){(0,h.Z)(this,t),(0,d.Z)(this,"file",void 0),this.file=n}return(0,v.Z)(t,[{key:"do",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(n){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.fs.pushd("/samples"),t.next=3,n.load(this.file);case 3:n.fs.popd();case 4:case"end":return t.stop()}}),t,this)})));return function(n){return t.apply(this,arguments)}}()},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),R=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"_chipTestInstruction_",!0)}return(0,v.Z)(t,[{key:"do",value:function(t){t.eval()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),T=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"_chipTestInstruction_",!0)}return(0,v.Z)(t,[{key:"do",value:function(t){t.tick()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),I=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"_chipTestInstruction_",!0)}return(0,v.Z)(t,[{key:"do",value:function(t){t.tock()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}()},7693:function(t,n,e){e.d(n,{a:function(){return u},op:function(){return a},p:function(){return s}});var i=e(9422),r=e(6693);function u(t){return 32768&t?function(t){t&=65535;var n=(4096&t)>>12,e=(4032&t)>>6,i=(56&t)>>3,u=7&t;if(void 0===r.PH.op[e])return"#ERR";var a=r.PH.op[e];n&&(a=a.replace(/A/g,"M"));var s=r.Uc.op[i],o=r.lK.op[u],c=a;s&&(c="".concat(s,"=").concat(c));o&&(c="".concat(c,";").concat(o));return c}(t):function(t){return"@"+(32767&t).toString(10)}(t)}function a(t){return"@"===t[0]?function(t){return parseInt(t.substring(1),10)}(t):function(t){var n,e=t.match((0,i.Z)(/(?:([AMD]{1,3})=)?([-!01ADM&|]{1,3})(?:;(JGT|JLT|JGE|JLE|JEQ|JMP))?/,{assign:1,operation:2,jump:3})),u=null!==(n=null===e||void 0===e?void 0:e.groups)&&void 0!==n?n:{},a=u.assign,o=u.operation,c=u.jump,l=o.includes("M")||a.includes("M"),h=r.Uc.asm[null!==a&&void 0!==a?a:""],v=r.lK.asm[null!==c&&void 0!==c?c:""],d=r.PH.asm[null!==o&&void 0!==o?o:""];return s(l,d,h,v)}(t)}function s(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=57344,u=t?4096:0,a=n<<6,s=(null!==e&&void 0!==e?e:0)<<3,o=null!==i&&void 0!==i?i:0;return r+u+a+s+o}},326:function(t,n,e){e.d(n,{$v:function(){return l},Af:function(){return s},C$:function(){return c},C2:function(){return f},E_:function(){return v},Ly:function(){return h},nN:function(){return d},o5:function(){return o}});var i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];function r(t){var n;return null!==(n=i[t])&&void 0!==n?n:"X"}function u(t){switch(t){case 0:return"0000";case 1:return"0001";case 2:return"0010";case 3:return"0011";case 4:return"0100";case 5:return"0101";case 6:return"0110";case 7:return"0111";case 8:return"1000";case 9:return"1001";case 10:return"1010";case 11:return"1011";case 12:return"1100";case 13:return"1101";case 14:return"1110";case 15:return"1111";default:return"erro"}}function a(t,n){return 65535&parseInt(t.replace(/[^\d+-.xa-fA-F]/g,""),n)}function s(t){return a(t,16)}function o(t){return a(t,10)}function c(t){return a(t,2)}function l(t){var n=r((61440&t)>>12),e=r((3840&t)>>8),i=r((240&t)>>4),u=r(15&t);return"0x".concat(n).concat(e).concat(i).concat(u)}function h(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,e=u((61440&t)>>12),i=u((3840&t)>>8),r=u((240&t)>>4),a=u(15&t);return"".concat(e).concat(i).concat(r).concat(a).substring(16-n)}function v(t){return 32768===(t&=65535)?"-32768":32768&t?"-".concat(t=1+~t&32767):"".concat(t)}function d(t){return"".concat(t&=65535)}function f(t,n){var e=~((t&=65535)&(n&=65535));return e&=65535}}}]); +//# sourceMappingURL=356.1228c852.chunk.js.map \ No newline at end of file diff --git a/build/static/js/356.1228c852.chunk.js.map b/build/static/js/356.1228c852.chunk.js.map new file mode 100644 index 000000000..b3a8b7d15 --- /dev/null +++ b/build/static/js/356.1228c852.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/356.1228c852.chunk.js","mappings":"yNAMaA,EAAY,SAAH,GAUjB,QATHC,UAAAA,OAAS,IAAG,KAAE,EACdC,EAAG,EAAHA,IACAC,EAAG,EAAHA,IACAC,EAAS,EAATA,UAOMC,EAASC,EAAAA,GAAAA,MAAUJ,GACnBK,EAAUD,EAAAA,GAAAA,MAAUH,GAE1B,IAAIK,EAAAA,EAAAA,IAAMH,GACR,OACEI,EAAAA,EAAAA,MAAAA,UAAAA,CAAAC,SAAAA,EACEC,EAAAA,EAAAA,KAAAA,UAAAA,CA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GAAJA,EAAS,OAGV,GAAP,OAAUA,EACZ,CAEM,SAAUuiB,EAAIviB,GAElB,MAAO,GAAP,OADAA,GAAQ,MAEV,CAEM,SAAUyI,EAAOhC,EAAWC,GAGhC,IAAIU,KAFJX,GAAQ,QACRC,GAAQ,QAGR,OADAU,GAAQ,KAEV,C","sources":["../../components/src/difftable.tsx","../../simulator/src/chip/builder.ts","../../simulator/src/chip/builtins/computer/computer.tsx","../../simulator/src/chip/builtins/logic/and.ts","../../simulator/src/chip/builtins/logic/dmux.ts","../../simulator/src/chip/builtins/logic/mux.ts","../../simulator/src/chip/builtins/logic/nand.ts","../../simulator/src/chip/builtins/logic/not.ts","../../simulator/src/chip/builtins/logic/or.ts","../../simulator/src/chip/builtins/logic/xor.ts","../../simulator/src/chip/builtins/arithmetic/add_16.ts","../../simulator/src/chip/builtins/arithmetic/alu.tsx","../../simulator/src/chip/builtins/arithmetic/half_adder.ts","../../simulator/src/chip/builtins/arithmetic/full_adder.ts","../../simulator/src/chip/builtins/arithmetic/inc16.ts","../../simulator/src/chip/builtins/sequential/dff.ts","../../simulator/src/chip/builtins/index.ts","../../simulator/src/chip/builtins/sequential/bit.tsx","../../simulator/src/chip/builtins/sequential/ram.tsx","../../simulator/src/chip/chip.tsx","../../simulator/src/chip/clock.ts","../../simulator/src/cpu/alu.ts","../../simulator/src/cpu/cpu.ts","../../simulator/src/cpu/memory.ts","../../simulator/src/languages/grammars/asm.ohm.js","../../simulator/src/languages/asm.ts","../../simulator/src/fs.ts","../../simulator/src/languages/base.ts","../../simulator/src/languages/grammars/base.ohm.js","../../simulator/src/languages/grammars/cmp.ohm.js","../../simulator/src/languages/cmp.ts","../../simulator/src/languages/grammars/hdl.ohm.js","../../simulator/src/languages/hdl.ts","../../simulator/src/languages/grammars/tst.ohm.js","../../simulator/src/languages/tst.ts","../../simulator/src/output.ts","../../simulator/src/tst.ts","../../simulator/src/util/asm.ts","../../simulator/src/util/twos.ts"],"sourcesContent":["import { CMP } from \"@nand2tetris/simulator/languages/cmp.js\";\nimport { display } from \"@davidsouther/jiffies/lib/esm/display.js\";\nimport { range } from \"@davidsouther/jiffies/lib/esm/range.js\";\nimport { Err, isErr, Ok } from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { ReactElement } from \"react\";\n\nexport const DiffTable = ({\n className = \"\",\n out,\n cmp,\n zeroState,\n}: {\n out: string;\n cmp: string;\n className?: string;\n zeroState?: ReactElement;\n}) => {\n const output = CMP.parse(out);\n const compare = CMP.parse(cmp);\n\n if (isErr(output)) {\n return (\n
\n Failed to parse output\n
{display(Err(output))}
\n \n
{out}
\n
\n
\n );\n }\n\n if (isErr(compare)) {\n return (\n
\n Failed to parse compare\n \n
{display(Err(compare))}
\n
{cmp}
\n
\n
\n );\n }\n\n const cmpData = Ok(compare);\n const outData = Ok(output);\n let failures = 0;\n const table = range(0, Math.min(cmpData.length, outData.length)).map((i) => {\n const cmpI = cmpData[i] ?? [];\n const outI = outData[i] ?? [];\n return range(0, Math.max(cmpI.length, outI.length))\n .map((_, j) => [cmpI[j] ?? \"\", outI[j] ?? \"\"])\n .map(([cmp, out]) => {\n const cell = {\n cmp: cmp ?? '\"',\n out: out ?? '\"',\n pass:\n cmp?.trim().match(/^\\*+$/) !== null || out?.trim() === cmp?.trim(),\n };\n if (!cell.pass) {\n failures += 1;\n }\n return cell;\n });\n });\n\n return (\n
\n {failures > 0 && (\n

\n {failures} failure{failures === 1 ? \"\" : \"s\"}\n

\n )}\n {table.length > 0 ? (\n \n \n {table.map((row, i) => (\n \n {row.map(({ cmp, out, pass }, i) => (\n \n ))}\n \n ))}\n \n \n ) : (\n zeroState ??

Execute test script to compare output.

\n )}\n
\n );\n};\n\nconst DiffCell = ({\n cmp,\n out,\n pass,\n}: {\n cmp: string;\n out: string;\n pass: boolean;\n}) => {\n return pass ? (\n <>\n {cmp}\n \n ) : (\n <>\n \n {cmp}\n
\n {out}\n \n \n );\n};\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport {\n Err,\n isErr,\n isOk,\n Ok,\n Result,\n} from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { HDL, HdlParse } from \"../languages/hdl.js\";\nimport { getBuiltinChip, hasBuiltinChip } from \"./builtins/index.js\";\nimport { Chip, Connection } from \"./chip.js\";\n\nfunction pinWidth(start: number, end: number | undefined): number | undefined {\n if (end === undefined) {\n return undefined;\n }\n if (end >= start) {\n return end - start + 1;\n }\n if (start > 0 && end === 0) {\n return 1;\n }\n throw new Error(`Bus specification has start > end (${start} > ${end})`);\n}\n\nexport async function parse(\n code: string\n): Promise> {\n const parsed = HDL.parse(code.toString());\n if (isErr(parsed)) return parsed;\n return build(Ok(parsed));\n}\n\nexport async function loadChip(\n name: string,\n fs?: FileSystem\n): Promise> {\n if (hasBuiltinChip(name) || fs === undefined) {\n return getBuiltinChip(name);\n }\n try {\n const file = await fs.readFile(`${name}.hdl`);\n const maybeParsedHDL = HDL.parse(file);\n const chip = isOk(maybeParsedHDL)\n ? build(Ok(maybeParsedHDL), fs)\n : Err(new Error(\"HDL Was not parsed\"));\n return chip;\n } catch (e) {\n return Err(new Error(`Could not load chip ${name}.hdl` /*, { cause: e }*/));\n }\n}\n\nexport async function build(\n parts: HdlParse,\n fs?: FileSystem\n): Promise> {\n if (parts.parts === \"BUILTIN\") {\n return getBuiltinChip(parts.name.toString());\n }\n\n const buildChip = new Chip(\n parts.ins.map(({ pin, width }) => ({ pin: pin.toString(), width })),\n parts.outs.map(({ pin, width }) => ({ pin: pin.toString(), width })),\n parts.name.toString(),\n [],\n parts.clocked\n );\n\n for (const part of parts.parts) {\n const builtin = await loadChip(part.name.toString(), fs);\n if (isErr(builtin)) return builtin;\n const partChip = Ok(builtin);\n\n const wires = part.wires.map(({ lhs, rhs }) => ({\n to: {\n name: lhs.pin.toString(),\n start: lhs.start ?? 0,\n width: pinWidth(lhs.start ?? 0, lhs.end),\n },\n from: {\n name: rhs.pin.toString(),\n start: rhs.start ?? 0,\n width: pinWidth(rhs.start ?? 0, rhs.end),\n },\n }));\n\n try {\n buildChip.wire(partChip, wires);\n } catch (e) {\n return Err(e as Error);\n }\n }\n\n return Ok(buildChip);\n}\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n// import { Screen as ScreenComponent } from \"../../../../app/components/chips/screen.js\";\n// import { Keyboard as KeyboardComponent } from \"../../../../app/components/chips/keyboard.js\";\n// import { RegisterComponent } from \"../../../../app/components/chips/register.js\";\n// import { ALUComponent } from \"../../../../app/components/chips/alu.js\";\n// import { Flags } from \"../../../cpu/alu.js\";\nimport { Chip, ClockedChip, ConstantBus, HIGH, LOW, Pin } from \"../../chip.js\";\nimport { RAM, RAM16K } from \"../sequential/ram.js\";\nimport {\n CPUInput,\n CPUState,\n cpuTick,\n cpuTock,\n emptyState,\n} from \"../../../cpu/cpu.js\";\nimport { int10 } from \"../../../util/twos.js\";\nimport { load } from \"../../../fs.js\";\nimport { KEYBOARD, SCREEN } from \"../../../cpu/memory.js\";\n\nexport class ROM32K extends RAM {\n constructor() {\n super(16, \"ROM\");\n }\n\n override async load(fs: FileSystem, path: string) {\n try {\n (await load(fs, path)).map((v, i) => (this.at(i).busVoltage = v));\n } catch (cause) {\n // throw new Error(`ROM32K Failed to load file ${path}`, { cause });\n throw new Error(`ROM32K Failed to load file ${path}`);\n }\n }\n}\n\nexport class Screen extends RAM {\n static readonly OFFSET = SCREEN;\n\n constructor() {\n super(13, \"Screen\");\n }\n}\n\nexport class Keyboard extends Chip {\n static readonly OFFSET = KEYBOARD;\n\n constructor() {\n super([], [\"out[16]\"], \"Keyboard\");\n }\n\n setKey(key: number) {\n this.out().busVoltage = key & 0xffff;\n }\n\n clearKey() {\n this.out().busVoltage = 0;\n }\n}\n\nexport class Memory extends ClockedChip {\n private ram = new RAM16K();\n private screen = new Screen();\n private keyboard = new Keyboard();\n private address = 0;\n\n constructor() {\n super([\"in[16]\", \"load\", \"address[15])\"], [\"out[16]\"], \"Memory\");\n this.parts.add(this.keyboard);\n this.parts.add(this.screen);\n this.parts.add(this.ram);\n }\n\n override tick() {\n const load = this.in(\"load\").voltage();\n this.address = this.in(\"address\").busVoltage;\n if (load) {\n const inn = this.in().busVoltage;\n if (this.address >= Keyboard.OFFSET) {\n // Keyboard, do nothing\n } else if (this.address >= Screen.OFFSET) {\n this.screen.at(this.address - Screen.OFFSET).busVoltage = inn;\n } else {\n this.ram.at(this.address).busVoltage = inn;\n }\n }\n }\n\n override tock() {\n this.eval();\n }\n\n override eval() {\n if (!this.ram) return;\n this.address = this.in(\"address\").busVoltage;\n let out = 0;\n if (this.address >= Keyboard.OFFSET) {\n // Keyboard, do nothing\n out = this.keyboard?.out().busVoltage ?? 0;\n } else if (this.address >= Screen.OFFSET) {\n out = this.screen?.at(this.address - Screen.OFFSET).busVoltage ?? 0;\n } else {\n out = this.ram?.at(this.address).busVoltage ?? 0;\n }\n this.out().busVoltage = out;\n }\n\n override in(pin?: string): Pin {\n if (pin?.startsWith(\"RAM16K\")) {\n const idx = int10(pin.match(/\\[(?\\d+)]/)?.groups?.idx ?? \"0\");\n return this.ram.at(idx);\n }\n if (pin?.startsWith(\"Screen\")) {\n const idx = int10(pin.match(/\\[(?\\d+)]/)?.groups?.idx ?? \"0\");\n return this.screen.at(idx);\n }\n return super.in(pin);\n }\n\n override get(name: string, offset = 0): Pin | undefined {\n if (name.startsWith(\"RAM16K\")) {\n return this.at(offset & 0x3fff);\n }\n if (name.startsWith(\"Screen\")) {\n return this.at(offset & (0x1fff + Screen.OFFSET));\n }\n if (name.startsWith(\"Keyboard\")) {\n return this.at(Keyboard.OFFSET);\n }\n if (name.startsWith(\"Memory\")) {\n return this.at(offset);\n }\n return super.get(name, offset);\n }\n\n at(offset: number): Pin {\n if (offset >= Keyboard.OFFSET) {\n return this.keyboard.out();\n }\n if (offset >= Screen.OFFSET) {\n return this.screen.at(offset - Screen.OFFSET);\n } else {\n return this.ram.at(offset);\n }\n }\n}\n\nexport class CPU extends ClockedChip {\n private _state: CPUState = emptyState();\n\n get state(): CPUState {\n return this._state;\n }\n\n constructor() {\n super(\n [\"inM[16]\", \"instruction[16]\", \"reset\"],\n [\"outM[16]\", \"writeM\", \"addressM[15]\", \"pc[15]\"]\n );\n }\n\n override tick(): void {\n const [state, writeM] = cpuTick(this.cpuInput(), this._state);\n this._state = state;\n this.out(\"writeM\").pull(writeM ? HIGH : LOW);\n this.out(\"outM\").busVoltage = this._state.ALU ?? 0;\n }\n\n override tock(): void {\n if (!this._state) return; // Skip initial tock\n const [output, state] = cpuTock(this.cpuInput(), this._state);\n this._state = state;\n\n this.out(\"addressM\").busVoltage = output.addressM ?? 0;\n this.out(\"outM\").busVoltage = output.outM ?? 0;\n this.out(\"writeM\").pull(output.writeM ? HIGH : LOW);\n this.out(\"pc\").busVoltage = this._state?.PC ?? 0;\n }\n\n private cpuInput(): CPUInput {\n const inM = this.in(\"inM\").busVoltage;\n const instruction = this.in(\"instruction\").busVoltage;\n const reset = this.in(\"reset\").busVoltage === 1;\n return { inM, instruction, reset };\n }\n\n override get(pin: string, offset?: number): Pin | undefined {\n if (pin?.startsWith(\"ARegister\")) {\n return new ConstantBus(\"ARegister\", this._state.A);\n }\n if (pin?.startsWith(\"DRegister\")) {\n return new ConstantBus(\"DRegister\", this._state.D);\n }\n if (pin?.startsWith(\"PC\")) {\n return new ConstantBus(\"PC\", this._state.PC);\n }\n return super.get(pin, offset);\n }\n\n override reset() {\n this._state = emptyState();\n super.reset();\n }\n}\n\nexport class Computer extends Chip {\n #ram = new Memory();\n #rom = new ROM32K();\n #cpu = new CPU();\n\n constructor() {\n super([\"reset\"], []);\n\n this.wire(this.#cpu, [\n { from: { name: \"reset\", start: 0 }, to: { name: \"reset\", start: 0 } },\n {\n from: { name: \"instruction\", start: 0 },\n to: { name: \"instruction\", start: 0 },\n },\n { from: { name: \"outM\", start: 0 }, to: { name: \"inM\", start: 0 } },\n { from: { name: \"writeM\", start: 0 }, to: { name: \"writeM\", start: 0 } },\n {\n from: { name: \"addressM\", start: 0 },\n to: { name: \"addressM\", start: 0 },\n },\n ]);\n\n this.wire(this.#rom, [\n { from: { name: \"pc\", start: 0 }, to: { name: \"address\", start: 0 } },\n {\n from: { name: \"instruction\", start: 0 },\n to: { name: \"out\", start: 0 },\n },\n ]);\n\n this.wire(this.#ram, [\n { from: { name: \"inM\", start: 0 }, to: { name: \"in\", start: 0 } },\n { from: { name: \"writeM\", start: 0 }, to: { name: \"load\", start: 0 } },\n {\n from: { name: \"addressM\", start: 0 },\n to: { name: \"address\", start: 0 },\n },\n { from: { name: \"outM\", start: 0 }, to: { name: \"out\", start: 0 } },\n ]);\n }\n\n override eval() {\n super.eval();\n }\n\n override get(name: string, offset?: number): Pin | undefined {\n if (\n name.startsWith(\"PC\") ||\n name.startsWith(\"ARegister\") ||\n name.startsWith(\"DRegister\")\n ) {\n return this.#cpu.get(name);\n }\n if (name.startsWith(\"RAM16K\")) {\n return this.#ram.get(name, offset);\n }\n return super.get(name, offset);\n }\n\n override load(fs: FileSystem, path: string): Promise {\n return this.#rom.load(fs, path);\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function and(a: Voltage, b: Voltage): [Voltage] {\n return [a === 1 && b === 1 ? HIGH : LOW];\n}\n\nexport function and16(a: number, b: number): [number] {\n return [a & b & 0xffff];\n}\n\nexport class And extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [n] = and(a, b);\n this.out().pull(n);\n }\n}\n\nexport class And16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const [n] = and16(a, b);\n this.out().busVoltage = n;\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function dmux(inn: Voltage, sel: Voltage): [Voltage, Voltage] {\n const a = sel === LOW && inn === HIGH ? HIGH : LOW;\n const b = sel === HIGH && inn === HIGH ? HIGH : LOW;\n return [a, b];\n}\n\nexport function dmux4way(\n inn: Voltage,\n sel: number\n): [Voltage, Voltage, Voltage, Voltage] {\n const a = sel === 0b00 && inn === HIGH ? HIGH : LOW;\n const b = sel === 0b01 && inn === HIGH ? HIGH : LOW;\n const c = sel === 0b10 && inn === HIGH ? HIGH : LOW;\n const d = sel === 0b11 && inn === HIGH ? HIGH : LOW;\n return [a, b, c, d];\n}\n\nexport function dmux8way(\n inn: Voltage,\n sel: number\n): [Voltage, Voltage, Voltage, Voltage, Voltage, Voltage, Voltage, Voltage] {\n const a = sel === 0b000 && inn === HIGH ? HIGH : LOW;\n const b = sel === 0b001 && inn === HIGH ? HIGH : LOW;\n const c = sel === 0b010 && inn === HIGH ? HIGH : LOW;\n const d = sel === 0b011 && inn === HIGH ? HIGH : LOW;\n const e = sel === 0b100 && inn === HIGH ? HIGH : LOW;\n const f = sel === 0b101 && inn === HIGH ? HIGH : LOW;\n const g = sel === 0b110 && inn === HIGH ? HIGH : LOW;\n const h = sel === 0b111 && inn === HIGH ? HIGH : LOW;\n return [a, b, c, d, e, f, g, h];\n}\n\nexport class DMux extends Chip {\n constructor() {\n super([\"in\", \"sel\"], [\"a\", \"b\"]);\n }\n\n override eval() {\n const inn = this.in(\"in\").voltage();\n const sel = this.in(\"sel\").voltage();\n\n const [a, b] = dmux(inn, sel);\n this.out(\"a\").pull(a);\n this.out(\"b\").pull(b);\n }\n}\n\nexport class DMux4Way extends Chip {\n constructor() {\n super([\"in\", \"sel[2]\"], [\"a\", \"b\", \"c\", \"d\"]);\n }\n\n override eval() {\n const inn = this.in(\"in\").voltage();\n const sel = this.in(\"sel\").busVoltage;\n\n const [a, b, c, d] = dmux4way(inn, sel);\n this.out(\"a\").pull(a);\n this.out(\"b\").pull(b);\n this.out(\"c\").pull(c);\n this.out(\"d\").pull(d);\n }\n}\n\nexport class DMux8Way extends Chip {\n constructor() {\n super([\"in\", \"sel[3]\"], [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"]);\n }\n\n override eval() {\n const inn = this.in(\"in\").voltage();\n const sel = this.in(\"sel\").busVoltage;\n\n const [a, b, c, d, e, f, g, h] = dmux8way(inn, sel);\n this.out(\"a\").pull(a);\n this.out(\"b\").pull(b);\n this.out(\"c\").pull(c);\n this.out(\"d\").pull(d);\n this.out(\"e\").pull(e);\n this.out(\"f\").pull(f);\n this.out(\"g\").pull(g);\n this.out(\"h\").pull(h);\n }\n}\n","import { Chip, LOW, Voltage } from \"../../chip.js\";\n\nexport function mux(a: Voltage, b: Voltage, sel: Voltage): [Voltage] {\n return [sel === LOW ? a : b];\n}\n\nexport function mux16(a: number, b: number, sel: Voltage): [number] {\n return [sel === LOW ? a : b];\n}\n\nexport function mux16_4(\n a: number,\n b: number,\n c: number,\n d: number,\n sel: number\n): [number] {\n const s2 = (sel & 0b01) as Voltage;\n return (sel & 0b10) === 0b00 ? mux16(a, b, s2) : mux16(c, d, s2);\n}\n\nexport function mux16_8(\n a: number,\n b: number,\n c: number,\n d: number,\n e: number,\n f: number,\n g: number,\n h: number,\n sel: number\n): [number] {\n const s2 = (sel & 0b11) as Voltage;\n return (sel & 0b100) === 0b000\n ? mux16_4(a, b, c, d, s2)\n : mux16_4(e, f, g, h, s2);\n}\n\nexport class Mux extends Chip {\n constructor() {\n super([\"a\", \"b\", \"sel\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const sel = this.in(\"sel\").voltage();\n\n const [set] = mux(a, b, sel);\n this.out().pull(set);\n }\n}\n\nexport class Mux16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\", \"sel\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const sel = this.in(\"sel\").voltage();\n const [out] = mux16(a, b, sel);\n this.out().busVoltage = out;\n }\n}\n\nexport class Mux4Way16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\", \"c[16]\", \"d[16]\", \"sel[2]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const c = this.in(\"c\").busVoltage;\n const d = this.in(\"d\").busVoltage;\n const sel = this.in(\"sel\").busVoltage;\n const [out] = mux16_4(a, b, c, d, sel);\n\n this.out().busVoltage = out;\n }\n}\n\nexport class Mux8Way16 extends Chip {\n constructor() {\n super(\n [\n \"a[16]\",\n \"b[16]\",\n \"c[16]\",\n \"d[16]\",\n \"e[16]\",\n \"f[16]\",\n \"g[16]\",\n \"h[16]\",\n \"sel[3]\",\n ],\n [\"out[16]\"]\n );\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const c = this.in(\"c\").busVoltage;\n const d = this.in(\"d\").busVoltage;\n const e = this.in(\"e\").busVoltage;\n const f = this.in(\"f\").busVoltage;\n const g = this.in(\"g\").busVoltage;\n const h = this.in(\"h\").busVoltage;\n const sel = this.in(\"sel\").busVoltage;\n const [out] = mux16_8(a, b, c, d, e, f, g, h, sel);\n\n this.out().busVoltage = out;\n }\n}\n","import { nand16 } from \"../../../util/twos.js\";\nimport { HIGH, LOW, Chip, Voltage } from \"../../chip.js\";\n\nexport function nand(a: Voltage, b: Voltage): [Voltage] {\n return [a === 1 && b === 1 ? LOW : HIGH];\n}\n\nexport class Nand extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [out] = nand(a, b);\n this.out().pull(out);\n }\n}\n\nexport class Nand16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n this.out().busVoltage = nand16(a, b);\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function not(inn: Voltage): [Voltage] {\n return [inn === LOW ? HIGH : LOW];\n}\n\nexport function not16(inn: number): [number] {\n return [~inn & 0xffff];\n}\n\nexport class Not extends Chip {\n constructor() {\n super([\"in\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"in\").voltage();\n const [out] = not(a);\n this.out().pull(out);\n }\n}\n\nexport class Not16 extends Chip {\n constructor() {\n super([\"in[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const [n] = not16(this.in().busVoltage);\n this.out().busVoltage = n;\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function or(a: Voltage, b: Voltage): [Voltage] {\n return [a === 1 || b === 1 ? HIGH : LOW];\n}\n\nexport function or16(a: number, b: number): [number] {\n return [(a | b) & 0xffff];\n}\n\nexport function or8way(a: number): [Voltage] {\n return [(a & 0xff) === 0 ? LOW : HIGH];\n}\n\nexport class Or extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [out] = or(a, b);\n this.out().pull(out);\n }\n}\n\nexport class Or16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const [out] = or16(a, b);\n this.out().busVoltage = out;\n }\n}\n\nexport class Or8way extends Chip {\n constructor() {\n super([\"in[8]\"], [\"out\"], \"Or8way\");\n }\n\n override eval() {\n const inn = this.in().busVoltage;\n const [out] = or8way(inn);\n this.out().pull(out);\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function xor(a: Voltage, b: Voltage): [Voltage] {\n return [(a === HIGH && b === LOW) || (a === LOW && b === HIGH) ? HIGH : LOW];\n}\n\nexport function xor16(a: number, b: number): [number] {\n return [(a ^ b) & 0xffff];\n}\n\nexport class Xor extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [out] = xor(a, b);\n this.out().pull(out);\n }\n}\n\nexport class Xor16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const [out] = xor16(a, b);\n this.out().busVoltage = out;\n }\n}\n","import { Chip } from \"../../chip.js\";\n\nexport function add16(a: number, b: number): [number] {\n return [(a + b) & 0xffff];\n}\n\nexport class Add16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"], \"Add16\");\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const [out] = add16(a, b);\n this.out().busVoltage = out;\n }\n}\n","import { alu, alua, COMMANDS_OP, Flags } from \"../../../cpu/alu.js\";\nimport { Chip, HIGH, LOW } from \"../../chip.js\";\n\nexport class ALUNoStat extends Chip {\n constructor() {\n super(\n [\n \"x[16]\",\n \"y[16]\", // 16-bit inputs\n \"zx\", // zero the x input?\n \"nx\", // negate the x input?\n \"zy\", // zero the y input?\n \"ny\", // negate the y input?\n \"f\", // compute out = x + y (if 1) or x & y (if 0)\n \"no\", // negate the out output?\n ],\n [\n \"out[16]\", // 16-bit output\n ],\n \"ALU\"\n );\n }\n\n override eval() {\n const x = this.in(\"x\").busVoltage;\n const y = this.in(\"y\").busVoltage;\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n\n const [out] = alu(op, x, y);\n\n this.out().busVoltage = out;\n }\n}\n\nexport class ALU extends Chip {\n constructor() {\n super(\n [\n \"x[16]\",\n \"y[16]\", // 16-bit inputs\n \"zx\", // zero the x input?\n \"nx\", // negate the x input?\n \"zy\", // zero the y input?\n \"ny\", // negate the y input?\n \"f\", // compute out = x + y (if 1) or x & y (if 0)\n \"no\", // negate the out output?\n ],\n [\n \"out[16]\", // 16-bit output\n \"zr\", // 1 if (out === 0), 0 otherwise\n \"ng\", // 1 if (out < 0), 0 otherwise\n ],\n \"ALU\"\n );\n }\n\n override eval() {\n const x = this.in(\"x\").busVoltage;\n const y = this.in(\"y\").busVoltage;\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n\n const [out, flags] = alu(op, x, y);\n\n const ng = flags === Flags.Negative ? HIGH : LOW;\n const zr = flags === Flags.Zero ? HIGH : LOW;\n this.out(\"out\").busVoltage = out;\n this.out(\"ng\").pull(ng);\n this.out(\"zr\").pull(zr);\n }\n\n op(): COMMANDS_OP {\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n return op as COMMANDS_OP;\n }\n}\n\nexport class ALUAll extends Chip {\n constructor() {\n super(\n [\n \"x[16]\",\n \"y[16]\", // 16-bit inputs\n \"zx\", // zero the x input?\n \"nx\", // negate the x input?\n \"zy\", // zero the y input?\n \"ny\", // negate the y input?\n \"f\", // compute out = x + y (if 1) or x & y (if 0)\n \"no\", // negate the out output?\n ],\n [\n \"out[16]\", // 16-bit output\n \"zr\", // 1 if (out === 0), 0 otherwise\n \"ng\", // 1 if (out < 0), 0 otherwise\n ],\n \"ALU\"\n );\n }\n\n override eval() {\n const x = this.in(\"x\").busVoltage;\n const y = this.in(\"y\").busVoltage;\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n\n const [out, flags] = alua(op, x, y);\n\n const ng = flags === Flags.Negative ? HIGH : LOW;\n const zr = flags === Flags.Zero ? HIGH : LOW;\n this.out(\"out\").busVoltage = out;\n this.out(\"ng\").pull(ng);\n this.out(\"zr\").pull(zr);\n }\n\n op(): COMMANDS_OP {\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n return op as COMMANDS_OP;\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function halfAdder(a: Voltage, b: Voltage): [Voltage, Voltage] {\n const sum = (a === 1 && b === 0) || (a === 0 && b === 1) ? HIGH : LOW;\n const car = a === 1 && b === 1 ? HIGH : LOW;\n\n return [sum, car];\n}\n\nexport class HalfAdder extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"sum\", \"carry\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [sum, carry] = halfAdder(a, b);\n this.out(\"sum\").pull(sum);\n this.out(\"carry\").pull(carry);\n }\n}\n","import { Chip, Voltage } from \"../../chip.js\";\nimport { or } from \"../logic/or.js\";\nimport { halfAdder } from \"./half_adder.js\";\n\nexport function fullAdder(\n a: Voltage,\n b: Voltage,\n c: Voltage\n): [Voltage, Voltage] {\n const [s, ca] = halfAdder(a, b);\n const [sum, cb] = halfAdder(s, c);\n const [carry] = or(ca, cb);\n\n return [sum, carry];\n}\n\nexport class FullAdder extends Chip {\n constructor() {\n super([\"a\", \"b\", \"c\"], [\"sum\", \"carry\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const c = this.in(\"c\").voltage();\n const [sum, carry] = fullAdder(a, b, c);\n this.out(\"sum\").pull(sum);\n this.out(\"carry\").pull(carry);\n }\n}\n","import { Chip } from \"../../chip.js\";\nimport { add16 } from \"./add_16.js\";\n\nexport function inc16(n: number): [number] {\n return add16(n, 1);\n}\n\nexport class Inc16 extends Chip {\n constructor() {\n super([\"in[16]\"], [\"out[16]\"], \"Inc16\");\n }\n\n override eval() {\n const a = this.in().busVoltage;\n const [out] = inc16(a);\n this.out().busVoltage = out;\n }\n}\n","import { ClockedChip } from \"../../chip.js\";\n\nexport class DFF extends ClockedChip {\n constructor(name?: string) {\n super([\"in\"], [\"out\"], name, [\"t\"]);\n }\n\n override tick() {\n // Read in into t\n const t = this.in().voltage();\n this.pin(\"t\").pull(t);\n }\n\n override tock() {\n // write t into out\n const t = this.pin(\"t\").voltage();\n this.out().pull(t);\n }\n}\n","import { Err, Ok, Result } from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { Chip } from \"../chip.js\";\n\nimport { And, And16 } from \"./logic/and.js\";\nimport { DMux, DMux4Way, DMux8Way } from \"./logic/dmux.js\";\nimport { Mux, Mux16, Mux4Way16, Mux8Way16 } from \"./logic/mux.js\";\nimport { Nand, Nand16 } from \"./logic/nand.js\";\nimport { Not, Not16 } from \"./logic/not.js\";\nimport { Or, Or16, Or8way } from \"./logic/or.js\";\nimport { Xor, Xor16 } from \"./logic/xor.js\";\n\nimport { Add16 } from \"./arithmetic/add_16.js\";\nimport { ALU, ALUNoStat } from \"./arithmetic/alu.js\";\nimport { FullAdder } from \"./arithmetic/full_adder.js\";\nimport { HalfAdder } from \"./arithmetic/half_adder.js\";\nimport { Inc16 } from \"./arithmetic/inc16.js\";\n\nimport {\n Computer,\n CPU,\n Keyboard,\n Memory,\n ROM32K,\n Screen,\n} from \"./computer/computer.js\";\nimport { Bit, PC, Register, VRegister } from \"./sequential/bit.js\";\nimport { DFF } from \"./sequential/dff.js\";\nimport { RAM16K, RAM4K, RAM512, RAM64, RAM8 } from \"./sequential/ram.js\";\n\nexport {\n And,\n And16,\n DMux,\n Mux,\n Mux16,\n Mux4Way16,\n Mux8Way16,\n Nand,\n Nand16,\n Not,\n Not16,\n Or,\n Or16,\n Or8way,\n Xor,\n Xor16,\n HalfAdder,\n FullAdder,\n Add16,\n Inc16,\n ALU,\n Bit,\n Register,\n VRegister as ARegister,\n VRegister as DRegister,\n DFF,\n RAM8,\n RAM64,\n RAM512,\n RAM4K,\n RAM16K,\n};\n\nexport const REGISTRY = new Map Chip>(\n (\n [\n [\"Nand\", Nand],\n [\"Nand16\", Nand16],\n [\"Not\", Not],\n [\"Not16\", Not16],\n [\"And\", And],\n [\"And16\", And16],\n [\"Or\", Or],\n [\"Or16\", Or16],\n [\"Or8Way\", Or8way],\n [\"XOr\", Xor],\n [\"XOr16\", Xor16],\n [\"Xor\", Xor],\n [\"Xor16\", Xor16],\n [\"Mux\", Mux],\n [\"Mux16\", Mux16],\n [\"Mux4Way16\", Mux4Way16],\n [\"Mux8Way16\", Mux8Way16],\n [\"DMux\", DMux],\n [\"DMux4Way\", DMux4Way],\n [\"DMux8Way\", DMux8Way],\n [\"HalfAdder\", HalfAdder],\n [\"FullAdder\", FullAdder],\n [\"Add16\", Add16],\n [\"Inc16\", Inc16],\n [\"ALU\", ALU],\n [\"ALUNoStat\", ALUNoStat],\n [\"DFF\", DFF],\n [\"Bit\", Bit],\n [\"Register\", Register],\n [\"ARegister\", Register],\n [\"DRegister\", Register],\n [\"PC\", PC],\n [\"RAM8\", RAM8],\n [\"RAM64\", RAM64],\n [\"RAM512\", RAM512],\n [\"RAM4K\", RAM4K],\n [\"RAM16K\", RAM16K],\n [\"ROM32K\", ROM32K],\n [\"Screen\", Screen],\n [\"Keyboard\", Keyboard],\n [\"CPU\", CPU],\n [\"Computer\", Computer],\n [\"Memory\", Memory],\n [\"ARegister\", VRegister],\n [\"DRegister\", VRegister],\n ] as [string, { new (): Chip }][]\n ).map(([name, ChipCtor]) => [\n name,\n () => {\n const chip = new ChipCtor();\n chip.name = name;\n return chip;\n },\n ])\n);\n\nexport function hasBuiltinChip(name: string): boolean {\n return REGISTRY.has(name);\n}\n\nexport function getBuiltinChip(name: string): Result {\n const chip = REGISTRY.get(name);\n return chip\n ? Ok(chip())\n : Err(new Error(`Chip ${name} not in builtin registry`));\n}\n","import { ClockedChip, HIGH, LOW, Pin, Voltage } from \"../../chip.js\";\n\nexport class Bit extends ClockedChip {\n bit: Voltage = LOW;\n\n constructor(name?: string) {\n super([\"in\", \"load\"], [\"out\"], name);\n }\n\n override tick() {\n if (this.in(\"load\").voltage() === HIGH) {\n this.bit = this.in().voltage();\n }\n }\n\n override tock() {\n this.out().pull(this.bit ?? 0);\n }\n\n override reset() {\n this.bit = LOW;\n }\n}\n\nexport class Register extends ClockedChip {\n bits = 0x00;\n\n constructor(name?: string) {\n super([\"in[16]\", \"load\"], [\"out[16]\"], name);\n }\n\n override tick() {\n if (this.in(\"load\").voltage() === HIGH) {\n this.bits = this.in().busVoltage & 0xffff;\n }\n }\n\n override tock() {\n this.out().busVoltage = this.bits & 0xffff;\n }\n\n override get(name: string, offset?: number): Pin | undefined {\n return name === this.name ? this.out() : super.get(name, offset);\n }\n\n override reset() {\n this.bits = 0x00;\n }\n}\n\nexport class VRegister extends Register {}\n\nexport class PC extends ClockedChip {\n bits = 0x00;\n\n constructor(name?: string) {\n super([\"in[16]\", \"load\", \"inc\", \"reset\"], [\"out[16]\"], name);\n }\n\n override tick() {\n if (this.in(\"reset\").voltage() === HIGH) {\n this.bits = 0;\n } else if (this.in(\"load\").voltage() === HIGH) {\n this.bits = this.in().busVoltage & 0xffff;\n } else if (this.in(\"inc\").voltage() === HIGH) {\n this.bits += 1;\n }\n }\n\n override tock() {\n this.out().busVoltage = this.bits & 0xffff;\n }\n\n override get(name: string, offset?: number): Pin | undefined {\n return name === this.name ? this.out() : super.get(name, offset);\n }\n\n override reset() {\n this.bits = 0x00;\n }\n}\n","import { Bus, ClockedChip, Pin } from \"../../chip.js\";\nimport { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { Memory, Memory as MemoryChip } from \"../../../cpu/memory.js\";\n\nexport class RAM extends ClockedChip {\n protected _memory: MemoryChip;\n private _nextData = 0;\n private _address = 0;\n\n get memory() {\n return this._memory;\n }\n get address() {\n return this._address;\n }\n\n constructor(readonly width: number, name?: string) {\n super([\"in[16]\", \"load\", `address[${width}]`], [`out[16]`], name);\n this._memory = new MemoryChip(Math.pow(2, this.width));\n }\n\n override tick() {\n const load = this.in(\"load\").voltage();\n this._address = this.in(\"address\").busVoltage;\n if (load) {\n this._nextData = this.in().busVoltage;\n this._memory.set(this._address, this._nextData);\n }\n }\n\n override tock() {\n this.out().busVoltage = this._memory?.get(this._address) ?? 0;\n }\n\n override eval() {\n const address = this.in(\"address\").busVoltage;\n this.out().busVoltage = this._memory?.get(address) ?? 0;\n }\n\n at(idx: number): Pin {\n assert(\n idx < this._memory.size,\n () => `Request out of bounds (${idx} >= ${this._memory.size})`\n );\n return new RamBus(`${this.name}[${idx}]`, idx, this._memory);\n }\n}\n\nexport class RamBus extends Bus {\n constructor(\n name: string,\n private readonly index: number,\n private ram: Memory\n ) {\n super(name);\n }\n\n override get busVoltage(): number {\n return this.ram.get(this.index);\n }\n\n override set busVoltage(num: number) {\n this.ram.set(this.index, num);\n }\n}\n\nexport class RAM8 extends RAM {\n constructor(name?: string) {\n super(3, name);\n }\n}\n\nexport class RAM64 extends RAM {\n constructor(name?: string) {\n super(6, name);\n }\n}\n\nexport class RAM512 extends RAM {\n constructor(name?: string) {\n super(9, name);\n }\n}\n\nexport class RAM4K extends RAM {\n constructor(name?: string) {\n super(12, name);\n }\n}\n\nexport class RAM16K extends RAM {\n constructor(name?: string) {\n super(14, name);\n }\n}\n","/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { assert, assertExists } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { range } from \"@davidsouther/jiffies/lib/esm/range.js\";\nimport { bin } from \"../util/twos.js\";\nimport { Clock } from \"./clock.js\";\n\nexport const HIGH = 1;\nexport const LOW = 0;\nexport type Voltage = typeof HIGH | typeof LOW;\n\nexport interface Pin {\n readonly name: string;\n readonly width: number;\n busVoltage: number;\n pull(voltage: Voltage, bit?: number): void;\n toggle(bit?: number): void;\n voltage(bit?: number): Voltage;\n connect(pin: Pin): void;\n}\n\nexport class Bus implements Pin {\n state: Voltage[];\n next: Pin[] = [];\n\n constructor(readonly name: string, readonly width = 1) {\n this.state = range(0, this.width).map(() => LOW);\n }\n\n ensureWidth(newWidth: number) {\n assert(newWidth <= 16, `Cannot widen past 16 to ${newWidth} bits`);\n if (this.width < newWidth) {\n (this as { width: number }).width = newWidth;\n this.state = [\n ...this.state,\n ...range(this.width, newWidth).map(() => LOW as Voltage),\n ];\n }\n }\n\n connect(next: Pin) {\n this.next.push(next);\n next.busVoltage = this.busVoltage;\n }\n\n pull(voltage: Voltage, bit = 0) {\n assert(\n bit >= 0 && bit < this.width,\n `Bit out of bounds: ${this.name}@${bit}`\n );\n this.state[bit] = voltage;\n this.next.forEach((n) => n.pull(voltage, bit));\n }\n\n voltage(bit = 0): Voltage {\n assert(bit >= 0 && bit < this.width);\n return this.state[bit];\n }\n\n set busVoltage(voltage: number) {\n for (const i of range(0, this.width)) {\n this.state[i] = ((voltage & (1 << i)) >> i) as Voltage;\n }\n this.next.forEach((n) => (n.busVoltage = this.busVoltage));\n }\n\n get busVoltage(): number {\n return range(0, this.width).reduce((b, i) => b | (this.state[i] << i), 0);\n }\n\n toggle(bit = 0) {\n const nextVoltage = this.voltage(bit) === LOW ? HIGH : LOW;\n this.pull(nextVoltage, bit);\n }\n}\n\nexport class InSubBus extends Bus {\n constructor(\n private bus: Pin,\n private start: number,\n override readonly width = 1\n ) {\n super(bus.name);\n assert(\n start >= 0 && start + width <= bus.width,\n `Mismatched InSubBus dimensions on ${bus.name} (${width} + ${start} > ${bus.width})`\n );\n this.connect(bus);\n }\n\n override pull(voltage: Voltage, bit = 0) {\n assert(bit >= 0 && bit < this.width);\n this.bus.pull(voltage, this.start + bit);\n }\n\n override voltage(bit = 0): Voltage {\n assert(bit >= 0 && bit < this.width);\n return this.bus.voltage(this.start + bit);\n }\n\n override set busVoltage(voltage: number) {\n const high = this.bus.busVoltage & ~mask(this.width + this.start);\n const low = this.bus.busVoltage & mask(this.start);\n const mid = (voltage & mask(this.width)) << this.start;\n this.bus.busVoltage = high | mid | low;\n }\n\n override get busVoltage(): number {\n return (this.bus.busVoltage >> this.start) & mask(this.width);\n }\n\n override connect(bus: Pin): void {\n assert(\n this.start + this.width <= bus.width,\n `Mismatched InSubBus connection dimensions (From ${bus.name} to ${this.name})`\n );\n this.bus = bus;\n }\n}\n\nexport class OutSubBus extends Bus {\n constructor(\n private bus: Pin,\n private start: number,\n override readonly width = 1\n ) {\n super(bus.name);\n assert(start >= 0 && width <= bus.width, `Mismatched OutSubBus dimensions`);\n this.connect(bus);\n }\n\n override set busVoltage(voltage: number) {\n this.bus.busVoltage =\n (voltage & mask(this.width + this.start)) >> this.start;\n }\n\n override get busVoltage(): number {\n return this.bus.busVoltage & mask(this.width);\n }\n\n override connect(bus: Pin): void {\n assert(\n this.width <= bus.width,\n `Mismatched OutSubBus connection dimensions`\n );\n this.bus = bus;\n }\n}\n\nexport class ConstantBus extends Bus {\n constructor(name: string, private readonly value: number) {\n super(name, 16 /* TODO: get high bit index */);\n }\n\n pullHigh(_ = 0) {\n return undefined;\n }\n pullLow(_ = 0) {\n return undefined;\n }\n override voltage(_ = 0): Voltage {\n return (this.busVoltage & 0x1) as Voltage;\n }\n\n override set busVoltage(voltage: number) {\n // Noop\n }\n override get busVoltage(): number {\n return this.value;\n }\n}\n\nexport const TRUE_BUS = new ConstantBus(\"true\", 0xffff);\nexport const FALSE_BUS = new ConstantBus(\"false\", 0);\n\nexport function parsePinDecl(toPin: string): {\n pin: string;\n width: number;\n} {\n const { pin, w } = toPin.match(/(?[a-zA-Z]+)(\\[(?\\d+)\\])?/)\n ?.groups as {\n pin: string;\n w?: string;\n };\n return {\n pin,\n width: w ? Number(w) : 1,\n };\n}\n\nexport function parseToPin(toPin: string): {\n pin: string;\n start?: number;\n end?: number;\n} {\n const { pin, i, j } = toPin.match(\n /(?[a-z]+)(\\[(?\\d+)(\\.\\.(?\\d+))?\\])?/\n )?.groups as { pin: string; i?: string; j?: string };\n return {\n pin,\n start: i ? Number(i) : undefined,\n end: j ? Number(j) : undefined,\n };\n}\n\nexport class Pins {\n private readonly map = new Map();\n\n insert(pin: Pin) {\n const { name } = pin;\n assert(!this.map.has(name), `Pins already has ${name}!`);\n this.map.set(name, pin);\n }\n\n emplace(name: string, minWidth?: number) {\n if (this.has(name)) {\n return this.get(name)!;\n } else {\n const pin = new Bus(name, minWidth);\n this.insert(pin);\n return pin;\n }\n }\n\n has(pin: string): boolean {\n return this.map.has(pin);\n }\n\n get(pin: string): Pin | undefined {\n return this.map.get(pin);\n }\n\n entries(): Iterable {\n return this.map.values();\n }\n\n [Symbol.iterator]() {\n return this.map[Symbol.iterator]();\n }\n}\n\nlet id = 0;\nexport class Chip {\n readonly id = id++;\n ins = new Pins();\n outs = new Pins();\n pins = new Pins();\n parts = new Set();\n clockedPins: Set;\n\n get clocked() {\n if (this.clockedPins.size > 0) {\n return true;\n }\n for (const part of this.parts) {\n if (part.clocked) return true;\n }\n return false;\n }\n\n constructor(\n ins: (string | { pin: string; width: number })[],\n outs: (string | { pin: string; width: number })[],\n public name?: string,\n internals: (string | { pin: string; width: number })[] = [],\n clocked: string[] = []\n ) {\n for (const inn of ins) {\n const { pin, width = 1 } =\n (inn as { pin: string }).pin !== undefined\n ? (inn as { pin: string; width: number })\n : parsePinDecl(inn as string);\n this.ins.insert(new Bus(pin, width));\n }\n\n for (const out of outs) {\n const { pin, width = 1 } =\n (out as { pin: string }).pin !== undefined\n ? (out as { pin: string; width: number })\n : parsePinDecl(out as string);\n this.outs.insert(new Bus(pin, width));\n }\n\n for (const internal of internals) {\n const { pin, width = 1 } =\n (internal as { pin: string }).pin !== undefined\n ? (internal as { pin: string; width: number })\n : parsePinDecl(internal as string);\n this.pins.insert(new Bus(pin, width));\n }\n\n this.clockedPins = new Set(clocked);\n\n Clock.get().$.subscribe(() => this.eval());\n }\n\n reset() {\n for (const [_, pin] of this.ins) {\n pin.busVoltage = 0;\n }\n for (const part of this.parts) {\n part.reset();\n }\n this.eval();\n }\n\n in(pin = \"in\"): Pin {\n assert(this.hasIn(pin), `No in pin ${pin}`);\n return this.ins.get(pin)!;\n }\n\n out(pin = \"out\"): Pin {\n assert(this.hasOut(pin), `No in pin ${pin}`);\n return this.outs.get(pin)!;\n }\n\n hasIn(pin: string): boolean {\n return this.ins.has(pin);\n }\n\n hasOut(pin: string): boolean {\n return this.outs.has(pin);\n }\n\n pin(name: string): Pin {\n assert(this.pins.has(name));\n return this.pins.get(name)!;\n }\n\n get(name: string, offset?: number): Pin | undefined {\n if (this.ins.has(name)) {\n return this.ins.get(name)!;\n }\n if (this.outs.has(name)) {\n return this.outs.get(name)!;\n }\n if (this.pins.has(name)) {\n return this.pins.get(name)!;\n }\n return this.getBuiltin(name, offset);\n }\n\n private getBuiltin(name: string, offset = 0): Pin | undefined {\n if (BUILTIN_NAMES.includes(name)) {\n for (const part of this.parts) {\n const pin = part.get(name, offset);\n if (pin) {\n return pin;\n }\n }\n }\n return undefined;\n }\n\n isOutPin(pin: string): boolean {\n return this.outs.has(pin);\n }\n\n wire(part: Chip, connections: Connection[]) {\n this.parts.add(part);\n for (const { to, from } of connections) {\n if (part.isOutPin(to.name)) {\n this.wireOutPin(part, to, from);\n } else {\n this.wireInPin(part, to, from);\n }\n }\n }\n\n private findPin(from: string, minWidth?: number): Pin {\n if (from.toLowerCase() === \"true\" || from === \"1\") {\n return TRUE_BUS;\n }\n if (from.toLowerCase() === \"false\" || from === \"0\") {\n return FALSE_BUS;\n }\n if (this.ins.has(from)) {\n return this.ins.get(from)!;\n }\n if (this.outs.has(from)) {\n return this.outs.get(from)!;\n }\n return this.pins.emplace(from, minWidth);\n }\n\n private wireOutPin(part: Chip, to: PinSide, from: PinSide) {\n const partPin = assertExists(\n part.outs.get(to.name),\n () => `Cannot wire to missing pin ${to.name}`\n );\n to.width ??= partPin.width;\n\n let chipPin = this.findPin(from.name, from.width ?? to.width);\n const isInternal = this.pins.has(chipPin.name);\n\n from.width ??= chipPin.width;\n\n if (chipPin instanceof ConstantBus) {\n throw new Error(`Cannot wire to constant bus`);\n }\n\n // Widen internal pins\n if (isInternal && chipPin instanceof Bus) {\n chipPin.ensureWidth(from.start + from.width);\n }\n\n // Wrap the chipPin in an InBus when the chip side is dimensioned\n if (from.start > 0 || from.width !== chipPin.width) {\n chipPin = new InSubBus(chipPin, from.start, from.width);\n }\n\n // Wrap the chipPin in an OutBus when the part side is dimensioned\n if (to.start > 0 || to.width !== chipPin.width) {\n chipPin = new OutSubBus(chipPin, to.start, to.width);\n }\n\n partPin.connect(chipPin);\n }\n\n private wireInPin(part: Chip, to: PinSide, from: PinSide) {\n let partPin = assertExists(\n part.ins.get(to.name),\n () => `Cannot wire to missing pin ${to.name}`\n );\n to.width ??= partPin.width;\n\n const chipPin = this.findPin(from.name, from.width ?? to.width);\n\n from.width ??= chipPin.width;\n\n // Wrap the partPin in an InBus when the part side is dimensioned\n if (to.start > 0 || to.width !== chipPin.width) {\n partPin = new InSubBus(partPin, to.start, to.width);\n }\n\n // Wrap the partPin in an OutBus when the chip side is dimensioned\n if (![\"true\", \"false\"].includes(chipPin.name)) {\n if (from.start > 0 || from.width !== chipPin.width) {\n partPin = new OutSubBus(partPin, from.start, from.width);\n }\n }\n chipPin.connect(partPin);\n }\n\n eval() {\n for (const chip of this.parts) {\n // TODO topological sort\n // eval chip input busses\n chip.eval();\n // eval output busses\n }\n }\n\n tick() {\n this.eval();\n }\n\n tock() {\n this.eval();\n }\n\n remove() {\n for (const part of this.parts) {\n part.remove();\n }\n }\n\n // For the ROM32K builtin to load from a file system\n async load(fs: FileSystem, path: string): Promise {\n for (const part of this.parts) {\n if (part.name === \"ROM32K\") {\n await part.load(fs, path);\n }\n }\n }\n}\n\nexport class Low extends Chip {\n constructor() {\n super([], []);\n this.outs.insert(FALSE_BUS);\n }\n}\n\nexport class High extends Chip {\n constructor() {\n super([], []);\n this.outs.insert(TRUE_BUS);\n }\n}\n\nexport class ClockedChip extends Chip {\n override get clocked(): boolean {\n return true;\n }\n\n #subscription = Clock.get().$.subscribe(({ level }) => {\n if (level === LOW) {\n this.tock();\n } else {\n this.tick();\n }\n });\n\n override remove() {\n this.#subscription.unsubscribe();\n super.remove();\n }\n}\n\nexport interface PinSide {\n name: string;\n start: number;\n width?: number;\n}\n\nexport interface Connection {\n // To is the part side\n to: PinSide;\n // From is the chip side\n from: PinSide;\n}\n\nexport type Pinout = Record;\nexport interface SerializedChip {\n id: number;\n name: string;\n ins: Pinout;\n outs: Pinout;\n pins: Pinout;\n children: SerializedChip[];\n}\n\nfunction mask(width: number) {\n return Math.pow(2, width) - 1;\n}\n\nfunction setBus(busses: Pinout, pin: Pin) {\n busses[pin.name] = bin(\n (pin.busVoltage & mask(pin.width)) <<\n (pin as unknown as { start: number }).start ?? 0\n );\n return busses;\n}\n\nexport function printChip(chip: Chip): SerializedChip {\n return {\n id: chip.id,\n name: chip.name ?? chip.constructor.name,\n ins: [...chip.ins.entries()].reduce(setBus, {} as Pinout),\n outs: [...chip.outs.entries()].reduce(setBus, {} as Pinout),\n pins: [...chip.pins.entries()].reduce(setBus, {} as Pinout),\n children: [...chip.parts.values()].map(printChip),\n };\n}\n\nexport const BUILTIN_NAMES = [\n \"Register\",\n \"ARegister\",\n \"DRegister\",\n \"PC\",\n \"RAM8\",\n \"RAM64\",\n \"RAM512\",\n \"RAM4K\",\n \"RAM16K\",\n \"ROM32K\",\n \"Screen\",\n \"Keyboard\",\n \"Memory\",\n];\n","import { BehaviorSubject, Observable, Subject } from \"rxjs\";\nimport { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { HIGH, LOW, Voltage } from \"./chip.js\";\n\ninterface Tick {\n readonly level: Voltage;\n readonly ticks: number;\n}\n\nlet clock: Clock;\nexport class Clock {\n private level: Voltage = LOW;\n private ticks = 0;\n\n static get() {\n if (clock === undefined) {\n clock = new Clock();\n }\n return clock;\n }\n\n get isHigh(): boolean {\n return this.level === HIGH;\n }\n\n get isLow(): boolean {\n return this.level === LOW;\n }\n\n private subject = new BehaviorSubject({\n level: this.level,\n ticks: this.ticks,\n });\n readonly frameSubject = new Subject();\n\n readonly $: Observable = this.subject;\n readonly frame$: Observable = this.frameSubject;\n\n private next() {\n this.subject.next({\n level: this.level,\n ticks: this.ticks,\n });\n }\n\n private constructor() {\n // private\n }\n\n reset() {\n this.level = LOW;\n this.ticks = 0;\n this.next();\n }\n\n tick() {\n assert(this.level === LOW, \"Can only tick up from LOW\");\n this.level = HIGH;\n this.next();\n }\n\n tock() {\n assert(this.level === HIGH, \"Can only tock down from HIGH\");\n this.level = LOW;\n this.ticks += 1;\n this.next();\n }\n\n toggle() {\n this.level === HIGH ? this.tock() : this.tick();\n }\n\n eval() {\n this.tick();\n this.tock();\n }\n\n frame() {\n this.frameSubject.next();\n }\n\n toString() {\n return `${this.ticks}${this.level === HIGH ? \"+\" : \"\"}`;\n }\n}\n","export type COMMANDS_ASM =\n | \"0\"\n | \"1\"\n | \"-1\"\n | \"D\"\n | \"A\"\n | \"M\"\n | \"!D\"\n | \"!A\"\n | \"-D\"\n | \"-A\"\n | \"D+1\"\n | \"A+1\"\n | \"D-1\"\n | \"A-1\"\n | \"D+A\"\n | \"D-A\"\n | \"D-M\"\n | \"A-D\"\n | \"D&A\"\n | \"D&M\"\n | \"D|A\"\n | \"D|M\";\n\nexport type COMMANDS_OP =\n | 0b101010\n | 0b111111\n | 0b111010\n | 0b001100\n | 0b110000\n | 0b110000\n | 0b001101\n | 0b110001\n | 0b001111\n | 0b110011\n | 0b011111\n | 0b110111\n | 0b001110\n | 0b110010\n | 0b000010\n | 0b010011\n | 0b010011\n | 0b000111\n | 0b000000\n | 0b000000\n | 0b010101\n | 0b010101;\n\nexport const COMMANDS: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"0\": 0b101010, // 42 0x2A\n \"1\": 0b111111, // 63 0x3F\n \"-1\": 0b111010, // 58 0x3A\n D: 0b001100, // 12 0x0C\n A: 0b110000, // 48 0x30\n M: 0b110000, // 48 0x30\n \"!D\": 0b001101, // 13 0x0D\n \"!A\": 0b110001, // 49 0x31\n \"-D\": 0b001111, // 15 0x0F\n \"-A\": 0b110011, // 51 0x33\n \"D+1\": 0b011111, // 31 0x1F\n \"A+1\": 0b110111, // 55 0x37\n \"D-1\": 0b001110, // 14 0x0E\n \"A-1\": 0b110010, // 50 0x32\n \"D+A\": 0b000010, // 2 0x02\n \"D-A\": 0b010011, // 19 0x13\n \"D-M\": 0b010011, // 19 0x13\n \"A-D\": 0b000111, // 7 0x07\n \"D&A\": 0b000000, // 0 0x00\n \"D&M\": 0b000000, // 0 0x00\n \"D|A\": 0b010101, // 21 0x15\n \"D|M\": 0b010101, // 21 0x15\n },\n op: {\n 0x2a: \"0\",\n 0x3f: \"1\",\n 0x3a: \"-1\",\n 0x0c: \"D\",\n 0x30: \"A\",\n 0x0d: \"!D\",\n 0x31: \"!A\",\n 0x0f: \"-D\",\n 0x33: \"-A\",\n 0x1f: \"D+1\",\n 0x37: \"A+1\",\n 0x0e: \"D-1\",\n 0x32: \"A-1\",\n 0x02: \"D+A\",\n 0x13: \"D-A\",\n 0x07: \"A-D\",\n 0x00: \"D&A\",\n 0x15: \"D|A\",\n },\n};\n\nexport type ASSIGN_ASM = \"\" | \"M\" | \"D\" | \"MD\" | \"A\" | \"AM\" | \"AD\" | \"AMD\";\nexport type ASSIGN_OP = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;\n\nexport const ASSIGN: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"\": 0x0,\n M: 0b001,\n D: 0b010,\n MD: 0b011,\n A: 0b100,\n AM: 0b101,\n AD: 0b110,\n AMD: 0b111,\n },\n op: {\n 0x0: \"\",\n 0x1: \"M\",\n 0x2: \"D\",\n 0x3: \"MD\",\n 0x4: \"A\",\n 0x5: \"AM\",\n 0x6: \"AD\",\n 0x7: \"AMD\",\n },\n};\n\nexport type JUMP_ASM =\n | \"\"\n | \"JGT\"\n | \"JEQ\"\n | \"JGE\"\n | \"JLT\"\n | \"JNE\"\n | \"JLE\"\n | \"JMP\";\nexport type JUMP_OP = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;\nexport const JUMP: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"\": 0b0,\n JGT: 0b001,\n JEQ: 0b010,\n JGE: 0b011,\n JLT: 0b100,\n JNE: 0b101,\n JLE: 0b110,\n JMP: 0b111,\n },\n op: {\n 0x0: \"\",\n 0x1: \"JGT\",\n 0x2: \"JEQ\",\n 0x3: \"JGE\",\n 0x4: \"JLT\",\n 0x5: \"JNE\",\n 0x6: \"JLE\",\n 0x7: \"JMP\",\n },\n};\n\nexport const Flags = {\n 0x01: \"Positive\",\n 0x00: \"Zero\",\n 0x0f: \"Negative\",\n Positive: 0x01,\n Zero: 0x00,\n Negative: 0x0f,\n};\n\nexport function alu(op: number, d: number, a: number): [number, number] {\n let o = 0;\n switch (op) {\n case 0x2a:\n o = 0;\n break;\n case 0x3f:\n o = 1;\n break;\n case 0x3a:\n o = -1;\n break;\n case 0x0c:\n o = d;\n break;\n case 0x30:\n o = a;\n break;\n case 0x0d:\n o = ~d;\n break;\n case 0x31:\n o = ~a;\n break;\n case 0x0f:\n o = -d;\n break;\n case 0x33:\n o = -a;\n break;\n case 0x1f:\n o = d + 1;\n break;\n case 0x37:\n o = a + 1;\n break;\n case 0x0e:\n o = d - 1;\n break;\n case 0x32:\n o = a - 1;\n break;\n case 0x02:\n o = d + a;\n break;\n case 0x13:\n o = d - a;\n break;\n case 0x07:\n o = a - d;\n break;\n case 0x00:\n o = d & a;\n break;\n case 0x15:\n o = d | a;\n break;\n }\n\n o = o & 0xffff;\n const flags =\n o === 0 ? Flags.Zero : o & 0x8000 ? Flags.Negative : Flags.Positive;\n return [o, flags];\n}\n\nexport function alua(op: number, d: number, a: number): [number, number] {\n if (op & 0b100000) d = 0;\n if (op & 0b010000) d = ~d & 0xffff;\n if (op & 0b001000) a = 0;\n if (op & 0b000100) a = ~a & 0xffff;\n\n let o = (op & 0b000010 ? d + a : d & a) & 0xffff;\n if (op & 0b000001) o = ~o & 0xffff;\n\n const flags =\n o === 0 ? Flags.Zero : o & 0x8000 ? Flags.Negative : Flags.Positive;\n return [o, flags];\n}\n","import { alu, COMMANDS_OP, Flags } from \"./alu.js\";\nimport { Memory } from \"./memory.js\";\n\nexport interface CPUInput {\n inM: number;\n instruction: number;\n reset: boolean;\n}\n\nexport interface CPUOutput {\n outM: number;\n writeM: boolean;\n addressM: number;\n}\n\nexport interface CPUState {\n A: number;\n D: number;\n PC: number;\n ALU: number;\n flag: number;\n}\n\nexport function emptyState(): CPUState {\n return { A: 0, D: 0, PC: 0, ALU: 0, flag: Flags.Zero };\n}\n\nconst BITS = {\n c: 0b1000_0000_0000_0000,\n x1: 0b1001_0000_0000_0000,\n x2: 0b1001_0000_0000_0000,\n am: 0b1001_0000_0000_0000,\n op: 0b0000_1111_1100_0000,\n d1: 0b1000_0000_0010_0000,\n d2: 0b1000_0000_0001_0000,\n d3: 0b1000_0000_0000_1000,\n j1: 0b1000_0000_0000_0001,\n j2: 0b1000_0000_0000_0010,\n j3: 0b1000_0000_0000_0100,\n};\n\nexport function decode(instruction: number) {\n function bit(bit: number): boolean {\n return (instruction & bit) === bit;\n }\n const bits = {\n c: bit(BITS.c),\n x1: bit(BITS.x1),\n x2: bit(BITS.x2),\n am: bit(BITS.am),\n op: ((instruction & BITS.op) >> 6) as COMMANDS_OP,\n d1: bit(BITS.d1),\n d2: bit(BITS.d2),\n d3: bit(BITS.d3),\n j1: bit(BITS.j1),\n j2: bit(BITS.j2),\n j3: bit(BITS.j3),\n };\n\n return bits;\n}\n\nexport function cpuTick(\n { inM, instruction }: CPUInput,\n { A, D, PC }: CPUState\n): [CPUState, boolean] {\n const bits = decode(instruction);\n const a = bits.am ? inM : A;\n const [ALU, flag] = alu(bits.op, D, a);\n\n return [{ A, D, PC: PC + 1, ALU, flag }, bits.d3];\n}\n\nexport function cpuTock(\n { inM, instruction, reset }: CPUInput,\n { A, D, PC, ALU, flag }: CPUState\n): [CPUOutput, CPUState] {\n const bits = decode(instruction);\n\n const j1 = bits.j1 && flag === Flags.Positive;\n const j2 = bits.j2 && flag === Flags.Zero;\n const j3 = bits.j3 && flag === Flags.Negative;\n const jmp = j1 || j2 || j3;\n\n PC = reset ? 0 : jmp ? A : PC;\n\n if (bits.d2) {\n D = ALU;\n }\n\n if (!bits.c) {\n A = instruction & 0x7fff;\n } else if (bits.d1) {\n A = ALU;\n }\n\n const a = bits.am ? inM : A;\n const alu2 = alu(bits.op, D, a);\n\n ALU = alu2[0];\n flag = alu2[1];\n\n const output: CPUOutput = {\n addressM: A,\n outM: ALU,\n writeM: bits.d3,\n };\n\n const state: CPUState = {\n A,\n D,\n ALU,\n flag,\n PC,\n };\n\n return [output, state];\n}\n\nexport function cpu(input: CPUInput, state: CPUState): [CPUOutput, CPUState] {\n const [tickState, _writeM] = cpuTick(input, state);\n return cpuTock(input, tickState);\n}\n\nexport class CPU {\n RAM: Memory;\n ROM: Memory;\n\n #pc = 0;\n #a = 0;\n #d = 0;\n\n #tickState: CPUState = {\n A: 0,\n D: 0,\n PC: 0,\n ALU: 0,\n flag: Flags.Zero,\n };\n\n get state(): CPUState {\n return this.#tickState;\n }\n\n get PC() {\n return this.#pc;\n }\n\n get A() {\n return this.#a;\n }\n\n get D() {\n return this.#d;\n }\n\n constructor({\n RAM = new Memory(0x7fff),\n ROM,\n }: {\n RAM?: Memory;\n ROM: Memory;\n }) {\n this.RAM = RAM;\n this.ROM = ROM;\n }\n\n reset() {\n this.#pc = 0;\n this.#a = 0;\n this.#d = 0;\n }\n\n tick() {\n const [{ addressM, outM, writeM }, { A, D, PC }] = cpu(\n {\n inM: this.RAM.get(this.#a),\n instruction: this.ROM.get(this.#pc),\n reset: false,\n },\n {\n A: this.#a,\n D: this.#d,\n PC: this.#pc,\n ALU: this.#d,\n flag: Flags.Zero,\n }\n );\n\n this.#a = A;\n this.#d = D;\n this.#pc = PC;\n\n if (writeM) {\n this.RAM.set(addressM, outM);\n }\n }\n}\n","import { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { Subject } from \"rxjs\";\nimport { op } from \"../util/asm.js\";\nimport { int10, int16, int2 } from \"../util/twos.js\";\nimport { load } from \"../fs.js\";\n\nexport const FORMATS = [\"bin\", \"dec\", \"hex\", \"asm\"];\nexport type Format = typeof FORMATS[number];\n\nexport const SCREEN = 0x4000;\nexport const SCREEN_ROWS = 512;\nexport const SCREEN_COLS = 256;\nexport const KEYBOARD = 0x6000;\n\nexport class Memory {\n #memory: Int16Array;\n updates = new Subject();\n\n get size(): number {\n return this.#memory.length;\n }\n\n constructor(memory: ArrayBuffer | number) {\n if (typeof memory === \"number\") {\n this.#memory = new Int16Array(memory);\n } else {\n this.#memory = new Int16Array(memory);\n }\n }\n\n get(index: number): number {\n if (index < 0 || index >= this.size) {\n return 0xffff;\n }\n return this.#memory[index] ?? 0;\n }\n\n set(index: number, value: number): void {\n if (index >= 0 && index < this.size) {\n this.#memory[index] = value & 0xffff;\n }\n }\n\n update(cell: number, value: string, format: Format) {\n let current: number;\n switch (format) {\n case \"asm\":\n current = op(value);\n break;\n case \"bin\":\n current = int2(value);\n break;\n case \"hex\":\n current = int16(value);\n break;\n case \"dec\":\n default:\n current = int10(value);\n break;\n }\n\n if (isFinite(current) && current <= 0xffff) {\n this.set(cell, current);\n this.updates.next();\n }\n }\n\n async load(fs: FileSystem, path: string) {\n try {\n (await load(fs, path)).map((v, i) => this.set(i, v));\n } catch (cause) {\n // throw new Error(`ROM32K Failed to load file ${path}`, { cause });\n throw new Error(`Memory Failed to load file ${path}`);\n }\n }\n\n range(start = 0, end = this.size): number[] {\n return [...this.#memory.slice(start, end)];\n }\n\n *map(\n fn: (index: number, value: number) => T,\n start = 0,\n end = this.size\n ): Iterable {\n assert(start < end);\n for (let i = start; i < end; i++) {\n yield fn(i, this.get(i));\n }\n }\n}\n","const asm = `\nASM <: Base {\n Root := ASM\n ASM = Instruction*\n \n Instruction = Label|AInstruction|CInstruction\n \n Label = OpenParen identifier closeParen\n AInstruction = at (identifier | decNumber)\n CInstruction = assign? op jmp?\n \n assign = (\n \"AMD\"\n | \"AM\"\n | \"AD\"\n | \"MD\"\n | \"M\"\n | \"D\"\n | \"A\"\n ) equal\n \n op =\n | \"0\" | \"1\" | \"-1\"\n | \"!D\" | \"!A\" | \"!M\"\n | \"-D\" | \"-A\" | \"-M\"\n | \"D+1\" | \"A+1\" | \"M+1\"\n | \"D-1\" | \"A-1\" | \"M-1\"\n | \"D+A\" | \"D+M\"\n | \"D-A\" | \"D-M\"\n | \"A-D\" | \"M-D\"\n | \"D&A\" | \"D&M\"\n | \"D|A\" | \"D|M\"\n | \"D\" | \"A\" | \"M\"\n\n\n jmp = semi (\"JGT\" | \"JEQ\" | \"JGE\" | \"JLT\" | \"JNE\" | \"JLE\" | \"JMP\")\n}`;\nexport default asm;\n","import { assertExists } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport ohm from \"ohm-js\";\nimport {\n ASSIGN,\n ASSIGN_ASM,\n ASSIGN_OP,\n COMMANDS,\n COMMANDS_ASM,\n COMMANDS_OP,\n JUMP,\n JUMP_ASM,\n JUMP_OP,\n} from \"../cpu/alu.js\";\nimport { KEYBOARD, SCREEN } from \"../cpu/memory.js\";\nimport { makeC } from \"../util/asm.js\";\nimport { grammars, makeParser, baseSemantics } from \"./base.js\";\n\nimport asmGrammar from \"./grammars/asm.ohm.js\";\n\nexport const grammar = ohm.grammar(asmGrammar, grammars);\nexport const asmSemantics = grammar.extendSemantics(baseSemantics);\n\nexport interface Asm {\n instructions: AsmInstruction[];\n}\n\nexport type AsmInstruction =\n | AsmAInstruction\n | AsmCInstruction\n | AsmLabelInstruction;\n\nexport type AsmAInstruction = AsmALabelInstruction | AsmAValueInstruction;\nexport interface AsmALabelInstruction {\n type: \"A\";\n label: string;\n}\n\nexport interface AsmAValueInstruction {\n type: \"A\";\n value: number;\n}\n\nfunction isALabelInstruction(\n inst: AsmAInstruction\n): inst is AsmALabelInstruction {\n return (inst as AsmALabelInstruction).label !== undefined;\n}\n\nexport interface AsmCInstruction {\n type: \"C\";\n op: COMMANDS_OP;\n isM: boolean;\n store?: ASSIGN_OP;\n jump?: JUMP_OP;\n}\n\nexport interface AsmLabelInstruction {\n type: \"L\";\n label: string;\n}\n\nasmSemantics.addAttribute(\"root\", {\n Root(_) {\n return this.asm;\n },\n});\n\nasmSemantics.addAttribute(\"asm\", {\n Root(asm) {\n return {\n instructions: asm\n .child(0)\n .children.map(({ instruction }) => instruction as AsmInstruction),\n };\n },\n});\n\nasmSemantics.addAttribute(\"instruction\", {\n AInstruction(_at, val): AsmAInstruction {\n try {\n return {\n type: \"A\",\n label: val.name,\n };\n } catch (e) {\n // Pass\n }\n\n try {\n return {\n type: \"A\",\n value: val.value,\n };\n } catch (e) {\n // pass\n }\n\n throw new Error(`AsmAInstruction must have either a name or a value`);\n },\n CInstruction(assignN, opN, jmpN): AsmCInstruction {\n const assign = assignN.child(0)?.child(0)?.sourceString as ASSIGN_ASM;\n const op = opN.sourceString.replace(\"M\", \"A\") as COMMANDS_ASM;\n const jmp = jmpN.child(0)?.child(1)?.sourceString as JUMP_ASM;\n const isM =\n assignN.sourceString.includes(\"M\") || opN.sourceString.includes(\"M\");\n const inst: AsmCInstruction = {\n type: \"C\",\n op: COMMANDS.asm[op],\n isM,\n };\n if (jmp) inst.jump = JUMP.asm[jmp];\n if (assign) inst.store = ASSIGN.asm[assign];\n return inst;\n },\n Label(_o, { name }, _c): AsmLabelInstruction {\n return {\n type: \"L\",\n label: name,\n };\n },\n});\n\nexport function fillLabel(asm: Asm) {\n let nextLabel = 16;\n const symbols = new Map([\n [\"R0\", 0],\n [\"R1\", 1],\n [\"R2\", 2],\n [\"R3\", 3],\n [\"R4\", 4],\n [\"R5\", 5],\n [\"R6\", 6],\n [\"R7\", 7],\n [\"R8\", 8],\n [\"R9\", 9],\n [\"R10\", 10],\n [\"R11\", 11],\n [\"R12\", 12],\n [\"R13\", 13],\n [\"R14\", 14],\n [\"R15\", 15],\n [\"SP\", 0],\n [\"LCL\", 1],\n [\"ARG\", 2],\n [\"THIS\", 3],\n [\"THAT\", 4],\n [\"SCREEN\", SCREEN],\n [\"KBD\", KEYBOARD],\n ]);\n\n function getLabelValue(label: string) {\n if (!symbols.has(label)) {\n symbols.set(label, nextLabel);\n nextLabel += 1;\n }\n return assertExists(symbols.get(label), `Label not in symbols: ${label}`);\n }\n\n function transmuteAInstruction(instruction: AsmALabelInstruction) {\n const value = getLabelValue(instruction.label);\n (instruction as unknown as AsmAValueInstruction).value = value;\n delete (instruction as unknown as { label: undefined }).label;\n }\n\n const unfilled: AsmALabelInstruction[] = [];\n let line = 0;\n for (const instruction of asm.instructions) {\n if (instruction.type === \"L\") {\n if (symbols.has(instruction.label)) {\n throw new Error(`ASM Duplicate label ${instruction.label}`);\n } else {\n symbols.set(instruction.label, line);\n }\n continue;\n }\n\n line += 1;\n\n if (instruction.type === \"A\") {\n if (isALabelInstruction(instruction)) {\n unfilled.push(instruction);\n }\n }\n }\n\n unfilled.forEach(transmuteAInstruction);\n}\n\nexport function emit(asm: Asm): number[] {\n return asm.instructions\n .map((inst) => {\n if (inst.type === \"A\") {\n if (isALabelInstruction(inst)) {\n throw new Error(`ASM Emitting unfilled A instruction`);\n }\n return inst.value;\n }\n if (inst.type === \"C\") {\n return makeC(inst.isM, inst.op, inst.store, inst.jump);\n }\n return undefined;\n })\n .filter((op): op is number => op !== undefined);\n}\n\nexport const ASM = {\n grammar: asmGrammar,\n semantics: asmSemantics,\n parser: grammar,\n parse: makeParser(grammar, asmSemantics),\n passes: {\n fillLabel,\n emit,\n },\n};\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { unwrap } from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { ASM } from \"./languages/asm.js\";\nimport { int2 } from \"./util/twos.js\";\n\nexport async function load(fs: FileSystem, path: string): Promise {\n if (path.endsWith(\".hack\")) {\n return loadHack(fs, path);\n }\n\n if (path.endsWith(\".asm\")) {\n return loadAsm(fs, path);\n }\n\n throw new Error(`Cannot load file without hack or asm extension ${path}`);\n}\n\nexport async function loadAsm(fs: FileSystem, path: string): Promise {\n const source = await fs.readFile(path);\n const asm = unwrap(ASM.parse(source));\n ASM.passes.fillLabel(asm);\n return ASM.passes.emit(asm);\n}\n\nexport async function loadHack(\n fs: FileSystem,\n path: string\n): Promise {\n return (await fs.readFile(path))\n .split(\"\\n\")\n .filter((line) => line.trim() !== \"\")\n .map(int2);\n}\n","import ohm from \"ohm-js\";\nimport { int10, int16, int2 } from \"../util/twos.js\";\nimport { Err, Ok, Result } from \"@davidsouther/jiffies/lib/esm/result.js\";\n\nexport const UNKNOWN_PARSE_ERROR = `Unknown parse error`;\n\nimport baseGrammar from \"./grammars/base.ohm.js\";\nexport const grammars = {\n Base: ohm.grammar(baseGrammar),\n};\n\nexport const baseSemantics = grammars.Base.createSemantics();\n\nbaseSemantics.extendOperation(\"asIteration\", {\n List(list, _) {\n return list.asIteration();\n },\n});\n\nbaseSemantics.addAttribute(\"value\", {\n decNumber(_, digits): number {\n return int10(digits.sourceString);\n },\n wholeDec(_, digits): number {\n return int10(digits.sourceString);\n },\n binNumber(_, digits) {\n return int2(digits.sourceString);\n },\n hexNumber(_, digits) {\n return int16(digits.sourceString);\n },\n Number(num) {\n return num.value;\n },\n Name(ident) {\n return ident.name;\n },\n identifier(_, __): string {\n return this.sourceString;\n },\n});\n\nbaseSemantics.addAttribute(\"name\", {\n identifier(_, __): string {\n return this.sourceString;\n },\n Name(_): string {\n return this.child(0)?.name;\n },\n});\n\nbaseSemantics.addAttribute(\"String\", {\n String(_a, str, _b) {\n return str.sourceString;\n },\n});\n\nexport type ParseError = Error | { message: string; shortMessage: string };\n\nexport function makeParser(\n grammar: ohm.Grammar,\n semantics: ohm.Semantics,\n property: (obj: ohm.Dict) => ResultType = ({ root }) => root\n): (source: string) => Result {\n return function parse(source) {\n try {\n const match = grammar.match(source);\n if (match.succeeded()) {\n const parsed = semantics(match);\n const parse = property(parsed);\n return Ok(parse);\n } else {\n return Err({\n message: match.message ?? UNKNOWN_PARSE_ERROR,\n shortMessage: match.shortMessage ?? UNKNOWN_PARSE_ERROR,\n });\n }\n } catch (e) {\n return Err(e as Error);\n }\n };\n}\n\nexport interface Span {\n start: number;\n end: number;\n}\n","const base = `\nBase {\n Root = Value*\n\n At = at\n Bang = bang\n Bar = bar\n CloseAngle = closeAngle\n CloseBrace = closeBrace\n CloseParen = closeParen\n CloseSquare = closeSquare\n Comma = comma\n Dollar = dollar\n Dot = dot\n DoubleQuote = doubleQuote\n Equal = equal\n OpenAngle = openAngle\n OpenBrace = openBrace\n OpenParen = openParen\n OpenSquare = openSquare\n Percent = percent\n Semi = semi\n Underscore = underscore\n\n at = \"@\"\n bang = \"!\"\n bar = \"|\"\n closeAngle = \">\"\n closeBrace = \"}\"\n closeParen = \")\"\n closeSquare = \"]\"\n comma = \",\"\n dollar = \"$\"\n dot = \".\"\n doubleQuote = \"\\\\\"\"\n equal = \"=\"\n minus = \"-\"\n newline = \"\\\\r\"? \"\\\\n\"\n openAngle = \"<\"\n openBrace = \"{\"\n openParen = \"(\"\n openSquare = \"[\"\n percent = \"%\"\n semi = \";\"\n underscore = \"_\"\n\n Value = identifier | number | boolean\n\n boolean = true | false\n True = true\n False = false\n true = \"true\"\n false = \"false\"\n\n Name = identifier\n identifier = (letter|underscore) (alnum|underscore|dot|dollar)*\n\n Number = number\n number = hexNumber | decNumber | binNumber\n binNumber = (\"%B\") (\"0\"|\"1\")+\n hexNumber = (\"%X\") hexDigit+\n decNumber = (\"%D\")? (wholeDec | realDec)\n wholeDec = minus? digit+\n realDec = minus? digit* \".\" digit+\n\n String = DoubleQuote (~doubleQuote any)* doubleQuote\n \n spaces := (lineComment | comment | space)*\n commentStart = \"/*\"\n commentEnd = \"*/\"\n comment = commentStart (~commentEnd any)* commentEnd\n lineCommentStart = \"//\"\n lineComment = lineCommentStart (~\"\\\\n\" any)* \"\\\\n\"\n\n List = NonemptyListOf sep?\n EmptyList = EmptyList sep?\n}`;\nexport default base;\n","const cmp = `\nCmp <: Base {\n Root := line*\n line = bar cell+ newline?\n cell = cellvalue bar\n cellvalue = (~(bar|newline) any)*\n}`;\nexport default cmp;\n","import ohm from \"ohm-js\";\nimport { grammars, makeParser, baseSemantics } from \"./base.js\";\n\nexport type Cell = string;\nexport type Line = Cell[];\nexport type Cmp = Line[];\n\nimport cmpGrammar from \"./grammars/cmp.ohm.js\";\nexport const grammar = ohm.grammar(cmpGrammar, grammars);\nexport const cmpSemantics = grammar.extendSemantics(baseSemantics);\n\ncmpSemantics.addAttribute(\"cell\", {\n cell(value, _) {\n return value.sourceString;\n },\n});\n\ncmpSemantics.addAttribute(\"line\", {\n line(_a, cells, _b) {\n return cells.children.map((c) => c.cell);\n },\n});\n\ncmpSemantics.addAttribute(\"root\", {\n Root(lines) {\n return lines.children.map((c) => c.line);\n },\n});\n\nexport const CMP = {\n grammar: cmpGrammar,\n semantics: cmpSemantics,\n parser: grammar,\n parse: makeParser(grammar, cmpSemantics),\n};\n","const hdl = `\nHdl <: Base{\n Root := Chip\n Chip = \"CHIP\" Name OpenBrace ChipBody CloseBrace\n ChipBody = InList? OutList? PartList ClockedList?\n InList = \"IN\" PinList Semi\n OutList = \"OUT\" PinList Semi\n PartList = BuiltinPart | Parts\n PinList = List\n PinDecl = Name PinWidth?\n PinWidth = OpenSquare decNumber CloseSquare\n BuiltinPart = \"BUILTIN\" Semi\n Parts = \"PARTS:\" Part*\n Part = Name \"(\" Wires \")\" Semi\n Wires = List\n Wire = WireSide Equal (WireSide | True | False) \n WireSide = Name SubBus? \n SubBus = OpenSquare decNumber subBusRest? CloseSquare\n subBusRest = \"..\" decNumber\n ClockedList = \"CLOCKED\" SimplePinList Semi\n SimplePinList = List\n}`;\nexport default hdl;\n","/** Reads and parses HDL chip descriptions. */\nimport ohm from \"ohm-js\";\nimport { grammars, baseSemantics } from \"./base.js\";\nimport { makeParser } from \"./base.js\";\n\nexport interface PinIndex {\n start?: number | undefined;\n end?: number | undefined;\n}\n\nexport interface PinParts extends PinIndex {\n pin: string;\n}\n\nexport interface PinDeclaration {\n pin: string | string;\n width: number;\n}\n\nexport interface Wire {\n lhs: PinParts;\n rhs: PinParts;\n}\n\nexport interface Part {\n name: string;\n wires: Wire[];\n}\n\nexport interface HdlParse {\n name: string;\n ins: PinDeclaration[];\n outs: PinDeclaration[];\n clocked: string[];\n parts: \"BUILTIN\" | Part[];\n}\n\nimport hdlGrammar from \"./grammars/hdl.ohm.js\";\nexport const grammar = ohm.grammar(hdlGrammar, grammars);\n\nexport const hdlSemantics = grammar.extendSemantics(baseSemantics);\n\nhdlSemantics.addAttribute(\"SubBus\", {\n SubBus(_a, startNode, endNode, _b) {\n const start = startNode.value;\n const end = endNode.child(0)?.child(1)?.value ?? start;\n return { start, end };\n },\n});\n\nhdlSemantics.addAttribute(\"WireSide\", {\n WireSide({ name }, index) {\n const { start, end } = (index.child(0)?.SubBus as PinIndex) ?? {\n start: undefined,\n end: undefined,\n };\n return { pin: name, start, end };\n },\n});\n\nhdlSemantics.addAttribute(\"Wire\", {\n Wire(left, _, right) {\n const rhs: PinParts = right.isTerminal()\n ? { pin: right.sourceString }\n : right.WireSide;\n return { lhs: left.WireSide as PinParts, rhs };\n },\n});\n\nhdlSemantics.addAttribute(\"Wires\", {\n Wires(list) {\n return list.asIteration().children.map((node) => node.Wire as Wire);\n },\n});\n\nhdlSemantics.addAttribute(\"Part\", {\n Part({ name }, _a, { Wires }, _b, _c) {\n return { name: name as string, wires: Wires as Wire[] };\n },\n});\n\nhdlSemantics.addAttribute(\"Parts\", {\n Parts(_, parts) {\n return parts.children.map((c) => c.Part);\n },\n BuiltinPart(_a, _b) {\n return \"BUILTIN\";\n },\n});\n\nhdlSemantics.addAttribute<\"BUILTIN\" | Part[]>(\"PartList\", {\n PartList(list) {\n return list.Parts;\n },\n});\n\nhdlSemantics.addAttribute(\"Clocked\", {\n ClockedList(_a, clocked, _b) {\n return (\n clocked\n .asIteration()\n .children.map(\n ({ sourceString }: { sourceString: string }) => sourceString\n ) ?? []\n );\n },\n});\n\nhdlSemantics.addAttribute(\"PinDecl\", {\n PinDecl({ name }, width) {\n return {\n pin: name,\n width: width.child(0)?.child(1)?.value ?? 1,\n };\n },\n});\n\nhdlSemantics.addAttribute(\"PinList\", {\n PinList(list) {\n return list\n .asIteration()\n .children.map((node) => node.PinDecl as PinDeclaration);\n },\n});\n\nhdlSemantics.addAttribute(\"Chip\", {\n Chip(_a, { name }, _b, body, _c) {\n return {\n name,\n ins: body.child(0).child(0)?.child(1)?.PinList ?? [],\n outs: body.child(1).child(0)?.child(1)?.PinList ?? [],\n parts: body.child(2).PartList ?? [],\n clocked: body.child(3).child(0)?.Clocked,\n };\n },\n});\n\nhdlSemantics.addAttribute(\"Root\", {\n Root(root) {\n return root.child(0)?.Chip;\n },\n});\n\nexport const HDL = {\n parser: grammar,\n grammar: hdlGrammar,\n semantics: hdlSemantics,\n parse: makeParser(grammar, hdlSemantics, (n) => n.Chip),\n};\n","const tst = `\nTst <: Base {\n Root := Tst\n Tst = (TstStatement | TstRepeat | TstWhile)+\n\n TstRepeat = Repeat Number? OpenBrace TstStatement+ CloseBrace\n TstWhile = While Condition OpenBrace TstStatement+ CloseBrace\n TstStatement = List (Semi | Bang)\n\n TstOperation =\n | TstFileOperation\n | TstOutputListOperation\n | TstEvalOperation\n | TstSetOperation\n | TstOutputOperation\n | TstEchoOperation\n | TstClearEchoOperation\n | TstLoadROMOperation\n\n TstLoadROMOperation = ROM32K Load FileName\n TstFileOperation = FileOperation FileName\n TstOutputListOperation = \"output-list\" OutputFormat+\n OutputFormat = Name Index? percent FormatStyle wholeDec dot wholeDec dot wholeDec\n TstSetOperation = Set Name Index? Number\n Index = OpenSquare wholeDec? CloseSquare\n Condition = Value CompareOp Value\n TstEvalOperation = Eval | Tick | Tock\n TstOutputOperation = Output\n TstEchoOperation = Echo String\n TstClearEchoOperation = ClearEcho\n\n FileName = Name\n FileOperation = \"load\" | \"output-file\" | \"compare-to\"\n\n Set = \"set\"\n Eval = \"eval\"\n Tick = \"tick\"\n Tock = \"tock\"\n Echo = \"echo\"\n Repeat = \"repeat\"\n ClearEcho = \"clear-echo\"\n Output = \"output\"\n OutputList = \"output-list\"\n FormatStyle = \"B\"|\"D\"|\"S\"|\"X\"\n ROM32K = \"ROM32K\"\n Load = \"load\"\n While = \"while\"\n\n CompareOp = \"<>\" | \"<=\" | \">=\" | \"=\" | \"<\" | \">\"\n}`;\nexport default tst;\n","/** Reads tst files to apply and perform test runs. */\n\nimport ohm from \"ohm-js\";\nimport { baseSemantics, grammars, makeParser, Span } from \"./base.js\";\n\nexport interface TstEchoOperation {\n op: \"echo\";\n message: string;\n}\n\nexport interface TstClearEchoOperation {\n op: \"clear-echo\";\n}\n\nexport interface TstSetOperation {\n op: \"set\";\n id: string;\n index?: number;\n value: number;\n}\n\nexport interface TstEvalOperation {\n op: \"eval\" | \"tick\" | \"tock\";\n}\n\nexport interface TstOutputOperation {\n op: \"output\";\n}\n\nexport interface TstOutputSpec {\n id: string;\n builtin: boolean;\n address: number;\n style: \"D\" | \"X\" | \"B\" | \"S\";\n width: number;\n lpad: number;\n rpad: number;\n}\n\nexport interface TstOutputListOperation {\n op: \"output-list\";\n spec: TstOutputSpec[];\n}\n\nexport interface TstLoadROMOperation {\n op: \"loadRom\";\n file: string;\n}\n\nexport interface TstFileOperation {\n op: \"load\" | \"output-file\" | \"compare-to\";\n file: string;\n}\n\nexport type TstOperation =\n | TstFileOperation\n | TstEvalOperation\n | TstEchoOperation\n | TstClearEchoOperation\n | TstOutputOperation\n | TstSetOperation\n | TstOutputListOperation\n | TstLoadROMOperation;\n\nexport interface TstLineStatement {\n ops: TstOperation[];\n break?: true;\n span: Span;\n}\n\nexport interface TstRepeat {\n statements: TstLineStatement[];\n count: number;\n span: Span;\n}\n\nexport interface TstWhileCondition {\n op: \"<\" | \"<=\" | \"=\" | \">=\" | \">\" | \"<>\";\n left: string | number;\n right: string | number;\n}\n\nexport interface TstWhileStatement {\n statements: TstLineStatement[];\n condition: TstWhileCondition;\n span: Span;\n}\n\nexport type TstStatement = TstLineStatement | TstRepeat | TstWhileStatement;\n\nexport interface Tst {\n lines: TstStatement[];\n}\n\nimport tstGrammar from \"./grammars/tst.ohm.js\";\nexport const grammar = ohm.grammar(tstGrammar, grammars);\nexport const tstSemantics = grammar.extendSemantics(baseSemantics);\n\ntstSemantics.extendAttribute(\"value\", {\n Index(_a, idx, _b) {\n return idx?.child(0)?.value ?? -1;\n },\n});\n\ntstSemantics.extendAttribute(\"name\", {\n FileName({ name }) {\n return name;\n },\n});\n\ntstSemantics.addAttribute(\"index\", {\n Index(_open, dec, _close) {\n return dec.child(0)?.value ?? 0;\n },\n});\n\ntstSemantics.addAttribute(\"format\", {\n OutputFormat(\n { name: id },\n index,\n _a,\n { sourceString: style },\n { value: lpad },\n _b,\n { value: width },\n _c,\n { value: rpad }\n ) {\n return {\n id,\n builtin: index?.child(0) !== undefined,\n address: index?.child(0)?.value ?? -1,\n style: style as TstOutputSpec[\"style\"],\n width,\n lpad,\n rpad,\n };\n },\n});\n\ntstSemantics.addAttribute(\"operation\", {\n TstEvalOperation(op) {\n return { op: op.sourceString as TstEvalOperation[\"op\"] };\n },\n TstOutputOperation(_) {\n return { op: \"output\" };\n },\n TstOutputListOperation(_, formats) {\n return {\n op: \"output-list\",\n spec: formats.children.map((n) => n.format),\n };\n },\n TstSetOperation(op, { name }, index, { value }) {\n const setOp: TstSetOperation = {\n op: \"set\",\n id: name,\n value,\n };\n const child = index.child(0)?.child(1)?.child(0);\n if (child) {\n setOp.index = child.value;\n }\n return setOp;\n },\n TstEchoOperation(op, str) {\n return {\n op: \"echo\",\n message: str.String as string,\n };\n },\n TstClearEchoOperation(op) {\n return {\n op: \"clear-echo\",\n };\n },\n TstLoadROMOperation(_r, _l, { name }) {\n return {\n op: \"loadRom\",\n file: name,\n };\n },\n TstFileOperation(op, file) {\n return {\n op: op.sourceString as TstFileOperation[\"op\"],\n file: file.sourceString,\n };\n },\n});\n\ntstSemantics.addAttribute(\"condition\", {\n Condition({ value: left }, { sourceString: op }, { value: right }) {\n return {\n left,\n right,\n op: op as \"<\" | \"<=\" | \"=\" | \">=\" | \">\" | \"<>\",\n };\n },\n});\n\ntstSemantics.addAttribute(\"statement\", {\n TstWhile(op, cond, _o, statements, _c) {\n return {\n statements: statements.children.map(({ statement }) => statement),\n condition: cond.condition,\n span: {\n start: op.source.startIdx,\n end: cond.source.endIdx,\n },\n };\n },\n TstRepeat(op, count, _o, statements, _c) {\n return {\n statements: statements.children.map(({ statement }) => statement),\n count: count.child(0)?.value ?? -1,\n span: {\n start: op.source.startIdx,\n end: count.source.endIdx,\n },\n };\n },\n TstStatement(list, end) {\n const stmt: TstStatement = {\n ops: list\n .asIteration()\n .children.map((node) => node.operation as TstOperation),\n span: {\n start: this.source.startIdx,\n end: this.source.endIdx,\n },\n };\n if (end.sourceString === \"!\") {\n stmt.break = true;\n }\n return stmt;\n },\n});\n\ntstSemantics.addAttribute(\"tst\", {\n Tst(lines) {\n return {\n lines: lines.children.map((n) => n.statement),\n };\n },\n});\n\ntstSemantics.addAttribute(\"root\", {\n Root({ tst }) {\n return tst;\n },\n});\n\nexport const TST = {\n grammar: tstGrammar,\n semantics: tstSemantics,\n parser: grammar,\n parse: makeParser(grammar, tstSemantics),\n};\n","import { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { bin, dec, hex } from \"./util/twos.js\";\nimport { Test } from \"./tst.js\";\n\nexport class Output {\n private readonly fmt: \"B\" | \"X\" | \"D\" | \"S\";\n private readonly lPad: number;\n private readonly rPad: number;\n private readonly len: number;\n private readonly index: number;\n private readonly builtin: boolean;\n\n // new Output(inst.id, inst.style, inst.width, inst.lpad, inst.rpad)\n constructor(\n private variable: string,\n format = \"%B1.1.1\",\n len?: number,\n lPad?: number,\n rPad?: number,\n builtin?: boolean,\n index?: number\n ) {\n if (\n format.startsWith(\"%\") &&\n len === undefined &&\n lPad === undefined &&\n rPad === undefined\n ) {\n const { fmt, lPad, rPad, len } = format.match(\n /^%(?[BDXS])(?\\d+)\\.(?\\d+)\\.(?\\d+)$/\n )?.groups as {\n fmt: \"B\" | \"X\" | \"D\" | \"S\";\n lPad: string;\n rPad: string;\n len: string;\n };\n this.fmt = fmt;\n this.lPad = parseInt(lPad);\n this.rPad = parseInt(rPad);\n this.len = parseInt(len);\n this.builtin = false;\n this.index = -1;\n } else {\n assert([\"B\", \"X\", \"D\", \"S\"].includes(format[0]));\n this.fmt = format[0] as \"B\" | \"X\" | \"D\" | \"S\";\n this.len = len ?? 3;\n this.lPad = lPad ?? 1;\n this.rPad = rPad ?? 1;\n this.builtin = builtin ?? false;\n this.index = index ?? -1;\n }\n }\n\n header(test: Test) {\n let variable = `${this.variable}`;\n if (this.builtin) {\n const index = this.index >= 0 ? this.index : \"\";\n variable = `${variable}[${index}]`;\n }\n if (variable.length > this.len + this.lPad + this.rPad) {\n return variable.substring(0, this.len + this.lPad + this.rPad);\n }\n return this.padCenter(variable);\n }\n\n print(test: Test) {\n const val = test.getVar(this.variable, this.index);\n if (this.fmt === \"S\") {\n return this.padLeft(val as string);\n }\n\n const fmt = { B: bin, D: dec, X: hex }[this.fmt];\n const value = fmt(val as number);\n if (this.fmt === \"D\") {\n return this.padRight(value);\n } else {\n return this.padCenter(value.slice(value.length - this.len));\n }\n }\n\n private padCenter(value: string) {\n const space = this.lPad + this.len + this.rPad;\n const leftSpace = Math.floor((space - value.length) / 2);\n const rightSpace = space - leftSpace - value.length;\n const padLeft = leftSpace + value.length;\n const padRight = padLeft + rightSpace;\n value = value.padStart(padLeft);\n value = value.padEnd(padRight);\n return value;\n }\n\n private padLeft(value: string) {\n value = value.substring(0, this.len);\n const padRight = this.rPad + this.len;\n const padLeft = this.lPad + padRight;\n value = value.padEnd(padRight);\n value = value.padStart(padLeft);\n return value;\n }\n\n private padRight(value: string) {\n value = value.substring(0, this.len);\n const padLeft = this.lPad + this.len;\n const padRight = this.rPad + padLeft;\n value = value.padStart(padLeft);\n value = value.padEnd(padRight);\n return value;\n }\n}\n","import {\n assertExists,\n checkExhaustive,\n} from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { Span } from \"./languages/base.js\";\nimport {\n Tst,\n TstLineStatement,\n TstOperation,\n TstOutputSpec,\n TstStatement,\n TstWhileStatement,\n} from \"./languages/tst.js\";\nimport { Bus, Chip, HIGH, Low, LOW } from \"./chip/chip.js\";\nimport { Clock } from \"./chip/clock.js\";\nimport { Output } from \"./output.js\";\n\nexport abstract class Test {\n protected readonly instructions: (IS | TestInstruction)[] = [];\n protected _outputList: Output[] = [];\n protected _log = \"\";\n fs: FileSystem = new FileSystem();\n\n setFileSystem(fs: FileSystem): this {\n this.fs = fs;\n return this;\n }\n\n echo(_content: string) {\n return undefined;\n }\n clearEcho() {\n return undefined;\n }\n\n async load(_filename: string): Promise {\n return undefined;\n }\n async compareTo(_filename: string): Promise {\n return undefined;\n }\n outputFile(_filename: string): void {\n return undefined;\n }\n outputList(outputs: Output[]): void {\n this._outputList = outputs;\n }\n\n addInstruction(instruction: IS | TestInstruction): void {\n this.instructions.push(instruction);\n }\n\n reset(): this {\n this._steps = (function* (test) {\n for (const instruction of test.instructions) {\n yield* instruction.steps(test);\n }\n })(this);\n this._step = this._steps.next();\n this._step; //?\n this._log = \"\";\n return this;\n }\n\n private _steps!: IterableIterator;\n private _step!: IteratorResult;\n\n get steps(): Iterator {\n if (this._steps === undefined) {\n this.reset();\n this._steps = assertExists(this._steps, \"Reset did not initialize steps\");\n this._step = assertExists(this._step, \"Reset did not find first step\");\n }\n return this._steps;\n }\n\n get currentStep(): IS | TestInstruction | undefined {\n return this._step?.value;\n }\n\n get done(): boolean {\n return this._step?.done ?? false;\n }\n\n async step() {\n if (!this._step.done) {\n await this._step.value.do(this);\n this._step = this.steps.next();\n return false;\n }\n return true;\n }\n\n async run() {\n this.reset();\n while (!(await this.step()));\n }\n\n protected readonly breakpoints: Map = new Map();\n addBreakpoint(variable: string, value: number) {\n this.breakpoints.set(variable, value);\n }\n clearBreakpoints() {\n this.breakpoints.clear();\n }\n\n output() {\n const values = this._outputList.map((output) => output.print(this));\n this._log += `|${values.join(\"|\")}|\\n`;\n }\n\n header() {\n const values = this._outputList.map((output) => output.header(this));\n this._log += `|${values.join(\"|\")}|\\n`;\n }\n\n log() {\n return this._log;\n }\n\n abstract hasVar(variable: string | number): boolean;\n abstract getVar(variable: string | number, offset?: number): number | string;\n abstract setVar(variable: string, value: number, offset?: number): void;\n}\n\nfunction isTstLineStatment(line: TstStatement): line is TstLineStatement {\n return (line as TstLineStatement).ops !== undefined;\n}\n\nfunction isTstWhileStatement(line: TstStatement): line is TstWhileStatement {\n return (line as TstWhileStatement).condition !== undefined;\n}\n\nexport class ChipTest extends Test {\n private chip: Chip = new Low();\n get chipId(): number {\n return this.chip.id;\n }\n\n private clock = Clock.get();\n\n static from(tst: Tst): ChipTest {\n const test = new ChipTest();\n\n for (const line of tst.lines) {\n if (isTstLineStatment(line)) {\n test.addInstruction(ChipTest.makeLineStatement(line));\n } else {\n const repeat = isTstWhileStatement(line)\n ? new TestWhileInstruction(\n new Condition(\n line.condition.left,\n line.condition.right,\n line.condition.op\n )\n )\n : new TestRepeatInstruction(line.count);\n repeat.span = line.span;\n test.addInstruction(repeat);\n for (const statement of line.statements) {\n repeat.addInstruction(ChipTest.makeLineStatement(statement));\n }\n }\n }\n\n test.reset();\n\n return test;\n }\n\n private static makeLineStatement(line: TstLineStatement) {\n const statement = new TestCompoundInstruction();\n statement.span = line.span;\n for (const op of line.ops) {\n const inst = ChipTest.makeInstruction(op);\n if (inst !== undefined) statement.addInstruction(inst);\n }\n return statement;\n }\n\n private static makeInstruction(inst: TstOperation) {\n const { op } = inst;\n switch (op) {\n case \"tick\":\n return new TestTickInstruction();\n case \"tock\":\n return new TestTockInstruction();\n case \"eval\":\n return new TestEvalInstruction();\n case \"output\":\n return new TestOutputInstruction();\n case \"set\":\n return new TestSetInstruction(inst.id, inst.value, inst.index);\n case \"output-list\":\n return new TestOutputListInstruction(inst.spec);\n case \"echo\":\n return new TestEchoInstruction(inst.message);\n case \"clear-echo\":\n return new TestClearEchoInstruction();\n case \"loadRom\":\n return new TestLoadROMInstruction(inst.file);\n case \"load\":\n case \"output-file\":\n case \"compare-to\":\n return undefined;\n default:\n checkExhaustive(op, `Unknown tst operation ${op}`);\n }\n }\n\n with(chip: Chip): this {\n this.chip = chip;\n return this;\n }\n\n hasVar(variable: string | number): boolean {\n if (variable === \"time\") {\n return true;\n }\n variable = `${variable}`;\n // Look up built-in chip state variables\n return this.chip.hasIn(variable) || this.chip.hasOut(variable);\n }\n\n getVar(variable: string | number, offset?: number): number | string {\n variable = `${variable}`;\n if (variable === \"time\") {\n return this.clock.toString();\n }\n const pin = this.chip.get(variable, offset);\n if (!pin) return 0;\n return pin instanceof Bus ? pin.busVoltage : pin.voltage();\n }\n\n setVar(variable: string, value: number, offset?: number): void {\n // Look up built-in chip state variables\n const pinOrBus = this.chip.get(variable, offset);\n if (pinOrBus instanceof Bus) {\n pinOrBus.busVoltage = value;\n } else {\n pinOrBus?.pull(value === 0 ? LOW : HIGH);\n }\n }\n\n eval(): void {\n this.chip.eval();\n }\n\n tick(): void {\n this.chip.eval();\n this.clock.tick();\n }\n\n tock(): void {\n this.chip.eval();\n this.clock.tock();\n }\n\n override async load(filename: string) {\n await this.chip.load(this.fs, filename);\n }\n\n override async run() {\n this.clock.reset();\n await super.run();\n }\n}\n\nexport class CPUTest extends Test {\n hasVar(_variable: string | number): boolean {\n return false;\n }\n getVar(_variable: string | number): number {\n return 0;\n }\n setVar(_variable: string, _value: number): void {\n return undefined;\n }\n ticktock(): void {\n return undefined;\n }\n}\n\nexport class VMTest extends Test {\n hasVar(_variable: string | number): boolean {\n return false;\n }\n getVar(_variable: string | number): number {\n return 0;\n }\n setVar(_variable: string, _value: number): void {\n return undefined;\n }\n vmstep(): void {\n return undefined;\n }\n}\n\nexport interface TestInstruction {\n span?: Span;\n do(test: Test): void;\n steps(test: Test): IterableIterator;\n}\n\nexport class TestSetInstruction implements TestInstruction {\n constructor(\n private variable: string,\n private value: number,\n private index?: number | undefined\n ) {}\n\n do(test: Test) {\n test.setVar(this.variable, this.value, this.index);\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestOutputInstruction implements TestInstruction {\n do(test: Test) {\n test.output();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestOutputListInstruction implements TestInstruction {\n private outputs: Output[] = [];\n\n constructor(specs: TstOutputSpec[] = []) {\n for (const spec of specs) {\n this.addOutput(spec);\n }\n }\n\n addOutput(inst: TstOutputSpec) {\n this.outputs.push(\n new Output(\n inst.id,\n inst.style,\n inst.width,\n inst.lpad,\n inst.rpad,\n inst.builtin,\n inst.address\n )\n );\n }\n\n do(test: Test) {\n test.outputList(this.outputs);\n test.header();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestCompoundInstruction implements TestInstruction {\n protected readonly instructions: TestInstruction[] = [];\n span?: Span;\n\n addInstruction(instruction: TestInstruction) {\n this.instructions.push(instruction);\n }\n\n do(test: Test): void {\n for (const instruction of this.instructions) {\n instruction.do(test);\n }\n }\n\n *steps(_test: Test): Generator {\n yield this;\n }\n}\n\nexport class TestRepeatInstruction extends TestCompoundInstruction {\n constructor(public readonly repeat: number) {\n super();\n }\n\n override do() {\n return undefined;\n }\n\n private *innerSteps(test: Test) {\n for (const instruction of this.instructions) {\n yield* instruction.steps(test);\n }\n }\n\n override *steps(test: Test) {\n if (this.repeat === -1) {\n yield this;\n while (true) {\n yield* this.innerSteps(test);\n }\n } else {\n for (let i = 0; i < this.repeat; i++) {\n yield this;\n yield* this.innerSteps(test);\n }\n }\n }\n}\n\nexport class Condition {\n constructor(\n public readonly x: string | number,\n public readonly y: string | number,\n public readonly op: \"<\" | \"<=\" | \"=\" | \">=\" | \">\" | \"<>\"\n ) {}\n\n check(test: Test): boolean {\n const x = test.hasVar(this.x) ? test.getVar(this.x) : this.x;\n const y = test.hasVar(this.y) ? test.getVar(this.y) : this.y;\n\n if (typeof x === \"string\" || typeof y === \"string\") {\n switch (this.op) {\n case \"=\":\n return `${x}` === `${y}`;\n case \"<>\":\n return `${x}` !== `${y}`;\n }\n } else {\n switch (this.op) {\n case \"<\":\n return x < y;\n case \"<=\":\n return x <= y;\n case \">\":\n return x > y;\n case \">=\":\n return x >= y;\n case \"=\":\n return x === y;\n case \"<>\":\n return x !== y;\n }\n }\n return false;\n }\n}\n\nexport class TestWhileInstruction extends TestCompoundInstruction {\n constructor(public readonly condition: Condition) {\n super();\n }\n\n override *steps(test: Test) {\n while (this.condition.check(test)) {\n yield this;\n for (const instruction of this.instructions) {\n yield* instruction.steps(test);\n }\n }\n }\n}\n\nexport class TestEchoInstruction implements TestInstruction {\n constructor(public readonly content: string) {}\n do(test: Test) {\n test.echo(this.content);\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestClearEchoInstruction implements TestInstruction {\n do(test: Test) {\n test.clearEcho();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestLoadROMInstruction implements TestInstruction {\n constructor(readonly file: string) {}\n async do(test: Test) {\n test.fs.pushd(\"/samples\");\n await test.load(this.file);\n test.fs.popd();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestBreakpointInstruction implements TestInstruction {\n constructor(readonly variable: string, readonly value: number) {}\n\n do(test: Test) {\n test.addBreakpoint(this.variable, this.value);\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestClearBreakpointsInstruction implements TestInstruction {\n do(test: Test) {\n test.clearBreakpoints();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport interface ChipTestInstruction extends TestInstruction {\n _chipTestInstruction_: true;\n do(test: ChipTest): void | Promise;\n}\n\nexport class TestEvalInstruction implements ChipTestInstruction {\n readonly _chipTestInstruction_ = true;\n do(test: ChipTest) {\n test.eval();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestTickInstruction implements ChipTestInstruction {\n readonly _chipTestInstruction_ = true;\n do(test: ChipTest) {\n test.tick();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestTockInstruction implements ChipTestInstruction {\n readonly _chipTestInstruction_ = true;\n do(test: ChipTest) {\n test.tock();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport interface CPUTestInstruction extends TestInstruction {\n _cpuTestInstruction_: true;\n do(test: CPUTest): void | Promise;\n}\n\nexport class TestTickTockInstruction implements CPUTestInstruction {\n readonly _cpuTestInstruction_ = true;\n do(test: CPUTest) {\n test.ticktock();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport interface VMTestInstruction extends TestInstruction {\n _vmTestInstruction_: true;\n do(test: VMTest): void | Promise;\n}\n\nexport class TestVMStepInstruction implements VMTestInstruction {\n readonly _vmTestInstruction_ = true;\n do(test: VMTest) {\n test.vmstep();\n }\n\n *steps() {\n yield this;\n }\n}\n","import {\n ASSIGN,\n ASSIGN_ASM,\n ASSIGN_OP,\n COMMANDS,\n COMMANDS_ASM,\n COMMANDS_OP,\n JUMP,\n JUMP_ASM,\n JUMP_OP,\n} from \"../cpu/alu.js\";\n\nexport type CommandOps = keyof typeof COMMANDS.op;\nexport type JumpOps = keyof typeof JUMP.op;\nexport type StoreOps = keyof typeof ASSIGN.op;\n\nexport function asm(op: number): string {\n if (op & 0x8000) {\n return cInstruction(op);\n }\n return aInstruction(op);\n}\n\nfunction cInstruction(op: number): string {\n op = op & 0xffff; // Clear high order bits\n const mop = (op & 0x1000) >> 12;\n const cop: CommandOps = ((op & 0b0000111111000000) >> 6) as CommandOps;\n const sop: StoreOps = ((op & 0b0000000000111000) >> 3) as StoreOps;\n const jop: JumpOps = (op & 0b0000000000000111) as JumpOps;\n\n if (COMMANDS.op[cop] === undefined) {\n // Invalid commend\n return \"#ERR\";\n }\n\n let command = COMMANDS.op[cop];\n if (mop) {\n command = command.replace(/A/g, \"M\") as COMMANDS_ASM;\n }\n\n const store = ASSIGN.op[sop];\n const jump = JUMP.op[jop];\n\n let instruction: string = command;\n if (store) {\n instruction = `${store}=${instruction}`;\n }\n if (jump) {\n instruction = `${instruction};${jump}`;\n }\n\n return instruction;\n}\n\nfunction aInstruction(op: number): string {\n return \"@\" + (op & 0x7fff).toString(10);\n}\n\nexport function op(asm: string): number {\n if (asm[0] === \"@\") {\n return aop(asm);\n } else {\n return cop(asm);\n }\n}\n\nfunction aop(asm: string): number {\n return parseInt(asm.substring(1), 10);\n}\n\nfunction cop(asm: string): number {\n const parts = asm.match(\n /(?:(?[AMD]{1,3})=)?(?[-!01ADM&|]{1,3})(?:;(?JGT|JLT|JGE|JLE|JEQ|JMP))?/\n );\n const { assign, operation, jump } = parts?.groups ?? {};\n const mode = operation.includes(\"M\") || assign.includes(\"M\");\n const aop = ASSIGN.asm[(assign as ASSIGN_ASM) ?? \"\"];\n const jop = JUMP.asm[(jump as JUMP_ASM) ?? \"\"];\n const cop = COMMANDS.asm[(operation as COMMANDS_ASM) ?? \"\"];\n\n return makeC(mode, cop, aop, jop);\n}\n\nexport function makeC(\n isM: boolean,\n op: COMMANDS_OP,\n assign: ASSIGN_OP = 0,\n jmp: JUMP_OP = 0\n): number {\n const C = 0xe000;\n const A = isM ? 0x1000 : 0;\n const O = op << 6;\n const D = (assign ?? 0) << 3;\n const J = jmp ?? 0;\n return C + A + O + D + J;\n}\n","const Hex = [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n];\n\nexport function chars(i: number): string {\n return Hex[i] ?? \"X\";\n}\n\nexport function bits(i: number): string {\n switch (i) {\n case 0x0:\n return \"0000\";\n case 0x1:\n return \"0001\";\n case 0x2:\n return \"0010\";\n case 0x3:\n return \"0011\";\n case 0x4:\n return \"0100\";\n case 0x5:\n return \"0101\";\n case 0x6:\n return \"0110\";\n case 0x7:\n return \"0111\";\n case 0x8:\n return \"1000\";\n case 0x9:\n return \"1001\";\n case 0xa:\n return \"1010\";\n case 0xb:\n return \"1011\";\n case 0xc:\n return \"1100\";\n case 0xd:\n return \"1101\";\n case 0xe:\n return \"1110\";\n case 0xf:\n return \"1111\";\n default:\n return \"erro\";\n }\n}\n\nexport function int(n: string, radix: number): number {\n const i = parseInt(n.replace(/[^\\d+-.xa-fA-F]/g, \"\"), radix);\n return i & 0xffff;\n}\n\nexport function int16(i: string): number {\n return int(i, 16);\n}\n\nexport function int10(i: string): number {\n return int(i, 10);\n}\n\nexport function int2(i: string): number {\n return int(i, 2);\n}\n\nexport function hex(i: number): string {\n const hu = chars((i & 0xf000) >> 12);\n const hl = chars((i & 0x0f00) >> 8);\n const lu = chars((i & 0x00f0) >> 4);\n const ll = chars(i & 0x000f);\n\n return `0x${hu}${hl}${lu}${ll}`;\n}\n\nexport function bin(i: number, precision = 16): string {\n const hu = bits((i & 0xf000) >> 12);\n const hl = bits((i & 0x0f00) >> 8);\n const lu = bits((i & 0x00f0) >> 4);\n const ll = bits(i & 0x000f);\n\n // return `${hu} ${hl} ${lu} ${ll}`;\n return `${hu}${hl}${lu}${ll}`.substring(16 - precision); // Match the book's formatting\n}\n\nexport function dec(i: number): string {\n i = i & 0xffff;\n if (i === 0x8000) {\n return \"-32768\";\n }\n if (i & 0x8000) {\n i = (~i + 1) & 0x7fff;\n return `-${i}`;\n }\n return `${i}`;\n}\n\nexport function uns(i: number): string {\n i = i & 0xffff;\n return `${i}`;\n}\n\nexport function nand16(a: number, b: number): number {\n a = a & 0xffff;\n b = b & 0xffff;\n let c = ~(a & b);\n c = c & 0xffff;\n return c;\n}\n"],"names":["DiffTable","className","out","cmp","zeroState","output","CMP","compare","isErr","_jsxs","children","_jsx","display","Err","cmpData","Ok","outData","failures","table","range","Math","min","length","map","i","cmpI","outI","max","_","j","cell","pass","trim","match","style","fontFamily","marginBottom","row","DiffCell","pinWidth","start","end","undefined","Error","loadChip","name","fs","hasBuiltinChip","getBuiltinChip","readFile","file","maybeParsedHDL","HDL","chip","isOk","build","parts","toString","buildChip","Chip","ins","pin","width","outs","clocked","part","builtin","partChip","wires","lhs","rhs","to","from","wire","ROM32K","path","load","v","at","busVoltage","RAM","Screen","SCREEN","Keyboard","key","this","KEYBOARD","Memory","RAM16K","add","keyboard","screen","ram","in","voltage","address","inn","OFFSET","eval","startsWith","idx","int10","groups","offset","ClockedChip","CPU","emptyState","_state","cpuTick","cpuInput","state","writeM","pull","HIGH","LOW","ALU","cpuTock","addressM","outM","PC","inM","instruction","reset","ConstantBus","A","D","Computer","get","And","a","b","and","n","And16","and16","DMux","sel","dmux","DMux4Way","dmux4way","c","d","DMux8Way","dmux8way","e","f","g","h","mux16","mux16_4","s2","Mux","mux","set","Mux16","Mux4Way16","Mux8Way16","mux16_8","Nand","nand","Nand16","nand16","Not","Not16","or","Or","Or16","or16","Or8way","Xor","xor","Xor16","xor16","add16","Add16","ALUNoStat","x","y","op","alu","flags","ng","Flags","zr","halfAdder","HalfAdder","sum","carry","FullAdder","s","ca","fullAdder","Inc16","DFF","t","REGISTRY","Map","Bit","Register","RAM8","RAM64","RAM512","RAM4K","VRegister","ChipCtor","has","bit","bits","_memory","MemoryChip","pow","_address","_nextData","assert","size","RamBus","index","num","Bus","newWidth","next","push","forEach","reduce","nextVoltage","InSubBus","bus","connect","mask","high","low","mid","OutSubBus","value","TRUE_BUS","FALSE_BUS","parsePinDecl","toPin","w","Number","Symbol","iterator","Pins","minWidth","insert","values","id","internals","Set","internal","pins","clockedPins","Clock","$","subscribe","hasIn","hasOut","getBuiltin","BUILTIN_NAMES","includes","connections","isOutPin","wireOutPin","wireInPin","toLowerCase","emplace","partPin","assertExists","chipPin","findPin","isInternal","ensureWidth","remove","Low","level","tock","tick","unsubscribe","clock","BehaviorSubject","ticks","Subject","subject","frameSubject","COMMANDS","asm","M","ASSIGN","MD","AM","AD","AMD","JUMP","JGT","JEQ","JGE","JLT","JNE","JLE","JMP","Positive","Zero","Negative","o","flag","BITS","decode","x1","x2","am","d1","d2","d3","j1","j2","j3","alu2","ROM","input","tickState","cpu","FORMATS","memory","Int16Array","format","current","int2","int16","isFinite","updates","slice","fn","grammar","ohm","asmGrammar","grammars","asmSemantics","extendSemantics","baseSemantics","isALabelInstruction","inst","label","addAttribute","Root","instructions","child","AInstruction","_at","val","type","CInstruction","assignN","opN","jmpN","assign","sourceString","replace","jmp","isM","jump","store","Label","_o","_c","ASM","semantics","parser","parse","makeParser","passes","fillLabel","nextLabel","symbols","unfilled","line","emit","makeC","filter","endsWith","loadHack","loadAsm","source","unwrap","split","UNKNOWN_PARSE_ERROR","Base","createSemantics","property","root","succeeded","parsed","message","shortMessage","extendOperation","List","list","asIteration","decNumber","digits","wholeDec","binNumber","hexNumber","Name","ident","identifier","__","String","_a","str","_b","cmpGrammar","cmpSemantics","cells","lines","hdlGrammar","hdlSemantics","SubBus","startNode","endNode","WireSide","Wire","left","right","isTerminal","Wires","node","Part","Parts","BuiltinPart","PartList","ClockedList","PinDecl","PinList","body","Clocked","tstGrammar","tstSemantics","extendAttribute","Index","FileName","_open","dec","_close","OutputFormat","lpad","rpad","TstEvalOperation","TstOutputOperation","TstOutputListOperation","formats","spec","TstSetOperation","setOp","TstEchoOperation","TstClearEchoOperation","TstLoadROMOperation","_r","_l","TstFileOperation","Condition","TstWhile","cond","statements","statement","condition","span","startIdx","endIdx","TstRepeat","count","TstStatement","stmt","ops","operation","break","Tst","tst","TST","Output","variable","len","lPad","rPad","fmt","parseInt","test","substring","padCenter","getVar","padLeft","B","bin","X","hex","padRight","space","leftSpace","floor","rightSpace","padStart","padEnd","Test","FileSystem","_content","_filename","outputs","_outputList","_steps","steps","_step","_log","done","do","step","breakpoints","clear","print","join","header","isTstLineStatment","isTstWhileStatement","ChipTest","pinOrBus","filename","addInstruction","makeLineStatement","repeat","TestWhileInstruction","TestRepeatInstruction","TestCompoundInstruction","makeInstruction","TestTickInstruction","TestTockInstruction","TestEvalInstruction","TestOutputInstruction","TestSetInstruction","TestOutputListInstruction","TestEchoInstruction","TestClearEchoInstruction","TestLoadROMInstruction","checkExhaustive","setVar","specs","addOutput","outputList","_test","innerSteps","hasVar","check","content","echo","clearEcho","pushd","popd","mop","cop","sop","jop","command","cInstruction","aInstruction","aop","mode","C","O","J","Hex","chars","int","radix","hu","hl","lu","ll","precision","uns"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/506.f6bf6957.chunk.js b/build/static/js/506.f6bf6957.chunk.js new file mode 100644 index 000000000..159a9a52e --- /dev/null +++ b/build/static/js/506.f6bf6957.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[506],{9506:function(n,e,r){r.r(e),r.d(e,{Util:function(){return i}});var t=r(1026),a=r(6167),u=r(7693),c=r(326),o=r(7878),i=function(){var n=(0,a.useState)(0),e=(0,t.Z)(n,2),r=e[0],i=e[1],s=(0,a.useState)("@0"),l=(0,t.Z)(s,2),f=l[0],v=l[1],p=(0,a.useCallback)((function(){return(0,c.Ly)(r)}),[r]),b=(0,a.useCallback)((function(){return(0,c.E_)(r)}),[r]),d=(0,a.useCallback)((function(){return(0,c.nN)(r)}),[r]),A=(0,a.useCallback)((function(){return(0,c.$v)(r)}),[r]),g=(0,a.useCallback)((function(n){var e=n.target.value,r=(0,c.C$)(e);i(r),v((0,u.a)(r))}),[i,v]),D=(0,a.useCallback)((function(n){var e=n.target.value,r=(0,c.o5)(e);i(r),v((0,u.a)(r))}),[i,v]),h=(0,a.useCallback)((function(n){var e=n.target.value,r=(0,c.o5)(e);i(r),v((0,u.a)(r))}),[i,v]),k=(0,a.useCallback)((function(n){var e=n.target.value,r=(0,c.Af)(e);i(r),v((0,u.a)(r))}),[i,v]),x=(0,a.useCallback)((function(n){var e=n.target.value;v(e),i((0,u.op)(e))}),[i,v]);return(0,o.jsx)("form",{children:(0,o.jsxs)("div",{className:"grid",children:[(0,o.jsxs)("label",{children:["Binary ",(0,o.jsx)("input",{type:"text",value:p(),onChange:g})]}),(0,o.jsxs)("label",{children:["Decimal ",(0,o.jsx)("input",{type:"text",value:b(),onChange:D})]}),(0,o.jsxs)("label",{children:["Unsigned",(0,o.jsx)("input",{type:"text",value:d(),onChange:h})]}),(0,o.jsxs)("label",{children:["Hex ",(0,o.jsx)("input",{type:"text",value:A(),onChange:k})]}),(0,o.jsxs)("label",{children:["HACK ASM",(0,o.jsx)("input",{type:"text",value:f,onChange:x})]})]})})};e.default=i},9422:function(n,e,r){r.d(e,{Z:function(){return c}});var t=r(3940),a=r(6983),u=r(7591);function c(){c=function(n,e){return new r(n,void 0,e)};var n=RegExp.prototype,e=new WeakMap;function r(n,t,u){var c=new RegExp(n,t);return e.set(c,u||e.get(n)),(0,a.Z)(c,r.prototype)}function o(n,r){var t=e.get(r);return Object.keys(t).reduce((function(e,r){var a=t[r];if("number"==typeof a)e[r]=n[a];else{for(var u=0;void 0===n[a[u]]&&u+1]+)>/g,(function(n,e){var r=u[e];return"$"+(Array.isArray(r)?r.join("$"):r)})))}if("function"==typeof a){var c=this;return n[Symbol.replace].call(this,r,(function(){var n=arguments;return"object"!=(0,t.Z)(n[n.length-1])&&(n=[].slice.call(n)).push(o(n,c)),a.apply(this,n)}))}return n[Symbol.replace].call(this,r,a)},c.apply(this,arguments)}},6693:function(n,e,r){r.d(e,{Bb:function(){return o},PH:function(){return t},Uc:function(){return a},lK:function(){return u},vU:function(){return c}});var t={asm:{0:42,1:63,"-1":58,D:12,A:48,M:48,"!D":13,"!A":49,"-D":15,"-A":51,"D+1":31,"A+1":55,"D-1":14,"A-1":50,"D+A":2,"D-A":19,"D-M":19,"A-D":7,"D&A":0,"D&M":0,"D|A":21,"D|M":21},op:{42:"0",63:"1",58:"-1",12:"D",48:"A",13:"!D",49:"!A",15:"-D",51:"-A",31:"D+1",55:"A+1",14:"D-1",50:"A-1",2:"D+A",19:"D-A",7:"A-D",0:"D&A",21:"D|A"}},a={asm:{"":0,M:1,D:2,MD:3,A:4,AM:5,AD:6,AMD:7},op:{0:"",1:"M",2:"D",3:"MD",4:"A",5:"AM",6:"AD",7:"AMD"}},u={asm:{"":0,JGT:1,JEQ:2,JGE:3,JLT:4,JNE:5,JLE:6,JMP:7},op:{0:"",1:"JGT",2:"JEQ",3:"JGE",4:"JLT",5:"JNE",6:"JLE",7:"JMP"}},c={1:"Positive",0:"Zero",15:"Negative",Positive:1,Zero:0,Negative:15};function o(n,e,r){var t=0;switch(n){case 42:t=0;break;case 63:t=1;break;case 58:t=-1;break;case 12:t=e;break;case 48:t=r;break;case 13:t=~e;break;case 49:t=~r;break;case 15:t=-e;break;case 51:t=-r;break;case 31:t=e+1;break;case 55:t=r+1;break;case 14:t=e-1;break;case 50:t=r-1;break;case 2:t=e+r;break;case 19:t=e-r;break;case 7:t=r-e;break;case 0:t=e&r;break;case 21:t=e|r}return[t&=65535,0===t?c.Zero:32768&t?c.Negative:c.Positive]}},7693:function(n,e,r){r.d(e,{a:function(){return u},op:function(){return c},p:function(){return o}});var t=r(9422),a=r(6693);function u(n){return 32768&n?function(n){n&=65535;var e=(4096&n)>>12,r=(4032&n)>>6,t=(56&n)>>3,u=7&n;if(void 0===a.PH.op[r])return"#ERR";var c=a.PH.op[r];e&&(c=c.replace(/A/g,"M"));var o=a.Uc.op[t],i=a.lK.op[u],s=c;o&&(s="".concat(o,"=").concat(s));i&&(s="".concat(s,";").concat(i));return s}(n):function(n){return"@"+(32767&n).toString(10)}(n)}function c(n){return"@"===n[0]?function(n){return parseInt(n.substring(1),10)}(n):function(n){var e,r=n.match((0,t.Z)(/(?:([AMD]{1,3})=)?([-!01ADM&|]{1,3})(?:;(JGT|JLT|JGE|JLE|JEQ|JMP))?/,{assign:1,operation:2,jump:3})),u=null!==(e=null===r||void 0===r?void 0:r.groups)&&void 0!==e?e:{},c=u.assign,i=u.operation,s=u.jump,l=i.includes("M")||c.includes("M"),f=a.Uc.asm[null!==c&&void 0!==c?c:""],v=a.lK.asm[null!==s&&void 0!==s?s:""],p=a.PH.asm[null!==i&&void 0!==i?i:""];return o(l,p,f,v)}(n)}function o(n,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=57344,u=n?4096:0,c=e<<6,o=(null!==r&&void 0!==r?r:0)<<3,i=null!==t&&void 0!==t?t:0;return a+u+c+o+i}},326:function(n,e,r){r.d(e,{$v:function(){return l},Af:function(){return o},C$:function(){return s},C2:function(){return b},E_:function(){return v},Ly:function(){return f},nN:function(){return p},o5:function(){return i}});var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];function a(n){var e;return null!==(e=t[n])&&void 0!==e?e:"X"}function u(n){switch(n){case 0:return"0000";case 1:return"0001";case 2:return"0010";case 3:return"0011";case 4:return"0100";case 5:return"0101";case 6:return"0110";case 7:return"0111";case 8:return"1000";case 9:return"1001";case 10:return"1010";case 11:return"1011";case 12:return"1100";case 13:return"1101";case 14:return"1110";case 15:return"1111";default:return"erro"}}function c(n,e){return 65535&parseInt(n.replace(/[^\d+-.xa-fA-F]/g,""),e)}function o(n){return c(n,16)}function i(n){return c(n,10)}function s(n){return c(n,2)}function l(n){var e=a((61440&n)>>12),r=a((3840&n)>>8),t=a((240&n)>>4),u=a(15&n);return"0x".concat(e).concat(r).concat(t).concat(u)}function f(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,r=u((61440&n)>>12),t=u((3840&n)>>8),a=u((240&n)>>4),c=u(15&n);return"".concat(r).concat(t).concat(a).concat(c).substring(16-e)}function v(n){return 32768===(n&=65535)?"-32768":32768&n?"-".concat(n=1+~n&32767):"".concat(n)}function p(n){return"".concat(n&=65535)}function b(n,e){var r=~((n&=65535)&(e&=65535));return r&=65535}}}]); +//# sourceMappingURL=506.f6bf6957.chunk.js.map \ No newline at end of file diff --git a/build/static/js/506.f6bf6957.chunk.js.map b/build/static/js/506.f6bf6957.chunk.js.map new file mode 100644 index 000000000..e58a387a1 --- /dev/null +++ b/build/static/js/506.f6bf6957.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/506.f6bf6957.chunk.js","mappings":"wNAYaA,EAAO,WAClB,OAA0BC,EAAAA,EAAAA,UAAS,GAAE,eAA9BC,EAAK,KAAEC,EAAQ,KACtB,GAAgCF,EAAAA,EAAAA,UAAS,MAAK,eAAvCG,EAAQ,KAAEC,EAAW,KAEtBC,GAAWC,EAAAA,EAAAA,cAAY,kBAAMC,EAAAA,EAAAA,IAAIN,EAAM,GAAE,CAACA,IAC1CO,GAAWF,EAAAA,EAAAA,cAAY,kBAAMG,EAAAA,EAAAA,IAAIR,EAAM,GAAE,CAACA,IAC1CS,GAAWJ,EAAAA,EAAAA,cAAY,kBAAMK,EAAAA,EAAAA,IAAIV,EAAM,GAAE,CAACA,IAC1CW,GAAWN,EAAAA,EAAAA,cAAY,kBAAMO,EAAAA,EAAAA,IAAIZ,EAAM,GAAE,CAACA,IAG1Ca,GAASR,EAAAA,EAAAA,cACb,YAA2D,IAA9CL,EAAK,EAAfc,OAAUd,MACLe,GAASC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,OAAGC,EAC7B,CAEM,SAAU7H,EAAI0C,GAAyB,IAAdoF,EAAY,UAAH,6CAAG,GACnCJ,EAAKJ,GAAU,MAAJ5E,IAAe,IAC1BiF,EAAKL,GAAU,KAAJ5E,IAAe,GAC1BkF,EAAKN,GAAU,IAAJ5E,IAAe,GAC1BmF,EAAKP,EAAS,GAAJ5E,GAGhB,MAAO,UAAGgF,GAAE,OAAGC,GAAE,OAAGC,GAAE,OAAGC,GAAKvB,UAAU,GAAKwB,EAC/C,CAEM,SAAU5H,EAAIwC,GAElB,OAAU,SADVA,GAAQ,OAEC,SAED,MAAJA,EAEK,IAAP,OADAA,EAAU,GAAJA,EAAS,OAGV,GAAP,OAAUA,EACZ,CAEM,SAAUtC,EAAIsC,GAElB,MAAO,GAAP,OADAA,GAAQ,MAEV,CAEM,SAAUqF,EAAOxC,EAAWyC,GAGhC,IAAIC,KAFJ1C,GAAQ,QACRyC,GAAQ,QAGR,OADAC,GAAQ,KAEV,C","sources":["pages/util.tsx","../../node_modules/@babel/runtime/helpers/esm/wrapRegExp.js","../../simulator/src/cpu/alu.ts","../../simulator/src/util/asm.ts","../../simulator/src/util/twos.ts"],"sourcesContent":["import { ChangeEvent, useCallback, useState } from \"react\";\nimport { asm, op } from \"@nand2tetris/simulator/util/asm.js\";\nimport {\n bin,\n dec,\n hex,\n int10,\n int16,\n int2,\n uns,\n} from \"@nand2tetris/simulator/util/twos.js\";\n\nexport const Util = () => {\n const [value, setValue] = useState(0);\n const [asmValue, setAsmValue] = useState(\"@0\");\n\n const binValue = useCallback(() => bin(value), [value]);\n const decValue = useCallback(() => dec(value), [value]);\n const unsValue = useCallback(() => uns(value), [value]);\n const hexValue = useCallback(() => hex(value), [value]);\n // const asmValue = useCallback(() => asm(value), [value]);\n\n const setBin = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n const ivalue = int2(value);\n setValue(ivalue);\n setAsmValue(asm(ivalue));\n },\n [setValue, setAsmValue]\n );\n const setInt = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n const ivalue = int10(value);\n setValue(ivalue);\n setAsmValue(asm(ivalue));\n },\n [setValue, setAsmValue]\n );\n const setUns = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n const ivalue = int10(value);\n setValue(ivalue);\n setAsmValue(asm(ivalue));\n },\n [setValue, setAsmValue]\n );\n const setHex = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n const ivalue = int16(value);\n setValue(ivalue);\n setAsmValue(asm(ivalue));\n },\n [setValue, setAsmValue]\n );\n const setAsm = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n setAsmValue(value);\n setValue(op(value));\n },\n [setValue, setAsmValue]\n );\n\n return (\n
\n
\n \n \n \n \n \n
\n
\n );\n};\n\nexport default Util;\n","import _typeof from \"./typeof.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport inherits from \"./inherits.js\";\nexport default function _wrapRegExp() {\n _wrapRegExp = function _wrapRegExp(re, groups) {\n return new BabelRegExp(re, void 0, groups);\n };\n var _super = RegExp.prototype,\n _groups = new WeakMap();\n function BabelRegExp(re, flags, groups) {\n var _this = new RegExp(re, flags);\n return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype);\n }\n function buildGroups(result, re) {\n var g = _groups.get(re);\n return Object.keys(g).reduce(function (groups, name) {\n var i = g[name];\n if (\"number\" == typeof i) groups[name] = result[i];else {\n for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;\n groups[name] = result[i[k]];\n }\n return groups;\n }, Object.create(null));\n }\n return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {\n var result = _super.exec.call(this, str);\n if (result) {\n result.groups = buildGroups(result, this);\n var indices = result.indices;\n indices && (indices.groups = buildGroups(indices, this));\n }\n return result;\n }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {\n if (\"string\" == typeof substitution) {\n var groups = _groups.get(this);\n return _super[Symbol.replace].call(this, str, substitution.replace(/\\$<([^>]+)>/g, function (_, name) {\n var group = groups[name];\n return \"$\" + (Array.isArray(group) ? group.join(\"$\") : group);\n }));\n }\n if (\"function\" == typeof substitution) {\n var _this = this;\n return _super[Symbol.replace].call(this, str, function () {\n var args = arguments;\n return \"object\" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);\n });\n }\n return _super[Symbol.replace].call(this, str, substitution);\n }, _wrapRegExp.apply(this, arguments);\n}","export type COMMANDS_ASM =\n | \"0\"\n | \"1\"\n | \"-1\"\n | \"D\"\n | \"A\"\n | \"M\"\n | \"!D\"\n | \"!A\"\n | \"-D\"\n | \"-A\"\n | \"D+1\"\n | \"A+1\"\n | \"D-1\"\n | \"A-1\"\n | \"D+A\"\n | \"D-A\"\n | \"D-M\"\n | \"A-D\"\n | \"D&A\"\n | \"D&M\"\n | \"D|A\"\n | \"D|M\";\n\nexport type COMMANDS_OP =\n | 0b101010\n | 0b111111\n | 0b111010\n | 0b001100\n | 0b110000\n | 0b110000\n | 0b001101\n | 0b110001\n | 0b001111\n | 0b110011\n | 0b011111\n | 0b110111\n | 0b001110\n | 0b110010\n | 0b000010\n | 0b010011\n | 0b010011\n | 0b000111\n | 0b000000\n | 0b000000\n | 0b010101\n | 0b010101;\n\nexport const COMMANDS: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"0\": 0b101010, // 42 0x2A\n \"1\": 0b111111, // 63 0x3F\n \"-1\": 0b111010, // 58 0x3A\n D: 0b001100, // 12 0x0C\n A: 0b110000, // 48 0x30\n M: 0b110000, // 48 0x30\n \"!D\": 0b001101, // 13 0x0D\n \"!A\": 0b110001, // 49 0x31\n \"-D\": 0b001111, // 15 0x0F\n \"-A\": 0b110011, // 51 0x33\n \"D+1\": 0b011111, // 31 0x1F\n \"A+1\": 0b110111, // 55 0x37\n \"D-1\": 0b001110, // 14 0x0E\n \"A-1\": 0b110010, // 50 0x32\n \"D+A\": 0b000010, // 2 0x02\n \"D-A\": 0b010011, // 19 0x13\n \"D-M\": 0b010011, // 19 0x13\n \"A-D\": 0b000111, // 7 0x07\n \"D&A\": 0b000000, // 0 0x00\n \"D&M\": 0b000000, // 0 0x00\n \"D|A\": 0b010101, // 21 0x15\n \"D|M\": 0b010101, // 21 0x15\n },\n op: {\n 0x2a: \"0\",\n 0x3f: \"1\",\n 0x3a: \"-1\",\n 0x0c: \"D\",\n 0x30: \"A\",\n 0x0d: \"!D\",\n 0x31: \"!A\",\n 0x0f: \"-D\",\n 0x33: \"-A\",\n 0x1f: \"D+1\",\n 0x37: \"A+1\",\n 0x0e: \"D-1\",\n 0x32: \"A-1\",\n 0x02: \"D+A\",\n 0x13: \"D-A\",\n 0x07: \"A-D\",\n 0x00: \"D&A\",\n 0x15: \"D|A\",\n },\n};\n\nexport type ASSIGN_ASM = \"\" | \"M\" | \"D\" | \"MD\" | \"A\" | \"AM\" | \"AD\" | \"AMD\";\nexport type ASSIGN_OP = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;\n\nexport const ASSIGN: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"\": 0x0,\n M: 0b001,\n D: 0b010,\n MD: 0b011,\n A: 0b100,\n AM: 0b101,\n AD: 0b110,\n AMD: 0b111,\n },\n op: {\n 0x0: \"\",\n 0x1: \"M\",\n 0x2: \"D\",\n 0x3: \"MD\",\n 0x4: \"A\",\n 0x5: \"AM\",\n 0x6: \"AD\",\n 0x7: \"AMD\",\n },\n};\n\nexport type JUMP_ASM =\n | \"\"\n | \"JGT\"\n | \"JEQ\"\n | \"JGE\"\n | \"JLT\"\n | \"JNE\"\n | \"JLE\"\n | \"JMP\";\nexport type JUMP_OP = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;\nexport const JUMP: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"\": 0b0,\n JGT: 0b001,\n JEQ: 0b010,\n JGE: 0b011,\n JLT: 0b100,\n JNE: 0b101,\n JLE: 0b110,\n JMP: 0b111,\n },\n op: {\n 0x0: \"\",\n 0x1: \"JGT\",\n 0x2: \"JEQ\",\n 0x3: \"JGE\",\n 0x4: \"JLT\",\n 0x5: \"JNE\",\n 0x6: \"JLE\",\n 0x7: \"JMP\",\n },\n};\n\nexport const Flags = {\n 0x01: \"Positive\",\n 0x00: \"Zero\",\n 0x0f: \"Negative\",\n Positive: 0x01,\n Zero: 0x00,\n Negative: 0x0f,\n};\n\nexport function alu(op: number, d: number, a: number): [number, number] {\n let o = 0;\n switch (op) {\n case 0x2a:\n o = 0;\n break;\n case 0x3f:\n o = 1;\n break;\n case 0x3a:\n o = -1;\n break;\n case 0x0c:\n o = d;\n break;\n case 0x30:\n o = a;\n break;\n case 0x0d:\n o = ~d;\n break;\n case 0x31:\n o = ~a;\n break;\n case 0x0f:\n o = -d;\n break;\n case 0x33:\n o = -a;\n break;\n case 0x1f:\n o = d + 1;\n break;\n case 0x37:\n o = a + 1;\n break;\n case 0x0e:\n o = d - 1;\n break;\n case 0x32:\n o = a - 1;\n break;\n case 0x02:\n o = d + a;\n break;\n case 0x13:\n o = d - a;\n break;\n case 0x07:\n o = a - d;\n break;\n case 0x00:\n o = d & a;\n break;\n case 0x15:\n o = d | a;\n break;\n }\n\n o = o & 0xffff;\n const flags =\n o === 0 ? Flags.Zero : o & 0x8000 ? Flags.Negative : Flags.Positive;\n return [o, flags];\n}\n\nexport function alua(op: number, d: number, a: number): [number, number] {\n if (op & 0b100000) d = 0;\n if (op & 0b010000) d = ~d & 0xffff;\n if (op & 0b001000) a = 0;\n if (op & 0b000100) a = ~a & 0xffff;\n\n let o = (op & 0b000010 ? d + a : d & a) & 0xffff;\n if (op & 0b000001) o = ~o & 0xffff;\n\n const flags =\n o === 0 ? Flags.Zero : o & 0x8000 ? Flags.Negative : Flags.Positive;\n return [o, flags];\n}\n","import {\n ASSIGN,\n ASSIGN_ASM,\n ASSIGN_OP,\n COMMANDS,\n COMMANDS_ASM,\n COMMANDS_OP,\n JUMP,\n JUMP_ASM,\n JUMP_OP,\n} from \"../cpu/alu.js\";\n\nexport type CommandOps = keyof typeof COMMANDS.op;\nexport type JumpOps = keyof typeof JUMP.op;\nexport type StoreOps = keyof typeof ASSIGN.op;\n\nexport function asm(op: number): string {\n if (op & 0x8000) {\n return cInstruction(op);\n }\n return aInstruction(op);\n}\n\nfunction cInstruction(op: number): string {\n op = op & 0xffff; // Clear high order bits\n const mop = (op & 0x1000) >> 12;\n const cop: CommandOps = ((op & 0b0000111111000000) >> 6) as CommandOps;\n const sop: StoreOps = ((op & 0b0000000000111000) >> 3) as StoreOps;\n const jop: JumpOps = (op & 0b0000000000000111) as JumpOps;\n\n if (COMMANDS.op[cop] === undefined) {\n // Invalid commend\n return \"#ERR\";\n }\n\n let command = COMMANDS.op[cop];\n if (mop) {\n command = command.replace(/A/g, \"M\") as COMMANDS_ASM;\n }\n\n const store = ASSIGN.op[sop];\n const jump = JUMP.op[jop];\n\n let instruction: string = command;\n if (store) {\n instruction = `${store}=${instruction}`;\n }\n if (jump) {\n instruction = `${instruction};${jump}`;\n }\n\n return instruction;\n}\n\nfunction aInstruction(op: number): string {\n return \"@\" + (op & 0x7fff).toString(10);\n}\n\nexport function op(asm: string): number {\n if (asm[0] === \"@\") {\n return aop(asm);\n } else {\n return cop(asm);\n }\n}\n\nfunction aop(asm: string): number {\n return parseInt(asm.substring(1), 10);\n}\n\nfunction cop(asm: string): number {\n const parts = asm.match(\n /(?:(?[AMD]{1,3})=)?(?[-!01ADM&|]{1,3})(?:;(?JGT|JLT|JGE|JLE|JEQ|JMP))?/\n );\n const { assign, operation, jump } = parts?.groups ?? {};\n const mode = operation.includes(\"M\") || assign.includes(\"M\");\n const aop = ASSIGN.asm[(assign as ASSIGN_ASM) ?? \"\"];\n const jop = JUMP.asm[(jump as JUMP_ASM) ?? \"\"];\n const cop = COMMANDS.asm[(operation as COMMANDS_ASM) ?? \"\"];\n\n return makeC(mode, cop, aop, jop);\n}\n\nexport function makeC(\n isM: boolean,\n op: COMMANDS_OP,\n assign: ASSIGN_OP = 0,\n jmp: JUMP_OP = 0\n): number {\n const C = 0xe000;\n const A = isM ? 0x1000 : 0;\n const O = op << 6;\n const D = (assign ?? 0) << 3;\n const J = jmp ?? 0;\n return C + A + O + D + J;\n}\n","const Hex = [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n];\n\nexport function chars(i: number): string {\n return Hex[i] ?? \"X\";\n}\n\nexport function bits(i: number): string {\n switch (i) {\n case 0x0:\n return \"0000\";\n case 0x1:\n return \"0001\";\n case 0x2:\n return \"0010\";\n case 0x3:\n return \"0011\";\n case 0x4:\n return \"0100\";\n case 0x5:\n return \"0101\";\n case 0x6:\n return \"0110\";\n case 0x7:\n return \"0111\";\n case 0x8:\n return \"1000\";\n case 0x9:\n return \"1001\";\n case 0xa:\n return \"1010\";\n case 0xb:\n return \"1011\";\n case 0xc:\n return \"1100\";\n case 0xd:\n return \"1101\";\n case 0xe:\n return \"1110\";\n case 0xf:\n return \"1111\";\n default:\n return \"erro\";\n }\n}\n\nexport function int(n: string, radix: number): number {\n const i = parseInt(n.replace(/[^\\d+-.xa-fA-F]/g, \"\"), radix);\n return i & 0xffff;\n}\n\nexport function int16(i: string): number {\n return int(i, 16);\n}\n\nexport function int10(i: string): number {\n return int(i, 10);\n}\n\nexport function int2(i: string): number {\n return int(i, 2);\n}\n\nexport function hex(i: number): string {\n const hu = chars((i & 0xf000) >> 12);\n const hl = chars((i & 0x0f00) >> 8);\n const lu = chars((i & 0x00f0) >> 4);\n const ll = chars(i & 0x000f);\n\n return `0x${hu}${hl}${lu}${ll}`;\n}\n\nexport function bin(i: number, precision = 16): string {\n const hu = bits((i & 0xf000) >> 12);\n const hl = bits((i & 0x0f00) >> 8);\n const lu = bits((i & 0x00f0) >> 4);\n const ll = bits(i & 0x000f);\n\n // return `${hu} ${hl} ${lu} ${ll}`;\n return `${hu}${hl}${lu}${ll}`.substring(16 - precision); // Match the book's formatting\n}\n\nexport function dec(i: number): string {\n i = i & 0xffff;\n if (i === 0x8000) {\n return \"-32768\";\n }\n if (i & 0x8000) {\n i = (~i + 1) & 0x7fff;\n return `-${i}`;\n }\n return `${i}`;\n}\n\nexport function uns(i: number): string {\n i = i & 0xffff;\n return `${i}`;\n}\n\nexport function nand16(a: number, b: number): number {\n a = a & 0xffff;\n b = b & 0xffff;\n let c = ~(a & b);\n c = c & 0xffff;\n return c;\n}\n"],"names":["Util","useState","value","setValue","asmValue","setAsmValue","binValue","useCallback","bin","decValue","dec","unsValue","uns","hexValue","hex","setBin","target","ivalue","int2","asm","setInt","int10","setUns","setHex","int16","setAsm","op","className","type","onChange","_wrapRegExp","re","groups","BabelRegExp","_super","RegExp","prototype","_groups","WeakMap","flags","_this","set","get","buildGroups","result","g","Object","keys","reduce","name","i","k","length","create","exec","str","call","this","indices","Symbol","replace","substitution","_","group","Array","isArray","join","args","arguments","slice","push","apply","COMMANDS","D","A","M","ASSIGN","MD","AM","AD","AMD","JUMP","JGT","JEQ","JGE","JLT","JNE","JLE","JMP","Flags","Positive","Zero","Negative","alu","d","a","o","mop","cop","sop","jop","undefined","command","store","jump","instruction","cInstruction","toString","aInstruction","parseInt","substring","aop","parts","match","assign","operation","mode","includes","makeC","isM","jmp","C","O","J","Hex","chars","bits","int","n","radix","hu","hl","lu","ll","precision","nand16","b","c"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/512.9c0d1032.chunk.js b/build/static/js/512.9c0d1032.chunk.js new file mode 100644 index 000000000..10dd3757e --- /dev/null +++ b/build/static/js/512.9c0d1032.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[512],{512:function(e,t,n){n.r(t),n.d(t,{getCLS:function(){return y},getFCP:function(){return g},getFID:function(){return C},getLCP:function(){return P},getTTFB:function(){return D}});var i,r,a,o,u=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if("first-input"===e&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},f=function(e,t){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},s=function(e){addEventListener("pageshow",(function(t){t.persisted&&e(t)}),!0)},m=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},v=-1,d=function(){return"hidden"===document.visibilityState?0:1/0},p=function(){f((function(e){var t=e.timeStamp;v=t}),!0)},l=function(){return v<0&&(v=d(),p(),s((function(){setTimeout((function(){v=d(),p()}),0)}))),{get firstHiddenTime(){return v}}},g=function(e,t){var n,i=l(),r=u("FCP"),a=function(e){"first-contentful-paint"===e.name&&(f&&f.disconnect(),e.startTime-1&&e(t)},r=u("CLS",0),a=0,o=[],v=function(e){if(!e.hadRecentInput){var t=o[0],i=o[o.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(a+=e.value,o.push(e)):(a=e.value,o=[e]),a>r.value&&(r.value=a,r.entries=o,n())}},d=c("layout-shift",v);d&&(n=m(i,r,t),f((function(){d.takeRecords().map(v),n(!0)})),s((function(){a=0,T=-1,r=u("CLS",0),n=m(i,r,t)})))},E={passive:!0,capture:!0},w=new Date,L=function(e,t){i||(i=t,r=e,a=new Date,F(removeEventListener),S())},S=function(){if(r>=0&&r1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){L(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,E),removeEventListener("pointercancel",i,E)};addEventListener("pointerup",n,E),addEventListener("pointercancel",i,E)}(t,e):L(t,e)}},F=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,b,E)}))},C=function(e,t){var n,a=l(),v=u("FID"),d=function(e){e.startTimeperformance.now())return;n.entries=[t],e(n)}catch(e){}},"complete"===document.readyState?setTimeout(t,0):addEventListener("load",(function(){return setTimeout(t,0)}))}}}]); +//# sourceMappingURL=512.9c0d1032.chunk.js.map \ No newline at end of file diff --git a/build/static/js/512.9c0d1032.chunk.js.map b/build/static/js/512.9c0d1032.chunk.js.map new file mode 100644 index 000000000..d201c4d49 --- /dev/null +++ b/build/static/js/512.9c0d1032.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/512.9c0d1032.chunk.js","mappings":"qRAAA,IAAIA,EAAEC,EAAEC,EAAEC,EAAEC,EAAE,SAASJ,EAAEC,GAAG,MAAM,CAACI,KAAKL,EAAEM,WAAM,IAASL,GAAG,EAAEA,EAAEM,MAAM,EAAEC,QAAQ,GAAGC,GAAG,MAAMC,OAAOC,KAAKC,MAAM,KAAKF,OAAOG,KAAKC,MAAM,cAAcD,KAAKE,UAAU,MAAM,EAAEC,EAAE,SAAShB,EAAEC,GAAG,IAAI,GAAGgB,oBAAoBC,oBAAoBC,SAASnB,GAAG,CAAC,GAAG,gBAAgBA,KAAK,2BAA2BoB,MAAM,OAAO,IAAIlB,EAAE,IAAIe,qBAAqB,SAASjB,GAAG,OAAOA,EAAEqB,aAAaC,IAAIrB,EAAE,IAAI,OAAOC,EAAEqB,QAAQ,CAACC,KAAKxB,EAAEyB,UAAS,IAAKvB,CAAC,CAAW,CAAT,MAAMF,GAAG,CAAC,EAAE0B,EAAE,SAAS1B,EAAEC,GAAG,IAAIC,EAAE,SAASA,EAAEC,GAAG,aAAaA,EAAEqB,MAAM,WAAWG,SAASC,kBAAkB5B,EAAEG,GAAGF,IAAI4B,oBAAoB,mBAAmB3B,GAAE,GAAI2B,oBAA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AAE,WAAW,IAAI,IAAIA,EAAE6C,YAAY2B,iBAAiB,cAAc,IAAI,WAAW,IAAIzE,EAAE8C,YAAY4B,OAAOzE,EAAE,CAAC6D,UAAU,aAAanB,UAAU,GAAG,IAAI,IAAIzC,KAAKF,EAAE,oBAAoBE,GAAG,WAAWA,IAAID,EAAEC,GAAGW,KAAK8D,IAAI3E,EAAEE,GAAGF,EAAE4E,gBAAgB,IAAI,OAAO3E,CAAC,CAAjL,GAAqL,GAAGC,EAAEI,MAAMJ,EAAEK,MAAMN,EAAE4E,cAAc3E,EAAEI,MAAM,GAAGJ,EAAEI,MAAMwC,YAAYlC,MAAM,OAAOV,EAAEM,QAAQ,CAACP,GAAGD,EAAEE,EAAY,CAAT,MAAMF,GAAG,CAAC,EAAE,aAAa2B,SAASmD,WAAWvC,WAAWtC,EAAE,GAAG6B,iBAAiB,QAAQ,WAAW,OAAOS,WAAWtC,EAAE,EAAE,GAAG,C","sources":["../../node_modules/web-vitals/dist/web-vitals.js"],"sourcesContent":["var e,t,n,i,r=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:\"v2-\".concat(Date.now(),\"-\").concat(Math.floor(8999999999999*Math.random())+1e12)}},a=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if(\"first-input\"===e&&!(\"PerformanceEventTiming\"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},o=function(e,t){var n=function n(i){\"pagehide\"!==i.type&&\"hidden\"!==document.visibilityState||(e(i),t&&(removeEventListener(\"visibilitychange\",n,!0),removeEventListener(\"pagehide\",n,!0)))};addEventListener(\"visibilitychange\",n,!0),addEventListener(\"pagehide\",n,!0)},u=function(e){addEventListener(\"pageshow\",(function(t){t.persisted&&e(t)}),!0)},c=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},f=-1,s=function(){return\"hidden\"===document.visibilityState?0:1/0},m=function(){o((function(e){var t=e.timeStamp;f=t}),!0)},v=function(){return f<0&&(f=s(),m(),u((function(){setTimeout((function(){f=s(),m()}),0)}))),{get firstHiddenTime(){return f}}},d=function(e,t){var n,i=v(),o=r(\"FCP\"),f=function(e){\"first-contentful-paint\"===e.name&&(m&&m.disconnect(),e.startTime-1&&e(t)},f=r(\"CLS\",0),s=0,m=[],v=function(e){if(!e.hadRecentInput){var t=m[0],i=m[m.length-1];s&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(s+=e.value,m.push(e)):(s=e.value,m=[e]),s>f.value&&(f.value=s,f.entries=m,n())}},h=a(\"layout-shift\",v);h&&(n=c(i,f,t),o((function(){h.takeRecords().map(v),n(!0)})),u((function(){s=0,l=-1,f=r(\"CLS\",0),n=c(i,f,t)})))},T={passive:!0,capture:!0},y=new Date,g=function(i,r){e||(e=r,t=i,n=new Date,w(removeEventListener),E())},E=function(){if(t>=0&&t1e12?new Date:performance.now())-e.timeStamp;\"pointerdown\"==e.type?function(e,t){var n=function(){g(e,t),r()},i=function(){r()},r=function(){removeEventListener(\"pointerup\",n,T),removeEventListener(\"pointercancel\",i,T)};addEventListener(\"pointerup\",n,T),addEventListener(\"pointercancel\",i,T)}(t,e):g(t,e)}},w=function(e){[\"mousedown\",\"keydown\",\"touchstart\",\"pointerdown\"].forEach((function(t){return e(t,S,T)}))},L=function(n,f){var s,m=v(),d=r(\"FID\"),p=function(e){e.startTimeperformance.now())return;n.entries=[t],e(n)}catch(e){}},\"complete\"===document.readyState?setTimeout(t,0):addEventListener(\"load\",(function(){return setTimeout(t,0)}))};export{h as getCLS,d as getFCP,L as getFID,F as getLCP,P as getTTFB};\n"],"names":["e","t","n","i","r","name","value","delta","entries","id","concat","Date","now","Math","floor","random","a","PerformanceObserver","supportedEntryTypes","includes","self","getEntries","map","observe","type","buffered","o","document","visibilityState","removeEventListener","addEventListener","u","persisted","c","f","s","m","timeStamp","v","setTimeout","firstHiddenTime","d","disconnect","startTime","push","window","performance","getEntriesByName","requestAnimationFrame","p","l","h","hadRecentInput","length","takeRecords","T","passive","capture","y","g","w","E","entryType","target","cancelable","processingStart","forEach","S","L","b","F","once","P","getEntriesByType","timing","max","navigationStart","responseStart","readyState"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/568.4e6a571b.chunk.js b/build/static/js/568.4e6a571b.chunk.js new file mode 100644 index 000000000..51e182fe4 --- /dev/null +++ b/build/static/js/568.4e6a571b.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[568],{1568:function(e,t,n){n.r(t),n.d(t,{default:function(){return o}});var i=n(6776),s=n(768),p=n(3102),a=n(7878),l=function(e){return e=e.replace("%25PUBLIC_URL%25","/web-ide"),(0,i.A)(e)},h=function(e){var t=e.children;return(0,a.jsx)(s.D,{remarkPlugins:[p.Z],transformImageUri:l,children:t})},o=function(){return(0,a.jsx)("div",{className:"container",style:{maxWidth:"900px",margin:"0 auto",overflow:"none"},children:(0,a.jsx)(h,{children:'# NAND2Tetris Web User Guide\n\nThis web application implements the [NAND2Tetris](https://nand2tetris.org) software suite, including an hdl chip simulator, a hack CPU, and a Hack VM.\nStudents are able to paste their implementations of the various chips and programs\n\n## Chip Simulator\n\n![Empty Chip](%PUBLIC_URL%/user_guide/01_chip_empty.png){:height="256px" width="512px"}\n\nThe chip page has five panels, as well as a project selction bar.\nIn the top left, users can input the text of their HDL chip.\nThe top center panel displays the chip\'s input pins, and the bottom center the output pins.\nThe bottom left panel has any internal pins in the chip.\nThe right panel includes the test program, the expected comparison output, and after executing the test, the test output and a diff of failed lines.\n\n---\n\n![Simple Not Chip](%PUBLIC_URL%/user_guide/02_chip_simple_nand.png)\n\nThe project selection bar loads the chip HDL outlines, tests, and cmp files from the book.\nAfter choosing the "Not" chip, the input and output pins update.\nAfter implementing the chip and clicking "Compile", clicking the input pin buttons will toggle their voltage states.\nThe output pins will update with the simulated state from the hdl spec.\n\n---\n\n![Complex Chip](%PUBLIC_URL%/user_guide/03_chip_complex.png)\n\nLoading a chip with a 16-bit bus changes the pin panels to show a binary representation of the chip.\n\n---\n\n![Implemented Complex Chip](%PUBLIC_URL%/user_guide/04_chip_complex_implemented.png)\n\nClicking an input bus will increment that bus by one.\n\n---\n\n![Complex Chip Pins](%PUBLIC_URL%/user_guide/05_chip_complex_failed_test.png)\n\nClicking "Execute" will run the test against the chip implementation.\nAny failing tests will be put in the bottom of the panel, with a diff between the expected and actual output.\nYou may need to scroll to see all failed lines.\n\n---\n\n![Passed Chip Test](%PUBLIC_URL%/user_guide/06_chip_complex_passed_test.png)\n\nAll tests pass!\n\n---\n\n![Settings](%PUBLIC_URL%/user_guide/07_settings.png)\n\nClicking `Save` in the HDL panel will store the HDL chip to user\'s local storage.\nIn settings, clicking `Files: Reset` will restore the files to the book\' projects.\n'})})}}}]); +//# sourceMappingURL=568.4e6a571b.chunk.js.map \ No newline at end of file diff --git a/build/static/js/568.4e6a571b.chunk.js.map b/build/static/js/568.4e6a571b.chunk.js.map new file mode 100644 index 000000000..d25f558b6 --- /dev/null +++ b/build/static/js/568.4e6a571b.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/568.4e6a571b.chunk.js","mappings":"iNAGMA,EAAe,SAACC,GAEpB,OADAA,EAAOA,EAAKC,QAAQ,mBAAoBC,aACjCC,EAAAA,EAAAA,GAAeH,EACxB,EAQA,EANiB,SAAH,OAAMI,EAAQ,EAARA,SAAQ,OAC1B,SAAC,IAAa,CAACC,cAAe,CAACC,EAAAA,GAAYC,kBAAmBR,EAAa,SACxEK,GACa,ECClB,EATkB,WAAH,OACb,gBACEI,UAAU,YACVC,MAAO,CAAEC,SAAU,QAASC,OAAQ,SAAUC,SAAU,QAAS,UAEjE,SAAC,EAAQ,ssEACL,C","sources":["shell/markdown.tsx","pages/user_guide.tsx"],"sourcesContent":["import ReactMarkdown, { uriTransformer } from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\n\nconst publicImages = (href: string) => {\n href = href.replace(\"%25PUBLIC_URL%25\", process.env.PUBLIC_URL);\n return uriTransformer(href);\n};\n\nconst Markdown = ({ children }: { children: string }) => (\n \n {children}\n \n);\n\nexport default Markdown;\n","import raw from \"raw.macro\";\nimport Markdown from \"../shell/markdown\";\n\nconst UserGuide = () => (\n \n {raw(\"./USER_GUIDE.md\")}\n \n);\n\nexport default UserGuide;\n"],"names":["publicImages","href","replace","process","uriTransformer","children","remarkPlugins","remarkGfm","transformImageUri","className","style","maxWidth","margin","overflow"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/600.6e4176cb.chunk.js b/build/static/js/600.6e4176cb.chunk.js new file mode 100644 index 000000000..02afe1707 --- /dev/null +++ b/build/static/js/600.6e4176cb.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[600],{5640:function(u,t,e){e.d(t,{Z:function(){return be}});var r=e(1026),n=e(649),i=e(7591),o=e(4337),a=e(2951),s=e(1976),c={exports:{}};function l(u,t,e){if(!function(u){return"description"===u||"string"===u||"code"===u}(e))throw new Error("invalid Failure type: "+e);this.pexpr=u,this.text=t,this.type=e,this.fluffy=!1}l.prototype.getPExpr=function(){return this.pexpr},l.prototype.getText=function(){return this.text},l.prototype.getType=function(){return this.type},l.prototype.isDescription=function(){return"description"===this.type},l.prototype.isStringTerminal=function(){return"string"===this.type},l.prototype.isCode=function(){return"code"===this.type},l.prototype.isFluffy=function(){return this.fluffy},l.prototype.makeFluffy=function(){this.fluffy=!0},l.prototype.clearFluffy=function(){this.fluffy=!1},l.prototype.subsumes=function(u){return this.getText()===u.getText()&&this.type===u.type&&(!this.isFluffy()||this.isFluffy()&&u.isFluffy())},l.prototype.toString=function(){return"string"===this.type?JSON.stringify(this.getText()):this.getText()},l.prototype.clone=function(){var u=new l(this.pexpr,this.text,this.type);return this.isFluffy()&&u.makeFluffy(),u},l.prototype.toKey=function(){return this.toString()+"#"+this.type};var p=l,D={};!function(u){for(var t={},e=0;e<128;e++)t[e]=String.fromCharCode(e);t["'".charCodeAt(0)]="\\'",t['"'.charCodeAt(0)]='\\"',t["\\".charCodeAt(0)]="\\\\",t["\b".charCodeAt(0)]="\\b",t["\f".charCodeAt(0)]="\\f",t["\n".charCodeAt(0)]="\\n",t["\r".charCodeAt(0)]="\\r",t["\t".charCodeAt(0)]="\\t",t["\v".charCodeAt(0)]="\\v",u.abstract=function(u){var t=u||"";return function(){throw new Error("this method "+t+" is abstract! (it has no implementation in class "+this.constructor.name+")")}},u.assert=function(u,t){if(!u)throw new Error(t||"Assertion failed")},u.defineLazyProperty=function(u,t,e){var r;Object.defineProperty(u,t,{get:function(){return r||(r=e.call(this)),r}})},u.clone=function(u){return u?Object.assign({},u):u},u.repeatFn=function(u,t){for(var e=[];t-- >0;)e.push(u());return e},u.repeatStr=function(u,t){return new Array(t+1).join(u)},u.repeat=function(t,e){return u.repeatFn((function(){return t}),e)},u.getDuplicates=function(u){for(var t=[],e=0;e0}},{key:"hasNoChildren",value:function(){return!this.hasChildren()}},{key:"onlyChild",value:function(){if(1!==this.numChildren())throw new Error("cannot get only child of a node of type "+this.ctorName+" (it has "+this.numChildren()+" children)");return this.firstChild()}},{key:"firstChild",value:function(){if(this.hasNoChildren())throw new Error("cannot get first child of a "+this.ctorName+" node, which has no children");return this.childAt(0)}},{key:"lastChild",value:function(){if(this.hasNoChildren())throw new Error("cannot get last child of a "+this.ctorName+" node, which has no children");return this.childAt(this.numChildren()-1)}},{key:"childBefore",value:function(u){var t=this.indexOfChild(u);if(t<0)throw new Error("Node.childBefore() called w/ an argument that is not a child");if(0===t)throw new Error("cannot get child before first child");return this.childAt(t-1)}},{key:"childAfter",value:function(u){var t=this.indexOfChild(u);if(t<0)throw new Error("Node.childAfter() called w/ an argument that is not a child");if(t===this.numChildren()-1)throw new Error("cannot get child after last child");return this.childAt(t+1)}},{key:"isTerminal",value:function(){return!1}},{key:"isNonterminal",value:function(){return!1}},{key:"isIteration",value:function(){return!1}},{key:"isOptional",value:function(){return!1}}]),u}(),f=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(){return(0,a.Z)(this,e),t.apply(this,arguments)}return(0,s.Z)(e,[{key:"ctorName",get:function(){return"_terminal"}},{key:"isTerminal",value:function(){return!0}},{key:"primitiveValue",get:function(){throw new Error("The `primitiveValue` property was removed in Ohm v17.")}}]),e}(A),m={Node:A,TerminalNode:f,NonterminalNode:function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r,n,i){var o;return(0,a.Z)(this,e),(o=t.call(this,i)).ruleName=u,o.children=r,o.childOffsets=n,o}return(0,s.Z)(e,[{key:"ctorName",get:function(){return this.ruleName}},{key:"isNonterminal",value:function(){return!0}},{key:"isLexical",value:function(){return h.isLexical(this.ctorName)}},{key:"isSyntactic",value:function(){return h.isSyntactic(this.ctorName)}}]),e}(A),IterationNode:function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r,n,i){var o;return(0,a.Z)(this,e),(o=t.call(this,n)).children=u,o.childOffsets=r,o.optional=i,o}return(0,s.Z)(e,[{key:"ctorName",get:function(){return"_iter"}},{key:"isIteration",value:function(){return!0}},{key:"isOptional",value:function(){return this.optional}}]),e}(A)},E={},C={Lu:/[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A]|\uD801[\uDC00-\uDC27\uDCB0-\uDCD3]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21]/,Ll:/[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]|\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD83A[\uDD22-\uDD43]/,Lt:/[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/,Lm:/[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C\uA69D\uA717-\uA71F\uA770\uA788\uA7F8\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E\uFF9F]|\uD81A[\uDF40-\uDF43]|\uD81B[\uDF93-\uDF9F\uDFE0]/,Lo:/[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC50-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,Nl:/[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]|\uD800[\uDD40-\uDD74\uDF41\uDF4A\uDFD1-\uDFD5]|\uD809[\uDC00-\uDC6E]/,Nd:/[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD801[\uDCA0-\uDCA9]|\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDEF0-\uDEF9]|[\uD805\uD807][\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF39]|\uD806[\uDCE0-\uDCE9]|\uD81A[\uDE60-\uDE69\uDF50-\uDF59]|\uD835[\uDFCE-\uDFFF]|\uD83A[\uDD50-\uDD59]/,Mn:/[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D01\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1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\u0F7F]/,Pc:/[_\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F]/,Zs:/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,L:/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF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u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]|[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C\uA69D\uA717-\uA71F\uA770\uA788\uA7F8\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E\uFF9F]|\uD81A[\uDF40-\uDF43]|\uD81B[\uDF93-\uDF9F\uDFE0]|[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC50-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/},F=D,d=function(){function u(){if((0,a.Z)(this,u),this.constructor===u)throw new Error("PExpr cannot be instantiated -- it's abstract")}return(0,s.Z)(u,[{key:"withSource",value:function(u){return u&&(this.source=u.trimmed()),this}}]),u}(),v=Object.create(d.prototype),y=Object.create(d.prototype),g=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).obj=u,r}return(0,s.Z)(e)}(d),B=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r){var n;return(0,a.Z)(this,e),(n=t.call(this)).from=u,n.to=r,n.matchCodePoint=u.length>1||r.length>1,n}return(0,s.Z)(e)}(d),I=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).index=u,r}return(0,s.Z)(e)}(d),x=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).terms=u,r}return(0,s.Z)(e)}(d),b=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r,n){var i;(0,a.Z)(this,e);var o=u.rules[r].body;return(i=t.call(this,[n,o])).superGrammar=u,i.name=r,i.body=n,i}return(0,s.Z)(e)}(x),S=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r,i,o){var s;(0,a.Z)(this,e);var c=u.rules[r].body;return(s=t.call(this,[].concat((0,n.Z)(i),[c],(0,n.Z)(o)))).superGrammar=u,s.ruleName=r,s.expansionPos=i.length,s}return(0,s.Z)(e)}(x),w=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).factors=u,r}return(0,s.Z)(e)}(d),_=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).expr=u,r}return(0,s.Z)(e)}(d),O=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(){return(0,a.Z)(this,e),t.apply(this,arguments)}return(0,s.Z)(e)}(_),N=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(){return(0,a.Z)(this,e),t.apply(this,arguments)}return(0,s.Z)(e)}(_),R=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(){return(0,a.Z)(this,e),t.apply(this,arguments)}return(0,s.Z)(e)}(_);O.prototype.operator="*",N.prototype.operator="+",R.prototype.operator="?",O.prototype.minNumMatches=0,N.prototype.minNumMatches=1,R.prototype.minNumMatches=0,O.prototype.maxNumMatches=Number.POSITIVE_INFINITY,N.prototype.maxNumMatches=Number.POSITIVE_INFINITY,R.prototype.maxNumMatches=1;var L=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).expr=u,r}return(0,s.Z)(e)}(d),P=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).expr=u,r}return(0,s.Z)(e)}(d),k=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).expr=u,r}return(0,s.Z)(e)}(d),T=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(0,a.Z)(this,e),(r=t.call(this)).ruleName=u,r.args=n,r}return(0,s.Z)(e,[{key:"isSyntactic",value:function(){return F.isSyntactic(this.ruleName)}},{key:"toMemoKey",value:function(){return this._memoKey||Object.defineProperty(this,"_memoKey",{value:this.toString()}),this._memoKey}}]),e}(d),j=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).category=u,r.pattern=C[u],r}return(0,s.Z)(e)}(d);E.PExpr=d,E.any=v,E.end=y,E.Terminal=g,E.Range=B,E.Param=I,E.Alt=x,E.Extend=b,E.Splice=S,E.Seq=w,E.Iter=_,E.Star=O,E.Plus=N,E.Opt=R,E.Not=L,E.Lookahead=P,E.Lex=k,E.Apply=T,E.UnicodeChar=j;var Z=D,q=E;function M(){}q.PExpr.prototype.allowsSkippingPrecedingSpace=Z.abstract("allowsSkippingPrecedingSpace"),q.any.allowsSkippingPrecedingSpace=q.end.allowsSkippingPrecedingSpace=q.Apply.prototype.allowsSkippingPrecedingSpace=q.Terminal.prototype.allowsSkippingPrecedingSpace=q.Range.prototype.allowsSkippingPrecedingSpace=q.UnicodeChar.prototype.allowsSkippingPrecedingSpace=function(){return!0},q.Alt.prototype.allowsSkippingPrecedingSpace=q.Iter.prototype.allowsSkippingPrecedingSpace=q.Lex.prototype.allowsSkippingPrecedingSpace=q.Lookahead.prototype.allowsSkippingPrecedingSpace=q.Not.prototype.allowsSkippingPrecedingSpace=q.Param.prototype.allowsSkippingPrecedingSpace=q.Seq.prototype.allowsSkippingPrecedingSpace=function(){return!1},M.prototype=Object.create(null),M.asNamespace=function(u){return u instanceof M?u:M.createNamespace(u)},M.createNamespace=function(u){return M.extend(M.prototype,u)},M.extend=function(u,t){if(u!==M.prototype&&!(u instanceof M))throw new TypeError("not a Namespace object: "+u);var e=Object.create(u,{constructor:{value:M,enumerable:!1,writable:!0,configurable:!0}});return Object.assign(e,t)},M.toString=function(u){return Object.prototype.toString.call(u)};var G=M,U=D.assert,z=G,H=E;function K(u,t){var e;return t?((e=new Error(t.getLineAndColumnMessage()+u)).shortMessage=u,e.interval=t):e=new Error(u),e}var V={applicationOfSyntacticRuleFromLexicalContext:function(u,t){return K("Cannot apply syntactic rule "+u+" from here (inside a lexical context)",t.source)},applySyntacticWithLexicalRuleApplication:function(u){var t=u.ruleName;return K("applySyntactic is for syntactic rules, but '".concat(t,"' is a lexical rule. ")+"NOTE: A _syntactic rule_ is a rule whose name begins with a capital letter. See https://ohmjs.org/d/svl for more details.",u.source)},cannotExtendUndeclaredRule:function(u,t,e){return K("Cannot extend rule "+u+" because it is not declared in "+t,e)},cannotOverrideUndeclaredRule:function(u,t,e){return K("Cannot override rule "+u+" because it is not declared in "+t,e)},duplicateGrammarDeclaration:function(u,t){return K("Grammar "+u.name+" is already declared in this namespace")},duplicateParameterNames:function(u,t,e){return K("Duplicate parameter names in rule "+u+": "+t.join(", "),e)},duplicatePropertyNames:function(u){return K("Object pattern has duplicate property names: "+u.join(", "))},duplicateRuleDeclaration:function(u,t,e,r){var n="Duplicate declaration for rule '"+u+"' in grammar '"+t+"'";return t!==e&&(n+=" (originally declared in '"+e+"')"),K(n,r)},inconsistentArity:function(u,t,e,r){return K("Rule "+u+" involves an alternation which has inconsistent arity (expected "+t+", got "+e+")",r.source)},incorrectArgumentType:function(u,t){return K("Incorrect argument type: expected "+u,t.source)},intervalSourcesDontMatch:function(){return K("Interval sources don't match")},invalidCodePoint:function(u){var t,e=u._node;U(e&&e.isNonterminal()&&"escapeChar_unicodeCodePoint"===e.ctorName);var r=u.children.slice(1,-1).map((function(u){return u.source})),i=(t=r[0]).coverageWith.apply(t,(0,n.Z)(r.slice(1)));return K("U+".concat(i.contents," is not a valid Unicode code point"),i)},invalidConstructorCall:function(u,t,e){return K("Attempt to invoke constructor "+t+" with invalid or unexpected arguments")},invalidParameter:function(u,t){return K("Invalid parameter to rule "+u+": "+t+" has arity "+t.getArity()+", but parameter expressions must have arity 1",t.source)},grammarSyntaxError:function(u){var t=new Error;return Object.defineProperty(t,"message",{enumerable:!0,get:function(){return u.message}}),Object.defineProperty(t,"shortMessage",{enumerable:!0,get:function(){return"Expected "+u.getExpectedText()}}),t.interval=u.getInterval(),t},kleeneExprHasNullableOperand:function(u,t){var e=t.length>0?t[t.length-1].args:[],r="Nullable expression "+u.expr.substituteParams(e)+" is not allowed inside '"+u.operator+"' (possible infinite loop)";return t.length>0&&(r+="\nApplication stack (most recent application last):\n"+t.map((function(u){return new H.Apply(u.ruleName,u.args)})).join("\n")),K(r,u.expr.source)},missingSemanticAction:function(u,t,e,r){var n=r.slice(0,-1).map((function(u){var t=" "+u[0].name+" > "+u[1];return 3===u.length?t+" for '"+u[2]+"'":t})).join("\n");n+="\n "+t+" > "+u;var i="";"_iter"===u&&(i=["\nNOTE: as of Ohm v16, there is no default action for iteration nodes \u2014 see "," https://ohmjs.org/d/dsa for details."].join("\n"));var o=K(["Missing semantic action for '".concat(u,"' in ").concat(e," '").concat(t,"'.").concat(i),"Action stack (most recent call last):",n].join("\n"));return o.name="missingSemanticAction",o},multipleSuperSplices:function(u){return K("'...' can appear at most once in a rule body",u.source)},undeclaredGrammar:function(u,t,e){return K(t?"Grammar "+u+" is not declared in namespace "+z.toString(t):"Undeclared grammar "+u,e)},undeclaredRule:function(u,t,e){return K("Rule "+u+" is not declared in grammar "+t,e)},unnecessaryExperimentalApplySyntactic:function(u){return K("applySyntactic is not required here (in a syntactic context)",u.source)},wrongNumberOfArguments:function(u,t,e,r){return K("Wrong number of arguments for rule "+u+" (expected "+t+", got "+e+")",r)},wrongNumberOfParameters:function(u,t,e,r){return K("Wrong number of parameters for rule "+u+" (expected "+t+", got "+e+")",r)},throwErrors:function(u){if(1===u.length)throw u[0];if(u.length>1)throw function(u){var t=u.map((function(u){return u.message}));return K(["Errors:"].concat(t).join("\n- "),u[0].interval)}(u)}},W={};!function(u){var t=D;function e(u){var e=0;return u.map((function(u){var t=u.toString();return e=Math.max(e,t.length),t})).map((function(u){return t.padLeft(u,e)}))}function r(u,t,e){var r=u.length;return(u.slice(0,e)+t+u.slice(e+t.length)).substr(0,r)}function n(){var u=this,n=u.offset,i=t.repeatStr,o=new t.StringBuffer;o.append("Line "+u.lineNum+", col "+u.colNum+":\n");var a=e([null==u.prevLine?0:u.lineNum-1,u.lineNum,null==u.nextLine?0:u.lineNum+1]),s=function(u,t,e){o.append(e+a[u]+" | "+t+"\n")};null!=u.prevLine&&s(0,u.prevLine," "),s(1,u.line,"> ");for(var c=u.line.length,l=i(" ",c+1),p=arguments.length,D=new Array(p),h=0;h=0&&f<=m,"range start must be >= 0 and <= end");var E=n-u.colNum+1;f=Math.max(0,f-E),l=r(l,i("~",(m=Math.min(m-E,c))-f),f)}var C=2+a[1].length+3;return o.append(i(" ",C)),l=r(l,"^",u.colNum-1),o.append(l.replace(/ +$/,"")+"\n"),null!=u.nextLine&&s(2,u.nextLine," "),o.contents()}var i=[];u.awaitBuiltInRules=function(u){i.push(u)},u.announceBuiltInRules=function(u){i.forEach((function(t){t(u)})),i=null},u.getLineAndColumn=function(u,t){for(var e=1,r=1,i=0,o=0,a=null,s=null,c=-1;i=0&&(s=u.slice(c,o).replace(/\r?\n$/,"")),{offset:t,lineNum:e,colNum:r,line:u.slice(o,p).replace(/\r$/,""),prevLine:s,nextLine:a,toString:n}},u.getLineAndColumnMessage=function(t,e){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]&&arguments[2],n=t.rules[this.ruleName],i=X(u)&&0===J;if(!n)throw Y.undeclaredRule(this.ruleName,t.name,this.source);if(!r&&X(this.ruleName)&&!i)throw Y.applicationOfSyntacticRuleFromLexicalContext(this.ruleName,this);var o=this.args.length,a=n.formals.length;if(o!==a)throw Y.wrongNumberOfArguments(this.ruleName,a,o,this.source);var s=$&&n===$.rules.applySyntactic,c=$&&n===$.rules.caseInsensitive;if(c&&!(this.args[0]instanceof uu.Terminal))throw Y.incorrectArgumentType('a Terminal (e.g. "abc")',this.args[0]);if(s){var l=this.args[0];if(!(l instanceof uu.Apply))throw Y.incorrectArgumentType("a syntactic rule application",l);if(!X(l.ruleName))throw Y.applySyntacticWithLexicalRuleApplication(l);if(i)throw Y.unnecessaryExperimentalApplySyntactic(this)}this.args.forEach((function(r){if(r._assertAllApplicationsAreValid(u,t,s),1!==r.getArity())throw Y.invalidParameter(e.ruleName,r)}))};var tu=D,eu=V,ru=E;ru.PExpr.prototype.assertChoicesHaveUniformArity=tu.abstract("assertChoicesHaveUniformArity"),ru.any.assertChoicesHaveUniformArity=ru.end.assertChoicesHaveUniformArity=ru.Terminal.prototype.assertChoicesHaveUniformArity=ru.Range.prototype.assertChoicesHaveUniformArity=ru.Param.prototype.assertChoicesHaveUniformArity=ru.Lex.prototype.assertChoicesHaveUniformArity=ru.UnicodeChar.prototype.assertChoicesHaveUniformArity=function(u){},ru.Alt.prototype.assertChoicesHaveUniformArity=function(u){if(0!==this.terms.length)for(var t=this.terms[0].getArity(),e=0;e1?r-1:0),i=1;i=u.startIdx&&this.endIdx<=u.endIdx,"other interval does not cover this one"),new lu(this.sourceString,this.startIdx-u.startIdx,this.endIdx-u.startIdx)},trimmed:function(){var u=this.contents,t=this.startIdx+u.match(/^\s*/)[0].length,e=this.endIdx-u.match(/\s*$/)[0].length;return new lu(this.sourceString,t,e)},subInterval:function(u,t){var e=this.startIdx+u;return new lu(this.sourceString,e,e+t)}},Object.defineProperties(lu.prototype,{contents:{get:function(){return void 0===this._contents&&(this._contents=this.sourceString.slice(this.startIdx,this.endIdx)),this._contents},enumerable:!0},length:{get:function(){return this.endIdx-this.startIdx},enumerable:!0}});var pu=lu,Du=pu,hu=D,Au={succeeded:1,isRootNode:2,isImplicitSpaces:4,isMemoized:8,isHeadOfLeftRecursion:16,terminatesLR:32};function fu(u){return"string"===typeof u?u.replace(/ /g,"\u22c5").replace(/\t/g,"\u2409").replace(/\n/g,"\u240a").replace(/\r/g,"\u240d"):String(u)}function mu(u,t,e,r,n,i,o){this.input=u,this.pos=this.pos1=t,this.pos2=e,this.source=new Du(u,t,e),this.expr=r,this.bindings=i,this.children=o||[],this.terminatingLREntry=null,this._flags=n?Au.succeeded:0}mu.prototype.SKIP={},Object.defineProperty(mu.prototype,"displayString",{get:function(){return this.expr.toDisplayString()}}),Object.keys(Au).forEach((function(u){var t=Au[u];Object.defineProperty(mu.prototype,u,{get:function(){return 0!==(this._flags&t)},set:function(u){u?this._flags|=t:this._flags&=~t}})})),mu.prototype.clone=function(){return this.cloneWithExpr(this.expr)},mu.prototype.cloneWithExpr=function(u){var t=new mu(this.input,this.pos,this.pos2,u,this.succeeded,this.bindings,this.children);return t.isHeadOfLeftRecursion=this.isHeadOfLeftRecursion,t.isImplicitSpaces=this.isImplicitSpaces,t.isMemoized=this.isMemoized,t.isRootNode=this.isRootNode,t.terminatesLR=this.terminatesLR,t.terminatingLREntry=this.terminatingLREntry,t},mu.prototype.recordLRTermination=function(u,t){this.terminatingLREntry=new mu(this.input,this.pos,this.pos2,this.expr,!1,[t],[u]),this.terminatingLREntry.terminatesLR=!0},mu.prototype.walk=function(u,t){var e=u;function r(u,n,i){var o=!0;e.enter&&e.enter.call(t,u,n,i)===mu.prototype.SKIP&&(o=!1),o&&(u.children.forEach((function(t){r(t,u,i+1)})),e.exit&&e.exit.call(t,u,n,i))}"function"===typeof e&&(e={enter:e}),this.isRootNode?this.children.forEach((function(u){r(u,null,0)})):r(this,null,0)},mu.prototype.toString=function(){var u=this,t=new hu.StringBuffer;return this.walk((function(e,r,n){if(!e)return u.SKIP;if("Alt"!==e.expr.constructor.name){var i;if(t.append(function(u,t,e){var r=fu(u.slice(t,t+e));return r.length0){var h=n[r-1],A=i[r-1];D=A[A.length-1]+h[h.length-1].matchLength-(p=i[0][0])}var f=this instanceof vu.Opt;for(o=0;o=0){if(this.args.length>0)throw new Error("Parameterized rules cannot be passed as arguments to another rule.");return new Ou.Param(t).withSource(this.source)}return this.args.forEach((function(t,e,r){r[e]=t.introduceParams(u)})),this};var Nu=D,Ru=E;Ru.PExpr.prototype.isNullable=function(u){return this._isNullable(u,Object.create(null))},Ru.PExpr.prototype._isNullable=Nu.abstract("_isNullable"),Ru.any._isNullable=Ru.Range.prototype._isNullable=Ru.Param.prototype._isNullable=Ru.Plus.prototype._isNullable=Ru.UnicodeChar.prototype._isNullable=function(u,t){return!1},Ru.end._isNullable=function(u,t){return!0},Ru.Terminal.prototype._isNullable=function(u,t){return"string"===typeof this.obj&&""===this.obj},Ru.Alt.prototype._isNullable=function(u,t){return 0===this.terms.length||this.terms.some((function(e){return e._isNullable(u,t)}))},Ru.Seq.prototype._isNullable=function(u,t){return this.factors.every((function(e){return e._isNullable(u,t)}))},Ru.Star.prototype._isNullable=Ru.Opt.prototype._isNullable=Ru.Not.prototype._isNullable=Ru.Lookahead.prototype._isNullable=function(u,t){return!0},Ru.Lex.prototype._isNullable=function(u,t){return this.expr._isNullable(u,t)},Ru.Apply.prototype._isNullable=function(u,t){var e=this.toMemoKey();if(!Object.prototype.hasOwnProperty.call(t,e)){var r=u.rules[this.ruleName].body.substituteParams(this.args);t[e]=!1,t[e]=r._isNullable(u,t)}return t[e]};var Lu=D,Pu=E;Pu.PExpr.prototype.substituteParams=Lu.abstract("substituteParams"),Pu.any.substituteParams=Pu.end.substituteParams=Pu.Terminal.prototype.substituteParams=Pu.Range.prototype.substituteParams=Pu.UnicodeChar.prototype.substituteParams=function(u){return this},Pu.Param.prototype.substituteParams=function(u){return u[this.index]},Pu.Alt.prototype.substituteParams=function(u){return new Pu.Alt(this.terms.map((function(t){return t.substituteParams(u)})))},Pu.Seq.prototype.substituteParams=function(u){return new Pu.Seq(this.factors.map((function(t){return t.substituteParams(u)})))},Pu.Iter.prototype.substituteParams=Pu.Not.prototype.substituteParams=Pu.Lookahead.prototype.substituteParams=Pu.Lex.prototype.substituteParams=function(u){return new this.constructor(this.expr.substituteParams(u))},Pu.Apply.prototype.substituteParams=function(u){if(0===this.args.length)return this;var t=this.args.map((function(t){return t.substituteParams(u)}));return new Pu.Apply(this.ruleName,t)};var ku=D,Tu=E,ju=ku.copyWithoutDuplicates;function Zu(u){return/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(u)}function qu(u){var t=Object.create(null);u.forEach((function(u){t[u]=(t[u]||0)+1})),Object.keys(t).forEach((function(e){if(!(t[e]<=1)){var r=1;u.forEach((function(t,n){t===e&&(u[n]=t+"_"+r++)}))}}))}Tu.PExpr.prototype.toArgumentNameList=ku.abstract("toArgumentNameList"),Tu.any.toArgumentNameList=function(u,t){return["any"]},Tu.end.toArgumentNameList=function(u,t){return["end"]},Tu.Terminal.prototype.toArgumentNameList=function(u,t){return"string"===typeof this.obj&&/^[_a-zA-Z0-9]+$/.test(this.obj)?["_"+this.obj]:["$"+u]},Tu.Range.prototype.toArgumentNameList=function(u,t){var e=this.from+"_to_"+this.to;return Zu(e)||(e="_"+e),Zu(e)||(e="$"+u),[e]},Tu.Alt.prototype.toArgumentNameList=function(u,t){for(var e=this.terms.map((function(t){return t.toArgumentNameList(u,!0)})),r=[],n=e[0].length,i=0;i0){var u=this.args.map((function(u){return u.toDisplayString()}));return this.ruleName+"<"+u.join(",")+">"}return this.ruleName},Gu.UnicodeChar.prototype.toDisplayString=function(){return"Unicode ["+this.category+"] character"};var Uu=p,zu=D,Hu=E;Hu.PExpr.prototype.toFailure=zu.abstract("toFailure"),Hu.any.toFailure=function(u){return new Uu(this,"any object","description")},Hu.end.toFailure=function(u){return new Uu(this,"end of input","description")},Hu.Terminal.prototype.toFailure=function(u){return new Uu(this,this.obj,"string")},Hu.Range.prototype.toFailure=function(u){return new Uu(this,JSON.stringify(this.from)+".."+JSON.stringify(this.to),"code")},Hu.Not.prototype.toFailure=function(u){var t=this.expr===Hu.any?"nothing":"not "+this.expr.toFailure(u);return new Uu(this,t,"description")},Hu.Lookahead.prototype.toFailure=function(u){return this.expr.toFailure(u)},Hu.Apply.prototype.toFailure=function(u){var t=u.rules[this.ruleName].description;t||(t=(/^[aeiouAEIOU]/.test(this.ruleName)?"an":"a")+" "+this.ruleName);return new Uu(this,t,"description")},Hu.UnicodeChar.prototype.toFailure=function(u){return new Uu(this,"a Unicode ["+this.category+"] character","description")},Hu.Alt.prototype.toFailure=function(u){var t="("+this.terms.map((function(t){return t.toFailure(u)})).join(" or ")+")";return new Uu(this,t,"description")},Hu.Seq.prototype.toFailure=function(u){var t="("+this.factors.map((function(t){return t.toFailure(u)})).join(" ")+")";return new Uu(this,t,"description")},Hu.Iter.prototype.toFailure=function(u){var t="("+this.expr.toFailure(u)+this.operator+")";return new Uu(this,t,"description")};var Ku=D,Vu=E;Vu.PExpr.prototype.toString=Ku.abstract("toString"),Vu.any.toString=function(){return"any"},Vu.end.toString=function(){return"end"},Vu.Terminal.prototype.toString=function(){return JSON.stringify(this.obj)},Vu.Range.prototype.toString=function(){return JSON.stringify(this.from)+".."+JSON.stringify(this.to)},Vu.Param.prototype.toString=function(){return"$"+this.index},Vu.Lex.prototype.toString=function(){return"#("+this.expr.toString()+")"},Vu.Alt.prototype.toString=function(){return 1===this.terms.length?this.terms[0].toString():"("+this.terms.map((function(u){return u.toString()})).join(" | ")+")"},Vu.Seq.prototype.toString=function(){return 1===this.factors.length?this.factors[0].toString():"("+this.factors.map((function(u){return u.toString()})).join(" ")+")"},Vu.Iter.prototype.toString=function(){return this.expr+this.operator},Vu.Not.prototype.toString=function(){return"~"+this.expr},Vu.Lookahead.prototype.toString=function(){return"&"+this.expr},Vu.Apply.prototype.toString=function(){if(this.args.length>0){var u=this.args.map((function(u){return u.toString()}));return this.ruleName+"<"+u.join(",")+">"}return this.ruleName},Vu.UnicodeChar.prototype.toString=function(){return"\\p{"+this.category+"}"};var Wu=E,$u=p,Ju=m.TerminalNode,Qu=D.assert,Xu=Wu.PExpr,Yu=Wu.Terminal,ut=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).obj=u,r}return(0,s.Z)(e,[{key:"_getString",value:function(u){var t=u.currentApplication().args[this.obj.index];return Qu(t instanceof Yu,"expected a Terminal expression"),t.obj}},{key:"allowsSkippingPrecedingSpace",value:function(){return!0}},{key:"eval",value:function(u){var t=u.inputStream,e=t.pos,r=this._getString(u);return t.matchString(r,!0)?(u.pushBinding(new Ju(r.length),e),!0):(u.processFailure(e,this),!1)}},{key:"getArity",value:function(){return 1}},{key:"substituteParams",value:function(u){return new e(this.obj.substituteParams(u))}},{key:"toDisplayString",value:function(){return this.obj.toDisplayString()+" (case-insensitive)"}},{key:"toFailure",value:function(u){return new $u(this,this.obj.toFailure(u)+" (case-insensitive)","description")}},{key:"_isNullable",value:function(u,t){return this.obj._isNullable(u,t)}}]),e}(Xu),tt=ut,et=pu;function rt(u){this.source=u,this.pos=0,this.examinedLength=0}rt.prototype={atEnd:function(){var u=this.pos===this.source.length;return this.examinedLength=Math.max(this.examinedLength,this.pos+1),u},next:function(){var u=this.source[this.pos++];return this.examinedLength=Math.max(this.examinedLength,this.pos),u},nextCharCode:function(){var u=this.next();return u&&u.charCodeAt(0)},nextCodePoint:function(){var u=this.source.slice(this.pos++).codePointAt(0);return u>65535&&(this.pos+=1),this.examinedLength=Math.max(this.examinedLength,this.pos),u},matchString:function(u,t){var e;if(t){for(e=0;e0&&(e===t.length-1?u.append(t.length>2?", or ":" or "):u.append(", ")),u.append(t[e].toString());return u.contents()},st.prototype.getInterval=function(){var u=this.getRightmostFailurePosition();return new at(this.input,u,u)};var ct=st;function lt(){this.applicationMemoKeyStack=[],this.memo={},this.maxExaminedLength=0,this.maxRightmostFailureOffset=-1,this.currentLeftRecursion=void 0}lt.prototype={isActive:function(u){return this.applicationMemoKeyStack.indexOf(u.toMemoKey())>=0},enter:function(u){this.applicationMemoKeyStack.push(u.toMemoKey())},exit:function(){this.applicationMemoKeyStack.pop()},startLeftRecursion:function(u,t){t.isLeftRecursion=!0,t.headApplication=u,t.nextLeftRecursion=this.currentLeftRecursion,this.currentLeftRecursion=t;var e=this.applicationMemoKeyStack,r=e.indexOf(u.toMemoKey())+1,n=e.slice(r);t.isInvolved=function(u){return n.indexOf(u)>=0},t.updateInvolvedApplicationMemoKeys=function(){for(var u=r;ut?delete r[n]:(e.maxExaminedLength=Math.max(e.maxExaminedLength,i.examinedLength),e.maxRightmostFailureOffset=Math.max(e.maxRightmostFailureOffset,i.rightmostFailureOffset))}))}}};var pt,Dt=nt,ht=ct,At=lt,ft=Eu,mt=Wu;W.awaitBuiltInRules((function(u){pt=u.rules.applySyntactic.body}));var Et=new mt.Apply("spaces");function Ct(u,t,e){this.matcher=u,this.startExpr=t,this.grammar=u.grammar,this.input=u.input,this.inputStream=new Dt(u.input),this.memoTable=u.memoTable,this._bindings=[],this._bindingOffsets=[],this._applicationStack=[],this._posStack=[0],this.inLexifiedContextStack=[!1],this.rightmostFailurePosition=-1,this._rightmostFailurePositionStack=[],this._recordedFailuresStack=[],void 0!==e&&(this.positionToRecordFailures=e,this.recordedFailures=Object.create(null))}Ct.prototype={posToOffset:function(u){return u-this._posStack[this._posStack.length-1]},enterApplication:function(u,t){this._posStack.push(this.inputStream.pos),this._applicationStack.push(t),this.inLexifiedContextStack.push(!1),u.enter(t),this._rightmostFailurePositionStack.push(this.rightmostFailurePosition),this.rightmostFailurePosition=-1},exitApplication:function(u,t){var e=this._posStack.pop();this._applicationStack.pop(),this.inLexifiedContextStack.pop(),u.exit(),this.rightmostFailurePosition=Math.max(this.rightmostFailurePosition,this._rightmostFailurePositionStack.pop()),t&&this.pushBinding(t,e)},enterLexifiedContext:function(){this.inLexifiedContextStack.push(!0)},exitLexifiedContext:function(){this.inLexifiedContextStack.pop()},currentApplication:function(){return this._applicationStack[this._applicationStack.length-1]},inSyntacticContext:function(){var u=this.currentApplication();return u?u.isSyntactic()&&!this.inLexifiedContext():this.startExpr.factors[0].isSyntactic()},inLexifiedContext:function(){return this.inLexifiedContextStack[this.inLexifiedContextStack.length-1]},skipSpaces:function(){return this.pushFailuresInfo(),this.eval(Et),this.popBinding(),this.popFailuresInfo(),this.inputStream.pos},skipSpacesIfInSyntacticContext:function(){return this.inSyntacticContext()?this.skipSpaces():this.inputStream.pos},maybeSkipSpacesBefore:function(u){return u.allowsSkippingPrecedingSpace()&&u!==Et?this.skipSpacesIfInSyntacticContext():this.inputStream.pos},pushBinding:function(u,t){this._bindings.push(u),this._bindingOffsets.push(this.posToOffset(t))},popBinding:function(){this._bindings.pop(),this._bindingOffsets.pop()},numBindings:function(){return this._bindings.length},truncateBindings:function(u){for(;this._bindings.length>u;)this.popBinding()},getCurrentPosInfo:function(){return this.getPosInfo(this.inputStream.pos)},getPosInfo:function(u){var t=this.memoTable[u];return t||(t=this.memoTable[u]=new At),t},processFailure:function(u,t){if(this.rightmostFailurePosition=Math.max(this.rightmostFailurePosition,u),this.recordedFailures&&u===this.positionToRecordFailures){var e=this.currentApplication();e&&(t=t.substituteParams(e.args)),this.recordFailure(t.toFailure(this.grammar),!1)}},recordFailure:function(u,t){var e=u.toKey();this.recordedFailures[e]?this.recordedFailures[e].isFluffy()&&!u.isFluffy()&&this.recordedFailures[e].clearFluffy():this.recordedFailures[e]=t?u.clone():u},recordFailures:function(u,t){var e=this;Object.keys(u).forEach((function(r){e.recordFailure(u[r],t)}))},cloneRecordedFailures:function(){var u=this;if(this.recordedFailures){var t=Object.create(null);return Object.keys(this.recordedFailures).forEach((function(e){t[e]=u.recordedFailures[e].clone()})),t}},getRightmostFailurePosition:function(){return this.rightmostFailurePosition},_getRightmostFailureOffset:function(){return this.rightmostFailurePosition>=0?this.posToOffset(this.rightmostFailurePosition):-1},getMemoizedTraceEntry:function(u,t){var e=this.memoTable[u];if(e&&t instanceof mt.Apply){var r=e.memo[t.toMemoKey()];if(r&&r.traceEntry){var n=r.traceEntry.cloneWithExpr(t);return n.isMemoized=!0,n}}return null},getTraceEntry:function(u,t,e,r){if(t instanceof mt.Apply){var n=this.currentApplication(),i=n?n.args:[];t=t.substituteParams(i)}return this.getMemoizedTraceEntry(u,t)||new ft(this.input,u,this.inputStream.pos,t,e,r,this.trace)},isTracing:function(){return!!this.trace},hasNecessaryInfo:function(u){return!(this.trace&&!u.traceEntry)&&(!this.recordedFailures||this.inputStream.pos+u.rightmostFailureOffset!==this.positionToRecordFailures||!!u.failuresAtRightmostPosition)},useMemoizedResult:function(u,t){this.trace&&this.trace.push(t.traceEntry);var e=this.inputStream.pos+t.rightmostFailureOffset;return this.rightmostFailurePosition=Math.max(this.rightmostFailurePosition,e),this.recordedFailures&&this.positionToRecordFailures===e&&t.failuresAtRightmostPosition&&this.recordFailures(t.failuresAtRightmostPosition,!0),this.inputStream.examinedLength=Math.max(this.inputStream.examinedLength,t.examinedLength+u),!!t.value&&(this.inputStream.pos+=t.matchLength,this.pushBinding(t.value,u),!0)},eval:function(u){var t,e=this,r=this.inputStream,n=this._bindings.length;this.recordedFailures&&(t=this.recordedFailures,this.recordedFailures=Object.create(null));var i,o=r.pos,a=this.maybeSkipSpacesBefore(u);this.trace&&(i=this.trace,this.trace=[]);var s=u.eval(this);if(this.trace){var c=this._bindings.slice(n),l=this.getTraceEntry(a,u,s,c);l.isImplicitSpaces=u===Et,l.isRootNode=u===this.startExpr,i.push(l),this.trace=i}return s?this.recordedFailures&&r.pos===this.positionToRecordFailures&&Object.keys(this.recordedFailures).forEach((function(u){e.recordedFailures[u].makeFluffy()})):(r.pos=o,this.truncateBindings(n)),this.recordedFailures&&this.recordFailures(t,!1),u===pt&&this.skipSpaces(),s},getMatchResult:function(){var u,t=this;this.eval(this.startExpr),this.recordedFailures&&(u=Object.keys(this.recordedFailures).map((function(u){return t.recordedFailures[u]})));var e=this._bindings[0];return e&&(e.grammar=this.grammar),new ht(this.matcher,this.input,this.startExpr,e,this._bindingOffsets[0],this.rightmostFailurePosition,u)},getTrace:function(){this.trace=[];var u=this.getMatchResult(),t=this.trace[this.trace.length-1];return t.result=u,t},pushFailuresInfo:function(){this._rightmostFailurePositionStack.push(this.rightmostFailurePosition),this._recordedFailuresStack.push(this.recordedFailures)},popFailuresInfo:function(){this.rightmostFailurePosition=this._rightmostFailurePositionStack.pop(),this.recordedFailures=this._recordedFailuresStack.pop()}};var Ft=Ct,dt=Wu;function vt(u){this.grammar=u,this.memoTable=[],this.input=""}vt.prototype.getInput=function(){return this.input},vt.prototype.setInput=function(u){return this.input!==u&&this.replaceInputRange(0,this.input.length,u),this},vt.prototype.replaceInputRange=function(u,t,e){var r=this.input;if(u<0||u>r.length||t<0||t>r.length||u>t)throw new Error("Invalid indices: "+u+" and "+t);this.input=r.slice(0,u)+e+r.slice(t);var n=this.memoTable.slice(t);this.memoTable.length=u;for(var i=0;i0&&(p+="("+c.join(", ")+")"),o=e(t)&&t.super[u.toLowerCase()+"s"][i]?"extend"+u:"add"+u,r+="\n ."+o+"("+JSON.stringify(p)+", {";var D=[];Object.keys(s).forEach((function(u){if(s[u]!==l){var t=s[u].toString().trim();t=t.replace(/^.*\(/,"function("),D.push("\n "+JSON.stringify(u)+": "+t)}})),r+=D.join(",")+"\n })"}))})),r+=";\n })",u||(r="(function() {\n var grammar = this.fromRecipe("+this.grammar.toRecipe()+");\n var semantics = "+r+"(grammar);\n return semantics;\n});\n"),r},Nt.prototype.addOperationOrAttribute=function(u,t,e){var n=u+"s",i=Rt(t,u),o=i.name,a=i.formals;this.assertNewName(o,u);var s=function(u,t,e){return function(){var r=this,n=(this._semantics.operations[t]||this._semantics.attributes[t]).formals.map((function(u){return r.args[u]}));if(this.isIteration()||1!==arguments.length)throw bt.missingSemanticAction(this.ctorName,t,u,wt);return e.apply(arguments.length<=0?void 0:arguments[0],n)}}(u,o,p),c={_default:s};Object.keys(e).forEach((function(u){c[u]=e[u]}));var l="operation"===u?new Lt(o,a,c,s):new Pt(o,c,s);function p(){for(var t=arguments.length,e=new Array(t),i=0;i0){var l=r.map((function(u){return"- "+u})),p=new Error(["Found errors in the action dictionary of the '".concat(t,"' ").concat(u,":")].concat((0,n.Z)(l)).join("\n"));throw p.problems=r,p}},_topDownActionArity:function(u){return Ut.includes(u)?0:this.rules[u].body.getArity()},_inheritsFrom:function(u){for(var t=this.superGrammar;t;){if(t.equals(u,!0))return!0;t=t.superGrammar}return!1},toRecipe:function(){var u=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e={};this.source&&(e.source=this.source.contents);var r=null;this.defaultStartRule&&(r=this.defaultStartRule);var i={};Object.keys(this.rules).forEach((function(t){var e,r=u.rules[t],n=r.body,o=!u.superGrammar||!u.superGrammar.rules[t];e=o?"define":n instanceof Gt.Extend?"extend":"override";var a={};if(r.source&&u.source){var s=r.source.relativeTo(u.source);a.sourceInterval=[s.startIdx,s.endIdx]}var c=o?r.description:null,l=n.outputRecipe(r.formals,u.source);i[t]=[e,a,c,r.formals,l]}));var o="null";t?o=t:this.superGrammar&&!this.superGrammar.isBuiltIn()&&(o=this.superGrammar.toRecipe());var a=[].concat((0,n.Z)(["grammar",e,this.name].map(JSON.stringify)),[o],(0,n.Z)([r,i].map(JSON.stringify)));return Vt("[".concat(a.join(","),"]"))},toOperationActionDictionaryTemplate:function(){return this._toOperationOrAttributeActionDictionaryTemplate()},toAttributeActionDictionaryTemplate:function(){return this._toOperationOrAttributeActionDictionaryTemplate()},_toOperationOrAttributeActionDictionaryTemplate:function(){var u=new qt.StringBuffer;u.append("{");var t=!0;for(var e in this.rules){var r=this.rules[e].body;t?t=!1:u.append(","),u.append("\n"),u.append(" "),this.addSemanticActionTemplate(e,r,u)}return u.append("\n}"),u.contents()},addSemanticActionTemplate:function(u,t,e){e.append(u),e.append(": function(");var r=this._topDownActionArity(u);e.append(qt.repeat("_",r).join(", ")),e.append(") {\n"),e.append(" }")},parseApplication:function(u){var t;if(-1===u.indexOf("<"))t=new Gt.Apply(u);else{var e=Ht.match(u,"Base_application");t=Kt(e,{})}if(!(t.ruleName in this.rules))throw Mt.undeclaredRule(t.ruleName,this.name);var r=this.rules[t.ruleName].formals;if(r.length!==t.args.length){var n=this.rules[t.ruleName].source;throw Mt.wrongNumberOfParameters(t.ruleName,r.length,t.args.length,n)}return t}},Wt.ProtoBuiltInRules=new Wt("ProtoBuiltInRules",void 0,{any:{body:Gt.any,formals:[],description:"any character",primitive:!0},end:{body:Gt.end,formals:[],description:"end of input",primitive:!0},caseInsensitive:{body:new Tt(new Gt.Param(0)),formals:["str"],primitive:!0},lower:{body:new Gt.UnicodeChar("Ll"),formals:[],description:"a lowercase letter",primitive:!0},upper:{body:new Gt.UnicodeChar("Lu"),formals:[],description:"an uppercase letter",primitive:!0},unicodeLtmo:{body:new Gt.UnicodeChar("Ltmo"),formals:[],description:"a Unicode character in Lt, Lm, or Lo",primitive:!0},spaces:{body:new Gt.Star(new Gt.Apply("space")),formals:[]},space:{body:new Gt.Range("\0"," "),formals:[],description:"a space"}});var $t=Wt,Jt=$t,Qt=nt,Xt=D,Yt=V,ue=Wu;function te(u){this.name=u}te.prototype.sourceInterval=function(u,t){return this.source.subInterval(u,t-u)},te.prototype.ensureSuperGrammar=function(){return this.superGrammar||this.withSuperGrammar("BuiltInRules"===this.name?Jt.ProtoBuiltInRules:Jt.BuiltInRules),this.superGrammar},te.prototype.ensureSuperGrammarRuleForOverriding=function(u,t){var e=this.ensureSuperGrammar().rules[u];if(!e)throw Yt.cannotOverrideUndeclaredRule(u,this.superGrammar.name,t);return e},te.prototype.installOverriddenOrExtendedRule=function(u,t,e,r){var n=Xt.getDuplicates(t);if(n.length>0)throw Yt.duplicateParameterNames(u,n,r);var i=this.ensureSuperGrammar().rules[u],o=i.formals,a=o?o.length:0;if(t.length!==a)throw Yt.wrongNumberOfParameters(u,a,t.length,r);return this.install(u,t,e,i.description,r)},te.prototype.install=function(u,t,e,r,n){return this.rules[u]={body:e.introduceParams(t),formals:t,description:r,source:n},this},te.prototype.withSuperGrammar=function(u){if(this.superGrammar)throw new Error("the super grammar of a GrammarDecl cannot be set more than once");return this.superGrammar=u,this.rules=Object.create(u.rules),u.isBuiltIn()||(this.defaultStartRule=u.defaultStartRule),this},te.prototype.withDefaultStartRule=function(u){return this.defaultStartRule=u,this},te.prototype.withSource=function(u){return this.source=new Qt(u).interval(0,u.length),this},te.prototype.build=function(){var u=new Jt(this.name,this.ensureSuperGrammar(),this.rules,this.defaultStartRule),t=[],e=!1;return Object.keys(u.rules).forEach((function(r){var n=u.rules[r].body;try{n.assertChoicesHaveUniformArity(r)}catch(i){t.push(i)}try{n.assertAllApplicationsAreValid(r,u)}catch(i){t.push(i),e=!0}})),e||Object.keys(u.rules).forEach((function(e){var r=u.rules[e].body;try{r.assertIteratedExprsAreNotNullable(u,[])}catch(n){t.push(n)}})),t.length>0&&Yt.throwErrors(t),this.source&&(u.source=this.source),u},te.prototype.define=function(u,t,e,r,n){if(this.ensureSuperGrammar(),this.superGrammar.rules[u])throw Yt.duplicateRuleDeclaration(u,this.name,this.superGrammar.name,n);if(this.rules[u])throw Yt.duplicateRuleDeclaration(u,this.name,this.name,n);var i=Xt.getDuplicates(t);if(i.length>0)throw Yt.duplicateParameterNames(u,i,n);return this.install(u,t,e,r,n)},te.prototype.override=function(u,t,e,r,n){return this.ensureSuperGrammarRuleForOverriding(u,n),this.installOverriddenOrExtendedRule(u,t,e,n),this},te.prototype.extend=function(u,t,e,r,n){if(!this.ensureSuperGrammar().rules[u])throw Yt.cannotExtendUndeclaredRule(u,this.superGrammar.name,n);var i=new ue.Extend(this.superGrammar,u,e);return i.source=e.source,this.installOverriddenOrExtendedRule(u,t,i,n),this};var ee=$t,re=te,ne=Wu;function ie(){}ie.prototype={currentDecl:null,currentRuleName:null,newGrammar:function(u){return new re(u)},grammar:function(u,t,e,r,n){var i=this,o=new re(t);return e&&o.withSuperGrammar(e instanceof ee?e:this.fromRecipe(e)),r&&o.withDefaultStartRule(r),u&&u.source&&o.withSource(u.source),this.currentDecl=o,Object.keys(n).forEach((function(u){i.currentRuleName=u;var t,e=n[u],r=e[0],a=e[1],s=e[2],c=e[3],l=i.fromRecipe(e[4]);o.source&&a&&a.sourceInterval&&(t=o.source.subInterval(a.sourceInterval[0],a.sourceInterval[1]-a.sourceInterval[0])),o[r](u,c,l,s,t)})),this.currentRuleName=this.currentDecl=null,o.build()},terminal:function(u){return new ne.Terminal(u)},range:function(u,t){return new ne.Range(u,t)},param:function(u){return new ne.Param(u)},alt:function(){for(var u=[],t=arguments.length,e=new Array(t),r=0;r0&&(t=t.map((function(u){return u instanceof ne.PExpr?u:this.fromRecipe(u)}),this)),new ne.Apply(u,t)},splice:function(u,t){var e=this;return new ne.Splice(this.currentDecl.superGrammar,this.currentRuleName,u.map((function(u){return e.fromRecipe(u)})),t.map((function(u){return e.fromRecipe(u)})))},fromRecipe:function(u){var t,e="grammar"===u[0]?u.slice(1):u.slice(2),r=this[u[0]].apply(this,(0,n.Z)(e)),i=u[1];i&&(i.sourceInterval&&this.currentDecl&&r.withSource((t=this.currentDecl).sourceInterval.apply(t,(0,n.Z)(i.sourceInterval))));return r}};var oe=ie,ae="string"===typeof __GLOBAL_OHM_VERSION__?__GLOBAL_OHM_VERSION__:"16.6.0",se={},ce=oe;se.makeRecipe=function(u){return"function"===typeof u?u.call(new ce):("string"===typeof u&&(u=JSON.parse(u)),(new ce).fromRecipe(u))};var le=(0,se.makeRecipe)(["grammar",{source:'BuiltInRules {\n\n alnum (an alpha-numeric character)\n = letter\n | digit\n\n letter (a letter)\n = lower\n | upper\n | unicodeLtmo\n\n digit (a digit)\n = "0".."9"\n\n hexDigit (a hexadecimal digit)\n = digit\n | "a".."f"\n | "A".."F"\n\n ListOf\n = NonemptyListOf\n | EmptyListOf\n\n NonemptyListOf\n = elem (sep elem)*\n\n EmptyListOf\n = /* nothing */\n\n listOf\n = nonemptyListOf\n | emptyListOf\n\n nonemptyListOf\n = elem (sep elem)*\n\n emptyListOf\n = /* nothing */\n\n // Allows a syntactic rule application within a lexical context.\n applySyntactic = app\n}'},"BuiltInRules",null,null,{alnum:["define",{sourceInterval:[18,78]},"an alpha-numeric character",[],["alt",{sourceInterval:[60,78]},["app",{sourceInterval:[60,66]},"letter",[]],["app",{sourceInterval:[73,78]},"digit",[]]]],letter:["define",{sourceInterval:[82,142]},"a letter",[],["alt",{sourceInterval:[107,142]},["app",{sourceInterval:[107,112]},"lower",[]],["app",{sourceInterval:[119,124]},"upper",[]],["app",{sourceInterval:[131,142]},"unicodeLtmo",[]]]],digit:["define",{sourceInterval:[146,177]},"a digit",[],["range",{sourceInterval:[169,177]},"0","9"]],hexDigit:["define",{sourceInterval:[181,254]},"a hexadecimal digit",[],["alt",{sourceInterval:[219,254]},["app",{sourceInterval:[219,224]},"digit",[]],["range",{sourceInterval:[231,239]},"a","f"],["range",{sourceInterval:[246,254]},"A","F"]]],ListOf:["define",{sourceInterval:[258,336]},null,["elem","sep"],["alt",{sourceInterval:[282,336]},["app",{sourceInterval:[282,307]},"NonemptyListOf",[["param",{sourceInterval:[297,301]},0],["param",{sourceInterval:[303,306]},1]]],["app",{sourceInterval:[314,336]},"EmptyListOf",[["param",{sourceInterval:[326,330]},0],["param",{sourceInterval:[332,335]},1]]]]],NonemptyListOf:["define",{sourceInterval:[340,388]},null,["elem","sep"],["seq",{sourceInterval:[372,388]},["param",{sourceInterval:[372,376]},0],["star",{sourceInterval:[377,388]},["seq",{sourceInterval:[378,386]},["param",{sourceInterval:[378,381]},1],["param",{sourceInterval:[382,386]},0]]]]],EmptyListOf:["define",{sourceInterval:[392,434]},null,["elem","sep"],["seq",{sourceInterval:[438,438]}]],listOf:["define",{sourceInterval:[438,516]},null,["elem","sep"],["alt",{sourceInterval:[462,516]},["app",{sourceInterval:[462,487]},"nonemptyListOf",[["param",{sourceInterval:[477,481]},0],["param",{sourceInterval:[483,486]},1]]],["app",{sourceInterval:[494,516]},"emptyListOf",[["param",{sourceInterval:[506,510]},0],["param",{sourceInterval:[512,515]},1]]]]],nonemptyListOf:["define",{sourceInterval:[520,568]},null,["elem","sep"],["seq",{sourceInterval:[552,568]},["param",{sourceInterval:[552,556]},0],["star",{sourceInterval:[557,568]},["seq",{sourceInterval:[558,566]},["param",{sourceInterval:[558,561]},1],["param",{sourceInterval:[562,566]},0]]]]],emptyListOf:["define",{sourceInterval:[572,682]},null,["elem","sep"],["seq",{sourceInterval:[685,685]}]],applySyntactic:["define",{sourceInterval:[685,710]},null,["app"],["param",{sourceInterval:[707,710]},0]]}]);$t.BuiltInRules=le;var pe=(0,se.makeRecipe)(["grammar",{source:'OperationsAndAttributes {\n\n AttributeSignature =\n name\n\n OperationSignature =\n name Formals?\n\n Formals\n = "(" ListOf ")"\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = "_"\n | letter\n\n nameRest\n = "_"\n | alnum\n\n}'},"OperationsAndAttributes",null,"AttributeSignature",{AttributeSignature:["define",{sourceInterval:[29,58]},null,[],["app",{sourceInterval:[54,58]},"name",[]]],OperationSignature:["define",{sourceInterval:[62,100]},null,[],["seq",{sourceInterval:[87,100]},["app",{sourceInterval:[87,91]},"name",[]],["opt",{sourceInterval:[92,100]},["app",{sourceInterval:[92,99]},"Formals",[]]]]],Formals:["define",{sourceInterval:[104,143]},null,[],["seq",{sourceInterval:[118,143]},["terminal",{sourceInterval:[118,121]},"("],["app",{sourceInterval:[122,139]},"ListOf",[["app",{sourceInterval:[129,133]},"name",[]],["terminal",{sourceInterval:[135,138]},","]]],["terminal",{sourceInterval:[140,143]},")"]]],name:["define",{sourceInterval:[147,187]},"a name",[],["seq",{sourceInterval:[168,187]},["app",{sourceInterval:[168,177]},"nameFirst",[]],["star",{sourceInterval:[178,187]},["app",{sourceInterval:[178,186]},"nameRest",[]]]]],nameFirst:["define",{sourceInterval:[191,223]},null,[],["alt",{sourceInterval:[207,223]},["terminal",{sourceInterval:[207,210]},"_"],["app",{sourceInterval:[217,223]},"letter",[]]]],nameRest:["define",{sourceInterval:[227,257]},null,[],["alt",{sourceInterval:[242,257]},["terminal",{sourceInterval:[242,245]},"_"],["app",{sourceInterval:[252,257]},"alnum",[]]]]}]),De=kt;W.awaitBuiltInRules((function(u){var t=pe;!function(u){var t={empty:function(){return this.iteration()},nonEmpty:function(u,t,e){return this.iteration([u].concat(e.children))}};De.BuiltInSemantics=De.createSemantics(u,null).addOperation("asIteration",{emptyListOf:t.empty,nonemptyListOf:t.nonEmpty,EmptyListOf:t.empty,NonemptyListOf:t.nonEmpty})}(u),function(u){De.prototypeGrammarSemantics=u.createSemantics().addOperation("parse",{AttributeSignature:function(u){return{name:u.parse(),formals:[]}},OperationSignature:function(u,t){return{name:u.parse(),formals:t.children.map((function(u){return u.parse()}))[0]||[]}},Formals:function(u,t,e){return t.asIteration().children.map((function(u){return u.parse()}))},name:function(u,t){return this.sourceString}}),De.prototypeGrammar=u}(t)}));var he,Ae=(0,se.makeRecipe)(["grammar",{source:'Ohm {\n\n Grammars\n = Grammar*\n\n Grammar\n = ident SuperGrammar? "{" Rule* "}"\n\n SuperGrammar\n = "<:" ident\n\n Rule\n = ident Formals? ruleDescr? "=" RuleBody -- define\n | ident Formals? ":=" OverrideRuleBody -- override\n | ident Formals? "+=" RuleBody -- extend\n\n RuleBody\n = "|"? NonemptyListOf\n\n TopLevelTerm\n = Seq caseName -- inline\n | Seq\n\n OverrideRuleBody\n = "|"? NonemptyListOf\n\n OverrideTopLevelTerm\n = "..." -- superSplice\n | TopLevelTerm\n\n Formals\n = "<" ListOf ">"\n\n Params\n = "<" ListOf ">"\n\n Alt\n = NonemptyListOf\n\n Seq\n = Iter*\n\n Iter\n = Pred "*" -- star\n | Pred "+" -- plus\n | Pred "?" -- opt\n | Pred\n\n Pred\n = "~" Lex -- not\n | "&" Lex -- lookahead\n | Lex\n\n Lex\n = "#" Base -- lex\n | Base\n\n Base\n = ident Params? ~(ruleDescr? "=" | ":=" | "+=") -- application\n | oneCharTerminal ".." oneCharTerminal -- range\n | terminal -- terminal\n | "(" Alt ")" -- paren\n\n ruleDescr (a rule description)\n = "(" ruleDescrText ")"\n\n ruleDescrText\n = (~")" any)*\n\n caseName\n = "--" (~"\\n" space)* name (~"\\n" space)* ("\\n" | &"}")\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = "_"\n | letter\n\n nameRest\n = "_"\n | alnum\n\n ident (an identifier)\n = name\n\n terminal\n = "\\"" terminalChar* "\\""\n\n oneCharTerminal\n = "\\"" terminalChar "\\""\n\n terminalChar\n = escapeChar\n | ~"\\\\" ~"\\"" ~"\\n" "\\u{0}".."\\u{10FFFF}"\n\n escapeChar (an escape sequence)\n = "\\\\\\\\" -- backslash\n | "\\\\\\"" -- doubleQuote\n | "\\\\\\\'" -- singleQuote\n | "\\\\b" -- backspace\n | "\\\\n" -- lineFeed\n | "\\\\r" -- carriageReturn\n | "\\\\t" -- tab\n | "\\\\u{" hexDigit hexDigit? hexDigit?\n hexDigit? hexDigit? hexDigit? "}" -- unicodeCodePoint\n | "\\\\u" hexDigit hexDigit hexDigit hexDigit -- unicodeEscape\n | "\\\\x" hexDigit hexDigit -- hexEscape\n\n space\n += comment\n\n comment\n = "//" (~"\\n" any)* &("\\n" | end) -- singleLine\n | "/*" (~"*/" any)* "*/" -- multiLine\n\n tokens = token*\n\n token = caseName | comment | ident | operator | punctuation | terminal | any\n\n operator = "<:" | "=" | ":=" | "+=" | "*" | "+" | "?" | "~" | "&"\n\n punctuation = "<" | ">" | "," | "--"\n}'},"Ohm",null,"Grammars",{Grammars:["define",{sourceInterval:[9,32]},null,[],["star",{sourceInterval:[24,32]},["app",{sourceInterval:[24,31]},"Grammar",[]]]],Grammar:["define",{sourceInterval:[36,83]},null,[],["seq",{sourceInterval:[50,83]},["app",{sourceInterval:[50,55]},"ident",[]],["opt",{sourceInterval:[56,69]},["app",{sourceInterval:[56,68]},"SuperGrammar",[]]],["terminal",{sourceInterval:[70,73]},"{"],["star",{sourceInterval:[74,79]},["app",{sourceInterval:[74,78]},"Rule",[]]],["terminal",{sourceInterval:[80,83]},"}"]]],SuperGrammar:["define",{sourceInterval:[87,116]},null,[],["seq",{sourceInterval:[106,116]},["terminal",{sourceInterval:[106,110]},"<:"],["app",{sourceInterval:[111,116]},"ident",[]]]],Rule_define:["define",{sourceInterval:[131,181]},null,[],["seq",{sourceInterval:[131,170]},["app",{sourceInterval:[131,136]},"ident",[]],["opt",{sourceInterval:[137,145]},["app",{sourceInterval:[137,144]},"Formals",[]]],["opt",{sourceInterval:[146,156]},["app",{sourceInterval:[146,155]},"ruleDescr",[]]],["terminal",{sourceInterval:[157,160]},"="],["app",{sourceInterval:[162,170]},"RuleBody",[]]]],Rule_override:["define",{sourceInterval:[188,248]},null,[],["seq",{sourceInterval:[188,235]},["app",{sourceInterval:[188,193]},"ident",[]],["opt",{sourceInterval:[194,202]},["app",{sourceInterval:[194,201]},"Formals",[]]],["terminal",{sourceInterval:[214,218]},":="],["app",{sourceInterval:[219,235]},"OverrideRuleBody",[]]]],Rule_extend:["define",{sourceInterval:[255,305]},null,[],["seq",{sourceInterval:[255,294]},["app",{sourceInterval:[255,260]},"ident",[]],["opt",{sourceInterval:[261,269]},["app",{sourceInterval:[261,268]},"Formals",[]]],["terminal",{sourceInterval:[281,285]},"+="],["app",{sourceInterval:[286,294]},"RuleBody",[]]]],Rule:["define",{sourceInterval:[120,305]},null,[],["alt",{sourceInterval:[131,305]},["app",{sourceInterval:[131,170]},"Rule_define",[]],["app",{sourceInterval:[188,235]},"Rule_override",[]],["app",{sourceInterval:[255,294]},"Rule_extend",[]]]],RuleBody:["define",{sourceInterval:[309,362]},null,[],["seq",{sourceInterval:[324,362]},["opt",{sourceInterval:[324,328]},["terminal",{sourceInterval:[324,327]},"|"]],["app",{sourceInterval:[329,362]},"NonemptyListOf",[["app",{sourceInterval:[344,356]},"TopLevelTerm",[]],["terminal",{sourceInterval:[358,361]},"|"]]]]],TopLevelTerm_inline:["define",{sourceInterval:[385,408]},null,[],["seq",{sourceInterval:[385,397]},["app",{sourceInterval:[385,388]},"Seq",[]],["app",{sourceInterval:[389,397]},"caseName",[]]]],TopLevelTerm:["define",{sourceInterval:[366,418]},null,[],["alt",{sourceInterval:[385,418]},["app",{sourceInterval:[385,397]},"TopLevelTerm_inline",[]],["app",{sourceInterval:[415,418]},"Seq",[]]]],OverrideRuleBody:["define",{sourceInterval:[422,491]},null,[],["seq",{sourceInterval:[445,491]},["opt",{sourceInterval:[445,449]},["terminal",{sourceInterval:[445,448]},"|"]],["app",{sourceInterval:[450,491]},"NonemptyListOf",[["app",{sourceInterval:[465,485]},"OverrideTopLevelTerm",[]],["terminal",{sourceInterval:[487,490]},"|"]]]]],OverrideTopLevelTerm_superSplice:["define",{sourceInterval:[522,543]},null,[],["terminal",{sourceInterval:[522,527]},"..."]],OverrideTopLevelTerm:["define",{sourceInterval:[495,562]},null,[],["alt",{sourceInterval:[522,562]},["app",{sourceInterval:[522,527]},"OverrideTopLevelTerm_superSplice",[]],["app",{sourceInterval:[550,562]},"TopLevelTerm",[]]]],Formals:["define",{sourceInterval:[566,606]},null,[],["seq",{sourceInterval:[580,606]},["terminal",{sourceInterval:[580,583]},"<"],["app",{sourceInterval:[584,602]},"ListOf",[["app",{sourceInterval:[591,596]},"ident",[]],["terminal",{sourceInterval:[598,601]},","]]],["terminal",{sourceInterval:[603,606]},">"]]],Params:["define",{sourceInterval:[610,647]},null,[],["seq",{sourceInterval:[623,647]},["terminal",{sourceInterval:[623,626]},"<"],["app",{sourceInterval:[627,643]},"ListOf",[["app",{sourceInterval:[634,637]},"Seq",[]],["terminal",{sourceInterval:[639,642]},","]]],["terminal",{sourceInterval:[644,647]},">"]]],Alt:["define",{sourceInterval:[651,685]},null,[],["app",{sourceInterval:[661,685]},"NonemptyListOf",[["app",{sourceInterval:[676,679]},"Seq",[]],["terminal",{sourceInterval:[681,684]},"|"]]]],Seq:["define",{sourceInterval:[689,704]},null,[],["star",{sourceInterval:[699,704]},["app",{sourceInterval:[699,703]},"Iter",[]]]],Iter_star:["define",{sourceInterval:[719,736]},null,[],["seq",{sourceInterval:[719,727]},["app",{sourceInterval:[719,723]},"Pred",[]],["terminal",{sourceInterval:[724,727]},"*"]]],Iter_plus:["define",{sourceInterval:[743,760]},null,[],["seq",{sourceInterval:[743,751]},["app",{sourceInterval:[743,747]},"Pred",[]],["terminal",{sourceInterval:[748,751]},"+"]]],Iter_opt:["define",{sourceInterval:[767,783]},null,[],["seq",{sourceInterval:[767,775]},["app",{sourceInterval:[767,771]},"Pred",[]],["terminal",{sourceInterval:[772,775]},"?"]]],Iter:["define",{sourceInterval:[708,794]},null,[],["alt",{sourceInterval:[719,794]},["app",{sourceInterval:[719,727]},"Iter_star",[]],["app",{sourceInterval:[743,751]},"Iter_plus",[]],["app",{sourceInterval:[767,775]},"Iter_opt",[]],["app",{sourceInterval:[790,794]},"Pred",[]]]],Pred_not:["define",{sourceInterval:[809,824]},null,[],["seq",{sourceInterval:[809,816]},["terminal",{sourceInterval:[809,812]},"~"],["app",{sourceInterval:[813,816]},"Lex",[]]]],Pred_lookahead:["define",{sourceInterval:[831,852]},null,[],["seq",{sourceInterval:[831,838]},["terminal",{sourceInterval:[831,834]},"&"],["app",{sourceInterval:[835,838]},"Lex",[]]]],Pred:["define",{sourceInterval:[798,862]},null,[],["alt",{sourceInterval:[809,862]},["app",{sourceInterval:[809,816]},"Pred_not",[]],["app",{sourceInterval:[831,838]},"Pred_lookahead",[]],["app",{sourceInterval:[859,862]},"Lex",[]]]],Lex_lex:["define",{sourceInterval:[876,892]},null,[],["seq",{sourceInterval:[876,884]},["terminal",{sourceInterval:[876,879]},"#"],["app",{sourceInterval:[880,884]},"Base",[]]]],Lex:["define",{sourceInterval:[866,903]},null,[],["alt",{sourceInterval:[876,903]},["app",{sourceInterval:[876,884]},"Lex_lex",[]],["app",{sourceInterval:[899,903]},"Base",[]]]],Base_application:["define",{sourceInterval:[918,979]},null,[],["seq",{sourceInterval:[918,963]},["app",{sourceInterval:[918,923]},"ident",[]],["opt",{sourceInterval:[924,931]},["app",{sourceInterval:[924,930]},"Params",[]]],["not",{sourceInterval:[932,963]},["alt",{sourceInterval:[934,962]},["seq",{sourceInterval:[934,948]},["opt",{sourceInterval:[934,944]},["app",{sourceInterval:[934,943]},"ruleDescr",[]]],["terminal",{sourceInterval:[945,948]},"="]],["terminal",{sourceInterval:[951,955]},":="],["terminal",{sourceInterval:[958,962]},"+="]]]]],Base_range:["define",{sourceInterval:[986,1041]},null,[],["seq",{sourceInterval:[986,1022]},["app",{sourceInterval:[986,1001]},"oneCharTerminal",[]],["terminal",{sourceInterval:[1002,1006]},".."],["app",{sourceInterval:[1007,1022]},"oneCharTerminal",[]]]],Base_terminal:["define",{sourceInterval:[1048,1106]},null,[],["app",{sourceInterval:[1048,1056]},"terminal",[]]],Base_paren:["define",{sourceInterval:[1113,1168]},null,[],["seq",{sourceInterval:[1113,1124]},["terminal",{sourceInterval:[1113,1116]},"("],["app",{sourceInterval:[1117,1120]},"Alt",[]],["terminal",{sourceInterval:[1121,1124]},")"]]],Base:["define",{sourceInterval:[907,1168]},null,[],["alt",{sourceInterval:[918,1168]},["app",{sourceInterval:[918,963]},"Base_application",[]],["app",{sourceInterval:[986,1022]},"Base_range",[]],["app",{sourceInterval:[1048,1056]},"Base_terminal",[]],["app",{sourceInterval:[1113,1124]},"Base_paren",[]]]],ruleDescr:["define",{sourceInterval:[1172,1231]},"a rule description",[],["seq",{sourceInterval:[1210,1231]},["terminal",{sourceInterval:[1210,1213]},"("],["app",{sourceInterval:[1214,1227]},"ruleDescrText",[]],["terminal",{sourceInterval:[1228,1231]},")"]]],ruleDescrText:["define",{sourceInterval:[1235,1266]},null,[],["star",{sourceInterval:[1255,1266]},["seq",{sourceInterval:[1256,1264]},["not",{sourceInterval:[1256,1260]},["terminal",{sourceInterval:[1257,1260]},")"]],["app",{sourceInterval:[1261,1264]},"any",[]]]]],caseName:["define",{sourceInterval:[1270,1338]},null,[],["seq",{sourceInterval:[1285,1338]},["terminal",{sourceInterval:[1285,1289]},"--"],["star",{sourceInterval:[1290,1304]},["seq",{sourceInterval:[1291,1302]},["not",{sourceInterval:[1291,1296]},["terminal",{sourceInterval:[1292,1296]},"\n"]],["app",{sourceInterval:[1297,1302]},"space",[]]]],["app",{sourceInterval:[1305,1309]},"name",[]],["star",{sourceInterval:[1310,1324]},["seq",{sourceInterval:[1311,1322]},["not",{sourceInterval:[1311,1316]},["terminal",{sourceInterval:[1312,1316]},"\n"]],["app",{sourceInterval:[1317,1322]},"space",[]]]],["alt",{sourceInterval:[1326,1337]},["terminal",{sourceInterval:[1326,1330]},"\n"],["lookahead",{sourceInterval:[1333,1337]},["terminal",{sourceInterval:[1334,1337]},"}"]]]]],name:["define",{sourceInterval:[1342,1382]},"a name",[],["seq",{sourceInterval:[1363,1382]},["app",{sourceInterval:[1363,1372]},"nameFirst",[]],["star",{sourceInterval:[1373,1382]},["app",{sourceInterval:[1373,1381]},"nameRest",[]]]]],nameFirst:["define",{sourceInterval:[1386,1418]},null,[],["alt",{sourceInterval:[1402,1418]},["terminal",{sourceInterval:[1402,1405]},"_"],["app",{sourceInterval:[1412,1418]},"letter",[]]]],nameRest:["define",{sourceInterval:[1422,1452]},null,[],["alt",{sourceInterval:[1437,1452]},["terminal",{sourceInterval:[1437,1440]},"_"],["app",{sourceInterval:[1447,1452]},"alnum",[]]]],ident:["define",{sourceInterval:[1456,1489]},"an identifier",[],["app",{sourceInterval:[1485,1489]},"name",[]]],terminal:["define",{sourceInterval:[1493,1531]},null,[],["seq",{sourceInterval:[1508,1531]},["terminal",{sourceInterval:[1508,1512]},'"'],["star",{sourceInterval:[1513,1526]},["app",{sourceInterval:[1513,1525]},"terminalChar",[]]],["terminal",{sourceInterval:[1527,1531]},'"']]],oneCharTerminal:["define",{sourceInterval:[1535,1579]},null,[],["seq",{sourceInterval:[1557,1579]},["terminal",{sourceInterval:[1557,1561]},'"'],["app",{sourceInterval:[1562,1574]},"terminalChar",[]],["terminal",{sourceInterval:[1575,1579]},'"']]],terminalChar:["define",{sourceInterval:[1583,1660]},null,[],["alt",{sourceInterval:[1602,1660]},["app",{sourceInterval:[1602,1612]},"escapeChar",[]],["seq",{sourceInterval:[1621,1660]},["not",{sourceInterval:[1621,1626]},["terminal",{sourceInterval:[1622,1626]},"\\"]],["not",{sourceInterval:[1627,1632]},["terminal",{sourceInterval:[1628,1632]},'"']],["not",{sourceInterval:[1633,1638]},["terminal",{sourceInterval:[1634,1638]},"\n"]],["range",{sourceInterval:[1639,1660]},"\0","\udbff\udfff"]]]],escapeChar_backslash:["define",{sourceInterval:[1703,1758]},null,[],["terminal",{sourceInterval:[1703,1709]},"\\\\"]],escapeChar_doubleQuote:["define",{sourceInterval:[1765,1822]},null,[],["terminal",{sourceInterval:[1765,1771]},'\\"']],escapeChar_singleQuote:["define",{sourceInterval:[1829,1886]},null,[],["terminal",{sourceInterval:[1829,1835]},"\\'"]],escapeChar_backspace:["define",{sourceInterval:[1893,1948]},null,[],["terminal",{sourceInterval:[1893,1898]},"\\b"]],escapeChar_lineFeed:["define",{sourceInterval:[1955,2009]},null,[],["terminal",{sourceInterval:[1955,1960]},"\\n"]],escapeChar_carriageReturn:["define",{sourceInterval:[2016,2076]},null,[],["terminal",{sourceInterval:[2016,2021]},"\\r"]],escapeChar_tab:["define",{sourceInterval:[2083,2132]},null,[],["terminal",{sourceInterval:[2083,2088]},"\\t"]],escapeChar_unicodeCodePoint:["define",{sourceInterval:[2139,2243]},null,[],["seq",{sourceInterval:[2139,2221]},["terminal",{sourceInterval:[2139,2145]},"\\u{"],["app",{sourceInterval:[2146,2154]},"hexDigit",[]],["opt",{sourceInterval:[2155,2164]},["app",{sourceInterval:[2155,2163]},"hexDigit",[]]],["opt",{sourceInterval:[2165,2174]},["app",{sourceInterval:[2165,2173]},"hexDigit",[]]],["opt",{sourceInterval:[2188,2197]},["app",{sourceInterval:[2188,2196]},"hexDigit",[]]],["opt",{sourceInterval:[2198,2207]},["app",{sourceInterval:[2198,2206]},"hexDigit",[]]],["opt",{sourceInterval:[2208,2217]},["app",{sourceInterval:[2208,2216]},"hexDigit",[]]],["terminal",{sourceInterval:[2218,2221]},"}"]]],escapeChar_unicodeEscape:["define",{sourceInterval:[2250,2309]},null,[],["seq",{sourceInterval:[2250,2291]},["terminal",{sourceInterval:[2250,2255]},"\\u"],["app",{sourceInterval:[2256,2264]},"hexDigit",[]],["app",{sourceInterval:[2265,2273]},"hexDigit",[]],["app",{sourceInterval:[2274,2282]},"hexDigit",[]],["app",{sourceInterval:[2283,2291]},"hexDigit",[]]]],escapeChar_hexEscape:["define",{sourceInterval:[2316,2371]},null,[],["seq",{sourceInterval:[2316,2339]},["terminal",{sourceInterval:[2316,2321]},"\\x"],["app",{sourceInterval:[2322,2330]},"hexDigit",[]],["app",{sourceInterval:[2331,2339]},"hexDigit",[]]]],escapeChar:["define",{sourceInterval:[1664,2371]},"an escape sequence",[],["alt",{sourceInterval:[1703,2371]},["app",{sourceInterval:[1703,1709]},"escapeChar_backslash",[]],["app",{sourceInterval:[1765,1771]},"escapeChar_doubleQuote",[]],["app",{sourceInterval:[1829,1835]},"escapeChar_singleQuote",[]],["app",{sourceInterval:[1893,1898]},"escapeChar_backspace",[]],["app",{sourceInterval:[1955,1960]},"escapeChar_lineFeed",[]],["app",{sourceInterval:[2016,2021]},"escapeChar_carriageReturn",[]],["app",{sourceInterval:[2083,2088]},"escapeChar_tab",[]],["app",{sourceInterval:[2139,2221]},"escapeChar_unicodeCodePoint",[]],["app",{sourceInterval:[2250,2291]},"escapeChar_unicodeEscape",[]],["app",{sourceInterval:[2316,2339]},"escapeChar_hexEscape",[]]]],space:["extend",{sourceInterval:[2375,2394]},null,[],["app",{sourceInterval:[2387,2394]},"comment",[]]],comment_singleLine:["define",{sourceInterval:[2412,2458]},null,[],["seq",{sourceInterval:[2412,2443]},["terminal",{sourceInterval:[2412,2416]},"//"],["star",{sourceInterval:[2417,2429]},["seq",{sourceInterval:[2418,2427]},["not",{sourceInterval:[2418,2423]},["terminal",{sourceInterval:[2419,2423]},"\n"]],["app",{sourceInterval:[2424,2427]},"any",[]]]],["lookahead",{sourceInterval:[2430,2443]},["alt",{sourceInterval:[2432,2442]},["terminal",{sourceInterval:[2432,2436]},"\n"],["app",{sourceInterval:[2439,2442]},"end",[]]]]]],comment_multiLine:["define",{sourceInterval:[2465,2501]},null,[],["seq",{sourceInterval:[2465,2487]},["terminal",{sourceInterval:[2465,2469]},"/*"],["star",{sourceInterval:[2470,2482]},["seq",{sourceInterval:[2471,2480]},["not",{sourceInterval:[2471,2476]},["terminal",{sourceInterval:[2472,2476]},"*/"]],["app",{sourceInterval:[2477,2480]},"any",[]]]],["terminal",{sourceInterval:[2483,2487]},"*/"]]],comment:["define",{sourceInterval:[2398,2501]},null,[],["alt",{sourceInterval:[2412,2501]},["app",{sourceInterval:[2412,2443]},"comment_singleLine",[]],["app",{sourceInterval:[2465,2487]},"comment_multiLine",[]]]],tokens:["define",{sourceInterval:[2505,2520]},null,[],["star",{sourceInterval:[2514,2520]},["app",{sourceInterval:[2514,2519]},"token",[]]]],token:["define",{sourceInterval:[2524,2600]},null,[],["alt",{sourceInterval:[2532,2600]},["app",{sourceInterval:[2532,2540]},"caseName",[]],["app",{sourceInterval:[2543,2550]},"comment",[]],["app",{sourceInterval:[2553,2558]},"ident",[]],["app",{sourceInterval:[2561,2569]},"operator",[]],["app",{sourceInterval:[2572,2583]},"punctuation",[]],["app",{sourceInterval:[2586,2594]},"terminal",[]],["app",{sourceInterval:[2597,2600]},"any",[]]]],operator:["define",{sourceInterval:[2604,2669]},null,[],["alt",{sourceInterval:[2615,2669]},["terminal",{sourceInterval:[2615,2619]},"<:"],["terminal",{sourceInterval:[2622,2625]},"="],["terminal",{sourceInterval:[2628,2632]},":="],["terminal",{sourceInterval:[2635,2639]},"+="],["terminal",{sourceInterval:[2642,2645]},"*"],["terminal",{sourceInterval:[2648,2651]},"+"],["terminal",{sourceInterval:[2654,2657]},"?"],["terminal",{sourceInterval:[2660,2663]},"~"],["terminal",{sourceInterval:[2666,2669]},"&"]]],punctuation:["define",{sourceInterval:[2673,2709]},null,[],["alt",{sourceInterval:[2687,2709]},["terminal",{sourceInterval:[2687,2690]},"<"],["terminal",{sourceInterval:[2693,2696]},">"],["terminal",{sourceInterval:[2699,2702]},","],["terminal",{sourceInterval:[2705,2709]},"--"]]]}]),fe=oe,me=$t,Ee=G,Ce=D,Fe=V,de=Wu,ve=W,ye=ae,ge=se.makeRecipe,Be=Object.create(de.PExpr.prototype);function Ie(u,t,e){var r,i,o,a=new fe,s=!1,c=(e||he).createSemantics().addOperation("visit",{Grammars:function(u){return u.children.map((function(u){return u.visit()}))},Grammar:function(u,e,n,i,o){var s=u.visit();r=a.newGrammar(s,t),e.child(0)&&e.child(0).visit(),i.children.map((function(u){return u.visit()}));var c=r.build();if(c.source=this.source.trimmed(),s in t)throw Fe.duplicateGrammarDeclaration(c,t);return t[s]=c,c},SuperGrammar:function(u,e){var n=e.visit();if("null"===n)r.withSuperGrammar(null);else{if(!t||!(n in t))throw Fe.undeclaredGrammar(n,t,e.source);r.withSuperGrammar(t[n])}},Rule_define:function(u,t,e,n,a){i=u.visit(),o=t.children.map((function(u){return u.visit()}))[0]||[],r.defaultStartRule||r.ensureSuperGrammar()===me.ProtoBuiltInRules||r.withDefaultStartRule(i);var s=a.visit(),c=e.children.map((function(u){return u.visit()}))[0],l=this.source.trimmed();return r.define(i,o,s,c,l)},Rule_override:function(u,t,e,n){i=u.visit(),o=t.children.map((function(u){return u.visit()}))[0]||[];var a=this.source.trimmed();r.ensureSuperGrammarRuleForOverriding(i,a),s=!0;var c=n.visit();return s=!1,r.override(i,o,c,null,a)},Rule_extend:function(u,t,e,n){i=u.visit(),o=t.children.map((function(u){return u.visit()}))[0]||[];var a=n.visit(),s=this.source.trimmed();return r.extend(i,o,a,null,s)},RuleBody:function(u,t){return a.alt.apply(a,(0,n.Z)(t.visit())).withSource(this.source)},OverrideRuleBody:function(u,t){var e=t.visit(),o=e.indexOf(Be);if(o>=0){var s=e.slice(0,o),c=e.slice(o+1);return c.forEach((function(u){if(u===Be)throw Fe.multipleSuperSplices(u)})),new de.Splice(r.superGrammar,i,s,c).withSource(this.source)}return a.alt.apply(a,(0,n.Z)(e)).withSource(this.source)},Formals:function(u,t,e){return t.visit()},Params:function(u,t,e){return t.visit()},Alt:function(u){return a.alt.apply(a,(0,n.Z)(u.visit())).withSource(this.source)},TopLevelTerm_inline:function(u,t){var e=i+"_"+t.visit(),n=u.visit(),c=this.source.trimmed(),l=!(r.superGrammar&&r.superGrammar.rules[e]);s&&!l?r.override(e,o,n,null,c):r.define(e,o,n,null,c);var p=o.map((function(u){return a.app(u)}));return a.app(e,p).withSource(n.source)},OverrideTopLevelTerm_superSplice:function(u){return Be},Seq:function(u){return a.seq.apply(a,(0,n.Z)(u.children.map((function(u){return u.visit()})))).withSource(this.source)},Iter_star:function(u,t){return a.star(u.visit()).withSource(this.source)},Iter_plus:function(u,t){return a.plus(u.visit()).withSource(this.source)},Iter_opt:function(u,t){return a.opt(u.visit()).withSource(this.source)},Pred_not:function(u,t){return a.not(t.visit()).withSource(this.source)},Pred_lookahead:function(u,t){return a.lookahead(t.visit()).withSource(this.source)},Lex_lex:function(u,t){return a.lex(t.visit()).withSource(this.source)},Base_application:function(u,t){var e=t.children.map((function(u){return u.visit()}))[0]||[];return a.app(u.visit(),e).withSource(this.source)},Base_range:function(u,t,e){return a.range(u.visit(),e.visit()).withSource(this.source)},Base_terminal:function(u){return a.terminal(u.visit()).withSource(this.source)},Base_paren:function(u,t,e){return t.visit()},ruleDescr:function(u,t,e){return t.visit()},ruleDescrText:function(u){return this.sourceString.trim()},caseName:function(u,t,e,r,n){return e.visit()},name:function(u,t){return this.sourceString},nameFirst:function(u){},nameRest:function(u){},terminal:function(u,t,e){return t.children.map((function(u){return u.visit()})).join("")},oneCharTerminal:function(u,t,e){return t.visit()},escapeChar:function(u){try{return Ce.unescapeCodePoint(this.sourceString)}catch(t){if(t instanceof RangeError&&t.message.startsWith("Invalid code point "))throw Fe.invalidCodePoint(u);throw t}},NonemptyListOf:function(u,t,e){return[u.visit()].concat(e.children.map((function(u){return u.visit()})))},EmptyListOf:function(){return[]},_terminal:function(){return this.sourceString}});return c(u).visit()}function xe(u,t){var e,r=Ee.extend(Ee.asNamespace(t));if("string"!==typeof u){if(!(e=u).constructor||"function"!==typeof e.constructor.isBuffer||!e.constructor.isBuffer(e))throw new TypeError("Expected string as first argument, got "+Ce.unexpectedObjToString(u));u=u.toString()}return function(u,t){var e=he.match(u,"Grammars");if(e.failed())throw Fe.grammarSyntaxError(e);Ie(e,t)}(u,r),r}c.exports={createNamespace:Ee.createNamespace,grammar:function(u,t){var e=xe(u,t),r=Object.keys(e);if(0===r.length)throw new Error("Missing grammar definition");if(r.length>1){var n=e[r[1]].source;throw new Error(ve.getLineAndColumnMessage(n.sourceString,n.startIdx)+"Found more than one grammar definition -- use ohm.grammars() instead.")}return e[r[0]]},grammars:xe,grammarFromScriptElement:function(u){throw new Error("grammarFromScriptElement was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.")},grammarsFromScriptElements:function(u){throw new Error("grammarsFromScriptElements was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.")},makeRecipe:ge,ohmGrammar:null,pexprs:de,util:ve,version:ye},c.exports._buildGrammar=Ie,ve.announceBuiltInRules(me.BuiltInRules),c.exports.ohmGrammar=he=Ae,me.initApplicationParser(he,Ie);var be=c.exports,Se=D.assert;function we(u,t,e){return e(t[u])}function _e(u,t,e){return t[u].map(e)}function Oe(u){var t=u.split(/ ?\[\]/);return 2===t.length?_e.bind(null,t[0]):we.bind(null,u)}function Ne(u,t,e){return u.map((function(u){return u(t,e)}))}function Re(u){return/^[a-zA-Z_][0-9a-zA-Z_]*$/.test(u)}function Le(u){return u.trim()}function Pe(u){var t=this;this._shapes=u.shapes,this._getTag=u.getTag,this.Adapter=function(u,t){this._adaptee=u,this._family=t},this.Adapter.prototype.valueOf=function(){throw new Error("heeey!")},this.operations={},this._arities=Object.create(null),this._getChildren=Object.create(null),Object.keys(this._shapes).forEach((function(u){var e=t._shapes[u];t._getChildren[u]=function(u){return"string"===typeof u?Ne.bind(null,[Oe(u)]):Array.isArray(u)?Ne.bind(null,u.map(Oe)):(Se("function"===typeof u,"Expected a string, Array, or function"),Se(2===u.length,"Expected a function of arity 2, got "+u.length),u)}(e),"function"!==typeof e&&(t._arities[u]=Array.isArray(e)?e.length:1)})),this._wrap=function(u){return new t.Adapter(u,t)}}Pe.prototype.wrap=function(u){return this._wrap(u)},Pe.prototype._checkActionDict=function(u){var t=this;Object.keys(u).forEach((function(e){Se(e in t._getChildren,"Unrecognized action name '"+e+"'");var r=u[e];if(Se("function"===typeof r,"Key '"+e+"': expected function, got "+r),e in t._arities){var n=t._arities[e],i=u[e].length;Se(i===n,"Action '"+e+"' has the wrong arity: expected "+n+", got "+i)}}))},Pe.prototype.addOperation=function(u,t){var e=function(u){var t=u.split(/[()]/).map(Le);if(3===t.length&&""===t[2]){var e=t[0],r=[];if(t[1].length>0&&(r=t[1].split(",").map(Le)),Re(e)&&r.every(Re))return{name:e,formals:r}}throw new Error("Invalid operation signature: "+u)}(u),n=e.name;this._checkActionDict(t),this.operations[n]={name:n,formals:e.formals,actions:t};var i=this;return this.Adapter.prototype[n]=function(){var u=i._getTag(this._adaptee);Se(u in i._getChildren,"getTag returned unrecognized tag '"+u+"'"),Se(u in t,"No action for '"+u+"' in operation '"+n+"'");for(var o=Object.create(null),a=arguments.length,s=new Array(a),c=0;c0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),u.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(u){return this._throwIfClosed(),this._checkFinalizedStatuses(u),this._innerSubscribe(u)},t.prototype._innerSubscribe=function(u){var t=this,e=this,r=e.hasError,n=e.isStopped,i=e.observers;return r||n?c:(this.currentObservers=null,i.push(u),new s((function(){t.currentObservers=null,a(i,u)})))},t.prototype._checkFinalizedStatuses=function(u){var t=this,e=t.hasError,r=t.thrownError,n=t.isStopped;e?u.error(r):n&&u.complete()},t.prototype.asObservable=function(){var u=new _;return u.source=this,u},t.create=function(u,t){return new L(u,t)},t}(_),L=function(u){function t(t,e){var r=u.call(this)||this;return r.destination=t,r.source=e,r}return(0,r.ZT)(t,u),t.prototype.next=function(u){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===e||e.call(t,u)},t.prototype.error=function(u){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===e||e.call(t,u)},t.prototype.complete=function(){var u,t;null===(t=null===(u=this.destination)||void 0===u?void 0:u.complete)||void 0===t||t.call(u)},t.prototype._subscribe=function(u){var t,e;return null!==(e=null===(t=this.source)||void 0===t?void 0:t.subscribe(u))&&void 0!==e?e:c},t}(R)},4558:function(u,t,e){e.d(t,{CR:function(){return o},XA:function(){return i},ZT:function(){return n},ev:function(){return a}});var r=function(u,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,t){u.__proto__=t}||function(u,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(u[e]=t[e])},r(u,t)};function n(u,t){if("function"!==typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=u}r(u,t),u.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}Object.create;function i(u){var t="function"===typeof Symbol&&Symbol.iterator,e=t&&u[t],r=0;if(e)return e.call(u);if(u&&"number"===typeof u.length)return{next:function(){return u&&r>=u.length&&(u=void 0),{value:u&&u[r++],done:!u}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(u,t){var e="function"===typeof Symbol&&u[Symbol.iterator];if(!e)return u;var r,n,i=e.call(u),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(a){n={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}return o}function a(u,t,e){if(e||2===arguments.length)for(var r,n=0,i=t.length;n]+)>/g,(function(u,t){var e=i[t];return"$"+(Array.isArray(e)?e.join("$"):e)})))}if("function"==typeof n){var o=this;return u[Symbol.replace].call(this,e,(function(){var u=arguments;return"object"!=(0,r.Z)(u[u.length-1])&&(u=[].slice.call(u)).push(a(u,o)),n.apply(this,u)}))}return u[Symbol.replace].call(this,e,n)},o.apply(this,arguments)}},4408:function(u,t,e){e.d(t,{j:function(){return r}});var r=function(u){if(function(u){return"function"===typeof(null===u||void 0===u?void 0:u.toString)||"string"===typeof u}(u)){var t=u.toString();return"[object Object]"===t?JSON.stringify(u):t}return JSON.stringify(u)}},1585:function(u,t,e){function r(u,t){for(var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=[],n=u;n\nvar main$1 = {exports: {}};\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n/*\n `Failure`s represent expressions that weren't matched while parsing. They are used to generate\n error messages automatically. The interface of `Failure`s includes the collowing methods:\n\n - getText() : String\n - getType() : String (one of {\"description\", \"string\", \"code\"})\n - isDescription() : bool\n - isStringTerminal() : bool\n - isCode() : bool\n - isFluffy() : bool\n - makeFluffy() : void\n - subsumes(Failure) : bool\n*/\n\nfunction isValidType(type) {\n return type === 'description' || type === 'string' || type === 'code';\n}\n\nfunction Failure$2(pexpr, text, type) {\n if (!isValidType(type)) {\n throw new Error('invalid Failure type: ' + type);\n }\n this.pexpr = pexpr;\n this.text = text;\n this.type = type;\n this.fluffy = false;\n}\n\nFailure$2.prototype.getPExpr = function() {\n return this.pexpr;\n};\n\nFailure$2.prototype.getText = function() {\n return this.text;\n};\n\nFailure$2.prototype.getType = function() {\n return this.type;\n};\n\nFailure$2.prototype.isDescription = function() {\n return this.type === 'description';\n};\n\nFailure$2.prototype.isStringTerminal = function() {\n return this.type === 'string';\n};\n\nFailure$2.prototype.isCode = function() {\n return this.type === 'code';\n};\n\nFailure$2.prototype.isFluffy = function() {\n return this.fluffy;\n};\n\nFailure$2.prototype.makeFluffy = function() {\n this.fluffy = true;\n};\n\nFailure$2.prototype.clearFluffy = function() {\n this.fluffy = false;\n};\n\nFailure$2.prototype.subsumes = function(that) {\n return (\n this.getText() === that.getText() &&\n this.type === that.type &&\n (!this.isFluffy() || (this.isFluffy() && that.isFluffy()))\n );\n};\n\nFailure$2.prototype.toString = function() {\n return this.type === 'string' ? JSON.stringify(this.getText()) : this.getText();\n};\n\nFailure$2.prototype.clone = function() {\n const failure = new Failure$2(this.pexpr, this.text, this.type);\n if (this.isFluffy()) {\n failure.makeFluffy();\n }\n return failure;\n};\n\nFailure$2.prototype.toKey = function() {\n return this.toString() + '#' + this.type;\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Failure_1 = Failure$2;\n\nvar common$l = {};\n\n(function (exports) {\n\n// --------------------------------------------------------------------\n// Private Stuff\n// --------------------------------------------------------------------\n\n// Helpers\n\nconst escapeStringFor = {};\nfor (let c = 0; c < 128; c++) {\n escapeStringFor[c] = String.fromCharCode(c);\n}\nescapeStringFor[\"'\".charCodeAt(0)] = \"\\\\'\";\nescapeStringFor['\"'.charCodeAt(0)] = '\\\\\"';\nescapeStringFor['\\\\'.charCodeAt(0)] = '\\\\\\\\';\nescapeStringFor['\\b'.charCodeAt(0)] = '\\\\b';\nescapeStringFor['\\f'.charCodeAt(0)] = '\\\\f';\nescapeStringFor['\\n'.charCodeAt(0)] = '\\\\n';\nescapeStringFor['\\r'.charCodeAt(0)] = '\\\\r';\nescapeStringFor['\\t'.charCodeAt(0)] = '\\\\t';\nescapeStringFor['\\u000b'.charCodeAt(0)] = '\\\\v';\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nexports.abstract = function(optMethodName) {\n const methodName = optMethodName || '';\n return function() {\n throw new Error(\n 'this method ' +\n methodName +\n ' is abstract! ' +\n '(it has no implementation in class ' +\n this.constructor.name +\n ')'\n );\n };\n};\n\nexports.assert = function(cond, message) {\n if (!cond) {\n throw new Error(message || 'Assertion failed');\n }\n};\n\n// Define a lazily-computed, non-enumerable property named `propName`\n// on the object `obj`. `getterFn` will be called to compute the value the\n// first time the property is accessed.\nexports.defineLazyProperty = function(obj, propName, getterFn) {\n let memo;\n Object.defineProperty(obj, propName, {\n get() {\n if (!memo) {\n memo = getterFn.call(this);\n }\n return memo;\n },\n });\n};\n\nexports.clone = function(obj) {\n if (obj) {\n return Object.assign({}, obj);\n }\n return obj;\n};\n\nexports.repeatFn = function(fn, n) {\n const arr = [];\n while (n-- > 0) {\n arr.push(fn());\n }\n return arr;\n};\n\nexports.repeatStr = function(str, n) {\n return new Array(n + 1).join(str);\n};\n\nexports.repeat = function(x, n) {\n return exports.repeatFn(() => x, n);\n};\n\nexports.getDuplicates = function(array) {\n const duplicates = [];\n for (let idx = 0; idx < array.length; idx++) {\n const x = array[idx];\n if (array.lastIndexOf(x) !== idx && duplicates.indexOf(x) < 0) {\n duplicates.push(x);\n }\n }\n return duplicates;\n};\n\nexports.copyWithoutDuplicates = function(array) {\n const noDuplicates = [];\n array.forEach(entry => {\n if (noDuplicates.indexOf(entry) < 0) {\n noDuplicates.push(entry);\n }\n });\n return noDuplicates;\n};\n\nexports.isSyntactic = function(ruleName) {\n const firstChar = ruleName[0];\n return firstChar === firstChar.toUpperCase();\n};\n\nexports.isLexical = function(ruleName) {\n return !exports.isSyntactic(ruleName);\n};\n\nexports.padLeft = function(str, len, optChar) {\n const ch = optChar || ' ';\n if (str.length < len) {\n return exports.repeatStr(ch, len - str.length) + str;\n }\n return str;\n};\n\n// StringBuffer\n\nexports.StringBuffer = function() {\n this.strings = [];\n};\n\nexports.StringBuffer.prototype.append = function(str) {\n this.strings.push(str);\n};\n\nexports.StringBuffer.prototype.contents = function() {\n return this.strings.join('');\n};\n\nconst escapeUnicode = str => String.fromCodePoint(parseInt(str, 16));\n\nexports.unescapeCodePoint = function(s) {\n if (s.charAt(0) === '\\\\') {\n switch (s.charAt(1)) {\n case 'b':\n return '\\b';\n case 'f':\n return '\\f';\n case 'n':\n return '\\n';\n case 'r':\n return '\\r';\n case 't':\n return '\\t';\n case 'v':\n return '\\v';\n case 'x':\n return escapeUnicode(s.slice(2, 4));\n case 'u':\n return s.charAt(2) === '{' ?\n escapeUnicode(s.slice(3, -1)) :\n escapeUnicode(s.slice(2, 6));\n default:\n return s.charAt(1);\n }\n } else {\n return s;\n }\n};\n\n// Helper for producing a description of an unknown object in a safe way.\n// Especially useful for error messages where an unexpected type of object was encountered.\nexports.unexpectedObjToString = function(obj) {\n if (obj == null) {\n return String(obj);\n }\n const baseToString = Object.prototype.toString.call(obj);\n try {\n let typeName;\n if (obj.constructor && obj.constructor.name) {\n typeName = obj.constructor.name;\n } else if (baseToString.indexOf('[object ') === 0) {\n typeName = baseToString.slice(8, -1); // Extract e.g. \"Array\" from \"[object Array]\".\n } else {\n typeName = typeof obj;\n }\n return typeName + ': ' + JSON.stringify(String(obj));\n } catch (e) {\n return baseToString;\n }\n};\n}(common$l));\n\nconst common$k = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nclass Node {\n constructor(matchLength) {\n this.matchLength = matchLength;\n }\n\n get ctorName() {\n throw new Error('subclass responsibility');\n }\n\n numChildren() {\n return this.children ? this.children.length : 0;\n }\n\n childAt(idx) {\n if (this.children) {\n return this.children[idx];\n }\n }\n\n indexOfChild(arg) {\n return this.children.indexOf(arg);\n }\n\n hasChildren() {\n return this.numChildren() > 0;\n }\n\n hasNoChildren() {\n return !this.hasChildren();\n }\n\n onlyChild() {\n if (this.numChildren() !== 1) {\n throw new Error(\n 'cannot get only child of a node of type ' +\n this.ctorName +\n ' (it has ' +\n this.numChildren() +\n ' children)'\n );\n } else {\n return this.firstChild();\n }\n }\n\n firstChild() {\n if (this.hasNoChildren()) {\n throw new Error(\n 'cannot get first child of a ' + this.ctorName + ' node, which has no children'\n );\n } else {\n return this.childAt(0);\n }\n }\n\n lastChild() {\n if (this.hasNoChildren()) {\n throw new Error(\n 'cannot get last child of a ' + this.ctorName + ' node, which has no children'\n );\n } else {\n return this.childAt(this.numChildren() - 1);\n }\n }\n\n childBefore(child) {\n const childIdx = this.indexOfChild(child);\n if (childIdx < 0) {\n throw new Error('Node.childBefore() called w/ an argument that is not a child');\n } else if (childIdx === 0) {\n throw new Error('cannot get child before first child');\n } else {\n return this.childAt(childIdx - 1);\n }\n }\n\n childAfter(child) {\n const childIdx = this.indexOfChild(child);\n if (childIdx < 0) {\n throw new Error('Node.childAfter() called w/ an argument that is not a child');\n } else if (childIdx === this.numChildren() - 1) {\n throw new Error('cannot get child after last child');\n } else {\n return this.childAt(childIdx + 1);\n }\n }\n\n isTerminal() {\n return false;\n }\n\n isNonterminal() {\n return false;\n }\n\n isIteration() {\n return false;\n }\n\n isOptional() {\n return false;\n }\n}\n\n// Terminals\n\nclass TerminalNode$2 extends Node {\n get ctorName() {\n return '_terminal';\n }\n\n isTerminal() {\n return true;\n }\n\n get primitiveValue() {\n throw new Error('The `primitiveValue` property was removed in Ohm v17.');\n }\n}\n\n// Nonterminals\n\nclass NonterminalNode$1 extends Node {\n constructor(ruleName, children, childOffsets, matchLength) {\n super(matchLength);\n this.ruleName = ruleName;\n this.children = children;\n this.childOffsets = childOffsets;\n }\n\n get ctorName() {\n return this.ruleName;\n }\n\n isNonterminal() {\n return true;\n }\n\n isLexical() {\n return common$k.isLexical(this.ctorName);\n }\n\n isSyntactic() {\n return common$k.isSyntactic(this.ctorName);\n }\n}\n\n// Iterations\n\nclass IterationNode$2 extends Node {\n constructor(children, childOffsets, matchLength, isOptional) {\n super(matchLength);\n this.children = children;\n this.childOffsets = childOffsets;\n this.optional = isOptional;\n }\n\n get ctorName() {\n return '_iter';\n }\n\n isIteration() {\n return true;\n }\n\n isOptional() {\n return this.optional;\n }\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar nodes$1 = {\n Node,\n TerminalNode: TerminalNode$2,\n NonterminalNode: NonterminalNode$1,\n IterationNode: IterationNode$2,\n};\n\nvar pexprsMain = {};\n\n// Based on https://github.com/mathiasbynens/unicode-9.0.0.\n// These are just categories that are used in ES5/ES2015.\n// The full list of Unicode categories is here: http://www.fileformat.info/info/unicode/category/index.htm.\nvar UnicodeCategories$1 = {\n // Letters\n Lu: /[A-Z\\xC0-\\xD6\\xD8-\\xDE\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C7\\u01CA\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F1\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0370\\u0372\\u0376\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E\\u038F\\u0391-\\u03A1\\u03A3-\\u03AB\\u03CF\\u03D2-\\u03D4\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F4\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0528\\u052A\\u052C\\u052E\\u0531-\\u0556\\u10A0-\\u10C5\\u10C7\\u10CD\\u13A0-\\u13F5\\u1E00\\u1E02\\u1E04\\u1E06\\u1E08\\u1E0A\\u1E0C\\u1E0E\\u1E10\\u1E12\\u1E14\\u1E16\\u1E18\\u1E1A\\u1E1C\\u1E1E\\u1E20\\u1E22\\u1E24\\u1E26\\u1E28\\u1E2A\\u1E2C\\u1E2E\\u1E30\\u1E32\\u1E34\\u1E36\\u1E38\\u1E3A\\u1E3C\\u1E3E\\u1E40\\u1E42\\u1E44\\u1E46\\u1E48\\u1E4A\\u1E4C\\u1E4E\\u1E50\\u1E52\\u1E54\\u1E56\\u1E58\\u1E5A\\u1E5C\\u1E5E\\u1E60\\u1E62\\u1E64\\u1E66\\u1E68\\u1E6A\\u1E6C\\u1E6E\\u1E70\\u1E72\\u1E74\\u1E76\\u1E78\\u1E7A\\u1E7C\\u1E7E\\u1E80\\u1E82\\u1E84\\u1E86\\u1E88\\u1E8A\\u1E8C\\u1E8E\\u1E90\\u1E92\\u1E94\\u1E9E\\u1EA0\\u1EA2\\u1EA4\\u1EA6\\u1EA8\\u1EAA\\u1EAC\\u1EAE\\u1EB0\\u1EB2\\u1EB4\\u1EB6\\u1EB8\\u1EBA\\u1EBC\\u1EBE\\u1EC0\\u1EC2\\u1EC4\\u1EC6\\u1EC8\\u1ECA\\u1ECC\\u1ECE\\u1ED0\\u1ED2\\u1ED4\\u1ED6\\u1ED8\\u1EDA\\u1EDC\\u1EDE\\u1EE0\\u1EE2\\u1EE4\\u1EE6\\u1EE8\\u1EEA\\u1EEC\\u1EEE\\u1EF0\\u1EF2\\u1EF4\\u1EF6\\u1EF8\\u1EFA\\u1EFC\\u1EFE\\u1F08-\\u1F0F\\u1F18-\\u1F1D\\u1F28-\\u1F2F\\u1F38-\\u1F3F\\u1F48-\\u1F4D\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F68-\\u1F6F\\u1FB8-\\u1FBB\\u1FC8-\\u1FCB\\u1FD8-\\u1FDB\\u1FE8-\\u1FEC\\u1FF8-\\u1FFB\\u2102\\u2107\\u210B-\\u210D\\u2110-\\u2112\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u2130-\\u2133\\u213E\\u213F\\u2145\\u2183\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\u2CF2\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA698\\uA69A\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA792\\uA796\\uA798\\uA79A\\uA79C\\uA79E\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uA7AA-\\uA7AE\\uA7B0-\\uA7B4\\uA7B6\\uFF21-\\uFF3A]|\\uD801[\\uDC00-\\uDC27\\uDCB0-\\uDCD3]|\\uD803[\\uDC80-\\uDCB2]|\\uD806[\\uDCA0-\\uDCBF]|\\uD835[\\uDC00-\\uDC19\\uDC34-\\uDC4D\\uDC68-\\uDC81\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB5\\uDCD0-\\uDCE9\\uDD04\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD38\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD6C-\\uDD85\\uDDA0-\\uDDB9\\uDDD4-\\uDDED\\uDE08-\\uDE21\\uDE3C-\\uDE55\\uDE70-\\uDE89\\uDEA8-\\uDEC0\\uDEE2-\\uDEFA\\uDF1C-\\uDF34\\uDF56-\\uDF6E\\uDF90-\\uDFA8\\uDFCA]|\\uD83A[\\uDD00-\\uDD21]/,\n Ll: /[a-z\\xB5\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0529\\u052B\\u052D\\u052F\\u0561-\\u0587\\u13F8-\\u13FD\\u1C80-\\u1C88\\u1D00-\\u1D2B\\u1D6B-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1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\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3\\u2CE4\\u2CEC\\u2CEE\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA699\\uA69B\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA793-\\uA795\\uA797\\uA799\\uA79B\\uA79D\\uA79F\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7B5\\uA7B7\\uA7FA\\uAB30-\\uAB5A\\uAB60-\\uAB65\\uAB70-\\uABBF\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A]|\\uD801[\\uDC28-\\uDC4F\\uDCD8-\\uDCFB]|\\uD803[\\uDCC0-\\uDCF2]|\\uD806[\\uDCC0-\\uDCDF]|\\uD835[\\uDC1A-\\uDC33\\uDC4E-\\uDC54\\uDC56-\\uDC67\\uDC82-\\uDC9B\\uDCB6-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDCCF\\uDCEA-\\uDD03\\uDD1E-\\uDD37\\uDD52-\\uDD6B\\uDD86-\\uDD9F\\uDDBA-\\uDDD3\\uDDEE-\\uDE07\\uDE22-\\uDE3B\\uDE56-\\uDE6F\\uDE8A-\\uDEA5\\uDEC2-\\uDEDA\\uDEDC-\\uDEE1\\uDEFC-\\uDF14\\uDF16-\\uDF1B\\uDF36-\\uDF4E\\uDF50-\\uDF55\\uDF70-\\uDF88\\uDF8A-\\uDF8F\\uDFAA-\\uDFC2\\uDFC4-\\uDFC9\\uDFCB]|\\uD83A[\\uDD22-\\uDD43]/,\n Lt: /[\\u01C5\\u01C8\\u01CB\\u01F2\\u1F88-\\u1F8F\\u1F98-\\u1F9F\\u1FA8-\\u1FAF\\u1FBC\\u1FCC\\u1FFC]/,\n Lm: /[\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D6A\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA69C\\uA69D\\uA717-\\uA71F\\uA770\\uA788\\uA7F8\\uA7F9\\uA9CF\\uA9E6\\uAA70\\uAADD\\uAAF3\\uAAF4\\uAB5C-\\uAB5F\\uFF70\\uFF9E\\uFF9F]|\\uD81A[\\uDF40-\\uDF43]|\\uD81B[\\uDF93-\\uDF9F\\uDFE0]/,\n Lo: /[\\xAA\\xBA\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10D0-\\u10FA\\u10FD-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u2135-\\u2138\\u2D30-\\u2D67\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA014\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA500-\\uA60B\\uA610-\\uA61F\\uA62A\\uA62B\\uA66E\\uA6A0-\\uA6E5\\uA78F\\uA7F7\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9E0-\\uA9E4\\uA9E7-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA6F\\uAA71-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB\\uAADC\\uAAE0-\\uAAEA\\uAAF2\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\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\uDD03-\\uDD26\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCFF\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD83A[\\uDC00-\\uDCC4]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1]|\\uD87E[\\uDC00-\\uDE1D]/,\n\n // Numbers\n Nl: /[\\u16EE-\\u16F0\\u2160-\\u2182\\u2185-\\u2188\\u3007\\u3021-\\u3029\\u3038-\\u303A\\uA6E6-\\uA6EF]|\\uD800[\\uDD40-\\uDD74\\uDF41\\uDF4A\\uDFD1-\\uDFD5]|\\uD809[\\uDC00-\\uDC6E]/,\n Nd: /[0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]|\\uD801[\\uDCA0-\\uDCA9]|\\uD804[\\uDC66-\\uDC6F\\uDCF0-\\uDCF9\\uDD36-\\uDD3F\\uDDD0-\\uDDD9\\uDEF0-\\uDEF9]|[\\uD805\\uD807][\\uDC50-\\uDC59\\uDCD0-\\uDCD9\\uDE50-\\uDE59\\uDEC0-\\uDEC9\\uDF30-\\uDF39]|\\uD806[\\uDCE0-\\uDCE9]|\\uD81A[\\uDE60-\\uDE69\\uDF50-\\uDF59]|\\uD835[\\uDFCE-\\uDFFF]|\\uD83A[\\uDD50-\\uDD59]/,\n\n // Marks\n Mn: /[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D4-\\u08E1\\u08E3-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C00\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D01\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4\\u17B5\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u1885\\u1886\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A1B\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1AB0-\\u1ABD\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BAB-\\u1BAD\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1CF4\\u1CF8\\u1CF9\\u1DC0-\\u1DF5\\u1DFB-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u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u0CD5-\\u0CD6]|[\\u0D02-\\u0D03]|[\\u0D3E-\\u0D40]|[\\u0D46-\\u0D48]|[\\u0D4A-\\u0D4C]|[\\u0D57-\\u0D57]|[\\u0F3E-\\u0F3F]|[\\u0F7F-\\u0F7F]/,\n\n // Punctuation, Connector\n Pc: /[_\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]/,\n\n // Separator, Space\n Zs: /[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/,\n\n // These two are not real Unicode categories, but our useful for Ohm.\n // L is a combination of all the letter categories.\n // Ltmo is a combination of Lt, Lm, and Lo.\n L: /[A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\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-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\u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E79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1]|\\uD87E[\\uDC00-\\uDE1D]/,\n Ltmo: /[\\u01C5\\u01C8\\u01CB\\u01F2\\u1F88-\\u1F8F\\u1F98-\\u1F9F\\u1FA8-\\u1FAF\\u1FBC\\u1FCC\\u1FFC]|[\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D6A\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA69C\\uA69D\\uA717-\\uA71F\\uA770\\uA788\\uA7F8\\uA7F9\\uA9CF\\uA9E6\\uAA70\\uAADD\\uAAF3\\uAAF4\\uAB5C-\\uAB5F\\uFF70\\uFF9E\\uFF9F]|\\uD81A[\\uDF40-\\uDF43]|\\uD81B[\\uDF93-\\uDF9F\\uDFE0]|[\\xAA\\xBA\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10D0-\\u10FA\\u10FD-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u2135-\\u2138\\u2D30-\\u2D67\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA014\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA500-\\uA60B\\uA610-\\uA61F\\uA62A\\uA62B\\uA66E\\uA6A0-\\uA6E5\\uA78F\\uA7F7\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9E0-\\uA9E4\\uA9E7-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA6F\\uAA71-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB\\uAADC\\uAAE0-\\uAAEA\\uAAF2\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\u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\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCFF\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD83A[\\uDC00-\\uDCC4]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1]|\\uD87E[\\uDC00-\\uDE1D]/\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst UnicodeCategories = UnicodeCategories$1;\nconst common$j = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// General stuff\n\nclass PExpr$1 {\n constructor() {\n if (this.constructor === PExpr$1) {\n throw new Error(\"PExpr cannot be instantiated -- it's abstract\");\n }\n }\n\n // Set the `source` property to the interval containing the source for this expression.\n withSource(interval) {\n if (interval) {\n this.source = interval.trimmed();\n }\n return this;\n }\n}\n\n// Any\n\nconst any = Object.create(PExpr$1.prototype);\n\n// End\n\nconst end = Object.create(PExpr$1.prototype);\n\n// Terminals\n\nclass Terminal$1 extends PExpr$1 {\n constructor(obj) {\n super();\n this.obj = obj;\n }\n}\n\n// Ranges\n\nclass Range extends PExpr$1 {\n constructor(from, to) {\n super();\n this.from = from;\n this.to = to;\n // If either `from` or `to` is made up of multiple code units, then\n // the range should consume a full code point, not a single code unit.\n this.matchCodePoint = from.length > 1 || to.length > 1;\n }\n}\n\n// Parameters\n\nclass Param extends PExpr$1 {\n constructor(index) {\n super();\n this.index = index;\n }\n}\n\n// Alternation\n\nclass Alt extends PExpr$1 {\n constructor(terms) {\n super();\n this.terms = terms;\n }\n}\n\n// Extend is an implementation detail of rule extension\n\nclass Extend extends Alt {\n constructor(superGrammar, name, body) {\n const origBody = superGrammar.rules[name].body;\n super([body, origBody]);\n\n this.superGrammar = superGrammar;\n this.name = name;\n this.body = body;\n }\n}\n\n// Splice is an implementation detail of rule overriding with the `...` operator.\nclass Splice extends Alt {\n constructor(superGrammar, ruleName, beforeTerms, afterTerms) {\n const origBody = superGrammar.rules[ruleName].body;\n super([...beforeTerms, origBody, ...afterTerms]);\n\n this.superGrammar = superGrammar;\n this.ruleName = ruleName;\n this.expansionPos = beforeTerms.length;\n }\n}\n\n// Sequences\n\nclass Seq extends PExpr$1 {\n constructor(factors) {\n super();\n this.factors = factors;\n }\n}\n\n// Iterators and optionals\n\nclass Iter extends PExpr$1 {\n constructor(expr) {\n super();\n this.expr = expr;\n }\n}\n\nclass Star extends Iter {}\nclass Plus extends Iter {}\nclass Opt extends Iter {}\n\nStar.prototype.operator = '*';\nPlus.prototype.operator = '+';\nOpt.prototype.operator = '?';\n\nStar.prototype.minNumMatches = 0;\nPlus.prototype.minNumMatches = 1;\nOpt.prototype.minNumMatches = 0;\n\nStar.prototype.maxNumMatches = Number.POSITIVE_INFINITY;\nPlus.prototype.maxNumMatches = Number.POSITIVE_INFINITY;\nOpt.prototype.maxNumMatches = 1;\n\n// Predicates\n\nclass Not extends PExpr$1 {\n constructor(expr) {\n super();\n this.expr = expr;\n }\n}\n\nclass Lookahead extends PExpr$1 {\n constructor(expr) {\n super();\n this.expr = expr;\n }\n}\n\n// \"Lexification\"\n\nclass Lex extends PExpr$1 {\n constructor(expr) {\n super();\n this.expr = expr;\n }\n}\n\n// Rule application\n\nclass Apply extends PExpr$1 {\n constructor(ruleName, args = []) {\n super();\n this.ruleName = ruleName;\n this.args = args;\n }\n\n isSyntactic() {\n return common$j.isSyntactic(this.ruleName);\n }\n\n // This method just caches the result of `this.toString()` in a non-enumerable property.\n toMemoKey() {\n if (!this._memoKey) {\n Object.defineProperty(this, '_memoKey', {value: this.toString()});\n }\n return this._memoKey;\n }\n}\n\n// Unicode character\n\nclass UnicodeChar extends PExpr$1 {\n constructor(category) {\n super();\n this.category = category;\n this.pattern = UnicodeCategories[category];\n }\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\npexprsMain.PExpr = PExpr$1;\npexprsMain.any = any;\npexprsMain.end = end;\npexprsMain.Terminal = Terminal$1;\npexprsMain.Range = Range;\npexprsMain.Param = Param;\npexprsMain.Alt = Alt;\npexprsMain.Extend = Extend;\npexprsMain.Splice = Splice;\npexprsMain.Seq = Seq;\npexprsMain.Iter = Iter;\npexprsMain.Star = Star;\npexprsMain.Plus = Plus;\npexprsMain.Opt = Opt;\npexprsMain.Not = Not;\npexprsMain.Lookahead = Lookahead;\npexprsMain.Lex = Lex;\npexprsMain.Apply = Apply;\npexprsMain.UnicodeChar = UnicodeChar;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$i = common$l;\nconst pexprs$l = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Return true if we should skip spaces preceding this expression in a syntactic context.\n*/\npexprs$l.PExpr.prototype.allowsSkippingPrecedingSpace = common$i.abstract(\n 'allowsSkippingPrecedingSpace'\n);\n\n/*\n Generally, these are all first-order expressions and (with the exception of Apply)\n directly read from the input stream.\n*/\npexprs$l.any.allowsSkippingPrecedingSpace =\n pexprs$l.end.allowsSkippingPrecedingSpace =\n pexprs$l.Apply.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Terminal.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Range.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.UnicodeChar.prototype.allowsSkippingPrecedingSpace =\n function() {\n return true;\n };\n\n/*\n Higher-order expressions that don't directly consume input.\n*/\npexprs$l.Alt.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Iter.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Lex.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Lookahead.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Not.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Param.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Seq.prototype.allowsSkippingPrecedingSpace =\n function() {\n return false;\n };\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction Namespace$2() {}\nNamespace$2.prototype = Object.create(null);\n\nNamespace$2.asNamespace = function(objOrNamespace) {\n if (objOrNamespace instanceof Namespace$2) {\n return objOrNamespace;\n }\n return Namespace$2.createNamespace(objOrNamespace);\n};\n\n// Create a new namespace. If `optProps` is specified, all of its properties\n// will be copied to the new namespace.\nNamespace$2.createNamespace = function(optProps) {\n return Namespace$2.extend(Namespace$2.prototype, optProps);\n};\n\n// Create a new namespace which extends another namespace. If `optProps` is\n// specified, all of its properties will be copied to the new namespace.\nNamespace$2.extend = function(namespace, optProps) {\n if (namespace !== Namespace$2.prototype && !(namespace instanceof Namespace$2)) {\n throw new TypeError('not a Namespace object: ' + namespace);\n }\n const ns = Object.create(namespace, {\n constructor: {\n value: Namespace$2,\n enumerable: false,\n writable: true,\n configurable: true,\n },\n });\n return Object.assign(ns, optProps);\n};\n\n// TODO: Should this be a regular method?\nNamespace$2.toString = function(ns) {\n return Object.prototype.toString.call(ns);\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Namespace_1 = Namespace$2;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst {assert: assert$3} = common$l;\nconst Namespace$1 = Namespace_1;\nconst pexprs$k = pexprsMain;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction createError(message, optInterval) {\n let e;\n if (optInterval) {\n e = new Error(optInterval.getLineAndColumnMessage() + message);\n e.shortMessage = message;\n e.interval = optInterval;\n } else {\n e = new Error(message);\n }\n return e;\n}\n\n// ----------------- errors about intervals -----------------\n\nfunction intervalSourcesDontMatch() {\n return createError(\"Interval sources don't match\");\n}\n\n// ----------------- errors about grammars -----------------\n\n// Grammar syntax error\n\nfunction grammarSyntaxError(matchFailure) {\n const e = new Error();\n Object.defineProperty(e, 'message', {\n enumerable: true,\n get() {\n return matchFailure.message;\n },\n });\n Object.defineProperty(e, 'shortMessage', {\n enumerable: true,\n get() {\n return 'Expected ' + matchFailure.getExpectedText();\n },\n });\n e.interval = matchFailure.getInterval();\n return e;\n}\n\n// Undeclared grammar\n\nfunction undeclaredGrammar(grammarName, namespace, interval) {\n const message = namespace ?\n 'Grammar ' +\n grammarName +\n ' is not declared in namespace ' +\n Namespace$1.toString(namespace) :\n 'Undeclared grammar ' + grammarName;\n return createError(message, interval);\n}\n\n// Duplicate grammar declaration\n\nfunction duplicateGrammarDeclaration(grammar, namespace) {\n return createError('Grammar ' + grammar.name + ' is already declared in this namespace');\n}\n\n// ----------------- rules -----------------\n\n// Undeclared rule\n\nfunction undeclaredRule(ruleName, grammarName, optInterval) {\n return createError(\n 'Rule ' + ruleName + ' is not declared in grammar ' + grammarName,\n optInterval\n );\n}\n\n// Cannot override undeclared rule\n\nfunction cannotOverrideUndeclaredRule(ruleName, grammarName, optSource) {\n return createError(\n 'Cannot override rule ' + ruleName + ' because it is not declared in ' + grammarName,\n optSource\n );\n}\n\n// Cannot extend undeclared rule\n\nfunction cannotExtendUndeclaredRule(ruleName, grammarName, optSource) {\n return createError(\n 'Cannot extend rule ' + ruleName + ' because it is not declared in ' + grammarName,\n optSource\n );\n}\n\n// Duplicate rule declaration\n\nfunction duplicateRuleDeclaration(ruleName, grammarName, declGrammarName, optSource) {\n let message =\n \"Duplicate declaration for rule '\" + ruleName + \"' in grammar '\" + grammarName + \"'\";\n if (grammarName !== declGrammarName) {\n message += \" (originally declared in '\" + declGrammarName + \"')\";\n }\n return createError(message, optSource);\n}\n\n// Wrong number of parameters\n\nfunction wrongNumberOfParameters(ruleName, expected, actual, source) {\n return createError(\n 'Wrong number of parameters for rule ' +\n ruleName +\n ' (expected ' +\n expected +\n ', got ' +\n actual +\n ')',\n source\n );\n}\n\n// Wrong number of arguments\n\nfunction wrongNumberOfArguments(ruleName, expected, actual, expr) {\n return createError(\n 'Wrong number of arguments for rule ' +\n ruleName +\n ' (expected ' +\n expected +\n ', got ' +\n actual +\n ')',\n expr\n );\n}\n\n// Duplicate parameter names\n\nfunction duplicateParameterNames(ruleName, duplicates, source) {\n return createError(\n 'Duplicate parameter names in rule ' + ruleName + ': ' + duplicates.join(', '),\n source\n );\n}\n\n// Invalid parameter expression\n\nfunction invalidParameter(ruleName, expr) {\n return createError(\n 'Invalid parameter to rule ' +\n ruleName +\n ': ' +\n expr +\n ' has arity ' +\n expr.getArity() +\n ', but parameter expressions must have arity 1',\n expr.source\n );\n}\n\n// Application of syntactic rule from lexical rule\n\nconst syntacticVsLexicalNote =\n 'NOTE: A _syntactic rule_ is a rule whose name begins with a capital letter. ' +\n 'See https://ohmjs.org/d/svl for more details.';\n\nfunction applicationOfSyntacticRuleFromLexicalContext(ruleName, applyExpr) {\n return createError(\n 'Cannot apply syntactic rule ' + ruleName + ' from here (inside a lexical context)',\n applyExpr.source\n );\n}\n\n// Lexical rule application used with applySyntactic\n\nfunction applySyntacticWithLexicalRuleApplication(applyExpr) {\n const {ruleName} = applyExpr;\n return createError(\n `applySyntactic is for syntactic rules, but '${ruleName}' is a lexical rule. ` +\n syntacticVsLexicalNote,\n applyExpr.source\n );\n}\n\n// Application of applySyntactic in a syntactic context\n\nfunction unnecessaryExperimentalApplySyntactic(applyExpr) {\n return createError(\n 'applySyntactic is not required here (in a syntactic context)',\n applyExpr.source\n );\n}\n\n// Incorrect argument type\n\nfunction incorrectArgumentType(expectedType, expr) {\n return createError('Incorrect argument type: expected ' + expectedType, expr.source);\n}\n\n// Multiple instances of the super-splice operator (`...`) in the rule body.\n\nfunction multipleSuperSplices(expr) {\n return createError(\"'...' can appear at most once in a rule body\", expr.source);\n}\n\n// Unicode code point escapes\n\nfunction invalidCodePoint(applyWrapper) {\n const node = applyWrapper._node;\n assert$3(node && node.isNonterminal() && node.ctorName === 'escapeChar_unicodeCodePoint');\n\n // Get an interval that covers all of the hex digits.\n const digitIntervals = applyWrapper.children.slice(1, -1).map(d => d.source);\n const fullInterval = digitIntervals[0].coverageWith(...digitIntervals.slice(1));\n return createError(\n `U+${fullInterval.contents} is not a valid Unicode code point`,\n fullInterval\n );\n}\n\n// ----------------- Kleene operators -----------------\n\nfunction kleeneExprHasNullableOperand(kleeneExpr, applicationStack) {\n const actuals =\n applicationStack.length > 0 ? applicationStack[applicationStack.length - 1].args : [];\n const expr = kleeneExpr.expr.substituteParams(actuals);\n let message =\n 'Nullable expression ' +\n expr +\n \" is not allowed inside '\" +\n kleeneExpr.operator +\n \"' (possible infinite loop)\";\n if (applicationStack.length > 0) {\n const stackTrace = applicationStack\n .map(app => new pexprs$k.Apply(app.ruleName, app.args))\n .join('\\n');\n message += '\\nApplication stack (most recent application last):\\n' + stackTrace;\n }\n return createError(message, kleeneExpr.expr.source);\n}\n\n// ----------------- arity -----------------\n\nfunction inconsistentArity(ruleName, expected, actual, expr) {\n return createError(\n 'Rule ' +\n ruleName +\n ' involves an alternation which has inconsistent arity ' +\n '(expected ' +\n expected +\n ', got ' +\n actual +\n ')',\n expr.source\n );\n}\n\n// ----------------- properties -----------------\n\nfunction duplicatePropertyNames(duplicates) {\n return createError('Object pattern has duplicate property names: ' + duplicates.join(', '));\n}\n\n// ----------------- constructors -----------------\n\nfunction invalidConstructorCall(grammar, ctorName, children) {\n return createError(\n 'Attempt to invoke constructor ' + ctorName + ' with invalid or unexpected arguments'\n );\n}\n\n// ----------------- convenience -----------------\n\nfunction multipleErrors(errors) {\n const messages = errors.map(e => e.message);\n return createError(['Errors:'].concat(messages).join('\\n- '), errors[0].interval);\n}\n\n// ----------------- semantic -----------------\n\nfunction missingSemanticAction(ctorName, name, type, stack) {\n let stackTrace = stack\n .slice(0, -1)\n .map(info => {\n const ans = ' ' + info[0].name + ' > ' + info[1];\n return info.length === 3 ? ans + \" for '\" + info[2] + \"'\" : ans;\n })\n .join('\\n');\n stackTrace += '\\n ' + name + ' > ' + ctorName;\n\n let moreInfo = '';\n if (ctorName === '_iter') {\n moreInfo = [\n '\\nNOTE: as of Ohm v16, there is no default action for iteration nodes — see ',\n ' https://ohmjs.org/d/dsa for details.',\n ].join('\\n');\n }\n\n const message = [\n `Missing semantic action for '${ctorName}' in ${type} '${name}'.${moreInfo}`,\n 'Action stack (most recent call last):',\n stackTrace,\n ].join('\\n');\n\n const e = createError(message);\n e.name = 'missingSemanticAction';\n return e;\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar errors$9 = {\n applicationOfSyntacticRuleFromLexicalContext,\n applySyntacticWithLexicalRuleApplication,\n cannotExtendUndeclaredRule,\n cannotOverrideUndeclaredRule,\n duplicateGrammarDeclaration,\n duplicateParameterNames,\n duplicatePropertyNames,\n duplicateRuleDeclaration,\n inconsistentArity,\n incorrectArgumentType,\n intervalSourcesDontMatch,\n invalidCodePoint,\n invalidConstructorCall,\n invalidParameter,\n grammarSyntaxError,\n kleeneExprHasNullableOperand,\n missingSemanticAction,\n multipleSuperSplices,\n undeclaredGrammar,\n undeclaredRule,\n unnecessaryExperimentalApplySyntactic,\n wrongNumberOfArguments,\n wrongNumberOfParameters,\n\n throwErrors(errors) {\n if (errors.length === 1) {\n throw errors[0];\n }\n if (errors.length > 1) {\n throw multipleErrors(errors);\n }\n },\n};\n\nvar util$7 = {};\n\n(function (exports) {\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// Given an array of numbers `arr`, return an array of the numbers as strings,\n// right-justified and padded to the same length.\nfunction padNumbersToEqualLength(arr) {\n let maxLen = 0;\n const strings = arr.map(n => {\n const str = n.toString();\n maxLen = Math.max(maxLen, str.length);\n return str;\n });\n return strings.map(s => common.padLeft(s, maxLen));\n}\n\n// Produce a new string that would be the result of copying the contents\n// of the string `src` onto `dest` at offset `offest`.\nfunction strcpy(dest, src, offset) {\n const origDestLen = dest.length;\n const start = dest.slice(0, offset);\n const end = dest.slice(offset + src.length);\n return (start + src + end).substr(0, origDestLen);\n}\n\n// Casts the underlying lineAndCol object to a formatted message string,\n// highlighting `ranges`.\nfunction lineAndColumnToMessage(...ranges) {\n const lineAndCol = this;\n const {offset} = lineAndCol;\n const {repeatStr} = common;\n\n const sb = new common.StringBuffer();\n sb.append('Line ' + lineAndCol.lineNum + ', col ' + lineAndCol.colNum + ':\\n');\n\n // An array of the previous, current, and next line numbers as strings of equal length.\n const lineNumbers = padNumbersToEqualLength([\n lineAndCol.prevLine == null ? 0 : lineAndCol.lineNum - 1,\n lineAndCol.lineNum,\n lineAndCol.nextLine == null ? 0 : lineAndCol.lineNum + 1,\n ]);\n\n // Helper for appending formatting input lines to the buffer.\n const appendLine = (num, content, prefix) => {\n sb.append(prefix + lineNumbers[num] + ' | ' + content + '\\n');\n };\n\n // Include the previous line for context if possible.\n if (lineAndCol.prevLine != null) {\n appendLine(0, lineAndCol.prevLine, ' ');\n }\n // Line that the error occurred on.\n appendLine(1, lineAndCol.line, '> ');\n\n // Build up the line that points to the offset and possible indicates one or more ranges.\n // Start with a blank line, and indicate each range by overlaying a string of `~` chars.\n const lineLen = lineAndCol.line.length;\n let indicationLine = repeatStr(' ', lineLen + 1);\n for (let i = 0; i < ranges.length; ++i) {\n let startIdx = ranges[i][0];\n let endIdx = ranges[i][1];\n common.assert(startIdx >= 0 && startIdx <= endIdx, 'range start must be >= 0 and <= end');\n\n const lineStartOffset = offset - lineAndCol.colNum + 1;\n startIdx = Math.max(0, startIdx - lineStartOffset);\n endIdx = Math.min(endIdx - lineStartOffset, lineLen);\n\n indicationLine = strcpy(indicationLine, repeatStr('~', endIdx - startIdx), startIdx);\n }\n const gutterWidth = 2 + lineNumbers[1].length + 3;\n sb.append(repeatStr(' ', gutterWidth));\n indicationLine = strcpy(indicationLine, '^', lineAndCol.colNum - 1);\n sb.append(indicationLine.replace(/ +$/, '') + '\\n');\n\n // Include the next line for context if possible.\n if (lineAndCol.nextLine != null) {\n appendLine(2, lineAndCol.nextLine, ' ');\n }\n return sb.contents();\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nlet builtInRulesCallbacks = [];\n\n// Since Grammar.BuiltInRules is bootstrapped, most of Ohm can't directly depend it.\n// This function allows modules that do depend on the built-in rules to register a callback\n// that will be called later in the initialization process.\nexports.awaitBuiltInRules = cb => {\n builtInRulesCallbacks.push(cb);\n};\n\nexports.announceBuiltInRules = grammar => {\n builtInRulesCallbacks.forEach(cb => {\n cb(grammar);\n });\n builtInRulesCallbacks = null;\n};\n\n// Return an object with the line and column information for the given\n// offset in `str`.\nexports.getLineAndColumn = (str, offset) => {\n let lineNum = 1;\n let colNum = 1;\n\n let currOffset = 0;\n let lineStartOffset = 0;\n\n let nextLine = null;\n let prevLine = null;\n let prevLineStartOffset = -1;\n\n while (currOffset < offset) {\n const c = str.charAt(currOffset++);\n if (c === '\\n') {\n lineNum++;\n colNum = 1;\n prevLineStartOffset = lineStartOffset;\n lineStartOffset = currOffset;\n } else if (c !== '\\r') {\n colNum++;\n }\n }\n\n // Find the end of the target line.\n let lineEndOffset = str.indexOf('\\n', lineStartOffset);\n if (lineEndOffset === -1) {\n lineEndOffset = str.length;\n } else {\n // Get the next line.\n const nextLineEndOffset = str.indexOf('\\n', lineEndOffset + 1);\n nextLine =\n nextLineEndOffset === -1 ?\n str.slice(lineEndOffset) :\n str.slice(lineEndOffset, nextLineEndOffset);\n // Strip leading and trailing EOL char(s).\n nextLine = nextLine.replace(/^\\r?\\n/, '').replace(/\\r$/, '');\n }\n\n // Get the previous line.\n if (prevLineStartOffset >= 0) {\n // Strip trailing EOL char(s).\n prevLine = str.slice(prevLineStartOffset, lineStartOffset).replace(/\\r?\\n$/, '');\n }\n\n // Get the target line, stripping a trailing carriage return if necessary.\n const line = str.slice(lineStartOffset, lineEndOffset).replace(/\\r$/, '');\n\n return {\n offset,\n lineNum,\n colNum,\n line,\n prevLine,\n nextLine,\n toString: lineAndColumnToMessage,\n };\n};\n\n// Return a nicely-formatted string describing the line and column for the\n// given offset in `str` highlighting `ranges`.\nexports.getLineAndColumnMessage = function(str, offset, ...ranges) {\n return exports.getLineAndColumn(str, offset).toString(...ranges);\n};\n\nexports.uniqueId = (() => {\n let idCounter = 0;\n return prefix => '' + prefix + idCounter++;\n})();\n}(util$7));\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst {abstract, isSyntactic} = common$l;\nconst errors$8 = errors$9;\nconst pexprs$j = pexprsMain;\nconst util$6 = util$7;\n\nlet BuiltInRules;\n\nutil$6.awaitBuiltInRules(g => {\n BuiltInRules = g;\n});\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\nlet lexifyCount;\n\npexprs$j.PExpr.prototype.assertAllApplicationsAreValid = function(ruleName, grammar) {\n lexifyCount = 0;\n this._assertAllApplicationsAreValid(ruleName, grammar);\n};\n\npexprs$j.PExpr.prototype._assertAllApplicationsAreValid = abstract(\n '_assertAllApplicationsAreValid'\n);\n\npexprs$j.any._assertAllApplicationsAreValid =\n pexprs$j.end._assertAllApplicationsAreValid =\n pexprs$j.Terminal.prototype._assertAllApplicationsAreValid =\n pexprs$j.Range.prototype._assertAllApplicationsAreValid =\n pexprs$j.Param.prototype._assertAllApplicationsAreValid =\n pexprs$j.UnicodeChar.prototype._assertAllApplicationsAreValid =\n function(ruleName, grammar) {\n // no-op\n };\n\npexprs$j.Lex.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) {\n lexifyCount++;\n this.expr._assertAllApplicationsAreValid(ruleName, grammar);\n lexifyCount--;\n};\n\npexprs$j.Alt.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) {\n for (let idx = 0; idx < this.terms.length; idx++) {\n this.terms[idx]._assertAllApplicationsAreValid(ruleName, grammar);\n }\n};\n\npexprs$j.Seq.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) {\n for (let idx = 0; idx < this.factors.length; idx++) {\n this.factors[idx]._assertAllApplicationsAreValid(ruleName, grammar);\n }\n};\n\npexprs$j.Iter.prototype._assertAllApplicationsAreValid =\n pexprs$j.Not.prototype._assertAllApplicationsAreValid =\n pexprs$j.Lookahead.prototype._assertAllApplicationsAreValid =\n function(ruleName, grammar) {\n this.expr._assertAllApplicationsAreValid(ruleName, grammar);\n };\n\npexprs$j.Apply.prototype._assertAllApplicationsAreValid = function(\n ruleName,\n grammar,\n skipSyntacticCheck = false\n) {\n const ruleInfo = grammar.rules[this.ruleName];\n const isContextSyntactic = isSyntactic(ruleName) && lexifyCount === 0;\n\n // Make sure that the rule exists...\n if (!ruleInfo) {\n throw errors$8.undeclaredRule(this.ruleName, grammar.name, this.source);\n }\n\n // ...and that this application is allowed\n if (!skipSyntacticCheck && isSyntactic(this.ruleName) && !isContextSyntactic) {\n throw errors$8.applicationOfSyntacticRuleFromLexicalContext(this.ruleName, this);\n }\n\n // ...and that this application has the correct number of arguments.\n const actual = this.args.length;\n const expected = ruleInfo.formals.length;\n if (actual !== expected) {\n throw errors$8.wrongNumberOfArguments(this.ruleName, expected, actual, this.source);\n }\n\n const isBuiltInApplySyntactic =\n BuiltInRules && ruleInfo === BuiltInRules.rules.applySyntactic;\n const isBuiltInCaseInsensitive =\n BuiltInRules && ruleInfo === BuiltInRules.rules.caseInsensitive;\n\n // If it's an application of 'caseInsensitive', ensure that the argument is a Terminal.\n if (isBuiltInCaseInsensitive) {\n if (!(this.args[0] instanceof pexprs$j.Terminal)) {\n throw errors$8.incorrectArgumentType('a Terminal (e.g. \"abc\")', this.args[0]);\n }\n }\n\n if (isBuiltInApplySyntactic) {\n const arg = this.args[0];\n if (!(arg instanceof pexprs$j.Apply)) {\n throw errors$8.incorrectArgumentType('a syntactic rule application', arg);\n }\n if (!isSyntactic(arg.ruleName)) {\n throw errors$8.applySyntacticWithLexicalRuleApplication(arg);\n }\n if (isContextSyntactic) {\n throw errors$8.unnecessaryExperimentalApplySyntactic(this);\n }\n }\n\n // ...and that all of the argument expressions only have valid applications and have arity 1.\n // If `this` is an application of the built-in applySyntactic rule, then its arg is\n // allowed (and expected) to be a syntactic rule, even if we're in a lexical context.\n this.args.forEach(arg => {\n arg._assertAllApplicationsAreValid(ruleName, grammar, isBuiltInApplySyntactic);\n if (arg.getArity() !== 1) {\n throw errors$8.invalidParameter(this.ruleName, arg);\n }\n });\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$h = common$l;\nconst errors$7 = errors$9;\nconst pexprs$i = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$i.PExpr.prototype.assertChoicesHaveUniformArity = common$h.abstract(\n 'assertChoicesHaveUniformArity'\n);\n\npexprs$i.any.assertChoicesHaveUniformArity =\n pexprs$i.end.assertChoicesHaveUniformArity =\n pexprs$i.Terminal.prototype.assertChoicesHaveUniformArity =\n pexprs$i.Range.prototype.assertChoicesHaveUniformArity =\n pexprs$i.Param.prototype.assertChoicesHaveUniformArity =\n pexprs$i.Lex.prototype.assertChoicesHaveUniformArity =\n pexprs$i.UnicodeChar.prototype.assertChoicesHaveUniformArity =\n function(ruleName) {\n // no-op\n };\n\npexprs$i.Alt.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n if (this.terms.length === 0) {\n return;\n }\n const arity = this.terms[0].getArity();\n for (let idx = 0; idx < this.terms.length; idx++) {\n const term = this.terms[idx];\n term.assertChoicesHaveUniformArity();\n const otherArity = term.getArity();\n if (arity !== otherArity) {\n throw errors$7.inconsistentArity(ruleName, arity, otherArity, term);\n }\n }\n};\n\npexprs$i.Extend.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n // Extend is a special case of Alt that's guaranteed to have exactly two\n // cases: [extensions, origBody].\n const actualArity = this.terms[0].getArity();\n const expectedArity = this.terms[1].getArity();\n if (actualArity !== expectedArity) {\n throw errors$7.inconsistentArity(ruleName, expectedArity, actualArity, this.terms[0]);\n }\n};\n\npexprs$i.Seq.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n for (let idx = 0; idx < this.factors.length; idx++) {\n this.factors[idx].assertChoicesHaveUniformArity(ruleName);\n }\n};\n\npexprs$i.Iter.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n this.expr.assertChoicesHaveUniformArity(ruleName);\n};\n\npexprs$i.Not.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n // no-op (not required b/c the nested expr doesn't show up in the CST)\n};\n\npexprs$i.Lookahead.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n this.expr.assertChoicesHaveUniformArity(ruleName);\n};\n\npexprs$i.Apply.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n // The arities of the parameter expressions is required to be 1 by\n // `assertAllApplicationsAreValid()`.\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$g = common$l;\nconst errors$6 = errors$9;\nconst pexprs$h = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$h.PExpr.prototype.assertIteratedExprsAreNotNullable = common$g.abstract(\n 'assertIteratedExprsAreNotNullable'\n);\n\npexprs$h.any.assertIteratedExprsAreNotNullable =\n pexprs$h.end.assertIteratedExprsAreNotNullable =\n pexprs$h.Terminal.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Range.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Param.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.UnicodeChar.prototype.assertIteratedExprsAreNotNullable =\n function(grammar) {\n // no-op\n };\n\npexprs$h.Alt.prototype.assertIteratedExprsAreNotNullable = function(grammar) {\n for (let idx = 0; idx < this.terms.length; idx++) {\n this.terms[idx].assertIteratedExprsAreNotNullable(grammar);\n }\n};\n\npexprs$h.Seq.prototype.assertIteratedExprsAreNotNullable = function(grammar) {\n for (let idx = 0; idx < this.factors.length; idx++) {\n this.factors[idx].assertIteratedExprsAreNotNullable(grammar);\n }\n};\n\npexprs$h.Iter.prototype.assertIteratedExprsAreNotNullable = function(grammar) {\n // Note: this is the implementation of this method for `Star` and `Plus` expressions.\n // It is overridden for `Opt` below.\n this.expr.assertIteratedExprsAreNotNullable(grammar);\n if (this.expr.isNullable(grammar)) {\n throw errors$6.kleeneExprHasNullableOperand(this, []);\n }\n};\n\npexprs$h.Opt.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Not.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Lookahead.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Lex.prototype.assertIteratedExprsAreNotNullable =\n function(grammar) {\n this.expr.assertIteratedExprsAreNotNullable(grammar);\n };\n\npexprs$h.Apply.prototype.assertIteratedExprsAreNotNullable = function(grammar) {\n this.args.forEach(arg => {\n arg.assertIteratedExprsAreNotNullable(grammar);\n });\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst {assert: assert$2} = common$l;\nconst errors$5 = errors$9;\nconst util$5 = util$7;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction Interval$3(sourceString, startIdx, endIdx) {\n this.sourceString = sourceString;\n this.startIdx = startIdx;\n this.endIdx = endIdx;\n}\n\nInterval$3.coverage = function(firstInterval, ...intervals) {\n let {startIdx, endIdx} = firstInterval;\n for (const interval of intervals) {\n if (interval.sourceString !== firstInterval.sourceString) {\n throw errors$5.intervalSourcesDontMatch();\n } else {\n startIdx = Math.min(startIdx, interval.startIdx);\n endIdx = Math.max(endIdx, interval.endIdx);\n }\n }\n return new Interval$3(firstInterval.sourceString, startIdx, endIdx);\n};\n\nInterval$3.prototype = {\n coverageWith(...intervals) {\n return Interval$3.coverage(...intervals, this);\n },\n\n collapsedLeft() {\n return new Interval$3(this.sourceString, this.startIdx, this.startIdx);\n },\n\n collapsedRight() {\n return new Interval$3(this.sourceString, this.endIdx, this.endIdx);\n },\n\n getLineAndColumn() {\n return util$5.getLineAndColumn(this.sourceString, this.startIdx);\n },\n\n getLineAndColumnMessage() {\n const range = [this.startIdx, this.endIdx];\n return util$5.getLineAndColumnMessage(this.sourceString, this.startIdx, range);\n },\n\n // Returns an array of 0, 1, or 2 intervals that represents the result of the\n // interval difference operation.\n minus(that) {\n if (this.sourceString !== that.sourceString) {\n throw errors$5.intervalSourcesDontMatch();\n } else if (this.startIdx === that.startIdx && this.endIdx === that.endIdx) {\n // `this` and `that` are the same interval!\n return [];\n } else if (this.startIdx < that.startIdx && that.endIdx < this.endIdx) {\n // `that` splits `this` into two intervals\n return [\n new Interval$3(this.sourceString, this.startIdx, that.startIdx),\n new Interval$3(this.sourceString, that.endIdx, this.endIdx),\n ];\n } else if (this.startIdx < that.endIdx && that.endIdx < this.endIdx) {\n // `that` contains a prefix of `this`\n return [new Interval$3(this.sourceString, that.endIdx, this.endIdx)];\n } else if (this.startIdx < that.startIdx && that.startIdx < this.endIdx) {\n // `that` contains a suffix of `this`\n return [new Interval$3(this.sourceString, this.startIdx, that.startIdx)];\n } else {\n // `that` and `this` do not overlap\n return [this];\n }\n },\n\n // Returns a new Interval that has the same extent as this one, but which is relative\n // to `that`, an Interval that fully covers this one.\n relativeTo(that) {\n if (this.sourceString !== that.sourceString) {\n throw errors$5.intervalSourcesDontMatch();\n }\n assert$2(\n this.startIdx >= that.startIdx && this.endIdx <= that.endIdx,\n 'other interval does not cover this one'\n );\n return new Interval$3(\n this.sourceString,\n this.startIdx - that.startIdx,\n this.endIdx - that.startIdx\n );\n },\n\n // Returns a new Interval which contains the same contents as this one,\n // but with whitespace trimmed from both ends.\n trimmed() {\n const {contents} = this;\n const startIdx = this.startIdx + contents.match(/^\\s*/)[0].length;\n const endIdx = this.endIdx - contents.match(/\\s*$/)[0].length;\n return new Interval$3(this.sourceString, startIdx, endIdx);\n },\n\n subInterval(offset, len) {\n const newStartIdx = this.startIdx + offset;\n return new Interval$3(this.sourceString, newStartIdx, newStartIdx + len);\n },\n};\n\nObject.defineProperties(Interval$3.prototype, {\n contents: {\n get() {\n if (this._contents === undefined) {\n this._contents = this.sourceString.slice(this.startIdx, this.endIdx);\n }\n return this._contents;\n },\n enumerable: true,\n },\n length: {\n get() {\n return this.endIdx - this.startIdx;\n },\n enumerable: true,\n },\n});\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Interval_1 = Interval$3;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Interval$2 = Interval_1;\nconst common$f = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// Unicode characters that are used in the `toString` output.\nconst BALLOT_X = '\\u2717';\nconst CHECK_MARK = '\\u2713';\nconst DOT_OPERATOR = '\\u22C5';\nconst RIGHTWARDS_DOUBLE_ARROW = '\\u21D2';\nconst SYMBOL_FOR_HORIZONTAL_TABULATION = '\\u2409';\nconst SYMBOL_FOR_LINE_FEED = '\\u240A';\nconst SYMBOL_FOR_CARRIAGE_RETURN = '\\u240D';\n\nconst Flags = {\n succeeded: 1 << 0,\n isRootNode: 1 << 1,\n isImplicitSpaces: 1 << 2,\n isMemoized: 1 << 3,\n isHeadOfLeftRecursion: 1 << 4,\n terminatesLR: 1 << 5,\n};\n\nfunction spaces(n) {\n return common$f.repeat(' ', n).join('');\n}\n\n// Return a string representation of a portion of `input` at offset `pos`.\n// The result will contain exactly `len` characters.\nfunction getInputExcerpt(input, pos, len) {\n const excerpt = asEscapedString(input.slice(pos, pos + len));\n\n // Pad the output if necessary.\n if (excerpt.length < len) {\n return excerpt + common$f.repeat(' ', len - excerpt.length).join('');\n }\n return excerpt;\n}\n\nfunction asEscapedString(obj) {\n if (typeof obj === 'string') {\n // Replace non-printable characters with visible symbols.\n return obj\n .replace(/ /g, DOT_OPERATOR)\n .replace(/\\t/g, SYMBOL_FOR_HORIZONTAL_TABULATION)\n .replace(/\\n/g, SYMBOL_FOR_LINE_FEED)\n .replace(/\\r/g, SYMBOL_FOR_CARRIAGE_RETURN);\n }\n return String(obj);\n}\n\n// ----------------- Trace -----------------\n\nfunction Trace$2(input, pos1, pos2, expr, succeeded, bindings, optChildren) {\n this.input = input;\n this.pos = this.pos1 = pos1;\n this.pos2 = pos2;\n this.source = new Interval$2(input, pos1, pos2);\n this.expr = expr;\n this.bindings = bindings;\n this.children = optChildren || [];\n this.terminatingLREntry = null;\n\n this._flags = succeeded ? Flags.succeeded : 0;\n}\n\n// A value that can be returned from visitor functions to indicate that a\n// node should not be recursed into.\nTrace$2.prototype.SKIP = {};\n\nObject.defineProperty(Trace$2.prototype, 'displayString', {\n get() {\n return this.expr.toDisplayString();\n },\n});\n\n// For convenience, create a getter and setter for the boolean flags in `Flags`.\nObject.keys(Flags).forEach(name => {\n const mask = Flags[name];\n Object.defineProperty(Trace$2.prototype, name, {\n get() {\n return (this._flags & mask) !== 0;\n },\n set(val) {\n if (val) {\n this._flags |= mask;\n } else {\n this._flags &= ~mask;\n }\n },\n });\n});\n\nTrace$2.prototype.clone = function() {\n return this.cloneWithExpr(this.expr);\n};\n\nTrace$2.prototype.cloneWithExpr = function(expr) {\n const ans = new Trace$2(\n this.input,\n this.pos,\n this.pos2,\n expr,\n this.succeeded,\n this.bindings,\n this.children\n );\n\n ans.isHeadOfLeftRecursion = this.isHeadOfLeftRecursion;\n ans.isImplicitSpaces = this.isImplicitSpaces;\n ans.isMemoized = this.isMemoized;\n ans.isRootNode = this.isRootNode;\n ans.terminatesLR = this.terminatesLR;\n ans.terminatingLREntry = this.terminatingLREntry;\n return ans;\n};\n\n// Record the trace information for the terminating condition of the LR loop.\nTrace$2.prototype.recordLRTermination = function(ruleBodyTrace, value) {\n this.terminatingLREntry = new Trace$2(\n this.input,\n this.pos,\n this.pos2,\n this.expr,\n false,\n [value],\n [ruleBodyTrace]\n );\n this.terminatingLREntry.terminatesLR = true;\n};\n\n// Recursively traverse this trace node and all its descendents, calling a visitor function\n// for each node that is visited. If `vistorObjOrFn` is an object, then its 'enter' property\n// is a function to call before visiting the children of a node, and its 'exit' property is\n// a function to call afterwards. If `visitorObjOrFn` is a function, it represents the 'enter'\n// function.\n//\n// The functions are called with three arguments: the Trace node, its parent Trace, and a number\n// representing the depth of the node in the tree. (The root node has depth 0.) `optThisArg`, if\n// specified, is the value to use for `this` when executing the visitor functions.\nTrace$2.prototype.walk = function(visitorObjOrFn, optThisArg) {\n let visitor = visitorObjOrFn;\n if (typeof visitor === 'function') {\n visitor = {enter: visitor};\n }\n\n function _walk(node, parent, depth) {\n let recurse = true;\n if (visitor.enter) {\n if (visitor.enter.call(optThisArg, node, parent, depth) === Trace$2.prototype.SKIP) {\n recurse = false;\n }\n }\n if (recurse) {\n node.children.forEach(child => {\n _walk(child, node, depth + 1);\n });\n if (visitor.exit) {\n visitor.exit.call(optThisArg, node, parent, depth);\n }\n }\n }\n if (this.isRootNode) {\n // Don't visit the root node itself, only its children.\n this.children.forEach(c => {\n _walk(c, null, 0);\n });\n } else {\n _walk(this, null, 0);\n }\n};\n\n// Return a string representation of the trace.\n// Sample:\n// 12⋅+⋅2⋅*⋅3 ✓ exp ⇒ \"12\"\n// 12⋅+⋅2⋅*⋅3 ✓ addExp (LR) ⇒ \"12\"\n// 12⋅+⋅2⋅*⋅3 ✗ addExp_plus\nTrace$2.prototype.toString = function() {\n const sb = new common$f.StringBuffer();\n this.walk((node, parent, depth) => {\n if (!node) {\n return this.SKIP;\n }\n const ctorName = node.expr.constructor.name;\n // Don't print anything for Alt nodes.\n if (ctorName === 'Alt') {\n return; // eslint-disable-line consistent-return\n }\n sb.append(getInputExcerpt(node.input, node.pos, 10) + spaces(depth * 2 + 1));\n sb.append((node.succeeded ? CHECK_MARK : BALLOT_X) + ' ' + node.displayString);\n if (node.isHeadOfLeftRecursion) {\n sb.append(' (LR)');\n }\n if (node.succeeded) {\n const contents = asEscapedString(node.source.contents);\n sb.append(' ' + RIGHTWARDS_DOUBLE_ARROW + ' ');\n sb.append(typeof contents === 'string' ? '\"' + contents + '\"' : contents);\n }\n sb.append('\\n');\n });\n return sb.contents();\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Trace_1 = Trace$2;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Trace$1 = Trace_1;\nconst common$e = common$l;\nconst errors$4 = errors$9;\nconst nodes = nodes$1;\nconst pexprs$g = pexprsMain;\n\nconst {TerminalNode: TerminalNode$1} = nodes;\nconst {NonterminalNode} = nodes;\nconst {IterationNode: IterationNode$1} = nodes;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Evaluate the expression and return `true` if it succeeds, `false` otherwise. This method should\n only be called directly by `State.prototype.eval(expr)`, which also updates the data structures\n that are used for tracing. (Making those updates in a method of `State` enables the trace-specific\n data structures to be \"secrets\" of that class, which is good for modularity.)\n\n The contract of this method is as follows:\n * When the return value is `true`,\n - the state object will have `expr.getArity()` more bindings than it did before the call.\n * When the return value is `false`,\n - the state object may have more bindings than it did before the call, and\n - its input stream's position may be anywhere.\n\n Note that `State.prototype.eval(expr)`, unlike this method, guarantees that neither the state\n object's bindings nor its input stream's position will change if the expression fails to match.\n*/\npexprs$g.PExpr.prototype.eval = common$e.abstract('eval'); // function(state) { ... }\n\npexprs$g.any.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const ch = inputStream.next();\n if (ch) {\n state.pushBinding(new TerminalNode$1(ch.length), origPos);\n return true;\n } else {\n state.processFailure(origPos, this);\n return false;\n }\n};\n\npexprs$g.end.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n if (inputStream.atEnd()) {\n state.pushBinding(new TerminalNode$1(0), origPos);\n return true;\n } else {\n state.processFailure(origPos, this);\n return false;\n }\n};\n\npexprs$g.Terminal.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n if (!inputStream.matchString(this.obj)) {\n state.processFailure(origPos, this);\n return false;\n } else {\n state.pushBinding(new TerminalNode$1(this.obj.length), origPos);\n return true;\n }\n};\n\npexprs$g.Range.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n\n // A range can operate in one of two modes: matching a single, 16-bit _code unit_,\n // or matching a _code point_. (Code points over 0xFFFF take up two 16-bit code units.)\n const cp = this.matchCodePoint ? inputStream.nextCodePoint() : inputStream.nextCharCode();\n\n // Always compare by code point value to get the correct result in all scenarios.\n // Note that for strings of length 1, codePointAt(0) and charPointAt(0) are equivalent.\n if (cp !== undefined && this.from.codePointAt(0) <= cp && cp <= this.to.codePointAt(0)) {\n state.pushBinding(new TerminalNode$1(String.fromCodePoint(cp).length), origPos);\n return true;\n } else {\n state.processFailure(origPos, this);\n return false;\n }\n};\n\npexprs$g.Param.prototype.eval = function(state) {\n return state.eval(state.currentApplication().args[this.index]);\n};\n\npexprs$g.Lex.prototype.eval = function(state) {\n state.enterLexifiedContext();\n const ans = state.eval(this.expr);\n state.exitLexifiedContext();\n return ans;\n};\n\npexprs$g.Alt.prototype.eval = function(state) {\n for (let idx = 0; idx < this.terms.length; idx++) {\n if (state.eval(this.terms[idx])) {\n return true;\n }\n }\n return false;\n};\n\npexprs$g.Seq.prototype.eval = function(state) {\n for (let idx = 0; idx < this.factors.length; idx++) {\n const factor = this.factors[idx];\n if (!state.eval(factor)) {\n return false;\n }\n }\n return true;\n};\n\npexprs$g.Iter.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const arity = this.getArity();\n const cols = [];\n const colOffsets = [];\n while (cols.length < arity) {\n cols.push([]);\n colOffsets.push([]);\n }\n\n let numMatches = 0;\n let prevPos = origPos;\n let idx;\n while (numMatches < this.maxNumMatches && state.eval(this.expr)) {\n if (inputStream.pos === prevPos) {\n throw errors$4.kleeneExprHasNullableOperand(this, state._applicationStack);\n }\n prevPos = inputStream.pos;\n numMatches++;\n const row = state._bindings.splice(state._bindings.length - arity, arity);\n const rowOffsets = state._bindingOffsets.splice(\n state._bindingOffsets.length - arity,\n arity\n );\n for (idx = 0; idx < row.length; idx++) {\n cols[idx].push(row[idx]);\n colOffsets[idx].push(rowOffsets[idx]);\n }\n }\n if (numMatches < this.minNumMatches) {\n return false;\n }\n let offset = state.posToOffset(origPos);\n let matchLength = 0;\n if (numMatches > 0) {\n const lastCol = cols[arity - 1];\n const lastColOffsets = colOffsets[arity - 1];\n\n const endOffset =\n lastColOffsets[lastColOffsets.length - 1] + lastCol[lastCol.length - 1].matchLength;\n offset = colOffsets[0][0];\n matchLength = endOffset - offset;\n }\n const isOptional = this instanceof pexprs$g.Opt;\n for (idx = 0; idx < cols.length; idx++) {\n state._bindings.push(\n new IterationNode$1(cols[idx], colOffsets[idx], matchLength, isOptional)\n );\n state._bindingOffsets.push(offset);\n }\n return true;\n};\n\npexprs$g.Not.prototype.eval = function(state) {\n /*\n TODO:\n - Right now we're just throwing away all of the failures that happen inside a `not`, and\n recording `this` as a failed expression.\n - Double negation should be equivalent to lookahead, but that's not the case right now wrt\n failures. E.g., ~~'foo' produces a failure for ~~'foo', but maybe it should produce\n a failure for 'foo' instead.\n */\n\n const {inputStream} = state;\n const origPos = inputStream.pos;\n state.pushFailuresInfo();\n\n const ans = state.eval(this.expr);\n\n state.popFailuresInfo();\n if (ans) {\n state.processFailure(origPos, this);\n return false;\n }\n\n inputStream.pos = origPos;\n return true;\n};\n\npexprs$g.Lookahead.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n if (state.eval(this.expr)) {\n inputStream.pos = origPos;\n return true;\n } else {\n return false;\n }\n};\n\npexprs$g.Apply.prototype.eval = function(state) {\n const caller = state.currentApplication();\n const actuals = caller ? caller.args : [];\n const app = this.substituteParams(actuals);\n\n const posInfo = state.getCurrentPosInfo();\n if (posInfo.isActive(app)) {\n // This rule is already active at this position, i.e., it is left-recursive.\n return app.handleCycle(state);\n }\n\n const memoKey = app.toMemoKey();\n const memoRec = posInfo.memo[memoKey];\n\n if (memoRec && posInfo.shouldUseMemoizedResult(memoRec)) {\n if (state.hasNecessaryInfo(memoRec)) {\n return state.useMemoizedResult(state.inputStream.pos, memoRec);\n }\n delete posInfo.memo[memoKey];\n }\n return app.reallyEval(state);\n};\n\npexprs$g.Apply.prototype.handleCycle = function(state) {\n const posInfo = state.getCurrentPosInfo();\n const {currentLeftRecursion} = posInfo;\n const memoKey = this.toMemoKey();\n let memoRec = posInfo.memo[memoKey];\n\n if (currentLeftRecursion && currentLeftRecursion.headApplication.toMemoKey() === memoKey) {\n // We already know about this left recursion, but it's possible there are \"involved\n // applications\" that we don't already know about, so...\n memoRec.updateInvolvedApplicationMemoKeys();\n } else if (!memoRec) {\n // New left recursion detected! Memoize a failure to try to get a seed parse.\n memoRec = posInfo.memoize(memoKey, {\n matchLength: 0,\n examinedLength: 0,\n value: false,\n rightmostFailureOffset: -1,\n });\n posInfo.startLeftRecursion(this, memoRec);\n }\n return state.useMemoizedResult(state.inputStream.pos, memoRec);\n};\n\npexprs$g.Apply.prototype.reallyEval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const origPosInfo = state.getCurrentPosInfo();\n const ruleInfo = state.grammar.rules[this.ruleName];\n const {body} = ruleInfo;\n const {description} = ruleInfo;\n\n state.enterApplication(origPosInfo, this);\n\n if (description) {\n state.pushFailuresInfo();\n }\n\n // Reset the input stream's examinedLength property so that we can track\n // the examined length of this particular application.\n const origInputStreamExaminedLength = inputStream.examinedLength;\n inputStream.examinedLength = 0;\n\n let value = this.evalOnce(body, state);\n const currentLR = origPosInfo.currentLeftRecursion;\n const memoKey = this.toMemoKey();\n const isHeadOfLeftRecursion = currentLR && currentLR.headApplication.toMemoKey() === memoKey;\n let memoRec;\n\n if (isHeadOfLeftRecursion) {\n value = this.growSeedResult(body, state, origPos, currentLR, value);\n origPosInfo.endLeftRecursion();\n memoRec = currentLR;\n memoRec.examinedLength = inputStream.examinedLength - origPos;\n memoRec.rightmostFailureOffset = state._getRightmostFailureOffset();\n origPosInfo.memoize(memoKey, memoRec); // updates origPosInfo's maxExaminedLength\n } else if (!currentLR || !currentLR.isInvolved(memoKey)) {\n // This application is not involved in left recursion, so it's ok to memoize it.\n memoRec = origPosInfo.memoize(memoKey, {\n matchLength: inputStream.pos - origPos,\n examinedLength: inputStream.examinedLength - origPos,\n value,\n failuresAtRightmostPosition: state.cloneRecordedFailures(),\n rightmostFailureOffset: state._getRightmostFailureOffset(),\n });\n }\n const succeeded = !!value;\n\n if (description) {\n state.popFailuresInfo();\n if (!succeeded) {\n state.processFailure(origPos, this);\n }\n if (memoRec) {\n memoRec.failuresAtRightmostPosition = state.cloneRecordedFailures();\n }\n }\n\n // Record trace information in the memo table, so that it is available if the memoized result\n // is used later.\n if (state.isTracing() && memoRec) {\n const entry = state.getTraceEntry(origPos, this, succeeded, succeeded ? [value] : []);\n if (isHeadOfLeftRecursion) {\n common$e.assert(entry.terminatingLREntry != null || !succeeded);\n entry.isHeadOfLeftRecursion = true;\n }\n memoRec.traceEntry = entry;\n }\n\n // Fix the input stream's examinedLength -- it should be the maximum examined length\n // across all applications, not just this one.\n inputStream.examinedLength = Math.max(\n inputStream.examinedLength,\n origInputStreamExaminedLength\n );\n\n state.exitApplication(origPosInfo, value);\n\n return succeeded;\n};\n\npexprs$g.Apply.prototype.evalOnce = function(expr, state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n\n if (state.eval(expr)) {\n const arity = expr.getArity();\n const bindings = state._bindings.splice(state._bindings.length - arity, arity);\n const offsets = state._bindingOffsets.splice(state._bindingOffsets.length - arity, arity);\n const matchLength = inputStream.pos - origPos;\n return new NonterminalNode(this.ruleName, bindings, offsets, matchLength);\n } else {\n return false;\n }\n};\n\npexprs$g.Apply.prototype.growSeedResult = function(body, state, origPos, lrMemoRec, newValue) {\n if (!newValue) {\n return false;\n }\n\n const {inputStream} = state;\n\n while (true) {\n lrMemoRec.matchLength = inputStream.pos - origPos;\n lrMemoRec.value = newValue;\n lrMemoRec.failuresAtRightmostPosition = state.cloneRecordedFailures();\n\n if (state.isTracing()) {\n // Before evaluating the body again, add a trace node for this application to the memo entry.\n // Its only child is a copy of the trace node from `newValue`, which will always be the last\n // element in `state.trace`.\n const seedTrace = state.trace[state.trace.length - 1];\n lrMemoRec.traceEntry = new Trace$1(\n state.input,\n origPos,\n inputStream.pos,\n this,\n true,\n [newValue],\n [seedTrace.clone()]\n );\n }\n inputStream.pos = origPos;\n newValue = this.evalOnce(body, state);\n if (inputStream.pos - origPos <= lrMemoRec.matchLength) {\n break;\n }\n if (state.isTracing()) {\n state.trace.splice(-2, 1); // Drop the trace for the old seed.\n }\n }\n if (state.isTracing()) {\n // The last entry is for an unused result -- pop it and save it in the \"real\" entry.\n lrMemoRec.traceEntry.recordLRTermination(state.trace.pop(), newValue);\n }\n inputStream.pos = origPos + lrMemoRec.matchLength;\n return lrMemoRec.value;\n};\n\npexprs$g.UnicodeChar.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const ch = inputStream.next();\n if (ch && this.pattern.test(ch)) {\n state.pushBinding(new TerminalNode$1(ch.length), origPos);\n return true;\n } else {\n state.processFailure(origPos, this);\n return false;\n }\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$d = common$l;\nconst pexprs$f = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$f.PExpr.prototype.getArity = common$d.abstract('getArity');\n\npexprs$f.any.getArity =\n pexprs$f.end.getArity =\n pexprs$f.Terminal.prototype.getArity =\n pexprs$f.Range.prototype.getArity =\n pexprs$f.Param.prototype.getArity =\n pexprs$f.Apply.prototype.getArity =\n pexprs$f.UnicodeChar.prototype.getArity =\n function() {\n return 1;\n };\n\npexprs$f.Alt.prototype.getArity = function() {\n // This is ok b/c all terms must have the same arity -- this property is\n // checked by the Grammar constructor.\n return this.terms.length === 0 ? 0 : this.terms[0].getArity();\n};\n\npexprs$f.Seq.prototype.getArity = function() {\n let arity = 0;\n for (let idx = 0; idx < this.factors.length; idx++) {\n arity += this.factors[idx].getArity();\n }\n return arity;\n};\n\npexprs$f.Iter.prototype.getArity = function() {\n return this.expr.getArity();\n};\n\npexprs$f.Not.prototype.getArity = function() {\n return 0;\n};\n\npexprs$f.Lookahead.prototype.getArity = pexprs$f.Lex.prototype.getArity = function() {\n return this.expr.getArity();\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$c = common$l;\nconst pexprs$e = pexprsMain;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction getMetaInfo(expr, grammarInterval) {\n const metaInfo = {};\n if (expr.source && grammarInterval) {\n const adjusted = expr.source.relativeTo(grammarInterval);\n metaInfo.sourceInterval = [adjusted.startIdx, adjusted.endIdx];\n }\n return metaInfo;\n}\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$e.PExpr.prototype.outputRecipe = common$c.abstract('outputRecipe');\n\npexprs$e.any.outputRecipe = function(formals, grammarInterval) {\n return ['any', getMetaInfo(this, grammarInterval)];\n};\n\npexprs$e.end.outputRecipe = function(formals, grammarInterval) {\n return ['end', getMetaInfo(this, grammarInterval)];\n};\n\npexprs$e.Terminal.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['terminal', getMetaInfo(this, grammarInterval), this.obj];\n};\n\npexprs$e.Range.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['range', getMetaInfo(this, grammarInterval), this.from, this.to];\n};\n\npexprs$e.Param.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['param', getMetaInfo(this, grammarInterval), this.index];\n};\n\npexprs$e.Alt.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['alt', getMetaInfo(this, grammarInterval)].concat(\n this.terms.map(term => term.outputRecipe(formals, grammarInterval))\n );\n};\n\npexprs$e.Extend.prototype.outputRecipe = function(formals, grammarInterval) {\n const extension = this.terms[0]; // [extension, original]\n return extension.outputRecipe(formals, grammarInterval);\n};\n\npexprs$e.Splice.prototype.outputRecipe = function(formals, grammarInterval) {\n const beforeTerms = this.terms.slice(0, this.expansionPos);\n const afterTerms = this.terms.slice(this.expansionPos + 1);\n return [\n 'splice',\n getMetaInfo(this, grammarInterval),\n beforeTerms.map(term => term.outputRecipe(formals, grammarInterval)),\n afterTerms.map(term => term.outputRecipe(formals, grammarInterval)),\n ];\n};\n\npexprs$e.Seq.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['seq', getMetaInfo(this, grammarInterval)].concat(\n this.factors.map(factor => factor.outputRecipe(formals, grammarInterval))\n );\n};\n\npexprs$e.Star.prototype.outputRecipe =\n pexprs$e.Plus.prototype.outputRecipe =\n pexprs$e.Opt.prototype.outputRecipe =\n pexprs$e.Not.prototype.outputRecipe =\n pexprs$e.Lookahead.prototype.outputRecipe =\n pexprs$e.Lex.prototype.outputRecipe =\n function(formals, grammarInterval) {\n return [\n this.constructor.name.toLowerCase(),\n getMetaInfo(this, grammarInterval),\n this.expr.outputRecipe(formals, grammarInterval),\n ];\n };\n\npexprs$e.Apply.prototype.outputRecipe = function(formals, grammarInterval) {\n return [\n 'app',\n getMetaInfo(this, grammarInterval),\n this.ruleName,\n this.args.map(arg => arg.outputRecipe(formals, grammarInterval)),\n ];\n};\n\npexprs$e.UnicodeChar.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['unicodeChar', getMetaInfo(this, grammarInterval), this.category];\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$b = common$l;\nconst pexprs$d = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Called at grammar creation time to rewrite a rule body, replacing each reference to a formal\n parameter with a `Param` node. Returns a PExpr -- either a new one, or the original one if\n it was modified in place.\n*/\npexprs$d.PExpr.prototype.introduceParams = common$b.abstract('introduceParams');\n\npexprs$d.any.introduceParams =\n pexprs$d.end.introduceParams =\n pexprs$d.Terminal.prototype.introduceParams =\n pexprs$d.Range.prototype.introduceParams =\n pexprs$d.Param.prototype.introduceParams =\n pexprs$d.UnicodeChar.prototype.introduceParams =\n function(formals) {\n return this;\n };\n\npexprs$d.Alt.prototype.introduceParams = function(formals) {\n this.terms.forEach((term, idx, terms) => {\n terms[idx] = term.introduceParams(formals);\n });\n return this;\n};\n\npexprs$d.Seq.prototype.introduceParams = function(formals) {\n this.factors.forEach((factor, idx, factors) => {\n factors[idx] = factor.introduceParams(formals);\n });\n return this;\n};\n\npexprs$d.Iter.prototype.introduceParams =\n pexprs$d.Not.prototype.introduceParams =\n pexprs$d.Lookahead.prototype.introduceParams =\n pexprs$d.Lex.prototype.introduceParams =\n function(formals) {\n this.expr = this.expr.introduceParams(formals);\n return this;\n };\n\npexprs$d.Apply.prototype.introduceParams = function(formals) {\n const index = formals.indexOf(this.ruleName);\n if (index >= 0) {\n if (this.args.length > 0) {\n // TODO: Should this be supported? See issue #64.\n throw new Error('Parameterized rules cannot be passed as arguments to another rule.');\n }\n return new pexprs$d.Param(index).withSource(this.source);\n } else {\n this.args.forEach((arg, idx, args) => {\n args[idx] = arg.introduceParams(formals);\n });\n return this;\n }\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$a = common$l;\nconst pexprs$c = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n// Returns `true` if this parsing expression may accept without consuming any input.\npexprs$c.PExpr.prototype.isNullable = function(grammar) {\n return this._isNullable(grammar, Object.create(null));\n};\n\npexprs$c.PExpr.prototype._isNullable = common$a.abstract('_isNullable');\n\npexprs$c.any._isNullable =\n pexprs$c.Range.prototype._isNullable =\n pexprs$c.Param.prototype._isNullable =\n pexprs$c.Plus.prototype._isNullable =\n pexprs$c.UnicodeChar.prototype._isNullable =\n function(grammar, memo) {\n return false;\n };\n\npexprs$c.end._isNullable = function(grammar, memo) {\n return true;\n};\n\npexprs$c.Terminal.prototype._isNullable = function(grammar, memo) {\n if (typeof this.obj === 'string') {\n // This is an over-simplification: it's only correct if the input is a string. If it's an array\n // or an object, then the empty string parsing expression is not nullable.\n return this.obj === '';\n } else {\n return false;\n }\n};\n\npexprs$c.Alt.prototype._isNullable = function(grammar, memo) {\n return this.terms.length === 0 || this.terms.some(term => term._isNullable(grammar, memo));\n};\n\npexprs$c.Seq.prototype._isNullable = function(grammar, memo) {\n return this.factors.every(factor => factor._isNullable(grammar, memo));\n};\n\npexprs$c.Star.prototype._isNullable =\n pexprs$c.Opt.prototype._isNullable =\n pexprs$c.Not.prototype._isNullable =\n pexprs$c.Lookahead.prototype._isNullable =\n function(grammar, memo) {\n return true;\n };\n\npexprs$c.Lex.prototype._isNullable = function(grammar, memo) {\n return this.expr._isNullable(grammar, memo);\n};\n\npexprs$c.Apply.prototype._isNullable = function(grammar, memo) {\n const key = this.toMemoKey();\n if (!Object.prototype.hasOwnProperty.call(memo, key)) {\n const {body} = grammar.rules[this.ruleName];\n const inlined = body.substituteParams(this.args);\n memo[key] = false; // Prevent infinite recursion for recursive rules.\n memo[key] = inlined._isNullable(grammar, memo);\n }\n return memo[key];\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$9 = common$l;\nconst pexprs$b = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Returns a PExpr that results from recursively replacing every formal parameter (i.e., instance\n of `Param`) inside this PExpr with its actual value from `actuals` (an Array).\n\n The receiver must not be modified; a new PExpr must be returned if any replacement is necessary.\n*/\n// function(actuals) { ... }\npexprs$b.PExpr.prototype.substituteParams = common$9.abstract('substituteParams');\n\npexprs$b.any.substituteParams =\n pexprs$b.end.substituteParams =\n pexprs$b.Terminal.prototype.substituteParams =\n pexprs$b.Range.prototype.substituteParams =\n pexprs$b.UnicodeChar.prototype.substituteParams =\n function(actuals) {\n return this;\n };\n\npexprs$b.Param.prototype.substituteParams = function(actuals) {\n return actuals[this.index];\n};\n\npexprs$b.Alt.prototype.substituteParams = function(actuals) {\n return new pexprs$b.Alt(this.terms.map(term => term.substituteParams(actuals)));\n};\n\npexprs$b.Seq.prototype.substituteParams = function(actuals) {\n return new pexprs$b.Seq(this.factors.map(factor => factor.substituteParams(actuals)));\n};\n\npexprs$b.Iter.prototype.substituteParams =\n pexprs$b.Not.prototype.substituteParams =\n pexprs$b.Lookahead.prototype.substituteParams =\n pexprs$b.Lex.prototype.substituteParams =\n function(actuals) {\n return new this.constructor(this.expr.substituteParams(actuals));\n };\n\npexprs$b.Apply.prototype.substituteParams = function(actuals) {\n if (this.args.length === 0) {\n // Avoid making a copy of this application, as an optimization\n return this;\n } else {\n const args = this.args.map(arg => arg.substituteParams(actuals));\n return new pexprs$b.Apply(this.ruleName, args);\n }\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$8 = common$l;\nconst pexprs$a = pexprsMain;\n\nconst {copyWithoutDuplicates} = common$8;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction isRestrictedJSIdentifier(str) {\n return /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(str);\n}\n\nfunction resolveDuplicatedNames(argumentNameList) {\n // `count` is used to record the number of times each argument name occurs in the list,\n // this is useful for checking duplicated argument name. It maps argument names to ints.\n const count = Object.create(null);\n argumentNameList.forEach(argName => {\n count[argName] = (count[argName] || 0) + 1;\n });\n\n // Append subscripts ('_1', '_2', ...) to duplicate argument names.\n Object.keys(count).forEach(dupArgName => {\n if (count[dupArgName] <= 1) {\n return;\n }\n\n // This name shows up more than once, so add subscripts.\n let subscript = 1;\n argumentNameList.forEach((argName, idx) => {\n if (argName === dupArgName) {\n argumentNameList[idx] = argName + '_' + subscript++;\n }\n });\n });\n}\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Returns a list of strings that will be used as the default argument names for its receiver\n (a pexpr) in a semantic action. This is used exclusively by the Semantics Editor.\n\n `firstArgIndex` is the 1-based index of the first argument name that will be generated for this\n pexpr. It enables us to name arguments positionally, e.g., if the second argument is a\n non-alphanumeric terminal like \"+\", it will be named '$2'.\n\n `noDupCheck` is true if the caller of `toArgumentNameList` is not a top level caller. It enables\n us to avoid nested duplication subscripts appending, e.g., '_1_1', '_1_2', by only checking\n duplicates at the top level.\n\n Here is a more elaborate example that illustrates how this method works:\n `(a \"+\" b).toArgumentNameList(1)` evaluates to `['a', '$2', 'b']` with the following recursive\n calls:\n\n (a).toArgumentNameList(1) -> ['a'],\n (\"+\").toArgumentNameList(2) -> ['$2'],\n (b).toArgumentNameList(3) -> ['b']\n\n Notes:\n * This method must only be called on well-formed expressions, e.g., the receiver must\n not have any Alt sub-expressions with inconsistent arities.\n * e.getArity() === e.toArgumentNameList(1).length\n*/\n// function(firstArgIndex, noDupCheck) { ... }\npexprs$a.PExpr.prototype.toArgumentNameList = common$8.abstract('toArgumentNameList');\n\npexprs$a.any.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return ['any'];\n};\n\npexprs$a.end.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return ['end'];\n};\n\npexprs$a.Terminal.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n if (typeof this.obj === 'string' && /^[_a-zA-Z0-9]+$/.test(this.obj)) {\n // If this terminal is a valid suffix for a JS identifier, just prepend it with '_'\n return ['_' + this.obj];\n } else {\n // Otherwise, name it positionally.\n return ['$' + firstArgIndex];\n }\n};\n\npexprs$a.Range.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n let argName = this.from + '_to_' + this.to;\n // If the `argName` is not valid then try to prepend a `_`.\n if (!isRestrictedJSIdentifier(argName)) {\n argName = '_' + argName;\n }\n // If the `argName` still not valid after prepending a `_`, then name it positionally.\n if (!isRestrictedJSIdentifier(argName)) {\n argName = '$' + firstArgIndex;\n }\n return [argName];\n};\n\npexprs$a.Alt.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n // `termArgNameLists` is an array of arrays where each row is the\n // argument name list that corresponds to a term in this alternation.\n const termArgNameLists = this.terms.map(term =>\n term.toArgumentNameList(firstArgIndex, true)\n );\n\n const argumentNameList = [];\n const numArgs = termArgNameLists[0].length;\n for (let colIdx = 0; colIdx < numArgs; colIdx++) {\n const col = [];\n for (let rowIdx = 0; rowIdx < this.terms.length; rowIdx++) {\n col.push(termArgNameLists[rowIdx][colIdx]);\n }\n const uniqueNames = copyWithoutDuplicates(col);\n argumentNameList.push(uniqueNames.join('_or_'));\n }\n\n if (!noDupCheck) {\n resolveDuplicatedNames(argumentNameList);\n }\n return argumentNameList;\n};\n\npexprs$a.Seq.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n // Generate the argument name list, without worrying about duplicates.\n let argumentNameList = [];\n this.factors.forEach(factor => {\n const factorArgumentNameList = factor.toArgumentNameList(firstArgIndex, true);\n argumentNameList = argumentNameList.concat(factorArgumentNameList);\n\n // Shift the firstArgIndex to take this factor's argument names into account.\n firstArgIndex += factorArgumentNameList.length;\n });\n if (!noDupCheck) {\n resolveDuplicatedNames(argumentNameList);\n }\n return argumentNameList;\n};\n\npexprs$a.Iter.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n const argumentNameList = this.expr\n .toArgumentNameList(firstArgIndex, noDupCheck)\n .map(exprArgumentString =>\n exprArgumentString[exprArgumentString.length - 1] === 's' ?\n exprArgumentString + 'es' :\n exprArgumentString + 's'\n );\n if (!noDupCheck) {\n resolveDuplicatedNames(argumentNameList);\n }\n return argumentNameList;\n};\n\npexprs$a.Opt.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return this.expr.toArgumentNameList(firstArgIndex, noDupCheck).map(argName => {\n return 'opt' + argName[0].toUpperCase() + argName.slice(1);\n });\n};\n\npexprs$a.Not.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return [];\n};\n\npexprs$a.Lookahead.prototype.toArgumentNameList = pexprs$a.Lex.prototype.toArgumentNameList =\n function(firstArgIndex, noDupCheck) {\n return this.expr.toArgumentNameList(firstArgIndex, noDupCheck);\n };\n\npexprs$a.Apply.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return [this.ruleName];\n};\n\npexprs$a.UnicodeChar.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return ['$' + firstArgIndex];\n};\n\npexprs$a.Param.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return ['param' + this.index];\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$7 = common$l;\nconst pexprs$9 = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n// Returns a string representing the PExpr, for use as a UI label, etc.\npexprs$9.PExpr.prototype.toDisplayString = common$7.abstract('toDisplayString');\n\npexprs$9.Alt.prototype.toDisplayString = pexprs$9.Seq.prototype.toDisplayString = function() {\n if (this.source) {\n return this.source.trimmed().contents;\n }\n return '[' + this.constructor.name + ']';\n};\n\npexprs$9.any.toDisplayString =\n pexprs$9.end.toDisplayString =\n pexprs$9.Iter.prototype.toDisplayString =\n pexprs$9.Not.prototype.toDisplayString =\n pexprs$9.Lookahead.prototype.toDisplayString =\n pexprs$9.Lex.prototype.toDisplayString =\n pexprs$9.Terminal.prototype.toDisplayString =\n pexprs$9.Range.prototype.toDisplayString =\n pexprs$9.Param.prototype.toDisplayString =\n function() {\n return this.toString();\n };\n\npexprs$9.Apply.prototype.toDisplayString = function() {\n if (this.args.length > 0) {\n const ps = this.args.map(arg => arg.toDisplayString());\n return this.ruleName + '<' + ps.join(',') + '>';\n } else {\n return this.ruleName;\n }\n};\n\npexprs$9.UnicodeChar.prototype.toDisplayString = function() {\n return 'Unicode [' + this.category + '] character';\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Failure$1 = Failure_1;\nconst common$6 = common$l;\nconst pexprs$8 = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$8.PExpr.prototype.toFailure = common$6.abstract('toFailure');\n\npexprs$8.any.toFailure = function(grammar) {\n return new Failure$1(this, 'any object', 'description');\n};\n\npexprs$8.end.toFailure = function(grammar) {\n return new Failure$1(this, 'end of input', 'description');\n};\n\npexprs$8.Terminal.prototype.toFailure = function(grammar) {\n return new Failure$1(this, this.obj, 'string');\n};\n\npexprs$8.Range.prototype.toFailure = function(grammar) {\n // TODO: come up with something better\n return new Failure$1(this, JSON.stringify(this.from) + '..' + JSON.stringify(this.to), 'code');\n};\n\npexprs$8.Not.prototype.toFailure = function(grammar) {\n const description =\n this.expr === pexprs$8.any ? 'nothing' : 'not ' + this.expr.toFailure(grammar);\n return new Failure$1(this, description, 'description');\n};\n\npexprs$8.Lookahead.prototype.toFailure = function(grammar) {\n return this.expr.toFailure(grammar);\n};\n\npexprs$8.Apply.prototype.toFailure = function(grammar) {\n let {description} = grammar.rules[this.ruleName];\n if (!description) {\n const article = /^[aeiouAEIOU]/.test(this.ruleName) ? 'an' : 'a';\n description = article + ' ' + this.ruleName;\n }\n return new Failure$1(this, description, 'description');\n};\n\npexprs$8.UnicodeChar.prototype.toFailure = function(grammar) {\n return new Failure$1(this, 'a Unicode [' + this.category + '] character', 'description');\n};\n\npexprs$8.Alt.prototype.toFailure = function(grammar) {\n const fs = this.terms.map(t => t.toFailure(grammar));\n const description = '(' + fs.join(' or ') + ')';\n return new Failure$1(this, description, 'description');\n};\n\npexprs$8.Seq.prototype.toFailure = function(grammar) {\n const fs = this.factors.map(f => f.toFailure(grammar));\n const description = '(' + fs.join(' ') + ')';\n return new Failure$1(this, description, 'description');\n};\n\npexprs$8.Iter.prototype.toFailure = function(grammar) {\n const description = '(' + this.expr.toFailure(grammar) + this.operator + ')';\n return new Failure$1(this, description, 'description');\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$5 = common$l;\nconst pexprs$7 = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n e1.toString() === e2.toString() ==> e1 and e2 are semantically equivalent.\n Note that this is not an iff (<==>): e.g.,\n (~\"b\" \"a\").toString() !== (\"a\").toString(), even though\n ~\"b\" \"a\" and \"a\" are interchangeable in any grammar,\n both in terms of the languages they accept and their arities.\n*/\npexprs$7.PExpr.prototype.toString = common$5.abstract('toString');\n\npexprs$7.any.toString = function() {\n return 'any';\n};\n\npexprs$7.end.toString = function() {\n return 'end';\n};\n\npexprs$7.Terminal.prototype.toString = function() {\n return JSON.stringify(this.obj);\n};\n\npexprs$7.Range.prototype.toString = function() {\n return JSON.stringify(this.from) + '..' + JSON.stringify(this.to);\n};\n\npexprs$7.Param.prototype.toString = function() {\n return '$' + this.index;\n};\n\npexprs$7.Lex.prototype.toString = function() {\n return '#(' + this.expr.toString() + ')';\n};\n\npexprs$7.Alt.prototype.toString = function() {\n return this.terms.length === 1 ?\n this.terms[0].toString() :\n '(' + this.terms.map(term => term.toString()).join(' | ') + ')';\n};\n\npexprs$7.Seq.prototype.toString = function() {\n return this.factors.length === 1 ?\n this.factors[0].toString() :\n '(' + this.factors.map(factor => factor.toString()).join(' ') + ')';\n};\n\npexprs$7.Iter.prototype.toString = function() {\n return this.expr + this.operator;\n};\n\npexprs$7.Not.prototype.toString = function() {\n return '~' + this.expr;\n};\n\npexprs$7.Lookahead.prototype.toString = function() {\n return '&' + this.expr;\n};\n\npexprs$7.Apply.prototype.toString = function() {\n if (this.args.length > 0) {\n const ps = this.args.map(arg => arg.toString());\n return this.ruleName + '<' + ps.join(',') + '>';\n } else {\n return this.ruleName;\n }\n};\n\npexprs$7.UnicodeChar.prototype.toString = function() {\n return '\\\\p{' + this.category + '}';\n};\n\n// --------------------------------------------------------------------\n// Re-export classes\n// --------------------------------------------------------------------\n\nvar pexprs$6 = pexprsMain;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Failure = Failure_1;\nconst {TerminalNode} = nodes$1;\nconst {assert: assert$1} = common$l;\nconst {PExpr, Terminal} = pexprs$6;\n\nclass CaseInsensitiveTerminal$1 extends PExpr {\n constructor(param) {\n super();\n this.obj = param;\n }\n\n _getString(state) {\n const terminal = state.currentApplication().args[this.obj.index];\n assert$1(terminal instanceof Terminal, 'expected a Terminal expression');\n return terminal.obj;\n }\n\n // Implementation of the PExpr API\n\n allowsSkippingPrecedingSpace() {\n return true;\n }\n\n eval(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const matchStr = this._getString(state);\n if (!inputStream.matchString(matchStr, true)) {\n state.processFailure(origPos, this);\n return false;\n } else {\n state.pushBinding(new TerminalNode(matchStr.length), origPos);\n return true;\n }\n }\n\n getArity() {\n return 1;\n }\n\n substituteParams(actuals) {\n return new CaseInsensitiveTerminal$1(this.obj.substituteParams(actuals));\n }\n\n toDisplayString() {\n return this.obj.toDisplayString() + ' (case-insensitive)';\n }\n\n toFailure(grammar) {\n return new Failure(\n this,\n this.obj.toFailure(grammar) + ' (case-insensitive)',\n 'description'\n );\n }\n\n _isNullable(grammar, memo) {\n return this.obj._isNullable(grammar, memo);\n }\n}\n\nvar CaseInsensitiveTerminal_1 = CaseInsensitiveTerminal$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Interval$1 = Interval_1;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction InputStream$3(source) {\n this.source = source;\n this.pos = 0;\n this.examinedLength = 0;\n}\n\nInputStream$3.prototype = {\n atEnd() {\n const ans = this.pos === this.source.length;\n this.examinedLength = Math.max(this.examinedLength, this.pos + 1);\n return ans;\n },\n\n next() {\n const ans = this.source[this.pos++];\n this.examinedLength = Math.max(this.examinedLength, this.pos);\n return ans;\n },\n\n nextCharCode() {\n const nextChar = this.next();\n return nextChar && nextChar.charCodeAt(0);\n },\n\n nextCodePoint() {\n const cp = this.source.slice(this.pos++).codePointAt(0);\n // If the code point is beyond plane 0, it takes up two characters.\n if (cp > 0xffff) {\n this.pos += 1;\n }\n this.examinedLength = Math.max(this.examinedLength, this.pos);\n return cp;\n },\n\n matchString(s, optIgnoreCase) {\n let idx;\n if (optIgnoreCase) {\n /*\n Case-insensitive comparison is a tricky business. Some notable gotchas include the\n \"Turkish I\" problem (http://www.i18nguy.com/unicode/turkish-i18n.html) and the fact\n that the German Esszet (ß) turns into \"SS\" in upper case.\n\n This is intended to be a locale-invariant comparison, which means it may not obey\n locale-specific expectations (e.g. \"i\" => \"İ\").\n */\n for (idx = 0; idx < s.length; idx++) {\n const actual = this.next();\n const expected = s[idx];\n if (actual == null || actual.toUpperCase() !== expected.toUpperCase()) {\n return false;\n }\n }\n return true;\n }\n // Default is case-sensitive comparison.\n for (idx = 0; idx < s.length; idx++) {\n if (this.next() !== s[idx]) {\n return false;\n }\n }\n return true;\n },\n\n sourceSlice(startIdx, endIdx) {\n return this.source.slice(startIdx, endIdx);\n },\n\n interval(startIdx, optEndIdx) {\n return new Interval$1(this.source, startIdx, optEndIdx ? optEndIdx : this.pos);\n },\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar InputStream_1 = InputStream$3;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$4 = common$l;\nconst util$4 = util$7;\nconst Interval = Interval_1;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction MatchResult$2(\n matcher,\n input,\n startExpr,\n cst,\n cstOffset,\n rightmostFailurePosition,\n optRecordedFailures\n) {\n this.matcher = matcher;\n this.input = input;\n this.startExpr = startExpr;\n this._cst = cst;\n this._cstOffset = cstOffset;\n this._rightmostFailurePosition = rightmostFailurePosition;\n this._rightmostFailures = optRecordedFailures;\n\n if (this.failed()) {\n /* eslint-disable no-invalid-this */\n common$4.defineLazyProperty(this, 'message', function() {\n const detail = 'Expected ' + this.getExpectedText();\n return (\n util$4.getLineAndColumnMessage(this.input, this.getRightmostFailurePosition()) + detail\n );\n });\n common$4.defineLazyProperty(this, 'shortMessage', function() {\n const detail = 'expected ' + this.getExpectedText();\n const errorInfo = util$4.getLineAndColumn(this.input, this.getRightmostFailurePosition());\n return 'Line ' + errorInfo.lineNum + ', col ' + errorInfo.colNum + ': ' + detail;\n });\n /* eslint-enable no-invalid-this */\n }\n}\n\nMatchResult$2.prototype.succeeded = function() {\n return !!this._cst;\n};\n\nMatchResult$2.prototype.failed = function() {\n return !this.succeeded();\n};\n\nMatchResult$2.prototype.getRightmostFailurePosition = function() {\n return this._rightmostFailurePosition;\n};\n\nMatchResult$2.prototype.getRightmostFailures = function() {\n if (!this._rightmostFailures) {\n this.matcher.setInput(this.input);\n const matchResultWithFailures = this.matcher._match(\n this.startExpr,\n false,\n this.getRightmostFailurePosition()\n );\n this._rightmostFailures = matchResultWithFailures.getRightmostFailures();\n }\n return this._rightmostFailures;\n};\n\nMatchResult$2.prototype.toString = function() {\n return this.succeeded() ?\n '[match succeeded]' :\n '[match failed at position ' + this.getRightmostFailurePosition() + ']';\n};\n\n// Return a string summarizing the expected contents of the input stream when\n// the match failure occurred.\nMatchResult$2.prototype.getExpectedText = function() {\n if (this.succeeded()) {\n throw new Error('cannot get expected text of a successful MatchResult');\n }\n\n const sb = new common$4.StringBuffer();\n let failures = this.getRightmostFailures();\n\n // Filter out the fluffy failures to make the default error messages more useful\n failures = failures.filter(failure => !failure.isFluffy());\n\n for (let idx = 0; idx < failures.length; idx++) {\n if (idx > 0) {\n if (idx === failures.length - 1) {\n sb.append(failures.length > 2 ? ', or ' : ' or ');\n } else {\n sb.append(', ');\n }\n }\n sb.append(failures[idx].toString());\n }\n return sb.contents();\n};\n\nMatchResult$2.prototype.getInterval = function() {\n const pos = this.getRightmostFailurePosition();\n return new Interval(this.input, pos, pos);\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar MatchResult_1 = MatchResult$2;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction PosInfo$1() {\n this.applicationMemoKeyStack = []; // active applications at this position\n this.memo = {};\n this.maxExaminedLength = 0;\n this.maxRightmostFailureOffset = -1;\n this.currentLeftRecursion = undefined;\n}\n\nPosInfo$1.prototype = {\n isActive(application) {\n return this.applicationMemoKeyStack.indexOf(application.toMemoKey()) >= 0;\n },\n\n enter(application) {\n this.applicationMemoKeyStack.push(application.toMemoKey());\n },\n\n exit() {\n this.applicationMemoKeyStack.pop();\n },\n\n startLeftRecursion(headApplication, memoRec) {\n memoRec.isLeftRecursion = true;\n memoRec.headApplication = headApplication;\n memoRec.nextLeftRecursion = this.currentLeftRecursion;\n this.currentLeftRecursion = memoRec;\n\n const {applicationMemoKeyStack} = this;\n const indexOfFirstInvolvedRule =\n applicationMemoKeyStack.indexOf(headApplication.toMemoKey()) + 1;\n const involvedApplicationMemoKeys = applicationMemoKeyStack.slice(\n indexOfFirstInvolvedRule\n );\n\n memoRec.isInvolved = function(applicationMemoKey) {\n return involvedApplicationMemoKeys.indexOf(applicationMemoKey) >= 0;\n };\n\n memoRec.updateInvolvedApplicationMemoKeys = function() {\n for (let idx = indexOfFirstInvolvedRule; idx < applicationMemoKeyStack.length; idx++) {\n const applicationMemoKey = applicationMemoKeyStack[idx];\n if (!this.isInvolved(applicationMemoKey)) {\n involvedApplicationMemoKeys.push(applicationMemoKey);\n }\n }\n };\n },\n\n endLeftRecursion() {\n this.currentLeftRecursion = this.currentLeftRecursion.nextLeftRecursion;\n },\n\n // Note: this method doesn't get called for the \"head\" of a left recursion -- for LR heads,\n // the memoized result (which starts out being a failure) is always used.\n shouldUseMemoizedResult(memoRec) {\n if (!memoRec.isLeftRecursion) {\n return true;\n }\n const {applicationMemoKeyStack} = this;\n for (let idx = 0; idx < applicationMemoKeyStack.length; idx++) {\n const applicationMemoKey = applicationMemoKeyStack[idx];\n if (memoRec.isInvolved(applicationMemoKey)) {\n return false;\n }\n }\n return true;\n },\n\n memoize(memoKey, memoRec) {\n this.memo[memoKey] = memoRec;\n this.maxExaminedLength = Math.max(this.maxExaminedLength, memoRec.examinedLength);\n this.maxRightmostFailureOffset = Math.max(\n this.maxRightmostFailureOffset,\n memoRec.rightmostFailureOffset\n );\n return memoRec;\n },\n\n clearObsoleteEntries(pos, invalidatedIdx) {\n if (pos + this.maxExaminedLength <= invalidatedIdx) {\n // Optimization: none of the rule applications that were memoized here examined the\n // interval of the input that changed, so nothing has to be invalidated.\n return;\n }\n\n const {memo} = this;\n this.maxExaminedLength = 0;\n this.maxRightmostFailureOffset = -1;\n Object.keys(memo).forEach(k => {\n const memoRec = memo[k];\n if (pos + memoRec.examinedLength > invalidatedIdx) {\n delete memo[k];\n } else {\n this.maxExaminedLength = Math.max(this.maxExaminedLength, memoRec.examinedLength);\n this.maxRightmostFailureOffset = Math.max(\n this.maxRightmostFailureOffset,\n memoRec.rightmostFailureOffset\n );\n }\n });\n },\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar PosInfo_1 = PosInfo$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst InputStream$2 = InputStream_1;\nconst MatchResult$1 = MatchResult_1;\nconst PosInfo = PosInfo_1;\nconst Trace = Trace_1;\nconst pexprs$5 = pexprs$6;\nconst util$3 = util$7;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nlet builtInApplySyntacticBody;\n\nutil$3.awaitBuiltInRules(builtInRules => {\n builtInApplySyntacticBody = builtInRules.rules.applySyntactic.body;\n});\n\nconst applySpaces = new pexprs$5.Apply('spaces');\n\nfunction MatchState$1(matcher, startExpr, optPositionToRecordFailures) {\n this.matcher = matcher;\n this.startExpr = startExpr;\n\n this.grammar = matcher.grammar;\n this.input = matcher.input;\n this.inputStream = new InputStream$2(matcher.input);\n this.memoTable = matcher.memoTable;\n\n this._bindings = [];\n this._bindingOffsets = [];\n this._applicationStack = [];\n this._posStack = [0];\n this.inLexifiedContextStack = [false];\n\n this.rightmostFailurePosition = -1;\n this._rightmostFailurePositionStack = [];\n this._recordedFailuresStack = [];\n\n if (optPositionToRecordFailures !== undefined) {\n this.positionToRecordFailures = optPositionToRecordFailures;\n this.recordedFailures = Object.create(null);\n }\n}\n\nMatchState$1.prototype = {\n posToOffset(pos) {\n return pos - this._posStack[this._posStack.length - 1];\n },\n\n enterApplication(posInfo, app) {\n this._posStack.push(this.inputStream.pos);\n this._applicationStack.push(app);\n this.inLexifiedContextStack.push(false);\n posInfo.enter(app);\n this._rightmostFailurePositionStack.push(this.rightmostFailurePosition);\n this.rightmostFailurePosition = -1;\n },\n\n exitApplication(posInfo, optNode) {\n const origPos = this._posStack.pop();\n this._applicationStack.pop();\n this.inLexifiedContextStack.pop();\n posInfo.exit();\n\n this.rightmostFailurePosition = Math.max(\n this.rightmostFailurePosition,\n this._rightmostFailurePositionStack.pop()\n );\n\n if (optNode) {\n this.pushBinding(optNode, origPos);\n }\n },\n\n enterLexifiedContext() {\n this.inLexifiedContextStack.push(true);\n },\n\n exitLexifiedContext() {\n this.inLexifiedContextStack.pop();\n },\n\n currentApplication() {\n return this._applicationStack[this._applicationStack.length - 1];\n },\n\n inSyntacticContext() {\n const currentApplication = this.currentApplication();\n if (currentApplication) {\n return currentApplication.isSyntactic() && !this.inLexifiedContext();\n } else {\n // The top-level context is syntactic if the start application is.\n return this.startExpr.factors[0].isSyntactic();\n }\n },\n\n inLexifiedContext() {\n return this.inLexifiedContextStack[this.inLexifiedContextStack.length - 1];\n },\n\n skipSpaces() {\n this.pushFailuresInfo();\n this.eval(applySpaces);\n this.popBinding();\n this.popFailuresInfo();\n return this.inputStream.pos;\n },\n\n skipSpacesIfInSyntacticContext() {\n return this.inSyntacticContext() ? this.skipSpaces() : this.inputStream.pos;\n },\n\n maybeSkipSpacesBefore(expr) {\n if (expr.allowsSkippingPrecedingSpace() && expr !== applySpaces) {\n return this.skipSpacesIfInSyntacticContext();\n } else {\n return this.inputStream.pos;\n }\n },\n\n pushBinding(node, origPos) {\n this._bindings.push(node);\n this._bindingOffsets.push(this.posToOffset(origPos));\n },\n\n popBinding() {\n this._bindings.pop();\n this._bindingOffsets.pop();\n },\n\n numBindings() {\n return this._bindings.length;\n },\n\n truncateBindings(newLength) {\n // Yes, this is this really faster than setting the `length` property (tested with\n // bin/es5bench on Node v6.1.0).\n // Update 2021-10-25: still true on v14.15.5 — it's ~20% speedup on es5bench.\n while (this._bindings.length > newLength) {\n this.popBinding();\n }\n },\n\n getCurrentPosInfo() {\n return this.getPosInfo(this.inputStream.pos);\n },\n\n getPosInfo(pos) {\n let posInfo = this.memoTable[pos];\n if (!posInfo) {\n posInfo = this.memoTable[pos] = new PosInfo();\n }\n return posInfo;\n },\n\n processFailure(pos, expr) {\n this.rightmostFailurePosition = Math.max(this.rightmostFailurePosition, pos);\n\n if (this.recordedFailures && pos === this.positionToRecordFailures) {\n const app = this.currentApplication();\n if (app) {\n // Substitute parameters with the actual pexprs that were passed to\n // the current rule.\n expr = expr.substituteParams(app.args);\n }\n\n this.recordFailure(expr.toFailure(this.grammar), false);\n }\n },\n\n recordFailure(failure, shouldCloneIfNew) {\n const key = failure.toKey();\n if (!this.recordedFailures[key]) {\n this.recordedFailures[key] = shouldCloneIfNew ? failure.clone() : failure;\n } else if (this.recordedFailures[key].isFluffy() && !failure.isFluffy()) {\n this.recordedFailures[key].clearFluffy();\n }\n },\n\n recordFailures(failures, shouldCloneIfNew) {\n Object.keys(failures).forEach(key => {\n this.recordFailure(failures[key], shouldCloneIfNew);\n });\n },\n\n cloneRecordedFailures() {\n if (!this.recordedFailures) {\n return undefined;\n }\n\n const ans = Object.create(null);\n Object.keys(this.recordedFailures).forEach(key => {\n ans[key] = this.recordedFailures[key].clone();\n });\n return ans;\n },\n\n getRightmostFailurePosition() {\n return this.rightmostFailurePosition;\n },\n\n _getRightmostFailureOffset() {\n return this.rightmostFailurePosition >= 0 ?\n this.posToOffset(this.rightmostFailurePosition) :\n -1;\n },\n\n // Returns the memoized trace entry for `expr` at `pos`, if one exists, `null` otherwise.\n getMemoizedTraceEntry(pos, expr) {\n const posInfo = this.memoTable[pos];\n if (posInfo && expr instanceof pexprs$5.Apply) {\n const memoRec = posInfo.memo[expr.toMemoKey()];\n if (memoRec && memoRec.traceEntry) {\n const entry = memoRec.traceEntry.cloneWithExpr(expr);\n entry.isMemoized = true;\n return entry;\n }\n }\n return null;\n },\n\n // Returns a new trace entry, with the currently active trace array as its children.\n getTraceEntry(pos, expr, succeeded, bindings) {\n if (expr instanceof pexprs$5.Apply) {\n const app = this.currentApplication();\n const actuals = app ? app.args : [];\n expr = expr.substituteParams(actuals);\n }\n return (\n this.getMemoizedTraceEntry(pos, expr) ||\n new Trace(this.input, pos, this.inputStream.pos, expr, succeeded, bindings, this.trace)\n );\n },\n\n isTracing() {\n return !!this.trace;\n },\n\n hasNecessaryInfo(memoRec) {\n if (this.trace && !memoRec.traceEntry) {\n return false;\n }\n\n if (\n this.recordedFailures &&\n this.inputStream.pos + memoRec.rightmostFailureOffset === this.positionToRecordFailures\n ) {\n return !!memoRec.failuresAtRightmostPosition;\n }\n\n return true;\n },\n\n useMemoizedResult(origPos, memoRec) {\n if (this.trace) {\n this.trace.push(memoRec.traceEntry);\n }\n\n const memoRecRightmostFailurePosition =\n this.inputStream.pos + memoRec.rightmostFailureOffset;\n this.rightmostFailurePosition = Math.max(\n this.rightmostFailurePosition,\n memoRecRightmostFailurePosition\n );\n if (\n this.recordedFailures &&\n this.positionToRecordFailures === memoRecRightmostFailurePosition &&\n memoRec.failuresAtRightmostPosition\n ) {\n this.recordFailures(memoRec.failuresAtRightmostPosition, true);\n }\n\n this.inputStream.examinedLength = Math.max(\n this.inputStream.examinedLength,\n memoRec.examinedLength + origPos\n );\n\n if (memoRec.value) {\n this.inputStream.pos += memoRec.matchLength;\n this.pushBinding(memoRec.value, origPos);\n return true;\n }\n return false;\n },\n\n // Evaluate `expr` and return `true` if it succeeded, `false` otherwise. On success, `bindings`\n // will have `expr.getArity()` more elements than before, and the input stream's position may\n // have increased. On failure, `bindings` and position will be unchanged.\n eval(expr) {\n const {inputStream} = this;\n const origNumBindings = this._bindings.length;\n\n let origRecordedFailures;\n if (this.recordedFailures) {\n origRecordedFailures = this.recordedFailures;\n this.recordedFailures = Object.create(null);\n }\n\n const origPos = inputStream.pos;\n const memoPos = this.maybeSkipSpacesBefore(expr);\n\n let origTrace;\n if (this.trace) {\n origTrace = this.trace;\n this.trace = [];\n }\n\n // Do the actual evaluation.\n const ans = expr.eval(this);\n\n if (this.trace) {\n const bindings = this._bindings.slice(origNumBindings);\n const traceEntry = this.getTraceEntry(memoPos, expr, ans, bindings);\n traceEntry.isImplicitSpaces = expr === applySpaces;\n traceEntry.isRootNode = expr === this.startExpr;\n origTrace.push(traceEntry);\n this.trace = origTrace;\n }\n\n if (ans) {\n if (this.recordedFailures && inputStream.pos === this.positionToRecordFailures) {\n Object.keys(this.recordedFailures).forEach(key => {\n this.recordedFailures[key].makeFluffy();\n });\n }\n } else {\n // Reset the position and the bindings.\n inputStream.pos = origPos;\n this.truncateBindings(origNumBindings);\n }\n\n if (this.recordedFailures) {\n this.recordFailures(origRecordedFailures, false);\n }\n\n // The built-in applySyntactic rule needs special handling: we want to skip\n // trailing spaces, just as with the top-level application of a syntactic rule.\n if (expr === builtInApplySyntacticBody) {\n this.skipSpaces();\n }\n\n return ans;\n },\n\n getMatchResult() {\n this.eval(this.startExpr);\n let rightmostFailures;\n if (this.recordedFailures) {\n rightmostFailures = Object.keys(this.recordedFailures).map(\n key => this.recordedFailures[key]\n );\n }\n const cst = this._bindings[0];\n if (cst) {\n cst.grammar = this.grammar;\n }\n return new MatchResult$1(\n this.matcher,\n this.input,\n this.startExpr,\n cst,\n this._bindingOffsets[0],\n this.rightmostFailurePosition,\n rightmostFailures\n );\n },\n\n getTrace() {\n this.trace = [];\n const matchResult = this.getMatchResult();\n\n // The trace node for the start rule is always the last entry. If it is a syntactic rule,\n // the first entry is for an application of 'spaces'.\n // TODO(pdubroy): Clean this up by introducing a special `Match` rule, which will\n // ensure that there is always a single root trace node.\n const rootTrace = this.trace[this.trace.length - 1];\n rootTrace.result = matchResult;\n return rootTrace;\n },\n\n pushFailuresInfo() {\n this._rightmostFailurePositionStack.push(this.rightmostFailurePosition);\n this._recordedFailuresStack.push(this.recordedFailures);\n },\n\n popFailuresInfo() {\n this.rightmostFailurePosition = this._rightmostFailurePositionStack.pop();\n this.recordedFailures = this._recordedFailuresStack.pop();\n },\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar MatchState_1 = MatchState$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst MatchState = MatchState_1;\n\nconst pexprs$4 = pexprs$6;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction Matcher$1(grammar) {\n this.grammar = grammar;\n this.memoTable = [];\n this.input = '';\n}\n\nMatcher$1.prototype.getInput = function() {\n return this.input;\n};\n\nMatcher$1.prototype.setInput = function(str) {\n if (this.input !== str) {\n this.replaceInputRange(0, this.input.length, str);\n }\n return this;\n};\n\nMatcher$1.prototype.replaceInputRange = function(startIdx, endIdx, str) {\n const currentInput = this.input;\n if (\n startIdx < 0 ||\n startIdx > currentInput.length ||\n endIdx < 0 ||\n endIdx > currentInput.length ||\n startIdx > endIdx\n ) {\n throw new Error('Invalid indices: ' + startIdx + ' and ' + endIdx);\n }\n\n // update input\n this.input = currentInput.slice(0, startIdx) + str + currentInput.slice(endIdx);\n\n // update memo table (similar to the above)\n const restOfMemoTable = this.memoTable.slice(endIdx);\n this.memoTable.length = startIdx;\n for (let idx = 0; idx < str.length; idx++) {\n this.memoTable.push(undefined);\n }\n restOfMemoTable.forEach(function(posInfo) {\n this.memoTable.push(posInfo);\n }, this);\n\n // Invalidate memoRecs\n for (let pos = 0; pos < startIdx; pos++) {\n const posInfo = this.memoTable[pos];\n if (posInfo) {\n posInfo.clearObsoleteEntries(pos, startIdx);\n }\n }\n\n return this;\n};\n\nMatcher$1.prototype.match = function(optStartApplicationStr) {\n return this._match(this._getStartExpr(optStartApplicationStr), false);\n};\n\nMatcher$1.prototype.trace = function(optStartApplicationStr) {\n return this._match(this._getStartExpr(optStartApplicationStr), true);\n};\n\nMatcher$1.prototype._match = function(startExpr, tracing, optPositionToRecordFailures) {\n const state = new MatchState(this, startExpr, optPositionToRecordFailures);\n return tracing ? state.getTrace() : state.getMatchResult();\n};\n\n/*\n Returns the starting expression for this Matcher's associated grammar. If `optStartApplicationStr`\n is specified, it is a string expressing a rule application in the grammar. If not specified, the\n grammar's default start rule will be used.\n*/\nMatcher$1.prototype._getStartExpr = function(optStartApplicationStr) {\n const applicationStr = optStartApplicationStr || this.grammar.defaultStartRule;\n if (!applicationStr) {\n throw new Error('Missing start rule argument -- the grammar has no default start rule.');\n }\n\n const startApp = this.grammar.parseApplication(applicationStr);\n return new pexprs$4.Seq([startApp, pexprs$4.end]);\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Matcher_1 = Matcher$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst InputStream$1 = InputStream_1;\nconst {IterationNode} = nodes$1;\nconst MatchResult = MatchResult_1;\nconst common$3 = common$l;\nconst errors$3 = errors$9;\nconst util$2 = util$7;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nconst globalActionStack = [];\n\nconst hasOwnProperty = (x, prop) => Object.prototype.hasOwnProperty.call(x, prop);\n\n// ----------------- Wrappers -----------------\n\n// Wrappers decorate CST nodes with all of the functionality (i.e., operations and attributes)\n// provided by a Semantics (see below). `Wrapper` is the abstract superclass of all wrappers. A\n// `Wrapper` must have `_node` and `_semantics` instance variables, which refer to the CST node and\n// Semantics (resp.) for which it was created, and a `_childWrappers` instance variable which is\n// used to cache the wrapper instances that are created for its child nodes. Setting these instance\n// variables is the responsibility of the constructor of each Semantics-specific subclass of\n// `Wrapper`.\nclass Wrapper {\n constructor(node, sourceInterval, baseInterval) {\n this._node = node;\n this.source = sourceInterval;\n\n // The interval that the childOffsets of `node` are relative to. It should be the source\n // of the closest Nonterminal node.\n this._baseInterval = baseInterval;\n\n if (node.isNonterminal()) {\n common$3.assert(sourceInterval === baseInterval);\n }\n this._childWrappers = [];\n }\n\n toString() {\n return '[semantics wrapper for ' + this._node.grammar.name + ']';\n }\n\n _forgetMemoizedResultFor(attributeName) {\n // Remove the memoized attribute from the cstNode and all its children.\n delete this._node[this._semantics.attributeKeys[attributeName]];\n this.children.forEach(child => {\n child._forgetMemoizedResultFor(attributeName);\n });\n }\n\n // Returns the wrapper of the specified child node. Child wrappers are created lazily and\n // cached in the parent wrapper's `_childWrappers` instance variable.\n child(idx) {\n if (!(0 <= idx && idx < this._node.numChildren())) {\n // TODO: Consider throwing an exception here.\n return undefined;\n }\n let childWrapper = this._childWrappers[idx];\n if (!childWrapper) {\n const childNode = this._node.childAt(idx);\n const offset = this._node.childOffsets[idx];\n\n const source = this._baseInterval.subInterval(offset, childNode.matchLength);\n const base = childNode.isNonterminal() ? source : this._baseInterval;\n childWrapper = this._childWrappers[idx] = this._semantics.wrap(childNode, source, base);\n }\n return childWrapper;\n }\n\n // Returns an array containing the wrappers of all of the children of the node associated\n // with this wrapper.\n _children() {\n // Force the creation of all child wrappers\n for (let idx = 0; idx < this._node.numChildren(); idx++) {\n this.child(idx);\n }\n return this._childWrappers;\n }\n\n // Returns `true` if the CST node associated with this wrapper corresponds to an iteration\n // expression, i.e., a Kleene-*, Kleene-+, or an optional. Returns `false` otherwise.\n isIteration() {\n return this._node.isIteration();\n }\n\n // Returns `true` if the CST node associated with this wrapper is a terminal node, `false`\n // otherwise.\n isTerminal() {\n return this._node.isTerminal();\n }\n\n // Returns `true` if the CST node associated with this wrapper is a nonterminal node, `false`\n // otherwise.\n isNonterminal() {\n return this._node.isNonterminal();\n }\n\n // Returns `true` if the CST node associated with this wrapper is a nonterminal node\n // corresponding to a syntactic rule, `false` otherwise.\n isSyntactic() {\n return this.isNonterminal() && this._node.isSyntactic();\n }\n\n // Returns `true` if the CST node associated with this wrapper is a nonterminal node\n // corresponding to a lexical rule, `false` otherwise.\n isLexical() {\n return this.isNonterminal() && this._node.isLexical();\n }\n\n // Returns `true` if the CST node associated with this wrapper is an iterator node\n // having either one or no child (? operator), `false` otherwise.\n // Otherwise, throws an exception.\n isOptional() {\n return this._node.isOptional();\n }\n\n // Create a new _iter wrapper in the same semantics as this wrapper.\n iteration(optChildWrappers) {\n const childWrappers = optChildWrappers || [];\n\n const childNodes = childWrappers.map(c => c._node);\n const iter = new IterationNode(childNodes, [], -1, false);\n\n const wrapper = this._semantics.wrap(iter, null, null);\n wrapper._childWrappers = childWrappers;\n return wrapper;\n }\n\n // Returns an array containing the children of this CST node.\n get children() {\n return this._children();\n }\n\n // Returns the name of grammar rule that created this CST node.\n get ctorName() {\n return this._node.ctorName;\n }\n\n // TODO: Remove this eventually (deprecated in v0.12).\n get interval() {\n throw new Error('The `interval` property is deprecated -- use `source` instead');\n }\n\n // Returns the number of children of this CST node.\n get numChildren() {\n return this._node.numChildren();\n }\n\n // Returns the contents of the input stream consumed by this CST node.\n get sourceString() {\n return this.source.contents;\n }\n}\n\n// ----------------- Semantics -----------------\n\n// A Semantics is a container for a family of Operations and Attributes for a given grammar.\n// Semantics enable modularity (different clients of a grammar can create their set of operations\n// and attributes in isolation) and extensibility even when operations and attributes are mutually-\n// recursive. This constructor should not be called directly except from\n// `Semantics.createSemantics`. The normal ways to create a Semantics, given a grammar 'g', are\n// `g.createSemantics()` and `g.extendSemantics(parentSemantics)`.\nfunction Semantics$2(grammar, superSemantics) {\n const self = this;\n this.grammar = grammar;\n this.checkedActionDicts = false;\n\n // Constructor for wrapper instances, which are passed as the arguments to the semantic actions\n // of an operation or attribute. Operations and attributes require double dispatch: the semantic\n // action is chosen based on both the node's type and the semantics. Wrappers ensure that\n // the `execute` method is called with the correct (most specific) semantics object as an\n // argument.\n this.Wrapper = class extends (superSemantics ? superSemantics.Wrapper : Wrapper) {\n constructor(node, sourceInterval, baseInterval) {\n super(node, sourceInterval, baseInterval);\n self.checkActionDictsIfHaventAlready();\n this._semantics = self;\n }\n };\n\n this.super = superSemantics;\n if (superSemantics) {\n if (!(grammar.equals(this.super.grammar) || grammar._inheritsFrom(this.super.grammar))) {\n throw new Error(\n \"Cannot extend a semantics for grammar '\" +\n this.super.grammar.name +\n \"' for use with grammar '\" +\n grammar.name +\n \"' (not a sub-grammar)\"\n );\n }\n this.operations = Object.create(this.super.operations);\n this.attributes = Object.create(this.super.attributes);\n this.attributeKeys = Object.create(null);\n\n // Assign unique symbols for each of the attributes inherited from the super-semantics so that\n // they are memoized independently.\n // eslint-disable-next-line guard-for-in\n for (const attributeName in this.attributes) {\n Object.defineProperty(this.attributeKeys, attributeName, {\n value: util$2.uniqueId(attributeName),\n });\n }\n } else {\n this.operations = Object.create(null);\n this.attributes = Object.create(null);\n this.attributeKeys = Object.create(null);\n }\n}\n\nSemantics$2.prototype.toString = function() {\n return '[semantics for ' + this.grammar.name + ']';\n};\n\nSemantics$2.prototype.checkActionDictsIfHaventAlready = function() {\n if (!this.checkedActionDicts) {\n this.checkActionDicts();\n this.checkedActionDicts = true;\n }\n};\n\n// Checks that the action dictionaries for all operations and attributes in this semantics,\n// including the ones that were inherited from the super-semantics, agree with the grammar.\n// Throws an exception if one or more of them doesn't.\nSemantics$2.prototype.checkActionDicts = function() {\n let name;\n // eslint-disable-next-line guard-for-in\n for (name in this.operations) {\n this.operations[name].checkActionDict(this.grammar);\n }\n // eslint-disable-next-line guard-for-in\n for (name in this.attributes) {\n this.attributes[name].checkActionDict(this.grammar);\n }\n};\n\nSemantics$2.prototype.toRecipe = function(semanticsOnly) {\n function hasSuperSemantics(s) {\n return s.super !== Semantics$2.BuiltInSemantics._getSemantics();\n }\n\n let str = '(function(g) {\\n';\n if (hasSuperSemantics(this)) {\n str += ' var semantics = ' + this.super.toRecipe(true) + '(g';\n\n const superSemanticsGrammar = this.super.grammar;\n let relatedGrammar = this.grammar;\n while (relatedGrammar !== superSemanticsGrammar) {\n str += '.superGrammar';\n relatedGrammar = relatedGrammar.superGrammar;\n }\n\n str += ');\\n';\n str += ' return g.extendSemantics(semantics)';\n } else {\n str += ' return g.createSemantics()';\n }\n ['Operation', 'Attribute'].forEach(type => {\n const semanticOperations = this[type.toLowerCase() + 's'];\n Object.keys(semanticOperations).forEach(name => {\n const {actionDict, formals, builtInDefault} = semanticOperations[name];\n\n let signature = name;\n if (formals.length > 0) {\n signature += '(' + formals.join(', ') + ')';\n }\n\n let method;\n if (hasSuperSemantics(this) && this.super[type.toLowerCase() + 's'][name]) {\n method = 'extend' + type;\n } else {\n method = 'add' + type;\n }\n str += '\\n .' + method + '(' + JSON.stringify(signature) + ', {';\n\n const srcArray = [];\n Object.keys(actionDict).forEach(actionName => {\n if (actionDict[actionName] !== builtInDefault) {\n let source = actionDict[actionName].toString().trim();\n\n // Convert method shorthand to plain old function syntax.\n // https://github.com/harc/ohm/issues/263\n source = source.replace(/^.*\\(/, 'function(');\n\n srcArray.push('\\n ' + JSON.stringify(actionName) + ': ' + source);\n }\n });\n str += srcArray.join(',') + '\\n })';\n });\n });\n str += ';\\n })';\n\n if (!semanticsOnly) {\n str =\n '(function() {\\n' +\n ' var grammar = this.fromRecipe(' +\n this.grammar.toRecipe() +\n ');\\n' +\n ' var semantics = ' +\n str +\n '(grammar);\\n' +\n ' return semantics;\\n' +\n '});\\n';\n }\n\n return str;\n};\n\nfunction parseSignature$1(signature, type) {\n if (!Semantics$2.prototypeGrammar) {\n // The Operations and Attributes grammar won't be available while Ohm is loading,\n // but we can get away the following simplification b/c none of the operations\n // that are used while loading take arguments.\n common$3.assert(signature.indexOf('(') === -1);\n return {\n name: signature,\n formals: [],\n };\n }\n\n const r = Semantics$2.prototypeGrammar.match(\n signature,\n type === 'operation' ? 'OperationSignature' : 'AttributeSignature'\n );\n if (r.failed()) {\n throw new Error(r.message);\n }\n\n return Semantics$2.prototypeGrammarSemantics(r).parse();\n}\n\nfunction newDefaultAction(type, name, doIt) {\n return function(...children) {\n const thisThing = this._semantics.operations[name] || this._semantics.attributes[name];\n const args = thisThing.formals.map(formal => this.args[formal]);\n\n if (!this.isIteration() && children.length === 1) {\n // This CST node corresponds to a non-terminal in the grammar (e.g., AddExpr). The fact that\n // we got here means that this action dictionary doesn't have an action for this particular\n // non-terminal or a generic `_nonterminal` action.\n // As a convenience, if this node only has one child, we just return the result of applying\n // this operation / attribute to the child node.\n return doIt.apply(children[0], args);\n } else {\n // Otherwise, we throw an exception to let the programmer know that we don't know what\n // to do with this node.\n throw errors$3.missingSemanticAction(this.ctorName, name, type, globalActionStack);\n }\n };\n}\n\nSemantics$2.prototype.addOperationOrAttribute = function(type, signature, actionDict) {\n const typePlural = type + 's';\n\n const parsedNameAndFormalArgs = parseSignature$1(signature, type);\n const {name} = parsedNameAndFormalArgs;\n const {formals} = parsedNameAndFormalArgs;\n\n // TODO: check that there are no duplicate formal arguments\n\n this.assertNewName(name, type);\n\n // Create the action dictionary for this operation / attribute that contains a `_default` action\n // which defines the default behavior of iteration, terminal, and non-terminal nodes...\n const builtInDefault = newDefaultAction(type, name, doIt);\n const realActionDict = {_default: builtInDefault};\n // ... and add in the actions supplied by the programmer, which may override some or all of the\n // default ones.\n Object.keys(actionDict).forEach(name => {\n realActionDict[name] = actionDict[name];\n });\n\n const entry =\n type === 'operation' ?\n new Operation(name, formals, realActionDict, builtInDefault) :\n new Attribute(name, realActionDict, builtInDefault);\n\n // The following check is not strictly necessary (it will happen later anyway) but it's better to\n // catch errors early.\n entry.checkActionDict(this.grammar);\n\n this[typePlural][name] = entry;\n\n function doIt(...args) {\n // Dispatch to most specific version of this operation / attribute -- it may have been\n // overridden by a sub-semantics.\n const thisThing = this._semantics[typePlural][name];\n\n // Check that the caller passed the correct number of arguments.\n if (arguments.length !== thisThing.formals.length) {\n throw new Error(\n 'Invalid number of arguments passed to ' +\n name +\n ' ' +\n type +\n ' (expected ' +\n thisThing.formals.length +\n ', got ' +\n arguments.length +\n ')'\n );\n }\n\n // Create an \"arguments object\" from the arguments that were passed to this\n // operation / attribute.\n const argsObj = Object.create(null);\n for (const [idx, val] of Object.entries(args)) {\n const formal = thisThing.formals[idx];\n argsObj[formal] = val;\n }\n\n const oldArgs = this.args;\n this.args = argsObj;\n const ans = thisThing.execute(this._semantics, this);\n this.args = oldArgs;\n return ans;\n }\n\n if (type === 'operation') {\n this.Wrapper.prototype[name] = doIt;\n this.Wrapper.prototype[name].toString = function() {\n return '[' + name + ' operation]';\n };\n } else {\n Object.defineProperty(this.Wrapper.prototype, name, {\n get: doIt,\n configurable: true, // So the property can be deleted.\n });\n Object.defineProperty(this.attributeKeys, name, {\n value: util$2.uniqueId(name),\n });\n }\n};\n\nSemantics$2.prototype.extendOperationOrAttribute = function(type, name, actionDict) {\n const typePlural = type + 's';\n\n // Make sure that `name` really is just a name, i.e., that it doesn't also contain formals.\n parseSignature$1(name, 'attribute');\n\n if (!(this.super && name in this.super[typePlural])) {\n throw new Error(\n 'Cannot extend ' +\n type +\n \" '\" +\n name +\n \"': did not inherit an \" +\n type +\n ' with that name'\n );\n }\n if (hasOwnProperty(this[typePlural], name)) {\n throw new Error('Cannot extend ' + type + \" '\" + name + \"' again\");\n }\n\n // Create a new operation / attribute whose actionDict delegates to the super operation /\n // attribute's actionDict, and which has all the keys from `inheritedActionDict`.\n const inheritedFormals = this[typePlural][name].formals;\n const inheritedActionDict = this[typePlural][name].actionDict;\n const newActionDict = Object.create(inheritedActionDict);\n Object.keys(actionDict).forEach(name => {\n newActionDict[name] = actionDict[name];\n });\n\n this[typePlural][name] =\n type === 'operation' ?\n new Operation(name, inheritedFormals, newActionDict) :\n new Attribute(name, newActionDict);\n\n // The following check is not strictly necessary (it will happen later anyway) but it's better to\n // catch errors early.\n this[typePlural][name].checkActionDict(this.grammar);\n};\n\nSemantics$2.prototype.assertNewName = function(name, type) {\n if (hasOwnProperty(Wrapper.prototype, name)) {\n throw new Error('Cannot add ' + type + \" '\" + name + \"': that's a reserved name\");\n }\n if (name in this.operations) {\n throw new Error(\n 'Cannot add ' + type + \" '\" + name + \"': an operation with that name already exists\"\n );\n }\n if (name in this.attributes) {\n throw new Error(\n 'Cannot add ' + type + \" '\" + name + \"': an attribute with that name already exists\"\n );\n }\n};\n\n// Returns a wrapper for the given CST `node` in this semantics.\n// If `node` is already a wrapper, returns `node` itself. // TODO: why is this needed?\nSemantics$2.prototype.wrap = function(node, source, optBaseInterval) {\n const baseInterval = optBaseInterval || source;\n return node instanceof this.Wrapper ? node : new this.Wrapper(node, source, baseInterval);\n};\n\n// Creates a new Semantics instance for `grammar`, inheriting operations and attributes from\n// `optSuperSemantics`, if it is specified. Returns a function that acts as a proxy for the new\n// Semantics instance. When that function is invoked with a CST node as an argument, it returns\n// a wrapper for that node which gives access to the operations and attributes provided by this\n// semantics.\nSemantics$2.createSemantics = function(grammar, optSuperSemantics) {\n const s = new Semantics$2(\n grammar,\n optSuperSemantics !== undefined ?\n optSuperSemantics :\n Semantics$2.BuiltInSemantics._getSemantics()\n );\n\n // To enable clients to invoke a semantics like a function, return a function that acts as a proxy\n // for `s`, which is the real `Semantics` instance.\n const proxy = function ASemantics(matchResult) {\n if (!(matchResult instanceof MatchResult)) {\n throw new TypeError(\n 'Semantics expected a MatchResult, but got ' +\n common$3.unexpectedObjToString(matchResult)\n );\n }\n if (matchResult.failed()) {\n throw new TypeError('cannot apply Semantics to ' + matchResult.toString());\n }\n\n const cst = matchResult._cst;\n if (cst.grammar !== grammar) {\n throw new Error(\n \"Cannot use a MatchResult from grammar '\" +\n cst.grammar.name +\n \"' with a semantics for '\" +\n grammar.name +\n \"'\"\n );\n }\n const inputStream = new InputStream$1(matchResult.input);\n return s.wrap(cst, inputStream.interval(matchResult._cstOffset, matchResult.input.length));\n };\n\n // Forward public methods from the proxy to the semantics instance.\n proxy.addOperation = function(signature, actionDict) {\n s.addOperationOrAttribute('operation', signature, actionDict);\n return proxy;\n };\n proxy.extendOperation = function(name, actionDict) {\n s.extendOperationOrAttribute('operation', name, actionDict);\n return proxy;\n };\n proxy.addAttribute = function(name, actionDict) {\n s.addOperationOrAttribute('attribute', name, actionDict);\n return proxy;\n };\n proxy.extendAttribute = function(name, actionDict) {\n s.extendOperationOrAttribute('attribute', name, actionDict);\n return proxy;\n };\n proxy._getActionDict = function(operationOrAttributeName) {\n const action =\n s.operations[operationOrAttributeName] || s.attributes[operationOrAttributeName];\n if (!action) {\n throw new Error(\n '\"' +\n operationOrAttributeName +\n '\" is not a valid operation or attribute ' +\n 'name in this semantics for \"' +\n grammar.name +\n '\"'\n );\n }\n return action.actionDict;\n };\n proxy._remove = function(operationOrAttributeName) {\n let semantic;\n if (operationOrAttributeName in s.operations) {\n semantic = s.operations[operationOrAttributeName];\n delete s.operations[operationOrAttributeName];\n } else if (operationOrAttributeName in s.attributes) {\n semantic = s.attributes[operationOrAttributeName];\n delete s.attributes[operationOrAttributeName];\n }\n delete s.Wrapper.prototype[operationOrAttributeName];\n return semantic;\n };\n proxy.getOperationNames = function() {\n return Object.keys(s.operations);\n };\n proxy.getAttributeNames = function() {\n return Object.keys(s.attributes);\n };\n proxy.getGrammar = function() {\n return s.grammar;\n };\n proxy.toRecipe = function(semanticsOnly) {\n return s.toRecipe(semanticsOnly);\n };\n\n // Make the proxy's toString() work.\n proxy.toString = s.toString.bind(s);\n\n // Returns the semantics for the proxy.\n proxy._getSemantics = function() {\n return s;\n };\n\n return proxy;\n};\n\n// ----------------- Operation -----------------\n\n// An Operation represents a function to be applied to a concrete syntax tree (CST) -- it's very\n// similar to a Visitor (http://en.wikipedia.org/wiki/Visitor_pattern). An operation is executed by\n// recursively walking the CST, and at each node, invoking the matching semantic action from\n// `actionDict`. See `Operation.prototype.execute` for details of how a CST node's matching semantic\n// action is found.\nclass Operation {\n constructor(name, formals, actionDict, builtInDefault) {\n this.name = name;\n this.formals = formals;\n this.actionDict = actionDict;\n this.builtInDefault = builtInDefault;\n }\n\n checkActionDict(grammar) {\n grammar._checkTopDownActionDict(this.typeName, this.name, this.actionDict);\n }\n\n // Execute this operation on the CST node associated with `nodeWrapper` in the context of the\n // given Semantics instance.\n execute(semantics, nodeWrapper) {\n try {\n // Look for a semantic action whose name matches the node's constructor name, which is either\n // the name of a rule in the grammar, or '_terminal' (for a terminal node), or '_iter' (for an\n // iteration node).\n const {ctorName} = nodeWrapper._node;\n let actionFn = this.actionDict[ctorName];\n if (actionFn) {\n globalActionStack.push([this, ctorName]);\n return actionFn.apply(nodeWrapper, nodeWrapper._children());\n }\n\n // The action dictionary does not contain a semantic action for this specific type of node.\n // If this is a nonterminal node and the programmer has provided a `_nonterminal` semantic\n // action, we invoke it:\n if (nodeWrapper.isNonterminal()) {\n actionFn = this.actionDict._nonterminal;\n if (actionFn) {\n globalActionStack.push([this, '_nonterminal', ctorName]);\n return actionFn.apply(nodeWrapper, nodeWrapper._children());\n }\n }\n\n // Otherwise, we invoke the '_default' semantic action.\n globalActionStack.push([this, 'default action', ctorName]);\n return this.actionDict._default.apply(nodeWrapper, nodeWrapper._children());\n } finally {\n globalActionStack.pop();\n }\n }\n}\n\nOperation.prototype.typeName = 'operation';\n\n// ----------------- Attribute -----------------\n\n// Attributes are Operations whose results are memoized. This means that, for any given semantics,\n// the semantic action for a CST node will be invoked no more than once.\nclass Attribute extends Operation {\n constructor(name, actionDict, builtInDefault) {\n super(name, [], actionDict, builtInDefault);\n }\n\n execute(semantics, nodeWrapper) {\n const node = nodeWrapper._node;\n const key = semantics.attributeKeys[this.name];\n if (!hasOwnProperty(node, key)) {\n // The following is a super-send -- isn't JS beautiful? :/\n node[key] = Operation.prototype.execute.call(this, semantics, nodeWrapper);\n }\n return node[key];\n }\n}\n\nAttribute.prototype.typeName = 'attribute';\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Semantics_1 = Semantics$2;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst CaseInsensitiveTerminal = CaseInsensitiveTerminal_1;\nconst Matcher = Matcher_1;\nconst Semantics$1 = Semantics_1;\nconst common$2 = common$l;\nconst errors$2 = errors$9;\nconst pexprs$3 = pexprs$6;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nconst SPECIAL_ACTION_NAMES = ['_iter', '_terminal', '_nonterminal', '_default'];\n\nfunction getSortedRuleValues(grammar) {\n return Object.keys(grammar.rules)\n .sort()\n .map(name => grammar.rules[name]);\n}\n\n// Until ES2019, JSON was not a valid subset of JavaScript because U+2028 (line separator)\n// and U+2029 (paragraph separator) are allowed in JSON string literals, but not in JS.\n// This function properly encodes those two characters so that the resulting string is\n// represents both valid JSON, and valid JavaScript (for ES2018 and below).\n// See https://v8.dev/features/subsume-json for more details.\nconst jsonToJS = str => str.replace(/\\u2028/g, '\\\\u2028').replace(/\\u2029/g, '\\\\u2029');\n\nfunction Grammar$4(name, superGrammar, rules, optDefaultStartRule) {\n this.name = name;\n this.superGrammar = superGrammar;\n this.rules = rules;\n if (optDefaultStartRule) {\n if (!(optDefaultStartRule in rules)) {\n throw new Error(\n \"Invalid start rule: '\" +\n optDefaultStartRule +\n \"' is not a rule in grammar '\" +\n name +\n \"'\"\n );\n }\n this.defaultStartRule = optDefaultStartRule;\n }\n}\n\nlet ohmGrammar$2;\nlet buildGrammar$1;\n\n// This method is called from main.js once Ohm has loaded.\nGrammar$4.initApplicationParser = function(grammar, builderFn) {\n ohmGrammar$2 = grammar;\n buildGrammar$1 = builderFn;\n};\n\nGrammar$4.prototype = {\n matcher() {\n return new Matcher(this);\n },\n\n // Return true if the grammar is a built-in grammar, otherwise false.\n // NOTE: This might give an unexpected result if called before BuiltInRules is defined!\n isBuiltIn() {\n return this === Grammar$4.ProtoBuiltInRules || this === Grammar$4.BuiltInRules;\n },\n\n equals(g) {\n if (this === g) {\n return true;\n }\n // Do the cheapest comparisons first.\n if (\n g == null ||\n this.name !== g.name ||\n this.defaultStartRule !== g.defaultStartRule ||\n !(this.superGrammar === g.superGrammar || this.superGrammar.equals(g.superGrammar))\n ) {\n return false;\n }\n const myRules = getSortedRuleValues(this);\n const otherRules = getSortedRuleValues(g);\n return (\n myRules.length === otherRules.length &&\n myRules.every((rule, i) => {\n return (\n rule.description === otherRules[i].description &&\n rule.formals.join(',') === otherRules[i].formals.join(',') &&\n rule.body.toString() === otherRules[i].body.toString()\n );\n })\n );\n },\n\n match(input, optStartApplication) {\n const m = this.matcher();\n m.replaceInputRange(0, 0, input);\n return m.match(optStartApplication);\n },\n\n trace(input, optStartApplication) {\n const m = this.matcher();\n m.replaceInputRange(0, 0, input);\n return m.trace(optStartApplication);\n },\n\n createSemantics() {\n return Semantics$1.createSemantics(this);\n },\n\n extendSemantics(superSemantics) {\n return Semantics$1.createSemantics(this, superSemantics._getSemantics());\n },\n\n // Check that every key in `actionDict` corresponds to a semantic action, and that it maps to\n // a function of the correct arity. If not, throw an exception.\n _checkTopDownActionDict(what, name, actionDict) {\n const problems = [];\n\n // eslint-disable-next-line guard-for-in\n for (const k in actionDict) {\n const v = actionDict[k];\n const isSpecialAction = SPECIAL_ACTION_NAMES.includes(k);\n\n if (!isSpecialAction && !(k in this.rules)) {\n problems.push(`'${k}' is not a valid semantic action for '${this.name}'`);\n continue;\n }\n if (typeof v !== 'function') {\n problems.push(`'${k}' must be a function in an action dictionary for '${this.name}'`);\n continue;\n }\n const actual = v.length;\n const expected = this._topDownActionArity(k);\n if (actual !== expected) {\n let details;\n if (k === '_iter' || k === '_nonterminal') {\n details =\n `it should use a rest parameter, e.g. \\`${k}(...children) {}\\`. ` +\n 'NOTE: this is new in Ohm v16 — see https://ohmjs.org/d/ati for details.';\n } else {\n details = `expected ${expected}, got ${actual}`;\n }\n problems.push(`Semantic action '${k}' has the wrong arity: ${details}`);\n }\n }\n if (problems.length > 0) {\n const prettyProblems = problems.map(problem => '- ' + problem);\n const error = new Error(\n [\n `Found errors in the action dictionary of the '${name}' ${what}:`,\n ...prettyProblems,\n ].join('\\n')\n );\n error.problems = problems;\n throw error;\n }\n },\n\n // Return the expected arity for a semantic action named `actionName`, which\n // is either a rule name or a special action name like '_nonterminal'.\n _topDownActionArity(actionName) {\n // All special actions have an expected arity of 0, though all but _terminal\n // are expected to use the rest parameter syntax (e.g. `_iter(...children)`).\n // This is considered to have arity 0, i.e. `((...args) => {}).length` is 0.\n return SPECIAL_ACTION_NAMES.includes(actionName) ?\n 0 :\n this.rules[actionName].body.getArity();\n },\n\n _inheritsFrom(grammar) {\n let g = this.superGrammar;\n while (g) {\n if (g.equals(grammar, true)) {\n return true;\n }\n g = g.superGrammar;\n }\n return false;\n },\n\n toRecipe(superGrammarExpr = undefined) {\n const metaInfo = {};\n // Include the grammar source if it is available.\n if (this.source) {\n metaInfo.source = this.source.contents;\n }\n\n let startRule = null;\n if (this.defaultStartRule) {\n startRule = this.defaultStartRule;\n }\n\n const rules = {};\n Object.keys(this.rules).forEach(ruleName => {\n const ruleInfo = this.rules[ruleName];\n const {body} = ruleInfo;\n const isDefinition = !this.superGrammar || !this.superGrammar.rules[ruleName];\n\n let operation;\n if (isDefinition) {\n operation = 'define';\n } else {\n operation = body instanceof pexprs$3.Extend ? 'extend' : 'override';\n }\n\n const metaInfo = {};\n if (ruleInfo.source && this.source) {\n const adjusted = ruleInfo.source.relativeTo(this.source);\n metaInfo.sourceInterval = [adjusted.startIdx, adjusted.endIdx];\n }\n\n const description = isDefinition ? ruleInfo.description : null;\n const bodyRecipe = body.outputRecipe(ruleInfo.formals, this.source);\n\n rules[ruleName] = [\n operation, // \"define\"/\"extend\"/\"override\"\n metaInfo,\n description,\n ruleInfo.formals,\n bodyRecipe,\n ];\n });\n\n // If the caller provided an expression to use for the supergrammar, use that.\n // Otherwise, if the supergrammar is a user grammar, use its recipe inline.\n let superGrammarOutput = 'null';\n if (superGrammarExpr) {\n superGrammarOutput = superGrammarExpr;\n } else if (this.superGrammar && !this.superGrammar.isBuiltIn()) {\n superGrammarOutput = this.superGrammar.toRecipe();\n }\n\n const recipeElements = [\n ...['grammar', metaInfo, this.name].map(JSON.stringify),\n superGrammarOutput,\n ...[startRule, rules].map(JSON.stringify),\n ];\n return jsonToJS(`[${recipeElements.join(',')}]`);\n },\n\n // TODO: Come up with better names for these methods.\n // TODO: Write the analog of these methods for inherited attributes.\n toOperationActionDictionaryTemplate() {\n return this._toOperationOrAttributeActionDictionaryTemplate();\n },\n toAttributeActionDictionaryTemplate() {\n return this._toOperationOrAttributeActionDictionaryTemplate();\n },\n\n _toOperationOrAttributeActionDictionaryTemplate() {\n // TODO: add the super-grammar's templates at the right place, e.g., a case for AddExpr_plus\n // should appear next to other cases of AddExpr.\n\n const sb = new common$2.StringBuffer();\n sb.append('{');\n\n let first = true;\n // eslint-disable-next-line guard-for-in\n for (const ruleName in this.rules) {\n const {body} = this.rules[ruleName];\n if (first) {\n first = false;\n } else {\n sb.append(',');\n }\n sb.append('\\n');\n sb.append(' ');\n this.addSemanticActionTemplate(ruleName, body, sb);\n }\n\n sb.append('\\n}');\n return sb.contents();\n },\n\n addSemanticActionTemplate(ruleName, body, sb) {\n sb.append(ruleName);\n sb.append(': function(');\n const arity = this._topDownActionArity(ruleName);\n sb.append(common$2.repeat('_', arity).join(', '));\n sb.append(') {\\n');\n sb.append(' }');\n },\n\n // Parse a string which expresses a rule application in this grammar, and return the\n // resulting Apply node.\n parseApplication(str) {\n let app;\n if (str.indexOf('<') === -1) {\n // simple application\n app = new pexprs$3.Apply(str);\n } else {\n // parameterized application\n const cst = ohmGrammar$2.match(str, 'Base_application');\n app = buildGrammar$1(cst, {});\n }\n\n // Ensure that the application is valid.\n if (!(app.ruleName in this.rules)) {\n throw errors$2.undeclaredRule(app.ruleName, this.name);\n }\n const {formals} = this.rules[app.ruleName];\n if (formals.length !== app.args.length) {\n const {source} = this.rules[app.ruleName];\n throw errors$2.wrongNumberOfParameters(\n app.ruleName,\n formals.length,\n app.args.length,\n source\n );\n }\n return app;\n },\n};\n\n// The following grammar contains a few rules that couldn't be written in \"userland\".\n// At the bottom of src/main.js, we create a sub-grammar of this grammar that's called\n// `BuiltInRules`. That grammar contains several convenience rules, e.g., `letter` and\n// `digit`, and is implicitly the super-grammar of any grammar whose super-grammar\n// isn't specified.\nGrammar$4.ProtoBuiltInRules = new Grammar$4(\n 'ProtoBuiltInRules', // name\n undefined, // supergrammar\n {\n any: {\n body: pexprs$3.any,\n formals: [],\n description: 'any character',\n primitive: true,\n },\n end: {\n body: pexprs$3.end,\n formals: [],\n description: 'end of input',\n primitive: true,\n },\n\n caseInsensitive: {\n body: new CaseInsensitiveTerminal(new pexprs$3.Param(0)),\n formals: ['str'],\n primitive: true,\n },\n lower: {\n body: new pexprs$3.UnicodeChar('Ll'),\n formals: [],\n description: 'a lowercase letter',\n primitive: true,\n },\n upper: {\n body: new pexprs$3.UnicodeChar('Lu'),\n formals: [],\n description: 'an uppercase letter',\n primitive: true,\n },\n // Union of Lt (titlecase), Lm (modifier), and Lo (other), i.e. any letter not in Ll or Lu.\n unicodeLtmo: {\n body: new pexprs$3.UnicodeChar('Ltmo'),\n formals: [],\n description: 'a Unicode character in Lt, Lm, or Lo',\n primitive: true,\n },\n\n // These rules are not truly primitive (they could be written in userland) but are defined\n // here for bootstrapping purposes.\n spaces: {\n body: new pexprs$3.Star(new pexprs$3.Apply('space')),\n formals: [],\n },\n space: {\n body: new pexprs$3.Range('\\x00', ' '),\n formals: [],\n description: 'a space',\n },\n }\n);\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Grammar_1 = Grammar$4;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Grammar$3 = Grammar_1;\nconst InputStream = InputStream_1;\nconst common$1 = common$l;\nconst errors$1 = errors$9;\nconst pexprs$2 = pexprs$6;\n\n// --------------------------------------------------------------------\n// Private Stuff\n// --------------------------------------------------------------------\n\n// Constructors\n\nfunction GrammarDecl$1(name) {\n this.name = name;\n}\n\n// Helpers\n\nGrammarDecl$1.prototype.sourceInterval = function(startIdx, endIdx) {\n return this.source.subInterval(startIdx, endIdx - startIdx);\n};\n\nGrammarDecl$1.prototype.ensureSuperGrammar = function() {\n if (!this.superGrammar) {\n this.withSuperGrammar(\n // TODO: The conditional expression below is an ugly hack. It's kind of ok because\n // I doubt anyone will ever try to declare a grammar called `BuiltInRules`. Still,\n // we should try to find a better way to do this.\n this.name === 'BuiltInRules' ? Grammar$3.ProtoBuiltInRules : Grammar$3.BuiltInRules\n );\n }\n return this.superGrammar;\n};\n\nGrammarDecl$1.prototype.ensureSuperGrammarRuleForOverriding = function(name, source) {\n const ruleInfo = this.ensureSuperGrammar().rules[name];\n if (!ruleInfo) {\n throw errors$1.cannotOverrideUndeclaredRule(name, this.superGrammar.name, source);\n }\n return ruleInfo;\n};\n\nGrammarDecl$1.prototype.installOverriddenOrExtendedRule = function(\n name,\n formals,\n body,\n source\n) {\n const duplicateParameterNames = common$1.getDuplicates(formals);\n if (duplicateParameterNames.length > 0) {\n throw errors$1.duplicateParameterNames(name, duplicateParameterNames, source);\n }\n const ruleInfo = this.ensureSuperGrammar().rules[name];\n const expectedFormals = ruleInfo.formals;\n const expectedNumFormals = expectedFormals ? expectedFormals.length : 0;\n if (formals.length !== expectedNumFormals) {\n throw errors$1.wrongNumberOfParameters(name, expectedNumFormals, formals.length, source);\n }\n return this.install(name, formals, body, ruleInfo.description, source);\n};\n\nGrammarDecl$1.prototype.install = function(name, formals, body, description, source) {\n this.rules[name] = {\n body: body.introduceParams(formals),\n formals,\n description,\n source,\n };\n return this;\n};\n\n// Stuff that you should only do once\n\nGrammarDecl$1.prototype.withSuperGrammar = function(superGrammar) {\n if (this.superGrammar) {\n throw new Error('the super grammar of a GrammarDecl cannot be set more than once');\n }\n this.superGrammar = superGrammar;\n this.rules = Object.create(superGrammar.rules);\n\n // Grammars with an explicit supergrammar inherit a default start rule.\n if (!superGrammar.isBuiltIn()) {\n this.defaultStartRule = superGrammar.defaultStartRule;\n }\n return this;\n};\n\nGrammarDecl$1.prototype.withDefaultStartRule = function(ruleName) {\n this.defaultStartRule = ruleName;\n return this;\n};\n\nGrammarDecl$1.prototype.withSource = function(source) {\n this.source = new InputStream(source).interval(0, source.length);\n return this;\n};\n\n// Creates a Grammar instance, and if it passes the sanity checks, returns it.\nGrammarDecl$1.prototype.build = function() {\n const grammar = new Grammar$3(\n this.name,\n this.ensureSuperGrammar(),\n this.rules,\n this.defaultStartRule\n );\n\n // TODO: change the pexpr.prototype.assert... methods to make them add\n // exceptions to an array that's provided as an arg. Then we'll be able to\n // show more than one error of the same type at a time.\n // TODO: include the offending pexpr in the errors, that way we can show\n // the part of the source that caused it.\n const grammarErrors = [];\n let grammarHasInvalidApplications = false;\n Object.keys(grammar.rules).forEach(ruleName => {\n const {body} = grammar.rules[ruleName];\n try {\n body.assertChoicesHaveUniformArity(ruleName);\n } catch (e) {\n grammarErrors.push(e);\n }\n try {\n body.assertAllApplicationsAreValid(ruleName, grammar);\n } catch (e) {\n grammarErrors.push(e);\n grammarHasInvalidApplications = true;\n }\n });\n if (!grammarHasInvalidApplications) {\n // The following check can only be done if the grammar has no invalid applications.\n Object.keys(grammar.rules).forEach(ruleName => {\n const {body} = grammar.rules[ruleName];\n try {\n body.assertIteratedExprsAreNotNullable(grammar, []);\n } catch (e) {\n grammarErrors.push(e);\n }\n });\n }\n if (grammarErrors.length > 0) {\n errors$1.throwErrors(grammarErrors);\n }\n if (this.source) {\n grammar.source = this.source;\n }\n\n return grammar;\n};\n\n// Rule declarations\n\nGrammarDecl$1.prototype.define = function(name, formals, body, description, source) {\n this.ensureSuperGrammar();\n if (this.superGrammar.rules[name]) {\n throw errors$1.duplicateRuleDeclaration(name, this.name, this.superGrammar.name, source);\n } else if (this.rules[name]) {\n throw errors$1.duplicateRuleDeclaration(name, this.name, this.name, source);\n }\n const duplicateParameterNames = common$1.getDuplicates(formals);\n if (duplicateParameterNames.length > 0) {\n throw errors$1.duplicateParameterNames(name, duplicateParameterNames, source);\n }\n return this.install(name, formals, body, description, source);\n};\n\nGrammarDecl$1.prototype.override = function(name, formals, body, descIgnored, source) {\n this.ensureSuperGrammarRuleForOverriding(name, source);\n this.installOverriddenOrExtendedRule(name, formals, body, source);\n return this;\n};\n\nGrammarDecl$1.prototype.extend = function(name, formals, fragment, descIgnored, source) {\n const ruleInfo = this.ensureSuperGrammar().rules[name];\n if (!ruleInfo) {\n throw errors$1.cannotExtendUndeclaredRule(name, this.superGrammar.name, source);\n }\n const body = new pexprs$2.Extend(this.superGrammar, name, fragment);\n body.source = fragment.source;\n this.installOverriddenOrExtendedRule(name, formals, body, source);\n return this;\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar GrammarDecl_1 = GrammarDecl$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Grammar$2 = Grammar_1;\nconst GrammarDecl = GrammarDecl_1;\nconst pexprs$1 = pexprs$6;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction Builder$2() {}\n\nBuilder$2.prototype = {\n currentDecl: null,\n currentRuleName: null,\n\n newGrammar(name) {\n return new GrammarDecl(name);\n },\n\n grammar(metaInfo, name, superGrammar, defaultStartRule, rules) {\n const gDecl = new GrammarDecl(name);\n if (superGrammar) {\n // `superGrammar` may be a recipe (i.e. an Array), or an actual grammar instance.\n gDecl.withSuperGrammar(\n superGrammar instanceof Grammar$2 ? superGrammar : this.fromRecipe(superGrammar)\n );\n }\n if (defaultStartRule) {\n gDecl.withDefaultStartRule(defaultStartRule);\n }\n if (metaInfo && metaInfo.source) {\n gDecl.withSource(metaInfo.source);\n }\n\n this.currentDecl = gDecl;\n Object.keys(rules).forEach(ruleName => {\n this.currentRuleName = ruleName;\n const ruleRecipe = rules[ruleName];\n\n const action = ruleRecipe[0]; // define/extend/override\n const metaInfo = ruleRecipe[1];\n const description = ruleRecipe[2];\n const formals = ruleRecipe[3];\n const body = this.fromRecipe(ruleRecipe[4]);\n\n let source;\n if (gDecl.source && metaInfo && metaInfo.sourceInterval) {\n source = gDecl.source.subInterval(\n metaInfo.sourceInterval[0],\n metaInfo.sourceInterval[1] - metaInfo.sourceInterval[0]\n );\n }\n gDecl[action](ruleName, formals, body, description, source);\n });\n this.currentRuleName = this.currentDecl = null;\n return gDecl.build();\n },\n\n terminal(x) {\n return new pexprs$1.Terminal(x);\n },\n\n range(from, to) {\n return new pexprs$1.Range(from, to);\n },\n\n param(index) {\n return new pexprs$1.Param(index);\n },\n\n alt(...termArgs) {\n let terms = [];\n for (let arg of termArgs) {\n if (!(arg instanceof pexprs$1.PExpr)) {\n arg = this.fromRecipe(arg);\n }\n if (arg instanceof pexprs$1.Alt) {\n terms = terms.concat(arg.terms);\n } else {\n terms.push(arg);\n }\n }\n return terms.length === 1 ? terms[0] : new pexprs$1.Alt(terms);\n },\n\n seq(...factorArgs) {\n let factors = [];\n for (let arg of factorArgs) {\n if (!(arg instanceof pexprs$1.PExpr)) {\n arg = this.fromRecipe(arg);\n }\n if (arg instanceof pexprs$1.Seq) {\n factors = factors.concat(arg.factors);\n } else {\n factors.push(arg);\n }\n }\n return factors.length === 1 ? factors[0] : new pexprs$1.Seq(factors);\n },\n\n star(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Star(expr);\n },\n\n plus(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Plus(expr);\n },\n\n opt(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Opt(expr);\n },\n\n not(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Not(expr);\n },\n\n la(expr) {\n // TODO: temporary to still be able to read old recipes\n return this.lookahead(expr);\n },\n\n lookahead(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Lookahead(expr);\n },\n\n lex(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Lex(expr);\n },\n\n app(ruleName, optParams) {\n if (optParams && optParams.length > 0) {\n optParams = optParams.map(function(param) {\n return param instanceof pexprs$1.PExpr ? param : this.fromRecipe(param);\n }, this);\n }\n return new pexprs$1.Apply(ruleName, optParams);\n },\n\n // Note that unlike other methods in this class, this method cannot be used as a\n // convenience constructor. It only works with recipes, because it relies on\n // `this.currentDecl` and `this.currentRuleName` being set.\n splice(beforeTerms, afterTerms) {\n return new pexprs$1.Splice(\n this.currentDecl.superGrammar,\n this.currentRuleName,\n beforeTerms.map(term => this.fromRecipe(term)),\n afterTerms.map(term => this.fromRecipe(term))\n );\n },\n\n fromRecipe(recipe) {\n // the meta-info of 'grammar' is processed in Builder.grammar\n const args = recipe[0] === 'grammar' ? recipe.slice(1) : recipe.slice(2);\n const result = this[recipe[0]](...args);\n\n const metaInfo = recipe[1];\n if (metaInfo) {\n if (metaInfo.sourceInterval && this.currentDecl) {\n result.withSource(this.currentDecl.sourceInterval(...metaInfo.sourceInterval));\n }\n }\n return result;\n },\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Builder_1 = Builder$2;\n\nvar name = \"ohm-js\";\nvar version$2 = \"16.6.0\";\nvar description = \"An object-oriented language for parsing and pattern matching\";\nvar repository = \"https://github.com/harc/ohm\";\nvar keywords = [\n\t\"parser\",\n\t\"compiler\",\n\t\"pattern matching\",\n\t\"pattern-matching\",\n\t\"ometa\",\n\t\"ometa/js\",\n\t\"ometa-js\",\n\t\"ometajs\",\n\t\"rapid\",\n\t\"prototyping\"\n];\nvar homepage = \"https://ohmjs.org\";\nvar bugs = \"https://github.com/harc/ohm/issues\";\nvar main = \"index.js\";\nvar module = \"dist/ohm.esm.js\";\nvar files = [\n\t\"src\",\n\t\"dist\",\n\t\"extras\",\n\t\"third_party\",\n\t\"index.d.ts\"\n];\nvar types = \"index.d.ts\";\nvar scripts = {\n\tprebootstrap: \"bash scripts/prebootstrap\",\n\tbootstrap: \"bash scripts/bootstrap --test || (echo 'Bootstrap failed.' && mv -v dist/ohm-grammar.js.old dist/ohm-grammar.js && mv -v dist/built-in-rules.js.old dist/built-in-rules.js && mv -v dist/operations-and-attributes.js.old dist/operations-and-attributes.js)\",\n\tbuild: \"yarn build-debug && webpack --mode=production\",\n\t\"build-debug\": \"webpack --mode=development && yarn build-esm && node scripts/generate-types.mjs\",\n\t\"build-esm\": \"rollup -c rollup.config.mjs\",\n\tclean: \"rm -f dist/ohm.js dist/ohm.min.js\",\n\tlint: \"eslint . --ignore-path ../.eslintignore\",\n\tformat: \"prettier . --write --ignore-path ../.prettierignore --config ../.prettierrc && eslint . --ignore-path ../.eslintignore --fix\",\n\ttest: \"ava && ava --config ava-ts.config.js test/test-typings.ts\",\n\t\"test-watch\": \"ava --watch\",\n\t\"pre-commit\": \"yarn run lint && yarn run build && yarn run test\",\n\tprepublishOnly: \"bash scripts/prepublishOnly\",\n\tprepack: \"cp ../../README.md . && yarn build\",\n\tpostpack: \"rm README.md\",\n\tpostpublish: \"echo '👉 Now go to https://github.com/harc/ohm/releases and create a release.'\",\n\t\"unsafe-bootstrap\": \"bash scripts/bootstrap\",\n\t\"update-contributors\": \"bash scripts/update-contributors\",\n\twatch: \"webpack --mode=development --watch\"\n};\nvar license = \"MIT\";\nvar author = \"Alex Warth (http://tinlizzie.org/~awarth)\";\nvar contributors = [\n\t\"Patrick Dubroy \",\n\t\"Meixian Li \",\n\t\"Marko Röder \",\n\t\"Tony Garnock-Jones \",\n\t\"Saketh Kasibatla \",\n\t\"Lionel Landwerlin \",\n\t\"Jason Merrill \",\n\t\"Ray Toal \",\n\t\"Yoshiki Ohshima \",\n\t\"megabuz <3299889+megabuz@users.noreply.github.com>\",\n\t\"Jonathan Edwards \",\n\t\"Milan Lajtoš \",\n\t\"Neil Jewers \",\n\t\"stagas \",\n\t\"AngryPowman \",\n\t\"Arthur Carabott \",\n\t\"Casey Olson \",\n\t\"Daniel Tomlinson \",\n\t\"Ian Harris \",\n\t\"Justin Chase \",\n\t\"Leslie Ying \",\n\t\"Luca Guzzon \",\n\t\"Mike Niebling <(none)>\",\n\t\"Patrick Dubroy \",\n\t\"Pierre Donias \",\n\t\"Stan Rozenraukh \",\n\t\"Stephan Seidt \",\n\t\"Steve Phillips \",\n\t\"Szymon Kaliski \",\n\t\"Thomas Nyberg \",\n\t\"Vse Mozhet Byt \",\n\t\"Wil Chung <10446+iamwilhelm@users.noreply.github.com>\",\n\t\"Zachary Sakowitz \",\n\t\"abego \",\n\t\"acslk \",\n\t\"codeZeilen \",\n\t\"kassadin \",\n\t\"owch \",\n\t\"sfinnie \"\n];\nvar dependencies = {\n};\nvar devDependencies = {\n\t\"@ohm-js/cli\": \"^1.0.0\",\n\t\"@rollup/plugin-commonjs\": \"^21.0.1\",\n\t\"@rollup/plugin-json\": \"^4.1.0\",\n\t\"@rollup/plugin-node-resolve\": \"^13.1.3\",\n\tava: \"^3.15.0\",\n\t\"ava-spec\": \"^1.1.1\",\n\tdedent: \"^0.7.0\",\n\teslint: \"^7.9.0\",\n\t\"eslint-config-google\": \"^0.14.0\",\n\t\"eslint-plugin-ava\": \"^11.0.0\",\n\t\"eslint-plugin-camelcase-ohm\": \"^0.2.1\",\n\t\"eslint-plugin-no-extension-in-require\": \"^0.2.0\",\n\thusky: \"^4.2.5\",\n\tjsdom: \"^9.9.1\",\n\tjson: \"^9.0.6\",\n\tmarkscript: \"^0.5.0\",\n\t\"node-static\": \"^0.7.11\",\n\t\"ohm-grammar-ecmascript\": \"^1.0.0\",\n\trollup: \"^2.63.0\",\n\t\"ts-loader\": \"^8.0.4\",\n\t\"ts-node\": \"^9.0.0\",\n\ttypescript: \"^4.0.3\",\n\t\"walk-sync\": \"^2.2.0\",\n\twebpack: \"^4.44.2\",\n\t\"webpack-cli\": \"^3.3.12\"\n};\nvar engines = {\n\tnode: \">=0.12.1\"\n};\nvar require$$0 = {\n\tname: name,\n\tversion: version$2,\n\tdescription: description,\n\trepository: repository,\n\tkeywords: keywords,\n\thomepage: homepage,\n\tbugs: bugs,\n\tmain: main,\n\tmodule: module,\n\tfiles: files,\n\ttypes: types,\n\tscripts: scripts,\n\tlicense: license,\n\tauthor: author,\n\tcontributors: contributors,\n\tdependencies: dependencies,\n\tdevDependencies: devDependencies,\n\tengines: engines\n};\n\n/* global __GLOBAL_OHM_VERSION__ */\n\n// When running under Node, read the version from package.json. For the browser,\n// use a special global variable defined in the build process (see webpack.config.js).\nvar version$1 =\n typeof __GLOBAL_OHM_VERSION__ === 'string' ?\n __GLOBAL_OHM_VERSION__ :\n require$$0.version;\n\nvar makeRecipe$5 = {};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Builder$1 = Builder_1;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction makeRecipe$4(recipe) {\n if (typeof recipe === 'function') {\n return recipe.call(new Builder$1());\n } else {\n if (typeof recipe === 'string') {\n // stringified JSON recipe\n recipe = JSON.parse(recipe);\n }\n return new Builder$1().fromRecipe(recipe);\n }\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nmakeRecipe$5.makeRecipe = makeRecipe$4;\n\nvar {makeRecipe: makeRecipe$3} = makeRecipe$5;\nvar builtInRules = makeRecipe$3([\"grammar\",{\"source\":\"BuiltInRules {\\n\\n alnum (an alpha-numeric character)\\n = letter\\n | digit\\n\\n letter (a letter)\\n = lower\\n | upper\\n | unicodeLtmo\\n\\n digit (a digit)\\n = \\\"0\\\"..\\\"9\\\"\\n\\n hexDigit (a hexadecimal digit)\\n = digit\\n | \\\"a\\\"..\\\"f\\\"\\n | \\\"A\\\"..\\\"F\\\"\\n\\n ListOf\\n = NonemptyListOf\\n | EmptyListOf\\n\\n NonemptyListOf\\n = elem (sep elem)*\\n\\n EmptyListOf\\n = /* nothing */\\n\\n listOf\\n = nonemptyListOf\\n | emptyListOf\\n\\n nonemptyListOf\\n = elem (sep elem)*\\n\\n emptyListOf\\n = /* nothing */\\n\\n // Allows a syntactic rule application within a lexical context.\\n applySyntactic = app\\n}\"},\"BuiltInRules\",null,null,{\"alnum\":[\"define\",{\"sourceInterval\":[18,78]},\"an alpha-numeric character\",[],[\"alt\",{\"sourceInterval\":[60,78]},[\"app\",{\"sourceInterval\":[60,66]},\"letter\",[]],[\"app\",{\"sourceInterval\":[73,78]},\"digit\",[]]]],\"letter\":[\"define\",{\"sourceInterval\":[82,142]},\"a letter\",[],[\"alt\",{\"sourceInterval\":[107,142]},[\"app\",{\"sourceInterval\":[107,112]},\"lower\",[]],[\"app\",{\"sourceInterval\":[119,124]},\"upper\",[]],[\"app\",{\"sourceInterval\":[131,142]},\"unicodeLtmo\",[]]]],\"digit\":[\"define\",{\"sourceInterval\":[146,177]},\"a digit\",[],[\"range\",{\"sourceInterval\":[169,177]},\"0\",\"9\"]],\"hexDigit\":[\"define\",{\"sourceInterval\":[181,254]},\"a hexadecimal digit\",[],[\"alt\",{\"sourceInterval\":[219,254]},[\"app\",{\"sourceInterval\":[219,224]},\"digit\",[]],[\"range\",{\"sourceInterval\":[231,239]},\"a\",\"f\"],[\"range\",{\"sourceInterval\":[246,254]},\"A\",\"F\"]]],\"ListOf\":[\"define\",{\"sourceInterval\":[258,336]},null,[\"elem\",\"sep\"],[\"alt\",{\"sourceInterval\":[282,336]},[\"app\",{\"sourceInterval\":[282,307]},\"NonemptyListOf\",[[\"param\",{\"sourceInterval\":[297,301]},0],[\"param\",{\"sourceInterval\":[303,306]},1]]],[\"app\",{\"sourceInterval\":[314,336]},\"EmptyListOf\",[[\"param\",{\"sourceInterval\":[326,330]},0],[\"param\",{\"sourceInterval\":[332,335]},1]]]]],\"NonemptyListOf\":[\"define\",{\"sourceInterval\":[340,388]},null,[\"elem\",\"sep\"],[\"seq\",{\"sourceInterval\":[372,388]},[\"param\",{\"sourceInterval\":[372,376]},0],[\"star\",{\"sourceInterval\":[377,388]},[\"seq\",{\"sourceInterval\":[378,386]},[\"param\",{\"sourceInterval\":[378,381]},1],[\"param\",{\"sourceInterval\":[382,386]},0]]]]],\"EmptyListOf\":[\"define\",{\"sourceInterval\":[392,434]},null,[\"elem\",\"sep\"],[\"seq\",{\"sourceInterval\":[438,438]}]],\"listOf\":[\"define\",{\"sourceInterval\":[438,516]},null,[\"elem\",\"sep\"],[\"alt\",{\"sourceInterval\":[462,516]},[\"app\",{\"sourceInterval\":[462,487]},\"nonemptyListOf\",[[\"param\",{\"sourceInterval\":[477,481]},0],[\"param\",{\"sourceInterval\":[483,486]},1]]],[\"app\",{\"sourceInterval\":[494,516]},\"emptyListOf\",[[\"param\",{\"sourceInterval\":[506,510]},0],[\"param\",{\"sourceInterval\":[512,515]},1]]]]],\"nonemptyListOf\":[\"define\",{\"sourceInterval\":[520,568]},null,[\"elem\",\"sep\"],[\"seq\",{\"sourceInterval\":[552,568]},[\"param\",{\"sourceInterval\":[552,556]},0],[\"star\",{\"sourceInterval\":[557,568]},[\"seq\",{\"sourceInterval\":[558,566]},[\"param\",{\"sourceInterval\":[558,561]},1],[\"param\",{\"sourceInterval\":[562,566]},0]]]]],\"emptyListOf\":[\"define\",{\"sourceInterval\":[572,682]},null,[\"elem\",\"sep\"],[\"seq\",{\"sourceInterval\":[685,685]}]],\"applySyntactic\":[\"define\",{\"sourceInterval\":[685,710]},null,[\"app\"],[\"param\",{\"sourceInterval\":[707,710]},0]]}]);\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Grammar$1 = Grammar_1;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nGrammar$1.BuiltInRules = builtInRules;\n\nvar {makeRecipe: makeRecipe$2} = makeRecipe$5;\nvar operationsAndAttributes = makeRecipe$2([\"grammar\",{\"source\":\"OperationsAndAttributes {\\n\\n AttributeSignature =\\n name\\n\\n OperationSignature =\\n name Formals?\\n\\n Formals\\n = \\\"(\\\" ListOf \\\")\\\"\\n\\n name (a name)\\n = nameFirst nameRest*\\n\\n nameFirst\\n = \\\"_\\\"\\n | letter\\n\\n nameRest\\n = \\\"_\\\"\\n | alnum\\n\\n}\"},\"OperationsAndAttributes\",null,\"AttributeSignature\",{\"AttributeSignature\":[\"define\",{\"sourceInterval\":[29,58]},null,[],[\"app\",{\"sourceInterval\":[54,58]},\"name\",[]]],\"OperationSignature\":[\"define\",{\"sourceInterval\":[62,100]},null,[],[\"seq\",{\"sourceInterval\":[87,100]},[\"app\",{\"sourceInterval\":[87,91]},\"name\",[]],[\"opt\",{\"sourceInterval\":[92,100]},[\"app\",{\"sourceInterval\":[92,99]},\"Formals\",[]]]]],\"Formals\":[\"define\",{\"sourceInterval\":[104,143]},null,[],[\"seq\",{\"sourceInterval\":[118,143]},[\"terminal\",{\"sourceInterval\":[118,121]},\"(\"],[\"app\",{\"sourceInterval\":[122,139]},\"ListOf\",[[\"app\",{\"sourceInterval\":[129,133]},\"name\",[]],[\"terminal\",{\"sourceInterval\":[135,138]},\",\"]]],[\"terminal\",{\"sourceInterval\":[140,143]},\")\"]]],\"name\":[\"define\",{\"sourceInterval\":[147,187]},\"a name\",[],[\"seq\",{\"sourceInterval\":[168,187]},[\"app\",{\"sourceInterval\":[168,177]},\"nameFirst\",[]],[\"star\",{\"sourceInterval\":[178,187]},[\"app\",{\"sourceInterval\":[178,186]},\"nameRest\",[]]]]],\"nameFirst\":[\"define\",{\"sourceInterval\":[191,223]},null,[],[\"alt\",{\"sourceInterval\":[207,223]},[\"terminal\",{\"sourceInterval\":[207,210]},\"_\"],[\"app\",{\"sourceInterval\":[217,223]},\"letter\",[]]]],\"nameRest\":[\"define\",{\"sourceInterval\":[227,257]},null,[],[\"alt\",{\"sourceInterval\":[242,257]},[\"terminal\",{\"sourceInterval\":[242,245]},\"_\"],[\"app\",{\"sourceInterval\":[252,257]},\"alnum\",[]]]]}]);\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Semantics = Semantics_1;\nconst util$1 = util$7;\n\n// ----------------- Deferred initialization -----------------\n\nutil$1.awaitBuiltInRules(builtInRules => {\n const operationsAndAttributesGrammar = operationsAndAttributes;\n initBuiltInSemantics(builtInRules);\n initPrototypeParser(operationsAndAttributesGrammar); // requires BuiltInSemantics\n});\n\nfunction initBuiltInSemantics(builtInRules) {\n const actions = {\n empty() {\n return this.iteration();\n },\n nonEmpty(first, _, rest) {\n return this.iteration([first].concat(rest.children));\n },\n };\n\n Semantics.BuiltInSemantics = Semantics.createSemantics(builtInRules, null).addOperation(\n 'asIteration',\n {\n emptyListOf: actions.empty,\n nonemptyListOf: actions.nonEmpty,\n EmptyListOf: actions.empty,\n NonemptyListOf: actions.nonEmpty,\n }\n );\n}\n\nfunction initPrototypeParser(grammar) {\n Semantics.prototypeGrammarSemantics = grammar.createSemantics().addOperation('parse', {\n AttributeSignature(name) {\n return {\n name: name.parse(),\n formals: [],\n };\n },\n OperationSignature(name, optFormals) {\n return {\n name: name.parse(),\n formals: optFormals.children.map(c => c.parse())[0] || [],\n };\n },\n Formals(oparen, fs, cparen) {\n return fs.asIteration().children.map(c => c.parse());\n },\n name(first, rest) {\n return this.sourceString;\n },\n });\n Semantics.prototypeGrammar = grammar;\n}\n\nvar {makeRecipe: makeRecipe$1} = makeRecipe$5;\nvar ohmGrammar$1 = makeRecipe$1([\"grammar\",{\"source\":\"Ohm {\\n\\n Grammars\\n = Grammar*\\n\\n Grammar\\n = ident SuperGrammar? \\\"{\\\" Rule* \\\"}\\\"\\n\\n SuperGrammar\\n = \\\"<:\\\" ident\\n\\n Rule\\n = ident Formals? ruleDescr? \\\"=\\\" RuleBody -- define\\n | ident Formals? \\\":=\\\" OverrideRuleBody -- override\\n | ident Formals? \\\"+=\\\" RuleBody -- extend\\n\\n RuleBody\\n = \\\"|\\\"? NonemptyListOf\\n\\n TopLevelTerm\\n = Seq caseName -- inline\\n | Seq\\n\\n OverrideRuleBody\\n = \\\"|\\\"? NonemptyListOf\\n\\n OverrideTopLevelTerm\\n = \\\"...\\\" -- superSplice\\n | TopLevelTerm\\n\\n Formals\\n = \\\"<\\\" ListOf \\\">\\\"\\n\\n Params\\n = \\\"<\\\" ListOf \\\">\\\"\\n\\n Alt\\n = NonemptyListOf\\n\\n Seq\\n = Iter*\\n\\n Iter\\n = Pred \\\"*\\\" -- star\\n | Pred \\\"+\\\" -- plus\\n | Pred \\\"?\\\" -- opt\\n | Pred\\n\\n Pred\\n = \\\"~\\\" Lex -- not\\n | \\\"&\\\" Lex -- lookahead\\n | Lex\\n\\n Lex\\n = \\\"#\\\" Base -- lex\\n | Base\\n\\n Base\\n = ident Params? ~(ruleDescr? \\\"=\\\" | \\\":=\\\" | \\\"+=\\\") -- application\\n | oneCharTerminal \\\"..\\\" oneCharTerminal -- range\\n | terminal -- terminal\\n | \\\"(\\\" Alt \\\")\\\" -- paren\\n\\n ruleDescr (a rule description)\\n = \\\"(\\\" ruleDescrText \\\")\\\"\\n\\n ruleDescrText\\n = (~\\\")\\\" any)*\\n\\n caseName\\n = \\\"--\\\" (~\\\"\\\\n\\\" space)* name (~\\\"\\\\n\\\" space)* (\\\"\\\\n\\\" | &\\\"}\\\")\\n\\n name (a name)\\n = nameFirst nameRest*\\n\\n nameFirst\\n = \\\"_\\\"\\n | letter\\n\\n nameRest\\n = \\\"_\\\"\\n | alnum\\n\\n ident (an identifier)\\n = name\\n\\n terminal\\n = \\\"\\\\\\\"\\\" terminalChar* \\\"\\\\\\\"\\\"\\n\\n oneCharTerminal\\n = \\\"\\\\\\\"\\\" terminalChar \\\"\\\\\\\"\\\"\\n\\n terminalChar\\n = escapeChar\\n | ~\\\"\\\\\\\\\\\" ~\\\"\\\\\\\"\\\" ~\\\"\\\\n\\\" \\\"\\\\u{0}\\\"..\\\"\\\\u{10FFFF}\\\"\\n\\n escapeChar (an escape sequence)\\n = \\\"\\\\\\\\\\\\\\\\\\\" -- backslash\\n | \\\"\\\\\\\\\\\\\\\"\\\" -- doubleQuote\\n | \\\"\\\\\\\\\\\\'\\\" -- singleQuote\\n | \\\"\\\\\\\\b\\\" -- backspace\\n | \\\"\\\\\\\\n\\\" -- lineFeed\\n | \\\"\\\\\\\\r\\\" -- carriageReturn\\n | \\\"\\\\\\\\t\\\" -- tab\\n | \\\"\\\\\\\\u{\\\" hexDigit hexDigit? hexDigit?\\n hexDigit? hexDigit? hexDigit? \\\"}\\\" -- unicodeCodePoint\\n | \\\"\\\\\\\\u\\\" hexDigit hexDigit hexDigit hexDigit -- unicodeEscape\\n | \\\"\\\\\\\\x\\\" hexDigit hexDigit -- hexEscape\\n\\n space\\n += comment\\n\\n comment\\n = \\\"//\\\" (~\\\"\\\\n\\\" any)* &(\\\"\\\\n\\\" | end) -- singleLine\\n | \\\"/*\\\" (~\\\"*/\\\" any)* \\\"*/\\\" -- multiLine\\n\\n tokens = token*\\n\\n token = caseName | comment | ident | operator | punctuation | terminal | any\\n\\n operator = \\\"<:\\\" | \\\"=\\\" | \\\":=\\\" | \\\"+=\\\" | \\\"*\\\" | \\\"+\\\" | \\\"?\\\" | \\\"~\\\" | \\\"&\\\"\\n\\n punctuation = \\\"<\\\" | \\\">\\\" | \\\",\\\" | \\\"--\\\"\\n}\"},\"Ohm\",null,\"Grammars\",{\"Grammars\":[\"define\",{\"sourceInterval\":[9,32]},null,[],[\"star\",{\"sourceInterval\":[24,32]},[\"app\",{\"sourceInterval\":[24,31]},\"Grammar\",[]]]],\"Grammar\":[\"define\",{\"sourceInterval\":[36,83]},null,[],[\"seq\",{\"sourceInterval\":[50,83]},[\"app\",{\"sourceInterval\":[50,55]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[56,69]},[\"app\",{\"sourceInterval\":[56,68]},\"SuperGrammar\",[]]],[\"terminal\",{\"sourceInterval\":[70,73]},\"{\"],[\"star\",{\"sourceInterval\":[74,79]},[\"app\",{\"sourceInterval\":[74,78]},\"Rule\",[]]],[\"terminal\",{\"sourceInterval\":[80,83]},\"}\"]]],\"SuperGrammar\":[\"define\",{\"sourceInterval\":[87,116]},null,[],[\"seq\",{\"sourceInterval\":[106,116]},[\"terminal\",{\"sourceInterval\":[106,110]},\"<:\"],[\"app\",{\"sourceInterval\":[111,116]},\"ident\",[]]]],\"Rule_define\":[\"define\",{\"sourceInterval\":[131,181]},null,[],[\"seq\",{\"sourceInterval\":[131,170]},[\"app\",{\"sourceInterval\":[131,136]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[137,145]},[\"app\",{\"sourceInterval\":[137,144]},\"Formals\",[]]],[\"opt\",{\"sourceInterval\":[146,156]},[\"app\",{\"sourceInterval\":[146,155]},\"ruleDescr\",[]]],[\"terminal\",{\"sourceInterval\":[157,160]},\"=\"],[\"app\",{\"sourceInterval\":[162,170]},\"RuleBody\",[]]]],\"Rule_override\":[\"define\",{\"sourceInterval\":[188,248]},null,[],[\"seq\",{\"sourceInterval\":[188,235]},[\"app\",{\"sourceInterval\":[188,193]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[194,202]},[\"app\",{\"sourceInterval\":[194,201]},\"Formals\",[]]],[\"terminal\",{\"sourceInterval\":[214,218]},\":=\"],[\"app\",{\"sourceInterval\":[219,235]},\"OverrideRuleBody\",[]]]],\"Rule_extend\":[\"define\",{\"sourceInterval\":[255,305]},null,[],[\"seq\",{\"sourceInterval\":[255,294]},[\"app\",{\"sourceInterval\":[255,260]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[261,269]},[\"app\",{\"sourceInterval\":[261,268]},\"Formals\",[]]],[\"terminal\",{\"sourceInterval\":[281,285]},\"+=\"],[\"app\",{\"sourceInterval\":[286,294]},\"RuleBody\",[]]]],\"Rule\":[\"define\",{\"sourceInterval\":[120,305]},null,[],[\"alt\",{\"sourceInterval\":[131,305]},[\"app\",{\"sourceInterval\":[131,170]},\"Rule_define\",[]],[\"app\",{\"sourceInterval\":[188,235]},\"Rule_override\",[]],[\"app\",{\"sourceInterval\":[255,294]},\"Rule_extend\",[]]]],\"RuleBody\":[\"define\",{\"sourceInterval\":[309,362]},null,[],[\"seq\",{\"sourceInterval\":[324,362]},[\"opt\",{\"sourceInterval\":[324,328]},[\"terminal\",{\"sourceInterval\":[324,327]},\"|\"]],[\"app\",{\"sourceInterval\":[329,362]},\"NonemptyListOf\",[[\"app\",{\"sourceInterval\":[344,356]},\"TopLevelTerm\",[]],[\"terminal\",{\"sourceInterval\":[358,361]},\"|\"]]]]],\"TopLevelTerm_inline\":[\"define\",{\"sourceInterval\":[385,408]},null,[],[\"seq\",{\"sourceInterval\":[385,397]},[\"app\",{\"sourceInterval\":[385,388]},\"Seq\",[]],[\"app\",{\"sourceInterval\":[389,397]},\"caseName\",[]]]],\"TopLevelTerm\":[\"define\",{\"sourceInterval\":[366,418]},null,[],[\"alt\",{\"sourceInterval\":[385,418]},[\"app\",{\"sourceInterval\":[385,397]},\"TopLevelTerm_inline\",[]],[\"app\",{\"sourceInterval\":[415,418]},\"Seq\",[]]]],\"OverrideRuleBody\":[\"define\",{\"sourceInterval\":[422,491]},null,[],[\"seq\",{\"sourceInterval\":[445,491]},[\"opt\",{\"sourceInterval\":[445,449]},[\"terminal\",{\"sourceInterval\":[445,448]},\"|\"]],[\"app\",{\"sourceInterval\":[450,491]},\"NonemptyListOf\",[[\"app\",{\"sourceInterval\":[465,485]},\"OverrideTopLevelTerm\",[]],[\"terminal\",{\"sourceInterval\":[487,490]},\"|\"]]]]],\"OverrideTopLevelTerm_superSplice\":[\"define\",{\"sourceInterval\":[522,543]},null,[],[\"terminal\",{\"sourceInterval\":[522,527]},\"...\"]],\"OverrideTopLevelTerm\":[\"define\",{\"sourceInterval\":[495,562]},null,[],[\"alt\",{\"sourceInterval\":[522,562]},[\"app\",{\"sourceInterval\":[522,527]},\"OverrideTopLevelTerm_superSplice\",[]],[\"app\",{\"sourceInterval\":[550,562]},\"TopLevelTerm\",[]]]],\"Formals\":[\"define\",{\"sourceInterval\":[566,606]},null,[],[\"seq\",{\"sourceInterval\":[580,606]},[\"terminal\",{\"sourceInterval\":[580,583]},\"<\"],[\"app\",{\"sourceInterval\":[584,602]},\"ListOf\",[[\"app\",{\"sourceInterval\":[591,596]},\"ident\",[]],[\"terminal\",{\"sourceInterval\":[598,601]},\",\"]]],[\"terminal\",{\"sourceInterval\":[603,606]},\">\"]]],\"Params\":[\"define\",{\"sourceInterval\":[610,647]},null,[],[\"seq\",{\"sourceInterval\":[623,647]},[\"terminal\",{\"sourceInterval\":[623,626]},\"<\"],[\"app\",{\"sourceInterval\":[627,643]},\"ListOf\",[[\"app\",{\"sourceInterval\":[634,637]},\"Seq\",[]],[\"terminal\",{\"sourceInterval\":[639,642]},\",\"]]],[\"terminal\",{\"sourceInterval\":[644,647]},\">\"]]],\"Alt\":[\"define\",{\"sourceInterval\":[651,685]},null,[],[\"app\",{\"sourceInterval\":[661,685]},\"NonemptyListOf\",[[\"app\",{\"sourceInterval\":[676,679]},\"Seq\",[]],[\"terminal\",{\"sourceInterval\":[681,684]},\"|\"]]]],\"Seq\":[\"define\",{\"sourceInterval\":[689,704]},null,[],[\"star\",{\"sourceInterval\":[699,704]},[\"app\",{\"sourceInterval\":[699,703]},\"Iter\",[]]]],\"Iter_star\":[\"define\",{\"sourceInterval\":[719,736]},null,[],[\"seq\",{\"sourceInterval\":[719,727]},[\"app\",{\"sourceInterval\":[719,723]},\"Pred\",[]],[\"terminal\",{\"sourceInterval\":[724,727]},\"*\"]]],\"Iter_plus\":[\"define\",{\"sourceInterval\":[743,760]},null,[],[\"seq\",{\"sourceInterval\":[743,751]},[\"app\",{\"sourceInterval\":[743,747]},\"Pred\",[]],[\"terminal\",{\"sourceInterval\":[748,751]},\"+\"]]],\"Iter_opt\":[\"define\",{\"sourceInterval\":[767,783]},null,[],[\"seq\",{\"sourceInterval\":[767,775]},[\"app\",{\"sourceInterval\":[767,771]},\"Pred\",[]],[\"terminal\",{\"sourceInterval\":[772,775]},\"?\"]]],\"Iter\":[\"define\",{\"sourceInterval\":[708,794]},null,[],[\"alt\",{\"sourceInterval\":[719,794]},[\"app\",{\"sourceInterval\":[719,727]},\"Iter_star\",[]],[\"app\",{\"sourceInterval\":[743,751]},\"Iter_plus\",[]],[\"app\",{\"sourceInterval\":[767,775]},\"Iter_opt\",[]],[\"app\",{\"sourceInterval\":[790,794]},\"Pred\",[]]]],\"Pred_not\":[\"define\",{\"sourceInterval\":[809,824]},null,[],[\"seq\",{\"sourceInterval\":[809,816]},[\"terminal\",{\"sourceInterval\":[809,812]},\"~\"],[\"app\",{\"sourceInterval\":[813,816]},\"Lex\",[]]]],\"Pred_lookahead\":[\"define\",{\"sourceInterval\":[831,852]},null,[],[\"seq\",{\"sourceInterval\":[831,838]},[\"terminal\",{\"sourceInterval\":[831,834]},\"&\"],[\"app\",{\"sourceInterval\":[835,838]},\"Lex\",[]]]],\"Pred\":[\"define\",{\"sourceInterval\":[798,862]},null,[],[\"alt\",{\"sourceInterval\":[809,862]},[\"app\",{\"sourceInterval\":[809,816]},\"Pred_not\",[]],[\"app\",{\"sourceInterval\":[831,838]},\"Pred_lookahead\",[]],[\"app\",{\"sourceInterval\":[859,862]},\"Lex\",[]]]],\"Lex_lex\":[\"define\",{\"sourceInterval\":[876,892]},null,[],[\"seq\",{\"sourceInterval\":[876,884]},[\"terminal\",{\"sourceInterval\":[876,879]},\"#\"],[\"app\",{\"sourceInterval\":[880,884]},\"Base\",[]]]],\"Lex\":[\"define\",{\"sourceInterval\":[866,903]},null,[],[\"alt\",{\"sourceInterval\":[876,903]},[\"app\",{\"sourceInterval\":[876,884]},\"Lex_lex\",[]],[\"app\",{\"sourceInterval\":[899,903]},\"Base\",[]]]],\"Base_application\":[\"define\",{\"sourceInterval\":[918,979]},null,[],[\"seq\",{\"sourceInterval\":[918,963]},[\"app\",{\"sourceInterval\":[918,923]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[924,931]},[\"app\",{\"sourceInterval\":[924,930]},\"Params\",[]]],[\"not\",{\"sourceInterval\":[932,963]},[\"alt\",{\"sourceInterval\":[934,962]},[\"seq\",{\"sourceInterval\":[934,948]},[\"opt\",{\"sourceInterval\":[934,944]},[\"app\",{\"sourceInterval\":[934,943]},\"ruleDescr\",[]]],[\"terminal\",{\"sourceInterval\":[945,948]},\"=\"]],[\"terminal\",{\"sourceInterval\":[951,955]},\":=\"],[\"terminal\",{\"sourceInterval\":[958,962]},\"+=\"]]]]],\"Base_range\":[\"define\",{\"sourceInterval\":[986,1041]},null,[],[\"seq\",{\"sourceInterval\":[986,1022]},[\"app\",{\"sourceInterval\":[986,1001]},\"oneCharTerminal\",[]],[\"terminal\",{\"sourceInterval\":[1002,1006]},\"..\"],[\"app\",{\"sourceInterval\":[1007,1022]},\"oneCharTerminal\",[]]]],\"Base_terminal\":[\"define\",{\"sourceInterval\":[1048,1106]},null,[],[\"app\",{\"sourceInterval\":[1048,1056]},\"terminal\",[]]],\"Base_paren\":[\"define\",{\"sourceInterval\":[1113,1168]},null,[],[\"seq\",{\"sourceInterval\":[1113,1124]},[\"terminal\",{\"sourceInterval\":[1113,1116]},\"(\"],[\"app\",{\"sourceInterval\":[1117,1120]},\"Alt\",[]],[\"terminal\",{\"sourceInterval\":[1121,1124]},\")\"]]],\"Base\":[\"define\",{\"sourceInterval\":[907,1168]},null,[],[\"alt\",{\"sourceInterval\":[918,1168]},[\"app\",{\"sourceInterval\":[918,963]},\"Base_application\",[]],[\"app\",{\"sourceInterval\":[986,1022]},\"Base_range\",[]],[\"app\",{\"sourceInterval\":[1048,1056]},\"Base_terminal\",[]],[\"app\",{\"sourceInterval\":[1113,1124]},\"Base_paren\",[]]]],\"ruleDescr\":[\"define\",{\"sourceInterval\":[1172,1231]},\"a rule description\",[],[\"seq\",{\"sourceInterval\":[1210,1231]},[\"terminal\",{\"sourceInterval\":[1210,1213]},\"(\"],[\"app\",{\"sourceInterval\":[1214,1227]},\"ruleDescrText\",[]],[\"terminal\",{\"sourceInterval\":[1228,1231]},\")\"]]],\"ruleDescrText\":[\"define\",{\"sourceInterval\":[1235,1266]},null,[],[\"star\",{\"sourceInterval\":[1255,1266]},[\"seq\",{\"sourceInterval\":[1256,1264]},[\"not\",{\"sourceInterval\":[1256,1260]},[\"terminal\",{\"sourceInterval\":[1257,1260]},\")\"]],[\"app\",{\"sourceInterval\":[1261,1264]},\"any\",[]]]]],\"caseName\":[\"define\",{\"sourceInterval\":[1270,1338]},null,[],[\"seq\",{\"sourceInterval\":[1285,1338]},[\"terminal\",{\"sourceInterval\":[1285,1289]},\"--\"],[\"star\",{\"sourceInterval\":[1290,1304]},[\"seq\",{\"sourceInterval\":[1291,1302]},[\"not\",{\"sourceInterval\":[1291,1296]},[\"terminal\",{\"sourceInterval\":[1292,1296]},\"\\n\"]],[\"app\",{\"sourceInterval\":[1297,1302]},\"space\",[]]]],[\"app\",{\"sourceInterval\":[1305,1309]},\"name\",[]],[\"star\",{\"sourceInterval\":[1310,1324]},[\"seq\",{\"sourceInterval\":[1311,1322]},[\"not\",{\"sourceInterval\":[1311,1316]},[\"terminal\",{\"sourceInterval\":[1312,1316]},\"\\n\"]],[\"app\",{\"sourceInterval\":[1317,1322]},\"space\",[]]]],[\"alt\",{\"sourceInterval\":[1326,1337]},[\"terminal\",{\"sourceInterval\":[1326,1330]},\"\\n\"],[\"lookahead\",{\"sourceInterval\":[1333,1337]},[\"terminal\",{\"sourceInterval\":[1334,1337]},\"}\"]]]]],\"name\":[\"define\",{\"sourceInterval\":[1342,1382]},\"a name\",[],[\"seq\",{\"sourceInterval\":[1363,1382]},[\"app\",{\"sourceInterval\":[1363,1372]},\"nameFirst\",[]],[\"star\",{\"sourceInterval\":[1373,1382]},[\"app\",{\"sourceInterval\":[1373,1381]},\"nameRest\",[]]]]],\"nameFirst\":[\"define\",{\"sourceInterval\":[1386,1418]},null,[],[\"alt\",{\"sourceInterval\":[1402,1418]},[\"terminal\",{\"sourceInterval\":[1402,1405]},\"_\"],[\"app\",{\"sourceInterval\":[1412,1418]},\"letter\",[]]]],\"nameRest\":[\"define\",{\"sourceInterval\":[1422,1452]},null,[],[\"alt\",{\"sourceInterval\":[1437,1452]},[\"terminal\",{\"sourceInterval\":[1437,1440]},\"_\"],[\"app\",{\"sourceInterval\":[1447,1452]},\"alnum\",[]]]],\"ident\":[\"define\",{\"sourceInterval\":[1456,1489]},\"an identifier\",[],[\"app\",{\"sourceInterval\":[1485,1489]},\"name\",[]]],\"terminal\":[\"define\",{\"sourceInterval\":[1493,1531]},null,[],[\"seq\",{\"sourceInterval\":[1508,1531]},[\"terminal\",{\"sourceInterval\":[1508,1512]},\"\\\"\"],[\"star\",{\"sourceInterval\":[1513,1526]},[\"app\",{\"sourceInterval\":[1513,1525]},\"terminalChar\",[]]],[\"terminal\",{\"sourceInterval\":[1527,1531]},\"\\\"\"]]],\"oneCharTerminal\":[\"define\",{\"sourceInterval\":[1535,1579]},null,[],[\"seq\",{\"sourceInterval\":[1557,1579]},[\"terminal\",{\"sourceInterval\":[1557,1561]},\"\\\"\"],[\"app\",{\"sourceInterval\":[1562,1574]},\"terminalChar\",[]],[\"terminal\",{\"sourceInterval\":[1575,1579]},\"\\\"\"]]],\"terminalChar\":[\"define\",{\"sourceInterval\":[1583,1660]},null,[],[\"alt\",{\"sourceInterval\":[1602,1660]},[\"app\",{\"sourceInterval\":[1602,1612]},\"escapeChar\",[]],[\"seq\",{\"sourceInterval\":[1621,1660]},[\"not\",{\"sourceInterval\":[1621,1626]},[\"terminal\",{\"sourceInterval\":[1622,1626]},\"\\\\\"]],[\"not\",{\"sourceInterval\":[1627,1632]},[\"terminal\",{\"sourceInterval\":[1628,1632]},\"\\\"\"]],[\"not\",{\"sourceInterval\":[1633,1638]},[\"terminal\",{\"sourceInterval\":[1634,1638]},\"\\n\"]],[\"range\",{\"sourceInterval\":[1639,1660]},\"\\u0000\",\"􏿿\"]]]],\"escapeChar_backslash\":[\"define\",{\"sourceInterval\":[1703,1758]},null,[],[\"terminal\",{\"sourceInterval\":[1703,1709]},\"\\\\\\\\\"]],\"escapeChar_doubleQuote\":[\"define\",{\"sourceInterval\":[1765,1822]},null,[],[\"terminal\",{\"sourceInterval\":[1765,1771]},\"\\\\\\\"\"]],\"escapeChar_singleQuote\":[\"define\",{\"sourceInterval\":[1829,1886]},null,[],[\"terminal\",{\"sourceInterval\":[1829,1835]},\"\\\\'\"]],\"escapeChar_backspace\":[\"define\",{\"sourceInterval\":[1893,1948]},null,[],[\"terminal\",{\"sourceInterval\":[1893,1898]},\"\\\\b\"]],\"escapeChar_lineFeed\":[\"define\",{\"sourceInterval\":[1955,2009]},null,[],[\"terminal\",{\"sourceInterval\":[1955,1960]},\"\\\\n\"]],\"escapeChar_carriageReturn\":[\"define\",{\"sourceInterval\":[2016,2076]},null,[],[\"terminal\",{\"sourceInterval\":[2016,2021]},\"\\\\r\"]],\"escapeChar_tab\":[\"define\",{\"sourceInterval\":[2083,2132]},null,[],[\"terminal\",{\"sourceInterval\":[2083,2088]},\"\\\\t\"]],\"escapeChar_unicodeCodePoint\":[\"define\",{\"sourceInterval\":[2139,2243]},null,[],[\"seq\",{\"sourceInterval\":[2139,2221]},[\"terminal\",{\"sourceInterval\":[2139,2145]},\"\\\\u{\"],[\"app\",{\"sourceInterval\":[2146,2154]},\"hexDigit\",[]],[\"opt\",{\"sourceInterval\":[2155,2164]},[\"app\",{\"sourceInterval\":[2155,2163]},\"hexDigit\",[]]],[\"opt\",{\"sourceInterval\":[2165,2174]},[\"app\",{\"sourceInterval\":[2165,2173]},\"hexDigit\",[]]],[\"opt\",{\"sourceInterval\":[2188,2197]},[\"app\",{\"sourceInterval\":[2188,2196]},\"hexDigit\",[]]],[\"opt\",{\"sourceInterval\":[2198,2207]},[\"app\",{\"sourceInterval\":[2198,2206]},\"hexDigit\",[]]],[\"opt\",{\"sourceInterval\":[2208,2217]},[\"app\",{\"sourceInterval\":[2208,2216]},\"hexDigit\",[]]],[\"terminal\",{\"sourceInterval\":[2218,2221]},\"}\"]]],\"escapeChar_unicodeEscape\":[\"define\",{\"sourceInterval\":[2250,2309]},null,[],[\"seq\",{\"sourceInterval\":[2250,2291]},[\"terminal\",{\"sourceInterval\":[2250,2255]},\"\\\\u\"],[\"app\",{\"sourceInterval\":[2256,2264]},\"hexDigit\",[]],[\"app\",{\"sourceInterval\":[2265,2273]},\"hexDigit\",[]],[\"app\",{\"sourceInterval\":[2274,2282]},\"hexDigit\",[]],[\"app\",{\"sourceInterval\":[2283,2291]},\"hexDigit\",[]]]],\"escapeChar_hexEscape\":[\"define\",{\"sourceInterval\":[2316,2371]},null,[],[\"seq\",{\"sourceInterval\":[2316,2339]},[\"terminal\",{\"sourceInterval\":[2316,2321]},\"\\\\x\"],[\"app\",{\"sourceInterval\":[2322,2330]},\"hexDigit\",[]],[\"app\",{\"sourceInterval\":[2331,2339]},\"hexDigit\",[]]]],\"escapeChar\":[\"define\",{\"sourceInterval\":[1664,2371]},\"an escape sequence\",[],[\"alt\",{\"sourceInterval\":[1703,2371]},[\"app\",{\"sourceInterval\":[1703,1709]},\"escapeChar_backslash\",[]],[\"app\",{\"sourceInterval\":[1765,1771]},\"escapeChar_doubleQuote\",[]],[\"app\",{\"sourceInterval\":[1829,1835]},\"escapeChar_singleQuote\",[]],[\"app\",{\"sourceInterval\":[1893,1898]},\"escapeChar_backspace\",[]],[\"app\",{\"sourceInterval\":[1955,1960]},\"escapeChar_lineFeed\",[]],[\"app\",{\"sourceInterval\":[2016,2021]},\"escapeChar_carriageReturn\",[]],[\"app\",{\"sourceInterval\":[2083,2088]},\"escapeChar_tab\",[]],[\"app\",{\"sourceInterval\":[2139,2221]},\"escapeChar_unicodeCodePoint\",[]],[\"app\",{\"sourceInterval\":[2250,2291]},\"escapeChar_unicodeEscape\",[]],[\"app\",{\"sourceInterval\":[2316,2339]},\"escapeChar_hexEscape\",[]]]],\"space\":[\"extend\",{\"sourceInterval\":[2375,2394]},null,[],[\"app\",{\"sourceInterval\":[2387,2394]},\"comment\",[]]],\"comment_singleLine\":[\"define\",{\"sourceInterval\":[2412,2458]},null,[],[\"seq\",{\"sourceInterval\":[2412,2443]},[\"terminal\",{\"sourceInterval\":[2412,2416]},\"//\"],[\"star\",{\"sourceInterval\":[2417,2429]},[\"seq\",{\"sourceInterval\":[2418,2427]},[\"not\",{\"sourceInterval\":[2418,2423]},[\"terminal\",{\"sourceInterval\":[2419,2423]},\"\\n\"]],[\"app\",{\"sourceInterval\":[2424,2427]},\"any\",[]]]],[\"lookahead\",{\"sourceInterval\":[2430,2443]},[\"alt\",{\"sourceInterval\":[2432,2442]},[\"terminal\",{\"sourceInterval\":[2432,2436]},\"\\n\"],[\"app\",{\"sourceInterval\":[2439,2442]},\"end\",[]]]]]],\"comment_multiLine\":[\"define\",{\"sourceInterval\":[2465,2501]},null,[],[\"seq\",{\"sourceInterval\":[2465,2487]},[\"terminal\",{\"sourceInterval\":[2465,2469]},\"/*\"],[\"star\",{\"sourceInterval\":[2470,2482]},[\"seq\",{\"sourceInterval\":[2471,2480]},[\"not\",{\"sourceInterval\":[2471,2476]},[\"terminal\",{\"sourceInterval\":[2472,2476]},\"*/\"]],[\"app\",{\"sourceInterval\":[2477,2480]},\"any\",[]]]],[\"terminal\",{\"sourceInterval\":[2483,2487]},\"*/\"]]],\"comment\":[\"define\",{\"sourceInterval\":[2398,2501]},null,[],[\"alt\",{\"sourceInterval\":[2412,2501]},[\"app\",{\"sourceInterval\":[2412,2443]},\"comment_singleLine\",[]],[\"app\",{\"sourceInterval\":[2465,2487]},\"comment_multiLine\",[]]]],\"tokens\":[\"define\",{\"sourceInterval\":[2505,2520]},null,[],[\"star\",{\"sourceInterval\":[2514,2520]},[\"app\",{\"sourceInterval\":[2514,2519]},\"token\",[]]]],\"token\":[\"define\",{\"sourceInterval\":[2524,2600]},null,[],[\"alt\",{\"sourceInterval\":[2532,2600]},[\"app\",{\"sourceInterval\":[2532,2540]},\"caseName\",[]],[\"app\",{\"sourceInterval\":[2543,2550]},\"comment\",[]],[\"app\",{\"sourceInterval\":[2553,2558]},\"ident\",[]],[\"app\",{\"sourceInterval\":[2561,2569]},\"operator\",[]],[\"app\",{\"sourceInterval\":[2572,2583]},\"punctuation\",[]],[\"app\",{\"sourceInterval\":[2586,2594]},\"terminal\",[]],[\"app\",{\"sourceInterval\":[2597,2600]},\"any\",[]]]],\"operator\":[\"define\",{\"sourceInterval\":[2604,2669]},null,[],[\"alt\",{\"sourceInterval\":[2615,2669]},[\"terminal\",{\"sourceInterval\":[2615,2619]},\"<:\"],[\"terminal\",{\"sourceInterval\":[2622,2625]},\"=\"],[\"terminal\",{\"sourceInterval\":[2628,2632]},\":=\"],[\"terminal\",{\"sourceInterval\":[2635,2639]},\"+=\"],[\"terminal\",{\"sourceInterval\":[2642,2645]},\"*\"],[\"terminal\",{\"sourceInterval\":[2648,2651]},\"+\"],[\"terminal\",{\"sourceInterval\":[2654,2657]},\"?\"],[\"terminal\",{\"sourceInterval\":[2660,2663]},\"~\"],[\"terminal\",{\"sourceInterval\":[2666,2669]},\"&\"]]],\"punctuation\":[\"define\",{\"sourceInterval\":[2673,2709]},null,[],[\"alt\",{\"sourceInterval\":[2687,2709]},[\"terminal\",{\"sourceInterval\":[2687,2690]},\"<\"],[\"terminal\",{\"sourceInterval\":[2693,2696]},\">\"],[\"terminal\",{\"sourceInterval\":[2699,2702]},\",\"],[\"terminal\",{\"sourceInterval\":[2705,2709]},\"--\"]]]}]);\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Builder = Builder_1;\nconst Grammar = Grammar_1;\nconst Namespace = Namespace_1;\nconst common = common$l;\nconst errors = errors$9;\nconst pexprs = pexprs$6;\nconst util = util$7;\nconst version = version$1;\nconst {makeRecipe} = makeRecipe$5;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// The metagrammar, i.e. the grammar for Ohm grammars. Initialized at the\n// bottom of this file because loading the grammar requires Ohm itself.\nlet ohmGrammar;\n\nconst superSplicePlaceholder = Object.create(pexprs.PExpr.prototype);\n\nconst isBuffer = obj =>\n !!obj.constructor &&\n typeof obj.constructor.isBuffer === 'function' &&\n obj.constructor.isBuffer(obj);\n\n// Returns a Grammar instance (i.e., an object with a `match` method) for\n// `tree`, which is the concrete syntax tree of a user-written grammar.\n// The grammar will be assigned into `namespace` under the name of the grammar\n// as specified in the source.\nfunction buildGrammar(match, namespace, optOhmGrammarForTesting) {\n const builder = new Builder();\n let decl;\n let currentRuleName;\n let currentRuleFormals;\n let overriding = false;\n const metaGrammar = optOhmGrammarForTesting || ohmGrammar;\n\n // A visitor that produces a Grammar instance from the CST.\n const helpers = metaGrammar.createSemantics().addOperation('visit', {\n Grammars(grammarIter) {\n return grammarIter.children.map(c => c.visit());\n },\n Grammar(id, s, _open, rules, _close) {\n const grammarName = id.visit();\n decl = builder.newGrammar(grammarName, namespace);\n s.child(0) && s.child(0).visit();\n rules.children.map(c => c.visit());\n const g = decl.build();\n g.source = this.source.trimmed();\n if (grammarName in namespace) {\n throw errors.duplicateGrammarDeclaration(g, namespace);\n }\n namespace[grammarName] = g;\n return g;\n },\n\n SuperGrammar(_, n) {\n const superGrammarName = n.visit();\n if (superGrammarName === 'null') {\n decl.withSuperGrammar(null);\n } else {\n if (!namespace || !(superGrammarName in namespace)) {\n throw errors.undeclaredGrammar(superGrammarName, namespace, n.source);\n }\n decl.withSuperGrammar(namespace[superGrammarName]);\n }\n },\n\n Rule_define(n, fs, d, _, b) {\n currentRuleName = n.visit();\n currentRuleFormals = fs.children.map(c => c.visit())[0] || [];\n // If there is no default start rule yet, set it now. This must be done before visiting\n // the body, because it might contain an inline rule definition.\n if (!decl.defaultStartRule && decl.ensureSuperGrammar() !== Grammar.ProtoBuiltInRules) {\n decl.withDefaultStartRule(currentRuleName);\n }\n const body = b.visit();\n const description = d.children.map(c => c.visit())[0];\n const source = this.source.trimmed();\n return decl.define(currentRuleName, currentRuleFormals, body, description, source);\n },\n Rule_override(n, fs, _, b) {\n currentRuleName = n.visit();\n currentRuleFormals = fs.children.map(c => c.visit())[0] || [];\n\n const source = this.source.trimmed();\n decl.ensureSuperGrammarRuleForOverriding(currentRuleName, source);\n\n overriding = true;\n const body = b.visit();\n overriding = false;\n return decl.override(currentRuleName, currentRuleFormals, body, null, source);\n },\n Rule_extend(n, fs, _, b) {\n currentRuleName = n.visit();\n currentRuleFormals = fs.children.map(c => c.visit())[0] || [];\n const body = b.visit();\n const source = this.source.trimmed();\n return decl.extend(currentRuleName, currentRuleFormals, body, null, source);\n },\n RuleBody(_, terms) {\n return builder.alt(...terms.visit()).withSource(this.source);\n },\n OverrideRuleBody(_, terms) {\n const args = terms.visit();\n\n // Check if the super-splice operator (`...`) appears in the terms.\n const expansionPos = args.indexOf(superSplicePlaceholder);\n if (expansionPos >= 0) {\n const beforeTerms = args.slice(0, expansionPos);\n const afterTerms = args.slice(expansionPos + 1);\n\n // Ensure it appears no more than once.\n afterTerms.forEach(t => {\n if (t === superSplicePlaceholder) throw errors.multipleSuperSplices(t);\n });\n\n return new pexprs.Splice(\n decl.superGrammar,\n currentRuleName,\n beforeTerms,\n afterTerms\n ).withSource(this.source);\n } else {\n return builder.alt(...args).withSource(this.source);\n }\n },\n Formals(opointy, fs, cpointy) {\n return fs.visit();\n },\n\n Params(opointy, ps, cpointy) {\n return ps.visit();\n },\n\n Alt(seqs) {\n return builder.alt(...seqs.visit()).withSource(this.source);\n },\n\n TopLevelTerm_inline(b, n) {\n const inlineRuleName = currentRuleName + '_' + n.visit();\n const body = b.visit();\n const source = this.source.trimmed();\n const isNewRuleDeclaration = !(\n decl.superGrammar && decl.superGrammar.rules[inlineRuleName]\n );\n if (overriding && !isNewRuleDeclaration) {\n decl.override(inlineRuleName, currentRuleFormals, body, null, source);\n } else {\n decl.define(inlineRuleName, currentRuleFormals, body, null, source);\n }\n const params = currentRuleFormals.map(formal => builder.app(formal));\n return builder.app(inlineRuleName, params).withSource(body.source);\n },\n OverrideTopLevelTerm_superSplice(_) {\n return superSplicePlaceholder;\n },\n\n Seq(expr) {\n return builder.seq(...expr.children.map(c => c.visit())).withSource(this.source);\n },\n\n Iter_star(x, _) {\n return builder.star(x.visit()).withSource(this.source);\n },\n Iter_plus(x, _) {\n return builder.plus(x.visit()).withSource(this.source);\n },\n Iter_opt(x, _) {\n return builder.opt(x.visit()).withSource(this.source);\n },\n\n Pred_not(_, x) {\n return builder.not(x.visit()).withSource(this.source);\n },\n Pred_lookahead(_, x) {\n return builder.lookahead(x.visit()).withSource(this.source);\n },\n\n Lex_lex(_, x) {\n return builder.lex(x.visit()).withSource(this.source);\n },\n\n Base_application(rule, ps) {\n const params = ps.children.map(c => c.visit())[0] || [];\n return builder.app(rule.visit(), params).withSource(this.source);\n },\n Base_range(from, _, to) {\n return builder.range(from.visit(), to.visit()).withSource(this.source);\n },\n Base_terminal(expr) {\n return builder.terminal(expr.visit()).withSource(this.source);\n },\n Base_paren(open, x, close) {\n return x.visit();\n },\n\n ruleDescr(open, t, close) {\n return t.visit();\n },\n ruleDescrText(_) {\n return this.sourceString.trim();\n },\n\n caseName(_, space1, n, space2, end) {\n return n.visit();\n },\n\n name(first, rest) {\n return this.sourceString;\n },\n nameFirst(expr) {},\n nameRest(expr) {},\n\n terminal(open, cs, close) {\n return cs.children.map(c => c.visit()).join('');\n },\n\n oneCharTerminal(open, c, close) {\n return c.visit();\n },\n\n escapeChar(c) {\n try {\n return common.unescapeCodePoint(this.sourceString);\n } catch (err) {\n if (err instanceof RangeError && err.message.startsWith('Invalid code point ')) {\n throw errors.invalidCodePoint(c);\n }\n throw err; // Rethrow\n }\n },\n\n NonemptyListOf(x, _, xs) {\n return [x.visit()].concat(xs.children.map(c => c.visit()));\n },\n EmptyListOf() {\n return [];\n },\n\n _terminal() {\n return this.sourceString;\n },\n });\n return helpers(match).visit();\n}\n\nfunction compileAndLoad(source, namespace) {\n const m = ohmGrammar.match(source, 'Grammars');\n if (m.failed()) {\n throw errors.grammarSyntaxError(m);\n }\n return buildGrammar(m, namespace);\n}\n\nfunction grammar(source, optNamespace) {\n const ns = grammars(source, optNamespace);\n\n // Ensure that the source contained no more than one grammar definition.\n const grammarNames = Object.keys(ns);\n if (grammarNames.length === 0) {\n throw new Error('Missing grammar definition');\n } else if (grammarNames.length > 1) {\n const secondGrammar = ns[grammarNames[1]];\n const interval = secondGrammar.source;\n throw new Error(\n util.getLineAndColumnMessage(interval.sourceString, interval.startIdx) +\n 'Found more than one grammar definition -- use ohm.grammars() instead.'\n );\n }\n return ns[grammarNames[0]]; // Return the one and only grammar.\n}\n\nfunction grammars(source, optNamespace) {\n const ns = Namespace.extend(Namespace.asNamespace(optNamespace));\n if (typeof source !== 'string') {\n // For convenience, detect Node.js Buffer objects and automatically call toString().\n if (isBuffer(source)) {\n source = source.toString();\n } else {\n throw new TypeError(\n 'Expected string as first argument, got ' + common.unexpectedObjToString(source)\n );\n }\n }\n compileAndLoad(source, ns);\n return ns;\n}\n\nfunction grammarFromScriptElement(optNode) {\n throw new Error(\n 'grammarFromScriptElement was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.'\n );\n}\n\nfunction grammarsFromScriptElements(optNodeOrNodeList) {\n throw new Error(\n 'grammarsFromScriptElements was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.'\n );\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\n// Stuff that users should know about\nmain$1.exports = {\n createNamespace: Namespace.createNamespace,\n grammar,\n grammars,\n grammarFromScriptElement,\n grammarsFromScriptElements,\n makeRecipe,\n ohmGrammar: null, // Initialized below, after Grammar.BuiltInRules.\n pexprs,\n util,\n version,\n};\n\n// Stuff for testing, etc.\nmain$1.exports._buildGrammar = buildGrammar;\n\n// Late initialization for stuff that is bootstrapped.\n\n\nutil.announceBuiltInRules(Grammar.BuiltInRules);\n\nmain$1.exports.ohmGrammar = ohmGrammar = ohmGrammar$1;\nGrammar.initApplicationParser(ohmGrammar, buildGrammar);\n\nvar ohm = main$1.exports;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst {assert} = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// Helpers\n\nfunction getProp(name, thing, fn) {\n return fn(thing[name]);\n}\n\nfunction mapProp(name, thing, fn) {\n return thing[name].map(fn);\n}\n\n// Returns a function that will walk a single property of a node.\n// `descriptor` is a string indicating the property name, optionally ending\n// with '[]' (e.g., 'children[]').\nfunction getPropWalkFn(descriptor) {\n const parts = descriptor.split(/ ?\\[\\]/);\n if (parts.length === 2) {\n return mapProp.bind(null, parts[0]);\n }\n return getProp.bind(null, descriptor);\n}\n\nfunction getProps(walkFns, thing, fn) {\n return walkFns.map(walkFn => walkFn(thing, fn));\n}\n\nfunction getWalkFn(shape) {\n if (typeof shape === 'string') {\n return getProps.bind(null, [getPropWalkFn(shape)]);\n } else if (Array.isArray(shape)) {\n return getProps.bind(null, shape.map(getPropWalkFn));\n } else {\n assert(typeof shape === 'function', 'Expected a string, Array, or function');\n assert(shape.length === 2, 'Expected a function of arity 2, got ' + shape.length);\n return shape;\n }\n}\n\nfunction isRestrictedIdentifier(str) {\n return /^[a-zA-Z_][0-9a-zA-Z_]*$/.test(str);\n}\n\nfunction trim(s) {\n return s.trim();\n}\n\nfunction parseSignature(sig) {\n const parts = sig.split(/[()]/).map(trim);\n if (parts.length === 3 && parts[2] === '') {\n const name = parts[0];\n let params = [];\n if (parts[1].length > 0) {\n params = parts[1].split(',').map(trim);\n }\n if (isRestrictedIdentifier(name) && params.every(isRestrictedIdentifier)) {\n return {name, formals: params};\n }\n }\n throw new Error('Invalid operation signature: ' + sig);\n}\n\n/*\n A VisitorFamily contains a set of recursive operations that are defined over some kind of\n tree structure. The `config` parameter specifies how to walk the tree:\n - 'getTag' is function which, given a node in the tree, returns the node's 'tag' (type)\n - 'shapes' an object that maps from a tag to a value that describes how to recursively\n evaluate the operation for nodes of that type. The value can be:\n * a string indicating the property name that holds that node's only child\n * an Array of property names (or an empty array indicating a leaf type), or\n * a function taking two arguments (node, fn), and returning an Array which is the result\n of apply `fn` to each of the node's children.\n */\nfunction VisitorFamily(config) {\n this._shapes = config.shapes;\n this._getTag = config.getTag;\n\n this.Adapter = function(thing, family) {\n this._adaptee = thing;\n this._family = family;\n };\n this.Adapter.prototype.valueOf = function() {\n throw new Error('heeey!');\n };\n this.operations = {};\n\n this._arities = Object.create(null);\n this._getChildren = Object.create(null);\n\n Object.keys(this._shapes).forEach(k => {\n const shape = this._shapes[k];\n this._getChildren[k] = getWalkFn(shape);\n\n // A function means the arity isn't fixed, so don't put an entry in the arity map.\n if (typeof shape !== 'function') {\n this._arities[k] = Array.isArray(shape) ? shape.length : 1;\n }\n });\n this._wrap = thing => new this.Adapter(thing, this);\n}\n\nVisitorFamily.prototype.wrap = function(thing) {\n return this._wrap(thing);\n};\n\nVisitorFamily.prototype._checkActionDict = function(dict) {\n Object.keys(dict).forEach(k => {\n assert(k in this._getChildren, \"Unrecognized action name '\" + k + \"'\");\n const action = dict[k];\n assert(typeof action === 'function', \"Key '\" + k + \"': expected function, got \" + action);\n if (k in this._arities) {\n const expected = this._arities[k];\n const actual = dict[k].length;\n assert(\n actual === expected,\n \"Action '\" + k + \"' has the wrong arity: expected \" + expected + ', got ' + actual\n );\n }\n });\n};\n\nVisitorFamily.prototype.addOperation = function(signature, actions) {\n const sig = parseSignature(signature);\n const {name} = sig;\n this._checkActionDict(actions);\n this.operations[name] = {\n name,\n formals: sig.formals,\n actions,\n };\n\n const family = this;\n this.Adapter.prototype[name] = function(...args) {\n const tag = family._getTag(this._adaptee);\n assert(tag in family._getChildren, \"getTag returned unrecognized tag '\" + tag + \"'\");\n assert(tag in actions, \"No action for '\" + tag + \"' in operation '\" + name + \"'\");\n\n // Create an \"arguments object\" from the arguments that were passed to this\n // operation / attribute.\n const argsObj = Object.create(null);\n for (const [i, val] of Object.entries(args)) {\n argsObj[sig.formals[i]] = val;\n }\n\n const oldArgs = this.args;\n this.args = argsObj;\n const ans = actions[tag].apply(\n this,\n family._getChildren[tag](this._adaptee, family._wrap)\n );\n this.args = oldArgs;\n return ans;\n };\n return this;\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar VisitorFamily_1 = VisitorFamily;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\nconst defaultOperation = {\n _terminal() {\n return this.sourceString;\n },\n\n _nonterminal(...children) {\n const {ctorName} = this._node;\n const {mapping} = this.args;\n\n // without customization\n if (!Object.prototype.hasOwnProperty.call(mapping, ctorName)) {\n // lexical rule\n if (this.isLexical()) {\n return this.sourceString;\n }\n\n // singular node (e.g. only surrounded by literals or lookaheads)\n const realChildren = children.filter(child => !child.isTerminal());\n if (realChildren.length === 1) {\n return realChildren[0].toAST(mapping);\n }\n\n // rest: terms with multiple children\n }\n\n // direct forward\n if (typeof mapping[ctorName] === 'number') {\n return children[mapping[ctorName]].toAST(mapping);\n }\n\n // named/mapped children or unnamed children ('0', '1', '2', ...)\n const propMap = mapping[ctorName] || children;\n const node = {\n type: ctorName,\n };\n // eslint-disable-next-line guard-for-in\n for (const prop in propMap) {\n const mappedProp = mapping[ctorName] && mapping[ctorName][prop];\n if (typeof mappedProp === 'number') {\n // direct forward\n node[prop] = children[mappedProp].toAST(mapping);\n } else if (\n typeof mappedProp === 'string' ||\n typeof mappedProp === 'boolean' ||\n mappedProp === null\n ) {\n // primitive value\n node[prop] = mappedProp;\n } else if (typeof mappedProp === 'object' && mappedProp instanceof Number) {\n // primitive number (must be unboxed)\n node[prop] = Number(mappedProp);\n } else if (typeof mappedProp === 'function') {\n // computed value\n node[prop] = mappedProp.call(this, children);\n } else if (mappedProp === undefined) {\n if (children[prop] && !children[prop].isTerminal()) {\n node[prop] = children[prop].toAST(mapping);\n } else {\n // delete predefined 'type' properties, like 'type', if explicitely removed\n delete node[prop];\n }\n }\n }\n return node;\n },\n\n _iter(...children) {\n if (this._node.isOptional()) {\n if (this.numChildren === 0) {\n return null;\n } else {\n return children[0].toAST(this.args.mapping);\n }\n }\n\n return children.map(function(child) {\n return child.toAST(this.args.mapping);\n }, this);\n },\n\n NonemptyListOf(first, sep, rest) {\n return [first.toAST(this.args.mapping)].concat(rest.toAST(this.args.mapping));\n },\n\n EmptyListOf() {\n return [];\n },\n};\n\n// Returns a plain JavaScript object that includes an abstract syntax tree (AST)\n// for the given match result `res` containg a concrete syntax tree (CST) and grammar.\n// The optional `mapping` parameter can be used to customize how the nodes of the CST\n// are mapped to the AST (see /doc/extras.md#toastmatchresult-mapping).\nfunction toAST(res, mapping) {\n if (typeof res.failed !== 'function' || res.failed()) {\n throw new Error('toAST() expects a succesful MatchResult as first parameter');\n }\n\n mapping = Object.assign({}, mapping);\n const operation = Object.assign({}, defaultOperation);\n for (const termName in mapping) {\n if (typeof mapping[termName] === 'function') {\n operation[termName] = mapping[termName];\n delete mapping[termName];\n }\n }\n const g = res._cst.grammar;\n const s = g.createSemantics().addOperation('toAST(mapping)', operation);\n return s(res).toAST(mapping);\n}\n\n// Returns a semantics containg the toAST(mapping) operation for the given grammar g.\nfunction semanticsForToAST(g) {\n if (typeof g.createSemantics !== 'function') {\n throw new Error('semanticsToAST() expects a Grammar as parameter');\n }\n\n return g.createSemantics().addOperation('toAST(mapping)', defaultOperation);\n}\n\nvar semanticsToAST = {\n helper: toAST,\n semantics: semanticsForToAST,\n};\n\nvar extras = {\n VisitorFamily: VisitorFamily_1,\n semanticsForToAST: semanticsToAST.semantics,\n toAST: semanticsToAST.helper,\n};\n\nexport { ohm as default, extras };\n","import { Subject } from './Subject';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\n\n/**\n * A variant of Subject that requires an initial value and emits its current\n * value whenever it is subscribed to.\n *\n * @class BehaviorSubject\n */\nexport class BehaviorSubject extends Subject {\n constructor(private _value: T) {\n super();\n }\n\n get value(): T {\n return this.getValue();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n const subscription = super._subscribe(subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n }\n\n getValue(): T {\n const { hasError, thrownError, _value } = this;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n }\n\n next(value: T): void {\n super.next((this._value = value));\n }\n}\n","/**\n * Returns true if the object is a function.\n * @param value The value to check\n */\nexport function isFunction(value: any): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n","/**\n * Used to create Error subclasses until the community moves away from ES5.\n *\n * This is because compiling from TypeScript down to ES5 has issues with subclassing Errors\n * as well as other built-in types: https://github.com/Microsoft/TypeScript/issues/12123\n *\n * @param createImpl A factory function to create the actual constructor implementation. The returned\n * function should be a named function that calls `_super` internally.\n */\nexport function createErrorClass(createImpl: (_super: any) => any): T {\n const _super = (instance: any) => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n","import { createErrorClass } from './createErrorClass';\n\nexport interface UnsubscriptionError extends Error {\n readonly errors: any[];\n}\n\nexport interface UnsubscriptionErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (errors: any[]): UnsubscriptionError;\n}\n\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nexport const UnsubscriptionError: UnsubscriptionErrorCtor = createErrorClass(\n (_super) =>\n function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {\n _super(this);\n this.message = errors\n ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}`\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n }\n);\n","/**\n * Removes an item from an array, mutating it.\n * @param arr The array to remove the item from\n * @param item The item to remove\n */\nexport function arrRemove(arr: T[] | undefined | null, item: T) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { SubscriptionLike, TeardownLogic, Unsubscribable } from './types';\nimport { arrRemove } from './util/arrRemove';\n\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n *\n * @class Subscription\n */\nexport class Subscription implements SubscriptionLike {\n /** @nocollapse */\n public static EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n */\n public closed = false;\n\n private _parentage: Subscription[] | Subscription | null = null;\n\n /**\n * The list of registered finalizers to execute upon unsubscription. Adding and removing from this\n * list occurs in the {@link #add} and {@link #remove} methods.\n */\n private _finalizers: Exclude[] | null = null;\n\n /**\n * @param initialTeardown A function executed first as part of the finalization\n * process that is kicked off when {@link #unsubscribe} is called.\n */\n constructor(private initialTeardown?: () => void) {}\n\n /**\n * Disposes the resources held by the subscription. May, for instance, cancel\n * an ongoing Observable execution or cancel any other type of work that\n * started when the Subscription was created.\n * @return {void}\n */\n unsubscribe(): void {\n let errors: any[] | undefined;\n\n if (!this.closed) {\n this.closed = true;\n\n // Remove this from it's parents.\n const { _parentage } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n\n const { initialTeardown: initialFinalizer } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n\n const { _finalizers } = this;\n if (_finalizers) {\n this._finalizers = null;\n for (const finalizer of _finalizers) {\n try {\n execFinalizer(finalizer);\n } catch (err) {\n errors = errors ?? [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n\n /**\n * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called\n * when this subscription is unsubscribed. If this subscription is already {@link #closed},\n * because it has already been unsubscribed, then whatever finalizer is passed to it\n * will automatically be executed (unless the finalizer itself is also a closed subscription).\n *\n * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed\n * subscription to a any subscription will result in no operation. (A noop).\n *\n * Adding a subscription to itself, or adding `null` or `undefined` will not perform any\n * operation at all. (A noop).\n *\n * `Subscription` instances that are added to this instance will automatically remove themselves\n * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove\n * will need to be removed manually with {@link #remove}\n *\n * @param teardown The finalization logic to add to this subscription.\n */\n add(teardown: TeardownLogic): void {\n // Only add the finalizer if it's not undefined\n // and don't add a subscription to itself.\n if (teardown && teardown !== this) {\n if (this.closed) {\n // If this subscription is already closed,\n // execute whatever finalizer is handed to it automatically.\n execFinalizer(teardown);\n } else {\n if (teardown instanceof Subscription) {\n // We don't add closed subscriptions, and we don't add the same subscription\n // twice. Subscription unsubscribe is idempotent.\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = this._finalizers ?? []).push(teardown);\n }\n }\n }\n\n /**\n * Checks to see if a this subscription already has a particular parent.\n * This will signal that this subscription has already been added to the parent in question.\n * @param parent the parent to check for\n */\n private _hasParent(parent: Subscription) {\n const { _parentage } = this;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n }\n\n /**\n * Adds a parent to this subscription so it can be removed from the parent if it\n * unsubscribes on it's own.\n *\n * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.\n * @param parent The parent subscription to add\n */\n private _addParent(parent: Subscription) {\n const { _parentage } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n\n /**\n * Called on a child when it is removed via {@link #remove}.\n * @param parent The parent to remove\n */\n private _removeParent(parent: Subscription) {\n const { _parentage } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n\n /**\n * Removes a finalizer from this subscription that was previously added with the {@link #add} method.\n *\n * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves\n * from every other `Subscription` they have been added to. This means that using the `remove` method\n * is not a common thing and should be used thoughtfully.\n *\n * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance\n * more than once, you will need to call `remove` the same number of times to remove all instances.\n *\n * All finalizer instances are removed to free up memory upon unsubscription.\n *\n * @param teardown The finalizer to remove from this subscription\n */\n remove(teardown: Exclude): void {\n const { _finalizers } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\n\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\n\nexport function isSubscription(value: any): value is Subscription {\n return (\n value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe))\n );\n}\n\nfunction execFinalizer(finalizer: Unsubscribable | (() => void)) {\n if (isFunction(finalizer)) {\n finalizer();\n } else {\n finalizer.unsubscribe();\n }\n}\n","import { Subscriber } from './Subscriber';\nimport { ObservableNotification } from './types';\n\n/**\n * The {@link GlobalConfig} object for RxJS. It is used to configure things\n * like how to react on unhandled errors.\n */\nexport const config: GlobalConfig = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n\n/**\n * The global configuration object for RxJS, used to configure things\n * like how to react on unhandled errors. Accessible via {@link config}\n * object.\n */\nexport interface GlobalConfig {\n /**\n * A registration point for unhandled errors from RxJS. These are errors that\n * cannot were not handled by consuming code in the usual subscription path. For\n * example, if you have this configured, and you subscribe to an observable without\n * providing an error handler, errors from that subscription will end up here. This\n * will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onUnhandledError: ((err: any) => void) | null;\n\n /**\n * A registration point for notifications that cannot be sent to subscribers because they\n * have completed, errored or have been explicitly unsubscribed. By default, next, complete\n * and error notifications sent to stopped subscribers are noops. However, sometimes callers\n * might want a different behavior. For example, with sources that attempt to report errors\n * to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.\n * This will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onStoppedNotification: ((notification: ObservableNotification, subscriber: Subscriber) => void) | null;\n\n /**\n * The promise constructor used by default for {@link Observable#toPromise toPromise} and {@link Observable#forEach forEach}\n * methods.\n *\n * @deprecated As of version 8, RxJS will no longer support this sort of injection of a\n * Promise constructor. If you need a Promise implementation other than native promises,\n * please polyfill/patch Promise as you see appropriate. Will be removed in v8.\n */\n Promise?: PromiseConstructorLike;\n\n /**\n * If true, turns on synchronous error rethrowing, which is a deprecated behavior\n * in v6 and higher. This behavior enables bad patterns like wrapping a subscribe\n * call in a try/catch block. It also enables producer interference, a nasty bug\n * where a multicast can be broken for all observers by a downstream consumer with\n * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BUY TIME\n * FOR MIGRATION REASONS.\n *\n * @deprecated As of version 8, RxJS will no longer support synchronous throwing\n * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad\n * behaviors described above. Will be removed in v8.\n */\n useDeprecatedSynchronousErrorHandling: boolean;\n\n /**\n * If true, enables an as-of-yet undocumented feature from v5: The ability to access\n * `unsubscribe()` via `this` context in `next` functions created in observers passed\n * to `subscribe`.\n *\n * This is being removed because the performance was severely problematic, and it could also cause\n * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have\n * their `this` context overwritten.\n *\n * @deprecated As of version 8, RxJS will no longer support altering the\n * context of next functions provided as part of an observer to Subscribe. Instead,\n * you will have access to a subscription or a signal or token that will allow you to do things like\n * unsubscribe and test closed status. Will be removed in v8.\n */\n useDeprecatedNextContext: boolean;\n}\n","import type { TimerHandle } from './timerHandle';\ntype SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearTimeoutFunction = (handle: TimerHandle) => void;\n\ninterface TimeoutProvider {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n delegate:\n | {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n }\n | undefined;\n}\n\nexport const timeoutProvider: TimeoutProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setTimeout(handler: () => void, timeout?: number, ...args) {\n const { delegate } = timeoutProvider;\n if (delegate?.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const { delegate } = timeoutProvider;\n return (delegate?.clearTimeout || clearTimeout)(handle as any);\n },\n delegate: undefined,\n};\n","/* tslint:disable:no-empty */\nexport function noop() { }\n","import { CompleteNotification, NextNotification, ErrorNotification } from './types';\n\n/**\n * A completion object optimized for memory use and created to be the\n * same \"shape\" as other notifications in v8.\n * @internal\n */\nexport const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined) as CompleteNotification)();\n\n/**\n * Internal use only. Creates an optimized error notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function errorNotification(error: any): ErrorNotification {\n return createNotification('E', undefined, error) as any;\n}\n\n/**\n * Internal use only. Creates an optimized next notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function nextNotification(value: T) {\n return createNotification('N', value, undefined) as NextNotification;\n}\n\n/**\n * Ensures that all notifications created internally have the same \"shape\" in v8.\n *\n * TODO: This is only exported to support a crazy legacy test in `groupBy`.\n * @internal\n */\nexport function createNotification(kind: 'N' | 'E' | 'C', value: any, error: any) {\n return {\n kind,\n value,\n error,\n };\n}\n","import { config } from '../config';\n\nlet context: { errorThrown: boolean; error: any } | null = null;\n\n/**\n * Handles dealing with errors for super-gross mode. Creates a context, in which\n * any synchronously thrown errors will be passed to {@link captureError}. Which\n * will record the error such that it will be rethrown after the call back is complete.\n * TODO: Remove in v8\n * @param cb An immediately executed function.\n */\nexport function errorContext(cb: () => void) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n const { errorThrown, error } = context!;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n // This is the general non-deprecated path for everyone that\n // isn't crazy enough to use super-gross mode (useDeprecatedSynchronousErrorHandling)\n cb();\n }\n}\n\n/**\n * Captures errors only in super-gross mode.\n * @param err the error to capture\n */\nexport function captureError(err: any) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { Observer, ObservableNotification } from './types';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\n\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n *\n * @class Subscriber\n */\nexport class Subscriber extends Subscription implements Observer {\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param next The `next` callback of an Observer.\n * @param error The `error` callback of an\n * Observer.\n * @param complete The `complete` callback of an\n * Observer.\n * @return A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n * @nocollapse\n * @deprecated Do not use. Will be removed in v8. There is no replacement for this\n * method, and there is no reason to be creating instances of `Subscriber` directly.\n * If you have a specific use case, please file an issue.\n */\n static create(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber {\n return new SafeSubscriber(next, error, complete);\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected isStopped: boolean = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected destination: Subscriber | Observer; // this `any` is the escape hatch to erase extra type param (e.g. R)\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.\n */\n constructor(destination?: Subscriber | Observer) {\n super();\n if (destination) {\n this.destination = destination;\n // Automatically chain subscriptions together here.\n // if destination is a Subscription, then it is a Subscriber.\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `next` from\n * the Observable, with a value. The Observable may call this method 0 or more\n * times.\n * @param {T} [value] The `next` value.\n * @return {void}\n */\n next(value?: T): void {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\n this._next(value!);\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `error` from\n * the Observable, with an attached `Error`. Notifies the Observer that\n * the Observable has experienced an error condition.\n * @param {any} [err] The `error` exception.\n * @return {void}\n */\n error(err?: any): void {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\n this.isStopped = true;\n this._error(err);\n }\n }\n\n /**\n * The {@link Observer} callback to receive a valueless notification of type\n * `complete` from the Observable. Notifies the Observer that the Observable\n * has finished sending push-based notifications.\n * @return {void}\n */\n complete(): void {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n\n unsubscribe(): void {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null!;\n }\n }\n\n protected _next(value: T): void {\n this.destination.next(value);\n }\n\n protected _error(err: any): void {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n\n protected _complete(): void {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\n\n/**\n * This bind is captured here because we want to be able to have\n * compatibility with monoid libraries that tend to use a method named\n * `bind`. In particular, a library called Monio requires this.\n */\nconst _bind = Function.prototype.bind;\n\nfunction bind any>(fn: Fn, thisArg: any): Fn {\n return _bind.call(fn, thisArg);\n}\n\n/**\n * Internal optimization only, DO NOT EXPOSE.\n * @internal\n */\nclass ConsumerObserver implements Observer {\n constructor(private partialObserver: Partial>) {}\n\n next(value: T): void {\n const { partialObserver } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n\n error(err: any): void {\n const { partialObserver } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n } catch (error) {\n handleUnhandledError(error);\n }\n } else {\n handleUnhandledError(err);\n }\n }\n\n complete(): void {\n const { partialObserver } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\n\nexport class SafeSubscriber extends Subscriber {\n constructor(\n observerOrNext?: Partial> | ((value: T) => void) | null,\n error?: ((e?: any) => void) | null,\n complete?: (() => void) | null\n ) {\n super();\n\n let partialObserver: Partial>;\n if (isFunction(observerOrNext) || !observerOrNext) {\n // The first argument is a function, not an observer. The next\n // two arguments *could* be observers, or they could be empty.\n partialObserver = {\n next: (observerOrNext ?? undefined) as (((value: T) => void) | undefined),\n error: error ?? undefined,\n complete: complete ?? undefined,\n };\n } else {\n // The first argument is a partial observer.\n let context: any;\n if (this && config.useDeprecatedNextContext) {\n // This is a deprecated path that made `this.unsubscribe()` available in\n // next handler functions passed to subscribe. This only exists behind a flag\n // now, as it is *very* slow.\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context),\n error: observerOrNext.error && bind(observerOrNext.error, context),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context),\n };\n } else {\n // The \"normal\" path. Just use the partial observer directly.\n partialObserver = observerOrNext;\n }\n }\n\n // Wrap the partial observer to ensure it's a full observer, and\n // make sure proper error handling is accounted for.\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\n\nfunction handleUnhandledError(error: any) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n } else {\n // Ideal path, we report this as an unhandled error,\n // which is thrown on a new call stack.\n reportUnhandledError(error);\n }\n}\n\n/**\n * An error handler used when no error handler was supplied\n * to the SafeSubscriber -- meaning no error handler was supplied\n * do the `subscribe` call on our observable.\n * @param err The error to handle\n */\nfunction defaultErrorHandler(err: any) {\n throw err;\n}\n\n/**\n * A handler for notifications that cannot be sent to a stopped subscriber.\n * @param notification The notification being sent\n * @param subscriber The stopped subscriber\n */\nfunction handleStoppedNotification(notification: ObservableNotification, subscriber: Subscriber) {\n const { onStoppedNotification } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\n\n/**\n * The observer used as a stub for subscriptions where the user did not\n * pass any arguments to `subscribe`. Comes with the default error handling\n * behavior.\n */\nexport const EMPTY_OBSERVER: Readonly> & { closed: true } = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n","import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\n\n/**\n * Handles an error on another job either with the user-configured {@link onUnhandledError},\n * or by throwing it on that new job so it can be picked up by `window.onerror`, `process.on('error')`, etc.\n *\n * This should be called whenever there is an error that is out-of-band with the subscription\n * or when an error hits a terminal boundary of the subscription and no error handler was provided.\n *\n * @param err the error to report\n */\nexport function reportUnhandledError(err: any) {\n timeoutProvider.setTimeout(() => {\n const { onUnhandledError } = config;\n if (onUnhandledError) {\n // Execute the user-configured error handler.\n onUnhandledError(err);\n } else {\n // Throw so it is picked up by the runtime's uncaught error mechanism.\n throw err;\n }\n });\n}\n","/**\n * Symbol.observable or a string \"@@observable\". Used for interop\n *\n * @deprecated We will no longer be exporting this symbol in upcoming versions of RxJS.\n * Instead polyfill and use Symbol.observable directly *or* use https://www.npmjs.com/package/symbol-observable\n */\nexport const observable: string | symbol = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();\n","/**\n * This function takes one parameter and just returns it. Simply put,\n * this is like `(x: T): T => x`.\n *\n * ## Examples\n *\n * This is useful in some cases when using things like `mergeMap`\n *\n * ```ts\n * import { interval, take, map, range, mergeMap, identity } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(5));\n *\n * const result$ = source$.pipe(\n * map(i => range(i)),\n * mergeMap(identity) // same as mergeMap(x => x)\n * );\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * Or when you want to selectively apply an operator\n *\n * ```ts\n * import { interval, take, identity } from 'rxjs';\n *\n * const shouldLimit = () => Math.random() < 0.5;\n *\n * const source$ = interval(1000);\n *\n * const result$ = source$.pipe(shouldLimit() ? take(5) : identity);\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * @param x Any value that is returned by this function\n * @returns The value passed as the first parameter to this function\n */\nexport function identity(x: T): T {\n return x;\n}\n","import { identity } from './identity';\nimport { UnaryFunction } from '../types';\n\nexport function pipe(): typeof identity;\nexport function pipe(fn1: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction,\n fn9: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction,\n fn9: UnaryFunction,\n ...fns: UnaryFunction[]\n): UnaryFunction;\n\n/**\n * pipe() can be called on one or more functions, each of which can take one argument (\"UnaryFunction\")\n * and uses it to return a value.\n * It returns a function that takes one argument, passes it to the first UnaryFunction, and then\n * passes the result to the next one, passes that result to the next one, and so on. \n */\nexport function pipe(...fns: Array>): UnaryFunction {\n return pipeFromArray(fns);\n}\n\n/** @internal */\nexport function pipeFromArray(fns: Array>): UnaryFunction {\n if (fns.length === 0) {\n return identity as UnaryFunction;\n }\n\n if (fns.length === 1) {\n return fns[0];\n }\n\n return function piped(input: T): R {\n return fns.reduce((prev: any, fn: UnaryFunction) => fn(prev), input as any);\n };\n}\n","import { Operator } from './Operator';\nimport { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription, Subscription } from './Subscription';\nimport { TeardownLogic, OperatorFunction, Subscribable, Observer } from './types';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A representation of any set of values over any amount of time. This is the most basic building block\n * of RxJS.\n *\n * @class Observable\n */\nexport class Observable implements Subscribable {\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n source: Observable | undefined;\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n operator: Operator | undefined;\n\n /**\n * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n constructor(subscribe?: (this: Observable, subscriber: Subscriber) => TeardownLogic) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n\n // HACK: Since TypeScript inherits static properties too, we have to\n // fight against TypeScript here so Subject can have a different static create signature\n /**\n * Creates a new Observable by calling the Observable constructor\n * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new observable\n * @nocollapse\n * @deprecated Use `new Observable()` instead. Will be removed in v8.\n */\n static create: (...args: any[]) => any = (subscribe?: (subscriber: Subscriber) => TeardownLogic) => {\n return new Observable(subscribe);\n };\n\n /**\n * Creates a new Observable, with this Observable instance as the source, and the passed\n * operator defined as the new observable's operator.\n * @method lift\n * @param operator the operator defining the operation to take on the observable\n * @return a new observable with the Operator applied\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * If you have implemented an operator using `lift`, it is recommended that you create an\n * operator by simply returning `new Observable()` directly. See \"Creating new operators from\n * scratch\" section here: https://rxjs.dev/guide/operators\n */\n lift(operator?: Operator): Observable {\n const observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n\n subscribe(observerOrNext?: Partial> | ((value: T) => void)): Subscription;\n /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */\n subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;\n /**\n * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.\n *\n * Use it when you have all these Observables, but still nothing is happening.\n *\n * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It\n * might be for example a function that you passed to Observable's constructor, but most of the time it is\n * a library implementation, which defines what will be emitted by an Observable, and when it be will emitted. This means\n * that calling `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often\n * the thought.\n *\n * Apart from starting the execution of an Observable, this method allows you to listen for values\n * that an Observable emits, as well as for when it completes or errors. You can achieve this in two\n * of the following ways.\n *\n * The first way is creating an object that implements {@link Observer} interface. It should have methods\n * defined by that interface, but note that it should be just a regular JavaScript object, which you can create\n * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular, do\n * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also\n * that your object does not have to implement all methods. If you find yourself creating a method that doesn't\n * do anything, you can simply omit it. Note however, if the `error` method is not provided and an error happens,\n * it will be thrown asynchronously. Errors thrown asynchronously cannot be caught using `try`/`catch`. Instead,\n * use the {@link onUnhandledError} configuration option or use a runtime handler (like `window.onerror` or\n * `process.on('error)`) to be notified of unhandled errors. Because of this, it's recommended that you provide\n * an `error` method to avoid missing thrown errors.\n *\n * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.\n * This means you can provide three functions as arguments to `subscribe`, where the first function is equivalent\n * of a `next` method, the second of an `error` method and the third of a `complete` method. Just as in case of an Observer,\n * if you do not need to listen for something, you can omit a function by passing `undefined` or `null`,\n * since `subscribe` recognizes these functions by where they were placed in function call. When it comes\n * to the `error` function, as with an Observer, if not provided, errors emitted by an Observable will be thrown asynchronously.\n *\n * You can, however, subscribe with no parameters at all. This may be the case where you're not interested in terminal events\n * and you also handled emissions internally by using operators (e.g. using `tap`).\n *\n * Whichever style of calling `subscribe` you use, in both cases it returns a Subscription object.\n * This object allows you to call `unsubscribe` on it, which in turn will stop the work that an Observable does and will clean\n * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback\n * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.\n *\n * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.\n * It is an Observable itself that decides when these functions will be called. For example {@link of}\n * by default emits all its values synchronously. Always check documentation for how given Observable\n * will behave when subscribed and if its default behavior can be modified with a `scheduler`.\n *\n * #### Examples\n *\n * Subscribe with an {@link guide/observer Observer}\n *\n * ```ts\n * import { of } from 'rxjs';\n *\n * const sumObserver = {\n * sum: 0,\n * next(value) {\n * console.log('Adding: ' + value);\n * this.sum = this.sum + value;\n * },\n * error() {\n * // We actually could just remove this method,\n * // since we do not really care about errors right now.\n * },\n * complete() {\n * console.log('Sum equals: ' + this.sum);\n * }\n * };\n *\n * of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.\n * .subscribe(sumObserver);\n *\n * // Logs:\n * // 'Adding: 1'\n * // 'Adding: 2'\n * // 'Adding: 3'\n * // 'Sum equals: 6'\n * ```\n *\n * Subscribe with functions ({@link deprecations/subscribe-arguments deprecated})\n *\n * ```ts\n * import { of } from 'rxjs'\n *\n * let sum = 0;\n *\n * of(1, 2, 3).subscribe(\n * value => {\n * console.log('Adding: ' + value);\n * sum = sum + value;\n * },\n * undefined,\n * () => console.log('Sum equals: ' + sum)\n * );\n *\n * // Logs:\n * // 'Adding: 1'\n * // 'Adding: 2'\n * // 'Adding: 3'\n * // 'Sum equals: 6'\n * ```\n *\n * Cancel a subscription\n *\n * ```ts\n * import { interval } from 'rxjs';\n *\n * const subscription = interval(1000).subscribe({\n * next(num) {\n * console.log(num)\n * },\n * complete() {\n * // Will not be called, even when cancelling subscription.\n * console.log('completed!');\n * }\n * });\n *\n * setTimeout(() => {\n * subscription.unsubscribe();\n * console.log('unsubscribed!');\n * }, 2500);\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // 'unsubscribed!' after 2.5s\n * ```\n *\n * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown asynchronously as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {Subscription} a subscription reference to the registered handlers\n * @method subscribe\n */\n subscribe(\n observerOrNext?: Partial> | ((value: T) => void) | null,\n error?: ((error: any) => void) | null,\n complete?: (() => void) | null\n ): Subscription {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n\n errorContext(() => {\n const { operator, source } = this;\n subscriber.add(\n operator\n ? // We're dealing with a subscription in the\n // operator chain to one of our lifted operators.\n operator.call(subscriber, source)\n : source\n ? // If `source` has a value, but `operator` does not, something that\n // had intimate knowledge of our API, like our `Subject`, must have\n // set it. We're going to just call `_subscribe` directly.\n this._subscribe(subscriber)\n : // In all other cases, we're likely wrapping a user-provided initializer\n // function, so we need to catch errors and handle them appropriately.\n this._trySubscribe(subscriber)\n );\n });\n\n return subscriber;\n }\n\n /** @internal */\n protected _trySubscribe(sink: Subscriber): TeardownLogic {\n try {\n return this._subscribe(sink);\n } catch (err) {\n // We don't need to return anything in this case,\n // because it's just going to try to `add()` to a subscription\n // above.\n sink.error(err);\n }\n }\n\n /**\n * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with\n * APIs that expect promises, like `async/await`. You cannot unsubscribe from this.\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * #### Example\n *\n * ```ts\n * import { interval, take } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(4));\n *\n * async function getTotal() {\n * let total = 0;\n *\n * await source$.forEach(value => {\n * total += value;\n * console.log('observable -> ' + value);\n * });\n *\n * return total;\n * }\n *\n * getTotal().then(\n * total => console.log('Total: ' + total)\n * );\n *\n * // Expected:\n * // 'observable -> 0'\n * // 'observable -> 1'\n * // 'observable -> 2'\n * // 'observable -> 3'\n * // 'Total: 6'\n * ```\n *\n * @param next a handler for each value emitted by the observable\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n */\n forEach(next: (value: T) => void): Promise;\n\n /**\n * @param next a handler for each value emitted by the observable\n * @param promiseCtor a constructor function used to instantiate the Promise\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n * @deprecated Passing a Promise constructor will no longer be available\n * in upcoming versions of RxJS. This is because it adds weight to the library, for very\n * little benefit. If you need this functionality, it is recommended that you either\n * polyfill Promise, or you create an adapter to convert the returned native promise\n * to whatever promise implementation you wanted. Will be removed in v8.\n */\n forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise;\n\n forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n const subscriber = new SafeSubscriber({\n next: (value) => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve,\n });\n this.subscribe(subscriber);\n }) as Promise;\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): TeardownLogic {\n return this.source?.subscribe(subscriber);\n }\n\n /**\n * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable;\n pipe(op1: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction,\n op9: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction,\n op9: OperatorFunction,\n ...operations: OperatorFunction[]\n ): Observable;\n /* tslint:enable:max-line-length */\n\n /**\n * Used to stitch together functional operators into a chain.\n * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * ## Example\n *\n * ```ts\n * import { interval, filter, map, scan } from 'rxjs';\n *\n * interval(1000)\n * .pipe(\n * filter(x => x % 2 === 0),\n * map(x => x + x),\n * scan((acc, x) => acc + x)\n * )\n * .subscribe(x => console.log(x));\n * ```\n */\n pipe(...operations: OperatorFunction[]): Observable {\n return pipeFromArray(operations)(this);\n }\n\n /* tslint:disable:max-line-length */\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(): Promise;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: typeof Promise): Promise;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: PromiseConstructorLike): Promise;\n /* tslint:enable:max-line-length */\n\n /**\n * Subscribe to this Observable and get a Promise resolving on\n * `complete` with the last emission (if any).\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * @method toPromise\n * @param [promiseCtor] a constructor function used to instantiate\n * the Promise\n * @return A Promise that resolves with the last value emit, or\n * rejects on an error. If there were no emissions, Promise\n * resolves with undefined.\n * @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise\n */\n toPromise(promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n let value: T | undefined;\n this.subscribe(\n (x: T) => (value = x),\n (err: any) => reject(err),\n () => resolve(value)\n );\n }) as Promise;\n }\n}\n\n/**\n * Decides between a passed promise constructor from consuming code,\n * A default configured promise constructor, and the native promise\n * constructor and returns it. If nothing can be found, it will throw\n * an error.\n * @param promiseCtor The optional promise constructor to passed by consuming code\n */\nfunction getPromiseCtor(promiseCtor: PromiseConstructorLike | undefined) {\n return promiseCtor ?? config.Promise ?? Promise;\n}\n\nfunction isObserver(value: any): value is Observer {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\n\nfunction isSubscriber(value: any): value is Subscriber {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n","import { createErrorClass } from './createErrorClass';\n\nexport interface ObjectUnsubscribedError extends Error {}\n\nexport interface ObjectUnsubscribedErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): ObjectUnsubscribedError;\n}\n\n/**\n * An error thrown when an action is invalid because the object has been\n * unsubscribed.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n *\n * @class ObjectUnsubscribedError\n */\nexport const ObjectUnsubscribedError: ObjectUnsubscribedErrorCtor = createErrorClass(\n (_super) =>\n function ObjectUnsubscribedErrorImpl(this: any) {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n }\n);\n","import { Operator } from './Operator';\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { Observer, SubscriptionLike, TeardownLogic } from './types';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A Subject is a special type of Observable that allows values to be\n * multicasted to many Observers. Subjects are like EventEmitters.\n *\n * Every Subject is an Observable and an Observer. You can subscribe to a\n * Subject, and you can call next to feed values as well as error and complete.\n */\nexport class Subject extends Observable implements SubscriptionLike {\n closed = false;\n\n private currentObservers: Observer[] | null = null;\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n observers: Observer[] = [];\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n isStopped = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n hasError = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n thrownError: any = null;\n\n /**\n * Creates a \"subject\" by basically gluing an observer to an observable.\n *\n * @nocollapse\n * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.\n */\n static create: (...args: any[]) => any = (destination: Observer, source: Observable): AnonymousSubject => {\n return new AnonymousSubject(destination, source);\n };\n\n constructor() {\n // NOTE: This must be here to obscure Observable's constructor.\n super();\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n lift(operator: Operator): Observable {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator as any;\n return subject as any;\n }\n\n /** @internal */\n protected _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n\n next(value: T) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n if (!this.currentObservers) {\n this.currentObservers = Array.from(this.observers);\n }\n for (const observer of this.currentObservers) {\n observer.next(value);\n }\n }\n });\n }\n\n error(err: any) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.hasError = this.isStopped = true;\n this.thrownError = err;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.error(err);\n }\n }\n });\n }\n\n complete() {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.isStopped = true;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.complete();\n }\n }\n });\n }\n\n unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = this.currentObservers = null!;\n }\n\n get observed() {\n return this.observers?.length > 0;\n }\n\n /** @internal */\n protected _trySubscribe(subscriber: Subscriber): TeardownLogic {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n\n /** @internal */\n protected _innerSubscribe(subscriber: Subscriber) {\n const { hasError, isStopped, observers } = this;\n if (hasError || isStopped) {\n return EMPTY_SUBSCRIPTION;\n }\n this.currentObservers = null;\n observers.push(subscriber);\n return new Subscription(() => {\n this.currentObservers = null;\n arrRemove(observers, subscriber);\n });\n }\n\n /** @internal */\n protected _checkFinalizedStatuses(subscriber: Subscriber) {\n const { hasError, thrownError, isStopped } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped) {\n subscriber.complete();\n }\n }\n\n /**\n * Creates a new Observable with this Subject as the source. You can do this\n * to create custom Observer-side logic of the Subject and conceal it from\n * code that uses the Observable.\n * @return {Observable} Observable that the Subject casts to\n */\n asObservable(): Observable {\n const observable: any = new Observable();\n observable.source = this;\n return observable;\n }\n}\n\n/**\n * @class AnonymousSubject\n */\nexport class AnonymousSubject extends Subject {\n constructor(\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n public destination?: Observer,\n source?: Observable\n ) {\n super();\n this.source = source;\n }\n\n next(value: T) {\n this.destination?.next?.(value);\n }\n\n error(err: any) {\n this.destination?.error?.(err);\n }\n\n complete() {\n this.destination?.complete?.();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n return this.source?.subscribe(subscriber) ?? EMPTY_SUBSCRIPTION;\n }\n}\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","export default function _classExtractFieldDescriptor(receiver, privateMap, action) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to \" + action + \" private field on non-instance\");\n }\n return privateMap.get(receiver);\n}","import classApplyDescriptorGet from \"./classApplyDescriptorGet.js\";\nimport classExtractFieldDescriptor from \"./classExtractFieldDescriptor.js\";\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"get\");\n return classApplyDescriptorGet(receiver, descriptor);\n}","export default function _classApplyDescriptorGet(receiver, descriptor) {\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n return descriptor.value;\n}","import checkPrivateRedeclaration from \"./checkPrivateRedeclaration.js\";\nexport default function _classPrivateFieldInitSpec(obj, privateMap, value) {\n checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}","import classApplyDescriptorSet from \"./classApplyDescriptorSet.js\";\nimport classExtractFieldDescriptor from \"./classExtractFieldDescriptor.js\";\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}","export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}","import getPrototypeOf from \"./getPrototypeOf.js\";\nexport default function _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n return object;\n}","import superPropBase from \"./superPropBase.js\";\nexport default function _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n return desc.value;\n };\n }\n return _get.apply(this, arguments);\n}","import _typeof from \"./typeof.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport inherits from \"./inherits.js\";\nexport default function _wrapRegExp() {\n _wrapRegExp = function _wrapRegExp(re, groups) {\n return new BabelRegExp(re, void 0, groups);\n };\n var _super = RegExp.prototype,\n _groups = new WeakMap();\n function BabelRegExp(re, flags, groups) {\n var _this = new RegExp(re, flags);\n return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype);\n }\n function buildGroups(result, re) {\n var g = _groups.get(re);\n return Object.keys(g).reduce(function (groups, name) {\n var i = g[name];\n if (\"number\" == typeof i) groups[name] = result[i];else {\n for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;\n groups[name] = result[i[k]];\n }\n return groups;\n }, Object.create(null));\n }\n return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {\n var result = _super.exec.call(this, str);\n if (result) {\n result.groups = buildGroups(result, this);\n var indices = result.indices;\n indices && (indices.groups = buildGroups(indices, this));\n }\n return result;\n }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {\n if (\"string\" == typeof substitution) {\n var groups = _groups.get(this);\n return _super[Symbol.replace].call(this, str, substitution.replace(/\\$<([^>]+)>/g, function (_, name) {\n var group = groups[name];\n return \"$\" + (Array.isArray(group) ? group.join(\"$\") : group);\n }));\n }\n if (\"function\" == typeof substitution) {\n var _this = this;\n return _super[Symbol.replace].call(this, str, function () {\n var args = arguments;\n return \"object\" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);\n });\n }\n return _super[Symbol.replace].call(this, str, substitution);\n }, _wrapRegExp.apply(this, arguments);\n}","export const isDisplay = (a) => typeof a?.toString === \"function\" ||\n typeof a === \"string\";\nexport const display = (a) => {\n if (isDisplay(a)) {\n const str = a.toString();\n if (str === \"[object Object]\")\n return JSON.stringify(a);\n return str;\n }\n return JSON.stringify(a);\n};\n","export function range(start, end, stride = 1) {\n const range = [];\n for (let i = start; i < end; i += stride) {\n range.push(i);\n }\n return range;\n}\n","export const isNone = (s) => s === null;\nexport const isSome = (s) => s != null;\nexport function None(_) {\n return null;\n}\nexport function Some(t) {\n return t;\n}\nexport const isOk = (t) => t.ok !== undefined;\nexport const isErr = (e) => e.err !== undefined;\nexport const isResult = (t) => isOk(t) || isErr(t);\nexport function Ok(t) {\n return t.ok\n ? t.ok\n : {\n ok: t,\n map(fn) {\n return fn(Ok(this));\n },\n };\n}\nexport function Err(e) {\n return (e.err ?? {\n err: e,\n map(_fn) {\n return this;\n },\n });\n}\nexport function unwrap(t) {\n if (isNone(t)) {\n throw new Error(`Attempted to unwrap None`);\n }\n if (isErr(t)) {\n throw Err(t);\n }\n if (isOk(t)) {\n return Ok(t);\n }\n return t;\n}\nexport function unwrapOr(t, def) {\n if (isNone(t)) {\n return def;\n }\n if (isErr(t)) {\n return def;\n }\n if (isOk(t)) {\n return Ok(t);\n }\n return t;\n}\nexport function unwrapOrElse(t, def) {\n if (isNone(t)) {\n return def();\n }\n if (isErr(t)) {\n return def();\n }\n if (isOk(t)) {\n return Ok(t);\n }\n return t;\n}\n"],"names":["main$1","exports","Failure$2","pexpr","text","type","isValidType","Error","this","fluffy","prototype","getPExpr","getText","getType","isDescription","isStringTerminal","isCode","isFluffy","makeFluffy","clearFluffy","subsumes","that","toString","JSON","stringify","clone","failure","toKey","Failure_1","common$l","escapeStringFor","c","String","fromCharCode","charCodeAt","abstract","optMethodName","methodName","constructor","name","assert","cond","message","defineLazyProperty","obj","propName","getterFn","memo","Object","defineProperty","get","call","assign","repeatFn","fn","n","arr","push","repeatStr","str","Array","join","repeat","x","getDuplicates","array","duplicates","idx","length","lastIndexOf","indexOf","copyWithoutDuplicates","noDuplicates","forEach","entry","isSyntactic","ruleName","firstChar","toUpperCase","isLexical","padLeft","len","optChar","ch","StringBuffer","strings","append","contents","escapeUnicode","fromCodePoint","parseInt","unescapeCodePoint","s","charAt","slice","unexpectedObjToString","baseToString","e","common$k","Node","matchLength","children","arg","numChildren","hasChildren","ctorName","firstChild","hasNoChildren","childAt","child","childIdx","indexOfChild","TerminalNode$2","nodes$1","TerminalNode","NonterminalNode","childOffsets","IterationNode","isOptional","optional","pexprsMain","UnicodeCategories","Lu","Ll","Lt","Lm","Lo","Nl","Nd","Mn","Mc","Pc","Zs","L","Ltmo","common$j","PExpr$1","interval","source","trimmed","any","create","end","Terminal$1","Range","from","to","matchCodePoint","Param","index","Alt","terms","Extend","superGrammar","body","origBody","rules","Splice","beforeTerms","afterTerms","expansionPos","Seq","factors","Iter","expr","Star","Plus","Opt","operator","minNumMatches","maxNumMatches","Number","POSITIVE_INFINITY","Not","Lookahead","Lex","Apply","args","_memoKey","value","UnicodeChar","category","pattern","PExpr","Terminal","common$i","pexprs$l","Namespace$2","allowsSkippingPrecedingSpace","asNamespace","objOrNamespace","createNamespace","optProps","extend","namespace","TypeError","ns","enumerable","writable","configurable","Namespace_1","assert$3","Namespace$1","pexprs$k","createError","optInterval","getLineAndColumnMessage","shortMessage","errors$9","applicationOfSyntacticRuleFromLexicalContext","applyExpr","applySyntacticWithLexicalRuleApplication","cannotExtendUndeclaredRule","grammarName","optSource","cannotOverrideUndeclaredRule","duplicateGrammarDeclaration","grammar","duplicateParameterNames","duplicatePropertyNames","duplicateRuleDeclaration","declGrammarName","inconsistentArity","expected","actual","incorrectArgumentType","expectedType","intervalSourcesDontMatch","invalidCodePoint","applyWrapper","node","_node","isNonterminal","digitIntervals","map","d","fullInterval","coverageWith","invalidConstructorCall","invalidParameter","getArity","grammarSyntaxError","matchFailure","getExpectedText","getInterval","kleeneExprHasNullableOperand","kleeneExpr","applicationStack","actuals","substituteParams","app","missingSemanticAction","stack","stackTrace","info","ans","moreInfo","multipleSuperSplices","undeclaredGrammar","undeclaredRule","unnecessaryExperimentalApplySyntactic","wrongNumberOfArguments","wrongNumberOfParameters","throwErrors","errors","messages","concat","multipleErrors","util$7","common","padNumbersToEqualLength","maxLen","Math","max","strcpy","dest","src","offset","origDestLen","substr","lineAndColumnToMessage","lineAndCol","sb","lineNum","colNum","lineNumbers","prevLine","nextLine","appendLine","num","content","prefix","line","lineLen","indicationLine","ranges","i","startIdx","endIdx","lineStartOffset","min","gutterWidth","replace","builtInRulesCallbacks","awaitBuiltInRules","cb","announceBuiltInRules","getLineAndColumn","currOffset","prevLineStartOffset","lineEndOffset","nextLineEndOffset","uniqueId","idCounter","BuiltInRules","lexifyCount","errors$8","pexprs$j","g","assertAllApplicationsAreValid","_assertAllApplicationsAreValid","skipSyntacticCheck","ruleInfo","isContextSyntactic","formals","isBuiltInApplySyntactic","applySyntactic","isBuiltInCaseInsensitive","caseInsensitive","common$h","errors$7","pexprs$i","assertChoicesHaveUniformArity","arity","term","otherArity","actualArity","expectedArity","common$g","errors$6","pexprs$h","assertIteratedExprsAreNotNullable","isNullable","assert$2","errors$5","util$5","Interval$3","sourceString","coverage","firstInterval","intervals","collapsedLeft","collapsedRight","range","minus","relativeTo","match","subInterval","newStartIdx","defineProperties","undefined","_contents","Interval_1","Interval$2","common$f","Flags","succeeded","isRootNode","isImplicitSpaces","isMemoized","isHeadOfLeftRecursion","terminatesLR","asEscapedString","Trace$2","input","pos1","pos2","bindings","optChildren","pos","terminatingLREntry","_flags","SKIP","toDisplayString","keys","mask","set","val","cloneWithExpr","recordLRTermination","ruleBodyTrace","walk","visitorObjOrFn","optThisArg","visitor","_walk","parent","depth","recurse","enter","exit","excerpt","getInputExcerpt","displayString","Trace_1","Trace$1","common$e","errors$4","pexprs$g","TerminalNode$1","IterationNode$1","eval","state","inputStream","origPos","next","pushBinding","processFailure","atEnd","matchString","cp","nextCodePoint","nextCharCode","codePointAt","currentApplication","enterLexifiedContext","exitLexifiedContext","factor","cols","colOffsets","numMatches","prevPos","_applicationStack","row","_bindings","splice","rowOffsets","_bindingOffsets","posToOffset","lastCol","lastColOffsets","pushFailuresInfo","popFailuresInfo","caller","posInfo","getCurrentPosInfo","isActive","handleCycle","memoKey","toMemoKey","memoRec","shouldUseMemoizedResult","hasNecessaryInfo","useMemoizedResult","reallyEval","currentLeftRecursion","headApplication","updateInvolvedApplicationMemoKeys","memoize","examinedLength","rightmostFailureOffset","startLeftRecursion","origPosInfo","description","enterApplication","origInputStreamExaminedLength","evalOnce","currentLR","growSeedResult","endLeftRecursion","_getRightmostFailureOffset","isInvolved","failuresAtRightmostPosition","cloneRecordedFailures","isTracing","getTraceEntry","traceEntry","exitApplication","offsets","lrMemoRec","newValue","seedTrace","trace","pop","test","common$d","pexprs$f","common$c","pexprs$e","getMetaInfo","grammarInterval","metaInfo","adjusted","sourceInterval","outputRecipe","toLowerCase","common$b","pexprs$d","introduceParams","withSource","common$a","pexprs$c","_isNullable","some","every","key","hasOwnProperty","inlined","common$9","pexprs$b","common$8","pexprs$a","isRestrictedJSIdentifier","resolveDuplicatedNames","argumentNameList","count","argName","dupArgName","subscript","toArgumentNameList","firstArgIndex","noDupCheck","termArgNameLists","numArgs","colIdx","col","rowIdx","uniqueNames","factorArgumentNameList","exprArgumentString","common$7","pexprs$9","ps","Failure$1","common$6","pexprs$8","toFailure","t","f","common$5","pexprs$7","pexprs$6","Failure","assert$1","CaseInsensitiveTerminal$1","param","terminal","matchStr","_getString","CaseInsensitiveTerminal_1","Interval$1","InputStream$3","nextChar","optIgnoreCase","sourceSlice","optEndIdx","InputStream_1","common$4","util$4","Interval","MatchResult$2","matcher","startExpr","cst","cstOffset","rightmostFailurePosition","optRecordedFailures","_cst","_cstOffset","_rightmostFailurePosition","_rightmostFailures","failed","detail","getRightmostFailurePosition","errorInfo","getRightmostFailures","setInput","matchResultWithFailures","_match","failures","filter","MatchResult_1","PosInfo$1","applicationMemoKeyStack","maxExaminedLength","maxRightmostFailureOffset","application","isLeftRecursion","nextLeftRecursion","indexOfFirstInvolvedRule","involvedApplicationMemoKeys","applicationMemoKey","clearObsoleteEntries","invalidatedIdx","k","builtInApplySyntacticBody","InputStream$2","MatchResult$1","PosInfo","Trace","pexprs$5","builtInRules","applySpaces","MatchState$1","optPositionToRecordFailures","memoTable","_posStack","inLexifiedContextStack","_rightmostFailurePositionStack","_recordedFailuresStack","positionToRecordFailures","recordedFailures","optNode","inSyntacticContext","inLexifiedContext","skipSpaces","popBinding","skipSpacesIfInSyntacticContext","maybeSkipSpacesBefore","numBindings","truncateBindings","newLength","getPosInfo","recordFailure","shouldCloneIfNew","recordFailures","getMemoizedTraceEntry","memoRecRightmostFailurePosition","origRecordedFailures","origNumBindings","origTrace","memoPos","getMatchResult","rightmostFailures","getTrace","matchResult","rootTrace","result","MatchState","pexprs$4","Matcher$1","getInput","replaceInputRange","currentInput","restOfMemoTable","optStartApplicationStr","_getStartExpr","tracing","applicationStr","defaultStartRule","startApp","parseApplication","Matcher_1","InputStream$1","MatchResult","common$3","errors$3","util$2","globalActionStack","prop","Wrapper","baseInterval","_baseInterval","_childWrappers","attributeName","_semantics","attributeKeys","_forgetMemoizedResultFor","childWrapper","childNode","base","wrap","isIteration","isTerminal","optChildWrappers","childWrappers","childNodes","iter","wrapper","_children","Semantics$2","superSemantics","self","checkedActionDicts","checkActionDictsIfHaventAlready","super","equals","_inheritsFrom","operations","attributes","parseSignature$1","signature","prototypeGrammar","r","prototypeGrammarSemantics","parse","checkActionDicts","checkActionDict","toRecipe","semanticsOnly","hasSuperSemantics","BuiltInSemantics","_getSemantics","superSemanticsGrammar","relatedGrammar","semanticOperations","method","actionDict","builtInDefault","srcArray","actionName","trim","addOperationOrAttribute","typePlural","parsedNameAndFormalArgs","assertNewName","doIt","formal","apply","newDefaultAction","realActionDict","_default","Operation","Attribute","thisThing","arguments","argsObj","entries","oldArgs","execute","extendOperationOrAttribute","inheritedFormals","inheritedActionDict","newActionDict","optBaseInterval","createSemantics","optSuperSemantics","proxy","addOperation","extendOperation","addAttribute","extendAttribute","_getActionDict","operationOrAttributeName","action","_remove","semantic","getOperationNames","getAttributeNames","getGrammar","bind","_checkTopDownActionDict","typeName","semantics","nodeWrapper","actionFn","_nonterminal","Semantics_1","CaseInsensitiveTerminal","Matcher","Semantics$1","common$2","errors$2","pexprs$3","SPECIAL_ACTION_NAMES","getSortedRuleValues","sort","ohmGrammar$2","buildGrammar$1","jsonToJS","Grammar$4","optDefaultStartRule","initApplicationParser","builderFn","isBuiltIn","ProtoBuiltInRules","myRules","otherRules","rule","optStartApplication","m","extendSemantics","what","problems","v","includes","_topDownActionArity","details","prettyProblems","problem","error","superGrammarExpr","startRule","operation","isDefinition","bodyRecipe","superGrammarOutput","recipeElements","toOperationActionDictionaryTemplate","_toOperationOrAttributeActionDictionaryTemplate","toAttributeActionDictionaryTemplate","first","addSemanticActionTemplate","primitive","lower","upper","unicodeLtmo","spaces","space","Grammar_1","Grammar$3","InputStream","common$1","errors$1","pexprs$2","GrammarDecl$1","ensureSuperGrammar","withSuperGrammar","ensureSuperGrammarRuleForOverriding","installOverriddenOrExtendedRule","expectedFormals","expectedNumFormals","install","withDefaultStartRule","build","grammarErrors","grammarHasInvalidApplications","define","override","descIgnored","fragment","Grammar$2","GrammarDecl","pexprs$1","Builder$2","currentDecl","currentRuleName","newGrammar","gDecl","fromRecipe","ruleRecipe","alt","termArgs","seq","factorArgs","star","plus","opt","not","la","lookahead","lex","optParams","recipe","Builder_1","version$1","__GLOBAL_OHM_VERSION__","makeRecipe$5","Builder$1","makeRecipe","makeRecipe$3","operationsAndAttributes","makeRecipe$2","Semantics","operationsAndAttributesGrammar","actions","empty","iteration","nonEmpty","_","rest","emptyListOf","nonemptyListOf","EmptyListOf","NonemptyListOf","initBuiltInSemantics","AttributeSignature","OperationSignature","optFormals","Formals","oparen","fs","cparen","asIteration","initPrototypeParser","ohmGrammar","ohmGrammar$1","makeRecipe$1","Builder","Grammar","Namespace","pexprs","util","version","superSplicePlaceholder","buildGrammar","optOhmGrammarForTesting","decl","currentRuleFormals","builder","overriding","helpers","Grammars","grammarIter","visit","id","_open","_close","SuperGrammar","superGrammarName","Rule_define","b","Rule_override","Rule_extend","RuleBody","OverrideRuleBody","opointy","cpointy","Params","seqs","TopLevelTerm_inline","inlineRuleName","isNewRuleDeclaration","params","OverrideTopLevelTerm_superSplice","Iter_star","Iter_plus","Iter_opt","Pred_not","Pred_lookahead","Lex_lex","Base_application","Base_range","Base_terminal","Base_paren","open","close","ruleDescr","ruleDescrText","caseName","space1","space2","nameFirst","nameRest","cs","oneCharTerminal","escapeChar","err","RangeError","startsWith","xs","_terminal","grammars","optNamespace","isBuffer","compileAndLoad","grammarNames","grammarFromScriptElement","grammarsFromScriptElements","optNodeOrNodeList","_buildGrammar","ohm","getProp","thing","mapProp","getPropWalkFn","descriptor","parts","split","getProps","walkFns","walkFn","isRestrictedIdentifier","VisitorFamily","config","_shapes","shapes","_getTag","getTag","Adapter","family","_adaptee","_family","valueOf","_arities","_getChildren","shape","isArray","getWalkFn","_wrap","_checkActionDict","dict","sig","parseSignature","tag","_value","_super","_this","__extends","BehaviorSubject","getValue","subscriber","subscription","_subscribe","closed","hasError","thrownError","_throwIfClosed","Subject","isFunction","createErrorClass","createImpl","ctorFunc","instance","UnsubscriptionError","arrRemove","item","initialTeardown","_parentage","_finalizers","Subscription","remove","initialFinalizer","finalizer","execFinalizer","teardown","_hasParent","_addParent","_removeParent","EMPTY_SUBSCRIPTION","EMPTY","isSubscription","add","unsubscribe","onUnhandledError","onStoppedNotification","Promise","useDeprecatedSynchronousErrorHandling","useDeprecatedNextContext","timeoutProvider","setTimeout","handler","timeout","_i","delegate","clearTimeout","handle","noop","COMPLETE_NOTIFICATION","createNotification","kind","context","errorContext","isRoot","errorThrown","destination","EMPTY_OBSERVER","Subscriber","complete","SafeSubscriber","isStopped","handleStoppedNotification","nextNotification","_next","_error","_complete","_bind","Function","thisArg","partialObserver","ConsumerObserver","handleUnhandledError","observerOrNext","context_1","reportUnhandledError","notification","observable","Symbol","identity","pipeFromArray","fns","reduce","prev","subscribe","Observable","isObserver","_trySubscribe","sink","promiseCtor","getPromiseCtor","resolve","reject","Symbol_observable","ObjectUnsubscribedError","subject","AnonymousSubject","currentObservers","observers","shift","_checkFinalizedStatuses","_innerSubscribe","extendStatics","setPrototypeOf","__proto__","p","__","__values","o","iterator","done","__read","ar","__spreadArray","pack","l","_classExtractFieldDescriptor","receiver","privateMap","has","_classPrivateFieldGet","classExtractFieldDescriptor","_classPrivateFieldInitSpec","privateCollection","_classPrivateFieldSet","_superPropBase","object","property","getPrototypeOf","_get","Reflect","target","desc","getOwnPropertyDescriptor","_wrapRegExp","re","groups","BabelRegExp","RegExp","_groups","WeakMap","flags","buildGroups","exec","indices","substitution","group","display","a","isDisplay","start","stride","isNone","isOk","ok","isErr","Ok","Err","_fn","unwrap"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/605.b27434d9.chunk.js b/build/static/js/605.b27434d9.chunk.js new file mode 100644 index 000000000..4d6122ade --- /dev/null +++ b/build/static/js/605.b27434d9.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[605],{9605:function(e,t,n){n.r(t),n.d(t,{Chip:function(){return Jt},default:function(){return Gt}});var r=n(2951),i=n(1976),o=n(3243),a=n(7597),s=n(7591),c=n(4337),u=n(1092),l=n(7791),d=n(1026),f=n(8061),p=n(6167),h=n(649),v=n(7878),m=n(3300),g=n(3118),x=n(7039),b=n(3116),j=n(6329),y=n(6693),k=n(134),C=n(326),Z=function(e){var t,n=e.A,r=e.op,i=e.D,o=e.out,a=e.flag;return(0,v.jsxs)("div",{children:[(0,v.jsx)("span",{children:"ALU"}),(0,v.jsxs)("dl",{children:[(0,v.jsx)("dt",{children:"A"})," ",(0,v.jsx)("dd",{children:(0,C.Ly)(n)}),(0,v.jsx)("dt",{children:"op"})," ",(0,v.jsx)("dd",{children:null!==(t=y.PH.op[r])&&void 0!==t?t:"(??)"}),(0,v.jsx)("dt",{children:"D"})," ",(0,v.jsx)("dd",{children:(0,C.Ly)(i)}),(0,v.jsx)("dt",{children:"="})," ",(0,v.jsx)("dd",{children:(0,C.Ly)(o)}),(0,v.jsx)("dd",{children:y.vU[a]})]})]})},w=function(e){var t=e.name,n=e.bits;return(0,v.jsxs)("div",{children:[t,": ",(0,C.E_)(n)]})},P={Enter:128,Backspace:129,ArrowLeft:130,ArrowUp:131,ArrowRight:132,ArrowDown:133,Home:134,End:135,PageUp:136,PageDown:137,Insert:138,Delete:139,Escape:140,F1:141,F2:142,F3:143,F4:144,F5:145,F6:146,F7:147,F8:148,F9:149,F10:150,F11:151,F12:152};var S=function(e){var t=e.keyboard,n=(0,p.useState)(!1),r=(0,d.Z)(n,2),i=r[0],o=r[1],a=(0,p.useState)(t.out().busVoltage),s=(0,d.Z)(a,2),c=s[0],u=s[1],l=(0,p.useCallback)((function(e){var n=function(e){var t=P[e.key];if(void 0!==t)return t;if(1===e.key.length){var n=e.key.charCodeAt(0);if(n>=32&&n<=126)return n}return 0}(e);0!==n&&(e.preventDefault(),t.setKey(n),u(t.out().busVoltage),o(!1))}),[t,o,u]),f=(0,p.useCallback)((function(){o(!0)}),[]);return(0,v.jsxs)("div",{className:"flex row align-baseline",children:[(0,v.jsx)("div",{className:"flex-1",children:(0,v.jsx)(w,{name:"Keyboard",bits:c})}),(0,v.jsx)("div",{className:"flex-1",children:i?(0,v.jsx)("input",{ref:function(e){return null===e||void 0===e?void 0:e.focus()},type:"text",onKeyDown:l}):(0,v.jsx)("button",{onClick:f,children:"\u2328\ufe0f"})})]})},F=n(189),N={none:"0px",sm:"0.125rem","":"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},O={"":"",t:"Top",r:"Right",l:"Left",b:"Bottom",tl:"TopLeft",tr:"TopRight",bl:"BottomLeft",br:"BottomRight"},A={"1/4":"25%","1/2":"50%","3/4":"75%",full:"100%"};function E(e){return void 0!==O[e]}function I(e){return N[e]}function M(e){switch(e){case"t":return[].concat((0,h.Z)(M("tl")),(0,h.Z)(M("tr")));case"r":return[].concat((0,h.Z)(M("tr")),(0,h.Z)(M("br")));case"b":return[].concat((0,h.Z)(M("br")),(0,h.Z)(M("bl")));case"l":return[].concat((0,h.Z)(M("tl")),(0,h.Z)(M("bl")));default:return[O[e]]}}function T(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";E(e)&&(t=e,e="");var n=I(e);return M(t).reduce((function(e,t){return""===t?e.borderRadius=n:e["border".concat(t,"Radius")]=n,e}),{})}var R=n(5838),D=n(7693);function H(e,t){var n;return void 0===e&&void 0!==A[t]&&(e=t),(0,F.Z)((0,F.Z)({},"inline"===t?{display:"inline-block"}:{}),{},{width:null!==(n=A[e])&&void 0!==n?n:"0"})}function _(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:G(e)?2:$(e)?3:0}function K(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t){return 2===B(e)?e.get(t):e[t]}function W(e,t,n){var r=B(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function J(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function G(e){return ke&&e instanceof Map}function $(e){return Ce&&e instanceof Set}function q(e){return e.o||e.t}function X(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Oe(e);delete t[Se];for(var n=Ne(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=Q),Object.freeze(e),t&&z(e,(function(e,t){return Y(t,!0)}),!0)),e}function Q(){_(2)}function ee(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function te(e){var t=Ae[e];return t||_(18,e),t}function ne(){return je}function re(e,t){t&&(te("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){oe(e),e.p.forEach(se),e.p=null}function oe(e){e===je&&(je=e.l)}function ae(e){return je={p:[],l:je,h:e,m:!0,_:0}}function se(e){var t=e[Se];0===t.i||1===t.i?t.j():t.O=!0}function ce(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||te("ES5").S(t,e,r),r?(n[Se].P&&(ie(t),_(4)),U(e)&&(e=ue(t,e),t.l||de(t,e)),t.u&&te("Patches").M(n[Se].t,e,t.u,t.s)):e=ue(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==we?e:void 0}function ue(e,t,n){if(ee(t))return t;var r=t[Se];if(!r)return z(t,(function(i,o){return le(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return de(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=X(r.k):r.o;z(3===r.i?new Set(i):i,(function(t,o){return le(e,r,i,t,o,n)})),de(e,i,!1),n&&e.u&&te("Patches").R(r,n,e.u,e.s)}return r.o}function le(e,t,n,r,i,o){if(L(i)){var a=ue(e,i,o&&t&&3!==t.i&&!K(t.D,r)?o.concat(r):void 0);if(W(n,r,a),!L(a))return;e.m=!1}if(U(i)&&!ee(i)){if(!e.h.F&&e._<1)return;ue(e,i),t&&t.A.l||de(e,i)}}function de(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Y(t,n)}function fe(e,t){var n=e[Se];return(n?q(n):e)[t]}function pe(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function he(e){e.P||(e.P=!0,e.l&&he(e.l))}function ve(e){e.o||(e.o=X(e.t))}function me(e,t,n){var r=G(t)?te("MapSet").N(t,n):$(t)?te("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:ne(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=Ee;n&&(i=[r],o=Ie);var a=Proxy.revocable(i,o),s=a.revoke,c=a.proxy;return r.k=c,r.j=s,c}(t,n):te("ES5").J(t,n);return(n?n.A:ne()).p.push(r),r}function ge(e){return L(e)||_(22,e),function e(t){if(!U(t))return t;var n,r=t[Se],i=B(t);if(r){if(!r.P&&(r.i<4||!te("ES5").K(r)))return r.t;r.I=!0,n=xe(t,i),r.I=!1}else n=xe(t,i);return z(n,(function(t,i){r&&V(r.t,t)===i||W(n,t,e(i))})),3===i?new Set(n):n}(e)}function xe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return X(e)}var be,je,ye="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ke="undefined"!=typeof Map,Ce="undefined"!=typeof Set,Ze="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,we=ye?Symbol.for("immer-nothing"):((be={})["immer-nothing"]=!0,be),Pe=ye?Symbol.for("immer-draftable"):"__$immer_draftable",Se=ye?Symbol.for("immer-state"):"__$immer_state",Fe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Ne="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Oe=Object.getOwnPropertyDescriptors||function(e){var t={};return Ne(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ae={},Ee={get:function(e,t){if(t===Se)return e;var n=q(e);if(!K(n,t))return function(e,t,n){var r,i=pe(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!U(r)?r:r===fe(e.t,t)?(ve(e),e.o[t]=me(e.A.h,r,e)):r},has:function(e,t){return t in q(e)},ownKeys:function(e){return Reflect.ownKeys(q(e))},set:function(e,t,n){var r=pe(q(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=fe(q(e),t),o=null==i?void 0:i[Se];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(J(n,i)&&(void 0!==n||K(e.t,t)))return!0;ve(e),he(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==fe(e.t,t)||t in e.t?(e.D[t]=!1,ve(e),he(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=q(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){_(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){_(12)}},Ie={};z(Ee,(function(e,t){Ie[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ie.deleteProperty=function(e,t){return Ie.set.call(this,e,t,void 0)},Ie.set=function(e,t,n){return Ee.set.call(this,e[0],t,n,e[0])};var Me=function(){function e(e){var t=this;this.g=Ze,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,a=Array(r>1?r-1:0),s=1;s1?r-1:0),o=1;o=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var i=te("Patches").$;return L(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Te=new Me,Re=Te.produce,De=(Te.produceWithPatches.bind(Te),Te.setAutoFreeze.bind(Te),Te.setUseProxies.bind(Te),Te.applyPatches.bind(Te),Te.createDraft.bind(Te),Te.finishDraft.bind(Te),Re);function He(e,t){return(0,p.useReducer)((function(t,n){return De(t,(function(t){e[n.action](t,n.payload)}))}),t)}function _e(e){var t=(0,p.useState)(e),n=(0,d.Z)(t,2),r=n[0],i=n[1];return(0,p.useEffect)((function(){i(e)}),[e]),[r,i]}var Le=0,Ue=1,ze=function(e){var t,n=(0,p.useState)(null!==(t=e.mode)&&void 0!==t?t:Le),r=(0,d.Z)(n,2),i=r[0],o=r[1],a=_e(e.value),s=(0,d.Z)(a,2),c=s[0],u=s[1],l=function(){return(0,v.jsx)("span",{style:(0,F.Z)({cursor:"text"},H("full","inline")),onClick:function(){o(Ue)},children:c})},f=(0,p.useCallback)((function(e){return null===e||void 0===e?void 0:e.select()}),[]),h=(0,p.useCallback)((function(t){var n,r;o(Le),u(null!==(n=t.value)&&void 0!==n?n:""),e.onChange(null!==(r=t.value)&&void 0!==r?r:"")}),[e,o,u]),m=function(){var e=(0,v.jsx)("span",{style:{display:"block",position:"relative"},children:(0,v.jsx)("input",{ref:f,style:{zIndex:"10",position:"absolute",left:"0",marginTop:"-0.375rem"},onBlur:function(e){var t=e.target;return h(t)},onKeyPress:function(e){var t=e.key,n=e.target;"Enter"===t&&h(n)},type:"text",defaultValue:c})});return e};return function(){switch(i){case Ue:return m();case Le:return l();default:return(0,v.jsx)("span",{})}}()};function Be(e,t,n){var r=t.totalHeight,i=t.toleranceHeight,o=t.bufferedItems,a=t.settings,s=a.itemHeight,c=a.minIndex,u=a.maxIndex,l=c+Math.floor((e-i)/s),d=function(e,t,n,r,i){var o=Math.max(0,e,n),a=i(o,Math.min(t,n+r-1)-o);return(0,h.Z)(a)}(c,u,l,o,n),f=Math.max((l-c)*s,0);return{scrollTop:e,topPaddingHeight:f,bottomPaddingHeight:Math.max(r-(f+d.length*s),0),data:d}}var Ke=function(e){var t,n=(0,p.useRef)(null),r=(0,p.useMemo)((function(){var t,n=function(e){var t=e.minIndex,n=void 0===t?0:t,r=e.maxIndex,i=void 0===r?Number.MAX_SAFE_INTEGER:r,o=e.startIndex,a=void 0===o?0:o,s=e.itemHeight,c=void 0===s?20:s,u=e.count,l=void 0===u?Math.max(i-n,1):u,d=e.tolerance;return{minIndex:n,maxIndex:i,startIndex:a,itemHeight:c,count:l,tolerance:void 0===d?l:d}}(null!==(t=e.settings)&&void 0!==t?t:{}),r=function(e,t){var n=e.minIndex,r=e.maxIndex,i=e.startIndex,o=e.itemHeight,a=e.count,s=e.tolerance,c=a+2*s,u=Math.max(0,i-s-n),l=a*o,d=Math.min(r-n,1)*o,f=s*o,p=u*o,h={scrollTop:0,settings:e,viewportHeight:l,totalHeight:d,toleranceHeight:f,bufferedItems:c,topPaddingHeight:p,bottomPaddingHeight:d-(p+(l+2*f)),data:[]};return(0,F.Z)((0,F.Z)({},h),Be(p+f,h,t))}(n,e.get),i=function(e){return function(t,n){return(0,F.Z)((0,F.Z)({},t),Be(n,t,e))}}(e.get);return{settings:n,reducer:i,startState:r}}),[e.settings,e.get]),i=r.settings,o=r.startState,a=r.reducer,s=(0,p.useReducer)(a,o),c=(0,d.Z)(s,2),u=c[0],l=c[1];(0,p.useEffect)((function(){null!==n.current&&l(n.current.scrollTop)}),[i,e.row]);var f=(0,p.useCallback)((function(e){e&&(e.scrollTop=n.current?n.current.scrollTop:i.startIndex*i.itemHeight),n.current=e}),[n,i.startIndex,i.itemHeight]),h=u.data.map((function(t){return(0,v.jsx)("div",{style:{height:"".concat(i.itemHeight,"px")},children:e.row(t)},e.rowKey(t))}));return(0,v.jsxs)("div",{ref:f,style:{height:"".concat(u.viewportHeight,"px"),overflowY:"scroll",overflowAnchor:"none"},className:null!==(t=e.className)&&void 0!==t?t:"",onScroll:function(e){return l(e.target.scrollTop)},children:[(0,v.jsx)("div",{style:{height:"".concat(u.topPaddingHeight,"px")}}),h,(0,v.jsx)("div",{style:{height:"".concat(u.bottomPaddingHeight,"px")}})]})},Ve=function(e){var t=e.memory,n=e.jmp,r=void 0===n?{value:0}:n,i=e.highlight,o=void 0===i?-1:i,a=e.editable,s=void 0!==a&&a,c=e.format,u=void 0===c?C.E_:c,l=e.onChange,f=void 0===l?function(){}:l,h=(0,p.useMemo)((function(){return{count:Math.min(t.size,20),maxIndex:t.size,itemHeight:34,startIndex:r.value}}),[t.size,r]),m=(0,p.useCallback)((function(e,n){return t.range(e,e+n).map((function(t,n){return[n+e,t]}))}),[t]),g=(0,p.useCallback)((function(e){var t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,v.jsx)(We,{index:n,value:u(r),editable:s,highlight:n===o,onChange:f})}),[u,s,o,f]);return(0,v.jsx)(Ke,{settings:h,get:m,row:g,rowKey:function(e){return(0,d.Z)(e,1)[0]}})},We=function(e){var t=e.index,n=e.value,r=e.highlight,i=void 0!==r&&r,o=e.editable,a=void 0!==o&&o,s=e.onChange,c=void 0===s?function(){}:s;return(0,v.jsxs)("div",{style:{display:"flex",height:"100%"},children:[(0,v.jsx)("code",{style:(0,F.Z)((0,F.Z)({},T("none")),i?{background:"var(--code-kbd-background-color)"}:{}),children:(0,C.$v)(t)}),(0,v.jsx)("code",{style:(0,F.Z)((0,F.Z)({flex:"1",textAlign:"right"},T("none")),i?{background:"var(--code-kbd-background-color)"}:{}),children:a?(0,v.jsx)(ze,{value:n,onChange:function(e){return c(t,e,Number(n))}}):(0,v.jsx)("span",{children:n})})]})},Je=function(e){var t=e.name,n=void 0===t?"Memory":t,r=e.highlight,i=void 0===r?-1:r,o=e.editable,a=void 0===o||o,s=e.memory,c=e.format,u=void 0===c?"dec":c,l=(0,p.useState)(u),f=(0,d.Z)(l,2),h=f[0],m=f[1],g=(0,p.useState)("0"),x=(0,d.Z)(g,2),b=x[0],j=x[1],y=(0,p.useState)({value:0}),k=(0,d.Z)(y,2),Z=k[0],w=k[1],P=function(){w({value:Number(b)})},S=(0,p.useCallback)((function(e,t){s.update(e,t,null!==h&&void 0!==h?h:"dec")}),[s,h]);return(0,v.jsxs)("article",{className:"panel",children:[(0,v.jsxs)("header",{children:[(0,v.jsx)("div",{children:n}),(0,v.jsxs)("fieldset",{role:"group",children:[(0,v.jsx)("button",{onClick:function(){},className:"flex-0",children:"\ud83d\udcc2"}),(0,v.jsx)("input",{style:{width:"4em",height:"100%"},placeholder:"Goto",onKeyDown:function(e){return"Enter"===e.key&&P()},onChange:function(e){var t=e.target.value;return j(null!==t&&void 0!==t?t:"0")}}),(0,v.jsx)("button",{onClick:P,className:"flex-0",children:"\u2935\ufe0f"}),R.I2.map((function(e){return(0,v.jsxs)("label",{className:"flex-0",role:"button","aria-current":e===h,children:[(0,v.jsx)("input",{type:"radio",name:n,value:e,checked:e===h,onChange:function(){return m(e)}}),e]},e)}))]})]}),(0,v.jsx)(Ve,{jmp:Z,memory:s,highlight:i,editable:a,format:function(e){return function(e,t){switch(e){case"bin":return(0,C.Ly)(t);case"hex":return(0,C.$v)(t);case"asm":return(0,D.a)(t);default:return(0,C.E_)(t)}}(h,e)},onChange:S})]})};var Ge=n(5541),$e=n(4408),qe=n(6531);function Xe(){return(0,$e.j)(qe.S.get())}var Ye=function(){var e=function(){var e=(0,p.useState)(Xe()),t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,p.useEffect)((function(){var e=qe.S.get().$.subscribe((function(){r(Xe())}));return function(){return e.unsubscribe()}}),[]),n}();return(0,v.jsx)("span",{style:{whiteSpace:"nowrap"},children:e})},Qe="white";function et(e,t,n){return 0===(e.get(32*n+(t/16|0))&1<0?(0,v.jsx)(v.Fragment,{children:r}):void 0}var it=n(8582),ot=n(1585);function at(e){return{pin:e,bits:(0,ot.w)(0,e.width).map((function(t){return[t,e.voltage(t)]})).reverse()}}function st(e){return(0,h.Z)(e.entries()).map(at)}var ct=function(e){var t=e.sim,n=t.inPins,r=t.outPins,i=t.internalPins;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("style",{children:"\n table.pinout th {\n font-weight: bold;\n }\n\n table.pinout tbody td:first-child {\n text-align: right;\n --font-size: 1rem;\n width: 0;\n white-space: nowrap;\n border-right: var(--border-width) solid var(--table-border-color);\n }\n\n table.pinout tbody button {\n --font-size: 0.875em;\n font-family: var(--font-family-monospace);\n max-width: 2em;\n }\n "}),(0,v.jsx)("table",{className:"pinout",children:(0,v.jsxs)("tbody",{children:[(0,v.jsx)(ut,{pins:n,header:"Input pins",toggle:e.toggle}),(0,v.jsx)(ut,{pins:r,header:"Output pins",disabled:e.sim.pending}),(0,v.jsx)(ut,{pins:i,header:"Internal pins",disabled:e.sim.pending})]})})]})},ut=function(e){return(0,v.jsxs)(v.Fragment,{children:[e.pins.length>0&&(0,v.jsx)("tr",{children:(0,v.jsx)("th",{colSpan:2,children:e.header})}),(0,h.Z)(e.pins).map((function(t){return(0,v.jsxs)("tr",{children:[(0,v.jsx)("td",{children:t.pin.name}),(0,v.jsx)("td",{children:(0,v.jsx)(lt,{pin:t,toggle:e.toggle,disabled:e.disabled})})]},t.pin.name)}))]})},lt=function(e){var t=e.pin,n=e.toggle,r=e.disabled,i=void 0!==r&&r;return(0,v.jsx)("fieldset",{role:"group",style:{width:"".concat(t.bits.length,"rem")},children:t.bits.map((function(e){var r=(0,d.Z)(e,2),o=r[0],a=r[1];return(0,v.jsx)("button",{onClick:function(){return null===n||void 0===n?void 0:n(t.pin,o)},disabled:i,"data-testid":"pin-".concat(o),children:a},o)}))})};var dt=function(e){var t=function(e){var t=(0,p.useRef)((function(){})),n=(0,p.useMemo)((function(){return function(e,t){var n={running:e.running,speed:e.speed,steps:e.steps},r=e.finishFrame.bind(e);return e.finishFrame=function(){r(),t.current({action:"update"})},{initialState:n,reducers:{update:function(t){t.running=e.running,t.speed=e.speed,t.steps=e.steps},setSteps:function(t,n){t.steps=n,e.steps=n},setSpeed:function(t,n){t.speed=n,e.speed=n}},actions:{frame:function(){e.frame()},start:function(){e.start(),t.current({action:"update"})},stop:function(){e.stop(),t.current({action:"update"})},reset:function(){e.reset(),t.current({action:"update"})}}}}(e,t)}),[e,t]),r=n.initialState,i=n.reducers,o=n.actions,a=He(i,r),s=(0,d.Z)(a,2),c=s[0],u=s[1];return t.current=u,{state:c,dispatch:t.current,actions:o}}(e.runner);return(0,v.jsxs)("fieldset",{role:"group",children:[(0,v.jsx)("button",{className:"flex-0",onClick:function(){return t.actions.frame()},"data-tooltip":"Step","data-placement":"bottom",children:"\u27a1\ufe0f"}),(0,v.jsx)("button",{className:"flex-0",onClick:function(){return t.state.running?t.actions.stop():t.actions.start()},"data-tooltip":t.state.running?"Pause":"Play","data-placement":"bottom",children:t.state.running?"\u23f8":"\ufe0f\u23e9"}),(0,v.jsx)("button",{className:"flex-0",onClick:function(){return t.actions.reset()},"data-tooltip":"Reset","data-placement":"bottom",children:"\u23ee"}),(0,v.jsx)("select",{className:"flex-1",name:"speed",value:t.state.speed,onChange:function(e){var n,r;t.dispatch({action:"setSpeed",payload:Number(null!==(n=null===(r=e.target)||void 0===r?void 0:r.value)&&void 0!==n?n:t.state.speed)})},disabled:t.state.running,children:[[1e3,"Slow"],[500,"Fast"],[16,"Faster"]].map((function(e){var t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,v.jsx)("option",{value:n,children:r},n)}))}),(0,v.jsx)("select",{className:"flex-1",name:"steps",value:t.state.steps,onChange:function(e){var n,r;t.dispatch({action:"setSteps",payload:Number(null!==(n=null===(r=e.target)||void 0===r?void 0:r.value)&&void 0!==n?n:t.state.steps)})},disabled:t.state.running,children:[[1,"1 Step"],[500,"500"],[1e3,"1000"],[2e3,"2000"]].map((function(e){var t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,v.jsx)("option",{value:n,children:r},n)}))}),e.children]})},ft=n(8365),pt=n(8090),ht=n(9647),vt=n(7538),mt=n(4649),gt=n(2648),xt=n(3943),bt=qe.S.get(),jt=new WeakMap,yt=new WeakMap,kt=new WeakMap,Ct=new WeakMap,Zt=function(){function e(){var t=this;(0,r.Z)(this,e),(0,mt.Z)(this,"steps",1),(0,mt.Z)(this,"speed",1e3),(0,vt.Z)(this,jt,{writable:!0,value:!1}),(0,vt.Z)(this,yt,{writable:!0,value:0}),(0,vt.Z)(this,kt,{writable:!0,value:0}),(0,vt.Z)(this,Ct,{writable:!0,value:function(){var e=(0,l.Z)((0,u.Z)().mark((function e(){var n,r,i,o;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((0,xt.Z)(t,jt)){e.next=2;break}return e.abrupt("return");case 2:if(n=Date.now(),r=n-(0,xt.Z)(t,kt),(0,gt.Z)(t,kt,n),(0,gt.Z)(t,yt,(0,xt.Z)(t,yt)+r),!((0,xt.Z)(t,yt)>t.speed)){e.next=19;break}i=!1,o=0;case 9:if(!(o0&&void 0!==arguments[0]?arguments[0]:"";return n(e)},language:r,onMount:g})})},It=function(e){var t=e.className,n=void 0===t?"":t,r=e.style,i=void 0===r?{}:r,o=e.disabled,a=void 0!==o&&o,s=e.value,c=e.onChange,u=e.grammar,l=e.language,f=e.highlight,h=(0,p.useState)(),m=(0,d.Z)(h,2),g=m[0],x=m[1],b=(0,p.useContext)(wt.Il).monaco,j=(0,p.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=u.match(e);x(t.failed()?t:void 0)}),[x,u]);(0,p.useEffect)((function(){return j(s)}),[j,s]);var y=(0,p.useMemo)((function(){return function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;return function(){for(var r=arguments.length,i=new Array(r),o=0;o0&&void 0!==arguments[0]?arguments[0]:"";c(e),y(e)}),[y,c]);return(0,v.jsx)("div",{className:"Editor ".concat(n),style:i,children:b.canUse&&b.wants?(0,v.jsx)(Et,{value:s,onChange:k,language:l,error:g,disabled:a,highlight:f}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(At,{value:s,onChange:k,language:l,disabled:a}),(0,v.jsx)(Ot,{error:g})]})})},Mt=function(e){var t;return(0,v.jsxs)("article",{className:["panel",null!==(t=e.className)&&void 0!==t?t:""].join(" "),children:[e.header&&(0,v.jsx)("header",{children:e.header}),(0,v.jsx)("main",{children:e.children}),e.footer&&(0,v.jsx)("footer",{children:e.footer})]})},Tt=function(e){var t;return(0,v.jsxs)("details",{className:null!==(t=e.className)&&void 0!==t?t:"",open:e.open,style:e.style,children:[(0,v.jsx)("summary",{children:(0,v.jsx)("div",{className:"flex row align-baseline",children:e.summary})}),e.children]})},Rt=n(726),Dt=n(4625),Ht=n(691),_t=n(1277),Lt=n(3389),Ut=n(8698),zt=[["01","Project 1"],["02","Project 2"],["03","Project 3"],["05","Project 5"]];function Bt(e){return"CHIP ".concat(e," {\n IN in;\n OUT out;\n PARTS:\n}")}function Kt(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{clocked:e.clocked,inPins:st(e.ins),outPins:st(e.outs),internalPins:st(e.pins),chip:[e],pending:t,invalid:n}}var Vt=qe.S.get();function Wt(e,t,n,r){var i=function(e){var t,n,r=null!==(t=e["/chip/project"])&&void 0!==t?t:"01",i=_t.CHIP_PROJECTS[r];return{project:r,chips:i,chipName:null!==(n=e["/chip/chip"])&&void 0!==n?n:i[0]}}(n),o=i.project,a=i.chipName,s=i.chips,c=new j.P9,f=new Lt.l1,p=!1,v={setFiles:function(e,t){var n=t.hdl,r=void 0===n?e.files.hdl:n,i=t.tst,o=void 0===i?e.files.tst:i,a=t.cmp,s=void 0===a?e.files.cmp:a,c=t.out,u=void 0===c?"":c;e.files.hdl=r,e.files.tst=o,e.files.cmp=s,e.files.out=u},updateChip:function(e,t){var n,r,i,o,s,u;e.sim=Kt(c,null!==(n=null===t||void 0===t?void 0:t.pending)&&void 0!==n?n:e.sim.pending,null!==(r=null===t||void 0===t?void 0:t.invalid)&&void 0!==r?r:e.sim.invalid),e.controls.error=e.sim.invalid?null!==(i=null===t||void 0===t?void 0:t.error)&&void 0!==i?i:e.controls.error:"",e.controls.chips=_t.CHIP_PROJECTS[e.controls.project],e.controls.chipName=e.sim.invalid?null!==(o=null===t||void 0===t?void 0:t.chipName)&&void 0!==o?o:a:null!==(s=null!==(u=c.name)&&void 0!==u?u:null===t||void 0===t?void 0:t.chipName)&&void 0!==s?s:a,e.controls.chips.includes(e.controls.chipName)||(e.controls.chips=[].concat((0,h.Z)(e.controls.chips),[e.controls.chipName]))},setProject:function(e,t){var n=_t.CHIP_PROJECTS[t],r=e.controls.chipName&&n.includes(e.controls.chipName)?e.controls.chipName:n[0];e.controls.project=t,e.controls.chips=n,this.setChip(e,r)},setChip:function(e,t){e.controls.chipName=t,e.controls.hasBuiltin=g.zZ.has(t)},testRunning:function(e){e.controls.runningTest=!0},testFinished:function(e){e.controls.runningTest=!1;var n=e.files.out.trim()===e.files.cmp.trim();t(n?"Simulation successful: The output file is identical to the compare file":"Simulation error: The output file differs from the compare file")},updateTestStep:function(e){var t,n,r,i;if(e.files.out=null!==(t=null===(n=f)||void 0===n?void 0:n.log())&&void 0!==t?t:"",null!==(r=f)&&void 0!==r&&null!==(i=r.currentStep)&&void 0!==i&&i.span)e.controls.span=f.currentStep.span;else if(f.done){var o=e.files.tst.length;e.controls.span={start:o-1,end:o}}this.updateChip(e,{pending:e.sim.pending,invalid:e.sim.invalid})}},m={setProject:function(e){o=n["/chip/project"]=e,r.current({action:"setProject",payload:o}),this.setChip(_t.CHIP_PROJECTS[o][0])},setChip:function(e){var t=arguments,i=this;return(0,l.Z)((0,u.Z)().mark((function o(){var s,c;return(0,u.Z)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return c=t.length>1&&void 0!==t[1]?t[1]:null!==(s=n["/chip/project"])&&void 0!==s?s:_t.ChipProjects["01"],a=n["/chip/chip"]=e,r.current({action:"setChip",payload:a}),o.next=5,i.loadChip(c,a);case 5:p&&i.useBuiltin();case 6:case"end":return o.stop()}}),o)})))()},reset:function(){qe.S.get().reset(),c.reset(),f.reset(),r.current({action:"setFiles",payload:{}}),r.current({action:"updateChip"})},updateFiles:function(e){var n=this;return(0,l.Z)((0,u.Z)().mark((function i(){var o,a,s;return(0,u.Z)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(o=e.hdl,a=e.tst,s=e.cmp,r.current({action:"setFiles",payload:{hdl:o,tst:a,cmp:s}}),i.prev=2,!o){i.next=6;break}return i.next=6,n.compileChip(o);case 6:a&&n.compileTest(a),i.next=12;break;case 9:i.prev=9,i.t0=i.catch(2),t((0,$e.j)(i.t0));case 12:case"end":return i.stop()}}),i,null,[[2,9]])})))()},compileChip:function(e){var n=this;return(0,l.Z)((0,u.Z)().mark((function i(){var o,a,s;return(0,u.Z)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(c.remove(),o=pt.Gq.parse(e),!(0,Dt.dZ)(o)){i.next=6;break}return t("Failed to parse chip"),r.current({action:"updateChip",payload:{invalid:!0,error:(0,$e.j)((0,Dt.UG)(o))}}),i.abrupt("return");case 6:return i.next=8,(0,Ht.J_)((0,Dt.Ok)(o));case 8:if(a=i.sent,!(0,Dt.dZ)(a)){i.next=14;break}return s=(0,$e.j)((0,Dt.UG)(a)),t(s),r.current({action:"updateChip",payload:{invalid:!0,error:s}}),i.abrupt("return");case 14:t("Compiled ".concat(c.name)),n.replaceChip((0,Dt.Ok)(a));case 16:case"end":return i.stop()}}),i)})))()},replaceChip:function(e){var t,n=c.ins,i=(0,Rt.Z)(n);try{for(i.s();!(t=i.n()).done;){var o=(0,d.Z)(t.value,2),a=o[0],s=o[1].busVoltage,u=e.ins.get(a);u&&(u.busVoltage=s)}}catch(l){i.e(l)}finally{i.f()}Vt.reset(),e.eval(),c=e,f=f.with(c).reset(),r.current({action:"updateChip",payload:{invalid:!1}}),r.current({action:"updateTestStep"})},loadChip:function(t,i){var o=this;return(0,l.Z)((0,u.Z)().mark((function a(){var s,c,l,f,p,h;return(0,u.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return n["/chip/chip"]=i,s=function(e){return"/projects/".concat(t,"/").concat(i,"/").concat(i,".").concat(e)},a.next=4,Promise.all([e.readFile(s("hdl")).catch((function(){return Bt(i)})),e.readFile(s("tst")).catch((function(e){return console.log(e),"repeat 10 {\n tick,\n tock;\n}"})),e.readFile(s("cmp")).catch((function(){return"| in|out|"}))]);case 4:return c=a.sent,l=(0,d.Z)(c,3),f=l[0],p=l[1],h=l[2],r.current({action:"setFiles",payload:{hdl:f,tst:p,cmp:h}}),a.next=12,o.compileChip(f);case 12:o.compileTest(p);case 13:case"end":return a.stop()}}),a)})))()},saveChip:function(n){var i=arguments;return(0,l.Z)((0,u.Z)().mark((function s(){var c,l,d;return(0,u.Z)().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return c=i.length>1&&void 0!==i[1]?i[1]:o,l=i.length>2&&void 0!==i[2]?i[2]:a,r.current({action:"setFiles",payload:{hdl:n}}),d="/projects/".concat(c,"/").concat(l,"/").concat(l,".hdl"),s.next=6,e.writeFile(d,n);case 6:t("Saved ".concat(d));case 7:case"end":return s.stop()}}),s)})))()},toggle:function(e,t){void 0!==t?e.busVoltage=e.busVoltage^1<0&&void 0!==e[0])||e[0],d=e.length>1?e[1]:void 0,l){i.next=7;break}return p=!1,i.next=6,n.loadChip(o,a);case 6:return i.abrupt("return");case 7:if(p=!0,f=null!==(s=c.name)&&void 0!==s?s:a,h=(0,g.cT)(f),!(0,Dt.dZ)(h)){i.next=13;break}return t("Failed to load builtin ".concat(f,": ").concat((0,$e.j)((0,Dt.UG)(h)))),i.abrupt("return");case 13:if(!d){i.next=16;break}return i.next=16,n.saveChip(d,o,a);case 16:v=_t.ChipProjects[o].CHIPS[f]["".concat(f,".hdl")],m=v.replace("PARTS:","PARTS:\n BUILTIN ".concat(f)),r.current({action:"setFiles",payload:{hdl:m}}),n.replaceChip((0,Dt.Ok)(h));case 20:case"end":return i.stop()}}),i)})))()},initialize:function(){var e=this;return(0,l.Z)((0,u.Z)().mark((function t(){return(0,u.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.loadChip(o,a);case 2:case"end":return t.stop()}}),t)})))()},compileTest:function(n){r.current({action:"setFiles",payload:{tst:n}});var i=ht.qH.parse(n);return(0,Dt.dZ)(i)?(t("Failed to parse test"),!1):(t("Parsed tst"),(f=Lt.l1.from((0,Dt.Ok)(i)).with(c).reset()).setFileSystem(e),r.current({action:"updateTestStep"}),!0)},runTest:function(t){var n=this;return(0,l.Z)((0,u.Z)().mark((function i(){return(0,u.Z)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(n.compileTest(t)){i.next=2;break}return i.abrupt("return");case 2:return r.current({action:"testRunning"}),e.pushd("/samples"),i.next=6,f.run();case 6:e.popd(),r.current({action:"updateTestStep"}),r.current({action:"testFinished"});case 9:case"end":return i.stop()}}),i)})))()},tick:function(){return this.stepTest()},stepTest:function(){return(0,l.Z)((0,u.Z)().mark((function e(){var t;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,Ge.hu)(f.chipId===c.id,"Test and chip out of sync"),e.next=3,f.step();case 3:return t=e.sent,r.current({action:"updateTestStep"}),t&&r.current({action:"testFinished"}),e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)})))()}};return{initialState:function(){var e={project:o,chips:s,chipName:a,hasBuiltin:g.zZ.has(a),runningTest:!1,error:""},n=(0,g.cT)(e.chipName);return(0,Dt.dZ)(n)?(t((0,$e.j)((0,Dt.UG)(n))),c=new j.P9):c=(0,Dt.Ok)(n),{controls:e,files:{hdl:"",cmp:"",tst:"",out:""},sim:Kt(c)}}(),reducers:v,actions:m}}var Jt=function(){var e=(0,p.useContext)(Ut.r),t=e.fs,n=e.setStatus,m=(0,p.useContext)(wt.Il),g=m.filePicker,x=m.tracking,b=function(){var e=(0,p.useContext)(Ut.r),t=e.fs,n=e.setStatus,r=e.storage,i=(0,p.useRef)((function(){})),o=(0,p.useMemo)((function(){return Wt(t,n,r,i)}),[t,n,r,i]),a=o.initialState,s=o.reducers,c=o.actions,u=He(s,a),l=(0,d.Z)(u,2),f=l[0],h=l[1];return i.current=h,{state:f,dispatch:i,actions:c}}(),j=b.state,y=b.actions,k=b.dispatch,C=_e(j.files.hdl),Z=(0,d.Z)(C,2),w=Z[0],P=Z[1],S=_e(j.files.tst),F=(0,d.Z)(S,2),N=F[0],O=F[1],A=_e(j.files.cmp),E=(0,d.Z)(A,2),I=E[0],M=E[1],T=_e(j.files.out),R=(0,d.Z)(T,1)[0];(0,p.useEffect)((function(){y.initialize()}),[y]),(0,p.useEffect)((function(){x.trackPage("/chip")}),[x]);(0,p.useEffect)((function(){x.trackEvent("action","setProject",j.controls.project),x.trackEvent("action","setChip",j.controls.chipName)}),[]);var D=(0,p.useCallback)((function(e){y.setProject(e),x.trackEvent("action","setProject",e)}),[y,x]),H=(0,p.useCallback)((function(e){y.setChip(e),y.reset(),x.trackEvent("action","setChip",e)}),[y,x]),_=(0,p.useCallback)((function(){y.eval(),x.trackEvent("action","eval")}),[y,x]),L=(0,p.useRef)((function(){}));L.current=(0,l.Z)((0,u.Z)().mark((function e(){var t,n,r,i=arguments;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>0&&void 0!==i[0]?i[0]:{},e.next=3,y.updateFiles({hdl:r.hdl,tst:null!==(t=r.tst)&&void 0!==t?t:N,cmp:null!==(n=r.cmp)&&void 0!==n?n:I});case 3:case"end":return e.stop()}}),e)})));var U=(0,p.useCallback)((0,l.Z)((0,u.Z)().mark((function e(){var r,i;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,g.select();case 3:return r=e.sent,e.next=6,t.readFile(r);case 6:return i=e.sent,e.next=9,L.current({tst:i});case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0),n("Failed to load into memory");case 15:case"end":return e.stop()}}),e,null,[[0,11]])}))),[g,n,t,L]),z=(0,p.useRef)();(0,p.useEffect)((function(){return z.current=new(function(e){(0,s.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,r.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"reset",value:function(){var e=(0,l.Z)((0,u.Z)().mark((function e(){return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.current();case 2:return e.next=4,y.reset();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"finishFrame",value:function(){(0,o.Z)((0,a.Z)(n.prototype),"finishFrame",this).call(this),k.current({action:"updateTestStep"})}},{key:"tick",value:function(){var e=(0,l.Z)((0,u.Z)().mark((function e(){return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",y.stepTest());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"toggle",value:function(){k.current({action:"updateTestStep"})}}]),n}(Zt)),function(){var e;null===(e=z.current)||void 0===e||e.stop()}}),[L,y,k]);var B=(0,p.useMemo)((function(){return{toggle:function(){y.clock(),x.trackEvent("action","toggleClock")},reset:function(){x.trackEvent("action","resetClock"),y.reset()}}}),[y]),K=(0,p.useState)(!1),V=(0,d.Z)(K,2),W=V[0],J=V[1],G=function(){var e=(0,l.Z)((0,u.Z)().mark((function e(){return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!W){e.next=6;break}return J(!1),e.next=4,y.useBuiltin(!1);case 4:e.next=9;break;case 6:return J(!0),e.next=9,y.useBuiltin(!0,w);case 9:y.reset();case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),$=(0,v.jsx)(v.Fragment,{children:(0,v.jsxs)("fieldset",{role:"group",children:[(0,v.jsx)("select",{value:j.controls.project,onChange:function(e){var t=e.target.value;D(t)},"data-testid":"project-picker",children:zt.map((function(e){var t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,v.jsx)("option",{value:n,children:r},n)}))}),(0,v.jsx)("select",{value:j.controls.chipName,onChange:function(e){var t=e.target.value;H(t)},"data-testid":"chip-picker",children:j.controls.chips.map((function(e){return(0,v.jsx)("option",{value:e,children:e},e)}))}),(0,v.jsx)("button",{className:"flex-0",onClick:function(){y.saveChip(w)},disabled:W,children:(0,v.jsx)(f.cC,{id:"Save"})})]})}),q=(0,v.jsx)(Mt,{className:"_hdl_panel",header:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{tabIndex:0,children:"HDL"}),(0,v.jsx)("fieldset",{children:j.controls.hasBuiltin&&(0,v.jsxs)("label",{children:[(0,v.jsx)("input",{type:"checkbox",role:"switch",checked:W,onChange:G}),(0,v.jsx)(f.cC,{id:"Builtin"})]})}),$]}),children:(0,v.jsx)(It,{className:"flex-1",value:w,onChange:function(e){P(e),L.current(W?{}:{hdl:e})},grammar:pt.Gq.parser,language:"hdl",disabled:W})}),X=(0,v.jsxs)("fieldset",{role:"group",children:[(0,v.jsx)("button",{onClick:_,onKeyDown:_,disabled:!j.sim.pending,children:(0,v.jsx)(f.cC,{id:"Eval"})}),(0,v.jsxs)("button",{onClick:B.toggle,style:{maxWidth:"initial"},disabled:!j.sim.clocked,children:[(0,v.jsx)(f.cC,{id:"Clock"}),":","\xa0",(0,v.jsx)(Ye,{})]}),(0,v.jsx)("button",{onClick:B.reset,style:{maxWidth:"initial"},disabled:!j.sim.clocked,children:(0,v.jsx)(f.cC,{id:"Reset"})})]}),Y=function(e){return(0,h.Z)(e.parts).map((function(e,t){return["".concat(e.id,"_").concat(t),rt(e)]})).filter((function(e){var t=(0,d.Z)(e,2);return t[0],void 0!==t[1]}))}({parts:j.sim.chip}),Q=(0,v.jsx)(Mt,{className:"_parts_panel",header:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:(0,v.jsx)(f.cC,{id:"Chip"})}),X]}),children:j.sim.invalid?(0,v.jsx)(f.cC,{id:"Invalid Chip"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(ct,{sim:j.sim,toggle:y.toggle}),Y.length>0&&(0,v.jsx)(Tt,{summary:(0,v.jsx)(f.cC,{id:"Visualizations"}),open:!0,children:(0,v.jsx)("main",{children:Y.map((function(e){var t=(0,d.Z)(e,2);t[0];return t[1]}))})})]})}),ee=(0,p.useState)("tst"),te=(0,d.Z)(ee,2),ne=te[0],re=te[1],ie=(0,p.useCallback)((function(e){re(e),x.trackEvent("tab","change",e)}),[x]),oe=(0,v.jsx)(Mt,{className:"_test_panel",header:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{className:"flex-1",children:(0,v.jsx)(f.cC,{id:"Test"})}),(0,v.jsx)("div",{className:"flex-2",children:z.current&&(0,v.jsx)(dt,{runner:z.current})}),(0,v.jsx)("div",{children:(0,v.jsxs)("button",{onClick:U,children:[(0,v.jsx)(Pt.J,{name:"upload_file"})," "]})})]}),children:(0,v.jsxs)("div",{role:"tablist",style:{"--tab-count":"3"},children:[(0,v.jsx)("div",{role:"tab",id:"test-tab-tst","aria-controls":"test-tabpanel-tst","aria-selected":"tst"===ne,children:(0,v.jsxs)("label",{children:[(0,v.jsx)("input",{type:"radio",name:"test-tabs","aria-controls":"test-tabpanel-tst",value:"tst",checked:"tst"===ne,onChange:function(){return ie("tst")}}),"Test Script"]})}),(0,v.jsx)("div",{role:"tabpanel","aria-labelledby":"test-tab-tst",id:"test-tabpanel-tst",children:(0,v.jsx)(It,{value:N,onChange:O,grammar:ht.qH.parser,language:"tst",highlight:j.controls.span})}),(0,v.jsx)("div",{role:"tab",id:"test-tab-cmp","aria-controls":"test-tablpanel-cmp","aria-selected":"cmp"===ne,children:(0,v.jsxs)("label",{children:[(0,v.jsx)("input",{type:"radio",name:"test-tabs","aria-controls":"test-tabpanel-cmp",value:"cmp",checked:"cmp"===ne,onChange:function(){return ie("cmp")}}),"Compare File"]})}),(0,v.jsx)("div",{role:"tabpanel","aria-labelledby":"test-tab-cmp",id:"test-tabpanel-cmp",style:{position:"relative"},children:(0,v.jsx)(It,{value:I,onChange:M,grammar:ft.lA.parser,language:"cmp"})}),(0,v.jsx)("div",{role:"tab",id:"test-tab-out","aria-controls":"test-tabpanel-out","aria-selected":"out"===ne,children:(0,v.jsxs)("label",{children:[(0,v.jsx)("input",{type:"radio",name:"test-tabs","aria-controls":"test-tabpanel-out",value:"out",checked:"out"===ne,onChange:function(){return ie("out")}}),"Output File"]})}),(0,v.jsx)("div",{role:"tabpanel",id:"test-tabpanel-out","aria-labelledby":"test-tab-out",children:(0,v.jsx)(it.M,{cmp:I,out:R})})]})});return(0,v.jsxs)("div",{className:"ChipPage grid",children:[q,Q,oe]})},Gt=Jt}}]); +//# sourceMappingURL=605.b27434d9.chunk.js.map \ No newline at end of file diff --git a/build/static/js/605.b27434d9.chunk.js.map b/build/static/js/605.b27434d9.chunk.js.map new file mode 100644 index 000000000..30b324058 --- /dev/null +++ b/build/static/js/605.b27434d9.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/605.b27434d9.chunk.js","mappings":"qZAOaA,EAAe,SAAH,SACvBC,EAAC,EAADA,EACAC,EAAE,EAAFA,GACAC,EAAC,EAADA,EACAC,EAAG,EAAHA,IACAC,EAAI,EAAJA,KAAI,OAQJC,EAAAA,EAAAA,MAAAA,MAAAA,CAAAC,SAAAA,EACEC,EAAAA,EAAAA,KAAAA,OAAAA,CAAAD,SAAAA,SACAD,EAAAA,EAAAA,MAAAA,KAAAA,CAAAC,SAAAA,EACEC,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAAA,MAAU,KAACC,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,UAAKE,EAAAA,EAAAA,IAAIR,MACpBO,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAAA,OAAW,KAACC,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAoB,QAApBA,EAAKG,EAAAA,GAAAA,GAAYR,UAAG,QAAI,UACpCM,EAAAA,EAAAA,KAAAA,KAAAA,CAAA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AK,WACL,kBAAgB,eAChBmD,GAAG,oBACHxI,MAAO,CAAEO,SAAU,YAAa,UAEhC,SAACuP,GAAM,CACL/c,MAAOyf,EACPnS,SAAU2W,EACVjH,QAASwI,GAAAA,GAAAA,OACT7L,SAAU,WAGd,gBACErH,KAAK,MACLmD,GAAG,eACH,gBAAc,oBACd,gBAAmC,QAApB0P,GAA0B,UAEzC,8BACE,kBACEhoB,KAAK,QACLrD,KAAK,YACL,gBAAc,oBACdkG,MAAM,MACN0S,QAA6B,QAApByS,GACT7X,SAAU,kBAAM+X,GAAmB,MAAM,IACzC,oBAIN,gBACE/S,KAAK,WACLmD,GAAG,oBACH,kBAAgB,eAAc,UAE9B,SAAC,KAAS,CAACgK,IAAKA,EAAKpmB,IAAKA,WAMlC,OACE,iBAAK0D,UAAU,gBAAe,UAC3B6nB,EACAM,EACAK,KAGP,EAEA,K","sources":["../../components/src/chips/alu.tsx","../../components/src/chips/register.tsx","../../components/src/chips/keyboard.tsx","../../node_modules/@davidsouther/jiffies/lib/esm/dom/css/constants.js","../../node_modules/@davidsouther/jiffies/lib/esm/dom/css/core.js","../../node_modules/@davidsouther/jiffies/lib/esm/dom/css/border.js","../../node_modules/@davidsouther/jiffies/lib/esm/dom/css/sizing.js","../../node_modules/immer/src/utils/errors.ts","../../node_modules/immer/src/utils/common.ts","../../node_modules/immer/src/utils/plugins.ts","../../node_modules/immer/src/core/scope.ts","../../node_modules/immer/src/core/finalize.ts","../../node_modules/immer/src/core/proxy.ts","../../node_modules/immer/src/core/immerClass.ts","../../node_modules/immer/src/core/current.ts","../../node_modules/immer/src/immer.ts","../../node_modules/immer/src/utils/env.ts","../../components/src/react.ts","../../components/src/inline_edit.tsx","../../components/src/virtual_scroll.tsx","../../components/src/chips/memory.tsx","../../components/src/clockface.tsx","../../components/src/chips/screen.tsx","../../components/src/chips/visualizations.tsx","../../components/src/pinout.tsx","../../components/src/runbar.tsx","../../components/src/timer.tsx","../../simulator/src/timer.ts","shell/editor.tsx","../../node_modules/@davidsouther/jiffies/lib/esm/debounce.js","shell/panel.tsx","../../components/src/stores/chip.store.ts","pages/chip.tsx"],"sourcesContent":["import {\n COMMANDS,\n COMMANDS_OP,\n Flags,\n} from \"@nand2tetris/simulator/cpu/alu.js\";\nimport { bin } from \"@nand2tetris/simulator/util/twos.js\";\n\nexport const ALUComponent = ({\n A,\n op,\n D,\n out,\n flag,\n}: {\n A: number;\n op: COMMANDS_OP;\n D: number;\n out: number;\n flag: keyof typeof Flags;\n}) => (\n
\n ALU\n
\n
A
{bin(A)}
\n
op
{COMMANDS.op[op] ?? \"(??)\"}
\n
D
{bin(D)}
\n
=
{bin(out)}
\n
{Flags[flag as keyof typeof Flags]}
\n
\n
\n);\n","import { dec } from \"@nand2tetris/simulator/util/twos.js\";\n\nexport const RegisterComponent = ({\n name,\n bits,\n}: {\n name: string;\n bits: number;\n}) => (\n
\n {name}: {dec(bits)}\n
\n);\n","import { Keyboard as KeyboardChip } from \"@nand2tetris/simulator/chip/builtins/computer/computer.js\";\nimport { KeyboardEvent, useCallback, useState } from \"react\";\nimport { RegisterComponent } from \"./register.js\";\n\nconst KeyMap: Record = {\n // Delete: 127,\n Enter: 128,\n Backspace: 129,\n ArrowLeft: 130,\n ArrowUp: 131,\n ArrowRight: 132,\n ArrowDown: 133,\n Home: 134,\n End: 135,\n PageUp: 136,\n PageDown: 137,\n Insert: 138,\n Delete: 139,\n Escape: 140,\n F1: 141,\n F2: 142,\n F3: 143,\n F4: 144,\n F5: 145,\n F6: 146,\n F7: 147,\n F8: 148,\n F9: 149,\n F10: 150,\n F11: 151,\n F12: 152,\n};\n\nfunction keyPressToHackCharacter(keypress: KeyboardEvent): number {\n const mapping = KeyMap[keypress.key];\n if (mapping !== undefined) {\n return mapping;\n }\n if (keypress.key.length === 1) {\n const code = keypress.key.charCodeAt(0);\n if (code >= 32 && code <= 126) {\n return code;\n }\n }\n\n return 0;\n}\n\nexport const Keyboard = ({ keyboard }: { keyboard: KeyboardChip }) => {\n const [showPicker, setShowPicker] = useState(false);\n const [bits, setBits] = useState(keyboard.out().busVoltage);\n\n const setKey = useCallback(\n (event: KeyboardEvent) => {\n const key = keyPressToHackCharacter(event);\n if (key === 0) {\n return;\n }\n event.preventDefault();\n keyboard.setKey(key);\n setBits(keyboard.out().busVoltage);\n setShowPicker(false);\n },\n [keyboard, setShowPicker, setBits]\n );\n\n const changeKey = useCallback(() => {\n setShowPicker(true);\n }, []);\n\n return (\n
\n
\n \n
\n
\n {showPicker ? (\n e?.focus()} type=\"text\" onKeyDown={setKey} />\n ) : (\n \n )}\n
\n
\n );\n};\n","export const Sizes = {\n none: \"0px\",\n sm: \"0.125rem\",\n \"\": \"0.25rem\",\n md: \"0.375rem\",\n lg: \"0.5rem\",\n xl: \"0.75rem\",\n \"2xl\": \"1rem\",\n \"3xl\": \"1.5rem\",\n full: \"9999px\",\n};\nexport const Sides = {\n \"\": \"\",\n t: \"Top\",\n r: \"Right\",\n l: \"Left\",\n b: \"Bottom\",\n tl: \"TopLeft\",\n tr: \"TopRight\",\n bl: \"BottomLeft\",\n br: \"BottomRight\",\n};\nexport const Widths = {\n \"1/4\": \"25%\",\n \"1/2\": \"50%\",\n \"3/4\": \"75%\",\n full: \"100%\",\n};\n","import { Sides, Sizes } from \"./constants.js\";\nexport function isSide(v) {\n return Sides[v] !== undefined;\n}\nexport function isSize(v) {\n return Sizes[v] !== undefined;\n}\nexport function getSize(size) {\n return Sizes[size];\n}\nexport function getSide(side) {\n switch (side) {\n case \"t\":\n return [...getSide(\"tl\"), ...getSide(\"tr\")];\n case \"r\":\n return [...getSide(\"tr\"), ...getSide(\"br\")];\n case \"b\":\n return [...getSide(\"br\"), ...getSide(\"bl\")];\n case \"l\":\n return [...getSide(\"tl\"), ...getSide(\"bl\")];\n default:\n return [Sides[side]];\n }\n}\n","import { isSide, getSize, getSide } from \"./core.js\";\nexport function rounded(size = \"\", side = \"\") {\n if (isSide(size)) {\n side = size;\n size = \"\";\n }\n const sized = getSize(size);\n return getSide(side).reduce((prev, curr) => {\n if (curr === \"\") {\n prev.borderRadius = sized;\n }\n else {\n // @ts-ignore\n prev[`border${curr}Radius`] = sized;\n }\n return prev;\n }, {});\n}\nexport function border({ side = \"\", style = \"solid\", radius = \"\", width = 1, color = \"black\", }) {\n return {};\n}\nexport function inset(width, color1 = \"gray\", color2 = \"lightgray\") {\n return {\n ...border({ side: \"tl\", width, color: color1, radius: \"none\" }),\n ...border({ side: \"br\", width, color: color2, radius: \"none\" }),\n };\n}\n","import { Widths } from \"./constants.js\";\nexport function width(amount, block) {\n if (amount === undefined && Widths[block] !== undefined) {\n amount = block;\n }\n return {\n ...(block === \"inline\" ? { display: \"inline-block\" } : {}),\n width: Widths[amount] ?? \"0\",\n };\n}\n","const errors = {\n\t0: \"Illegal state\",\n\t1: \"Immer drafts cannot have computed properties\",\n\t2: \"This object has been frozen and should not be mutated\",\n\t3(data: any) {\n\t\treturn (\n\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\tdata\n\t\t)\n\t},\n\t4: \"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t5: \"Immer forbids circular references\",\n\t6: \"The first or second argument to `produce` must be a function\",\n\t7: \"The third argument to `produce` must be a function or undefined\",\n\t8: \"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t9: \"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t10: \"The given draft is already finalized\",\n\t11: \"Object.defineProperty() cannot be used on an Immer draft\",\n\t12: \"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t13: \"Immer only supports deleting array indices\",\n\t14: \"Immer only supports setting array indices and the 'length' property\",\n\t15(path: string) {\n\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t},\n\t16: 'Sets cannot have \"replace\" patches.',\n\t17(op: string) {\n\t\treturn \"Unsupported patch operation: \" + op\n\t},\n\t18(plugin: string) {\n\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t},\n\t20: \"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available\",\n\t21(thing: string) {\n\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t},\n\t22(thing: string) {\n\t\treturn `'current' expects a draft, got: ${thing}`\n\t},\n\t23(thing: string) {\n\t\treturn `'original' expects a draft, got: ${thing}`\n\t},\n\t24: \"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n} as const\n\nexport function die(error: keyof typeof errors, ...args: any[]): never {\n\tif (__DEV__) {\n\t\tconst e = errors[error]\n\t\tconst msg = !e\n\t\t\t? \"unknown error nr: \" + error\n\t\t\t: typeof e === \"function\"\n\t\t\t? e.apply(null, args as any)\n\t\t\t: e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}${\n\t\t\targs.length ? \" \" + args.map(s => `'${s}'`).join(\",\") : \"\"\n\t\t}. Find the full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\thasSet,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\thasMap,\n\tArchtype,\n\tdie\n} from \"../internal\"\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = Object.getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(23, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/*#__PURE__*/\nexport const ownKeys: (target: AnyObject) => PropertyKey[] =\n\ttypeof Reflect !== \"undefined\" && Reflect.ownKeys\n\t\t? Reflect.ownKeys\n\t\t: typeof Object.getOwnPropertySymbols !== \"undefined\"\n\t\t? obj =>\n\t\t\t\tObject.getOwnPropertyNames(obj).concat(\n\t\t\t\t\tObject.getOwnPropertySymbols(obj) as any\n\t\t\t\t)\n\t\t: /* istanbul ignore next */ Object.getOwnPropertyNames\n\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors ||\n\tfunction getOwnPropertyDescriptors(target: any) {\n\t\t// Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n\t\tconst res: any = {}\n\t\townKeys(target).forEach(key => {\n\t\t\tres[key] = Object.getOwnPropertyDescriptor(target, key)\n\t\t})\n\t\treturn res\n\t}\n\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void,\n\tenumerableOnly?: boolean\n): void\nexport function each(obj: any, iter: any, enumerableOnly = false) {\n\tif (getArchtype(obj) === Archtype.Object) {\n\t\t;(enumerableOnly ? Object.keys : ownKeys)(obj).forEach(key => {\n\t\t\tif (!enumerableOnly || typeof key !== \"symbol\") iter(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): Archtype {\n\t/* istanbul ignore next */\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_ > 3\n\t\t\t? state.type_ - 4 // cause Object and Array map back from 4 and 5\n\t\t\t: (state.type_ as any) // others are the same\n\t\t: Array.isArray(thing)\n\t\t? Archtype.Array\n\t\t: isMap(thing)\n\t\t? Archtype.Map\n\t\t: isSet(thing)\n\t\t? Archtype.Set\n\t\t: Archtype.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === Archtype.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === Archtype.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === Archtype.Map) thing.set(propOrOldValue, value)\n\telse if (t === Archtype.Set) {\n\t\tthing.delete(propOrOldValue)\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn hasMap && target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn hasSet && target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any) {\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\tconst descriptors = getOwnPropertyDescriptors(base)\n\tdelete descriptors[DRAFT_STATE as any]\n\tlet keys = ownKeys(descriptors)\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tconst key: any = keys[i]\n\t\tconst desc = descriptors[key]\n\t\tif (desc.writable === false) {\n\t\t\tdesc.writable = true\n\t\t\tdesc.configurable = true\n\t\t}\n\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t// with libraries that trap values, like mobx or vue\n\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\tif (desc.get || desc.set)\n\t\t\tdescriptors[key] = {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\tvalue: base[key]\n\t\t\t}\n\t}\n\treturn Object.create(Object.getPrototypeOf(base), descriptors)\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep) each(obj, (key, value) => freeze(value, true), true)\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\tif (obj == null || typeof obj !== \"object\") return true\n\t// See #600, IE dies on non-objects in Object.isFrozen\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tImmerScope,\n\tDrafted,\n\tAnyObject,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tProxyType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: Patch[]): T\n\t}\n\tES5?: {\n\t\twillFinalizeES5_(scope: ImmerScope, result: any, isReplaced: boolean): void\n\t\tcreateES5Proxy_(\n\t\t\tbase: T,\n\t\t\tparent?: ImmerState\n\t\t): Drafted\n\t\thasChanges_(state: ES5ArrayState | ES5ObjectState): boolean\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(18, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n\n/** ES5 Plugin */\n\ninterface ES5BaseState extends ImmerBaseState {\n\tassigned_: {[key: string]: any}\n\tparent_?: ImmerState\n\trevoked_: boolean\n}\n\nexport interface ES5ObjectState extends ES5BaseState {\n\ttype_: ProxyType.ES5Object\n\tdraft_: Drafted\n\tbase_: AnyObject\n\tcopy_: AnyObject | null\n}\n\nexport interface ES5ArrayState extends ES5BaseState {\n\ttype_: ProxyType.ES5Array\n\tdraft_: Drafted\n\tbase_: any\n\tcopy_: any\n}\n\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ProxyType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ProxyType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tProxyType,\n\tgetPlugin\n} from \"../internal\"\nimport {die} from \"../utils/errors\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\tif (__DEV__ && !currentScope) die(0)\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (\n\t\tstate.type_ === ProxyType.ProxyObject ||\n\t\tstate.type_ === ProxyType.ProxyArray\n\t)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tProxyType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen,\n\tshallowCopy\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (!scope.immer_.useProxies_)\n\t\tgetPlugin(\"ES5\").willFinalizeES5_(scope, result, isReplaced)\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(\n\t\t\tvalue,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path),\n\t\t\ttrue // See #590, don't recurse into non-enumerable of non drafted objects\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result =\n\t\t\t// For ES5, create a good copy from the draft first, with added keys and without deleted keys.\n\t\t\tstate.type_ === ProxyType.ES5Object || state.type_ === ProxyType.ES5Array\n\t\t\t\t? (state.copy_ = shallowCopy(state.draft_))\n\t\t\t\t: state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// Although the original test case doesn't seem valid anyway, so if this in the way we can turn the next line\n\t\t// back to each(result, ....)\n\t\teach(\n\t\t\tstate.type_ === ProxyType.Set ? new Set(result) : result,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath\n) {\n\tif (__DEV__ && childValue === targetObject) die(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ProxyType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\tif (!parentState || !parentState.scope_.parent_)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\tif (scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tProxyType\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ProxyType.ProxyObject\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ProxyType.ProxyArray\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ProxyType.ProxyArray : (ProxyType.ProxyObject as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(\n\t\t\t\tstate.scope_.immer_,\n\t\t\t\tvalue,\n\t\t\t\tstate\n\t\t\t))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\tstate.copy_![prop] === value &&\n\t\t\t// special case: NaN\n\t\t\ttypeof value !== \"number\" &&\n\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t(value !== undefined || prop in state.copy_)\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\t// @ts-ignore\n\t\tif (state.copy_) delete state.copy_[prop]\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ProxyType.ProxyArray || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn Object.getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (__DEV__ && isNaN(parseInt(prop as any))) die(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (__DEV__ && prop !== \"length\" && isNaN(parseInt(prop as any))) die(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = Object.getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = Object.getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {base_: any; copy_: any}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(state.base_)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\thasProxies,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport class Immer implements ProducersFns {\n\tuseProxies_: boolean = hasProxies\n\n\tautoFreeze_: boolean = true\n\n\tconstructor(config?: {useProxies?: boolean; autoFreeze?: boolean}) {\n\t\tif (typeof config?.useProxies === \"boolean\")\n\t\t\tthis.setUseProxies(config!.useProxies)\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(this, base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tif (typeof Promise !== \"undefined\" && result instanceof Promise) {\n\t\t\t\treturn result.then(\n\t\t\t\t\tresult => {\n\t\t\t\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\t\t\t\treturn processResult(result, scope)\n\t\t\t\t\t},\n\t\t\t\t\terror => {\n\t\t\t\t\t\trevokeScope(scope)\n\t\t\t\t\t\tthrow error\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(21, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (\n\t\tbase: any,\n\t\trecipe?: any,\n\t): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\n\t\tif (typeof Promise !== \"undefined\" && result instanceof Promise) {\n\t\t\treturn result.then(nextState => [nextState, patches!, inversePatches!])\n\t\t}\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(this, base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (__DEV__) {\n\t\t\tif (!state || !state.isManual_) die(9)\n\t\t\tif (state.finalized_) die(10)\n\t\t}\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n\t * always faster than using ES5 proxies.\n\t *\n\t * By default, feature detection is used, so calling this is rarely necessary.\n\t */\n\tsetUseProxies(value: boolean) {\n\t\tif (value && !hasProxies) {\n\t\t\tdie(20)\n\t\t}\n\t\tthis.useProxies_ = value\n\t}\n\n\tapplyPatches(base: T, patches: Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\timmer: Immer,\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: immer.useProxies_\n\t\t? createProxyProxy(value, parent)\n\t\t: getPlugin(\"ES5\").createES5Proxy_(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tget,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tArchtype,\n\tgetArchtype,\n\tgetPlugin\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(22, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tconst archType = getArchtype(value)\n\tif (state) {\n\t\tif (\n\t\t\t!state.modified_ &&\n\t\t\t(state.type_ < 4 || !getPlugin(\"ES5\").hasChanges_(state as any))\n\t\t)\n\t\t\treturn state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = copyHelper(value, archType)\n\t\tstate.finalized_ = false\n\t} else {\n\t\tcopy = copyHelper(value, archType)\n\t}\n\n\teach(copy, (key, childValue) => {\n\t\tif (state && get(state.base_, key) === childValue) return // no need to copy or search in something that didn't change\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\t// In the future, we might consider freezing here, based on the current settings\n\treturn archType === Archtype.Set ? new Set(copy) : copy\n}\n\nfunction copyHelper(value: any, archType: number): any {\n\t// creates a shallow copy, even if it is a map or set\n\tswitch (archType) {\n\t\tcase Archtype.Map:\n\t\t\treturn new Map(value)\n\t\tcase Archtype.Set:\n\t\t\t// Set will be cloned as array temporarily, so that we can replace individual items\n\t\t\treturn Array.from(value)\n\t}\n\treturn shallowCopy(value)\n}\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\nexport default produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n * always faster than using ES5 proxies.\n *\n * By default, feature detection is used, so calling this is rarely necessary.\n */\nexport const setUseProxies = immer.setUseProxies.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enableES5} from \"./plugins/es5\"\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\nexport {enableAllPlugins} from \"./plugins/all\"\n","// Should be no imports here!\n\n// Some things that should be evaluated before all else...\n\n// We only want to know if non-polyfilled symbols are available\nconst hasSymbol =\n\ttypeof Symbol !== \"undefined\" && typeof Symbol(\"x\") === \"symbol\"\nexport const hasMap = typeof Map !== \"undefined\"\nexport const hasSet = typeof Set !== \"undefined\"\nexport const hasProxies =\n\ttypeof Proxy !== \"undefined\" &&\n\ttypeof Proxy.revocable !== \"undefined\" &&\n\ttypeof Reflect !== \"undefined\"\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: Nothing = hasSymbol\n\t? Symbol.for(\"immer-nothing\")\n\t: ({[\"immer-nothing\"]: true} as any)\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = hasSymbol\n\t? Symbol.for(\"immer-draftable\")\n\t: (\"__$immer_draftable\" as any)\n\nexport const DRAFT_STATE: unique symbol = hasSymbol\n\t? Symbol.for(\"immer-state\")\n\t: (\"__$immer_state\" as any)\n\n// Even a polyfilled Symbol might provide Symbol.iterator\nexport const iteratorSymbol: typeof Symbol.iterator =\n\t(typeof Symbol != \"undefined\" && Symbol.iterator) || (\"@@iterator\" as any)\n\n/** Use a class type for `nothing` so its type is unique */\nexport class Nothing {\n\t// This lets us do `Exclude`\n\t// @ts-ignore\n\tprivate _!: unique symbol\n}\n","import produce from \"immer\";\nimport { Dispatch, useEffect, useReducer, useState } from \"react\";\n\nexport function useImmerReducer<\n T,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Reducers extends Record T | void>\n>(reducers: Reducers, initialState: T) {\n return useReducer(\n (\n state: T,\n command: {\n action: keyof Reducers;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload?: any;\n }\n ): T =>\n produce(state, (draft: T) => {\n reducers[command.action](draft, command.payload);\n }),\n initialState\n );\n}\n\nexport function useStateInitializer(init: T): [T, Dispatch] {\n const [state, setState] = useState(init);\n useEffect(() => {\n setState(init);\n }, [init]);\n return [state, setState];\n}\n","import { width } from \"@davidsouther/jiffies/lib/esm/dom/css/sizing.js\";\nimport { useCallback, useState } from \"react\";\nimport { useStateInitializer } from \"./react.js\";\n\nconst Mode = { VIEW: 0, EDIT: 1 };\n\nexport const InlineEdit = (props: {\n mode?: keyof typeof Mode;\n value: string;\n onChange: (value: string) => void;\n}) => {\n const [mode, setMode] = useState(props.mode ?? Mode.VIEW);\n const [value, setValue] = useStateInitializer(props.value);\n\n const render = () => {\n switch (mode) {\n case Mode.EDIT:\n return edit();\n case Mode.VIEW:\n return view();\n default:\n return ;\n }\n };\n\n const view = () => (\n {\n setMode(Mode.EDIT);\n }}\n >\n {value}\n \n );\n\n const doSelect = useCallback(\n (ref: HTMLInputElement | null) => ref?.select(),\n []\n );\n const doChange = useCallback(\n (target: HTMLInputElement) => {\n setMode(Mode.VIEW);\n setValue(target.value ?? \"\");\n props.onChange(target.value ?? \"\");\n },\n [props, setMode, setValue]\n );\n const edit = () => {\n const edit = (\n \n doChange(target)}\n onKeyPress={({ key, target }) => {\n if (key === \"Enter\") {\n doChange(target as HTMLInputElement);\n }\n }}\n type=\"text\"\n defaultValue={value}\n />\n \n );\n return edit;\n };\n\n return render();\n};\n\nexport default InlineEdit;\n","/* eslint-disable @typescript-eslint/ban-types */\nimport {\n Key,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n} from \"react\";\n\nexport interface VirtualScrollSettings {\n /**Minimum offset into the adapter. Default is 0. */\n minIndex: number;\n /** Maximum offset into the adapter. Default is Number.MAX_SAFE_INTEGER. */\n maxIndex: number;\n /** Initial index to start rendering from. Default is minIndex. */\n startIndex: number;\n /**\n * Number of items to render in visible area. Default is entire range from\n * minIndex to maxIndex.\n */\n count: number;\n /**\n * Maximum number of items to render on either side of the visible area.\n * Default is `count`.\n */\n tolerance: number;\n /** Height of each item, in pixels. Default is 20px. */\n itemHeight: number;\n}\n\nexport interface VirtualScrollDataAdapter {\n (offset: number, limit: number): Iterable;\n}\n\nexport function arrayAdapter(data: T[]): VirtualScrollDataAdapter {\n return (offset, limit) => data.slice(offset, offset + limit);\n}\n\nexport interface VirtualScrollProps {\n settings?: Partial;\n get: VirtualScrollDataAdapter;\n row: (t: T) => U;\n rowKey: (t: T) => Key;\n}\n\nexport function fillVirtualScrollSettings(\n settings: Partial\n): VirtualScrollSettings {\n const {\n minIndex = 0,\n maxIndex = Number.MAX_SAFE_INTEGER,\n startIndex = 0,\n itemHeight = 20,\n count = Math.max(maxIndex - minIndex, 1),\n tolerance = count,\n } = settings;\n\n return { minIndex, maxIndex, startIndex, itemHeight, count, tolerance };\n}\n\nexport function initialState(\n settings: VirtualScrollSettings,\n adapter: VirtualScrollDataAdapter\n): VirtualScrollState {\n // From Denis Hilt, https://blog.logrocket.com/virtual-scrolling-core-principles-and-basic-implementation-in-react/\n const { minIndex, maxIndex, startIndex, itemHeight, count, tolerance } =\n settings;\n const bufferedItems = count + 2 * tolerance;\n const itemsAbove = Math.max(0, startIndex - tolerance - minIndex);\n\n const viewportHeight = count * itemHeight;\n const totalHeight = Math.min(maxIndex - minIndex, 1) * itemHeight;\n const toleranceHeight = tolerance * itemHeight;\n const bufferHeight = viewportHeight + 2 * toleranceHeight;\n const topPaddingHeight = itemsAbove * itemHeight;\n const bottomPaddingHeight = totalHeight - (topPaddingHeight + bufferHeight);\n\n const state: VirtualScrollState = {\n scrollTop: 0,\n settings,\n viewportHeight,\n totalHeight,\n toleranceHeight,\n bufferedItems,\n topPaddingHeight,\n bottomPaddingHeight,\n data: [],\n };\n\n return {\n ...state,\n ...doScroll(topPaddingHeight + toleranceHeight, state, adapter),\n };\n}\n\nexport function getData(\n minIndex: number,\n maxIndex: number,\n offset: number,\n limit: number,\n get: VirtualScrollDataAdapter\n): T[] {\n const start = Math.max(0, minIndex, offset);\n const end = Math.min(maxIndex, offset + limit - 1);\n const data = get(start, end - start);\n return [...data];\n}\n\ninterface ScrollUpdate {\n scrollTop: number;\n topPaddingHeight: number;\n bottomPaddingHeight: number;\n data: T[];\n}\n\nexport function doScroll(\n scrollTop: number,\n state: VirtualScrollState,\n get: VirtualScrollDataAdapter\n): ScrollUpdate {\n const {\n totalHeight,\n toleranceHeight,\n bufferedItems,\n settings: { itemHeight, minIndex, maxIndex },\n } = state;\n const index =\n minIndex + Math.floor((scrollTop - toleranceHeight) / itemHeight);\n const data = getData(minIndex, maxIndex, index, bufferedItems, get);\n const topPaddingHeight = Math.max((index - minIndex) * itemHeight, 0);\n const bottomPaddingHeight = Math.max(\n totalHeight - (topPaddingHeight + data.length * itemHeight),\n 0\n );\n\n return { scrollTop, topPaddingHeight, bottomPaddingHeight, data };\n}\n\ninterface VirtualScrollState {\n settings: VirtualScrollSettings;\n scrollTop: number; // px\n bufferedItems: number; // count\n totalHeight: number; // px\n viewportHeight: number; // px\n topPaddingHeight: number; // px\n bottomPaddingHeight: number; // px\n toleranceHeight: number; // px\n data: T[];\n}\n\nconst scrollReducer =\n (get: VirtualScrollDataAdapter) =>\n (state: VirtualScrollState, scrollTop: number) => ({\n ...state,\n ...doScroll(scrollTop, state, get),\n });\n\nexport const VirtualScroll = (\n props: VirtualScrollProps & { className?: string }\n) => {\n const viewportRef = useRef(null);\n\n const { settings, startState, reducer } = useMemo(() => {\n const settings = fillVirtualScrollSettings(props.settings ?? {});\n const startState = initialState(settings, props.get);\n const reducer = scrollReducer(props.get);\n return { settings, reducer, startState };\n }, [props.settings, props.get]);\n\n const [state, dispatchScroll] = useReducer(reducer, startState);\n\n useEffect(() => {\n if (viewportRef.current !== null) {\n dispatchScroll(viewportRef.current.scrollTop);\n }\n }, [settings, props.row]);\n\n const initialScroll = useCallback(\n (div: HTMLDivElement | null) => {\n if (div) {\n div.scrollTop = viewportRef.current\n ? viewportRef.current.scrollTop\n : settings.startIndex * settings.itemHeight;\n }\n viewportRef.current = div;\n },\n [viewportRef, settings.startIndex, settings.itemHeight]\n );\n\n const rows = state.data.map((d) => (\n
\n {props.row(d)}\n
\n ));\n\n return (\n dispatchScroll((e.target as HTMLDivElement).scrollTop)}\n >\n
\n {rows}\n
\n
\n );\n};\n\nexport default VirtualScroll;\n","import { rounded } from \"@davidsouther/jiffies/lib/esm/dom/css/border.js\";\nimport { ReactNode, useCallback, useMemo, useState } from \"react\";\n\nimport {\n Format,\n FORMATS,\n Memory as MemoryChip,\n} from \"@nand2tetris/simulator/cpu/memory.js\";\nimport { asm } from \"@nand2tetris/simulator/util/asm.js\";\nimport { bin, dec, hex } from \"@nand2tetris/simulator/util/twos.js\";\nimport InlineEdit from \"../inline_edit.js\";\nimport VirtualScroll, { VirtualScrollSettings } from \"../virtual_scroll.js\";\n\nconst ITEM_HEIGHT = 34;\n\nexport const MemoryBlock = ({\n memory,\n jmp = { value: 0 },\n highlight = -1,\n editable = false,\n format = dec,\n onChange = () => undefined,\n}: {\n jmp?: { value: number };\n memory: MemoryChip;\n highlight?: number;\n editable?: boolean;\n format?: (v: number) => string;\n onChange?: (i: number, value: string, previous: number) => void;\n}) => {\n const settings = useMemo>(\n () => ({\n count: Math.min(memory.size, 20),\n maxIndex: memory.size,\n itemHeight: ITEM_HEIGHT,\n startIndex: jmp.value,\n }),\n [memory.size, jmp]\n );\n const get = useCallback(\n (offset: number, count: number) =>\n memory\n .range(offset, offset + count)\n .map((v, i) => [i + offset, v] as [number, number]),\n [memory]\n );\n const row = useCallback(\n ([i, v]: [number, number]) => (\n \n ),\n [format, editable, highlight, onChange]\n );\n\n return (\n \n settings={settings}\n get={get}\n row={row}\n rowKey={([i]) => i}\n />\n );\n};\n\nexport const MemoryCell = ({\n index,\n value,\n highlight = false,\n editable = false,\n onChange = () => undefined,\n}: {\n index: number;\n value: string;\n highlight?: boolean;\n editable?: boolean;\n onChange?: (i: number, value: string, previous: number) => void;\n}) => (\n
\n \n {hex(index)}\n \n \n {editable ? (\n \n onChange(index, newValue, Number(value))\n }\n />\n ) : (\n {value}\n )}\n \n
\n);\n\nexport const Memory = ({\n name = \"Memory\",\n highlight = -1,\n editable = true,\n memory,\n format = \"dec\",\n}: {\n name?: string;\n editable?: boolean;\n highlight?: number;\n memory: MemoryChip;\n format: Format;\n}) => {\n const [fmt, setFormat] = useState(format);\n const [jmp, setJmp] = useState(\"0\");\n const [goto, setGoto] = useState({ value: 0 });\n\n const jumpTo = () => {\n setGoto({ value: Number(jmp) });\n };\n\n // const { filePicker, fs } = useContext(AppContext);\n // const doLoad = useCallback(async () => {\n // try {\n // const file = await filePicker.select();\n // await memory.load(fs, file);\n // } catch (e) {\n // console.error(e);\n // }\n // }, [fs, filePicker, memory]);\n\n const doLoad = () => undefined;\n\n const doUpdate = useCallback(\n (i: number, v: string) => {\n memory.update(i, v, fmt ?? \"dec\");\n },\n [memory, fmt]\n );\n\n return (\n
\n
\n
{name}
\n
\n \n key === \"Enter\" && jumpTo()}\n onChange={({ target: { value } }) => setJmp(value ?? \"0\")}\n />\n \n {FORMATS.map((option) => (\n \n setFormat(option)}\n />\n {option}\n \n ))}\n
\n
\n doFormat(fmt, v)}\n onChange={doUpdate}\n />\n
\n );\n};\n\nexport default Memory;\n\nfunction doFormat(format: Format, v: number): string {\n switch (format) {\n case \"bin\":\n return bin(v);\n case \"hex\":\n return hex(v);\n case \"asm\":\n return asm(v);\n case \"dec\":\n default:\n return dec(v);\n }\n}\n","import { useEffect, useMemo, useState } from \"react\";\n\nimport { display } from \"@davidsouther/jiffies/lib/esm/display.js\";\nimport { Clock } from \"@nand2tetris/simulator/chip/clock.js\";\n\nexport function useClock(actions: {\n tick?: () => void;\n toggle?: () => void;\n reset?: () => void;\n}) {\n const clock = useMemo(() => Clock.get(), []);\n\n useEffect(() => {\n const subscription = clock.$.subscribe(() => {\n actions.tick?.();\n });\n return () => subscription.unsubscribe();\n }, [actions, clock.$]);\n\n return {\n toggle() {\n clock.tick();\n actions.toggle?.();\n },\n\n reset() {\n clock.reset();\n actions.reset?.();\n },\n };\n}\n\nexport function useClockFrame(frameFinished: () => void) {\n useEffect(() => {\n const subscription = Clock.get().frame$.subscribe(() => {\n frameFinished();\n });\n return () => subscription.unsubscribe();\n }, [frameFinished]);\n}\n\nexport function displayClock() {\n return display(Clock.get());\n}\n\nexport function useClockface() {\n const [clockface, setClockface] = useState(displayClock());\n\n useEffect(() => {\n const subscription = Clock.get().$.subscribe(() => {\n setClockface(displayClock());\n });\n return () => subscription.unsubscribe();\n }, []);\n\n return clockface;\n}\n\nexport const Clockface = () => {\n const clockface = useClockface();\n return {clockface};\n};\n","import { Memory } from \"@nand2tetris/simulator/cpu/memory.js\";\nimport { assertExists } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { useCallback, useRef } from \"react\";\nimport { useClockFrame } from \"../clockface.js\";\n\nconst WHITE = \"white\";\nconst BLACK = \"black\";\ntype COLOR = typeof WHITE | typeof BLACK;\n\nexport interface ScreenMemory {\n get(idx: number): number;\n}\n\nexport function reduceScreen(memory: Memory, offset = 0): ScreenMemory {\n return {\n get(idx: number): number {\n return memory.get(offset + idx);\n },\n };\n}\n\nfunction get(mem: ScreenMemory, x: number, y: number): COLOR {\n const byte = mem.get(32 * y + ((x / 16) | 0));\n const bit = byte & (1 << x % 16);\n return bit === 0 ? WHITE : BLACK;\n}\n\nfunction set(data: Uint8ClampedArray, x: number, y: number, value: COLOR) {\n const pixel = (y * 512 + x) * 4;\n const color = value === WHITE ? 255 : 0;\n data[pixel] = color;\n data[pixel + 1] = color;\n data[pixel + 2] = color;\n data[pixel + 3] = 255;\n}\n\nfunction drawImage(ctx: CanvasRenderingContext2D, memory: ScreenMemory) {\n const image = assertExists(\n ctx.getImageData(0, 0, 512, 256),\n \"Failed to create Context2d\"\n );\n for (let col = 0; col < 512; col++) {\n for (let row = 0; row < 256; row++) {\n const color = get(memory, col, row);\n set(image.data, col, row, color);\n }\n }\n ctx.putImageData(image, 0, 0);\n}\n\nexport const Screen = ({ memory }: { memory: ScreenMemory }) => {\n const canvas = useRef();\n\n const draw = useCallback(() => {\n const ctx = canvas.current?.getContext(\"2d\") ?? undefined;\n\n if (ctx) {\n drawImage(ctx, memory);\n }\n }, [memory]);\n\n const ctxRef = useCallback(\n (ref: HTMLCanvasElement | null) => {\n canvas.current = ref ?? undefined;\n draw();\n },\n [canvas, draw]\n );\n\n useClockFrame(draw);\n\n return (\n
\n
Screen
\n
\n \n \n \n
\n
\n );\n};\n","import {\n Keyboard,\n Screen,\n} from \"@nand2tetris/simulator/chip/builtins/computer/computer.js\";\nimport { ALU } from \"@nand2tetris/simulator/chip/builtins/index.js\";\nimport {\n PC,\n VRegister,\n} from \"@nand2tetris/simulator/chip/builtins/sequential/bit.js\";\nimport {\n RAM,\n RAM8,\n} from \"@nand2tetris/simulator/chip/builtins/sequential/ram.js\";\nimport { Chip, HIGH } from \"@nand2tetris/simulator/chip/chip.js\";\nimport { Flags } from \"@nand2tetris/simulator/cpu/alu.js\";\nimport { CPU, decode } from \"@nand2tetris/simulator/cpu/cpu.js\";\nimport { ReactElement } from \"react\";\nimport { ALUComponent } from \"./alu.js\";\nimport { Keyboard as KeyboardComponent } from \"./keyboard.js\";\nimport { Memory as MemoryComponent } from \"./memory.js\";\nimport { RegisterComponent } from \"./register.js\";\nimport { Screen as ScreenComponent } from \"./screen.js\";\n\nexport function getBuiltinVisualization(part: Chip): ReactElement | undefined {\n switch (part.name) {\n case \"Register\":\n case \"ARegister\":\n case \"DRegister\":\n case \"PC\":\n case \"KEYBOARD\":\n case \"RAM8\":\n case \"RAM64\":\n case \"RAM512\":\n case \"RAM4K\":\n case \"RAM16K\":\n case \"ROM32K\":\n case \"Screen\":\n case \"Memory\":\n default:\n return undefined;\n }\n}\n\nexport function makeVisualization(chip: Chip): ReactElement | undefined {\n if (chip instanceof ALU) {\n return (\n \n );\n }\n if (chip instanceof VRegister) {\n return (\n \n );\n }\n if (chip instanceof PC) {\n return ;\n }\n if (chip instanceof Keyboard) {\n return ;\n }\n if (chip instanceof Screen) {\n return ;\n }\n if (chip instanceof RAM) {\n return (\n \n );\n }\n if (chip instanceof RAM8) {\n return RAM {chip.width};\n }\n if (chip instanceof CPU) {\n const bits = decode(chip.in(\"instruction\").busVoltage);\n return (\n <>\n \n \n \n \n \n );\n }\n\n const vis = [...chip.parts]\n .map(makeVisualization)\n .filter((v) => v !== undefined);\n return vis.length > 0 ? <>{vis} : undefined;\n}\n\nexport function makeVisualizationsWithId(chip: {\n parts: Chip[];\n}): [string, ReactElement][] {\n return [...chip.parts]\n .map((part, i): [string, ReactElement | undefined] => [\n `${part.id}_${i}`,\n makeVisualization(part),\n ])\n .filter(([_, v]) => v !== undefined) as [string, ReactElement][];\n}\n","// import { plural, Trans } from \"@lingui/macro\";\nimport {\n Pin as ChipPin,\n Pins,\n Voltage,\n} from \"@nand2tetris/simulator/chip/chip.js\";\nimport { range } from \"@davidsouther/jiffies/lib/esm/range.js\";\nimport { ChipSim } from \"./stores/chip.store.js\";\n\nexport interface ImmPin {\n bits: [number, Voltage][];\n pin: ChipPin;\n}\n\nexport function reducePin(pin: ChipPin) {\n return {\n pin,\n bits: range(0, pin.width)\n .map((i) => [i, pin.voltage(i)] as [number, Voltage])\n .reverse(),\n };\n}\n\nexport function reducePins(pins: Pins): ImmPin[] {\n return [...pins.entries()].map(reducePin);\n}\n\nexport interface PinoutPins {\n pins: ImmPin[];\n toggle?: (pin: ChipPin, bit?: number) => void;\n}\n\nexport const FullPinout = (props: {\n sim: ChipSim;\n toggle: (pin: ChipPin, i: number | undefined) => void;\n}) => {\n const { inPins, outPins, internalPins } = props.sim;\n return (\n <>\n \n \n \n \n \n \n \n
\n \n );\n};\n\nexport const PinoutBlock = (\n props: PinoutPins & { header: string; disabled?: boolean }\n) => (\n <>\n {props.pins.length > 0 && (\n \n {props.header}\n \n )}\n {[...props.pins].map((immPin) => (\n \n {immPin.pin.name}\n \n \n \n \n ))}\n \n);\n\nexport const Pinout = ({\n pins,\n toggle,\n}: {\n pins: ImmPin[];\n toggle?: (pin: ChipPin, bit?: number) => void;\n}) => {\n if (pins.length === 0) {\n return <>None;\n }\n return (\n \n \n \n \n \n \n \n \n {[...pins].map((immPin) => (\n \n \n \n \n ))}\n \n
NameValue
{immPin.pin.name}\n \n
\n );\n};\n\nconst Pin = ({\n pin,\n toggle,\n disabled = false,\n}: {\n pin: ImmPin;\n toggle: ((pin: ChipPin, bit?: number) => void) | undefined;\n disabled?: boolean;\n}) => {\n return (\n
\n {pin.bits.map(([i, v]) => (\n toggle?.(pin.pin, i)}\n disabled={disabled}\n data-testid={`pin-${i}`}\n >\n {v}\n \n ))}\n
\n );\n};\n","import { ReactNode } from \"react\";\nimport { Timer } from \"@nand2tetris/simulator/timer.js\";\nimport { useTimer } from \"./timer.js\";\n\nexport const Runbar = (props: { runner: Timer; children?: ReactNode }) => {\n const runner = useTimer(props.runner);\n return (\n
\n runner.actions.frame()}\n data-tooltip={`Step`}\n data-placement=\"bottom\"\n >\n {/* */}\n ➡️\n \n \n runner.state.running ? runner.actions.stop() : runner.actions.start()\n }\n data-tooltip={runner.state.running ? `Pause` : `Play`}\n data-placement=\"bottom\"\n >\n {/* */}\n {runner.state.running ? \"⏸\" : \"️⏩\"}\n \n runner.actions.reset()}\n data-tooltip={`Reset`}\n data-placement=\"bottom\"\n >\n {/* */}⏮\n \n {\n runner.dispatch({\n action: \"setSpeed\",\n payload: Number(e.target?.value ?? runner.state.speed),\n });\n }}\n disabled={runner.state.running}\n >\n {[\n // [2000, `Debug`], // For debugging, basically the same as clicking through\n [1000, `Slow`],\n [500, `Fast`],\n [16, `Faster`],\n ].map(([speed, label]) => (\n \n ))}\n \n {\n runner.dispatch({\n action: \"setSteps\",\n payload: Number(e.target?.value ?? runner.state.steps),\n });\n }}\n disabled={runner.state.running}\n >\n {[\n [1, `1 Step`],\n [500, \"500\"],\n [1000, \"1000\"],\n [2000, \"2000\"],\n ].map(([steps, label]) => (\n \n ))}\n \n {props.children}\n
\n );\n};\n","import { Timer } from \"@nand2tetris/simulator/timer.js\";\nimport { useImmerReducer } from \"./react.js\";\n\nexport interface TimerStoreState {\n steps: number;\n speed: number;\n running: boolean;\n}\n\nimport { Dispatch, MutableRefObject, useMemo, useRef } from \"react\";\nexport type TimerStoreDispatch = Dispatch<{\n action: keyof ReturnType[\"reducers\"];\n payload?: unknown;\n}>;\n\nconst makeTimerStore = (\n timer: Timer,\n dispatch: MutableRefObject\n) => {\n const initialState: TimerStoreState = {\n running: timer.running,\n speed: timer.speed,\n steps: timer.steps,\n };\n\n const finishFrame = timer.finishFrame.bind(timer);\n timer.finishFrame = function () {\n finishFrame();\n dispatch.current({ action: \"update\" });\n };\n\n const reducers = {\n update(state: TimerStoreState) {\n state.running = timer.running;\n state.speed = timer.speed;\n state.steps = timer.steps;\n },\n setSteps(state: TimerStoreState, steps: number) {\n state.steps = steps;\n timer.steps = steps;\n },\n setSpeed(state: TimerStoreState, speed: number) {\n state.speed = speed;\n timer.speed = speed;\n },\n };\n\n const actions = {\n frame() {\n timer.frame();\n },\n start() {\n timer.start();\n dispatch.current({ action: \"update\" });\n },\n stop() {\n timer.stop();\n dispatch.current({ action: \"update\" });\n },\n reset() {\n timer.reset();\n dispatch.current({ action: \"update\" });\n },\n };\n\n return { initialState, reducers, actions };\n};\n\nexport function useTimer(timer: Timer) {\n const dispatch = useRef(() => undefined);\n\n const { initialState, reducers, actions } = useMemo(\n () => makeTimerStore(timer, dispatch),\n [timer, dispatch]\n );\n\n const [state, dispatcher] = useImmerReducer(reducers, initialState);\n\n dispatch.current = dispatcher;\n\n return { state, dispatch: dispatch.current, actions };\n}\n","import { Clock } from \"./chip/clock.js\";\n\nexport const MAX_STEPS = 1000;\n\nconst clock = Clock.get();\n\nexport abstract class Timer {\n frame() {\n this.tick();\n this.finishFrame();\n }\n\n abstract tick(): Promise | boolean;\n\n finishFrame() {\n clock.frame();\n }\n\n abstract reset(): void;\n\n abstract toggle(): void;\n\n steps = 1; // How many steps to take per update\n speed = 1000; // how often to update, in ms\n get running() {\n return this.#running;\n }\n\n #running = false;\n #sinceLastFrame = 0;\n #lastUpdate = 0;\n #run = async () => {\n if (!this.#running) {\n return;\n }\n const now = Date.now();\n const delta = now - this.#lastUpdate;\n this.#lastUpdate = now;\n this.#sinceLastFrame += delta;\n if (this.#sinceLastFrame > this.speed) {\n let done = false;\n for (let i = 0; i < Math.min(this.steps, MAX_STEPS) && !done; i++) {\n done = await this.tick();\n }\n this.finishFrame();\n if (done) {\n this.stop();\n }\n this.#sinceLastFrame -= this.speed;\n }\n requestAnimationFrame(this.#run);\n };\n\n start() {\n this.#running = true;\n this.#lastUpdate = Date.now() - this.speed;\n this.#run();\n this.toggle();\n }\n\n stop() {\n this.#running = false;\n this.toggle();\n }\n}\n","import { debounce } from \"@davidsouther/jiffies/lib/esm/debounce\";\nimport { Trans } from \"@lingui/macro\";\nimport MonacoEditor, { useMonaco } from \"@monaco-editor/react\";\nimport type * as monacoT from \"monaco-editor/esm/vs/editor/editor.api\";\nimport { OnMount } from \"@monaco-editor/react\";\nimport ohm from \"ohm-js\";\nimport {\n CSSProperties,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { AppContext } from \"../App.context\";\n\nimport {\n Span,\n UNKNOWN_PARSE_ERROR,\n} from \"@nand2tetris/simulator/languages/base.js\";\n\nimport \"./editor.scss\";\n\nexport const ErrorPanel = ({ error }: { error?: ohm.MatchResult }) => {\n return error?.failed() ? (\n
\n \n Parse Error\n \n
\n        \n          {error?.message ?? error?.shortMessage ?? UNKNOWN_PARSE_ERROR}\n        \n      
\n
\n ) : (\n <>\n );\n};\n\nconst Textarea = ({\n value,\n onChange,\n language,\n disabled = false,\n}: {\n value: string;\n onChange: (value: string) => void;\n language: string;\n disabled?: boolean;\n}) => {\n const [text, setText] = useState(value);\n return (\n {\n const value = e.target?.value;\n setText(value);\n onChange(value);\n }}\n />\n );\n};\n\nconst MONACO_LIGHT_THEME = \"vs\";\nconst MONACO_DARK_THEME = \"vs-dark\";\n\nconst makeHighlight = (\n monaco: typeof monacoT | null,\n editor: monacoT.editor.IStandaloneCodeEditor | undefined,\n highlight: Span | undefined,\n decorations: string[]\n): string[] => {\n if (!(editor && highlight)) return decorations;\n const model = editor.getModel();\n if (!model) return decorations;\n const start = model.getPositionAt(highlight.start);\n const end = model.getPositionAt(highlight.end);\n const range = monaco?.Range.fromPositions(start, end);\n const nextDecoration: monacoT.editor.IModelDeltaDecoration[] = [];\n if (range) {\n nextDecoration.push({\n range,\n options: { inlineClassName: \"highlight\" },\n });\n editor.revealRangeInCenter(range);\n }\n return editor.deltaDecorations(decorations, nextDecoration);\n};\n\nconst Monaco = ({\n value,\n onChange,\n language,\n error,\n disabled = false,\n highlight: currentHighlight,\n}: {\n value: string;\n onChange: (value: string) => void;\n language: string;\n error?: ohm.MatchResult | undefined;\n disabled?: boolean;\n highlight?: Span;\n}) => {\n const { theme } = useContext(AppContext);\n const monaco = useMonaco();\n\n const editor = useRef();\n const decorations = useRef([]);\n const highlight = useRef(undefined);\n\n const codeTheme = useCallback(() => {\n const isDark =\n theme === \"system\"\n ? window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n : theme === \"dark\";\n return isDark ? MONACO_DARK_THEME : MONACO_LIGHT_THEME;\n }, [theme]);\n\n const doHighlight = useCallback(() => {\n decorations.current = makeHighlight(\n monaco,\n editor.current,\n // I'm not sure why this makes things work, but it is load bearing.\n // Removing the empty span will cause the initial first-statement\n // highlight in the test view to not show. Setting it to [0, 1] will\n // cause a 1-character highlight in the editor view, so don't do that\n // either.\n highlight.current ?? { start: 0, end: 0 },\n decorations.current\n );\n }, [decorations, monaco, editor, highlight]);\n\n // Mark and center highlighted spans\n useEffect(() => {\n highlight.current = currentHighlight;\n doHighlight();\n }, [currentHighlight]);\n\n // Set options when mounting\n const onMount: OnMount = useCallback(\n (ed) => {\n editor.current = ed;\n editor.current?.updateOptions({\n fontFamily: `\"JetBrains Mono\", source-code-pro, Menlo, Monaco,\n Consolas, \"Roboto Mono\", \"Ubuntu Monospace\", \"Noto Mono\", \"Oxygen Mono\",\n \"Liberation Mono\", monospace, \"Apple Color Emoji\", \"Segoe UI Emoji\",\n \"Segoe UI Symbol\", \"Noto Color Emoji\"`,\n fontSize: 16,\n minimap: {\n enabled: false,\n },\n theme: codeTheme(),\n scrollBeyondLastLine: false,\n });\n doHighlight();\n },\n [codeTheme]\n );\n\n // Set themes\n useEffect(() => {\n if (editor.current === undefined) return;\n editor.current.updateOptions({ theme: codeTheme() });\n }, [editor, codeTheme]);\n\n // Prevent editing disabled editors\n useEffect(() => {\n if (editor.current === undefined) return;\n editor.current.updateOptions({ readOnly: disabled });\n }, [editor, disabled]);\n\n // Add error markers on parse failure\n useEffect(() => {\n if (editor.current === undefined) return;\n if (monaco === null) return;\n const model = editor.current.getModel();\n if (model === null) return;\n if (error === undefined || error.succeeded()) {\n monaco.editor.setModelMarkers(model, language, []);\n return;\n }\n // Line 7, col 5:\n const { line, column, message } =\n /Line (?\\d+), col (?\\d+): (?.*)/.exec(\n error.shortMessage ?? \"\"\n )?.groups ?? { line: 1, column: 1, message: \"could not parse error\" };\n const startLineNumber = Number(line);\n const endLineNumber = startLineNumber;\n const startColumn = Number(column);\n const restOfLine = model\n .getLineContent(startLineNumber)\n .substring(startColumn - 1);\n let endColumn =\n startColumn + (restOfLine.match(/([^\\s]+)/)?.[0].length ?? 1);\n if (endColumn <= startColumn) {\n endColumn = startColumn + 1;\n }\n\n monaco.editor.setModelMarkers(model, language, [\n {\n message,\n startColumn,\n startLineNumber,\n endColumn,\n endLineNumber,\n severity: 8, // monacoT.MarkerSeverity.Error,\n },\n ]);\n }, [error, editor, monaco, language]);\n\n return (\n <>\n onChange(v)}\n language={language}\n onMount={onMount}\n />\n \n );\n};\n\nexport const Editor = ({\n className = \"\",\n style = {},\n disabled = false,\n value,\n onChange,\n grammar,\n language,\n highlight,\n}: {\n className?: string;\n style?: CSSProperties;\n disabled?: boolean;\n value: string;\n onChange: (source: string) => void;\n grammar: ohm.Grammar;\n language: string;\n highlight?: Span;\n}) => {\n const [error, setError] = useState();\n const { monaco } = useContext(AppContext);\n\n const parse = useCallback(\n (text = \"\") => {\n const parsed = grammar.match(text);\n setError(parsed.failed() ? parsed : undefined);\n },\n [setError, grammar]\n );\n\n useEffect(() => parse(value), [parse, value]);\n const doParse = useMemo(() => debounce(parse, 500), [parse]);\n\n const onChangeCB = useCallback(\n (text = \"\") => {\n onChange(text);\n doParse(text);\n },\n [doParse, onChange]\n );\n\n return (\n
\n {monaco.canUse && monaco.wants ? (\n \n ) : (\n <>\n \n \n \n )}\n
\n );\n};\n","export function debounce(fn, ms = 32) {\n let timer;\n return (...args) => {\n clearTimeout(timer);\n timer = setTimeout(() => (clearTimeout(timer), fn(...args)), ms);\n return timer;\n };\n}\n","import { CSSProperties, ReactNode } from \"react\";\n\nexport const Panel = (props: {\n children: ReactNode;\n header?: ReactNode;\n footer?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}) => {\n return (\n
\n {props.header &&
{props.header}
}\n
{props.children}
\n {props.footer &&
{props.footer}
}\n
\n );\n};\n\nexport const Accordian = (props: {\n children: ReactNode;\n summary: ReactNode;\n className?: string;\n style?: CSSProperties;\n open?: boolean;\n}) => {\n return (\n \n \n
{props.summary}
\n
\n {props.children}\n \n );\n};\n","import { display } from \"@davidsouther/jiffies/lib/esm/display.js\";\nimport { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { Err, isErr, Ok } from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { Dispatch, MutableRefObject, useContext, useMemo, useRef } from \"react\";\n\nimport { build as buildChip } from \"@nand2tetris/simulator/chip/builder.js\";\nimport {\n getBuiltinChip,\n REGISTRY,\n} from \"@nand2tetris/simulator/chip/builtins/index.js\";\nimport {\n Chip,\n Chip as SimChip,\n Low,\n Pin,\n} from \"@nand2tetris/simulator/chip/chip.js\";\nimport { Clock } from \"@nand2tetris/simulator/chip/clock.js\";\nimport { Span } from \"@nand2tetris/simulator/languages/base.js\";\nimport { HDL } from \"@nand2tetris/simulator/languages/hdl.js\";\nimport { TST } from \"@nand2tetris/simulator/languages/tst.js\";\nimport { ChipProjects, CHIP_PROJECTS } from \"@nand2tetris/projects/index.js\";\nimport { ChipTest } from \"@nand2tetris/simulator/tst.js\";\n\nimport { ImmPin, reducePins } from \"../pinout.js\";\nimport { useImmerReducer } from \"../react.js\";\n\nimport { BaseContext } from \"./base.context.js\";\nimport { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\n\nexport const PROJECT_NAMES = [\n [\"01\", `Project 1`],\n [\"02\", `Project 2`],\n [\"03\", `Project 3`],\n [\"05\", `Project 5`],\n];\n\nfunction findDropdowns(storage: Record) {\n const project =\n (storage[\"/chip/project\"] as keyof typeof CHIP_PROJECTS) ?? \"01\";\n const chips = CHIP_PROJECTS[project];\n const chipName = storage[\"/chip/chip\"] ?? chips[0];\n return { project, chips, chipName };\n}\n\nfunction makeHdl(name: string) {\n return `CHIP ${name} {\n IN in;\n OUT out;\n PARTS:\n}`;\n}\n\nfunction makeTst() {\n return `repeat 10 {\n tick,\n tock;\n}`;\n}\n\nfunction makeCmp() {\n return `| in|out|`;\n}\n\nexport interface ChipPageState {\n files: Files;\n sim: ChipSim;\n controls: ControlsState;\n}\n\nexport interface ChipSim {\n clocked: boolean;\n inPins: ImmPin[];\n outPins: ImmPin[];\n internalPins: ImmPin[];\n chip: [Chip];\n pending: boolean;\n invalid: boolean;\n}\n\nexport interface Files {\n hdl: string;\n cmp: string;\n tst: string;\n out: string;\n}\n\nexport interface ControlsState {\n project: keyof typeof CHIP_PROJECTS;\n chips: string[];\n chipName: string;\n hasBuiltin: boolean;\n runningTest: boolean;\n span?: Span;\n error: string;\n}\n\nfunction reduceChip(chip: SimChip, pending = false, invalid = false): ChipSim {\n return {\n clocked: chip.clocked,\n inPins: reducePins(chip.ins),\n outPins: reducePins(chip.outs),\n internalPins: reducePins(chip.pins),\n chip: [chip],\n pending,\n invalid,\n };\n}\n\nconst clock = Clock.get();\n\nexport type ChipStoreDispatch = Dispatch<{\n action: keyof ReturnType[\"reducers\"];\n payload?: unknown;\n}>;\n\nexport function makeChipStore(\n fs: FileSystem,\n setStatus: (status: string) => void,\n storage: Record,\n dispatch: MutableRefObject\n) {\n const dropdowns = findDropdowns(storage);\n let { project, chipName } = dropdowns;\n const { chips } = dropdowns;\n let chip = new Low();\n let test = new ChipTest();\n let usingBuiltin = false;\n\n const reducers = {\n setFiles(\n state: ChipPageState,\n {\n hdl = state.files.hdl,\n tst = state.files.tst,\n cmp = state.files.cmp,\n out = \"\",\n }: {\n hdl?: string;\n tst?: string;\n cmp?: string;\n out?: string;\n }\n ) {\n state.files.hdl = hdl;\n state.files.tst = tst;\n state.files.cmp = cmp;\n state.files.out = out;\n },\n\n updateChip(\n state: ChipPageState,\n payload?: {\n pending?: boolean;\n invalid?: boolean;\n chipName?: string;\n error?: string;\n }\n ) {\n state.sim = reduceChip(\n chip,\n payload?.pending ?? state.sim.pending,\n payload?.invalid ?? state.sim.invalid\n );\n state.controls.error = state.sim.invalid\n ? payload?.error ?? state.controls.error\n : \"\";\n state.controls.chips = CHIP_PROJECTS[state.controls.project];\n state.controls.chipName = state.sim.invalid\n ? payload?.chipName ?? chipName\n : chip.name ?? payload?.chipName ?? chipName;\n if (!state.controls.chips.includes(state.controls.chipName)) {\n state.controls.chips = [\n ...state.controls.chips,\n state.controls.chipName,\n ];\n }\n },\n\n setProject(state: ChipPageState, project: keyof typeof CHIP_PROJECTS) {\n const chips = CHIP_PROJECTS[project];\n const chipName =\n state.controls.chipName && chips.includes(state.controls.chipName)\n ? state.controls.chipName\n : chips[0];\n state.controls.project = project;\n state.controls.chips = chips;\n this.setChip(state, chipName);\n },\n\n setChip(state: ChipPageState, chipName: string) {\n state.controls.chipName = chipName;\n state.controls.hasBuiltin = REGISTRY.has(chipName);\n },\n\n testRunning(state: ChipPageState) {\n state.controls.runningTest = true;\n },\n\n testFinished(state: ChipPageState) {\n state.controls.runningTest = false;\n const passed = state.files.out.trim() === state.files.cmp.trim();\n setStatus(\n passed\n ? `Simulation successful: The output file is identical to the compare file`\n : `Simulation error: The output file differs from the compare file`\n );\n },\n\n updateTestStep(state: ChipPageState) {\n state.files.out = test?.log() ?? \"\";\n if (test?.currentStep?.span) {\n state.controls.span = test.currentStep.span;\n } else {\n if (test.done) {\n const end = state.files.tst.length;\n state.controls.span = {\n start: end - 1,\n end,\n };\n }\n }\n this.updateChip(state, {\n pending: state.sim.pending,\n invalid: state.sim.invalid,\n });\n },\n };\n\n const actions = {\n setProject(p: keyof typeof CHIP_PROJECTS) {\n project = storage[\"/chip/project\"] = p;\n dispatch.current({ action: \"setProject\", payload: project });\n this.setChip(CHIP_PROJECTS[project][0]);\n },\n\n async setChip(\n chip: string,\n project = storage[\"/chip/project\"] ?? ChipProjects[\"01\"]\n ) {\n chipName = storage[\"/chip/chip\"] = chip;\n dispatch.current({ action: \"setChip\", payload: chipName });\n await this.loadChip(project, chipName);\n if (usingBuiltin) {\n this.useBuiltin();\n }\n },\n\n reset() {\n Clock.get().reset();\n chip.reset();\n test.reset();\n dispatch.current({ action: \"setFiles\", payload: {} });\n dispatch.current({ action: \"updateChip\" });\n },\n\n async updateFiles({\n hdl,\n tst,\n cmp,\n }: {\n hdl?: string;\n tst?: string;\n cmp: string;\n }) {\n dispatch.current({ action: \"setFiles\", payload: { hdl, tst, cmp } });\n try {\n if (hdl) {\n await this.compileChip(hdl);\n }\n if (tst) {\n this.compileTest(tst);\n }\n } catch (e) {\n setStatus(display(e));\n }\n },\n\n async compileChip(hdl: string) {\n chip.remove();\n const maybeParsed = HDL.parse(hdl);\n if (isErr(maybeParsed)) {\n setStatus(\"Failed to parse chip\");\n dispatch.current({\n action: \"updateChip\",\n payload: { invalid: true, error: display(Err(maybeParsed)) },\n });\n return;\n }\n const maybeChip = await buildChip(Ok(maybeParsed));\n if (isErr(maybeChip)) {\n const error = display(Err(maybeChip));\n setStatus(error);\n dispatch.current({\n action: \"updateChip\",\n payload: { invalid: true, error },\n });\n return;\n }\n setStatus(`Compiled ${chip.name}`);\n this.replaceChip(Ok(maybeChip));\n },\n\n replaceChip(nextChip: SimChip) {\n // Store current inPins\n const inPins = chip.ins;\n for (const [pin, { busVoltage }] of inPins) {\n const nextPin = nextChip.ins.get(pin);\n if (nextPin) {\n nextPin.busVoltage = busVoltage;\n }\n }\n clock.reset();\n nextChip.eval();\n chip = nextChip;\n test = test.with(chip).reset();\n dispatch.current({ action: \"updateChip\", payload: { invalid: false } });\n dispatch.current({ action: \"updateTestStep\" });\n },\n\n async loadChip(project: string, name: string) {\n storage[\"/chip/chip\"] = name;\n const fsName = (ext: string) =>\n `/projects/${project}/${name}/${name}.${ext}`;\n\n const [hdl, tst, cmp] = await Promise.all([\n fs.readFile(fsName(\"hdl\")).catch(() => makeHdl(name)),\n fs.readFile(fsName(\"tst\")).catch((e) => {\n console.log(e);\n return makeTst();\n }),\n fs.readFile(fsName(\"cmp\")).catch(() => makeCmp()),\n ]);\n\n dispatch.current({ action: \"setFiles\", payload: { hdl, tst, cmp } });\n await this.compileChip(hdl);\n this.compileTest(tst);\n },\n\n async saveChip(hdl: string, prj = project, name = chipName) {\n dispatch.current({ action: \"setFiles\", payload: { hdl } });\n const path = `/projects/${prj}/${name}/${name}.hdl`;\n await fs.writeFile(path, hdl);\n setStatus(`Saved ${path}`);\n },\n\n toggle(pin: Pin, i: number | undefined) {\n if (i !== undefined) {\n pin.busVoltage = pin.busVoltage ^ (1 << i);\n } else {\n if (pin.width === 1) {\n pin.toggle();\n } else {\n pin.busVoltage += 1;\n }\n }\n dispatch.current({ action: \"updateChip\", payload: { pending: true } });\n },\n\n eval() {\n chip.eval();\n dispatch.current({ action: \"updateChip\", payload: { pending: false } });\n },\n\n clock() {\n clock.toggle();\n if (clock.isLow) {\n clock.frame();\n }\n dispatch.current({ action: \"updateChip\" });\n },\n\n async useBuiltin(doUseBuiltin = true, hdl?: string) {\n if (!doUseBuiltin) {\n usingBuiltin = false;\n await this.loadChip(project, chipName);\n return;\n }\n usingBuiltin = true;\n const builtinName = chip.name ?? chipName;\n const nextChip = getBuiltinChip(builtinName);\n if (isErr(nextChip)) {\n setStatus(\n `Failed to load builtin ${builtinName}: ${display(Err(nextChip))}`\n );\n return;\n }\n\n // Save hdl code that will be overwritten by the switch\n if (hdl) {\n await this.saveChip(hdl, project, chipName);\n }\n\n const template = (ChipProjects[project].CHIPS as any)[builtinName][\n `${builtinName}.hdl`\n ] as string;\n const builtinCode = template.replace(\n \"PARTS:\",\n `PARTS:\\n BUILTIN ${builtinName}`\n );\n dispatch.current({ action: \"setFiles\", payload: { hdl: builtinCode } });\n this.replaceChip(Ok(nextChip));\n },\n\n async initialize() {\n await this.loadChip(project, chipName);\n },\n\n compileTest(file: string) {\n dispatch.current({ action: \"setFiles\", payload: { tst: file } });\n const tst = TST.parse(file);\n\n if (isErr(tst)) {\n setStatus(`Failed to parse test`);\n return false;\n }\n setStatus(`Parsed tst`);\n\n test = ChipTest.from(Ok(tst)).with(chip).reset();\n test.setFileSystem(fs);\n dispatch.current({ action: \"updateTestStep\" });\n return true;\n },\n\n async runTest(file: string) {\n if (!this.compileTest(file)) {\n return;\n }\n dispatch.current({ action: \"testRunning\" });\n\n fs.pushd(\"/samples\");\n await test.run();\n fs.popd();\n\n dispatch.current({ action: \"updateTestStep\" });\n dispatch.current({ action: \"testFinished\" });\n },\n\n tick(): Promise {\n return this.stepTest();\n },\n\n async stepTest(): Promise {\n assert(test.chipId === chip.id, \"Test and chip out of sync\");\n const done = await test.step();\n dispatch.current({ action: \"updateTestStep\" });\n if (done) {\n dispatch.current({ action: \"testFinished\" });\n }\n return done;\n },\n };\n\n const initialState: ChipPageState = (() => {\n const controls: ControlsState = {\n project,\n chips,\n chipName,\n hasBuiltin: REGISTRY.has(chipName),\n runningTest: false,\n error: \"\",\n };\n\n const maybeChip = getBuiltinChip(controls.chipName);\n if (isErr(maybeChip)) {\n setStatus(display(Err(maybeChip)));\n chip = new Low();\n } else {\n chip = Ok(maybeChip);\n }\n\n const sim = reduceChip(chip);\n\n return {\n controls,\n files: {\n hdl: \"\",\n cmp: \"\",\n tst: \"\",\n out: \"\",\n },\n sim,\n };\n })();\n\n return { initialState, reducers, actions };\n}\n\nexport function useChipPageStore() {\n const { fs, setStatus, storage } = useContext(BaseContext);\n\n const dispatch = useRef(() => undefined);\n\n const { initialState, reducers, actions } = useMemo(\n () => makeChipStore(fs, setStatus, storage, dispatch),\n [fs, setStatus, storage, dispatch]\n );\n\n const [state, dispatcher] = useImmerReducer(\n reducers as unknown as Record<\n string,\n (state: ChipPageState, action?: unknown) => ChipPageState\n >,\n initialState\n );\n dispatch.current = dispatcher;\n\n return { state, dispatch, actions };\n}\n","import { Trans } from \"@lingui/macro\";\nimport {\n CSSProperties,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport \"./chip.scss\";\n\nimport { makeVisualizationsWithId } from \"@nand2tetris/components/chips/visualizations.js\";\nimport { Clockface } from \"@nand2tetris/components/clockface.js\";\nimport { DiffTable } from \"@nand2tetris/components/difftable.js\";\nimport { FullPinout } from \"@nand2tetris/components/pinout.js\";\nimport { useStateInitializer } from \"@nand2tetris/components/react.js\";\nimport { Runbar } from \"@nand2tetris/components/runbar.js\";\nimport { CMP } from \"@nand2tetris/simulator/languages/cmp.js\";\nimport { HDL } from \"@nand2tetris/simulator/languages/hdl.js\";\nimport { TST } from \"@nand2tetris/simulator/languages/tst.js\";\nimport { CHIP_PROJECTS } from \"@nand2tetris/projects/index.js\";\nimport { Timer } from \"@nand2tetris/simulator/timer.js\";\nimport { AppContext } from \"../App.context\";\nimport { Icon } from \"../pico/icon\";\nimport { Editor } from \"../shell/editor\";\nimport { Accordian, Panel } from \"../shell/panel\";\nimport {\n Files,\n PROJECT_NAMES,\n useChipPageStore,\n} from \"@nand2tetris/components/stores/chip.store.js\";\nimport { BaseContext } from \"@nand2tetris/components/stores/base.context.js\";\n\nexport const Chip = () => {\n const { fs, setStatus } = useContext(BaseContext);\n const { filePicker, tracking } = useContext(AppContext);\n const { state, actions, dispatch } = useChipPageStore();\n\n const [hdl, setHdl] = useStateInitializer(state.files.hdl);\n const [tst, setTst] = useStateInitializer(state.files.tst);\n const [cmp, setCmp] = useStateInitializer(state.files.cmp);\n const [out] = useStateInitializer(state.files.out);\n\n useEffect(() => {\n actions.initialize();\n }, [actions]);\n\n useEffect(() => {\n tracking.trackPage(\"/chip\");\n }, [tracking]);\n\n const saveChip = () => {\n actions.saveChip(hdl);\n };\n\n useEffect(() => {\n tracking.trackEvent(\"action\", \"setProject\", state.controls.project);\n tracking.trackEvent(\"action\", \"setChip\", state.controls.chipName);\n }, []);\n\n const setProject = useCallback(\n (project: keyof typeof CHIP_PROJECTS) => {\n actions.setProject(project);\n tracking.trackEvent(\"action\", \"setProject\", project);\n },\n [actions, tracking]\n );\n\n const setChip = useCallback(\n (chip: string) => {\n actions.setChip(chip);\n actions.reset();\n tracking.trackEvent(\"action\", \"setChip\", chip);\n },\n [actions, tracking]\n );\n\n const doEval = useCallback(() => {\n actions.eval();\n tracking.trackEvent(\"action\", \"eval\");\n }, [actions, tracking]);\n\n const compile = useRef<(files?: Partial) => void>(() => undefined);\n compile.current = async (files: Partial = {}) => {\n await actions.updateFiles({\n hdl: files.hdl,\n tst: files.tst ?? tst,\n cmp: files.cmp ?? cmp,\n });\n };\n\n const loadTest = useCallback(async () => {\n try {\n const path = await filePicker.select();\n const tst = await fs.readFile(path);\n await compile.current({ tst });\n } catch (e) {\n console.error(e);\n setStatus(`Failed to load into memory`);\n }\n }, [filePicker, setStatus, fs, compile]);\n\n const runner = useRef();\n useEffect(() => {\n runner.current = new (class ChipTimer extends Timer {\n async reset(): Promise {\n await compile.current();\n await actions.reset();\n }\n\n override finishFrame(): void {\n super.finishFrame();\n dispatch.current({ action: \"updateTestStep\" });\n }\n\n async tick(): Promise {\n return actions.stepTest();\n }\n\n toggle(): void {\n dispatch.current({ action: \"updateTestStep\" });\n }\n })();\n\n return () => {\n runner.current?.stop();\n };\n }, [compile, actions, dispatch]);\n\n const clockActions = useMemo(\n () => ({\n toggle() {\n actions.clock();\n tracking.trackEvent(\"action\", \"toggleClock\");\n },\n reset() {\n tracking.trackEvent(\"action\", \"resetClock\");\n actions.reset();\n },\n }),\n [actions]\n );\n\n const [useBuiltin, setUseBuiltin] = useState(false);\n const toggleUseBuiltin = async () => {\n if (useBuiltin) {\n setUseBuiltin(false);\n await actions.useBuiltin(false);\n } else {\n setUseBuiltin(true);\n await actions.useBuiltin(true, hdl);\n }\n actions.reset();\n };\n\n const selectors = (\n <>\n
\n {\n setProject(value as keyof typeof CHIP_PROJECTS);\n }}\n data-testid=\"project-picker\"\n >\n {PROJECT_NAMES.map(([number, label]) => (\n \n ))}\n \n {\n setChip(value);\n }}\n data-testid=\"chip-picker\"\n >\n {state.controls.chips.map((chip) => (\n \n ))}\n \n \n
\n \n );\n const hdlPanel = (\n \n
HDL
\n
\n {state.controls.hasBuiltin && (\n \n )}\n
\n {selectors}\n \n }\n >\n {\n setHdl(source);\n compile.current(useBuiltin ? {} : { hdl: source });\n }}\n grammar={HDL.parser}\n language={\"hdl\"}\n disabled={useBuiltin}\n />\n \n );\n\n const chipButtons = (\n
\n \n \n Clock:{\"\\u00a0\"}\n \n \n \n Reset\n \n
\n );\n\n const visualizations: [string, ReactNode][] = makeVisualizationsWithId({\n parts: state.sim.chip,\n });\n\n const pinsPanel = (\n \n
\n Chip\n
\n {chipButtons}\n \n }\n >\n {state.sim.invalid ? (\n Invalid Chip\n ) : (\n <>\n \n {visualizations.length > 0 && (\n Visualizations} open={true}>\n
{visualizations.map(([_, v]) => v)}
\n
\n )}\n \n )}\n \n );\n\n const [selectedTestTab, doSetSelectedTestTab] = useState<\n \"tst\" | \"cmp\" | \"out\"\n >(\"tst\");\n\n const setSelectedTestTab = useCallback(\n (tab: typeof selectedTestTab) => {\n doSetSelectedTestTab(tab);\n tracking.trackEvent(\"tab\", \"change\", tab);\n },\n [tracking]\n );\n\n const testPanel = (\n \n
\n Test\n
\n
\n {runner.current && }\n
\n
\n \n
\n \n }\n >\n
\n \n \n
\n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n\n return (\n
\n {hdlPanel}\n {pinsPanel}\n {testPanel}\n
\n );\n};\n\nexport default Chip;\n"],"names":["ALUComponent","A","op","D","out","flag","_jsxs","children","_jsx","bin","COMMANDS","Flags","RegisterComponent","name","bits","dec","KeyMap","Enter","Backspace","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Home","End","PageUp","PageDown","Insert","Delete","Escape","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Keyboard","keyboard","useState","showPicker","setShowPicker","busVoltage","setBits","setKey","useCallback","event","key","keypress","mapping","undefined","length","code","charCodeAt","keyPressToHackCharacter","preventDefault","changeKey","className","ref","e","focus","type","onKeyDown","onClick","Sizes","none","sm","md","lg","xl","full","Sides","t","r","l","b","tl","tr","bl","br","Widths","isSide","v","getSize","size","getSide","side","rounded","sized","reduce","prev","curr","borderRadius","width","amount","block","display","die","error","args","msg","Error","map","s","join","isDraft","value","DRAFT_STATE","isDraftable","proto","Object","getPrototypeOf","Ctor","hasOwnProperty","call","constructor","Function","toString","objectCtorString","Array","isArray","DRAFTABLE","_value$constructor","isMap","isSet","each","obj","iter","enumerableOnly","getArchtype","keys","ownKeys","forEach","entry","index","thing","state","type_","has","prop","prototype","get","set","propOrOldValue","delete","add","is","x","y","target","hasMap","Map","hasSet","Set","latest","copy_","base_","shallowCopy","base","slice","descriptors","getOwnPropertyDescriptors","i","desc","writable","configurable","enumerable","create","freeze","deep","isFrozen","clear","dontMutateFrozenCollections","getPlugin","pluginKey","plugin","plugins","getCurrentScope","currentScope","usePatchesInScope","scope","patchListener","patches_","inversePatches_","patchListener_","revokeScope","leaveScope","drafts_","revokeDraft","parent_","enterScope","immer","immer_","canAutoFreeze_","unfinalizedDrafts_","draft","revoke_","revoked_","processResult","result","baseDraft","isReplaced","useProxies_","willFinalizeES5_","modified_","finalize","maybeFreeze","generateReplacementPatches_","NOTHING","rootScope","path","childValue","finalizeProperty","scope_","finalized_","draft_","generatePatches_","parentState","targetObject","rootPath","res","assigned_","concat","autoFreeze_","peek","getDescriptorFromProto","source","getOwnPropertyDescriptor","markChanged","prepareCopy","createProxy","parent","proxyMap_","proxySet_","isManual_","traps","objectTraps","arrayTraps","Proxy","revocable","revoke","proxy","createES5Proxy_","push","current","currentImpl","copy","archType","hasChanges_","copyHelper","from","hasSymbol","Symbol","hasProxies","Reflect","for","iterator","getOwnPropertySymbols","getOwnPropertyNames","_desc$get","currentState","deleteProperty","owner","defineProperty","setPrototypeOf","fn","arguments","apply","this","Immer","config","recipe","defaultBase","self","_this","produce","_this2","hasError","Promise","then","p","ip","produceWithPatches","patches","inversePatches","n","nextState","useProxies","setUseProxies","autoFreeze","setAutoFreeze","createDraft","finishDraft","applyPatches","patch","applyPatchesImpl","applyPatches_","bind","useImmerReducer","reducers","initialState","useReducer","command","action","payload","useStateInitializer","init","setState","useEffect","Mode","props","mode","setMode","setValue","view","style","cursor","doSelect","select","doChange","onChange","edit","position","zIndex","left","marginTop","onBlur","onKeyPress","defaultValue","render","doScroll","scrollTop","totalHeight","toleranceHeight","bufferedItems","settings","itemHeight","minIndex","maxIndex","Math","floor","data","offset","limit","start","max","min","getData","topPaddingHeight","bottomPaddingHeight","viewportRef","useRef","useMemo","Number","MAX_SAFE_INTEGER","startIndex","count","tolerance","fillVirtualScrollSettings","startState","adapter","itemsAbove","viewportHeight","reducer","scrollReducer","dispatchScroll","row","initialScroll","div","rows","d","height","rowKey","overflowY","overflowAnchor","onScroll","MemoryBlock","memory","jmp","highlight","editable","format","range","MemoryCell","VirtualScroll","background","hex","flex","textAlign","InlineEdit","newValue","Memory","fmt","setFormat","setJmp","goto","setGoto","jumpTo","doUpdate","update","role","placeholder","FORMATS","option","checked","asm","doFormat","displayClock","Clock","Clockface","clockface","setClockface","subscription","$","subscribe","unsubscribe","useClockface","whiteSpace","WHITE","mem","pixel","color","Screen","frameFinished","canvas","draw","ctx","getContext","image","assertExists","getImageData","col","putImageData","drawImage","ctxRef","frame$","maxWidth","boxSizing","marginInline","margin","borderTop","borderLeft","borderBottom","borderRight","makeVisualization","chip","ALU","in","voltage","HIGH","VRegister","id","PC","KeyboardComponent","ScreenComponent","RAM","MemoryComponent","address","RAM8","CPU","decode","am","vis","parts","filter","reducePin","pin","reverse","reducePins","pins","entries","FullPinout","sim","inPins","outPins","internalPins","PinoutBlock","header","toggle","disabled","pending","colSpan","immPin","Pin","Runbar","runner","timer","dispatch","running","speed","steps","finishFrame","setSteps","setSpeed","actions","frame","stop","reset","makeTimerStore","dispatcher","useTimer","label","clock","Timer","now","Date","delta","done","tick","requestAnimationFrame","ErrorPanel","failed","open","message","shortMessage","UNKNOWN_PARSE_ERROR","Textarea","language","text","setText","Monaco","currentHighlight","theme","useContext","AppContext","monaco","useMonaco","editor","decorations","codeTheme","window","matchMedia","matches","doHighlight","model","getModel","getPositionAt","end","Range","fromPositions","nextDecoration","options","inlineClassName","revealRangeInCenter","deltaDecorations","makeHighlight","onMount","ed","updateOptions","fontFamily","fontSize","minimap","enabled","scrollBeyondLastLine","readOnly","succeeded","setModelMarkers","exec","groups","line","column","startLineNumber","endLineNumber","startColumn","endColumn","getLineContent","substring","match","severity","Editor","grammar","setError","parse","parsed","doParse","ms","clearTimeout","setTimeout","debounce","onChangeCB","canUse","wants","Panel","footer","Accordian","summary","PROJECT_NAMES","makeHdl","reduceChip","invalid","clocked","ins","outs","makeChipStore","fs","setStatus","storage","dropdowns","project","chips","CHIP_PROJECTS","chipName","findDropdowns","Low","test","ChipTest","usingBuiltin","setFiles","hdl","files","tst","cmp","updateChip","controls","includes","setProject","setChip","hasBuiltin","REGISTRY","testRunning","runningTest","testFinished","passed","trim","updateTestStep","log","currentStep","span","ChipProjects","loadChip","useBuiltin","updateFiles","compileChip","compileTest","remove","maybeParsed","HDL","isErr","Err","buildChip","Ok","maybeChip","replaceChip","nextChip","nextPin","eval","with","fsName","ext","all","readFile","catch","console","saveChip","prj","writeFile","isLow","doUseBuiltin","builtinName","getBuiltinChip","template","CHIPS","builtinCode","replace","initialize","file","TST","setFileSystem","runTest","pushd","run","popd","stepTest","assert","chipId","step","Chip","BaseContext","filePicker","tracking","useChipPageStore","setHdl","setTst","setCmp","trackPage","trackEvent","doEval","compile","loadTest","clockActions","setUseBuiltin","toggleUseBuiltin","selectors","number","hdlPanel","tabIndex","chipButtons","visualizations","part","makeVisualizationsWithId","pinsPanel","selectedTestTab","doSetSelectedTestTab","setSelectedTestTab","tab","testPanel","CMP"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/681.59527346.chunk.js b/build/static/js/681.59527346.chunk.js new file mode 100644 index 000000000..ec5580bf7 --- /dev/null +++ b/build/static/js/681.59527346.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[681],{2681:function(n,t,u){u.r(t),u.d(t,{ChipProjects:function(){return M},default:function(){return S},loadSolutions:function(){return y},loaders:function(){return m}});var e={};u.r(e),u.d(e,{SOLS:function(){return c},loadSolutions:function(){return i}});var r={};u.r(r),u.d(r,{SOLS:function(){return h},loadSolutions:function(){return p}});var a={};u.r(a),u.d(a,{SOLS:function(){return b},loadSolutions:function(){return f}});var o={};u.r(o),u.d(o,{SOLS:function(){return x},loadSolutions:function(){return R}});var d=u(1092),s=u(7791),l=u(9956),c={Not:{"Not.hdl":"// REDACTED"},And:{"And.hdl":"CHIP And {\n IN a, b;\n OUT out;\n\n PARTS:\n Nand(a=a, b=b, out=x);\n Not(in=x, out=out);\n}"},Or:{"Or.hdl":"// REDACTED"},XOr:{"XOr.hdl":"// REDACTED"},Mux:{"Mux.hdl":"// REDACTED"},DMux:{"DMux.hdl":"// REDACTED"},Not16:{"Not16.hdl":"// REDACTED"},And16:{"And16.hdl":"CHIP And16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n And (a=a[0], b=b[0], out=out[0]);\n And (a=a[1], b=b[1], out=out[1]);\n And (a=a[2], b=b[2], out=out[2]);\n And (a=a[3], b=b[3], out=out[3]);\n And (a=a[4], b=b[4], out=out[4]);\n And (a=a[5], b=b[5], out=out[5]);\n And (a=a[6], b=b[6], out=out[6]);\n And (a=a[7], b=b[7], out=out[7]);\n And (a=a[8], b=b[8], out=out[8]);\n And (a=a[9], b=b[9], out=out[9]);\n And (a=a[10], b=b[10], out=out[10]);\n And (a=a[11], b=b[11], out=out[11]);\n And (a=a[12], b=b[12], out=out[12]);\n And (a=a[13], b=b[13], out=out[13]);\n And (a=a[14], b=b[14], out=out[14]);\n And (a=a[15], b=b[15], out=out[15]);\n}"},Or16:{"Or16.hdl":"// REDACTED"},Mux16:{"Mux16.hdl":"// REDACTED"},Mux4Way16:{"Mux4Way16.hdl":"// REDACTED"},Mux8Way16:{"Mux8Way16.hdl":"CHIP Mux8Way16 {\n IN a[16], b[16], c[16], d[16],\n e[16], f[16], g[16], h[16],\n sel[3];\n OUT out[16];\n\n PARTS:\n // Binary tree of 2-way multiplexors\n Mux16 (a=a, b=b, sel=sel[0], out=ab);\n Mux16 (a=c, b=d, sel=sel[0], out=cd);\n Mux16 (a=e, b=f, sel=sel[0], out=ef);\n Mux16 (a=g, b=h, sel=sel[0], out=gh);\n Mux16 (a=ab, b=cd, sel=sel[1], out=abcd);\n Mux16 (a=ef, b=gh, sel=sel[1], out=efgh);\n Mux16 (a=abcd, b=efgh, sel=sel[2], out=out);\n\n\n// Alternate implementation\n//\n// This implementation replaces the upper two layers of the\n// tree with 4-way multiplexors.\n/*\n Mux4Way16 (a=a, b=b, c=c, d=d, sel=sel[0..1], out=abcd);\n Mux4Way16 (a=e, b=f, c=g, d=h, sel=sel[0..1], out=efgh);\n Mux16 (a=abcd, b=efgh, sel=sel[2], out=out);\n*/\n\n// Alternate implementation\n//\n// Some students make a Mux8Way chip and apply it 16 times as in Not16.\n}"},DMux4Way:{"DMux4Way.hdl":"// REDACTED"},DMux8Way:{"DMux8Way.hdl":"// REDACTED"},Or8Way:{"Or8Way.hdl":"// REDACTED"}};function i(n){return A.apply(this,arguments)}function A(){return(A=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.pushd("/projects/01");case 2:return n.next=4,(0,l.mc)(t,c);case 4:return n.next=6,t.popd();case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var h={HalfAdder:{"HalfAdder.hdl":"// REDACTED"},FullAdder:{"FullAdder.hdl":"// REDACTED"},Add16:{"Add16.hdl":"// REDACTED"},Inc16:{"Inc16.hdl":"// REDACTED"},AluNoStat:{"AluNoStat.hdl":"// REDACTED"},ALU:{"ALU.hdl":"// REDACTED"}};function p(n){return D.apply(this,arguments)}function D(){return(D=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.pushd("/projects/02");case 2:return n.next=4,(0,l.mc)(t,h);case 4:return n.next=6,t.popd();case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var b={Bit:{"Bit.hdl":"CHIP Bit {\n IN in, load;\n OUT out;\n\n PARTS:\n \n Mux (a=dffOut, b=in, sel=load, out=muxOut);\n DFF (in=muxOut, out=dffOut, out=out);\n}"},Register:{"Register.hdl":"// REDACTED"},PC:{"PC.hdl":"// REDACTED"},RAM8:{"RAM8.hdl":"// REDACTED"},RAM64:{"RAM64.hdl":"// REDACTED"},RAM512:{"RAM512.hdl":"// REDACTED"},RAM4k:{"RAM4k.hdl":"// REDACTED"},RAM16k:{"RAM16k.hdl":"// REDACTED"}};function f(n){return E.apply(this,arguments)}function E(){return(E=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.pushd("/projects/03");case 2:return n.next=4,(0,l.mc)(t,b);case 4:return n.next=6,t.popd();case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var x={Memory:{"Memory.hdl":"// REDACTED"},CPU:{"CPU.hdl":"// REDACTED"},Computer:{"Computer.hdl":"// REDACTED"}};function R(n){return C.apply(this,arguments)}function C(){return(C=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.pushd("/projects/05");case 2:return n.next=4,(0,l.mc)(t,x);case 4:return n.next=6,t.popd();case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var M={"01":e,"02":r,"03":a,"05":o},T=!1,y=function(){var n=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!T){n.next=2;break}return n.abrupt("return");case 2:return T=!0,n.next=5,i(t);case 5:return n.next=7,p(t);case 7:return n.next=9,f(t);case 9:return n.next=11,R(t);case 11:T=!1;case 12:case"end":return n.stop()}}),n)})));return function(t){return n.apply(this,arguments)}}(),m={loadSolutions:y},S=m}}]); +//# sourceMappingURL=681.59527346.chunk.js.map \ No newline at end of file diff --git a/build/static/js/681.59527346.chunk.js.map b/build/static/js/681.59527346.chunk.js.map new file mode 100644 index 000000000..85900538c --- /dev/null +++ b/build/static/js/681.59527346.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/681.59527346.chunk.js","mappings":"koBAkBaA,EAAO,CAClBC,IAAK,CACH,UCpBe,eDsBjBC,IAAK,CACH,UEvBe,gHFyBjBC,GAAI,CACF,SG1Be,eH4BjBC,IAAK,CACH,UI7Be,eJ+BjBC,IAAK,CACH,UKhCe,eLkCjBC,KAAM,CACJ,WMnCe,eNqCjBC,MAAO,CACL,YOtCe,ePwCjBC,MAAO,CACL,YQzCe,+tBR2CjBC,KAAM,CACJ,WS5Ce,eT8CjBC,MAAO,CACL,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A,EAAGC,MAAM,gBAAe,wBACxBC,EAAAA,EAAAA,IAAMF,EAAIjB,GAAK,uBACfiB,EAAGG,OAAM,4CAChB,sBGfM,IAAMkB,EAAe,CAC1B,KAAMC,EACN,KAAMC,EACN,KAAMC,EACN,KAAMC,GAGJvB,GAAQ,EACCH,EAAa,yCAAG,WAAOC,GAAc,0EAC5CE,EAAO,CAAF,gDACI,OAAbA,GAAQ,EAAK,SACPoB,EAAyBtB,GAAG,uBAC5BuB,EAAyBvB,GAAG,uBAC5BwB,EAAyBxB,GAAG,wBAC5ByB,EAAyBzB,GAAG,QAClCE,GAAQ,EAAM,4CACf,gBARyB,sCAUbwB,EAAU,CACrB3B,cAAAA,GAGF,G","sources":["../../projects/src/testing/project_01/index.ts","../../projects/src/testing/project_01/01_not.ts","../../projects/src/testing/project_01/02_and.ts","../../projects/src/testing/project_01/03_or.ts","../../projects/src/testing/project_01/04_xor.ts","../../projects/src/testing/project_01/05_mux.ts","../../projects/src/testing/project_01/06_dmux.ts","../../projects/src/testing/project_01/07_not16.ts","../../projects/src/testing/project_01/08_and16.ts","../../projects/src/testing/project_01/09_or16.ts","../../projects/src/testing/project_01/10_mux16.ts","../../projects/src/testing/project_01/11_mux4way16.ts","../../projects/src/testing/project_01/12_mux8way16.ts","../../projects/src/testing/project_01/13_dmux4way.ts","../../projects/src/testing/project_01/14_dmux8way.ts","../../projects/src/testing/project_01/15_or8way.ts","../../projects/src/testing/project_02/01_half_adder.ts","../../projects/src/testing/project_02/index.ts","../../projects/src/testing/project_02/02_full_adder.ts","../../projects/src/testing/project_02/03_add16.ts","../../projects/src/testing/project_02/04_inc16.ts","../../projects/src/testing/project_02/05_alu_no_stat.ts","../../projects/src/testing/project_02/06_alu.ts","../../projects/src/testing/project_03/01_bit.ts","../../projects/src/testing/project_03/index.ts","../../projects/src/testing/project_03/02_register.ts","../../projects/src/testing/project_03/03_pc.ts","../../projects/src/testing/project_03/04_ram8.ts","../../projects/src/testing/project_03/05_ram64.ts","../../projects/src/testing/project_03/06_ram512.ts","../../projects/src/testing/project_03/07_ram4k.ts","../../projects/src/testing/project_03/08_ram16k.ts","../../projects/src/testing/project_05/01_memory.ts","../../projects/src/testing/project_05/index.ts","../../projects/src/testing/project_05/02_cpu.ts","../../projects/src/testing/project_05/03_computer.ts","../../projects/src/testing/index.ts"],"sourcesContent":["import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Not from \"./01_not.js\";\nimport * as And from \"./02_and.js\";\nimport * as Or from \"./03_or.js\";\nimport * as Xor from \"./04_xor.js\";\nimport * as Mux from \"./05_mux.js\";\nimport * as DMux from \"./06_dmux.js\";\nimport * as Not16 from \"./07_not16.js\";\nimport * as And16 from \"./08_and16.js\";\nimport * as Or16 from \"./09_or16.js\";\nimport * as Mux16 from \"./10_mux16.js\";\nimport * as Mux4Way16 from \"./11_mux4way16.js\";\nimport * as Mux8Way16 from \"./12_mux8way16.js\";\nimport * as DMux4Way from \"./13_dmux4way.js\";\nimport * as DMux8Way from \"./14_dmux8way.js\";\nimport * as Or8Way from \"./15_or8way.js\";\n\nexport const SOLS = {\n Not: {\n \"Not.hdl\": Not.sol,\n },\n And: {\n \"And.hdl\": And.sol,\n },\n Or: {\n \"Or.hdl\": Or.sol,\n },\n XOr: {\n \"XOr.hdl\": Xor.sol,\n },\n Mux: {\n \"Mux.hdl\": Mux.sol,\n },\n DMux: {\n \"DMux.hdl\": DMux.sol,\n },\n Not16: {\n \"Not16.hdl\": Not16.sol,\n },\n And16: {\n \"And16.hdl\": And16.sol,\n },\n Or16: {\n \"Or16.hdl\": Or16.sol,\n },\n Mux16: {\n \"Mux16.hdl\": Mux16.sol,\n },\n Mux4Way16: {\n \"Mux4Way16.hdl\": Mux4Way16.sol,\n },\n Mux8Way16: {\n \"Mux8Way16.hdl\": Mux8Way16.sol,\n },\n DMux4Way: {\n \"DMux4Way.hdl\": DMux4Way.sol,\n },\n DMux8Way: {\n \"DMux8Way.hdl\": DMux8Way.sol,\n },\n Or8Way: {\n \"Or8Way.hdl\": Or8Way.sol,\n },\n};\n\nexport async function loadSolutions(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/01\");\n await reset(fs, SOLS);\n await fs.popd();\n}\n","export const sol = `// REDACTED`;\n","export const sol = `CHIP And {\n IN a, b;\n OUT out;\n\n PARTS:\n Nand(a=a, b=b, out=x);\n Not(in=x, out=out);\n}`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `CHIP And16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n And (a=a[0], b=b[0], out=out[0]);\n And (a=a[1], b=b[1], out=out[1]);\n And (a=a[2], b=b[2], out=out[2]);\n And (a=a[3], b=b[3], out=out[3]);\n And (a=a[4], b=b[4], out=out[4]);\n And (a=a[5], b=b[5], out=out[5]);\n And (a=a[6], b=b[6], out=out[6]);\n And (a=a[7], b=b[7], out=out[7]);\n And (a=a[8], b=b[8], out=out[8]);\n And (a=a[9], b=b[9], out=out[9]);\n And (a=a[10], b=b[10], out=out[10]);\n And (a=a[11], b=b[11], out=out[11]);\n And (a=a[12], b=b[12], out=out[12]);\n And (a=a[13], b=b[13], out=out[13]);\n And (a=a[14], b=b[14], out=out[14]);\n And (a=a[15], b=b[15], out=out[15]);\n}`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `CHIP Mux8Way16 {\n IN a[16], b[16], c[16], d[16],\n e[16], f[16], g[16], h[16],\n sel[3];\n OUT out[16];\n\n PARTS:\n // Binary tree of 2-way multiplexors\n Mux16 (a=a, b=b, sel=sel[0], out=ab);\n Mux16 (a=c, b=d, sel=sel[0], out=cd);\n Mux16 (a=e, b=f, sel=sel[0], out=ef);\n Mux16 (a=g, b=h, sel=sel[0], out=gh);\n Mux16 (a=ab, b=cd, sel=sel[1], out=abcd);\n Mux16 (a=ef, b=gh, sel=sel[1], out=efgh);\n Mux16 (a=abcd, b=efgh, sel=sel[2], out=out);\n\n\n// Alternate implementation\n//\n// This implementation replaces the upper two layers of the\n// tree with 4-way multiplexors.\n/*\n Mux4Way16 (a=a, b=b, c=c, d=d, sel=sel[0..1], out=abcd);\n Mux4Way16 (a=e, b=f, c=g, d=h, sel=sel[0..1], out=efgh);\n Mux16 (a=abcd, b=efgh, sel=sel[2], out=out);\n*/\n\n// Alternate implementation\n//\n// Some students make a Mux8Way chip and apply it 16 times as in Not16.\n}`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as HalfAdder from \"./01_half_adder.js\";\nimport * as FullAdder from \"./02_full_adder.js\";\nimport * as Add16 from \"./03_add16.js\";\nimport * as Inc16 from \"./04_inc16.js\";\nimport * as Alu from \"./05_alu_no_stat.js\";\nimport * as AluStatus from \"./06_alu.js\";\n\nexport const SOLS = {\n HalfAdder: {\n \"HalfAdder.hdl\": HalfAdder.sol,\n },\n FullAdder: {\n \"FullAdder.hdl\": FullAdder.sol,\n },\n Add16: {\n \"Add16.hdl\": Add16.sol,\n },\n Inc16: {\n \"Inc16.hdl\": Inc16.sol,\n },\n AluNoStat: {\n \"AluNoStat.hdl\": Alu.sol,\n },\n ALU: {\n \"ALU.hdl\": AluStatus.sol,\n },\n};\n\nexport async function loadSolutions(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/02\");\n await reset(fs, SOLS);\n await fs.popd();\n}\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `CHIP Bit {\n IN in, load;\n OUT out;\n\n PARTS:\n \n Mux (a=dffOut, b=in, sel=load, out=muxOut);\n DFF (in=muxOut, out=dffOut, out=out);\n}`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Bit from \"./01_bit.js\";\nimport * as Register from \"./02_register.js\";\nimport * as PC from \"./03_pc.js\";\nimport * as RAM8 from \"./04_ram8.js\";\nimport * as RAM64 from \"./05_ram64.js\";\nimport * as RAM512 from \"./06_ram512.js\";\nimport * as RAM4k from \"./07_ram4k.js\";\nimport * as RAM16k from \"./08_ram16k.js\";\n\nexport const SOLS = {\n Bit: {\n \"Bit.hdl\": Bit.sol,\n },\n Register: {\n \"Register.hdl\": Register.sol,\n },\n PC: {\n \"PC.hdl\": PC.sol,\n },\n RAM8: {\n \"RAM8.hdl\": RAM8.sol,\n },\n RAM64: {\n \"RAM64.hdl\": RAM64.sol,\n },\n RAM512: {\n \"RAM512.hdl\": RAM512.sol,\n },\n RAM4k: {\n \"RAM4k.hdl\": RAM4k.sol,\n },\n RAM16k: {\n \"RAM16k.hdl\": RAM16k.sol,\n },\n};\n\nexport async function loadSolutions(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/03\");\n await reset(fs, SOLS);\n await fs.popd();\n}\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Memory from \"./01_memory.js\";\nimport * as CPU from \"./02_cpu.js\";\nimport * as Computer from \"./03_computer.js\";\n\nexport const SOLS = {\n Memory: {\n \"Memory.hdl\": Memory.sol,\n },\n CPU: {\n \"CPU.hdl\": CPU.sol,\n },\n Computer: {\n \"Computer.hdl\": Computer.sol,\n },\n};\n\nexport async function loadSolutions(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/05\");\n await reset(fs, SOLS);\n await fs.popd();\n}\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as project_01 from \"./project_01/index.js\";\nimport * as project_02 from \"./project_02/index.js\";\nimport * as project_03 from \"./project_03/index.js\";\nimport * as project_05 from \"./project_05/index.js\";\n\nexport const ChipProjects = {\n \"01\": project_01,\n \"02\": project_02,\n \"03\": project_03,\n \"05\": project_05,\n};\n\nlet reset = false;\nexport const loadSolutions = async (fs: FileSystem) => {\n if (reset) return; // React will double-render a call to resetFiles in useEffect.\n reset = true;\n await project_01.loadSolutions(fs);\n await project_02.loadSolutions(fs);\n await project_03.loadSolutions(fs);\n await project_05.loadSolutions(fs);\n reset = false;\n};\n\nexport const loaders = {\n loadSolutions,\n};\n\nexport default loaders;\n"],"names":["SOLS","Not","And","Or","XOr","Mux","DMux","Not16","And16","Or16","Mux16","Mux4Way16","Mux8Way16","DMux4Way","DMux8Way","Or8Way","loadSolutions","fs","pushd","reset","popd","HalfAdder","FullAdder","Add16","Inc16","AluNoStat","ALU","Bit","Register","PC","RAM8","RAM64","RAM512","RAM4k","RAM16k","Memory","CPU","Computer","ChipProjects","project_01","project_02","project_03","project_05","loaders"],"sourceRoot":""} \ No newline at end of file diff --git a/build/static/js/813.65f1d443.chunk.js b/build/static/js/813.65f1d443.chunk.js new file mode 100644 index 000000000..3254c23f5 --- /dev/null +++ b/build/static/js/813.65f1d443.chunk.js @@ -0,0 +1,3 @@ +/*! For license information please see 813.65f1d443.chunk.js.LICENSE.txt */ +(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[813],{1959:function(e){"use strict";var n=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(e){return"function"===typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},l=function(e){if(!e||"[object Object]"!==t.call(e))return!1;var r,i=n.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!i&&!o)return!1;for(r in e);return"undefined"===typeof r||n.call(e,r)},u=function(e,n){r&&"__proto__"===n.name?r(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},a=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;if(i)return i(e,t).value}return e[t]};e.exports=function e(){var n,t,r,i,c,s,f=arguments[0],p=1,h=arguments.length,d=!1;for("boolean"===typeof f&&(d=f,f=arguments[1]||{},p=2),(null==f||"object"!==typeof f&&"function"!==typeof f)&&(f={});po?0:o+n:n>o?o:n,t=t>0?t:0,r.length<1e4)(i=Array.from(r)).unshift(n,t),[].splice.apply(e,i);else for(t&&[].splice.apply(e,[n,t]);l0?(r(e,e.length,0,n),e):n}t.d(n,{V:function(){return i},d:function(){return r}})},762:function(e,n,t){"use strict";t.d(n,{r:function(){return i}});var r=t(1964);function i(e){return null===e||(0,r.z3)(e)||(0,r.B8)(e)?1:(0,r.Xh)(e)?2:void 0}},5152:function(e,n,t){"use strict";t.d(n,{W:function(){return o}});var r=t(4115),i={}.hasOwnProperty;function o(e){for(var n={},t=-1;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||65535===(65535&t)||65534===(65535&t)||t>1114111?"\ufffd":String.fromCharCode(t)}t.d(n,{o:function(){return r}})},1522:function(e,n,t){"use strict";t.d(n,{v:function(){return l}});var r=t(421),i=t(4488),o=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function l(e){return e.replace(o,u)}function u(e,n,t){if(n)return n;if(35===t.charCodeAt(0)){var o=t.charCodeAt(1),l=120===o||88===o;return(0,i.o)(t.slice(l?2:1),l?16:10)}return(0,r.T)(t)||e}},7184:function(e,n,t){"use strict";function r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}t.d(n,{d:function(){return r}})},2771:function(e,n,t){"use strict";function r(e,n,t){for(var r=[],i=-1;++ie.length){for(;o--;)if(47===e.charCodeAt(o)){if(t){r=o+1;break}}else i<0&&(t=!0,i=o+1);return i<0?"":e.slice(r,i)}if(n===e)return"";var l=-1,u=n.length-1;for(;o--;)if(47===e.charCodeAt(o)){if(t){r=o+1;break}}else l<0&&(t=!0,l=o+1),u>-1&&(e.charCodeAt(o)===n.charCodeAt(u--)?u<0&&(i=o):(u=-1,i=l));r===i?i=l:i<0&&(i=e.length);return e.slice(r,i)},dirname:function(e){if(x(e),0===e.length)return".";var n,t=-1,r=e.length;for(;--r;)if(47===e.charCodeAt(r)){if(n){t=r;break}}else n||(n=!0);return t<0?47===e.charCodeAt(0)?"/":".":1===t&&47===e.charCodeAt(0)?"//":e.slice(0,t)},extname:function(e){x(e);var n,t=e.length,r=-1,i=0,o=-1,l=0;for(;t--;){var u=e.charCodeAt(t);if(47!==u)r<0&&(n=!0,r=t+1),46===u?o<0?o=t:1!==l&&(l=1):o>-1&&(l=-1);else if(n){i=t+1;break}}if(o<0||r<0||0===l||1===l&&o===r-1&&o===i+1)return"";return e.slice(o,r)},join:function(){for(var e,n=-1,t=arguments.length,r=new Array(t),i=0;i2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",o=0):o=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),l=a,u=0;continue}}else if(i.length>0){i="",o=0,l=a,u=0;continue}n&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(l+1,a):i=e.slice(l+1,a),o=a-l-1;l=a,u=0}else 46===t&&u>-1?u++:u=-1}return i}(e,!n);return 0!==t.length||n||(t="."),t.length>0&&47===e.charCodeAt(e.length-1)&&(t+="/"),n?"/"+t:t}function x(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var b={cwd:function(){return"/"}};function C(e){return null!==e&&"object"===typeof e&&e.href&&e.origin}function w(e){if("string"===typeof e)e=new URL(e);else if(!C(e)){var n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if("file:"!==e.protocol){var t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return function(e){if(""!==e.hostname){var n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}var t=e.pathname,r=-1;for(;++ro.length;a&&o.push(r);try{u=e.apply(this,o)}catch(s){var c=s;if(a&&t)throw c;return r(c)}a||(u instanceof Promise?u.then(i,r):u instanceof Error?r(u):i(u))};function r(e){if(!t){t=!0;for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o1?a-1:0),s=1;s1?t-1:0),a=1;ar))return;for(var c,s,f=i.events.length,p=f;p--;)if("exit"===i.events[p][0]&&"chunkFlow"===i.events[p][1].type){if(c){s=i.events[p][1].end;break}c=!0}for(v(l),a=f;an;){var r=o[t];i.containerState=r[1],r[0].exit.call(i,e)}o.length=n}function y(){n.write([null]),t=void 0,n=void 0,i.containerState._closeFlow=void 0}}},J={tokenize:function(e,n,t){return(0,W.f)(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};var G=t(6848);function ee(e){for(var n,t,r,i,o,l,u,a={},c=-1;++c=4?n(i):e.interrupt(r.parser.constructs.flow,t,n)(i)}},partial:!0};var ie={tokenize:function(e){var n=this,t=e.attempt(G.w,(function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}),e.attempt(this.parser.constructs.flowInitial,r,(0,W.f)(e,e.attempt(this.parser.constructs.flow,r,e.attempt(te,r)),"linePrefix")));return t;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n.currentConstruct=void 0,t;e.consume(r)}}};var oe={resolveAll:ce()},le=ae("string"),ue=ae("text");function ae(e){return{tokenize:function(n){var t=this,r=this.parser.constructs[e],i=n.attempt(r,o,l);return o;function o(e){return a(e)?i(e):l(e)}function l(e){if(null!==e)return n.enter("data"),n.consume(e),u;n.consume(e)}function u(e){return a(e)?(n.exit("data"),i(e)):(n.consume(e),u)}function a(e){if(null===e)return!0;var n=r[e],i=-1;if(n)for(;++i-1&&(t[0]=t[0].slice(i)),l>0&&t.push(e[o].slice(0,l)));return t}(l,e)}function h(){return Object.assign({},r)}function d(){for(var e;r._indexc?t(i):(e.consume(i),d):41===i?s--?(e.consume(i),d):(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),n(i)):null===i||(0,Y.z3)(i)?s?t(i):(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),n(i)):(0,Y.Av)(i)?t(i):(e.consume(i),92===i?g:d)}function g(n){return 40===n||41===n||92===n?(e.consume(n),d):d(n)}}function xe(e,n,t,r,i,o){var l,u=this,a=0;return function(n){return e.enter(r),e.enter(i),e.consume(n),e.exit(i),e.enter(o),c};function c(f){return null===f||91===f||93===f&&!l||94===f&&!a&&"_hiddenFootnoteSupport"in u.parser.constructs||a>999?t(f):93===f?(e.exit(o),e.enter(i),e.consume(f),e.exit(i),e.exit(r),n):(0,Y.Ch)(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),s(f))}function s(n){return null===n||91===n||93===n||(0,Y.Ch)(n)||a++>999?(e.exit("chunkString"),c(n)):(e.consume(n),l=l||!(0,Y.xz)(n),92===n?f:s)}function f(n){return 91===n||92===n||93===n?(e.consume(n),a++,s):s(n)}}function be(e,n,t,r,i,o){var l;return function(n){return e.enter(r),e.enter(i),e.consume(n),e.exit(i),l=40===n?41:n,u};function u(t){return t===l?(e.enter(i),e.consume(t),e.exit(i),e.exit(r),n):(e.enter(o),a(t))}function a(n){return n===l?(e.exit(o),u(l)):null===n?t(n):(0,Y.Ch)(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,W.f)(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(n))}function c(n){return n===l||null===n||(0,Y.Ch)(n)?(e.exit("chunkString"),a(n)):(e.consume(n),92===n?s:c)}function s(n){return n===l||92===n?(e.consume(n),c):c(n)}}function Ce(e,n){var t;return function r(i){if((0,Y.Ch)(i))return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r;if((0,Y.xz)(i))return(0,W.f)(e,r,t?"linePrefix":"lineSuffix")(i);return n(i)}}var we=t(7184),Se={name:"definition",tokenize:function(e,n,t){var r,i=this;return function(n){return e.enter("definition"),xe.call(i,e,o,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function o(n){return r=(0,we.d)(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===n?(e.enter("definitionMarker"),e.consume(n),e.exit("definitionMarker"),Ce(e,ke(e,e.attempt(Ae,(0,W.f)(e,l,"whitespace"),(0,W.f)(e,l,"whitespace")),t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString"))):t(n)}function l(o){return null===o||(0,Y.Ch)(o)?(e.exit("definition"),i.parser.defined.includes(r)||i.parser.defined.push(r),n(o)):t(o)}}},Ae={tokenize:function(e,n,t){return function(n){return(0,Y.z3)(n)?Ce(e,r)(n):t(n)};function r(n){return 34===n||39===n||40===n?be(e,(0,W.f)(e,i,"whitespace"),t,"definitionTitle","definitionTitleMarker","definitionTitleString")(n):t(n)}function i(e){return null===e||(0,Y.Ch)(e)?n(e):t(e)}},partial:!0};var Fe={name:"codeIndented",tokenize:function(e,n,t){var r=this;return function(n){return e.enter("codeIndented"),(0,W.f)(e,i,"linePrefix",5)(n)};function i(e){var n=r.events[r.events.length-1];return n&&"linePrefix"===n[1].type&&n[2].sliceSerialize(n[1],!0).length>=4?o(e):t(e)}function o(n){return null===n?u(n):(0,Y.Ch)(n)?e.attempt(Ee,o,u)(n):(e.enter("codeFlowValue"),l(n))}function l(n){return null===n||(0,Y.Ch)(n)?(e.exit("codeFlowValue"),o(n)):(e.consume(n),l)}function u(t){return e.exit("codeIndented"),n(t)}}},Ee={tokenize:function(e,n,t){var r=this;return i;function i(n){return r.parser.lazy[r.now().line]?t(n):(0,Y.Ch)(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),i):(0,W.f)(e,o,"linePrefix",5)(n)}function o(e){var o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?n(e):(0,Y.Ch)(e)?i(e):t(e)}},partial:!0};var Te={name:"headingAtx",tokenize:function(e,n,t){var r=this,i=0;return function(n){return e.enter("atxHeading"),e.enter("atxHeadingSequence"),o(n)};function o(u){return 35===u&&i++<6?(e.consume(u),o):null===u||(0,Y.z3)(u)?(e.exit("atxHeadingSequence"),r.interrupt?n(u):l(u)):t(u)}function l(t){return 35===t?(e.enter("atxHeadingSequence"),u(t)):null===t||(0,Y.Ch)(t)?(e.exit("atxHeading"),n(t)):(0,Y.xz)(t)?(0,W.f)(e,l,"whitespace")(t):(e.enter("atxHeadingText"),a(t))}function u(n){return 35===n?(e.consume(n),u):(e.exit("atxHeadingSequence"),l(n))}function a(n){return null===n||35===n||(0,Y.z3)(n)?(e.exit("atxHeadingText"),l(n)):(e.consume(n),a)}},resolve:function(e,n){var t,r,i=e.length-2,o=3;"whitespace"===e[o][1].type&&(o+=2);i-2>o&&"whitespace"===e[i][1].type&&(i-=2);"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4);i>o&&(t={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},(0,X.d)(e,o,i-o+1,[["enter",t,n],["enter",r,n],["exit",r,n],["exit",t,n]]));return e}};var De={name:"setextUnderline",tokenize:function(e,n,t){var r,i,o=this,l=o.events.length;for(;l--;)if("lineEnding"!==o.events[l][1].type&&"linePrefix"!==o.events[l][1].type&&"content"!==o.events[l][1].type){i="paragraph"===o.events[l][1].type;break}return function(n){if(!o.parser.lazy[o.now().line]&&(o.interrupt||i))return e.enter("setextHeadingLine"),e.enter("setextHeadingLineSequence"),r=n,u(n);return t(n)};function u(n){return n===r?(e.consume(n),u):(e.exit("setextHeadingLineSequence"),(0,W.f)(e,a,"lineSuffix")(n))}function a(r){return null===r||(0,Y.Ch)(r)?(e.exit("setextHeadingLine"),n(r)):t(r)}},resolveTo:function(e,n){var t,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){t=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);var l={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",l,n]),e.splice(i+1,0,["exit",e[t][1],n]),e[t][1].end=Object.assign({},e[i][1].end)):e[t][1]=l;return e.push(["exit",l,n]),e}};var ze=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Le=["pre","script","style","textarea"],Oe={name:"htmlFlow",tokenize:function(e,n,t){var r,i,o,l,u,a=this;return function(n){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(l){return 33===l?(e.consume(l),s):47===l?(e.consume(l),h):63===l?(e.consume(l),r=3,a.interrupt?n:I):(0,Y.jv)(l)?(e.consume(l),o=String.fromCharCode(l),i=!0,d):t(l)}function s(i){return 45===i?(e.consume(i),r=2,f):91===i?(e.consume(i),r=5,o="CDATA[",l=0,p):(0,Y.jv)(i)?(e.consume(i),r=4,a.interrupt?n:I):t(i)}function f(r){return 45===r?(e.consume(r),a.interrupt?n:I):t(r)}function p(r){return r===o.charCodeAt(l++)?(e.consume(r),l===o.length?a.interrupt?n:F:p):t(r)}function h(n){return(0,Y.jv)(n)?(e.consume(n),o=String.fromCharCode(n),d):t(n)}function d(l){return null===l||47===l||62===l||(0,Y.z3)(l)?47!==l&&i&&Le.includes(o.toLowerCase())?(r=1,a.interrupt?n(l):F(l)):ze.includes(o.toLowerCase())?(r=6,47===l?(e.consume(l),g):a.interrupt?n(l):F(l)):(r=7,a.interrupt&&!a.parser.lazy[a.now().line]?t(l):i?v(l):m(l)):45===l||(0,Y.H$)(l)?(e.consume(l),o+=String.fromCharCode(l),d):t(l)}function g(r){return 62===r?(e.consume(r),a.interrupt?n:F):t(r)}function m(n){return(0,Y.xz)(n)?(e.consume(n),m):S(n)}function v(n){return 47===n?(e.consume(n),S):58===n||95===n||(0,Y.jv)(n)?(e.consume(n),y):(0,Y.xz)(n)?(e.consume(n),v):S(n)}function y(n){return 45===n||46===n||58===n||95===n||(0,Y.H$)(n)?(e.consume(n),y):k(n)}function k(n){return 61===n?(e.consume(n),x):(0,Y.xz)(n)?(e.consume(n),k):v(n)}function x(n){return null===n||60===n||61===n||62===n||96===n?t(n):34===n||39===n?(e.consume(n),u=n,b):(0,Y.xz)(n)?(e.consume(n),x):(u=null,C(n))}function b(n){return null===n||(0,Y.Ch)(n)?t(n):n===u?(e.consume(n),w):(e.consume(n),b)}function C(n){return null===n||34===n||39===n||60===n||61===n||62===n||96===n||(0,Y.z3)(n)?k(n):(e.consume(n),C)}function w(e){return 47===e||62===e||(0,Y.xz)(e)?v(e):t(e)}function S(n){return 62===n?(e.consume(n),A):t(n)}function A(n){return(0,Y.xz)(n)?(e.consume(n),A):null===n||(0,Y.Ch)(n)?F(n):t(n)}function F(n){return 45===n&&2===r?(e.consume(n),z):60===n&&1===r?(e.consume(n),L):62===n&&4===r?(e.consume(n),M):63===n&&3===r?(e.consume(n),I):93===n&&5===r?(e.consume(n),P):!(0,Y.Ch)(n)||6!==r&&7!==r?null===n||(0,Y.Ch)(n)?E(n):(e.consume(n),F):e.check(Pe,M,E)(n)}function E(n){return e.exit("htmlFlowData"),T(n)}function T(n){return null===n?R(n):(0,Y.Ch)(n)?e.attempt({tokenize:D,partial:!0},T,R)(n):(e.enter("htmlFlowData"),F(n))}function D(e,n,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),r};function r(e){return a.parser.lazy[a.now().line]?t(e):n(e)}}function z(n){return 45===n?(e.consume(n),I):F(n)}function L(n){return 47===n?(e.consume(n),o="",O):F(n)}function O(n){return 62===n&&Le.includes(o.toLowerCase())?(e.consume(n),M):(0,Y.jv)(n)&&o.length<8?(e.consume(n),o+=String.fromCharCode(n),O):F(n)}function P(n){return 93===n?(e.consume(n),I):F(n)}function I(n){return 62===n?(e.consume(n),M):45===n&&2===r?(e.consume(n),I):F(n)}function M(n){return null===n||(0,Y.Ch)(n)?(e.exit("htmlFlowData"),R(n)):(e.consume(n),M)}function R(t){return e.exit("htmlFlow"),n(t)}},resolveTo:function(e){var n=e.length;for(;n--&&("enter"!==e[n][0]||"htmlFlow"!==e[n][1].type););n>1&&"linePrefix"===e[n-2][1].type&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2));return e},concrete:!0},Pe={tokenize:function(e,n,t){return function(r){return e.exit("htmlFlowData"),e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),e.attempt(G.w,n,t)}},partial:!0};var Ie={name:"codeFenced",tokenize:function(e,n,t){var r,i=this,o={tokenize:function(e,n,t){var i=0;return(0,W.f)(e,o,"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function o(n){return e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(n)}function l(n){return n===r?(e.consume(n),i++,l):i1&&e[s][1].end.offset-e[s][1].start.offset>1?2:1;var f=Object.assign({},e[t][1].end),p=Object.assign({},e[s][1].start);$e(f,-u),$e(p,u),o={type:u>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[t][1].end)},l={type:u>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[s][1].start),end:p},i={type:u>1?"strongText":"emphasisText",start:Object.assign({},e[t][1].end),end:Object.assign({},e[s][1].start)},r={type:u>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},l.end)},e[t][1].end=Object.assign({},o.start),e[s][1].start=Object.assign({},l.end),a=[],e[t][1].end.offset-e[t][1].start.offset&&(a=(0,X.V)(a,[["enter",e[t][1],n],["exit",e[t][1],n]])),a=(0,X.V)(a,[["enter",r,n],["enter",o,n],["exit",o,n],["enter",i,n]]),a=(0,X.V)(a,(0,fe.C)(n.parser.constructs.insideSpan.null,e.slice(t+1,s),n)),a=(0,X.V)(a,[["exit",i,n],["enter",l,n],["exit",l,n],["exit",r,n]]),e[s][1].end.offset-e[s][1].start.offset?(c=2,a=(0,X.V)(a,[["enter",e[s][1],n],["exit",e[s][1],n]])):c=0,(0,X.d)(e,t-1,s-t+3,a),s=t+a.length-c-2;break}s=-1;for(;++s0&&void 0!==arguments[0]?arguments[0]:{},n=yn({transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(oe),autolinkProtocol:D,autolinkEmail:D,atxHeading:a(ne),blockQuote:a(X),characterEscape:D,characterReference:D,codeFenced:a(K),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:a(K,c),codeText:a(J,c),codeTextData:D,data:D,codeFlowValue:D,definition:a(G),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:a(ee),hardBreakEscape:a(te),hardBreakTrailing:a(te),htmlFlow:a(re,c),htmlFlowData:D,htmlText:a(re,c),htmlTextData:D,image:a(ie),label:c,link:a(oe),listItem:a(ue),listItemValue:m,listOrdered:a(le,g),listUnordered:a(le),paragraph:a(ae),reference:V,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:a(ne),strong:a(ce),thematicBreak:a(fe)},exit:{atxHeading:f(),atxHeadingSequence:A,autolink:f(),autolinkEmail:Q,autolinkProtocol:Y,blockQuote:f(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:W,codeFenced:f(x),codeFencedFence:k,codeFencedFenceInfo:v,codeFencedFenceMeta:y,codeFlowValue:z,codeIndented:f(b),codeText:f(M),codeTextData:z,data:z,definition:f(),definitionDestinationString:S,definitionLabelString:C,definitionTitleString:w,emphasis:f(),hardBreakEscape:f(O),hardBreakTrailing:f(O),htmlFlow:f(P),htmlFlowData:z,htmlText:f(I),htmlTextData:z,image:f(j),label:_,labelText:B,lineEnding:L,link:f(R),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:q,resourceDestinationString:Z,resourceTitleString:H,resource:N,setextHeading:f(T),setextHeadingLineSequence:E,setextHeadingText:F,strong:f(),thematicBreak:f()}},e.mdastExtensions||[]),t={};return r;function r(e){for(var t={type:"root",children:[]},r=[],a=[],f={stack:[t],tokenStack:r,config:n,enter:s,exit:p,buffer:c,resume:d,setData:o,getData:l},h=-1;++h0){var m=r[r.length-1];(m[1]||xn).call(f,void 0,m[0])}for(t.position={start:u(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:u(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},h=-1;++h0&&void 0!==arguments[0]?arguments[0]:{},n=(0,$.W)([r].concat(e.extensions||[])),t={defined:[],lazy:{},constructs:n,content:i(Q),document:i(K),flow:i(ie),string:i(le),text:i(ue)};return t;function i(e){return function(n){return pe(t,e,n)}}}(t).document().write(function(){var e,n=1,t="",r=!0;return function(i,o,l){var u,a,c,s,f,p=[];for(i=t+i.toString(o),c=0,t="",r&&(65279===i.charCodeAt(0)&&c++,r=void 0);c-1?t.offset:null}}}var Tn={}.hasOwnProperty;function Dn(e){return String(e||"").toUpperCase()}var zn={}.hasOwnProperty;function Ln(e,n){var t=n.data||{};return"value"in n&&!(zn.call(t,"hName")||zn.call(t,"hProperties")||zn.call(t,"hChildren"))?e.augment(n,Cn("text",n.value)):e(n,"div",In(e,n))}function On(e,n,t){var r,i=n&&n.type;if(!i)throw new Error("Expected node, got `"+n+"`");return("function"===typeof(r=zn.call(e.handlers,i)?e.handlers[i]:e.passThrough&&e.passThrough.includes(i)?Pn:e.unknownHandler)?r:Ln)(e,n,t)}function Pn(e,n){return"children"in n?(0,o.Z)((0,o.Z)({},n),{},{children:In(e,n)}):n}function In(e,n){var t=[];if("children"in n)for(var r=n.children,i=-1;++i55295&&o<57344){var u=e.charCodeAt(t+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),i=1):l="\ufffd"}else l=String.fromCharCode(o);l&&(n.push(e.slice(r,t),encodeURIComponent(l)),r=t+i+1,l=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function Rn(e,n){var t=[],r=-1;for(n&&t.push(Cn("text","\n"));++r0&&t.push(Cn("text","\n")),t}function jn(e,n){var t,r=String(n.identifier),i=Mn(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);-1===o?(e.footnoteOrder.push(r),e.footnoteCounts[r]=1,t=e.footnoteOrder.length):(e.footnoteCounts[r]++,t=o+1);var l=e.footnoteCounts[r];return e(n,"sup",[e(n.position,"a",{href:"#"+e.clobberPrefix+"fn-"+i,id:e.clobberPrefix+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:"footnote-label"},[Cn("text",String(t))])])}function Bn(e,n){var t=n.referenceType,r="]";if("collapsed"===t?r+="[]":"full"===t&&(r+="["+(n.label||n.identifier)+"]"),"imageReference"===n.type)return Cn("text","!["+n.alt+r);var i=In(e,n),o=i[0];o&&"text"===o.type?o.value="["+o.value:i.unshift(Cn("text","["));var l=i[i.length-1];return l&&"text"===l.type?l.value+=r:i.push(Cn("text",r)),i}function _n(e){var n=e.spread;return void 0===n||null===n?e.children.length>1:n}function Zn(e,n,t){var r=0,i=e.length;if(n)for(var o=e.codePointAt(r);9===o||32===o;)r++,o=e.codePointAt(r);if(t)for(var l=e.codePointAt(i-1);9===l||32===l;)i--,l=e.codePointAt(i-1);return i>r?e.slice(r,i):""}var Hn={blockquote:function(e,n){return e(n,"blockquote",Rn(In(e,n),!0))},break:function(e,n){return[e(n,"br"),Cn("text","\n")]},code:function(e,n){var t=n.value?n.value+"\n":"",r=n.lang&&n.lang.match(/^[^ \t]+(?=[ \t]|$)/),i={};r&&(i.className=["language-"+r]);var o=e(n,"code",i,[Cn("text",t)]);return n.meta&&(o.data={meta:n.meta}),e(n.position,"pre",[o])},delete:function(e,n){return e(n,"del",In(e,n))},emphasis:function(e,n){return e(n,"em",In(e,n))},footnoteReference:jn,footnote:function(e,n){for(var t=e.footnoteById,r=1;r in t;)r++;var i=String(r);return t[i]={type:"footnoteDefinition",identifier:i,children:[{type:"paragraph",children:n.children}],position:n.position},jn(e,{type:"footnoteReference",identifier:i,position:n.position})},heading:function(e,n){return e(n,"h"+n.depth,In(e,n))},html:function(e,n){return e.dangerous?e.augment(n,Cn("raw",n.value)):null},imageReference:function(e,n){var t=e.definition(n.identifier);if(!t)return Bn(e,n);var r={src:Mn(t.url||""),alt:n.alt};return null!==t.title&&void 0!==t.title&&(r.title=t.title),e(n,"img",r)},image:function(e,n){var t={src:Mn(n.url),alt:n.alt};return null!==n.title&&void 0!==n.title&&(t.title=n.title),e(n,"img",t)},inlineCode:function(e,n){return e(n,"code",[Cn("text",n.value.replace(/\r?\n|\r/g," "))])},linkReference:function(e,n){var t=e.definition(n.identifier);if(!t)return Bn(e,n);var r={href:Mn(t.url||"")};return null!==t.title&&void 0!==t.title&&(r.title=t.title),e(n,"a",r,In(e,n))},link:function(e,n){var t={href:Mn(n.url)};return null!==n.title&&void 0!==n.title&&(t.title=n.title),e(n,"a",t,In(e,n))},listItem:function(e,n,t){var r,i=In(e,n),o=t?function(e){var n=e.spread,t=e.children,r=-1;for(;!n&&++r0&&r.children.unshift(Cn("text"," ")),r.children.unshift(e(null,"input",{type:"checkbox",checked:n.checked,disabled:!0})),l.className=["task-list-item"]);for(var c=-1;++c0,!0),r[0]),i=r.index+r[0].length,r=t.exec(n);return o.push(Zn(n.slice(i),i>0,!1)),o.join("")}(String(n.value))))},thematicBreak:function(e,n){return e(n,"hr")},toml:Nn,yaml:Nn,definition:Nn,footnoteDefinition:Nn};function Nn(){return null}var Un={}.hasOwnProperty;function Vn(e,n){var t=n||{},r=t.allowDangerousHtml||!1,i={};return u.dangerous=r,u.clobberPrefix=void 0===t.clobberPrefix||null===t.clobberPrefix?"user-content-":t.clobberPrefix,u.footnoteLabel=t.footnoteLabel||"Footnotes",u.footnoteLabelTagName=t.footnoteLabelTagName||"h2",u.footnoteLabelProperties=t.footnoteLabelProperties||{className:["sr-only"]},u.footnoteBackLabel=t.footnoteBackLabel||"Back to content",u.definition=function(e){var n=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Sn(e,"definition",(function(e){var t=Dn(e.identifier);t&&!Tn.call(n,t)&&(n[t]=e)})),function(e){var t=Dn(e);return t&&Tn.call(n,t)?n[t]:null}}(e),u.footnoteById=i,u.footnoteOrder=[],u.footnoteCounts={},u.augment=l,u.handlers=(0,o.Z)((0,o.Z)({},Hn),t.handlers),u.unknownHandler=t.unknownHandler,u.passThrough=t.passThrough,Sn(e,"footnoteDefinition",(function(e){var n=String(e.identifier).toUpperCase();Un.call(i,n)||(i[n]=e)})),u;function l(e,n){if(e&&"data"in e&&e.data){var t=e.data;t.hName&&("element"!==n.type&&(n={type:"element",tagName:"",properties:{},children:[]}),n.tagName=t.hName),"element"===n.type&&t.hProperties&&(n.properties=(0,o.Z)((0,o.Z)({},n.properties),t.hProperties)),"children"in n&&n.children&&t.hChildren&&(n.children=t.hChildren)}if(e){var r="type"in e?e:{position:e};(i=r)&&i.position&&i.position.start&&i.position.start.line&&i.position.start.column&&i.position.end&&i.position.end.line&&i.position.end.column&&(n.position={start:An(r),end:Fn(r)})}var i;return n}function u(e,n,t,r){return Array.isArray(t)&&(r=t,t={}),l(e,{type:"element",tagName:n,properties:t||{},children:r||[]})}}function qn(e,n){var t=Vn(e,n),r=On(t,e,null),i=function(e){for(var n=-1,t=[];++n1?"-"+a:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:e.footnoteBackLabel},children:[{type:"text",value:"\u21a9"}]};a>1&&s.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(a)}]}),c.length>0&&c.push({type:"text",value:" "}),c.push(s)}var f=i[i.length-1];if(f&&"element"===f.type&&"p"===f.tagName){var p,h=f.children[f.children.length-1];h&&"text"===h.type?h.value+=" ":f.children.push({type:"text",value:" "}),(p=f.children).push.apply(p,c)}else i.push.apply(i,c);var d={type:"element",tagName:"li",properties:{id:e.clobberPrefix+"fn-"+u},children:Rn(i,!0)};r.position&&(d.position=r.position),t.push(d)}}return 0===t.length?null:{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:e.footnoteLabelTagName,properties:(0,o.Z)((0,o.Z)({},JSON.parse(JSON.stringify(e.footnoteLabelProperties))),{},{id:"footnote-label"}),children:[Cn("text",e.footnoteLabel)]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:Rn(t,!0)},{type:"text",value:"\n"}]}}(t);return i&&r.children.push(Cn("text","\n"),i),Array.isArray(r)?{type:"root",children:r}:r}var $n=function(e,n){return e&&"run"in e?function(e,n){return function(t,r,i){e.run(qn(t,n),r,(function(e){i(e)}))}}(e,n):function(e){return function(n){return qn(n,e)}}(e||n)};var Wn=t(7630),Yn=(0,c.Z)((function e(n,t,r){(0,a.Z)(this,e),this.property=n,this.normal=t,r&&(this.space=r)}));function Qn(e,n){for(var t={},r={},i=-1;++i0?l.createElement(d,c,f):l.createElement(d,c)}function Bt(e,n){for(var t=-1,r=0;++t4&&"data"===t.slice(0,4)&&Et.test(n)){if("-"===n.charAt(4)){var o=n.slice(5).replace(Tt,Lt);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{var l=n.slice(4);if(!Tt.test(l)){var u=l.replace(Dt,zt);"-"!==u.charAt(0)&&(u="-"+u),n="data"+u}}i=ct}return new i(r,n)}(r.schema,n),o=t;null!==o&&void 0!==o&&o===o&&(Array.isArray(o)&&(o=i.commaSeparated?function(e,n){var t=n||{};return(""===e[e.length-1]?[].concat((0,u.Z)(e),[""]):e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(o):o.join(" ").trim()),"style"===i.property&&"string"===typeof o&&(o=function(e){var n={};try{Pt(e,t)}catch(r){}return n;function t(e,t){var r="-ms-"===e.slice(0,4)?"ms-".concat(e.slice(4)):e;n[r.replace(/-([a-z])/g,Zt)]=t}}(o)),i.space&&i.property?e[It.call(Ot,i.property)?Ot[i.property]:i.property]=o:i.attribute&&(e[i.attribute]=o))}function Zt(e,n){return n.toUpperCase()}var Ht={}.hasOwnProperty,Nt={plugins:{to:"plugins",id:"change-plugins-to-remarkplugins"},renderers:{to:"components",id:"change-renderers-to-components"},astPlugins:{id:"remove-buggy-html-in-markdown-parser"},allowDangerousHtml:{id:"remove-buggy-html-in-markdown-parser"},escapeHtml:{id:"remove-buggy-html-in-markdown-parser"},source:{to:"children",id:"change-source-to-children"},allowNode:{to:"allowElement",id:"replace-allownode-allowedtypes-and-disallowedtypes"},allowedTypes:{to:"allowedElements",id:"replace-allownode-allowedtypes-and-disallowedtypes"},disallowedTypes:{to:"disallowedElements",id:"replace-allownode-allowedtypes-and-disallowedtypes"},includeNodeIndex:{to:"includeElementIndex",id:"change-includenodeindex-to-includeelementindex"}};function Ut(e){for(var n in Nt)if(Ht.call(Nt,n)&&Ht.call(e,n)){var t=Nt[n];console.warn("[react-markdown] Warning: please ".concat(t.to?"use `".concat(t.to,"` instead of"):"remove"," `").concat(n,"` (see <").concat("https://github.com/remarkjs/react-markdown/blob/main/changelog.md","#").concat(t.id,"> for more info)")),delete Nt[n]}var r=I().use(bn).use(e.remarkPlugins||[]).use($n,(0,o.Z)((0,o.Z)({},e.remarkRehypeOptions),{},{allowDangerousHtml:!0})).use(e.rehypePlugins||[]).use(wt,e),i=new A;"string"===typeof e.children?i.value=e.children:void 0!==e.children&&null!==e.children&&console.warn("[react-markdown] Warning: please pass a string as `children` (not: `".concat(e.children,"`)"));var u=r.runSync(r.parse(i),i);if("root"!==u.type)throw new TypeError("Expected a `root` node");var a=l.createElement(l.Fragment,{},Rt({options:e,schema:bt,listDepth:0},u));return e.className&&(a=l.createElement("div",{className:e.className},a)),a}Ut.defaultProps={transformLinkUri:St.A},Ut.propTypes={children:Wn.string,className:Wn.string,allowElement:Wn.func,allowedElements:Wn.arrayOf(Wn.string),disallowedElements:Wn.arrayOf(Wn.string),unwrapDisallowed:Wn.bool,remarkPlugins:Wn.arrayOf(Wn.oneOfType([Wn.object,Wn.func,Wn.arrayOf(Wn.oneOfType([Wn.bool,Wn.string,Wn.object,Wn.func,Wn.arrayOf(Wn.any)]))])),rehypePlugins:Wn.arrayOf(Wn.oneOfType([Wn.object,Wn.func,Wn.arrayOf(Wn.oneOfType([Wn.bool,Wn.string,Wn.object,Wn.func,Wn.arrayOf(Wn.any)]))])),sourcePos:Wn.bool,rawSourcePos:Wn.bool,skipHtml:Wn.bool,includeElementIndex:Wn.bool,transformLinkUri:Wn.oneOfType([Wn.func,Wn.bool]),linkTarget:Wn.oneOfType([Wn.func,Wn.string]),transformImageUri:Wn.func,components:Wn.object}},6776:function(e,n,t){"use strict";t.d(n,{A:function(){return i}});var r=["http","https","mailto","tel"];function i(e){var n=(e||"").trim(),t=n.charAt(0);if("#"===t||"/"===t)return n;var i=n.indexOf(":");if(-1===i)return n;for(var o=-1;++oo||-1!==(o=n.indexOf("#"))&&i>o?n:"javascript:void(0)"}},3102:function(e,n,t){"use strict";t.d(n,{Z:function(){return Ze}});for(var r=t(5152),i=t(1964),o={tokenize:function(e,n,t){return function(n){return e.consume(n),r};function r(n){return 87===n||119===n?(e.consume(n),o):t(n)}function o(n){return 87===n||119===n?(e.consume(n),l):t(n)}function l(n){return 46===n?(e.consume(n),u):t(n)}function u(e){return null===e||(0,i.Ch)(e)?t(e):n(e)}},partial:!0},l={tokenize:function(e,n,t){var r,o;return l;function l(n){return 38===n?e.check(c,s,u)(n):46===n||95===n?e.check(a,s,u)(n):null===n||(0,i.Av)(n)||(0,i.B8)(n)||45!==n&&(0,i.Xh)(n)?s(n):(e.consume(n),l)}function u(n){return 46===n?(o=r,r=void 0,e.consume(n),l):(95===n&&(r=!0),e.consume(n),l)}function s(e){return o||r?t(e):n(e)}},partial:!0},u={tokenize:function(e,n){var t=0;return r;function r(l){return 38===l?e.check(c,n,i)(l):(40===l&&t++,41===l?e.check(a,o,i)(l):v(l)?n(l):m(l)?e.check(a,n,i)(l):(e.consume(l),r))}function i(n){return e.consume(n),r}function o(e){return--t<0?n(e):i(e)}},partial:!0},a={tokenize:function(e,n,t){return function(n){return e.consume(n),r};function r(i){return m(i)?(e.consume(i),r):v(i)?n(i):t(i)}},partial:!0},c={tokenize:function(e,n,t){return function(n){return e.consume(n),r};function r(n){return(0,i.jv)(n)?(e.consume(n),r):59===n?(e.consume(n),o):t(n)}function o(e){return v(e)?n(e):t(e)}},partial:!0},s={tokenize:function(e,n,t){var r=this;return function(n){if(87!==n&&119!==n||!k(r.previous)||C(r.events))return t(n);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(o,e.attempt(l,e.attempt(u,i),t),t)(n)};function i(t){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(t)}},previous:k},f={tokenize:function(e,n,t){var r=this;return function(n){if(72!==n&&104!==n||!x(r.previous)||C(r.events))return t(n);return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),e.consume(n),o};function o(n){return 84===n||116===n?(e.consume(n),a):t(n)}function a(n){return 84===n||116===n?(e.consume(n),c):t(n)}function c(n){return 80===n||112===n?(e.consume(n),s):t(n)}function s(n){return 83===n||115===n?(e.consume(n),f):f(n)}function f(n){return 58===n?(e.consume(n),p):t(n)}function p(n){return 47===n?(e.consume(n),h):t(n)}function h(n){return 47===n?(e.consume(n),d):t(n)}function d(n){return null===n||(0,i.Av)(n)||(0,i.B8)(n)||(0,i.Xh)(n)?t(n):e.attempt(l,e.attempt(u,g),t)(n)}function g(t){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(t)}},previous:x},p={tokenize:function(e,n,t){var r,o,l=this;return function(n){if(!y(n)||!b(l.previous)||C(l.events))return t(n);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(n)};function u(n){return y(n)?(e.consume(n),u):64===n?(e.consume(n),c):t(n)}function c(n){return 46===n?e.check(a,h,s)(n):45===n||95===n?e.check(a,t,f)(n):(0,i.H$)(n)?(!o&&(0,i.pY)(n)&&(o=!0),e.consume(n),c):h(n)}function s(n){return e.consume(n),r=!0,o=void 0,c}function f(n){return e.consume(n),p}function p(n){return 46===n?e.check(a,t,s)(n):c(n)}function h(i){return r&&!o?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(i)):t(i)}},previous:b},h={},d={text:h},g=48;g<123;)h[g]=p,58===++g?g=65:91===g&&(g=97);function m(e){return 33===e||34===e||39===e||41===e||42===e||44===e||46===e||58===e||59===e||60===e||63===e||95===e||126===e}function v(e){return null===e||60===e||(0,i.z3)(e)}function y(e){return 43===e||45===e||46===e||95===e||(0,i.H$)(e)}function k(e){return null===e||40===e||42===e||95===e||126===e||(0,i.z3)(e)}function x(e){return null===e||!(0,i.jv)(e)}function b(e){return 47!==e&&x(e)}function C(e){for(var n=e.length,t=!1;n--;){var r=e[n][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){t=!0;break}if(r._gfmAutolinkLiteralWalkedInto){t=!1;break}}return e.length>0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}h[43]=p,h[45]=p,h[46]=p,h[95]=p,h[72]=[p,f],h[104]=[p,f],h[87]=[p,s],h[119]=[p,s];var w=t(4649),S=t(6848),A=t(5561),F=t(7184),E={tokenize:function(e,n,t){var r=this;return(0,A.f)(e,(function(e){var i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?n(e):t(e)}),"gfmFootnoteDefinitionIndent",5)},partial:!0};function T(){var e;return{document:(0,w.Z)({},91,{tokenize:O,continuation:{tokenize:P},exit:I}),text:(e={},(0,w.Z)(e,91,{tokenize:L}),(0,w.Z)(e,93,{add:"after",tokenize:D,resolveTo:z}),e)}}function D(e,n,t){for(var r,i=this,o=i.events.length,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);o--;){var u=i.events[o][1];if("labelImage"===u.type){r=u;break}if("gfmFootnoteCall"===u.type||"labelLink"===u.type||"label"===u.type||"image"===u.type||"link"===u.type)break}return function(o){if(!r||!r._balanced)return t(o);var u=(0,F.d)(i.sliceSerialize({start:r.end,end:i.now()}));if(94!==u.charCodeAt(0)||!l.includes(u.slice(1)))return t(o);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),n(o)}}function z(e,n){for(var t=e.length;t--;)if("labelImage"===e[t][1].type&&"enter"===e[t][0]){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";var r={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;var o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[t+1],e[t+2],["enter",r,n],e[t+3],e[t+4],["enter",i,n],["exit",i,n],["enter",o,n],["enter",l,n],["exit",l,n],["exit",o,n],e[e.length-2],e[e.length-1],["exit",r,n]];return e.splice.apply(e,[t,e.length-t+1].concat(u)),e}function L(e,n,t){var r,o=this,l=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),u=0;return function(n){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(n),e.exit("gfmFootnoteCallLabelMarker"),a};function a(n){return 94!==n?t(n):(e.enter("gfmFootnoteCallMarker"),e.consume(n),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(a){var f;return null===a||91===a||u++>999?t(a):93===a?r?(e.exit("chunkString"),f=e.exit("gfmFootnoteCallString"),l.includes((0,F.d)(o.sliceSerialize(f)))?function(t){return e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n}(a):t(a)):t(a):(e.consume(a),(0,i.z3)(a)||(r=!0),92===a?s:c)}function s(n){return 91===n||92===n||93===n?(e.consume(n),u++,c):c(n)}}function O(e,n,t){var r,o,l=this,u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]),a=0;return function(n){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(n),e.exit("gfmFootnoteDefinitionLabelMarker"),c};function c(n){return 94===n?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(n),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),s):t(n)}function s(n){var u;return null===n||91===n||a>999?t(n):93===n?o?(u=e.exit("gfmFootnoteDefinitionLabelString"),r=(0,F.d)(l.sliceSerialize(u)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(n),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h):t(n):(0,i.Ch)(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),a++,s):(e.enter("chunkString").contentType="string",f(n))}function f(n){return null===n||(0,i.Ch)(n)||91===n||93===n||a>999?(e.exit("chunkString"),s(n)):((0,i.z3)(n)||(o=!0),a++,e.consume(n),92===n?p:f)}function p(n){return 91===n||92===n||93===n?(e.consume(n),a++,f):f(n)}function h(n){return 58===n?(e.enter("definitionMarker"),e.consume(n),e.exit("definitionMarker"),(0,A.f)(e,d,"gfmFootnoteDefinitionWhitespace")):t(n)}function d(e){return u.includes(r)||u.push(r),n(e)}}function P(e,n,t){return e.check(S.w,n,e.attempt(E,n,t))}function I(e){e.exit("gfmFootnoteDefinition")}var M=t(4115),R=t(762),j=t(2771);function B(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.singleTilde,t={tokenize:i,resolveAll:r};return null!==n&&void 0!==n||(n=!0),{text:(0,w.Z)({},126,t),insideSpan:{null:[t]},attentionMarkers:{null:[126]}};function r(e,n){for(var t=-1;++t1?r(o):(e.consume(o),l++,u);if(l<2&&!n)return r(o);var c=e.exit("strikethroughSequenceTemporary"),s=(0,R.r)(o);return c._open=!s||2===s&&Boolean(a),c._close=!a||2===a&&Boolean(s),t(o)}}}var _={flow:{null:{tokenize:function(e,n,t){var r,o,l=this,u=[],a=0;return function(n){if(e.enter("table")._align=u,e.enter("tableHead"),e.enter("tableRow"),124===n)return c(n);return a++,e.enter("temporaryTableCellContent"),p(n)};function c(n){return e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),r=!0,s}function s(n){return null===n||(0,i.Ch)(n)?function(n){if(null===n)return t(n);e.exit("tableRow"),e.exit("tableHead");var r=l.interrupt;return l.interrupt=!0,e.attempt({tokenize:z,partial:!0},(function(n){return l.interrupt=r,e.enter("tableDelimiterRow"),d(n)}),(function(e){return l.interrupt=r,t(e)}))(n)}(n):(0,i.xz)(n)?(e.enter("whitespace"),e.consume(n),f):(r&&(r=void 0,a++),124===n?c(n):(e.enter("temporaryTableCellContent"),p(n)))}function f(n){return(0,i.xz)(n)?(e.consume(n),f):(e.exit("whitespace"),s(n))}function p(n){return null===n||124===n||(0,i.z3)(n)?(e.exit("temporaryTableCellContent"),s(n)):(e.consume(n),92===n?h:p)}function h(n){return 92===n||124===n?(e.consume(n),p):p(n)}function d(n){return null===n||(0,i.Ch)(n)?k(n):(0,i.xz)(n)?(e.enter("whitespace"),e.consume(n),g):45===n?(e.enter("tableDelimiterFiller"),e.consume(n),o=!0,u.push("none"),m):58===n?(e.enter("tableDelimiterAlignment"),e.consume(n),e.exit("tableDelimiterAlignment"),u.push("left"),v):124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),d):t(n)}function g(n){return(0,i.xz)(n)?(e.consume(n),g):(e.exit("whitespace"),d(n))}function m(n){return 45===n?(e.consume(n),m):(e.exit("tableDelimiterFiller"),58===n?(e.enter("tableDelimiterAlignment"),e.consume(n),e.exit("tableDelimiterAlignment"),u[u.length-1]="left"===u[u.length-1]?"center":"right",y):d(n))}function v(n){return 45===n?(e.enter("tableDelimiterFiller"),e.consume(n),o=!0,m):t(n)}function y(n){return null===n||(0,i.Ch)(n)?k(n):(0,i.xz)(n)?(e.enter("whitespace"),e.consume(n),g):124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),d):t(n)}function k(n){return e.exit("tableDelimiterRow"),o&&a===u.length?null===n?x(n):e.check(Z,x,e.attempt({tokenize:z,partial:!0},(0,A.f)(e,b,"linePrefix",4),x))(n):t(n)}function x(t){return e.exit("table"),n(t)}function b(n){return e.enter("tableBody"),C(n)}function C(n){return e.enter("tableRow"),124===n?w(n):(e.enter("temporaryTableCellContent"),E(n))}function w(n){return e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),S}function S(n){return null===n||(0,i.Ch)(n)?function(n){if(e.exit("tableRow"),null===n)return D(n);return e.check(Z,D,e.attempt({tokenize:z,partial:!0},(0,A.f)(e,C,"linePrefix",4),D))(n)}(n):(0,i.xz)(n)?(e.enter("whitespace"),e.consume(n),F):124===n?w(n):(e.enter("temporaryTableCellContent"),E(n))}function F(n){return(0,i.xz)(n)?(e.consume(n),F):(e.exit("whitespace"),S(n))}function E(n){return null===n||124===n||(0,i.z3)(n)?(e.exit("temporaryTableCellContent"),S(n)):(e.consume(n),92===n?T:E)}function T(n){return 92===n||124===n?(e.consume(n),E):E(n)}function D(n){return e.exit("tableBody"),x(n)}function z(e,n,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,A.f)(e,r,"linePrefix")};function r(r){if(l.parser.lazy[l.now().line]||null===r||(0,i.Ch)(r))return t(r);var o=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(r):(l._gfmTableDynamicInterruptHack=!0,e.check(l.parser.constructs.flow,(function(e){return l._gfmTableDynamicInterruptHack=!1,t(e)}),(function(e){return l._gfmTableDynamicInterruptHack=!1,n(e)}))(r))}}},resolve:function(e,n){var t,r,i,o,l,u,a,c=-1;for(;++c0?{type:"text",value:d}:void 0),!1!==d){var g;if(l!==t&&f.push({type:"text",value:e.value.slice(l,t)}),Array.isArray(d))(g=f).push.apply(g,(0,$.Z)(d));else d&&f.push(d);l=t+p[0].length,s=!0}if(!i.global)break;p=i.exec(e.value)}if(s){var m;l?\]}]+$/.exec(e);if(o)for(e=e.slice(0,o.index),n=(i=o[0]).indexOf(")"),t=q(e,"("),r=q(e,")");-1!==n&&t>r;)e+=i.slice(0,n+1),n=(i=i.slice(n+1)).indexOf(")"),r++;return[e,i]}(t+r);if(!l[0])return!1;var u={type:"link",title:null,url:o+n+l[0],children:[{type:"text",value:n+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function oe(e,n,t,r){return!(!le(r,!0)||/[_-\d]$/.test(t))&&{type:"link",title:null,url:"mailto:"+n+"@"+t,children:[{type:"text",value:n+"@"+t}]}}function le(e,n){var t=e.input.charCodeAt(e.index-1);return(0===e.index||(0,i.B8)(t)||(0,i.Xh)(t))&&(!n||47!==t)}var ue=t(189),ae=t(1522);function ce(e){return e.label||!e.identifier?e.label||"":(0,ae.v)(e.identifier)}function se(e){var n=e||{},t=n.now||{},r=n.lineShift||0,i=t.line||1,o=t.column||1;return{move:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=e.split(/\r?\n|\r/g),t=n[n.length-1];return i+=n.length-1,o=1===n.length?o+t.length:1+t.length+r,e},current:function(){return{now:{line:i,column:o},lineShift:r}},shift:function(e){r+=e}}}function fe(e,n,t){var r=n.indexStack,i=e.children||[],o=se(t),l=[],u=-1;for(r.push(-1);++u=g||(m+10?" ":"")),i.shift(4),o+=i.move(he(fe(e,t,i.current()),(function(e,n,t){if(n)return(t?"":" ")+e;return e}))),l(),o},footnoteReference:e}};function e(e,n,t,r){var i=se(r),o=i.move("[^"),l=t.enter("footnoteReference"),u=t.enter("reference");return o+=i.move(ve(t,ce(e),(0,ue.Z)((0,ue.Z)({},i.current()),{},{before:o,after:"]"}))),u(),l(),o+=i.move("]")}}function be(e,n,t){var r=n.indexStack,i=e.children||[],o=[],l=-1,u=t.before;r.push(-1);for(var a=se(t);++l0&&("\r"===u||"\n"===u)&&"html"===c.type&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),u=" ",(a=se(t)).move(o.join(""))),o.push(a.move(n.handle(c,e,n,(0,ue.Z)((0,ue.Z)({},a.current()),{},{before:u,after:s})))),u=o[o.length-1].slice(-1)}return r.pop(),o.join("")}var Ce={canContainEols:["delete"],enter:{strikethrough:function(e){this.enter({type:"delete",children:[]},e)}},exit:{strikethrough:function(e){this.exit(e)}}},we={unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"]}],handlers:{delete:Se}};function Se(e,n,t,r){var i=se(r),o=t.enter("emphasis"),l=i.move("~~");return l+=be(e,t,(0,ue.Z)((0,ue.Z)({},i.current()),{},{before:l,after:"~"})),l+=i.move("~~"),o(),l}function Ae(e,n,t){for(var r=e.value||"",i="`",o=-1;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o1&&void 0!==arguments[1]?arguments[1]:{},t=(n.align||[]).concat(),r=n.stringLength||Ee,i=[],o=[],l=[],u=[],a=0,c=-1;++ca&&(a=e[c].length);++pu[p])&&(u[p]=d)}s.push(h)}o[c]=s,l[c]=f}var g=-1;if("object"===typeof t&&"length"in t)for(;++gu[g]&&(u[g]=C),y[g]=C),v[g]=w}o.splice(1,0,v),l.splice(1,0,y),c=-1;for(var S=[];++c-1?n.start:1)+(!1===t.options.incrementListMarker?0:n.children.indexOf(e))+o);var l=o.length+1;("tab"===i||"mixed"===i&&(n&&"list"===n.type&&n.spread||e.spread))&&(l=4*Math.ceil(l/4));var u=se(r);u.move(o+" ".repeat(l-o.length)),u.shift(l);var a=t.enter("listItem"),c=he(fe(e,t,u.current()),(function(e,n,t){if(n)return(t?"":" ".repeat(l))+e;return(t?o:o+" ".repeat(l-o.length))+e}));return a(),c}var Me={exit:{taskListCheckValueChecked:je,taskListCheckValueUnchecked:je,paragraph:function(e){var n,t=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1],i=t.children,o=r.children[0],l=-1;if(t&&"listItem"===t.type&&"boolean"===typeof t.checked&&o&&"text"===o.type){for(;++l0&&void 0!==arguments[0]?arguments[0]:{},n=this.data();function t(e,t){(n[e]?n[e]:n[e]=[]).push(t)}t("micromarkExtensions",V(e)),t("fromMarkdownExtensions",Be()),t("toMarkdownExtensions",_e(e))}},7775:function(e,n,t){"use strict";t.d(n,{O:function(){return r}});var r=function(e){if(void 0===e||null===e)return l;if("string"===typeof e)return function(e){return o(n);function n(n){return n&&n.type===e}}(e);if("object"===typeof e)return Array.isArray(e)?i(e):function(e){return o(n);function n(n){var t;for(t in e)if(n[t]!==e[t])return!1;return!0}}(e);if("function"===typeof e)return o(e);throw new Error("Expected function, string, or object as test")};function i(e){for(var n=[],t=-1;++t":"")+")"}));return f;function f(){var c,s,f,p=[];if((!n||o(r,u,a[a.length-1]||null))&&(p=function(e){if(Array.isArray(e))return e;if("number"===typeof e)return[true,e];return[e]}(t(r,a)),false===p[0]))return p;if(r.children&&"skip"!==p[0])for(s=(i?r.children.length:-1)+l,f=a.concat(r);s>-1&&s + * @license MIT + */ + +/** + * @license React + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ diff --git a/build/static/js/813.65f1d443.chunk.js.map b/build/static/js/813.65f1d443.chunk.js.map new file mode 100644 index 000000000..2e9a9748c --- /dev/null +++ b/build/static/js/813.65f1d443.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/813.65f1d443.chunk.js","mappings":";qHAEA,IAAIA,EAASC,OAAOC,UAAUC,eAC1BC,EAAQH,OAAOC,UAAUG,SACzBC,EAAiBL,OAAOK,eACxBC,EAAON,OAAOO,yBAEdC,EAAU,SAAiBC,GAC9B,MAA6B,oBAAlBC,MAAMF,QACTE,MAAMF,QAAQC,GAGK,mBAApBN,EAAMQ,KAAKF,EACnB,EAEIG,EAAgB,SAAuBC,GAC1C,IAAKA,GAA2B,oBAApBV,EAAMQ,KAAKE,GACtB,OAAO,EAGR,IASIC,EATAC,EAAoBhB,EAAOY,KAAKE,EAAK,eACrCG,EAAmBH,EAAII,aAAeJ,EAAII,YAAYhB,WAAaF,EAAOY,KAAKE,EAAII,YAAYhB,UAAW,iBAE9G,GAAIY,EAAII,cAAgBF,IAAsBC,EAC7C,OAAO,EAMR,IAAKF,KAAOD,GAEZ,MAAsB,qBAARC,GAAuBf,EAAOY,KAAKE,EAAKC,EACvD,EAGII,EAAc,SAAqBC,EAAQC,GAC1Cf,GAAmC,cAAjBe,EAAQC,KAC7BhB,EAAec,EAAQC,EAAQC,KAAM,CACpCC,YAAY,EACZC,cAAc,EACdC,MAAOJ,EAAQK,SACfC,UAAU,IAGXP,EAAOC,EAAQC,MAAQD,EAAQK,QAEjC,EAG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AEjDunB,EAAep+B,EAAQb,OAAOvtB,GAGvB+V,GAAU,GAAKA,EAAS/V,EAAK2T,SAASpV,QAAQ,CAInD,GArGM,SAmGNguD,EAAYr6B,EAAQlyB,EAAK2T,SAASoC,GAASA,EAAQy2C,EAAvCt6B,IAEE,GACZ,OAAOq6B,EAGTx2C,EAC0B,kBAAjBw2C,EAAU,GAAkBA,EAAU,GAAKx2C,EAASkvB,CAC/D,CAGF,OAAO33B,CACT,CACF,CAzEA4kB,CAAQrf,EAAM,KAAM,GAApBqf,EA0EF","sources":["../../node_modules/extend/index.js","../../node_modules/inline-style-parser/index.js","../../node_modules/is-buffer/index.js","../../node_modules/react-markdown/node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-markdown/node_modules/react-is/index.js","../../node_modules/style-to-object/index.js","../../node_modules/decode-named-character-reference/index.dom.js","../../node_modules/micromark-core-commonmark/lib/blank-line.js","../../node_modules/micromark-factory-space/index.js","../../node_modules/micromark-util-character/lib/unicode-punctuation-regex.js","../../node_modules/micromark-util-character/index.js","../../node_modules/micromark-util-chunked/index.js","../../node_modules/micromark-util-classify-character/index.js","../../node_modules/micromark-util-combine-extensions/index.js","../../node_modules/micromark-util-decode-numeric-character-reference/index.js","../../node_modules/micromark-util-decode-string/index.js","../../node_modules/micromark-util-normalize-identifier/index.js","../../node_modules/micromark-util-resolve-all/index.js","../../node_modules/unist-util-stringify-position/index.js","../../node_modules/vfile-message/index.js","../../node_modules/vfile/lib/minpath.browser.js","../../node_modules/vfile/lib/minproc.browser.js","../../node_modules/vfile/lib/minurl.shared.js","../../node_modules/vfile/lib/minurl.browser.js","../../node_modules/vfile/lib/index.js","../../node_modules/bail/index.js","../../node_modules/is-plain-obj/index.js","../../node_modules/trough/index.js","../../node_modules/unified/lib/index.js","../../node_modules/mdast-util-to-string/index.js","../../node_modules/micromark/lib/initialize/content.js","../../node_modules/micromark/lib/initialize/document.js","../../node_modules/micromark-util-subtokenize/index.js","../../node_modules/micromark-core-commonmark/lib/content.js","../../node_modules/micromark/lib/initialize/flow.js","../../node_modules/micromark/lib/initialize/text.js","../../node_modules/micromark/lib/create-tokenizer.js","../../node_modules/micromark-core-commonmark/lib/thematic-break.js","../../node_modules/micromark-core-commonmark/lib/list.js","../../node_modules/micromark-core-commonmark/lib/block-quote.js","../../node_modules/micromark-factory-destination/index.js","../../node_modules/micromark-factory-label/index.js","../../node_modules/micromark-factory-title/index.js","../../node_modules/micromark-factory-whitespace/index.js","../../node_modules/micromark-core-commonmark/lib/definition.js","../../node_modules/micromark-core-commonmark/lib/code-indented.js","../../node_modules/micromark-core-commonmark/lib/heading-atx.js","../../node_modules/micromark-core-commonmark/lib/setext-underline.js","../../node_modules/micromark-util-html-tag-name/index.js","../../node_modules/micromark-core-commonmark/lib/html-flow.js","../../node_modules/micromark-core-commonmark/lib/code-fenced.js","../../node_modules/micromark-core-commonmark/lib/character-reference.js","../../node_modules/micromark-core-commonmark/lib/character-escape.js","../../node_modules/micromark-core-commonmark/lib/line-ending.js","../../node_modules/micromark-core-commonmark/lib/label-end.js","../../node_modules/micromark-core-commonmark/lib/label-start-image.js","../../node_modules/micromark-core-commonmark/lib/attention.js","../../node_modules/micromark-core-commonmark/lib/autolink.js","../../node_modules/micromark-core-commonmark/lib/html-text.js","../../node_modules/micromark-core-commonmark/lib/label-start-link.js","../../node_modules/micromark-core-commonmark/lib/hard-break-escape.js","../../node_modules/micromark-core-commonmark/lib/code-text.js","../../node_modules/micromark/lib/constructs.js","../../node_modules/micromark/lib/preprocess.js","../../node_modules/mdast-util-from-markdown/lib/index.js","../../node_modules/micromark/lib/postprocess.js","../../node_modules/micromark/lib/parse.js","../../node_modules/remark-parse/index.js","../../node_modules/remark-parse/lib/index.js","../../node_modules/unist-builder/index.js","../../node_modules/unist-util-visit/index.js","../../node_modules/unist-util-position/index.js","../../node_modules/mdast-util-definitions/index.js","../../node_modules/mdast-util-to-hast/lib/traverse.js","../../node_modules/micromark-util-sanitize-uri/index.js","../../node_modules/mdast-util-to-hast/lib/wrap.js","../../node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js","../../node_modules/mdast-util-to-hast/lib/revert.js","../../node_modules/mdast-util-to-hast/lib/handlers/list-item.js","../../node_modules/trim-lines/index.js","../../node_modules/mdast-util-to-hast/lib/handlers/index.js","../../node_modules/mdast-util-to-hast/lib/handlers/blockquote.js","../../node_modules/mdast-util-to-hast/lib/handlers/break.js","../../node_modules/mdast-util-to-hast/lib/handlers/code.js","../../node_modules/mdast-util-to-hast/lib/handlers/delete.js","../../node_modules/mdast-util-to-hast/lib/handlers/emphasis.js","../../node_modules/mdast-util-to-hast/lib/handlers/footnote.js","../../node_modules/mdast-util-to-hast/lib/handlers/heading.js","../../node_modules/mdast-util-to-hast/lib/handlers/html.js","../../node_modules/mdast-util-to-hast/lib/handlers/image-reference.js","../../node_modules/mdast-util-to-hast/lib/handlers/image.js","../../node_modules/mdast-util-to-hast/lib/handlers/inline-code.js","../../node_modules/mdast-util-to-hast/lib/handlers/link-reference.js","../../node_modules/mdast-util-to-hast/lib/handlers/link.js","../../node_modules/mdast-util-to-hast/lib/handlers/list.js","../../node_modules/mdast-util-to-hast/lib/handlers/paragraph.js","../../node_modules/mdast-util-to-hast/lib/handlers/root.js","../../node_modules/mdast-util-to-hast/lib/handlers/strong.js","../../node_modules/mdast-util-to-hast/lib/handlers/table.js","../../node_modules/mdast-util-to-hast/lib/handlers/text.js","../../node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js","../../node_modules/mdast-util-to-hast/lib/index.js","../../node_modules/unist-util-generated/index.js","../../node_modules/mdast-util-to-hast/lib/footer.js","../../node_modules/remark-rehype/lib/index.js","../../node_modules/property-information/lib/util/schema.js","../../node_modules/property-information/lib/util/merge.js","../../node_modules/property-information/lib/normalize.js","../../node_modules/property-information/lib/util/info.js","../../node_modules/property-information/lib/util/types.js","../../node_modules/property-information/lib/util/defined-info.js","../../node_modules/property-information/lib/util/create.js","../../node_modules/property-information/lib/xlink.js","../../node_modules/property-information/lib/xml.js","../../node_modules/property-information/lib/util/case-sensitive-transform.js","../../node_modules/property-information/lib/util/case-insensitive-transform.js","../../node_modules/property-information/lib/xmlns.js","../../node_modules/property-information/lib/aria.js","../../node_modules/property-information/lib/html.js","../../node_modules/property-information/lib/svg.js","../../node_modules/property-information/index.js","../../node_modules/react-markdown/lib/rehype-filter.js","../../node_modules/hast-util-whitespace/index.js","../../node_modules/property-information/lib/find.js","../../node_modules/property-information/lib/hast-to-react.js","../../node_modules/react-markdown/lib/ast-to-react.js","../../node_modules/comma-separated-tokens/index.js","../../node_modules/space-separated-tokens/index.js","../../node_modules/react-markdown/lib/react-markdown.js","../../node_modules/react-markdown/lib/uri-transformer.js","../../node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js","../../node_modules/micromark-extension-gfm-footnote/lib/syntax.js","../../node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js","../../node_modules/micromark-extension-gfm-table/lib/syntax.js","../../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js","../../node_modules/micromark-extension-gfm/index.js","../../node_modules/ccount/index.js","../../node_modules/mdast-util-find-and-replace/lib/index.js","../../node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp/index.js","../../node_modules/mdast-util-gfm-autolink-literal/index.js","../../node_modules/mdast-util-to-markdown/lib/util/association.js","../../node_modules/mdast-util-to-markdown/lib/util/track.js","../../node_modules/mdast-util-to-markdown/lib/util/container-flow.js","../../node_modules/mdast-util-to-markdown/lib/util/indent-lines.js","../../node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js","../../node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js","../../node_modules/mdast-util-to-markdown/lib/util/safe.js","../../node_modules/mdast-util-gfm-footnote/index.js","../../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js","../../node_modules/mdast-util-gfm-strikethrough/index.js","../../node_modules/mdast-util-to-markdown/lib/handle/inline-code.js","../../node_modules/markdown-table/index.js","../../node_modules/mdast-util-gfm-table/lib/index.js","../../node_modules/mdast-util-to-markdown/lib/handle/list-item.js","../../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js","../../node_modules/mdast-util-to-markdown/lib/util/check-bullet.js","../../node_modules/mdast-util-gfm-task-list-item/index.js","../../node_modules/mdast-util-gfm/lib/index.js","../../node_modules/remark-gfm/index.js","../../node_modules/unist-util-is/index.js","../../node_modules/unist-util-visit-parents/index.js"],"sourcesContent":["'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nmodule.exports = function(style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function(node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n};\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n","/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n","/**\n * @license React\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=Symbol.for(\"react.element\"),c=Symbol.for(\"react.portal\"),d=Symbol.for(\"react.fragment\"),e=Symbol.for(\"react.strict_mode\"),f=Symbol.for(\"react.profiler\"),g=Symbol.for(\"react.provider\"),h=Symbol.for(\"react.context\"),k=Symbol.for(\"react.server_context\"),l=Symbol.for(\"react.forward_ref\"),m=Symbol.for(\"react.suspense\"),n=Symbol.for(\"react.suspense_list\"),p=Symbol.for(\"react.memo\"),q=Symbol.for(\"react.lazy\"),t=Symbol.for(\"react.offscreen\"),u;u=Symbol.for(\"react.module.reference\");\nfunction v(a){if(\"object\"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;\nexports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};\nexports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||\"object\"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","var parse = require('inline-style-parser');\n\n/**\n * Parses inline style to object.\n *\n * @example\n * // returns { 'line-height': '42' }\n * StyleToObject('line-height: 42;');\n *\n * @param {String} style - The inline style.\n * @param {Function} [iterator] - The iterator function.\n * @return {null|Object}\n */\nfunction StyleToObject(style, iterator) {\n var output = null;\n if (!style || typeof style !== 'string') {\n return output;\n }\n\n var declaration;\n var declarations = parse(style);\n var hasIterator = typeof iterator === 'function';\n var property;\n var value;\n\n for (var i = 0, len = declarations.length; i < len; i++) {\n declaration = declarations[i];\n property = declaration.property;\n value = declaration.value;\n\n if (hasIterator) {\n iterator(property, value, declaration);\n } else if (value) {\n output || (output = {});\n output[property] = value;\n }\n }\n\n return output;\n}\n\nmodule.exports = StyleToObject;\n","/// \n\n/* eslint-env browser */\n\nconst element = document.createElement('i')\n\n/**\n * @param {string} value\n * @returns {string|false}\n */\nexport function decodeNamedCharacterReference(value) {\n const characterReference = '&' + value + ';'\n element.innerHTML = characterReference\n const char = element.textContent\n\n // Some named character references do not require the closing semicolon\n // (`¬`, for instance), which leads to situations where parsing the assumed\n // named reference of `¬it;` will result in the string `¬it;`.\n // When we encounter a trailing semicolon after parsing, and the character\n // reference to decode was not a semicolon (`;`), we can assume that the\n // matching was not complete.\n // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n // yield `null`.\n if (char.charCodeAt(char.length - 1) === 59 /* `;` */ && value !== 'semi') {\n return false\n }\n\n // If the decoded string is equal to the input, the character reference was\n // not valid.\n // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n // yield `null`.\n return char === characterReference ? false : char\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const blankLine = {\n tokenize: tokenizeBlankLine,\n partial: true\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeBlankLine(effects, ok, nok) {\n return factorySpace(effects, afterWhitespace, 'linePrefix')\n /** @type {State} */\n\n function afterWhitespace(code) {\n return code === null || markdownLineEnding(code) ? ok(code) : nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n */\nimport {markdownSpace} from 'micromark-util-character'\n/**\n * @param {Effects} effects\n * @param {State} ok\n * @param {string} type\n * @param {number} [max=Infinity]\n * @returns {State}\n */\n\nexport function factorySpace(effects, ok, type, max) {\n const limit = max ? max - 1 : Number.POSITIVE_INFINITY\n let size = 0\n return start\n /** @type {State} */\n\n function start(code) {\n if (markdownSpace(code)) {\n effects.enter(type)\n return prefix(code)\n }\n\n return ok(code)\n }\n /** @type {State} */\n\n function prefix(code) {\n if (markdownSpace(code) && size++ < limit) {\n effects.consume(code)\n return prefix\n }\n\n effects.exit(type)\n return ok(code)\n }\n}\n","// This module is generated by `script/`.\n//\n// CommonMark handles attention (emphasis, strong) markers based on what comes\n// before or after them.\n// One such difference is if those characters are Unicode punctuation.\n// This script is generated from the Unicode data.\nexport const unicodePunctuationRegex =\n /[!-/:-@[-`{-~\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u09FD\\u0A76\\u0AF0\\u0C77\\u0C84\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E4F\\u2E52\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]/\n","/**\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {unicodePunctuationRegex} from './lib/unicode-punctuation-regex.js'\n/**\n * Check whether the character code represents an ASCII alpha (`a` through `z`,\n * case insensitive).\n *\n * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.\n *\n * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)\n * to U+005A (`Z`).\n *\n * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)\n * to U+007A (`z`).\n */\n\nexport const asciiAlpha = regexCheck(/[A-Za-z]/)\n/**\n * Check whether the character code represents an ASCII digit (`0` through `9`).\n *\n * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to\n * U+0039 (`9`).\n */\n\nexport const asciiDigit = regexCheck(/\\d/)\n/**\n * Check whether the character code represents an ASCII hex digit (`a` through\n * `f`, case insensitive, or `0` through `9`).\n *\n * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex\n * digit, or an ASCII lower hex digit.\n *\n * An **ASCII upper hex digit** is a character in the inclusive range U+0041\n * (`A`) to U+0046 (`F`).\n *\n * An **ASCII lower hex digit** is a character in the inclusive range U+0061\n * (`a`) to U+0066 (`f`).\n */\n\nexport const asciiHexDigit = regexCheck(/[\\dA-Fa-f]/)\n/**\n * Check whether the character code represents an ASCII alphanumeric (`a`\n * through `z`, case insensitive, or `0` through `9`).\n *\n * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha\n * (see `asciiAlpha`).\n */\n\nexport const asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/)\n/**\n * Check whether the character code represents ASCII punctuation.\n *\n * An **ASCII punctuation** is a character in the inclusive ranges U+0021\n * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT\n * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT\n * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).\n */\n\nexport const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/)\n/**\n * Check whether the character code represents an ASCII atext.\n *\n * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in\n * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),\n * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F\n * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E\n * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE\n * (`{`) to U+007E TILDE (`~`).\n *\n * See:\n * **\\[RFC5322]**:\n * [Internet Message Format](https://tools.ietf.org/html/rfc5322).\n * P. Resnick.\n * IETF.\n */\n\nexport const asciiAtext = regexCheck(/[#-'*+\\--9=?A-Z^-~]/)\n/**\n * Check whether a character code is an ASCII control character.\n *\n * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)\n * to U+001F (US), or U+007F (DEL).\n *\n * @param {Code} code\n * @returns {code is number}\n */\n\nexport function asciiControl(code) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code !== null && (code < 32 || code === 127)\n )\n}\n/**\n * Check whether a character code is a markdown line ending (see\n * `markdownLineEnding`) or markdown space (see `markdownSpace`).\n *\n * @param {Code} code\n * @returns {code is number}\n */\n\nexport function markdownLineEndingOrSpace(code) {\n return code !== null && (code < 0 || code === 32)\n}\n/**\n * Check whether a character code is a markdown line ending.\n *\n * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN\n * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).\n *\n * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE\n * RETURN (CR) are replaced by these virtual characters depending on whether\n * they occurred together.\n *\n * @param {Code} code\n * @returns {code is number}\n */\n\nexport function markdownLineEnding(code) {\n return code !== null && code < -2\n}\n/**\n * Check whether a character code is a markdown space.\n *\n * A **markdown space** is the concrete character U+0020 SPACE (SP) and the\n * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).\n *\n * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is\n * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL\n * SPACE (VS) characters, depending on the column at which the tab occurred.\n *\n * @param {Code} code\n * @returns {code is number}\n */\n\nexport function markdownSpace(code) {\n return code === -2 || code === -1 || code === 32\n}\n/**\n * Check whether the character code represents Unicode whitespace.\n *\n * Note that this does handle micromark specific markdown whitespace characters.\n * See `markdownLineEndingOrSpace` to check that.\n *\n * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,\n * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),\n * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\\[UNICODE]**).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n */\n\nexport const unicodeWhitespace = regexCheck(/\\s/)\n/**\n * Check whether the character code represents Unicode punctuation.\n *\n * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,\n * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`\n * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`\n * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII\n * punctuation (see `asciiPunctuation`).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n */\n// Size note: removing ASCII from the regex and using `asciiPunctuation` here\n// In fact adds to the bundle size.\n\nexport const unicodePunctuation = regexCheck(unicodePunctuationRegex)\n/**\n * Create a code check from a regex.\n *\n * @param {RegExp} regex\n * @returns {(code: Code) => code is number}\n */\n\nfunction regexCheck(regex) {\n return check\n /**\n * Check whether a code matches the bound regex.\n *\n * @param {Code} code Character code\n * @returns {code is number} Whether the character code matches the bound regex\n */\n\n function check(code) {\n return code !== null && regex.test(String.fromCharCode(code))\n }\n}\n","/**\n * Like `Array#splice`, but smarter for giant arrays.\n *\n * `Array#splice` takes all items to be inserted as individual argument which\n * causes a stack overflow in V8 when trying to insert 100k items for instance.\n *\n * Otherwise, this does not return the removed items, and takes `items` as an\n * array instead of rest parameters.\n *\n * @template {unknown} T\n * @param {T[]} list\n * @param {number} start\n * @param {number} remove\n * @param {T[]} items\n * @returns {void}\n */\nexport function splice(list, start, remove, items) {\n const end = list.length\n let chunkStart = 0\n /** @type {unknown[]} */\n\n let parameters // Make start between zero and `end` (included).\n\n if (start < 0) {\n start = -start > end ? 0 : end + start\n } else {\n start = start > end ? end : start\n }\n\n remove = remove > 0 ? remove : 0 // No need to chunk the items if there’s only a couple (10k) items.\n\n if (items.length < 10000) {\n parameters = Array.from(items)\n parameters.unshift(start, remove) // @ts-expect-error Hush, it’s fine.\n ;[].splice.apply(list, parameters)\n } else {\n // Delete `remove` items starting from `start`\n if (remove) [].splice.apply(list, [start, remove]) // Insert the items in chunks to not cause stack overflows.\n\n while (chunkStart < items.length) {\n parameters = items.slice(chunkStart, chunkStart + 10000)\n parameters.unshift(start, 0) // @ts-expect-error Hush, it’s fine.\n ;[].splice.apply(list, parameters)\n chunkStart += 10000\n start += 10000\n }\n }\n}\n/**\n * Append `items` (an array) at the end of `list` (another array).\n * When `list` was empty, returns `items` instead.\n *\n * This prevents a potentially expensive operation when `list` is empty,\n * and adds items in batches to prevent V8 from hanging.\n *\n * @template {unknown} T\n * @param {T[]} list\n * @param {T[]} items\n * @returns {T[]}\n */\n\nexport function push(list, items) {\n if (list.length > 0) {\n splice(list, list.length, 0, items)\n return list\n }\n\n return items\n}\n","/**\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {\n markdownLineEndingOrSpace,\n unicodePunctuation,\n unicodeWhitespace\n} from 'micromark-util-character'\n\n/**\n * Classify whether a character code represents whitespace, punctuation, or\n * something else.\n *\n * Used for attention (emphasis, strong), whose sequences can open or close\n * based on the class of surrounding characters.\n *\n * Note that eof (`null`) is seen as whitespace.\n *\n * @param {Code} code\n * @returns {number|undefined}\n */\nexport function classifyCharacter(code) {\n if (\n code === null ||\n markdownLineEndingOrSpace(code) ||\n unicodeWhitespace(code)\n ) {\n return 1\n }\n\n if (unicodePunctuation(code)) {\n return 2\n }\n}\n","/**\n * @typedef {import('micromark-util-types').NormalizedExtension} NormalizedExtension\n * @typedef {import('micromark-util-types').Extension} Extension\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension\n */\n\nimport {splice} from 'micromark-util-chunked'\n\nconst hasOwnProperty = {}.hasOwnProperty\n\n/**\n * Combine several syntax extensions into one.\n *\n * @param {Extension[]} extensions List of syntax extensions.\n * @returns {NormalizedExtension} A single combined extension.\n */\nexport function combineExtensions(extensions) {\n /** @type {NormalizedExtension} */\n const all = {}\n let index = -1\n\n while (++index < extensions.length) {\n syntaxExtension(all, extensions[index])\n }\n\n return all\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {NormalizedExtension} all Extension to merge into.\n * @param {Extension} extension Extension to merge.\n * @returns {void}\n */\nfunction syntaxExtension(all, extension) {\n /** @type {string} */\n let hook\n\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n const left = maybe || (all[hook] = {})\n const right = extension[hook]\n /** @type {string} */\n let code\n\n for (code in right) {\n if (!hasOwnProperty.call(left, code)) left[code] = []\n const value = right[code]\n constructs(\n // @ts-expect-error Looks like a list.\n left[code],\n Array.isArray(value) ? value : value ? [value] : []\n )\n }\n }\n}\n\n/**\n * Merge `list` into `existing` (both lists of constructs).\n * Mutates `existing`.\n *\n * @param {unknown[]} existing\n * @param {unknown[]} list\n * @returns {void}\n */\nfunction constructs(existing, list) {\n let index = -1\n /** @type {unknown[]} */\n const before = []\n\n while (++index < list.length) {\n // @ts-expect-error Looks like an object.\n ;(list[index].add === 'after' ? existing : before).push(list[index])\n }\n\n splice(existing, 0, 0, before)\n}\n\n/**\n * Combine several HTML extensions into one.\n *\n * @param {HtmlExtension[]} htmlExtensions List of HTML extensions.\n * @returns {HtmlExtension} A single combined extension.\n */\nexport function combineHtmlExtensions(htmlExtensions) {\n /** @type {HtmlExtension} */\n const handlers = {}\n let index = -1\n\n while (++index < htmlExtensions.length) {\n htmlExtension(handlers, htmlExtensions[index])\n }\n\n return handlers\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {HtmlExtension} all Extension to merge into.\n * @param {HtmlExtension} extension Extension to merge.\n * @returns {void}\n */\nfunction htmlExtension(all, extension) {\n /** @type {string} */\n let hook\n\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n const left = maybe || (all[hook] = {})\n const right = extension[hook]\n /** @type {string} */\n let type\n\n if (right) {\n for (type in right) {\n left[type] = right[type]\n }\n }\n }\n}\n","/**\n * Turn the number (in string form as either hexa- or plain decimal) coming from\n * a numeric character reference into a character.\n *\n * @param {string} value\n * Value to decode.\n * @param {number} base\n * Numeric base.\n * @returns {string}\n */\nexport function decodeNumericCharacterReference(value, base) {\n const code = Number.parseInt(value, base)\n\n if (\n // C0 except for HT, LF, FF, CR, space\n code < 9 ||\n code === 11 ||\n (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls.\n (code > 126 && code < 160) || // Lone high surrogates and low surrogates.\n (code > 55295 && code < 57344) || // Noncharacters.\n (code > 64975 && code < 65008) ||\n (code & 65535) === 65535 ||\n (code & 65535) === 65534 || // Out of range\n code > 1114111\n ) {\n return '\\uFFFD'\n }\n\n return String.fromCharCode(code)\n}\n","import {decodeNamedCharacterReference} from 'decode-named-character-reference'\nimport {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'\nconst characterEscapeOrReference =\n /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi\n/**\n * Utility to decode markdown strings (which occur in places such as fenced\n * code info strings, destinations, labels, and titles).\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * @returns {string}\n */\n\nexport function decodeString(value) {\n return value.replace(characterEscapeOrReference, decode)\n}\n/**\n * @param {string} $0\n * @param {string} $1\n * @param {string} $2\n * @returns {string}\n */\n\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1\n } // Reference.\n\n const head = $2.charCodeAt(0)\n\n if (head === 35) {\n const head = $2.charCodeAt(1)\n const hex = head === 120 || head === 88\n return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10)\n }\n\n return decodeNamedCharacterReference($2) || $0\n}\n","/**\n * Normalize an identifier (such as used in definitions).\n *\n * @param {string} value\n * @returns {string}\n */\nexport function normalizeIdentifier(value) {\n return (\n value // Collapse Markdown whitespace.\n .replace(/[\\t\\n\\r ]+/g, ' ') // Trim.\n .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase\n // counterpart is uppercased will result in a different uppercase\n // character.\n // Hence, to get that form, we perform both lower- and uppercase.\n // Upper case makes sure keys will not interact with default prototypal\n // methods: no method is uppercase.\n .toLowerCase()\n .toUpperCase()\n )\n}\n","/**\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Resolver} Resolver\n */\n\n/**\n * Call all `resolveAll`s.\n *\n * @param {{resolveAll?: Resolver}[]} constructs\n * @param {Event[]} events\n * @param {TokenizeContext} context\n * @returns {Event[]}\n */\nexport function resolveAll(constructs, events, context) {\n /** @type {Resolver[]} */\n const called = []\n let index = -1\n\n while (++index < constructs.length) {\n const resolve = constructs[index].resolveAll\n\n if (resolve && !called.includes(resolve)) {\n events = resolve(events, context)\n called.push(resolve)\n }\n }\n\n return events\n}\n","/**\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {object & {type: string, position?: Position|undefined}} NodeLike\n */\n\n/**\n * Stringify one point, a position (start and end points), or a node’s\n * positional information.\n *\n * @param {Node|NodeLike|Position|Point|null} [value]\n * @returns {string}\n */\nexport function stringifyPosition(value) {\n // Nothing.\n if (!value || typeof value !== 'object') {\n return ''\n }\n\n // Node.\n if ('position' in value || 'type' in value) {\n return position(value.position)\n }\n\n // Position.\n if ('start' in value || 'end' in value) {\n return position(value)\n }\n\n // Point.\n if ('line' in value || 'column' in value) {\n return point(value)\n }\n\n // ?\n return ''\n}\n\n/**\n * @param {Point|undefined} point\n * @returns {string}\n */\nfunction point(point) {\n return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position|undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number|undefined} value\n * @returns {number}\n */\nfunction index(value) {\n return value && typeof value === 'number' ? value : 1\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Point} Point\n * @typedef {object & {type: string, position?: Position|undefined}} NodeLike\n */\n\nimport {stringifyPosition} from 'unist-util-stringify-position'\n\nexport class VFileMessage extends Error {\n /**\n * Create a message for `reason` at `place` from `origin`.\n *\n * When an error is passed in as `reason`, the `stack` is copied.\n *\n * @param {string|Error|VFileMessage} reason\n * Reason for message.\n * Uses the stack and message of the error if given.\n * @param {Node|NodeLike|Position|Point} [place]\n * Place at which the message occurred in a file.\n * @param {string} [origin]\n * Place in code the message originates from (example `'my-package:my-rule-name'`)\n */\n constructor(reason, place, origin) {\n /** @type {[string|null, string|null]} */\n const parts = [null, null]\n /** @type {Position} */\n let position = {\n // @ts-expect-error: we always follows the structure of `position`.\n start: {line: null, column: null},\n // @ts-expect-error: \"\n end: {line: null, column: null}\n }\n\n super()\n\n if (typeof place === 'string') {\n origin = place\n place = undefined\n }\n\n if (typeof origin === 'string') {\n const index = origin.indexOf(':')\n\n if (index === -1) {\n parts[1] = origin\n } else {\n parts[0] = origin.slice(0, index)\n parts[1] = origin.slice(index + 1)\n }\n }\n\n if (place) {\n // Node.\n if ('type' in place || 'position' in place) {\n if (place.position) {\n // @ts-expect-error: looks like a position.\n position = place.position\n }\n }\n // Position.\n else if ('start' in place || 'end' in place) {\n // @ts-expect-error: looks like a position.\n position = place\n }\n // Point.\n else if ('line' in place || 'column' in place) {\n position.start = place\n }\n }\n\n // Fields from `Error`\n this.name = stringifyPosition(place) || '1:1'\n /** @type {string} */\n this.message = typeof reason === 'object' ? reason.message : reason\n /** @type {string} */\n this.stack = ''\n\n if (typeof reason === 'object' && reason.stack) {\n this.stack = reason.stack\n }\n\n /**\n * Reason for message.\n *\n * @type {string}\n */\n this.reason = this.message\n\n /* eslint-disable no-unused-expressions */\n /**\n * Whether this is a fatal problem that marks an associated file as no\n * longer processable.\n * If `true`, marks associated file as no longer processable.\n * If `false`, necessitates a (potential) change.\n * The value can also be `null` or `undefined`, for things that might not\n * need changing.\n *\n * @type {boolean?}\n */\n this.fatal\n\n /**\n * Starting line of error.\n *\n * @type {number?}\n */\n this.line = position.start.line\n\n /**\n * Starting column of error.\n *\n * @type {number?}\n */\n this.column = position.start.column\n\n /**\n * Full range information, when available.\n * Has `start` and `end` fields, both set to an object with `line` and\n * `column`, set to `number?`.\n *\n * @type {Position?}\n */\n this.position = position\n\n /**\n * Namespace of warning (example: `'my-package'`).\n *\n * @type {string?}\n */\n this.source = parts[0]\n\n /**\n * Category of message (example: `'my-rule-name'`).\n *\n * @type {string?}\n */\n this.ruleId = parts[1]\n\n /**\n * Path of a file (used throughout the VFile ecosystem).\n *\n * @type {string?}\n */\n this.file\n\n // The following fields are “well known”.\n // Not standard.\n // Feel free to add other non-standard fields to your messages.\n\n /**\n * Specify the source value that’s being reported, which is deemed\n * incorrect.\n *\n * @type {string?}\n */\n this.actual\n\n /**\n * Suggest values that should be used instead of `actual`, one or more\n * values that are deemed as acceptable.\n *\n * @type {Array?}\n */\n this.expected\n\n /**\n * Link to documentation for the message.\n *\n * @type {string?}\n */\n this.url\n\n /**\n * Long form description of the message (supported by `vfile-reporter`).\n *\n * @type {string?}\n */\n this.note\n /* eslint-enable no-unused-expressions */\n }\n}\n\nVFileMessage.prototype.file = ''\nVFileMessage.prototype.name = ''\nVFileMessage.prototype.reason = ''\nVFileMessage.prototype.message = ''\nVFileMessage.prototype.stack = ''\nVFileMessage.prototype.fatal = null\nVFileMessage.prototype.column = null\nVFileMessage.prototype.line = null\nVFileMessage.prototype.source = null\nVFileMessage.prototype.ruleId = null\nVFileMessage.prototype.position = null\n","// A derivative work based on:\n// .\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// .\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const path = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * @param {string} path\n * @param {string} [ext]\n * @returns {string}\n */\nfunction basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') {\n throw new TypeError('\"ext\" argument must be a string')\n }\n\n assertPath(path)\n let start = 0\n let end = -1\n let index = path.length\n /** @type {boolean|undefined} */\n let seenNonSlash\n\n if (ext === undefined || ext.length === 0 || ext.length > path.length) {\n while (index--) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // path component.\n seenNonSlash = true\n end = index + 1\n }\n }\n\n return end < 0 ? '' : path.slice(start, end)\n }\n\n if (ext === path) {\n return ''\n }\n\n let firstNonSlashEnd = -1\n let extIndex = ext.length - 1\n\n while (index--) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else {\n if (firstNonSlashEnd < 0) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching.\n seenNonSlash = true\n firstNonSlashEnd = index + 1\n }\n\n if (extIndex > -1) {\n // Try to match the explicit extension.\n if (path.charCodeAt(index) === ext.charCodeAt(extIndex--)) {\n if (extIndex < 0) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = index\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIndex = -1\n end = firstNonSlashEnd\n }\n }\n }\n }\n\n if (start === end) {\n end = firstNonSlashEnd\n } else if (end < 0) {\n end = path.length\n }\n\n return path.slice(start, end)\n}\n\n/**\n * @param {string} path\n * @returns {string}\n */\nfunction dirname(path) {\n assertPath(path)\n\n if (path.length === 0) {\n return '.'\n }\n\n let end = -1\n let index = path.length\n /** @type {boolean|undefined} */\n let unmatchedSlash\n\n // Prefix `--` is important to not run on `0`.\n while (--index) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n if (unmatchedSlash) {\n end = index\n break\n }\n } else if (!unmatchedSlash) {\n // We saw the first non-path separator\n unmatchedSlash = true\n }\n }\n\n return end < 0\n ? path.charCodeAt(0) === 47 /* `/` */\n ? '/'\n : '.'\n : end === 1 && path.charCodeAt(0) === 47 /* `/` */\n ? '//'\n : path.slice(0, end)\n}\n\n/**\n * @param {string} path\n * @returns {string}\n */\nfunction extname(path) {\n assertPath(path)\n\n let index = path.length\n\n let end = -1\n let startPart = 0\n let startDot = -1\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find.\n let preDotState = 0\n /** @type {boolean|undefined} */\n let unmatchedSlash\n\n while (index--) {\n const code = path.charCodeAt(index)\n\n if (code === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (unmatchedSlash) {\n startPart = index + 1\n break\n }\n\n continue\n }\n\n if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // extension.\n unmatchedSlash = true\n end = index + 1\n }\n\n if (code === 46 /* `.` */) {\n // If this is our first dot, mark it as the start of our extension.\n if (startDot < 0) {\n startDot = index\n } else if (preDotState !== 1) {\n preDotState = 1\n }\n } else if (startDot > -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension.\n preDotState = -1\n }\n }\n\n if (\n startDot < 0 ||\n end < 0 ||\n // We saw a non-dot character immediately before the dot.\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly `..`.\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n ) {\n return ''\n }\n\n return path.slice(startDot, end)\n}\n\n/**\n * @param {Array} segments\n * @returns {string}\n */\nfunction join(...segments) {\n let index = -1\n /** @type {string|undefined} */\n let joined\n\n while (++index < segments.length) {\n assertPath(segments[index])\n\n if (segments[index]) {\n joined =\n joined === undefined ? segments[index] : joined + '/' + segments[index]\n }\n }\n\n return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Note: `normalize` is not exposed as `path.normalize`, so some code is\n * manually removed from it.\n *\n * @param {string} path\n * @returns {string}\n */\nfunction normalize(path) {\n assertPath(path)\n\n const absolute = path.charCodeAt(0) === 47 /* `/` */\n\n // Normalize the path according to POSIX rules.\n let value = normalizeString(path, !absolute)\n\n if (value.length === 0 && !absolute) {\n value = '.'\n }\n\n if (value.length > 0 && path.charCodeAt(path.length - 1) === 47 /* / */) {\n value += '/'\n }\n\n return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n * @param {boolean} allowAboveRoot\n * @returns {string}\n */\nfunction normalizeString(path, allowAboveRoot) {\n let result = ''\n let lastSegmentLength = 0\n let lastSlash = -1\n let dots = 0\n let index = -1\n /** @type {number|undefined} */\n let code\n /** @type {number} */\n let lastSlashIndex\n\n while (++index <= path.length) {\n if (index < path.length) {\n code = path.charCodeAt(index)\n } else if (code === 47 /* `/` */) {\n break\n } else {\n code = 47 /* `/` */\n }\n\n if (code === 47 /* `/` */) {\n if (lastSlash === index - 1 || dots === 1) {\n // Empty.\n } else if (lastSlash !== index - 1 && dots === 2) {\n if (\n result.length < 2 ||\n lastSegmentLength !== 2 ||\n result.charCodeAt(result.length - 1) !== 46 /* `.` */ ||\n result.charCodeAt(result.length - 2) !== 46 /* `.` */\n ) {\n if (result.length > 2) {\n lastSlashIndex = result.lastIndexOf('/')\n\n if (lastSlashIndex !== result.length - 1) {\n if (lastSlashIndex < 0) {\n result = ''\n lastSegmentLength = 0\n } else {\n result = result.slice(0, lastSlashIndex)\n lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n }\n\n lastSlash = index\n dots = 0\n continue\n }\n } else if (result.length > 0) {\n result = ''\n lastSegmentLength = 0\n lastSlash = index\n dots = 0\n continue\n }\n }\n\n if (allowAboveRoot) {\n result = result.length > 0 ? result + '/..' : '..'\n lastSegmentLength = 2\n }\n } else {\n if (result.length > 0) {\n result += '/' + path.slice(lastSlash + 1, index)\n } else {\n result = path.slice(lastSlash + 1, index)\n }\n\n lastSegmentLength = index - lastSlash - 1\n }\n\n lastSlash = index\n dots = 0\n } else if (code === 46 /* `.` */ && dots > -1) {\n dots++\n } else {\n dots = -1\n }\n }\n\n return result\n}\n\n/**\n * @param {string} path\n */\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n 'Path must be a string. Received ' + JSON.stringify(path)\n )\n }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// .\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const proc = {cwd}\n\nfunction cwd() {\n return '/'\n}\n","/**\n * @typedef URL\n * @property {string} hash\n * @property {string} host\n * @property {string} hostname\n * @property {string} href\n * @property {string} origin\n * @property {string} password\n * @property {string} pathname\n * @property {string} port\n * @property {string} protocol\n * @property {string} search\n * @property {any} searchParams\n * @property {string} username\n * @property {() => string} toString\n * @property {() => string} toJSON\n */\n\n/**\n * @param {unknown} fileURLOrPath\n * @returns {fileURLOrPath is URL}\n */\n// From: \nexport function isUrl(fileURLOrPath) {\n return (\n fileURLOrPath !== null &&\n typeof fileURLOrPath === 'object' &&\n // @ts-expect-error: indexable.\n fileURLOrPath.href &&\n // @ts-expect-error: indexable.\n fileURLOrPath.origin\n )\n}\n","/// \n\nimport {isUrl} from './minurl.shared.js'\n\n// See: \n\n/**\n * @param {string|URL} path\n */\nexport function urlToPath(path) {\n if (typeof path === 'string') {\n path = new URL(path)\n } else if (!isUrl(path)) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'The \"path\" argument must be of type string or an instance of URL. Received `' +\n path +\n '`'\n )\n error.code = 'ERR_INVALID_ARG_TYPE'\n throw error\n }\n\n if (path.protocol !== 'file:') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError('The URL must be of scheme file')\n error.code = 'ERR_INVALID_URL_SCHEME'\n throw error\n }\n\n return getPathFromURLPosix(path)\n}\n\n/**\n * @param {URL} url\n */\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL host must be \"localhost\" or empty on darwin'\n )\n error.code = 'ERR_INVALID_FILE_URL_HOST'\n throw error\n }\n\n const pathname = url.pathname\n let index = -1\n\n while (++index < pathname.length) {\n if (\n pathname.charCodeAt(index) === 37 /* `%` */ &&\n pathname.charCodeAt(index + 1) === 50 /* `2` */\n ) {\n const third = pathname.charCodeAt(index + 2)\n if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL path must not include encoded / characters'\n )\n error.code = 'ERR_INVALID_FILE_URL_PATH'\n throw error\n }\n }\n }\n\n return decodeURIComponent(pathname)\n}\n\nexport {isUrl} from './minurl.shared.js'\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Point} Point\n * @typedef {Record & {type: string, position?: Position|undefined}} NodeLike\n * @typedef {import('./minurl.shared.js').URL} URL\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Value} Value\n *\n * @typedef {'ascii'|'utf8'|'utf-8'|'utf16le'|'ucs2'|'ucs-2'|'base64'|'base64url'|'latin1'|'binary'|'hex'} BufferEncoding\n * Encodings supported by the buffer class.\n * This is a copy of the typing from Node, copied to prevent Node globals from\n * being needed.\n * Copied from: \n *\n * @typedef {Value|Options|VFile|URL} Compatible\n * Things that can be passed to the constructor.\n *\n * @typedef VFileCoreOptions\n * @property {Value} [value]\n * @property {string} [cwd]\n * @property {Array} [history]\n * @property {string|URL} [path]\n * @property {string} [basename]\n * @property {string} [stem]\n * @property {string} [extname]\n * @property {string} [dirname]\n * @property {Data} [data]\n *\n * @typedef Map\n * Raw source map, see:\n * .\n * @property {number} version\n * @property {Array} sources\n * @property {Array} names\n * @property {string|undefined} [sourceRoot]\n * @property {Array|undefined} [sourcesContent]\n * @property {string} mappings\n * @property {string} file\n *\n * @typedef {{[key: string]: unknown} & VFileCoreOptions} Options\n * Configuration: a bunch of keys that will be shallow copied over to the new\n * file.\n *\n * @typedef {Record} ReporterSettings\n * @typedef {(files: Array, options: T) => string} Reporter\n */\n\nimport buffer from 'is-buffer'\nimport {VFileMessage} from 'vfile-message'\nimport {path} from './minpath.js'\nimport {proc} from './minproc.js'\nimport {urlToPath, isUrl} from './minurl.js'\n\n// Order of setting (least specific to most), we need this because otherwise\n// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n// stem can be set.\nconst order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * If `options` is `string` or `Buffer`, it’s treated as `{value: options}`.\n * If `options` is a `URL`, it’s treated as `{path: options}`.\n * If `options` is a `VFile`, shallow copies its data over to the new file.\n * All fields in `options` are set on the newly created `VFile`.\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * It’s not possible to set either `dirname` or `extname` without setting\n * either `history`, `path`, `basename`, or `stem` as well.\n *\n * @param {Compatible} [value]\n */\n constructor(value) {\n /** @type {Options} */\n let options\n\n if (!value) {\n options = {}\n } else if (typeof value === 'string' || buffer(value)) {\n // @ts-expect-error Looks like a buffer.\n options = {value}\n } else if (isUrl(value)) {\n options = {path: value}\n } else {\n // @ts-expect-error Looks like file or options.\n options = value\n }\n\n /**\n * Place to store custom information (default: `{}`).\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of messages associated with the file.\n * @type {Array}\n */\n this.messages = []\n\n /**\n * List of filepaths the file moved between.\n * The first is the original path and the last is the current path.\n * @type {Array}\n */\n this.history = []\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n * @type {string}\n */\n this.cwd = proc.cwd()\n\n /* eslint-disable no-unused-expressions */\n /**\n * Raw value.\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n\n /**\n * Whether a file was saved to disk.\n * This is used by vfile reporters.\n * @type {boolean}\n */\n this.stored\n\n /**\n * Sometimes files have a non-string, compiled, representation.\n * This can be stored in the `result` field.\n * One example is when turning markdown into React nodes.\n * This is used by unified to store non-string results.\n * @type {unknown}\n */\n this.result\n\n /**\n * Sometimes files have a source map associated with them.\n * This can be stored in the `map` field.\n * This should be a `Map` type, which is equivalent to the `RawSourceMap`\n * type from the `source-map` module.\n * @type {Map|undefined}\n */\n this.map\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const prop = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (prop in options && options[prop] !== undefined) {\n // @ts-expect-error: TS is confused by the different types for `history`.\n this[prop] = prop === 'history' ? [...options[prop]] : options[prop]\n }\n }\n\n /** @type {string} */\n let prop\n\n // Set non-path related properties.\n for (prop in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(prop)) this[prop] = options[prop]\n }\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n * @returns {string}\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n * @param {string|URL} path\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the parent path (example: `'~'`).\n */\n get dirname() {\n return typeof this.path === 'string' ? path.dirname(this.path) : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n * Cannot be set if there’s no `path` yet.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = path.join(dirname || '', this.basename)\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n */\n get basename() {\n return typeof this.path === 'string' ? path.basename(this.path) : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = path.join(this.dirname || '', basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n */\n get extname() {\n return typeof this.path === 'string' ? path.extname(this.path) : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.charCodeAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = path.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n */\n get stem() {\n return typeof this.path === 'string'\n ? path.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = path.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n /**\n * Serialize the file.\n *\n * @param {BufferEncoding} [encoding='utf8']\n * When `value` is a `Buffer`, `encoding` is a character encoding to\n * understand it as (default: `'utf8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n return (this.value || '').toString(encoding)\n }\n\n /**\n * Constructs a new `VFileMessage`, where `fatal` is set to `false`, and\n * associates it with the file by adding it to `vfile.messages` and setting\n * `message.file` to the current filepath.\n *\n * @param {string|Error|VFileMessage} reason\n * Human readable reason for the message, uses the stack and message of the error if given.\n * @param {Node|NodeLike|Position|Point} [place]\n * Place where the message occurred in the file.\n * @param {string} [origin]\n * Computer readable reason for the message\n * @returns {VFileMessage}\n * Message.\n */\n message(reason, place, origin) {\n const message = new VFileMessage(reason, place, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Like `VFile#message()`, but associates an informational message where\n * `fatal` is set to `null`.\n *\n * @param {string|Error|VFileMessage} reason\n * Human readable reason for the message, uses the stack and message of the error if given.\n * @param {Node|NodeLike|Position|Point} [place]\n * Place where the message occurred in the file.\n * @param {string} [origin]\n * Computer readable reason for the message\n * @returns {VFileMessage}\n * Message.\n */\n info(reason, place, origin) {\n const message = this.message(reason, place, origin)\n\n message.fatal = null\n\n return message\n }\n\n /**\n * Like `VFile#message()`, but associates a fatal message where `fatal` is\n * set to `true`, and then immediately throws it.\n *\n * > 👉 **Note**: a fatal error means that a file is no longer processable.\n *\n * @param {string|Error|VFileMessage} reason\n * Human readable reason for the message, uses the stack and message of the error if given.\n * @param {Node|NodeLike|Position|Point} [place]\n * Place where the message occurred in the file.\n * @param {string} [origin]\n * Computer readable reason for the message\n * @returns {never}\n * Message.\n */\n fail(reason, place, origin) {\n const message = this.message(reason, place, origin)\n\n message.fatal = true\n\n throw message\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string|undefined} part\n * @param {string} name\n * @returns {void}\n */\nfunction assertPart(part, name) {\n if (part && part.includes(path.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + path.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string|undefined} part\n * @param {string} name\n * @returns {asserts part is string}\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string|undefined} path\n * @param {string} name\n * @returns {asserts path is string}\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","/**\n * @typedef {(error?: Error|null|undefined, ...output: Array) => void} Callback\n * @typedef {(...input: Array) => any} Middleware\n *\n * @typedef {(...input: Array) => void} Run\n * Call all middleware.\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add `fn` (middleware) to the list.\n * @typedef {{run: Run, use: Use}} Pipeline\n * Middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n */\nexport function trough() {\n /** @type {Array} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error|null|undefined} error\n * @param {Array} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware`.\n * Can be sync or async; return a promise, receive a callback, or return new\n * values and errors.\n *\n * @param {Middleware} middleware\n * @param {Callback} callback\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result instanceof Promise) {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('vfile').VFileCompatible} VFileCompatible\n * @typedef {import('vfile').VFileValue} VFileValue\n * @typedef {import('..').Processor} Processor\n * @typedef {import('..').Plugin} Plugin\n * @typedef {import('..').Preset} Preset\n * @typedef {import('..').Pluggable} Pluggable\n * @typedef {import('..').PluggableList} PluggableList\n * @typedef {import('..').Transformer} Transformer\n * @typedef {import('..').Parser} Parser\n * @typedef {import('..').Compiler} Compiler\n * @typedef {import('..').RunCallback} RunCallback\n * @typedef {import('..').ProcessCallback} ProcessCallback\n *\n * @typedef Context\n * @property {Node} tree\n * @property {VFile} file\n */\n\nimport {bail} from 'bail'\nimport isBuffer from 'is-buffer'\nimport extend from 'extend'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\n\n// Expose a frozen processor.\nexport const unified = base().freeze()\n\nconst own = {}.hasOwnProperty\n\n// Function to create the first processor.\n/**\n * @returns {Processor}\n */\nfunction base() {\n const transformers = trough()\n /** @type {Processor['attachers']} */\n const attachers = []\n /** @type {Record} */\n let namespace = {}\n /** @type {boolean|undefined} */\n let frozen\n let freezeIndex = -1\n\n // Data management.\n // @ts-expect-error: overloads are handled.\n processor.data = data\n processor.Parser = undefined\n processor.Compiler = undefined\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n // @ts-expect-error: overloads are handled.\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n // @ts-expect-error: overloads are handled.\n processor.run = run\n processor.runSync = runSync\n // @ts-expect-error: overloads are handled.\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n /** @type {Processor} */\n function processor() {\n const destination = base()\n let index = -1\n\n while (++index < attachers.length) {\n destination.use(...attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n /**\n * @param {string|Record} [key]\n * @param {unknown} [value]\n * @returns {unknown}\n */\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n namespace[key] = value\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n /** @type {Processor['freeze']} */\n function freeze() {\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n const [attacher, ...options] = attachers[freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n /** @type {Transformer|void} */\n const transformer = attacher.call(processor, ...options)\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Number.POSITIVE_INFINITY\n\n return processor\n }\n\n /**\n * @param {Pluggable|null|undefined} [value]\n * @param {...unknown} options\n * @returns {Processor}\n */\n function use(value, ...options) {\n /** @type {Record|undefined} */\n let settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, ...options)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = Object.assign(namespace.settings || {}, settings)\n }\n\n return processor\n\n /**\n * @param {import('..').Pluggable} value\n * @returns {void}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...options] = value\n addPlugin(plugin, ...options)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {void}\n */\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = Object.assign(settings || {}, result.settings)\n }\n }\n\n /**\n * @param {PluggableList|null|undefined} [plugins]\n * @returns {void}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {...unknown} [value]\n * @returns {void}\n */\n function addPlugin(plugin, value) {\n let index = -1\n /** @type {Processor['attachers'][number]|undefined} */\n let entry\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entry = attachers[index]\n break\n }\n }\n\n if (entry) {\n if (isPlainObj(entry[1]) && isPlainObj(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n // @ts-expect-error: fine.\n attachers.push([...arguments])\n }\n }\n }\n\n /** @type {Processor['parse']} */\n function parse(doc) {\n processor.freeze()\n const file = vfile(doc)\n const Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n // @ts-expect-error: `newable` checks this.\n return new Parser(String(file), file).parse()\n }\n\n // @ts-expect-error: `newable` checks this.\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n /** @type {Processor['stringify']} */\n function stringify(node, doc) {\n processor.freeze()\n const file = vfile(doc)\n const Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n // @ts-expect-error: `newable` checks this.\n return new Compiler(node, file).compile()\n }\n\n // @ts-expect-error: `newable` checks this.\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n /**\n * @param {Node} node\n * @param {VFileCompatible|RunCallback} [doc]\n * @param {RunCallback} [callback]\n * @returns {Promise|void}\n */\n function run(node, doc, callback) {\n assertNode(node)\n processor.freeze()\n\n if (!callback && typeof doc === 'function') {\n callback = doc\n doc = undefined\n }\n\n if (!callback) {\n return new Promise(executor)\n }\n\n executor(null, callback)\n\n /**\n * @param {null|((node: Node) => void)} resolve\n * @param {(error: Error) => void} reject\n * @returns {void}\n */\n function executor(resolve, reject) {\n // @ts-expect-error: `doc` can’t be a callback anymore, we checked.\n transformers.run(node, vfile(doc), done)\n\n /**\n * @param {Error|null} error\n * @param {Node} tree\n * @param {VFile} file\n * @returns {void}\n */\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n // @ts-expect-error: `callback` is defined if `resolve` is not.\n callback(null, tree, file)\n }\n }\n }\n }\n\n /** @type {Processor['runSync']} */\n function runSync(node, file) {\n /** @type {Node|undefined} */\n let result\n /** @type {boolean|undefined} */\n let complete\n\n processor.run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n // @ts-expect-error: we either bailed on an error or have a tree.\n return result\n\n /**\n * @param {Error|null} [error]\n * @param {Node} [tree]\n * @returns {void}\n */\n function done(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * @param {VFileCompatible} doc\n * @param {ProcessCallback} [callback]\n * @returns {Promise|undefined}\n */\n function process(doc, callback) {\n processor.freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!callback) {\n return new Promise(executor)\n }\n\n executor(null, callback)\n\n /**\n * @param {null|((file: VFile) => void)} resolve\n * @param {(error?: Error|null|undefined) => void} reject\n * @returns {void}\n */\n function executor(resolve, reject) {\n const file = vfile(doc)\n\n processor.run(processor.parse(file), file, (error, tree, file) => {\n if (error || !tree || !file) {\n done(error)\n } else {\n /** @type {unknown} */\n const result = processor.stringify(tree, file)\n\n if (result === undefined || result === null) {\n // Empty.\n } else if (looksLikeAVFileValue(result)) {\n file.value = result\n } else {\n file.result = result\n }\n\n done(error, file)\n }\n })\n\n /**\n * @param {Error|null|undefined} [error]\n * @param {VFile|undefined} [file]\n * @returns {void}\n */\n function done(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n // @ts-expect-error: `callback` is defined if `resolve` is not.\n callback(null, file)\n }\n }\n }\n }\n\n /** @type {Processor['processSync']} */\n function processSync(doc) {\n /** @type {boolean|undefined} */\n let complete\n\n processor.freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n\n const file = vfile(doc)\n\n processor.process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n /**\n * @param {Error|null|undefined} [error]\n * @returns {void}\n */\n function done(error) {\n complete = true\n bail(error)\n }\n }\n}\n\n/**\n * Check if `value` is a constructor.\n *\n * @param {unknown} value\n * @param {string} name\n * @returns {boolean}\n */\nfunction newable(value, name) {\n return (\n typeof value === 'function' &&\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n value.prototype &&\n // A function with keys in its prototype is probably a constructor.\n // Classes’ prototype methods are not enumerable, so we check if some value\n // exists in the prototype.\n // type-coverage:ignore-next-line\n (keys(value.prototype) || name in value.prototype)\n )\n}\n\n/**\n * Check if `value` is an object with keys.\n *\n * @param {Record} value\n * @returns {boolean}\n */\nfunction keys(value) {\n /** @type {string} */\n let key\n\n for (key in value) {\n if (own.call(value, key)) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `Parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `Compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {VFileCompatible} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {VFileCompatible} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is VFileValue}\n */\nfunction looksLikeAVFileValue(value) {\n return typeof value === 'string' || isBuffer(value)\n}\n","/**\n * @typedef Options\n * @property {boolean} [includeImageAlt=true]\n */\n\n/**\n * Get the text content of a node.\n * Prefer the node’s plain-text fields, otherwise serialize its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} node\n * @param {Options} [options]\n * @returns {string}\n */\nexport function toString(node, options) {\n var {includeImageAlt = true} = options || {}\n return one(node, includeImageAlt)\n}\n\n/**\n * @param {unknown} node\n * @param {boolean} includeImageAlt\n * @returns {string}\n */\nfunction one(node, includeImageAlt) {\n return (\n (node &&\n typeof node === 'object' &&\n // @ts-ignore looks like a literal.\n (node.value ||\n // @ts-ignore looks like an image.\n (includeImageAlt ? node.alt : '') ||\n // @ts-ignore looks like a parent.\n ('children' in node && all(node.children, includeImageAlt)) ||\n (Array.isArray(node) && all(node, includeImageAlt)))) ||\n ''\n )\n}\n\n/**\n * @param {Array.} values\n * @param {boolean} includeImageAlt\n * @returns {string}\n */\nfunction all(values, includeImageAlt) {\n /** @type {Array.} */\n var result = []\n var index = -1\n\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt)\n }\n\n return result.join('')\n}\n","/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {InitialConstruct} */\nexport const content = {\n tokenize: initializeContent\n}\n/** @type {Initializer} */\n\nfunction initializeContent(effects) {\n const contentStart = effects.attempt(\n this.parser.constructs.contentInitial,\n afterContentStartConstruct,\n paragraphInitial\n )\n /** @type {Token} */\n\n let previous\n return contentStart\n /** @type {State} */\n\n function afterContentStartConstruct(code) {\n if (code === null) {\n effects.consume(code)\n return\n }\n\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(effects, contentStart, 'linePrefix')\n }\n /** @type {State} */\n\n function paragraphInitial(code) {\n effects.enter('paragraph')\n return lineStart(code)\n }\n /** @type {State} */\n\n function lineStart(code) {\n const token = effects.enter('chunkText', {\n contentType: 'text',\n previous\n })\n\n if (previous) {\n previous.next = token\n }\n\n previous = token\n return data(code)\n }\n /** @type {State} */\n\n function data(code) {\n if (code === null) {\n effects.exit('chunkText')\n effects.exit('paragraph')\n effects.consume(code)\n return\n }\n\n if (markdownLineEnding(code)) {\n effects.consume(code)\n effects.exit('chunkText')\n return lineStart\n } // Data.\n\n effects.consume(code)\n return data\n }\n}\n","/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Point} Point\n */\n\n/**\n * @typedef {Record} StackState\n * @typedef {[Construct, StackState]} StackItem\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\nimport {splice} from 'micromark-util-chunked'\n/** @type {InitialConstruct} */\n\nexport const document = {\n tokenize: initializeDocument\n}\n/** @type {Construct} */\n\nconst containerConstruct = {\n tokenize: tokenizeContainer\n}\n/** @type {Initializer} */\n\nfunction initializeDocument(effects) {\n const self = this\n /** @type {Array} */\n\n const stack = []\n let continued = 0\n /** @type {TokenizeContext|undefined} */\n\n let childFlow\n /** @type {Token|undefined} */\n\n let childToken\n /** @type {number} */\n\n let lineStartOffset\n return start\n /** @type {State} */\n\n function start(code) {\n // First we iterate through the open blocks, starting with the root\n // document, and descending through last children down to the last open\n // block.\n // Each block imposes a condition that the line must satisfy if the block is\n // to remain open.\n // For example, a block quote requires a `>` character.\n // A paragraph requires a non-blank line.\n // In this phase we may match all or just some of the open blocks.\n // But we cannot close unmatched blocks yet, because we may have a lazy\n // continuation line.\n if (continued < stack.length) {\n const item = stack[continued]\n self.containerState = item[1]\n return effects.attempt(\n item[0].continuation,\n documentContinue,\n checkNewContainers\n )(code)\n } // Done.\n\n return checkNewContainers(code)\n }\n /** @type {State} */\n\n function documentContinue(code) {\n continued++ // Note: this field is called `_closeFlow` but it also closes containers.\n // Perhaps a good idea to rename it but it’s already used in the wild by\n // extensions.\n\n if (self.containerState._closeFlow) {\n self.containerState._closeFlow = undefined\n\n if (childFlow) {\n closeFlow()\n } // Note: this algorithm for moving events around is similar to the\n // algorithm when dealing with lazy lines in `writeToChild`.\n\n const indexBeforeExits = self.events.length\n let indexBeforeFlow = indexBeforeExits\n /** @type {Point|undefined} */\n\n let point // Find the flow chunk.\n\n while (indexBeforeFlow--) {\n if (\n self.events[indexBeforeFlow][0] === 'exit' &&\n self.events[indexBeforeFlow][1].type === 'chunkFlow'\n ) {\n point = self.events[indexBeforeFlow][1].end\n break\n }\n }\n\n exitContainers(continued) // Fix positions.\n\n let index = indexBeforeExits\n\n while (index < self.events.length) {\n self.events[index][1].end = Object.assign({}, point)\n index++\n } // Inject the exits earlier (they’re still also at the end).\n\n splice(\n self.events,\n indexBeforeFlow + 1,\n 0,\n self.events.slice(indexBeforeExits)\n ) // Discard the duplicate exits.\n\n self.events.length = index\n return checkNewContainers(code)\n }\n\n return start(code)\n }\n /** @type {State} */\n\n function checkNewContainers(code) {\n // Next, after consuming the continuation markers for existing blocks, we\n // look for new block starts (e.g. `>` for a block quote).\n // If we encounter a new block start, we close any blocks unmatched in\n // step 1 before creating the new block as a child of the last matched\n // block.\n if (continued === stack.length) {\n // No need to `check` whether there’s a container, of `exitContainers`\n // would be moot.\n // We can instead immediately `attempt` to parse one.\n if (!childFlow) {\n return documentContinued(code)\n } // If we have concrete content, such as block HTML or fenced code,\n // we can’t have containers “pierce” into them, so we can immediately\n // start.\n\n if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {\n return flowStart(code)\n } // If we do have flow, it could still be a blank line,\n // but we’d be interrupting it w/ a new container if there’s a current\n // construct.\n\n self.interrupt = Boolean(\n childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack\n )\n } // Check if there is a new container.\n\n self.containerState = {}\n return effects.check(\n containerConstruct,\n thereIsANewContainer,\n thereIsNoNewContainer\n )(code)\n }\n /** @type {State} */\n\n function thereIsANewContainer(code) {\n if (childFlow) closeFlow()\n exitContainers(continued)\n return documentContinued(code)\n }\n /** @type {State} */\n\n function thereIsNoNewContainer(code) {\n self.parser.lazy[self.now().line] = continued !== stack.length\n lineStartOffset = self.now().offset\n return flowStart(code)\n }\n /** @type {State} */\n\n function documentContinued(code) {\n // Try new containers.\n self.containerState = {}\n return effects.attempt(\n containerConstruct,\n containerContinue,\n flowStart\n )(code)\n }\n /** @type {State} */\n\n function containerContinue(code) {\n continued++\n stack.push([self.currentConstruct, self.containerState]) // Try another.\n\n return documentContinued(code)\n }\n /** @type {State} */\n\n function flowStart(code) {\n if (code === null) {\n if (childFlow) closeFlow()\n exitContainers(0)\n effects.consume(code)\n return\n }\n\n childFlow = childFlow || self.parser.flow(self.now())\n effects.enter('chunkFlow', {\n contentType: 'flow',\n previous: childToken,\n _tokenizer: childFlow\n })\n return flowContinue(code)\n }\n /** @type {State} */\n\n function flowContinue(code) {\n if (code === null) {\n writeToChild(effects.exit('chunkFlow'), true)\n exitContainers(0)\n effects.consume(code)\n return\n }\n\n if (markdownLineEnding(code)) {\n effects.consume(code)\n writeToChild(effects.exit('chunkFlow')) // Get ready for the next line.\n\n continued = 0\n self.interrupt = undefined\n return start\n }\n\n effects.consume(code)\n return flowContinue\n }\n /**\n * @param {Token} token\n * @param {boolean} [eof]\n * @returns {void}\n */\n\n function writeToChild(token, eof) {\n const stream = self.sliceStream(token)\n if (eof) stream.push(null)\n token.previous = childToken\n if (childToken) childToken.next = token\n childToken = token\n childFlow.defineSkip(token.start)\n childFlow.write(stream) // Alright, so we just added a lazy line:\n //\n // ```markdown\n // > a\n // b.\n //\n // Or:\n //\n // > ~~~c\n // d\n //\n // Or:\n //\n // > | e |\n // f\n // ```\n //\n // The construct in the second example (fenced code) does not accept lazy\n // lines, so it marked itself as done at the end of its first line, and\n // then the content construct parses `d`.\n // Most constructs in markdown match on the first line: if the first line\n // forms a construct, a non-lazy line can’t “unmake” it.\n //\n // The construct in the third example is potentially a GFM table, and\n // those are *weird*.\n // It *could* be a table, from the first line, if the following line\n // matches a condition.\n // In this case, that second line is lazy, which “unmakes” the first line\n // and turns the whole into one content block.\n //\n // We’ve now parsed the non-lazy and the lazy line, and can figure out\n // whether the lazy line started a new flow block.\n // If it did, we exit the current containers between the two flow blocks.\n\n if (self.parser.lazy[token.start.line]) {\n let index = childFlow.events.length\n\n while (index--) {\n if (\n // The token starts before the line ending…\n childFlow.events[index][1].start.offset < lineStartOffset && // …and either is not ended yet…\n (!childFlow.events[index][1].end || // …or ends after it.\n childFlow.events[index][1].end.offset > lineStartOffset)\n ) {\n // Exit: there’s still something open, which means it’s a lazy line\n // part of something.\n return\n }\n } // Note: this algorithm for moving events around is similar to the\n // algorithm when closing flow in `documentContinue`.\n\n const indexBeforeExits = self.events.length\n let indexBeforeFlow = indexBeforeExits\n /** @type {boolean|undefined} */\n\n let seen\n /** @type {Point|undefined} */\n\n let point // Find the previous chunk (the one before the lazy line).\n\n while (indexBeforeFlow--) {\n if (\n self.events[indexBeforeFlow][0] === 'exit' &&\n self.events[indexBeforeFlow][1].type === 'chunkFlow'\n ) {\n if (seen) {\n point = self.events[indexBeforeFlow][1].end\n break\n }\n\n seen = true\n }\n }\n\n exitContainers(continued) // Fix positions.\n\n index = indexBeforeExits\n\n while (index < self.events.length) {\n self.events[index][1].end = Object.assign({}, point)\n index++\n } // Inject the exits earlier (they’re still also at the end).\n\n splice(\n self.events,\n indexBeforeFlow + 1,\n 0,\n self.events.slice(indexBeforeExits)\n ) // Discard the duplicate exits.\n\n self.events.length = index\n }\n }\n /**\n * @param {number} size\n * @returns {void}\n */\n\n function exitContainers(size) {\n let index = stack.length // Exit open containers.\n\n while (index-- > size) {\n const entry = stack[index]\n self.containerState = entry[1]\n entry[0].exit.call(self, effects)\n }\n\n stack.length = size\n }\n\n function closeFlow() {\n childFlow.write([null])\n childToken = undefined\n childFlow = undefined\n self.containerState._closeFlow = undefined\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeContainer(effects, ok, nok) {\n return factorySpace(\n effects,\n effects.attempt(this.parser.constructs.document, ok, nok),\n 'linePrefix',\n this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4\n )\n}\n","/**\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Event} Event\n */\nimport {splice} from 'micromark-util-chunked'\n\n/**\n * Tokenize subcontent.\n *\n * @param {Event[]} events\n * @returns {boolean}\n */\nexport function subtokenize(events) {\n /** @type {Record} */\n const jumps = {}\n let index = -1\n /** @type {Event} */\n\n let event\n /** @type {number|undefined} */\n\n let lineIndex\n /** @type {number} */\n\n let otherIndex\n /** @type {Event} */\n\n let otherEvent\n /** @type {Event[]} */\n\n let parameters\n /** @type {Event[]} */\n\n let subevents\n /** @type {boolean|undefined} */\n\n let more\n\n while (++index < events.length) {\n while (index in jumps) {\n index = jumps[index]\n }\n\n event = events[index] // Add a hook for the GFM tasklist extension, which needs to know if text\n // is in the first content of a list item.\n\n if (\n index &&\n event[1].type === 'chunkFlow' &&\n events[index - 1][1].type === 'listItemPrefix'\n ) {\n subevents = event[1]._tokenizer.events\n otherIndex = 0\n\n if (\n otherIndex < subevents.length &&\n subevents[otherIndex][1].type === 'lineEndingBlank'\n ) {\n otherIndex += 2\n }\n\n if (\n otherIndex < subevents.length &&\n subevents[otherIndex][1].type === 'content'\n ) {\n while (++otherIndex < subevents.length) {\n if (subevents[otherIndex][1].type === 'content') {\n break\n }\n\n if (subevents[otherIndex][1].type === 'chunkText') {\n subevents[otherIndex][1]._isInFirstContentOfListItem = true\n otherIndex++\n }\n }\n }\n } // Enter.\n\n if (event[0] === 'enter') {\n if (event[1].contentType) {\n Object.assign(jumps, subcontent(events, index))\n index = jumps[index]\n more = true\n }\n } // Exit.\n else if (event[1]._container) {\n otherIndex = index\n lineIndex = undefined\n\n while (otherIndex--) {\n otherEvent = events[otherIndex]\n\n if (\n otherEvent[1].type === 'lineEnding' ||\n otherEvent[1].type === 'lineEndingBlank'\n ) {\n if (otherEvent[0] === 'enter') {\n if (lineIndex) {\n events[lineIndex][1].type = 'lineEndingBlank'\n }\n\n otherEvent[1].type = 'lineEnding'\n lineIndex = otherIndex\n }\n } else {\n break\n }\n }\n\n if (lineIndex) {\n // Fix position.\n event[1].end = Object.assign({}, events[lineIndex][1].start) // Switch container exit w/ line endings.\n\n parameters = events.slice(lineIndex, index)\n parameters.unshift(event)\n splice(events, lineIndex, index - lineIndex + 1, parameters)\n }\n }\n }\n\n return !more\n}\n/**\n * Tokenize embedded tokens.\n *\n * @param {Event[]} events\n * @param {number} eventIndex\n * @returns {Record}\n */\n\nfunction subcontent(events, eventIndex) {\n const token = events[eventIndex][1]\n const context = events[eventIndex][2]\n let startPosition = eventIndex - 1\n /** @type {number[]} */\n\n const startPositions = []\n const tokenizer =\n token._tokenizer || context.parser[token.contentType](token.start)\n const childEvents = tokenizer.events\n /** @type {[number, number][]} */\n\n const jumps = []\n /** @type {Record} */\n\n const gaps = {}\n /** @type {Chunk[]} */\n\n let stream\n /** @type {Token|undefined} */\n\n let previous\n let index = -1\n /** @type {Token|undefined} */\n\n let current = token\n let adjust = 0\n let start = 0\n const breaks = [start] // Loop forward through the linked tokens to pass them in order to the\n // subtokenizer.\n\n while (current) {\n // Find the position of the event for this token.\n while (events[++startPosition][1] !== current) {\n // Empty.\n }\n\n startPositions.push(startPosition)\n\n if (!current._tokenizer) {\n stream = context.sliceStream(current)\n\n if (!current.next) {\n stream.push(null)\n }\n\n if (previous) {\n tokenizer.defineSkip(current.start)\n }\n\n if (current._isInFirstContentOfListItem) {\n tokenizer._gfmTasklistFirstContentOfListItem = true\n }\n\n tokenizer.write(stream)\n\n if (current._isInFirstContentOfListItem) {\n tokenizer._gfmTasklistFirstContentOfListItem = undefined\n }\n } // Unravel the next token.\n\n previous = current\n current = current.next\n } // Now, loop back through all events (and linked tokens), to figure out which\n // parts belong where.\n\n current = token\n\n while (++index < childEvents.length) {\n if (\n // Find a void token that includes a break.\n childEvents[index][0] === 'exit' &&\n childEvents[index - 1][0] === 'enter' &&\n childEvents[index][1].type === childEvents[index - 1][1].type &&\n childEvents[index][1].start.line !== childEvents[index][1].end.line\n ) {\n start = index + 1\n breaks.push(start) // Help GC.\n\n current._tokenizer = undefined\n current.previous = undefined\n current = current.next\n }\n } // Help GC.\n\n tokenizer.events = [] // If there’s one more token (which is the cases for lines that end in an\n // EOF), that’s perfect: the last point we found starts it.\n // If there isn’t then make sure any remaining content is added to it.\n\n if (current) {\n // Help GC.\n current._tokenizer = undefined\n current.previous = undefined\n } else {\n breaks.pop()\n } // Now splice the events from the subtokenizer into the current events,\n // moving back to front so that splice indices aren’t affected.\n\n index = breaks.length\n\n while (index--) {\n const slice = childEvents.slice(breaks[index], breaks[index + 1])\n const start = startPositions.pop()\n jumps.unshift([start, start + slice.length - 1])\n splice(events, start, 2, slice)\n }\n\n index = -1\n\n while (++index < jumps.length) {\n gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]\n adjust += jumps[index][1] - jumps[index][0] - 1\n }\n\n return gaps\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\nimport {subtokenize} from 'micromark-util-subtokenize'\n\n/**\n * No name because it must not be turned off.\n * @type {Construct}\n */\nexport const content = {\n tokenize: tokenizeContent,\n resolve: resolveContent\n}\n/** @type {Construct} */\n\nconst continuationConstruct = {\n tokenize: tokenizeContinuation,\n partial: true\n}\n/**\n * Content is transparent: it’s parsed right now. That way, definitions are also\n * parsed right now: before text in paragraphs (specifically, media) are parsed.\n *\n * @type {Resolver}\n */\n\nfunction resolveContent(events) {\n subtokenize(events)\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeContent(effects, ok) {\n /** @type {Token} */\n let previous\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('content')\n previous = effects.enter('chunkContent', {\n contentType: 'content'\n })\n return data(code)\n }\n /** @type {State} */\n\n function data(code) {\n if (code === null) {\n return contentEnd(code)\n }\n\n if (markdownLineEnding(code)) {\n return effects.check(\n continuationConstruct,\n contentContinue,\n contentEnd\n )(code)\n } // Data.\n\n effects.consume(code)\n return data\n }\n /** @type {State} */\n\n function contentEnd(code) {\n effects.exit('chunkContent')\n effects.exit('content')\n return ok(code)\n }\n /** @type {State} */\n\n function contentContinue(code) {\n effects.consume(code)\n effects.exit('chunkContent')\n previous.next = effects.enter('chunkContent', {\n contentType: 'content',\n previous\n })\n previous = previous.next\n return data\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeContinuation(effects, ok, nok) {\n const self = this\n return startLookahead\n /** @type {State} */\n\n function startLookahead(code) {\n effects.exit('chunkContent')\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(effects, prefixed, 'linePrefix')\n }\n /** @type {State} */\n\n function prefixed(code) {\n if (code === null || markdownLineEnding(code)) {\n return nok(code)\n }\n\n const tail = self.events[self.events.length - 1]\n\n if (\n !self.parser.constructs.disable.null.includes('codeIndented') &&\n tail &&\n tail[1].type === 'linePrefix' &&\n tail[2].sliceSerialize(tail[1], true).length >= 4\n ) {\n return ok(code)\n }\n\n return effects.interrupt(self.parser.constructs.flow, nok, ok)(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {blankLine, content} from 'micromark-core-commonmark'\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {InitialConstruct} */\nexport const flow = {\n tokenize: initializeFlow\n}\n/** @type {Initializer} */\n\nfunction initializeFlow(effects) {\n const self = this\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine,\n atBlankEnding, // Try to parse initial flow (essentially, only code).\n effects.attempt(\n this.parser.constructs.flowInitial,\n afterConstruct,\n factorySpace(\n effects,\n effects.attempt(\n this.parser.constructs.flow,\n afterConstruct,\n effects.attempt(content, afterConstruct)\n ),\n 'linePrefix'\n )\n )\n )\n return initial\n /** @type {State} */\n\n function atBlankEnding(code) {\n if (code === null) {\n effects.consume(code)\n return\n }\n\n effects.enter('lineEndingBlank')\n effects.consume(code)\n effects.exit('lineEndingBlank')\n self.currentConstruct = undefined\n return initial\n }\n /** @type {State} */\n\n function afterConstruct(code) {\n if (code === null) {\n effects.consume(code)\n return\n }\n\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n self.currentConstruct = undefined\n return initial\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nexport const resolver = {\n resolveAll: createResolver()\n}\nexport const string = initializeFactory('string')\nexport const text = initializeFactory('text')\n/**\n * @param {'string'|'text'} field\n * @returns {InitialConstruct}\n */\n\nfunction initializeFactory(field) {\n return {\n tokenize: initializeText,\n resolveAll: createResolver(\n field === 'text' ? resolveAllLineSuffixes : undefined\n )\n }\n /** @type {Initializer} */\n\n function initializeText(effects) {\n const self = this\n const constructs = this.parser.constructs[field]\n const text = effects.attempt(constructs, start, notText)\n return start\n /** @type {State} */\n\n function start(code) {\n return atBreak(code) ? text(code) : notText(code)\n }\n /** @type {State} */\n\n function notText(code) {\n if (code === null) {\n effects.consume(code)\n return\n }\n\n effects.enter('data')\n effects.consume(code)\n return data\n }\n /** @type {State} */\n\n function data(code) {\n if (atBreak(code)) {\n effects.exit('data')\n return text(code)\n } // Data.\n\n effects.consume(code)\n return data\n }\n /**\n * @param {Code} code\n * @returns {boolean}\n */\n\n function atBreak(code) {\n if (code === null) {\n return true\n }\n\n const list = constructs[code]\n let index = -1\n\n if (list) {\n while (++index < list.length) {\n const item = list[index]\n\n if (!item.previous || item.previous.call(self, self.previous)) {\n return true\n }\n }\n }\n\n return false\n }\n }\n}\n/**\n * @param {Resolver} [extraResolver]\n * @returns {Resolver}\n */\n\nfunction createResolver(extraResolver) {\n return resolveAllText\n /** @type {Resolver} */\n\n function resolveAllText(events, context) {\n let index = -1\n /** @type {number|undefined} */\n\n let enter // A rather boring computation (to merge adjacent `data` events) which\n // improves mm performance by 29%.\n\n while (++index <= events.length) {\n if (enter === undefined) {\n if (events[index] && events[index][1].type === 'data') {\n enter = index\n index++\n }\n } else if (!events[index] || events[index][1].type !== 'data') {\n // Don’t do anything if there is one data token.\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end\n events.splice(enter + 2, index - enter - 2)\n index = enter + 2\n }\n\n enter = undefined\n }\n }\n\n return extraResolver ? extraResolver(events, context) : events\n }\n}\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\n\nfunction resolveAllLineSuffixes(events, context) {\n let eventIndex = 0 // Skip first.\n\n while (++eventIndex <= events.length) {\n if (\n (eventIndex === events.length ||\n events[eventIndex][1].type === 'lineEnding') &&\n events[eventIndex - 1][1].type === 'data'\n ) {\n const data = events[eventIndex - 1][1]\n const chunks = context.sliceStream(data)\n let index = chunks.length\n let bufferIndex = -1\n let size = 0\n /** @type {boolean|undefined} */\n\n let tabs\n\n while (index--) {\n const chunk = chunks[index]\n\n if (typeof chunk === 'string') {\n bufferIndex = chunk.length\n\n while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n size++\n bufferIndex--\n }\n\n if (bufferIndex) break\n bufferIndex = -1\n } // Number\n else if (chunk === -2) {\n tabs = true\n size++\n } else if (chunk === -1) {\n // Empty\n } else {\n // Replacement character, exit.\n index++\n break\n }\n }\n\n if (size) {\n const token = {\n type:\n eventIndex === events.length || tabs || size < 2\n ? 'lineSuffix'\n : 'hardBreakTrailing',\n start: {\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size,\n _index: data.start._index + index,\n _bufferIndex: index\n ? bufferIndex\n : data.start._bufferIndex + bufferIndex\n },\n end: Object.assign({}, data.end)\n }\n data.end = Object.assign({}, token.start)\n\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token)\n } else {\n events.splice(\n eventIndex,\n 0,\n ['enter', token, context],\n ['exit', token, context]\n )\n eventIndex += 2\n }\n }\n\n eventIndex++\n }\n }\n\n return events\n}\n","/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Point} Point\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n */\n\n/**\n * @typedef Info\n * @property {() => void} restore\n * @property {number} from\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * @param {Info} info\n * @returns {void}\n */\nimport {markdownLineEnding} from 'micromark-util-character'\nimport {push, splice} from 'micromark-util-chunked'\nimport {resolveAll} from 'micromark-util-resolve-all'\n\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n * @param {InitialConstruct} initialize\n * @param {Omit} [from]\n * @returns {TokenizeContext}\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = Object.assign(\n from\n ? Object.assign({}, from)\n : {\n line: 1,\n column: 1,\n offset: 0\n },\n {\n _index: 0,\n _bufferIndex: -1\n }\n )\n /** @type {Record} */\n\n const columnStart = {}\n /** @type {Array} */\n\n const resolveAllConstructs = []\n /** @type {Array} */\n\n let chunks = []\n /** @type {Array} */\n\n let stack = []\n /** @type {boolean|undefined} */\n\n let consumed = true\n /**\n * Tools used for tokenizing.\n *\n * @type {Effects}\n */\n\n const effects = {\n consume,\n enter,\n exit,\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\n interrupt: constructFactory(onsuccessfulcheck, {\n interrupt: true\n })\n }\n /**\n * State and tools for resolving and serializing.\n *\n * @type {TokenizeContext}\n */\n\n const context = {\n previous: null,\n code: null,\n containerState: {},\n events: [],\n parser,\n sliceStream,\n sliceSerialize,\n now,\n defineSkip,\n write\n }\n /**\n * The state function.\n *\n * @type {State|void}\n */\n\n let state = initialize.tokenize.call(context, effects)\n /**\n * Track which character we expect to be consumed, to catch bugs.\n *\n * @type {Code}\n */\n\n let expectedCode\n\n if (initialize.resolveAll) {\n resolveAllConstructs.push(initialize)\n }\n\n return context\n /** @type {TokenizeContext['write']} */\n\n function write(slice) {\n chunks = push(chunks, slice)\n main() // Exit if we’re not done, resolve might change stuff.\n\n if (chunks[chunks.length - 1] !== null) {\n return []\n }\n\n addResult(initialize, 0) // Otherwise, resolve, and exit.\n\n context.events = resolveAll(resolveAllConstructs, context.events, context)\n return context.events\n } //\n // Tools.\n //\n\n /** @type {TokenizeContext['sliceSerialize']} */\n\n function sliceSerialize(token, expandTabs) {\n return serializeChunks(sliceStream(token), expandTabs)\n }\n /** @type {TokenizeContext['sliceStream']} */\n\n function sliceStream(token) {\n return sliceChunks(chunks, token)\n }\n /** @type {TokenizeContext['now']} */\n\n function now() {\n return Object.assign({}, point)\n }\n /** @type {TokenizeContext['defineSkip']} */\n\n function defineSkip(value) {\n columnStart[value.line] = value.column\n accountForPotentialSkip()\n } //\n // State management.\n //\n\n /**\n * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n * `consume`).\n * Here is where we walk through the chunks, which either include strings of\n * several characters, or numerical character codes.\n * The reason to do this in a loop instead of a call is so the stack can\n * drain.\n *\n * @returns {void}\n */\n\n function main() {\n /** @type {number} */\n let chunkIndex\n\n while (point._index < chunks.length) {\n const chunk = chunks[point._index] // If we’re in a buffer chunk, loop through it.\n\n if (typeof chunk === 'string') {\n chunkIndex = point._index\n\n if (point._bufferIndex < 0) {\n point._bufferIndex = 0\n }\n\n while (\n point._index === chunkIndex &&\n point._bufferIndex < chunk.length\n ) {\n go(chunk.charCodeAt(point._bufferIndex))\n }\n } else {\n go(chunk)\n }\n }\n }\n /**\n * Deal with one code.\n *\n * @param {Code} code\n * @returns {void}\n */\n\n function go(code) {\n consumed = undefined\n expectedCode = code\n state = state(code)\n }\n /** @type {Effects['consume']} */\n\n function consume(code) {\n if (markdownLineEnding(code)) {\n point.line++\n point.column = 1\n point.offset += code === -3 ? 2 : 1\n accountForPotentialSkip()\n } else if (code !== -1) {\n point.column++\n point.offset++\n } // Not in a string chunk.\n\n if (point._bufferIndex < 0) {\n point._index++\n } else {\n point._bufferIndex++ // At end of string chunk.\n // @ts-expect-error Points w/ non-negative `_bufferIndex` reference\n // strings.\n\n if (point._bufferIndex === chunks[point._index].length) {\n point._bufferIndex = -1\n point._index++\n }\n } // Expose the previous character.\n\n context.previous = code // Mark as consumed.\n\n consumed = true\n }\n /** @type {Effects['enter']} */\n\n function enter(type, fields) {\n /** @type {Token} */\n // @ts-expect-error Patch instead of assign required fields to help GC.\n const token = fields || {}\n token.type = type\n token.start = now()\n context.events.push(['enter', token, context])\n stack.push(token)\n return token\n }\n /** @type {Effects['exit']} */\n\n function exit(type) {\n const token = stack.pop()\n token.end = now()\n context.events.push(['exit', token, context])\n return token\n }\n /**\n * Use results.\n *\n * @type {ReturnHandle}\n */\n\n function onsuccessfulconstruct(construct, info) {\n addResult(construct, info.from)\n }\n /**\n * Discard results.\n *\n * @type {ReturnHandle}\n */\n\n function onsuccessfulcheck(_, info) {\n info.restore()\n }\n /**\n * Factory to attempt/check/interrupt.\n *\n * @param {ReturnHandle} onreturn\n * @param {Record} [fields]\n */\n\n function constructFactory(onreturn, fields) {\n return hook\n /**\n * Handle either an object mapping codes to constructs, a list of\n * constructs, or a single construct.\n *\n * @param {Construct|Array|ConstructRecord} constructs\n * @param {State} returnState\n * @param {State} [bogusState]\n * @returns {State}\n */\n\n function hook(constructs, returnState, bogusState) {\n /** @type {Array} */\n let listOfConstructs\n /** @type {number} */\n\n let constructIndex\n /** @type {Construct} */\n\n let currentConstruct\n /** @type {Info} */\n\n let info\n return Array.isArray(constructs)\n ? /* c8 ignore next 1 */\n handleListOfConstructs(constructs)\n : 'tokenize' in constructs // @ts-expect-error Looks like a construct.\n ? handleListOfConstructs([constructs])\n : handleMapOfConstructs(constructs)\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * @returns {State}\n */\n\n function handleMapOfConstructs(map) {\n return start\n /** @type {State} */\n\n function start(code) {\n const def = code !== null && map[code]\n const all = code !== null && map.null\n const list = [\n // To do: add more extension tests.\n\n /* c8 ignore next 2 */\n ...(Array.isArray(def) ? def : def ? [def] : []),\n ...(Array.isArray(all) ? all : all ? [all] : [])\n ]\n return handleListOfConstructs(list)(code)\n }\n }\n /**\n * Handle a list of construct.\n *\n * @param {Array} list\n * @returns {State}\n */\n\n function handleListOfConstructs(list) {\n listOfConstructs = list\n constructIndex = 0\n\n if (list.length === 0) {\n return bogusState\n }\n\n return handleConstruct(list[constructIndex])\n }\n /**\n * Handle a single construct.\n *\n * @param {Construct} construct\n * @returns {State}\n */\n\n function handleConstruct(construct) {\n return start\n /** @type {State} */\n\n function start(code) {\n // To do: not needed to store if there is no bogus state, probably?\n // Currently doesn’t work because `inspect` in document does a check\n // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n // by not storing.\n info = store()\n currentConstruct = construct\n\n if (!construct.partial) {\n context.currentConstruct = construct\n }\n\n if (\n construct.name &&\n context.parser.constructs.disable.null.includes(construct.name)\n ) {\n return nok(code)\n }\n\n return construct.tokenize.call(\n // If we do have fields, create an object w/ `context` as its\n // prototype.\n // This allows a “live binding”, which is needed for `interrupt`.\n fields ? Object.assign(Object.create(context), fields) : context,\n effects,\n ok,\n nok\n )(code)\n }\n }\n /** @type {State} */\n\n function ok(code) {\n consumed = true\n onreturn(currentConstruct, info)\n return returnState\n }\n /** @type {State} */\n\n function nok(code) {\n consumed = true\n info.restore()\n\n if (++constructIndex < listOfConstructs.length) {\n return handleConstruct(listOfConstructs[constructIndex])\n }\n\n return bogusState\n }\n }\n }\n /**\n * @param {Construct} construct\n * @param {number} from\n * @returns {void}\n */\n\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct)\n }\n\n if (construct.resolve) {\n splice(\n context.events,\n from,\n context.events.length - from,\n construct.resolve(context.events.slice(from), context)\n )\n }\n\n if (construct.resolveTo) {\n context.events = construct.resolveTo(context.events, context)\n }\n }\n /**\n * Store state.\n *\n * @returns {Info}\n */\n\n function store() {\n const startPoint = now()\n const startPrevious = context.previous\n const startCurrentConstruct = context.currentConstruct\n const startEventsIndex = context.events.length\n const startStack = Array.from(stack)\n return {\n restore,\n from: startEventsIndex\n }\n /**\n * Restore state.\n *\n * @returns {void}\n */\n\n function restore() {\n point = startPoint\n context.previous = startPrevious\n context.currentConstruct = startCurrentConstruct\n context.events.length = startEventsIndex\n stack = startStack\n accountForPotentialSkip()\n }\n }\n /**\n * Move the current point a bit forward in the line when it’s on a column\n * skip.\n *\n * @returns {void}\n */\n\n function accountForPotentialSkip() {\n if (point.line in columnStart && point.column < 2) {\n point.column = columnStart[point.line]\n point.offset += columnStart[point.line] - 1\n }\n }\n}\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {Array} chunks\n * @param {Pick} token\n * @returns {Array}\n */\n\nfunction sliceChunks(chunks, token) {\n const startIndex = token.start._index\n const startBufferIndex = token.start._bufferIndex\n const endIndex = token.end._index\n const endBufferIndex = token.end._bufferIndex\n /** @type {Array} */\n\n let view\n\n if (startIndex === endIndex) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]\n } else {\n view = chunks.slice(startIndex, endIndex)\n\n if (startBufferIndex > -1) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view[0] = view[0].slice(startBufferIndex)\n }\n\n if (endBufferIndex > 0) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view.push(chunks[endIndex].slice(0, endBufferIndex))\n }\n }\n\n return view\n}\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {Array} chunks\n * @param {boolean} [expandTabs=false]\n * @returns {string}\n */\n\nfunction serializeChunks(chunks, expandTabs) {\n let index = -1\n /** @type {Array} */\n\n const result = []\n /** @type {boolean|undefined} */\n\n let atTab\n\n while (++index < chunks.length) {\n const chunk = chunks[index]\n /** @type {string} */\n\n let value\n\n if (typeof chunk === 'string') {\n value = chunk\n } else\n switch (chunk) {\n case -5: {\n value = '\\r'\n break\n }\n\n case -4: {\n value = '\\n'\n break\n }\n\n case -3: {\n value = '\\r' + '\\n'\n break\n }\n\n case -2: {\n value = expandTabs ? ' ' : '\\t'\n break\n }\n\n case -1: {\n if (!expandTabs && atTab) continue\n value = ' '\n break\n }\n\n default: {\n // Currently only replacement character.\n value = String.fromCharCode(chunk)\n }\n }\n\n atTab = chunk === -2\n result.push(value)\n }\n\n return result.join('')\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding, markdownSpace} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const thematicBreak = {\n name: 'thematicBreak',\n tokenize: tokenizeThematicBreak\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeThematicBreak(effects, ok, nok) {\n let size = 0\n /** @type {NonNullable} */\n\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('thematicBreak')\n marker = code\n return atBreak(code)\n }\n /** @type {State} */\n\n function atBreak(code) {\n if (code === marker) {\n effects.enter('thematicBreakSequence')\n return sequence(code)\n }\n\n if (markdownSpace(code)) {\n return factorySpace(effects, atBreak, 'whitespace')(code)\n }\n\n if (size < 3 || (code !== null && !markdownLineEnding(code))) {\n return nok(code)\n }\n\n effects.exit('thematicBreak')\n return ok(code)\n }\n /** @type {State} */\n\n function sequence(code) {\n if (code === marker) {\n effects.consume(code)\n size++\n return sequence\n }\n\n effects.exit('thematicBreakSequence')\n return atBreak(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Exiter} Exiter\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\n\n/**\n * @typedef {Record & {marker: Code, type: string, size: number}} ListContainerState\n * @typedef {TokenizeContext & {containerState: ListContainerState}} TokenizeContextWithState\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {asciiDigit, markdownSpace} from 'micromark-util-character'\nimport {blankLine} from './blank-line.js'\nimport {thematicBreak} from './thematic-break.js'\n/** @type {Construct} */\n\nexport const list = {\n name: 'list',\n tokenize: tokenizeListStart,\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd\n}\n/** @type {Construct} */\n\nconst listItemPrefixWhitespaceConstruct = {\n tokenize: tokenizeListItemPrefixWhitespace,\n partial: true\n}\n/** @type {Construct} */\n\nconst indentConstruct = {\n tokenize: tokenizeIndent,\n partial: true\n}\n/**\n * @type {Tokenizer}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this\n const tail = self.events[self.events.length - 1]\n let initialSize =\n tail && tail[1].type === 'linePrefix'\n ? tail[2].sliceSerialize(tail[1], true).length\n : 0\n let size = 0\n return start\n /** @type {State} */\n\n function start(code) {\n const kind =\n self.containerState.type ||\n (code === 42 || code === 43 || code === 45\n ? 'listUnordered'\n : 'listOrdered')\n\n if (\n kind === 'listUnordered'\n ? !self.containerState.marker || code === self.containerState.marker\n : asciiDigit(code)\n ) {\n if (!self.containerState.type) {\n self.containerState.type = kind\n effects.enter(kind, {\n _container: true\n })\n }\n\n if (kind === 'listUnordered') {\n effects.enter('listItemPrefix')\n return code === 42 || code === 45\n ? effects.check(thematicBreak, nok, atMarker)(code)\n : atMarker(code)\n }\n\n if (!self.interrupt || code === 49) {\n effects.enter('listItemPrefix')\n effects.enter('listItemValue')\n return inside(code)\n }\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function inside(code) {\n if (asciiDigit(code) && ++size < 10) {\n effects.consume(code)\n return inside\n }\n\n if (\n (!self.interrupt || size < 2) &&\n (self.containerState.marker\n ? code === self.containerState.marker\n : code === 41 || code === 46)\n ) {\n effects.exit('listItemValue')\n return atMarker(code)\n }\n\n return nok(code)\n }\n /**\n * @type {State}\n **/\n\n function atMarker(code) {\n effects.enter('listItemMarker')\n effects.consume(code)\n effects.exit('listItemMarker')\n self.containerState.marker = self.containerState.marker || code\n return effects.check(\n blankLine, // Can’t be empty when interrupting.\n self.interrupt ? nok : onBlank,\n effects.attempt(\n listItemPrefixWhitespaceConstruct,\n endOfPrefix,\n otherPrefix\n )\n )\n }\n /** @type {State} */\n\n function onBlank(code) {\n self.containerState.initialBlankLine = true\n initialSize++\n return endOfPrefix(code)\n }\n /** @type {State} */\n\n function otherPrefix(code) {\n if (markdownSpace(code)) {\n effects.enter('listItemPrefixWhitespace')\n effects.consume(code)\n effects.exit('listItemPrefixWhitespace')\n return endOfPrefix\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function endOfPrefix(code) {\n self.containerState.size =\n initialSize +\n self.sliceSerialize(effects.exit('listItemPrefix'), true).length\n return ok(code)\n }\n}\n/**\n * @type {Tokenizer}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeListContinuation(effects, ok, nok) {\n const self = this\n self.containerState._closeFlow = undefined\n return effects.check(blankLine, onBlank, notBlank)\n /** @type {State} */\n\n function onBlank(code) {\n self.containerState.furtherBlankLines =\n self.containerState.furtherBlankLines ||\n self.containerState.initialBlankLine // We have a blank line.\n // Still, try to consume at most the items size.\n\n return factorySpace(\n effects,\n ok,\n 'listItemIndent',\n self.containerState.size + 1\n )(code)\n }\n /** @type {State} */\n\n function notBlank(code) {\n if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n self.containerState.furtherBlankLines = undefined\n self.containerState.initialBlankLine = undefined\n return notInCurrentItem(code)\n }\n\n self.containerState.furtherBlankLines = undefined\n self.containerState.initialBlankLine = undefined\n return effects.attempt(indentConstruct, ok, notInCurrentItem)(code)\n }\n /** @type {State} */\n\n function notInCurrentItem(code) {\n // While we do continue, we signal that the flow should be closed.\n self.containerState._closeFlow = true // As we’re closing flow, we’re no longer interrupting.\n\n self.interrupt = undefined\n return factorySpace(\n effects,\n effects.attempt(list, ok, nok),\n 'linePrefix',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )(code)\n }\n}\n/**\n * @type {Tokenizer}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this\n return factorySpace(\n effects,\n afterPrefix,\n 'listItemIndent',\n self.containerState.size + 1\n )\n /** @type {State} */\n\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === 'listItemIndent' &&\n tail[2].sliceSerialize(tail[1], true).length === self.containerState.size\n ? ok(code)\n : nok(code)\n }\n}\n/**\n * @type {Exiter}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type)\n}\n/**\n * @type {Tokenizer}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this\n return factorySpace(\n effects,\n afterPrefix,\n 'listItemPrefixWhitespace',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4 + 1\n )\n /** @type {State} */\n\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return !markdownSpace(code) &&\n tail &&\n tail[1].type === 'listItemPrefixWhitespace'\n ? ok(code)\n : nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Exiter} Exiter\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownSpace} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const blockQuote = {\n name: 'blockQuote',\n tokenize: tokenizeBlockQuoteStart,\n continuation: {\n tokenize: tokenizeBlockQuoteContinuation\n },\n exit\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeBlockQuoteStart(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n if (code === 62) {\n const state = self.containerState\n\n if (!state.open) {\n effects.enter('blockQuote', {\n _container: true\n })\n state.open = true\n }\n\n effects.enter('blockQuotePrefix')\n effects.enter('blockQuoteMarker')\n effects.consume(code)\n effects.exit('blockQuoteMarker')\n return after\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function after(code) {\n if (markdownSpace(code)) {\n effects.enter('blockQuotePrefixWhitespace')\n effects.consume(code)\n effects.exit('blockQuotePrefixWhitespace')\n effects.exit('blockQuotePrefix')\n return ok\n }\n\n effects.exit('blockQuotePrefix')\n return ok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeBlockQuoteContinuation(effects, ok, nok) {\n return factorySpace(\n effects,\n effects.attempt(blockQuote, ok, nok),\n 'linePrefix',\n this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4\n )\n}\n/** @type {Exiter} */\n\nfunction exit(effects) {\n effects.exit('blockQuote')\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n */\nimport {\n asciiControl,\n markdownLineEndingOrSpace,\n markdownLineEnding\n} from 'micromark-util-character'\n\n/**\n * @param {Effects} effects\n * @param {State} ok\n * @param {State} nok\n * @param {string} type\n * @param {string} literalType\n * @param {string} literalMarkerType\n * @param {string} rawType\n * @param {string} stringType\n * @param {number} [max=Infinity]\n * @returns {State}\n */\n// eslint-disable-next-line max-params\nexport function factoryDestination(\n effects,\n ok,\n nok,\n type,\n literalType,\n literalMarkerType,\n rawType,\n stringType,\n max\n) {\n const limit = max || Number.POSITIVE_INFINITY\n let balance = 0\n return start\n /** @type {State} */\n\n function start(code) {\n if (code === 60) {\n effects.enter(type)\n effects.enter(literalType)\n effects.enter(literalMarkerType)\n effects.consume(code)\n effects.exit(literalMarkerType)\n return destinationEnclosedBefore\n }\n\n if (code === null || code === 41 || asciiControl(code)) {\n return nok(code)\n }\n\n effects.enter(type)\n effects.enter(rawType)\n effects.enter(stringType)\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return destinationRaw(code)\n }\n /** @type {State} */\n\n function destinationEnclosedBefore(code) {\n if (code === 62) {\n effects.enter(literalMarkerType)\n effects.consume(code)\n effects.exit(literalMarkerType)\n effects.exit(literalType)\n effects.exit(type)\n return ok\n }\n\n effects.enter(stringType)\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return destinationEnclosed(code)\n }\n /** @type {State} */\n\n function destinationEnclosed(code) {\n if (code === 62) {\n effects.exit('chunkString')\n effects.exit(stringType)\n return destinationEnclosedBefore(code)\n }\n\n if (code === null || code === 60 || markdownLineEnding(code)) {\n return nok(code)\n }\n\n effects.consume(code)\n return code === 92 ? destinationEnclosedEscape : destinationEnclosed\n }\n /** @type {State} */\n\n function destinationEnclosedEscape(code) {\n if (code === 60 || code === 62 || code === 92) {\n effects.consume(code)\n return destinationEnclosed\n }\n\n return destinationEnclosed(code)\n }\n /** @type {State} */\n\n function destinationRaw(code) {\n if (code === 40) {\n if (++balance > limit) return nok(code)\n effects.consume(code)\n return destinationRaw\n }\n\n if (code === 41) {\n if (!balance--) {\n effects.exit('chunkString')\n effects.exit(stringType)\n effects.exit(rawType)\n effects.exit(type)\n return ok(code)\n }\n\n effects.consume(code)\n return destinationRaw\n }\n\n if (code === null || markdownLineEndingOrSpace(code)) {\n if (balance) return nok(code)\n effects.exit('chunkString')\n effects.exit(stringType)\n effects.exit(rawType)\n effects.exit(type)\n return ok(code)\n }\n\n if (asciiControl(code)) return nok(code)\n effects.consume(code)\n return code === 92 ? destinationRawEscape : destinationRaw\n }\n /** @type {State} */\n\n function destinationRawEscape(code) {\n if (code === 40 || code === 41 || code === 92) {\n effects.consume(code)\n return destinationRaw\n }\n\n return destinationRaw(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').State} State\n */\nimport {markdownLineEnding, markdownSpace} from 'micromark-util-character'\n\n/**\n * @this {TokenizeContext}\n * @param {Effects} effects\n * @param {State} ok\n * @param {State} nok\n * @param {string} type\n * @param {string} markerType\n * @param {string} stringType\n * @returns {State}\n */\n// eslint-disable-next-line max-params\nexport function factoryLabel(effects, ok, nok, type, markerType, stringType) {\n const self = this\n let size = 0\n /** @type {boolean} */\n\n let data\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter(type)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.enter(stringType)\n return atBreak\n }\n /** @type {State} */\n\n function atBreak(code) {\n if (\n code === null ||\n code === 91 ||\n (code === 93 && !data) ||\n /* To do: remove in the future once we’ve switched from\n * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n * which doesn’t need this */\n\n /* Hidden footnotes hook */\n\n /* c8 ignore next 3 */\n (code === 94 &&\n !size &&\n '_hiddenFootnoteSupport' in self.parser.constructs) ||\n size > 999\n ) {\n return nok(code)\n }\n\n if (code === 93) {\n effects.exit(stringType)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.exit(type)\n return ok\n }\n\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return atBreak\n }\n\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return label(code)\n }\n /** @type {State} */\n\n function label(code) {\n if (\n code === null ||\n code === 91 ||\n code === 93 ||\n markdownLineEnding(code) ||\n size++ > 999\n ) {\n effects.exit('chunkString')\n return atBreak(code)\n }\n\n effects.consume(code)\n data = data || !markdownSpace(code)\n return code === 92 ? labelEscape : label\n }\n /** @type {State} */\n\n function labelEscape(code) {\n if (code === 91 || code === 92 || code === 93) {\n effects.consume(code)\n size++\n return label\n }\n\n return label(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/**\n * @param {Effects} effects\n * @param {State} ok\n * @param {State} nok\n * @param {string} type\n * @param {string} markerType\n * @param {string} stringType\n * @returns {State}\n */\n// eslint-disable-next-line max-params\nexport function factoryTitle(effects, ok, nok, type, markerType, stringType) {\n /** @type {NonNullable} */\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter(type)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n marker = code === 40 ? 41 : code\n return atFirstTitleBreak\n }\n /** @type {State} */\n\n function atFirstTitleBreak(code) {\n if (code === marker) {\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.exit(type)\n return ok\n }\n\n effects.enter(stringType)\n return atTitleBreak(code)\n }\n /** @type {State} */\n\n function atTitleBreak(code) {\n if (code === marker) {\n effects.exit(stringType)\n return atFirstTitleBreak(marker)\n }\n\n if (code === null) {\n return nok(code)\n } // Note: blank lines can’t exist in content.\n\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(effects, atTitleBreak, 'linePrefix')\n }\n\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return title(code)\n }\n /** @type {State} */\n\n function title(code) {\n if (code === marker || code === null || markdownLineEnding(code)) {\n effects.exit('chunkString')\n return atTitleBreak(code)\n }\n\n effects.consume(code)\n return code === 92 ? titleEscape : title\n }\n /** @type {State} */\n\n function titleEscape(code) {\n if (code === marker || code === 92) {\n effects.consume(code)\n return title\n }\n\n return title(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding, markdownSpace} from 'micromark-util-character'\n\n/**\n * @param {Effects} effects\n * @param {State} ok\n */\nexport function factoryWhitespace(effects, ok) {\n /** @type {boolean} */\n let seen\n return start\n /** @type {State} */\n\n function start(code) {\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n seen = true\n return start\n }\n\n if (markdownSpace(code)) {\n return factorySpace(\n effects,\n start,\n seen ? 'linePrefix' : 'lineSuffix'\n )(code)\n }\n\n return ok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factoryDestination} from 'micromark-factory-destination'\nimport {factoryLabel} from 'micromark-factory-label'\nimport {factorySpace} from 'micromark-factory-space'\nimport {factoryTitle} from 'micromark-factory-title'\nimport {factoryWhitespace} from 'micromark-factory-whitespace'\nimport {normalizeIdentifier} from 'micromark-util-normalize-identifier'\nimport {\n markdownLineEnding,\n markdownLineEndingOrSpace\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const definition = {\n name: 'definition',\n tokenize: tokenizeDefinition\n}\n/** @type {Construct} */\n\nconst titleConstruct = {\n tokenize: tokenizeTitle,\n partial: true\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeDefinition(effects, ok, nok) {\n const self = this\n /** @type {string} */\n\n let identifier\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('definition')\n return factoryLabel.call(\n self,\n effects,\n labelAfter,\n nok,\n 'definitionLabel',\n 'definitionLabelMarker',\n 'definitionLabelString'\n )(code)\n }\n /** @type {State} */\n\n function labelAfter(code) {\n identifier = normalizeIdentifier(\n self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)\n )\n\n if (code === 58) {\n effects.enter('definitionMarker')\n effects.consume(code)\n effects.exit('definitionMarker') // Note: blank lines can’t exist in content.\n\n return factoryWhitespace(\n effects,\n factoryDestination(\n effects,\n effects.attempt(\n titleConstruct,\n factorySpace(effects, after, 'whitespace'),\n factorySpace(effects, after, 'whitespace')\n ),\n nok,\n 'definitionDestination',\n 'definitionDestinationLiteral',\n 'definitionDestinationLiteralMarker',\n 'definitionDestinationRaw',\n 'definitionDestinationString'\n )\n )\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function after(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('definition')\n\n if (!self.parser.defined.includes(identifier)) {\n self.parser.defined.push(identifier)\n }\n\n return ok(code)\n }\n\n return nok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeTitle(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n return markdownLineEndingOrSpace(code)\n ? factoryWhitespace(effects, before)(code)\n : nok(code)\n }\n /** @type {State} */\n\n function before(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(\n effects,\n factorySpace(effects, after, 'whitespace'),\n nok,\n 'definitionTitle',\n 'definitionTitleMarker',\n 'definitionTitleString'\n )(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function after(code) {\n return code === null || markdownLineEnding(code) ? ok(code) : nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const codeIndented = {\n name: 'codeIndented',\n tokenize: tokenizeCodeIndented\n}\n/** @type {Construct} */\n\nconst indentedContent = {\n tokenize: tokenizeIndentedContent,\n partial: true\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCodeIndented(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('codeIndented')\n return factorySpace(effects, afterStartPrefix, 'linePrefix', 4 + 1)(code)\n }\n /** @type {State} */\n\n function afterStartPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === 'linePrefix' &&\n tail[2].sliceSerialize(tail[1], true).length >= 4\n ? afterPrefix(code)\n : nok(code)\n }\n /** @type {State} */\n\n function afterPrefix(code) {\n if (code === null) {\n return after(code)\n }\n\n if (markdownLineEnding(code)) {\n return effects.attempt(indentedContent, afterPrefix, after)(code)\n }\n\n effects.enter('codeFlowValue')\n return content(code)\n }\n /** @type {State} */\n\n function content(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('codeFlowValue')\n return afterPrefix(code)\n }\n\n effects.consume(code)\n return content\n }\n /** @type {State} */\n\n function after(code) {\n effects.exit('codeIndented')\n return ok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeIndentedContent(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n // If this is a lazy line, it can’t be code.\n if (self.parser.lazy[self.now().line]) {\n return nok(code)\n }\n\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return start\n }\n\n return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code)\n }\n /** @type {State} */\n\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === 'linePrefix' &&\n tail[2].sliceSerialize(tail[1], true).length >= 4\n ? ok(code)\n : markdownLineEnding(code)\n ? start(code)\n : nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {\n markdownLineEnding,\n markdownLineEndingOrSpace,\n markdownSpace\n} from 'micromark-util-character'\nimport {splice} from 'micromark-util-chunked'\n\n/** @type {Construct} */\nexport const headingAtx = {\n name: 'headingAtx',\n tokenize: tokenizeHeadingAtx,\n resolve: resolveHeadingAtx\n}\n/** @type {Resolver} */\n\nfunction resolveHeadingAtx(events, context) {\n let contentEnd = events.length - 2\n let contentStart = 3\n /** @type {Token} */\n\n let content\n /** @type {Token} */\n\n let text // Prefix whitespace, part of the opening.\n\n if (events[contentStart][1].type === 'whitespace') {\n contentStart += 2\n } // Suffix whitespace, part of the closing.\n\n if (\n contentEnd - 2 > contentStart &&\n events[contentEnd][1].type === 'whitespace'\n ) {\n contentEnd -= 2\n }\n\n if (\n events[contentEnd][1].type === 'atxHeadingSequence' &&\n (contentStart === contentEnd - 1 ||\n (contentEnd - 4 > contentStart &&\n events[contentEnd - 2][1].type === 'whitespace'))\n ) {\n contentEnd -= contentStart + 1 === contentEnd ? 2 : 4\n }\n\n if (contentEnd > contentStart) {\n content = {\n type: 'atxHeadingText',\n start: events[contentStart][1].start,\n end: events[contentEnd][1].end\n }\n text = {\n type: 'chunkText',\n start: events[contentStart][1].start,\n end: events[contentEnd][1].end,\n // @ts-expect-error Constants are fine to assign.\n contentType: 'text'\n }\n splice(events, contentStart, contentEnd - contentStart + 1, [\n ['enter', content, context],\n ['enter', text, context],\n ['exit', text, context],\n ['exit', content, context]\n ])\n }\n\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeHeadingAtx(effects, ok, nok) {\n const self = this\n let size = 0\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('atxHeading')\n effects.enter('atxHeadingSequence')\n return fenceOpenInside(code)\n }\n /** @type {State} */\n\n function fenceOpenInside(code) {\n if (code === 35 && size++ < 6) {\n effects.consume(code)\n return fenceOpenInside\n }\n\n if (code === null || markdownLineEndingOrSpace(code)) {\n effects.exit('atxHeadingSequence')\n return self.interrupt ? ok(code) : headingBreak(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function headingBreak(code) {\n if (code === 35) {\n effects.enter('atxHeadingSequence')\n return sequence(code)\n }\n\n if (code === null || markdownLineEnding(code)) {\n effects.exit('atxHeading')\n return ok(code)\n }\n\n if (markdownSpace(code)) {\n return factorySpace(effects, headingBreak, 'whitespace')(code)\n }\n\n effects.enter('atxHeadingText')\n return data(code)\n }\n /** @type {State} */\n\n function sequence(code) {\n if (code === 35) {\n effects.consume(code)\n return sequence\n }\n\n effects.exit('atxHeadingSequence')\n return headingBreak(code)\n }\n /** @type {State} */\n\n function data(code) {\n if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {\n effects.exit('atxHeadingText')\n return headingBreak(code)\n }\n\n effects.consume(code)\n return data\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const setextUnderline = {\n name: 'setextUnderline',\n tokenize: tokenizeSetextUnderline,\n resolveTo: resolveToSetextUnderline\n}\n/** @type {Resolver} */\n\nfunction resolveToSetextUnderline(events, context) {\n let index = events.length\n /** @type {number|undefined} */\n\n let content\n /** @type {number|undefined} */\n\n let text\n /** @type {number|undefined} */\n\n let definition // Find the opening of the content.\n // It’ll always exist: we don’t tokenize if it isn’t there.\n\n while (index--) {\n if (events[index][0] === 'enter') {\n if (events[index][1].type === 'content') {\n content = index\n break\n }\n\n if (events[index][1].type === 'paragraph') {\n text = index\n }\n } // Exit\n else {\n if (events[index][1].type === 'content') {\n // Remove the content end (if needed we’ll add it later)\n events.splice(index, 1)\n }\n\n if (!definition && events[index][1].type === 'definition') {\n definition = index\n }\n }\n }\n\n const heading = {\n type: 'setextHeading',\n start: Object.assign({}, events[text][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n } // Change the paragraph to setext heading text.\n\n events[text][1].type = 'setextHeadingText' // If we have definitions in the content, we’ll keep on having content,\n // but we need move it.\n\n if (definition) {\n events.splice(text, 0, ['enter', heading, context])\n events.splice(definition + 1, 0, ['exit', events[content][1], context])\n events[content][1].end = Object.assign({}, events[definition][1].end)\n } else {\n events[content][1] = heading\n } // Add the heading exit at the end.\n\n events.push(['exit', heading, context])\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n const self = this\n let index = self.events.length\n /** @type {NonNullable} */\n\n let marker\n /** @type {boolean} */\n\n let paragraph // Find an opening.\n\n while (index--) {\n // Skip enter/exit of line ending, line prefix, and content.\n // We can now either have a definition or a paragraph.\n if (\n self.events[index][1].type !== 'lineEnding' &&\n self.events[index][1].type !== 'linePrefix' &&\n self.events[index][1].type !== 'content'\n ) {\n paragraph = self.events[index][1].type === 'paragraph'\n break\n }\n }\n\n return start\n /** @type {State} */\n\n function start(code) {\n if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n effects.enter('setextHeadingLine')\n effects.enter('setextHeadingLineSequence')\n marker = code\n return closingSequence(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function closingSequence(code) {\n if (code === marker) {\n effects.consume(code)\n return closingSequence\n }\n\n effects.exit('setextHeadingLineSequence')\n return factorySpace(effects, closingSequenceEnd, 'lineSuffix')(code)\n }\n /** @type {State} */\n\n function closingSequenceEnd(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('setextHeadingLine')\n return ok(code)\n }\n\n return nok(code)\n }\n}\n","/**\n * List of lowercase HTML tag names which when parsing HTML (flow), result\n * in more relaxed rules (condition 6): because they are known blocks, the\n * HTML-like syntax doesn’t have to be strictly parsed.\n * For tag names not in this list, a more strict algorithm (condition 7) is used\n * to detect whether the HTML-like syntax is seen as HTML (flow) or not.\n *\n * This is copied from:\n * .\n */\nexport const htmlBlockNames = [\n 'address',\n 'article',\n 'aside',\n 'base',\n 'basefont',\n 'blockquote',\n 'body',\n 'caption',\n 'center',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'frame',\n 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'iframe',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'menu',\n 'menuitem',\n 'nav',\n 'noframes',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'param',\n 'section',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'track',\n 'ul'\n]\n\n/**\n * List of lowercase HTML tag names which when parsing HTML (flow), result in\n * HTML that can include lines w/o exiting, until a closing tag also in this\n * list is found (condition 1).\n *\n * This module is copied from:\n * .\n *\n * Note that `textarea` was added in `CommonMark@0.30`.\n */\nexport const htmlRawNames = ['pre', 'script', 'style', 'textarea']\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {\n asciiAlpha,\n asciiAlphanumeric,\n markdownLineEnding,\n markdownLineEndingOrSpace,\n markdownSpace\n} from 'micromark-util-character'\nimport {htmlBlockNames, htmlRawNames} from 'micromark-util-html-tag-name'\nimport {blankLine} from './blank-line.js'\n/** @type {Construct} */\n\nexport const htmlFlow = {\n name: 'htmlFlow',\n tokenize: tokenizeHtmlFlow,\n resolveTo: resolveToHtmlFlow,\n concrete: true\n}\n/** @type {Construct} */\n\nconst nextBlankConstruct = {\n tokenize: tokenizeNextBlank,\n partial: true\n}\n/** @type {Resolver} */\n\nfunction resolveToHtmlFlow(events) {\n let index = events.length\n\n while (index--) {\n if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') {\n break\n }\n }\n\n if (index > 1 && events[index - 2][1].type === 'linePrefix') {\n // Add the prefix start to the HTML token.\n events[index][1].start = events[index - 2][1].start // Add the prefix start to the HTML line token.\n\n events[index + 1][1].start = events[index - 2][1].start // Remove the line prefix.\n\n events.splice(index - 2, 2)\n }\n\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeHtmlFlow(effects, ok, nok) {\n const self = this\n /** @type {number} */\n\n let kind\n /** @type {boolean} */\n\n let startTag\n /** @type {string} */\n\n let buffer\n /** @type {number} */\n\n let index\n /** @type {Code} */\n\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('htmlFlow')\n effects.enter('htmlFlowData')\n effects.consume(code)\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 33) {\n effects.consume(code)\n return declarationStart\n }\n\n if (code === 47) {\n effects.consume(code)\n return tagCloseStart\n }\n\n if (code === 63) {\n effects.consume(code)\n kind = 3 // While we’re in an instruction instead of a declaration, we’re on a `?`\n // right now, so we do need to search for `>`, similar to declarations.\n\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n if (asciiAlpha(code)) {\n effects.consume(code)\n buffer = String.fromCharCode(code)\n startTag = true\n return tagName\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function declarationStart(code) {\n if (code === 45) {\n effects.consume(code)\n kind = 2\n return commentOpenInside\n }\n\n if (code === 91) {\n effects.consume(code)\n kind = 5\n buffer = 'CDATA['\n index = 0\n return cdataOpenInside\n }\n\n if (asciiAlpha(code)) {\n effects.consume(code)\n kind = 4\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function commentOpenInside(code) {\n if (code === 45) {\n effects.consume(code)\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function cdataOpenInside(code) {\n if (code === buffer.charCodeAt(index++)) {\n effects.consume(code)\n return index === buffer.length\n ? self.interrupt\n ? ok\n : continuation\n : cdataOpenInside\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagCloseStart(code) {\n if (asciiAlpha(code)) {\n effects.consume(code)\n buffer = String.fromCharCode(code)\n return tagName\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagName(code) {\n if (\n code === null ||\n code === 47 ||\n code === 62 ||\n markdownLineEndingOrSpace(code)\n ) {\n if (\n code !== 47 &&\n startTag &&\n htmlRawNames.includes(buffer.toLowerCase())\n ) {\n kind = 1\n return self.interrupt ? ok(code) : continuation(code)\n }\n\n if (htmlBlockNames.includes(buffer.toLowerCase())) {\n kind = 6\n\n if (code === 47) {\n effects.consume(code)\n return basicSelfClosing\n }\n\n return self.interrupt ? ok(code) : continuation(code)\n }\n\n kind = 7 // Do not support complete HTML when interrupting\n\n return self.interrupt && !self.parser.lazy[self.now().line]\n ? nok(code)\n : startTag\n ? completeAttributeNameBefore(code)\n : completeClosingTagAfter(code)\n }\n\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code)\n buffer += String.fromCharCode(code)\n return tagName\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function basicSelfClosing(code) {\n if (code === 62) {\n effects.consume(code)\n return self.interrupt ? ok : continuation\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function completeClosingTagAfter(code) {\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeClosingTagAfter\n }\n\n return completeEnd(code)\n }\n /** @type {State} */\n\n function completeAttributeNameBefore(code) {\n if (code === 47) {\n effects.consume(code)\n return completeEnd\n }\n\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code)\n return completeAttributeName\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeAttributeNameBefore\n }\n\n return completeEnd(code)\n }\n /** @type {State} */\n\n function completeAttributeName(code) {\n if (\n code === 45 ||\n code === 46 ||\n code === 58 ||\n code === 95 ||\n asciiAlphanumeric(code)\n ) {\n effects.consume(code)\n return completeAttributeName\n }\n\n return completeAttributeNameAfter(code)\n }\n /** @type {State} */\n\n function completeAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code)\n return completeAttributeValueBefore\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeAttributeNameAfter\n }\n\n return completeAttributeNameBefore(code)\n }\n /** @type {State} */\n\n function completeAttributeValueBefore(code) {\n if (\n code === null ||\n code === 60 ||\n code === 61 ||\n code === 62 ||\n code === 96\n ) {\n return nok(code)\n }\n\n if (code === 34 || code === 39) {\n effects.consume(code)\n marker = code\n return completeAttributeValueQuoted\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeAttributeValueBefore\n }\n\n marker = null\n return completeAttributeValueUnquoted(code)\n }\n /** @type {State} */\n\n function completeAttributeValueQuoted(code) {\n if (code === null || markdownLineEnding(code)) {\n return nok(code)\n }\n\n if (code === marker) {\n effects.consume(code)\n return completeAttributeValueQuotedAfter\n }\n\n effects.consume(code)\n return completeAttributeValueQuoted\n }\n /** @type {State} */\n\n function completeAttributeValueUnquoted(code) {\n if (\n code === null ||\n code === 34 ||\n code === 39 ||\n code === 60 ||\n code === 61 ||\n code === 62 ||\n code === 96 ||\n markdownLineEndingOrSpace(code)\n ) {\n return completeAttributeNameAfter(code)\n }\n\n effects.consume(code)\n return completeAttributeValueUnquoted\n }\n /** @type {State} */\n\n function completeAttributeValueQuotedAfter(code) {\n if (code === 47 || code === 62 || markdownSpace(code)) {\n return completeAttributeNameBefore(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function completeEnd(code) {\n if (code === 62) {\n effects.consume(code)\n return completeAfter\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function completeAfter(code) {\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeAfter\n }\n\n return code === null || markdownLineEnding(code)\n ? continuation(code)\n : nok(code)\n }\n /** @type {State} */\n\n function continuation(code) {\n if (code === 45 && kind === 2) {\n effects.consume(code)\n return continuationCommentInside\n }\n\n if (code === 60 && kind === 1) {\n effects.consume(code)\n return continuationRawTagOpen\n }\n\n if (code === 62 && kind === 4) {\n effects.consume(code)\n return continuationClose\n }\n\n if (code === 63 && kind === 3) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n if (code === 93 && kind === 5) {\n effects.consume(code)\n return continuationCharacterDataInside\n }\n\n if (markdownLineEnding(code) && (kind === 6 || kind === 7)) {\n return effects.check(\n nextBlankConstruct,\n continuationClose,\n continuationAtLineEnding\n )(code)\n }\n\n if (code === null || markdownLineEnding(code)) {\n return continuationAtLineEnding(code)\n }\n\n effects.consume(code)\n return continuation\n }\n /** @type {State} */\n\n function continuationAtLineEnding(code) {\n effects.exit('htmlFlowData')\n return htmlContinueStart(code)\n }\n /** @type {State} */\n\n function htmlContinueStart(code) {\n if (code === null) {\n return done(code)\n }\n\n if (markdownLineEnding(code)) {\n return effects.attempt(\n {\n tokenize: htmlLineEnd,\n partial: true\n },\n htmlContinueStart,\n done\n )(code)\n }\n\n effects.enter('htmlFlowData')\n return continuation(code)\n }\n /** @type {Tokenizer} */\n\n function htmlLineEnd(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return lineStart\n }\n /** @type {State} */\n\n function lineStart(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code)\n }\n }\n /** @type {State} */\n\n function continuationCommentInside(code) {\n if (code === 45) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationRawTagOpen(code) {\n if (code === 47) {\n effects.consume(code)\n buffer = ''\n return continuationRawEndTag\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationRawEndTag(code) {\n if (code === 62 && htmlRawNames.includes(buffer.toLowerCase())) {\n effects.consume(code)\n return continuationClose\n }\n\n if (asciiAlpha(code) && buffer.length < 8) {\n effects.consume(code)\n buffer += String.fromCharCode(code)\n return continuationRawEndTag\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationCharacterDataInside(code) {\n if (code === 93) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationDeclarationInside(code) {\n if (code === 62) {\n effects.consume(code)\n return continuationClose\n } // More dashes.\n\n if (code === 45 && kind === 2) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationClose(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('htmlFlowData')\n return done(code)\n }\n\n effects.consume(code)\n return continuationClose\n }\n /** @type {State} */\n\n function done(code) {\n effects.exit('htmlFlow')\n return ok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeNextBlank(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.exit('htmlFlowData')\n effects.enter('lineEndingBlank')\n effects.consume(code)\n effects.exit('lineEndingBlank')\n return effects.attempt(blankLine, ok, nok)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {\n markdownLineEnding,\n markdownLineEndingOrSpace\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const codeFenced = {\n name: 'codeFenced',\n tokenize: tokenizeCodeFenced,\n concrete: true\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCodeFenced(effects, ok, nok) {\n const self = this\n /** @type {Construct} */\n\n const closingFenceConstruct = {\n tokenize: tokenizeClosingFence,\n partial: true\n }\n /** @type {Construct} */\n\n const nonLazyLine = {\n tokenize: tokenizeNonLazyLine,\n partial: true\n }\n const tail = this.events[this.events.length - 1]\n const initialPrefix =\n tail && tail[1].type === 'linePrefix'\n ? tail[2].sliceSerialize(tail[1], true).length\n : 0\n let sizeOpen = 0\n /** @type {NonNullable} */\n\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('codeFenced')\n effects.enter('codeFencedFence')\n effects.enter('codeFencedFenceSequence')\n marker = code\n return sequenceOpen(code)\n }\n /** @type {State} */\n\n function sequenceOpen(code) {\n if (code === marker) {\n effects.consume(code)\n sizeOpen++\n return sequenceOpen\n }\n\n effects.exit('codeFencedFenceSequence')\n return sizeOpen < 3\n ? nok(code)\n : factorySpace(effects, infoOpen, 'whitespace')(code)\n }\n /** @type {State} */\n\n function infoOpen(code) {\n if (code === null || markdownLineEnding(code)) {\n return openAfter(code)\n }\n\n effects.enter('codeFencedFenceInfo')\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return info(code)\n }\n /** @type {State} */\n\n function info(code) {\n if (code === null || markdownLineEndingOrSpace(code)) {\n effects.exit('chunkString')\n effects.exit('codeFencedFenceInfo')\n return factorySpace(effects, infoAfter, 'whitespace')(code)\n }\n\n if (code === 96 && code === marker) return nok(code)\n effects.consume(code)\n return info\n }\n /** @type {State} */\n\n function infoAfter(code) {\n if (code === null || markdownLineEnding(code)) {\n return openAfter(code)\n }\n\n effects.enter('codeFencedFenceMeta')\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return meta(code)\n }\n /** @type {State} */\n\n function meta(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('chunkString')\n effects.exit('codeFencedFenceMeta')\n return openAfter(code)\n }\n\n if (code === 96 && code === marker) return nok(code)\n effects.consume(code)\n return meta\n }\n /** @type {State} */\n\n function openAfter(code) {\n effects.exit('codeFencedFence')\n return self.interrupt ? ok(code) : contentStart(code)\n }\n /** @type {State} */\n\n function contentStart(code) {\n if (code === null) {\n return after(code)\n }\n\n if (markdownLineEnding(code)) {\n return effects.attempt(\n nonLazyLine,\n effects.attempt(\n closingFenceConstruct,\n after,\n initialPrefix\n ? factorySpace(\n effects,\n contentStart,\n 'linePrefix',\n initialPrefix + 1\n )\n : contentStart\n ),\n after\n )(code)\n }\n\n effects.enter('codeFlowValue')\n return contentContinue(code)\n }\n /** @type {State} */\n\n function contentContinue(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('codeFlowValue')\n return contentStart(code)\n }\n\n effects.consume(code)\n return contentContinue\n }\n /** @type {State} */\n\n function after(code) {\n effects.exit('codeFenced')\n return ok(code)\n }\n /** @type {Tokenizer} */\n\n function tokenizeNonLazyLine(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return lineStart\n }\n /** @type {State} */\n\n function lineStart(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code)\n }\n }\n /** @type {Tokenizer} */\n\n function tokenizeClosingFence(effects, ok, nok) {\n let size = 0\n return factorySpace(\n effects,\n closingSequenceStart,\n 'linePrefix',\n this.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )\n /** @type {State} */\n\n function closingSequenceStart(code) {\n effects.enter('codeFencedFence')\n effects.enter('codeFencedFenceSequence')\n return closingSequence(code)\n }\n /** @type {State} */\n\n function closingSequence(code) {\n if (code === marker) {\n effects.consume(code)\n size++\n return closingSequence\n }\n\n if (size < sizeOpen) return nok(code)\n effects.exit('codeFencedFenceSequence')\n return factorySpace(effects, closingSequenceEnd, 'whitespace')(code)\n }\n /** @type {State} */\n\n function closingSequenceEnd(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('codeFencedFence')\n return ok(code)\n }\n\n return nok(code)\n }\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {decodeNamedCharacterReference} from 'decode-named-character-reference'\nimport {\n asciiAlphanumeric,\n asciiDigit,\n asciiHexDigit\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const characterReference = {\n name: 'characterReference',\n tokenize: tokenizeCharacterReference\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCharacterReference(effects, ok, nok) {\n const self = this\n let size = 0\n /** @type {number} */\n\n let max\n /** @type {(code: Code) => code is number} */\n\n let test\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('characterReference')\n effects.enter('characterReferenceMarker')\n effects.consume(code)\n effects.exit('characterReferenceMarker')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 35) {\n effects.enter('characterReferenceMarkerNumeric')\n effects.consume(code)\n effects.exit('characterReferenceMarkerNumeric')\n return numeric\n }\n\n effects.enter('characterReferenceValue')\n max = 31\n test = asciiAlphanumeric\n return value(code)\n }\n /** @type {State} */\n\n function numeric(code) {\n if (code === 88 || code === 120) {\n effects.enter('characterReferenceMarkerHexadecimal')\n effects.consume(code)\n effects.exit('characterReferenceMarkerHexadecimal')\n effects.enter('characterReferenceValue')\n max = 6\n test = asciiHexDigit\n return value\n }\n\n effects.enter('characterReferenceValue')\n max = 7\n test = asciiDigit\n return value(code)\n }\n /** @type {State} */\n\n function value(code) {\n /** @type {Token} */\n let token\n\n if (code === 59 && size) {\n token = effects.exit('characterReferenceValue')\n\n if (\n test === asciiAlphanumeric &&\n !decodeNamedCharacterReference(self.sliceSerialize(token))\n ) {\n return nok(code)\n }\n\n effects.enter('characterReferenceMarker')\n effects.consume(code)\n effects.exit('characterReferenceMarker')\n effects.exit('characterReference')\n return ok\n }\n\n if (test(code) && size++ < max) {\n effects.consume(code)\n return value\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {asciiPunctuation} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const characterEscape = {\n name: 'characterEscape',\n tokenize: tokenizeCharacterEscape\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCharacterEscape(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('characterEscape')\n effects.enter('escapeMarker')\n effects.consume(code)\n effects.exit('escapeMarker')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (asciiPunctuation(code)) {\n effects.enter('characterEscapeValue')\n effects.consume(code)\n effects.exit('characterEscapeValue')\n effects.exit('characterEscape')\n return ok\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const lineEnding = {\n name: 'lineEnding',\n tokenize: tokenizeLineEnding\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeLineEnding(effects, ok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(effects, ok, 'linePrefix')\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factoryDestination} from 'micromark-factory-destination'\nimport {factoryLabel} from 'micromark-factory-label'\nimport {factoryTitle} from 'micromark-factory-title'\nimport {factoryWhitespace} from 'micromark-factory-whitespace'\nimport {markdownLineEndingOrSpace} from 'micromark-util-character'\nimport {push, splice} from 'micromark-util-chunked'\nimport {normalizeIdentifier} from 'micromark-util-normalize-identifier'\nimport {resolveAll} from 'micromark-util-resolve-all'\n\n/** @type {Construct} */\nexport const labelEnd = {\n name: 'labelEnd',\n tokenize: tokenizeLabelEnd,\n resolveTo: resolveToLabelEnd,\n resolveAll: resolveAllLabelEnd\n}\n/** @type {Construct} */\n\nconst resourceConstruct = {\n tokenize: tokenizeResource\n}\n/** @type {Construct} */\n\nconst fullReferenceConstruct = {\n tokenize: tokenizeFullReference\n}\n/** @type {Construct} */\n\nconst collapsedReferenceConstruct = {\n tokenize: tokenizeCollapsedReference\n}\n/** @type {Resolver} */\n\nfunction resolveAllLabelEnd(events) {\n let index = -1\n /** @type {Token} */\n\n let token\n\n while (++index < events.length) {\n token = events[index][1]\n\n if (\n token.type === 'labelImage' ||\n token.type === 'labelLink' ||\n token.type === 'labelEnd'\n ) {\n // Remove the marker.\n events.splice(index + 1, token.type === 'labelImage' ? 4 : 2)\n token.type = 'data'\n index++\n }\n }\n\n return events\n}\n/** @type {Resolver} */\n\nfunction resolveToLabelEnd(events, context) {\n let index = events.length\n let offset = 0\n /** @type {Token} */\n\n let token\n /** @type {number|undefined} */\n\n let open\n /** @type {number|undefined} */\n\n let close\n /** @type {Event[]} */\n\n let media // Find an opening.\n\n while (index--) {\n token = events[index][1]\n\n if (open) {\n // If we see another link, or inactive link label, we’ve been here before.\n if (\n token.type === 'link' ||\n (token.type === 'labelLink' && token._inactive)\n ) {\n break\n } // Mark other link openings as inactive, as we can’t have links in\n // links.\n\n if (events[index][0] === 'enter' && token.type === 'labelLink') {\n token._inactive = true\n }\n } else if (close) {\n if (\n events[index][0] === 'enter' &&\n (token.type === 'labelImage' || token.type === 'labelLink') &&\n !token._balanced\n ) {\n open = index\n\n if (token.type !== 'labelLink') {\n offset = 2\n break\n }\n }\n } else if (token.type === 'labelEnd') {\n close = index\n }\n }\n\n const group = {\n type: events[open][1].type === 'labelLink' ? 'link' : 'image',\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n }\n const label = {\n type: 'label',\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[close][1].end)\n }\n const text = {\n type: 'labelText',\n start: Object.assign({}, events[open + offset + 2][1].end),\n end: Object.assign({}, events[close - 2][1].start)\n }\n media = [\n ['enter', group, context],\n ['enter', label, context]\n ] // Opening marker.\n\n media = push(media, events.slice(open + 1, open + offset + 3)) // Text open.\n\n media = push(media, [['enter', text, context]]) // Between.\n\n media = push(\n media,\n resolveAll(\n context.parser.constructs.insideSpan.null,\n events.slice(open + offset + 4, close - 3),\n context\n )\n ) // Text close, marker close, label close.\n\n media = push(media, [\n ['exit', text, context],\n events[close - 2],\n events[close - 1],\n ['exit', label, context]\n ]) // Reference, resource, or so.\n\n media = push(media, events.slice(close + 1)) // Media close.\n\n media = push(media, [['exit', group, context]])\n splice(events, open, events.length, media)\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeLabelEnd(effects, ok, nok) {\n const self = this\n let index = self.events.length\n /** @type {Token} */\n\n let labelStart\n /** @type {boolean} */\n\n let defined // Find an opening.\n\n while (index--) {\n if (\n (self.events[index][1].type === 'labelImage' ||\n self.events[index][1].type === 'labelLink') &&\n !self.events[index][1]._balanced\n ) {\n labelStart = self.events[index][1]\n break\n }\n }\n\n return start\n /** @type {State} */\n\n function start(code) {\n if (!labelStart) {\n return nok(code)\n } // It’s a balanced bracket, but contains a link.\n\n if (labelStart._inactive) return balanced(code)\n defined = self.parser.defined.includes(\n normalizeIdentifier(\n self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })\n )\n )\n effects.enter('labelEnd')\n effects.enter('labelMarker')\n effects.consume(code)\n effects.exit('labelMarker')\n effects.exit('labelEnd')\n return afterLabelEnd\n }\n /** @type {State} */\n\n function afterLabelEnd(code) {\n // Resource: `[asd](fgh)`.\n if (code === 40) {\n return effects.attempt(\n resourceConstruct,\n ok,\n defined ? ok : balanced\n )(code)\n } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference?\n\n if (code === 91) {\n return effects.attempt(\n fullReferenceConstruct,\n ok,\n defined\n ? effects.attempt(collapsedReferenceConstruct, ok, balanced)\n : balanced\n )(code)\n } // Shortcut reference: `[asd]`?\n\n return defined ? ok(code) : balanced(code)\n }\n /** @type {State} */\n\n function balanced(code) {\n labelStart._balanced = true\n return nok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeResource(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('resource')\n effects.enter('resourceMarker')\n effects.consume(code)\n effects.exit('resourceMarker')\n return factoryWhitespace(effects, open)\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 41) {\n return end(code)\n }\n\n return factoryDestination(\n effects,\n destinationAfter,\n nok,\n 'resourceDestination',\n 'resourceDestinationLiteral',\n 'resourceDestinationLiteralMarker',\n 'resourceDestinationRaw',\n 'resourceDestinationString',\n 32\n )(code)\n }\n /** @type {State} */\n\n function destinationAfter(code) {\n return markdownLineEndingOrSpace(code)\n ? factoryWhitespace(effects, between)(code)\n : end(code)\n }\n /** @type {State} */\n\n function between(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(\n effects,\n factoryWhitespace(effects, end),\n nok,\n 'resourceTitle',\n 'resourceTitleMarker',\n 'resourceTitleString'\n )(code)\n }\n\n return end(code)\n }\n /** @type {State} */\n\n function end(code) {\n if (code === 41) {\n effects.enter('resourceMarker')\n effects.consume(code)\n effects.exit('resourceMarker')\n effects.exit('resource')\n return ok\n }\n\n return nok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeFullReference(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n return factoryLabel.call(\n self,\n effects,\n afterLabel,\n nok,\n 'reference',\n 'referenceMarker',\n 'referenceString'\n )(code)\n }\n /** @type {State} */\n\n function afterLabel(code) {\n return self.parser.defined.includes(\n normalizeIdentifier(\n self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)\n )\n )\n ? ok(code)\n : nok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCollapsedReference(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('reference')\n effects.enter('referenceMarker')\n effects.consume(code)\n effects.exit('referenceMarker')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 93) {\n effects.enter('referenceMarker')\n effects.consume(code)\n effects.exit('referenceMarker')\n effects.exit('reference')\n return ok\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {labelEnd} from './label-end.js'\n/** @type {Construct} */\n\nexport const labelStartImage = {\n name: 'labelStartImage',\n tokenize: tokenizeLabelStartImage,\n resolveAll: labelEnd.resolveAll\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('labelImage')\n effects.enter('labelImageMarker')\n effects.consume(code)\n effects.exit('labelImageMarker')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 91) {\n effects.enter('labelMarker')\n effects.consume(code)\n effects.exit('labelMarker')\n effects.exit('labelImage')\n return after\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function after(code) {\n /* To do: remove in the future once we’ve switched from\n * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n * which doesn’t need this */\n\n /* Hidden footnotes hook */\n\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs\n ? nok(code)\n : ok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Point} Point\n */\nimport {push, splice} from 'micromark-util-chunked'\nimport {classifyCharacter} from 'micromark-util-classify-character'\nimport {resolveAll} from 'micromark-util-resolve-all'\n\n/** @type {Construct} */\nexport const attention = {\n name: 'attention',\n tokenize: tokenizeAttention,\n resolveAll: resolveAllAttention\n}\n/**\n * Take all events and resolve attention to emphasis or strong.\n *\n * @type {Resolver}\n */\n\nfunction resolveAllAttention(events, context) {\n let index = -1\n /** @type {number} */\n\n let open\n /** @type {Token} */\n\n let group\n /** @type {Token} */\n\n let text\n /** @type {Token} */\n\n let openingSequence\n /** @type {Token} */\n\n let closingSequence\n /** @type {number} */\n\n let use\n /** @type {Event[]} */\n\n let nextEvents\n /** @type {number} */\n\n let offset // Walk through all events.\n //\n // Note: performance of this is fine on an mb of normal markdown, but it’s\n // a bottleneck for malicious stuff.\n\n while (++index < events.length) {\n // Find a token that can close.\n if (\n events[index][0] === 'enter' &&\n events[index][1].type === 'attentionSequence' &&\n events[index][1]._close\n ) {\n open = index // Now walk back to find an opener.\n\n while (open--) {\n // Find a token that can open the closer.\n if (\n events[open][0] === 'exit' &&\n events[open][1].type === 'attentionSequence' &&\n events[open][1]._open && // If the markers are the same:\n context.sliceSerialize(events[open][1]).charCodeAt(0) ===\n context.sliceSerialize(events[index][1]).charCodeAt(0)\n ) {\n // If the opening can close or the closing can open,\n // and the close size *is not* a multiple of three,\n // but the sum of the opening and closing size *is* multiple of three,\n // then don’t match.\n if (\n (events[open][1]._close || events[index][1]._open) &&\n (events[index][1].end.offset - events[index][1].start.offset) % 3 &&\n !(\n (events[open][1].end.offset -\n events[open][1].start.offset +\n events[index][1].end.offset -\n events[index][1].start.offset) %\n 3\n )\n ) {\n continue\n } // Number of markers to use from the sequence.\n\n use =\n events[open][1].end.offset - events[open][1].start.offset > 1 &&\n events[index][1].end.offset - events[index][1].start.offset > 1\n ? 2\n : 1\n const start = Object.assign({}, events[open][1].end)\n const end = Object.assign({}, events[index][1].start)\n movePoint(start, -use)\n movePoint(end, use)\n openingSequence = {\n type: use > 1 ? 'strongSequence' : 'emphasisSequence',\n start,\n end: Object.assign({}, events[open][1].end)\n }\n closingSequence = {\n type: use > 1 ? 'strongSequence' : 'emphasisSequence',\n start: Object.assign({}, events[index][1].start),\n end\n }\n text = {\n type: use > 1 ? 'strongText' : 'emphasisText',\n start: Object.assign({}, events[open][1].end),\n end: Object.assign({}, events[index][1].start)\n }\n group = {\n type: use > 1 ? 'strong' : 'emphasis',\n start: Object.assign({}, openingSequence.start),\n end: Object.assign({}, closingSequence.end)\n }\n events[open][1].end = Object.assign({}, openingSequence.start)\n events[index][1].start = Object.assign({}, closingSequence.end)\n nextEvents = [] // If there are more markers in the opening, add them before.\n\n if (events[open][1].end.offset - events[open][1].start.offset) {\n nextEvents = push(nextEvents, [\n ['enter', events[open][1], context],\n ['exit', events[open][1], context]\n ])\n } // Opening.\n\n nextEvents = push(nextEvents, [\n ['enter', group, context],\n ['enter', openingSequence, context],\n ['exit', openingSequence, context],\n ['enter', text, context]\n ]) // Between.\n\n nextEvents = push(\n nextEvents,\n resolveAll(\n context.parser.constructs.insideSpan.null,\n events.slice(open + 1, index),\n context\n )\n ) // Closing.\n\n nextEvents = push(nextEvents, [\n ['exit', text, context],\n ['enter', closingSequence, context],\n ['exit', closingSequence, context],\n ['exit', group, context]\n ]) // If there are more markers in the closing, add them after.\n\n if (events[index][1].end.offset - events[index][1].start.offset) {\n offset = 2\n nextEvents = push(nextEvents, [\n ['enter', events[index][1], context],\n ['exit', events[index][1], context]\n ])\n } else {\n offset = 0\n }\n\n splice(events, open - 1, index - open + 3, nextEvents)\n index = open + nextEvents.length - offset - 2\n break\n }\n }\n }\n } // Remove remaining sequences.\n\n index = -1\n\n while (++index < events.length) {\n if (events[index][1].type === 'attentionSequence') {\n events[index][1].type = 'data'\n }\n }\n\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeAttention(effects, ok) {\n const attentionMarkers = this.parser.constructs.attentionMarkers.null\n const previous = this.previous\n const before = classifyCharacter(previous)\n /** @type {NonNullable} */\n\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('attentionSequence')\n marker = code\n return sequence(code)\n }\n /** @type {State} */\n\n function sequence(code) {\n if (code === marker) {\n effects.consume(code)\n return sequence\n }\n\n const token = effects.exit('attentionSequence')\n const after = classifyCharacter(code)\n const open =\n !after || (after === 2 && before) || attentionMarkers.includes(code)\n const close =\n !before || (before === 2 && after) || attentionMarkers.includes(previous)\n token._open = Boolean(marker === 42 ? open : open && (before || !close))\n token._close = Boolean(marker === 42 ? close : close && (after || !open))\n return ok(code)\n }\n}\n/**\n * Move a point a bit.\n *\n * Note: `move` only works inside lines! It’s not possible to move past other\n * chunks (replacement characters, tabs, or line endings).\n *\n * @param {Point} point\n * @param {number} offset\n * @returns {void}\n */\n\nfunction movePoint(point, offset) {\n point.column += offset\n point.offset += offset\n point._bufferIndex += offset\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {\n asciiAlpha,\n asciiAlphanumeric,\n asciiAtext,\n asciiControl\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const autolink = {\n name: 'autolink',\n tokenize: tokenizeAutolink\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeAutolink(effects, ok, nok) {\n let size = 1\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('autolink')\n effects.enter('autolinkMarker')\n effects.consume(code)\n effects.exit('autolinkMarker')\n effects.enter('autolinkProtocol')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (asciiAlpha(code)) {\n effects.consume(code)\n return schemeOrEmailAtext\n }\n\n return asciiAtext(code) ? emailAtext(code) : nok(code)\n }\n /** @type {State} */\n\n function schemeOrEmailAtext(code) {\n return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)\n ? schemeInsideOrEmailAtext(code)\n : emailAtext(code)\n }\n /** @type {State} */\n\n function schemeInsideOrEmailAtext(code) {\n if (code === 58) {\n effects.consume(code)\n return urlInside\n }\n\n if (\n (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) &&\n size++ < 32\n ) {\n effects.consume(code)\n return schemeInsideOrEmailAtext\n }\n\n return emailAtext(code)\n }\n /** @type {State} */\n\n function urlInside(code) {\n if (code === 62) {\n effects.exit('autolinkProtocol')\n return end(code)\n }\n\n if (code === null || code === 32 || code === 60 || asciiControl(code)) {\n return nok(code)\n }\n\n effects.consume(code)\n return urlInside\n }\n /** @type {State} */\n\n function emailAtext(code) {\n if (code === 64) {\n effects.consume(code)\n size = 0\n return emailAtSignOrDot\n }\n\n if (asciiAtext(code)) {\n effects.consume(code)\n return emailAtext\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function emailAtSignOrDot(code) {\n return asciiAlphanumeric(code) ? emailLabel(code) : nok(code)\n }\n /** @type {State} */\n\n function emailLabel(code) {\n if (code === 46) {\n effects.consume(code)\n size = 0\n return emailAtSignOrDot\n }\n\n if (code === 62) {\n // Exit, then change the type.\n effects.exit('autolinkProtocol').type = 'autolinkEmail'\n return end(code)\n }\n\n return emailValue(code)\n }\n /** @type {State} */\n\n function emailValue(code) {\n if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {\n effects.consume(code)\n return code === 45 ? emailValue : emailLabel\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function end(code) {\n effects.enter('autolinkMarker')\n effects.consume(code)\n effects.exit('autolinkMarker')\n effects.exit('autolink')\n return ok\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {\n asciiAlpha,\n asciiAlphanumeric,\n markdownLineEnding,\n markdownLineEndingOrSpace,\n markdownSpace\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeHtmlText(effects, ok, nok) {\n const self = this\n /** @type {NonNullable|undefined} */\n\n let marker\n /** @type {string} */\n\n let buffer\n /** @type {number} */\n\n let index\n /** @type {State} */\n\n let returnState\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('htmlText')\n effects.enter('htmlTextData')\n effects.consume(code)\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 33) {\n effects.consume(code)\n return declarationOpen\n }\n\n if (code === 47) {\n effects.consume(code)\n return tagCloseStart\n }\n\n if (code === 63) {\n effects.consume(code)\n return instruction\n }\n\n if (asciiAlpha(code)) {\n effects.consume(code)\n return tagOpen\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function declarationOpen(code) {\n if (code === 45) {\n effects.consume(code)\n return commentOpen\n }\n\n if (code === 91) {\n effects.consume(code)\n buffer = 'CDATA['\n index = 0\n return cdataOpen\n }\n\n if (asciiAlpha(code)) {\n effects.consume(code)\n return declaration\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function commentOpen(code) {\n if (code === 45) {\n effects.consume(code)\n return commentStart\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function commentStart(code) {\n if (code === null || code === 62) {\n return nok(code)\n }\n\n if (code === 45) {\n effects.consume(code)\n return commentStartDash\n }\n\n return comment(code)\n }\n /** @type {State} */\n\n function commentStartDash(code) {\n if (code === null || code === 62) {\n return nok(code)\n }\n\n return comment(code)\n }\n /** @type {State} */\n\n function comment(code) {\n if (code === null) {\n return nok(code)\n }\n\n if (code === 45) {\n effects.consume(code)\n return commentClose\n }\n\n if (markdownLineEnding(code)) {\n returnState = comment\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return comment\n }\n /** @type {State} */\n\n function commentClose(code) {\n if (code === 45) {\n effects.consume(code)\n return end\n }\n\n return comment(code)\n }\n /** @type {State} */\n\n function cdataOpen(code) {\n if (code === buffer.charCodeAt(index++)) {\n effects.consume(code)\n return index === buffer.length ? cdata : cdataOpen\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function cdata(code) {\n if (code === null) {\n return nok(code)\n }\n\n if (code === 93) {\n effects.consume(code)\n return cdataClose\n }\n\n if (markdownLineEnding(code)) {\n returnState = cdata\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return cdata\n }\n /** @type {State} */\n\n function cdataClose(code) {\n if (code === 93) {\n effects.consume(code)\n return cdataEnd\n }\n\n return cdata(code)\n }\n /** @type {State} */\n\n function cdataEnd(code) {\n if (code === 62) {\n return end(code)\n }\n\n if (code === 93) {\n effects.consume(code)\n return cdataEnd\n }\n\n return cdata(code)\n }\n /** @type {State} */\n\n function declaration(code) {\n if (code === null || code === 62) {\n return end(code)\n }\n\n if (markdownLineEnding(code)) {\n returnState = declaration\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return declaration\n }\n /** @type {State} */\n\n function instruction(code) {\n if (code === null) {\n return nok(code)\n }\n\n if (code === 63) {\n effects.consume(code)\n return instructionClose\n }\n\n if (markdownLineEnding(code)) {\n returnState = instruction\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return instruction\n }\n /** @type {State} */\n\n function instructionClose(code) {\n return code === 62 ? end(code) : instruction(code)\n }\n /** @type {State} */\n\n function tagCloseStart(code) {\n if (asciiAlpha(code)) {\n effects.consume(code)\n return tagClose\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagClose(code) {\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code)\n return tagClose\n }\n\n return tagCloseBetween(code)\n }\n /** @type {State} */\n\n function tagCloseBetween(code) {\n if (markdownLineEnding(code)) {\n returnState = tagCloseBetween\n return atLineEnding(code)\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return tagCloseBetween\n }\n\n return end(code)\n }\n /** @type {State} */\n\n function tagOpen(code) {\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code)\n return tagOpen\n }\n\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagOpenBetween(code) {\n if (code === 47) {\n effects.consume(code)\n return end\n }\n\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code)\n return tagOpenAttributeName\n }\n\n if (markdownLineEnding(code)) {\n returnState = tagOpenBetween\n return atLineEnding(code)\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return tagOpenBetween\n }\n\n return end(code)\n }\n /** @type {State} */\n\n function tagOpenAttributeName(code) {\n if (\n code === 45 ||\n code === 46 ||\n code === 58 ||\n code === 95 ||\n asciiAlphanumeric(code)\n ) {\n effects.consume(code)\n return tagOpenAttributeName\n }\n\n return tagOpenAttributeNameAfter(code)\n }\n /** @type {State} */\n\n function tagOpenAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code)\n return tagOpenAttributeValueBefore\n }\n\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeNameAfter\n return atLineEnding(code)\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return tagOpenAttributeNameAfter\n }\n\n return tagOpenBetween(code)\n }\n /** @type {State} */\n\n function tagOpenAttributeValueBefore(code) {\n if (\n code === null ||\n code === 60 ||\n code === 61 ||\n code === 62 ||\n code === 96\n ) {\n return nok(code)\n }\n\n if (code === 34 || code === 39) {\n effects.consume(code)\n marker = code\n return tagOpenAttributeValueQuoted\n }\n\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueBefore\n return atLineEnding(code)\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return tagOpenAttributeValueBefore\n }\n\n effects.consume(code)\n marker = undefined\n return tagOpenAttributeValueUnquoted\n }\n /** @type {State} */\n\n function tagOpenAttributeValueQuoted(code) {\n if (code === marker) {\n effects.consume(code)\n return tagOpenAttributeValueQuotedAfter\n }\n\n if (code === null) {\n return nok(code)\n }\n\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueQuoted\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return tagOpenAttributeValueQuoted\n }\n /** @type {State} */\n\n function tagOpenAttributeValueQuotedAfter(code) {\n if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagOpenAttributeValueUnquoted(code) {\n if (\n code === null ||\n code === 34 ||\n code === 39 ||\n code === 60 ||\n code === 61 ||\n code === 96\n ) {\n return nok(code)\n }\n\n if (code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code)\n }\n\n effects.consume(code)\n return tagOpenAttributeValueUnquoted\n } // We can’t have blank lines in content, so no need to worry about empty\n // tokens.\n\n /** @type {State} */\n\n function atLineEnding(code) {\n effects.exit('htmlTextData')\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(\n effects,\n afterPrefix,\n 'linePrefix',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )\n }\n /** @type {State} */\n\n function afterPrefix(code) {\n effects.enter('htmlTextData')\n return returnState(code)\n }\n /** @type {State} */\n\n function end(code) {\n if (code === 62) {\n effects.consume(code)\n effects.exit('htmlTextData')\n effects.exit('htmlText')\n return ok\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {labelEnd} from './label-end.js'\n/** @type {Construct} */\n\nexport const labelStartLink = {\n name: 'labelStartLink',\n tokenize: tokenizeLabelStartLink,\n resolveAll: labelEnd.resolveAll\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('labelLink')\n effects.enter('labelMarker')\n effects.consume(code)\n effects.exit('labelMarker')\n effects.exit('labelLink')\n return after\n }\n /** @type {State} */\n\n function after(code) {\n /* To do: remove in the future once we’ve switched from\n * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n * which doesn’t need this */\n\n /* Hidden footnotes hook. */\n\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs\n ? nok(code)\n : ok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const hardBreakEscape = {\n name: 'hardBreakEscape',\n tokenize: tokenizeHardBreakEscape\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeHardBreakEscape(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('hardBreakEscape')\n effects.enter('escapeMarker')\n effects.consume(code)\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (markdownLineEnding(code)) {\n effects.exit('escapeMarker')\n effects.exit('hardBreakEscape')\n return ok(code)\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Previous} Previous\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const codeText = {\n name: 'codeText',\n tokenize: tokenizeCodeText,\n resolve: resolveCodeText,\n previous\n}\n/** @type {Resolver} */\n\nfunction resolveCodeText(events) {\n let tailExitIndex = events.length - 4\n let headEnterIndex = 3\n /** @type {number} */\n\n let index\n /** @type {number|undefined} */\n\n let enter // If we start and end with an EOL or a space.\n\n if (\n (events[headEnterIndex][1].type === 'lineEnding' ||\n events[headEnterIndex][1].type === 'space') &&\n (events[tailExitIndex][1].type === 'lineEnding' ||\n events[tailExitIndex][1].type === 'space')\n ) {\n index = headEnterIndex // And we have data.\n\n while (++index < tailExitIndex) {\n if (events[index][1].type === 'codeTextData') {\n // Then we have padding.\n events[headEnterIndex][1].type = 'codeTextPadding'\n events[tailExitIndex][1].type = 'codeTextPadding'\n headEnterIndex += 2\n tailExitIndex -= 2\n break\n }\n }\n } // Merge adjacent spaces and data.\n\n index = headEnterIndex - 1\n tailExitIndex++\n\n while (++index <= tailExitIndex) {\n if (enter === undefined) {\n if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') {\n enter = index\n }\n } else if (\n index === tailExitIndex ||\n events[index][1].type === 'lineEnding'\n ) {\n events[enter][1].type = 'codeTextData'\n\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end\n events.splice(enter + 2, index - enter - 2)\n tailExitIndex -= index - enter - 2\n index = enter + 2\n }\n\n enter = undefined\n }\n }\n\n return events\n}\n/** @type {Previous} */\n\nfunction previous(code) {\n // If there is a previous code, there will always be a tail.\n return (\n code !== 96 ||\n this.events[this.events.length - 1][1].type === 'characterEscape'\n )\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCodeText(effects, ok, nok) {\n const self = this\n let sizeOpen = 0\n /** @type {number} */\n\n let size\n /** @type {Token} */\n\n let token\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('codeText')\n effects.enter('codeTextSequence')\n return openingSequence(code)\n }\n /** @type {State} */\n\n function openingSequence(code) {\n if (code === 96) {\n effects.consume(code)\n sizeOpen++\n return openingSequence\n }\n\n effects.exit('codeTextSequence')\n return gap(code)\n }\n /** @type {State} */\n\n function gap(code) {\n // EOF.\n if (code === null) {\n return nok(code)\n } // Closing fence?\n // Could also be data.\n\n if (code === 96) {\n token = effects.enter('codeTextSequence')\n size = 0\n return closingSequence(code)\n } // Tabs don’t work, and virtual spaces don’t make sense.\n\n if (code === 32) {\n effects.enter('space')\n effects.consume(code)\n effects.exit('space')\n return gap\n }\n\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return gap\n } // Data.\n\n effects.enter('codeTextData')\n return data(code)\n } // In code.\n\n /** @type {State} */\n\n function data(code) {\n if (\n code === null ||\n code === 32 ||\n code === 96 ||\n markdownLineEnding(code)\n ) {\n effects.exit('codeTextData')\n return gap(code)\n }\n\n effects.consume(code)\n return data\n } // Closing fence.\n\n /** @type {State} */\n\n function closingSequence(code) {\n // More.\n if (code === 96) {\n effects.consume(code)\n size++\n return closingSequence\n } // Done!\n\n if (size === sizeOpen) {\n effects.exit('codeTextSequence')\n effects.exit('codeText')\n return ok(code)\n } // More or less accents: mark as data.\n\n token.type = 'codeTextData'\n return data(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Extension} Extension\n */\nimport {\n attention,\n autolink,\n blockQuote,\n characterEscape,\n characterReference,\n codeFenced,\n codeIndented,\n codeText,\n definition,\n hardBreakEscape,\n headingAtx,\n htmlFlow,\n htmlText,\n labelEnd,\n labelStartImage,\n labelStartLink,\n lineEnding,\n list,\n setextUnderline,\n thematicBreak\n} from 'micromark-core-commonmark'\nimport {resolver as resolveText} from './initialize/text.js'\n/** @type {Extension['document']} */\n\nexport const document = {\n [42]: list,\n [43]: list,\n [45]: list,\n [48]: list,\n [49]: list,\n [50]: list,\n [51]: list,\n [52]: list,\n [53]: list,\n [54]: list,\n [55]: list,\n [56]: list,\n [57]: list,\n [62]: blockQuote\n}\n/** @type {Extension['contentInitial']} */\n\nexport const contentInitial = {\n [91]: definition\n}\n/** @type {Extension['flowInitial']} */\n\nexport const flowInitial = {\n [-2]: codeIndented,\n [-1]: codeIndented,\n [32]: codeIndented\n}\n/** @type {Extension['flow']} */\n\nexport const flow = {\n [35]: headingAtx,\n [42]: thematicBreak,\n [45]: [setextUnderline, thematicBreak],\n [60]: htmlFlow,\n [61]: setextUnderline,\n [95]: thematicBreak,\n [96]: codeFenced,\n [126]: codeFenced\n}\n/** @type {Extension['string']} */\n\nexport const string = {\n [38]: characterReference,\n [92]: characterEscape\n}\n/** @type {Extension['text']} */\n\nexport const text = {\n [-5]: lineEnding,\n [-4]: lineEnding,\n [-3]: lineEnding,\n [33]: labelStartImage,\n [38]: characterReference,\n [42]: attention,\n [60]: [autolink, htmlText],\n [91]: labelStartLink,\n [92]: [hardBreakEscape, characterEscape],\n [93]: labelEnd,\n [95]: attention,\n [96]: codeText\n}\n/** @type {Extension['insideSpan']} */\n\nexport const insideSpan = {\n null: [attention, resolveText]\n}\n/** @type {Extension['attentionMarkers']} */\n\nexport const attentionMarkers = {\n null: [42, 95]\n}\n/** @type {Extension['disable']} */\n\nexport const disable = {\n null: []\n}\n","/**\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Value} Value\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Code} Code\n */\n\n/**\n * @callback Preprocessor\n * @param {Value} value\n * @param {Encoding} [encoding]\n * @param {boolean} [end=false]\n * @returns {Array}\n */\nconst search = /[\\0\\t\\n\\r]/g\n/**\n * @returns {Preprocessor}\n */\n\nexport function preprocess() {\n let column = 1\n let buffer = ''\n /** @type {boolean|undefined} */\n\n let start = true\n /** @type {boolean|undefined} */\n\n let atCarriageReturn\n return preprocessor\n /** @type {Preprocessor} */\n\n function preprocessor(value, encoding, end) {\n /** @type {Array} */\n const chunks = []\n /** @type {RegExpMatchArray|null} */\n\n let match\n /** @type {number} */\n\n let next\n /** @type {number} */\n\n let startPosition\n /** @type {number} */\n\n let endPosition\n /** @type {Code} */\n\n let code // @ts-expect-error `Buffer` does allow an encoding.\n\n value = buffer + value.toString(encoding)\n startPosition = 0\n buffer = ''\n\n if (start) {\n if (value.charCodeAt(0) === 65279) {\n startPosition++\n }\n\n start = undefined\n }\n\n while (startPosition < value.length) {\n search.lastIndex = startPosition\n match = search.exec(value)\n endPosition =\n match && match.index !== undefined ? match.index : value.length\n code = value.charCodeAt(endPosition)\n\n if (!match) {\n buffer = value.slice(startPosition)\n break\n }\n\n if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n chunks.push(-3)\n atCarriageReturn = undefined\n } else {\n if (atCarriageReturn) {\n chunks.push(-5)\n atCarriageReturn = undefined\n }\n\n if (startPosition < endPosition) {\n chunks.push(value.slice(startPosition, endPosition))\n column += endPosition - startPosition\n }\n\n switch (code) {\n case 0: {\n chunks.push(65533)\n column++\n break\n }\n\n case 9: {\n next = Math.ceil(column / 4) * 4\n chunks.push(-2)\n\n while (column++ < next) chunks.push(-1)\n\n break\n }\n\n case 10: {\n chunks.push(-4)\n column = 1\n break\n }\n\n default: {\n atCarriageReturn = true\n column = 1\n }\n }\n }\n\n startPosition = endPosition + 1\n }\n\n if (end) {\n if (atCarriageReturn) chunks.push(-5)\n if (buffer) chunks.push(buffer)\n chunks.push(null)\n }\n\n return chunks\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Value} Value\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist').Point} Point\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n * @typedef {import('mdast').Content} Content\n * @typedef {Root|Content} Node\n * @typedef {Extract} Parent\n * @typedef {import('mdast').Break} Break\n * @typedef {import('mdast').Blockquote} Blockquote\n * @typedef {import('mdast').Code} Code\n * @typedef {import('mdast').Definition} Definition\n * @typedef {import('mdast').Emphasis} Emphasis\n * @typedef {import('mdast').Heading} Heading\n * @typedef {import('mdast').HTML} HTML\n * @typedef {import('mdast').Image} Image\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('mdast').Link} Link\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('mdast').List} List\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast').Strong} Strong\n * @typedef {import('mdast').Text} Text\n * @typedef {import('mdast').ThematicBreak} ThematicBreak\n *\n * @typedef {UnistParent & {type: 'fragment', children: Array}} Fragment\n */\n\n/**\n * @typedef _CompileDataFields\n * @property {boolean|undefined} expectingFirstListItemValue\n * @property {boolean|undefined} flowCodeInside\n * @property {boolean|undefined} setextHeadingSlurpLineEnding\n * @property {boolean|undefined} atHardBreak\n * @property {'collapsed'|'full'} referenceType\n * @property {boolean|undefined} inReference\n * @property {'characterReferenceMarkerHexadecimal'|'characterReferenceMarkerNumeric'} characterReferenceType\n *\n * @typedef {Record & Partial<_CompileDataFields>} CompileData\n *\n * @typedef {(tree: Root) => Root|void} Transform\n * @typedef {(this: CompileContext, token: Token) => void} Handle\n * @typedef {Record} Handles\n * Token types mapping to handles\n * @typedef {Record|Array> & {canContainEols: Array, transforms: Array, enter: Handles, exit: Handles}} NormalizedExtension\n * @typedef {Partial} Extension\n * An mdast extension changes how markdown tokens are turned into mdast.\n *\n * @typedef {(this: Omit, left: Token|undefined, right: Token) => void} OnEnterError\n * @typedef {(this: Omit, left: Token, right: Token) => void} OnExitError\n *\n * @typedef CompileContext\n * mdast compiler context\n * @property {Array} stack\n * @property {Array<[Token, OnEnterError|undefined]>} tokenStack\n * @property {(key: string, value?: unknown) => void} setData\n * Set data into the key-value store.\n * @property {(key: K) => CompileData[K]} getData\n * Get data from the key-value store.\n * @property {(this: CompileContext) => void} buffer\n * Capture some of the output data.\n * @property {(this: CompileContext) => string} resume\n * Stop capturing and access the output data.\n * @property {(this: CompileContext, node: N, token: Token, onError?: OnEnterError) => N} enter\n * Enter a token.\n * @property {(this: CompileContext, token: Token, onError?: OnExitError) => Node} exit\n * Exit a token.\n * @property {TokenizeContext['sliceSerialize']} sliceSerialize\n * Get the string value of a token.\n * @property {NormalizedExtension} config\n * Configuration.\n *\n * @typedef {{mdastExtensions?: Array>}} FromMarkdownOptions\n * @typedef {ParseOptions & FromMarkdownOptions} Options\n */\nimport {toString} from 'mdast-util-to-string'\nimport {parse} from 'micromark/lib/parse.js'\nimport {preprocess} from 'micromark/lib/preprocess.js'\nimport {postprocess} from 'micromark/lib/postprocess.js'\nimport {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'\nimport {decodeString} from 'micromark-util-decode-string'\nimport {normalizeIdentifier} from 'micromark-util-normalize-identifier'\nimport {decodeNamedCharacterReference} from 'decode-named-character-reference'\nimport {stringifyPosition} from 'unist-util-stringify-position'\nconst own = {}.hasOwnProperty\n/**\n * @param value Markdown to parse (`string` or `Buffer`).\n * @param [encoding] Character encoding to understand `value` as when it’s a `Buffer` (`string`, default: `'utf8'`).\n * @param [options] Configuration\n */\n\nexport const fromMarkdown =\n /**\n * @type {(\n * ((value: Value, encoding: Encoding, options?: Options) => Root) &\n * ((value: Value, options?: Options) => Root)\n * )}\n */\n\n /**\n * @param {Value} value\n * @param {Encoding} [encoding]\n * @param {Options} [options]\n * @returns {Root}\n */\n function (value, encoding, options) {\n if (typeof encoding !== 'string') {\n options = encoding\n encoding = undefined\n }\n\n return compiler(options)(\n postprocess(\n parse(options).document().write(preprocess()(value, encoding, true))\n )\n )\n }\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options} [options]\n */\n\nfunction compiler(options = {}) {\n /** @type {NormalizedExtension} */\n // @ts-expect-error: our base has all required fields, so the result will too.\n const config = configure(\n {\n transforms: [],\n canContainEols: [\n 'emphasis',\n 'fragment',\n 'heading',\n 'paragraph',\n 'strong'\n ],\n enter: {\n autolink: opener(link),\n autolinkProtocol: onenterdata,\n autolinkEmail: onenterdata,\n atxHeading: opener(heading),\n blockQuote: opener(blockQuote),\n characterEscape: onenterdata,\n characterReference: onenterdata,\n codeFenced: opener(codeFlow),\n codeFencedFenceInfo: buffer,\n codeFencedFenceMeta: buffer,\n codeIndented: opener(codeFlow, buffer),\n codeText: opener(codeText, buffer),\n codeTextData: onenterdata,\n data: onenterdata,\n codeFlowValue: onenterdata,\n definition: opener(definition),\n definitionDestinationString: buffer,\n definitionLabelString: buffer,\n definitionTitleString: buffer,\n emphasis: opener(emphasis),\n hardBreakEscape: opener(hardBreak),\n hardBreakTrailing: opener(hardBreak),\n htmlFlow: opener(html, buffer),\n htmlFlowData: onenterdata,\n htmlText: opener(html, buffer),\n htmlTextData: onenterdata,\n image: opener(image),\n label: buffer,\n link: opener(link),\n listItem: opener(listItem),\n listItemValue: onenterlistitemvalue,\n listOrdered: opener(list, onenterlistordered),\n listUnordered: opener(list),\n paragraph: opener(paragraph),\n reference: onenterreference,\n referenceString: buffer,\n resourceDestinationString: buffer,\n resourceTitleString: buffer,\n setextHeading: opener(heading),\n strong: opener(strong),\n thematicBreak: opener(thematicBreak)\n },\n exit: {\n atxHeading: closer(),\n atxHeadingSequence: onexitatxheadingsequence,\n autolink: closer(),\n autolinkEmail: onexitautolinkemail,\n autolinkProtocol: onexitautolinkprotocol,\n blockQuote: closer(),\n characterEscapeValue: onexitdata,\n characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n characterReferenceValue: onexitcharacterreferencevalue,\n codeFenced: closer(onexitcodefenced),\n codeFencedFence: onexitcodefencedfence,\n codeFencedFenceInfo: onexitcodefencedfenceinfo,\n codeFencedFenceMeta: onexitcodefencedfencemeta,\n codeFlowValue: onexitdata,\n codeIndented: closer(onexitcodeindented),\n codeText: closer(onexitcodetext),\n codeTextData: onexitdata,\n data: onexitdata,\n definition: closer(),\n definitionDestinationString: onexitdefinitiondestinationstring,\n definitionLabelString: onexitdefinitionlabelstring,\n definitionTitleString: onexitdefinitiontitlestring,\n emphasis: closer(),\n hardBreakEscape: closer(onexithardbreak),\n hardBreakTrailing: closer(onexithardbreak),\n htmlFlow: closer(onexithtmlflow),\n htmlFlowData: onexitdata,\n htmlText: closer(onexithtmltext),\n htmlTextData: onexitdata,\n image: closer(onexitimage),\n label: onexitlabel,\n labelText: onexitlabeltext,\n lineEnding: onexitlineending,\n link: closer(onexitlink),\n listItem: closer(),\n listOrdered: closer(),\n listUnordered: closer(),\n paragraph: closer(),\n referenceString: onexitreferencestring,\n resourceDestinationString: onexitresourcedestinationstring,\n resourceTitleString: onexitresourcetitlestring,\n resource: onexitresource,\n setextHeading: closer(onexitsetextheading),\n setextHeadingLineSequence: onexitsetextheadinglinesequence,\n setextHeadingText: onexitsetextheadingtext,\n strong: closer(),\n thematicBreak: closer()\n }\n },\n options.mdastExtensions || []\n )\n /** @type {CompileData} */\n\n const data = {}\n return compile\n /**\n * @param {Array} events\n * @returns {Root}\n */\n\n function compile(events) {\n /** @type {Root} */\n let tree = {\n type: 'root',\n children: []\n }\n /** @type {CompileContext['stack']} */\n\n const stack = [tree]\n /** @type {CompileContext['tokenStack']} */\n\n const tokenStack = []\n /** @type {Array} */\n\n const listStack = []\n /** @type {Omit} */\n\n const context = {\n stack,\n tokenStack,\n config,\n enter,\n exit,\n buffer,\n resume,\n setData,\n getData\n }\n let index = -1\n\n while (++index < events.length) {\n // We preprocess lists to add `listItem` tokens, and to infer whether\n // items the list itself are spread out.\n if (\n events[index][1].type === 'listOrdered' ||\n events[index][1].type === 'listUnordered'\n ) {\n if (events[index][0] === 'enter') {\n listStack.push(index)\n } else {\n const tail = listStack.pop()\n index = prepareList(events, tail, index)\n }\n }\n }\n\n index = -1\n\n while (++index < events.length) {\n const handler = config[events[index][0]]\n\n if (own.call(handler, events[index][1].type)) {\n handler[events[index][1].type].call(\n Object.assign(\n {\n sliceSerialize: events[index][2].sliceSerialize\n },\n context\n ),\n events[index][1]\n )\n }\n }\n\n if (tokenStack.length > 0) {\n const tail = tokenStack[tokenStack.length - 1]\n const handler = tail[1] || defaultOnError\n handler.call(context, undefined, tail[0])\n } // Figure out `root` position.\n\n tree.position = {\n start: point(\n events.length > 0\n ? events[0][1].start\n : {\n line: 1,\n column: 1,\n offset: 0\n }\n ),\n end: point(\n events.length > 0\n ? events[events.length - 2][1].end\n : {\n line: 1,\n column: 1,\n offset: 0\n }\n )\n }\n index = -1\n\n while (++index < config.transforms.length) {\n tree = config.transforms[index](tree) || tree\n }\n\n return tree\n }\n /**\n * @param {Array} events\n * @param {number} start\n * @param {number} length\n * @returns {number}\n */\n\n function prepareList(events, start, length) {\n let index = start - 1\n let containerBalance = -1\n let listSpread = false\n /** @type {Token|undefined} */\n\n let listItem\n /** @type {number|undefined} */\n\n let lineIndex\n /** @type {number|undefined} */\n\n let firstBlankLineIndex\n /** @type {boolean|undefined} */\n\n let atMarker\n\n while (++index <= length) {\n const event = events[index]\n\n if (\n event[1].type === 'listUnordered' ||\n event[1].type === 'listOrdered' ||\n event[1].type === 'blockQuote'\n ) {\n if (event[0] === 'enter') {\n containerBalance++\n } else {\n containerBalance--\n }\n\n atMarker = undefined\n } else if (event[1].type === 'lineEndingBlank') {\n if (event[0] === 'enter') {\n if (\n listItem &&\n !atMarker &&\n !containerBalance &&\n !firstBlankLineIndex\n ) {\n firstBlankLineIndex = index\n }\n\n atMarker = undefined\n }\n } else if (\n event[1].type === 'linePrefix' ||\n event[1].type === 'listItemValue' ||\n event[1].type === 'listItemMarker' ||\n event[1].type === 'listItemPrefix' ||\n event[1].type === 'listItemPrefixWhitespace'\n ) {\n // Empty.\n } else {\n atMarker = undefined\n }\n\n if (\n (!containerBalance &&\n event[0] === 'enter' &&\n event[1].type === 'listItemPrefix') ||\n (containerBalance === -1 &&\n event[0] === 'exit' &&\n (event[1].type === 'listUnordered' ||\n event[1].type === 'listOrdered'))\n ) {\n if (listItem) {\n let tailIndex = index\n lineIndex = undefined\n\n while (tailIndex--) {\n const tailEvent = events[tailIndex]\n\n if (\n tailEvent[1].type === 'lineEnding' ||\n tailEvent[1].type === 'lineEndingBlank'\n ) {\n if (tailEvent[0] === 'exit') continue\n\n if (lineIndex) {\n events[lineIndex][1].type = 'lineEndingBlank'\n listSpread = true\n }\n\n tailEvent[1].type = 'lineEnding'\n lineIndex = tailIndex\n } else if (\n tailEvent[1].type === 'linePrefix' ||\n tailEvent[1].type === 'blockQuotePrefix' ||\n tailEvent[1].type === 'blockQuotePrefixWhitespace' ||\n tailEvent[1].type === 'blockQuoteMarker' ||\n tailEvent[1].type === 'listItemIndent'\n ) {\n // Empty\n } else {\n break\n }\n }\n\n if (\n firstBlankLineIndex &&\n (!lineIndex || firstBlankLineIndex < lineIndex)\n ) {\n // @ts-expect-error Patched.\n listItem._spread = true\n } // Fix position.\n\n listItem.end = Object.assign(\n {},\n lineIndex ? events[lineIndex][1].start : event[1].end\n )\n events.splice(lineIndex || index, 0, ['exit', listItem, event[2]])\n index++\n length++\n } // Create a new list item.\n\n if (event[1].type === 'listItemPrefix') {\n listItem = {\n type: 'listItem',\n // @ts-expect-error Patched\n _spread: false,\n start: Object.assign({}, event[1].start)\n } // @ts-expect-error: `listItem` is most definitely defined, TS...\n\n events.splice(index, 0, ['enter', listItem, event[2]])\n index++\n length++\n firstBlankLineIndex = undefined\n atMarker = true\n }\n }\n } // @ts-expect-error Patched.\n\n events[start][1]._spread = listSpread\n return length\n }\n /**\n * @type {CompileContext['setData']}\n * @param [value]\n */\n\n function setData(key, value) {\n data[key] = value\n }\n /**\n * @type {CompileContext['getData']}\n * @template {string} K\n * @param {K} key\n * @returns {CompileData[K]}\n */\n\n function getData(key) {\n return data[key]\n }\n /**\n * @param {Point} d\n * @returns {Point}\n */\n\n function point(d) {\n return {\n line: d.line,\n column: d.column,\n offset: d.offset\n }\n }\n /**\n * @param {(token: Token) => Node} create\n * @param {Handle} [and]\n * @returns {Handle}\n */\n\n function opener(create, and) {\n return open\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {void}\n */\n\n function open(token) {\n enter.call(this, create(token), token)\n if (and) and.call(this, token)\n }\n }\n /** @type {CompileContext['buffer']} */\n\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n })\n }\n /**\n * @type {CompileContext['enter']}\n * @template {Node} N\n * @this {CompileContext}\n * @param {N} node\n * @param {Token} token\n * @param {OnEnterError} [errorHandler]\n * @returns {N}\n */\n\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1]\n // @ts-expect-error: Assume `Node` can exist as a child of `parent`.\n parent.children.push(node)\n this.stack.push(node)\n this.tokenStack.push([token, errorHandler]) // @ts-expect-error: `end` will be patched later.\n\n node.position = {\n start: point(token.start)\n }\n return node\n }\n /**\n * @param {Handle} [and]\n * @returns {Handle}\n */\n\n function closer(and) {\n return close\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {void}\n */\n\n function close(token) {\n if (and) and.call(this, token)\n exit.call(this, token)\n }\n }\n /**\n * @type {CompileContext['exit']}\n * @this {CompileContext}\n * @param {Token} token\n * @param {OnExitError} [onExitError]\n * @returns {Node}\n */\n\n function exit(token, onExitError) {\n const node = this.stack.pop()\n const open = this.tokenStack.pop()\n\n if (!open) {\n throw new Error(\n 'Cannot close `' +\n token.type +\n '` (' +\n stringifyPosition({\n start: token.start,\n end: token.end\n }) +\n '): it’s not open'\n )\n } else if (open[0].type !== token.type) {\n if (onExitError) {\n onExitError.call(this, token, open[0])\n } else {\n const handler = open[1] || defaultOnError\n handler.call(this, token, open[0])\n }\n }\n\n node.position.end = point(token.end)\n return node\n }\n /**\n * @this {CompileContext}\n * @returns {string}\n */\n\n function resume() {\n return toString(this.stack.pop())\n } //\n // Handlers.\n //\n\n /** @type {Handle} */\n\n function onenterlistordered() {\n setData('expectingFirstListItemValue', true)\n }\n /** @type {Handle} */\n\n function onenterlistitemvalue(token) {\n if (getData('expectingFirstListItemValue')) {\n const ancestor =\n /** @type {List} */\n this.stack[this.stack.length - 2]\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10)\n setData('expectingFirstListItemValue')\n }\n }\n /** @type {Handle} */\n\n function onexitcodefencedfenceinfo() {\n const data = this.resume()\n const node =\n /** @type {Code} */\n this.stack[this.stack.length - 1]\n node.lang = data\n }\n /** @type {Handle} */\n\n function onexitcodefencedfencemeta() {\n const data = this.resume()\n const node =\n /** @type {Code} */\n this.stack[this.stack.length - 1]\n node.meta = data\n }\n /** @type {Handle} */\n\n function onexitcodefencedfence() {\n // Exit if this is the closing fence.\n if (getData('flowCodeInside')) return\n this.buffer()\n setData('flowCodeInside', true)\n }\n /** @type {Handle} */\n\n function onexitcodefenced() {\n const data = this.resume()\n const node =\n /** @type {Code} */\n this.stack[this.stack.length - 1]\n node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '')\n setData('flowCodeInside')\n }\n /** @type {Handle} */\n\n function onexitcodeindented() {\n const data = this.resume()\n const node =\n /** @type {Code} */\n this.stack[this.stack.length - 1]\n node.value = data.replace(/(\\r?\\n|\\r)$/g, '')\n }\n /** @type {Handle} */\n\n function onexitdefinitionlabelstring(token) {\n // Discard label, use the source content instead.\n const label = this.resume()\n const node =\n /** @type {Definition} */\n this.stack[this.stack.length - 1]\n node.label = label\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase()\n }\n /** @type {Handle} */\n\n function onexitdefinitiontitlestring() {\n const data = this.resume()\n const node =\n /** @type {Definition} */\n this.stack[this.stack.length - 1]\n node.title = data\n }\n /** @type {Handle} */\n\n function onexitdefinitiondestinationstring() {\n const data = this.resume()\n const node =\n /** @type {Definition} */\n this.stack[this.stack.length - 1]\n node.url = data\n }\n /** @type {Handle} */\n\n function onexitatxheadingsequence(token) {\n const node =\n /** @type {Heading} */\n this.stack[this.stack.length - 1]\n\n if (!node.depth) {\n const depth = this.sliceSerialize(token).length\n node.depth = depth\n }\n }\n /** @type {Handle} */\n\n function onexitsetextheadingtext() {\n setData('setextHeadingSlurpLineEnding', true)\n }\n /** @type {Handle} */\n\n function onexitsetextheadinglinesequence(token) {\n const node =\n /** @type {Heading} */\n this.stack[this.stack.length - 1]\n node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2\n }\n /** @type {Handle} */\n\n function onexitsetextheading() {\n setData('setextHeadingSlurpLineEnding')\n }\n /** @type {Handle} */\n\n function onenterdata(token) {\n const parent =\n /** @type {Parent} */\n this.stack[this.stack.length - 1]\n /** @type {Node} */\n\n let tail = parent.children[parent.children.length - 1]\n\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text() // @ts-expect-error: we’ll add `end` later.\n\n tail.position = {\n start: point(token.start)\n } // @ts-expect-error: Assume `parent` accepts `text`.\n\n parent.children.push(tail)\n }\n\n this.stack.push(tail)\n }\n /** @type {Handle} */\n\n function onexitdata(token) {\n const tail = this.stack.pop()\n tail.value += this.sliceSerialize(token)\n tail.position.end = point(token.end)\n }\n /** @type {Handle} */\n\n function onexitlineending(token) {\n const context = this.stack[this.stack.length - 1]\n\n // If we’re at a hard break, include the line ending in there.\n if (getData('atHardBreak')) {\n const tail = context.children[context.children.length - 1]\n tail.position.end = point(token.end)\n setData('atHardBreak')\n return\n }\n\n if (\n !getData('setextHeadingSlurpLineEnding') &&\n config.canContainEols.includes(context.type)\n ) {\n onenterdata.call(this, token)\n onexitdata.call(this, token)\n }\n }\n /** @type {Handle} */\n\n function onexithardbreak() {\n setData('atHardBreak', true)\n }\n /** @type {Handle} */\n\n function onexithtmlflow() {\n const data = this.resume()\n const node =\n /** @type {HTML} */\n this.stack[this.stack.length - 1]\n node.value = data\n }\n /** @type {Handle} */\n\n function onexithtmltext() {\n const data = this.resume()\n const node =\n /** @type {HTML} */\n this.stack[this.stack.length - 1]\n node.value = data\n }\n /** @type {Handle} */\n\n function onexitcodetext() {\n const data = this.resume()\n const node =\n /** @type {InlineCode} */\n this.stack[this.stack.length - 1]\n node.value = data\n }\n /** @type {Handle} */\n\n function onexitlink() {\n const context =\n /** @type {Link & {identifier: string, label: string}} */\n this.stack[this.stack.length - 1] // To do: clean.\n\n if (getData('inReference')) {\n context.type += 'Reference' // @ts-expect-error: mutate.\n\n context.referenceType = getData('referenceType') || 'shortcut' // @ts-expect-error: mutate.\n\n delete context.url\n delete context.title\n } else {\n // @ts-expect-error: mutate.\n delete context.identifier // @ts-expect-error: mutate.\n\n delete context.label\n }\n\n setData('referenceType')\n }\n /** @type {Handle} */\n\n function onexitimage() {\n const context =\n /** @type {Image & {identifier: string, label: string}} */\n this.stack[this.stack.length - 1] // To do: clean.\n\n if (getData('inReference')) {\n context.type += 'Reference' // @ts-expect-error: mutate.\n\n context.referenceType = getData('referenceType') || 'shortcut' // @ts-expect-error: mutate.\n\n delete context.url\n delete context.title\n } else {\n // @ts-expect-error: mutate.\n delete context.identifier // @ts-expect-error: mutate.\n\n delete context.label\n }\n\n setData('referenceType')\n }\n /** @type {Handle} */\n\n function onexitlabeltext(token) {\n const ancestor =\n /** @type {(Link|Image) & {identifier: string, label: string}} */\n this.stack[this.stack.length - 2]\n const string = this.sliceSerialize(token)\n ancestor.label = decodeString(string)\n ancestor.identifier = normalizeIdentifier(string).toLowerCase()\n }\n /** @type {Handle} */\n\n function onexitlabel() {\n const fragment =\n /** @type {Fragment} */\n this.stack[this.stack.length - 1]\n const value = this.resume()\n const node =\n /** @type {(Link|Image) & {identifier: string, label: string}} */\n this.stack[this.stack.length - 1] // Assume a reference.\n\n setData('inReference', true)\n\n if (node.type === 'link') {\n // @ts-expect-error: Assume static phrasing content.\n node.children = fragment.children\n } else {\n node.alt = value\n }\n }\n /** @type {Handle} */\n\n function onexitresourcedestinationstring() {\n const data = this.resume()\n const node =\n /** @type {Link|Image} */\n this.stack[this.stack.length - 1]\n node.url = data\n }\n /** @type {Handle} */\n\n function onexitresourcetitlestring() {\n const data = this.resume()\n const node =\n /** @type {Link|Image} */\n this.stack[this.stack.length - 1]\n node.title = data\n }\n /** @type {Handle} */\n\n function onexitresource() {\n setData('inReference')\n }\n /** @type {Handle} */\n\n function onenterreference() {\n setData('referenceType', 'collapsed')\n }\n /** @type {Handle} */\n\n function onexitreferencestring(token) {\n const label = this.resume()\n const node =\n /** @type {LinkReference|ImageReference} */\n this.stack[this.stack.length - 1]\n node.label = label\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase()\n setData('referenceType', 'full')\n }\n /** @type {Handle} */\n\n function onexitcharacterreferencemarker(token) {\n setData('characterReferenceType', token.type)\n }\n /** @type {Handle} */\n\n function onexitcharacterreferencevalue(token) {\n const data = this.sliceSerialize(token)\n const type = getData('characterReferenceType')\n /** @type {string} */\n\n let value\n\n if (type) {\n value = decodeNumericCharacterReference(\n data,\n type === 'characterReferenceMarkerNumeric' ? 10 : 16\n )\n setData('characterReferenceType')\n } else {\n // @ts-expect-error `decodeNamedCharacterReference` can return false for\n // invalid named character references, but everything we’ve tokenized is\n // valid.\n value = decodeNamedCharacterReference(data)\n }\n\n const tail = this.stack.pop()\n tail.value += value\n tail.position.end = point(token.end)\n }\n /** @type {Handle} */\n\n function onexitautolinkprotocol(token) {\n onexitdata.call(this, token)\n const node =\n /** @type {Link} */\n this.stack[this.stack.length - 1]\n node.url = this.sliceSerialize(token)\n }\n /** @type {Handle} */\n\n function onexitautolinkemail(token) {\n onexitdata.call(this, token)\n const node =\n /** @type {Link} */\n this.stack[this.stack.length - 1]\n node.url = 'mailto:' + this.sliceSerialize(token)\n } //\n // Creaters.\n //\n\n /** @returns {Blockquote} */\n\n function blockQuote() {\n return {\n type: 'blockquote',\n children: []\n }\n }\n /** @returns {Code} */\n\n function codeFlow() {\n return {\n type: 'code',\n lang: null,\n meta: null,\n value: ''\n }\n }\n /** @returns {InlineCode} */\n\n function codeText() {\n return {\n type: 'inlineCode',\n value: ''\n }\n }\n /** @returns {Definition} */\n\n function definition() {\n return {\n type: 'definition',\n identifier: '',\n label: null,\n title: null,\n url: ''\n }\n }\n /** @returns {Emphasis} */\n\n function emphasis() {\n return {\n type: 'emphasis',\n children: []\n }\n }\n /** @returns {Heading} */\n\n function heading() {\n // @ts-expect-error `depth` will be set later.\n return {\n type: 'heading',\n depth: undefined,\n children: []\n }\n }\n /** @returns {Break} */\n\n function hardBreak() {\n return {\n type: 'break'\n }\n }\n /** @returns {HTML} */\n\n function html() {\n return {\n type: 'html',\n value: ''\n }\n }\n /** @returns {Image} */\n\n function image() {\n return {\n type: 'image',\n title: null,\n url: '',\n alt: null\n }\n }\n /** @returns {Link} */\n\n function link() {\n return {\n type: 'link',\n title: null,\n url: '',\n children: []\n }\n }\n /**\n * @param {Token} token\n * @returns {List}\n */\n\n function list(token) {\n return {\n type: 'list',\n ordered: token.type === 'listOrdered',\n start: null,\n // @ts-expect-error Patched.\n spread: token._spread,\n children: []\n }\n }\n /**\n * @param {Token} token\n * @returns {ListItem}\n */\n\n function listItem(token) {\n return {\n type: 'listItem',\n // @ts-expect-error Patched.\n spread: token._spread,\n checked: null,\n children: []\n }\n }\n /** @returns {Paragraph} */\n\n function paragraph() {\n return {\n type: 'paragraph',\n children: []\n }\n }\n /** @returns {Strong} */\n\n function strong() {\n return {\n type: 'strong',\n children: []\n }\n }\n /** @returns {Text} */\n\n function text() {\n return {\n type: 'text',\n value: ''\n }\n }\n /** @returns {ThematicBreak} */\n\n function thematicBreak() {\n return {\n type: 'thematicBreak'\n }\n }\n}\n/**\n * @param {Extension} combined\n * @param {Array>} extensions\n * @returns {Extension}\n */\n\nfunction configure(combined, extensions) {\n let index = -1\n\n while (++index < extensions.length) {\n const value = extensions[index]\n\n if (Array.isArray(value)) {\n configure(combined, value)\n } else {\n extension(combined, value)\n }\n }\n\n return combined\n}\n/**\n * @param {Extension} combined\n * @param {Extension} extension\n * @returns {void}\n */\n\nfunction extension(combined, extension) {\n /** @type {string} */\n let key\n\n for (key in extension) {\n if (own.call(extension, key)) {\n const list = key === 'canContainEols' || key === 'transforms'\n const maybe = own.call(combined, key) ? combined[key] : undefined\n /* c8 ignore next */\n\n const left = maybe || (combined[key] = list ? [] : {})\n const right = extension[key]\n\n if (right) {\n if (list) {\n // @ts-expect-error: `left` is an array.\n combined[key] = [...left, ...right]\n } else {\n Object.assign(left, right)\n }\n }\n }\n }\n}\n/** @type {OnEnterError} */\n\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error(\n 'Cannot close `' +\n left.type +\n '` (' +\n stringifyPosition({\n start: left.start,\n end: left.end\n }) +\n '): a different token (`' +\n right.type +\n '`, ' +\n stringifyPosition({\n start: right.start,\n end: right.end\n }) +\n ') is open'\n )\n } else {\n throw new Error(\n 'Cannot close document, a token (`' +\n right.type +\n '`, ' +\n stringifyPosition({\n start: right.start,\n end: right.end\n }) +\n ') is still open'\n )\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Event} Event\n */\nimport {subtokenize} from 'micromark-util-subtokenize'\n/**\n * @param {Array} events\n * @returns {Array}\n */\n\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n\n return events\n}\n","/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n * @typedef {import('micromark-util-types').Create} Create\n */\nimport {combineExtensions} from 'micromark-util-combine-extensions'\nimport {content} from './initialize/content.js'\nimport {document} from './initialize/document.js'\nimport {flow} from './initialize/flow.js'\nimport {text, string} from './initialize/text.js'\nimport {createTokenizer} from './create-tokenizer.js'\nimport * as defaultConstructs from './constructs.js'\n/**\n * @param {ParseOptions} [options]\n * @returns {ParseContext}\n */\n\nexport function parse(options = {}) {\n /** @type {FullNormalizedExtension} */\n // @ts-expect-error `defaultConstructs` is full, so the result will be too.\n const constructs = combineExtensions(\n // @ts-expect-error Same as above.\n [defaultConstructs].concat(options.extensions || [])\n )\n /** @type {ParseContext} */\n\n const parser = {\n defined: [],\n lazy: {},\n constructs,\n content: create(content),\n document: create(document),\n flow: create(flow),\n string: create(string),\n text: create(text)\n }\n return parser\n /**\n * @param {InitialConstruct} initial\n */\n\n function create(initial) {\n return creator\n /** @type {Create} */\n\n function creator(from) {\n return createTokenizer(parser, initial, from)\n }\n }\n}\n","import remarkParse from './lib/index.js'\n\nexport default remarkParse\n","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/** @type {import('unified').Plugin<[Options?] | void[], string, Root>} */\nexport default function remarkParse(options) {\n /** @type {import('unified').ParserFunction} */\n const parser = (doc) => {\n // Assume options.\n const settings = /** @type {Options} */ (this.data('settings'))\n\n return fromMarkdown(\n doc,\n Object.assign({}, settings, options, {\n // Note: these options are not in the readme.\n // The goal is for them to be set by plugins on `data` instead of being\n // passed by users.\n extensions: this.data('micromarkExtensions') || [],\n mdastExtensions: this.data('fromMarkdownExtensions') || []\n })\n )\n }\n\n Object.assign(this, {Parser: parser})\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('unist').Literal} Literal\n * @typedef {Object.} Props\n * @typedef {Array.|string} ChildrenOrValue\n *\n * @typedef {(, C extends Node[]>(type: T, props: P, children: C) => {type: T, children: C} & P)} BuildParentWithProps\n * @typedef {(>(type: T, props: P, value: string) => {type: T, value: string} & P)} BuildLiteralWithProps\n * @typedef {(>(type: T, props: P) => {type: T} & P)} BuildVoidWithProps\n * @typedef {((type: T, children: C) => {type: T, children: C})} BuildParent\n * @typedef {((type: T, value: string) => {type: T, value: string})} BuildLiteral\n * @typedef {((type: T) => {type: T})} BuildVoid\n */\n\nexport var u = /**\n * @type {BuildVoid & BuildVoidWithProps & BuildLiteral & BuildLiteralWithProps & BuildParent & BuildParentWithProps}\n */ (\n /**\n * @param {string} type Type of node\n * @param {Props|ChildrenOrValue} [props] Additional properties for node (or `children` or `value`)\n * @param {ChildrenOrValue} [value] `children` or `value` of node\n * @returns {Node}\n */\n function (type, props, value) {\n /** @type {Node} */\n var node = {type: String(type)}\n\n if (\n (value === undefined || value === null) &&\n (typeof props === 'string' || Array.isArray(props))\n ) {\n value = props\n } else {\n Object.assign(node, props)\n }\n\n if (Array.isArray(value)) {\n node.children = value\n } else if (value !== undefined && value !== null) {\n node.value = String(value)\n }\n\n return node\n }\n)\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('unist-util-is').Test} Test\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n * @typedef {import('./complex-types.js').Visitor} Visitor\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\n/**\n * Visit children of tree which pass test.\n *\n * @param tree\n * Tree to walk\n * @param [test]\n * `unist-util-is`-compatible test\n * @param visitor\n * Function called for nodes that pass `test`.\n * @param reverse\n * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).\n */\nexport const visit =\n /**\n * @type {(\n * ((tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor, reverse?: boolean) => void) &\n * ((tree: Tree, visitor: import('./complex-types.js').BuildVisitor, reverse?: boolean) => void)\n * )}\n */\n (\n /**\n * @param {Node} tree\n * @param {Test} test\n * @param {import('./complex-types.js').Visitor} visitor\n * @param {boolean} [reverse]\n */\n function (tree, test, visitor, reverse) {\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n visitor = test\n test = null\n }\n\n visitParents(tree, test, overload, reverse)\n\n /**\n * @param {Node} node\n * @param {Array} parents\n */\n function overload(node, parents) {\n const parent = parents[parents.length - 1]\n return visitor(\n node,\n parent ? parent.children.indexOf(node) : null,\n parent\n )\n }\n }\n )\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n","/**\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Node} Node\n * @typedef {Record & {type: string, position?: PositionLike|undefined}} NodeLike\n * @typedef {import('unist').Point} Point\n *\n * @typedef {Partial} PointLike\n *\n * @typedef PositionLike\n * @property {PointLike} [start]\n * @property {PointLike} [end]\n */\n\nexport const pointStart = point('start')\nexport const pointEnd = point('end')\n\n/**\n * Get the positional info of `node`.\n *\n * @param {NodeLike|Node} [node]\n * @returns {Position}\n */\nexport function position(node) {\n return {start: pointStart(node), end: pointEnd(node)}\n}\n\n/**\n * Get the positional info of `node`.\n *\n * @param {'start'|'end'} type\n */\nfunction point(type) {\n return point\n\n /**\n * Get the positional info of `node`.\n *\n * @param {NodeLike|Node} [node]\n * @returns {Point}\n */\n function point(node) {\n const point = (node && node.position && node.position[type]) || {}\n\n return {\n line: point.line || null,\n column: point.column || null,\n offset: point.offset > -1 ? point.offset : null\n }\n }\n}\n","/**\n * @typedef {import('mdast').Root|import('mdast').Content} Node\n * @typedef {import('mdast').Definition} Definition\n */\n\nimport {visit} from 'unist-util-visit'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Find definitions in `node`.\n * Uses CommonMark precedence, which means that earlier definitions are\n * preferred over duplicate later definitions.\n *\n * @param {Node} node\n */\nexport function definitions(node) {\n /** @type {Record} */\n const cache = Object.create(null)\n\n if (!node || !node.type) {\n throw new Error('mdast-util-definitions expected node')\n }\n\n visit(node, 'definition', (definition) => {\n const id = clean(definition.identifier)\n if (id && !own.call(cache, id)) {\n cache[id] = definition\n }\n })\n\n return definition\n\n /**\n * Get a node from the bound definition cache.\n *\n * @param {string} identifier\n * @returns {Definition|null}\n */\n function definition(identifier) {\n const id = clean(identifier)\n return id && own.call(cache, id) ? cache[id] : null\n }\n}\n\n/**\n * @param {string} [value]\n * @returns {string}\n */\nfunction clean(value) {\n return String(value || '').toUpperCase()\n}\n","/**\n * @typedef {import('mdast').Root|import('mdast').Parent['children'][number]} MdastNode\n * @typedef {import('./index.js').H} H\n * @typedef {import('./index.js').Handler} Handler\n * @typedef {import('./index.js').Content} Content\n */\n\nimport {u} from 'unist-builder'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Transform an unknown node.\n * @type {Handler}\n * @param {MdastNode} node\n */\nfunction unknown(h, node) {\n const data = node.data || {}\n\n if (\n 'value' in node &&\n !(\n own.call(data, 'hName') ||\n own.call(data, 'hProperties') ||\n own.call(data, 'hChildren')\n )\n ) {\n return h.augment(node, u('text', node.value))\n }\n\n return h(node, 'div', all(h, node))\n}\n\n/**\n * @type {Handler}\n * @param {MdastNode} node\n */\nexport function one(h, node, parent) {\n const type = node && node.type\n /** @type {Handler} */\n let fn\n\n // Fail on non-nodes.\n if (!type) {\n throw new Error('Expected node, got `' + node + '`')\n }\n\n if (own.call(h.handlers, type)) {\n fn = h.handlers[type]\n } else if (h.passThrough && h.passThrough.includes(type)) {\n fn = returnNode\n } else {\n fn = h.unknownHandler\n }\n\n return (typeof fn === 'function' ? fn : unknown)(h, node, parent)\n}\n\n/**\n * @type {Handler}\n * @param {MdastNode} node\n */\nfunction returnNode(h, node) {\n // @ts-expect-error: Pass through custom node.\n return 'children' in node ? {...node, children: all(h, node)} : node\n}\n\n/**\n * @param {H} h\n * @param {MdastNode} parent\n */\nexport function all(h, parent) {\n /** @type {Array} */\n const values = []\n\n if ('children' in parent) {\n const nodes = parent.children\n let index = -1\n\n while (++index < nodes.length) {\n const result = one(h, nodes[index], parent)\n\n if (result) {\n if (index && nodes[index - 1].type === 'break') {\n if (!Array.isArray(result) && result.type === 'text') {\n result.value = result.value.replace(/^\\s+/, '')\n }\n\n if (!Array.isArray(result) && result.type === 'element') {\n const head = result.children[0]\n\n if (head && head.type === 'text') {\n head.value = head.value.replace(/^\\s+/, '')\n }\n }\n }\n\n if (Array.isArray(result)) {\n values.push(...result)\n } else {\n values.push(result)\n }\n }\n }\n }\n\n return values\n}\n","import {asciiAlphanumeric} from 'micromark-util-character'\nimport {encode} from 'micromark-util-encode'\n\n/**\n * Make a value safe for injection as a URL.\n *\n * This encodes unsafe characters with percent-encoding and skips already\n * encoded sequences (see `normalizeUri` below).\n * Further unsafe characters are encoded as character references (see\n * `micromark-util-encode`).\n *\n * Then, a regex of allowed protocols can be given, in which case the URL is\n * sanitized.\n * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`,\n * or `/^https?$/i` for `img[src]`.\n * If the URL includes an unknown protocol (one not matched by `protocol`, such\n * as a dangerous example, `javascript:`), the value is ignored.\n *\n * @param {string|undefined} url\n * @param {RegExp} [protocol]\n * @returns {string}\n */\nexport function sanitizeUri(url, protocol) {\n const value = encode(normalizeUri(url || ''))\n\n if (!protocol) {\n return value\n }\n\n const colon = value.indexOf(':')\n const questionMark = value.indexOf('?')\n const numberSign = value.indexOf('#')\n const slash = value.indexOf('/')\n\n if (\n // If there is no protocol, it’s relative.\n colon < 0 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.\n (slash > -1 && colon > slash) ||\n (questionMark > -1 && colon > questionMark) ||\n (numberSign > -1 && colon > numberSign) || // It is a protocol, it should be allowed.\n protocol.test(value.slice(0, colon))\n ) {\n return value\n }\n\n return ''\n}\n/**\n * Normalize a URL (such as used in definitions).\n *\n * Encode unsafe characters with percent-encoding, skipping already encoded\n * sequences.\n *\n * @param {string} value\n * @returns {string}\n */\n\nexport function normalizeUri(value) {\n /** @type {Array} */\n const result = []\n let index = -1\n let start = 0\n let skip = 0\n\n while (++index < value.length) {\n const code = value.charCodeAt(index)\n /** @type {string} */\n\n let replace = '' // A correct percent encoded value.\n\n if (\n code === 37 &&\n asciiAlphanumeric(value.charCodeAt(index + 1)) &&\n asciiAlphanumeric(value.charCodeAt(index + 2))\n ) {\n skip = 2\n } // ASCII.\n else if (code < 128) {\n if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {\n replace = String.fromCharCode(code)\n }\n } // Astral.\n else if (code > 55295 && code < 57344) {\n const next = value.charCodeAt(index + 1) // A correct surrogate pair.\n\n if (code < 56320 && next > 56319 && next < 57344) {\n replace = String.fromCharCode(code, next)\n skip = 1\n } // Lone surrogate.\n else {\n replace = '\\uFFFD'\n }\n } // Unicode.\n else {\n replace = String.fromCharCode(code)\n }\n\n if (replace) {\n result.push(value.slice(start, index), encodeURIComponent(replace))\n start = index + skip + 1\n replace = ''\n }\n\n if (skip) {\n index += skip\n skip = 0\n }\n }\n\n return result.join('') + value.slice(start)\n}\n","/**\n * @typedef {import('./index.js').Content} Content\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * Wrap `nodes` with line feeds between each entry.\n * Optionally adds line feeds at the start and end.\n *\n * @param {Array} nodes\n * @param {boolean} [loose=false]\n * @returns {Array}\n */\nexport function wrap(nodes, loose) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n if (loose) {\n result.push(u('text', '\\n'))\n }\n\n while (++index < nodes.length) {\n if (index) result.push(u('text', '\\n'))\n result.push(nodes[index])\n }\n\n if (loose && nodes.length > 0) {\n result.push(u('text', '\\n'))\n }\n\n return result\n}\n","/**\n * @typedef {import('mdast').FootnoteReference} FootnoteReference\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {FootnoteReference} node\n */\nexport function footnoteReference(h, node) {\n const id = String(node.identifier)\n const safeId = normalizeUri(id.toLowerCase())\n const index = h.footnoteOrder.indexOf(id)\n /** @type {number} */\n let counter\n\n if (index === -1) {\n h.footnoteOrder.push(id)\n h.footnoteCounts[id] = 1\n counter = h.footnoteOrder.length\n } else {\n h.footnoteCounts[id]++\n counter = index + 1\n }\n\n const reuseCounter = h.footnoteCounts[id]\n\n return h(node, 'sup', [\n h(\n node.position,\n 'a',\n {\n href: '#' + h.clobberPrefix + 'fn-' + safeId,\n id:\n h.clobberPrefix +\n 'fnref-' +\n safeId +\n (reuseCounter > 1 ? '-' + reuseCounter : ''),\n dataFootnoteRef: true,\n ariaDescribedBy: 'footnote-label'\n },\n [u('text', String(counter))]\n )\n ])\n}\n","/**\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('./index.js').Handler} Handler\n * @typedef {import('./index.js').Content} Content\n */\n\nimport {u} from 'unist-builder'\nimport {all} from './traverse.js'\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @type {Handler}\n * @param {ImageReference|LinkReference} node\n * @returns {Content|Array}\n */\nexport function revert(h, node) {\n const subtype = node.referenceType\n let suffix = ']'\n\n if (subtype === 'collapsed') {\n suffix += '[]'\n } else if (subtype === 'full') {\n suffix += '[' + (node.label || node.identifier) + ']'\n }\n\n if (node.type === 'imageReference') {\n return u('text', '![' + node.alt + suffix)\n }\n\n const contents = all(h, node)\n const head = contents[0]\n\n if (head && head.type === 'text') {\n head.value = '[' + head.value\n } else {\n contents.unshift(u('text', '['))\n }\n\n const tail = contents[contents.length - 1]\n\n if (tail && tail.type === 'text') {\n tail.value += suffix\n } else {\n contents.push(u('text', suffix))\n }\n\n return contents\n}\n","/**\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').List} List\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('hast').Element} Element\n * @typedef {import('../index.js').Handler} Handler\n * @typedef {import('../index.js').Content} Content\n */\n\nimport {u} from 'unist-builder'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {ListItem} node\n * @param {List} parent\n */\nexport function listItem(h, node, parent) {\n const result = all(h, node)\n const loose = parent ? listLoose(parent) : listItemLoose(node)\n /** @type {Properties} */\n const props = {}\n /** @type {Array} */\n const wrapped = []\n\n if (typeof node.checked === 'boolean') {\n /** @type {Element} */\n let paragraph\n\n if (\n result[0] &&\n result[0].type === 'element' &&\n result[0].tagName === 'p'\n ) {\n paragraph = result[0]\n } else {\n paragraph = h(null, 'p', [])\n result.unshift(paragraph)\n }\n\n if (paragraph.children.length > 0) {\n paragraph.children.unshift(u('text', ' '))\n }\n\n paragraph.children.unshift(\n h(null, 'input', {\n type: 'checkbox',\n checked: node.checked,\n disabled: true\n })\n )\n\n // According to github-markdown-css, this class hides bullet.\n // See: .\n props.className = ['task-list-item']\n }\n\n let index = -1\n\n while (++index < result.length) {\n const child = result[index]\n\n // Add eols before nodes, except if this is a loose, first paragraph.\n if (\n loose ||\n index !== 0 ||\n child.type !== 'element' ||\n child.tagName !== 'p'\n ) {\n wrapped.push(u('text', '\\n'))\n }\n\n if (child.type === 'element' && child.tagName === 'p' && !loose) {\n wrapped.push(...child.children)\n } else {\n wrapped.push(child)\n }\n }\n\n const tail = result[result.length - 1]\n\n // Add a final eol.\n if (tail && (loose || !('tagName' in tail) || tail.tagName !== 'p')) {\n wrapped.push(u('text', '\\n'))\n }\n\n return h(node, 'li', props, wrapped)\n}\n\n/**\n * @param {List} node\n * @return {Boolean}\n */\nfunction listLoose(node) {\n let loose = node.spread\n const children = node.children\n let index = -1\n\n while (!loose && ++index < children.length) {\n loose = listItemLoose(children[index])\n }\n\n return Boolean(loose)\n}\n\n/**\n * @param {ListItem} node\n * @return {Boolean}\n */\nfunction listItemLoose(node) {\n const spread = node.spread\n\n return spread === undefined || spread === null\n ? node.children.length > 1\n : spread\n}\n","const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Trimmed value.\n */\nexport function trimLines(value) {\n const source = String(value)\n const search = /\\r?\\n|\\r/g\n let match = search.exec(source)\n let last = 0\n /** @type {Array} */\n const lines = []\n\n while (match) {\n lines.push(\n trimLine(source.slice(last, match.index), last > 0, true),\n match[0]\n )\n\n last = match.index + match[0].length\n match = search.exec(source)\n }\n\n lines.push(trimLine(source.slice(last), last > 0, false))\n\n return lines.join('')\n}\n\n/**\n * @param {string} value\n * Line to trim.\n * @param {boolean} start\n * Whether to trim the start of the line.\n * @param {boolean} end\n * Whether to trim the end of the line.\n * @returns {string}\n * Trimmed line.\n */\nfunction trimLine(value, start, end) {\n let startIndex = 0\n let endIndex = value.length\n\n if (start) {\n let code = value.codePointAt(startIndex)\n\n while (code === tab || code === space) {\n startIndex++\n code = value.codePointAt(startIndex)\n }\n }\n\n if (end) {\n let code = value.codePointAt(endIndex - 1)\n\n while (code === tab || code === space) {\n endIndex--\n code = value.codePointAt(endIndex - 1)\n }\n }\n\n return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n","import {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {strikethrough} from './delete.js'\nimport {emphasis} from './emphasis.js'\nimport {footnoteReference} from './footnote-reference.js'\nimport {footnote} from './footnote.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {imageReference} from './image-reference.js'\nimport {image} from './image.js'\nimport {inlineCode} from './inline-code.js'\nimport {linkReference} from './link-reference.js'\nimport {link} from './link.js'\nimport {listItem} from './list-item.js'\nimport {list} from './list.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {table} from './table.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\nexport const handlers = {\n blockquote,\n break: hardBreak,\n code,\n delete: strikethrough,\n emphasis,\n footnoteReference,\n footnote,\n heading,\n html,\n imageReference,\n image,\n inlineCode,\n linkReference,\n link,\n listItem,\n list,\n paragraph,\n root,\n strong,\n table,\n text,\n thematicBreak,\n toml: ignore,\n yaml: ignore,\n definition: ignore,\n footnoteDefinition: ignore\n}\n\n// Return nothing for nodes that are ignored.\nfunction ignore() {\n return null\n}\n","/**\n * @typedef {import('mdast').Blockquote} Blockquote\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {wrap} from '../wrap.js'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Blockquote} node\n */\nexport function blockquote(h, node) {\n return h(node, 'blockquote', wrap(all(h, node), true))\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Text} Text\n * @typedef {import('mdast').Break} Break\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {Break} node\n * @returns {Array}\n */\nexport function hardBreak(h, node) {\n return [h(node, 'br'), u('text', '\\n')]\n}\n","/**\n * @typedef {import('mdast').Code} Code\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {Code} node\n */\nexport function code(h, node) {\n const value = node.value ? node.value + '\\n' : ''\n // To do: next major, use `node.lang` w/o regex, the splitting’s been going\n // on for years in remark now.\n const lang = node.lang && node.lang.match(/^[^ \\t]+(?=[ \\t]|$)/)\n /** @type {Properties} */\n const props = {}\n\n if (lang) {\n props.className = ['language-' + lang]\n }\n\n const code = h(node, 'code', props, [u('text', value)])\n\n if (node.meta) {\n code.data = {meta: node.meta}\n }\n\n return h(node.position, 'pre', [code])\n}\n","/**\n * @typedef {import('mdast').Delete} Delete\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Delete} node\n */\nexport function strikethrough(h, node) {\n return h(node, 'del', all(h, node))\n}\n","/**\n * @typedef {import('mdast').Emphasis} Emphasis\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Emphasis} node\n */\nexport function emphasis(h, node) {\n return h(node, 'em', all(h, node))\n}\n","/**\n * @typedef {import('mdast').Footnote} Footnote\n * @typedef {import('../index.js').Handler} Handler\n *\n * @todo\n * `footnote` (or “inline note”) are a pandoc footnotes feature (`^[a note]`)\n * that does not exist in GFM.\n * We still have support for it, so that things remain working with\n * `micromark-extension-footnote` and `mdast-util-footnote`, but in the future\n * we might be able to remove it?\n */\n\nimport {footnoteReference} from './footnote-reference.js'\n\n/**\n * @type {Handler}\n * @param {Footnote} node\n */\nexport function footnote(h, node) {\n const footnoteById = h.footnoteById\n let no = 1\n\n while (no in footnoteById) no++\n\n const identifier = String(no)\n\n footnoteById[identifier] = {\n type: 'footnoteDefinition',\n identifier,\n children: [{type: 'paragraph', children: node.children}],\n position: node.position\n }\n\n return footnoteReference(h, {\n type: 'footnoteReference',\n identifier,\n position: node.position\n })\n}\n","/**\n * @typedef {import('mdast').Heading} Heading\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Heading} node\n */\nexport function heading(h, node) {\n return h(node, 'h' + node.depth, all(h, node))\n}\n","/**\n * @typedef {import('mdast').HTML} HTML\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * Return either a `raw` node in dangerous mode, otherwise nothing.\n *\n * @type {Handler}\n * @param {HTML} node\n */\nexport function html(h, node) {\n return h.dangerous ? h.augment(node, u('raw', node.value)) : null\n}\n","/**\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * @type {Handler}\n * @param {ImageReference} node\n */\nexport function imageReference(h, node) {\n const def = h.definition(node.identifier)\n\n if (!def) {\n return revert(h, node)\n }\n\n /** @type {Properties} */\n const props = {src: normalizeUri(def.url || ''), alt: node.alt}\n\n if (def.title !== null && def.title !== undefined) {\n props.title = def.title\n }\n\n return h(node, 'img', props)\n}\n","/**\n * @typedef {import('mdast').Image} Image\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * @type {Handler}\n * @param {Image} node\n */\nexport function image(h, node) {\n /** @type {Properties} */\n const props = {src: normalizeUri(node.url), alt: node.alt}\n\n if (node.title !== null && node.title !== undefined) {\n props.title = node.title\n }\n\n return h(node, 'img', props)\n}\n","/**\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {InlineCode} node\n */\nexport function inlineCode(h, node) {\n return h(node, 'code', [u('text', node.value.replace(/\\r?\\n|\\r/g, ' '))])\n}\n","/**\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {LinkReference} node\n */\nexport function linkReference(h, node) {\n const def = h.definition(node.identifier)\n\n if (!def) {\n return revert(h, node)\n }\n\n /** @type {Properties} */\n const props = {href: normalizeUri(def.url || '')}\n\n if (def.title !== null && def.title !== undefined) {\n props.title = def.title\n }\n\n return h(node, 'a', props, all(h, node))\n}\n","/**\n * @typedef {import('mdast').Link} Link\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Link} node\n */\nexport function link(h, node) {\n /** @type {Properties} */\n const props = {href: normalizeUri(node.url)}\n\n if (node.title !== null && node.title !== undefined) {\n props.title = node.title\n }\n\n return h(node, 'a', props, all(h, node))\n}\n","/**\n * @typedef {import('mdast').List} List\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {wrap} from '../wrap.js'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {List} node\n * @returns {Element}\n */\nexport function list(h, node) {\n /** @type {Properties} */\n const props = {}\n const name = node.ordered ? 'ol' : 'ul'\n const items = all(h, node)\n let index = -1\n\n if (typeof node.start === 'number' && node.start !== 1) {\n props.start = node.start\n }\n\n // Like GitHub, add a class for custom styling.\n while (++index < items.length) {\n const item = items[index]\n\n if (\n item.type === 'element' &&\n item.tagName === 'li' &&\n item.properties &&\n Array.isArray(item.properties.className) &&\n item.properties.className.includes('task-list-item')\n ) {\n props.className = ['contains-task-list']\n break\n }\n }\n\n return h(node, name, props, wrap(items, true))\n}\n","/**\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Paragraph} node\n */\nexport function paragraph(h, node) {\n return h(node, 'p', all(h, node))\n}\n","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\nimport {all} from '../traverse.js'\nimport {wrap} from '../wrap.js'\n\n/**\n * @type {Handler}\n * @param {Root} node\n */\nexport function root(h, node) {\n // @ts-expect-error `root`s are also fine.\n return h.augment(node, u('root', wrap(all(h, node))))\n}\n","/**\n * @typedef {import('mdast').Strong} Strong\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Strong} node\n */\nexport function strong(h, node) {\n return h(node, 'strong', all(h, node))\n}\n","/**\n * @typedef {import('mdast').Table} Table\n * @typedef {import('hast').Element} Element\n * @typedef {import('../index.js').Handler} Handler\n * @typedef {import('../index.js').Content} Content\n */\n\nimport {pointStart, pointEnd} from 'unist-util-position'\nimport {wrap} from '../wrap.js'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Table} node\n */\nexport function table(h, node) {\n const rows = node.children\n let index = -1\n const align = node.align || []\n /** @type {Array} */\n const result = []\n\n while (++index < rows.length) {\n const row = rows[index].children\n const name = index === 0 ? 'th' : 'td'\n /** @type {Array} */\n const out = []\n let cellIndex = -1\n const length = node.align ? align.length : row.length\n\n while (++cellIndex < length) {\n const cell = row[cellIndex]\n out.push(\n h(cell, name, {align: align[cellIndex]}, cell ? all(h, cell) : [])\n )\n }\n\n result[index] = h(rows[index], 'tr', wrap(out, true))\n }\n\n return h(\n node,\n 'table',\n wrap(\n [h(result[0].position, 'thead', wrap([result[0]], true))].concat(\n result[1]\n ? h(\n {\n start: pointStart(result[1]),\n end: pointEnd(result[result.length - 1])\n },\n 'tbody',\n wrap(result.slice(1), true)\n )\n : []\n ),\n true\n )\n )\n}\n","/**\n * @typedef {import('mdast').Text} Text\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {trimLines} from 'trim-lines'\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {Text} node\n */\nexport function text(h, node) {\n return h.augment(node, u('text', trimLines(String(node.value))))\n}\n","/**\n * @typedef {import('mdast').ThematicBreak} ThematicBreak\n * @typedef {import('hast').Element} Element\n * @typedef {import('../index.js').Handler} Handler\n */\n\n/**\n * @type {Handler}\n * @param {ThematicBreak} [node]\n * @returns {Element}\n */\nexport function thematicBreak(h, node) {\n return h(node, 'hr')\n}\n","/**\n * @typedef {import('mdast').Root|import('mdast').Parent['children'][number]} MdastNode\n * @typedef {import('hast').Root|import('hast').Parent['children'][number]} HastNode\n * @typedef {import('mdast').Parent} Parent\n * @typedef {import('mdast').Definition} Definition\n * @typedef {import('mdast').FootnoteDefinition} FootnoteDefinition\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} Content\n * @typedef {import('unist-util-position').PositionLike} PositionLike\n *\n * @typedef EmbeddedHastFields\n * @property {string} [hName]\n * Defines the tag name of an element.\n * @property {Properties} [hProperties]\n * Defines the properties of an element.\n * @property {Array} [hChildren]\n * Defines the (hast) children of an element.\n *\n * @typedef {Record & EmbeddedHastFields} Data\n * unist data with embedded hast fields.\n *\n * @typedef {MdastNode & {data?: Data}} NodeWithData\n * unist node with embedded hast data.\n *\n * @callback Handler\n * Handle a node.\n * @param {H} h\n * Handle context.\n * @param {any} node\n * mdast node to handle.\n * @param {Parent|null} parent\n * Parent of `node`.\n * @returns {Content|Array|null|undefined}\n * hast node.\n *\n * @callback HFunctionProps\n * @param {MdastNode|PositionLike|null|undefined} node\n * mdast node or unist position.\n * @param {string} tagName\n * HTML tag name.\n * @param {Properties} props\n * Properties.\n * @param {Array?} [children]\n * hast content.\n * @returns {Element}\n * Compiled element.\n *\n * @callback HFunctionNoProps\n * @param {MdastNode|PositionLike|null|undefined} node\n * mdast node or unist position.\n * @param {string} tagName\n * HTML tag name.\n * @param {Array?} [children]\n * hast content\n * @returns {Element}\n * Compiled element.\n *\n * @typedef HFields\n * @property {boolean} dangerous\n * Whether HTML is allowed.\n * @property {string} clobberPrefix\n * Prefix to use to prevent DOM clobbering.\n * @property {string} footnoteLabel\n * Label to use to introduce the footnote section.\n * @property {string} footnoteLabelTagName\n * HTML used for the footnote label.\n * @property {Properties} footnoteLabelProperties\n * Properties on the HTML tag used for the footnote label.\n * @property {string} footnoteBackLabel\n * Label to use to go back to a footnote call from the footnote section.\n * @property {(identifier: string) => Definition|null} definition\n * Definition cache.\n * @property {Record} footnoteById\n * Footnote cache.\n * @property {Array} footnoteOrder\n * Order in which footnotes occur.\n * @property {Record} footnoteCounts\n * Counts the same footnote was used.\n * @property {Handlers} handlers\n * Applied handlers.\n * @property {Handler} unknownHandler\n * Handler for any none not in `passThrough` or otherwise handled.\n * @property {(left: NodeWithData|PositionLike|null|undefined, right: Content) => Content} augment\n * Like `h` but lower-level and usable on non-elements.\n * @property {Array} passThrough\n * List of node types to pass through untouched (except for their children).\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean} [allowDangerousHtml=false]\n * Whether to allow `html` nodes and inject them as `raw` HTML.\n * @property {string} [clobberPrefix='user-content-']\n * Prefix to use before the `id` attribute to prevent it from *clobbering*.\n * attributes.\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available in browsers on the `window` object.\n * Using a prefix prevents this from being a problem.\n * @property {string} [footnoteLabel='Footnotes']\n * Label to use for the footnotes section.\n * Affects screen reader users.\n * Change it if you’re authoring in a different language.\n * @property {string} [footnoteLabelTagName='h2']\n * HTML tag to use for the footnote label.\n * Can be changed to match your document structure and play well with your choice of css.\n * @property {Properties} [footnoteLabelProperties={className: ['sr-only']}]\n * Properties to use on the footnote label.\n * A 'sr-only' class is added by default to hide this from sighted users.\n * Change it to make the label visible, or add classes for other purposes.\n * @property {string} [footnoteBackLabel='Back to content']\n * Label to use from backreferences back to their footnote call.\n * Affects screen reader users.\n * Change it if you’re authoring in a different language.\n * @property {Handlers} [handlers]\n * Object mapping mdast nodes to functions handling them\n * @property {Array} [passThrough]\n * List of custom mdast node types to pass through (keep) in hast\n * @property {Handler} [unknownHandler]\n * Handler for all unknown nodes.\n *\n * @typedef {Record} Handlers\n * Map of node types to handlers\n * @typedef {HFunctionProps & HFunctionNoProps & HFields} H\n * Handle context\n */\n\nimport {u} from 'unist-builder'\nimport {visit} from 'unist-util-visit'\nimport {pointStart, pointEnd} from 'unist-util-position'\nimport {generated} from 'unist-util-generated'\nimport {definitions} from 'mdast-util-definitions'\nimport {one} from './traverse.js'\nimport {footer} from './footer.js'\nimport {handlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Turn mdast into hast.\n *\n * @param {MdastNode} tree\n * mdast node.\n * @param {Options} [options]\n * Configuration (optional).\n * @returns {H}\n * `h` function.\n */\nfunction factory(tree, options) {\n const settings = options || {}\n const dangerous = settings.allowDangerousHtml || false\n /** @type {Record} */\n const footnoteById = {}\n\n h.dangerous = dangerous\n h.clobberPrefix =\n settings.clobberPrefix === undefined || settings.clobberPrefix === null\n ? 'user-content-'\n : settings.clobberPrefix\n h.footnoteLabel = settings.footnoteLabel || 'Footnotes'\n h.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2'\n h.footnoteLabelProperties = settings.footnoteLabelProperties || {\n className: ['sr-only']\n }\n h.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'\n h.definition = definitions(tree)\n h.footnoteById = footnoteById\n /** @type {Array} */\n h.footnoteOrder = []\n /** @type {Record} */\n h.footnoteCounts = {}\n h.augment = augment\n h.handlers = {...handlers, ...settings.handlers}\n h.unknownHandler = settings.unknownHandler\n h.passThrough = settings.passThrough\n\n visit(tree, 'footnoteDefinition', (definition) => {\n const id = String(definition.identifier).toUpperCase()\n\n // Mimick CM behavior of link definitions.\n // See: .\n if (!own.call(footnoteById, id)) {\n footnoteById[id] = definition\n }\n })\n\n // @ts-expect-error Hush, it’s fine!\n return h\n\n /**\n * Finalise the created `right`, a hast node, from `left`, an mdast node.\n *\n * @param {(NodeWithData|PositionLike)?} left\n * @param {Content} right\n * @returns {Content}\n */\n function augment(left, right) {\n // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n if (left && 'data' in left && left.data) {\n /** @type {Data} */\n const data = left.data\n\n if (data.hName) {\n if (right.type !== 'element') {\n right = {\n type: 'element',\n tagName: '',\n properties: {},\n children: []\n }\n }\n\n right.tagName = data.hName\n }\n\n if (right.type === 'element' && data.hProperties) {\n right.properties = {...right.properties, ...data.hProperties}\n }\n\n if ('children' in right && right.children && data.hChildren) {\n right.children = data.hChildren\n }\n }\n\n if (left) {\n const ctx = 'type' in left ? left : {position: left}\n\n if (!generated(ctx)) {\n // @ts-expect-error: fine.\n right.position = {start: pointStart(ctx), end: pointEnd(ctx)}\n }\n }\n\n return right\n }\n\n /**\n * Create an element for `node`.\n *\n * @type {HFunctionProps}\n */\n function h(node, tagName, props, children) {\n if (Array.isArray(props)) {\n children = props\n props = {}\n }\n\n // @ts-expect-error augmenting an element yields an element.\n return augment(node, {\n type: 'element',\n tagName,\n properties: props || {},\n children: children || []\n })\n }\n}\n\n/**\n * Transform `tree` (an mdast node) to a hast node.\n *\n * @param {MdastNode} tree mdast node\n * @param {Options} [options] Configuration\n * @returns {HastNode|null|undefined} hast node\n */\nexport function toHast(tree, options) {\n const h = factory(tree, options)\n const node = one(h, tree, null)\n const foot = footer(h)\n\n if (foot) {\n // @ts-expect-error If there’s a footer, there were definitions, meaning block\n // content.\n // So assume `node` is a parent node.\n node.children.push(u('text', '\\n'), foot)\n }\n\n return Array.isArray(node) ? {type: 'root', children: node} : node\n}\n\nexport {handlers as defaultHandlers} from './handlers/index.js'\n","/**\n * @typedef {Object} PointLike\n * @property {number} [line]\n * @property {number} [column]\n * @property {number} [offset]\n *\n * @typedef {Object} PositionLike\n * @property {PointLike} [start]\n * @property {PointLike} [end]\n *\n * @typedef {Object} NodeLike\n * @property {PositionLike} [position]\n */\n\n/**\n * Check if `node` is *generated*.\n *\n * @param {NodeLike} [node]\n * @returns {boolean}\n */\nexport function generated(node) {\n return (\n !node ||\n !node.position ||\n !node.position.start ||\n !node.position.start.line ||\n !node.position.start.column ||\n !node.position.end ||\n !node.position.end.line ||\n !node.position.end.column\n )\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('./index.js').H} H\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {u} from 'unist-builder'\nimport {all} from './traverse.js'\nimport {wrap} from './wrap.js'\n\n/**\n * @param {H} h\n * @returns {Element|null}\n */\nexport function footer(h) {\n let index = -1\n /** @type {Array} */\n const listItems = []\n\n while (++index < h.footnoteOrder.length) {\n const def = h.footnoteById[h.footnoteOrder[index].toUpperCase()]\n\n if (!def) {\n continue\n }\n\n const content = all(h, def)\n const id = String(def.identifier)\n const safeId = normalizeUri(id.toLowerCase())\n let referenceIndex = 0\n /** @type {Array} */\n const backReferences = []\n\n while (++referenceIndex <= h.footnoteCounts[id]) {\n /** @type {Element} */\n const backReference = {\n type: 'element',\n tagName: 'a',\n properties: {\n href:\n '#' +\n h.clobberPrefix +\n 'fnref-' +\n safeId +\n (referenceIndex > 1 ? '-' + referenceIndex : ''),\n dataFootnoteBackref: true,\n className: ['data-footnote-backref'],\n ariaLabel: h.footnoteBackLabel\n },\n children: [{type: 'text', value: '↩'}]\n }\n\n if (referenceIndex > 1) {\n backReference.children.push({\n type: 'element',\n tagName: 'sup',\n children: [{type: 'text', value: String(referenceIndex)}]\n })\n }\n\n if (backReferences.length > 0) {\n backReferences.push({type: 'text', value: ' '})\n }\n\n backReferences.push(backReference)\n }\n\n const tail = content[content.length - 1]\n\n if (tail && tail.type === 'element' && tail.tagName === 'p') {\n const tailTail = tail.children[tail.children.length - 1]\n if (tailTail && tailTail.type === 'text') {\n tailTail.value += ' '\n } else {\n tail.children.push({type: 'text', value: ' '})\n }\n\n tail.children.push(...backReferences)\n } else {\n content.push(...backReferences)\n }\n\n /** @type {Element} */\n const listItem = {\n type: 'element',\n tagName: 'li',\n properties: {id: h.clobberPrefix + 'fn-' + safeId},\n children: wrap(content, true)\n }\n\n if (def.position) {\n listItem.position = def.position\n }\n\n listItems.push(listItem)\n }\n\n if (listItems.length === 0) {\n return null\n }\n\n return {\n type: 'element',\n tagName: 'section',\n properties: {dataFootnotes: true, className: ['footnotes']},\n children: [\n {\n type: 'element',\n tagName: h.footnoteLabelTagName,\n properties: {\n ...JSON.parse(JSON.stringify(h.footnoteLabelProperties)),\n id: 'footnote-label'\n },\n children: [u('text', h.footnoteLabel)]\n },\n {type: 'text', value: '\\n'},\n {\n type: 'element',\n tagName: 'ol',\n properties: {},\n children: wrap(listItems, true)\n },\n {type: 'text', value: '\\n'}\n ]\n }\n}\n","/**\n * @typedef {import('hast').Root} HastRoot\n * @typedef {import('mdast').Root} MdastRoot\n * @typedef {import('mdast-util-to-hast').Options} Options\n * @typedef {import('unified').Processor} Processor\n *\n * @typedef {import('mdast-util-to-hast')} DoNotTouchAsThisImportIncludesRawInTree\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n// Note: the `` overload doesn’t seem to work :'(\n\n/**\n * Plugin that turns markdown into HTML to support rehype.\n *\n * * If a destination processor is given, that processor runs with a new HTML\n * (hast) tree (bridge-mode).\n * As the given processor runs with a hast tree, and rehype plugins support\n * hast, that means rehype plugins can be used with the given processor.\n * The hast tree is discarded in the end.\n * It’s highly unlikely that you want to do this.\n * * The common case is to not pass a destination processor, in which case the\n * current processor continues running with a new HTML (hast) tree\n * (mutate-mode).\n * As the current processor continues with a hast tree, and rehype plugins\n * support hast, that means rehype plugins can be used after\n * `remark-rehype`.\n * It’s likely that this is what you want to do.\n *\n * @param destination\n * Optional unified processor.\n * @param options\n * Options passed to `mdast-util-to-hast`.\n */\nconst remarkRehype =\n /** @type {(import('unified').Plugin<[Processor, Options?]|[null|undefined, Options?]|[Options]|[], MdastRoot>)} */\n (\n function (destination, options) {\n return destination && 'run' in destination\n ? bridge(destination, options)\n : mutate(destination || options)\n }\n )\n\nexport default remarkRehype\n\n/**\n * Bridge-mode.\n * Runs the destination with the new hast tree.\n *\n * @type {import('unified').Plugin<[Processor, Options?], MdastRoot>}\n */\nfunction bridge(destination, options) {\n return (node, file, next) => {\n destination.run(toHast(node, options), file, (error) => {\n next(error)\n })\n }\n}\n\n/**\n * Mutate-mode.\n * Further plugins run on the hast tree.\n *\n * @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>}\n */\nfunction mutate(options) {\n // @ts-expect-error: assume a corresponding node is returned by `toHast`.\n return (node) => toHast(node, options)\n}\n","/**\n * @typedef {import('./info.js').Info} Info\n * @typedef {Record} Properties\n * @typedef {Record} Normal\n */\n\nexport class Schema {\n /**\n * @constructor\n * @param {Properties} property\n * @param {Normal} normal\n * @param {string} [space]\n */\n constructor(property, normal, space) {\n this.property = property\n this.normal = normal\n if (space) {\n this.space = space\n }\n }\n}\n\n/** @type {Properties} */\nSchema.prototype.property = {}\n/** @type {Normal} */\nSchema.prototype.normal = {}\n/** @type {string|null} */\nSchema.prototype.space = null\n","/**\n * @typedef {import('./schema.js').Properties} Properties\n * @typedef {import('./schema.js').Normal} Normal\n */\n\nimport {Schema} from './schema.js'\n\n/**\n * @param {Schema[]} definitions\n * @param {string} [space]\n * @returns {Schema}\n */\nexport function merge(definitions, space) {\n /** @type {Properties} */\n const property = {}\n /** @type {Normal} */\n const normal = {}\n let index = -1\n\n while (++index < definitions.length) {\n Object.assign(property, definitions[index].property)\n Object.assign(normal, definitions[index].normal)\n }\n\n return new Schema(property, normal, space)\n}\n","/**\n * @param {string} value\n * @returns {string}\n */\nexport function normalize(value) {\n return value.toLowerCase()\n}\n","export class Info {\n /**\n * @constructor\n * @param {string} property\n * @param {string} attribute\n */\n constructor(property, attribute) {\n /** @type {string} */\n this.property = property\n /** @type {string} */\n this.attribute = attribute\n }\n}\n\n/** @type {string|null} */\nInfo.prototype.space = null\nInfo.prototype.boolean = false\nInfo.prototype.booleanish = false\nInfo.prototype.overloadedBoolean = false\nInfo.prototype.number = false\nInfo.prototype.commaSeparated = false\nInfo.prototype.spaceSeparated = false\nInfo.prototype.commaOrSpaceSeparated = false\nInfo.prototype.mustUseProperty = false\nInfo.prototype.defined = false\n","let powers = 0\n\nexport const boolean = increment()\nexport const booleanish = increment()\nexport const overloadedBoolean = increment()\nexport const number = increment()\nexport const spaceSeparated = increment()\nexport const commaSeparated = increment()\nexport const commaOrSpaceSeparated = increment()\n\nfunction increment() {\n return 2 ** ++powers\n}\n","import {Info} from './info.js'\nimport * as types from './types.js'\n\n/** @type {Array} */\n// @ts-expect-error: hush.\nconst checks = Object.keys(types)\n\nexport class DefinedInfo extends Info {\n /**\n * @constructor\n * @param {string} property\n * @param {string} attribute\n * @param {number|null} [mask]\n * @param {string} [space]\n */\n constructor(property, attribute, mask, space) {\n let index = -1\n\n super(property, attribute)\n\n mark(this, 'space', space)\n\n if (typeof mask === 'number') {\n while (++index < checks.length) {\n const check = checks[index]\n mark(this, checks[index], (mask & types[check]) === types[check])\n }\n }\n }\n}\n\nDefinedInfo.prototype.defined = true\n\n/**\n * @param {DefinedInfo} values\n * @param {string} key\n * @param {unknown} value\n */\nfunction mark(values, key, value) {\n if (value) {\n // @ts-expect-error: assume `value` matches the expected value of `key`.\n values[key] = value\n }\n}\n","/**\n * @typedef {import('./schema.js').Properties} Properties\n * @typedef {import('./schema.js').Normal} Normal\n *\n * @typedef {Record} Attributes\n *\n * @typedef {Object} Definition\n * @property {Record} properties\n * @property {(attributes: Attributes, property: string) => string} transform\n * @property {string} [space]\n * @property {Attributes} [attributes]\n * @property {Array} [mustUseProperty]\n */\n\nimport {normalize} from '../normalize.js'\nimport {Schema} from './schema.js'\nimport {DefinedInfo} from './defined-info.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * @param {Definition} definition\n * @returns {Schema}\n */\nexport function create(definition) {\n /** @type {Properties} */\n const property = {}\n /** @type {Normal} */\n const normal = {}\n /** @type {string} */\n let prop\n\n for (prop in definition.properties) {\n if (own.call(definition.properties, prop)) {\n const value = definition.properties[prop]\n const info = new DefinedInfo(\n prop,\n definition.transform(definition.attributes || {}, prop),\n value,\n definition.space\n )\n\n if (\n definition.mustUseProperty &&\n definition.mustUseProperty.includes(prop)\n ) {\n info.mustUseProperty = true\n }\n\n property[prop] = info\n\n normal[normalize(prop)] = prop\n normal[normalize(info.attribute)] = prop\n }\n }\n\n return new Schema(property, normal, definition.space)\n}\n","import {create} from './util/create.js'\n\nexport const xlink = create({\n space: 'xlink',\n transform(_, prop) {\n return 'xlink:' + prop.slice(5).toLowerCase()\n },\n properties: {\n xLinkActuate: null,\n xLinkArcRole: null,\n xLinkHref: null,\n xLinkRole: null,\n xLinkShow: null,\n xLinkTitle: null,\n xLinkType: null\n }\n})\n","import {create} from './util/create.js'\n\nexport const xml = create({\n space: 'xml',\n transform(_, prop) {\n return 'xml:' + prop.slice(3).toLowerCase()\n },\n properties: {xmlLang: null, xmlBase: null, xmlSpace: null}\n})\n","/**\n * @param {Record} attributes\n * @param {string} attribute\n * @returns {string}\n */\nexport function caseSensitiveTransform(attributes, attribute) {\n return attribute in attributes ? attributes[attribute] : attribute\n}\n","import {caseSensitiveTransform} from './case-sensitive-transform.js'\n\n/**\n * @param {Record} attributes\n * @param {string} property\n * @returns {string}\n */\nexport function caseInsensitiveTransform(attributes, property) {\n return caseSensitiveTransform(attributes, property.toLowerCase())\n}\n","import {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const xmlns = create({\n space: 'xmlns',\n attributes: {xmlnsxlink: 'xmlns:xlink'},\n transform: caseInsensitiveTransform,\n properties: {xmlns: null, xmlnsXLink: null}\n})\n","import {booleanish, number, spaceSeparated} from './util/types.js'\nimport {create} from './util/create.js'\n\nexport const aria = create({\n transform(_, prop) {\n return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()\n },\n properties: {\n ariaActiveDescendant: null,\n ariaAtomic: booleanish,\n ariaAutoComplete: null,\n ariaBusy: booleanish,\n ariaChecked: booleanish,\n ariaColCount: number,\n ariaColIndex: number,\n ariaColSpan: number,\n ariaControls: spaceSeparated,\n ariaCurrent: null,\n ariaDescribedBy: spaceSeparated,\n ariaDetails: null,\n ariaDisabled: booleanish,\n ariaDropEffect: spaceSeparated,\n ariaErrorMessage: null,\n ariaExpanded: booleanish,\n ariaFlowTo: spaceSeparated,\n ariaGrabbed: booleanish,\n ariaHasPopup: null,\n ariaHidden: booleanish,\n ariaInvalid: null,\n ariaKeyShortcuts: null,\n ariaLabel: null,\n ariaLabelledBy: spaceSeparated,\n ariaLevel: number,\n ariaLive: null,\n ariaModal: booleanish,\n ariaMultiLine: booleanish,\n ariaMultiSelectable: booleanish,\n ariaOrientation: null,\n ariaOwns: spaceSeparated,\n ariaPlaceholder: null,\n ariaPosInSet: number,\n ariaPressed: booleanish,\n ariaReadOnly: booleanish,\n ariaRelevant: null,\n ariaRequired: booleanish,\n ariaRoleDescription: spaceSeparated,\n ariaRowCount: number,\n ariaRowIndex: number,\n ariaRowSpan: number,\n ariaSelected: booleanish,\n ariaSetSize: number,\n ariaSort: null,\n ariaValueMax: number,\n ariaValueMin: number,\n ariaValueNow: number,\n ariaValueText: null,\n role: null\n }\n})\n","import {\n boolean,\n overloadedBoolean,\n booleanish,\n number,\n spaceSeparated,\n commaSeparated\n} from './util/types.js'\nimport {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const html = create({\n space: 'html',\n attributes: {\n acceptcharset: 'accept-charset',\n classname: 'class',\n htmlfor: 'for',\n httpequiv: 'http-equiv'\n },\n transform: caseInsensitiveTransform,\n mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],\n properties: {\n // Standard Properties.\n abbr: null,\n accept: commaSeparated,\n acceptCharset: spaceSeparated,\n accessKey: spaceSeparated,\n action: null,\n allow: null,\n allowFullScreen: boolean,\n allowPaymentRequest: boolean,\n allowUserMedia: boolean,\n alt: null,\n as: null,\n async: boolean,\n autoCapitalize: null,\n autoComplete: spaceSeparated,\n autoFocus: boolean,\n autoPlay: boolean,\n capture: boolean,\n charSet: null,\n checked: boolean,\n cite: null,\n className: spaceSeparated,\n cols: number,\n colSpan: null,\n content: null,\n contentEditable: booleanish,\n controls: boolean,\n controlsList: spaceSeparated,\n coords: number | commaSeparated,\n crossOrigin: null,\n data: null,\n dateTime: null,\n decoding: null,\n default: boolean,\n defer: boolean,\n dir: null,\n dirName: null,\n disabled: boolean,\n download: overloadedBoolean,\n draggable: booleanish,\n encType: null,\n enterKeyHint: null,\n form: null,\n formAction: null,\n formEncType: null,\n formMethod: null,\n formNoValidate: boolean,\n formTarget: null,\n headers: spaceSeparated,\n height: number,\n hidden: boolean,\n high: number,\n href: null,\n hrefLang: null,\n htmlFor: spaceSeparated,\n httpEquiv: spaceSeparated,\n id: null,\n imageSizes: null,\n imageSrcSet: null,\n inputMode: null,\n integrity: null,\n is: null,\n isMap: boolean,\n itemId: null,\n itemProp: spaceSeparated,\n itemRef: spaceSeparated,\n itemScope: boolean,\n itemType: spaceSeparated,\n kind: null,\n label: null,\n lang: null,\n language: null,\n list: null,\n loading: null,\n loop: boolean,\n low: number,\n manifest: null,\n max: null,\n maxLength: number,\n media: null,\n method: null,\n min: null,\n minLength: number,\n multiple: boolean,\n muted: boolean,\n name: null,\n nonce: null,\n noModule: boolean,\n noValidate: boolean,\n onAbort: null,\n onAfterPrint: null,\n onAuxClick: null,\n onBeforeMatch: null,\n onBeforePrint: null,\n onBeforeUnload: null,\n onBlur: null,\n onCancel: null,\n onCanPlay: null,\n onCanPlayThrough: null,\n onChange: null,\n onClick: null,\n onClose: null,\n onContextLost: null,\n onContextMenu: null,\n onContextRestored: null,\n onCopy: null,\n onCueChange: null,\n onCut: null,\n onDblClick: null,\n onDrag: null,\n onDragEnd: null,\n onDragEnter: null,\n onDragExit: null,\n onDragLeave: null,\n onDragOver: null,\n onDragStart: null,\n onDrop: null,\n onDurationChange: null,\n onEmptied: null,\n onEnded: null,\n onError: null,\n onFocus: null,\n onFormData: null,\n onHashChange: null,\n onInput: null,\n onInvalid: null,\n onKeyDown: null,\n onKeyPress: null,\n onKeyUp: null,\n onLanguageChange: null,\n onLoad: null,\n onLoadedData: null,\n onLoadedMetadata: null,\n onLoadEnd: null,\n onLoadStart: null,\n onMessage: null,\n onMessageError: null,\n onMouseDown: null,\n onMouseEnter: null,\n onMouseLeave: null,\n onMouseMove: null,\n onMouseOut: null,\n onMouseOver: null,\n onMouseUp: null,\n onOffline: null,\n onOnline: null,\n onPageHide: null,\n onPageShow: null,\n onPaste: null,\n onPause: null,\n onPlay: null,\n onPlaying: null,\n onPopState: null,\n onProgress: null,\n onRateChange: null,\n onRejectionHandled: null,\n onReset: null,\n onResize: null,\n onScroll: null,\n onScrollEnd: null,\n onSecurityPolicyViolation: null,\n onSeeked: null,\n onSeeking: null,\n onSelect: null,\n onSlotChange: null,\n onStalled: null,\n onStorage: null,\n onSubmit: null,\n onSuspend: null,\n onTimeUpdate: null,\n onToggle: null,\n onUnhandledRejection: null,\n onUnload: null,\n onVolumeChange: null,\n onWaiting: null,\n onWheel: null,\n open: boolean,\n optimum: number,\n pattern: null,\n ping: spaceSeparated,\n placeholder: null,\n playsInline: boolean,\n poster: null,\n preload: null,\n readOnly: boolean,\n referrerPolicy: null,\n rel: spaceSeparated,\n required: boolean,\n reversed: boolean,\n rows: number,\n rowSpan: number,\n sandbox: spaceSeparated,\n scope: null,\n scoped: boolean,\n seamless: boolean,\n selected: boolean,\n shape: null,\n size: number,\n sizes: null,\n slot: null,\n span: number,\n spellCheck: booleanish,\n src: null,\n srcDoc: null,\n srcLang: null,\n srcSet: null,\n start: number,\n step: null,\n style: null,\n tabIndex: number,\n target: null,\n title: null,\n translate: null,\n type: null,\n typeMustMatch: boolean,\n useMap: null,\n value: booleanish,\n width: number,\n wrap: null,\n\n // Legacy.\n // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis\n align: null, // Several. Use CSS `text-align` instead,\n aLink: null, // ``. Use CSS `a:active {color}` instead\n archive: spaceSeparated, // ``. List of URIs to archives\n axis: null, // `` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: boolean, // Lists. Use CSS to reduce space between items instead\n declare: boolean, // ``\n event: null, // `
\ No newline at end of file diff --git a/web/build/.gitignore b/web/build/.gitignore new file mode 100644 index 000000000..1f619d05e --- /dev/null +++ b/web/build/.gitignore @@ -0,0 +1 @@ +pico.css diff --git a/web/build/asset-manifest.json b/web/build/asset-manifest.json new file mode 100644 index 000000000..e043d60bc --- /dev/null +++ b/web/build/asset-manifest.json @@ -0,0 +1,37 @@ +{ + "files": { + "main.css": "/web-ide/static/css/main.2f41c32c.css", + "main.js": "/web-ide/static/js/main.1a8f3959.js", + "static/js/2.0c1eab19.chunk.js": "/web-ide/static/js/2.0c1eab19.chunk.js", + "static/css/605.17e509d9.chunk.css": "/web-ide/static/css/605.17e509d9.chunk.css", + "static/js/605.b27434d9.chunk.js": "/web-ide/static/js/605.b27434d9.chunk.js", + "static/js/506.f6bf6957.chunk.js": "/web-ide/static/js/506.f6bf6957.chunk.js", + "static/js/568.4e6a571b.chunk.js": "/web-ide/static/js/568.4e6a571b.chunk.js", + "static/js/277.355c3689.chunk.js": "/web-ide/static/js/277.355c3689.chunk.js", + "static/js/949.77b4b684.chunk.js": "/web-ide/static/js/949.77b4b684.chunk.js", + "static/js/681.59527346.chunk.js": "/web-ide/static/js/681.59527346.chunk.js", + "static/js/512.9c0d1032.chunk.js": "/web-ide/static/js/512.9c0d1032.chunk.js", + "static/js/600.6e4176cb.chunk.js": "/web-ide/static/js/600.6e4176cb.chunk.js", + "static/js/813.65f1d443.chunk.js": "/web-ide/static/js/813.65f1d443.chunk.js", + "static/js/356.1228c852.chunk.js": "/web-ide/static/js/356.1228c852.chunk.js", + "index.html": "/web-ide/index.html", + "main.2f41c32c.css.map": "/web-ide/static/css/main.2f41c32c.css.map", + "main.1a8f3959.js.map": "/web-ide/static/js/main.1a8f3959.js.map", + "2.0c1eab19.chunk.js.map": "/web-ide/static/js/2.0c1eab19.chunk.js.map", + "605.17e509d9.chunk.css.map": "/web-ide/static/css/605.17e509d9.chunk.css.map", + "605.b27434d9.chunk.js.map": "/web-ide/static/js/605.b27434d9.chunk.js.map", + "506.f6bf6957.chunk.js.map": "/web-ide/static/js/506.f6bf6957.chunk.js.map", + "568.4e6a571b.chunk.js.map": "/web-ide/static/js/568.4e6a571b.chunk.js.map", + "277.355c3689.chunk.js.map": "/web-ide/static/js/277.355c3689.chunk.js.map", + "949.77b4b684.chunk.js.map": "/web-ide/static/js/949.77b4b684.chunk.js.map", + "681.59527346.chunk.js.map": "/web-ide/static/js/681.59527346.chunk.js.map", + "512.9c0d1032.chunk.js.map": "/web-ide/static/js/512.9c0d1032.chunk.js.map", + "600.6e4176cb.chunk.js.map": "/web-ide/static/js/600.6e4176cb.chunk.js.map", + "813.65f1d443.chunk.js.map": "/web-ide/static/js/813.65f1d443.chunk.js.map", + "356.1228c852.chunk.js.map": "/web-ide/static/js/356.1228c852.chunk.js.map" + }, + "entrypoints": [ + "static/css/main.2f41c32c.css", + "static/js/main.1a8f3959.js" + ] +} \ No newline at end of file diff --git a/web/build/chip/index.html b/web/build/chip/index.html new file mode 100644 index 000000000..8ae826d83 --- /dev/null +++ b/web/build/chip/index.html @@ -0,0 +1 @@ +NAND2Tetris
\ No newline at end of file diff --git a/web/build/favicon.svg b/web/build/favicon.svg new file mode 100644 index 000000000..cee1b79a6 --- /dev/null +++ b/web/build/favicon.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/build/guide/index.html b/web/build/guide/index.html new file mode 100644 index 000000000..8ae826d83 --- /dev/null +++ b/web/build/guide/index.html @@ -0,0 +1 @@ +NAND2Tetris
\ No newline at end of file diff --git a/web/build/index.html b/web/build/index.html new file mode 100644 index 000000000..8ae826d83 --- /dev/null +++ b/web/build/index.html @@ -0,0 +1 @@ +NAND2Tetris
\ No newline at end of file diff --git a/web/build/manifest.json b/web/build/manifest.json new file mode 100644 index 000000000..57fc1da07 --- /dev/null +++ b/web/build/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "NAND2Tetris", + "name": "NAND2Tetris Web IDE", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/web/build/robots.txt b/web/build/robots.txt new file mode 100644 index 000000000..e9e57dc4d --- /dev/null +++ b/web/build/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/web/build/root.css b/web/build/root.css new file mode 100644 index 000000000..4fb1f916f --- /dev/null +++ b/web/build/root.css @@ -0,0 +1,4 @@ +@import "https://unpkg.com/@picocss/pico@latest/css/pico.min.css" layer(pico); +@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono&family=Poppins:wght@400;700&display=swap"); + +@layer pico component user; diff --git a/web/build/static/css/605.17e509d9.chunk.css b/web/build/static/css/605.17e509d9.chunk.css new file mode 100644 index 000000000..52cfcd57c --- /dev/null +++ b/web/build/static/css/605.17e509d9.chunk.css @@ -0,0 +1,2 @@ +[role=group]{display:flex;flex-direction:row;margin:0}[role=group] [role=button],[role=group] button,[role=group] input,[role=group] select{margin:0}[role=group] [role=button]:not(:first-child),[role=group] button:not(:first-child),[role=group] input:not(:first-child),[role=group] select:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}[role=group] [role=button]:not(:last-child),[role=group] button:not(:last-child),[role=group] input:not(:last-child),[role=group] select:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}[role=group] [role=button][aria-current=true],[role=group] button[aria-current=true],[role=group] input[aria-current=true],[role=group] select[aria-current=true]{background-color:var(--primary-inverse);color:var(--primary)}[role=group] [role=button] input[type=checkbox],[role=group] [role=button] input[type=radio],[role=group] button input[type=checkbox],[role=group] button input[type=radio],[role=group] input input[type=checkbox],[role=group] input input[type=radio],[role=group] select input[type=checkbox],[role=group] select input[type=radio]{display:none}[role=tablist]{--border-style:solid;--border:var(--border-width) var(--border-style) var(--card-border-color);--border-empty:var(--border-width) var(--border-style) var(--card-background-color);--tab-count:5;--spacing-tab-edge:calc(var(--block-spacing-horizontal)/2);display:grid;grid-template:-webkit-min-content 1fr/var(--spacing-tab-edge) repeat(var(--tab-count),-webkit-min-content) 1fr;grid-template:min-content 1fr/var(--spacing-tab-edge) repeat(var(--tab-count),min-content) 1fr;height:100%}[role=tablist]:after,[role=tablist]:before{border-bottom:var(--border);content:"";display:block;grid-row:1;min-width:var(--spacing-tab-edge)}[role=tablist]:before{order:-1}[role=tablist]:after{grid-column-end:-1;order:1}[role=tab]{border:var(--border-empty);border-bottom:var(--border);grid-row:1;height:-webkit-min-content;height:min-content;order:0}[role=tab] label,label[role=tab]{padding:var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal) calc(var(--form-element-spacing-vertical)/2)}[role=tab]:hover{--border-color:var(--secondary-color);border:var(--border)}[role=tab]:has(:focus){--border-style:dotted}[role=tab]:has(:active){--border-style:dotted}[role=tab] [type=radio]{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px}[role=tab][aria-selected=true]{border:var(--border);border-bottom:var(--border-empty)}[role=tab]:has(:checked){border:var(--border);border-bottom:var(--border-empty)}[role=tabpanel]{display:none;grid-area:2/1/span 1/-1}[role=tab][aria-selected=true]+[role=tabpanel]{display:block;flex-basis:100%}[role=tab]:has(:checked)+[role=tabpanel]{display:block;flex-basis:100%}.ChipPage{--screen-size:calc(512px + var(--block-spacing-horizontal)*5);gap:0;grid-template-areas:"hdl prt tst";grid-template-columns:1fr var(--screen-size) 1fr;grid-template-rows:1fr;height:100%;margin:0}.ChipPage h2{margin:0 var(--nav-element-spacing-horizontal)}.ChipPage ._hdl_panel{grid-area:hdl;min-height:calc(var(--line-height)*10rem)}.ChipPage ._test_panel{grid-area:tst}.ChipPage ._test_panel main [role=tab]{white-space:nowrap}.ChipPage ._parts_panel{grid-area:prt}@media(max-width:1616px){.ChipPage{grid-template-areas:"hdl prt" "tst tst";grid-template-columns:1fr var(--screen-size);grid-template-rows:3fr 2fr}.ChipPage ._test_panel{grid-area:tst}.ChipPage ._test_panel main>.Editor{max-height:50%}}@media(max-width:1074px){.ChipPage{grid-template-areas:"hdl" "prt" "tst";grid-template-columns:1fr;grid-template-rows:1fr 1fr 1fr}.ChipPage ._test_panel{grid-area:tst}.ChipPage ._test_panel main>.Editor{max-height:40%}}.Editor{height:100%;position:relative;width:100%}.Editor .monaco-editor{position:absolute}.Editor .highlight{background-color:var(--mark-background-color)}.Editor textarea{flex:1 1}.Editor:has(.overlay){position:relative}.Editor .overlay{background-color:var(--form-element-disabled-background-color);inset:0;opacity:var(--form-element-disabled-opacity);position:absolute} +/*# sourceMappingURL=605.17e509d9.chunk.css.map*/ \ No newline at end of file diff --git a/web/build/static/css/605.17e509d9.chunk.css.map b/web/build/static/css/605.17e509d9.chunk.css.map new file mode 100644 index 000000000..125090d83 --- /dev/null +++ b/web/build/static/css/605.17e509d9.chunk.css.map @@ -0,0 +1 @@ +{"version":3,"file":"static/css/605.17e509d9.chunk.css","mappings":"AAAA,aAEE,aACA,mBAFA,QAEA,CAEA,sFAIE,SAEA,8JAEE,2BAA0B,CAD1B,wBACA,CAGF,0JAEE,4BAA2B,CAD3B,yBACA,CAGF,kKACE,wCACA,qBAGF,wUAEE,aC5BN,eACE,oBAAqB,CACrB,yEAA0E,CAC1E,oFAEA,aAAc,CACd,0DAA6D,CAC7D,aACA,8GACE,CADF,8FACE,CAEF,YAGF,2CAIE,4BAFA,WACA,cAGA,UAAS,CADT,iCACA,CAGF,sBACE,SAGF,qBAGE,mBAFA,OAEA,CAGF,WACE,2BACA,4BAGA,UAAS,CADT,8CADA,OAEA,CAGF,iCAME,iIAGF,iBACE,qCAAsC,CACtC,qBAGF,uBACE,qBAAsB,CAGxB,wBACE,qBAAsB,CAGxB,wBAEE,2BAEA,WAEA,gBAHA,4BAEA,SACA,CAGF,+BAIE,uDAGF,yBAIE,uDAGF,gBACE,aAEA,wBAGF,+CACE,cACA,gBAGF,yCACE,cACA,gBChGF,UAKE,6DAAsE,CAOtE,MAEA,kCAJA,iDADA,uBAFA,YAIA,QAGA,CAbA,aACE,+CAcF,sBACE,cACA,0CAGF,uBACE,cAGE,uCACE,mBAKN,wBACE,cAIJ,yBACE,UAIE,wCAFA,6CADA,0BAIE,CAGF,uBACE,cAGE,oCACE,gBAOV,yBACE,UAIE,sCAFA,0BADA,8BAIE,CAIF,uBACE,cAGE,oCACE,gBC3EV,QACE,YAgBA,kBAfA,UAeA,CAbA,uBAEE,kBAGF,mBACE,8CAGF,iBACE,SAIF,sBAEE,kBAGF,iBAGE,+DADA,QAEA,6CAHA,iBAGA","sources":["pico/button-group.scss","shell/tab.scss","pages/chip.scss","shell/editor.scss"],"sourcesContent":["[role=\"group\"] {\n margin: 0;\n display: flex;\n flex-direction: row;\n\n button,\n [role=\"button\"],\n input,\n select {\n margin: 0;\n\n &:not(:first-child) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n &:not(:last-child) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n &[aria-current=\"true\"] {\n background-color: var(--primary-inverse);\n color: var(--primary);\n }\n\n input[type=\"radio\"],\n input[type=\"checkbox\"] {\n display: none;\n }\n }\n}\n","[role=\"tablist\"] {\n --border-style: solid;\n --border: var(--border-width) var(--border-style) var(--card-border-color);\n --border-empty: var(--border-width) var(--border-style)\n var(--card-background-color);\n --tab-count: 5;\n --spacing-tab-edge: calc(var(--block-spacing-horizontal) / 2);\n display: grid;\n grid-template:\n min-content 1fr /\n var(--spacing-tab-edge) repeat(var(--tab-count), min-content) 1fr;\n height: 100%;\n}\n\n[role=\"tablist\"]::after,\n[role=\"tablist\"]::before {\n content: \"\";\n display: block;\n border-bottom: var(--border);\n min-width: var(--spacing-tab-edge);\n grid-row: 1;\n}\n\n[role=\"tablist\"]::before {\n order: -1;\n}\n\n[role=\"tablist\"]::after {\n order: 1;\n // flex: 1;\n grid-column-end: -1;\n}\n\n[role=\"tab\"] {\n border: var(--border-empty);\n border-bottom: var(--border);\n order: 0;\n height: min-content;\n grid-row: 1;\n}\n\nlabel[role=\"tab\"],\n[role=\"tab\"] label {\n /* Ensure the padding is on the label, so the entire area is clickable */\n padding-top: var(--form-element-spacing-vertical);\n padding-bottom: calc(var(--form-element-spacing-vertical) / 2);\n padding-left: var(--form-element-spacing-horizontal);\n padding-right: var(--form-element-spacing-horizontal);\n}\n\n[role=\"tab\"]:hover {\n --border-color: var(--secondary-color);\n border: var(--border);\n}\n\n[role=\"tab\"]:has(:focus) {\n --border-style: dotted;\n}\n\n[role=\"tab\"]:has(:active) {\n --border-style: dotted;\n}\n\n[role=\"tab\"] [type=\"radio\"] {\n /* Leave the radio button focusable, but not visible. Copied from .screen-reader-text */\n clip: rect(1px, 1px, 1px, 1px);\n position: absolute !important;\n height: 1px;\n width: 1px;\n overflow: hidden;\n}\n\n[role=\"tab\"][aria-selected=\"true\"] {\n border-top: var(--border);\n border-left: var(--border);\n border-right: var(--border);\n border-bottom: var(--border-empty);\n}\n\n[role=\"tab\"]:has(:checked) {\n border-top: var(--border);\n border-left: var(--border);\n border-right: var(--border);\n border-bottom: var(--border-empty);\n}\n\n[role=\"tabpanel\"] {\n display: none;\n // order: 2;\n grid-area: 2 / 1 / span 1 / -1;\n}\n\n[role=\"tab\"][aria-selected=\"true\"] + [role=\"tabpanel\"] {\n display: block;\n flex-basis: 100%;\n}\n\n[role=\"tab\"]:has(:checked) + [role=\"tabpanel\"] {\n display: block;\n flex-basis: 100%;\n}\n","@use \"../pico/button-group.scss\";\n@use \"../shell/tab.scss\";\n\n.ChipPage {\n h2 {\n margin: 0 var(--nav-element-spacing-horizontal);\n }\n\n --screen-size: calc(512px + calc(var(--block-spacing-horizontal) * 5));\n\n height: 100%;\n\n grid-template-rows: 1fr;\n grid-template-columns: 1fr var(--screen-size) 1fr;\n margin: 0px;\n gap: 0;\n\n grid-template-areas: \"hdl prt tst\";\n\n ._hdl_panel {\n grid-area: hdl;\n min-height: calc(var(--line-height) * 10rem);\n }\n\n ._test_panel {\n grid-area: tst;\n\n main {\n [role=\"tab\"] {\n white-space: nowrap;\n }\n }\n }\n\n ._parts_panel {\n grid-area: prt;\n }\n}\n\n@media (max-width: 1616px) {\n .ChipPage {\n grid-template-rows: 3fr 2fr;\n grid-template-columns: 1fr var(--screen-size);\n\n grid-template-areas:\n \"hdl prt\"\n \"tst tst\";\n\n ._test_panel {\n grid-area: tst;\n\n main {\n > .Editor {\n max-height: 50%;\n }\n }\n }\n }\n}\n\n@media (max-width: 1074px) {\n .ChipPage {\n grid-template-rows: 1fr 1fr 1fr;\n grid-template-columns: 1fr;\n\n grid-template-areas:\n \"hdl\"\n \"prt\"\n \"tst\";\n\n ._test_panel {\n grid-area: tst;\n\n main {\n > .Editor {\n max-height: 40%;\n }\n }\n }\n }\n}\n",".Editor {\n height: 100%;\n width: 100%;\n\n .monaco-editor {\n // Magic\n position: absolute;\n }\n\n .highlight {\n background-color: var(--mark-background-color);\n }\n\n textarea {\n flex: 1;\n }\n\n position: relative; // For \".overlay\", below.\n &:has(.overlay) {\n // Available in chrome 105\n position: relative;\n }\n\n .overlay {\n position: absolute;\n inset: 0;\n background-color: var(--form-element-disabled-background-color);\n opacity: var(--form-element-disabled-opacity);\n }\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/css/main.2f41c32c.css b/web/build/static/css/main.2f41c32c.css new file mode 100644 index 000000000..8640bccdb --- /dev/null +++ b/web/build/static/css/main.2f41c32c.css @@ -0,0 +1,2 @@ +@import url(https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200);@layer user{body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:root{--line-height:1.25;--spacing:0.25rem;--typography-spacing-vertical:1.15rem;--grid-spacing-horizontal:var(--spacing);--grid-spacing-vertical:var(--spacing);--form-element-spacing-vertical:0.15rem;--form-element-spacing-horizontal:0.25rem;--font-family:Poppins,system-ui,-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-size-monospace:16px;--font-family-monospace:"JetBrains Mono",source-code-pro,Menlo,Monaco,Consolas,"Roboto Mono","Ubuntu Monospace","Noto Mono","Oxygen Mono","Liberation Mono",monospace,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--card-border-color:#000}@media only screen and (prefers-color-scheme:dark){:root:not([data-theme=light]){--card-border-color:#fff}}[data-theme=dark]{--card-border-color:#fff}}@layer component{.scroll-x{overflow-x:auto}.scroll-y{overflow-y:auto}.font-monospace,code,kbd{font-family:var(--font-family-monospace);font-size:var(--font-size-monospace)}del{text-decoration:none}textarea{font-family:var(--font-family-monospace);font-size:var(--font-size-monospace);overflow:scroll;white-space:pre}article.fill{margin:0;padding:0}article.no-shadow{box-shadow:none}article.panel{border:solid var(--border-width) var(--card-border-color);border-radius:0;box-shadow:none;display:flex;flex-direction:column;margin:0;overflow-y:auto;padding:0}article.panel>header{border-radius:0;font-weight:700;margin:0;padding:0}article.panel>header>:first-child{padding:0 var(--block-spacing-vertical)}article.panel main{flex:1 1}details{margin-bottom:0;padding-bottom:0}details>summary{align-items:baseline;background-color:var(--card-sectionning-background-color);display:flex;flex-direction:row;font-weight:700;padding:calc(var(--block-spacing-vertical)*.66) var(--block-spacing-horizontal)}details>summary>:first-child{flex:1 1;padding:0 var(--block-spacing-horizontal)}#root{display:flex;flex-direction:column;inset:0;position:absolute}#root header{align-items:baseline;display:flex;flex-direction:row;justify-content:space-between}#root>main{overflow:hidden}#root>footer{align-items:baseline;background-color:var(--card-background-color);border-top:1px solid var(--card-border-color);padding-left:var(--block-spacing-horizontal);padding-top:calc(var(--block-spacing-vertical)/2)}nav ol,nav ul{margin-right:0}nav li{padding:0 var(--nav-link-spacing-horizontal)}td{vertical-align:top}}.material-symbols-outlined{font-variation-settings:"FILL" 0,"wght" 400,"GRAD" 0,"opsz" 24}ul.icon-list li{--raise:-20px;--time:0.33s;align-items:center;display:flex;flex-direction:column}ul.icon-list li a,ul.icon-list li span{position:relative;top:0;transition:var(--time)}ul.icon-list li a{opacity:0}ul.icon-list li:hover a,ul.icon-list li:hover span{top:var(--raise)}ul.icon-list li:hover a{opacity:1}#trackingBanner{background-color:#f8f8ff;border-top:1px solid #000;bottom:0;left:0;padding:var(--spacing);position:absolute;right:0}#trackingBanner [role=button].accept{background-color:#90ee90;color:#000}#trackingBanner [role=button].reject{background-color:#ffb6c1;color:#000}[role=group]{display:flex;flex-direction:row;margin:0}[role=group] [role=button],[role=group] button,[role=group] input,[role=group] select{margin:0}[role=group] [role=button]:not(:first-child),[role=group] button:not(:first-child),[role=group] input:not(:first-child),[role=group] select:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}[role=group] [role=button]:not(:last-child),[role=group] button:not(:last-child),[role=group] input:not(:last-child),[role=group] select:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}[role=group] [role=button][aria-current=true],[role=group] button[aria-current=true],[role=group] input[aria-current=true],[role=group] select[aria-current=true]{background-color:var(--primary-inverse);color:var(--primary)}[role=group] [role=button] input[type=checkbox],[role=group] [role=button] input[type=radio],[role=group] button input[type=checkbox],[role=group] button input[type=radio],[role=group] input input[type=checkbox],[role=group] input input[type=radio],[role=group] select input[type=checkbox],[role=group] select input[type=radio]{display:none}dl{display:grid;grid-template-columns:minmax(-webkit-max-content,1fr) minmax(auto,2fr);grid-template-columns:minmax(max-content,1fr) minmax(auto,2fr)}dl>header{background-color:var(--muted-color);color:var(--primary-inverse);font-weight:700;grid-column:1/span 2;padding:var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal)}dl dt{grid-column-start:1}dl dd{grid-column-start:2;margin:0}dl dd,dl dt{border:1px solid var(--muted-border-color);padding:var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal)}dl dd:nth-of-type(2n),dl dt:nth-of-type(2n){background-color:var(--table-row-stripped-background-color)}.flex{display:flex;flex-direction:column}.flex.row{flex-direction:row}.flex.row.inline>*{display:inline-block}.flex.justify-around{justify-content:space-around}.flex.justify-between{justify-content:space-between}.flex.justify-center{justify-content:center}.flex.align-baseline{align-items:baseline}.flex.align-center{align-items:center}.flex.align-stretch{align-items:stretch}.flex.align-end{align-items:end}.flex-0{flex-basis:0}.flex-1{flex:1 1}.flex-2{flex:2 1}.flex-3{flex:3 1}.flex-4{flex:4 1} +/*# sourceMappingURL=main.2f41c32c.css.map*/ \ No newline at end of file diff --git a/web/build/static/css/main.2f41c32c.css.map b/web/build/static/css/main.2f41c32c.css.map new file mode 100644 index 000000000..b0070f1e3 --- /dev/null +++ b/web/build/static/css/main.2f41c32c.css.map @@ -0,0 +1 @@ +{"version":3,"file":"static/css/main.2f41c32c.css","mappings":"kIAAA,YACE,KACE,mCACA,kCAGF,MACE,kBAAmB,CAEnB,iBAAkB,CAElB,qCAAsC,CAEtC,wCAAyC,CACzC,sCAAuC,CACvC,uCAAwC,CAExC,yCAA0C,CAE1C,yLAGA,0BAA2B,CAC3B,gPAIA,wBAA0B,CAG5B,mDACE,8BACE,wBAA0B,CAA1B,CAIJ,kBACE,wBAA0B,CAA1B,CAIJ,iBACE,UACE,gBAGF,UACE,gBAGF,yBAGE,yCACA,qCAGF,IACE,qBAGF,SAGE,yCACA,qCAHA,gBACA,eAEA,CAGF,aAEE,QAAO,CADP,SACA,CAGF,kBACE,gBAIF,cACE,0DAGA,gBACA,gBACA,aACA,sBAJA,SAKA,gBANA,SAMA,CAEA,qBAIE,eAAc,CADd,gBADA,SADA,SAGA,CAGF,kCACE,wCAGF,mBACE,SAKJ,QACE,gBACA,iBAEA,gBAGE,qBACA,0DAHA,aACA,mBAKA,gBAFA,+EAEA,CAGF,6BACE,SACA,0CAIJ,MAGE,aACA,sBAFA,QADA,iBAGA,CAEA,aAIE,qBAHA,aACA,mBACA,6BACA,CAGF,WACE,gBAGF,aAKE,qBAHA,8CADA,8CAGA,6CADA,iDAEA,CAIJ,cAEE,eAGF,OACE,6CAGF,GACE,oBChKJ,2BACE,+DAIA,gBAKE,aAAc,CACd,YAAY,CAHZ,mBAFA,aACA,qBAIa,CAEb,uCAEE,kBACA,MACA,uBAGF,kBACE,UAIA,mDAEE,iBAGF,wBACE,UChCR,gBACE,yBACA,0BAGA,SACA,OAFA,uBADA,kBAIA,QAGE,qCAEE,yBADA,UACA,CAGF,qCAEE,yBADA,UACA,CCjBN,aAEE,aACA,mBAFA,QAEA,CAEA,sFAIE,SAEA,8JAEE,2BAA0B,CAD1B,wBACA,CAGF,0JAEE,4BAA2B,CAD3B,yBACA,CAGF,kKACE,wCACA,qBAGF,wUAEE,aC5BN,GACE,aACA,sIAEA,UAGE,oCACA,6BAFA,gBADA,qBAIA,oFAIF,MACE,oBAGF,MACE,oBACA,SAGF,YAIE,2CAFA,mFAEA,CAEA,4CACE,4DC7BN,MACE,aACA,sBAEA,UACE,mBAEA,mBACE,qBAIJ,qBACE,6BAGF,sBACE,8BAGF,qBACE,uBAGF,qBACE,qBAGF,mBACE,mBAGF,oBACE,oBAGF,gBACE,gBAIJ,QACE,aAIA,QACE,QAFS,CACX,QACE,QAFS,CACX,QACE,QAFS,CACX,QACE,QAFS","sources":["pico/pico.scss","pico/icon.scss","tracking.scss","pico/button-group.scss","pico/property.scss","pico/flex.scss"],"sourcesContent":["@layer user {\n body {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n :root {\n --line-height: 1.25;\n /* 1.5 */\n --spacing: 0.25rem;\n /* 1rem */\n --typography-spacing-vertical: 1.15rem;\n /* 1.5rem */\n --grid-spacing-horizontal: var(--spacing);\n --grid-spacing-vertical: var(--spacing);\n --form-element-spacing-vertical: 0.15rem;\n /* .75rem */\n --form-element-spacing-horizontal: 0.25rem;\n /* 1rem */\n --font-family: Poppins, system-ui, -apple-system, \"Segoe UI\", Roboto, Oxygen,\n Ubuntu, Cantarell, \"Noto Sans\", sans-serif, \"Apple Color Emoji\",\n \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n --font-size-monospace: 16px;\n --font-family-monospace: \"JetBrains Mono\", source-code-pro, Menlo, Monaco,\n Consolas, \"Roboto Mono\", \"Ubuntu Monospace\", \"Noto Mono\", \"Oxygen Mono\",\n \"Liberation Mono\", monospace, \"Apple Color Emoji\", \"Segoe UI Emoji\",\n \"Segoe UI Symbol\", \"Noto Color Emoji\";\n --card-border-color: black;\n }\n\n @media only screen and (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --card-border-color: white;\n }\n }\n\n [data-theme=\"dark\"] {\n --card-border-color: white;\n }\n}\n\n@layer component {\n .scroll-x {\n overflow-x: auto;\n }\n\n .scroll-y {\n overflow-y: auto;\n }\n\n code,\n kbd,\n .font-monospace {\n font-family: var(--font-family-monospace);\n font-size: var(--font-size-monospace);\n }\n\n del {\n text-decoration: none;\n }\n\n textarea {\n overflow: scroll;\n white-space: pre;\n font-family: var(--font-family-monospace);\n font-size: var(--font-size-monospace);\n }\n\n article.fill {\n padding: 0;\n margin: 0;\n }\n\n article.no-shadow {\n box-shadow: none;\n }\n\n // Tighten up panel articles\n article.panel {\n border: solid var(--border-width) var(--card-border-color);\n padding: 0;\n margin: 0;\n border-radius: 0;\n box-shadow: none;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n\n > header {\n padding: 0;\n margin: 0;\n font-weight: bold;\n border-radius: 0;\n }\n\n > header > *:first-child {\n padding: 0 var(--block-spacing-vertical);\n }\n\n main {\n flex: 1;\n }\n }\n\n // Tighten up accordian headers\n details {\n margin-bottom: 0;\n padding-bottom: 0;\n\n > summary {\n display: flex;\n flex-direction: row;\n align-items: baseline;\n background-color: var(--card-sectionning-background-color);\n padding: calc(var(--block-spacing-vertical) * 0.66)\n var(--block-spacing-horizontal);\n font-weight: bold;\n }\n\n > summary > *:first-child {\n flex: 1;\n padding: 0 var(--block-spacing-horizontal);\n }\n }\n\n #root {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n\n header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: baseline;\n }\n\n > main {\n overflow: hidden;\n }\n\n > footer {\n border-top: 1px solid var(--card-border-color);\n background-color: var(--card-background-color);\n padding-top: calc(var(--block-spacing-vertical) / 2);\n padding-left: var(--block-spacing-horizontal);\n align-items: baseline;\n }\n }\n\n nav ol,\n nav ul {\n margin-right: 0;\n }\n\n nav li {\n padding: 0 var(--nav-link-spacing-horizontal);\n }\n\n td {\n vertical-align: top;\n }\n}\n","@import url(\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\");\n.material-symbols-outlined {\n font-variation-settings: \"FILL\" 0, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24;\n}\n\nul.icon-list {\n li {\n display: flex;\n flex-direction: column;\n align-items: center;\n\n --raise: -20px;\n --time: 0.33s;\n\n span,\n a {\n position: relative;\n top: 0;\n transition: var(--time);\n }\n\n a {\n opacity: 0;\n }\n\n &:hover {\n span,\n a {\n top: var(--raise);\n }\n\n a {\n opacity: 1;\n }\n }\n }\n}\n","#trackingBanner {\n background-color: ghostwhite;\n border-top: 1px solid black;\n position: absolute;\n padding: var(--spacing);\n bottom: 0;\n left: 0;\n right: 0;\n\n [role=\"button\"] {\n &.accept {\n color: black;\n background-color: lightgreen;\n }\n\n &.reject {\n color: black;\n background-color: lightpink;\n }\n }\n}\n","[role=\"group\"] {\n margin: 0;\n display: flex;\n flex-direction: row;\n\n button,\n [role=\"button\"],\n input,\n select {\n margin: 0;\n\n &:not(:first-child) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n &:not(:last-child) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n &[aria-current=\"true\"] {\n background-color: var(--primary-inverse);\n color: var(--primary);\n }\n\n input[type=\"radio\"],\n input[type=\"checkbox\"] {\n display: none;\n }\n }\n}\n","dl {\n display: grid;\n grid-template-columns: minmax(max-content, 1fr) minmax(auto, 2fr);\n\n > header {\n grid-column: 1 / span 2;\n font-weight: bold;\n background-color: var(--muted-color);\n color: var(--primary-inverse);\n padding: var(--form-element-spacing-vertical)\n var(--form-element-spacing-horizontal);\n }\n\n dt {\n grid-column-start: 1;\n }\n\n dd {\n grid-column-start: 2;\n margin: 0;\n }\n\n dd,\n dt {\n padding: var(--form-element-spacing-vertical)\n var(--form-element-spacing-horizontal);\n border: 1px solid var(--muted-border-color);\n\n &:nth-of-type(even) {\n background-color: var(--table-row-stripped-background-color);\n }\n }\n}\n",".flex {\n display: flex;\n flex-direction: column;\n\n &.row {\n flex-direction: row;\n\n &.inline > * {\n display: inline-block;\n }\n }\n\n &.justify-around {\n justify-content: space-around;\n }\n\n &.justify-between {\n justify-content: space-between;\n }\n\n &.justify-center {\n justify-content: center;\n }\n\n &.align-baseline {\n align-items: baseline;\n }\n\n &.align-center {\n align-items: center;\n }\n\n &.align-stretch {\n align-items: stretch;\n }\n\n &.align-end {\n align-items: end;\n }\n}\n\n.flex-0 {\n flex-basis: 0;\n}\n\n@for $i from 1 through 4 {\n .flex-#{$i} {\n flex: $i;\n }\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/2.0c1eab19.chunk.js b/web/build/static/js/2.0c1eab19.chunk.js new file mode 100644 index 000000000..9ab3da7cc --- /dev/null +++ b/web/build/static/js/2.0c1eab19.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[2],{5002:function(e,r,t){t.r(r),t.d(r,{default:function(){return D}});var n=t(1092),a=t(189),s=t(9422),u=t(649),i=t(1026),c=t(7791),o=t(8061),p=t(8698),f=t(8582),l=t(1277),d=t(4625),m=t(8090),h=t(9647),x=t(691),Z=t(3389),v=function(e){var r=m.Gq.parse(e.hdl),t=h.qH.parse(e.tst);return(0,a.Z)((0,a.Z)({},e),{},{maybeParsedHDL:r,maybeParsedTST:t})},b=function(e,r){var t=function(e){return function(){var r=(0,c.Z)((0,n.Z)().mark((function r(t){var s,u,i;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(0,d.dZ)(t.maybeChip)){r.next=2;break}return r.abrupt("return",(0,a.Z)((0,a.Z)({},t),{},{pass:!1,out:(0,d.UG)(t.maybeChip).message}));case 2:if(!(0,d.dZ)(t.maybeTest)){r.next=4;break}return r.abrupt("return",(0,a.Z)((0,a.Z)({},t),{},{pass:!1,out:(0,d.UG)(t.maybeTest).message}));case 4:return s=(0,d.Ok)(t.maybeTest).with((0,d.Ok)(t.maybeChip)).setFileSystem(e),r.next=7,s.run();case 7:return u=s.log(),i=u.trim()===t.cmp.trim(),r.abrupt("return",(0,a.Z)((0,a.Z)({},t),{},{out:u,pass:i}));case 10:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}()}(e),s=function(e){return function(){var r=(0,c.Z)((0,n.Z)().mark((function r(t){var s,u;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(0,d.IY)(t.maybeParsedHDL)){r.next=6;break}return r.next=3,(0,x.J_)((0,d.Ok)(t.maybeParsedHDL),e);case 3:r.t0=r.sent,r.next=7;break;case 6:r.t0=(0,d.UG)(new Error("HDL Was not parsed"));case 7:return s=r.t0,u=(0,d.IY)(t.maybeParsedTST)?(0,d.Ok)(Z.l1.from((0,d.Ok)(t.maybeParsedTST))):(0,d.UG)(new Error("TST Was not parsed")),r.abrupt("return",(0,a.Z)((0,a.Z)({},t),{},{maybeChip:s,maybeTest:u}));case 10:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}()}(e);return function(){var e=(0,c.Z)((0,n.Z)().mark((function e(u){var o,p,f,l,d,m;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(){var e=(0,c.Z)((0,n.Z)().mark((function e(){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=t,e.t1=s,e.next=4,v(u);case 4:return e.t2=e.sent,e.next=7,(0,e.t1)(e.t2);case 7:return e.t3=e.sent,e.abrupt("return",(0,e.t0)(e.t3));case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=(0,c.Z)((0,n.Z)().mark((function e(){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null===r||void 0===r?void 0:r.hdl(u));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.next=4,Promise.all([o(),p()]);case 4:return f=e.sent,l=(0,i.Z)(f,2),d=l[0],m=l[1],e.abrupt("return",(0,a.Z)((0,a.Z)({},d),{},{shadow:m}));case 9:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}()};function w(e,r,t,n){return y.apply(this,arguments)}function y(){return y=(0,c.Z)((0,n.Z)().mark((function e(r,t,a,s){var u;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=b(a,s),e.abrupt("return",Promise.all(r.map(t).map(function(){var e=(0,c.Z)((0,n.Z)().mark((function e(r){return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=u,e.next=3,r;case 3:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1));case 5:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}())));case 2:case"end":return e.stop()}}),e)}))),y.apply(this,arguments)}var k=t(6167),j=t(7878);function g(e){var r=e.name,t=e.ext;return void 0!==l.Assignments[r]&&".hdl"===t}var T=function(e){return(0,j.jsxs)("details",{children:[(0,j.jsxs)("summary",{children:[e.name," ",e.pass?(0,j.jsx)(o.cC,{id:"Passed"}):(0,j.jsx)(o.cC,{id:"Failed"})]}),(0,j.jsxs)("div",{className:"flex row",children:[(0,j.jsx)("pre",{children:(0,j.jsx)("code",{children:e.hdl})}),(0,j.jsx)("pre",{children:(0,j.jsx)("code",{children:e.tst})})]}),(0,j.jsx)(f.M,{cmp:e.cmp,out:e.out})]})};function P(e){return C.apply(this,arguments)}function C(){return C=(0,c.Z)((0,n.Z)().mark((function e(r){var t,s,u,i,c,o;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=l.Assignments[r.name],e.next=3,null===(s=r.file)||void 0===s?void 0:s.text();case 3:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=7;break}e.t0=void 0!==t;case 7:if(!e.t0){e.next=11;break}e.t2=t,e.next=12;break;case 11:e.t2="";case 12:return i=e.t2,c=u["".concat(r.name,".tst")],o=u["".concat(r.name,".cmp")],e.abrupt("return",(0,a.Z)((0,a.Z)({},r),{},{hdl:i,tst:c,cmp:o}));case 16:case"end":return e.stop()}}),e)}))),C.apply(this,arguments)}var D=function(){var e=(0,k.useState)([]),r=(0,i.Z)(e,2),t=r[0],o=r[1],f=(0,p.Q)().fs,l=(0,k.useCallback)(function(){var e=(0,c.Z)((0,n.Z)().mark((function e(r){var t,i,p,l;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.target,e.next=3,Promise.all((0,u.Z)(null!==(t=i.files)&&void 0!==t?t:[]).filter((function(e){return e.name.endsWith(".hdl")})).map((function(e){var r,t,n,a,u=null!==(r=null===(t=e.name.match((0,s.Z)(/^((.*)(\.[^.]*))?$/,{base:1,name:2,ext:3})))||void 0===t?void 0:t.groups)&&void 0!==r?r:{},i=u.name,c=u.base;return{name:i,base:c,ext:u.ext,dir:null!==(n="/"+(null===(a=e.webkitRelativePath)||void 0===a?void 0:a.replace(c,"")))&&void 0!==n?n:"",root:"/",file:e}})).filter(g).map(function(){var e=(0,c.Z)((0,n.Z)().mark((function e(r){var t;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.file.text();case 2:return t=e.sent,e.abrupt("return",(0,a.Z)((0,a.Z)({},r),{},{hdl:t}));case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}()));case 3:return p=e.sent,e.next=6,w(p,P,f);case 6:l=e.sent,f.pushd("/samples"),o(l),f.popd();case 10:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),[o,f]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:"NAND2Tetris Web IDE"}),(0,j.jsx)("form",{children:(0,j.jsxs)("fieldset",{children:[(0,j.jsx)("legend",{children:"Files for grading:"}),(0,j.jsx)("input",{type:"file",multiple:!0,directory:"",webkitdirectory:"",onChange:l})]})}),(0,j.jsx)("figure",{children:t.length>0?t.map((function(e,r){return(0,j.jsx)(T,(0,a.Z)({},e),e.name)})):(0,j.jsx)(j.Fragment,{})})]})}}}]); +//# sourceMappingURL=2.0c1eab19.chunk.js.map \ No newline at end of file diff --git a/web/build/static/js/2.0c1eab19.chunk.js.map b/web/build/static/js/2.0c1eab19.chunk.js.map new file mode 100644 index 000000000..8fdce7f4c --- /dev/null +++ b/web/build/static/js/2.0c1eab19.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/2.0c1eab19.chunk.js","mappings":"2TAkDaA,EAAa,SAACC,GACzB,IAAMC,EAAiBC,EAAAA,GAAAA,MAAUF,EAAKG,KAChCC,EAAiBC,EAAAA,GAAAA,MAAUL,EAAKM,KACtC,OAAO,kBAAKN,GAAI,IAAEC,eAAAA,EAAgBG,eAAAA,GACpC,EA2CaG,EAAS,SAACC,EAAgBC,GACrC,IAAMC,EA3BN,SAACF,GAAc,gDACf,WAAOG,GAA2B,qFAC5BC,EAAAA,EAAAA,IAAMD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,EACdrB,EAAMX,KAAI,SAACiC,EAAGC,GAAC,OAAK,SAAC5B,GAAU,UAAkB2B,GAAZA,EAAE/B,KAAe,KAEtD,4BAKV,C","sources":["../../simulator/src/projects/runner.ts","pages/home.tsx"],"sourcesContent":["import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport {\n isOk,\n Ok,\n Err,\n isErr,\n Result,\n} from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { Assignments, Assignment } from \"@nand2tetris/projects/index.js\";\nimport type { Runner, RunResult } from \"@nand2tetris/runner/types.js\";\nimport { HDL, HdlParse } from \"../languages/hdl.js\";\nimport { Tst, TST } from \"../languages/tst.js\";\nimport { build as buildChip } from \"../chip/builder.js\";\nimport { ChipTest } from \"../tst.js\";\nimport { ParseError } from \"../languages/base.js\";\nimport { Chip } from \"../chip/chip.js\";\n\nexport interface AssignmentFiles extends Assignment {\n hdl: string;\n tst: string;\n cmp: string;\n}\n\nexport interface AssignmentParse extends AssignmentFiles {\n maybeParsedHDL: Result;\n maybeParsedTST: Result;\n}\n\nexport interface AssignmentBuild extends AssignmentParse {\n maybeChip: Result;\n maybeTest: Result;\n}\n\nexport interface AssignmentRun extends AssignmentBuild {\n pass: boolean;\n out: string;\n shadow?: RunResult;\n}\n\nexport const hasTest = ({\n name,\n ext,\n}: {\n name: string;\n ext: string;\n}): boolean =>\n Assignments[name as keyof typeof Assignments] !== undefined &&\n [\".hdl\", \".tst\"].includes(ext);\n\n/** Try parsing the loaded files. */\nexport const maybeParse = (file: AssignmentFiles): AssignmentParse => {\n const maybeParsedHDL = HDL.parse(file.hdl);\n const maybeParsedTST = TST.parse(file.tst);\n return { ...file, maybeParsedHDL, maybeParsedTST };\n};\n\n/** After parsing the assignment, compile the Chip and Tst. */\nexport const maybeBuild =\n (fs: FileSystem) =>\n async (file: AssignmentParse): Promise => {\n const maybeChip = isOk(file.maybeParsedHDL)\n ? await buildChip(Ok(file.maybeParsedHDL), fs)\n : Err(new Error(\"HDL Was not parsed\"));\n const maybeTest = isOk(file.maybeParsedTST)\n ? Ok(ChipTest.from(Ok(file.maybeParsedTST)))\n : Err(new Error(\"TST Was not parsed\"));\n return { ...file, maybeChip, maybeTest };\n };\n\n/** If the assignment parsed, run it! */\nexport const tryRun =\n (fs: FileSystem) =>\n async (assignment: AssignmentBuild): Promise => {\n if (isErr(assignment.maybeChip)) {\n return {\n ...assignment,\n pass: false,\n out: Err(assignment.maybeChip).message,\n };\n }\n if (isErr(assignment.maybeTest)) {\n return {\n ...assignment,\n pass: false,\n out: Err(assignment.maybeTest).message,\n };\n }\n const test = Ok(assignment.maybeTest)\n .with(Ok(assignment.maybeChip))\n .setFileSystem(fs);\n await test.run();\n const out = test.log();\n const pass = out.trim() === assignment.cmp.trim();\n return { ...assignment, out, pass };\n };\n\n/** Parse & execute a Nand2tetris assignment, possibly also including the Java output in shadow mode. */\nexport const runner = (fs: FileSystem, ideRunner?: Runner) => {\n const tryRunWithFs = tryRun(fs);\n const maybeBuildWithFs = maybeBuild(fs);\n return async (assignment: AssignmentFiles): Promise => {\n const jsRunner = async () =>\n tryRunWithFs(await maybeBuildWithFs(await maybeParse(assignment)));\n const javaRunner = async () => ideRunner?.hdl(assignment);\n\n const [jsRun, shadow] = await Promise.all([jsRunner(), javaRunner()]);\n return { ...jsRun, shadow };\n };\n};\n\n/** Run all tests for a given Nand2Tetris project. */\nexport async function runTests(\n files: Array,\n loadAssignment: (file: Assignment) => Promise,\n fs: FileSystem,\n ideRunner?: Runner\n): Promise {\n const run = runner(fs, ideRunner);\n return Promise.all(\n files.map(loadAssignment).map(async (assignment) => run(await assignment))\n );\n}\n","import { useBaseContext } from \"@nand2tetris/components/stores/base.context\";\nimport { DiffTable } from \"@nand2tetris/components/difftable\";\nimport { Assignments, ParsedPath } from \"@nand2tetris/projects/index.js\";\nimport { runTests } from \"@nand2tetris/simulator/projects/runner.js\";\nimport { Trans } from \"@lingui/macro\";\nimport { ChangeEventHandler, useCallback, useState } from \"react\";\n// import { parse, ParsedPath } from \"node:path\";\n\nfunction hasTest({ name, ext }: { name: string; ext: string }) {\n return (\n Assignments[name as keyof typeof Assignments] !== undefined &&\n ext === \".hdl\"\n );\n}\n\nconst TestResult = (props: {\n name: string;\n pass: boolean;\n hdl: string;\n tst: string;\n cmp: string;\n out: string;\n}) => (\n
\n \n {props.name} {props.pass ? Passed : Failed}\n \n
\n
\n        {props.hdl}\n      
\n
\n        {props.tst}\n      
\n
\n \n
\n);\n\nasync function loadAssignment(file: ParsedPath & { file?: File }) {\n const assignment = Assignments[file.name as keyof typeof Assignments];\n const hdl = (await file.file?.text()) ?? \"\";\n const tst = assignment[\n `${file.name}.tst` as keyof typeof assignment\n ] as string;\n const cmp = assignment[\n `${file.name}.cmp` as keyof typeof assignment\n ] as string;\n return { ...file, hdl, tst, cmp };\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line\n interface HTMLAttributes {\n // extends React's HTMLAttributes\n directory?: string;\n webkitdirectory?: string;\n }\n}\n\nconst Home = () => {\n const [tests, setTests] = useState(\n [] as Array[0]>\n );\n const { fs } = useBaseContext();\n\n const onChange = useCallback>(\n async ({ target }) => {\n const files = await Promise.all(\n [...(target.files ?? [])]\n .filter((file) => file.name.endsWith(\".hdl\"))\n .map((file) => {\n const { name, base, ext } =\n file.name.match(/^(?(?.*)(?\\.[^.]*))?$/)\n ?.groups ?? {};\n\n const root = \"/\";\n const dir = root + file.webkitRelativePath?.replace(base, \"\") ?? \"\";\n\n return { name, base, ext, dir, root, file };\n })\n .filter(hasTest)\n .map(async (file) => {\n const hdl = await file.file.text();\n return { ...file, hdl };\n })\n );\n\n const tests = await runTests(files, loadAssignment, fs);\n\n fs.pushd(\"/samples\");\n setTests(tests);\n fs.popd();\n },\n [setTests, fs]\n );\n\n return (\n <>\n

NAND2Tetris Web IDE

\n
\n
\n Files for grading:\n \n
\n \n
\n {tests.length > 0 ? (\n tests.map((t, i) => )\n ) : (\n <>\n )}\n
\n \n );\n};\n\nexport default Home;\n"],"names":["maybeParse","file","maybeParsedHDL","HDL","hdl","maybeParsedTST","TST","tst","runner","fs","ideRunner","tryRunWithFs","assignment","isErr","maybeChip","pass","out","Err","message","maybeTest","test","Ok","with","setFileSystem","run","log","trim","cmp","tryRun","maybeBuildWithFs","isOk","buildChip","Error","ChipTest","maybeBuild","jsRunner","javaRunner","Promise","all","jsRun","shadow","runTests","files","loadAssignment","map","hasTest","name","ext","undefined","Assignments","TestResult","props","className","text","useState","tests","setTests","useBaseContext","onChange","useCallback","target","filter","endsWith","match","groups","base","dir","webkitRelativePath","replace","root","pushd","popd","type","multiple","directory","webkitdirectory","length","t","i"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/277.355c3689.chunk.js b/web/build/static/js/277.355c3689.chunk.js new file mode 100644 index 000000000..d3354033f --- /dev/null +++ b/web/build/static/js/277.355c3689.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[277],{1277:function(t,n,e){e.r(n),e.d(n,{ASM_PROJECTS:function(){return R},Assignments:function(){return D},CHIP_PROJECTS:function(){return w},ChipProjects:function(){return C},resetFiles:function(){return g}});var s={};e.r(s),e.d(s,{CHIPS:function(){return i},resetFiles:function(){return c}});var u={};e.r(u),e.d(u,{CHIPS:function(){return k},resetFiles:function(){return v}});var o={};e.r(o),e.d(o,{CHIPS:function(){return f},resetFiles:function(){return h}});var a={};e.r(a),e.d(a,{CHIPS:function(){return z},resetFiles:function(){return b}});var d=e(189),p=e(1092),l=e(7791),r=e(9956),i={Not:{"Not.hdl":"// Not gate: out = not in\n\nCHIP Not {\n IN in;\n OUT out;\n\n PARTS:\n}","Not.tst":"output-list in%B3.1.3 out%B3.1.3;\n\nset in 0, eval, output;\nset in 1, eval, output;","Not.cmp":"| in | out |\n| 0 | 1 |\n| 1 | 0 |"},And:{"And.hdl":"/**\n * And gate: out = 1 if {a==1 and b==1}, 0 otherwise\n * And gate: if {a==1 and b==1} then out = 1 else out = 0\n */\n\nCHIP And {\n IN a, b;\n OUT out;\n\n PARTS:\n}","And.tst":"output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;","And.cmp":"| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 0 |\n| 1 | 0 | 0 |\n| 1 | 1 | 1 |"},Or:{"Or.hdl":"/**\n * Or gate: out = 1 if {a==1 or b==1}, 0 otherwise\n */\n\nCHIP Or {\n IN a, b;\n OUT out;\n\n PARTS:\n}","Or.tst":"output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;","Or.cmp":"| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 1 |\n| 1 | 0 | 1 |\n| 1 | 1 | 1 |"},XOr:{"XOr.hdl":"/**\n * Exclusive-or gate: out = !(a == b).\n */\n\nCHIP XOr {\n IN a, b;\n OUT out;\n\n PARTS:\n}","XOr.tst":"output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;","XOr.cmp":"| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 1 |\n| 1 | 0 | 1 |\n| 1 | 1 | 0 |"},Mux:{"Mux.hdl":"// Multiplexor. If sel==1 then out=b else out=a.\n\nCHIP Mux {\n IN a, b, sel;\n OUT out;\n\n PARTS:\n}","Mux.tst":"output-list a%B3.1.3 b%B3.1.3 sel%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 0, set b 1, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 1, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 1, set b 1, set sel 0, eval, output;\nset sel 1, eval, output;","Mux.cmp":"| a | b | sel | out |\n| 0 | 0 | 0 | 0 |\n| 0 | 0 | 1 | 0 |\n| 0 | 1 | 0 | 0 |\n| 0 | 1 | 1 | 1 |\n| 1 | 0 | 0 | 1 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |\n| 1 | 1 | 1 | 1 |"},DMux:{"DMux.hdl":"/**\n * Demultiplexor.\n * {a,b} = {in,0} if sel==0\n * {0,in} if sel==1\n */\n\nCHIP DMux {\n IN in, sel;\n OUT a, b;\n\n PARTS:\n}","DMux.tst":"output-list in%B3.1.3 sel%B3.1.3 a%B3.1.3 b%B3.1.3;\n\nset in 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset in 1, set sel 0, eval, output;\nset sel 1, eval, output;","DMux.cmp":"| in | sel | a | b |\n| 0 | 0 | 0 | 0 |\n| 0 | 1 | 0 | 0 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |"},Not16:{"Not16.hdl":"// 16-bit Not gate: for i=0..15: out[i] = not in[i]\n\nCHIP Not16 {\n IN in[16];\n OUT out[16];\n\n PARTS:\n}","Not16.tst":"output-list in%B1.16.1 out%B1.16.1;\nset in %B0000000000000000, eval, output;\nset in %B1111111111111111, eval, output;\nset in %B1010101010101010, eval, output;\nset in %B0011110011000011, eval, output;\nset in %B0001001000110100, eval, output;","Not16.cmp":"| in | out |\n| 0000000000000000 | 1111111111111111 |\n| 1111111111111111 | 0000000000000000 |\n| 1010101010101010 | 0101010101010101 |\n| 0011110011000011 | 1100001100111100 |\n| 0001001000110100 | 1110110111001011 |"},And16:{"And16.hdl":"// 16-bit-wise and gate: for i = 0..15: out[i] = a[i] and b[i]\n\nCHIP And16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}","And16.tst":"output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\n\nset a %B0000000000000000, set b %B0000000000000000, eval, output;\nset a %B0000000000000000, set b %B1111111111111111, eval, output;\nset a %B1111111111111111, set b %B1111111111111111, eval, output;\nset a %B1010101010101010, set b %B0101010101010101, eval, output;\nset a %B0011110011000011, set b %B0000111111110000, eval, output;\nset a %B0001001000110100, set b %B1001100001110110, eval, output;","And16.cmp":"| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0000000000000000 |\n| 1111111111111111 | 1111111111111111 | 1111111111111111 |\n| 1010101010101010 | 0101010101010101 | 0000000000000000 |\n| 0011110011000011 | 0000111111110000 | 0000110011000000 |\n| 0001001000110100 | 1001100001110110 | 0001000000110100 |"},Or16:{"Or16.hdl":"// 16-bit bitwise Or gate: for i=0..15 out[i] = a[i] or b[i].\n\nCHIP Or16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}","Or16.tst":"output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\nset a %B0000000000000000, set b %B0000000000000000, eval, output;\nset a %B0000000000000000, set b %B1111111111111111, eval, output;\nset a %B1111111111111111, set b %B1111111111111111, eval, output;\nset a %B1010101010101010, set b %B0101010101010101, eval, output;\nset a %B0011110011000011, set b %B0000111111110000, eval, output;\nset a %B0001001000110100, set b %B1001100001110110, eval, output;","Or16.cmp":"| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1111111111111111 |\n| 1111111111111111 | 1111111111111111 | 1111111111111111 |\n| 1010101010101010 | 0101010101010101 | 1111111111111111 |\n| 0011110011000011 | 0000111111110000 | 0011111111110011 |\n| 0001001000110100 | 1001100001110110 | 1001101001110110 |"},Mux16:{"Mux16.hdl":"// 16 bit multiplexor. If sel==1 then out=b else out=a.\n\nCHIP Mux16 {\n IN a[16], b[16], sel;\n OUT out[16];\n\n PARTS:\n}","Mux16.tst":"output-list a%B1.16.1 b%B1.16.1 sel%D2.1.2 out%B1.16.1;\n\nset a 0, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B0000000000000000, set b %B0001001000110100, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B1001100001110110, set b %B0000000000000000, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B1010101010101010, set b %B0101010101010101, set sel 0, eval, output;\nset sel 1, eval, output;","Mux16.cmp":"| a | b | sel | out |\n| 0000000000000000 | 0000000000000000 | 0 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 1 | 0000000000000000 |\n| 0000000000000000 | 0001001000110100 | 0 | 0000000000000000 |\n| 0000000000000000 | 0001001000110100 | 1 | 0001001000110100 |\n| 1001100001110110 | 0000000000000000 | 0 | 1001100001110110 |\n| 1001100001110110 | 0000000000000000 | 1 | 0000000000000000 |\n| 1010101010101010 | 0101010101010101 | 0 | 1010101010101010 |\n| 1010101010101010 | 0101010101010101 | 1 | 0101010101010101 |"},Mux4Way16:{"Mux4Way16.hdl":"/**\n * 4-way 16-bit multiplexor.\n * out = a if sel==00\n * b if sel==01\n * c if sel==10\n * d if sel==11\n */\n\nCHIP Mux4Way16 {\n IN a[16], b[16], c[16], d[16], sel[2];\n OUT out[16];\n\n PARTS:\n}","Mux4Way16.tst":"output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 sel%B2.2.2 out%B1.16.1;\n\nset a 0, set b 0, set c 0, set d 0, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\n\nset a %B0001001000110100, set b %B1001100001110110, set c %B1010101010101010, set d %B0101010101010101, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;","Mux4Way16.cmp":"| a | b | c | d | sel | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 00 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 01 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 10 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 11 | 0000000000000000 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 00 | 0001001000110100 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 01 | 1001100001110110 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 10 | 1010101010101010 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 11 | 0101010101010101 |"},Mux8Way16:{"Mux8Way16.hdl":"/**\n * 8-way 16-bit multiplexor.\n * out = a if sel==000\n * b if sel==001\n * etc.\n * h if sel==111\n */\n\nCHIP Mux8Way16 {\n IN a[16], b[16], c[16], d[16],\n e[16], f[16], g[16], h[16],\n sel[3];\n OUT out[16];\n\n PARTS:\n}","Mux8Way16.tst":"output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 e%B1.16.1 f%B1.16.1 g%B1.16.1 h%B1.16.1 sel%B2.3.2 out%B1.16.1;\n\nset a 0, set b 0, set c 0, set d 0, set e 0, set f 0, set g 0, set h 0, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\nset sel 4, eval, output;\nset sel 5, eval, output;\nset sel 6, eval, output;\nset sel 7, eval, output;\n\nset a %B0001001000110100, set b %B0010001101000101, set c %B0011010001010110, set d %B0100010101100111, set e %B0101011001111000, set f %B0110011110001001, set g %B0111100010011010, set h %B1000100110101011, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\nset sel 4, eval, output;\nset sel 5, eval, output;\nset sel 6, eval, output;\nset sel 7, eval, output;","Mux8Way16.cmp":"| a | b | c | d | e | f | g | h | sel | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 000 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 001 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 010 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 011 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 100 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 101 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 110 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 111 | 0000000000000000 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 000 | 0001001000110100 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0011010001010110 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 011 | 0100010101100111 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 100 | 0101011001111000 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 101 | 0110011110001001 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 110 | 0111100010011010 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 111 | 1000100110101011 |"},DMux4Way:{"DMux4Way.hdl":"/**\n * 4-way demultiplexor.\n * {a,b,c,d} = {in,0,0,0} if sel==00\n * {0,in,0,0} if sel==01\n * {0,0,in,0} if sel==10\n * {0,0,0,in} if sel==11\n */\n\nCHIP DMux4Way {\n IN in, sel[2];\n OUT a, b, c, d;\n\n PARTS:\n}","DMux4Way.tst":"output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2;\n\nset in 0, set sel %B00, eval, output;\nset sel %B01, eval, output;\nset sel %B10, eval, output;\nset sel %B11, eval, output;\n\nset in 1, set sel %B00, eval, output;\nset sel %B01, eval, output;\nset sel %B10, eval, output;\nset sel %B11, eval, output;","DMux4Way.cmp":"| in | sel | a | b | c | d |\n| 0 | 00 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 1 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 1 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 1 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 1 |"},DMux8Way:{"DMux8Way.hdl":"/**\n * 8-way demultiplexor.\n * {a,b,c,d,e,f,g,h} = {in,0,0,0,0,0,0,0} if sel==000\n * {0,in,0,0,0,0,0,0} if sel==001\n * etc.\n * {0,0,0,0,0,0,0,in} if sel==111\n */\n\n\nCHIP DMux8Way {\n IN in, sel[3];\n OUT a, b, c, d, e, f, g, h;\n\n PARTS:\n}","DMux8Way.tst":"output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2 e%B2.1.2 f%B2.1.2 g%B2.1.2 h%B2.1.2;\n\nset in 0, set sel %B000, eval, output;\nset sel %B001, eval, output;\nset sel %B010, eval, output;\nset sel %B011, eval, output;\nset sel %B100, eval, output;\nset sel %B101, eval, output;\nset sel %B110, eval, output;\nset sel %B111, eval, output;\n\nset in 1, set sel %B000, eval, output;\nset sel %B001, eval, output;\nset sel %B010, eval, output;\nset sel %B011, eval, output;\nset sel %B100, eval, output;\nset sel %B101, eval, output;\nset sel %B110, eval, output;\nset sel %B111, eval, output;","DMux8Way.cmp":"| in | sel | a | b | c | d | e | f | g | h |\n| 0 | 00 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 00 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |"},Or8Way:{"Or8Way.hdl":"/**\n * 8-way or gate: out = in[0] or in[1] or ... or in[7].\n */\n\nCHIP Or8Way {\n IN in[8];\n OUT out;\n\n PARTS:\n}","Or8Way.tst":"output-list in%B2.8.2 out%B2.1.2;\n\nset in %B00000000, eval, output;\nset in %B11111111, eval, output;\nset in %B00010000, eval, output;\nset in %B00000001, eval, output;\nset in %B00100110, eval, output;","Or8Way.cmp":"| in | out |\n| 00000000 | 0 |\n| 11111111 | 1 |\n| 00010000 | 1 |\n| 00000001 | 1 |\n| 00100110 | 1 |"}};function c(t){return B.apply(this,arguments)}function B(){return(B=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.pushd("/projects/01");case 2:return t.next=4,(0,r.mc)(n,i);case 4:return t.next=6,n.popd();case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var k={HalfAdder:{"HalfAdder.hdl":"// Computes the sum of two bits.\n\nCHIP HalfAdder {\n IN a, b; // 1-bit inputs\n OUT sum, // Right bit of a + b \n carry; // Left bit of a + b\n\n PARTS:\n}","HalfAdder.tst":"output-list a%B3.1.3 b%B3.1.3 sum%B3.1.3 carry%B3.1.3;\n\nset a 0,\nset b 0,\neval,\noutput;\n\nset a 0,\nset b 1,\neval,\noutput;\n\nset a 1,\nset b 0,\neval,\noutput;\n\nset a 1,\nset b 1,\neval,\noutput;","HalfAdder.cmp":"| a | b | sum | carry |\n| 0 | 0 | 0 | 0 |\n| 0 | 1 | 1 | 0 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |"},FullAdder:{"FullAdder.hdl":"// Computes the sum of three bits.\n\nCHIP FullAdder {\n IN a, b, c; // 1-bit inputs\n OUT sum, // Right bit of a + b + c\n carry; // Left bit of a + b + c\n\n PARTS:\n}","FullAdder.tst":"output-list a%B3.1.3 b%B3.1.3 c%B3.1.3 sum%B3.1.3 carry%B3.1.3;\n\nset a 0,\nset b 0,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset b 1,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset a 1,\nset b 0,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset b 1,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;","FullAdder.cmp":"| a | b | c | sum | carry |\n| 0 | 0 | 0 | 0 | 0 |\n| 0 | 0 | 1 | 1 | 0 |\n| 0 | 1 | 0 | 1 | 0 |\n| 0 | 1 | 1 | 0 | 1 |\n| 1 | 0 | 0 | 1 | 0 |\n| 1 | 0 | 1 | 0 | 1 |\n| 1 | 1 | 0 | 0 | 1 |\n| 1 | 1 | 1 | 1 | 1 |"},Add16:{"Add16.hdl":"/**\n* Adds two 16-bit values.\n* The most significant carry bit is ignored.\n*/\n\nCHIP Add16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}","Add16.tst":"output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\n\nset a %B0000000000000000,\nset b %B0000000000000000,\neval,\noutput;\n\nset a %B0000000000000000,\nset b %B1111111111111111,\neval,\noutput;\n\nset a %B1111111111111111,\nset b %B1111111111111111,\neval,\noutput;\n\nset a %B1010101010101010,\nset b %B0101010101010101,\neval,\noutput;\n\nset a %B0011110011000011,\nset b %B0000111111110000,\neval,\noutput;\n\nset a %B0001001000110100,\nset b %B1001100001110110,\neval,\noutput;","Add16.cmp":"| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1111111111111111 |\n| 1111111111111111 | 1111111111111111 | 1111111111111110 |\n| 1010101010101010 | 0101010101010101 | 1111111111111111 |\n| 0011110011000011 | 0000111111110000 | 0100110010110011 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 |"},Inc16:{"Inc16.hdl":"/**\n* 16-bit incrementer:\n* out = in + 1 (arithmetic addition)\n*/\n\nCHIP Inc16 {\n IN in[16];\n OUT out[16];\n\n PARTS:\n}","Inc16.tst":"output-list in%B1.16.1 out%B1.16.1;\n\nset in %B0000000000000000, // in = 0\neval,\noutput;\n\nset in %B1111111111111111, // in = -1\neval,\noutput;\n\nset in %B0000000000000101, // in = 5\neval,\noutput;\n\nset in %B1111111111111011, // in = -5\neval,\noutput;","Inc16.cmp":"| in | out |\n| 0000000000000000 | 0000000000000001 |\n| 1111111111111111 | 0000000000000000 |\n| 0000000000000101 | 0000000000000110 |\n| 1111111111111011 | 1111111111111100 |\n"},AluNoStat:{"AluNoStat.hdl":"/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16]; // 16-bit output\n\n PARTS:\n}","AluNoStat.tst":"\n// ALU no stat tst provides a partial test of the ALU chip.\n// It IS NOT a replacement for ALU.tst.\n\n// ALU-nostat.tst tests only the computation part of the ALU.\n// The 'zr' and 'ng' status outputs are ignored.\n\n// This test lets you concentrate on getting the ALU computation right without the\n// additional task of handling the status outputs.\n\n// Once your ALU passes ALU-nostat.tst you need to test it with ALU.tst.\n// This way, any comparison failures during ALU.tst will be caused by errors in\n// the handling of the 'zr' and 'ng' status outputs.\n\noutput-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \n ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1;\n\nset x %B0000000000000000,\nset y %B1111111111111111,\n\nset zx 1,\nset nx 0,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset x %B101101110100000,\nset y %B001111011010010,\n\nset zx 1,\nset nx 0,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;","AluNoStat.cmp":"| x | y |zx |nx |zy |ny | f |no | out |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 |\n| 0101101110100000 | 0001111011010010 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 0 | 0101101110100000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 0 | 0001111011010010 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 1 | 1010010001011111 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 1 | 1110000100101101 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 1 | 1010010001100000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 1 | 1110000100101110 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 1 | 1 | 1 | 1 | 0101101110100001 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 1 | 1 | 1 | 0001111011010011 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 0 | 0101101110011111 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 0 | 0001111011010001 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 1 | 0 | 0111101001110010 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011110011001110 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100001100110010 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 0 | 0 | 0001101010000000 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 1 | 0 | 1 | 0101111111110010 |\n"},ALU:{"ALU.hdl":"/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16], // 16-bit output\n zr, // 1 if (out == 0), 0 otherwise\n ng; // 1 if (out < 0), 0 otherwise\n\n PARTS:\n}","ALU.tst":"output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \nny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1\nng%B1.1.1;\n\nset x %B0000000000000000, // x = 0\nset y %B1111111111111111; // y = -1\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;\n\nset x %B000000000010001, // x = 17\nset y %B000000000000011; // y = 3\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;","ALU.cmp":"| x | y |zx |nx |zy |ny | f |no | out |zr |ng |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |"},ALUAll:{"ALUAll.hdl":"/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * \n * All operations:\n * Ensure your solution handles these undocumented opcodes:\n * \n * -2, !(x&y), !(x|y), !x&y, !(!x&y), !(x&!y), x&!y\n * x+y+1, x-y-1, -(x+2), -(y+2), -(x+y+2), -(x+y+1), -(x-y+1)\n * \n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\n// Testing: the test script below has tests for the undocumented instructions\n// listed first, and then has the tests for the documented ALU instructions.\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16], // 16-bit output\n zr, // 1 if (out == 0), 0 otherwise\n ng; // 1 if (out < 0), 0 otherwise\n\n PARTS:\n // Put you code here:\n}","ALUAll.tst":"output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \nny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1\nng%B1.1.1;\n\n// Compute -2 \nset x %B0000000000000000,\nset y %B0000000000000000,\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\nset x %B0000000000000011,\nset y %B0000000000000101;\n\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 1, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 0, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 0, set no 0, eval, output;\n\nset x %B0000000000001101, // x = 13\nset y %B0000000000010011; // y = 19\n\nset zx 0, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 0, eval, output;\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 1, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\nset x %B0000000000000000, // x = 0\nset y %B1111111111111111; // y = -1\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;\n\nset x %B000000000010001, // x = 17\nset y %B000000000000011; // y = 3\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;","ALUAll.cmp":"| x | y |zx |nx |zy |ny | f |no | out |zr |ng |\n| 0000000000000000 | 0000000000000000 | 1 | 1 | 1 | 1 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 0 | 0 | 1 | 1111111111111110 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 1 | 0 | 0 | 1111111111111000 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 0 | 0 | 0 | 1111111111110100 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 0 | 0 | 1 | 1111111111111011 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 1 | 0 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 1 | 0 | 0 | 1111111111110010 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 1 | 1 | 1 | 0000000000100001 | 0 | 0 |\n| 0000000000001101 | 0000000000010011 | 0 | 0 | 0 | 1 | 1 | 0 | 1111111111111001 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 1 | 1 | 1 | 0 | 1111111111110001 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 1 | 1 | 0 | 1 | 1 | 0 | 1111111111101011 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 1 | 1 | 0 | 1111111111011110 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 0 | 0 | 0 | 1 | 1 | 1111111111011111 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 0 | 1 | 0 | 0000000000000101 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |"}};function v(t){return y.apply(this,arguments)}function y(){return(y=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.pushd("/projects/02");case 2:return t.next=4,(0,r.mc)(n,k);case 4:return t.next=6,n.popd();case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var x=e(1026),f={Bit:{"Bit.hdl":"/**\n * 1-bit register:\n * If load[t] == 1 then out[t+1] = in[t]\n * else out does not change (out[t+1] = out[t])\n */\n\nCHIP Bit {\n IN in, load;\n OUT out;\n\n PARTS:\n}","Bit.tst":"output-list time%S1.4.1 in%B2.1.2 load%B2.1.2 out%B2.1.2;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 1, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 1, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;","Bit.cmp":"| time | in |load | out |\n| 0+ | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 |\n| 2 | 0 | 1 | 0 |\n| 2+ | 1 | 0 | 0 |\n| 3 | 1 | 0 | 0 |\n| 3+ | 1 | 1 | 0 |\n| 4 | 1 | 1 | 1 |\n| 4+ | 0 | 0 | 1 |\n| 5 | 0 | 0 | 1 |\n| 5+ | 1 | 0 | 1 |\n| 6 | 1 | 0 | 1 |\n| 6+ | 0 | 1 | 1 |\n| 7 | 0 | 1 | 0 |\n| 7+ | 1 | 1 | 0 |\n| 8 | 1 | 1 | 1 |\n| 8+ | 0 | 0 | 1 |\n| 9 | 0 | 0 | 1 |\n| 9+ | 0 | 0 | 1 |\n| 10 | 0 | 0 | 1 |\n| 10+ | 0 | 0 | 1 |\n| 11 | 0 | 0 | 1 |\n| 11+ | 0 | 0 | 1 |\n| 12 | 0 | 0 | 1 |\n| 12+ | 0 | 0 | 1 |\n| 13 | 0 | 0 | 1 |\n| 13+ | 0 | 0 | 1 |\n| 14 | 0 | 0 | 1 |\n| 14+ | 0 | 0 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 | 1 | 0 | 0 |\n| 94 | 1 | 0 | 0 |\n| 94+ | 1 | 0 | 0 |\n| 95 | 1 | 0 | 0 |\n| 95+ | 1 | 0 | 0 |\n| 96 | 1 | 0 | 0 |\n| 96+ | 1 | 0 | 0 |\n| 97 | 1 | 0 | 0 |\n| 97+ | 1 | 0 | 0 |\n| 98 | 1 | 0 | 0 |\n| 98+ | 1 | 0 | 0 |\n| 99 | 1 | 0 | 0 |\n| 99+ | 1 | 0 | 0 |\n| 100 | 1 | 0 | 0 |\n| 100+ | 1 | 0 | 0 |\n| 101 | 1 | 0 | 0 |\n| 101+ | 1 | 0 | 0 |\n| 102 | 1 | 0 | 0 |\n| 102+ | 1 | 0 | 0 |\n| 103 | 1 | 0 | 0 |\n| 103+ | 1 | 0 | 0 |\n| 104 | 1 | 0 | 0 |\n| 104+ | 1 | 0 | 0 |\n| 105 | 1 | 0 | 0 |\n| 105+ | 1 | 0 | 0 |\n| 106 | 1 | 0 | 0 |\n| 106+ | 1 | 0 | 0 |\n| 107 | 1 | 0 | 0 |"},Register:{"Register.hdl":"/**\n * 16-bit register:\n * If load[t] == 1 then out[t+1] = in[t]\n * else out does not change\n */\n\nCHIP Register {\n IN in[16], load;\n OUT out[16];\n\n PARTS:\n}","Register.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 out%D1.6.1;\n"+[[0,0],[0,1],[-32123,0],[11111,0],[-32123,1],[-32123,1],[-32123,0],[12345,1],[0,0],[0,1]].map((function(t){var n=(0,x.Z)(t,2),e=n[0],s=n[1];return"set in ".concat(e,", set load ").concat(s,", tick, output; tock, output;")})).join("\n")+"\n"+["%B0000000000000001","%B0000000000000010","%B0000000000000100","%B0000000000001000","%B0000000000010000","%B0000000000100000","%B0000000001000000","%B0000000010000000","%B0000000100000000","%B0000001000000000","%B0000010000000000","%B0000100000000000","%B0001000000000000","%B0010000000000000","%B0100000000000000","%B1000000000000000","%B1111111111111110","%B1111111111111101","%B1111111111111011","%B1111111111110111","%B1111111111101111","%B1111111111011111","%B1111111110111111","%B1111111101111111","%B1111111011111111","%B1111110111111111","%B1111101111111111","%B1111011111111111","%B1110111111111111","%B1101111111111111","%B1011111111111111","%B0111111111111111"].map((function(t){return"set in ".concat(t,", set load 0, tick, output; tock, output; set load 1, tick, output; tock, output;")})).join("\n"),"Register.cmp":"| time | in |load | out |\n| 0+ | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 |\n| 2 | 0 | 1 | 0 |\n| 2+ | -32123 | 0 | 0 |\n| 3 | -32123 | 0 | 0 |\n| 3+ | 11111 | 0 | 0 |\n| 4 | 11111 | 0 | 0 |\n| 4+ | -32123 | 1 | 0 |\n| 5 | -32123 | 1 | -32123 |\n| 5+ | -32123 | 1 | -32123 |\n| 6 | -32123 | 1 | -32123 |\n| 6+ | -32123 | 0 | -32123 |\n| 7 | -32123 | 0 | -32123 |\n| 7+ | 12345 | 1 | -32123 |\n| 8 | 12345 | 1 | 12345 |\n| 8+ | 0 | 0 | 12345 |\n| 9 | 0 | 0 | 12345 |\n| 9+ | 0 | 1 | 12345 |\n| 10 | 0 | 1 | 0 |\n| 10+ | 1 | 0 | 0 |\n| 11 | 1 | 0 | 0 |\n| 11+ | 1 | 1 | 0 |\n| 12 | 1 | 1 | 1 |\n| 12+ | 2 | 0 | 1 |\n| 13 | 2 | 0 | 1 |\n| 13+ | 2 | 1 | 1 |\n| 14 | 2 | 1 | 2 |\n| 14+ | 4 | 0 | 2 |\n| 15 | 4 | 0 | 2 |\n| 15+ | 4 | 1 | 2 |\n| 16 | 4 | 1 | 4 |\n| 16+ | 8 | 0 | 4 |\n| 17 | 8 | 0 | 4 |\n| 17+ | 8 | 1 | 4 |\n| 18 | 8 | 1 | 8 |\n| 18+ | 16 | 0 | 8 |\n| 19 | 16 | 0 | 8 |\n| 19+ | 16 | 1 | 8 |\n| 20 | 16 | 1 | 16 |\n| 20+ | 32 | 0 | 16 |\n| 21 | 32 | 0 | 16 |\n| 21+ | 32 | 1 | 16 |\n| 22 | 32 | 1 | 32 |\n| 22+ | 64 | 0 | 32 |\n| 23 | 64 | 0 | 32 |\n| 23+ | 64 | 1 | 32 |\n| 24 | 64 | 1 | 64 |\n| 24+ | 128 | 0 | 64 |\n| 25 | 128 | 0 | 64 |\n| 25+ | 128 | 1 | 64 |\n| 26 | 128 | 1 | 128 |\n| 26+ | 256 | 0 | 128 |\n| 27 | 256 | 0 | 128 |\n| 27+ | 256 | 1 | 128 |\n| 28 | 256 | 1 | 256 |\n| 28+ | 512 | 0 | 256 |\n| 29 | 512 | 0 | 256 |\n| 29+ | 512 | 1 | 256 |\n| 30 | 512 | 1 | 512 |\n| 30+ | 1024 | 0 | 512 |\n| 31 | 1024 | 0 | 512 |\n| 31+ | 1024 | 1 | 512 |\n| 32 | 1024 | 1 | 1024 |\n| 32+ | 2048 | 0 | 1024 |\n| 33 | 2048 | 0 | 1024 |\n| 33+ | 2048 | 1 | 1024 |\n| 34 | 2048 | 1 | 2048 |\n| 34+ | 4096 | 0 | 2048 |\n| 35 | 4096 | 0 | 2048 |\n| 35+ | 4096 | 1 | 2048 |\n| 36 | 4096 | 1 | 4096 |\n| 36+ | 8192 | 0 | 4096 |\n| 37 | 8192 | 0 | 4096 |\n| 37+ | 8192 | 1 | 4096 |\n| 38 | 8192 | 1 | 8192 |\n| 38+ | 16384 | 0 | 8192 |\n| 39 | 16384 | 0 | 8192 |\n| 39+ | 16384 | 1 | 8192 |\n| 40 | 16384 | 1 | 16384 |\n| 40+ | -32768 | 0 | 16384 |\n| 41 | -32768 | 0 | 16384 |\n| 41+ | -32768 | 1 | 16384 |\n| 42 | -32768 | 1 | -32768 |\n| 42+ | -2 | 0 | -32768 |\n| 43 | -2 | 0 | -32768 |\n| 43+ | -2 | 1 | -32768 |\n| 44 | -2 | 1 | -2 |\n| 44+ | -3 | 0 | -2 |\n| 45 | -3 | 0 | -2 |\n| 45+ | -3 | 1 | -2 |\n| 46 | -3 | 1 | -3 |\n| 46+ | -5 | 0 | -3 |\n| 47 | -5 | 0 | -3 |\n| 47+ | -5 | 1 | -3 |\n| 48 | -5 | 1 | -5 |\n| 48+ | -9 | 0 | -5 |\n| 49 | -9 | 0 | -5 |\n| 49+ | -9 | 1 | -5 |\n| 50 | -9 | 1 | -9 |\n| 50+ | -17 | 0 | -9 |\n| 51 | -17 | 0 | -9 |\n| 51+ | -17 | 1 | -9 |\n| 52 | -17 | 1 | -17 |\n| 52+ | -33 | 0 | -17 |\n| 53 | -33 | 0 | -17 |\n| 53+ | -33 | 1 | -17 |\n| 54 | -33 | 1 | -33 |\n| 54+ | -65 | 0 | -33 |\n| 55 | -65 | 0 | -33 |\n| 55+ | -65 | 1 | -33 |\n| 56 | -65 | 1 | -65 |\n| 56+ | -129 | 0 | -65 |\n| 57 | -129 | 0 | -65 |\n| 57+ | -129 | 1 | -65 |\n| 58 | -129 | 1 | -129 |\n| 58+ | -257 | 0 | -129 |\n| 59 | -257 | 0 | -129 |\n| 59+ | -257 | 1 | -129 |\n| 60 | -257 | 1 | -257 |\n| 60+ | -513 | 0 | -257 |\n| 61 | -513 | 0 | -257 |\n| 61+ | -513 | 1 | -257 |\n| 62 | -513 | 1 | -513 |\n| 62+ | -1025 | 0 | -513 |\n| 63 | -1025 | 0 | -513 |\n| 63+ | -1025 | 1 | -513 |\n| 64 | -1025 | 1 | -1025 |\n| 64+ | -2049 | 0 | -1025 |\n| 65 | -2049 | 0 | -1025 |\n| 65+ | -2049 | 1 | -1025 |\n| 66 | -2049 | 1 | -2049 |\n| 66+ | -4097 | 0 | -2049 |\n| 67 | -4097 | 0 | -2049 |\n| 67+ | -4097 | 1 | -2049 |\n| 68 | -4097 | 1 | -4097 |\n| 68+ | -8193 | 0 | -4097 |\n| 69 | -8193 | 0 | -4097 |\n| 69+ | -8193 | 1 | -4097 |\n| 70 | -8193 | 1 | -8193 |\n| 70+ | -16385 | 0 | -8193 |\n| 71 | -16385 | 0 | -8193 |\n| 71+ | -16385 | 1 | -8193 |\n| 72 | -16385 | 1 | -16385 |\n| 72+ | 32767 | 0 | -16385 |\n| 73 | 32767 | 0 | -16385 |\n| 73+ | 32767 | 1 | -16385 |\n| 74 | 32767 | 1 | 32767 |"},PC:{"PC.hdl":"/**\n * A 16-bit counter with load and reset control bits.\n * if (reset[t] == 1) out[t+1] = 0\n * else if (load[t] == 1) out[t+1] = in[t]\n * else if (inc[t] == 1) out[t+1] = out[t] + 1 (integer addition)\n * else out[t+1] = out[t]\n */\n\nCHIP PC {\n IN in[16], load, inc, reset;\n OUT out[16];\n\n PARTS:\n}","PC.tst":"output-list time%S1.4.1 in%D1.6.1 reset%B2.1.2 load%B2.1.2 inc%B2.1.2 out%D1.6.1;\n\nset in 0, set reset 0, set load 0, set inc 0, tick, output;\ntock, output;\n\nset inc 1, tick, output; tock, output;\nset in -32123, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\ntick, output; tock, output;\nset in 12345, set load 1, set inc 0, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset reset 0, set inc 1, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset reset 0, set load 0, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset in 0, set reset 0, set load 1, tick, output; tock, output;\nset load 0, set inc 1, tick, output; tock, output;\nset in 22222, set reset 1, set inc 0, tick, output; tock, output;","PC.cmp":"| time | in |reset|load | inc | out |\n| 0+ | 0 | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 0 | 0 | 1 | 0 |\n| 2 | 0 | 0 | 0 | 1 | 1 |\n| 2+ | -32123 | 0 | 0 | 1 | 1 |\n| 3 | -32123 | 0 | 0 | 1 | 2 |\n| 3+ | -32123 | 0 | 1 | 1 | 2 |\n| 4 | -32123 | 0 | 1 | 1 | -32123 |\n| 4+ | -32123 | 0 | 0 | 1 | -32123 |\n| 5 | -32123 | 0 | 0 | 1 | -32122 |\n| 5+ | -32123 | 0 | 0 | 1 | -32122 |\n| 6 | -32123 | 0 | 0 | 1 | -32121 |\n| 6+ | 12345 | 0 | 1 | 0 | -32121 |\n| 7 | 12345 | 0 | 1 | 0 | 12345 |\n| 7+ | 12345 | 1 | 1 | 0 | 12345 |\n| 8 | 12345 | 1 | 1 | 0 | 0 |\n| 8+ | 12345 | 0 | 1 | 1 | 0 |\n| 9 | 12345 | 0 | 1 | 1 | 12345 |\n| 9+ | 12345 | 1 | 1 | 1 | 12345 |\n| 10 | 12345 | 1 | 1 | 1 | 0 |\n| 10+ | 12345 | 0 | 0 | 1 | 0 |\n| 11 | 12345 | 0 | 0 | 1 | 1 |\n| 11+ | 12345 | 1 | 0 | 1 | 1 |\n| 12 | 12345 | 1 | 0 | 1 | 0 |\n| 12+ | 0 | 0 | 1 | 1 | 0 |\n| 13 | 0 | 0 | 1 | 1 | 0 |\n| 13+ | 0 | 0 | 0 | 1 | 0 |\n| 14 | 0 | 0 | 0 | 1 | 1 |\n| 14+ | 22222 | 1 | 0 | 0 | 1 |\n| 15 | 22222 | 1 | 0 | 0 | 0 |"},RAM8:{"RAM8.hdl":"/**\n * Memory of 8 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM8 {\n IN in[16], load, address[3];\n OUT out[16];\n\n PARTS:\n}","RAM8.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D3.1.3 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 11111, set load 0, tick, output; tock, output;\nset load 1, set address 1, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 3333, set address 3, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 1, eval, output;\n\nset in 7777, tick, output; tock, output;\nset load 1, set address 7, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 3, eval, output;\nset address 7, eval, output;\n\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set in %B0101010101010101, set address 0, tick, output; tock, output;\nset address 1, tick, output, tock, output;\nset address 2, tick, output, tock, output;\nset address 3, tick, output, tock, output;\nset address 4, tick, output, tock, output;\nset address 5, tick, output, tock, output;\nset address 6, tick, output, tock, output;\nset address 7, tick, output, tock, output;\n\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 0, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 0, set in %B0101010101010101, tick, output, tock, output;\nset address 1, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 1, set in %B0101010101010101, tick, output, tock, output;\nset address 2, set in %B1010101010101010, tick, output;\ntock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 2, set in %B0101010101010101, tick, output, tock, output;\nset address 3, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 3, set in %B0101010101010101, tick, output, tock, output;\nset address 4, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 4, set in %B0101010101010101, tick, output, tock, output;\nset address 5, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 5, set in %B0101010101010101, tick, output, tock, output;\nset address 6, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 6, set in %B0101010101010101, tick, output, tock, output;\nset address 7, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 7, set in %B0101010101010101, tick, output, tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;","RAM8.cmp":"| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 11111 | 0 | 0 | 0 |\n| 3 | 11111 | 0 | 0 | 0 |\n| 3+ | 11111 | 1 | 1 | 0 |\n| 4 | 11111 | 1 | 1 | 11111 |\n| 4+ | 11111 | 0 | 0 | 0 |\n| 5 | 11111 | 0 | 0 | 0 |\n| 5+ | 3333 | 0 | 3 | 0 |\n| 6 | 3333 | 0 | 3 | 0 |\n| 6+ | 3333 | 1 | 3 | 0 |\n| 7 | 3333 | 1 | 3 | 3333 |\n| 7+ | 3333 | 0 | 3 | 3333 |\n| 8 | 3333 | 0 | 3 | 3333 |\n| 8 | 3333 | 0 | 1 | 11111 |\n| 8+ | 7777 | 0 | 1 | 11111 |\n| 9 | 7777 | 0 | 1 | 11111 |\n| 9+ | 7777 | 1 | 7 | 0 |\n| 10 | 7777 | 1 | 7 | 7777 |\n| 10+ | 7777 | 0 | 7 | 7777 |\n| 11 | 7777 | 0 | 7 | 7777 |\n| 11 | 7777 | 0 | 3 | 3333 |\n| 11 | 7777 | 0 | 7 | 7777 |\n| 11+ | 7777 | 0 | 0 | 0 |\n| 12 | 7777 | 0 | 0 | 0 |\n| 12 | 7777 | 0 | 1 | 11111 |\n| 12 | 7777 | 0 | 2 | 0 |\n| 12 | 7777 | 0 | 3 | 3333 |\n| 12 | 7777 | 0 | 4 | 0 |\n| 12 | 7777 | 0 | 5 | 0 |\n| 12 | 7777 | 0 | 6 | 0 |\n| 12 | 7777 | 0 | 7 | 7777 |\n| 12+ | 21845 | 1 | 0 | 0 |\n| 13 | 21845 | 1 | 0 | 21845 |\n| 13+ | 21845 | 1 | 1 | 11111 |\n| 14 | 21845 | 1 | 1 | 21845 |\n| 14+ | 21845 | 1 | 2 | 0 |\n| 15 | 21845 | 1 | 2 | 21845 |\n| 15+ | 21845 | 1 | 3 | 3333 |\n| 16 | 21845 | 1 | 3 | 21845 |\n| 16+ | 21845 | 1 | 4 | 0 |\n| 17 | 21845 | 1 | 4 | 21845 |\n| 17+ | 21845 | 1 | 5 | 0 |\n| 18 | 21845 | 1 | 5 | 21845 |\n| 18+ | 21845 | 1 | 6 | 0 |\n| 19 | 21845 | 1 | 6 | 21845 |\n| 19+ | 21845 | 1 | 7 | 7777 |\n| 20 | 21845 | 1 | 7 | 21845 |\n| 20+ | 21845 | 0 | 0 | 21845 |\n| 21 | 21845 | 0 | 0 | 21845 |\n| 21 | 21845 | 0 | 1 | 21845 |\n| 21 | 21845 | 0 | 2 | 21845 |\n| 21 | 21845 | 0 | 3 | 21845 |\n| 21 | 21845 | 0 | 4 | 21845 |\n| 21 | 21845 | 0 | 5 | 21845 |\n| 21 | 21845 | 0 | 6 | 21845 |\n| 21 | 21845 | 0 | 7 | 21845 |\n| 21+ | -21846 | 1 | 0 | 21845 |\n| 22 | -21846 | 1 | 0 | -21846 |\n| 22+ | -21846 | 0 | 0 | -21846 |\n| 23 | -21846 | 0 | 0 | -21846 |\n| 23 | -21846 | 0 | 1 | 21845 |\n| 23 | -21846 | 0 | 2 | 21845 |\n| 23 | -21846 | 0 | 3 | 21845 |\n| 23 | -21846 | 0 | 4 | 21845 |\n| 23 | -21846 | 0 | 5 | 21845 |\n| 23 | -21846 | 0 | 6 | 21845 |\n| 23 | -21846 | 0 | 7 | 21845 |\n| 23+ | 21845 | 1 | 0 | -21846 |\n| 24 | 21845 | 1 | 0 | 21845 |\n| 24+ | -21846 | 1 | 1 | 21845 |\n| 25 | -21846 | 1 | 1 | -21846 |\n| 25+ | -21846 | 0 | 0 | 21845 |\n| 26 | -21846 | 0 | 0 | 21845 |\n| 26 | -21846 | 0 | 1 | -21846 |\n| 26 | -21846 | 0 | 2 | 21845 |\n| 26 | -21846 | 0 | 3 | 21845 |\n| 26 | -21846 | 0 | 4 | 21845 |\n| 26 | -21846 | 0 | 5 | 21845 |\n| 26 | -21846 | 0 | 6 | 21845 |\n| 26 | -21846 | 0 | 7 | 21845 |\n| 26+ | 21845 | 1 | 1 | -21846 |\n| 27 | 21845 | 1 | 1 | 21845 |\n| 27+ | -21846 | 1 | 2 | 21845 |\n| 28 | -21846 | 1 | 2 | -21846 |\n| 28+ | -21846 | 0 | 0 | 21845 |\n| 29 | -21846 | 0 | 0 | 21845 |\n| 29 | -21846 | 0 | 1 | 21845 |\n| 29 | -21846 | 0 | 2 | -21846 |\n| 29 | -21846 | 0 | 3 | 21845 |\n| 29 | -21846 | 0 | 4 | 21845 |\n| 29 | -21846 | 0 | 5 | 21845 |\n| 29 | -21846 | 0 | 6 | 21845 |\n| 29 | -21846 | 0 | 7 | 21845 |\n| 29+ | 21845 | 1 | 2 | -21846 |\n| 30 | 21845 | 1 | 2 | 21845 |\n| 30+ | -21846 | 1 | 3 | 21845 |\n| 31 | -21846 | 1 | 3 | -21846 |\n| 31+ | -21846 | 0 | 0 | 21845 |\n| 32 | -21846 | 0 | 0 | 21845 |\n| 32 | -21846 | 0 | 1 | 21845 |\n| 32 | -21846 | 0 | 2 | 21845 |\n| 32 | -21846 | 0 | 3 | -21846 |\n| 32 | -21846 | 0 | 4 | 21845 |\n| 32 | -21846 | 0 | 5 | 21845 |\n| 32 | -21846 | 0 | 6 | 21845 |\n| 32 | -21846 | 0 | 7 | 21845 |\n| 32+ | 21845 | 1 | 3 | -21846 |\n| 33 | 21845 | 1 | 3 | 21845 |\n| 33+ | -21846 | 1 | 4 | 21845 |\n| 34 | -21846 | 1 | 4 | -21846 |\n| 34+ | -21846 | 0 | 0 | 21845 |\n| 35 | -21846 | 0 | 0 | 21845 |\n| 35 | -21846 | 0 | 1 | 21845 |\n| 35 | -21846 | 0 | 2 | 21845 |\n| 35 | -21846 | 0 | 3 | 21845 |\n| 35 | -21846 | 0 | 4 | -21846 |\n| 35 | -21846 | 0 | 5 | 21845 |\n| 35 | -21846 | 0 | 6 | 21845 |\n| 35 | -21846 | 0 | 7 | 21845 |\n| 35+ | 21845 | 1 | 4 | -21846 |\n| 36 | 21845 | 1 | 4 | 21845 |\n| 36+ | -21846 | 1 | 5 | 21845 |\n| 37 | -21846 | 1 | 5 | -21846 |\n| 37+ | -21846 | 0 | 0 | 21845 |\n| 38 | -21846 | 0 | 0 | 21845 |\n| 38 | -21846 | 0 | 1 | 21845 |\n| 38 | -21846 | 0 | 2 | 21845 |\n| 38 | -21846 | 0 | 3 | 21845 |\n| 38 | -21846 | 0 | 4 | 21845 |\n| 38 | -21846 | 0 | 5 | -21846 |\n| 38 | -21846 | 0 | 6 | 21845 |\n| 38 | -21846 | 0 | 7 | 21845 |\n| 38+ | 21845 | 1 | 5 | -21846 |\n| 39 | 21845 | 1 | 5 | 21845 |\n| 39+ | -21846 | 1 | 6 | 21845 |\n| 40 | -21846 | 1 | 6 | -21846 |\n| 40+ | -21846 | 0 | 0 | 21845 |\n| 41 | -21846 | 0 | 0 | 21845 |\n| 41 | -21846 | 0 | 1 | 21845 |\n| 41 | -21846 | 0 | 2 | 21845 |\n| 41 | -21846 | 0 | 3 | 21845 |\n| 41 | -21846 | 0 | 4 | 21845 |\n| 41 | -21846 | 0 | 5 | 21845 |\n| 41 | -21846 | 0 | 6 | -21846 |\n| 41 | -21846 | 0 | 7 | 21845 |\n| 41+ | 21845 | 1 | 6 | -21846 |\n| 42 | 21845 | 1 | 6 | 21845 |\n| 42+ | -21846 | 1 | 7 | 21845 |\n| 43 | -21846 | 1 | 7 | -21846 |\n| 43+ | -21846 | 0 | 0 | 21845 |\n| 44 | -21846 | 0 | 0 | 21845 |\n| 44 | -21846 | 0 | 1 | 21845 |\n| 44 | -21846 | 0 | 2 | 21845 |\n| 44 | -21846 | 0 | 3 | 21845 |\n| 44 | -21846 | 0 | 4 | 21845 |\n| 44 | -21846 | 0 | 5 | 21845 |\n| 44 | -21846 | 0 | 6 | 21845 |\n| 44 | -21846 | 0 | 7 | -21846 |\n| 44+ | 21845 | 1 | 7 | -21846 |\n| 45 | 21845 | 1 | 7 | 21845 |\n| 45+ | 21845 | 0 | 0 | 21845 |\n| 46 | 21845 | 0 | 0 | 21845 |\n| 46 | 21845 | 0 | 1 | 21845 |\n| 46 | 21845 | 0 | 2 | 21845 |\n| 46 | 21845 | 0 | 3 | 21845 |\n| 46 | 21845 | 0 | 4 | 21845 |\n| 46 | 21845 | 0 | 5 | 21845 |\n| 46 | 21845 | 0 | 6 | 21845 |\n| 46 | 21845 | 0 | 7 | 21845 |"},RAM64:{"RAM64.hdl":"/**\n * Memory of 64 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM64 {\n IN in[16], load, address[6];\n OUT out[16];\n \n PARTS:\n}","RAM64.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1;\n\nset in 0, set load 0,\nset address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset in 1313, set load 0, tick, output; tock, output;\nset load 1,\nset address 13, tick, output; tock, output;\nset load 0,\nset address 0, tick, output; tock, output;\nset in 4747, set address 47, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 13, eval, output;\n\nset in 6363, tick, output; tock, output;\nset load 1,\nset address 63, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 47, eval, output;\n\nset address 63, eval, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B101000, tick, output; tock, output;\nset address %B101001, tick, output, tock, output;\nset address %B101010, tick, output, tock, output;\nset address %B101011, tick, output, tock, output;\nset address %B101100, tick, output, tock, output;\nset address %B101101, tick, output, tock, output;\nset address %B101110, tick, output, tock, output;\nset address %B101111, tick, output, tock, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101000, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B101001, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101011, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B101100, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B101111, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101, tick, output; tock, output;\nset address %B001101, tick, output, tock, output;\nset address %B010101, tick, output, tock, output;\nset address %B011101, tick, output, tock, output;\nset address %B100101, tick, output, tock, output;\nset address %B101101, tick, output, tock, output;\nset address %B110101, tick, output, tock, output;\nset address %B111101, tick, output, tock, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B000101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B000101, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B001101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B011101, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B100101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B110101, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B111101, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;","RAM64.cmp":"| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 1313 | 0 | 0 | 0 |\n| 3 | 1313 | 0 | 0 | 0 |\n| 3+ | 1313 | 1 | 13 | 0 |\n| 4 | 1313 | 1 | 13 | 1313 |\n| 4+ | 1313 | 0 | 0 | 0 |\n| 5 | 1313 | 0 | 0 | 0 |\n| 5+ | 4747 | 0 | 47 | 0 |\n| 6 | 4747 | 0 | 47 | 0 |\n| 6+ | 4747 | 1 | 47 | 0 |\n| 7 | 4747 | 1 | 47 | 4747 |\n| 7+ | 4747 | 0 | 47 | 4747 |\n| 8 | 4747 | 0 | 47 | 4747 |\n| 8 | 4747 | 0 | 13 | 1313 |\n| 8+ | 6363 | 0 | 13 | 1313 |\n| 9 | 6363 | 0 | 13 | 1313 |\n| 9+ | 6363 | 1 | 63 | 0 |\n| 10 | 6363 | 1 | 63 | 6363 |\n| 10+ | 6363 | 0 | 63 | 6363 |\n| 11 | 6363 | 0 | 63 | 6363 |\n| 11 | 6363 | 0 | 47 | 4747 |\n| 11 | 6363 | 0 | 63 | 6363 |\n| 11+ | 6363 | 0 | 40 | 0 |\n| 12 | 6363 | 0 | 40 | 0 |\n| 12 | 6363 | 0 | 41 | 0 |\n| 12 | 6363 | 0 | 42 | 0 |\n| 12 | 6363 | 0 | 43 | 0 |\n| 12 | 6363 | 0 | 44 | 0 |\n| 12 | 6363 | 0 | 45 | 0 |\n| 12 | 6363 | 0 | 46 | 0 |\n| 12 | 6363 | 0 | 47 | 4747 |\n| 12+ | 21845 | 1 | 40 | 0 |\n| 13 | 21845 | 1 | 40 | 21845 |\n| 13+ | 21845 | 1 | 41 | 0 |\n| 14 | 21845 | 1 | 41 | 21845 |\n| 14+ | 21845 | 1 | 42 | 0 |\n| 15 | 21845 | 1 | 42 | 21845 |\n| 15+ | 21845 | 1 | 43 | 0 |\n| 16 | 21845 | 1 | 43 | 21845 |\n| 16+ | 21845 | 1 | 44 | 0 |\n| 17 | 21845 | 1 | 44 | 21845 |\n| 17+ | 21845 | 1 | 45 | 0 |\n| 18 | 21845 | 1 | 45 | 21845 |\n| 18+ | 21845 | 1 | 46 | 0 |\n| 19 | 21845 | 1 | 46 | 21845 |\n| 19+ | 21845 | 1 | 47 | 4747 |\n| 20 | 21845 | 1 | 47 | 21845 |\n| 20+ | 21845 | 0 | 40 | 21845 |\n| 21 | 21845 | 0 | 40 | 21845 |\n| 21 | 21845 | 0 | 41 | 21845 |\n| 21 | 21845 | 0 | 42 | 21845 |\n| 21 | 21845 | 0 | 43 | 21845 |\n| 21 | 21845 | 0 | 44 | 21845 |\n| 21 | 21845 | 0 | 45 | 21845 |\n| 21 | 21845 | 0 | 46 | 21845 |\n| 21 | 21845 | 0 | 47 | 21845 |\n| 21+ | -21846 | 1 | 40 | 21845 |\n| 22 | -21846 | 1 | 40 | -21846 |\n| 22+ | -21846 | 0 | 40 | -21846 |\n| 23 | -21846 | 0 | 40 | -21846 |\n| 23 | -21846 | 0 | 41 | 21845 |\n| 23 | -21846 | 0 | 42 | 21845 |\n| 23 | -21846 | 0 | 43 | 21845 |\n| 23 | -21846 | 0 | 44 | 21845 |\n| 23 | -21846 | 0 | 45 | 21845 |\n| 23 | -21846 | 0 | 46 | 21845 |\n| 23 | -21846 | 0 | 47 | 21845 |\n| 23+ | 21845 | 1 | 40 | -21846 |\n| 24 | 21845 | 1 | 40 | 21845 |\n| 24+ | -21846 | 1 | 41 | 21845 |\n| 25 | -21846 | 1 | 41 | -21846 |\n| 25+ | -21846 | 0 | 40 | 21845 |\n| 26 | -21846 | 0 | 40 | 21845 |\n| 26 | -21846 | 0 | 41 | -21846 |\n| 26 | -21846 | 0 | 42 | 21845 |\n| 26 | -21846 | 0 | 43 | 21845 |\n| 26 | -21846 | 0 | 44 | 21845 |\n| 26 | -21846 | 0 | 45 | 21845 |\n| 26 | -21846 | 0 | 46 | 21845 |\n| 26 | -21846 | 0 | 47 | 21845 |\n| 26+ | 21845 | 1 | 41 | -21846 |\n| 27 | 21845 | 1 | 41 | 21845 |\n| 27+ | -21846 | 1 | 42 | 21845 |\n| 28 | -21846 | 1 | 42 | -21846 |\n| 28+ | -21846 | 0 | 40 | 21845 |\n| 29 | -21846 | 0 | 40 | 21845 |\n| 29 | -21846 | 0 | 41 | 21845 |\n| 29 | -21846 | 0 | 42 | -21846 |\n| 29 | -21846 | 0 | 43 | 21845 |\n| 29 | -21846 | 0 | 44 | 21845 |\n| 29 | -21846 | 0 | 45 | 21845 |\n| 29 | -21846 | 0 | 46 | 21845 |\n| 29 | -21846 | 0 | 47 | 21845 |\n| 29+ | 21845 | 1 | 42 | -21846 |\n| 30 | 21845 | 1 | 42 | 21845 |\n| 30+ | -21846 | 1 | 43 | 21845 |\n| 31 | -21846 | 1 | 43 | -21846 |\n| 31+ | -21846 | 0 | 40 | 21845 |\n| 32 | -21846 | 0 | 40 | 21845 |\n| 32 | -21846 | 0 | 41 | 21845 |\n| 32 | -21846 | 0 | 42 | 21845 |\n| 32 | -21846 | 0 | 43 | -21846 |\n| 32 | -21846 | 0 | 44 | 21845 |\n| 32 | -21846 | 0 | 45 | 21845 |\n| 32 | -21846 | 0 | 46 | 21845 |\n| 32 | -21846 | 0 | 47 | 21845 |\n| 32+ | 21845 | 1 | 43 | -21846 |\n| 33 | 21845 | 1 | 43 | 21845 |\n| 33+ | -21846 | 1 | 44 | 21845 |\n| 34 | -21846 | 1 | 44 | -21846 |\n| 34+ | -21846 | 0 | 40 | 21845 |\n| 35 | -21846 | 0 | 40 | 21845 |\n| 35 | -21846 | 0 | 41 | 21845 |\n| 35 | -21846 | 0 | 42 | 21845 |\n| 35 | -21846 | 0 | 43 | 21845 |\n| 35 | -21846 | 0 | 44 | -21846 |\n| 35 | -21846 | 0 | 45 | 21845 |\n| 35 | -21846 | 0 | 46 | 21845 |\n| 35 | -21846 | 0 | 47 | 21845 |\n| 35+ | 21845 | 1 | 44 | -21846 |\n| 36 | 21845 | 1 | 44 | 21845 |\n| 36+ | -21846 | 1 | 45 | 21845 |\n| 37 | -21846 | 1 | 45 | -21846 |\n| 37+ | -21846 | 0 | 40 | 21845 |\n| 38 | -21846 | 0 | 40 | 21845 |\n| 38 | -21846 | 0 | 41 | 21845 |\n| 38 | -21846 | 0 | 42 | 21845 |\n| 38 | -21846 | 0 | 43 | 21845 |\n| 38 | -21846 | 0 | 44 | 21845 |\n| 38 | -21846 | 0 | 45 | -21846 |\n| 38 | -21846 | 0 | 46 | 21845 |\n| 38 | -21846 | 0 | 47 | 21845 |\n| 38+ | 21845 | 1 | 45 | -21846 |\n| 39 | 21845 | 1 | 45 | 21845 |\n| 39+ | -21846 | 1 | 46 | 21845 |\n| 40 | -21846 | 1 | 46 | -21846 |\n| 40+ | -21846 | 0 | 40 | 21845 |\n| 41 | -21846 | 0 | 40 | 21845 |\n| 41 | -21846 | 0 | 41 | 21845 |\n| 41 | -21846 | 0 | 42 | 21845 |\n| 41 | -21846 | 0 | 43 | 21845 |\n| 41 | -21846 | 0 | 44 | 21845 |\n| 41 | -21846 | 0 | 45 | 21845 |\n| 41 | -21846 | 0 | 46 | -21846 |\n| 41 | -21846 | 0 | 47 | 21845 |\n| 41+ | 21845 | 1 | 46 | -21846 |\n| 42 | 21845 | 1 | 46 | 21845 |\n| 42+ | -21846 | 1 | 47 | 21845 |\n| 43 | -21846 | 1 | 47 | -21846 |\n| 43+ | -21846 | 0 | 40 | 21845 |\n| 44 | -21846 | 0 | 40 | 21845 |\n| 44 | -21846 | 0 | 41 | 21845 |\n| 44 | -21846 | 0 | 42 | 21845 |\n| 44 | -21846 | 0 | 43 | 21845 |\n| 44 | -21846 | 0 | 44 | 21845 |\n| 44 | -21846 | 0 | 45 | 21845 |\n| 44 | -21846 | 0 | 46 | 21845 |\n| 44 | -21846 | 0 | 47 | -21846 |\n| 44+ | 21845 | 1 | 47 | -21846 |\n| 45 | 21845 | 1 | 47 | 21845 |\n| 45+ | 21845 | 0 | 40 | 21845 |\n| 46 | 21845 | 0 | 40 | 21845 |\n| 46 | 21845 | 0 | 41 | 21845 |\n| 46 | 21845 | 0 | 42 | 21845 |\n| 46 | 21845 | 0 | 43 | 21845 |\n| 46 | 21845 | 0 | 44 | 21845 |\n| 46 | 21845 | 0 | 45 | 21845 |\n| 46 | 21845 | 0 | 46 | 21845 |\n| 46 | 21845 | 0 | 47 | 21845 |\n| 46+ | 21845 | 0 | 5 | 0 |\n| 47 | 21845 | 0 | 5 | 0 |\n| 47 | 21845 | 0 | 13 | 1313 |\n| 47 | 21845 | 0 | 21 | 0 |\n| 47 | 21845 | 0 | 29 | 0 |\n| 47 | 21845 | 0 | 37 | 0 |\n| 47 | 21845 | 0 | 45 | 21845 |\n| 47 | 21845 | 0 | 53 | 0 |\n| 47 | 21845 | 0 | 61 | 0 |\n| 47+ | 21845 | 1 | 5 | 0 |\n| 48 | 21845 | 1 | 5 | 21845 |\n| 48+ | 21845 | 1 | 13 | 1313 |\n| 49 | 21845 | 1 | 13 | 21845 |\n| 49+ | 21845 | 1 | 21 | 0 |\n| 50 | 21845 | 1 | 21 | 21845 |\n| 50+ | 21845 | 1 | 29 | 0 |\n| 51 | 21845 | 1 | 29 | 21845 |\n| 51+ | 21845 | 1 | 37 | 0 |\n| 52 | 21845 | 1 | 37 | 21845 |\n| 52+ | 21845 | 1 | 45 | 21845 |\n| 53 | 21845 | 1 | 45 | 21845 |\n| 53+ | 21845 | 1 | 53 | 0 |\n| 54 | 21845 | 1 | 53 | 21845 |\n| 54+ | 21845 | 1 | 61 | 0 |\n| 55 | 21845 | 1 | 61 | 21845 |\n| 55+ | 21845 | 0 | 5 | 21845 |\n| 56 | 21845 | 0 | 5 | 21845 |\n| 56 | 21845 | 0 | 13 | 21845 |\n| 56 | 21845 | 0 | 21 | 21845 |\n| 56 | 21845 | 0 | 29 | 21845 |\n| 56 | 21845 | 0 | 37 | 21845 |\n| 56 | 21845 | 0 | 45 | 21845 |\n| 56 | 21845 | 0 | 53 | 21845 |\n| 56 | 21845 | 0 | 61 | 21845 |\n| 56+ | -21846 | 1 | 5 | 21845 |\n| 57 | -21846 | 1 | 5 | -21846 |\n| 57+ | -21846 | 0 | 5 | -21846 |\n| 58 | -21846 | 0 | 5 | -21846 |\n| 58 | -21846 | 0 | 13 | 21845 |\n| 58 | -21846 | 0 | 21 | 21845 |\n| 58 | -21846 | 0 | 29 | 21845 |\n| 58 | -21846 | 0 | 37 | 21845 |\n| 58 | -21846 | 0 | 45 | 21845 |\n| 58 | -21846 | 0 | 53 | 21845 |\n| 58 | -21846 | 0 | 61 | 21845 |\n| 58+ | 21845 | 1 | 5 | -21846 |\n| 59 | 21845 | 1 | 5 | 21845 |\n| 59+ | -21846 | 1 | 13 | 21845 |\n| 60 | -21846 | 1 | 13 | -21846 |\n| 60+ | -21846 | 0 | 5 | 21845 |\n| 61 | -21846 | 0 | 5 | 21845 |\n| 61 | -21846 | 0 | 13 | -21846 |\n| 61 | -21846 | 0 | 21 | 21845 |\n| 61 | -21846 | 0 | 29 | 21845 |\n| 61 | -21846 | 0 | 37 | 21845 |\n| 61 | -21846 | 0 | 45 | 21845 |\n| 61 | -21846 | 0 | 53 | 21845 |\n| 61 | -21846 | 0 | 61 | 21845 |\n| 61+ | 21845 | 1 | 13 | -21846 |\n| 62 | 21845 | 1 | 13 | 21845 |\n| 62+ | -21846 | 1 | 21 | 21845 |\n| 63 | -21846 | 1 | 21 | -21846 |\n| 63+ | -21846 | 0 | 5 | 21845 |\n| 64 | -21846 | 0 | 5 | 21845 |\n| 64 | -21846 | 0 | 13 | 21845 |\n| 64 | -21846 | 0 | 21 | -21846 |\n| 64 | -21846 | 0 | 29 | 21845 |\n| 64 | -21846 | 0 | 37 | 21845 |\n| 64 | -21846 | 0 | 45 | 21845 |\n| 64 | -21846 | 0 | 53 | 21845 |\n| 64 | -21846 | 0 | 61 | 21845 |\n| 64+ | 21845 | 1 | 21 | -21846 |\n| 65 | 21845 | 1 | 21 | 21845 |\n| 65+ | -21846 | 1 | 29 | 21845 |\n| 66 | -21846 | 1 | 29 | -21846 |\n| 66+ | -21846 | 0 | 5 | 21845 |\n| 67 | -21846 | 0 | 5 | 21845 |\n| 67 | -21846 | 0 | 13 | 21845 |\n| 67 | -21846 | 0 | 21 | 21845 |\n| 67 | -21846 | 0 | 29 | -21846 |\n| 67 | -21846 | 0 | 37 | 21845 |\n| 67 | -21846 | 0 | 45 | 21845 |\n| 67 | -21846 | 0 | 53 | 21845 |\n| 67 | -21846 | 0 | 61 | 21845 |\n| 67+ | 21845 | 1 | 29 | -21846 |\n| 68 | 21845 | 1 | 29 | 21845 |\n| 68+ | -21846 | 1 | 37 | 21845 |\n| 69 | -21846 | 1 | 37 | -21846 |\n| 69+ | -21846 | 0 | 5 | 21845 |\n| 70 | -21846 | 0 | 5 | 21845 |\n| 70 | -21846 | 0 | 13 | 21845 |\n| 70 | -21846 | 0 | 21 | 21845 |\n| 70 | -21846 | 0 | 29 | 21845 |\n| 70 | -21846 | 0 | 37 | -21846 |\n| 70 | -21846 | 0 | 45 | 21845 |\n| 70 | -21846 | 0 | 53 | 21845 |\n| 70 | -21846 | 0 | 61 | 21845 |\n| 70+ | 21845 | 1 | 37 | -21846 |\n| 71 | 21845 | 1 | 37 | 21845 |\n| 71+ | -21846 | 1 | 45 | 21845 |\n| 72 | -21846 | 1 | 45 | -21846 |\n| 72+ | -21846 | 0 | 5 | 21845 |\n| 73 | -21846 | 0 | 5 | 21845 |\n| 73 | -21846 | 0 | 13 | 21845 |\n| 73 | -21846 | 0 | 21 | 21845 |\n| 73 | -21846 | 0 | 29 | 21845 |\n| 73 | -21846 | 0 | 37 | 21845 |\n| 73 | -21846 | 0 | 45 | -21846 |\n| 73 | -21846 | 0 | 53 | 21845 |\n| 73 | -21846 | 0 | 61 | 21845 |\n| 73+ | 21845 | 1 | 45 | -21846 |\n| 74 | 21845 | 1 | 45 | 21845 |\n| 74+ | -21846 | 1 | 53 | 21845 |\n| 75 | -21846 | 1 | 53 | -21846 |\n| 75+ | -21846 | 0 | 5 | 21845 |\n| 76 | -21846 | 0 | 5 | 21845 |\n| 76 | -21846 | 0 | 13 | 21845 |\n| 76 | -21846 | 0 | 21 | 21845 |\n| 76 | -21846 | 0 | 29 | 21845 |\n| 76 | -21846 | 0 | 37 | 21845 |\n| 76 | -21846 | 0 | 45 | 21845 |\n| 76 | -21846 | 0 | 53 | -21846 |\n| 76 | -21846 | 0 | 61 | 21845 |\n| 76+ | 21845 | 1 | 53 | -21846 |\n| 77 | 21845 | 1 | 53 | 21845 |\n| 77+ | -21846 | 1 | 61 | 21845 |\n| 78 | -21846 | 1 | 61 | -21846 |\n| 78+ | -21846 | 0 | 5 | 21845 |\n| 79 | -21846 | 0 | 5 | 21845 |\n| 79 | -21846 | 0 | 13 | 21845 |\n| 79 | -21846 | 0 | 21 | 21845 |\n| 79 | -21846 | 0 | 29 | 21845 |\n| 79 | -21846 | 0 | 37 | 21845 |\n| 79 | -21846 | 0 | 45 | 21845 |\n| 79 | -21846 | 0 | 53 | 21845 |\n| 79 | -21846 | 0 | 61 | -21846 |\n| 79+ | 21845 | 1 | 61 | -21846 |\n| 80 | 21845 | 1 | 61 | 21845 |\n| 80+ | 21845 | 0 | 5 | 21845 |\n| 81 | 21845 | 0 | 5 | 21845 |\n| 81 | 21845 | 0 | 13 | 21845 |\n| 81 | 21845 | 0 | 21 | 21845 |\n| 81 | 21845 | 0 | 29 | 21845 |\n| 81 | 21845 | 0 | 37 | 21845 |\n| 81 | 21845 | 0 | 45 | 21845 |\n| 81 | 21845 | 0 | 53 | 21845 |\n| 81 | 21845 | 0 | 61 | 21845 |"},RAM512:{"RAM512.hdl":"/**\n * Memory of 512 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM512 {\n IN in[16], load, address[9];\n OUT out[16];\n \n PARTS:\n}","RAM512.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 13099, set load 0, tick, output; tock, output;\nset load 1, set address 130, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 4729, set address 472, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 130, eval, output;\n\nset in 5119, tick, output; tock, output;\nset load 1, set address 511, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 472, eval, output;\nset address 511, eval, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B010101000, tick, output; tock, output;\nset address %B010101001, tick, output, tock, output;\nset address %B010101010, tick, output, tock, output;\nset address %B010101011, tick, output, tock, output;\nset address %B010101100, tick, output, tock, output;\nset address %B010101101, tick, output, tock, output;\nset address %B010101110, tick, output, tock, output;\nset address %B010101111, tick, output, tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101000, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101001, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101011, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101100, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101110, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101111, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101010, tick, output; tock, output;\nset address %B001101010, tick, output, tock, output;\nset address %B010101010, tick, output, tock, output;\nset address %B011101010, tick, output, tock, output;\nset address %B100101010, tick, output, tock, output;\nset address %B101101010, tick, output, tock, output;\nset address %B110101010, tick, output, tock, output;\nset address %B111101010, tick, output, tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B000101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B000101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B001101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B011101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B100101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B101101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B110101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B111101010, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;","RAM512.cmp":"| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 13099 | 0 | 0 | 0 |\n| 3 | 13099 | 0 | 0 | 0 |\n| 3+ | 13099 | 1 | 130 | 0 |\n| 4 | 13099 | 1 | 130 | 13099 |\n| 4+ | 13099 | 0 | 0 | 0 |\n| 5 | 13099 | 0 | 0 | 0 |\n| 5+ | 4729 | 0 | 472 | 0 |\n| 6 | 4729 | 0 | 472 | 0 |\n| 6+ | 4729 | 1 | 472 | 0 |\n| 7 | 4729 | 1 | 472 | 4729 |\n| 7+ | 4729 | 0 | 472 | 4729 |\n| 8 | 4729 | 0 | 472 | 4729 |\n| 8 | 4729 | 0 | 130 | 13099 |\n| 8+ | 5119 | 0 | 130 | 13099 |\n| 9 | 5119 | 0 | 130 | 13099 |\n| 9+ | 5119 | 1 | 511 | 0 |\n| 10 | 5119 | 1 | 511 | 5119 |\n| 10+ | 5119 | 0 | 511 | 5119 |\n| 11 | 5119 | 0 | 511 | 5119 |\n| 11 | 5119 | 0 | 472 | 4729 |\n| 11 | 5119 | 0 | 511 | 5119 |\n| 11+ | 5119 | 0 | 168 | 0 |\n| 12 | 5119 | 0 | 168 | 0 |\n| 12 | 5119 | 0 | 169 | 0 |\n| 12 | 5119 | 0 | 170 | 0 |\n| 12 | 5119 | 0 | 171 | 0 |\n| 12 | 5119 | 0 | 172 | 0 |\n| 12 | 5119 | 0 | 173 | 0 |\n| 12 | 5119 | 0 | 174 | 0 |\n| 12 | 5119 | 0 | 175 | 0 |\n| 12+ | 21845 | 1 | 168 | 0 |\n| 13 | 21845 | 1 | 168 | 21845 |\n| 13+ | 21845 | 1 | 169 | 0 |\n| 14 | 21845 | 1 | 169 | 21845 |\n| 14+ | 21845 | 1 | 170 | 0 |\n| 15 | 21845 | 1 | 170 | 21845 |\n| 15+ | 21845 | 1 | 171 | 0 |\n| 16 | 21845 | 1 | 171 | 21845 |\n| 16+ | 21845 | 1 | 172 | 0 |\n| 17 | 21845 | 1 | 172 | 21845 |\n| 17+ | 21845 | 1 | 173 | 0 |\n| 18 | 21845 | 1 | 173 | 21845 |\n| 18+ | 21845 | 1 | 174 | 0 |\n| 19 | 21845 | 1 | 174 | 21845 |\n| 19+ | 21845 | 1 | 175 | 0 |\n| 20 | 21845 | 1 | 175 | 21845 |\n| 20+ | 21845 | 0 | 168 | 21845 |\n| 21 | 21845 | 0 | 168 | 21845 |\n| 21 | 21845 | 0 | 169 | 21845 |\n| 21 | 21845 | 0 | 170 | 21845 |\n| 21 | 21845 | 0 | 171 | 21845 |\n| 21 | 21845 | 0 | 172 | 21845 |\n| 21 | 21845 | 0 | 173 | 21845 |\n| 21 | 21845 | 0 | 174 | 21845 |\n| 21 | 21845 | 0 | 175 | 21845 |\n| 21+ | -21846 | 1 | 168 | 21845 |\n| 22 | -21846 | 1 | 168 | -21846 |\n| 22+ | -21846 | 0 | 168 | -21846 |\n| 23 | -21846 | 0 | 168 | -21846 |\n| 23 | -21846 | 0 | 169 | 21845 |\n| 23 | -21846 | 0 | 170 | 21845 |\n| 23 | -21846 | 0 | 171 | 21845 |\n| 23 | -21846 | 0 | 172 | 21845 |\n| 23 | -21846 | 0 | 173 | 21845 |\n| 23 | -21846 | 0 | 174 | 21845 |\n| 23 | -21846 | 0 | 175 | 21845 |\n| 23+ | 21845 | 1 | 168 | -21846 |\n| 24 | 21845 | 1 | 168 | 21845 |\n| 24+ | -21846 | 1 | 169 | 21845 |\n| 25 | -21846 | 1 | 169 | -21846 |\n| 25+ | -21846 | 0 | 168 | 21845 |\n| 26 | -21846 | 0 | 168 | 21845 |\n| 26 | -21846 | 0 | 169 | -21846 |\n| 26 | -21846 | 0 | 170 | 21845 |\n| 26 | -21846 | 0 | 171 | 21845 |\n| 26 | -21846 | 0 | 172 | 21845 |\n| 26 | -21846 | 0 | 173 | 21845 |\n| 26 | -21846 | 0 | 174 | 21845 |\n| 26 | -21846 | 0 | 175 | 21845 |\n| 26+ | 21845 | 1 | 169 | -21846 |\n| 27 | 21845 | 1 | 169 | 21845 |\n| 27+ | -21846 | 1 | 170 | 21845 |\n| 28 | -21846 | 1 | 170 | -21846 |\n| 28+ | -21846 | 0 | 168 | 21845 |\n| 29 | -21846 | 0 | 168 | 21845 |\n| 29 | -21846 | 0 | 169 | 21845 |\n| 29 | -21846 | 0 | 170 | -21846 |\n| 29 | -21846 | 0 | 171 | 21845 |\n| 29 | -21846 | 0 | 172 | 21845 |\n| 29 | -21846 | 0 | 173 | 21845 |\n| 29 | -21846 | 0 | 174 | 21845 |\n| 29 | -21846 | 0 | 175 | 21845 |\n| 29+ | 21845 | 1 | 170 | -21846 |\n| 30 | 21845 | 1 | 170 | 21845 |\n| 30+ | -21846 | 1 | 171 | 21845 |\n| 31 | -21846 | 1 | 171 | -21846 |\n| 31+ | -21846 | 0 | 168 | 21845 |\n| 32 | -21846 | 0 | 168 | 21845 |\n| 32 | -21846 | 0 | 169 | 21845 |\n| 32 | -21846 | 0 | 170 | 21845 |\n| 32 | -21846 | 0 | 171 | -21846 |\n| 32 | -21846 | 0 | 172 | 21845 |\n| 32 | -21846 | 0 | 173 | 21845 |\n| 32 | -21846 | 0 | 174 | 21845 |\n| 32 | -21846 | 0 | 175 | 21845 |\n| 32+ | 21845 | 1 | 171 | -21846 |\n| 33 | 21845 | 1 | 171 | 21845 |\n| 33+ | -21846 | 1 | 172 | 21845 |\n| 34 | -21846 | 1 | 172 | -21846 |\n| 34+ | -21846 | 0 | 168 | 21845 |\n| 35 | -21846 | 0 | 168 | 21845 |\n| 35 | -21846 | 0 | 169 | 21845 |\n| 35 | -21846 | 0 | 170 | 21845 |\n| 35 | -21846 | 0 | 171 | 21845 |\n| 35 | -21846 | 0 | 172 | -21846 |\n| 35 | -21846 | 0 | 173 | 21845 |\n| 35 | -21846 | 0 | 174 | 21845 |\n| 35 | -21846 | 0 | 175 | 21845 |\n| 35+ | 21845 | 1 | 172 | -21846 |\n| 36 | 21845 | 1 | 172 | 21845 |\n| 36+ | -21846 | 1 | 173 | 21845 |\n| 37 | -21846 | 1 | 173 | -21846 |\n| 37+ | -21846 | 0 | 168 | 21845 |\n| 38 | -21846 | 0 | 168 | 21845 |\n| 38 | -21846 | 0 | 169 | 21845 |\n| 38 | -21846 | 0 | 170 | 21845 |\n| 38 | -21846 | 0 | 171 | 21845 |\n| 38 | -21846 | 0 | 172 | 21845 |\n| 38 | -21846 | 0 | 173 | -21846 |\n| 38 | -21846 | 0 | 174 | 21845 |\n| 38 | -21846 | 0 | 175 | 21845 |\n| 38+ | 21845 | 1 | 173 | -21846 |\n| 39 | 21845 | 1 | 173 | 21845 |\n| 39+ | -21846 | 1 | 174 | 21845 |\n| 40 | -21846 | 1 | 174 | -21846 |\n| 40+ | -21846 | 0 | 168 | 21845 |\n| 41 | -21846 | 0 | 168 | 21845 |\n| 41 | -21846 | 0 | 169 | 21845 |\n| 41 | -21846 | 0 | 170 | 21845 |\n| 41 | -21846 | 0 | 171 | 21845 |\n| 41 | -21846 | 0 | 172 | 21845 |\n| 41 | -21846 | 0 | 173 | 21845 |\n| 41 | -21846 | 0 | 174 | -21846 |\n| 41 | -21846 | 0 | 175 | 21845 |\n| 41+ | 21845 | 1 | 174 | -21846 |\n| 42 | 21845 | 1 | 174 | 21845 |\n| 42+ | -21846 | 1 | 175 | 21845 |\n| 43 | -21846 | 1 | 175 | -21846 |\n| 43+ | -21846 | 0 | 168 | 21845 |\n| 44 | -21846 | 0 | 168 | 21845 |\n| 44 | -21846 | 0 | 169 | 21845 |\n| 44 | -21846 | 0 | 170 | 21845 |\n| 44 | -21846 | 0 | 171 | 21845 |\n| 44 | -21846 | 0 | 172 | 21845 |\n| 44 | -21846 | 0 | 173 | 21845 |\n| 44 | -21846 | 0 | 174 | 21845 |\n| 44 | -21846 | 0 | 175 | -21846 |\n| 44+ | 21845 | 1 | 175 | -21846 |\n| 45 | 21845 | 1 | 175 | 21845 |\n| 45+ | 21845 | 0 | 168 | 21845 |\n| 46 | 21845 | 0 | 168 | 21845 |\n| 46 | 21845 | 0 | 169 | 21845 |\n| 46 | 21845 | 0 | 170 | 21845 |\n| 46 | 21845 | 0 | 171 | 21845 |\n| 46 | 21845 | 0 | 172 | 21845 |\n| 46 | 21845 | 0 | 173 | 21845 |\n| 46 | 21845 | 0 | 174 | 21845 |\n| 46 | 21845 | 0 | 175 | 21845 |\n| 46+ | 21845 | 0 | 42 | 0 |\n| 47 | 21845 | 0 | 42 | 0 |\n| 47 | 21845 | 0 | 106 | 0 |\n| 47 | 21845 | 0 | 170 | 21845 |\n| 47 | 21845 | 0 | 234 | 0 |\n| 47 | 21845 | 0 | 298 | 0 |\n| 47 | 21845 | 0 | 362 | 0 |\n| 47 | 21845 | 0 | 426 | 0 |\n| 47 | 21845 | 0 | 490 | 0 |\n| 47+ | 21845 | 1 | 42 | 0 |\n| 48 | 21845 | 1 | 42 | 21845 |\n| 48+ | 21845 | 1 | 106 | 0 |\n| 49 | 21845 | 1 | 106 | 21845 |\n| 49+ | 21845 | 1 | 170 | 21845 |\n| 50 | 21845 | 1 | 170 | 21845 |\n| 50+ | 21845 | 1 | 234 | 0 |\n| 51 | 21845 | 1 | 234 | 21845 |\n| 51+ | 21845 | 1 | 298 | 0 |\n| 52 | 21845 | 1 | 298 | 21845 |\n| 52+ | 21845 | 1 | 362 | 0 |\n| 53 | 21845 | 1 | 362 | 21845 |\n| 53+ | 21845 | 1 | 426 | 0 |\n| 54 | 21845 | 1 | 426 | 21845 |\n| 54+ | 21845 | 1 | 490 | 0 |\n| 55 | 21845 | 1 | 490 | 21845 |\n| 55+ | 21845 | 0 | 42 | 21845 |\n| 56 | 21845 | 0 | 42 | 21845 |\n| 56 | 21845 | 0 | 106 | 21845 |\n| 56 | 21845 | 0 | 170 | 21845 |\n| 56 | 21845 | 0 | 234 | 21845 |\n| 56 | 21845 | 0 | 298 | 21845 |\n| 56 | 21845 | 0 | 362 | 21845 |\n| 56 | 21845 | 0 | 426 | 21845 |\n| 56 | 21845 | 0 | 490 | 21845 |\n| 56+ | -21846 | 1 | 42 | 21845 |\n| 57 | -21846 | 1 | 42 | -21846 |\n| 57+ | -21846 | 0 | 42 | -21846 |\n| 58 | -21846 | 0 | 42 | -21846 |\n| 58 | -21846 | 0 | 106 | 21845 |\n| 58 | -21846 | 0 | 170 | 21845 |\n| 58 | -21846 | 0 | 234 | 21845 |\n| 58 | -21846 | 0 | 298 | 21845 |\n| 58 | -21846 | 0 | 362 | 21845 |\n| 58 | -21846 | 0 | 426 | 21845 |\n| 58 | -21846 | 0 | 490 | 21845 |\n| 58+ | 21845 | 1 | 42 | -21846 |\n| 59 | 21845 | 1 | 42 | 21845 |\n| 59+ | -21846 | 1 | 106 | 21845 |\n| 60 | -21846 | 1 | 106 | -21846 |\n| 60+ | -21846 | 0 | 42 | 21845 |\n| 61 | -21846 | 0 | 42 | 21845 |\n| 61 | -21846 | 0 | 106 | -21846 |\n| 61 | -21846 | 0 | 170 | 21845 |\n| 61 | -21846 | 0 | 234 | 21845 |\n| 61 | -21846 | 0 | 298 | 21845 |\n| 61 | -21846 | 0 | 362 | 21845 |\n| 61 | -21846 | 0 | 426 | 21845 |\n| 61 | -21846 | 0 | 490 | 21845 |\n| 61+ | 21845 | 1 | 106 | -21846 |\n| 62 | 21845 | 1 | 106 | 21845 |\n| 62+ | -21846 | 1 | 170 | 21845 |\n| 63 | -21846 | 1 | 170 | -21846 |\n| 63+ | -21846 | 0 | 42 | 21845 |\n| 64 | -21846 | 0 | 42 | 21845 |\n| 64 | -21846 | 0 | 106 | 21845 |\n| 64 | -21846 | 0 | 170 | -21846 |\n| 64 | -21846 | 0 | 234 | 21845 |\n| 64 | -21846 | 0 | 298 | 21845 |\n| 64 | -21846 | 0 | 362 | 21845 |\n| 64 | -21846 | 0 | 426 | 21845 |\n| 64 | -21846 | 0 | 490 | 21845 |\n| 64+ | 21845 | 1 | 170 | -21846 |\n| 65 | 21845 | 1 | 170 | 21845 |\n| 65+ | -21846 | 1 | 234 | 21845 |\n| 66 | -21846 | 1 | 234 | -21846 |\n| 66+ | -21846 | 0 | 42 | 21845 |\n| 67 | -21846 | 0 | 42 | 21845 |\n| 67 | -21846 | 0 | 106 | 21845 |\n| 67 | -21846 | 0 | 170 | 21845 |\n| 67 | -21846 | 0 | 234 | -21846 |\n| 67 | -21846 | 0 | 298 | 21845 |\n| 67 | -21846 | 0 | 362 | 21845 |\n| 67 | -21846 | 0 | 426 | 21845 |\n| 67 | -21846 | 0 | 490 | 21845 |\n| 67+ | 21845 | 1 | 234 | -21846 |\n| 68 | 21845 | 1 | 234 | 21845 |\n| 68+ | -21846 | 1 | 298 | 21845 |\n| 69 | -21846 | 1 | 298 | -21846 |\n| 69+ | -21846 | 0 | 42 | 21845 |\n| 70 | -21846 | 0 | 42 | 21845 |\n| 70 | -21846 | 0 | 106 | 21845 |\n| 70 | -21846 | 0 | 170 | 21845 |\n| 70 | -21846 | 0 | 234 | 21845 |\n| 70 | -21846 | 0 | 298 | -21846 |\n| 70 | -21846 | 0 | 362 | 21845 |\n| 70 | -21846 | 0 | 426 | 21845 |\n| 70 | -21846 | 0 | 490 | 21845 |\n| 70+ | 21845 | 1 | 298 | -21846 |\n| 71 | 21845 | 1 | 298 | 21845 |\n| 71+ | -21846 | 1 | 362 | 21845 |\n| 72 | -21846 | 1 | 362 | -21846 |\n| 72+ | -21846 | 0 | 42 | 21845 |\n| 73 | -21846 | 0 | 42 | 21845 |\n| 73 | -21846 | 0 | 106 | 21845 |\n| 73 | -21846 | 0 | 170 | 21845 |\n| 73 | -21846 | 0 | 234 | 21845 |\n| 73 | -21846 | 0 | 298 | 21845 |\n| 73 | -21846 | 0 | 362 | -21846 |\n| 73 | -21846 | 0 | 426 | 21845 |\n| 73 | -21846 | 0 | 490 | 21845 |\n| 73+ | 21845 | 1 | 362 | -21846 |\n| 74 | 21845 | 1 | 362 | 21845 |\n| 74+ | -21846 | 1 | 426 | 21845 |\n| 75 | -21846 | 1 | 426 | -21846 |\n| 75+ | -21846 | 0 | 42 | 21845 |\n| 76 | -21846 | 0 | 42 | 21845 |\n| 76 | -21846 | 0 | 106 | 21845 |\n| 76 | -21846 | 0 | 170 | 21845 |\n| 76 | -21846 | 0 | 234 | 21845 |\n| 76 | -21846 | 0 | 298 | 21845 |\n| 76 | -21846 | 0 | 362 | 21845 |\n| 76 | -21846 | 0 | 426 | -21846 |\n| 76 | -21846 | 0 | 490 | 21845 |\n| 76+ | 21845 | 1 | 426 | -21846 |\n| 77 | 21845 | 1 | 426 | 21845 |\n| 77+ | -21846 | 1 | 490 | 21845 |\n| 78 | -21846 | 1 | 490 | -21846 |\n| 78+ | -21846 | 0 | 42 | 21845 |\n| 79 | -21846 | 0 | 42 | 21845 |\n| 79 | -21846 | 0 | 106 | 21845 |\n| 79 | -21846 | 0 | 170 | 21845 |\n| 79 | -21846 | 0 | 234 | 21845 |\n| 79 | -21846 | 0 | 298 | 21845 |\n| 79 | -21846 | 0 | 362 | 21845 |\n| 79 | -21846 | 0 | 426 | 21845 |\n| 79 | -21846 | 0 | 490 | -21846 |\n| 79+ | 21845 | 1 | 490 | -21846 |\n| 80 | 21845 | 1 | 490 | 21845 |\n| 80+ | 21845 | 0 | 42 | 21845 |\n| 81 | 21845 | 0 | 42 | 21845 |\n| 81 | 21845 | 0 | 106 | 21845 |\n| 81 | 21845 | 0 | 170 | 21845 |\n| 81 | 21845 | 0 | 234 | 21845 |\n| 81 | 21845 | 0 | 298 | 21845 |\n| 81 | 21845 | 0 | 362 | 21845 |\n| 81 | 21845 | 0 | 426 | 21845 |\n| 81 | 21845 | 0 | 490 | 21845 |"},RAM4k:{"RAM4k.hdl":"/**\n * Memory of 4K registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM4K {\n IN in[16], load, address[12];\n OUT out[16];\n\n PARTS:\n}","RAM4k.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.4.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset in 1111, set load 0, tick, output; tock, output;\nset load 1, set address 1111, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset in 3513, set address 3513, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 1111, eval, output;\n\nset in 4095, tick, output; tock, output;\nset load 1, set address 4095, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 3513, eval, output;\n\nset address 4095, eval, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B101010101000, tick, output; tock, output;\nset address %B101010101001, tick, output, tock, output;\nset address %B101010101010, tick, output, tock, output;\nset address %B101010101011, tick, output, tock, output;\nset address %B101010101100, tick, output, tock, output;\nset address %B101010101101, tick, output, tock, output;\nset address %B101010101110, tick, output, tock, output;\nset address %B101010101111, tick, output, tock, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101000, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101001, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101010, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101011, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101100, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101111, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101010101, tick, output; tock, output;\nset address %B001101010101, tick, output, tock, output;\nset address %B010101010101, tick, output, tock, output;\nset address %B011101010101, tick, output, tock, output;\nset address %B100101010101, tick, output, tock, output;\nset address %B101101010101, tick, output, tock, output;\nset address %B110101010101, tick, output, tock, output;\nset address %B111101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B000101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B000101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B001101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B011101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B100101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B101101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B111101010101, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;","RAM4k.cmp":"| time | in |load |address | out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 1111 | 0 | 0 | 0 |\n| 3 | 1111 | 0 | 0 | 0 |\n| 3+ | 1111 | 1 | 1111 | 0 |\n| 4 | 1111 | 1 | 1111 | 1111 |\n| 4+ | 1111 | 0 | 0 | 0 |\n| 5 | 1111 | 0 | 0 | 0 |\n| 5+ | 3513 | 0 | 3513 | 0 |\n| 6 | 3513 | 0 | 3513 | 0 |\n| 6+ | 3513 | 1 | 3513 | 0 |\n| 7 | 3513 | 1 | 3513 | 3513 |\n| 7+ | 3513 | 0 | 3513 | 3513 |\n| 8 | 3513 | 0 | 3513 | 3513 |\n| 8 | 3513 | 0 | 1111 | 1111 |\n| 8+ | 4095 | 0 | 1111 | 1111 |\n| 9 | 4095 | 0 | 1111 | 1111 |\n| 9+ | 4095 | 1 | 4095 | 0 |\n| 10 | 4095 | 1 | 4095 | 4095 |\n| 10+ | 4095 | 0 | 4095 | 4095 |\n| 11 | 4095 | 0 | 4095 | 4095 |\n| 11 | 4095 | 0 | 3513 | 3513 |\n| 11 | 4095 | 0 | 4095 | 4095 |\n| 11+ | 4095 | 0 | 2728 | 0 |\n| 12 | 4095 | 0 | 2728 | 0 |\n| 12 | 4095 | 0 | 2729 | 0 |\n| 12 | 4095 | 0 | 2730 | 0 |\n| 12 | 4095 | 0 | 2731 | 0 |\n| 12 | 4095 | 0 | 2732 | 0 |\n| 12 | 4095 | 0 | 2733 | 0 |\n| 12 | 4095 | 0 | 2734 | 0 |\n| 12 | 4095 | 0 | 2735 | 0 |\n| 12+ | 21845 | 1 | 2728 | 0 |\n| 13 | 21845 | 1 | 2728 | 21845 |\n| 13+ | 21845 | 1 | 2729 | 0 |\n| 14 | 21845 | 1 | 2729 | 21845 |\n| 14+ | 21845 | 1 | 2730 | 0 |\n| 15 | 21845 | 1 | 2730 | 21845 |\n| 15+ | 21845 | 1 | 2731 | 0 |\n| 16 | 21845 | 1 | 2731 | 21845 |\n| 16+ | 21845 | 1 | 2732 | 0 |\n| 17 | 21845 | 1 | 2732 | 21845 |\n| 17+ | 21845 | 1 | 2733 | 0 |\n| 18 | 21845 | 1 | 2733 | 21845 |\n| 18+ | 21845 | 1 | 2734 | 0 |\n| 19 | 21845 | 1 | 2734 | 21845 |\n| 19+ | 21845 | 1 | 2735 | 0 |\n| 20 | 21845 | 1 | 2735 | 21845 |\n| 20+ | 21845 | 0 | 2728 | 21845 |\n| 21 | 21845 | 0 | 2728 | 21845 |\n| 21 | 21845 | 0 | 2729 | 21845 |\n| 21 | 21845 | 0 | 2730 | 21845 |\n| 21 | 21845 | 0 | 2731 | 21845 |\n| 21 | 21845 | 0 | 2732 | 21845 |\n| 21 | 21845 | 0 | 2733 | 21845 |\n| 21 | 21845 | 0 | 2734 | 21845 |\n| 21 | 21845 | 0 | 2735 | 21845 |\n| 21+ | -21846 | 1 | 2728 | 21845 |\n| 22 | -21846 | 1 | 2728 | -21846 |\n| 22+ | -21846 | 0 | 2728 | -21846 |\n| 23 | -21846 | 0 | 2728 | -21846 |\n| 23 | -21846 | 0 | 2729 | 21845 |\n| 23 | -21846 | 0 | 2730 | 21845 |\n| 23 | -21846 | 0 | 2731 | 21845 |\n| 23 | -21846 | 0 | 2732 | 21845 |\n| 23 | -21846 | 0 | 2733 | 21845 |\n| 23 | -21846 | 0 | 2734 | 21845 |\n| 23 | -21846 | 0 | 2735 | 21845 |\n| 23+ | 21845 | 1 | 2728 | -21846 |\n| 24 | 21845 | 1 | 2728 | 21845 |\n| 24+ | -21846 | 1 | 2729 | 21845 |\n| 25 | -21846 | 1 | 2729 | -21846 |\n| 25+ | -21846 | 0 | 2728 | 21845 |\n| 26 | -21846 | 0 | 2728 | 21845 |\n| 26 | -21846 | 0 | 2729 | -21846 |\n| 26 | -21846 | 0 | 2730 | 21845 |\n| 26 | -21846 | 0 | 2731 | 21845 |\n| 26 | -21846 | 0 | 2732 | 21845 |\n| 26 | -21846 | 0 | 2733 | 21845 |\n| 26 | -21846 | 0 | 2734 | 21845 |\n| 26 | -21846 | 0 | 2735 | 21845 |\n| 26+ | 21845 | 1 | 2729 | -21846 |\n| 27 | 21845 | 1 | 2729 | 21845 |\n| 27+ | -21846 | 1 | 2730 | 21845 |\n| 28 | -21846 | 1 | 2730 | -21846 |\n| 28+ | -21846 | 0 | 2728 | 21845 |\n| 29 | -21846 | 0 | 2728 | 21845 |\n| 29 | -21846 | 0 | 2729 | 21845 |\n| 29 | -21846 | 0 | 2730 | -21846 |\n| 29 | -21846 | 0 | 2731 | 21845 |\n| 29 | -21846 | 0 | 2732 | 21845 |\n| 29 | -21846 | 0 | 2733 | 21845 |\n| 29 | -21846 | 0 | 2734 | 21845 |\n| 29 | -21846 | 0 | 2735 | 21845 |\n| 29+ | 21845 | 1 | 2730 | -21846 |\n| 30 | 21845 | 1 | 2730 | 21845 |\n| 30+ | -21846 | 1 | 2731 | 21845 |\n| 31 | -21846 | 1 | 2731 | -21846 |\n| 31+ | -21846 | 0 | 2728 | 21845 |\n| 32 | -21846 | 0 | 2728 | 21845 |\n| 32 | -21846 | 0 | 2729 | 21845 |\n| 32 | -21846 | 0 | 2730 | 21845 |\n| 32 | -21846 | 0 | 2731 | -21846 |\n| 32 | -21846 | 0 | 2732 | 21845 |\n| 32 | -21846 | 0 | 2733 | 21845 |\n| 32 | -21846 | 0 | 2734 | 21845 |\n| 32 | -21846 | 0 | 2735 | 21845 |\n| 32+ | 21845 | 1 | 2731 | -21846 |\n| 33 | 21845 | 1 | 2731 | 21845 |\n| 33+ | -21846 | 1 | 2732 | 21845 |\n| 34 | -21846 | 1 | 2732 | -21846 |\n| 34+ | -21846 | 0 | 2728 | 21845 |\n| 35 | -21846 | 0 | 2728 | 21845 |\n| 35 | -21846 | 0 | 2729 | 21845 |\n| 35 | -21846 | 0 | 2730 | 21845 |\n| 35 | -21846 | 0 | 2731 | 21845 |\n| 35 | -21846 | 0 | 2732 | -21846 |\n| 35 | -21846 | 0 | 2733 | 21845 |\n| 35 | -21846 | 0 | 2734 | 21845 |\n| 35 | -21846 | 0 | 2735 | 21845 |\n| 35+ | 21845 | 1 | 2732 | -21846 |\n| 36 | 21845 | 1 | 2732 | 21845 |\n| 36+ | -21846 | 1 | 2733 | 21845 |\n| 37 | -21846 | 1 | 2733 | -21846 |\n| 37+ | -21846 | 0 | 2728 | 21845 |\n| 38 | -21846 | 0 | 2728 | 21845 |\n| 38 | -21846 | 0 | 2729 | 21845 |\n| 38 | -21846 | 0 | 2730 | 21845 |\n| 38 | -21846 | 0 | 2731 | 21845 |\n| 38 | -21846 | 0 | 2732 | 21845 |\n| 38 | -21846 | 0 | 2733 | -21846 |\n| 38 | -21846 | 0 | 2734 | 21845 |\n| 38 | -21846 | 0 | 2735 | 21845 |\n| 38+ | 21845 | 1 | 2733 | -21846 |\n| 39 | 21845 | 1 | 2733 | 21845 |\n| 39+ | -21846 | 1 | 2734 | 21845 |\n| 40 | -21846 | 1 | 2734 | -21846 |\n| 40+ | -21846 | 0 | 2728 | 21845 |\n| 41 | -21846 | 0 | 2728 | 21845 |\n| 41 | -21846 | 0 | 2729 | 21845 |\n| 41 | -21846 | 0 | 2730 | 21845 |\n| 41 | -21846 | 0 | 2731 | 21845 |\n| 41 | -21846 | 0 | 2732 | 21845 |\n| 41 | -21846 | 0 | 2733 | 21845 |\n| 41 | -21846 | 0 | 2734 | -21846 |\n| 41 | -21846 | 0 | 2735 | 21845 |\n| 41+ | 21845 | 1 | 2734 | -21846 |\n| 42 | 21845 | 1 | 2734 | 21845 |\n| 42+ | -21846 | 1 | 2735 | 21845 |\n| 43 | -21846 | 1 | 2735 | -21846 |\n| 43+ | -21846 | 0 | 2728 | 21845 |\n| 44 | -21846 | 0 | 2728 | 21845 |\n| 44 | -21846 | 0 | 2729 | 21845 |\n| 44 | -21846 | 0 | 2730 | 21845 |\n| 44 | -21846 | 0 | 2731 | 21845 |\n| 44 | -21846 | 0 | 2732 | 21845 |\n| 44 | -21846 | 0 | 2733 | 21845 |\n| 44 | -21846 | 0 | 2734 | 21845 |\n| 44 | -21846 | 0 | 2735 | -21846 |\n| 44+ | 21845 | 1 | 2735 | -21846 |\n| 45 | 21845 | 1 | 2735 | 21845 |\n| 45+ | 21845 | 0 | 2728 | 21845 |\n| 46 | 21845 | 0 | 2728 | 21845 |\n| 46 | 21845 | 0 | 2729 | 21845 |\n| 46 | 21845 | 0 | 2730 | 21845 |\n| 46 | 21845 | 0 | 2731 | 21845 |\n| 46 | 21845 | 0 | 2732 | 21845 |\n| 46 | 21845 | 0 | 2733 | 21845 |\n| 46 | 21845 | 0 | 2734 | 21845 |\n| 46 | 21845 | 0 | 2735 | 21845 |\n| 46+ | 21845 | 0 | 341 | 0 |\n| 47 | 21845 | 0 | 341 | 0 |\n| 47 | 21845 | 0 | 853 | 0 |\n| 47 | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 1877 | 0 |\n| 47 | 21845 | 0 | 2389 | 0 |\n| 47 | 21845 | 0 | 2901 | 0 |\n| 47 | 21845 | 0 | 3413 | 0 |\n| 47 | 21845 | 0 | 3925 | 0 |\n| 47+ | 21845 | 1 | 341 | 0 |\n| 48 | 21845 | 1 | 341 | 21845 |\n| 48+ | 21845 | 1 | 853 | 0 |\n| 49 | 21845 | 1 | 853 | 21845 |\n| 49+ | 21845 | 1 | 1365 | 0 |\n| 50 | 21845 | 1 | 1365 | 21845 |\n| 50+ | 21845 | 1 | 1877 | 0 |\n| 51 | 21845 | 1 | 1877 | 21845 |\n| 51+ | 21845 | 1 | 2389 | 0 |\n| 52 | 21845 | 1 | 2389 | 21845 |\n| 52+ | 21845 | 1 | 2901 | 0 |\n| 53 | 21845 | 1 | 2901 | 21845 |\n| 53+ | 21845 | 1 | 3413 | 0 |\n| 54 | 21845 | 1 | 3413 | 21845 |\n| 54+ | 21845 | 1 | 3925 | 0 |\n| 55 | 21845 | 1 | 3925 | 21845 |\n| 55+ | 21845 | 0 | 341 | 21845 |\n| 56 | 21845 | 0 | 341 | 21845 |\n| 56 | 21845 | 0 | 853 | 21845 |\n| 56 | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 1877 | 21845 |\n| 56 | 21845 | 0 | 2389 | 21845 |\n| 56 | 21845 | 0 | 2901 | 21845 |\n| 56 | 21845 | 0 | 3413 | 21845 |\n| 56 | 21845 | 0 | 3925 | 21845 |\n| 56+ | -21846 | 1 | 341 | 21845 |\n| 57 | -21846 | 1 | 341 | -21846 |\n| 57+ | -21846 | 0 | 341 | -21846 |\n| 58 | -21846 | 0 | 341 | -21846 |\n| 58 | -21846 | 0 | 853 | 21845 |\n| 58 | -21846 | 0 | 1365 | 21845 |\n| 58 | -21846 | 0 | 1877 | 21845 |\n| 58 | -21846 | 0 | 2389 | 21845 |\n| 58 | -21846 | 0 | 2901 | 21845 |\n| 58 | -21846 | 0 | 3413 | 21845 |\n| 58 | -21846 | 0 | 3925 | 21845 |\n| 58+ | 21845 | 1 | 341 | -21846 |\n| 59 | 21845 | 1 | 341 | 21845 |\n| 59+ | -21846 | 1 | 853 | 21845 |\n| 60 | -21846 | 1 | 853 | -21846 |\n| 60+ | -21846 | 0 | 341 | 21845 |\n| 61 | -21846 | 0 | 341 | 21845 |\n| 61 | -21846 | 0 | 853 | -21846 |\n| 61 | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 1877 | 21845 |\n| 61 | -21846 | 0 | 2389 | 21845 |\n| 61 | -21846 | 0 | 2901 | 21845 |\n| 61 | -21846 | 0 | 3413 | 21845 |\n| 61 | -21846 | 0 | 3925 | 21845 |\n| 61+ | 21845 | 1 | 853 | -21846 |\n| 62 | 21845 | 1 | 853 | 21845 |\n| 62+ | -21846 | 1 | 1365 | 21845 |\n| 63 | -21846 | 1 | 1365 | -21846 |\n| 63+ | -21846 | 0 | 341 | 21845 |\n| 64 | -21846 | 0 | 341 | 21845 |\n| 64 | -21846 | 0 | 853 | 21845 |\n| 64 | -21846 | 0 | 1365 | -21846 |\n| 64 | -21846 | 0 | 1877 | 21845 |\n| 64 | -21846 | 0 | 2389 | 21845 |\n| 64 | -21846 | 0 | 2901 | 21845 |\n| 64 | -21846 | 0 | 3413 | 21845 |\n| 64 | -21846 | 0 | 3925 | 21845 |\n| 64+ | 21845 | 1 | 1365 | -21846 |\n| 65 | 21845 | 1 | 1365 | 21845 |\n| 65+ | -21846 | 1 | 1877 | 21845 |\n| 66 | -21846 | 1 | 1877 | -21846 |\n| 66+ | -21846 | 0 | 341 | 21845 |\n| 67 | -21846 | 0 | 341 | 21845 |\n| 67 | -21846 | 0 | 853 | 21845 |\n| 67 | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 1877 | -21846 |\n| 67 | -21846 | 0 | 2389 | 21845 |\n| 67 | -21846 | 0 | 2901 | 21845 |\n| 67 | -21846 | 0 | 3413 | 21845 |\n| 67 | -21846 | 0 | 3925 | 21845 |\n| 67+ | 21845 | 1 | 1877 | -21846 |\n| 68 | 21845 | 1 | 1877 | 21845 |\n| 68+ | -21846 | 1 | 2389 | 21845 |\n| 69 | -21846 | 1 | 2389 | -21846 |\n| 69+ | -21846 | 0 | 341 | 21845 |\n| 70 | -21846 | 0 | 341 | 21845 |\n| 70 | -21846 | 0 | 853 | 21845 |\n| 70 | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 1877 | 21845 |\n| 70 | -21846 | 0 | 2389 | -21846 |\n| 70 | -21846 | 0 | 2901 | 21845 |\n| 70 | -21846 | 0 | 3413 | 21845 |\n| 70 | -21846 | 0 | 3925 | 21845 |\n| 70+ | 21845 | 1 | 2389 | -21846 |\n| 71 | 21845 | 1 | 2389 | 21845 |\n| 71+ | -21846 | 1 | 2901 | 21845 |\n| 72 | -21846 | 1 | 2901 | -21846 |\n| 72+ | -21846 | 0 | 341 | 21845 |\n| 73 | -21846 | 0 | 341 | 21845 |\n| 73 | -21846 | 0 | 853 | 21845 |\n| 73 | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 1877 | 21845 |\n| 73 | -21846 | 0 | 2389 | 21845 |\n| 73 | -21846 | 0 | 2901 | -21846 |\n| 73 | -21846 | 0 | 3413 | 21845 |\n| 73 | -21846 | 0 | 3925 | 21845 |\n| 73+ | 21845 | 1 | 2901 | -21846 |\n| 74 | 21845 | 1 | 2901 | 21845 |\n| 74+ | -21846 | 1 | 3413 | 21845 |\n| 75 | -21846 | 1 | 3413 | -21846 |\n| 75+ | -21846 | 0 | 341 | 21845 |\n| 76 | -21846 | 0 | 341 | 21845 |\n| 76 | -21846 | 0 | 853 | 21845 |\n| 76 | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 1877 | 21845 |\n| 76 | -21846 | 0 | 2389 | 21845 |\n| 76 | -21846 | 0 | 2901 | 21845 |\n| 76 | -21846 | 0 | 3413 | -21846 |\n| 76 | -21846 | 0 | 3925 | 21845 |\n| 76+ | 21845 | 1 | 3413 | -21846 |\n| 77 | 21845 | 1 | 3413 | 21845 |\n| 77+ | -21846 | 1 | 3925 | 21845 |\n| 78 | -21846 | 1 | 3925 | -21846 |\n| 78+ | -21846 | 0 | 341 | 21845 |\n| 79 | -21846 | 0 | 341 | 21845 |\n| 79 | -21846 | 0 | 853 | 21845 |\n| 79 | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 1877 | 21845 |\n| 79 | -21846 | 0 | 2389 | 21845 |\n| 79 | -21846 | 0 | 2901 | 21845 |\n| 79 | -21846 | 0 | 3413 | 21845 |\n| 79 | -21846 | 0 | 3925 | -21846 |\n| 79+ | 21845 | 1 | 3925 | -21846 |\n| 80 | 21845 | 1 | 3925 | 21845 |\n| 80+ | 21845 | 0 | 341 | 21845 |\n| 81 | 21845 | 0 | 341 | 21845 |\n| 81 | 21845 | 0 | 853 | 21845 |\n| 81 | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 1877 | 21845 |\n| 81 | 21845 | 0 | 2389 | 21845 |\n| 81 | 21845 | 0 | 2901 | 21845 |\n| 81 | 21845 | 0 | 3413 | 21845 |\n| 81 | 21845 | 0 | 3925 | 21845 |"},RAM16k:{"RAM16k.hdl":"\nCHIP RAM16K {\n IN in[16], load, address[14];\n OUT out[16];\n\n PARTS:\n}","RAM16k.tst":"output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.5.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 4321, set load 0, tick, output; tock, output;\nset load 1, set address 4321, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 12345, set address 12345, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 4321, eval, output;\n\nset in 16383, tick, output; tock, output;\nset load 1, set address 16383, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 12345, eval, output;\nset address 16383, eval, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set in %B0101010101010101, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, tick, output, tock, output;\nset address %B10101010101010, tick, output, tock, output;\nset address %B10101010101011, tick, output, tock, output;\nset address %B10101010101100, tick, output, tock, output;\nset address %B10101010101101, tick, output, tock, output;\nset address %B10101010101110, tick, output, tock, output;\nset address %B10101010101111, tick, output, tock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101000, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101001, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101010, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1;\nset address %B10101010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101011, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0, set address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101100, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101111, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101111, set in %B0101010101010101, tick, output, tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, tick, output, tock, output;\nset address %B01010101010101, tick, output, tock, output;\nset address %B01110101010101, tick, output, tock, output;\nset address %B10010101010101, tick, output, tock, output;\nset address %B10110101010101, tick, output, tock, output;\nset address %B11010101010101, tick, output, tock, output;\nset address %B11110101010101, tick, output, tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00010101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B00110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B01010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B01010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B01110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B01110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B10010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B10110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B11010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B11010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B11110101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B11110101010101, set in %B0101010101010101, tick, output, tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;","RAM16k.cmp":"| time | in |load | address | out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 4321 | 0 | 0 | 0 |\n| 3 | 4321 | 0 | 0 | 0 |\n| 3+ | 4321 | 1 | 4321 | 0 |\n| 4 | 4321 | 1 | 4321 | 4321 |\n| 4+ | 4321 | 0 | 0 | 0 |\n| 5 | 4321 | 0 | 0 | 0 |\n| 5+ | 12345 | 0 | 12345 | 0 |\n| 6 | 12345 | 0 | 12345 | 0 |\n| 6+ | 12345 | 1 | 12345 | 0 |\n| 7 | 12345 | 1 | 12345 | 12345 |\n| 7+ | 12345 | 0 | 12345 | 12345 |\n| 8 | 12345 | 0 | 12345 | 12345 |\n| 8 | 12345 | 0 | 4321 | 4321 |\n| 8+ | 16383 | 0 | 4321 | 4321 |\n| 9 | 16383 | 0 | 4321 | 4321 |\n| 9+ | 16383 | 1 | 16383 | 0 |\n| 10 | 16383 | 1 | 16383 | 16383 |\n| 10+ | 16383 | 0 | 16383 | 16383 |\n| 11 | 16383 | 0 | 16383 | 16383 |\n| 11 | 16383 | 0 | 12345 | 12345 |\n| 11 | 16383 | 0 | 16383 | 16383 |\n| 11+ | 16383 | 0 | 10920 | 0 |\n| 12 | 16383 | 0 | 10920 | 0 |\n| 12 | 16383 | 0 | 10921 | 0 |\n| 12 | 16383 | 0 | 10922 | 0 |\n| 12 | 16383 | 0 | 10923 | 0 |\n| 12 | 16383 | 0 | 10924 | 0 |\n| 12 | 16383 | 0 | 10925 | 0 |\n| 12 | 16383 | 0 | 10926 | 0 |\n| 12 | 16383 | 0 | 10927 | 0 |\n| 12+ | 21845 | 1 | 10920 | 0 |\n| 13 | 21845 | 1 | 10920 | 21845 |\n| 13+ | 21845 | 1 | 10921 | 0 |\n| 14 | 21845 | 1 | 10921 | 21845 |\n| 14+ | 21845 | 1 | 10922 | 0 |\n| 15 | 21845 | 1 | 10922 | 21845 |\n| 15+ | 21845 | 1 | 10923 | 0 |\n| 16 | 21845 | 1 | 10923 | 21845 |\n| 16+ | 21845 | 1 | 10924 | 0 |\n| 17 | 21845 | 1 | 10924 | 21845 |\n| 17+ | 21845 | 1 | 10925 | 0 |\n| 18 | 21845 | 1 | 10925 | 21845 |\n| 18+ | 21845 | 1 | 10926 | 0 |\n| 19 | 21845 | 1 | 10926 | 21845 |\n| 19+ | 21845 | 1 | 10927 | 0 |\n| 20 | 21845 | 1 | 10927 | 21845 |\n| 20+ | 21845 | 0 | 10920 | 21845 |\n| 21 | 21845 | 0 | 10920 | 21845 |\n| 21 | 21845 | 0 | 10921 | 21845 |\n| 21 | 21845 | 0 | 10922 | 21845 |\n| 21 | 21845 | 0 | 10923 | 21845 |\n| 21 | 21845 | 0 | 10924 | 21845 |\n| 21 | 21845 | 0 | 10925 | 21845 |\n| 21 | 21845 | 0 | 10926 | 21845 |\n| 21 | 21845 | 0 | 10927 | 21845 |\n| 21+ | -21846 | 1 | 10920 | 21845 |\n| 22 | -21846 | 1 | 10920 | -21846 |\n| 22+ | -21846 | 0 | 10920 | -21846 |\n| 23 | -21846 | 0 | 10920 | -21846 |\n| 23 | -21846 | 0 | 10921 | 21845 |\n| 23 | -21846 | 0 | 10922 | 21845 |\n| 23 | -21846 | 0 | 10923 | 21845 |\n| 23 | -21846 | 0 | 10924 | 21845 |\n| 23 | -21846 | 0 | 10925 | 21845 |\n| 23 | -21846 | 0 | 10926 | 21845 |\n| 23 | -21846 | 0 | 10927 | 21845 |\n| 23+ | 21845 | 1 | 10920 | -21846 |\n| 24 | 21845 | 1 | 10920 | 21845 |\n| 24+ | -21846 | 1 | 10921 | 21845 |\n| 25 | -21846 | 1 | 10921 | -21846 |\n| 25+ | -21846 | 0 | 10920 | 21845 |\n| 26 | -21846 | 0 | 10920 | 21845 |\n| 26 | -21846 | 0 | 10921 | -21846 |\n| 26 | -21846 | 0 | 10922 | 21845 |\n| 26 | -21846 | 0 | 10923 | 21845 |\n| 26 | -21846 | 0 | 10924 | 21845 |\n| 26 | -21846 | 0 | 10925 | 21845 |\n| 26 | -21846 | 0 | 10926 | 21845 |\n| 26 | -21846 | 0 | 10927 | 21845 |\n| 26+ | 21845 | 1 | 10921 | -21846 |\n| 27 | 21845 | 1 | 10921 | 21845 |\n| 27+ | -21846 | 1 | 10922 | 21845 |\n| 28 | -21846 | 1 | 10922 | -21846 |\n| 28+ | -21846 | 0 | 10920 | 21845 |\n| 29 | -21846 | 0 | 10920 | 21845 |\n| 29 | -21846 | 0 | 10921 | 21845 |\n| 29 | -21846 | 0 | 10922 | -21846 |\n| 29 | -21846 | 0 | 10923 | 21845 |\n| 29 | -21846 | 0 | 10924 | 21845 |\n| 29 | -21846 | 0 | 10925 | 21845 |\n| 29 | -21846 | 0 | 10926 | 21845 |\n| 29 | -21846 | 0 | 10927 | 21845 |\n| 29+ | 21845 | 1 | 10922 | -21846 |\n| 30 | 21845 | 1 | 10922 | 21845 |\n| 30+ | -21846 | 1 | 10923 | 21845 |\n| 31 | -21846 | 1 | 10923 | -21846 |\n| 31+ | -21846 | 0 | 10920 | 21845 |\n| 32 | -21846 | 0 | 10920 | 21845 |\n| 32 | -21846 | 0 | 10921 | 21845 |\n| 32 | -21846 | 0 | 10922 | 21845 |\n| 32 | -21846 | 0 | 10923 | -21846 |\n| 32 | -21846 | 0 | 10924 | 21845 |\n| 32 | -21846 | 0 | 10925 | 21845 |\n| 32 | -21846 | 0 | 10926 | 21845 |\n| 32 | -21846 | 0 | 10927 | 21845 |\n| 32+ | 21845 | 1 | 10923 | -21846 |\n| 33 | 21845 | 1 | 10923 | 21845 |\n| 33+ | -21846 | 1 | 10924 | 21845 |\n| 34 | -21846 | 1 | 10924 | -21846 |\n| 34+ | -21846 | 0 | 10920 | 21845 |\n| 35 | -21846 | 0 | 10920 | 21845 |\n| 35 | -21846 | 0 | 10921 | 21845 |\n| 35 | -21846 | 0 | 10922 | 21845 |\n| 35 | -21846 | 0 | 10923 | 21845 |\n| 35 | -21846 | 0 | 10924 | -21846 |\n| 35 | -21846 | 0 | 10925 | 21845 |\n| 35 | -21846 | 0 | 10926 | 21845 |\n| 35 | -21846 | 0 | 10927 | 21845 |\n| 35+ | 21845 | 1 | 10924 | -21846 |\n| 36 | 21845 | 1 | 10924 | 21845 |\n| 36+ | -21846 | 1 | 10925 | 21845 |\n| 37 | -21846 | 1 | 10925 | -21846 |\n| 37+ | -21846 | 0 | 10920 | 21845 |\n| 38 | -21846 | 0 | 10920 | 21845 |\n| 38 | -21846 | 0 | 10921 | 21845 |\n| 38 | -21846 | 0 | 10922 | 21845 |\n| 38 | -21846 | 0 | 10923 | 21845 |\n| 38 | -21846 | 0 | 10924 | 21845 |\n| 38 | -21846 | 0 | 10925 | -21846 |\n| 38 | -21846 | 0 | 10926 | 21845 |\n| 38 | -21846 | 0 | 10927 | 21845 |\n| 38+ | 21845 | 1 | 10925 | -21846 |\n| 39 | 21845 | 1 | 10925 | 21845 |\n| 39+ | -21846 | 1 | 10926 | 21845 |\n| 40 | -21846 | 1 | 10926 | -21846 |\n| 40+ | -21846 | 0 | 10920 | 21845 |\n| 41 | -21846 | 0 | 10920 | 21845 |\n| 41 | -21846 | 0 | 10921 | 21845 |\n| 41 | -21846 | 0 | 10922 | 21845 |\n| 41 | -21846 | 0 | 10923 | 21845 |\n| 41 | -21846 | 0 | 10924 | 21845 |\n| 41 | -21846 | 0 | 10925 | 21845 |\n| 41 | -21846 | 0 | 10926 | -21846 |\n| 41 | -21846 | 0 | 10927 | 21845 |\n| 41+ | 21845 | 1 | 10926 | -21846 |\n| 42 | 21845 | 1 | 10926 | 21845 |\n| 42+ | -21846 | 1 | 10927 | 21845 |\n| 43 | -21846 | 1 | 10927 | -21846 |\n| 43+ | -21846 | 0 | 10920 | 21845 |\n| 44 | -21846 | 0 | 10920 | 21845 |\n| 44 | -21846 | 0 | 10921 | 21845 |\n| 44 | -21846 | 0 | 10922 | 21845 |\n| 44 | -21846 | 0 | 10923 | 21845 |\n| 44 | -21846 | 0 | 10924 | 21845 |\n| 44 | -21846 | 0 | 10925 | 21845 |\n| 44 | -21846 | 0 | 10926 | 21845 |\n| 44 | -21846 | 0 | 10927 | -21846 |\n| 44+ | 21845 | 1 | 10927 | -21846 |\n| 45 | 21845 | 1 | 10927 | 21845 |\n| 45+ | 21845 | 0 | 10920 | 21845 |\n| 46 | 21845 | 0 | 10920 | 21845 |\n| 46 | 21845 | 0 | 10921 | 21845 |\n| 46 | 21845 | 0 | 10922 | 21845 |\n| 46 | 21845 | 0 | 10923 | 21845 |\n| 46 | 21845 | 0 | 10924 | 21845 |\n| 46 | 21845 | 0 | 10925 | 21845 |\n| 46 | 21845 | 0 | 10926 | 21845 |\n| 46 | 21845 | 0 | 10927 | 21845 |\n| 46+ | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 3413 | 0 |\n| 47 | 21845 | 0 | 5461 | 0 |\n| 47 | 21845 | 0 | 7509 | 0 |\n| 47 | 21845 | 0 | 9557 | 0 |\n| 47 | 21845 | 0 | 11605 | 0 |\n| 47 | 21845 | 0 | 13653 | 0 |\n| 47 | 21845 | 0 | 15701 | 0 |\n| 47+ | 21845 | 1 | 1365 | 0 |\n| 48 | 21845 | 1 | 1365 | 21845 |\n| 48+ | 21845 | 1 | 3413 | 0 |\n| 49 | 21845 | 1 | 3413 | 21845 |\n| 49+ | 21845 | 1 | 5461 | 0 |\n| 50 | 21845 | 1 | 5461 | 21845 |\n| 50+ | 21845 | 1 | 7509 | 0 |\n| 51 | 21845 | 1 | 7509 | 21845 |\n| 51+ | 21845 | 1 | 9557 | 0 |\n| 52 | 21845 | 1 | 9557 | 21845 |\n| 52+ | 21845 | 1 | 11605 | 0 |\n| 53 | 21845 | 1 | 11605 | 21845 |\n| 53+ | 21845 | 1 | 13653 | 0 |\n| 54 | 21845 | 1 | 13653 | 21845 |\n| 54+ | 21845 | 1 | 15701 | 0 |\n| 55 | 21845 | 1 | 15701 | 21845 |\n| 55+ | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 3413 | 21845 |\n| 56 | 21845 | 0 | 5461 | 21845 |\n| 56 | 21845 | 0 | 7509 | 21845 |\n| 56 | 21845 | 0 | 9557 | 21845 |\n| 56 | 21845 | 0 | 11605 | 21845 |\n| 56 | 21845 | 0 | 13653 | 21845 |\n| 56 | 21845 | 0 | 15701 | 21845 |\n| 56+ | -21846 | 1 | 1365 | 21845 |\n| 57 | -21846 | 1 | 1365 | -21846 |\n| 57+ | -21846 | 0 | 1365 | -21846 |\n| 58 | -21846 | 0 | 1365 | -21846 |\n| 58 | -21846 | 0 | 3413 | 21845 |\n| 58 | -21846 | 0 | 5461 | 21845 |\n| 58 | -21846 | 0 | 7509 | 21845 |\n| 58 | -21846 | 0 | 9557 | 21845 |\n| 58 | -21846 | 0 | 11605 | 21845 |\n| 58 | -21846 | 0 | 13653 | 21845 |\n| 58 | -21846 | 0 | 15701 | 21845 |\n| 58+ | 21845 | 1 | 1365 | -21846 |\n| 59 | 21845 | 1 | 1365 | 21845 |\n| 59+ | -21846 | 1 | 3413 | 21845 |\n| 60 | -21846 | 1 | 3413 | -21846 |\n| 60+ | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 3413 | -21846 |\n| 61 | -21846 | 0 | 5461 | 21845 |\n| 61 | -21846 | 0 | 7509 | 21845 |\n| 61 | -21846 | 0 | 9557 | 21845 |\n| 61 | -21846 | 0 | 11605 | 21845 |\n| 61 | -21846 | 0 | 13653 | 21845 |\n| 61 | -21846 | 0 | 15701 | 21845 |\n| 61+ | 21845 | 1 | 3413 | -21846 |\n| 62 | 21845 | 1 | 3413 | 21845 |\n| 62+ | -21846 | 1 | 5461 | 21845 |\n| 63 | -21846 | 1 | 5461 | -21846 |\n| 63+ | -21846 | 0 | 1365 | 21845 |\n| 64 | -21846 | 0 | 1365 | 21845 |\n| 64 | -21846 | 0 | 3413 | 21845 |\n| 64 | -21846 | 0 | 5461 | -21846 |\n| 64 | -21846 | 0 | 7509 | 21845 |\n| 64 | -21846 | 0 | 9557 | 21845 |\n| 64 | -21846 | 0 | 11605 | 21845 |\n| 64 | -21846 | 0 | 13653 | 21845 |\n| 64 | -21846 | 0 | 15701 | 21845 |\n| 64+ | 21845 | 1 | 5461 | -21846 |\n| 65 | 21845 | 1 | 5461 | 21845 |\n| 65+ | -21846 | 1 | 7509 | 21845 |\n| 66 | -21846 | 1 | 7509 | -21846 |\n| 66+ | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 3413 | 21845 |\n| 67 | -21846 | 0 | 5461 | 21845 |\n| 67 | -21846 | 0 | 7509 | -21846 |\n| 67 | -21846 | 0 | 9557 | 21845 |\n| 67 | -21846 | 0 | 11605 | 21845 |\n| 67 | -21846 | 0 | 13653 | 21845 |\n| 67 | -21846 | 0 | 15701 | 21845 |\n| 67+ | 21845 | 1 | 7509 | -21846 |\n| 68 | 21845 | 1 | 7509 | 21845 |\n| 68+ | -21846 | 1 | 9557 | 21845 |\n| 69 | -21846 | 1 | 9557 | -21846 |\n| 69+ | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 3413 | 21845 |\n| 70 | -21846 | 0 | 5461 | 21845 |\n| 70 | -21846 | 0 | 7509 | 21845 |\n| 70 | -21846 | 0 | 9557 | -21846 |\n| 70 | -21846 | 0 | 11605 | 21845 |\n| 70 | -21846 | 0 | 13653 | 21845 |\n| 70 | -21846 | 0 | 15701 | 21845 |\n| 70+ | 21845 | 1 | 9557 | -21846 |\n| 71 | 21845 | 1 | 9557 | 21845 |\n| 71+ | -21846 | 1 | 11605 | 21845 |\n| 72 | -21846 | 1 | 11605 | -21846 |\n| 72+ | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 3413 | 21845 |\n| 73 | -21846 | 0 | 5461 | 21845 |\n| 73 | -21846 | 0 | 7509 | 21845 |\n| 73 | -21846 | 0 | 9557 | 21845 |\n| 73 | -21846 | 0 | 11605 | -21846 |\n| 73 | -21846 | 0 | 13653 | 21845 |\n| 73 | -21846 | 0 | 15701 | 21845 |\n| 73+ | 21845 | 1 | 11605 | -21846 |\n| 74 | 21845 | 1 | 11605 | 21845 |\n| 74+ | -21846 | 1 | 13653 | 21845 |\n| 75 | -21846 | 1 | 13653 | -21846 |\n| 75+ | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 3413 | 21845 |\n| 76 | -21846 | 0 | 5461 | 21845 |\n| 76 | -21846 | 0 | 7509 | 21845 |\n| 76 | -21846 | 0 | 9557 | 21845 |\n| 76 | -21846 | 0 | 11605 | 21845 |\n| 76 | -21846 | 0 | 13653 | -21846 |\n| 76 | -21846 | 0 | 15701 | 21845 |\n| 76+ | 21845 | 1 | 13653 | -21846 |\n| 77 | 21845 | 1 | 13653 | 21845 |\n| 77+ | -21846 | 1 | 15701 | 21845 |\n| 78 | -21846 | 1 | 15701 | -21846 |\n| 78+ | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 3413 | 21845 |\n| 79 | -21846 | 0 | 5461 | 21845 |\n| 79 | -21846 | 0 | 7509 | 21845 |\n| 79 | -21846 | 0 | 9557 | 21845 |\n| 79 | -21846 | 0 | 11605 | 21845 |\n| 79 | -21846 | 0 | 13653 | 21845 |\n| 79 | -21846 | 0 | 15701 | -21846 |\n| 79+ | 21845 | 1 | 15701 | -21846 |\n| 80 | 21845 | 1 | 15701 | 21845 |\n| 80+ | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 3413 | 21845 |\n| 81 | 21845 | 0 | 5461 | 21845 |\n| 81 | 21845 | 0 | 7509 | 21845 |\n| 81 | 21845 | 0 | 9557 | 21845 |\n| 81 | 21845 | 0 | 11605 | 21845 |\n| 81 | 21845 | 0 | 13653 | 21845 |\n| 81 | 21845 | 0 | 15701 | 21845 |"}};function h(t){return m.apply(this,arguments)}function m(){return(m=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.pushd("/projects/03");case 2:return t.next=4,(0,r.mc)(n,f);case 4:return t.next=6,n.popd();case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var z={Memory:{"Memory.hdl":"/**\n * The complete address space of the Hack computer's memory,\n * including RAM and memory-mapped I/O. \n * The chip facilitates read and write operations, as follows:\n * Read: out(t) = Memory[address(t)](t)\n * Write: if load(t-1) then Memory[address(t-1)](t) = in(t-1)\n * In words: the chip always outputs the value stored at the memory \n * location specified by address. If load==1, the in value is loaded \n * into the memory location specified by address. This value becomes \n * available through the out output from the next time step onward.\n * Address space rules:\n * Only the upper 16K+8K+1 words of the Memory chip are used. \n * Access to address>0x6000 is invalid. Access to any address in \n * the range 0x4000-0x5FFF results in accessing the screen memory \n * map. Access to address 0x6000 results in accessing the keyboard \n * memory map. The behavior in these addresses is described in the \n * Screen and Keyboard chip specifications given in the book.\n */\n\nCHIP Memory {\n IN in[16], load, address[15];\n OUT out[16];\n\n PARTS:\n}","Memory.tst":"output-list in%D1.6.1 load%B2.1.2 address%B1.15.1 out%D1.6.1;\n\n// Set RAM[0] = -1\nset address 0,\nset in -1, set load 1, tick, output; tock, output;\n\n// RAM[0] holds value\nset in 9999, set load 0, tick, output; tock, output;\n\n// Did not also write to upper RAM or Screen\nset address %X2000, eval, output;\nset address %X4000, eval, output;\n\n// Set RAM[0x2000] = 2222\nset address %X2000,\nset in 2222, set load 1, tick, output; tock, output;\n\n// RAM[0x2000] holds value\nset in 9999, set load 0, tick, output; tock, output;\n\n// Did not also write to lower RAM or Screen\nset address 0, eval, output;\nset address %X4000, eval, output;\n\nset load 0,\t// Low order address bits connected\nset address %X0001, eval, output;\nset address %X0002, eval, output;\nset address %X0004, eval, output;\nset address %X0008, eval, output;\nset address %X0010, eval, output;\nset address %X0020, eval, output;\nset address %X0040, eval, output;\nset address %X0080, eval, output;\nset address %X0100, eval, output;\nset address %X0200, eval, output;\nset address %X0400, eval, output;\nset address %X0800, eval, output;\nset address %X1000, eval, output;\nset address %X2000, eval, output;\n\n// RAM[1234] = 1234\nset address %X1234,\nset in 1234, set load 1, tick, output; tock, output;\n\n// Did not also write to upper RAM or Screen \nset load 0,\nset address %X2234, eval, output;\nset address %X6234, eval, output;\n\n// RAM[0x2345] = 2345\nset address %X2345,\nset in 2345, set load 1, tick, output; tock, output;\n\n// Did not also write to lower RAM or Screen \nset load 0,\nset address %X0345, eval, output;\nset address %X4345, eval, output;\n\n// Keyboard test\n\n// set address 24576,\n// echo \"Click the Keyboard icon and hold down the 'K' key (uppercase) until you see the next message (it should appear shortly after that) ...\",\n// It's important to keep holding the key down since if the system is busy,\n// the memory will zero itself before being outputted.\n\n/*\nset Keyboard 'K';\nwhile out <> 75 {\n eval,\n}\nclear-echo, output;\noutput;\n*/\n\n// Screen test\n\nset load 1, set in -1, set address %X4FCF, tick, tock, output;\nset address %X504F, tick, tock, output;\n\n// Did not also write to lower or upper RAM\nset address %X0FCF, eval, output;\nset address %X2FCF, eval, output;\n\nset load 0,\t\t\t\t// Low order address bits connected\nset address %X4FCE, eval, output;\nset address %X4FCD, eval, output;\nset address %X4FCB, eval, output;\nset address %X4FC7, eval, output;\nset address %X4FDF, eval, output;\nset address %X4FEF, eval, output;\nset address %X4F8F, eval, output;\nset address %X4F4F, eval, output;\nset address %X4ECF, eval, output;\nset address %X4DCF, eval, output;\nset address %X4BCF, eval, output;\nset address %X47CF, eval, output;\nset address %X5FCF, eval, output;\n\n\nset load 0, set address 24576,\necho \"Make sure you see ONLY two horizontal lines in the middle of the screen. Change Keyboard to 'Y' (uppercase) to continue ...\";\n\n/*\nwhile out <> 89 {\n eval;\n}\n*/\nclear-echo;","Memory.cmp":"| in |load | address | out |\n| -1 | 1 | 000000000000000 | 0 |\n| -1 | 1 | 000000000000000 | -1 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 010000000000000 | 0 |\n| 9999 | 0 | 100000000000000 | 0 |\n| 2222 | 1 | 010000000000000 | 0 |\n| 2222 | 1 | 010000000000000 | 2222 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 100000000000000 | 0 |\n| 9999 | 0 | 000000000000001 | 0 |\n| 9999 | 0 | 000000000000010 | 0 |\n| 9999 | 0 | 000000000000100 | 0 |\n| 9999 | 0 | 000000000001000 | 0 |\n| 9999 | 0 | 000000000010000 | 0 |\n| 9999 | 0 | 000000000100000 | 0 |\n| 9999 | 0 | 000000001000000 | 0 |\n| 9999 | 0 | 000000010000000 | 0 |\n| 9999 | 0 | 000000100000000 | 0 |\n| 9999 | 0 | 000001000000000 | 0 |\n| 9999 | 0 | 000010000000000 | 0 |\n| 9999 | 0 | 000100000000000 | 0 |\n| 9999 | 0 | 001000000000000 | 0 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 1234 | 1 | 001001000110100 | 0 |\n| 1234 | 1 | 001001000110100 | 1234 |\n| 1234 | 0 | 010001000110100 | 0 |\n| 1234 | 0 | 110001000110100 | 0 |\n| 2345 | 1 | 010001101000101 | 0 |\n| 2345 | 1 | 010001101000101 | 2345 |\n| 2345 | 0 | 000001101000101 | 0 |\n| 2345 | 0 | 100001101000101 | 0 |\n| -1 | 1 | 100111111001111 | -1 |\n| -1 | 1 | 101000001001111 | -1 |\n| -1 | 1 | 000111111001111 | 0 |\n| -1 | 1 | 010111111001111 | 0 |\n| -1 | 0 | 100111111001110 | 0 |\n| -1 | 0 | 100111111001101 | 0 |\n| -1 | 0 | 100111111001011 | 0 |\n| -1 | 0 | 100111111000111 | 0 |\n| -1 | 0 | 100111111011111 | 0 |\n| -1 | 0 | 100111111101111 | 0 |\n| -1 | 0 | 100111110001111 | 0 |\n| -1 | 0 | 100111101001111 | 0 |\n| -1 | 0 | 100111011001111 | 0 |\n| -1 | 0 | 100110111001111 | 0 |\n| -1 | 0 | 100101111001111 | 0 |\n| -1 | 0 | 100011111001111 | 0 |\n| -1 | 0 | 101111111001111 | 0 |"},CPU:{"CPU.hdl":"/**\n * The Hack CPU (Central Processing unit), consisting of an ALU,\n * two registers named A and D, and a program counter named PC.\n * The CPU is designed to fetch and execute instructions written in \n * the Hack machine language. In particular, functions as follows:\n * Executes the inputted instruction according to the Hack machine \n * language specification. The D and A in the language specification\n * refer to CPU-resident registers, while M refers to the external\n * memory location addressed by A, i.e. to Memory[A]. The inM input \n * holds the value of this location. If the current instruction needs \n * to write a value to M, the value is placed in outM, the address \n * of the target location is placed in the addressM output, and the \n * writeM control bit is asserted. (When writeM==0, any value may \n * appear in outM). The outM and writeM outputs are combinational: \n * they are affected instantaneously by the execution of the current \n * instruction. The addressM and pc outputs are clocked: although they \n * are affected by the execution of the current instruction, they commit \n * to their new values only in the next time step. If reset==1 then the \n * CPU jumps to address 0 (i.e. pc is set to 0 in next time step) rather \n * than to the address resulting from executing the current instruction. \n */\n\nCHIP CPU {\n\n IN inM[16], // M value input (M = contents of RAM[A])\n instruction[16], // Instruction for execution\n reset; // Signals whether to re-start the current\n // program (reset==1) or continue executing\n // the current program (reset==0).\n\n OUT outM[16], // M value output\n writeM, // Write to M? \n addressM[15], // Address in data memory (of M)\n pc[15]; // address of next instruction\n\n PARTS:\n}","CPU.tst":"output-list time%S0.4.0 inM%D0.6.0 instruction%B0.16.0 reset%B2.1.2 outM%D1.6.0 writeM%B3.1.3 addressM%D0.5.0 pc%D0.5.0 DRegister[]%D1.6.1;\n\n\nset instruction %B0011000000111001, // @12345\ntick, output, tock, output;\n\nset instruction %B1110110000010000, // D=A\ntick, output, tock, output;\n\nset instruction %B0101101110100000, // @23456\ntick, output, tock, output;\n\nset instruction %B1110000111010000, // D=A-D\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1110001100001000, // M=D\ntick, output, tock, output;\n\nset instruction %B0000001111101001, // @1001\ntick, output, tock, output;\n\nset instruction %B1110001110011000, // MD=D-1\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1111010011010000, // D=D-M\nset inM 11111,\ntick, output, tock, output;\n\nset instruction %B0000000000001110, // @14\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;jlt\ntick, output, tock, output;\n\nset instruction %B0000001111100111, // @999\ntick, output, tock, output;\n\nset instruction %B1110110111100000, // A=A+1\ntick, output, tock, output;\n\nset instruction %B1110001100001000, // M=D\ntick, output, tock, output;\n\nset instruction %B0000000000010101, // @21\ntick, output, tock, output;\n\nset instruction %B1110011111000010, // D+1;jeq\ntick, output, tock, output;\n\nset instruction %B0000000000000010, // @2\ntick, output, tock, output;\n\nset instruction %B1110000010010000, // D=D+A\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1110111010010000, // D=-1\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset instruction %B1110101010010000, // D=0\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset instruction %B1110111111010000, // D=1\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset reset 1;\ntick, output, tock, output;\n\nset instruction %B0111111111111111, // @32767\nset reset 0;\ntick, output, tock, output;","CPU.cmp":"|time| inM | instruction |reset| outM |writeM |addre| pc |DRegiste|\n|0+ | 0|0011000000111001| 0 |*******| 0 | 0| 0| 0 |\n|1 | 0|0011000000111001| 0 |*******| 0 |12345| 1| 0 |\n|1+ | 0|1110110000010000| 0 |*******| 0 |12345| 1| 0 |\n|2 | 0|1110110000010000| 0 |*******| 0 |12345| 2| 12345 |\n|2+ | 0|0101101110100000| 0 |*******| 0 |12345| 2| 12345 |\n|3 | 0|0101101110100000| 0 |*******| 0 |23456| 3| 12345 |\n|3+ | 0|1110000111010000| 0 |*******| 0 |23456| 3| 12345 |\n|4 | 0|1110000111010000| 0 |*******| 0 |23456| 4| 11111 |\n|4+ | 0|0000001111101000| 0 |*******| 0 |23456| 4| 11111 |\n|5 | 0|0000001111101000| 0 |*******| 0 | 1000| 5| 11111 |\n|5+ | 0|1110001100001000| 0 | 11111| 1 | 1000| 5| 11111 |\n|6 | 0|1110001100001000| 0 | 11111| 1 | 1000| 6| 11111 |\n|6+ | 0|0000001111101001| 0 |*******| 0 | 1000| 6| 11111 |\n|7 | 0|0000001111101001| 0 |*******| 0 | 1001| 7| 11111 |\n|7+ | 0|1110001110011000| 0 | 11110| 1 | 1001| 7| 11111 |\n|8 | 0|1110001110011000| 0 | 11109| 1 | 1001| 8| 11110 |\n|8+ | 0|0000001111101000| 0 |*******| 0 | 1001| 8| 11110 |\n|9 | 0|0000001111101000| 0 |*******| 0 | 1000| 9| 11110 |\n|9+ | 11111|1111010011010000| 0 |*******| 0 | 1000| 9| 11110 |\n|10 | 11111|1111010011010000| 0 |*******| 0 | 1000| 10| -1 |\n|10+ | 11111|0000000000001110| 0 |*******| 0 | 1000| 10| -1 |\n|11 | 11111|0000000000001110| 0 |*******| 0 | 14| 11| -1 |\n|11+ | 11111|1110001100000100| 0 |*******| 0 | 14| 11| -1 |\n|12 | 11111|1110001100000100| 0 |*******| 0 | 14| 14| -1 |\n|12+ | 11111|0000001111100111| 0 |*******| 0 | 14| 14| -1 |\n|13 | 11111|0000001111100111| 0 |*******| 0 | 999| 15| -1 |\n|13+ | 11111|1110110111100000| 0 |*******| 0 | 999| 15| -1 |\n|14 | 11111|1110110111100000| 0 |*******| 0 | 1000| 16| -1 |\n|14+ | 11111|1110001100001000| 0 | -1| 1 | 1000| 16| -1 |\n|15 | 11111|1110001100001000| 0 | -1| 1 | 1000| 17| -1 |\n|15+ | 11111|0000000000010101| 0 |*******| 0 | 1000| 17| -1 |\n|16 | 11111|0000000000010101| 0 |*******| 0 | 21| 18| -1 |\n|16+ | 11111|1110011111000010| 0 |*******| 0 | 21| 18| -1 |\n|17 | 11111|1110011111000010| 0 |*******| 0 | 21| 21| -1 |\n|17+ | 11111|0000000000000010| 0 |*******| 0 | 21| 21| -1 |\n|18 | 11111|0000000000000010| 0 |*******| 0 | 2| 22| -1 |\n|18+ | 11111|1110000010010000| 0 |*******| 0 | 2| 22| -1 |\n|19 | 11111|1110000010010000| 0 |*******| 0 | 2| 23| 1 |\n|19+ | 11111|0000001111101000| 0 |*******| 0 | 2| 23| 1 |\n|20 | 11111|0000001111101000| 0 |*******| 0 | 1000| 24| 1 |\n|20+ | 11111|1110111010010000| 0 |*******| 0 | 1000| 24| 1 |\n|21 | 11111|1110111010010000| 0 |*******| 0 | 1000| 25| -1 |\n|21+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 25| -1 |\n|22 | 11111|1110001100000001| 0 |*******| 0 | 1000| 26| -1 |\n|22+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 26| -1 |\n|23 | 11111|1110001100000010| 0 |*******| 0 | 1000| 27| -1 |\n|23+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 27| -1 |\n|24 | 11111|1110001100000011| 0 |*******| 0 | 1000| 28| -1 |\n|24+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 28| -1 |\n|25 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| -1 |\n|25+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 |\n|26 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 |\n|26+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 |\n|27 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 |\n|27+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 |\n|28 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 |\n|28+ | 11111|1110101010010000| 0 |*******| 0 | 1000| 1000| -1 |\n|29 | 11111|1110101010010000| 0 |*******| 0 | 1000| 1001| 0 |\n|29+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 0 |\n|30 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1002| 0 |\n|30+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1002| 0 |\n|31 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 0 |\n|31+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 |\n|32 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 |\n|32+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 0 |\n|33 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 0 |\n|33+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 0 |\n|34 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1002| 0 |\n|34+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1002| 0 |\n|35 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 0 |\n|35+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 |\n|36 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 |\n|36+ | 11111|1110111111010000| 0 |*******| 0 | 1000| 1000| 0 |\n|37 | 11111|1110111111010000| 0 |*******| 0 | 1000| 1001| 1 |\n|37+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 1 |\n|38 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1000| 1 |\n|38+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 1 |\n|39 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1001| 1 |\n|39+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1001| 1 |\n|40 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 1 |\n|40+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 1 |\n|41 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 1 |\n|41+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 1 |\n|42 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| 1 |\n|42+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 1 |\n|43 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1001| 1 |\n|43+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1001| 1 |\n|44 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 1 |\n|44+ | 11111|1110001100000111| 1 |*******| 0 | 1000| 1000| 1 |\n|45 | 11111|1110001100000111| 1 |*******| 0 | 1000| 0| 1 |\n|45+ | 11111|0111111111111111| 0 |*******| 0 | 1000| 0| 1 |\n|46 | 11111|0111111111111111| 0 |*******| 0 |32767| 1| 1 |"},Computer:{"Computer.hdl":'/**\n * The HACK computer, including CPU, ROM and RAM.\n * When reset is 0, the program stored in the computer\'s ROM executes.\n * When reset is 1, the execution of the program restarts. \n * Thus, to start a program\'s execution, reset must be pushed "up" (1)\n * and "down" (0). From this point onward the user is at the mercy of \n * the software. In particular, depending on the program\'s code, the \n * screen may show some output and the user may be able to interact \n * with the computer via the keyboard.\n */\n\nCHIP Computer {\n\n IN reset;\n\n PARTS:\n}',"Computer.tst":"output-list time%S1.4.1 reset%B2.1.2 ARegister[]%D1.7.1 DRegister[]%D1.7.1 PC[]%D0.4.0 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1;\n\n// Load a program written in the Hack machine language.\n// The program computes the maximum of RAM[0] and RAM[1] \n// and writes the result in RAM[2].\n\nROM32K load Max.hack,\n\n// first run: compute max(3,5)\nset Memory[0] 3,\nset Memory[1] 5,\noutput;\n\nrepeat 14 {\n tick, tock, output;\n}\n\n// reset the PC\nset reset 1,\ntick, tock, output;\n\n// second run: compute max(23456,12345)\nset reset 0,\nset Memory[0] 23456,\nset Memory[1] 12345,\noutput;\n\n// The run on these inputs needs less cycles (different branching)\nrepeat 10 {\n tick, tock, output;\n}\n","Computer.cmp":"| time |reset|ARegister|DRegister|PC[]|RAM16K[0]|RAM16K[1]|RAM16K[2]|\n| 0 | 0 | 0 | 0 | 0| 3 | 5 | 0 |\n| 1 | 0 | 0 | 0 | 1| 3 | 5 | 0 |\n| 2 | 0 | 0 | 3 | 2| 3 | 5 | 0 |\n| 3 | 0 | 1 | 3 | 3| 3 | 5 | 0 |\n| 4 | 0 | 1 | -2 | 4| 3 | 5 | 0 |\n| 5 | 0 | 10 | -2 | 5| 3 | 5 | 0 |\n| 6 | 0 | 10 | -2 | 6| 3 | 5 | 0 |\n| 7 | 0 | 1 | -2 | 7| 3 | 5 | 0 |\n| 8 | 0 | 1 | 5 | 8| 3 | 5 | 0 |\n| 9 | 0 | 12 | 5 | 9| 3 | 5 | 0 |\n| 10 | 0 | 12 | 5 | 12| 3 | 5 | 0 |\n| 11 | 0 | 2 | 5 | 13| 3 | 5 | 0 |\n| 12 | 0 | 2 | 5 | 14| 3 | 5 | 5 |\n| 13 | 0 | 14 | 5 | 15| 3 | 5 | 5 |\n| 14 | 0 | 14 | 5 | 14| 3 | 5 | 5 |\n| 15 | 1 | 14 | 5 | 0| 3 | 5 | 5 |\n| 15 | 0 | 14 | 5 | 0| 23456 | 12345 | 5 |\n| 16 | 0 | 0 | 5 | 1| 23456 | 12345 | 5 |\n| 17 | 0 | 0 | 23456 | 2| 23456 | 12345 | 5 |\n| 18 | 0 | 1 | 23456 | 3| 23456 | 12345 | 5 |\n| 19 | 0 | 1 | 11111 | 4| 23456 | 12345 | 5 |\n| 20 | 0 | 10 | 11111 | 5| 23456 | 12345 | 5 |\n| 21 | 0 | 10 | 11111 | 10| 23456 | 12345 | 5 |\n| 22 | 0 | 0 | 11111 | 11| 23456 | 12345 | 5 |\n| 23 | 0 | 0 | 23456 | 12| 23456 | 12345 | 5 |\n| 24 | 0 | 2 | 23456 | 13| 23456 | 12345 | 5 |\n| 25 | 0 | 2 | 23456 | 14| 23456 | 12345 | 23456 |","Max.hack":"0000000000000000\n1111110000010000\n0000000000000001\n1111010011010000\n0000000000001010\n1110001100000001\n0000000000000001\n1111110000010000\n0000000000001100\n1110101010000111\n0000000000000000\n1111110000010000\n0000000000000010\n1110001100001000\n0000000000001110\n1110101010000111"}};function b(t){return A.apply(this,arguments)}function A(){return(A=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.pushd("/projects/05");case 2:return t.next=4,(0,r.mc)(n,z);case 4:return t.next=6,n.popd();case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var C={"01":s,"02":u,"03":o,"05":a},M=!1,g=function(){var t=(0,l.Z)((0,p.Z)().mark((function t(n){return(0,p.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!M){t.next=2;break}return t.abrupt("return");case 2:return M=!0,t.next=5,c(n);case 5:return t.next=7,v(n);case 7:return t.next=9,h(n);case 9:return t.next=11,b(n);case 11:M=!1;case 12:case"end":return t.stop()}}),t)})));return function(n){return t.apply(this,arguments)}}(),w={"01":["Not","And","Or","XOr","Mux","DMux","Not16","And16","Or16","Mux16","Mux4Way16","Mux8Way16","DMux4Way","DMux8Way","Or8Way"],"02":["HalfAdder","FullAdder","Add16","Inc16","AluNoStat","ALU"],"03":["Bit","Register","PC","RAM8","RAM64","RAM512","RAM4k","RAM16k"],"05":["Memory","CPU","Computer"]},R={"06":["Add","Max","Rectangle","Pong"]},D=(0,d.Z)((0,d.Z)((0,d.Z)((0,d.Z)({},i),k),f),z)}}]); +//# sourceMappingURL=277.355c3689.chunk.js.map \ No newline at end of file diff --git a/web/build/static/js/277.355c3689.chunk.js.map b/web/build/static/js/277.355c3689.chunk.js.map new file mode 100644 index 000000000..dfd5776a9 --- /dev/null +++ b/web/build/static/js/277.355c3689.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/277.355c3689.chunk.js","mappings":"4qBAkBaA,EAAQ,CACnBC,IAAK,CACH,UCjBe,qFDkBf,UCVe,wFDWf,UCtBe,2DDwBjBC,IAAK,CACH,UEzBe,uLF0Bf,UEfe,gLFgBf,UEVe,yIFYjBC,GAAI,CACF,SGzBe,yHH0Bf,SGhBe,kLHiBf,SGhCe,yIHkCjBC,IAAK,CACH,UI9Be,+GJ+Bf,UIrBe,kLJsBf,UIrCe,yIJuCjBC,IAAK,CACH,UK/Be,mHLgCf,UKxBe,uVLyBf,UK1Ce,6TL4CjBC,KAAM,CACJ,WM7Ce,wJN8Cf,WMlCe,sLNmCf,WM3Be,iLN6BjBC,MAAO,CACL,YOlDe,sHPmDf,YO3Ce,wPP4Cf,YOtCe,wPPwCjBC,MAAO,CACL,YQvDe,0IRwDf,YQhDe,mcRiDf,YQxCe,saR0CjBC,KAAM,CACJ,WSrDe,wITsDf,WS9Ce,icT+Cf,WS9De,saTgEjBC,MAAO,CACL,YUxDe,wIVyDf,YUjDe,gcVkDf,YUnEe,olBVqEjBC,UAAW,CACT,gBW7De,wOX8Df,gBWhDe,8aXiDf,gBWxEe,m7BX0EjBC,UAAW,CACT,gBY1De,+QZ2Df,gBY3Ce,kzBZ4Cf,gBY7Ee,whGZ+EjBC,SAAU,CACR,eahFe,yQbiFf,eanEe,wUboEf,eaxDe,0Wb0DjBC,SAAU,CACR,ecrFe,iUdsFf,ectEe,omBduEf,ecnDe,kkCdqDjBC,OAAQ,CACN,aepFe,mIfqFf,ae3Ee,gNf4Ef,ae5Fe,uIfgGZ,SAAeC,EAAW,GAAD,+BAI/B,8CAJM,WAA0BC,GAAc,sFACvCA,EAAGC,MAAM,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AAG,uBACzB8B,EAAsB9B,GAAG,wBACzB+B,EAAsB/B,GAAG,QAC/BE,GAAQ,EAAM,4CACf,gBARsB,sCAUV8B,EAA6D,CACxE,KAAM,CACJ,MACA,MACA,KACA,MACA,MACA,OACA,QACA,QACA,OACA,QACA,YACA,YACA,WACA,WACA,UAEF,KAAM,CACJ,YACA,YACA,QACA,QACA,YACA,OAGF,KAAM,CAAC,MAAO,WAAY,KAAM,OAAQ,QAAS,SAAU,QAAS,UACpE,KAAM,CAAC,SAAU,MAAO,aAGbC,EAAuC,CAClD,KAAM,CAAC,MAAO,MAAO,YAAa,SAGvBC,GAAc,kCACtBN,GACAC,GACAC,GACAC,E","sources":["../../projects/src/project_01/index.ts","../../projects/src/project_01/01_not.ts","../../projects/src/project_01/02_and.ts","../../projects/src/project_01/03_or.ts","../../projects/src/project_01/04_xor.ts","../../projects/src/project_01/05_mux.ts","../../projects/src/project_01/06_dmux.ts","../../projects/src/project_01/07_not16.ts","../../projects/src/project_01/08_and16.ts","../../projects/src/project_01/09_or16.ts","../../projects/src/project_01/10_mux16.ts","../../projects/src/project_01/11_mux4way16.ts","../../projects/src/project_01/12_mux8way16.ts","../../projects/src/project_01/13_dmux4way.ts","../../projects/src/project_01/14_dmux8way.ts","../../projects/src/project_01/15_or8way.ts","../../projects/src/project_02/01_half_adder.ts","../../projects/src/project_02/index.ts","../../projects/src/project_02/02_full_adder.ts","../../projects/src/project_02/03_add16.ts","../../projects/src/project_02/04_inc16.ts","../../projects/src/project_02/05_alu_no_stat.ts","../../projects/src/project_02/06_alu.ts","../../projects/src/project_02/06_alu_all.ts","../../projects/src/project_03/01_bit.ts","../../projects/src/project_03/index.ts","../../projects/src/project_03/02_register.ts","../../projects/src/project_03/03_pc.ts","../../projects/src/project_03/04_ram8.ts","../../projects/src/project_03/05_ram64.ts","../../projects/src/project_03/06_ram512.ts","../../projects/src/project_03/07_ram4k.ts","../../projects/src/project_03/08_ram16k.ts","../../projects/src/project_05/01_memory.ts","../../projects/src/project_05/index.ts","../../projects/src/project_05/02_cpu.ts","../../projects/src/project_05/03_computer.ts","../../projects/src/index.ts"],"sourcesContent":["import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Not from \"./01_not.js\";\nimport * as And from \"./02_and.js\";\nimport * as Or from \"./03_or.js\";\nimport * as Xor from \"./04_xor.js\";\nimport * as Mux from \"./05_mux.js\";\nimport * as DMux from \"./06_dmux.js\";\nimport * as Not16 from \"./07_not16.js\";\nimport * as And16 from \"./08_and16.js\";\nimport * as Or16 from \"./09_or16.js\";\nimport * as Mux16 from \"./10_mux16.js\";\nimport * as Mux4Way16 from \"./11_mux4way16.js\";\nimport * as Mux8Way16 from \"./12_mux8way16.js\";\nimport * as DMux4Way from \"./13_dmux4way.js\";\nimport * as DMux8Way from \"./14_dmux8way.js\";\nimport * as Or8Way from \"./15_or8way.js\";\n\nexport const CHIPS = {\n Not: {\n \"Not.hdl\": Not.hdl,\n \"Not.tst\": Not.tst,\n \"Not.cmp\": Not.cmp,\n },\n And: {\n \"And.hdl\": And.hdl,\n \"And.tst\": And.tst,\n \"And.cmp\": And.cmp,\n },\n Or: {\n \"Or.hdl\": Or.hdl,\n \"Or.tst\": Or.tst,\n \"Or.cmp\": Or.cmp,\n },\n XOr: {\n \"XOr.hdl\": Xor.hdl,\n \"XOr.tst\": Xor.tst,\n \"XOr.cmp\": Xor.cmp,\n },\n Mux: {\n \"Mux.hdl\": Mux.hdl,\n \"Mux.tst\": Mux.tst,\n \"Mux.cmp\": Mux.cmp,\n },\n DMux: {\n \"DMux.hdl\": DMux.hdl,\n \"DMux.tst\": DMux.tst,\n \"DMux.cmp\": DMux.cmp,\n },\n Not16: {\n \"Not16.hdl\": Not16.hdl,\n \"Not16.tst\": Not16.tst,\n \"Not16.cmp\": Not16.cmp,\n },\n And16: {\n \"And16.hdl\": And16.hdl,\n \"And16.tst\": And16.tst,\n \"And16.cmp\": And16.cmp,\n },\n Or16: {\n \"Or16.hdl\": Or16.hdl,\n \"Or16.tst\": Or16.tst,\n \"Or16.cmp\": Or16.cmp,\n },\n Mux16: {\n \"Mux16.hdl\": Mux16.hdl,\n \"Mux16.tst\": Mux16.tst,\n \"Mux16.cmp\": Mux16.cmp,\n },\n Mux4Way16: {\n \"Mux4Way16.hdl\": Mux4Way16.hdl,\n \"Mux4Way16.tst\": Mux4Way16.tst,\n \"Mux4Way16.cmp\": Mux4Way16.cmp,\n },\n Mux8Way16: {\n \"Mux8Way16.hdl\": Mux8Way16.hdl,\n \"Mux8Way16.tst\": Mux8Way16.tst,\n \"Mux8Way16.cmp\": Mux8Way16.cmp,\n },\n DMux4Way: {\n \"DMux4Way.hdl\": DMux4Way.hdl,\n \"DMux4Way.tst\": DMux4Way.tst,\n \"DMux4Way.cmp\": DMux4Way.cmp,\n },\n DMux8Way: {\n \"DMux8Way.hdl\": DMux8Way.hdl,\n \"DMux8Way.tst\": DMux8Way.tst,\n \"DMux8Way.cmp\": DMux8Way.cmp,\n },\n Or8Way: {\n \"Or8Way.hdl\": Or8Way.hdl,\n \"Or8Way.tst\": Or8Way.tst,\n \"Or8Way.cmp\": Or8Way.cmp,\n },\n};\n\nexport async function resetFiles(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/01\");\n await reset(fs, CHIPS);\n await fs.popd();\n}\n","export const cmp = `| in | out |\n| 0 | 1 |\n| 1 | 0 |`;\nexport const hdl = `// Not gate: out = not in\n\nCHIP Not {\n IN in;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list in%B3.1.3 out%B3.1.3;\n\nset in 0, eval, output;\nset in 1, eval, output;`;\n","export const hdl = `/**\n * And gate: out = 1 if {a==1 and b==1}, 0 otherwise\n * And gate: if {a==1 and b==1} then out = 1 else out = 0\n */\n\nCHIP And {\n IN a, b;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;`;\n\nexport const cmp = `| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 0 |\n| 1 | 0 | 0 |\n| 1 | 1 | 1 |`;\n","export const cmp = `| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 1 |\n| 1 | 0 | 1 |\n| 1 | 1 | 1 |`;\nexport const hdl = `/**\n * Or gate: out = 1 if {a==1 or b==1}, 0 otherwise\n */\n\nCHIP Or {\n IN a, b;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;`;\n","export const cmp = `| a | b | out |\n| 0 | 0 | 0 |\n| 0 | 1 | 1 |\n| 1 | 0 | 1 |\n| 1 | 1 | 0 |`;\nexport const hdl = `/**\n * Exclusive-or gate: out = !(a == b).\n */\n\nCHIP XOr {\n IN a, b;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, eval, output;\nset a 0, set b 1, eval, output;\nset a 1, set b 0, eval, output;\nset a 1, set b 1, eval, output;`;\n","export const cmp = `| a | b | sel | out |\n| 0 | 0 | 0 | 0 |\n| 0 | 0 | 1 | 0 |\n| 0 | 1 | 0 | 0 |\n| 0 | 1 | 1 | 1 |\n| 1 | 0 | 0 | 1 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |\n| 1 | 1 | 1 | 1 |`;\nexport const hdl = `// Multiplexor. If sel==1 then out=b else out=a.\n\nCHIP Mux {\n IN a, b, sel;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 sel%B3.1.3 out%B3.1.3;\n\nset a 0, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 0, set b 1, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 1, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a 1, set b 1, set sel 0, eval, output;\nset sel 1, eval, output;`;\n","export const hdl = `/**\n * Demultiplexor.\n * {a,b} = {in,0} if sel==0\n * {0,in} if sel==1\n */\n\nCHIP DMux {\n IN in, sel;\n OUT a, b;\n\n PARTS:\n}`;\nexport const tst = `output-list in%B3.1.3 sel%B3.1.3 a%B3.1.3 b%B3.1.3;\n\nset in 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset in 1, set sel 0, eval, output;\nset sel 1, eval, output;`;\n\nexport const cmp = `| in | sel | a | b |\n| 0 | 0 | 0 | 0 |\n| 0 | 1 | 0 | 0 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |`;\n","export const hdl = `// 16-bit Not gate: for i=0..15: out[i] = not in[i]\n\nCHIP Not16 {\n IN in[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list in%B1.16.1 out%B1.16.1;\nset in %B0000000000000000, eval, output;\nset in %B1111111111111111, eval, output;\nset in %B1010101010101010, eval, output;\nset in %B0011110011000011, eval, output;\nset in %B0001001000110100, eval, output;`;\nexport const cmp = `| in | out |\n| 0000000000000000 | 1111111111111111 |\n| 1111111111111111 | 0000000000000000 |\n| 1010101010101010 | 0101010101010101 |\n| 0011110011000011 | 1100001100111100 |\n| 0001001000110100 | 1110110111001011 |`;\n","export const hdl = `// 16-bit-wise and gate: for i = 0..15: out[i] = a[i] and b[i]\n\nCHIP And16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\n\nset a %B0000000000000000, set b %B0000000000000000, eval, output;\nset a %B0000000000000000, set b %B1111111111111111, eval, output;\nset a %B1111111111111111, set b %B1111111111111111, eval, output;\nset a %B1010101010101010, set b %B0101010101010101, eval, output;\nset a %B0011110011000011, set b %B0000111111110000, eval, output;\nset a %B0001001000110100, set b %B1001100001110110, eval, output;`;\n\nexport const cmp = `| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0000000000000000 |\n| 1111111111111111 | 1111111111111111 | 1111111111111111 |\n| 1010101010101010 | 0101010101010101 | 0000000000000000 |\n| 0011110011000011 | 0000111111110000 | 0000110011000000 |\n| 0001001000110100 | 1001100001110110 | 0001000000110100 |`;\n","export const cmp = `| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1111111111111111 |\n| 1111111111111111 | 1111111111111111 | 1111111111111111 |\n| 1010101010101010 | 0101010101010101 | 1111111111111111 |\n| 0011110011000011 | 0000111111110000 | 0011111111110011 |\n| 0001001000110100 | 1001100001110110 | 1001101001110110 |`;\nexport const hdl = `// 16-bit bitwise Or gate: for i=0..15 out[i] = a[i] or b[i].\n\nCHIP Or16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\nset a %B0000000000000000, set b %B0000000000000000, eval, output;\nset a %B0000000000000000, set b %B1111111111111111, eval, output;\nset a %B1111111111111111, set b %B1111111111111111, eval, output;\nset a %B1010101010101010, set b %B0101010101010101, eval, output;\nset a %B0011110011000011, set b %B0000111111110000, eval, output;\nset a %B0001001000110100, set b %B1001100001110110, eval, output;`;\n","export const cmp = `| a | b | sel | out |\n| 0000000000000000 | 0000000000000000 | 0 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 1 | 0000000000000000 |\n| 0000000000000000 | 0001001000110100 | 0 | 0000000000000000 |\n| 0000000000000000 | 0001001000110100 | 1 | 0001001000110100 |\n| 1001100001110110 | 0000000000000000 | 0 | 1001100001110110 |\n| 1001100001110110 | 0000000000000000 | 1 | 0000000000000000 |\n| 1010101010101010 | 0101010101010101 | 0 | 1010101010101010 |\n| 1010101010101010 | 0101010101010101 | 1 | 0101010101010101 |`;\nexport const hdl = `// 16 bit multiplexor. If sel==1 then out=b else out=a.\n\nCHIP Mux16 {\n IN a[16], b[16], sel;\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 sel%D2.1.2 out%B1.16.1;\n\nset a 0, set b 0, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B0000000000000000, set b %B0001001000110100, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B1001100001110110, set b %B0000000000000000, set sel 0, eval, output;\nset sel 1, eval, output;\n\nset a %B1010101010101010, set b %B0101010101010101, set sel 0, eval, output;\nset sel 1, eval, output;`;\n","export const cmp = `| a | b | c | d | sel | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 00 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 01 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 10 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 11 | 0000000000000000 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 00 | 0001001000110100 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 01 | 1001100001110110 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 10 | 1010101010101010 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 11 | 0101010101010101 |`;\nexport const hdl = `/**\n * 4-way 16-bit multiplexor.\n * out = a if sel==00\n * b if sel==01\n * c if sel==10\n * d if sel==11\n */\n\nCHIP Mux4Way16 {\n IN a[16], b[16], c[16], d[16], sel[2];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 sel%B2.2.2 out%B1.16.1;\n\nset a 0, set b 0, set c 0, set d 0, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\n\nset a %B0001001000110100, set b %B1001100001110110, set c %B1010101010101010, set d %B0101010101010101, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;`;\n","export const cmp = `| a | b | c | d | e | f | g | h | sel | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 000 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 001 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 010 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 011 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 100 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 101 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 110 | 0000000000000000 |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 111 | 0000000000000000 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 000 | 0001001000110100 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0011010001010110 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 011 | 0100010101100111 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 100 | 0101011001111000 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 101 | 0110011110001001 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 110 | 0111100010011010 |\n| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 111 | 1000100110101011 |`;\nexport const hdl = `/**\n * 8-way 16-bit multiplexor.\n * out = a if sel==000\n * b if sel==001\n * etc.\n * h if sel==111\n */\n\nCHIP Mux8Way16 {\n IN a[16], b[16], c[16], d[16],\n e[16], f[16], g[16], h[16],\n sel[3];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 e%B1.16.1 f%B1.16.1 g%B1.16.1 h%B1.16.1 sel%B2.3.2 out%B1.16.1;\n\nset a 0, set b 0, set c 0, set d 0, set e 0, set f 0, set g 0, set h 0, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\nset sel 4, eval, output;\nset sel 5, eval, output;\nset sel 6, eval, output;\nset sel 7, eval, output;\n\nset a %B0001001000110100, set b %B0010001101000101, set c %B0011010001010110, set d %B0100010101100111, set e %B0101011001111000, set f %B0110011110001001, set g %B0111100010011010, set h %B1000100110101011, set sel 0, eval, output;\nset sel 1, eval, output;\nset sel 2, eval, output;\nset sel 3, eval, output;\nset sel 4, eval, output;\nset sel 5, eval, output;\nset sel 6, eval, output;\nset sel 7, eval, output;`;\n","export const hdl = `/**\n * 4-way demultiplexor.\n * {a,b,c,d} = {in,0,0,0} if sel==00\n * {0,in,0,0} if sel==01\n * {0,0,in,0} if sel==10\n * {0,0,0,in} if sel==11\n */\n\nCHIP DMux4Way {\n IN in, sel[2];\n OUT a, b, c, d;\n\n PARTS:\n}`;\nexport const tst = `output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2;\n\nset in 0, set sel %B00, eval, output;\nset sel %B01, eval, output;\nset sel %B10, eval, output;\nset sel %B11, eval, output;\n\nset in 1, set sel %B00, eval, output;\nset sel %B01, eval, output;\nset sel %B10, eval, output;\nset sel %B11, eval, output;`;\n\nexport const cmp = `| in | sel | a | b | c | d |\n| 0 | 00 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 1 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 1 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 1 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 1 |`;\n","export const hdl = `/**\n * 8-way demultiplexor.\n * {a,b,c,d,e,f,g,h} = {in,0,0,0,0,0,0,0} if sel==000\n * {0,in,0,0,0,0,0,0} if sel==001\n * etc.\n * {0,0,0,0,0,0,0,in} if sel==111\n */\n\n\nCHIP DMux8Way {\n IN in, sel[3];\n OUT a, b, c, d, e, f, g, h;\n\n PARTS:\n}`;\n\nexport const tst = `output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2 e%B2.1.2 f%B2.1.2 g%B2.1.2 h%B2.1.2;\n\nset in 0, set sel %B000, eval, output;\nset sel %B001, eval, output;\nset sel %B010, eval, output;\nset sel %B011, eval, output;\nset sel %B100, eval, output;\nset sel %B101, eval, output;\nset sel %B110, eval, output;\nset sel %B111, eval, output;\n\nset in 1, set sel %B000, eval, output;\nset sel %B001, eval, output;\nset sel %B010, eval, output;\nset sel %B011, eval, output;\nset sel %B100, eval, output;\nset sel %B101, eval, output;\nset sel %B110, eval, output;\nset sel %B111, eval, output;`;\n\nexport const cmp = `| in | sel | a | b | c | d | e | f | g | h |\n| 0 | 00 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 00 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 01 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 0 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |\n| 1 | 00 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |\n| 1 | 01 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |\n| 1 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |\n| 1 | 11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |`;\n","export const cmp = `| in | out |\n| 00000000 | 0 |\n| 11111111 | 1 |\n| 00010000 | 1 |\n| 00000001 | 1 |\n| 00100110 | 1 |`;\nexport const hdl = `/**\n * 8-way or gate: out = in[0] or in[1] or ... or in[7].\n */\n\nCHIP Or8Way {\n IN in[8];\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list in%B2.8.2 out%B2.1.2;\n\nset in %B00000000, eval, output;\nset in %B11111111, eval, output;\nset in %B00010000, eval, output;\nset in %B00000001, eval, output;\nset in %B00100110, eval, output;`;\n","export const hdl = `// Computes the sum of two bits.\n\nCHIP HalfAdder {\n IN a, b; // 1-bit inputs\n OUT sum, // Right bit of a + b \n carry; // Left bit of a + b\n\n PARTS:\n}`;\nexport const cmp = `| a | b | sum | carry |\n| 0 | 0 | 0 | 0 |\n| 0 | 1 | 1 | 0 |\n| 1 | 0 | 1 | 0 |\n| 1 | 1 | 0 | 1 |`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 sum%B3.1.3 carry%B3.1.3;\n\nset a 0,\nset b 0,\neval,\noutput;\n\nset a 0,\nset b 1,\neval,\noutput;\n\nset a 1,\nset b 0,\neval,\noutput;\n\nset a 1,\nset b 1,\neval,\noutput;`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as HalfAdder from \"./01_half_adder.js\";\nimport * as FullAdder from \"./02_full_adder.js\";\nimport * as Add16 from \"./03_add16.js\";\nimport * as Inc16 from \"./04_inc16.js\";\nimport * as Alu from \"./05_alu_no_stat.js\";\nimport * as AluStatus from \"./06_alu.js\";\nimport * as AluAll from \"./06_alu_all.js\";\n\nexport const CHIPS = {\n HalfAdder: {\n \"HalfAdder.hdl\": HalfAdder.hdl,\n \"HalfAdder.tst\": HalfAdder.tst,\n \"HalfAdder.cmp\": HalfAdder.cmp,\n },\n FullAdder: {\n \"FullAdder.hdl\": FullAdder.hdl,\n \"FullAdder.tst\": FullAdder.tst,\n \"FullAdder.cmp\": FullAdder.cmp,\n },\n Add16: {\n \"Add16.hdl\": Add16.hdl,\n \"Add16.tst\": Add16.tst,\n \"Add16.cmp\": Add16.cmp,\n },\n Inc16: {\n \"Inc16.hdl\": Inc16.hdl,\n \"Inc16.tst\": Inc16.tst,\n \"Inc16.cmp\": Inc16.cmp,\n },\n AluNoStat: {\n \"AluNoStat.hdl\": Alu.hdl,\n \"AluNoStat.tst\": Alu.tst,\n \"AluNoStat.cmp\": Alu.cmp,\n },\n ALU: {\n \"ALU.hdl\": AluStatus.hdl,\n \"ALU.tst\": AluStatus.tst,\n \"ALU.cmp\": AluStatus.cmp,\n },\n ALUAll: {\n \"ALUAll.hdl\": AluAll.hdl,\n \"ALUAll.tst\": AluAll.tst,\n \"ALUAll.cmp\": AluAll.cmp,\n },\n};\n\nexport async function resetFiles(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/02\");\n await reset(fs, CHIPS);\n await fs.popd();\n}\n","export const hdl = `// Computes the sum of three bits.\n\nCHIP FullAdder {\n IN a, b, c; // 1-bit inputs\n OUT sum, // Right bit of a + b + c\n carry; // Left bit of a + b + c\n\n PARTS:\n}`;\nexport const cmp = `| a | b | c | sum | carry |\n| 0 | 0 | 0 | 0 | 0 |\n| 0 | 0 | 1 | 1 | 0 |\n| 0 | 1 | 0 | 1 | 0 |\n| 0 | 1 | 1 | 0 | 1 |\n| 1 | 0 | 0 | 1 | 0 |\n| 1 | 0 | 1 | 0 | 1 |\n| 1 | 1 | 0 | 0 | 1 |\n| 1 | 1 | 1 | 1 | 1 |`;\nexport const tst = `output-list a%B3.1.3 b%B3.1.3 c%B3.1.3 sum%B3.1.3 carry%B3.1.3;\n\nset a 0,\nset b 0,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset b 1,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset a 1,\nset b 0,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;\n\nset b 1,\nset c 0,\neval,\noutput;\n\nset c 1,\neval,\noutput;`;\n","export const hdl = `/**\n* Adds two 16-bit values.\n* The most significant carry bit is ignored.\n*/\n\nCHIP Add16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const cmp = `| a | b | out |\n| 0000000000000000 | 0000000000000000 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1111111111111111 |\n| 1111111111111111 | 1111111111111111 | 1111111111111110 |\n| 1010101010101010 | 0101010101010101 | 1111111111111111 |\n| 0011110011000011 | 0000111111110000 | 0100110010110011 |\n| 0001001000110100 | 1001100001110110 | 1010101010101010 |`;\nexport const tst = `output-list a%B1.16.1 b%B1.16.1 out%B1.16.1;\n\nset a %B0000000000000000,\nset b %B0000000000000000,\neval,\noutput;\n\nset a %B0000000000000000,\nset b %B1111111111111111,\neval,\noutput;\n\nset a %B1111111111111111,\nset b %B1111111111111111,\neval,\noutput;\n\nset a %B1010101010101010,\nset b %B0101010101010101,\neval,\noutput;\n\nset a %B0011110011000011,\nset b %B0000111111110000,\neval,\noutput;\n\nset a %B0001001000110100,\nset b %B1001100001110110,\neval,\noutput;`;\n","export const hdl = `/**\n* 16-bit incrementer:\n* out = in + 1 (arithmetic addition)\n*/\n\nCHIP Inc16 {\n IN in[16];\n OUT out[16];\n\n PARTS:\n}`;\nexport const cmp = `| in | out |\n| 0000000000000000 | 0000000000000001 |\n| 1111111111111111 | 0000000000000000 |\n| 0000000000000101 | 0000000000000110 |\n| 1111111111111011 | 1111111111111100 |\n`;\nexport const tst = `output-list in%B1.16.1 out%B1.16.1;\n\nset in %B0000000000000000, // in = 0\neval,\noutput;\n\nset in %B1111111111111111, // in = -1\neval,\noutput;\n\nset in %B0000000000000101, // in = 5\neval,\noutput;\n\nset in %B1111111111111011, // in = -5\neval,\noutput;`;\n","export const hdl = `/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16]; // 16-bit output\n\n PARTS:\n}`;\nexport const cmp = `| x | y |zx |nx |zy |ny | f |no | out |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 |\n| 0101101110100000 | 0001111011010010 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 0 | 0101101110100000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 0 | 0001111011010010 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 1 | 1010010001011111 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 1 | 1110000100101101 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 1 | 1010010001100000 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 1 | 1110000100101110 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 1 | 1 | 1 | 1 | 0101101110100001 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 1 | 1 | 1 | 0001111011010011 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 0 | 0101101110011111 |\n| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 0 | 0001111011010001 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 1 | 0 | 0111101001110010 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011110011001110 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100001100110010 |\n| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 0 | 0 | 0001101010000000 |\n| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 1 | 0 | 1 | 0101111111110010 |\n`;\nexport const tst = `\n// ALU no stat tst provides a partial test of the ALU chip.\n// It IS NOT a replacement for ALU.tst.\n\n// ALU-nostat.tst tests only the computation part of the ALU.\n// The 'zr' and 'ng' status outputs are ignored.\n\n// This test lets you concentrate on getting the ALU computation right without the\n// additional task of handling the status outputs.\n\n// Once your ALU passes ALU-nostat.tst you need to test it with ALU.tst.\n// This way, any comparison failures during ALU.tst will be caused by errors in\n// the handling of the 'zr' and 'ng' status outputs.\n\noutput-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \n ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1;\n\nset x %B0000000000000000,\nset y %B1111111111111111,\n\nset zx 1,\nset nx 0,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset x %B101101110100000,\nset y %B001111011010010,\n\nset zx 1,\nset nx 0,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 1,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 0,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 1,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 1,\nset ny 1,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 1,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 1,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 0,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 1,\nset f 1,\nset no 1,\neval,\noutput;\n\nset zx 0,\nset nx 0,\nset zy 0,\nset ny 0,\nset f 0,\nset no 0,\neval,\noutput;\n\nset zx 0,\nset nx 1,\nset zy 0,\nset ny 1,\nset f 0,\nset no 1,\neval,\noutput;`;\n","export const hdl = `/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16], // 16-bit output\n zr, // 1 if (out == 0), 0 otherwise\n ng; // 1 if (out < 0), 0 otherwise\n\n PARTS:\n}`;\nexport const cmp = `| x | y |zx |nx |zy |ny | f |no | out |zr |ng |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |`;\nexport const tst = `output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \nny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1\nng%B1.1.1;\n\nset x %B0000000000000000, // x = 0\nset y %B1111111111111111; // y = -1\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;\n\nset x %B000000000010001, // x = 17\nset y %B000000000000011; // y = 3\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;`;\n","export const hdl = `/**\n * The ALU (Arithmetic Logic Unit).\n * Computes one of the following functions:\n * x+y, x-y, y-x, 0, 1, -1, x, y, -x, -y, !x, !y,\n * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs, \n * according to 6 input bits denoted zx,nx,zy,ny,f,no.\n * \n * All operations:\n * Ensure your solution handles these undocumented opcodes:\n * \n * -2, !(x&y), !(x|y), !x&y, !(!x&y), !(x&!y), x&!y\n * x+y+1, x-y-1, -(x+2), -(y+2), -(x+y+2), -(x+y+1), -(x-y+1)\n * \n * In addition, the ALU computes two 1-bit outputs:\n * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0;\n * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0.\n */\n\n// Implementation: the ALU logic manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) set x = 0 // 16-bit constant\n// if (nx == 1) set x = !x // bitwise not\n// if (zy == 1) set y = 0 // 16-bit constant\n// if (ny == 1) set y = !y // bitwise not\n// if (f == 1) set out = x + y // integer 2's complement addition\n// if (f == 0) set out = x & y // bitwise and\n// if (no == 1) set out = !out // bitwise not\n// if (out == 0) set zr = 1\n// if (out < 0) set ng = 1\n\n// Testing: the test script below has tests for the undocumented instructions\n// listed first, and then has the tests for the documented ALU instructions.\n\nCHIP ALU {\n IN \n x[16], y[16], // 16-bit inputs \n zx, // zero the x input?\n nx, // negate the x input?\n zy, // zero the y input?\n ny, // negate the y input?\n f, // compute out = x + y (if 1) or x & y (if 0)\n no; // negate the out output?\n\n OUT \n out[16], // 16-bit output\n zr, // 1 if (out == 0), 0 otherwise\n ng; // 1 if (out < 0), 0 otherwise\n\n PARTS:\n // Put you code here:\n}`;\nexport const cmp = `| x | y |zx |nx |zy |ny | f |no | out |zr |ng |\n| 0000000000000000 | 0000000000000000 | 1 | 1 | 1 | 1 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 0 | 0 | 1 | 1111111111111110 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 1 | 0 | 0 | 1111111111111000 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 0 | 0 | 0 | 1111111111110100 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 1 | 0 | 0 | 0 | 1 | 1111111111111011 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 1 | 0 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000000011 | 0000000000000101 | 0 | 0 | 0 | 1 | 0 | 0 | 1111111111110010 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 1 | 1 | 1 | 0000000000100001 | 0 | 0 |\n| 0000000000001101 | 0000000000010011 | 0 | 0 | 0 | 1 | 1 | 0 | 1111111111111001 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 1 | 1 | 1 | 0 | 1111111111110001 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 1 | 1 | 0 | 1 | 1 | 0 | 1111111111101011 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 1 | 1 | 0 | 1111111111011110 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 0 | 0 | 0 | 1 | 1 | 1111111111011111 | 0 | 1 |\n| 0000000000001101 | 0000000000010011 | 0 | 1 | 0 | 0 | 1 | 0 | 0000000000000101 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 |\n| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 |\n| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 |`;\nexport const tst = `output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 \nny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1\nng%B1.1.1;\n\n// Compute -2 \nset x %B0000000000000000,\nset y %B0000000000000000,\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\nset x %B0000000000000011,\nset y %B0000000000000101;\n\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 1, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 0, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 0, set no 0, eval, output;\n\nset x %B0000000000001101, // x = 13\nset y %B0000000000010011; // y = 19\n\nset zx 0, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 0, eval, output;\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 1, set f 1, set no 0, eval, output;\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 1, eval, output;\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\nset x %B0000000000000000, // x = 0\nset y %B1111111111111111; // y = -1\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;\n\nset x %B000000000010001, // x = 17\nset y %B000000000000011; // y = 3\n\n// Compute 0\nset zx 1, set nx 0, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute 1\nset zx 1, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -1\nset zx 1, set nx 1, set zy 1, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 0, eval, output;\n\n// Compute y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute !x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 0, set no 1, eval, output;\n\n// Compute !y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 0, set no 1, eval, output;\n\n// Compute -x\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute -y\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute x + 1\nset zx 0, set nx 1, set zy 1, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute y + 1\nset zx 1, set nx 1, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x - 1\nset zx 0, set nx 0, set zy 1, set ny 1, set f 1, set no 0, eval, output;\n\n// Compute y - 1\nset zx 1, set nx 1, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x + y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 1, set no 0, eval, output;\n\n// Compute x - y\nset zx 0, set nx 1, set zy 0, set ny 0, set f 1, set no 1, eval, output;\n\n// Compute y - x\nset zx 0, set nx 0, set zy 0, set ny 1, set f 1, set no 1, eval, output;\n\n// Compute x & y\nset zx 0, set nx 0, set zy 0, set ny 0, set f 0, set no 0, eval, output;\n\n// Compute x | y\nset zx 0, set nx 1, set zy 0, set ny 1, set f 0, set no 1, eval, output;`;\n","export const hdl = `/**\n * 1-bit register:\n * If load[t] == 1 then out[t+1] = in[t]\n * else out does not change (out[t+1] = out[t])\n */\n\nCHIP Bit {\n IN in, load;\n OUT out;\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%B2.1.2 load%B2.1.2 out%B2.1.2;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 1, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 1, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 0, tick, output; tock, output;\nset in 0, set load 1, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;\nset in 1, set load 0, tick, output; tock, output;`;\nexport const cmp = `| time | in |load | out |\n| 0+ | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 |\n| 2 | 0 | 1 | 0 |\n| 2+ | 1 | 0 | 0 |\n| 3 | 1 | 0 | 0 |\n| 3+ | 1 | 1 | 0 |\n| 4 | 1 | 1 | 1 |\n| 4+ | 0 | 0 | 1 |\n| 5 | 0 | 0 | 1 |\n| 5+ | 1 | 0 | 1 |\n| 6 | 1 | 0 | 1 |\n| 6+ | 0 | 1 | 1 |\n| 7 | 0 | 1 | 0 |\n| 7+ | 1 | 1 | 0 |\n| 8 | 1 | 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 87 | 1 | 0 | 0 |\n| 87+ | 1 | 0 | 0 |\n| 88 | 1 | 0 | 0 |\n| 88+ | 1 | 0 | 0 |\n| 89 | 1 | 0 | 0 |\n| 89+ | 1 | 0 | 0 |\n| 90 | 1 | 0 | 0 |\n| 90+ | 1 | 0 | 0 |\n| 91 | 1 | 0 | 0 |\n| 91+ | 1 | 0 | 0 |\n| 92 | 1 | 0 | 0 |\n| 92+ | 1 | 0 | 0 |\n| 93 | 1 | 0 | 0 |\n| 93+ | 1 | 0 | 0 |\n| 94 | 1 | 0 | 0 |\n| 94+ | 1 | 0 | 0 |\n| 95 | 1 | 0 | 0 |\n| 95+ | 1 | 0 | 0 |\n| 96 | 1 | 0 | 0 |\n| 96+ | 1 | 0 | 0 |\n| 97 | 1 | 0 | 0 |\n| 97+ | 1 | 0 | 0 |\n| 98 | 1 | 0 | 0 |\n| 98+ | 1 | 0 | 0 |\n| 99 | 1 | 0 | 0 |\n| 99+ | 1 | 0 | 0 |\n| 100 | 1 | 0 | 0 |\n| 100+ | 1 | 0 | 0 |\n| 101 | 1 | 0 | 0 |\n| 101+ | 1 | 0 | 0 |\n| 102 | 1 | 0 | 0 |\n| 102+ | 1 | 0 | 0 |\n| 103 | 1 | 0 | 0 |\n| 103+ | 1 | 0 | 0 |\n| 104 | 1 | 0 | 0 |\n| 104+ | 1 | 0 | 0 |\n| 105 | 1 | 0 | 0 |\n| 105+ | 1 | 0 | 0 |\n| 106 | 1 | 0 | 0 |\n| 106+ | 1 | 0 | 0 |\n| 107 | 1 | 0 | 0 |`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Bit from \"./01_bit.js\";\nimport * as Register from \"./02_register.js\";\nimport * as PC from \"./03_pc.js\";\nimport * as RAM8 from \"./04_ram8.js\";\nimport * as RAM64 from \"./05_ram64.js\";\nimport * as RAM512 from \"./06_ram512.js\";\nimport * as RAM4k from \"./07_ram4k.js\";\nimport * as RAM16k from \"./08_ram16k.js\";\n\nexport const CHIPS = {\n Bit: {\n \"Bit.hdl\": Bit.hdl,\n \"Bit.tst\": Bit.tst,\n \"Bit.cmp\": Bit.cmp,\n },\n Register: {\n \"Register.hdl\": Register.hdl,\n \"Register.tst\": Register.tst,\n \"Register.cmp\": Register.cmp,\n },\n PC: {\n \"PC.hdl\": PC.hdl,\n \"PC.tst\": PC.tst,\n \"PC.cmp\": PC.cmp,\n },\n RAM8: {\n \"RAM8.hdl\": RAM8.hdl,\n \"RAM8.tst\": RAM8.tst,\n \"RAM8.cmp\": RAM8.cmp,\n },\n RAM64: {\n \"RAM64.hdl\": RAM64.hdl,\n \"RAM64.tst\": RAM64.tst,\n \"RAM64.cmp\": RAM64.cmp,\n },\n RAM512: {\n \"RAM512.hdl\": RAM512.hdl,\n \"RAM512.tst\": RAM512.tst,\n \"RAM512.cmp\": RAM512.cmp,\n },\n RAM4k: {\n \"RAM4k.hdl\": RAM4k.hdl,\n \"RAM4k.tst\": RAM4k.tst,\n \"RAM4k.cmp\": RAM4k.cmp,\n },\n RAM16k: {\n \"RAM16k.hdl\": RAM16k.hdl,\n \"RAM16k.tst\": RAM16k.tst,\n \"RAM16k.cmp\": RAM16k.cmp,\n },\n};\n\nexport async function resetFiles(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/03\");\n await reset(fs, CHIPS);\n await fs.popd();\n}\n","export const hdl = `/**\n * 16-bit register:\n * If load[t] == 1 then out[t+1] = in[t]\n * else out does not change\n */\n\nCHIP Register {\n IN in[16], load;\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst =\n `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 out%D1.6.1;\\n` +\n [\n [0, 0],\n [0, 1],\n [-32123, 0],\n [11111, 0],\n [-32123, 1],\n [-32123, 1],\n [-32123, 0],\n [12345, 1],\n [0, 0],\n [0, 1],\n ]\n .map(\n ([inn, load]) =>\n `set in ${inn}, set load ${load}, tick, output; tock, output;`\n )\n .join(\"\\n\") +\n \"\\n\" +\n [\n \"%B0000000000000001\",\n \"%B0000000000000010\",\n \"%B0000000000000100\",\n \"%B0000000000001000\",\n \"%B0000000000010000\",\n \"%B0000000000100000\",\n \"%B0000000001000000\",\n \"%B0000000010000000\",\n \"%B0000000100000000\",\n \"%B0000001000000000\",\n \"%B0000010000000000\",\n \"%B0000100000000000\",\n \"%B0001000000000000\",\n \"%B0010000000000000\",\n \"%B0100000000000000\",\n \"%B1000000000000000\",\n \"%B1111111111111110\",\n \"%B1111111111111101\",\n \"%B1111111111111011\",\n \"%B1111111111110111\",\n \"%B1111111111101111\",\n \"%B1111111111011111\",\n \"%B1111111110111111\",\n \"%B1111111101111111\",\n \"%B1111111011111111\",\n \"%B1111110111111111\",\n \"%B1111101111111111\",\n \"%B1111011111111111\",\n \"%B1110111111111111\",\n \"%B1101111111111111\",\n \"%B1011111111111111\",\n \"%B0111111111111111\",\n ]\n .map(\n (n) =>\n `set in ${n}, set load 0, tick, output; tock, output; set load 1, tick, output; tock, output;`\n )\n .join(\"\\n\");\n\nexport const cmp = `| time | in |load | out |\n| 0+ | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 |\n| 2 | 0 | 1 | 0 |\n| 2+ | -32123 | 0 | 0 |\n| 3 | -32123 | 0 | 0 |\n| 3+ | 11111 | 0 | 0 |\n| 4 | 11111 | 0 | 0 |\n| 4+ | -32123 | 1 | 0 |\n| 5 | -32123 | 1 | -32123 |\n| 5+ | -32123 | 1 | -32123 |\n| 6 | -32123 | 1 | -32123 |\n| 6+ | -32123 | 0 | -32123 |\n| 7 | -32123 | 0 | -32123 |\n| 7+ | 12345 | 1 | -32123 |\n| 8 | 12345 | 1 | 12345 |\n| 8+ | 0 | 0 | 12345 |\n| 9 | 0 | 0 | 12345 |\n| 9+ | 0 | 1 | 12345 |\n| 10 | 0 | 1 | 0 |\n| 10+ | 1 | 0 | 0 |\n| 11 | 1 | 0 | 0 |\n| 11+ | 1 | 1 | 0 |\n| 12 | 1 | 1 | 1 |\n| 12+ | 2 | 0 | 1 |\n| 13 | 2 | 0 | 1 |\n| 13+ | 2 | 1 | 1 |\n| 14 | 2 | 1 | 2 |\n| 14+ | 4 | 0 | 2 |\n| 15 | 4 | 0 | 2 |\n| 15+ | 4 | 1 | 2 |\n| 16 | 4 | 1 | 4 |\n| 16+ | 8 | 0 | 4 |\n| 17 | 8 | 0 | 4 |\n| 17+ | 8 | 1 | 4 |\n| 18 | 8 | 1 | 8 |\n| 18+ | 16 | 0 | 8 |\n| 19 | 16 | 0 | 8 |\n| 19+ | 16 | 1 | 8 |\n| 20 | 16 | 1 | 16 |\n| 20+ | 32 | 0 | 16 |\n| 21 | 32 | 0 | 16 |\n| 21+ | 32 | 1 | 16 |\n| 22 | 32 | 1 | 32 |\n| 22+ | 64 | 0 | 32 |\n| 23 | 64 | 0 | 32 |\n| 23+ | 64 | 1 | 32 |\n| 24 | 64 | 1 | 64 |\n| 24+ | 128 | 0 | 64 |\n| 25 | 128 | 0 | 64 |\n| 25+ | 128 | 1 | 64 |\n| 26 | 128 | 1 | 128 |\n| 26+ | 256 | 0 | 128 |\n| 27 | 256 | 0 | 128 |\n| 27+ | 256 | 1 | 128 |\n| 28 | 256 | 1 | 256 |\n| 28+ | 512 | 0 | 256 |\n| 29 | 512 | 0 | 256 |\n| 29+ | 512 | 1 | 256 |\n| 30 | 512 | 1 | 512 |\n| 30+ | 1024 | 0 | 512 |\n| 31 | 1024 | 0 | 512 |\n| 31+ | 1024 | 1 | 512 |\n| 32 | 1024 | 1 | 1024 |\n| 32+ | 2048 | 0 | 1024 |\n| 33 | 2048 | 0 | 1024 |\n| 33+ | 2048 | 1 | 1024 |\n| 34 | 2048 | 1 | 2048 |\n| 34+ | 4096 | 0 | 2048 |\n| 35 | 4096 | 0 | 2048 |\n| 35+ | 4096 | 1 | 2048 |\n| 36 | 4096 | 1 | 4096 |\n| 36+ | 8192 | 0 | 4096 |\n| 37 | 8192 | 0 | 4096 |\n| 37+ | 8192 | 1 | 4096 |\n| 38 | 8192 | 1 | 8192 |\n| 38+ | 16384 | 0 | 8192 |\n| 39 | 16384 | 0 | 8192 |\n| 39+ | 16384 | 1 | 8192 |\n| 40 | 16384 | 1 | 16384 |\n| 40+ | -32768 | 0 | 16384 |\n| 41 | -32768 | 0 | 16384 |\n| 41+ | -32768 | 1 | 16384 |\n| 42 | -32768 | 1 | -32768 |\n| 42+ | -2 | 0 | -32768 |\n| 43 | -2 | 0 | -32768 |\n| 43+ | -2 | 1 | -32768 |\n| 44 | -2 | 1 | -2 |\n| 44+ | -3 | 0 | -2 |\n| 45 | -3 | 0 | -2 |\n| 45+ | -3 | 1 | -2 |\n| 46 | -3 | 1 | -3 |\n| 46+ | -5 | 0 | -3 |\n| 47 | -5 | 0 | -3 |\n| 47+ | -5 | 1 | -3 |\n| 48 | -5 | 1 | -5 |\n| 48+ | -9 | 0 | -5 |\n| 49 | -9 | 0 | -5 |\n| 49+ | -9 | 1 | -5 |\n| 50 | -9 | 1 | -9 |\n| 50+ | -17 | 0 | -9 |\n| 51 | -17 | 0 | -9 |\n| 51+ | -17 | 1 | -9 |\n| 52 | -17 | 1 | -17 |\n| 52+ | -33 | 0 | -17 |\n| 53 | -33 | 0 | -17 |\n| 53+ | -33 | 1 | -17 |\n| 54 | -33 | 1 | -33 |\n| 54+ | -65 | 0 | -33 |\n| 55 | -65 | 0 | -33 |\n| 55+ | -65 | 1 | -33 |\n| 56 | -65 | 1 | -65 |\n| 56+ | -129 | 0 | -65 |\n| 57 | -129 | 0 | -65 |\n| 57+ | -129 | 1 | -65 |\n| 58 | -129 | 1 | -129 |\n| 58+ | -257 | 0 | -129 |\n| 59 | -257 | 0 | -129 |\n| 59+ | -257 | 1 | -129 |\n| 60 | -257 | 1 | -257 |\n| 60+ | -513 | 0 | -257 |\n| 61 | -513 | 0 | -257 |\n| 61+ | -513 | 1 | -257 |\n| 62 | -513 | 1 | -513 |\n| 62+ | -1025 | 0 | -513 |\n| 63 | -1025 | 0 | -513 |\n| 63+ | -1025 | 1 | -513 |\n| 64 | -1025 | 1 | -1025 |\n| 64+ | -2049 | 0 | -1025 |\n| 65 | -2049 | 0 | -1025 |\n| 65+ | -2049 | 1 | -1025 |\n| 66 | -2049 | 1 | -2049 |\n| 66+ | -4097 | 0 | -2049 |\n| 67 | -4097 | 0 | -2049 |\n| 67+ | -4097 | 1 | -2049 |\n| 68 | -4097 | 1 | -4097 |\n| 68+ | -8193 | 0 | -4097 |\n| 69 | -8193 | 0 | -4097 |\n| 69+ | -8193 | 1 | -4097 |\n| 70 | -8193 | 1 | -8193 |\n| 70+ | -16385 | 0 | -8193 |\n| 71 | -16385 | 0 | -8193 |\n| 71+ | -16385 | 1 | -8193 |\n| 72 | -16385 | 1 | -16385 |\n| 72+ | 32767 | 0 | -16385 |\n| 73 | 32767 | 0 | -16385 |\n| 73+ | 32767 | 1 | -16385 |\n| 74 | 32767 | 1 | 32767 |`;\n","export const hdl = `/**\n * A 16-bit counter with load and reset control bits.\n * if (reset[t] == 1) out[t+1] = 0\n * else if (load[t] == 1) out[t+1] = in[t]\n * else if (inc[t] == 1) out[t+1] = out[t] + 1 (integer addition)\n * else out[t+1] = out[t]\n */\n\nCHIP PC {\n IN in[16], load, inc, reset;\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 reset%B2.1.2 load%B2.1.2 inc%B2.1.2 out%D1.6.1;\n\nset in 0, set reset 0, set load 0, set inc 0, tick, output;\ntock, output;\n\nset inc 1, tick, output; tock, output;\nset in -32123, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\ntick, output; tock, output;\nset in 12345, set load 1, set inc 0, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset reset 0, set inc 1, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset reset 0, set load 0, tick, output; tock, output;\nset reset 1, tick, output; tock, output;\nset in 0, set reset 0, set load 1, tick, output; tock, output;\nset load 0, set inc 1, tick, output; tock, output;\nset in 22222, set reset 1, set inc 0, tick, output; tock, output;`;\nexport const cmp = `| time | in |reset|load | inc | out |\n| 0+ | 0 | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 0 | 0 | 1 | 0 |\n| 2 | 0 | 0 | 0 | 1 | 1 |\n| 2+ | -32123 | 0 | 0 | 1 | 1 |\n| 3 | -32123 | 0 | 0 | 1 | 2 |\n| 3+ | -32123 | 0 | 1 | 1 | 2 |\n| 4 | -32123 | 0 | 1 | 1 | -32123 |\n| 4+ | -32123 | 0 | 0 | 1 | -32123 |\n| 5 | -32123 | 0 | 0 | 1 | -32122 |\n| 5+ | -32123 | 0 | 0 | 1 | -32122 |\n| 6 | -32123 | 0 | 0 | 1 | -32121 |\n| 6+ | 12345 | 0 | 1 | 0 | -32121 |\n| 7 | 12345 | 0 | 1 | 0 | 12345 |\n| 7+ | 12345 | 1 | 1 | 0 | 12345 |\n| 8 | 12345 | 1 | 1 | 0 | 0 |\n| 8+ | 12345 | 0 | 1 | 1 | 0 |\n| 9 | 12345 | 0 | 1 | 1 | 12345 |\n| 9+ | 12345 | 1 | 1 | 1 | 12345 |\n| 10 | 12345 | 1 | 1 | 1 | 0 |\n| 10+ | 12345 | 0 | 0 | 1 | 0 |\n| 11 | 12345 | 0 | 0 | 1 | 1 |\n| 11+ | 12345 | 1 | 0 | 1 | 1 |\n| 12 | 12345 | 1 | 0 | 1 | 0 |\n| 12+ | 0 | 0 | 1 | 1 | 0 |\n| 13 | 0 | 0 | 1 | 1 | 0 |\n| 13+ | 0 | 0 | 0 | 1 | 0 |\n| 14 | 0 | 0 | 0 | 1 | 1 |\n| 14+ | 22222 | 1 | 0 | 0 | 1 |\n| 15 | 22222 | 1 | 0 | 0 | 0 |`;\n","export const hdl = `/**\n * Memory of 8 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM8 {\n IN in[16], load, address[3];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D3.1.3 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 11111, set load 0, tick, output; tock, output;\nset load 1, set address 1, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 3333, set address 3, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 1, eval, output;\n\nset in 7777, tick, output; tock, output;\nset load 1, set address 7, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 3, eval, output;\nset address 7, eval, output;\n\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set in %B0101010101010101, set address 0, tick, output; tock, output;\nset address 1, tick, output, tock, output;\nset address 2, tick, output, tock, output;\nset address 3, tick, output, tock, output;\nset address 4, tick, output, tock, output;\nset address 5, tick, output, tock, output;\nset address 6, tick, output, tock, output;\nset address 7, tick, output, tock, output;\n\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 0, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 0, set in %B0101010101010101, tick, output, tock, output;\nset address 1, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 1, set in %B0101010101010101, tick, output, tock, output;\nset address 2, set in %B1010101010101010, tick, output;\ntock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 2, set in %B0101010101010101, tick, output, tock, output;\nset address 3, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 3, set in %B0101010101010101, tick, output, tock, output;\nset address 4, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 4, set in %B0101010101010101, tick, output, tock, output;\nset address 5, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 5, set in %B0101010101010101, tick, output, tock, output;\nset address 6, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 6, set in %B0101010101010101, tick, output, tock, output;\nset address 7, set in %B1010101010101010, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;\n\nset load 1, set address 7, set in %B0101010101010101, tick, output, tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset address 1, eval, output;\nset address 2, eval, output;\nset address 3, eval, output;\nset address 4, eval, output;\nset address 5, eval, output;\nset address 6, eval, output;\nset address 7, eval, output;`;\nexport const cmp = `| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 11111 | 0 | 0 | 0 |\n| 3 | 11111 | 0 | 0 | 0 |\n| 3+ | 11111 | 1 | 1 | 0 |\n| 4 | 11111 | 1 | 1 | 11111 |\n| 4+ | 11111 | 0 | 0 | 0 |\n| 5 | 11111 | 0 | 0 | 0 |\n| 5+ | 3333 | 0 | 3 | 0 |\n| 6 | 3333 | 0 | 3 | 0 |\n| 6+ | 3333 | 1 | 3 | 0 |\n| 7 | 3333 | 1 | 3 | 3333 |\n| 7+ | 3333 | 0 | 3 | 3333 |\n| 8 | 3333 | 0 | 3 | 3333 |\n| 8 | 3333 | 0 | 1 | 11111 |\n| 8+ | 7777 | 0 | 1 | 11111 |\n| 9 | 7777 | 0 | 1 | 11111 |\n| 9+ | 7777 | 1 | 7 | 0 |\n| 10 | 7777 | 1 | 7 | 7777 |\n| 10+ | 7777 | 0 | 7 | 7777 |\n| 11 | 7777 | 0 | 7 | 7777 |\n| 11 | 7777 | 0 | 3 | 3333 |\n| 11 | 7777 | 0 | 7 | 7777 |\n| 11+ | 7777 | 0 | 0 | 0 |\n| 12 | 7777 | 0 | 0 | 0 |\n| 12 | 7777 | 0 | 1 | 11111 |\n| 12 | 7777 | 0 | 2 | 0 |\n| 12 | 7777 | 0 | 3 | 3333 |\n| 12 | 7777 | 0 | 4 | 0 |\n| 12 | 7777 | 0 | 5 | 0 |\n| 12 | 7777 | 0 | 6 | 0 |\n| 12 | 7777 | 0 | 7 | 7777 |\n| 12+ | 21845 | 1 | 0 | 0 |\n| 13 | 21845 | 1 | 0 | 21845 |\n| 13+ | 21845 | 1 | 1 | 11111 |\n| 14 | 21845 | 1 | 1 | 21845 |\n| 14+ | 21845 | 1 | 2 | 0 |\n| 15 | 21845 | 1 | 2 | 21845 |\n| 15+ | 21845 | 1 | 3 | 3333 |\n| 16 | 21845 | 1 | 3 | 21845 |\n| 16+ | 21845 | 1 | 4 | 0 |\n| 17 | 21845 | 1 | 4 | 21845 |\n| 17+ | 21845 | 1 | 5 | 0 |\n| 18 | 21845 | 1 | 5 | 21845 |\n| 18+ | 21845 | 1 | 6 | 0 |\n| 19 | 21845 | 1 | 6 | 21845 |\n| 19+ | 21845 | 1 | 7 | 7777 |\n| 20 | 21845 | 1 | 7 | 21845 |\n| 20+ | 21845 | 0 | 0 | 21845 |\n| 21 | 21845 | 0 | 0 | 21845 |\n| 21 | 21845 | 0 | 1 | 21845 |\n| 21 | 21845 | 0 | 2 | 21845 |\n| 21 | 21845 | 0 | 3 | 21845 |\n| 21 | 21845 | 0 | 4 | 21845 |\n| 21 | 21845 | 0 | 5 | 21845 |\n| 21 | 21845 | 0 | 6 | 21845 |\n| 21 | 21845 | 0 | 7 | 21845 |\n| 21+ | -21846 | 1 | 0 | 21845 |\n| 22 | -21846 | 1 | 0 | -21846 |\n| 22+ | -21846 | 0 | 0 | -21846 |\n| 23 | -21846 | 0 | 0 | -21846 |\n| 23 | -21846 | 0 | 1 | 21845 |\n| 23 | -21846 | 0 | 2 | 21845 |\n| 23 | -21846 | 0 | 3 | 21845 |\n| 23 | -21846 | 0 | 4 | 21845 |\n| 23 | -21846 | 0 | 5 | 21845 |\n| 23 | -21846 | 0 | 6 | 21845 |\n| 23 | -21846 | 0 | 7 | 21845 |\n| 23+ | 21845 | 1 | 0 | -21846 |\n| 24 | 21845 | 1 | 0 | 21845 |\n| 24+ | -21846 | 1 | 1 | 21845 |\n| 25 | -21846 | 1 | 1 | -21846 |\n| 25+ | -21846 | 0 | 0 | 21845 |\n| 26 | -21846 | 0 | 0 | 21845 |\n| 26 | -21846 | 0 | 1 | -21846 |\n| 26 | -21846 | 0 | 2 | 21845 |\n| 26 | -21846 | 0 | 3 | 21845 |\n| 26 | -21846 | 0 | 4 | 21845 |\n| 26 | -21846 | 0 | 5 | 21845 |\n| 26 | -21846 | 0 | 6 | 21845 |\n| 26 | -21846 | 0 | 7 | 21845 |\n| 26+ | 21845 | 1 | 1 | -21846 |\n| 27 | 21845 | 1 | 1 | 21845 |\n| 27+ | -21846 | 1 | 2 | 21845 |\n| 28 | -21846 | 1 | 2 | -21846 |\n| 28+ | -21846 | 0 | 0 | 21845 |\n| 29 | -21846 | 0 | 0 | 21845 |\n| 29 | -21846 | 0 | 1 | 21845 |\n| 29 | -21846 | 0 | 2 | -21846 |\n| 29 | -21846 | 0 | 3 | 21845 |\n| 29 | -21846 | 0 | 4 | 21845 |\n| 29 | -21846 | 0 | 5 | 21845 |\n| 29 | -21846 | 0 | 6 | 21845 |\n| 29 | -21846 | 0 | 7 | 21845 |\n| 29+ | 21845 | 1 | 2 | -21846 |\n| 30 | 21845 | 1 | 2 | 21845 |\n| 30+ | -21846 | 1 | 3 | 21845 |\n| 31 | -21846 | 1 | 3 | -21846 |\n| 31+ | -21846 | 0 | 0 | 21845 |\n| 32 | -21846 | 0 | 0 | 21845 |\n| 32 | -21846 | 0 | 1 | 21845 |\n| 32 | -21846 | 0 | 2 | 21845 |\n| 32 | -21846 | 0 | 3 | -21846 |\n| 32 | -21846 | 0 | 4 | 21845 |\n| 32 | -21846 | 0 | 5 | 21845 |\n| 32 | -21846 | 0 | 6 | 21845 |\n| 32 | -21846 | 0 | 7 | 21845 |\n| 32+ | 21845 | 1 | 3 | -21846 |\n| 33 | 21845 | 1 | 3 | 21845 |\n| 33+ | -21846 | 1 | 4 | 21845 |\n| 34 | -21846 | 1 | 4 | -21846 |\n| 34+ | -21846 | 0 | 0 | 21845 |\n| 35 | -21846 | 0 | 0 | 21845 |\n| 35 | -21846 | 0 | 1 | 21845 |\n| 35 | -21846 | 0 | 2 | 21845 |\n| 35 | -21846 | 0 | 3 | 21845 |\n| 35 | -21846 | 0 | 4 | -21846 |\n| 35 | -21846 | 0 | 5 | 21845 |\n| 35 | -21846 | 0 | 6 | 21845 |\n| 35 | -21846 | 0 | 7 | 21845 |\n| 35+ | 21845 | 1 | 4 | -21846 |\n| 36 | 21845 | 1 | 4 | 21845 |\n| 36+ | -21846 | 1 | 5 | 21845 |\n| 37 | -21846 | 1 | 5 | -21846 |\n| 37+ | -21846 | 0 | 0 | 21845 |\n| 38 | -21846 | 0 | 0 | 21845 |\n| 38 | -21846 | 0 | 1 | 21845 |\n| 38 | -21846 | 0 | 2 | 21845 |\n| 38 | -21846 | 0 | 3 | 21845 |\n| 38 | -21846 | 0 | 4 | 21845 |\n| 38 | -21846 | 0 | 5 | -21846 |\n| 38 | -21846 | 0 | 6 | 21845 |\n| 38 | -21846 | 0 | 7 | 21845 |\n| 38+ | 21845 | 1 | 5 | -21846 |\n| 39 | 21845 | 1 | 5 | 21845 |\n| 39+ | -21846 | 1 | 6 | 21845 |\n| 40 | -21846 | 1 | 6 | -21846 |\n| 40+ | -21846 | 0 | 0 | 21845 |\n| 41 | -21846 | 0 | 0 | 21845 |\n| 41 | -21846 | 0 | 1 | 21845 |\n| 41 | -21846 | 0 | 2 | 21845 |\n| 41 | -21846 | 0 | 3 | 21845 |\n| 41 | -21846 | 0 | 4 | 21845 |\n| 41 | -21846 | 0 | 5 | 21845 |\n| 41 | -21846 | 0 | 6 | -21846 |\n| 41 | -21846 | 0 | 7 | 21845 |\n| 41+ | 21845 | 1 | 6 | -21846 |\n| 42 | 21845 | 1 | 6 | 21845 |\n| 42+ | -21846 | 1 | 7 | 21845 |\n| 43 | -21846 | 1 | 7 | -21846 |\n| 43+ | -21846 | 0 | 0 | 21845 |\n| 44 | -21846 | 0 | 0 | 21845 |\n| 44 | -21846 | 0 | 1 | 21845 |\n| 44 | -21846 | 0 | 2 | 21845 |\n| 44 | -21846 | 0 | 3 | 21845 |\n| 44 | -21846 | 0 | 4 | 21845 |\n| 44 | -21846 | 0 | 5 | 21845 |\n| 44 | -21846 | 0 | 6 | 21845 |\n| 44 | -21846 | 0 | 7 | -21846 |\n| 44+ | 21845 | 1 | 7 | -21846 |\n| 45 | 21845 | 1 | 7 | 21845 |\n| 45+ | 21845 | 0 | 0 | 21845 |\n| 46 | 21845 | 0 | 0 | 21845 |\n| 46 | 21845 | 0 | 1 | 21845 |\n| 46 | 21845 | 0 | 2 | 21845 |\n| 46 | 21845 | 0 | 3 | 21845 |\n| 46 | 21845 | 0 | 4 | 21845 |\n| 46 | 21845 | 0 | 5 | 21845 |\n| 46 | 21845 | 0 | 6 | 21845 |\n| 46 | 21845 | 0 | 7 | 21845 |`;\n","export const hdl = `/**\n * Memory of 64 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM64 {\n IN in[16], load, address[6];\n OUT out[16];\n \n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1;\n\nset in 0, set load 0,\nset address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset in 1313, set load 0, tick, output; tock, output;\nset load 1,\nset address 13, tick, output; tock, output;\nset load 0,\nset address 0, tick, output; tock, output;\nset in 4747, set address 47, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 13, eval, output;\n\nset in 6363, tick, output; tock, output;\nset load 1,\nset address 63, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 47, eval, output;\n\nset address 63, eval, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B101000, tick, output; tock, output;\nset address %B101001, tick, output, tock, output;\nset address %B101010, tick, output, tock, output;\nset address %B101011, tick, output, tock, output;\nset address %B101100, tick, output, tock, output;\nset address %B101101, tick, output, tock, output;\nset address %B101110, tick, output, tock, output;\nset address %B101111, tick, output, tock, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101000, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B101001, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101011, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B101100, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B101111, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 1,\nset address %B101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B101000, tick, output; tock, output;\nset address %B101001, eval, output;\nset address %B101010, eval, output;\nset address %B101011, eval, output;\nset address %B101100, eval, output;\nset address %B101101, eval, output;\nset address %B101110, eval, output;\nset address %B101111, eval, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101, tick, output; tock, output;\nset address %B001101, tick, output, tock, output;\nset address %B010101, tick, output, tock, output;\nset address %B011101, tick, output, tock, output;\nset address %B100101, tick, output, tock, output;\nset address %B101101, tick, output, tock, output;\nset address %B110101, tick, output, tock, output;\nset address %B111101, tick, output, tock, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B000101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B000101, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B001101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B011101, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B100101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B110101, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;\n\nset load 1,\nset address %B111101, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101, tick, output; tock, output;\nset address %B001101, eval, output;\nset address %B010101, eval, output;\nset address %B011101, eval, output;\nset address %B100101, eval, output;\nset address %B101101, eval, output;\nset address %B110101, eval, output;\nset address %B111101, eval, output;`;\n\nexport const cmp = `| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 1313 | 0 | 0 | 0 |\n| 3 | 1313 | 0 | 0 | 0 |\n| 3+ | 1313 | 1 | 13 | 0 |\n| 4 | 1313 | 1 | 13 | 1313 |\n| 4+ | 1313 | 0 | 0 | 0 |\n| 5 | 1313 | 0 | 0 | 0 |\n| 5+ | 4747 | 0 | 47 | 0 |\n| 6 | 4747 | 0 | 47 | 0 |\n| 6+ | 4747 | 1 | 47 | 0 |\n| 7 | 4747 | 1 | 47 | 4747 |\n| 7+ | 4747 | 0 | 47 | 4747 |\n| 8 | 4747 | 0 | 47 | 4747 |\n| 8 | 4747 | 0 | 13 | 1313 |\n| 8+ | 6363 | 0 | 13 | 1313 |\n| 9 | 6363 | 0 | 13 | 1313 |\n| 9+ | 6363 | 1 | 63 | 0 |\n| 10 | 6363 | 1 | 63 | 6363 |\n| 10+ | 6363 | 0 | 63 | 6363 |\n| 11 | 6363 | 0 | 63 | 6363 |\n| 11 | 6363 | 0 | 47 | 4747 |\n| 11 | 6363 | 0 | 63 | 6363 |\n| 11+ | 6363 | 0 | 40 | 0 |\n| 12 | 6363 | 0 | 40 | 0 |\n| 12 | 6363 | 0 | 41 | 0 |\n| 12 | 6363 | 0 | 42 | 0 |\n| 12 | 6363 | 0 | 43 | 0 |\n| 12 | 6363 | 0 | 44 | 0 |\n| 12 | 6363 | 0 | 45 | 0 |\n| 12 | 6363 | 0 | 46 | 0 |\n| 12 | 6363 | 0 | 47 | 4747 |\n| 12+ | 21845 | 1 | 40 | 0 |\n| 13 | 21845 | 1 | 40 | 21845 |\n| 13+ | 21845 | 1 | 41 | 0 |\n| 14 | 21845 | 1 | 41 | 21845 |\n| 14+ | 21845 | 1 | 42 | 0 |\n| 15 | 21845 | 1 | 42 | 21845 |\n| 15+ | 21845 | 1 | 43 | 0 |\n| 16 | 21845 | 1 | 43 | 21845 |\n| 16+ | 21845 | 1 | 44 | 0 |\n| 17 | 21845 | 1 | 44 | 21845 |\n| 17+ | 21845 | 1 | 45 | 0 |\n| 18 | 21845 | 1 | 45 | 21845 |\n| 18+ | 21845 | 1 | 46 | 0 |\n| 19 | 21845 | 1 | 46 | 21845 |\n| 19+ | 21845 | 1 | 47 | 4747 |\n| 20 | 21845 | 1 | 47 | 21845 |\n| 20+ | 21845 | 0 | 40 | 21845 |\n| 21 | 21845 | 0 | 40 | 21845 |\n| 21 | 21845 | 0 | 41 | 21845 |\n| 21 | 21845 | 0 | 42 | 21845 |\n| 21 | 21845 | 0 | 43 | 21845 |\n| 21 | 21845 | 0 | 44 | 21845 |\n| 21 | 21845 | 0 | 45 | 21845 |\n| 21 | 21845 | 0 | 46 | 21845 |\n| 21 | 21845 | 0 | 47 | 21845 |\n| 21+ | -21846 | 1 | 40 | 21845 |\n| 22 | -21846 | 1 | 40 | -21846 |\n| 22+ | -21846 | 0 | 40 | -21846 |\n| 23 | -21846 | 0 | 40 | -21846 |\n| 23 | -21846 | 0 | 41 | 21845 |\n| 23 | -21846 | 0 | 42 | 21845 |\n| 23 | -21846 | 0 | 43 | 21845 |\n| 23 | -21846 | 0 | 44 | 21845 |\n| 23 | -21846 | 0 | 45 | 21845 |\n| 23 | -21846 | 0 | 46 | 21845 |\n| 23 | -21846 | 0 | 47 | 21845 |\n| 23+ | 21845 | 1 | 40 | -21846 |\n| 24 | 21845 | 1 | 40 | 21845 |\n| 24+ | -21846 | 1 | 41 | 21845 |\n| 25 | -21846 | 1 | 41 | -21846 |\n| 25+ | -21846 | 0 | 40 | 21845 |\n| 26 | -21846 | 0 | 40 | 21845 |\n| 26 | -21846 | 0 | 41 | -21846 |\n| 26 | -21846 | 0 | 42 | 21845 |\n| 26 | -21846 | 0 | 43 | 21845 |\n| 26 | -21846 | 0 | 44 | 21845 |\n| 26 | -21846 | 0 | 45 | 21845 |\n| 26 | -21846 | 0 | 46 | 21845 |\n| 26 | -21846 | 0 | 47 | 21845 |\n| 26+ | 21845 | 1 | 41 | -21846 |\n| 27 | 21845 | 1 | 41 | 21845 |\n| 27+ | -21846 | 1 | 42 | 21845 |\n| 28 | -21846 | 1 | 42 | -21846 |\n| 28+ | -21846 | 0 | 40 | 21845 |\n| 29 | -21846 | 0 | 40 | 21845 |\n| 29 | -21846 | 0 | 41 | 21845 |\n| 29 | -21846 | 0 | 42 | -21846 |\n| 29 | -21846 | 0 | 43 | 21845 |\n| 29 | -21846 | 0 | 44 | 21845 |\n| 29 | -21846 | 0 | 45 | 21845 |\n| 29 | -21846 | 0 | 46 | 21845 |\n| 29 | -21846 | 0 | 47 | 21845 |\n| 29+ | 21845 | 1 | 42 | -21846 |\n| 30 | 21845 | 1 | 42 | 21845 |\n| 30+ | -21846 | 1 | 43 | 21845 |\n| 31 | -21846 | 1 | 43 | -21846 |\n| 31+ | -21846 | 0 | 40 | 21845 |\n| 32 | -21846 | 0 | 40 | 21845 |\n| 32 | -21846 | 0 | 41 | 21845 |\n| 32 | -21846 | 0 | 42 | 21845 |\n| 32 | -21846 | 0 | 43 | -21846 |\n| 32 | -21846 | 0 | 44 | 21845 |\n| 32 | -21846 | 0 | 45 | 21845 |\n| 32 | -21846 | 0 | 46 | 21845 |\n| 32 | -21846 | 0 | 47 | 21845 |\n| 32+ | 21845 | 1 | 43 | -21846 |\n| 33 | 21845 | 1 | 43 | 21845 |\n| 33+ | -21846 | 1 | 44 | 21845 |\n| 34 | -21846 | 1 | 44 | -21846 |\n| 34+ | -21846 | 0 | 40 | 21845 |\n| 35 | -21846 | 0 | 40 | 21845 |\n| 35 | -21846 | 0 | 41 | 21845 |\n| 35 | -21846 | 0 | 42 | 21845 |\n| 35 | -21846 | 0 | 43 | 21845 |\n| 35 | -21846 | 0 | 44 | -21846 |\n| 35 | -21846 | 0 | 45 | 21845 |\n| 35 | -21846 | 0 | 46 | 21845 |\n| 35 | -21846 | 0 | 47 | 21845 |\n| 35+ | 21845 | 1 | 44 | -21846 |\n| 36 | 21845 | 1 | 44 | 21845 |\n| 36+ | -21846 | 1 | 45 | 21845 |\n| 37 | -21846 | 1 | 45 | -21846 |\n| 37+ | -21846 | 0 | 40 | 21845 |\n| 38 | -21846 | 0 | 40 | 21845 |\n| 38 | -21846 | 0 | 41 | 21845 |\n| 38 | -21846 | 0 | 42 | 21845 |\n| 38 | -21846 | 0 | 43 | 21845 |\n| 38 | -21846 | 0 | 44 | 21845 |\n| 38 | -21846 | 0 | 45 | -21846 |\n| 38 | -21846 | 0 | 46 | 21845 |\n| 38 | -21846 | 0 | 47 | 21845 |\n| 38+ | 21845 | 1 | 45 | -21846 |\n| 39 | 21845 | 1 | 45 | 21845 |\n| 39+ | -21846 | 1 | 46 | 21845 |\n| 40 | -21846 | 1 | 46 | -21846 |\n| 40+ | -21846 | 0 | 40 | 21845 |\n| 41 | -21846 | 0 | 40 | 21845 |\n| 41 | -21846 | 0 | 41 | 21845 |\n| 41 | -21846 | 0 | 42 | 21845 |\n| 41 | -21846 | 0 | 43 | 21845 |\n| 41 | -21846 | 0 | 44 | 21845 |\n| 41 | -21846 | 0 | 45 | 21845 |\n| 41 | -21846 | 0 | 46 | -21846 |\n| 41 | -21846 | 0 | 47 | 21845 |\n| 41+ | 21845 | 1 | 46 | -21846 |\n| 42 | 21845 | 1 | 46 | 21845 |\n| 42+ | -21846 | 1 | 47 | 21845 |\n| 43 | -21846 | 1 | 47 | -21846 |\n| 43+ | -21846 | 0 | 40 | 21845 |\n| 44 | -21846 | 0 | 40 | 21845 |\n| 44 | -21846 | 0 | 41 | 21845 |\n| 44 | -21846 | 0 | 42 | 21845 |\n| 44 | -21846 | 0 | 43 | 21845 |\n| 44 | -21846 | 0 | 44 | 21845 |\n| 44 | -21846 | 0 | 45 | 21845 |\n| 44 | -21846 | 0 | 46 | 21845 |\n| 44 | -21846 | 0 | 47 | -21846 |\n| 44+ | 21845 | 1 | 47 | -21846 |\n| 45 | 21845 | 1 | 47 | 21845 |\n| 45+ | 21845 | 0 | 40 | 21845 |\n| 46 | 21845 | 0 | 40 | 21845 |\n| 46 | 21845 | 0 | 41 | 21845 |\n| 46 | 21845 | 0 | 42 | 21845 |\n| 46 | 21845 | 0 | 43 | 21845 |\n| 46 | 21845 | 0 | 44 | 21845 |\n| 46 | 21845 | 0 | 45 | 21845 |\n| 46 | 21845 | 0 | 46 | 21845 |\n| 46 | 21845 | 0 | 47 | 21845 |\n| 46+ | 21845 | 0 | 5 | 0 |\n| 47 | 21845 | 0 | 5 | 0 |\n| 47 | 21845 | 0 | 13 | 1313 |\n| 47 | 21845 | 0 | 21 | 0 |\n| 47 | 21845 | 0 | 29 | 0 |\n| 47 | 21845 | 0 | 37 | 0 |\n| 47 | 21845 | 0 | 45 | 21845 |\n| 47 | 21845 | 0 | 53 | 0 |\n| 47 | 21845 | 0 | 61 | 0 |\n| 47+ | 21845 | 1 | 5 | 0 |\n| 48 | 21845 | 1 | 5 | 21845 |\n| 48+ | 21845 | 1 | 13 | 1313 |\n| 49 | 21845 | 1 | 13 | 21845 |\n| 49+ | 21845 | 1 | 21 | 0 |\n| 50 | 21845 | 1 | 21 | 21845 |\n| 50+ | 21845 | 1 | 29 | 0 |\n| 51 | 21845 | 1 | 29 | 21845 |\n| 51+ | 21845 | 1 | 37 | 0 |\n| 52 | 21845 | 1 | 37 | 21845 |\n| 52+ | 21845 | 1 | 45 | 21845 |\n| 53 | 21845 | 1 | 45 | 21845 |\n| 53+ | 21845 | 1 | 53 | 0 |\n| 54 | 21845 | 1 | 53 | 21845 |\n| 54+ | 21845 | 1 | 61 | 0 |\n| 55 | 21845 | 1 | 61 | 21845 |\n| 55+ | 21845 | 0 | 5 | 21845 |\n| 56 | 21845 | 0 | 5 | 21845 |\n| 56 | 21845 | 0 | 13 | 21845 |\n| 56 | 21845 | 0 | 21 | 21845 |\n| 56 | 21845 | 0 | 29 | 21845 |\n| 56 | 21845 | 0 | 37 | 21845 |\n| 56 | 21845 | 0 | 45 | 21845 |\n| 56 | 21845 | 0 | 53 | 21845 |\n| 56 | 21845 | 0 | 61 | 21845 |\n| 56+ | -21846 | 1 | 5 | 21845 |\n| 57 | -21846 | 1 | 5 | -21846 |\n| 57+ | -21846 | 0 | 5 | -21846 |\n| 58 | -21846 | 0 | 5 | -21846 |\n| 58 | -21846 | 0 | 13 | 21845 |\n| 58 | -21846 | 0 | 21 | 21845 |\n| 58 | -21846 | 0 | 29 | 21845 |\n| 58 | -21846 | 0 | 37 | 21845 |\n| 58 | -21846 | 0 | 45 | 21845 |\n| 58 | -21846 | 0 | 53 | 21845 |\n| 58 | -21846 | 0 | 61 | 21845 |\n| 58+ | 21845 | 1 | 5 | -21846 |\n| 59 | 21845 | 1 | 5 | 21845 |\n| 59+ | -21846 | 1 | 13 | 21845 |\n| 60 | -21846 | 1 | 13 | -21846 |\n| 60+ | -21846 | 0 | 5 | 21845 |\n| 61 | -21846 | 0 | 5 | 21845 |\n| 61 | -21846 | 0 | 13 | -21846 |\n| 61 | -21846 | 0 | 21 | 21845 |\n| 61 | -21846 | 0 | 29 | 21845 |\n| 61 | -21846 | 0 | 37 | 21845 |\n| 61 | -21846 | 0 | 45 | 21845 |\n| 61 | -21846 | 0 | 53 | 21845 |\n| 61 | -21846 | 0 | 61 | 21845 |\n| 61+ | 21845 | 1 | 13 | -21846 |\n| 62 | 21845 | 1 | 13 | 21845 |\n| 62+ | -21846 | 1 | 21 | 21845 |\n| 63 | -21846 | 1 | 21 | -21846 |\n| 63+ | -21846 | 0 | 5 | 21845 |\n| 64 | -21846 | 0 | 5 | 21845 |\n| 64 | -21846 | 0 | 13 | 21845 |\n| 64 | -21846 | 0 | 21 | -21846 |\n| 64 | -21846 | 0 | 29 | 21845 |\n| 64 | -21846 | 0 | 37 | 21845 |\n| 64 | -21846 | 0 | 45 | 21845 |\n| 64 | -21846 | 0 | 53 | 21845 |\n| 64 | -21846 | 0 | 61 | 21845 |\n| 64+ | 21845 | 1 | 21 | -21846 |\n| 65 | 21845 | 1 | 21 | 21845 |\n| 65+ | -21846 | 1 | 29 | 21845 |\n| 66 | -21846 | 1 | 29 | -21846 |\n| 66+ | -21846 | 0 | 5 | 21845 |\n| 67 | -21846 | 0 | 5 | 21845 |\n| 67 | -21846 | 0 | 13 | 21845 |\n| 67 | -21846 | 0 | 21 | 21845 |\n| 67 | -21846 | 0 | 29 | -21846 |\n| 67 | -21846 | 0 | 37 | 21845 |\n| 67 | -21846 | 0 | 45 | 21845 |\n| 67 | -21846 | 0 | 53 | 21845 |\n| 67 | -21846 | 0 | 61 | 21845 |\n| 67+ | 21845 | 1 | 29 | -21846 |\n| 68 | 21845 | 1 | 29 | 21845 |\n| 68+ | -21846 | 1 | 37 | 21845 |\n| 69 | -21846 | 1 | 37 | -21846 |\n| 69+ | -21846 | 0 | 5 | 21845 |\n| 70 | -21846 | 0 | 5 | 21845 |\n| 70 | -21846 | 0 | 13 | 21845 |\n| 70 | -21846 | 0 | 21 | 21845 |\n| 70 | -21846 | 0 | 29 | 21845 |\n| 70 | -21846 | 0 | 37 | -21846 |\n| 70 | -21846 | 0 | 45 | 21845 |\n| 70 | -21846 | 0 | 53 | 21845 |\n| 70 | -21846 | 0 | 61 | 21845 |\n| 70+ | 21845 | 1 | 37 | -21846 |\n| 71 | 21845 | 1 | 37 | 21845 |\n| 71+ | -21846 | 1 | 45 | 21845 |\n| 72 | -21846 | 1 | 45 | -21846 |\n| 72+ | -21846 | 0 | 5 | 21845 |\n| 73 | -21846 | 0 | 5 | 21845 |\n| 73 | -21846 | 0 | 13 | 21845 |\n| 73 | -21846 | 0 | 21 | 21845 |\n| 73 | -21846 | 0 | 29 | 21845 |\n| 73 | -21846 | 0 | 37 | 21845 |\n| 73 | -21846 | 0 | 45 | -21846 |\n| 73 | -21846 | 0 | 53 | 21845 |\n| 73 | -21846 | 0 | 61 | 21845 |\n| 73+ | 21845 | 1 | 45 | -21846 |\n| 74 | 21845 | 1 | 45 | 21845 |\n| 74+ | -21846 | 1 | 53 | 21845 |\n| 75 | -21846 | 1 | 53 | -21846 |\n| 75+ | -21846 | 0 | 5 | 21845 |\n| 76 | -21846 | 0 | 5 | 21845 |\n| 76 | -21846 | 0 | 13 | 21845 |\n| 76 | -21846 | 0 | 21 | 21845 |\n| 76 | -21846 | 0 | 29 | 21845 |\n| 76 | -21846 | 0 | 37 | 21845 |\n| 76 | -21846 | 0 | 45 | 21845 |\n| 76 | -21846 | 0 | 53 | -21846 |\n| 76 | -21846 | 0 | 61 | 21845 |\n| 76+ | 21845 | 1 | 53 | -21846 |\n| 77 | 21845 | 1 | 53 | 21845 |\n| 77+ | -21846 | 1 | 61 | 21845 |\n| 78 | -21846 | 1 | 61 | -21846 |\n| 78+ | -21846 | 0 | 5 | 21845 |\n| 79 | -21846 | 0 | 5 | 21845 |\n| 79 | -21846 | 0 | 13 | 21845 |\n| 79 | -21846 | 0 | 21 | 21845 |\n| 79 | -21846 | 0 | 29 | 21845 |\n| 79 | -21846 | 0 | 37 | 21845 |\n| 79 | -21846 | 0 | 45 | 21845 |\n| 79 | -21846 | 0 | 53 | 21845 |\n| 79 | -21846 | 0 | 61 | -21846 |\n| 79+ | 21845 | 1 | 61 | -21846 |\n| 80 | 21845 | 1 | 61 | 21845 |\n| 80+ | 21845 | 0 | 5 | 21845 |\n| 81 | 21845 | 0 | 5 | 21845 |\n| 81 | 21845 | 0 | 13 | 21845 |\n| 81 | 21845 | 0 | 21 | 21845 |\n| 81 | 21845 | 0 | 29 | 21845 |\n| 81 | 21845 | 0 | 37 | 21845 |\n| 81 | 21845 | 0 | 45 | 21845 |\n| 81 | 21845 | 0 | 53 | 21845 |\n| 81 | 21845 | 0 | 61 | 21845 |`;\n","export const hdl = `/**\n * Memory of 512 registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM512 {\n IN in[16], load, address[9];\n OUT out[16];\n \n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 13099, set load 0, tick, output; tock, output;\nset load 1, set address 130, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 4729, set address 472, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 130, eval, output;\n\nset in 5119, tick, output; tock, output;\nset load 1, set address 511, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 472, eval, output;\nset address 511, eval, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B010101000, tick, output; tock, output;\nset address %B010101001, tick, output, tock, output;\nset address %B010101010, tick, output, tock, output;\nset address %B010101011, tick, output, tock, output;\nset address %B010101100, tick, output, tock, output;\nset address %B010101101, tick, output, tock, output;\nset address %B010101110, tick, output, tock, output;\nset address %B010101111, tick, output, tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101000, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101001, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101011, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101100, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101110, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101111, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\nset load 1,\nset address %B010101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B010101000, tick, output; tock, output;\nset address %B010101001, eval, output;\nset address %B010101010, eval, output;\nset address %B010101011, eval, output;\nset address %B010101100, eval, output;\nset address %B010101101, eval, output;\nset address %B010101110, eval, output;\nset address %B010101111, eval, output;\n\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101010, tick, output; tock, output;\nset address %B001101010, tick, output, tock, output;\nset address %B010101010, tick, output, tock, output;\nset address %B011101010, tick, output, tock, output;\nset address %B100101010, tick, output, tock, output;\nset address %B101101010, tick, output, tock, output;\nset address %B110101010, tick, output, tock, output;\nset address %B111101010, tick, output, tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B000101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B000101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B001101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B011101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B100101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B101101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B110101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101010, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;\n\nset load 1,\nset address %B111101010, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010, tick, output; tock, output;\nset address %B001101010, eval, output;\nset address %B010101010, eval, output;\nset address %B011101010, eval, output;\nset address %B100101010, eval, output;\nset address %B101101010, eval, output;\nset address %B110101010, eval, output;\nset address %B111101010, eval, output;`;\nexport const cmp = `| time | in |load |address| out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 13099 | 0 | 0 | 0 |\n| 3 | 13099 | 0 | 0 | 0 |\n| 3+ | 13099 | 1 | 130 | 0 |\n| 4 | 13099 | 1 | 130 | 13099 |\n| 4+ | 13099 | 0 | 0 | 0 |\n| 5 | 13099 | 0 | 0 | 0 |\n| 5+ | 4729 | 0 | 472 | 0 |\n| 6 | 4729 | 0 | 472 | 0 |\n| 6+ | 4729 | 1 | 472 | 0 |\n| 7 | 4729 | 1 | 472 | 4729 |\n| 7+ | 4729 | 0 | 472 | 4729 |\n| 8 | 4729 | 0 | 472 | 4729 |\n| 8 | 4729 | 0 | 130 | 13099 |\n| 8+ | 5119 | 0 | 130 | 13099 |\n| 9 | 5119 | 0 | 130 | 13099 |\n| 9+ | 5119 | 1 | 511 | 0 |\n| 10 | 5119 | 1 | 511 | 5119 |\n| 10+ | 5119 | 0 | 511 | 5119 |\n| 11 | 5119 | 0 | 511 | 5119 |\n| 11 | 5119 | 0 | 472 | 4729 |\n| 11 | 5119 | 0 | 511 | 5119 |\n| 11+ | 5119 | 0 | 168 | 0 |\n| 12 | 5119 | 0 | 168 | 0 |\n| 12 | 5119 | 0 | 169 | 0 |\n| 12 | 5119 | 0 | 170 | 0 |\n| 12 | 5119 | 0 | 171 | 0 |\n| 12 | 5119 | 0 | 172 | 0 |\n| 12 | 5119 | 0 | 173 | 0 |\n| 12 | 5119 | 0 | 174 | 0 |\n| 12 | 5119 | 0 | 175 | 0 |\n| 12+ | 21845 | 1 | 168 | 0 |\n| 13 | 21845 | 1 | 168 | 21845 |\n| 13+ | 21845 | 1 | 169 | 0 |\n| 14 | 21845 | 1 | 169 | 21845 |\n| 14+ | 21845 | 1 | 170 | 0 |\n| 15 | 21845 | 1 | 170 | 21845 |\n| 15+ | 21845 | 1 | 171 | 0 |\n| 16 | 21845 | 1 | 171 | 21845 |\n| 16+ | 21845 | 1 | 172 | 0 |\n| 17 | 21845 | 1 | 172 | 21845 |\n| 17+ | 21845 | 1 | 173 | 0 |\n| 18 | 21845 | 1 | 173 | 21845 |\n| 18+ | 21845 | 1 | 174 | 0 |\n| 19 | 21845 | 1 | 174 | 21845 |\n| 19+ | 21845 | 1 | 175 | 0 |\n| 20 | 21845 | 1 | 175 | 21845 |\n| 20+ | 21845 | 0 | 168 | 21845 |\n| 21 | 21845 | 0 | 168 | 21845 |\n| 21 | 21845 | 0 | 169 | 21845 |\n| 21 | 21845 | 0 | 170 | 21845 |\n| 21 | 21845 | 0 | 171 | 21845 |\n| 21 | 21845 | 0 | 172 | 21845 |\n| 21 | 21845 | 0 | 173 | 21845 |\n| 21 | 21845 | 0 | 174 | 21845 |\n| 21 | 21845 | 0 | 175 | 21845 |\n| 21+ | -21846 | 1 | 168 | 21845 |\n| 22 | -21846 | 1 | 168 | -21846 |\n| 22+ | -21846 | 0 | 168 | -21846 |\n| 23 | -21846 | 0 | 168 | -21846 |\n| 23 | -21846 | 0 | 169 | 21845 |\n| 23 | -21846 | 0 | 170 | 21845 |\n| 23 | -21846 | 0 | 171 | 21845 |\n| 23 | -21846 | 0 | 172 | 21845 |\n| 23 | -21846 | 0 | 173 | 21845 |\n| 23 | -21846 | 0 | 174 | 21845 |\n| 23 | -21846 | 0 | 175 | 21845 |\n| 23+ | 21845 | 1 | 168 | -21846 |\n| 24 | 21845 | 1 | 168 | 21845 |\n| 24+ | -21846 | 1 | 169 | 21845 |\n| 25 | -21846 | 1 | 169 | -21846 |\n| 25+ | -21846 | 0 | 168 | 21845 |\n| 26 | -21846 | 0 | 168 | 21845 |\n| 26 | -21846 | 0 | 169 | -21846 |\n| 26 | -21846 | 0 | 170 | 21845 |\n| 26 | -21846 | 0 | 171 | 21845 |\n| 26 | -21846 | 0 | 172 | 21845 |\n| 26 | -21846 | 0 | 173 | 21845 |\n| 26 | -21846 | 0 | 174 | 21845 |\n| 26 | -21846 | 0 | 175 | 21845 |\n| 26+ | 21845 | 1 | 169 | -21846 |\n| 27 | 21845 | 1 | 169 | 21845 |\n| 27+ | -21846 | 1 | 170 | 21845 |\n| 28 | -21846 | 1 | 170 | -21846 |\n| 28+ | -21846 | 0 | 168 | 21845 |\n| 29 | -21846 | 0 | 168 | 21845 |\n| 29 | -21846 | 0 | 169 | 21845 |\n| 29 | -21846 | 0 | 170 | -21846 |\n| 29 | -21846 | 0 | 171 | 21845 |\n| 29 | -21846 | 0 | 172 | 21845 |\n| 29 | -21846 | 0 | 173 | 21845 |\n| 29 | -21846 | 0 | 174 | 21845 |\n| 29 | -21846 | 0 | 175 | 21845 |\n| 29+ | 21845 | 1 | 170 | -21846 |\n| 30 | 21845 | 1 | 170 | 21845 |\n| 30+ | -21846 | 1 | 171 | 21845 |\n| 31 | -21846 | 1 | 171 | -21846 |\n| 31+ | -21846 | 0 | 168 | 21845 |\n| 32 | -21846 | 0 | 168 | 21845 |\n| 32 | -21846 | 0 | 169 | 21845 |\n| 32 | -21846 | 0 | 170 | 21845 |\n| 32 | -21846 | 0 | 171 | -21846 |\n| 32 | -21846 | 0 | 172 | 21845 |\n| 32 | -21846 | 0 | 173 | 21845 |\n| 32 | -21846 | 0 | 174 | 21845 |\n| 32 | -21846 | 0 | 175 | 21845 |\n| 32+ | 21845 | 1 | 171 | -21846 |\n| 33 | 21845 | 1 | 171 | 21845 |\n| 33+ | -21846 | 1 | 172 | 21845 |\n| 34 | -21846 | 1 | 172 | -21846 |\n| 34+ | -21846 | 0 | 168 | 21845 |\n| 35 | -21846 | 0 | 168 | 21845 |\n| 35 | -21846 | 0 | 169 | 21845 |\n| 35 | -21846 | 0 | 170 | 21845 |\n| 35 | -21846 | 0 | 171 | 21845 |\n| 35 | -21846 | 0 | 172 | -21846 |\n| 35 | -21846 | 0 | 173 | 21845 |\n| 35 | -21846 | 0 | 174 | 21845 |\n| 35 | -21846 | 0 | 175 | 21845 |\n| 35+ | 21845 | 1 | 172 | -21846 |\n| 36 | 21845 | 1 | 172 | 21845 |\n| 36+ | -21846 | 1 | 173 | 21845 |\n| 37 | -21846 | 1 | 173 | -21846 |\n| 37+ | -21846 | 0 | 168 | 21845 |\n| 38 | -21846 | 0 | 168 | 21845 |\n| 38 | -21846 | 0 | 169 | 21845 |\n| 38 | -21846 | 0 | 170 | 21845 |\n| 38 | -21846 | 0 | 171 | 21845 |\n| 38 | -21846 | 0 | 172 | 21845 |\n| 38 | -21846 | 0 | 173 | -21846 |\n| 38 | -21846 | 0 | 174 | 21845 |\n| 38 | -21846 | 0 | 175 | 21845 |\n| 38+ | 21845 | 1 | 173 | -21846 |\n| 39 | 21845 | 1 | 173 | 21845 |\n| 39+ | -21846 | 1 | 174 | 21845 |\n| 40 | -21846 | 1 | 174 | -21846 |\n| 40+ | -21846 | 0 | 168 | 21845 |\n| 41 | -21846 | 0 | 168 | 21845 |\n| 41 | -21846 | 0 | 169 | 21845 |\n| 41 | -21846 | 0 | 170 | 21845 |\n| 41 | -21846 | 0 | 171 | 21845 |\n| 41 | -21846 | 0 | 172 | 21845 |\n| 41 | -21846 | 0 | 173 | 21845 |\n| 41 | -21846 | 0 | 174 | -21846 |\n| 41 | -21846 | 0 | 175 | 21845 |\n| 41+ | 21845 | 1 | 174 | -21846 |\n| 42 | 21845 | 1 | 174 | 21845 |\n| 42+ | -21846 | 1 | 175 | 21845 |\n| 43 | -21846 | 1 | 175 | -21846 |\n| 43+ | -21846 | 0 | 168 | 21845 |\n| 44 | -21846 | 0 | 168 | 21845 |\n| 44 | -21846 | 0 | 169 | 21845 |\n| 44 | -21846 | 0 | 170 | 21845 |\n| 44 | -21846 | 0 | 171 | 21845 |\n| 44 | -21846 | 0 | 172 | 21845 |\n| 44 | -21846 | 0 | 173 | 21845 |\n| 44 | -21846 | 0 | 174 | 21845 |\n| 44 | -21846 | 0 | 175 | -21846 |\n| 44+ | 21845 | 1 | 175 | -21846 |\n| 45 | 21845 | 1 | 175 | 21845 |\n| 45+ | 21845 | 0 | 168 | 21845 |\n| 46 | 21845 | 0 | 168 | 21845 |\n| 46 | 21845 | 0 | 169 | 21845 |\n| 46 | 21845 | 0 | 170 | 21845 |\n| 46 | 21845 | 0 | 171 | 21845 |\n| 46 | 21845 | 0 | 172 | 21845 |\n| 46 | 21845 | 0 | 173 | 21845 |\n| 46 | 21845 | 0 | 174 | 21845 |\n| 46 | 21845 | 0 | 175 | 21845 |\n| 46+ | 21845 | 0 | 42 | 0 |\n| 47 | 21845 | 0 | 42 | 0 |\n| 47 | 21845 | 0 | 106 | 0 |\n| 47 | 21845 | 0 | 170 | 21845 |\n| 47 | 21845 | 0 | 234 | 0 |\n| 47 | 21845 | 0 | 298 | 0 |\n| 47 | 21845 | 0 | 362 | 0 |\n| 47 | 21845 | 0 | 426 | 0 |\n| 47 | 21845 | 0 | 490 | 0 |\n| 47+ | 21845 | 1 | 42 | 0 |\n| 48 | 21845 | 1 | 42 | 21845 |\n| 48+ | 21845 | 1 | 106 | 0 |\n| 49 | 21845 | 1 | 106 | 21845 |\n| 49+ | 21845 | 1 | 170 | 21845 |\n| 50 | 21845 | 1 | 170 | 21845 |\n| 50+ | 21845 | 1 | 234 | 0 |\n| 51 | 21845 | 1 | 234 | 21845 |\n| 51+ | 21845 | 1 | 298 | 0 |\n| 52 | 21845 | 1 | 298 | 21845 |\n| 52+ | 21845 | 1 | 362 | 0 |\n| 53 | 21845 | 1 | 362 | 21845 |\n| 53+ | 21845 | 1 | 426 | 0 |\n| 54 | 21845 | 1 | 426 | 21845 |\n| 54+ | 21845 | 1 | 490 | 0 |\n| 55 | 21845 | 1 | 490 | 21845 |\n| 55+ | 21845 | 0 | 42 | 21845 |\n| 56 | 21845 | 0 | 42 | 21845 |\n| 56 | 21845 | 0 | 106 | 21845 |\n| 56 | 21845 | 0 | 170 | 21845 |\n| 56 | 21845 | 0 | 234 | 21845 |\n| 56 | 21845 | 0 | 298 | 21845 |\n| 56 | 21845 | 0 | 362 | 21845 |\n| 56 | 21845 | 0 | 426 | 21845 |\n| 56 | 21845 | 0 | 490 | 21845 |\n| 56+ | -21846 | 1 | 42 | 21845 |\n| 57 | -21846 | 1 | 42 | -21846 |\n| 57+ | -21846 | 0 | 42 | -21846 |\n| 58 | -21846 | 0 | 42 | -21846 |\n| 58 | -21846 | 0 | 106 | 21845 |\n| 58 | -21846 | 0 | 170 | 21845 |\n| 58 | -21846 | 0 | 234 | 21845 |\n| 58 | -21846 | 0 | 298 | 21845 |\n| 58 | -21846 | 0 | 362 | 21845 |\n| 58 | -21846 | 0 | 426 | 21845 |\n| 58 | -21846 | 0 | 490 | 21845 |\n| 58+ | 21845 | 1 | 42 | -21846 |\n| 59 | 21845 | 1 | 42 | 21845 |\n| 59+ | -21846 | 1 | 106 | 21845 |\n| 60 | -21846 | 1 | 106 | -21846 |\n| 60+ | -21846 | 0 | 42 | 21845 |\n| 61 | -21846 | 0 | 42 | 21845 |\n| 61 | -21846 | 0 | 106 | -21846 |\n| 61 | -21846 | 0 | 170 | 21845 |\n| 61 | -21846 | 0 | 234 | 21845 |\n| 61 | -21846 | 0 | 298 | 21845 |\n| 61 | -21846 | 0 | 362 | 21845 |\n| 61 | -21846 | 0 | 426 | 21845 |\n| 61 | -21846 | 0 | 490 | 21845 |\n| 61+ | 21845 | 1 | 106 | -21846 |\n| 62 | 21845 | 1 | 106 | 21845 |\n| 62+ | -21846 | 1 | 170 | 21845 |\n| 63 | -21846 | 1 | 170 | -21846 |\n| 63+ | -21846 | 0 | 42 | 21845 |\n| 64 | -21846 | 0 | 42 | 21845 |\n| 64 | -21846 | 0 | 106 | 21845 |\n| 64 | -21846 | 0 | 170 | -21846 |\n| 64 | -21846 | 0 | 234 | 21845 |\n| 64 | -21846 | 0 | 298 | 21845 |\n| 64 | -21846 | 0 | 362 | 21845 |\n| 64 | -21846 | 0 | 426 | 21845 |\n| 64 | -21846 | 0 | 490 | 21845 |\n| 64+ | 21845 | 1 | 170 | -21846 |\n| 65 | 21845 | 1 | 170 | 21845 |\n| 65+ | -21846 | 1 | 234 | 21845 |\n| 66 | -21846 | 1 | 234 | -21846 |\n| 66+ | -21846 | 0 | 42 | 21845 |\n| 67 | -21846 | 0 | 42 | 21845 |\n| 67 | -21846 | 0 | 106 | 21845 |\n| 67 | -21846 | 0 | 170 | 21845 |\n| 67 | -21846 | 0 | 234 | -21846 |\n| 67 | -21846 | 0 | 298 | 21845 |\n| 67 | -21846 | 0 | 362 | 21845 |\n| 67 | -21846 | 0 | 426 | 21845 |\n| 67 | -21846 | 0 | 490 | 21845 |\n| 67+ | 21845 | 1 | 234 | -21846 |\n| 68 | 21845 | 1 | 234 | 21845 |\n| 68+ | -21846 | 1 | 298 | 21845 |\n| 69 | -21846 | 1 | 298 | -21846 |\n| 69+ | -21846 | 0 | 42 | 21845 |\n| 70 | -21846 | 0 | 42 | 21845 |\n| 70 | -21846 | 0 | 106 | 21845 |\n| 70 | -21846 | 0 | 170 | 21845 |\n| 70 | -21846 | 0 | 234 | 21845 |\n| 70 | -21846 | 0 | 298 | -21846 |\n| 70 | -21846 | 0 | 362 | 21845 |\n| 70 | -21846 | 0 | 426 | 21845 |\n| 70 | -21846 | 0 | 490 | 21845 |\n| 70+ | 21845 | 1 | 298 | -21846 |\n| 71 | 21845 | 1 | 298 | 21845 |\n| 71+ | -21846 | 1 | 362 | 21845 |\n| 72 | -21846 | 1 | 362 | -21846 |\n| 72+ | -21846 | 0 | 42 | 21845 |\n| 73 | -21846 | 0 | 42 | 21845 |\n| 73 | -21846 | 0 | 106 | 21845 |\n| 73 | -21846 | 0 | 170 | 21845 |\n| 73 | -21846 | 0 | 234 | 21845 |\n| 73 | -21846 | 0 | 298 | 21845 |\n| 73 | -21846 | 0 | 362 | -21846 |\n| 73 | -21846 | 0 | 426 | 21845 |\n| 73 | -21846 | 0 | 490 | 21845 |\n| 73+ | 21845 | 1 | 362 | -21846 |\n| 74 | 21845 | 1 | 362 | 21845 |\n| 74+ | -21846 | 1 | 426 | 21845 |\n| 75 | -21846 | 1 | 426 | -21846 |\n| 75+ | -21846 | 0 | 42 | 21845 |\n| 76 | -21846 | 0 | 42 | 21845 |\n| 76 | -21846 | 0 | 106 | 21845 |\n| 76 | -21846 | 0 | 170 | 21845 |\n| 76 | -21846 | 0 | 234 | 21845 |\n| 76 | -21846 | 0 | 298 | 21845 |\n| 76 | -21846 | 0 | 362 | 21845 |\n| 76 | -21846 | 0 | 426 | -21846 |\n| 76 | -21846 | 0 | 490 | 21845 |\n| 76+ | 21845 | 1 | 426 | -21846 |\n| 77 | 21845 | 1 | 426 | 21845 |\n| 77+ | -21846 | 1 | 490 | 21845 |\n| 78 | -21846 | 1 | 490 | -21846 |\n| 78+ | -21846 | 0 | 42 | 21845 |\n| 79 | -21846 | 0 | 42 | 21845 |\n| 79 | -21846 | 0 | 106 | 21845 |\n| 79 | -21846 | 0 | 170 | 21845 |\n| 79 | -21846 | 0 | 234 | 21845 |\n| 79 | -21846 | 0 | 298 | 21845 |\n| 79 | -21846 | 0 | 362 | 21845 |\n| 79 | -21846 | 0 | 426 | 21845 |\n| 79 | -21846 | 0 | 490 | -21846 |\n| 79+ | 21845 | 1 | 490 | -21846 |\n| 80 | 21845 | 1 | 490 | 21845 |\n| 80+ | 21845 | 0 | 42 | 21845 |\n| 81 | 21845 | 0 | 42 | 21845 |\n| 81 | 21845 | 0 | 106 | 21845 |\n| 81 | 21845 | 0 | 170 | 21845 |\n| 81 | 21845 | 0 | 234 | 21845 |\n| 81 | 21845 | 0 | 298 | 21845 |\n| 81 | 21845 | 0 | 362 | 21845 |\n| 81 | 21845 | 0 | 426 | 21845 |\n| 81 | 21845 | 0 | 490 | 21845 |`;\n","export const hdl = `/**\n * Memory of 4K registers, each 16 bit-wide. Out holds the value\n * stored at the memory location specified by address. If load==1, then \n * the in value is loaded into the memory location specified by address \n * (the loaded value will be emitted to out from the next time step onward).\n */\n\nCHIP RAM4K {\n IN in[16], load, address[12];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.4.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset in 1111, set load 0, tick, output; tock, output;\nset load 1, set address 1111, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\nset in 3513, set address 3513, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 1111, eval, output;\n\nset in 4095, tick, output; tock, output;\nset load 1, set address 4095, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 3513, eval, output;\n\nset address 4095, eval, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B101010101000, tick, output; tock, output;\nset address %B101010101001, tick, output, tock, output;\nset address %B101010101010, tick, output, tock, output;\nset address %B101010101011, tick, output, tock, output;\nset address %B101010101100, tick, output, tock, output;\nset address %B101010101101, tick, output, tock, output;\nset address %B101010101110, tick, output, tock, output;\nset address %B101010101111, tick, output, tock, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101000, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101001, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101010, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101011, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101100, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B101010101111, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 1,\nset address %B101010101111, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B101010101000, tick, output; tock, output;\nset address %B101010101001, eval, output;\nset address %B101010101010, eval, output;\nset address %B101010101011, eval, output;\nset address %B101010101100, eval, output;\nset address %B101010101101, eval, output;\nset address %B101010101110, eval, output;\nset address %B101010101111, eval, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B000101010101, tick, output; tock, output;\nset address %B001101010101, tick, output, tock, output;\nset address %B010101010101, tick, output, tock, output;\nset address %B011101010101, tick, output, tock, output;\nset address %B100101010101, tick, output, tock, output;\nset address %B101101010101, tick, output, tock, output;\nset address %B110101010101, tick, output, tock, output;\nset address %B111101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B000101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B000101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B001101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B001101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B010101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B011101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B011101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B100101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B100101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B101101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B101101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B110101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B111101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;\n\nset load 1,\nset address %B111101010101, set in %B0101010101010101, tick, output, tock, output;\n\nset load 0,\nset address %B000101010101, tick, output; tock, output;\nset address %B001101010101, eval, output;\nset address %B010101010101, eval, output;\nset address %B011101010101, eval, output;\nset address %B100101010101, eval, output;\nset address %B101101010101, eval, output;\nset address %B110101010101, eval, output;\nset address %B111101010101, eval, output;`;\nexport const cmp = `| time | in |load |address | out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 1111 | 0 | 0 | 0 |\n| 3 | 1111 | 0 | 0 | 0 |\n| 3+ | 1111 | 1 | 1111 | 0 |\n| 4 | 1111 | 1 | 1111 | 1111 |\n| 4+ | 1111 | 0 | 0 | 0 |\n| 5 | 1111 | 0 | 0 | 0 |\n| 5+ | 3513 | 0 | 3513 | 0 |\n| 6 | 3513 | 0 | 3513 | 0 |\n| 6+ | 3513 | 1 | 3513 | 0 |\n| 7 | 3513 | 1 | 3513 | 3513 |\n| 7+ | 3513 | 0 | 3513 | 3513 |\n| 8 | 3513 | 0 | 3513 | 3513 |\n| 8 | 3513 | 0 | 1111 | 1111 |\n| 8+ | 4095 | 0 | 1111 | 1111 |\n| 9 | 4095 | 0 | 1111 | 1111 |\n| 9+ | 4095 | 1 | 4095 | 0 |\n| 10 | 4095 | 1 | 4095 | 4095 |\n| 10+ | 4095 | 0 | 4095 | 4095 |\n| 11 | 4095 | 0 | 4095 | 4095 |\n| 11 | 4095 | 0 | 3513 | 3513 |\n| 11 | 4095 | 0 | 4095 | 4095 |\n| 11+ | 4095 | 0 | 2728 | 0 |\n| 12 | 4095 | 0 | 2728 | 0 |\n| 12 | 4095 | 0 | 2729 | 0 |\n| 12 | 4095 | 0 | 2730 | 0 |\n| 12 | 4095 | 0 | 2731 | 0 |\n| 12 | 4095 | 0 | 2732 | 0 |\n| 12 | 4095 | 0 | 2733 | 0 |\n| 12 | 4095 | 0 | 2734 | 0 |\n| 12 | 4095 | 0 | 2735 | 0 |\n| 12+ | 21845 | 1 | 2728 | 0 |\n| 13 | 21845 | 1 | 2728 | 21845 |\n| 13+ | 21845 | 1 | 2729 | 0 |\n| 14 | 21845 | 1 | 2729 | 21845 |\n| 14+ | 21845 | 1 | 2730 | 0 |\n| 15 | 21845 | 1 | 2730 | 21845 |\n| 15+ | 21845 | 1 | 2731 | 0 |\n| 16 | 21845 | 1 | 2731 | 21845 |\n| 16+ | 21845 | 1 | 2732 | 0 |\n| 17 | 21845 | 1 | 2732 | 21845 |\n| 17+ | 21845 | 1 | 2733 | 0 |\n| 18 | 21845 | 1 | 2733 | 21845 |\n| 18+ | 21845 | 1 | 2734 | 0 |\n| 19 | 21845 | 1 | 2734 | 21845 |\n| 19+ | 21845 | 1 | 2735 | 0 |\n| 20 | 21845 | 1 | 2735 | 21845 |\n| 20+ | 21845 | 0 | 2728 | 21845 |\n| 21 | 21845 | 0 | 2728 | 21845 |\n| 21 | 21845 | 0 | 2729 | 21845 |\n| 21 | 21845 | 0 | 2730 | 21845 |\n| 21 | 21845 | 0 | 2731 | 21845 |\n| 21 | 21845 | 0 | 2732 | 21845 |\n| 21 | 21845 | 0 | 2733 | 21845 |\n| 21 | 21845 | 0 | 2734 | 21845 |\n| 21 | 21845 | 0 | 2735 | 21845 |\n| 21+ | -21846 | 1 | 2728 | 21845 |\n| 22 | -21846 | 1 | 2728 | -21846 |\n| 22+ | -21846 | 0 | 2728 | -21846 |\n| 23 | -21846 | 0 | 2728 | -21846 |\n| 23 | -21846 | 0 | 2729 | 21845 |\n| 23 | -21846 | 0 | 2730 | 21845 |\n| 23 | -21846 | 0 | 2731 | 21845 |\n| 23 | -21846 | 0 | 2732 | 21845 |\n| 23 | -21846 | 0 | 2733 | 21845 |\n| 23 | -21846 | 0 | 2734 | 21845 |\n| 23 | -21846 | 0 | 2735 | 21845 |\n| 23+ | 21845 | 1 | 2728 | -21846 |\n| 24 | 21845 | 1 | 2728 | 21845 |\n| 24+ | -21846 | 1 | 2729 | 21845 |\n| 25 | -21846 | 1 | 2729 | -21846 |\n| 25+ | -21846 | 0 | 2728 | 21845 |\n| 26 | -21846 | 0 | 2728 | 21845 |\n| 26 | -21846 | 0 | 2729 | -21846 |\n| 26 | -21846 | 0 | 2730 | 21845 |\n| 26 | -21846 | 0 | 2731 | 21845 |\n| 26 | -21846 | 0 | 2732 | 21845 |\n| 26 | -21846 | 0 | 2733 | 21845 |\n| 26 | -21846 | 0 | 2734 | 21845 |\n| 26 | -21846 | 0 | 2735 | 21845 |\n| 26+ | 21845 | 1 | 2729 | -21846 |\n| 27 | 21845 | 1 | 2729 | 21845 |\n| 27+ | -21846 | 1 | 2730 | 21845 |\n| 28 | -21846 | 1 | 2730 | -21846 |\n| 28+ | -21846 | 0 | 2728 | 21845 |\n| 29 | -21846 | 0 | 2728 | 21845 |\n| 29 | -21846 | 0 | 2729 | 21845 |\n| 29 | -21846 | 0 | 2730 | -21846 |\n| 29 | -21846 | 0 | 2731 | 21845 |\n| 29 | -21846 | 0 | 2732 | 21845 |\n| 29 | -21846 | 0 | 2733 | 21845 |\n| 29 | -21846 | 0 | 2734 | 21845 |\n| 29 | -21846 | 0 | 2735 | 21845 |\n| 29+ | 21845 | 1 | 2730 | -21846 |\n| 30 | 21845 | 1 | 2730 | 21845 |\n| 30+ | -21846 | 1 | 2731 | 21845 |\n| 31 | -21846 | 1 | 2731 | -21846 |\n| 31+ | -21846 | 0 | 2728 | 21845 |\n| 32 | -21846 | 0 | 2728 | 21845 |\n| 32 | -21846 | 0 | 2729 | 21845 |\n| 32 | -21846 | 0 | 2730 | 21845 |\n| 32 | -21846 | 0 | 2731 | -21846 |\n| 32 | -21846 | 0 | 2732 | 21845 |\n| 32 | -21846 | 0 | 2733 | 21845 |\n| 32 | -21846 | 0 | 2734 | 21845 |\n| 32 | -21846 | 0 | 2735 | 21845 |\n| 32+ | 21845 | 1 | 2731 | -21846 |\n| 33 | 21845 | 1 | 2731 | 21845 |\n| 33+ | -21846 | 1 | 2732 | 21845 |\n| 34 | -21846 | 1 | 2732 | -21846 |\n| 34+ | -21846 | 0 | 2728 | 21845 |\n| 35 | -21846 | 0 | 2728 | 21845 |\n| 35 | -21846 | 0 | 2729 | 21845 |\n| 35 | -21846 | 0 | 2730 | 21845 |\n| 35 | -21846 | 0 | 2731 | 21845 |\n| 35 | -21846 | 0 | 2732 | -21846 |\n| 35 | -21846 | 0 | 2733 | 21845 |\n| 35 | -21846 | 0 | 2734 | 21845 |\n| 35 | -21846 | 0 | 2735 | 21845 |\n| 35+ | 21845 | 1 | 2732 | -21846 |\n| 36 | 21845 | 1 | 2732 | 21845 |\n| 36+ | -21846 | 1 | 2733 | 21845 |\n| 37 | -21846 | 1 | 2733 | -21846 |\n| 37+ | -21846 | 0 | 2728 | 21845 |\n| 38 | -21846 | 0 | 2728 | 21845 |\n| 38 | -21846 | 0 | 2729 | 21845 |\n| 38 | -21846 | 0 | 2730 | 21845 |\n| 38 | -21846 | 0 | 2731 | 21845 |\n| 38 | -21846 | 0 | 2732 | 21845 |\n| 38 | -21846 | 0 | 2733 | -21846 |\n| 38 | -21846 | 0 | 2734 | 21845 |\n| 38 | -21846 | 0 | 2735 | 21845 |\n| 38+ | 21845 | 1 | 2733 | -21846 |\n| 39 | 21845 | 1 | 2733 | 21845 |\n| 39+ | -21846 | 1 | 2734 | 21845 |\n| 40 | -21846 | 1 | 2734 | -21846 |\n| 40+ | -21846 | 0 | 2728 | 21845 |\n| 41 | -21846 | 0 | 2728 | 21845 |\n| 41 | -21846 | 0 | 2729 | 21845 |\n| 41 | -21846 | 0 | 2730 | 21845 |\n| 41 | -21846 | 0 | 2731 | 21845 |\n| 41 | -21846 | 0 | 2732 | 21845 |\n| 41 | -21846 | 0 | 2733 | 21845 |\n| 41 | -21846 | 0 | 2734 | -21846 |\n| 41 | -21846 | 0 | 2735 | 21845 |\n| 41+ | 21845 | 1 | 2734 | -21846 |\n| 42 | 21845 | 1 | 2734 | 21845 |\n| 42+ | -21846 | 1 | 2735 | 21845 |\n| 43 | -21846 | 1 | 2735 | -21846 |\n| 43+ | -21846 | 0 | 2728 | 21845 |\n| 44 | -21846 | 0 | 2728 | 21845 |\n| 44 | -21846 | 0 | 2729 | 21845 |\n| 44 | -21846 | 0 | 2730 | 21845 |\n| 44 | -21846 | 0 | 2731 | 21845 |\n| 44 | -21846 | 0 | 2732 | 21845 |\n| 44 | -21846 | 0 | 2733 | 21845 |\n| 44 | -21846 | 0 | 2734 | 21845 |\n| 44 | -21846 | 0 | 2735 | -21846 |\n| 44+ | 21845 | 1 | 2735 | -21846 |\n| 45 | 21845 | 1 | 2735 | 21845 |\n| 45+ | 21845 | 0 | 2728 | 21845 |\n| 46 | 21845 | 0 | 2728 | 21845 |\n| 46 | 21845 | 0 | 2729 | 21845 |\n| 46 | 21845 | 0 | 2730 | 21845 |\n| 46 | 21845 | 0 | 2731 | 21845 |\n| 46 | 21845 | 0 | 2732 | 21845 |\n| 46 | 21845 | 0 | 2733 | 21845 |\n| 46 | 21845 | 0 | 2734 | 21845 |\n| 46 | 21845 | 0 | 2735 | 21845 |\n| 46+ | 21845 | 0 | 341 | 0 |\n| 47 | 21845 | 0 | 341 | 0 |\n| 47 | 21845 | 0 | 853 | 0 |\n| 47 | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 1877 | 0 |\n| 47 | 21845 | 0 | 2389 | 0 |\n| 47 | 21845 | 0 | 2901 | 0 |\n| 47 | 21845 | 0 | 3413 | 0 |\n| 47 | 21845 | 0 | 3925 | 0 |\n| 47+ | 21845 | 1 | 341 | 0 |\n| 48 | 21845 | 1 | 341 | 21845 |\n| 48+ | 21845 | 1 | 853 | 0 |\n| 49 | 21845 | 1 | 853 | 21845 |\n| 49+ | 21845 | 1 | 1365 | 0 |\n| 50 | 21845 | 1 | 1365 | 21845 |\n| 50+ | 21845 | 1 | 1877 | 0 |\n| 51 | 21845 | 1 | 1877 | 21845 |\n| 51+ | 21845 | 1 | 2389 | 0 |\n| 52 | 21845 | 1 | 2389 | 21845 |\n| 52+ | 21845 | 1 | 2901 | 0 |\n| 53 | 21845 | 1 | 2901 | 21845 |\n| 53+ | 21845 | 1 | 3413 | 0 |\n| 54 | 21845 | 1 | 3413 | 21845 |\n| 54+ | 21845 | 1 | 3925 | 0 |\n| 55 | 21845 | 1 | 3925 | 21845 |\n| 55+ | 21845 | 0 | 341 | 21845 |\n| 56 | 21845 | 0 | 341 | 21845 |\n| 56 | 21845 | 0 | 853 | 21845 |\n| 56 | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 1877 | 21845 |\n| 56 | 21845 | 0 | 2389 | 21845 |\n| 56 | 21845 | 0 | 2901 | 21845 |\n| 56 | 21845 | 0 | 3413 | 21845 |\n| 56 | 21845 | 0 | 3925 | 21845 |\n| 56+ | -21846 | 1 | 341 | 21845 |\n| 57 | -21846 | 1 | 341 | -21846 |\n| 57+ | -21846 | 0 | 341 | -21846 |\n| 58 | -21846 | 0 | 341 | -21846 |\n| 58 | -21846 | 0 | 853 | 21845 |\n| 58 | -21846 | 0 | 1365 | 21845 |\n| 58 | -21846 | 0 | 1877 | 21845 |\n| 58 | -21846 | 0 | 2389 | 21845 |\n| 58 | -21846 | 0 | 2901 | 21845 |\n| 58 | -21846 | 0 | 3413 | 21845 |\n| 58 | -21846 | 0 | 3925 | 21845 |\n| 58+ | 21845 | 1 | 341 | -21846 |\n| 59 | 21845 | 1 | 341 | 21845 |\n| 59+ | -21846 | 1 | 853 | 21845 |\n| 60 | -21846 | 1 | 853 | -21846 |\n| 60+ | -21846 | 0 | 341 | 21845 |\n| 61 | -21846 | 0 | 341 | 21845 |\n| 61 | -21846 | 0 | 853 | -21846 |\n| 61 | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 1877 | 21845 |\n| 61 | -21846 | 0 | 2389 | 21845 |\n| 61 | -21846 | 0 | 2901 | 21845 |\n| 61 | -21846 | 0 | 3413 | 21845 |\n| 61 | -21846 | 0 | 3925 | 21845 |\n| 61+ | 21845 | 1 | 853 | -21846 |\n| 62 | 21845 | 1 | 853 | 21845 |\n| 62+ | -21846 | 1 | 1365 | 21845 |\n| 63 | -21846 | 1 | 1365 | -21846 |\n| 63+ | -21846 | 0 | 341 | 21845 |\n| 64 | -21846 | 0 | 341 | 21845 |\n| 64 | -21846 | 0 | 853 | 21845 |\n| 64 | -21846 | 0 | 1365 | -21846 |\n| 64 | -21846 | 0 | 1877 | 21845 |\n| 64 | -21846 | 0 | 2389 | 21845 |\n| 64 | -21846 | 0 | 2901 | 21845 |\n| 64 | -21846 | 0 | 3413 | 21845 |\n| 64 | -21846 | 0 | 3925 | 21845 |\n| 64+ | 21845 | 1 | 1365 | -21846 |\n| 65 | 21845 | 1 | 1365 | 21845 |\n| 65+ | -21846 | 1 | 1877 | 21845 |\n| 66 | -21846 | 1 | 1877 | -21846 |\n| 66+ | -21846 | 0 | 341 | 21845 |\n| 67 | -21846 | 0 | 341 | 21845 |\n| 67 | -21846 | 0 | 853 | 21845 |\n| 67 | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 1877 | -21846 |\n| 67 | -21846 | 0 | 2389 | 21845 |\n| 67 | -21846 | 0 | 2901 | 21845 |\n| 67 | -21846 | 0 | 3413 | 21845 |\n| 67 | -21846 | 0 | 3925 | 21845 |\n| 67+ | 21845 | 1 | 1877 | -21846 |\n| 68 | 21845 | 1 | 1877 | 21845 |\n| 68+ | -21846 | 1 | 2389 | 21845 |\n| 69 | -21846 | 1 | 2389 | -21846 |\n| 69+ | -21846 | 0 | 341 | 21845 |\n| 70 | -21846 | 0 | 341 | 21845 |\n| 70 | -21846 | 0 | 853 | 21845 |\n| 70 | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 1877 | 21845 |\n| 70 | -21846 | 0 | 2389 | -21846 |\n| 70 | -21846 | 0 | 2901 | 21845 |\n| 70 | -21846 | 0 | 3413 | 21845 |\n| 70 | -21846 | 0 | 3925 | 21845 |\n| 70+ | 21845 | 1 | 2389 | -21846 |\n| 71 | 21845 | 1 | 2389 | 21845 |\n| 71+ | -21846 | 1 | 2901 | 21845 |\n| 72 | -21846 | 1 | 2901 | -21846 |\n| 72+ | -21846 | 0 | 341 | 21845 |\n| 73 | -21846 | 0 | 341 | 21845 |\n| 73 | -21846 | 0 | 853 | 21845 |\n| 73 | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 1877 | 21845 |\n| 73 | -21846 | 0 | 2389 | 21845 |\n| 73 | -21846 | 0 | 2901 | -21846 |\n| 73 | -21846 | 0 | 3413 | 21845 |\n| 73 | -21846 | 0 | 3925 | 21845 |\n| 73+ | 21845 | 1 | 2901 | -21846 |\n| 74 | 21845 | 1 | 2901 | 21845 |\n| 74+ | -21846 | 1 | 3413 | 21845 |\n| 75 | -21846 | 1 | 3413 | -21846 |\n| 75+ | -21846 | 0 | 341 | 21845 |\n| 76 | -21846 | 0 | 341 | 21845 |\n| 76 | -21846 | 0 | 853 | 21845 |\n| 76 | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 1877 | 21845 |\n| 76 | -21846 | 0 | 2389 | 21845 |\n| 76 | -21846 | 0 | 2901 | 21845 |\n| 76 | -21846 | 0 | 3413 | -21846 |\n| 76 | -21846 | 0 | 3925 | 21845 |\n| 76+ | 21845 | 1 | 3413 | -21846 |\n| 77 | 21845 | 1 | 3413 | 21845 |\n| 77+ | -21846 | 1 | 3925 | 21845 |\n| 78 | -21846 | 1 | 3925 | -21846 |\n| 78+ | -21846 | 0 | 341 | 21845 |\n| 79 | -21846 | 0 | 341 | 21845 |\n| 79 | -21846 | 0 | 853 | 21845 |\n| 79 | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 1877 | 21845 |\n| 79 | -21846 | 0 | 2389 | 21845 |\n| 79 | -21846 | 0 | 2901 | 21845 |\n| 79 | -21846 | 0 | 3413 | 21845 |\n| 79 | -21846 | 0 | 3925 | -21846 |\n| 79+ | 21845 | 1 | 3925 | -21846 |\n| 80 | 21845 | 1 | 3925 | 21845 |\n| 80+ | 21845 | 0 | 341 | 21845 |\n| 81 | 21845 | 0 | 341 | 21845 |\n| 81 | 21845 | 0 | 853 | 21845 |\n| 81 | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 1877 | 21845 |\n| 81 | 21845 | 0 | 2389 | 21845 |\n| 81 | 21845 | 0 | 2901 | 21845 |\n| 81 | 21845 | 0 | 3413 | 21845 |\n| 81 | 21845 | 0 | 3925 | 21845 |`;\n","export const hdl = `\nCHIP RAM16K {\n IN in[16], load, address[14];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.5.2 out%D1.6.1;\n\nset in 0, set load 0, set address 0, tick, output; tock, output;\nset load 1, tick, output; tock, output;\n\nset in 4321, set load 0, tick, output; tock, output;\nset load 1, set address 4321, tick, output; tock, output;\nset load 0, set address 0, tick, output; tock, output;\n\nset in 12345, set address 12345, tick, output; tock, output;\nset load 1, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 4321, eval, output;\n\nset in 16383, tick, output; tock, output;\nset load 1, set address 16383, tick, output; tock, output;\nset load 0, tick, output; tock, output;\nset address 12345, eval, output;\nset address 16383, eval, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set in %B0101010101010101, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, tick, output, tock, output;\nset address %B10101010101010, tick, output, tock, output;\nset address %B10101010101011, tick, output, tock, output;\nset address %B10101010101100, tick, output, tock, output;\nset address %B10101010101101, tick, output, tock, output;\nset address %B10101010101110, tick, output, tock, output;\nset address %B10101010101111, tick, output, tock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101000, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101000, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101001, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output;\ntock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1, set address %B10101010101001, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101010, set in %B1010101010101010, tick, output;\ntock, output;\n\nset load 0, set address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1;\nset address %B10101010101010, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101011, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0, set address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101011, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101100, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101100, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101110, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101110, set in %B0101010101010101, tick, output, tock, output;\nset address %B10101010101111, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 1,\nset address %B10101010101111, set in %B0101010101010101, tick, output, tock, output;\nset load 0,\nset address %B10101010101000, tick, output; tock, output;\nset address %B10101010101001, eval, output;\nset address %B10101010101010, eval, output;\nset address %B10101010101011, eval, output;\nset address %B10101010101100, eval, output;\nset address %B10101010101101, eval, output;\nset address %B10101010101110, eval, output;\nset address %B10101010101111, eval, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset in %B0101010101010101, set address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, tick, output, tock, output;\nset address %B01010101010101, tick, output, tock, output;\nset address %B01110101010101, tick, output, tock, output;\nset address %B10010101010101, tick, output, tock, output;\nset address %B10110101010101, tick, output, tock, output;\nset address %B11010101010101, tick, output, tock, output;\nset address %B11110101010101, tick, output, tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00010101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B00110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B00110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B01010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B01010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B01110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B01110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B10010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B10110101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B10110101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B11010101010101, set in %B1010101010101010, tick, output; tock, output;\n\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B11010101010101, set in %B0101010101010101, tick, output, tock, output;\nset address %B11110101010101, set in %B1010101010101010, tick, output; tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;\n\nset load 1,\nset address %B11110101010101, set in %B0101010101010101, tick, output, tock, output;\nset load 0,\nset address %B00010101010101, tick, output; tock, output;\nset address %B00110101010101, eval, output;\nset address %B01010101010101, eval, output;\nset address %B01110101010101, eval, output;\nset address %B10010101010101, eval, output;\nset address %B10110101010101, eval, output;\nset address %B11010101010101, eval, output;\nset address %B11110101010101, eval, output;`;\nexport const cmp = `| time | in |load | address | out |\n| 0+ | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 0 |\n| 1+ | 0 | 1 | 0 | 0 |\n| 2 | 0 | 1 | 0 | 0 |\n| 2+ | 4321 | 0 | 0 | 0 |\n| 3 | 4321 | 0 | 0 | 0 |\n| 3+ | 4321 | 1 | 4321 | 0 |\n| 4 | 4321 | 1 | 4321 | 4321 |\n| 4+ | 4321 | 0 | 0 | 0 |\n| 5 | 4321 | 0 | 0 | 0 |\n| 5+ | 12345 | 0 | 12345 | 0 |\n| 6 | 12345 | 0 | 12345 | 0 |\n| 6+ | 12345 | 1 | 12345 | 0 |\n| 7 | 12345 | 1 | 12345 | 12345 |\n| 7+ | 12345 | 0 | 12345 | 12345 |\n| 8 | 12345 | 0 | 12345 | 12345 |\n| 8 | 12345 | 0 | 4321 | 4321 |\n| 8+ | 16383 | 0 | 4321 | 4321 |\n| 9 | 16383 | 0 | 4321 | 4321 |\n| 9+ | 16383 | 1 | 16383 | 0 |\n| 10 | 16383 | 1 | 16383 | 16383 |\n| 10+ | 16383 | 0 | 16383 | 16383 |\n| 11 | 16383 | 0 | 16383 | 16383 |\n| 11 | 16383 | 0 | 12345 | 12345 |\n| 11 | 16383 | 0 | 16383 | 16383 |\n| 11+ | 16383 | 0 | 10920 | 0 |\n| 12 | 16383 | 0 | 10920 | 0 |\n| 12 | 16383 | 0 | 10921 | 0 |\n| 12 | 16383 | 0 | 10922 | 0 |\n| 12 | 16383 | 0 | 10923 | 0 |\n| 12 | 16383 | 0 | 10924 | 0 |\n| 12 | 16383 | 0 | 10925 | 0 |\n| 12 | 16383 | 0 | 10926 | 0 |\n| 12 | 16383 | 0 | 10927 | 0 |\n| 12+ | 21845 | 1 | 10920 | 0 |\n| 13 | 21845 | 1 | 10920 | 21845 |\n| 13+ | 21845 | 1 | 10921 | 0 |\n| 14 | 21845 | 1 | 10921 | 21845 |\n| 14+ | 21845 | 1 | 10922 | 0 |\n| 15 | 21845 | 1 | 10922 | 21845 |\n| 15+ | 21845 | 1 | 10923 | 0 |\n| 16 | 21845 | 1 | 10923 | 21845 |\n| 16+ | 21845 | 1 | 10924 | 0 |\n| 17 | 21845 | 1 | 10924 | 21845 |\n| 17+ | 21845 | 1 | 10925 | 0 |\n| 18 | 21845 | 1 | 10925 | 21845 |\n| 18+ | 21845 | 1 | 10926 | 0 |\n| 19 | 21845 | 1 | 10926 | 21845 |\n| 19+ | 21845 | 1 | 10927 | 0 |\n| 20 | 21845 | 1 | 10927 | 21845 |\n| 20+ | 21845 | 0 | 10920 | 21845 |\n| 21 | 21845 | 0 | 10920 | 21845 |\n| 21 | 21845 | 0 | 10921 | 21845 |\n| 21 | 21845 | 0 | 10922 | 21845 |\n| 21 | 21845 | 0 | 10923 | 21845 |\n| 21 | 21845 | 0 | 10924 | 21845 |\n| 21 | 21845 | 0 | 10925 | 21845 |\n| 21 | 21845 | 0 | 10926 | 21845 |\n| 21 | 21845 | 0 | 10927 | 21845 |\n| 21+ | -21846 | 1 | 10920 | 21845 |\n| 22 | -21846 | 1 | 10920 | -21846 |\n| 22+ | -21846 | 0 | 10920 | -21846 |\n| 23 | -21846 | 0 | 10920 | -21846 |\n| 23 | -21846 | 0 | 10921 | 21845 |\n| 23 | -21846 | 0 | 10922 | 21845 |\n| 23 | -21846 | 0 | 10923 | 21845 |\n| 23 | -21846 | 0 | 10924 | 21845 |\n| 23 | -21846 | 0 | 10925 | 21845 |\n| 23 | -21846 | 0 | 10926 | 21845 |\n| 23 | -21846 | 0 | 10927 | 21845 |\n| 23+ | 21845 | 1 | 10920 | -21846 |\n| 24 | 21845 | 1 | 10920 | 21845 |\n| 24+ | -21846 | 1 | 10921 | 21845 |\n| 25 | -21846 | 1 | 10921 | -21846 |\n| 25+ | -21846 | 0 | 10920 | 21845 |\n| 26 | -21846 | 0 | 10920 | 21845 |\n| 26 | -21846 | 0 | 10921 | -21846 |\n| 26 | -21846 | 0 | 10922 | 21845 |\n| 26 | -21846 | 0 | 10923 | 21845 |\n| 26 | -21846 | 0 | 10924 | 21845 |\n| 26 | -21846 | 0 | 10925 | 21845 |\n| 26 | -21846 | 0 | 10926 | 21845 |\n| 26 | -21846 | 0 | 10927 | 21845 |\n| 26+ | 21845 | 1 | 10921 | -21846 |\n| 27 | 21845 | 1 | 10921 | 21845 |\n| 27+ | -21846 | 1 | 10922 | 21845 |\n| 28 | -21846 | 1 | 10922 | -21846 |\n| 28+ | -21846 | 0 | 10920 | 21845 |\n| 29 | -21846 | 0 | 10920 | 21845 |\n| 29 | -21846 | 0 | 10921 | 21845 |\n| 29 | -21846 | 0 | 10922 | -21846 |\n| 29 | -21846 | 0 | 10923 | 21845 |\n| 29 | -21846 | 0 | 10924 | 21845 |\n| 29 | -21846 | 0 | 10925 | 21845 |\n| 29 | -21846 | 0 | 10926 | 21845 |\n| 29 | -21846 | 0 | 10927 | 21845 |\n| 29+ | 21845 | 1 | 10922 | -21846 |\n| 30 | 21845 | 1 | 10922 | 21845 |\n| 30+ | -21846 | 1 | 10923 | 21845 |\n| 31 | -21846 | 1 | 10923 | -21846 |\n| 31+ | -21846 | 0 | 10920 | 21845 |\n| 32 | -21846 | 0 | 10920 | 21845 |\n| 32 | -21846 | 0 | 10921 | 21845 |\n| 32 | -21846 | 0 | 10922 | 21845 |\n| 32 | -21846 | 0 | 10923 | -21846 |\n| 32 | -21846 | 0 | 10924 | 21845 |\n| 32 | -21846 | 0 | 10925 | 21845 |\n| 32 | -21846 | 0 | 10926 | 21845 |\n| 32 | -21846 | 0 | 10927 | 21845 |\n| 32+ | 21845 | 1 | 10923 | -21846 |\n| 33 | 21845 | 1 | 10923 | 21845 |\n| 33+ | -21846 | 1 | 10924 | 21845 |\n| 34 | -21846 | 1 | 10924 | -21846 |\n| 34+ | -21846 | 0 | 10920 | 21845 |\n| 35 | -21846 | 0 | 10920 | 21845 |\n| 35 | -21846 | 0 | 10921 | 21845 |\n| 35 | -21846 | 0 | 10922 | 21845 |\n| 35 | -21846 | 0 | 10923 | 21845 |\n| 35 | -21846 | 0 | 10924 | -21846 |\n| 35 | -21846 | 0 | 10925 | 21845 |\n| 35 | -21846 | 0 | 10926 | 21845 |\n| 35 | -21846 | 0 | 10927 | 21845 |\n| 35+ | 21845 | 1 | 10924 | -21846 |\n| 36 | 21845 | 1 | 10924 | 21845 |\n| 36+ | -21846 | 1 | 10925 | 21845 |\n| 37 | -21846 | 1 | 10925 | -21846 |\n| 37+ | -21846 | 0 | 10920 | 21845 |\n| 38 | -21846 | 0 | 10920 | 21845 |\n| 38 | -21846 | 0 | 10921 | 21845 |\n| 38 | -21846 | 0 | 10922 | 21845 |\n| 38 | -21846 | 0 | 10923 | 21845 |\n| 38 | -21846 | 0 | 10924 | 21845 |\n| 38 | -21846 | 0 | 10925 | -21846 |\n| 38 | -21846 | 0 | 10926 | 21845 |\n| 38 | -21846 | 0 | 10927 | 21845 |\n| 38+ | 21845 | 1 | 10925 | -21846 |\n| 39 | 21845 | 1 | 10925 | 21845 |\n| 39+ | -21846 | 1 | 10926 | 21845 |\n| 40 | -21846 | 1 | 10926 | -21846 |\n| 40+ | -21846 | 0 | 10920 | 21845 |\n| 41 | -21846 | 0 | 10920 | 21845 |\n| 41 | -21846 | 0 | 10921 | 21845 |\n| 41 | -21846 | 0 | 10922 | 21845 |\n| 41 | -21846 | 0 | 10923 | 21845 |\n| 41 | -21846 | 0 | 10924 | 21845 |\n| 41 | -21846 | 0 | 10925 | 21845 |\n| 41 | -21846 | 0 | 10926 | -21846 |\n| 41 | -21846 | 0 | 10927 | 21845 |\n| 41+ | 21845 | 1 | 10926 | -21846 |\n| 42 | 21845 | 1 | 10926 | 21845 |\n| 42+ | -21846 | 1 | 10927 | 21845 |\n| 43 | -21846 | 1 | 10927 | -21846 |\n| 43+ | -21846 | 0 | 10920 | 21845 |\n| 44 | -21846 | 0 | 10920 | 21845 |\n| 44 | -21846 | 0 | 10921 | 21845 |\n| 44 | -21846 | 0 | 10922 | 21845 |\n| 44 | -21846 | 0 | 10923 | 21845 |\n| 44 | -21846 | 0 | 10924 | 21845 |\n| 44 | -21846 | 0 | 10925 | 21845 |\n| 44 | -21846 | 0 | 10926 | 21845 |\n| 44 | -21846 | 0 | 10927 | -21846 |\n| 44+ | 21845 | 1 | 10927 | -21846 |\n| 45 | 21845 | 1 | 10927 | 21845 |\n| 45+ | 21845 | 0 | 10920 | 21845 |\n| 46 | 21845 | 0 | 10920 | 21845 |\n| 46 | 21845 | 0 | 10921 | 21845 |\n| 46 | 21845 | 0 | 10922 | 21845 |\n| 46 | 21845 | 0 | 10923 | 21845 |\n| 46 | 21845 | 0 | 10924 | 21845 |\n| 46 | 21845 | 0 | 10925 | 21845 |\n| 46 | 21845 | 0 | 10926 | 21845 |\n| 46 | 21845 | 0 | 10927 | 21845 |\n| 46+ | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 1365 | 0 |\n| 47 | 21845 | 0 | 3413 | 0 |\n| 47 | 21845 | 0 | 5461 | 0 |\n| 47 | 21845 | 0 | 7509 | 0 |\n| 47 | 21845 | 0 | 9557 | 0 |\n| 47 | 21845 | 0 | 11605 | 0 |\n| 47 | 21845 | 0 | 13653 | 0 |\n| 47 | 21845 | 0 | 15701 | 0 |\n| 47+ | 21845 | 1 | 1365 | 0 |\n| 48 | 21845 | 1 | 1365 | 21845 |\n| 48+ | 21845 | 1 | 3413 | 0 |\n| 49 | 21845 | 1 | 3413 | 21845 |\n| 49+ | 21845 | 1 | 5461 | 0 |\n| 50 | 21845 | 1 | 5461 | 21845 |\n| 50+ | 21845 | 1 | 7509 | 0 |\n| 51 | 21845 | 1 | 7509 | 21845 |\n| 51+ | 21845 | 1 | 9557 | 0 |\n| 52 | 21845 | 1 | 9557 | 21845 |\n| 52+ | 21845 | 1 | 11605 | 0 |\n| 53 | 21845 | 1 | 11605 | 21845 |\n| 53+ | 21845 | 1 | 13653 | 0 |\n| 54 | 21845 | 1 | 13653 | 21845 |\n| 54+ | 21845 | 1 | 15701 | 0 |\n| 55 | 21845 | 1 | 15701 | 21845 |\n| 55+ | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 1365 | 21845 |\n| 56 | 21845 | 0 | 3413 | 21845 |\n| 56 | 21845 | 0 | 5461 | 21845 |\n| 56 | 21845 | 0 | 7509 | 21845 |\n| 56 | 21845 | 0 | 9557 | 21845 |\n| 56 | 21845 | 0 | 11605 | 21845 |\n| 56 | 21845 | 0 | 13653 | 21845 |\n| 56 | 21845 | 0 | 15701 | 21845 |\n| 56+ | -21846 | 1 | 1365 | 21845 |\n| 57 | -21846 | 1 | 1365 | -21846 |\n| 57+ | -21846 | 0 | 1365 | -21846 |\n| 58 | -21846 | 0 | 1365 | -21846 |\n| 58 | -21846 | 0 | 3413 | 21845 |\n| 58 | -21846 | 0 | 5461 | 21845 |\n| 58 | -21846 | 0 | 7509 | 21845 |\n| 58 | -21846 | 0 | 9557 | 21845 |\n| 58 | -21846 | 0 | 11605 | 21845 |\n| 58 | -21846 | 0 | 13653 | 21845 |\n| 58 | -21846 | 0 | 15701 | 21845 |\n| 58+ | 21845 | 1 | 1365 | -21846 |\n| 59 | 21845 | 1 | 1365 | 21845 |\n| 59+ | -21846 | 1 | 3413 | 21845 |\n| 60 | -21846 | 1 | 3413 | -21846 |\n| 60+ | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 1365 | 21845 |\n| 61 | -21846 | 0 | 3413 | -21846 |\n| 61 | -21846 | 0 | 5461 | 21845 |\n| 61 | -21846 | 0 | 7509 | 21845 |\n| 61 | -21846 | 0 | 9557 | 21845 |\n| 61 | -21846 | 0 | 11605 | 21845 |\n| 61 | -21846 | 0 | 13653 | 21845 |\n| 61 | -21846 | 0 | 15701 | 21845 |\n| 61+ | 21845 | 1 | 3413 | -21846 |\n| 62 | 21845 | 1 | 3413 | 21845 |\n| 62+ | -21846 | 1 | 5461 | 21845 |\n| 63 | -21846 | 1 | 5461 | -21846 |\n| 63+ | -21846 | 0 | 1365 | 21845 |\n| 64 | -21846 | 0 | 1365 | 21845 |\n| 64 | -21846 | 0 | 3413 | 21845 |\n| 64 | -21846 | 0 | 5461 | -21846 |\n| 64 | -21846 | 0 | 7509 | 21845 |\n| 64 | -21846 | 0 | 9557 | 21845 |\n| 64 | -21846 | 0 | 11605 | 21845 |\n| 64 | -21846 | 0 | 13653 | 21845 |\n| 64 | -21846 | 0 | 15701 | 21845 |\n| 64+ | 21845 | 1 | 5461 | -21846 |\n| 65 | 21845 | 1 | 5461 | 21845 |\n| 65+ | -21846 | 1 | 7509 | 21845 |\n| 66 | -21846 | 1 | 7509 | -21846 |\n| 66+ | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 1365 | 21845 |\n| 67 | -21846 | 0 | 3413 | 21845 |\n| 67 | -21846 | 0 | 5461 | 21845 |\n| 67 | -21846 | 0 | 7509 | -21846 |\n| 67 | -21846 | 0 | 9557 | 21845 |\n| 67 | -21846 | 0 | 11605 | 21845 |\n| 67 | -21846 | 0 | 13653 | 21845 |\n| 67 | -21846 | 0 | 15701 | 21845 |\n| 67+ | 21845 | 1 | 7509 | -21846 |\n| 68 | 21845 | 1 | 7509 | 21845 |\n| 68+ | -21846 | 1 | 9557 | 21845 |\n| 69 | -21846 | 1 | 9557 | -21846 |\n| 69+ | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 1365 | 21845 |\n| 70 | -21846 | 0 | 3413 | 21845 |\n| 70 | -21846 | 0 | 5461 | 21845 |\n| 70 | -21846 | 0 | 7509 | 21845 |\n| 70 | -21846 | 0 | 9557 | -21846 |\n| 70 | -21846 | 0 | 11605 | 21845 |\n| 70 | -21846 | 0 | 13653 | 21845 |\n| 70 | -21846 | 0 | 15701 | 21845 |\n| 70+ | 21845 | 1 | 9557 | -21846 |\n| 71 | 21845 | 1 | 9557 | 21845 |\n| 71+ | -21846 | 1 | 11605 | 21845 |\n| 72 | -21846 | 1 | 11605 | -21846 |\n| 72+ | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 1365 | 21845 |\n| 73 | -21846 | 0 | 3413 | 21845 |\n| 73 | -21846 | 0 | 5461 | 21845 |\n| 73 | -21846 | 0 | 7509 | 21845 |\n| 73 | -21846 | 0 | 9557 | 21845 |\n| 73 | -21846 | 0 | 11605 | -21846 |\n| 73 | -21846 | 0 | 13653 | 21845 |\n| 73 | -21846 | 0 | 15701 | 21845 |\n| 73+ | 21845 | 1 | 11605 | -21846 |\n| 74 | 21845 | 1 | 11605 | 21845 |\n| 74+ | -21846 | 1 | 13653 | 21845 |\n| 75 | -21846 | 1 | 13653 | -21846 |\n| 75+ | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 1365 | 21845 |\n| 76 | -21846 | 0 | 3413 | 21845 |\n| 76 | -21846 | 0 | 5461 | 21845 |\n| 76 | -21846 | 0 | 7509 | 21845 |\n| 76 | -21846 | 0 | 9557 | 21845 |\n| 76 | -21846 | 0 | 11605 | 21845 |\n| 76 | -21846 | 0 | 13653 | -21846 |\n| 76 | -21846 | 0 | 15701 | 21845 |\n| 76+ | 21845 | 1 | 13653 | -21846 |\n| 77 | 21845 | 1 | 13653 | 21845 |\n| 77+ | -21846 | 1 | 15701 | 21845 |\n| 78 | -21846 | 1 | 15701 | -21846 |\n| 78+ | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 1365 | 21845 |\n| 79 | -21846 | 0 | 3413 | 21845 |\n| 79 | -21846 | 0 | 5461 | 21845 |\n| 79 | -21846 | 0 | 7509 | 21845 |\n| 79 | -21846 | 0 | 9557 | 21845 |\n| 79 | -21846 | 0 | 11605 | 21845 |\n| 79 | -21846 | 0 | 13653 | 21845 |\n| 79 | -21846 | 0 | 15701 | -21846 |\n| 79+ | 21845 | 1 | 15701 | -21846 |\n| 80 | 21845 | 1 | 15701 | 21845 |\n| 80+ | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 1365 | 21845 |\n| 81 | 21845 | 0 | 3413 | 21845 |\n| 81 | 21845 | 0 | 5461 | 21845 |\n| 81 | 21845 | 0 | 7509 | 21845 |\n| 81 | 21845 | 0 | 9557 | 21845 |\n| 81 | 21845 | 0 | 11605 | 21845 |\n| 81 | 21845 | 0 | 13653 | 21845 |\n| 81 | 21845 | 0 | 15701 | 21845 |`;\n","export const hdl = `/**\n * The complete address space of the Hack computer's memory,\n * including RAM and memory-mapped I/O. \n * The chip facilitates read and write operations, as follows:\n * Read: out(t) = Memory[address(t)](t)\n * Write: if load(t-1) then Memory[address(t-1)](t) = in(t-1)\n * In words: the chip always outputs the value stored at the memory \n * location specified by address. If load==1, the in value is loaded \n * into the memory location specified by address. This value becomes \n * available through the out output from the next time step onward.\n * Address space rules:\n * Only the upper 16K+8K+1 words of the Memory chip are used. \n * Access to address>0x6000 is invalid. Access to any address in \n * the range 0x4000-0x5FFF results in accessing the screen memory \n * map. Access to address 0x6000 results in accessing the keyboard \n * memory map. The behavior in these addresses is described in the \n * Screen and Keyboard chip specifications given in the book.\n */\n\nCHIP Memory {\n IN in[16], load, address[15];\n OUT out[16];\n\n PARTS:\n}`;\nexport const tst = `output-list in%D1.6.1 load%B2.1.2 address%B1.15.1 out%D1.6.1;\n\n// Set RAM[0] = -1\nset address 0,\nset in -1, set load 1, tick, output; tock, output;\n\n// RAM[0] holds value\nset in 9999, set load 0, tick, output; tock, output;\n\n// Did not also write to upper RAM or Screen\nset address %X2000, eval, output;\nset address %X4000, eval, output;\n\n// Set RAM[0x2000] = 2222\nset address %X2000,\nset in 2222, set load 1, tick, output; tock, output;\n\n// RAM[0x2000] holds value\nset in 9999, set load 0, tick, output; tock, output;\n\n// Did not also write to lower RAM or Screen\nset address 0, eval, output;\nset address %X4000, eval, output;\n\nset load 0,\t// Low order address bits connected\nset address %X0001, eval, output;\nset address %X0002, eval, output;\nset address %X0004, eval, output;\nset address %X0008, eval, output;\nset address %X0010, eval, output;\nset address %X0020, eval, output;\nset address %X0040, eval, output;\nset address %X0080, eval, output;\nset address %X0100, eval, output;\nset address %X0200, eval, output;\nset address %X0400, eval, output;\nset address %X0800, eval, output;\nset address %X1000, eval, output;\nset address %X2000, eval, output;\n\n// RAM[1234] = 1234\nset address %X1234,\nset in 1234, set load 1, tick, output; tock, output;\n\n// Did not also write to upper RAM or Screen \nset load 0,\nset address %X2234, eval, output;\nset address %X6234, eval, output;\n\n// RAM[0x2345] = 2345\nset address %X2345,\nset in 2345, set load 1, tick, output; tock, output;\n\n// Did not also write to lower RAM or Screen \nset load 0,\nset address %X0345, eval, output;\nset address %X4345, eval, output;\n\n// Keyboard test\n\n// set address 24576,\n// echo \"Click the Keyboard icon and hold down the 'K' key (uppercase) until you see the next message (it should appear shortly after that) ...\",\n// It's important to keep holding the key down since if the system is busy,\n// the memory will zero itself before being outputted.\n\n/*\nset Keyboard 'K';\nwhile out <> 75 {\n eval,\n}\nclear-echo, output;\noutput;\n*/\n\n// Screen test\n\nset load 1, set in -1, set address %X4FCF, tick, tock, output;\nset address %X504F, tick, tock, output;\n\n// Did not also write to lower or upper RAM\nset address %X0FCF, eval, output;\nset address %X2FCF, eval, output;\n\nset load 0,\t\t\t\t// Low order address bits connected\nset address %X4FCE, eval, output;\nset address %X4FCD, eval, output;\nset address %X4FCB, eval, output;\nset address %X4FC7, eval, output;\nset address %X4FDF, eval, output;\nset address %X4FEF, eval, output;\nset address %X4F8F, eval, output;\nset address %X4F4F, eval, output;\nset address %X4ECF, eval, output;\nset address %X4DCF, eval, output;\nset address %X4BCF, eval, output;\nset address %X47CF, eval, output;\nset address %X5FCF, eval, output;\n\n\nset load 0, set address 24576,\necho \"Make sure you see ONLY two horizontal lines in the middle of the screen. Change Keyboard to 'Y' (uppercase) to continue ...\";\n\n/*\nwhile out <> 89 {\n eval;\n}\n*/\nclear-echo;`;\nexport const cmp = `| in |load | address | out |\n| -1 | 1 | 000000000000000 | 0 |\n| -1 | 1 | 000000000000000 | -1 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 010000000000000 | 0 |\n| 9999 | 0 | 100000000000000 | 0 |\n| 2222 | 1 | 010000000000000 | 0 |\n| 2222 | 1 | 010000000000000 | 2222 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 9999 | 0 | 000000000000000 | -1 |\n| 9999 | 0 | 100000000000000 | 0 |\n| 9999 | 0 | 000000000000001 | 0 |\n| 9999 | 0 | 000000000000010 | 0 |\n| 9999 | 0 | 000000000000100 | 0 |\n| 9999 | 0 | 000000000001000 | 0 |\n| 9999 | 0 | 000000000010000 | 0 |\n| 9999 | 0 | 000000000100000 | 0 |\n| 9999 | 0 | 000000001000000 | 0 |\n| 9999 | 0 | 000000010000000 | 0 |\n| 9999 | 0 | 000000100000000 | 0 |\n| 9999 | 0 | 000001000000000 | 0 |\n| 9999 | 0 | 000010000000000 | 0 |\n| 9999 | 0 | 000100000000000 | 0 |\n| 9999 | 0 | 001000000000000 | 0 |\n| 9999 | 0 | 010000000000000 | 2222 |\n| 1234 | 1 | 001001000110100 | 0 |\n| 1234 | 1 | 001001000110100 | 1234 |\n| 1234 | 0 | 010001000110100 | 0 |\n| 1234 | 0 | 110001000110100 | 0 |\n| 2345 | 1 | 010001101000101 | 0 |\n| 2345 | 1 | 010001101000101 | 2345 |\n| 2345 | 0 | 000001101000101 | 0 |\n| 2345 | 0 | 100001101000101 | 0 |\n| -1 | 1 | 100111111001111 | -1 |\n| -1 | 1 | 101000001001111 | -1 |\n| -1 | 1 | 000111111001111 | 0 |\n| -1 | 1 | 010111111001111 | 0 |\n| -1 | 0 | 100111111001110 | 0 |\n| -1 | 0 | 100111111001101 | 0 |\n| -1 | 0 | 100111111001011 | 0 |\n| -1 | 0 | 100111111000111 | 0 |\n| -1 | 0 | 100111111011111 | 0 |\n| -1 | 0 | 100111111101111 | 0 |\n| -1 | 0 | 100111110001111 | 0 |\n| -1 | 0 | 100111101001111 | 0 |\n| -1 | 0 | 100111011001111 | 0 |\n| -1 | 0 | 100110111001111 | 0 |\n| -1 | 0 | 100101111001111 | 0 |\n| -1 | 0 | 100011111001111 | 0 |\n| -1 | 0 | 101111111001111 | 0 |`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Memory from \"./01_memory.js\";\nimport * as CPU from \"./02_cpu.js\";\nimport * as Computer from \"./03_computer.js\";\n\nexport const CHIPS = {\n Memory: {\n \"Memory.hdl\": Memory.hdl,\n \"Memory.tst\": Memory.tst,\n \"Memory.cmp\": Memory.cmp,\n },\n CPU: {\n \"CPU.hdl\": CPU.hdl,\n \"CPU.tst\": CPU.tst,\n \"CPU.cmp\": CPU.cmp,\n },\n Computer: {\n \"Computer.hdl\": Computer.hdl,\n \"Computer.tst\": Computer.tst,\n \"Computer.cmp\": Computer.cmp,\n \"Max.hack\": Computer.hack,\n },\n};\n\nexport async function resetFiles(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/05\");\n await reset(fs, CHIPS);\n await fs.popd();\n}\n","export const hdl = `/**\n * The Hack CPU (Central Processing unit), consisting of an ALU,\n * two registers named A and D, and a program counter named PC.\n * The CPU is designed to fetch and execute instructions written in \n * the Hack machine language. In particular, functions as follows:\n * Executes the inputted instruction according to the Hack machine \n * language specification. The D and A in the language specification\n * refer to CPU-resident registers, while M refers to the external\n * memory location addressed by A, i.e. to Memory[A]. The inM input \n * holds the value of this location. If the current instruction needs \n * to write a value to M, the value is placed in outM, the address \n * of the target location is placed in the addressM output, and the \n * writeM control bit is asserted. (When writeM==0, any value may \n * appear in outM). The outM and writeM outputs are combinational: \n * they are affected instantaneously by the execution of the current \n * instruction. The addressM and pc outputs are clocked: although they \n * are affected by the execution of the current instruction, they commit \n * to their new values only in the next time step. If reset==1 then the \n * CPU jumps to address 0 (i.e. pc is set to 0 in next time step) rather \n * than to the address resulting from executing the current instruction. \n */\n\nCHIP CPU {\n\n IN inM[16], // M value input (M = contents of RAM[A])\n instruction[16], // Instruction for execution\n reset; // Signals whether to re-start the current\n // program (reset==1) or continue executing\n // the current program (reset==0).\n\n OUT outM[16], // M value output\n writeM, // Write to M? \n addressM[15], // Address in data memory (of M)\n pc[15]; // address of next instruction\n\n PARTS:\n}`;\nexport const tst = `output-list time%S0.4.0 inM%D0.6.0 instruction%B0.16.0 reset%B2.1.2 outM%D1.6.0 writeM%B3.1.3 addressM%D0.5.0 pc%D0.5.0 DRegister[]%D1.6.1;\n\n\nset instruction %B0011000000111001, // @12345\ntick, output, tock, output;\n\nset instruction %B1110110000010000, // D=A\ntick, output, tock, output;\n\nset instruction %B0101101110100000, // @23456\ntick, output, tock, output;\n\nset instruction %B1110000111010000, // D=A-D\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1110001100001000, // M=D\ntick, output, tock, output;\n\nset instruction %B0000001111101001, // @1001\ntick, output, tock, output;\n\nset instruction %B1110001110011000, // MD=D-1\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1111010011010000, // D=D-M\nset inM 11111,\ntick, output, tock, output;\n\nset instruction %B0000000000001110, // @14\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;jlt\ntick, output, tock, output;\n\nset instruction %B0000001111100111, // @999\ntick, output, tock, output;\n\nset instruction %B1110110111100000, // A=A+1\ntick, output, tock, output;\n\nset instruction %B1110001100001000, // M=D\ntick, output, tock, output;\n\nset instruction %B0000000000010101, // @21\ntick, output, tock, output;\n\nset instruction %B1110011111000010, // D+1;jeq\ntick, output, tock, output;\n\nset instruction %B0000000000000010, // @2\ntick, output, tock, output;\n\nset instruction %B1110000010010000, // D=D+A\ntick, output, tock, output;\n\nset instruction %B0000001111101000, // @1000\ntick, output, tock, output;\n\nset instruction %B1110111010010000, // D=-1\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset instruction %B1110101010010000, // D=0\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset instruction %B1110111111010000, // D=1\ntick, output, tock, output;\n\nset instruction %B1110001100000001, // D;JGT\ntick, output, tock, output;\n\nset instruction %B1110001100000010, // D;JEQ\ntick, output, tock, output;\n\nset instruction %B1110001100000011, // D;JGE\ntick, output, tock, output;\n\nset instruction %B1110001100000100, // D;JLT\ntick, output, tock, output;\n\nset instruction %B1110001100000101, // D;JNE\ntick, output, tock, output;\n\nset instruction %B1110001100000110, // D;JLE\ntick, output, tock, output;\n\nset instruction %B1110001100000111, // D;JMP\ntick, output, tock, output;\n\nset reset 1;\ntick, output, tock, output;\n\nset instruction %B0111111111111111, // @32767\nset reset 0;\ntick, output, tock, output;`;\nexport const cmp = `|time| inM | instruction |reset| outM |writeM |addre| pc |DRegiste|\n|0+ | 0|0011000000111001| 0 |*******| 0 | 0| 0| 0 |\n|1 | 0|0011000000111001| 0 |*******| 0 |12345| 1| 0 |\n|1+ | 0|1110110000010000| 0 |*******| 0 |12345| 1| 0 |\n|2 | 0|1110110000010000| 0 |*******| 0 |12345| 2| 12345 |\n|2+ | 0|0101101110100000| 0 |*******| 0 |12345| 2| 12345 |\n|3 | 0|0101101110100000| 0 |*******| 0 |23456| 3| 12345 |\n|3+ | 0|1110000111010000| 0 |*******| 0 |23456| 3| 12345 |\n|4 | 0|1110000111010000| 0 |*******| 0 |23456| 4| 11111 |\n|4+ | 0|0000001111101000| 0 |*******| 0 |23456| 4| 11111 |\n|5 | 0|0000001111101000| 0 |*******| 0 | 1000| 5| 11111 |\n|5+ | 0|1110001100001000| 0 | 11111| 1 | 1000| 5| 11111 |\n|6 | 0|1110001100001000| 0 | 11111| 1 | 1000| 6| 11111 |\n|6+ | 0|0000001111101001| 0 |*******| 0 | 1000| 6| 11111 |\n|7 | 0|0000001111101001| 0 |*******| 0 | 1001| 7| 11111 |\n|7+ | 0|1110001110011000| 0 | 11110| 1 | 1001| 7| 11111 |\n|8 | 0|1110001110011000| 0 | 11109| 1 | 1001| 8| 11110 |\n|8+ | 0|0000001111101000| 0 |*******| 0 | 1001| 8| 11110 |\n|9 | 0|0000001111101000| 0 |*******| 0 | 1000| 9| 11110 |\n|9+ | 11111|1111010011010000| 0 |*******| 0 | 1000| 9| 11110 |\n|10 | 11111|1111010011010000| 0 |*******| 0 | 1000| 10| -1 |\n|10+ | 11111|0000000000001110| 0 |*******| 0 | 1000| 10| -1 |\n|11 | 11111|0000000000001110| 0 |*******| 0 | 14| 11| -1 |\n|11+ | 11111|1110001100000100| 0 |*******| 0 | 14| 11| -1 |\n|12 | 11111|1110001100000100| 0 |*******| 0 | 14| 14| -1 |\n|12+ | 11111|0000001111100111| 0 |*******| 0 | 14| 14| -1 |\n|13 | 11111|0000001111100111| 0 |*******| 0 | 999| 15| -1 |\n|13+ | 11111|1110110111100000| 0 |*******| 0 | 999| 15| -1 |\n|14 | 11111|1110110111100000| 0 |*******| 0 | 1000| 16| -1 |\n|14+ | 11111|1110001100001000| 0 | -1| 1 | 1000| 16| -1 |\n|15 | 11111|1110001100001000| 0 | -1| 1 | 1000| 17| -1 |\n|15+ | 11111|0000000000010101| 0 |*******| 0 | 1000| 17| -1 |\n|16 | 11111|0000000000010101| 0 |*******| 0 | 21| 18| -1 |\n|16+ | 11111|1110011111000010| 0 |*******| 0 | 21| 18| -1 |\n|17 | 11111|1110011111000010| 0 |*******| 0 | 21| 21| -1 |\n|17+ | 11111|0000000000000010| 0 |*******| 0 | 21| 21| -1 |\n|18 | 11111|0000000000000010| 0 |*******| 0 | 2| 22| -1 |\n|18+ | 11111|1110000010010000| 0 |*******| 0 | 2| 22| -1 |\n|19 | 11111|1110000010010000| 0 |*******| 0 | 2| 23| 1 |\n|19+ | 11111|0000001111101000| 0 |*******| 0 | 2| 23| 1 |\n|20 | 11111|0000001111101000| 0 |*******| 0 | 1000| 24| 1 |\n|20+ | 11111|1110111010010000| 0 |*******| 0 | 1000| 24| 1 |\n|21 | 11111|1110111010010000| 0 |*******| 0 | 1000| 25| -1 |\n|21+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 25| -1 |\n|22 | 11111|1110001100000001| 0 |*******| 0 | 1000| 26| -1 |\n|22+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 26| -1 |\n|23 | 11111|1110001100000010| 0 |*******| 0 | 1000| 27| -1 |\n|23+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 27| -1 |\n|24 | 11111|1110001100000011| 0 |*******| 0 | 1000| 28| -1 |\n|24+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 28| -1 |\n|25 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| -1 |\n|25+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 |\n|26 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 |\n|26+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 |\n|27 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 |\n|27+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 |\n|28 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 |\n|28+ | 11111|1110101010010000| 0 |*******| 0 | 1000| 1000| -1 |\n|29 | 11111|1110101010010000| 0 |*******| 0 | 1000| 1001| 0 |\n|29+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 0 |\n|30 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1002| 0 |\n|30+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1002| 0 |\n|31 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 0 |\n|31+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 |\n|32 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 |\n|32+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 0 |\n|33 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 0 |\n|33+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 0 |\n|34 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1002| 0 |\n|34+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1002| 0 |\n|35 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 0 |\n|35+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 |\n|36 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 |\n|36+ | 11111|1110111111010000| 0 |*******| 0 | 1000| 1000| 0 |\n|37 | 11111|1110111111010000| 0 |*******| 0 | 1000| 1001| 1 |\n|37+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 1 |\n|38 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1000| 1 |\n|38+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 1 |\n|39 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1001| 1 |\n|39+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1001| 1 |\n|40 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 1 |\n|40+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 1 |\n|41 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 1 |\n|41+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 1 |\n|42 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| 1 |\n|42+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 1 |\n|43 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1001| 1 |\n|43+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1001| 1 |\n|44 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 1 |\n|44+ | 11111|1110001100000111| 1 |*******| 0 | 1000| 1000| 1 |\n|45 | 11111|1110001100000111| 1 |*******| 0 | 1000| 0| 1 |\n|45+ | 11111|0111111111111111| 0 |*******| 0 | 1000| 0| 1 |\n|46 | 11111|0111111111111111| 0 |*******| 0 |32767| 1| 1 |`;\n","export const hdl = `/**\n * The HACK computer, including CPU, ROM and RAM.\n * When reset is 0, the program stored in the computer's ROM executes.\n * When reset is 1, the execution of the program restarts. \n * Thus, to start a program's execution, reset must be pushed \"up\" (1)\n * and \"down\" (0). From this point onward the user is at the mercy of \n * the software. In particular, depending on the program's code, the \n * screen may show some output and the user may be able to interact \n * with the computer via the keyboard.\n */\n\nCHIP Computer {\n\n IN reset;\n\n PARTS:\n}`;\nexport const tst = `output-list time%S1.4.1 reset%B2.1.2 ARegister[]%D1.7.1 DRegister[]%D1.7.1 PC[]%D0.4.0 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1;\n\n// Load a program written in the Hack machine language.\n// The program computes the maximum of RAM[0] and RAM[1] \n// and writes the result in RAM[2].\n\nROM32K load Max.hack,\n\n// first run: compute max(3,5)\nset Memory[0] 3,\nset Memory[1] 5,\noutput;\n\nrepeat 14 {\n tick, tock, output;\n}\n\n// reset the PC\nset reset 1,\ntick, tock, output;\n\n// second run: compute max(23456,12345)\nset reset 0,\nset Memory[0] 23456,\nset Memory[1] 12345,\noutput;\n\n// The run on these inputs needs less cycles (different branching)\nrepeat 10 {\n tick, tock, output;\n}\n`;\nexport const hack = `0000000000000000\n1111110000010000\n0000000000000001\n1111010011010000\n0000000000001010\n1110001100000001\n0000000000000001\n1111110000010000\n0000000000001100\n1110101010000111\n0000000000000000\n1111110000010000\n0000000000000010\n1110001100001000\n0000000000001110\n1110101010000111`;\nexport const cmp = `| time |reset|ARegister|DRegister|PC[]|RAM16K[0]|RAM16K[1]|RAM16K[2]|\n| 0 | 0 | 0 | 0 | 0| 3 | 5 | 0 |\n| 1 | 0 | 0 | 0 | 1| 3 | 5 | 0 |\n| 2 | 0 | 0 | 3 | 2| 3 | 5 | 0 |\n| 3 | 0 | 1 | 3 | 3| 3 | 5 | 0 |\n| 4 | 0 | 1 | -2 | 4| 3 | 5 | 0 |\n| 5 | 0 | 10 | -2 | 5| 3 | 5 | 0 |\n| 6 | 0 | 10 | -2 | 6| 3 | 5 | 0 |\n| 7 | 0 | 1 | -2 | 7| 3 | 5 | 0 |\n| 8 | 0 | 1 | 5 | 8| 3 | 5 | 0 |\n| 9 | 0 | 12 | 5 | 9| 3 | 5 | 0 |\n| 10 | 0 | 12 | 5 | 12| 3 | 5 | 0 |\n| 11 | 0 | 2 | 5 | 13| 3 | 5 | 0 |\n| 12 | 0 | 2 | 5 | 14| 3 | 5 | 5 |\n| 13 | 0 | 14 | 5 | 15| 3 | 5 | 5 |\n| 14 | 0 | 14 | 5 | 14| 3 | 5 | 5 |\n| 15 | 1 | 14 | 5 | 0| 3 | 5 | 5 |\n| 15 | 0 | 14 | 5 | 0| 23456 | 12345 | 5 |\n| 16 | 0 | 0 | 5 | 1| 23456 | 12345 | 5 |\n| 17 | 0 | 0 | 23456 | 2| 23456 | 12345 | 5 |\n| 18 | 0 | 1 | 23456 | 3| 23456 | 12345 | 5 |\n| 19 | 0 | 1 | 11111 | 4| 23456 | 12345 | 5 |\n| 20 | 0 | 10 | 11111 | 5| 23456 | 12345 | 5 |\n| 21 | 0 | 10 | 11111 | 10| 23456 | 12345 | 5 |\n| 22 | 0 | 0 | 11111 | 11| 23456 | 12345 | 5 |\n| 23 | 0 | 0 | 23456 | 12| 23456 | 12345 | 5 |\n| 24 | 0 | 2 | 23456 | 13| 23456 | 12345 | 5 |\n| 25 | 0 | 2 | 23456 | 14| 23456 | 12345 | 23456 |`;\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as project_01 from \"./project_01/index.js\";\nimport * as project_02 from \"./project_02/index.js\";\nimport * as project_03 from \"./project_03/index.js\";\nimport * as project_05 from \"./project_05/index.js\";\n\n/**\n * Duplicated for web from node:path.\n * A parsed path object generated by path.parse() or consumed by path.format().\n */\nexport interface ParsedPath {\n /** The root of the path such as '/' or 'c:\\' */\n root: string;\n /** The full directory path such as '/home/user/dir' or 'c:\\path\\dir' */\n dir: string;\n /** The file name including extension (if any) such as 'index.html' */\n base: string;\n /** The file extension (if any) such as '.html' */\n ext: string;\n /** The file name without extension (if any) such as 'index' */\n name: string;\n}\n\nexport type Assignment = ParsedPath;\n\nexport const ChipProjects = {\n \"01\": project_01,\n \"02\": project_02,\n \"03\": project_03,\n \"05\": project_05,\n};\n\nlet reset = false;\nexport const resetFiles = async (fs: FileSystem) => {\n if (reset) return; // React will double-render a call to resetFiles in useEffect.\n reset = true;\n await project_01.resetFiles(fs);\n await project_02.resetFiles(fs);\n await project_03.resetFiles(fs);\n await project_05.resetFiles(fs);\n reset = false;\n};\n\nexport const CHIP_PROJECTS: Record<\"01\" | \"02\" | \"03\" | \"05\", string[]> = {\n \"01\": [\n \"Not\",\n \"And\",\n \"Or\",\n \"XOr\",\n \"Mux\",\n \"DMux\",\n \"Not16\",\n \"And16\",\n \"Or16\",\n \"Mux16\",\n \"Mux4Way16\",\n \"Mux8Way16\",\n \"DMux4Way\",\n \"DMux8Way\",\n \"Or8Way\",\n ],\n \"02\": [\n \"HalfAdder\",\n \"FullAdder\",\n \"Add16\",\n \"Inc16\",\n \"AluNoStat\",\n \"ALU\",\n // \"ALUAll\", // Special secret undocumented ALU tests\n ],\n \"03\": [\"Bit\", \"Register\", \"PC\", \"RAM8\", \"RAM64\", \"RAM512\", \"RAM4k\", \"RAM16k\"],\n \"05\": [\"Memory\", \"CPU\", \"Computer\"],\n};\n\nexport const ASM_PROJECTS: Record<\"06\", string[]> = {\n \"06\": [\"Add\", \"Max\", \"Rectangle\", \"Pong\"],\n};\n\nexport const Assignments = {\n ...project_01.CHIPS,\n ...project_02.CHIPS,\n ...project_03.CHIPS,\n ...project_05.CHIPS,\n};\n"],"names":["CHIPS","Not","And","Or","XOr","Mux","DMux","Not16","And16","Or16","Mux16","Mux4Way16","Mux8Way16","DMux4Way","DMux8Way","Or8Way","resetFiles","fs","pushd","reset","popd","HalfAdder","FullAdder","Add16","Inc16","AluNoStat","ALU","ALUAll","Bit","Register","map","inn","load","join","n","PC","RAM8","RAM64","RAM512","RAM4k","RAM16k","Memory","CPU","Computer","ChipProjects","project_01","project_02","project_03","project_05","CHIP_PROJECTS","ASM_PROJECTS","Assignments"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/356.1228c852.chunk.js b/web/build/static/js/356.1228c852.chunk.js new file mode 100644 index 000000000..86451beee --- /dev/null +++ b/web/build/static/js/356.1228c852.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[356],{8582:function(t,n,e){e.d(n,{M:function(){return c}});var i=e(1026),r=e(7878),u=e(8365),a=e(4408),s=e(1585),o=e(4625),c=function(t){var n=t.className,e=void 0===n?"":n,c=t.out,h=t.cmp,v=t.zeroState,d=u.lA.parse(c),f=u.lA.parse(h);if((0,o.dZ)(d))return(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{children:"Failed to parse output"}),(0,r.jsx)("pre",{children:(0,a.j)((0,o.UG)(d))}),(0,r.jsx)("code",{children:(0,r.jsx)("pre",{children:c})})]});if((0,o.dZ)(f))return(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{children:"Failed to parse compare"}),(0,r.jsxs)("code",{children:[(0,r.jsx)("pre",{children:(0,a.j)((0,o.UG)(f))}),(0,r.jsx)("pre",{children:h})]})]});var p=(0,o.Ok)(f),Z=(0,o.Ok)(d),m=0,b=(0,s.w)(0,Math.min(p.length,Z.length)).map((function(t){var n,e,r=null!==(n=p[t])&&void 0!==n?n:[],u=null!==(e=Z[t])&&void 0!==e?e:[];return(0,s.w)(0,Math.max(r.length,u.length)).map((function(t,n){var e,i;return[null!==(e=r[n])&&void 0!==e?e:"",null!==(i=u[n])&&void 0!==i?i:""]})).map((function(t){var n=(0,i.Z)(t,2),e=n[0],r=n[1],u={cmp:null!==e&&void 0!==e?e:'"',out:null!==r&&void 0!==r?r:'"',pass:null!==(null===e||void 0===e?void 0:e.trim().match(/^\*+$/))||(null===r||void 0===r?void 0:r.trim())===(null===e||void 0===e?void 0:e.trim())};return u.pass||(m+=1),u}))}));return(0,r.jsxs)("div",{className:"scroll-x "+e,children:[m>0&&(0,r.jsxs)("p",{children:[m," failure",1===m?"":"s"]}),b.length>0?(0,r.jsx)("table",{style:{fontFamily:"var(--font-family-monospace)",marginBottom:"none"},children:(0,r.jsx)("tbody",{children:b.map((function(t,n){return(0,r.jsx)("tr",{children:t.map((function(t,n){var e=t.cmp,i=t.out,u=t.pass;return(0,r.jsx)(l,{cmp:e,out:i,pass:u},n)}))},n)}))})}):null!==v&&void 0!==v?v:(0,r.jsx)("p",{children:"Execute test script to compare output."})]})},l=function(t){var n=t.cmp,e=t.out;return t.pass?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("td",{children:n})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("td",{children:[(0,r.jsx)("ins",{children:n}),(0,r.jsx)("br",{}),(0,r.jsx)("del",{children:e})]})})}},691:function(t,n,e){e.d(n,{J_:function(){return d}});var i=e(726),r=e(1092),u=e(7791),a=e(4625),s=e(8090),o=e(3118),c=e(6329);function l(t,n){if(void 0!==n){if(n>=t)return n-t+1;if(t>0&&0===n)return 1;throw new Error("Bus specification has start > end (".concat(t," > ").concat(n,")"))}}function h(t,n){return v.apply(this,arguments)}function v(){return(v=(0,u.Z)((0,r.Z)().mark((function t(n,e){var i,u,c;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(0,o._c)(n)&&void 0!==e){t.next=2;break}return t.abrupt("return",(0,o.cT)(n));case 2:return t.prev=2,t.next=5,e.readFile("".concat(n,".hdl"));case 5:return i=t.sent,u=s.Gq.parse(i),c=(0,a.IY)(u)?d((0,a.Ok)(u),e):(0,a.UG)(new Error("HDL Was not parsed")),t.abrupt("return",c);case 11:return t.prev=11,t.t0=t.catch(2),t.abrupt("return",(0,a.UG)(new Error("Could not load chip ".concat(n,".hdl"))));case 14:case"end":return t.stop()}}),t,null,[[2,11]])})))).apply(this,arguments)}function d(t,n){return f.apply(this,arguments)}function f(){return(f=(0,u.Z)((0,r.Z)().mark((function t(n,e){var u,s,v,d,f,p,Z;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("BUILTIN"!==n.parts){t.next=2;break}return t.abrupt("return",(0,o.cT)(n.name.toString()));case 2:u=new c.Af(n.ins.map((function(t){var n=t.pin,e=t.width;return{pin:n.toString(),width:e}})),n.outs.map((function(t){var n=t.pin,e=t.width;return{pin:n.toString(),width:e}})),n.name.toString(),[],n.clocked),s=(0,i.Z)(n.parts),t.prev=4,s.s();case 6:if((v=s.n()).done){t.next=24;break}return d=v.value,t.next=10,h(d.name.toString(),e);case 10:if(f=t.sent,!(0,a.dZ)(f)){t.next=13;break}return t.abrupt("return",f);case 13:p=(0,a.Ok)(f),Z=d.wires.map((function(t){var n,e,i,r,u=t.lhs,a=t.rhs;return{to:{name:u.pin.toString(),start:null!==(n=u.start)&&void 0!==n?n:0,width:l(null!==(e=u.start)&&void 0!==e?e:0,u.end)},from:{name:a.pin.toString(),start:null!==(i=a.start)&&void 0!==i?i:0,width:l(null!==(r=a.start)&&void 0!==r?r:0,a.end)}}})),t.prev=15,u.wire(p,Z),t.next=22;break;case 19:return t.prev=19,t.t0=t.catch(15),t.abrupt("return",(0,a.UG)(t.t0));case 22:t.next=6;break;case 24:t.next=29;break;case 26:t.prev=26,t.t1=t.catch(4),s.e(t.t1);case 29:return t.prev=29,s.f(),t.finish(29);case 32:return t.abrupt("return",(0,a.Ok)(u));case 33:case"end":return t.stop()}}),t,null,[[4,26,29,32],[15,19]])})))).apply(this,arguments)}},3300:function(t,n,e){e.d(n,{N1:function(){return S},Z9:function(){return P},ar:function(){return D},lL:function(){return A},m1:function(){return x},zp:function(){return M}});var i=e(7538),r=e(3943),u=e(1026),a=e(9422),s=e(7169),o=e(3243),c=e(7597),l=e(4649),h=e(1092),v=e(7791),d=e(2951),f=e(1976),p=e(7591),Z=e(4337),m=e(6329),b=e(3116),y=e(134),g=e(326),k=e(9600),w=e(5838),x=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){return(0,d.Z)(this,e),n.call(this,16,"ROM")}return(0,f.Z)(e,[{key:"load",value:function(){var t=(0,v.Z)((0,h.Z)().mark((function t(n,e){var i=this;return(0,h.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,(0,k.zD)(n,e);case 3:t.sent.map((function(t,n){return i.at(n).busVoltage=t})),t.next=9;break;case 6:throw t.prev=6,t.t0=t.catch(0),new Error("ROM32K Failed to load file ".concat(e));case 9:case"end":return t.stop()}}),t,null,[[0,6]])})));return function(n,e){return t.apply(this,arguments)}}()}]),e}(b.FH),A=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){return(0,d.Z)(this,e),n.call(this,13,"Screen")}return(0,f.Z)(e)}(b.FH);(0,l.Z)(A,"OFFSET",w.qJ);var S=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){return(0,d.Z)(this,e),n.call(this,[],["out[16]"],"Keyboard")}return(0,f.Z)(e,[{key:"setKey",value:function(t){this.out().busVoltage=65535&t}},{key:"clearKey",value:function(){this.out().busVoltage=0}}]),e}(m.Af);(0,l.Z)(S,"OFFSET",w.sd);var M=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){var t;return(0,d.Z)(this,e),t=n.call(this,["in[16]","load","address[15])"],["out[16]"],"Memory"),(0,l.Z)((0,s.Z)(t),"ram",new b.xs),(0,l.Z)((0,s.Z)(t),"screen",new A),(0,l.Z)((0,s.Z)(t),"keyboard",new S),(0,l.Z)((0,s.Z)(t),"address",0),t.parts.add(t.keyboard),t.parts.add(t.screen),t.parts.add(t.ram),t}return(0,f.Z)(e,[{key:"tick",value:function(){var t=this.in("load").voltage();if(this.address=this.in("address").busVoltage,t){var n=this.in().busVoltage;this.address>=S.OFFSET||(this.address>=A.OFFSET?this.screen.at(this.address-A.OFFSET).busVoltage=n:this.ram.at(this.address).busVoltage=n)}}},{key:"tock",value:function(){this.eval()}},{key:"eval",value:function(){if(this.ram){this.address=this.in("address").busVoltage;var t,n,e=0;if(this.address>=S.OFFSET)e=null!==(t=null===(n=this.keyboard)||void 0===n?void 0:n.out().busVoltage)&&void 0!==t?t:0;else if(this.address>=A.OFFSET){var i,r;e=null!==(i=null===(r=this.screen)||void 0===r?void 0:r.at(this.address-A.OFFSET).busVoltage)&&void 0!==i?i:0}else{var u,a;e=null!==(u=null===(a=this.ram)||void 0===a?void 0:a.at(this.address).busVoltage)&&void 0!==u?u:0}this.out().busVoltage=e}}},{key:"in",value:function(t){if(null!==t&&void 0!==t&&t.startsWith("RAM16K")){var n,i,r,u=(0,g.o5)(null!==(n=null===(i=t.match((0,a.Z)(/\[(\d+)\]/,{idx:1})))||void 0===i||null===(r=i.groups)||void 0===r?void 0:r.idx)&&void 0!==n?n:"0");return this.ram.at(u)}if(null!==t&&void 0!==t&&t.startsWith("Screen")){var s,l,h,v=(0,g.o5)(null!==(s=null===(l=t.match((0,a.Z)(/\[(\d+)\]/,{idx:1})))||void 0===l||null===(h=l.groups)||void 0===h?void 0:h.idx)&&void 0!==s?s:"0");return this.screen.at(v)}return(0,o.Z)((0,c.Z)(e.prototype),"in",this).call(this,t)}},{key:"get",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.startsWith("RAM16K")?this.at(16383&n):t.startsWith("Screen")?this.at(n&8191+A.OFFSET):t.startsWith("Keyboard")?this.at(S.OFFSET):t.startsWith("Memory")?this.at(n):(0,o.Z)((0,c.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"at",value:function(t){return t>=S.OFFSET?this.keyboard.out():t>=A.OFFSET?this.screen.at(t-A.OFFSET):this.ram.at(t)}}]),e}(m.tI),P=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){var t;return(0,d.Z)(this,e),t=n.call(this,["inM[16]","instruction[16]","reset"],["outM[16]","writeM","addressM[15]","pc[15]"]),(0,l.Z)((0,s.Z)(t),"_state",(0,y.Zu)()),t}return(0,f.Z)(e,[{key:"state",get:function(){return this._state}},{key:"tick",value:function(){var t,n=(0,y.aL)(this.cpuInput(),this._state),e=(0,u.Z)(n,2),i=e[0],r=e[1];this._state=i,this.out("writeM").pull(r?m.lj:m.yE),this.out("outM").busVoltage=null!==(t=this._state.ALU)&&void 0!==t?t:0}},{key:"tock",value:function(){var t,n,e,i;if(this._state){var r=(0,y.Ff)(this.cpuInput(),this._state),a=(0,u.Z)(r,2),s=a[0],o=a[1];this._state=o,this.out("addressM").busVoltage=null!==(t=s.addressM)&&void 0!==t?t:0,this.out("outM").busVoltage=null!==(n=s.outM)&&void 0!==n?n:0,this.out("writeM").pull(s.writeM?m.lj:m.yE),this.out("pc").busVoltage=null!==(e=null===(i=this._state)||void 0===i?void 0:i.PC)&&void 0!==e?e:0}}},{key:"cpuInput",value:function(){return{inM:this.in("inM").busVoltage,instruction:this.in("instruction").busVoltage,reset:1===this.in("reset").busVoltage}}},{key:"get",value:function(t,n){return null!==t&&void 0!==t&&t.startsWith("ARegister")?new m.qP("ARegister",this._state.A):null!==t&&void 0!==t&&t.startsWith("DRegister")?new m.qP("DRegister",this._state.D):null!==t&&void 0!==t&&t.startsWith("PC")?new m.qP("PC",this._state.PC):(0,o.Z)((0,c.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"reset",value:function(){this._state=(0,y.Zu)(),(0,o.Z)((0,c.Z)(e.prototype),"reset",this).call(this)}}]),e}(m.tI),V=new WeakMap,E=new WeakMap,O=new WeakMap,D=function(t){(0,p.Z)(e,t);var n=(0,Z.Z)(e);function e(){var t;return(0,d.Z)(this,e),t=n.call(this,["reset"],[]),(0,i.Z)((0,s.Z)(t),V,{writable:!0,value:new M}),(0,i.Z)((0,s.Z)(t),E,{writable:!0,value:new x}),(0,i.Z)((0,s.Z)(t),O,{writable:!0,value:new P}),t.wire((0,r.Z)((0,s.Z)(t),O),[{from:{name:"reset",start:0},to:{name:"reset",start:0}},{from:{name:"instruction",start:0},to:{name:"instruction",start:0}},{from:{name:"outM",start:0},to:{name:"inM",start:0}},{from:{name:"writeM",start:0},to:{name:"writeM",start:0}},{from:{name:"addressM",start:0},to:{name:"addressM",start:0}}]),t.wire((0,r.Z)((0,s.Z)(t),E),[{from:{name:"pc",start:0},to:{name:"address",start:0}},{from:{name:"instruction",start:0},to:{name:"out",start:0}}]),t.wire((0,r.Z)((0,s.Z)(t),V),[{from:{name:"inM",start:0},to:{name:"in",start:0}},{from:{name:"writeM",start:0},to:{name:"load",start:0}},{from:{name:"addressM",start:0},to:{name:"address",start:0}},{from:{name:"outM",start:0},to:{name:"out",start:0}}]),t}return(0,f.Z)(e,[{key:"eval",value:function(){(0,o.Z)((0,c.Z)(e.prototype),"eval",this).call(this)}},{key:"get",value:function(t,n){return t.startsWith("PC")||t.startsWith("ARegister")||t.startsWith("DRegister")?(0,r.Z)(this,O).get(t):t.startsWith("RAM16K")?(0,r.Z)(this,V).get(t,n):(0,o.Z)((0,c.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"load",value:function(t,n){return(0,r.Z)(this,E).load(t,n)}}]),e}(m.Af)},3118:function(t,n,e){e.d(n,{JU:function(){return T},zZ:function(){return z},cT:function(){return K},_c:function(){return q}});var i=e(1026),r=e(4625),u=e(2951),a=e(1976),s=e(7591),o=e(4337),c=e(6329);var l=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[1===t&&1===n?c.lj:c.yE]}(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),h=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[t&n&65535]}(this.in("a").busVoltage,this.in("b").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af);var v=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in","sel"],["a","b"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[n===c.yE&&t===c.lj?c.lj:c.yE,n===c.lj&&t===c.lj?c.lj:c.yE]}(this.in("in").voltage(),this.in("sel").voltage()),n=(0,i.Z)(t,2),e=n[0],r=n[1];this.out("a").pull(e),this.out("b").pull(r)}}]),e}(c.Af),d=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in","sel[2]"],["a","b","c","d"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[0===n&&t===c.lj?c.lj:c.yE,1===n&&t===c.lj?c.lj:c.yE,2===n&&t===c.lj?c.lj:c.yE,3===n&&t===c.lj?c.lj:c.yE]}(this.in("in").voltage(),this.in("sel").busVoltage),n=(0,i.Z)(t,4),e=n[0],r=n[1],u=n[2],a=n[3];this.out("a").pull(e),this.out("b").pull(r),this.out("c").pull(u),this.out("d").pull(a)}}]),e}(c.Af),f=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in","sel[3]"],["a","b","c","d","e","f","g","h"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[0===n&&t===c.lj?c.lj:c.yE,1===n&&t===c.lj?c.lj:c.yE,2===n&&t===c.lj?c.lj:c.yE,3===n&&t===c.lj?c.lj:c.yE,4===n&&t===c.lj?c.lj:c.yE,5===n&&t===c.lj?c.lj:c.yE,6===n&&t===c.lj?c.lj:c.yE,7===n&&t===c.lj?c.lj:c.yE]}(this.in("in").voltage(),this.in("sel").busVoltage),n=(0,i.Z)(t,8),e=n[0],r=n[1],u=n[2],a=n[3],s=n[4],o=n[5],l=n[6],h=n[7];this.out("a").pull(e),this.out("b").pull(r),this.out("c").pull(u),this.out("d").pull(a),this.out("e").pull(s),this.out("f").pull(o),this.out("g").pull(l),this.out("h").pull(h)}}]),e}(c.Af);function p(t,n,e){return[e===c.yE?t:n]}function Z(t,n,e,i,r){var u=1&r;return 0===(2&r)?p(t,n,u):p(e,i,u)}var m=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b","sel"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n,e){return[e===c.yE?t:n]}(this.in("a").voltage(),this.in("b").voltage(),this.in("sel").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),b=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]","sel"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=p(this.in("a").busVoltage,this.in("b").busVoltage,this.in("sel").voltage()),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),y=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]","c[16]","d[16]","sel[2]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=Z(this.in("a").busVoltage,this.in("b").busVoltage,this.in("c").busVoltage,this.in("d").busVoltage,this.in("sel").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),g=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]","c[16]","d[16]","e[16]","f[16]","g[16]","h[16]","sel[3]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n,e,i,r,u,a,s,o){var c=3&o;return 0===(4&o)?Z(t,n,e,i,c):Z(r,u,a,s,c)}(this.in("a").busVoltage,this.in("b").busVoltage,this.in("c").busVoltage,this.in("d").busVoltage,this.in("e").busVoltage,this.in("f").busVoltage,this.in("g").busVoltage,this.in("h").busVoltage,this.in("sel").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),k=e(326);var w=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[1===t&&1===n?c.yE:c.lj]}(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),x=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in("a").busVoltage,n=this.in("b").busVoltage;this.out().busVoltage=(0,k.C2)(t,n)}}]),e}(c.Af);var A=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in("in").voltage(),n=[t===c.yE?c.lj:c.yE],e=(0,i.Z)(n,1)[0];this.out().pull(e)}}]),e}(c.Af),S=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=[65535&~this.in().busVoltage],n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af);function M(t,n){return[1===t||1===n?c.lj:c.yE]}var P=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=M(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),V=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[65535&(t|n)]}(this.in("a").busVoltage,this.in("b").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),E=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in[8]"],["out"],"Or8way")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in().busVoltage,n=[0===(255&t)?c.yE:c.lj],e=(0,i.Z)(n,1)[0];this.out().pull(e)}}]),e}(c.Af);var O=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["out"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[t===c.lj&&n===c.yE||t===c.yE&&n===c.lj?c.lj:c.yE]}(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,1)[0];this.out().pull(n)}}]),e}(c.Af),D=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n){return[65535&(t^n)]}(this.in("a").busVoltage,this.in("b").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af);function j(t,n){return[t+n&65535]}var C=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a[16]","b[16]"],["out[16]"],"Add16")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=j(this.in("a").busVoltage,this.in("b").busVoltage),n=(0,i.Z)(t,1)[0];this.out().busVoltage=n}}]),e}(c.Af),L=e(6693),R=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["x[16]","y[16]","zx","nx","zy","ny","f","no"],["out[16]"],"ALU")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in("x").busVoltage,n=this.in("y").busVoltage,e=(this.in("zx").busVoltage<<5)+(this.in("nx").busVoltage<<4)+(this.in("zy").busVoltage<<3)+(this.in("ny").busVoltage<<2)+(this.in("f").busVoltage<<1)+(this.in("no").busVoltage<<0),r=(0,L.Bb)(e,t,n),u=(0,i.Z)(r,1)[0];this.out().busVoltage=u}}]),e}(c.Af),T=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["x[16]","y[16]","zx","nx","zy","ny","f","no"],["out[16]","zr","ng"],"ALU")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in("x").busVoltage,n=this.in("y").busVoltage,e=(this.in("zx").busVoltage<<5)+(this.in("nx").busVoltage<<4)+(this.in("zy").busVoltage<<3)+(this.in("ny").busVoltage<<2)+(this.in("f").busVoltage<<1)+(this.in("no").busVoltage<<0),r=(0,L.Bb)(e,t,n),u=(0,i.Z)(r,2),a=u[0],s=u[1],o=s===L.vU.Negative?c.lj:c.yE,l=s===L.vU.Zero?c.lj:c.yE;this.out("out").busVoltage=a,this.out("ng").pull(o),this.out("zr").pull(l)}},{key:"op",value:function(){var t=(this.in("zx").busVoltage<<5)+(this.in("nx").busVoltage<<4)+(this.in("zy").busVoltage<<3)+(this.in("ny").busVoltage<<2)+(this.in("f").busVoltage<<1)+(this.in("no").busVoltage<<0);return t}}]),e}(c.Af);function I(t,n){return[1===t&&0===n||0===t&&1===n?c.lj:c.yE,1===t&&1===n?c.lj:c.yE]}var _=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b"],["sum","carry"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=I(this.in("a").voltage(),this.in("b").voltage()),n=(0,i.Z)(t,2),e=n[0],r=n[1];this.out("sum").pull(e),this.out("carry").pull(r)}}]),e}(c.Af);var F=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["a","b","c"],["sum","carry"])}return(0,a.Z)(e,[{key:"eval",value:function(){var t=function(t,n,e){var r=I(t,n),u=(0,i.Z)(r,2),a=u[0],s=u[1],o=I(a,e),c=(0,i.Z)(o,2),l=c[0],h=M(s,c[1]);return[l,(0,i.Z)(h,1)[0]]}(this.in("a").voltage(),this.in("b").voltage(),this.in("c").voltage()),n=(0,i.Z)(t,2),e=n[0],r=n[1];this.out("sum").pull(e),this.out("carry").pull(r)}}]),e}(c.Af);var B=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(){return(0,u.Z)(this,e),n.call(this,["in[16]"],["out[16]"],"Inc16")}return(0,a.Z)(e,[{key:"eval",value:function(){var t=this.in().busVoltage,n=j(t,1),e=(0,i.Z)(n,1)[0];this.out().busVoltage=e}}]),e}(c.Af),W=e(3300),N=e(7039),U=function(t){(0,s.Z)(e,t);var n=(0,o.Z)(e);function e(t){return(0,u.Z)(this,e),n.call(this,["in"],["out"],t,["t"])}return(0,a.Z)(e,[{key:"tick",value:function(){var t=this.in().voltage();this.pin("t").pull(t)}},{key:"tock",value:function(){var t=this.pin("t").voltage();this.out().pull(t)}}]),e}(c.tI),J=e(3116),z=new Map([["Nand",w],["Nand16",x],["Not",A],["Not16",S],["And",l],["And16",h],["Or",P],["Or16",V],["Or8Way",E],["XOr",O],["XOr16",D],["Xor",O],["Xor16",D],["Mux",m],["Mux16",b],["Mux4Way16",y],["Mux8Way16",g],["DMux",v],["DMux4Way",d],["DMux8Way",f],["HalfAdder",_],["FullAdder",F],["Add16",C],["Inc16",B],["ALU",T],["ALUNoStat",R],["DFF",U],["Bit",N.sU],["Register",N.aX],["ARegister",N.aX],["DRegister",N.aX],["PC",N.PC],["RAM8",J.HX],["RAM64",J.IH],["RAM512",J.OB],["RAM4K",J.rS],["RAM16K",J.xs],["ROM32K",W.m1],["Screen",W.lL],["Keyboard",W.N1],["CPU",W.Z9],["Computer",W.ar],["Memory",W.zp],["ARegister",N.l0],["DRegister",N.l0]].map((function(t){var n=(0,i.Z)(t,2),e=n[0],r=n[1];return[e,function(){var t=new r;return t.name=e,t}]})));function q(t){return z.has(t)}function K(t){var n=z.get(t);return n?(0,r.Ok)(n()):(0,r.UG)(new Error("Chip ".concat(t," not in builtin registry")))}},7039:function(t,n,e){e.d(n,{PC:function(){return p},aX:function(){return d},l0:function(){return f},sU:function(){return v}});var i=e(3243),r=e(7597),u=e(2951),a=e(1976),s=e(7169),o=e(7591),c=e(4337),l=e(4649),h=e(6329),v=function(t){(0,o.Z)(e,t);var n=(0,c.Z)(e);function e(t){var i;return(0,u.Z)(this,e),i=n.call(this,["in","load"],["out"],t),(0,l.Z)((0,s.Z)(i),"bit",h.yE),i}return(0,a.Z)(e,[{key:"tick",value:function(){this.in("load").voltage()===h.lj&&(this.bit=this.in().voltage())}},{key:"tock",value:function(){var t;this.out().pull(null!==(t=this.bit)&&void 0!==t?t:0)}},{key:"reset",value:function(){this.bit=h.yE}}]),e}(h.tI),d=function(t){(0,o.Z)(e,t);var n=(0,c.Z)(e);function e(t){var i;return(0,u.Z)(this,e),i=n.call(this,["in[16]","load"],["out[16]"],t),(0,l.Z)((0,s.Z)(i),"bits",0),i}return(0,a.Z)(e,[{key:"tick",value:function(){this.in("load").voltage()===h.lj&&(this.bits=65535&this.in().busVoltage)}},{key:"tock",value:function(){this.out().busVoltage=65535&this.bits}},{key:"get",value:function(t,n){return t===this.name?this.out():(0,i.Z)((0,r.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"reset",value:function(){this.bits=0}}]),e}(h.tI),f=function(t){(0,o.Z)(e,t);var n=(0,c.Z)(e);function e(){return(0,u.Z)(this,e),n.apply(this,arguments)}return(0,a.Z)(e)}(d),p=function(t){(0,o.Z)(e,t);var n=(0,c.Z)(e);function e(t){var i;return(0,u.Z)(this,e),i=n.call(this,["in[16]","load","inc","reset"],["out[16]"],t),(0,l.Z)((0,s.Z)(i),"bits",0),i}return(0,a.Z)(e,[{key:"tick",value:function(){this.in("reset").voltage()===h.lj?this.bits=0:this.in("load").voltage()===h.lj?this.bits=65535&this.in().busVoltage:this.in("inc").voltage()===h.lj&&(this.bits+=1)}},{key:"tock",value:function(){this.out().busVoltage=65535&this.bits}},{key:"get",value:function(t,n){return t===this.name?this.out():(0,i.Z)((0,r.Z)(e.prototype),"get",this).call(this,t,n)}},{key:"reset",value:function(){this.bits=0}}]),e}(h.tI)},3116:function(t,n,e){e.d(n,{FH:function(){return v},HX:function(){return f},IH:function(){return p},OB:function(){return Z},rS:function(){return m},xs:function(){return b}});var i=e(2951),r=e(1976),u=e(7169),a=e(7591),s=e(4337),o=e(4649),c=e(6329),l=e(5541),h=e(5838),v=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t,r){var a;return(0,i.Z)(this,e),a=n.call(this,["in[16]","load","address[".concat(t,"]")],["out[16]"],r),(0,o.Z)((0,u.Z)(a),"width",void 0),(0,o.Z)((0,u.Z)(a),"_memory",void 0),(0,o.Z)((0,u.Z)(a),"_nextData",0),(0,o.Z)((0,u.Z)(a),"_address",0),a.width=t,a._memory=new h.zp(Math.pow(2,a.width)),a}return(0,r.Z)(e,[{key:"memory",get:function(){return this._memory}},{key:"address",get:function(){return this._address}},{key:"tick",value:function(){var t=this.in("load").voltage();this._address=this.in("address").busVoltage,t&&(this._nextData=this.in().busVoltage,this._memory.set(this._address,this._nextData))}},{key:"tock",value:function(){var t,n;this.out().busVoltage=null!==(t=null===(n=this._memory)||void 0===n?void 0:n.get(this._address))&&void 0!==t?t:0}},{key:"eval",value:function(){var t,n,e=this.in("address").busVoltage;this.out().busVoltage=null!==(t=null===(n=this._memory)||void 0===n?void 0:n.get(e))&&void 0!==t?t:0}},{key:"at",value:function(t){var n=this;return(0,l.hu)(t= ").concat(n._memory.size,")")})),new d("".concat(this.name,"[").concat(t,"]"),t,this._memory)}}]),e}(c.tI),d=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t,r,a){var s;return(0,i.Z)(this,e),s=n.call(this,t),(0,o.Z)((0,u.Z)(s),"index",void 0),(0,o.Z)((0,u.Z)(s),"ram",void 0),s.index=r,s.ram=a,s}return(0,r.Z)(e,[{key:"busVoltage",get:function(){return this.ram.get(this.index)},set:function(t){this.ram.set(this.index,t)}}]),e}(c.Gc),f=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,3,t)}return(0,r.Z)(e)}(v),p=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,6,t)}return(0,r.Z)(e)}(v),Z=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,9,t)}return(0,r.Z)(e)}(v),m=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,12,t)}return(0,r.Z)(e)}(v),b=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){return(0,i.Z)(this,e),n.call(this,14,t)}return(0,r.Z)(e)}(v)},6329:function(t,n,e){e.d(n,{Af:function(){return L},Gc:function(){return S},P9:function(){return R},lj:function(){return x},qP:function(){return V},tI:function(){return I},yE:function(){return A}});var i,r=e(3243),u=e(7597),a=e(7538),s=e(3943),o=e(1092),c=e(7791),l=e(1026),h=e(9422),v=e(7169),d=e(7591),f=e(4337),p=e(726),Z=e(649),m=e(2951),b=e(1976),y=e(4649),g=e(5541),k=e(1585),w=e(6531),x=1,A=0,S=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;(0,m.Z)(this,t),(0,y.Z)(this,"name",void 0),(0,y.Z)(this,"width",void 0),(0,y.Z)(this,"state",void 0),(0,y.Z)(this,"next",[]),this.name=n,this.width=e,this.state=(0,k.w)(0,this.width).map((function(){return A}))}return(0,b.Z)(t,[{key:"ensureWidth",value:function(t){(0,g.hu)(t<=16,"Cannot widen past 16 to ".concat(t," bits")),this.width1&&void 0!==arguments[1]?arguments[1]:0;(0,g.hu)(n>=0&&n0&&void 0!==arguments[0]?arguments[0]:0;return(0,g.hu)(t>=0&&t>r}}catch(u){i.e(u)}finally{i.f()}this.next.forEach((function(t){return t.busVoltage=e.busVoltage}))}},{key:"toggle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=this.voltage(t)===A?x:A;this.pull(n,t)}}]),t}(),M=function(t){(0,d.Z)(e,t);var n=(0,f.Z)(e);function e(t,i){var r,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return(0,m.Z)(this,e),r=n.call(this,t.name),(0,y.Z)((0,v.Z)(r),"bus",void 0),(0,y.Z)((0,v.Z)(r),"start",void 0),(0,y.Z)((0,v.Z)(r),"width",void 0),r.bus=t,r.start=i,r.width=u,(0,g.hu)(i>=0&&i+u<=t.width,"Mismatched InSubBus dimensions on ".concat(t.name," (").concat(u," + ").concat(i," > ").concat(t.width,")")),r.connect(t),r}return(0,b.Z)(e,[{key:"pull",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(0,g.hu)(n>=0&&n0&&void 0!==arguments[0]?arguments[0]:0;return(0,g.hu)(t>=0&&t>this.start&_(this.width)},set:function(t){var n=this.bus.busVoltage&~_(this.width+this.start),e=this.bus.busVoltage&_(this.start),i=(t&_(this.width))<2&&void 0!==arguments[2]?arguments[2]:1;return(0,m.Z)(this,e),r=n.call(this,t.name),(0,y.Z)((0,v.Z)(r),"bus",void 0),(0,y.Z)((0,v.Z)(r),"start",void 0),(0,y.Z)((0,v.Z)(r),"width",void 0),r.bus=t,r.start=i,r.width=u,(0,g.hu)(i>=0&&u<=t.width,"Mismatched OutSubBus dimensions"),r.connect(t),r}return(0,b.Z)(e,[{key:"busVoltage",get:function(){return this.bus.busVoltage&_(this.width)},set:function(t){this.bus.busVoltage=(t&_(this.width+this.start))>>this.start}},{key:"connect",value:function(t){(0,g.hu)(this.width<=t.width,"Mismatched OutSubBus connection dimensions"),this.bus=t}}]),e}(S),V=function(t){(0,d.Z)(e,t);var n=(0,f.Z)(e);function e(t,i){var r;return(0,m.Z)(this,e),r=n.call(this,t,16),(0,y.Z)((0,v.Z)(r),"value",void 0),r.value=i,r}return(0,b.Z)(e,[{key:"pullHigh",value:function(){}},{key:"pullLow",value:function(){}},{key:"voltage",value:function(){return 1&this.busVoltage}},{key:"busVoltage",get:function(){return this.value},set:function(t){}}]),e}(S),E=new V("true",65535),O=new V("false",0);function D(t){var n,e=null===(n=t.match((0,h.Z)(/([a-zA-Z]+)(\[(\d+)\])?/,{pin:1,w:3})))||void 0===n?void 0:n.groups,i=e.pin,r=e.w;return{pin:i,width:r?Number(r):1}}i=Symbol.iterator;var j=function(){function t(){(0,m.Z)(this,t),(0,y.Z)(this,"map",new Map)}return(0,b.Z)(t,[{key:"insert",value:function(t){var n=t.name;(0,g.hu)(!this.map.has(n),"Pins already has ".concat(n,"!")),this.map.set(n,t)}},{key:"emplace",value:function(t,n){if(this.has(t))return this.get(t);var e=new S(t,n);return this.insert(e),e}},{key:"has",value:function(t){return this.map.has(t)}},{key:"get",value:function(t){return this.map.get(t)}},{key:"entries",value:function(){return this.map.values()}},{key:i,value:function(){return this.map[Symbol.iterator]()}}]),t}(),C=0,L=function(){function t(n,e,i){var r=this,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];(0,m.Z)(this,t),(0,y.Z)(this,"name",void 0),(0,y.Z)(this,"id",C++),(0,y.Z)(this,"ins",new j),(0,y.Z)(this,"outs",new j),(0,y.Z)(this,"pins",new j),(0,y.Z)(this,"parts",new Set),(0,y.Z)(this,"clockedPins",void 0),this.name=i;var s,o=(0,p.Z)(n);try{for(o.s();!(s=o.n()).done;){var c=s.value,l=void 0!==c.pin?c:D(c),h=l.pin,v=l.width,d=void 0===v?1:v;this.ins.insert(new S(h,d))}}catch(T){o.e(T)}finally{o.f()}var f,Z=(0,p.Z)(e);try{for(Z.s();!(f=Z.n()).done;){var b=f.value,g=void 0!==b.pin?b:D(b),k=g.pin,x=g.width,A=void 0===x?1:x;this.outs.insert(new S(k,A))}}catch(T){Z.e(T)}finally{Z.f()}var M,P=(0,p.Z)(u);try{for(P.s();!(M=P.n()).done;){var V=M.value,E=void 0!==V.pin?V:D(V),O=E.pin,L=E.width,R=void 0===L?1:L;this.pins.insert(new S(O,R))}}catch(T){P.e(T)}finally{P.f()}this.clockedPins=new Set(a),w.S.get().$.subscribe((function(){return r.eval()}))}return(0,b.Z)(t,[{key:"clocked",get:function(){if(this.clockedPins.size>0)return!0;var t,n=(0,p.Z)(this.parts);try{for(n.s();!(t=n.n()).done;){if(t.value.clocked)return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"reset",value:function(){var t,n=(0,p.Z)(this.ins);try{for(n.s();!(t=n.n()).done;){var e=(0,l.Z)(t.value,2);e[0];e[1].busVoltage=0}}catch(u){n.e(u)}finally{n.f()}var i,r=(0,p.Z)(this.parts);try{for(r.s();!(i=r.n()).done;){i.value.reset()}}catch(u){r.e(u)}finally{r.f()}this.eval()}},{key:"in",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"in";return(0,g.hu)(this.hasIn(t),"No in pin ".concat(t)),this.ins.get(t)}},{key:"out",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"out";return(0,g.hu)(this.hasOut(t),"No in pin ".concat(t)),this.outs.get(t)}},{key:"hasIn",value:function(t){return this.ins.has(t)}},{key:"hasOut",value:function(t){return this.outs.has(t)}},{key:"pin",value:function(t){return(0,g.hu)(this.pins.has(t)),this.pins.get(t)}},{key:"get",value:function(t,n){return this.ins.has(t)?this.ins.get(t):this.outs.has(t)?this.outs.get(t):this.pins.has(t)?this.pins.get(t):this.getBuiltin(t,n)}},{key:"getBuiltin",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(F.includes(t)){var e,i=(0,p.Z)(this.parts);try{for(i.s();!(e=i.n()).done;){var r=e.value,u=r.get(t,n);if(u)return u}}catch(a){i.e(a)}finally{i.f()}}}},{key:"isOutPin",value:function(t){return this.outs.has(t)}},{key:"wire",value:function(t,n){this.parts.add(t);var e,i=(0,p.Z)(n);try{for(i.s();!(e=i.n()).done;){var r=e.value,u=r.to,a=r.from;t.isOutPin(u.name)?this.wireOutPin(t,u,a):this.wireInPin(t,u,a)}}catch(s){i.e(s)}finally{i.f()}}},{key:"findPin",value:function(t,n){return"true"===t.toLowerCase()||"1"===t?E:"false"===t.toLowerCase()||"0"===t?O:this.ins.has(t)?this.ins.get(t):this.outs.has(t)?this.outs.get(t):this.pins.emplace(t,n)}},{key:"wireOutPin",value:function(t,n,e){var i,r,u,a=(0,g.kP)(t.outs.get(n.name),(function(){return"Cannot wire to missing pin ".concat(n.name)}));null!==(i=n.width)&&void 0!==i||(n.width=a.width);var s=this.findPin(e.name,null!==(r=e.width)&&void 0!==r?r:n.width),o=this.pins.has(s.name);if(null!==(u=e.width)&&void 0!==u||(e.width=s.width),s instanceof V)throw new Error("Cannot wire to constant bus");o&&s instanceof S&&s.ensureWidth(e.start+e.width),(e.start>0||e.width!==s.width)&&(s=new M(s,e.start,e.width)),(n.start>0||n.width!==s.width)&&(s=new P(s,n.start,n.width)),a.connect(s)}},{key:"wireInPin",value:function(t,n,e){var i,r,u,a=(0,g.kP)(t.ins.get(n.name),(function(){return"Cannot wire to missing pin ".concat(n.name)}));null!==(i=n.width)&&void 0!==i||(n.width=a.width);var s=this.findPin(e.name,null!==(r=e.width)&&void 0!==r?r:n.width);null!==(u=e.width)&&void 0!==u||(e.width=s.width),(n.start>0||n.width!==s.width)&&(a=new M(a,n.start,n.width)),["true","false"].includes(s.name)||(e.start>0||e.width!==s.width)&&(a=new P(a,e.start,e.width)),s.connect(a)}},{key:"eval",value:function(){var t,n=(0,p.Z)(this.parts);try{for(n.s();!(t=n.n()).done;){t.value.eval()}}catch(e){n.e(e)}finally{n.f()}}},{key:"tick",value:function(){this.eval()}},{key:"tock",value:function(){this.eval()}},{key:"remove",value:function(){var t,n=(0,p.Z)(this.parts);try{for(n.s();!(t=n.n()).done;){t.value.remove()}}catch(e){n.e(e)}finally{n.f()}}},{key:"load",value:function(){var t=(0,c.Z)((0,o.Z)().mark((function t(n,e){var i,r,u;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=(0,p.Z)(this.parts),t.prev=1,i.s();case 3:if((r=i.n()).done){t.next=10;break}if("ROM32K"!==(u=r.value).name){t.next=8;break}return t.next=8,u.load(n,e);case 8:t.next=3;break;case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(1),i.e(t.t0);case 15:return t.prev=15,i.f(),t.finish(15);case 18:case"end":return t.stop()}}),t,this,[[1,12,15,18]])})));return function(n,e){return t.apply(this,arguments)}}()}]),t}(),R=function(t){(0,d.Z)(e,t);var n=(0,f.Z)(e);function e(){var t;return(0,m.Z)(this,e),(t=n.call(this,[],[])).outs.insert(O),t}return(0,b.Z)(e)}(L),T=new WeakMap,I=function(t){(0,d.Z)(e,t);var n=(0,f.Z)(e);function e(){var t;(0,m.Z)(this,e);for(var i=arguments.length,r=new Array(i),u=0;u>6,d1:n(b),d2:n(y),d3:n(g),j1:n(k),j2:n(w),j3:n(x)}}function S(t,n){var e=t.inM,i=t.instruction,r=n.A,u=n.D,a=n.PC,s=A(i),o=s.am?e:r,h=(0,l.Bb)(s.op,u,o),v=(0,c.Z)(h,2);return[{A:r,D:u,PC:a+1,ALU:v[0],flag:v[1]},s.d3]}function M(t,n){var e=t.inM,i=t.instruction,r=t.reset,u=n.A,a=n.D,s=n.PC,o=n.ALU,c=n.flag,h=A(i),v=h.j1&&c===l.vU.Positive,d=h.j2&&c===l.vU.Zero,f=h.j3&&c===l.vU.Negative;s=r?0:v||d||f?u:s,h.d2&&(a=o),h.c?h.d1&&(u=o):u=32767&i;var p=h.am?e:u,Z=(0,l.Bb)(h.op,a,p);return o=Z[0],c=Z[1],[{addressM:u,outM:o,writeM:h.d3},{A:u,D:a,ALU:o,flag:c,PC:s}]}var P=new WeakMap,V=new WeakMap,E=new WeakMap,O=new WeakMap,D=function(){function t(n){var e=n.RAM,r=void 0===e?new h.zp(32767):e,s=n.ROM;(0,i.Z)(this,t),(0,a.Z)(this,"RAM",void 0),(0,a.Z)(this,"ROM",void 0),(0,u.Z)(this,P,{writable:!0,value:0}),(0,u.Z)(this,V,{writable:!0,value:0}),(0,u.Z)(this,E,{writable:!0,value:0}),(0,u.Z)(this,O,{writable:!0,value:{A:0,D:0,PC:0,ALU:0,flag:l.vU.Zero}}),this.RAM=r,this.ROM=s}return(0,r.Z)(t,[{key:"state",get:function(){return(0,o.Z)(this,O)}},{key:"PC",get:function(){return(0,o.Z)(this,P)}},{key:"A",get:function(){return(0,o.Z)(this,V)}},{key:"D",get:function(){return(0,o.Z)(this,E)}},{key:"reset",value:function(){(0,s.Z)(this,P,0),(0,s.Z)(this,V,0),(0,s.Z)(this,E,0)}},{key:"tick",value:function(){var t=function(t,n){var e=S(t,n),i=(0,c.Z)(e,2),r=i[0];return i[1],M(t,r)}({inM:this.RAM.get((0,o.Z)(this,V)),instruction:this.ROM.get((0,o.Z)(this,P)),reset:!1},{A:(0,o.Z)(this,V),D:(0,o.Z)(this,E),PC:(0,o.Z)(this,P),ALU:(0,o.Z)(this,E),flag:l.vU.Zero}),n=(0,c.Z)(t,2),e=n[0],i=e.addressM,r=e.outM,u=e.writeM,a=n[1],h=a.A,v=a.D,d=a.PC;(0,s.Z)(this,V,h),(0,s.Z)(this,E,v),(0,s.Z)(this,P,d),u&&this.RAM.set(i,r)}}]),t}()},5838:function(t,n,e){e.d(n,{I2:function(){return m},qJ:function(){return b},sd:function(){return y},zp:function(){return k}});var i=e(649),r=e(1092),u=e(7791),a=e(2951),s=e(1976),o=e(4649),c=e(7538),l=e(2648),h=e(3943),v=e(5541),d=e(9810),f=e(7693),p=e(326),Z=e(9600),m=["bin","dec","hex","asm"],b=16384,y=24576,g=new WeakMap,k=function(){function t(n){(0,a.Z)(this,t),(0,c.Z)(this,g,{writable:!0,value:void 0}),(0,o.Z)(this,"updates",new d.x),(0,l.Z)(this,g,new Int16Array(n))}return(0,s.Z)(t,[{key:"size",get:function(){return(0,h.Z)(this,g).length}},{key:"get",value:function(t){var n;return t<0||t>=this.size?65535:null!==(n=(0,h.Z)(this,g)[t])&&void 0!==n?n:0}},{key:"set",value:function(t,n){t>=0&&t0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;return(0,i.Z)((0,h.Z)(this,g).slice(t,n))}},{key:"map",value:function(t){var n=this,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.size;return(0,r.Z)().mark((function u(){var a;return(0,r.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:(0,v.hu)(e = NonemptyListOf sep?\n EmptyList = EmptyList sep?\n}')},o=s.Base.createSemantics();function c(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t.root};return function(i){try{var r,s,o=t.match(i);if(o.succeeded()){var c=n(o),l=e(c);return(0,u.Ok)(l)}return(0,u.UG)({message:null!==(r=o.message)&&void 0!==r?r:a,shortMessage:null!==(s=o.shortMessage)&&void 0!==s?s:a})}catch(h){return(0,u.UG)(h)}}}o.extendOperation("asIteration",{List:function(t,n){return t.asIteration()}}),o.addAttribute("value",{decNumber:function(t,n){return(0,r.o5)(n.sourceString)},wholeDec:function(t,n){return(0,r.o5)(n.sourceString)},binNumber:function(t,n){return(0,r.C$)(n.sourceString)},hexNumber:function(t,n){return(0,r.Af)(n.sourceString)},Number:function(t){return t.value},Name:function(t){return t.name},identifier:function(t,n){return this.sourceString}}),o.addAttribute("name",{identifier:function(t,n){return this.sourceString},Name:function(t){var n;return null===(n=this.child(0))||void 0===n?void 0:n.name}}),o.addAttribute("String",{String:function(t,n,e){return n.sourceString}})},8365:function(t,n,e){e.d(n,{lA:function(){return o}});var i=e(5640),r=e(1510),u="\nCmp <: Base {\n Root := line*\n line = bar cell+ newline?\n cell = cellvalue bar\n cellvalue = (~(bar|newline) any)*\n}",a=i.Z.grammar(u,r.y1),s=a.extendSemantics(r.rJ);s.addAttribute("cell",{cell:function(t,n){return t.sourceString}}),s.addAttribute("line",{line:function(t,n,e){return n.children.map((function(t){return t.cell}))}}),s.addAttribute("root",{Root:function(t){return t.children.map((function(t){return t.line}))}});var o={grammar:u,semantics:s,parser:a,parse:(0,r.Pz)(a,s)}},8090:function(t,n,e){e.d(n,{Gq:function(){return o}});var i=e(5640),r=e(1510),u='\nHdl <: Base{\n Root := Chip\n Chip = "CHIP" Name OpenBrace ChipBody CloseBrace\n ChipBody = InList? OutList? PartList ClockedList?\n InList = "IN" PinList Semi\n OutList = "OUT" PinList Semi\n PartList = BuiltinPart | Parts\n PinList = List\n PinDecl = Name PinWidth?\n PinWidth = OpenSquare decNumber CloseSquare\n BuiltinPart = "BUILTIN" Semi\n Parts = "PARTS:" Part*\n Part = Name "(" Wires ")" Semi\n Wires = List\n Wire = WireSide Equal (WireSide | True | False) \n WireSide = Name SubBus? \n SubBus = OpenSquare decNumber subBusRest? CloseSquare\n subBusRest = ".." decNumber\n ClockedList = "CLOCKED" SimplePinList Semi\n SimplePinList = List\n}',a=i.Z.grammar(u,r.y1),s=a.extendSemantics(r.rJ);s.addAttribute("SubBus",{SubBus:function(t,n,e,i){var r,u,a,s=n.value;return{start:s,end:null!==(r=null===(u=e.child(0))||void 0===u||null===(a=u.child(1))||void 0===a?void 0:a.value)&&void 0!==r?r:s}}}),s.addAttribute("WireSide",{WireSide:function(t,n){var e,i,r=t.name,u=null!==(e=null===(i=n.child(0))||void 0===i?void 0:i.SubBus)&&void 0!==e?e:{start:void 0,end:void 0};return{pin:r,start:u.start,end:u.end}}}),s.addAttribute("Wire",{Wire:function(t,n,e){var i=e.isTerminal()?{pin:e.sourceString}:e.WireSide;return{lhs:t.WireSide,rhs:i}}}),s.addAttribute("Wires",{Wires:function(t){return t.asIteration().children.map((function(t){return t.Wire}))}}),s.addAttribute("Part",{Part:function(t,n,e,i,r){return{name:t.name,wires:e.Wires}}}),s.addAttribute("Parts",{Parts:function(t,n){return n.children.map((function(t){return t.Part}))},BuiltinPart:function(t,n){return"BUILTIN"}}),s.addAttribute("PartList",{PartList:function(t){return t.Parts}}),s.addAttribute("Clocked",{ClockedList:function(t,n,e){var i;return null!==(i=n.asIteration().children.map((function(t){return t.sourceString})))&&void 0!==i?i:[]}}),s.addAttribute("PinDecl",{PinDecl:function(t,n){var e,i,r;return{pin:t.name,width:null!==(e=null===(i=n.child(0))||void 0===i||null===(r=i.child(1))||void 0===r?void 0:r.value)&&void 0!==e?e:1}}}),s.addAttribute("PinList",{PinList:function(t){return t.asIteration().children.map((function(t){return t.PinDecl}))}}),s.addAttribute("Chip",{Chip:function(t,n,e,i,r){var u,a,s,o,c,l,h,v;return{name:n.name,ins:null!==(u=null===(a=i.child(0).child(0))||void 0===a||null===(s=a.child(1))||void 0===s?void 0:s.PinList)&&void 0!==u?u:[],outs:null!==(o=null===(c=i.child(1).child(0))||void 0===c||null===(l=c.child(1))||void 0===l?void 0:l.PinList)&&void 0!==o?o:[],parts:null!==(h=i.child(2).PartList)&&void 0!==h?h:[],clocked:null===(v=i.child(3).child(0))||void 0===v?void 0:v.Clocked}}}),s.addAttribute("Root",{Root:function(t){var n;return null===(n=t.child(0))||void 0===n?void 0:n.Chip}});var o={parser:a,grammar:u,semantics:s,parse:(0,r.Pz)(a,s,(function(t){return t.Chip}))}},9647:function(t,n,e){e.d(n,{qH:function(){return o}});var i=e(5640),r=e(1510),u='\nTst <: Base {\n Root := Tst\n Tst = (TstStatement | TstRepeat | TstWhile)+\n\n TstRepeat = Repeat Number? OpenBrace TstStatement+ CloseBrace\n TstWhile = While Condition OpenBrace TstStatement+ CloseBrace\n TstStatement = List (Semi | Bang)\n\n TstOperation =\n | TstFileOperation\n | TstOutputListOperation\n | TstEvalOperation\n | TstSetOperation\n | TstOutputOperation\n | TstEchoOperation\n | TstClearEchoOperation\n | TstLoadROMOperation\n\n TstLoadROMOperation = ROM32K Load FileName\n TstFileOperation = FileOperation FileName\n TstOutputListOperation = "output-list" OutputFormat+\n OutputFormat = Name Index? percent FormatStyle wholeDec dot wholeDec dot wholeDec\n TstSetOperation = Set Name Index? Number\n Index = OpenSquare wholeDec? CloseSquare\n Condition = Value CompareOp Value\n TstEvalOperation = Eval | Tick | Tock\n TstOutputOperation = Output\n TstEchoOperation = Echo String\n TstClearEchoOperation = ClearEcho\n\n FileName = Name\n FileOperation = "load" | "output-file" | "compare-to"\n\n Set = "set"\n Eval = "eval"\n Tick = "tick"\n Tock = "tock"\n Echo = "echo"\n Repeat = "repeat"\n ClearEcho = "clear-echo"\n Output = "output"\n OutputList = "output-list"\n FormatStyle = "B"|"D"|"S"|"X"\n ROM32K = "ROM32K"\n Load = "load"\n While = "while"\n\n CompareOp = "<>" | "<=" | ">=" | "=" | "<" | ">"\n}',a=i.Z.grammar(u,r.y1),s=a.extendSemantics(r.rJ);s.extendAttribute("value",{Index:function(t,n,e){var i,r;return null!==(i=null===n||void 0===n||null===(r=n.child(0))||void 0===r?void 0:r.value)&&void 0!==i?i:-1}}),s.extendAttribute("name",{FileName:function(t){return t.name}}),s.addAttribute("index",{Index:function(t,n,e){var i,r;return null!==(i=null===(r=n.child(0))||void 0===r?void 0:r.value)&&void 0!==i?i:0}}),s.addAttribute("format",{OutputFormat:function(t,n,e,i,r,u,a,s,o){var c,l,h=t.name,v=i.sourceString,d=r.value,f=a.value,p=o.value;return{id:h,builtin:void 0!==(null===n||void 0===n?void 0:n.child(0)),address:null!==(c=null===n||void 0===n||null===(l=n.child(0))||void 0===l?void 0:l.value)&&void 0!==c?c:-1,style:v,width:f,lpad:d,rpad:p}}}),s.addAttribute("operation",{TstEvalOperation:function(t){return{op:t.sourceString}},TstOutputOperation:function(t){return{op:"output"}},TstOutputListOperation:function(t,n){return{op:"output-list",spec:n.children.map((function(t){return t.format}))}},TstSetOperation:function(t,n,e,i){var r,u,a={op:"set",id:n.name,value:i.value},s=null===(r=e.child(0))||void 0===r||null===(u=r.child(1))||void 0===u?void 0:u.child(0);return s&&(a.index=s.value),a},TstEchoOperation:function(t,n){return{op:"echo",message:n.String}},TstClearEchoOperation:function(t){return{op:"clear-echo"}},TstLoadROMOperation:function(t,n,e){return{op:"loadRom",file:e.name}},TstFileOperation:function(t,n){return{op:t.sourceString,file:n.sourceString}}}),s.addAttribute("condition",{Condition:function(t,n,e){var i=t.value,r=n.sourceString;return{left:i,right:e.value,op:r}}}),s.addAttribute("statement",{TstWhile:function(t,n,e,i,r){return{statements:i.children.map((function(t){return t.statement})),condition:n.condition,span:{start:t.source.startIdx,end:n.source.endIdx}}},TstRepeat:function(t,n,e,i,r){var u,a;return{statements:i.children.map((function(t){return t.statement})),count:null!==(u=null===(a=n.child(0))||void 0===a?void 0:a.value)&&void 0!==u?u:-1,span:{start:t.source.startIdx,end:n.source.endIdx}}},TstStatement:function(t,n){var e={ops:t.asIteration().children.map((function(t){return t.operation})),span:{start:this.source.startIdx,end:this.source.endIdx}};return"!"===n.sourceString&&(e.break=!0),e}}),s.addAttribute("tst",{Tst:function(t){return{lines:t.children.map((function(t){return t.statement}))}}}),s.addAttribute("root",{Root:function(t){return t.tst}});var o={grammar:u,semantics:s,parser:a,parse:(0,r.Pz)(a,s)}},3389:function(t,n,e){e.d(n,{l1:function(){return A}});var i=e(7169),r=e(3243),u=e(7597),a=e(7591),s=e(4337),o=e(726),c=e(1092),l=e(7791),h=e(2951),v=e(1976),d=e(4649),f=e(5541),p=e(9956),Z=e(6329),m=e(6531),b=e(9422),y=e(326),g=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"%B1.1.1",i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0;if((0,h.Z)(this,t),(0,d.Z)(this,"variable",void 0),(0,d.Z)(this,"fmt",void 0),(0,d.Z)(this,"lPad",void 0),(0,d.Z)(this,"rPad",void 0),(0,d.Z)(this,"len",void 0),(0,d.Z)(this,"index",void 0),(0,d.Z)(this,"builtin",void 0),this.variable=n,e.startsWith("%")&&void 0===i&&void 0===r&&void 0===u){var o,c=null===(o=e.match((0,b.Z)(/^%([BDXS])(\d+)\.(\d+)\.(\d+)$/,{fmt:1,lPad:2,len:3,rPad:4})))||void 0===o?void 0:o.groups,l=c.fmt,v=c.lPad,p=c.rPad,Z=c.len;this.fmt=l,this.lPad=parseInt(v),this.rPad=parseInt(p),this.len=parseInt(Z),this.builtin=!1,this.index=-1}else(0,f.hu)(["B","X","D","S"].includes(e[0])),this.fmt=e[0],this.len=null!==i&&void 0!==i?i:3,this.lPad=null!==r&&void 0!==r?r:1,this.rPad=null!==u&&void 0!==u?u:1,this.builtin=null!==a&&void 0!==a&&a,this.index=null!==s&&void 0!==s?s:-1}return(0,v.Z)(t,[{key:"header",value:function(t){var n="".concat(this.variable);if(this.builtin){var e=this.index>=0?this.index:"";n="".concat(n,"[").concat(e,"]")}return n.length>this.len+this.lPad+this.rPad?n.substring(0,this.len+this.lPad+this.rPad):this.padCenter(n)}},{key:"print",value:function(t){var n=t.getVar(this.variable,this.index);if("S"===this.fmt)return this.padLeft(n);var e=(0,{B:y.Ly,D:y.E_,X:y.$v}[this.fmt])(n);return"D"===this.fmt?this.padRight(e):this.padCenter(e.slice(e.length-this.len))}},{key:"padCenter",value:function(t){var n=this.lPad+this.len+this.rPad,e=Math.floor((n-t.length)/2),i=n-e-t.length,r=e+t.length,u=r+i;return t=(t=t.padStart(r)).padEnd(u)}},{key:"padLeft",value:function(t){t=t.substring(0,this.len);var n=this.rPad+this.len,e=this.lPad+n;return t=(t=t.padEnd(n)).padStart(e)}},{key:"padRight",value:function(t){t=t.substring(0,this.len);var n=this.lPad+this.len,e=this.rPad+n;return t=(t=t.padStart(n)).padEnd(e)}}]),t}(),k=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"instructions",[]),(0,d.Z)(this,"_outputList",[]),(0,d.Z)(this,"_log",""),(0,d.Z)(this,"fs",new p.Wd),(0,d.Z)(this,"_steps",void 0),(0,d.Z)(this,"_step",void 0),(0,d.Z)(this,"breakpoints",new Map)}return(0,v.Z)(t,[{key:"setFileSystem",value:function(t){return this.fs=t,this}},{key:"echo",value:function(t){}},{key:"clearEcho",value:function(){}},{key:"load",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(n){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",void 0);case 1:case"end":return t.stop()}}),t)})));return function(n){return t.apply(this,arguments)}}()},{key:"compareTo",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(n){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",void 0);case 1:case"end":return t.stop()}}),t)})));return function(n){return t.apply(this,arguments)}}()},{key:"outputFile",value:function(t){}},{key:"outputList",value:function(t){this._outputList=t}},{key:"addInstruction",value:function(t){this.instructions.push(t)}},{key:"reset",value:function(){return this._steps=(0,c.Z)().mark((function t(n){var e,i,r;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=(0,o.Z)(n.instructions),t.prev=1,e.s();case 3:if((i=e.n()).done){t.next=8;break}return r=i.value,t.delegateYield(r.steps(n),"t0",6);case 6:t.next=3;break;case 8:t.next=13;break;case 10:t.prev=10,t.t1=t.catch(1),e.e(t.t1);case 13:return t.prev=13,e.f(),t.finish(13);case 16:case"end":return t.stop()}}),t,null,[[1,10,13,16]])}))(this),this._step=this._steps.next(),this._step,this._log="",this}},{key:"steps",get:function(){return void 0===this._steps&&(this.reset(),this._steps=(0,f.kP)(this._steps,"Reset did not initialize steps"),this._step=(0,f.kP)(this._step,"Reset did not find first step")),this._steps}},{key:"currentStep",get:function(){var t;return null===(t=this._step)||void 0===t?void 0:t.value}},{key:"done",get:function(){var t,n;return null!==(t=null===(n=this._step)||void 0===n?void 0:n.done)&&void 0!==t&&t}},{key:"step",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._step.done){t.next=5;break}return t.next=3,this._step.value.do(this);case 3:return this._step=this.steps.next(),t.abrupt("return",!1);case 5:return t.abrupt("return",!0);case 6:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"run",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.reset();case 1:return t.next=3,this.step();case 3:if(t.sent){t.next=7;break}t.next=1;break;case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"addBreakpoint",value:function(t,n){this.breakpoints.set(t,n)}},{key:"clearBreakpoints",value:function(){this.breakpoints.clear()}},{key:"output",value:function(){var t=this,n=this._outputList.map((function(n){return n.print(t)}));this._log+="|".concat(n.join("|"),"|\n")}},{key:"header",value:function(){var t=this,n=this._outputList.map((function(n){return n.header(t)}));this._log+="|".concat(n.join("|"),"|\n")}},{key:"log",value:function(){return this._log}}]),t}();function w(t){return void 0!==t.ops}function x(t){return void 0!==t.condition}var A=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(){var t;(0,h.Z)(this,e);for(var r=arguments.length,u=new Array(r),a=0;a0&&void 0!==arguments[0]?arguments[0]:[];(0,h.Z)(this,t),(0,d.Z)(this,"outputs",[]);var e,i=(0,o.Z)(n);try{for(i.s();!(e=i.n()).done;){var r=e.value;this.addOutput(r)}}catch(u){i.e(u)}finally{i.f()}}return(0,v.Z)(t,[{key:"addOutput",value:function(t){this.outputs.push(new g(t.id,t.style,t.width,t.lpad,t.rpad,t.builtin,t.address))}},{key:"do",value:function(t){t.outputList(this.outputs),t.header()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),V=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"instructions",[]),(0,d.Z)(this,"span",void 0)}return(0,v.Z)(t,[{key:"addInstruction",value:function(t){this.instructions.push(t)}},{key:"do",value:function(t){var n,e=(0,o.Z)(this.instructions);try{for(e.s();!(n=e.n()).done;){n.value.do(t)}}catch(i){e.e(i)}finally{e.f()}}},{key:"steps",value:(0,c.Z)().mark((function t(n){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),E=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){var r;return(0,h.Z)(this,e),r=n.call(this),(0,d.Z)((0,i.Z)(r),"repeat",void 0),r.repeat=t,r}return(0,v.Z)(e,[{key:"do",value:function(){}},{key:"innerSteps",value:(0,c.Z)().mark((function t(n){var e,i,r;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=(0,o.Z)(this.instructions),t.prev=1,e.s();case 3:if((i=e.n()).done){t.next=8;break}return r=i.value,t.delegateYield(r.steps(n),"t0",6);case 6:t.next=3;break;case 8:t.next=13;break;case 10:t.prev=10,t.t1=t.catch(1),e.e(t.t1);case 13:return t.prev=13,e.f(),t.finish(13);case 16:case"end":return t.stop()}}),t,this,[[1,10,13,16]])}))},{key:"steps",value:(0,c.Z)().mark((function t(n){var e;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(-1!==this.repeat){t.next=9;break}return t.next=3,this;case 3:return t.delegateYield(this.innerSteps(n),"t0",5);case 5:t.next=3;break;case 7:t.next=17;break;case 9:e=0;case 10:if(!(e":return"".concat(n)!=="".concat(e)}else switch(this.op){case"<":return n":return n>e;case">=":return n>=e;case"=":return n===e;case"<>":return n!==e}return!1}}]),t}(),D=function(t){(0,a.Z)(e,t);var n=(0,s.Z)(e);function e(t){var r;return(0,h.Z)(this,e),r=n.call(this),(0,d.Z)((0,i.Z)(r),"condition",void 0),r.condition=t,r}return(0,v.Z)(e,[{key:"steps",value:(0,c.Z)().mark((function t(n){var e,i,r;return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.condition.check(n)){t.next=21;break}return t.next=3,this;case 3:e=(0,o.Z)(this.instructions),t.prev=4,e.s();case 6:if((i=e.n()).done){t.next=11;break}return r=i.value,t.delegateYield(r.steps(n),"t0",9);case 9:t.next=6;break;case 11:t.next=16;break;case 13:t.prev=13,t.t1=t.catch(4),e.e(t.t1);case 16:return t.prev=16,e.f(),t.finish(16);case 19:t.next=0;break;case 21:case"end":return t.stop()}}),t,this,[[4,13,16,19]])}))}]),e}(V),j=function(){function t(n){(0,h.Z)(this,t),(0,d.Z)(this,"content",void 0),this.content=n}return(0,v.Z)(t,[{key:"do",value:function(t){t.echo(this.content)}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),C=function(){function t(){(0,h.Z)(this,t)}return(0,v.Z)(t,[{key:"do",value:function(t){t.clearEcho()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),L=function(){function t(n){(0,h.Z)(this,t),(0,d.Z)(this,"file",void 0),this.file=n}return(0,v.Z)(t,[{key:"do",value:function(){var t=(0,l.Z)((0,c.Z)().mark((function t(n){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.fs.pushd("/samples"),t.next=3,n.load(this.file);case 3:n.fs.popd();case 4:case"end":return t.stop()}}),t,this)})));return function(n){return t.apply(this,arguments)}}()},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),R=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"_chipTestInstruction_",!0)}return(0,v.Z)(t,[{key:"do",value:function(t){t.eval()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),T=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"_chipTestInstruction_",!0)}return(0,v.Z)(t,[{key:"do",value:function(t){t.tick()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}(),I=function(){function t(){(0,h.Z)(this,t),(0,d.Z)(this,"_chipTestInstruction_",!0)}return(0,v.Z)(t,[{key:"do",value:function(t){t.tock()}},{key:"steps",value:(0,c.Z)().mark((function t(){return(0,c.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:case"end":return t.stop()}}),t,this)}))}]),t}()},7693:function(t,n,e){e.d(n,{a:function(){return u},op:function(){return a},p:function(){return s}});var i=e(9422),r=e(6693);function u(t){return 32768&t?function(t){t&=65535;var n=(4096&t)>>12,e=(4032&t)>>6,i=(56&t)>>3,u=7&t;if(void 0===r.PH.op[e])return"#ERR";var a=r.PH.op[e];n&&(a=a.replace(/A/g,"M"));var s=r.Uc.op[i],o=r.lK.op[u],c=a;s&&(c="".concat(s,"=").concat(c));o&&(c="".concat(c,";").concat(o));return c}(t):function(t){return"@"+(32767&t).toString(10)}(t)}function a(t){return"@"===t[0]?function(t){return parseInt(t.substring(1),10)}(t):function(t){var n,e=t.match((0,i.Z)(/(?:([AMD]{1,3})=)?([-!01ADM&|]{1,3})(?:;(JGT|JLT|JGE|JLE|JEQ|JMP))?/,{assign:1,operation:2,jump:3})),u=null!==(n=null===e||void 0===e?void 0:e.groups)&&void 0!==n?n:{},a=u.assign,o=u.operation,c=u.jump,l=o.includes("M")||a.includes("M"),h=r.Uc.asm[null!==a&&void 0!==a?a:""],v=r.lK.asm[null!==c&&void 0!==c?c:""],d=r.PH.asm[null!==o&&void 0!==o?o:""];return s(l,d,h,v)}(t)}function s(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=57344,u=t?4096:0,a=n<<6,s=(null!==e&&void 0!==e?e:0)<<3,o=null!==i&&void 0!==i?i:0;return r+u+a+s+o}},326:function(t,n,e){e.d(n,{$v:function(){return l},Af:function(){return s},C$:function(){return c},C2:function(){return f},E_:function(){return v},Ly:function(){return h},nN:function(){return d},o5:function(){return o}});var i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];function r(t){var n;return null!==(n=i[t])&&void 0!==n?n:"X"}function u(t){switch(t){case 0:return"0000";case 1:return"0001";case 2:return"0010";case 3:return"0011";case 4:return"0100";case 5:return"0101";case 6:return"0110";case 7:return"0111";case 8:return"1000";case 9:return"1001";case 10:return"1010";case 11:return"1011";case 12:return"1100";case 13:return"1101";case 14:return"1110";case 15:return"1111";default:return"erro"}}function a(t,n){return 65535&parseInt(t.replace(/[^\d+-.xa-fA-F]/g,""),n)}function s(t){return a(t,16)}function o(t){return a(t,10)}function c(t){return a(t,2)}function l(t){var n=r((61440&t)>>12),e=r((3840&t)>>8),i=r((240&t)>>4),u=r(15&t);return"0x".concat(n).concat(e).concat(i).concat(u)}function h(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,e=u((61440&t)>>12),i=u((3840&t)>>8),r=u((240&t)>>4),a=u(15&t);return"".concat(e).concat(i).concat(r).concat(a).substring(16-n)}function v(t){return 32768===(t&=65535)?"-32768":32768&t?"-".concat(t=1+~t&32767):"".concat(t)}function d(t){return"".concat(t&=65535)}function f(t,n){var e=~((t&=65535)&(n&=65535));return e&=65535}}}]); +//# sourceMappingURL=356.1228c852.chunk.js.map \ No newline at end of file diff --git a/web/build/static/js/356.1228c852.chunk.js.map b/web/build/static/js/356.1228c852.chunk.js.map new file mode 100644 index 000000000..b3a8b7d15 --- /dev/null +++ b/web/build/static/js/356.1228c852.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/356.1228c852.chunk.js","mappings":"yNAMaA,EAAY,SAAH,GAUjB,QATHC,UAAAA,OAAS,IAAG,KAAE,EACdC,EAAG,EAAHA,IACAC,EAAG,EAAHA,IACAC,EAAS,EAATA,UAOMC,EAASC,EAAAA,GAAAA,MAAUJ,GACnBK,EAAUD,EAAAA,GAAAA,MAAUH,GAE1B,IAAIK,EAAAA,EAAAA,IAAMH,GACR,OACEI,EAAAA,EAAAA,MAAAA,UAAAA,CAAAC,SAAAA,EACEC,EAAAA,EAAAA,KAAAA,UAAAA,CAAAD,SAAAA,4BACAC,EAAAA,EAAAA,KAAAA,MAAAA,CAAAD,UAAME,EAAAA,EAAAA,IAAQC,EAAAA,EAAAA,IAAIR,OAClBM,EAAAA,EAAAA,KAAAA,OAAAA,CAAAD,UACEC,EAAAA,EAAAA,KAAAA,MAAAA,CAAAD,SAAMR,SAMd,IAAIM,EAAAA,EAAAA,IAAMD,GACR,OACEE,EAAAA,EAAAA,MAAAA,UAAAA,CAAAC,SAAAA,EACEC,EAAAA,EAAAA,KAAAA,UAAAA,CAAAD,SAAAA,6BACAD,EAAAA,EAAAA,MAAAA,OAAAA,CAAAC,SAAAA,EACEC,EAAAA,EAAAA,KAAAA,MAAAA,CAAAD,UAAME,EAAAA,EAAAA,IAAQC,EAAAA,EAAAA,IAAIN,OAClBI,EAAAA,EAAAA,KAAAA,MAAAA,CAAAD,SAA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,SAAU8S,EAAK9S,GACnB,OAAOgiB,EAAIhiB,EAAG,EAChB,CAEM,SAAUqd,EAAIrd,GAClB,IAAMkiB,EAAKH,GAAW,MAAJ/hB,IAAe,IAC3BmiB,EAAKJ,GAAW,KAAJ/hB,IAAe,GAC3BoiB,EAAKL,GAAW,IAAJ/hB,IAAe,GAC3BqiB,EAAKN,EAAU,GAAJ/hB,GAEjB,MAAO,KAAP,OAAYkiB,GAAE,OAAGC,GAAE,OAAGC,GAAE,OAAGC,EAC7B,CAEM,SAAUlF,EAAInd,GAAyB,IAAdsiB,EAAY,UAAH,6CAAG,GACnCJ,EAAK3W,GAAU,MAAJvL,IAAe,IAC1BmiB,EAAK5W,GAAU,KAAJvL,IAAe,GAC1BoiB,EAAK7W,GAAU,IAAJvL,IAAe,GAC1BqiB,EAAK9W,EAAS,GAAJvL,GAGhB,MAAO,UAAGkiB,GAAE,OAAGC,GAAE,OAAGC,GAAE,OAAGC,GAAKvF,UAAU,GAAKwF,EAC/C,CAEM,SAAUrI,EAAIja,GAElB,OAAU,SADVA,GAAQ,OAEC,SAED,MAAJA,EAEK,IAAP,OADAA,EAAU,GAAJA,EAAS,OAGV,GAAP,OAAUA,EACZ,CAEM,SAAUuiB,EAAIviB,GAElB,MAAO,GAAP,OADAA,GAAQ,MAEV,CAEM,SAAUyI,EAAOhC,EAAWC,GAGhC,IAAIU,KAFJX,GAAQ,QACRC,GAAQ,QAGR,OADAU,GAAQ,KAEV,C","sources":["../../components/src/difftable.tsx","../../simulator/src/chip/builder.ts","../../simulator/src/chip/builtins/computer/computer.tsx","../../simulator/src/chip/builtins/logic/and.ts","../../simulator/src/chip/builtins/logic/dmux.ts","../../simulator/src/chip/builtins/logic/mux.ts","../../simulator/src/chip/builtins/logic/nand.ts","../../simulator/src/chip/builtins/logic/not.ts","../../simulator/src/chip/builtins/logic/or.ts","../../simulator/src/chip/builtins/logic/xor.ts","../../simulator/src/chip/builtins/arithmetic/add_16.ts","../../simulator/src/chip/builtins/arithmetic/alu.tsx","../../simulator/src/chip/builtins/arithmetic/half_adder.ts","../../simulator/src/chip/builtins/arithmetic/full_adder.ts","../../simulator/src/chip/builtins/arithmetic/inc16.ts","../../simulator/src/chip/builtins/sequential/dff.ts","../../simulator/src/chip/builtins/index.ts","../../simulator/src/chip/builtins/sequential/bit.tsx","../../simulator/src/chip/builtins/sequential/ram.tsx","../../simulator/src/chip/chip.tsx","../../simulator/src/chip/clock.ts","../../simulator/src/cpu/alu.ts","../../simulator/src/cpu/cpu.ts","../../simulator/src/cpu/memory.ts","../../simulator/src/languages/grammars/asm.ohm.js","../../simulator/src/languages/asm.ts","../../simulator/src/fs.ts","../../simulator/src/languages/base.ts","../../simulator/src/languages/grammars/base.ohm.js","../../simulator/src/languages/grammars/cmp.ohm.js","../../simulator/src/languages/cmp.ts","../../simulator/src/languages/grammars/hdl.ohm.js","../../simulator/src/languages/hdl.ts","../../simulator/src/languages/grammars/tst.ohm.js","../../simulator/src/languages/tst.ts","../../simulator/src/output.ts","../../simulator/src/tst.ts","../../simulator/src/util/asm.ts","../../simulator/src/util/twos.ts"],"sourcesContent":["import { CMP } from \"@nand2tetris/simulator/languages/cmp.js\";\nimport { display } from \"@davidsouther/jiffies/lib/esm/display.js\";\nimport { range } from \"@davidsouther/jiffies/lib/esm/range.js\";\nimport { Err, isErr, Ok } from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { ReactElement } from \"react\";\n\nexport const DiffTable = ({\n className = \"\",\n out,\n cmp,\n zeroState,\n}: {\n out: string;\n cmp: string;\n className?: string;\n zeroState?: ReactElement;\n}) => {\n const output = CMP.parse(out);\n const compare = CMP.parse(cmp);\n\n if (isErr(output)) {\n return (\n
\n Failed to parse output\n
{display(Err(output))}
\n \n
{out}
\n
\n
\n );\n }\n\n if (isErr(compare)) {\n return (\n
\n Failed to parse compare\n \n
{display(Err(compare))}
\n
{cmp}
\n
\n
\n );\n }\n\n const cmpData = Ok(compare);\n const outData = Ok(output);\n let failures = 0;\n const table = range(0, Math.min(cmpData.length, outData.length)).map((i) => {\n const cmpI = cmpData[i] ?? [];\n const outI = outData[i] ?? [];\n return range(0, Math.max(cmpI.length, outI.length))\n .map((_, j) => [cmpI[j] ?? \"\", outI[j] ?? \"\"])\n .map(([cmp, out]) => {\n const cell = {\n cmp: cmp ?? '\"',\n out: out ?? '\"',\n pass:\n cmp?.trim().match(/^\\*+$/) !== null || out?.trim() === cmp?.trim(),\n };\n if (!cell.pass) {\n failures += 1;\n }\n return cell;\n });\n });\n\n return (\n
\n {failures > 0 && (\n

\n {failures} failure{failures === 1 ? \"\" : \"s\"}\n

\n )}\n {table.length > 0 ? (\n \n
\n {table.map((row, i) => (\n \n {row.map(({ cmp, out, pass }, i) => (\n \n ))}\n \n ))}\n \n
\n ) : (\n zeroState ??

Execute test script to compare output.

\n )}\n \n );\n};\n\nconst DiffCell = ({\n cmp,\n out,\n pass,\n}: {\n cmp: string;\n out: string;\n pass: boolean;\n}) => {\n return pass ? (\n <>\n {cmp}\n \n ) : (\n <>\n \n {cmp}\n
\n {out}\n \n \n );\n};\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport {\n Err,\n isErr,\n isOk,\n Ok,\n Result,\n} from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { HDL, HdlParse } from \"../languages/hdl.js\";\nimport { getBuiltinChip, hasBuiltinChip } from \"./builtins/index.js\";\nimport { Chip, Connection } from \"./chip.js\";\n\nfunction pinWidth(start: number, end: number | undefined): number | undefined {\n if (end === undefined) {\n return undefined;\n }\n if (end >= start) {\n return end - start + 1;\n }\n if (start > 0 && end === 0) {\n return 1;\n }\n throw new Error(`Bus specification has start > end (${start} > ${end})`);\n}\n\nexport async function parse(\n code: string\n): Promise> {\n const parsed = HDL.parse(code.toString());\n if (isErr(parsed)) return parsed;\n return build(Ok(parsed));\n}\n\nexport async function loadChip(\n name: string,\n fs?: FileSystem\n): Promise> {\n if (hasBuiltinChip(name) || fs === undefined) {\n return getBuiltinChip(name);\n }\n try {\n const file = await fs.readFile(`${name}.hdl`);\n const maybeParsedHDL = HDL.parse(file);\n const chip = isOk(maybeParsedHDL)\n ? build(Ok(maybeParsedHDL), fs)\n : Err(new Error(\"HDL Was not parsed\"));\n return chip;\n } catch (e) {\n return Err(new Error(`Could not load chip ${name}.hdl` /*, { cause: e }*/));\n }\n}\n\nexport async function build(\n parts: HdlParse,\n fs?: FileSystem\n): Promise> {\n if (parts.parts === \"BUILTIN\") {\n return getBuiltinChip(parts.name.toString());\n }\n\n const buildChip = new Chip(\n parts.ins.map(({ pin, width }) => ({ pin: pin.toString(), width })),\n parts.outs.map(({ pin, width }) => ({ pin: pin.toString(), width })),\n parts.name.toString(),\n [],\n parts.clocked\n );\n\n for (const part of parts.parts) {\n const builtin = await loadChip(part.name.toString(), fs);\n if (isErr(builtin)) return builtin;\n const partChip = Ok(builtin);\n\n const wires = part.wires.map(({ lhs, rhs }) => ({\n to: {\n name: lhs.pin.toString(),\n start: lhs.start ?? 0,\n width: pinWidth(lhs.start ?? 0, lhs.end),\n },\n from: {\n name: rhs.pin.toString(),\n start: rhs.start ?? 0,\n width: pinWidth(rhs.start ?? 0, rhs.end),\n },\n }));\n\n try {\n buildChip.wire(partChip, wires);\n } catch (e) {\n return Err(e as Error);\n }\n }\n\n return Ok(buildChip);\n}\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n// import { Screen as ScreenComponent } from \"../../../../app/components/chips/screen.js\";\n// import { Keyboard as KeyboardComponent } from \"../../../../app/components/chips/keyboard.js\";\n// import { RegisterComponent } from \"../../../../app/components/chips/register.js\";\n// import { ALUComponent } from \"../../../../app/components/chips/alu.js\";\n// import { Flags } from \"../../../cpu/alu.js\";\nimport { Chip, ClockedChip, ConstantBus, HIGH, LOW, Pin } from \"../../chip.js\";\nimport { RAM, RAM16K } from \"../sequential/ram.js\";\nimport {\n CPUInput,\n CPUState,\n cpuTick,\n cpuTock,\n emptyState,\n} from \"../../../cpu/cpu.js\";\nimport { int10 } from \"../../../util/twos.js\";\nimport { load } from \"../../../fs.js\";\nimport { KEYBOARD, SCREEN } from \"../../../cpu/memory.js\";\n\nexport class ROM32K extends RAM {\n constructor() {\n super(16, \"ROM\");\n }\n\n override async load(fs: FileSystem, path: string) {\n try {\n (await load(fs, path)).map((v, i) => (this.at(i).busVoltage = v));\n } catch (cause) {\n // throw new Error(`ROM32K Failed to load file ${path}`, { cause });\n throw new Error(`ROM32K Failed to load file ${path}`);\n }\n }\n}\n\nexport class Screen extends RAM {\n static readonly OFFSET = SCREEN;\n\n constructor() {\n super(13, \"Screen\");\n }\n}\n\nexport class Keyboard extends Chip {\n static readonly OFFSET = KEYBOARD;\n\n constructor() {\n super([], [\"out[16]\"], \"Keyboard\");\n }\n\n setKey(key: number) {\n this.out().busVoltage = key & 0xffff;\n }\n\n clearKey() {\n this.out().busVoltage = 0;\n }\n}\n\nexport class Memory extends ClockedChip {\n private ram = new RAM16K();\n private screen = new Screen();\n private keyboard = new Keyboard();\n private address = 0;\n\n constructor() {\n super([\"in[16]\", \"load\", \"address[15])\"], [\"out[16]\"], \"Memory\");\n this.parts.add(this.keyboard);\n this.parts.add(this.screen);\n this.parts.add(this.ram);\n }\n\n override tick() {\n const load = this.in(\"load\").voltage();\n this.address = this.in(\"address\").busVoltage;\n if (load) {\n const inn = this.in().busVoltage;\n if (this.address >= Keyboard.OFFSET) {\n // Keyboard, do nothing\n } else if (this.address >= Screen.OFFSET) {\n this.screen.at(this.address - Screen.OFFSET).busVoltage = inn;\n } else {\n this.ram.at(this.address).busVoltage = inn;\n }\n }\n }\n\n override tock() {\n this.eval();\n }\n\n override eval() {\n if (!this.ram) return;\n this.address = this.in(\"address\").busVoltage;\n let out = 0;\n if (this.address >= Keyboard.OFFSET) {\n // Keyboard, do nothing\n out = this.keyboard?.out().busVoltage ?? 0;\n } else if (this.address >= Screen.OFFSET) {\n out = this.screen?.at(this.address - Screen.OFFSET).busVoltage ?? 0;\n } else {\n out = this.ram?.at(this.address).busVoltage ?? 0;\n }\n this.out().busVoltage = out;\n }\n\n override in(pin?: string): Pin {\n if (pin?.startsWith(\"RAM16K\")) {\n const idx = int10(pin.match(/\\[(?\\d+)]/)?.groups?.idx ?? \"0\");\n return this.ram.at(idx);\n }\n if (pin?.startsWith(\"Screen\")) {\n const idx = int10(pin.match(/\\[(?\\d+)]/)?.groups?.idx ?? \"0\");\n return this.screen.at(idx);\n }\n return super.in(pin);\n }\n\n override get(name: string, offset = 0): Pin | undefined {\n if (name.startsWith(\"RAM16K\")) {\n return this.at(offset & 0x3fff);\n }\n if (name.startsWith(\"Screen\")) {\n return this.at(offset & (0x1fff + Screen.OFFSET));\n }\n if (name.startsWith(\"Keyboard\")) {\n return this.at(Keyboard.OFFSET);\n }\n if (name.startsWith(\"Memory\")) {\n return this.at(offset);\n }\n return super.get(name, offset);\n }\n\n at(offset: number): Pin {\n if (offset >= Keyboard.OFFSET) {\n return this.keyboard.out();\n }\n if (offset >= Screen.OFFSET) {\n return this.screen.at(offset - Screen.OFFSET);\n } else {\n return this.ram.at(offset);\n }\n }\n}\n\nexport class CPU extends ClockedChip {\n private _state: CPUState = emptyState();\n\n get state(): CPUState {\n return this._state;\n }\n\n constructor() {\n super(\n [\"inM[16]\", \"instruction[16]\", \"reset\"],\n [\"outM[16]\", \"writeM\", \"addressM[15]\", \"pc[15]\"]\n );\n }\n\n override tick(): void {\n const [state, writeM] = cpuTick(this.cpuInput(), this._state);\n this._state = state;\n this.out(\"writeM\").pull(writeM ? HIGH : LOW);\n this.out(\"outM\").busVoltage = this._state.ALU ?? 0;\n }\n\n override tock(): void {\n if (!this._state) return; // Skip initial tock\n const [output, state] = cpuTock(this.cpuInput(), this._state);\n this._state = state;\n\n this.out(\"addressM\").busVoltage = output.addressM ?? 0;\n this.out(\"outM\").busVoltage = output.outM ?? 0;\n this.out(\"writeM\").pull(output.writeM ? HIGH : LOW);\n this.out(\"pc\").busVoltage = this._state?.PC ?? 0;\n }\n\n private cpuInput(): CPUInput {\n const inM = this.in(\"inM\").busVoltage;\n const instruction = this.in(\"instruction\").busVoltage;\n const reset = this.in(\"reset\").busVoltage === 1;\n return { inM, instruction, reset };\n }\n\n override get(pin: string, offset?: number): Pin | undefined {\n if (pin?.startsWith(\"ARegister\")) {\n return new ConstantBus(\"ARegister\", this._state.A);\n }\n if (pin?.startsWith(\"DRegister\")) {\n return new ConstantBus(\"DRegister\", this._state.D);\n }\n if (pin?.startsWith(\"PC\")) {\n return new ConstantBus(\"PC\", this._state.PC);\n }\n return super.get(pin, offset);\n }\n\n override reset() {\n this._state = emptyState();\n super.reset();\n }\n}\n\nexport class Computer extends Chip {\n #ram = new Memory();\n #rom = new ROM32K();\n #cpu = new CPU();\n\n constructor() {\n super([\"reset\"], []);\n\n this.wire(this.#cpu, [\n { from: { name: \"reset\", start: 0 }, to: { name: \"reset\", start: 0 } },\n {\n from: { name: \"instruction\", start: 0 },\n to: { name: \"instruction\", start: 0 },\n },\n { from: { name: \"outM\", start: 0 }, to: { name: \"inM\", start: 0 } },\n { from: { name: \"writeM\", start: 0 }, to: { name: \"writeM\", start: 0 } },\n {\n from: { name: \"addressM\", start: 0 },\n to: { name: \"addressM\", start: 0 },\n },\n ]);\n\n this.wire(this.#rom, [\n { from: { name: \"pc\", start: 0 }, to: { name: \"address\", start: 0 } },\n {\n from: { name: \"instruction\", start: 0 },\n to: { name: \"out\", start: 0 },\n },\n ]);\n\n this.wire(this.#ram, [\n { from: { name: \"inM\", start: 0 }, to: { name: \"in\", start: 0 } },\n { from: { name: \"writeM\", start: 0 }, to: { name: \"load\", start: 0 } },\n {\n from: { name: \"addressM\", start: 0 },\n to: { name: \"address\", start: 0 },\n },\n { from: { name: \"outM\", start: 0 }, to: { name: \"out\", start: 0 } },\n ]);\n }\n\n override eval() {\n super.eval();\n }\n\n override get(name: string, offset?: number): Pin | undefined {\n if (\n name.startsWith(\"PC\") ||\n name.startsWith(\"ARegister\") ||\n name.startsWith(\"DRegister\")\n ) {\n return this.#cpu.get(name);\n }\n if (name.startsWith(\"RAM16K\")) {\n return this.#ram.get(name, offset);\n }\n return super.get(name, offset);\n }\n\n override load(fs: FileSystem, path: string): Promise {\n return this.#rom.load(fs, path);\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function and(a: Voltage, b: Voltage): [Voltage] {\n return [a === 1 && b === 1 ? HIGH : LOW];\n}\n\nexport function and16(a: number, b: number): [number] {\n return [a & b & 0xffff];\n}\n\nexport class And extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [n] = and(a, b);\n this.out().pull(n);\n }\n}\n\nexport class And16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const [n] = and16(a, b);\n this.out().busVoltage = n;\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function dmux(inn: Voltage, sel: Voltage): [Voltage, Voltage] {\n const a = sel === LOW && inn === HIGH ? HIGH : LOW;\n const b = sel === HIGH && inn === HIGH ? HIGH : LOW;\n return [a, b];\n}\n\nexport function dmux4way(\n inn: Voltage,\n sel: number\n): [Voltage, Voltage, Voltage, Voltage] {\n const a = sel === 0b00 && inn === HIGH ? HIGH : LOW;\n const b = sel === 0b01 && inn === HIGH ? HIGH : LOW;\n const c = sel === 0b10 && inn === HIGH ? HIGH : LOW;\n const d = sel === 0b11 && inn === HIGH ? HIGH : LOW;\n return [a, b, c, d];\n}\n\nexport function dmux8way(\n inn: Voltage,\n sel: number\n): [Voltage, Voltage, Voltage, Voltage, Voltage, Voltage, Voltage, Voltage] {\n const a = sel === 0b000 && inn === HIGH ? HIGH : LOW;\n const b = sel === 0b001 && inn === HIGH ? HIGH : LOW;\n const c = sel === 0b010 && inn === HIGH ? HIGH : LOW;\n const d = sel === 0b011 && inn === HIGH ? HIGH : LOW;\n const e = sel === 0b100 && inn === HIGH ? HIGH : LOW;\n const f = sel === 0b101 && inn === HIGH ? HIGH : LOW;\n const g = sel === 0b110 && inn === HIGH ? HIGH : LOW;\n const h = sel === 0b111 && inn === HIGH ? HIGH : LOW;\n return [a, b, c, d, e, f, g, h];\n}\n\nexport class DMux extends Chip {\n constructor() {\n super([\"in\", \"sel\"], [\"a\", \"b\"]);\n }\n\n override eval() {\n const inn = this.in(\"in\").voltage();\n const sel = this.in(\"sel\").voltage();\n\n const [a, b] = dmux(inn, sel);\n this.out(\"a\").pull(a);\n this.out(\"b\").pull(b);\n }\n}\n\nexport class DMux4Way extends Chip {\n constructor() {\n super([\"in\", \"sel[2]\"], [\"a\", \"b\", \"c\", \"d\"]);\n }\n\n override eval() {\n const inn = this.in(\"in\").voltage();\n const sel = this.in(\"sel\").busVoltage;\n\n const [a, b, c, d] = dmux4way(inn, sel);\n this.out(\"a\").pull(a);\n this.out(\"b\").pull(b);\n this.out(\"c\").pull(c);\n this.out(\"d\").pull(d);\n }\n}\n\nexport class DMux8Way extends Chip {\n constructor() {\n super([\"in\", \"sel[3]\"], [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"]);\n }\n\n override eval() {\n const inn = this.in(\"in\").voltage();\n const sel = this.in(\"sel\").busVoltage;\n\n const [a, b, c, d, e, f, g, h] = dmux8way(inn, sel);\n this.out(\"a\").pull(a);\n this.out(\"b\").pull(b);\n this.out(\"c\").pull(c);\n this.out(\"d\").pull(d);\n this.out(\"e\").pull(e);\n this.out(\"f\").pull(f);\n this.out(\"g\").pull(g);\n this.out(\"h\").pull(h);\n }\n}\n","import { Chip, LOW, Voltage } from \"../../chip.js\";\n\nexport function mux(a: Voltage, b: Voltage, sel: Voltage): [Voltage] {\n return [sel === LOW ? a : b];\n}\n\nexport function mux16(a: number, b: number, sel: Voltage): [number] {\n return [sel === LOW ? a : b];\n}\n\nexport function mux16_4(\n a: number,\n b: number,\n c: number,\n d: number,\n sel: number\n): [number] {\n const s2 = (sel & 0b01) as Voltage;\n return (sel & 0b10) === 0b00 ? mux16(a, b, s2) : mux16(c, d, s2);\n}\n\nexport function mux16_8(\n a: number,\n b: number,\n c: number,\n d: number,\n e: number,\n f: number,\n g: number,\n h: number,\n sel: number\n): [number] {\n const s2 = (sel & 0b11) as Voltage;\n return (sel & 0b100) === 0b000\n ? mux16_4(a, b, c, d, s2)\n : mux16_4(e, f, g, h, s2);\n}\n\nexport class Mux extends Chip {\n constructor() {\n super([\"a\", \"b\", \"sel\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const sel = this.in(\"sel\").voltage();\n\n const [set] = mux(a, b, sel);\n this.out().pull(set);\n }\n}\n\nexport class Mux16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\", \"sel\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const sel = this.in(\"sel\").voltage();\n const [out] = mux16(a, b, sel);\n this.out().busVoltage = out;\n }\n}\n\nexport class Mux4Way16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\", \"c[16]\", \"d[16]\", \"sel[2]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const c = this.in(\"c\").busVoltage;\n const d = this.in(\"d\").busVoltage;\n const sel = this.in(\"sel\").busVoltage;\n const [out] = mux16_4(a, b, c, d, sel);\n\n this.out().busVoltage = out;\n }\n}\n\nexport class Mux8Way16 extends Chip {\n constructor() {\n super(\n [\n \"a[16]\",\n \"b[16]\",\n \"c[16]\",\n \"d[16]\",\n \"e[16]\",\n \"f[16]\",\n \"g[16]\",\n \"h[16]\",\n \"sel[3]\",\n ],\n [\"out[16]\"]\n );\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const c = this.in(\"c\").busVoltage;\n const d = this.in(\"d\").busVoltage;\n const e = this.in(\"e\").busVoltage;\n const f = this.in(\"f\").busVoltage;\n const g = this.in(\"g\").busVoltage;\n const h = this.in(\"h\").busVoltage;\n const sel = this.in(\"sel\").busVoltage;\n const [out] = mux16_8(a, b, c, d, e, f, g, h, sel);\n\n this.out().busVoltage = out;\n }\n}\n","import { nand16 } from \"../../../util/twos.js\";\nimport { HIGH, LOW, Chip, Voltage } from \"../../chip.js\";\n\nexport function nand(a: Voltage, b: Voltage): [Voltage] {\n return [a === 1 && b === 1 ? LOW : HIGH];\n}\n\nexport class Nand extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [out] = nand(a, b);\n this.out().pull(out);\n }\n}\n\nexport class Nand16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n this.out().busVoltage = nand16(a, b);\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function not(inn: Voltage): [Voltage] {\n return [inn === LOW ? HIGH : LOW];\n}\n\nexport function not16(inn: number): [number] {\n return [~inn & 0xffff];\n}\n\nexport class Not extends Chip {\n constructor() {\n super([\"in\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"in\").voltage();\n const [out] = not(a);\n this.out().pull(out);\n }\n}\n\nexport class Not16 extends Chip {\n constructor() {\n super([\"in[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const [n] = not16(this.in().busVoltage);\n this.out().busVoltage = n;\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function or(a: Voltage, b: Voltage): [Voltage] {\n return [a === 1 || b === 1 ? HIGH : LOW];\n}\n\nexport function or16(a: number, b: number): [number] {\n return [(a | b) & 0xffff];\n}\n\nexport function or8way(a: number): [Voltage] {\n return [(a & 0xff) === 0 ? LOW : HIGH];\n}\n\nexport class Or extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [out] = or(a, b);\n this.out().pull(out);\n }\n}\n\nexport class Or16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const [out] = or16(a, b);\n this.out().busVoltage = out;\n }\n}\n\nexport class Or8way extends Chip {\n constructor() {\n super([\"in[8]\"], [\"out\"], \"Or8way\");\n }\n\n override eval() {\n const inn = this.in().busVoltage;\n const [out] = or8way(inn);\n this.out().pull(out);\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function xor(a: Voltage, b: Voltage): [Voltage] {\n return [(a === HIGH && b === LOW) || (a === LOW && b === HIGH) ? HIGH : LOW];\n}\n\nexport function xor16(a: number, b: number): [number] {\n return [(a ^ b) & 0xffff];\n}\n\nexport class Xor extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"out\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [out] = xor(a, b);\n this.out().pull(out);\n }\n}\n\nexport class Xor16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const [out] = xor16(a, b);\n this.out().busVoltage = out;\n }\n}\n","import { Chip } from \"../../chip.js\";\n\nexport function add16(a: number, b: number): [number] {\n return [(a + b) & 0xffff];\n}\n\nexport class Add16 extends Chip {\n constructor() {\n super([\"a[16]\", \"b[16]\"], [\"out[16]\"], \"Add16\");\n }\n\n override eval() {\n const a = this.in(\"a\").busVoltage;\n const b = this.in(\"b\").busVoltage;\n const [out] = add16(a, b);\n this.out().busVoltage = out;\n }\n}\n","import { alu, alua, COMMANDS_OP, Flags } from \"../../../cpu/alu.js\";\nimport { Chip, HIGH, LOW } from \"../../chip.js\";\n\nexport class ALUNoStat extends Chip {\n constructor() {\n super(\n [\n \"x[16]\",\n \"y[16]\", // 16-bit inputs\n \"zx\", // zero the x input?\n \"nx\", // negate the x input?\n \"zy\", // zero the y input?\n \"ny\", // negate the y input?\n \"f\", // compute out = x + y (if 1) or x & y (if 0)\n \"no\", // negate the out output?\n ],\n [\n \"out[16]\", // 16-bit output\n ],\n \"ALU\"\n );\n }\n\n override eval() {\n const x = this.in(\"x\").busVoltage;\n const y = this.in(\"y\").busVoltage;\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n\n const [out] = alu(op, x, y);\n\n this.out().busVoltage = out;\n }\n}\n\nexport class ALU extends Chip {\n constructor() {\n super(\n [\n \"x[16]\",\n \"y[16]\", // 16-bit inputs\n \"zx\", // zero the x input?\n \"nx\", // negate the x input?\n \"zy\", // zero the y input?\n \"ny\", // negate the y input?\n \"f\", // compute out = x + y (if 1) or x & y (if 0)\n \"no\", // negate the out output?\n ],\n [\n \"out[16]\", // 16-bit output\n \"zr\", // 1 if (out === 0), 0 otherwise\n \"ng\", // 1 if (out < 0), 0 otherwise\n ],\n \"ALU\"\n );\n }\n\n override eval() {\n const x = this.in(\"x\").busVoltage;\n const y = this.in(\"y\").busVoltage;\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n\n const [out, flags] = alu(op, x, y);\n\n const ng = flags === Flags.Negative ? HIGH : LOW;\n const zr = flags === Flags.Zero ? HIGH : LOW;\n this.out(\"out\").busVoltage = out;\n this.out(\"ng\").pull(ng);\n this.out(\"zr\").pull(zr);\n }\n\n op(): COMMANDS_OP {\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n return op as COMMANDS_OP;\n }\n}\n\nexport class ALUAll extends Chip {\n constructor() {\n super(\n [\n \"x[16]\",\n \"y[16]\", // 16-bit inputs\n \"zx\", // zero the x input?\n \"nx\", // negate the x input?\n \"zy\", // zero the y input?\n \"ny\", // negate the y input?\n \"f\", // compute out = x + y (if 1) or x & y (if 0)\n \"no\", // negate the out output?\n ],\n [\n \"out[16]\", // 16-bit output\n \"zr\", // 1 if (out === 0), 0 otherwise\n \"ng\", // 1 if (out < 0), 0 otherwise\n ],\n \"ALU\"\n );\n }\n\n override eval() {\n const x = this.in(\"x\").busVoltage;\n const y = this.in(\"y\").busVoltage;\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n\n const [out, flags] = alua(op, x, y);\n\n const ng = flags === Flags.Negative ? HIGH : LOW;\n const zr = flags === Flags.Zero ? HIGH : LOW;\n this.out(\"out\").busVoltage = out;\n this.out(\"ng\").pull(ng);\n this.out(\"zr\").pull(zr);\n }\n\n op(): COMMANDS_OP {\n const zx = this.in(\"zx\").busVoltage << 5;\n const nx = this.in(\"nx\").busVoltage << 4;\n const zy = this.in(\"zy\").busVoltage << 3;\n const ny = this.in(\"ny\").busVoltage << 2;\n const f = this.in(\"f\").busVoltage << 1;\n const no = this.in(\"no\").busVoltage << 0;\n const op = zx + nx + zy + ny + f + no;\n return op as COMMANDS_OP;\n }\n}\n","import { Chip, HIGH, LOW, Voltage } from \"../../chip.js\";\n\nexport function halfAdder(a: Voltage, b: Voltage): [Voltage, Voltage] {\n const sum = (a === 1 && b === 0) || (a === 0 && b === 1) ? HIGH : LOW;\n const car = a === 1 && b === 1 ? HIGH : LOW;\n\n return [sum, car];\n}\n\nexport class HalfAdder extends Chip {\n constructor() {\n super([\"a\", \"b\"], [\"sum\", \"carry\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const [sum, carry] = halfAdder(a, b);\n this.out(\"sum\").pull(sum);\n this.out(\"carry\").pull(carry);\n }\n}\n","import { Chip, Voltage } from \"../../chip.js\";\nimport { or } from \"../logic/or.js\";\nimport { halfAdder } from \"./half_adder.js\";\n\nexport function fullAdder(\n a: Voltage,\n b: Voltage,\n c: Voltage\n): [Voltage, Voltage] {\n const [s, ca] = halfAdder(a, b);\n const [sum, cb] = halfAdder(s, c);\n const [carry] = or(ca, cb);\n\n return [sum, carry];\n}\n\nexport class FullAdder extends Chip {\n constructor() {\n super([\"a\", \"b\", \"c\"], [\"sum\", \"carry\"]);\n }\n\n override eval() {\n const a = this.in(\"a\").voltage();\n const b = this.in(\"b\").voltage();\n const c = this.in(\"c\").voltage();\n const [sum, carry] = fullAdder(a, b, c);\n this.out(\"sum\").pull(sum);\n this.out(\"carry\").pull(carry);\n }\n}\n","import { Chip } from \"../../chip.js\";\nimport { add16 } from \"./add_16.js\";\n\nexport function inc16(n: number): [number] {\n return add16(n, 1);\n}\n\nexport class Inc16 extends Chip {\n constructor() {\n super([\"in[16]\"], [\"out[16]\"], \"Inc16\");\n }\n\n override eval() {\n const a = this.in().busVoltage;\n const [out] = inc16(a);\n this.out().busVoltage = out;\n }\n}\n","import { ClockedChip } from \"../../chip.js\";\n\nexport class DFF extends ClockedChip {\n constructor(name?: string) {\n super([\"in\"], [\"out\"], name, [\"t\"]);\n }\n\n override tick() {\n // Read in into t\n const t = this.in().voltage();\n this.pin(\"t\").pull(t);\n }\n\n override tock() {\n // write t into out\n const t = this.pin(\"t\").voltage();\n this.out().pull(t);\n }\n}\n","import { Err, Ok, Result } from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { Chip } from \"../chip.js\";\n\nimport { And, And16 } from \"./logic/and.js\";\nimport { DMux, DMux4Way, DMux8Way } from \"./logic/dmux.js\";\nimport { Mux, Mux16, Mux4Way16, Mux8Way16 } from \"./logic/mux.js\";\nimport { Nand, Nand16 } from \"./logic/nand.js\";\nimport { Not, Not16 } from \"./logic/not.js\";\nimport { Or, Or16, Or8way } from \"./logic/or.js\";\nimport { Xor, Xor16 } from \"./logic/xor.js\";\n\nimport { Add16 } from \"./arithmetic/add_16.js\";\nimport { ALU, ALUNoStat } from \"./arithmetic/alu.js\";\nimport { FullAdder } from \"./arithmetic/full_adder.js\";\nimport { HalfAdder } from \"./arithmetic/half_adder.js\";\nimport { Inc16 } from \"./arithmetic/inc16.js\";\n\nimport {\n Computer,\n CPU,\n Keyboard,\n Memory,\n ROM32K,\n Screen,\n} from \"./computer/computer.js\";\nimport { Bit, PC, Register, VRegister } from \"./sequential/bit.js\";\nimport { DFF } from \"./sequential/dff.js\";\nimport { RAM16K, RAM4K, RAM512, RAM64, RAM8 } from \"./sequential/ram.js\";\n\nexport {\n And,\n And16,\n DMux,\n Mux,\n Mux16,\n Mux4Way16,\n Mux8Way16,\n Nand,\n Nand16,\n Not,\n Not16,\n Or,\n Or16,\n Or8way,\n Xor,\n Xor16,\n HalfAdder,\n FullAdder,\n Add16,\n Inc16,\n ALU,\n Bit,\n Register,\n VRegister as ARegister,\n VRegister as DRegister,\n DFF,\n RAM8,\n RAM64,\n RAM512,\n RAM4K,\n RAM16K,\n};\n\nexport const REGISTRY = new Map Chip>(\n (\n [\n [\"Nand\", Nand],\n [\"Nand16\", Nand16],\n [\"Not\", Not],\n [\"Not16\", Not16],\n [\"And\", And],\n [\"And16\", And16],\n [\"Or\", Or],\n [\"Or16\", Or16],\n [\"Or8Way\", Or8way],\n [\"XOr\", Xor],\n [\"XOr16\", Xor16],\n [\"Xor\", Xor],\n [\"Xor16\", Xor16],\n [\"Mux\", Mux],\n [\"Mux16\", Mux16],\n [\"Mux4Way16\", Mux4Way16],\n [\"Mux8Way16\", Mux8Way16],\n [\"DMux\", DMux],\n [\"DMux4Way\", DMux4Way],\n [\"DMux8Way\", DMux8Way],\n [\"HalfAdder\", HalfAdder],\n [\"FullAdder\", FullAdder],\n [\"Add16\", Add16],\n [\"Inc16\", Inc16],\n [\"ALU\", ALU],\n [\"ALUNoStat\", ALUNoStat],\n [\"DFF\", DFF],\n [\"Bit\", Bit],\n [\"Register\", Register],\n [\"ARegister\", Register],\n [\"DRegister\", Register],\n [\"PC\", PC],\n [\"RAM8\", RAM8],\n [\"RAM64\", RAM64],\n [\"RAM512\", RAM512],\n [\"RAM4K\", RAM4K],\n [\"RAM16K\", RAM16K],\n [\"ROM32K\", ROM32K],\n [\"Screen\", Screen],\n [\"Keyboard\", Keyboard],\n [\"CPU\", CPU],\n [\"Computer\", Computer],\n [\"Memory\", Memory],\n [\"ARegister\", VRegister],\n [\"DRegister\", VRegister],\n ] as [string, { new (): Chip }][]\n ).map(([name, ChipCtor]) => [\n name,\n () => {\n const chip = new ChipCtor();\n chip.name = name;\n return chip;\n },\n ])\n);\n\nexport function hasBuiltinChip(name: string): boolean {\n return REGISTRY.has(name);\n}\n\nexport function getBuiltinChip(name: string): Result {\n const chip = REGISTRY.get(name);\n return chip\n ? Ok(chip())\n : Err(new Error(`Chip ${name} not in builtin registry`));\n}\n","import { ClockedChip, HIGH, LOW, Pin, Voltage } from \"../../chip.js\";\n\nexport class Bit extends ClockedChip {\n bit: Voltage = LOW;\n\n constructor(name?: string) {\n super([\"in\", \"load\"], [\"out\"], name);\n }\n\n override tick() {\n if (this.in(\"load\").voltage() === HIGH) {\n this.bit = this.in().voltage();\n }\n }\n\n override tock() {\n this.out().pull(this.bit ?? 0);\n }\n\n override reset() {\n this.bit = LOW;\n }\n}\n\nexport class Register extends ClockedChip {\n bits = 0x00;\n\n constructor(name?: string) {\n super([\"in[16]\", \"load\"], [\"out[16]\"], name);\n }\n\n override tick() {\n if (this.in(\"load\").voltage() === HIGH) {\n this.bits = this.in().busVoltage & 0xffff;\n }\n }\n\n override tock() {\n this.out().busVoltage = this.bits & 0xffff;\n }\n\n override get(name: string, offset?: number): Pin | undefined {\n return name === this.name ? this.out() : super.get(name, offset);\n }\n\n override reset() {\n this.bits = 0x00;\n }\n}\n\nexport class VRegister extends Register {}\n\nexport class PC extends ClockedChip {\n bits = 0x00;\n\n constructor(name?: string) {\n super([\"in[16]\", \"load\", \"inc\", \"reset\"], [\"out[16]\"], name);\n }\n\n override tick() {\n if (this.in(\"reset\").voltage() === HIGH) {\n this.bits = 0;\n } else if (this.in(\"load\").voltage() === HIGH) {\n this.bits = this.in().busVoltage & 0xffff;\n } else if (this.in(\"inc\").voltage() === HIGH) {\n this.bits += 1;\n }\n }\n\n override tock() {\n this.out().busVoltage = this.bits & 0xffff;\n }\n\n override get(name: string, offset?: number): Pin | undefined {\n return name === this.name ? this.out() : super.get(name, offset);\n }\n\n override reset() {\n this.bits = 0x00;\n }\n}\n","import { Bus, ClockedChip, Pin } from \"../../chip.js\";\nimport { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { Memory, Memory as MemoryChip } from \"../../../cpu/memory.js\";\n\nexport class RAM extends ClockedChip {\n protected _memory: MemoryChip;\n private _nextData = 0;\n private _address = 0;\n\n get memory() {\n return this._memory;\n }\n get address() {\n return this._address;\n }\n\n constructor(readonly width: number, name?: string) {\n super([\"in[16]\", \"load\", `address[${width}]`], [`out[16]`], name);\n this._memory = new MemoryChip(Math.pow(2, this.width));\n }\n\n override tick() {\n const load = this.in(\"load\").voltage();\n this._address = this.in(\"address\").busVoltage;\n if (load) {\n this._nextData = this.in().busVoltage;\n this._memory.set(this._address, this._nextData);\n }\n }\n\n override tock() {\n this.out().busVoltage = this._memory?.get(this._address) ?? 0;\n }\n\n override eval() {\n const address = this.in(\"address\").busVoltage;\n this.out().busVoltage = this._memory?.get(address) ?? 0;\n }\n\n at(idx: number): Pin {\n assert(\n idx < this._memory.size,\n () => `Request out of bounds (${idx} >= ${this._memory.size})`\n );\n return new RamBus(`${this.name}[${idx}]`, idx, this._memory);\n }\n}\n\nexport class RamBus extends Bus {\n constructor(\n name: string,\n private readonly index: number,\n private ram: Memory\n ) {\n super(name);\n }\n\n override get busVoltage(): number {\n return this.ram.get(this.index);\n }\n\n override set busVoltage(num: number) {\n this.ram.set(this.index, num);\n }\n}\n\nexport class RAM8 extends RAM {\n constructor(name?: string) {\n super(3, name);\n }\n}\n\nexport class RAM64 extends RAM {\n constructor(name?: string) {\n super(6, name);\n }\n}\n\nexport class RAM512 extends RAM {\n constructor(name?: string) {\n super(9, name);\n }\n}\n\nexport class RAM4K extends RAM {\n constructor(name?: string) {\n super(12, name);\n }\n}\n\nexport class RAM16K extends RAM {\n constructor(name?: string) {\n super(14, name);\n }\n}\n","/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { assert, assertExists } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { range } from \"@davidsouther/jiffies/lib/esm/range.js\";\nimport { bin } from \"../util/twos.js\";\nimport { Clock } from \"./clock.js\";\n\nexport const HIGH = 1;\nexport const LOW = 0;\nexport type Voltage = typeof HIGH | typeof LOW;\n\nexport interface Pin {\n readonly name: string;\n readonly width: number;\n busVoltage: number;\n pull(voltage: Voltage, bit?: number): void;\n toggle(bit?: number): void;\n voltage(bit?: number): Voltage;\n connect(pin: Pin): void;\n}\n\nexport class Bus implements Pin {\n state: Voltage[];\n next: Pin[] = [];\n\n constructor(readonly name: string, readonly width = 1) {\n this.state = range(0, this.width).map(() => LOW);\n }\n\n ensureWidth(newWidth: number) {\n assert(newWidth <= 16, `Cannot widen past 16 to ${newWidth} bits`);\n if (this.width < newWidth) {\n (this as { width: number }).width = newWidth;\n this.state = [\n ...this.state,\n ...range(this.width, newWidth).map(() => LOW as Voltage),\n ];\n }\n }\n\n connect(next: Pin) {\n this.next.push(next);\n next.busVoltage = this.busVoltage;\n }\n\n pull(voltage: Voltage, bit = 0) {\n assert(\n bit >= 0 && bit < this.width,\n `Bit out of bounds: ${this.name}@${bit}`\n );\n this.state[bit] = voltage;\n this.next.forEach((n) => n.pull(voltage, bit));\n }\n\n voltage(bit = 0): Voltage {\n assert(bit >= 0 && bit < this.width);\n return this.state[bit];\n }\n\n set busVoltage(voltage: number) {\n for (const i of range(0, this.width)) {\n this.state[i] = ((voltage & (1 << i)) >> i) as Voltage;\n }\n this.next.forEach((n) => (n.busVoltage = this.busVoltage));\n }\n\n get busVoltage(): number {\n return range(0, this.width).reduce((b, i) => b | (this.state[i] << i), 0);\n }\n\n toggle(bit = 0) {\n const nextVoltage = this.voltage(bit) === LOW ? HIGH : LOW;\n this.pull(nextVoltage, bit);\n }\n}\n\nexport class InSubBus extends Bus {\n constructor(\n private bus: Pin,\n private start: number,\n override readonly width = 1\n ) {\n super(bus.name);\n assert(\n start >= 0 && start + width <= bus.width,\n `Mismatched InSubBus dimensions on ${bus.name} (${width} + ${start} > ${bus.width})`\n );\n this.connect(bus);\n }\n\n override pull(voltage: Voltage, bit = 0) {\n assert(bit >= 0 && bit < this.width);\n this.bus.pull(voltage, this.start + bit);\n }\n\n override voltage(bit = 0): Voltage {\n assert(bit >= 0 && bit < this.width);\n return this.bus.voltage(this.start + bit);\n }\n\n override set busVoltage(voltage: number) {\n const high = this.bus.busVoltage & ~mask(this.width + this.start);\n const low = this.bus.busVoltage & mask(this.start);\n const mid = (voltage & mask(this.width)) << this.start;\n this.bus.busVoltage = high | mid | low;\n }\n\n override get busVoltage(): number {\n return (this.bus.busVoltage >> this.start) & mask(this.width);\n }\n\n override connect(bus: Pin): void {\n assert(\n this.start + this.width <= bus.width,\n `Mismatched InSubBus connection dimensions (From ${bus.name} to ${this.name})`\n );\n this.bus = bus;\n }\n}\n\nexport class OutSubBus extends Bus {\n constructor(\n private bus: Pin,\n private start: number,\n override readonly width = 1\n ) {\n super(bus.name);\n assert(start >= 0 && width <= bus.width, `Mismatched OutSubBus dimensions`);\n this.connect(bus);\n }\n\n override set busVoltage(voltage: number) {\n this.bus.busVoltage =\n (voltage & mask(this.width + this.start)) >> this.start;\n }\n\n override get busVoltage(): number {\n return this.bus.busVoltage & mask(this.width);\n }\n\n override connect(bus: Pin): void {\n assert(\n this.width <= bus.width,\n `Mismatched OutSubBus connection dimensions`\n );\n this.bus = bus;\n }\n}\n\nexport class ConstantBus extends Bus {\n constructor(name: string, private readonly value: number) {\n super(name, 16 /* TODO: get high bit index */);\n }\n\n pullHigh(_ = 0) {\n return undefined;\n }\n pullLow(_ = 0) {\n return undefined;\n }\n override voltage(_ = 0): Voltage {\n return (this.busVoltage & 0x1) as Voltage;\n }\n\n override set busVoltage(voltage: number) {\n // Noop\n }\n override get busVoltage(): number {\n return this.value;\n }\n}\n\nexport const TRUE_BUS = new ConstantBus(\"true\", 0xffff);\nexport const FALSE_BUS = new ConstantBus(\"false\", 0);\n\nexport function parsePinDecl(toPin: string): {\n pin: string;\n width: number;\n} {\n const { pin, w } = toPin.match(/(?[a-zA-Z]+)(\\[(?\\d+)\\])?/)\n ?.groups as {\n pin: string;\n w?: string;\n };\n return {\n pin,\n width: w ? Number(w) : 1,\n };\n}\n\nexport function parseToPin(toPin: string): {\n pin: string;\n start?: number;\n end?: number;\n} {\n const { pin, i, j } = toPin.match(\n /(?[a-z]+)(\\[(?\\d+)(\\.\\.(?\\d+))?\\])?/\n )?.groups as { pin: string; i?: string; j?: string };\n return {\n pin,\n start: i ? Number(i) : undefined,\n end: j ? Number(j) : undefined,\n };\n}\n\nexport class Pins {\n private readonly map = new Map();\n\n insert(pin: Pin) {\n const { name } = pin;\n assert(!this.map.has(name), `Pins already has ${name}!`);\n this.map.set(name, pin);\n }\n\n emplace(name: string, minWidth?: number) {\n if (this.has(name)) {\n return this.get(name)!;\n } else {\n const pin = new Bus(name, minWidth);\n this.insert(pin);\n return pin;\n }\n }\n\n has(pin: string): boolean {\n return this.map.has(pin);\n }\n\n get(pin: string): Pin | undefined {\n return this.map.get(pin);\n }\n\n entries(): Iterable {\n return this.map.values();\n }\n\n [Symbol.iterator]() {\n return this.map[Symbol.iterator]();\n }\n}\n\nlet id = 0;\nexport class Chip {\n readonly id = id++;\n ins = new Pins();\n outs = new Pins();\n pins = new Pins();\n parts = new Set();\n clockedPins: Set;\n\n get clocked() {\n if (this.clockedPins.size > 0) {\n return true;\n }\n for (const part of this.parts) {\n if (part.clocked) return true;\n }\n return false;\n }\n\n constructor(\n ins: (string | { pin: string; width: number })[],\n outs: (string | { pin: string; width: number })[],\n public name?: string,\n internals: (string | { pin: string; width: number })[] = [],\n clocked: string[] = []\n ) {\n for (const inn of ins) {\n const { pin, width = 1 } =\n (inn as { pin: string }).pin !== undefined\n ? (inn as { pin: string; width: number })\n : parsePinDecl(inn as string);\n this.ins.insert(new Bus(pin, width));\n }\n\n for (const out of outs) {\n const { pin, width = 1 } =\n (out as { pin: string }).pin !== undefined\n ? (out as { pin: string; width: number })\n : parsePinDecl(out as string);\n this.outs.insert(new Bus(pin, width));\n }\n\n for (const internal of internals) {\n const { pin, width = 1 } =\n (internal as { pin: string }).pin !== undefined\n ? (internal as { pin: string; width: number })\n : parsePinDecl(internal as string);\n this.pins.insert(new Bus(pin, width));\n }\n\n this.clockedPins = new Set(clocked);\n\n Clock.get().$.subscribe(() => this.eval());\n }\n\n reset() {\n for (const [_, pin] of this.ins) {\n pin.busVoltage = 0;\n }\n for (const part of this.parts) {\n part.reset();\n }\n this.eval();\n }\n\n in(pin = \"in\"): Pin {\n assert(this.hasIn(pin), `No in pin ${pin}`);\n return this.ins.get(pin)!;\n }\n\n out(pin = \"out\"): Pin {\n assert(this.hasOut(pin), `No in pin ${pin}`);\n return this.outs.get(pin)!;\n }\n\n hasIn(pin: string): boolean {\n return this.ins.has(pin);\n }\n\n hasOut(pin: string): boolean {\n return this.outs.has(pin);\n }\n\n pin(name: string): Pin {\n assert(this.pins.has(name));\n return this.pins.get(name)!;\n }\n\n get(name: string, offset?: number): Pin | undefined {\n if (this.ins.has(name)) {\n return this.ins.get(name)!;\n }\n if (this.outs.has(name)) {\n return this.outs.get(name)!;\n }\n if (this.pins.has(name)) {\n return this.pins.get(name)!;\n }\n return this.getBuiltin(name, offset);\n }\n\n private getBuiltin(name: string, offset = 0): Pin | undefined {\n if (BUILTIN_NAMES.includes(name)) {\n for (const part of this.parts) {\n const pin = part.get(name, offset);\n if (pin) {\n return pin;\n }\n }\n }\n return undefined;\n }\n\n isOutPin(pin: string): boolean {\n return this.outs.has(pin);\n }\n\n wire(part: Chip, connections: Connection[]) {\n this.parts.add(part);\n for (const { to, from } of connections) {\n if (part.isOutPin(to.name)) {\n this.wireOutPin(part, to, from);\n } else {\n this.wireInPin(part, to, from);\n }\n }\n }\n\n private findPin(from: string, minWidth?: number): Pin {\n if (from.toLowerCase() === \"true\" || from === \"1\") {\n return TRUE_BUS;\n }\n if (from.toLowerCase() === \"false\" || from === \"0\") {\n return FALSE_BUS;\n }\n if (this.ins.has(from)) {\n return this.ins.get(from)!;\n }\n if (this.outs.has(from)) {\n return this.outs.get(from)!;\n }\n return this.pins.emplace(from, minWidth);\n }\n\n private wireOutPin(part: Chip, to: PinSide, from: PinSide) {\n const partPin = assertExists(\n part.outs.get(to.name),\n () => `Cannot wire to missing pin ${to.name}`\n );\n to.width ??= partPin.width;\n\n let chipPin = this.findPin(from.name, from.width ?? to.width);\n const isInternal = this.pins.has(chipPin.name);\n\n from.width ??= chipPin.width;\n\n if (chipPin instanceof ConstantBus) {\n throw new Error(`Cannot wire to constant bus`);\n }\n\n // Widen internal pins\n if (isInternal && chipPin instanceof Bus) {\n chipPin.ensureWidth(from.start + from.width);\n }\n\n // Wrap the chipPin in an InBus when the chip side is dimensioned\n if (from.start > 0 || from.width !== chipPin.width) {\n chipPin = new InSubBus(chipPin, from.start, from.width);\n }\n\n // Wrap the chipPin in an OutBus when the part side is dimensioned\n if (to.start > 0 || to.width !== chipPin.width) {\n chipPin = new OutSubBus(chipPin, to.start, to.width);\n }\n\n partPin.connect(chipPin);\n }\n\n private wireInPin(part: Chip, to: PinSide, from: PinSide) {\n let partPin = assertExists(\n part.ins.get(to.name),\n () => `Cannot wire to missing pin ${to.name}`\n );\n to.width ??= partPin.width;\n\n const chipPin = this.findPin(from.name, from.width ?? to.width);\n\n from.width ??= chipPin.width;\n\n // Wrap the partPin in an InBus when the part side is dimensioned\n if (to.start > 0 || to.width !== chipPin.width) {\n partPin = new InSubBus(partPin, to.start, to.width);\n }\n\n // Wrap the partPin in an OutBus when the chip side is dimensioned\n if (![\"true\", \"false\"].includes(chipPin.name)) {\n if (from.start > 0 || from.width !== chipPin.width) {\n partPin = new OutSubBus(partPin, from.start, from.width);\n }\n }\n chipPin.connect(partPin);\n }\n\n eval() {\n for (const chip of this.parts) {\n // TODO topological sort\n // eval chip input busses\n chip.eval();\n // eval output busses\n }\n }\n\n tick() {\n this.eval();\n }\n\n tock() {\n this.eval();\n }\n\n remove() {\n for (const part of this.parts) {\n part.remove();\n }\n }\n\n // For the ROM32K builtin to load from a file system\n async load(fs: FileSystem, path: string): Promise {\n for (const part of this.parts) {\n if (part.name === \"ROM32K\") {\n await part.load(fs, path);\n }\n }\n }\n}\n\nexport class Low extends Chip {\n constructor() {\n super([], []);\n this.outs.insert(FALSE_BUS);\n }\n}\n\nexport class High extends Chip {\n constructor() {\n super([], []);\n this.outs.insert(TRUE_BUS);\n }\n}\n\nexport class ClockedChip extends Chip {\n override get clocked(): boolean {\n return true;\n }\n\n #subscription = Clock.get().$.subscribe(({ level }) => {\n if (level === LOW) {\n this.tock();\n } else {\n this.tick();\n }\n });\n\n override remove() {\n this.#subscription.unsubscribe();\n super.remove();\n }\n}\n\nexport interface PinSide {\n name: string;\n start: number;\n width?: number;\n}\n\nexport interface Connection {\n // To is the part side\n to: PinSide;\n // From is the chip side\n from: PinSide;\n}\n\nexport type Pinout = Record;\nexport interface SerializedChip {\n id: number;\n name: string;\n ins: Pinout;\n outs: Pinout;\n pins: Pinout;\n children: SerializedChip[];\n}\n\nfunction mask(width: number) {\n return Math.pow(2, width) - 1;\n}\n\nfunction setBus(busses: Pinout, pin: Pin) {\n busses[pin.name] = bin(\n (pin.busVoltage & mask(pin.width)) <<\n (pin as unknown as { start: number }).start ?? 0\n );\n return busses;\n}\n\nexport function printChip(chip: Chip): SerializedChip {\n return {\n id: chip.id,\n name: chip.name ?? chip.constructor.name,\n ins: [...chip.ins.entries()].reduce(setBus, {} as Pinout),\n outs: [...chip.outs.entries()].reduce(setBus, {} as Pinout),\n pins: [...chip.pins.entries()].reduce(setBus, {} as Pinout),\n children: [...chip.parts.values()].map(printChip),\n };\n}\n\nexport const BUILTIN_NAMES = [\n \"Register\",\n \"ARegister\",\n \"DRegister\",\n \"PC\",\n \"RAM8\",\n \"RAM64\",\n \"RAM512\",\n \"RAM4K\",\n \"RAM16K\",\n \"ROM32K\",\n \"Screen\",\n \"Keyboard\",\n \"Memory\",\n];\n","import { BehaviorSubject, Observable, Subject } from \"rxjs\";\nimport { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { HIGH, LOW, Voltage } from \"./chip.js\";\n\ninterface Tick {\n readonly level: Voltage;\n readonly ticks: number;\n}\n\nlet clock: Clock;\nexport class Clock {\n private level: Voltage = LOW;\n private ticks = 0;\n\n static get() {\n if (clock === undefined) {\n clock = new Clock();\n }\n return clock;\n }\n\n get isHigh(): boolean {\n return this.level === HIGH;\n }\n\n get isLow(): boolean {\n return this.level === LOW;\n }\n\n private subject = new BehaviorSubject({\n level: this.level,\n ticks: this.ticks,\n });\n readonly frameSubject = new Subject();\n\n readonly $: Observable = this.subject;\n readonly frame$: Observable = this.frameSubject;\n\n private next() {\n this.subject.next({\n level: this.level,\n ticks: this.ticks,\n });\n }\n\n private constructor() {\n // private\n }\n\n reset() {\n this.level = LOW;\n this.ticks = 0;\n this.next();\n }\n\n tick() {\n assert(this.level === LOW, \"Can only tick up from LOW\");\n this.level = HIGH;\n this.next();\n }\n\n tock() {\n assert(this.level === HIGH, \"Can only tock down from HIGH\");\n this.level = LOW;\n this.ticks += 1;\n this.next();\n }\n\n toggle() {\n this.level === HIGH ? this.tock() : this.tick();\n }\n\n eval() {\n this.tick();\n this.tock();\n }\n\n frame() {\n this.frameSubject.next();\n }\n\n toString() {\n return `${this.ticks}${this.level === HIGH ? \"+\" : \"\"}`;\n }\n}\n","export type COMMANDS_ASM =\n | \"0\"\n | \"1\"\n | \"-1\"\n | \"D\"\n | \"A\"\n | \"M\"\n | \"!D\"\n | \"!A\"\n | \"-D\"\n | \"-A\"\n | \"D+1\"\n | \"A+1\"\n | \"D-1\"\n | \"A-1\"\n | \"D+A\"\n | \"D-A\"\n | \"D-M\"\n | \"A-D\"\n | \"D&A\"\n | \"D&M\"\n | \"D|A\"\n | \"D|M\";\n\nexport type COMMANDS_OP =\n | 0b101010\n | 0b111111\n | 0b111010\n | 0b001100\n | 0b110000\n | 0b110000\n | 0b001101\n | 0b110001\n | 0b001111\n | 0b110011\n | 0b011111\n | 0b110111\n | 0b001110\n | 0b110010\n | 0b000010\n | 0b010011\n | 0b010011\n | 0b000111\n | 0b000000\n | 0b000000\n | 0b010101\n | 0b010101;\n\nexport const COMMANDS: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"0\": 0b101010, // 42 0x2A\n \"1\": 0b111111, // 63 0x3F\n \"-1\": 0b111010, // 58 0x3A\n D: 0b001100, // 12 0x0C\n A: 0b110000, // 48 0x30\n M: 0b110000, // 48 0x30\n \"!D\": 0b001101, // 13 0x0D\n \"!A\": 0b110001, // 49 0x31\n \"-D\": 0b001111, // 15 0x0F\n \"-A\": 0b110011, // 51 0x33\n \"D+1\": 0b011111, // 31 0x1F\n \"A+1\": 0b110111, // 55 0x37\n \"D-1\": 0b001110, // 14 0x0E\n \"A-1\": 0b110010, // 50 0x32\n \"D+A\": 0b000010, // 2 0x02\n \"D-A\": 0b010011, // 19 0x13\n \"D-M\": 0b010011, // 19 0x13\n \"A-D\": 0b000111, // 7 0x07\n \"D&A\": 0b000000, // 0 0x00\n \"D&M\": 0b000000, // 0 0x00\n \"D|A\": 0b010101, // 21 0x15\n \"D|M\": 0b010101, // 21 0x15\n },\n op: {\n 0x2a: \"0\",\n 0x3f: \"1\",\n 0x3a: \"-1\",\n 0x0c: \"D\",\n 0x30: \"A\",\n 0x0d: \"!D\",\n 0x31: \"!A\",\n 0x0f: \"-D\",\n 0x33: \"-A\",\n 0x1f: \"D+1\",\n 0x37: \"A+1\",\n 0x0e: \"D-1\",\n 0x32: \"A-1\",\n 0x02: \"D+A\",\n 0x13: \"D-A\",\n 0x07: \"A-D\",\n 0x00: \"D&A\",\n 0x15: \"D|A\",\n },\n};\n\nexport type ASSIGN_ASM = \"\" | \"M\" | \"D\" | \"MD\" | \"A\" | \"AM\" | \"AD\" | \"AMD\";\nexport type ASSIGN_OP = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;\n\nexport const ASSIGN: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"\": 0x0,\n M: 0b001,\n D: 0b010,\n MD: 0b011,\n A: 0b100,\n AM: 0b101,\n AD: 0b110,\n AMD: 0b111,\n },\n op: {\n 0x0: \"\",\n 0x1: \"M\",\n 0x2: \"D\",\n 0x3: \"MD\",\n 0x4: \"A\",\n 0x5: \"AM\",\n 0x6: \"AD\",\n 0x7: \"AMD\",\n },\n};\n\nexport type JUMP_ASM =\n | \"\"\n | \"JGT\"\n | \"JEQ\"\n | \"JGE\"\n | \"JLT\"\n | \"JNE\"\n | \"JLE\"\n | \"JMP\";\nexport type JUMP_OP = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;\nexport const JUMP: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"\": 0b0,\n JGT: 0b001,\n JEQ: 0b010,\n JGE: 0b011,\n JLT: 0b100,\n JNE: 0b101,\n JLE: 0b110,\n JMP: 0b111,\n },\n op: {\n 0x0: \"\",\n 0x1: \"JGT\",\n 0x2: \"JEQ\",\n 0x3: \"JGE\",\n 0x4: \"JLT\",\n 0x5: \"JNE\",\n 0x6: \"JLE\",\n 0x7: \"JMP\",\n },\n};\n\nexport const Flags = {\n 0x01: \"Positive\",\n 0x00: \"Zero\",\n 0x0f: \"Negative\",\n Positive: 0x01,\n Zero: 0x00,\n Negative: 0x0f,\n};\n\nexport function alu(op: number, d: number, a: number): [number, number] {\n let o = 0;\n switch (op) {\n case 0x2a:\n o = 0;\n break;\n case 0x3f:\n o = 1;\n break;\n case 0x3a:\n o = -1;\n break;\n case 0x0c:\n o = d;\n break;\n case 0x30:\n o = a;\n break;\n case 0x0d:\n o = ~d;\n break;\n case 0x31:\n o = ~a;\n break;\n case 0x0f:\n o = -d;\n break;\n case 0x33:\n o = -a;\n break;\n case 0x1f:\n o = d + 1;\n break;\n case 0x37:\n o = a + 1;\n break;\n case 0x0e:\n o = d - 1;\n break;\n case 0x32:\n o = a - 1;\n break;\n case 0x02:\n o = d + a;\n break;\n case 0x13:\n o = d - a;\n break;\n case 0x07:\n o = a - d;\n break;\n case 0x00:\n o = d & a;\n break;\n case 0x15:\n o = d | a;\n break;\n }\n\n o = o & 0xffff;\n const flags =\n o === 0 ? Flags.Zero : o & 0x8000 ? Flags.Negative : Flags.Positive;\n return [o, flags];\n}\n\nexport function alua(op: number, d: number, a: number): [number, number] {\n if (op & 0b100000) d = 0;\n if (op & 0b010000) d = ~d & 0xffff;\n if (op & 0b001000) a = 0;\n if (op & 0b000100) a = ~a & 0xffff;\n\n let o = (op & 0b000010 ? d + a : d & a) & 0xffff;\n if (op & 0b000001) o = ~o & 0xffff;\n\n const flags =\n o === 0 ? Flags.Zero : o & 0x8000 ? Flags.Negative : Flags.Positive;\n return [o, flags];\n}\n","import { alu, COMMANDS_OP, Flags } from \"./alu.js\";\nimport { Memory } from \"./memory.js\";\n\nexport interface CPUInput {\n inM: number;\n instruction: number;\n reset: boolean;\n}\n\nexport interface CPUOutput {\n outM: number;\n writeM: boolean;\n addressM: number;\n}\n\nexport interface CPUState {\n A: number;\n D: number;\n PC: number;\n ALU: number;\n flag: number;\n}\n\nexport function emptyState(): CPUState {\n return { A: 0, D: 0, PC: 0, ALU: 0, flag: Flags.Zero };\n}\n\nconst BITS = {\n c: 0b1000_0000_0000_0000,\n x1: 0b1001_0000_0000_0000,\n x2: 0b1001_0000_0000_0000,\n am: 0b1001_0000_0000_0000,\n op: 0b0000_1111_1100_0000,\n d1: 0b1000_0000_0010_0000,\n d2: 0b1000_0000_0001_0000,\n d3: 0b1000_0000_0000_1000,\n j1: 0b1000_0000_0000_0001,\n j2: 0b1000_0000_0000_0010,\n j3: 0b1000_0000_0000_0100,\n};\n\nexport function decode(instruction: number) {\n function bit(bit: number): boolean {\n return (instruction & bit) === bit;\n }\n const bits = {\n c: bit(BITS.c),\n x1: bit(BITS.x1),\n x2: bit(BITS.x2),\n am: bit(BITS.am),\n op: ((instruction & BITS.op) >> 6) as COMMANDS_OP,\n d1: bit(BITS.d1),\n d2: bit(BITS.d2),\n d3: bit(BITS.d3),\n j1: bit(BITS.j1),\n j2: bit(BITS.j2),\n j3: bit(BITS.j3),\n };\n\n return bits;\n}\n\nexport function cpuTick(\n { inM, instruction }: CPUInput,\n { A, D, PC }: CPUState\n): [CPUState, boolean] {\n const bits = decode(instruction);\n const a = bits.am ? inM : A;\n const [ALU, flag] = alu(bits.op, D, a);\n\n return [{ A, D, PC: PC + 1, ALU, flag }, bits.d3];\n}\n\nexport function cpuTock(\n { inM, instruction, reset }: CPUInput,\n { A, D, PC, ALU, flag }: CPUState\n): [CPUOutput, CPUState] {\n const bits = decode(instruction);\n\n const j1 = bits.j1 && flag === Flags.Positive;\n const j2 = bits.j2 && flag === Flags.Zero;\n const j3 = bits.j3 && flag === Flags.Negative;\n const jmp = j1 || j2 || j3;\n\n PC = reset ? 0 : jmp ? A : PC;\n\n if (bits.d2) {\n D = ALU;\n }\n\n if (!bits.c) {\n A = instruction & 0x7fff;\n } else if (bits.d1) {\n A = ALU;\n }\n\n const a = bits.am ? inM : A;\n const alu2 = alu(bits.op, D, a);\n\n ALU = alu2[0];\n flag = alu2[1];\n\n const output: CPUOutput = {\n addressM: A,\n outM: ALU,\n writeM: bits.d3,\n };\n\n const state: CPUState = {\n A,\n D,\n ALU,\n flag,\n PC,\n };\n\n return [output, state];\n}\n\nexport function cpu(input: CPUInput, state: CPUState): [CPUOutput, CPUState] {\n const [tickState, _writeM] = cpuTick(input, state);\n return cpuTock(input, tickState);\n}\n\nexport class CPU {\n RAM: Memory;\n ROM: Memory;\n\n #pc = 0;\n #a = 0;\n #d = 0;\n\n #tickState: CPUState = {\n A: 0,\n D: 0,\n PC: 0,\n ALU: 0,\n flag: Flags.Zero,\n };\n\n get state(): CPUState {\n return this.#tickState;\n }\n\n get PC() {\n return this.#pc;\n }\n\n get A() {\n return this.#a;\n }\n\n get D() {\n return this.#d;\n }\n\n constructor({\n RAM = new Memory(0x7fff),\n ROM,\n }: {\n RAM?: Memory;\n ROM: Memory;\n }) {\n this.RAM = RAM;\n this.ROM = ROM;\n }\n\n reset() {\n this.#pc = 0;\n this.#a = 0;\n this.#d = 0;\n }\n\n tick() {\n const [{ addressM, outM, writeM }, { A, D, PC }] = cpu(\n {\n inM: this.RAM.get(this.#a),\n instruction: this.ROM.get(this.#pc),\n reset: false,\n },\n {\n A: this.#a,\n D: this.#d,\n PC: this.#pc,\n ALU: this.#d,\n flag: Flags.Zero,\n }\n );\n\n this.#a = A;\n this.#d = D;\n this.#pc = PC;\n\n if (writeM) {\n this.RAM.set(addressM, outM);\n }\n }\n}\n","import { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { Subject } from \"rxjs\";\nimport { op } from \"../util/asm.js\";\nimport { int10, int16, int2 } from \"../util/twos.js\";\nimport { load } from \"../fs.js\";\n\nexport const FORMATS = [\"bin\", \"dec\", \"hex\", \"asm\"];\nexport type Format = typeof FORMATS[number];\n\nexport const SCREEN = 0x4000;\nexport const SCREEN_ROWS = 512;\nexport const SCREEN_COLS = 256;\nexport const KEYBOARD = 0x6000;\n\nexport class Memory {\n #memory: Int16Array;\n updates = new Subject();\n\n get size(): number {\n return this.#memory.length;\n }\n\n constructor(memory: ArrayBuffer | number) {\n if (typeof memory === \"number\") {\n this.#memory = new Int16Array(memory);\n } else {\n this.#memory = new Int16Array(memory);\n }\n }\n\n get(index: number): number {\n if (index < 0 || index >= this.size) {\n return 0xffff;\n }\n return this.#memory[index] ?? 0;\n }\n\n set(index: number, value: number): void {\n if (index >= 0 && index < this.size) {\n this.#memory[index] = value & 0xffff;\n }\n }\n\n update(cell: number, value: string, format: Format) {\n let current: number;\n switch (format) {\n case \"asm\":\n current = op(value);\n break;\n case \"bin\":\n current = int2(value);\n break;\n case \"hex\":\n current = int16(value);\n break;\n case \"dec\":\n default:\n current = int10(value);\n break;\n }\n\n if (isFinite(current) && current <= 0xffff) {\n this.set(cell, current);\n this.updates.next();\n }\n }\n\n async load(fs: FileSystem, path: string) {\n try {\n (await load(fs, path)).map((v, i) => this.set(i, v));\n } catch (cause) {\n // throw new Error(`ROM32K Failed to load file ${path}`, { cause });\n throw new Error(`Memory Failed to load file ${path}`);\n }\n }\n\n range(start = 0, end = this.size): number[] {\n return [...this.#memory.slice(start, end)];\n }\n\n *map(\n fn: (index: number, value: number) => T,\n start = 0,\n end = this.size\n ): Iterable {\n assert(start < end);\n for (let i = start; i < end; i++) {\n yield fn(i, this.get(i));\n }\n }\n}\n","const asm = `\nASM <: Base {\n Root := ASM\n ASM = Instruction*\n \n Instruction = Label|AInstruction|CInstruction\n \n Label = OpenParen identifier closeParen\n AInstruction = at (identifier | decNumber)\n CInstruction = assign? op jmp?\n \n assign = (\n \"AMD\"\n | \"AM\"\n | \"AD\"\n | \"MD\"\n | \"M\"\n | \"D\"\n | \"A\"\n ) equal\n \n op =\n | \"0\" | \"1\" | \"-1\"\n | \"!D\" | \"!A\" | \"!M\"\n | \"-D\" | \"-A\" | \"-M\"\n | \"D+1\" | \"A+1\" | \"M+1\"\n | \"D-1\" | \"A-1\" | \"M-1\"\n | \"D+A\" | \"D+M\"\n | \"D-A\" | \"D-M\"\n | \"A-D\" | \"M-D\"\n | \"D&A\" | \"D&M\"\n | \"D|A\" | \"D|M\"\n | \"D\" | \"A\" | \"M\"\n\n\n jmp = semi (\"JGT\" | \"JEQ\" | \"JGE\" | \"JLT\" | \"JNE\" | \"JLE\" | \"JMP\")\n}`;\nexport default asm;\n","import { assertExists } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport ohm from \"ohm-js\";\nimport {\n ASSIGN,\n ASSIGN_ASM,\n ASSIGN_OP,\n COMMANDS,\n COMMANDS_ASM,\n COMMANDS_OP,\n JUMP,\n JUMP_ASM,\n JUMP_OP,\n} from \"../cpu/alu.js\";\nimport { KEYBOARD, SCREEN } from \"../cpu/memory.js\";\nimport { makeC } from \"../util/asm.js\";\nimport { grammars, makeParser, baseSemantics } from \"./base.js\";\n\nimport asmGrammar from \"./grammars/asm.ohm.js\";\n\nexport const grammar = ohm.grammar(asmGrammar, grammars);\nexport const asmSemantics = grammar.extendSemantics(baseSemantics);\n\nexport interface Asm {\n instructions: AsmInstruction[];\n}\n\nexport type AsmInstruction =\n | AsmAInstruction\n | AsmCInstruction\n | AsmLabelInstruction;\n\nexport type AsmAInstruction = AsmALabelInstruction | AsmAValueInstruction;\nexport interface AsmALabelInstruction {\n type: \"A\";\n label: string;\n}\n\nexport interface AsmAValueInstruction {\n type: \"A\";\n value: number;\n}\n\nfunction isALabelInstruction(\n inst: AsmAInstruction\n): inst is AsmALabelInstruction {\n return (inst as AsmALabelInstruction).label !== undefined;\n}\n\nexport interface AsmCInstruction {\n type: \"C\";\n op: COMMANDS_OP;\n isM: boolean;\n store?: ASSIGN_OP;\n jump?: JUMP_OP;\n}\n\nexport interface AsmLabelInstruction {\n type: \"L\";\n label: string;\n}\n\nasmSemantics.addAttribute(\"root\", {\n Root(_) {\n return this.asm;\n },\n});\n\nasmSemantics.addAttribute(\"asm\", {\n Root(asm) {\n return {\n instructions: asm\n .child(0)\n .children.map(({ instruction }) => instruction as AsmInstruction),\n };\n },\n});\n\nasmSemantics.addAttribute(\"instruction\", {\n AInstruction(_at, val): AsmAInstruction {\n try {\n return {\n type: \"A\",\n label: val.name,\n };\n } catch (e) {\n // Pass\n }\n\n try {\n return {\n type: \"A\",\n value: val.value,\n };\n } catch (e) {\n // pass\n }\n\n throw new Error(`AsmAInstruction must have either a name or a value`);\n },\n CInstruction(assignN, opN, jmpN): AsmCInstruction {\n const assign = assignN.child(0)?.child(0)?.sourceString as ASSIGN_ASM;\n const op = opN.sourceString.replace(\"M\", \"A\") as COMMANDS_ASM;\n const jmp = jmpN.child(0)?.child(1)?.sourceString as JUMP_ASM;\n const isM =\n assignN.sourceString.includes(\"M\") || opN.sourceString.includes(\"M\");\n const inst: AsmCInstruction = {\n type: \"C\",\n op: COMMANDS.asm[op],\n isM,\n };\n if (jmp) inst.jump = JUMP.asm[jmp];\n if (assign) inst.store = ASSIGN.asm[assign];\n return inst;\n },\n Label(_o, { name }, _c): AsmLabelInstruction {\n return {\n type: \"L\",\n label: name,\n };\n },\n});\n\nexport function fillLabel(asm: Asm) {\n let nextLabel = 16;\n const symbols = new Map([\n [\"R0\", 0],\n [\"R1\", 1],\n [\"R2\", 2],\n [\"R3\", 3],\n [\"R4\", 4],\n [\"R5\", 5],\n [\"R6\", 6],\n [\"R7\", 7],\n [\"R8\", 8],\n [\"R9\", 9],\n [\"R10\", 10],\n [\"R11\", 11],\n [\"R12\", 12],\n [\"R13\", 13],\n [\"R14\", 14],\n [\"R15\", 15],\n [\"SP\", 0],\n [\"LCL\", 1],\n [\"ARG\", 2],\n [\"THIS\", 3],\n [\"THAT\", 4],\n [\"SCREEN\", SCREEN],\n [\"KBD\", KEYBOARD],\n ]);\n\n function getLabelValue(label: string) {\n if (!symbols.has(label)) {\n symbols.set(label, nextLabel);\n nextLabel += 1;\n }\n return assertExists(symbols.get(label), `Label not in symbols: ${label}`);\n }\n\n function transmuteAInstruction(instruction: AsmALabelInstruction) {\n const value = getLabelValue(instruction.label);\n (instruction as unknown as AsmAValueInstruction).value = value;\n delete (instruction as unknown as { label: undefined }).label;\n }\n\n const unfilled: AsmALabelInstruction[] = [];\n let line = 0;\n for (const instruction of asm.instructions) {\n if (instruction.type === \"L\") {\n if (symbols.has(instruction.label)) {\n throw new Error(`ASM Duplicate label ${instruction.label}`);\n } else {\n symbols.set(instruction.label, line);\n }\n continue;\n }\n\n line += 1;\n\n if (instruction.type === \"A\") {\n if (isALabelInstruction(instruction)) {\n unfilled.push(instruction);\n }\n }\n }\n\n unfilled.forEach(transmuteAInstruction);\n}\n\nexport function emit(asm: Asm): number[] {\n return asm.instructions\n .map((inst) => {\n if (inst.type === \"A\") {\n if (isALabelInstruction(inst)) {\n throw new Error(`ASM Emitting unfilled A instruction`);\n }\n return inst.value;\n }\n if (inst.type === \"C\") {\n return makeC(inst.isM, inst.op, inst.store, inst.jump);\n }\n return undefined;\n })\n .filter((op): op is number => op !== undefined);\n}\n\nexport const ASM = {\n grammar: asmGrammar,\n semantics: asmSemantics,\n parser: grammar,\n parse: makeParser(grammar, asmSemantics),\n passes: {\n fillLabel,\n emit,\n },\n};\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { unwrap } from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { ASM } from \"./languages/asm.js\";\nimport { int2 } from \"./util/twos.js\";\n\nexport async function load(fs: FileSystem, path: string): Promise {\n if (path.endsWith(\".hack\")) {\n return loadHack(fs, path);\n }\n\n if (path.endsWith(\".asm\")) {\n return loadAsm(fs, path);\n }\n\n throw new Error(`Cannot load file without hack or asm extension ${path}`);\n}\n\nexport async function loadAsm(fs: FileSystem, path: string): Promise {\n const source = await fs.readFile(path);\n const asm = unwrap(ASM.parse(source));\n ASM.passes.fillLabel(asm);\n return ASM.passes.emit(asm);\n}\n\nexport async function loadHack(\n fs: FileSystem,\n path: string\n): Promise {\n return (await fs.readFile(path))\n .split(\"\\n\")\n .filter((line) => line.trim() !== \"\")\n .map(int2);\n}\n","import ohm from \"ohm-js\";\nimport { int10, int16, int2 } from \"../util/twos.js\";\nimport { Err, Ok, Result } from \"@davidsouther/jiffies/lib/esm/result.js\";\n\nexport const UNKNOWN_PARSE_ERROR = `Unknown parse error`;\n\nimport baseGrammar from \"./grammars/base.ohm.js\";\nexport const grammars = {\n Base: ohm.grammar(baseGrammar),\n};\n\nexport const baseSemantics = grammars.Base.createSemantics();\n\nbaseSemantics.extendOperation(\"asIteration\", {\n List(list, _) {\n return list.asIteration();\n },\n});\n\nbaseSemantics.addAttribute(\"value\", {\n decNumber(_, digits): number {\n return int10(digits.sourceString);\n },\n wholeDec(_, digits): number {\n return int10(digits.sourceString);\n },\n binNumber(_, digits) {\n return int2(digits.sourceString);\n },\n hexNumber(_, digits) {\n return int16(digits.sourceString);\n },\n Number(num) {\n return num.value;\n },\n Name(ident) {\n return ident.name;\n },\n identifier(_, __): string {\n return this.sourceString;\n },\n});\n\nbaseSemantics.addAttribute(\"name\", {\n identifier(_, __): string {\n return this.sourceString;\n },\n Name(_): string {\n return this.child(0)?.name;\n },\n});\n\nbaseSemantics.addAttribute(\"String\", {\n String(_a, str, _b) {\n return str.sourceString;\n },\n});\n\nexport type ParseError = Error | { message: string; shortMessage: string };\n\nexport function makeParser(\n grammar: ohm.Grammar,\n semantics: ohm.Semantics,\n property: (obj: ohm.Dict) => ResultType = ({ root }) => root\n): (source: string) => Result {\n return function parse(source) {\n try {\n const match = grammar.match(source);\n if (match.succeeded()) {\n const parsed = semantics(match);\n const parse = property(parsed);\n return Ok(parse);\n } else {\n return Err({\n message: match.message ?? UNKNOWN_PARSE_ERROR,\n shortMessage: match.shortMessage ?? UNKNOWN_PARSE_ERROR,\n });\n }\n } catch (e) {\n return Err(e as Error);\n }\n };\n}\n\nexport interface Span {\n start: number;\n end: number;\n}\n","const base = `\nBase {\n Root = Value*\n\n At = at\n Bang = bang\n Bar = bar\n CloseAngle = closeAngle\n CloseBrace = closeBrace\n CloseParen = closeParen\n CloseSquare = closeSquare\n Comma = comma\n Dollar = dollar\n Dot = dot\n DoubleQuote = doubleQuote\n Equal = equal\n OpenAngle = openAngle\n OpenBrace = openBrace\n OpenParen = openParen\n OpenSquare = openSquare\n Percent = percent\n Semi = semi\n Underscore = underscore\n\n at = \"@\"\n bang = \"!\"\n bar = \"|\"\n closeAngle = \">\"\n closeBrace = \"}\"\n closeParen = \")\"\n closeSquare = \"]\"\n comma = \",\"\n dollar = \"$\"\n dot = \".\"\n doubleQuote = \"\\\\\"\"\n equal = \"=\"\n minus = \"-\"\n newline = \"\\\\r\"? \"\\\\n\"\n openAngle = \"<\"\n openBrace = \"{\"\n openParen = \"(\"\n openSquare = \"[\"\n percent = \"%\"\n semi = \";\"\n underscore = \"_\"\n\n Value = identifier | number | boolean\n\n boolean = true | false\n True = true\n False = false\n true = \"true\"\n false = \"false\"\n\n Name = identifier\n identifier = (letter|underscore) (alnum|underscore|dot|dollar)*\n\n Number = number\n number = hexNumber | decNumber | binNumber\n binNumber = (\"%B\") (\"0\"|\"1\")+\n hexNumber = (\"%X\") hexDigit+\n decNumber = (\"%D\")? (wholeDec | realDec)\n wholeDec = minus? digit+\n realDec = minus? digit* \".\" digit+\n\n String = DoubleQuote (~doubleQuote any)* doubleQuote\n \n spaces := (lineComment | comment | space)*\n commentStart = \"/*\"\n commentEnd = \"*/\"\n comment = commentStart (~commentEnd any)* commentEnd\n lineCommentStart = \"//\"\n lineComment = lineCommentStart (~\"\\\\n\" any)* \"\\\\n\"\n\n List = NonemptyListOf sep?\n EmptyList = EmptyList sep?\n}`;\nexport default base;\n","const cmp = `\nCmp <: Base {\n Root := line*\n line = bar cell+ newline?\n cell = cellvalue bar\n cellvalue = (~(bar|newline) any)*\n}`;\nexport default cmp;\n","import ohm from \"ohm-js\";\nimport { grammars, makeParser, baseSemantics } from \"./base.js\";\n\nexport type Cell = string;\nexport type Line = Cell[];\nexport type Cmp = Line[];\n\nimport cmpGrammar from \"./grammars/cmp.ohm.js\";\nexport const grammar = ohm.grammar(cmpGrammar, grammars);\nexport const cmpSemantics = grammar.extendSemantics(baseSemantics);\n\ncmpSemantics.addAttribute(\"cell\", {\n cell(value, _) {\n return value.sourceString;\n },\n});\n\ncmpSemantics.addAttribute(\"line\", {\n line(_a, cells, _b) {\n return cells.children.map((c) => c.cell);\n },\n});\n\ncmpSemantics.addAttribute(\"root\", {\n Root(lines) {\n return lines.children.map((c) => c.line);\n },\n});\n\nexport const CMP = {\n grammar: cmpGrammar,\n semantics: cmpSemantics,\n parser: grammar,\n parse: makeParser(grammar, cmpSemantics),\n};\n","const hdl = `\nHdl <: Base{\n Root := Chip\n Chip = \"CHIP\" Name OpenBrace ChipBody CloseBrace\n ChipBody = InList? OutList? PartList ClockedList?\n InList = \"IN\" PinList Semi\n OutList = \"OUT\" PinList Semi\n PartList = BuiltinPart | Parts\n PinList = List\n PinDecl = Name PinWidth?\n PinWidth = OpenSquare decNumber CloseSquare\n BuiltinPart = \"BUILTIN\" Semi\n Parts = \"PARTS:\" Part*\n Part = Name \"(\" Wires \")\" Semi\n Wires = List\n Wire = WireSide Equal (WireSide | True | False) \n WireSide = Name SubBus? \n SubBus = OpenSquare decNumber subBusRest? CloseSquare\n subBusRest = \"..\" decNumber\n ClockedList = \"CLOCKED\" SimplePinList Semi\n SimplePinList = List\n}`;\nexport default hdl;\n","/** Reads and parses HDL chip descriptions. */\nimport ohm from \"ohm-js\";\nimport { grammars, baseSemantics } from \"./base.js\";\nimport { makeParser } from \"./base.js\";\n\nexport interface PinIndex {\n start?: number | undefined;\n end?: number | undefined;\n}\n\nexport interface PinParts extends PinIndex {\n pin: string;\n}\n\nexport interface PinDeclaration {\n pin: string | string;\n width: number;\n}\n\nexport interface Wire {\n lhs: PinParts;\n rhs: PinParts;\n}\n\nexport interface Part {\n name: string;\n wires: Wire[];\n}\n\nexport interface HdlParse {\n name: string;\n ins: PinDeclaration[];\n outs: PinDeclaration[];\n clocked: string[];\n parts: \"BUILTIN\" | Part[];\n}\n\nimport hdlGrammar from \"./grammars/hdl.ohm.js\";\nexport const grammar = ohm.grammar(hdlGrammar, grammars);\n\nexport const hdlSemantics = grammar.extendSemantics(baseSemantics);\n\nhdlSemantics.addAttribute(\"SubBus\", {\n SubBus(_a, startNode, endNode, _b) {\n const start = startNode.value;\n const end = endNode.child(0)?.child(1)?.value ?? start;\n return { start, end };\n },\n});\n\nhdlSemantics.addAttribute(\"WireSide\", {\n WireSide({ name }, index) {\n const { start, end } = (index.child(0)?.SubBus as PinIndex) ?? {\n start: undefined,\n end: undefined,\n };\n return { pin: name, start, end };\n },\n});\n\nhdlSemantics.addAttribute(\"Wire\", {\n Wire(left, _, right) {\n const rhs: PinParts = right.isTerminal()\n ? { pin: right.sourceString }\n : right.WireSide;\n return { lhs: left.WireSide as PinParts, rhs };\n },\n});\n\nhdlSemantics.addAttribute(\"Wires\", {\n Wires(list) {\n return list.asIteration().children.map((node) => node.Wire as Wire);\n },\n});\n\nhdlSemantics.addAttribute(\"Part\", {\n Part({ name }, _a, { Wires }, _b, _c) {\n return { name: name as string, wires: Wires as Wire[] };\n },\n});\n\nhdlSemantics.addAttribute(\"Parts\", {\n Parts(_, parts) {\n return parts.children.map((c) => c.Part);\n },\n BuiltinPart(_a, _b) {\n return \"BUILTIN\";\n },\n});\n\nhdlSemantics.addAttribute<\"BUILTIN\" | Part[]>(\"PartList\", {\n PartList(list) {\n return list.Parts;\n },\n});\n\nhdlSemantics.addAttribute(\"Clocked\", {\n ClockedList(_a, clocked, _b) {\n return (\n clocked\n .asIteration()\n .children.map(\n ({ sourceString }: { sourceString: string }) => sourceString\n ) ?? []\n );\n },\n});\n\nhdlSemantics.addAttribute(\"PinDecl\", {\n PinDecl({ name }, width) {\n return {\n pin: name,\n width: width.child(0)?.child(1)?.value ?? 1,\n };\n },\n});\n\nhdlSemantics.addAttribute(\"PinList\", {\n PinList(list) {\n return list\n .asIteration()\n .children.map((node) => node.PinDecl as PinDeclaration);\n },\n});\n\nhdlSemantics.addAttribute(\"Chip\", {\n Chip(_a, { name }, _b, body, _c) {\n return {\n name,\n ins: body.child(0).child(0)?.child(1)?.PinList ?? [],\n outs: body.child(1).child(0)?.child(1)?.PinList ?? [],\n parts: body.child(2).PartList ?? [],\n clocked: body.child(3).child(0)?.Clocked,\n };\n },\n});\n\nhdlSemantics.addAttribute(\"Root\", {\n Root(root) {\n return root.child(0)?.Chip;\n },\n});\n\nexport const HDL = {\n parser: grammar,\n grammar: hdlGrammar,\n semantics: hdlSemantics,\n parse: makeParser(grammar, hdlSemantics, (n) => n.Chip),\n};\n","const tst = `\nTst <: Base {\n Root := Tst\n Tst = (TstStatement | TstRepeat | TstWhile)+\n\n TstRepeat = Repeat Number? OpenBrace TstStatement+ CloseBrace\n TstWhile = While Condition OpenBrace TstStatement+ CloseBrace\n TstStatement = List (Semi | Bang)\n\n TstOperation =\n | TstFileOperation\n | TstOutputListOperation\n | TstEvalOperation\n | TstSetOperation\n | TstOutputOperation\n | TstEchoOperation\n | TstClearEchoOperation\n | TstLoadROMOperation\n\n TstLoadROMOperation = ROM32K Load FileName\n TstFileOperation = FileOperation FileName\n TstOutputListOperation = \"output-list\" OutputFormat+\n OutputFormat = Name Index? percent FormatStyle wholeDec dot wholeDec dot wholeDec\n TstSetOperation = Set Name Index? Number\n Index = OpenSquare wholeDec? CloseSquare\n Condition = Value CompareOp Value\n TstEvalOperation = Eval | Tick | Tock\n TstOutputOperation = Output\n TstEchoOperation = Echo String\n TstClearEchoOperation = ClearEcho\n\n FileName = Name\n FileOperation = \"load\" | \"output-file\" | \"compare-to\"\n\n Set = \"set\"\n Eval = \"eval\"\n Tick = \"tick\"\n Tock = \"tock\"\n Echo = \"echo\"\n Repeat = \"repeat\"\n ClearEcho = \"clear-echo\"\n Output = \"output\"\n OutputList = \"output-list\"\n FormatStyle = \"B\"|\"D\"|\"S\"|\"X\"\n ROM32K = \"ROM32K\"\n Load = \"load\"\n While = \"while\"\n\n CompareOp = \"<>\" | \"<=\" | \">=\" | \"=\" | \"<\" | \">\"\n}`;\nexport default tst;\n","/** Reads tst files to apply and perform test runs. */\n\nimport ohm from \"ohm-js\";\nimport { baseSemantics, grammars, makeParser, Span } from \"./base.js\";\n\nexport interface TstEchoOperation {\n op: \"echo\";\n message: string;\n}\n\nexport interface TstClearEchoOperation {\n op: \"clear-echo\";\n}\n\nexport interface TstSetOperation {\n op: \"set\";\n id: string;\n index?: number;\n value: number;\n}\n\nexport interface TstEvalOperation {\n op: \"eval\" | \"tick\" | \"tock\";\n}\n\nexport interface TstOutputOperation {\n op: \"output\";\n}\n\nexport interface TstOutputSpec {\n id: string;\n builtin: boolean;\n address: number;\n style: \"D\" | \"X\" | \"B\" | \"S\";\n width: number;\n lpad: number;\n rpad: number;\n}\n\nexport interface TstOutputListOperation {\n op: \"output-list\";\n spec: TstOutputSpec[];\n}\n\nexport interface TstLoadROMOperation {\n op: \"loadRom\";\n file: string;\n}\n\nexport interface TstFileOperation {\n op: \"load\" | \"output-file\" | \"compare-to\";\n file: string;\n}\n\nexport type TstOperation =\n | TstFileOperation\n | TstEvalOperation\n | TstEchoOperation\n | TstClearEchoOperation\n | TstOutputOperation\n | TstSetOperation\n | TstOutputListOperation\n | TstLoadROMOperation;\n\nexport interface TstLineStatement {\n ops: TstOperation[];\n break?: true;\n span: Span;\n}\n\nexport interface TstRepeat {\n statements: TstLineStatement[];\n count: number;\n span: Span;\n}\n\nexport interface TstWhileCondition {\n op: \"<\" | \"<=\" | \"=\" | \">=\" | \">\" | \"<>\";\n left: string | number;\n right: string | number;\n}\n\nexport interface TstWhileStatement {\n statements: TstLineStatement[];\n condition: TstWhileCondition;\n span: Span;\n}\n\nexport type TstStatement = TstLineStatement | TstRepeat | TstWhileStatement;\n\nexport interface Tst {\n lines: TstStatement[];\n}\n\nimport tstGrammar from \"./grammars/tst.ohm.js\";\nexport const grammar = ohm.grammar(tstGrammar, grammars);\nexport const tstSemantics = grammar.extendSemantics(baseSemantics);\n\ntstSemantics.extendAttribute(\"value\", {\n Index(_a, idx, _b) {\n return idx?.child(0)?.value ?? -1;\n },\n});\n\ntstSemantics.extendAttribute(\"name\", {\n FileName({ name }) {\n return name;\n },\n});\n\ntstSemantics.addAttribute(\"index\", {\n Index(_open, dec, _close) {\n return dec.child(0)?.value ?? 0;\n },\n});\n\ntstSemantics.addAttribute(\"format\", {\n OutputFormat(\n { name: id },\n index,\n _a,\n { sourceString: style },\n { value: lpad },\n _b,\n { value: width },\n _c,\n { value: rpad }\n ) {\n return {\n id,\n builtin: index?.child(0) !== undefined,\n address: index?.child(0)?.value ?? -1,\n style: style as TstOutputSpec[\"style\"],\n width,\n lpad,\n rpad,\n };\n },\n});\n\ntstSemantics.addAttribute(\"operation\", {\n TstEvalOperation(op) {\n return { op: op.sourceString as TstEvalOperation[\"op\"] };\n },\n TstOutputOperation(_) {\n return { op: \"output\" };\n },\n TstOutputListOperation(_, formats) {\n return {\n op: \"output-list\",\n spec: formats.children.map((n) => n.format),\n };\n },\n TstSetOperation(op, { name }, index, { value }) {\n const setOp: TstSetOperation = {\n op: \"set\",\n id: name,\n value,\n };\n const child = index.child(0)?.child(1)?.child(0);\n if (child) {\n setOp.index = child.value;\n }\n return setOp;\n },\n TstEchoOperation(op, str) {\n return {\n op: \"echo\",\n message: str.String as string,\n };\n },\n TstClearEchoOperation(op) {\n return {\n op: \"clear-echo\",\n };\n },\n TstLoadROMOperation(_r, _l, { name }) {\n return {\n op: \"loadRom\",\n file: name,\n };\n },\n TstFileOperation(op, file) {\n return {\n op: op.sourceString as TstFileOperation[\"op\"],\n file: file.sourceString,\n };\n },\n});\n\ntstSemantics.addAttribute(\"condition\", {\n Condition({ value: left }, { sourceString: op }, { value: right }) {\n return {\n left,\n right,\n op: op as \"<\" | \"<=\" | \"=\" | \">=\" | \">\" | \"<>\",\n };\n },\n});\n\ntstSemantics.addAttribute(\"statement\", {\n TstWhile(op, cond, _o, statements, _c) {\n return {\n statements: statements.children.map(({ statement }) => statement),\n condition: cond.condition,\n span: {\n start: op.source.startIdx,\n end: cond.source.endIdx,\n },\n };\n },\n TstRepeat(op, count, _o, statements, _c) {\n return {\n statements: statements.children.map(({ statement }) => statement),\n count: count.child(0)?.value ?? -1,\n span: {\n start: op.source.startIdx,\n end: count.source.endIdx,\n },\n };\n },\n TstStatement(list, end) {\n const stmt: TstStatement = {\n ops: list\n .asIteration()\n .children.map((node) => node.operation as TstOperation),\n span: {\n start: this.source.startIdx,\n end: this.source.endIdx,\n },\n };\n if (end.sourceString === \"!\") {\n stmt.break = true;\n }\n return stmt;\n },\n});\n\ntstSemantics.addAttribute(\"tst\", {\n Tst(lines) {\n return {\n lines: lines.children.map((n) => n.statement),\n };\n },\n});\n\ntstSemantics.addAttribute(\"root\", {\n Root({ tst }) {\n return tst;\n },\n});\n\nexport const TST = {\n grammar: tstGrammar,\n semantics: tstSemantics,\n parser: grammar,\n parse: makeParser(grammar, tstSemantics),\n};\n","import { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { bin, dec, hex } from \"./util/twos.js\";\nimport { Test } from \"./tst.js\";\n\nexport class Output {\n private readonly fmt: \"B\" | \"X\" | \"D\" | \"S\";\n private readonly lPad: number;\n private readonly rPad: number;\n private readonly len: number;\n private readonly index: number;\n private readonly builtin: boolean;\n\n // new Output(inst.id, inst.style, inst.width, inst.lpad, inst.rpad)\n constructor(\n private variable: string,\n format = \"%B1.1.1\",\n len?: number,\n lPad?: number,\n rPad?: number,\n builtin?: boolean,\n index?: number\n ) {\n if (\n format.startsWith(\"%\") &&\n len === undefined &&\n lPad === undefined &&\n rPad === undefined\n ) {\n const { fmt, lPad, rPad, len } = format.match(\n /^%(?[BDXS])(?\\d+)\\.(?\\d+)\\.(?\\d+)$/\n )?.groups as {\n fmt: \"B\" | \"X\" | \"D\" | \"S\";\n lPad: string;\n rPad: string;\n len: string;\n };\n this.fmt = fmt;\n this.lPad = parseInt(lPad);\n this.rPad = parseInt(rPad);\n this.len = parseInt(len);\n this.builtin = false;\n this.index = -1;\n } else {\n assert([\"B\", \"X\", \"D\", \"S\"].includes(format[0]));\n this.fmt = format[0] as \"B\" | \"X\" | \"D\" | \"S\";\n this.len = len ?? 3;\n this.lPad = lPad ?? 1;\n this.rPad = rPad ?? 1;\n this.builtin = builtin ?? false;\n this.index = index ?? -1;\n }\n }\n\n header(test: Test) {\n let variable = `${this.variable}`;\n if (this.builtin) {\n const index = this.index >= 0 ? this.index : \"\";\n variable = `${variable}[${index}]`;\n }\n if (variable.length > this.len + this.lPad + this.rPad) {\n return variable.substring(0, this.len + this.lPad + this.rPad);\n }\n return this.padCenter(variable);\n }\n\n print(test: Test) {\n const val = test.getVar(this.variable, this.index);\n if (this.fmt === \"S\") {\n return this.padLeft(val as string);\n }\n\n const fmt = { B: bin, D: dec, X: hex }[this.fmt];\n const value = fmt(val as number);\n if (this.fmt === \"D\") {\n return this.padRight(value);\n } else {\n return this.padCenter(value.slice(value.length - this.len));\n }\n }\n\n private padCenter(value: string) {\n const space = this.lPad + this.len + this.rPad;\n const leftSpace = Math.floor((space - value.length) / 2);\n const rightSpace = space - leftSpace - value.length;\n const padLeft = leftSpace + value.length;\n const padRight = padLeft + rightSpace;\n value = value.padStart(padLeft);\n value = value.padEnd(padRight);\n return value;\n }\n\n private padLeft(value: string) {\n value = value.substring(0, this.len);\n const padRight = this.rPad + this.len;\n const padLeft = this.lPad + padRight;\n value = value.padEnd(padRight);\n value = value.padStart(padLeft);\n return value;\n }\n\n private padRight(value: string) {\n value = value.substring(0, this.len);\n const padLeft = this.lPad + this.len;\n const padRight = this.rPad + padLeft;\n value = value.padStart(padLeft);\n value = value.padEnd(padRight);\n return value;\n }\n}\n","import {\n assertExists,\n checkExhaustive,\n} from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { Span } from \"./languages/base.js\";\nimport {\n Tst,\n TstLineStatement,\n TstOperation,\n TstOutputSpec,\n TstStatement,\n TstWhileStatement,\n} from \"./languages/tst.js\";\nimport { Bus, Chip, HIGH, Low, LOW } from \"./chip/chip.js\";\nimport { Clock } from \"./chip/clock.js\";\nimport { Output } from \"./output.js\";\n\nexport abstract class Test {\n protected readonly instructions: (IS | TestInstruction)[] = [];\n protected _outputList: Output[] = [];\n protected _log = \"\";\n fs: FileSystem = new FileSystem();\n\n setFileSystem(fs: FileSystem): this {\n this.fs = fs;\n return this;\n }\n\n echo(_content: string) {\n return undefined;\n }\n clearEcho() {\n return undefined;\n }\n\n async load(_filename: string): Promise {\n return undefined;\n }\n async compareTo(_filename: string): Promise {\n return undefined;\n }\n outputFile(_filename: string): void {\n return undefined;\n }\n outputList(outputs: Output[]): void {\n this._outputList = outputs;\n }\n\n addInstruction(instruction: IS | TestInstruction): void {\n this.instructions.push(instruction);\n }\n\n reset(): this {\n this._steps = (function* (test) {\n for (const instruction of test.instructions) {\n yield* instruction.steps(test);\n }\n })(this);\n this._step = this._steps.next();\n this._step; //?\n this._log = \"\";\n return this;\n }\n\n private _steps!: IterableIterator;\n private _step!: IteratorResult;\n\n get steps(): Iterator {\n if (this._steps === undefined) {\n this.reset();\n this._steps = assertExists(this._steps, \"Reset did not initialize steps\");\n this._step = assertExists(this._step, \"Reset did not find first step\");\n }\n return this._steps;\n }\n\n get currentStep(): IS | TestInstruction | undefined {\n return this._step?.value;\n }\n\n get done(): boolean {\n return this._step?.done ?? false;\n }\n\n async step() {\n if (!this._step.done) {\n await this._step.value.do(this);\n this._step = this.steps.next();\n return false;\n }\n return true;\n }\n\n async run() {\n this.reset();\n while (!(await this.step()));\n }\n\n protected readonly breakpoints: Map = new Map();\n addBreakpoint(variable: string, value: number) {\n this.breakpoints.set(variable, value);\n }\n clearBreakpoints() {\n this.breakpoints.clear();\n }\n\n output() {\n const values = this._outputList.map((output) => output.print(this));\n this._log += `|${values.join(\"|\")}|\\n`;\n }\n\n header() {\n const values = this._outputList.map((output) => output.header(this));\n this._log += `|${values.join(\"|\")}|\\n`;\n }\n\n log() {\n return this._log;\n }\n\n abstract hasVar(variable: string | number): boolean;\n abstract getVar(variable: string | number, offset?: number): number | string;\n abstract setVar(variable: string, value: number, offset?: number): void;\n}\n\nfunction isTstLineStatment(line: TstStatement): line is TstLineStatement {\n return (line as TstLineStatement).ops !== undefined;\n}\n\nfunction isTstWhileStatement(line: TstStatement): line is TstWhileStatement {\n return (line as TstWhileStatement).condition !== undefined;\n}\n\nexport class ChipTest extends Test {\n private chip: Chip = new Low();\n get chipId(): number {\n return this.chip.id;\n }\n\n private clock = Clock.get();\n\n static from(tst: Tst): ChipTest {\n const test = new ChipTest();\n\n for (const line of tst.lines) {\n if (isTstLineStatment(line)) {\n test.addInstruction(ChipTest.makeLineStatement(line));\n } else {\n const repeat = isTstWhileStatement(line)\n ? new TestWhileInstruction(\n new Condition(\n line.condition.left,\n line.condition.right,\n line.condition.op\n )\n )\n : new TestRepeatInstruction(line.count);\n repeat.span = line.span;\n test.addInstruction(repeat);\n for (const statement of line.statements) {\n repeat.addInstruction(ChipTest.makeLineStatement(statement));\n }\n }\n }\n\n test.reset();\n\n return test;\n }\n\n private static makeLineStatement(line: TstLineStatement) {\n const statement = new TestCompoundInstruction();\n statement.span = line.span;\n for (const op of line.ops) {\n const inst = ChipTest.makeInstruction(op);\n if (inst !== undefined) statement.addInstruction(inst);\n }\n return statement;\n }\n\n private static makeInstruction(inst: TstOperation) {\n const { op } = inst;\n switch (op) {\n case \"tick\":\n return new TestTickInstruction();\n case \"tock\":\n return new TestTockInstruction();\n case \"eval\":\n return new TestEvalInstruction();\n case \"output\":\n return new TestOutputInstruction();\n case \"set\":\n return new TestSetInstruction(inst.id, inst.value, inst.index);\n case \"output-list\":\n return new TestOutputListInstruction(inst.spec);\n case \"echo\":\n return new TestEchoInstruction(inst.message);\n case \"clear-echo\":\n return new TestClearEchoInstruction();\n case \"loadRom\":\n return new TestLoadROMInstruction(inst.file);\n case \"load\":\n case \"output-file\":\n case \"compare-to\":\n return undefined;\n default:\n checkExhaustive(op, `Unknown tst operation ${op}`);\n }\n }\n\n with(chip: Chip): this {\n this.chip = chip;\n return this;\n }\n\n hasVar(variable: string | number): boolean {\n if (variable === \"time\") {\n return true;\n }\n variable = `${variable}`;\n // Look up built-in chip state variables\n return this.chip.hasIn(variable) || this.chip.hasOut(variable);\n }\n\n getVar(variable: string | number, offset?: number): number | string {\n variable = `${variable}`;\n if (variable === \"time\") {\n return this.clock.toString();\n }\n const pin = this.chip.get(variable, offset);\n if (!pin) return 0;\n return pin instanceof Bus ? pin.busVoltage : pin.voltage();\n }\n\n setVar(variable: string, value: number, offset?: number): void {\n // Look up built-in chip state variables\n const pinOrBus = this.chip.get(variable, offset);\n if (pinOrBus instanceof Bus) {\n pinOrBus.busVoltage = value;\n } else {\n pinOrBus?.pull(value === 0 ? LOW : HIGH);\n }\n }\n\n eval(): void {\n this.chip.eval();\n }\n\n tick(): void {\n this.chip.eval();\n this.clock.tick();\n }\n\n tock(): void {\n this.chip.eval();\n this.clock.tock();\n }\n\n override async load(filename: string) {\n await this.chip.load(this.fs, filename);\n }\n\n override async run() {\n this.clock.reset();\n await super.run();\n }\n}\n\nexport class CPUTest extends Test {\n hasVar(_variable: string | number): boolean {\n return false;\n }\n getVar(_variable: string | number): number {\n return 0;\n }\n setVar(_variable: string, _value: number): void {\n return undefined;\n }\n ticktock(): void {\n return undefined;\n }\n}\n\nexport class VMTest extends Test {\n hasVar(_variable: string | number): boolean {\n return false;\n }\n getVar(_variable: string | number): number {\n return 0;\n }\n setVar(_variable: string, _value: number): void {\n return undefined;\n }\n vmstep(): void {\n return undefined;\n }\n}\n\nexport interface TestInstruction {\n span?: Span;\n do(test: Test): void;\n steps(test: Test): IterableIterator;\n}\n\nexport class TestSetInstruction implements TestInstruction {\n constructor(\n private variable: string,\n private value: number,\n private index?: number | undefined\n ) {}\n\n do(test: Test) {\n test.setVar(this.variable, this.value, this.index);\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestOutputInstruction implements TestInstruction {\n do(test: Test) {\n test.output();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestOutputListInstruction implements TestInstruction {\n private outputs: Output[] = [];\n\n constructor(specs: TstOutputSpec[] = []) {\n for (const spec of specs) {\n this.addOutput(spec);\n }\n }\n\n addOutput(inst: TstOutputSpec) {\n this.outputs.push(\n new Output(\n inst.id,\n inst.style,\n inst.width,\n inst.lpad,\n inst.rpad,\n inst.builtin,\n inst.address\n )\n );\n }\n\n do(test: Test) {\n test.outputList(this.outputs);\n test.header();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestCompoundInstruction implements TestInstruction {\n protected readonly instructions: TestInstruction[] = [];\n span?: Span;\n\n addInstruction(instruction: TestInstruction) {\n this.instructions.push(instruction);\n }\n\n do(test: Test): void {\n for (const instruction of this.instructions) {\n instruction.do(test);\n }\n }\n\n *steps(_test: Test): Generator {\n yield this;\n }\n}\n\nexport class TestRepeatInstruction extends TestCompoundInstruction {\n constructor(public readonly repeat: number) {\n super();\n }\n\n override do() {\n return undefined;\n }\n\n private *innerSteps(test: Test) {\n for (const instruction of this.instructions) {\n yield* instruction.steps(test);\n }\n }\n\n override *steps(test: Test) {\n if (this.repeat === -1) {\n yield this;\n while (true) {\n yield* this.innerSteps(test);\n }\n } else {\n for (let i = 0; i < this.repeat; i++) {\n yield this;\n yield* this.innerSteps(test);\n }\n }\n }\n}\n\nexport class Condition {\n constructor(\n public readonly x: string | number,\n public readonly y: string | number,\n public readonly op: \"<\" | \"<=\" | \"=\" | \">=\" | \">\" | \"<>\"\n ) {}\n\n check(test: Test): boolean {\n const x = test.hasVar(this.x) ? test.getVar(this.x) : this.x;\n const y = test.hasVar(this.y) ? test.getVar(this.y) : this.y;\n\n if (typeof x === \"string\" || typeof y === \"string\") {\n switch (this.op) {\n case \"=\":\n return `${x}` === `${y}`;\n case \"<>\":\n return `${x}` !== `${y}`;\n }\n } else {\n switch (this.op) {\n case \"<\":\n return x < y;\n case \"<=\":\n return x <= y;\n case \">\":\n return x > y;\n case \">=\":\n return x >= y;\n case \"=\":\n return x === y;\n case \"<>\":\n return x !== y;\n }\n }\n return false;\n }\n}\n\nexport class TestWhileInstruction extends TestCompoundInstruction {\n constructor(public readonly condition: Condition) {\n super();\n }\n\n override *steps(test: Test) {\n while (this.condition.check(test)) {\n yield this;\n for (const instruction of this.instructions) {\n yield* instruction.steps(test);\n }\n }\n }\n}\n\nexport class TestEchoInstruction implements TestInstruction {\n constructor(public readonly content: string) {}\n do(test: Test) {\n test.echo(this.content);\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestClearEchoInstruction implements TestInstruction {\n do(test: Test) {\n test.clearEcho();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestLoadROMInstruction implements TestInstruction {\n constructor(readonly file: string) {}\n async do(test: Test) {\n test.fs.pushd(\"/samples\");\n await test.load(this.file);\n test.fs.popd();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestBreakpointInstruction implements TestInstruction {\n constructor(readonly variable: string, readonly value: number) {}\n\n do(test: Test) {\n test.addBreakpoint(this.variable, this.value);\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestClearBreakpointsInstruction implements TestInstruction {\n do(test: Test) {\n test.clearBreakpoints();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport interface ChipTestInstruction extends TestInstruction {\n _chipTestInstruction_: true;\n do(test: ChipTest): void | Promise;\n}\n\nexport class TestEvalInstruction implements ChipTestInstruction {\n readonly _chipTestInstruction_ = true;\n do(test: ChipTest) {\n test.eval();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestTickInstruction implements ChipTestInstruction {\n readonly _chipTestInstruction_ = true;\n do(test: ChipTest) {\n test.tick();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport class TestTockInstruction implements ChipTestInstruction {\n readonly _chipTestInstruction_ = true;\n do(test: ChipTest) {\n test.tock();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport interface CPUTestInstruction extends TestInstruction {\n _cpuTestInstruction_: true;\n do(test: CPUTest): void | Promise;\n}\n\nexport class TestTickTockInstruction implements CPUTestInstruction {\n readonly _cpuTestInstruction_ = true;\n do(test: CPUTest) {\n test.ticktock();\n }\n\n *steps() {\n yield this;\n }\n}\n\nexport interface VMTestInstruction extends TestInstruction {\n _vmTestInstruction_: true;\n do(test: VMTest): void | Promise;\n}\n\nexport class TestVMStepInstruction implements VMTestInstruction {\n readonly _vmTestInstruction_ = true;\n do(test: VMTest) {\n test.vmstep();\n }\n\n *steps() {\n yield this;\n }\n}\n","import {\n ASSIGN,\n ASSIGN_ASM,\n ASSIGN_OP,\n COMMANDS,\n COMMANDS_ASM,\n COMMANDS_OP,\n JUMP,\n JUMP_ASM,\n JUMP_OP,\n} from \"../cpu/alu.js\";\n\nexport type CommandOps = keyof typeof COMMANDS.op;\nexport type JumpOps = keyof typeof JUMP.op;\nexport type StoreOps = keyof typeof ASSIGN.op;\n\nexport function asm(op: number): string {\n if (op & 0x8000) {\n return cInstruction(op);\n }\n return aInstruction(op);\n}\n\nfunction cInstruction(op: number): string {\n op = op & 0xffff; // Clear high order bits\n const mop = (op & 0x1000) >> 12;\n const cop: CommandOps = ((op & 0b0000111111000000) >> 6) as CommandOps;\n const sop: StoreOps = ((op & 0b0000000000111000) >> 3) as StoreOps;\n const jop: JumpOps = (op & 0b0000000000000111) as JumpOps;\n\n if (COMMANDS.op[cop] === undefined) {\n // Invalid commend\n return \"#ERR\";\n }\n\n let command = COMMANDS.op[cop];\n if (mop) {\n command = command.replace(/A/g, \"M\") as COMMANDS_ASM;\n }\n\n const store = ASSIGN.op[sop];\n const jump = JUMP.op[jop];\n\n let instruction: string = command;\n if (store) {\n instruction = `${store}=${instruction}`;\n }\n if (jump) {\n instruction = `${instruction};${jump}`;\n }\n\n return instruction;\n}\n\nfunction aInstruction(op: number): string {\n return \"@\" + (op & 0x7fff).toString(10);\n}\n\nexport function op(asm: string): number {\n if (asm[0] === \"@\") {\n return aop(asm);\n } else {\n return cop(asm);\n }\n}\n\nfunction aop(asm: string): number {\n return parseInt(asm.substring(1), 10);\n}\n\nfunction cop(asm: string): number {\n const parts = asm.match(\n /(?:(?[AMD]{1,3})=)?(?[-!01ADM&|]{1,3})(?:;(?JGT|JLT|JGE|JLE|JEQ|JMP))?/\n );\n const { assign, operation, jump } = parts?.groups ?? {};\n const mode = operation.includes(\"M\") || assign.includes(\"M\");\n const aop = ASSIGN.asm[(assign as ASSIGN_ASM) ?? \"\"];\n const jop = JUMP.asm[(jump as JUMP_ASM) ?? \"\"];\n const cop = COMMANDS.asm[(operation as COMMANDS_ASM) ?? \"\"];\n\n return makeC(mode, cop, aop, jop);\n}\n\nexport function makeC(\n isM: boolean,\n op: COMMANDS_OP,\n assign: ASSIGN_OP = 0,\n jmp: JUMP_OP = 0\n): number {\n const C = 0xe000;\n const A = isM ? 0x1000 : 0;\n const O = op << 6;\n const D = (assign ?? 0) << 3;\n const J = jmp ?? 0;\n return C + A + O + D + J;\n}\n","const Hex = [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n];\n\nexport function chars(i: number): string {\n return Hex[i] ?? \"X\";\n}\n\nexport function bits(i: number): string {\n switch (i) {\n case 0x0:\n return \"0000\";\n case 0x1:\n return \"0001\";\n case 0x2:\n return \"0010\";\n case 0x3:\n return \"0011\";\n case 0x4:\n return \"0100\";\n case 0x5:\n return \"0101\";\n case 0x6:\n return \"0110\";\n case 0x7:\n return \"0111\";\n case 0x8:\n return \"1000\";\n case 0x9:\n return \"1001\";\n case 0xa:\n return \"1010\";\n case 0xb:\n return \"1011\";\n case 0xc:\n return \"1100\";\n case 0xd:\n return \"1101\";\n case 0xe:\n return \"1110\";\n case 0xf:\n return \"1111\";\n default:\n return \"erro\";\n }\n}\n\nexport function int(n: string, radix: number): number {\n const i = parseInt(n.replace(/[^\\d+-.xa-fA-F]/g, \"\"), radix);\n return i & 0xffff;\n}\n\nexport function int16(i: string): number {\n return int(i, 16);\n}\n\nexport function int10(i: string): number {\n return int(i, 10);\n}\n\nexport function int2(i: string): number {\n return int(i, 2);\n}\n\nexport function hex(i: number): string {\n const hu = chars((i & 0xf000) >> 12);\n const hl = chars((i & 0x0f00) >> 8);\n const lu = chars((i & 0x00f0) >> 4);\n const ll = chars(i & 0x000f);\n\n return `0x${hu}${hl}${lu}${ll}`;\n}\n\nexport function bin(i: number, precision = 16): string {\n const hu = bits((i & 0xf000) >> 12);\n const hl = bits((i & 0x0f00) >> 8);\n const lu = bits((i & 0x00f0) >> 4);\n const ll = bits(i & 0x000f);\n\n // return `${hu} ${hl} ${lu} ${ll}`;\n return `${hu}${hl}${lu}${ll}`.substring(16 - precision); // Match the book's formatting\n}\n\nexport function dec(i: number): string {\n i = i & 0xffff;\n if (i === 0x8000) {\n return \"-32768\";\n }\n if (i & 0x8000) {\n i = (~i + 1) & 0x7fff;\n return `-${i}`;\n }\n return `${i}`;\n}\n\nexport function uns(i: number): string {\n i = i & 0xffff;\n return `${i}`;\n}\n\nexport function nand16(a: number, b: number): number {\n a = a & 0xffff;\n b = b & 0xffff;\n let c = ~(a & b);\n c = c & 0xffff;\n return c;\n}\n"],"names":["DiffTable","className","out","cmp","zeroState","output","CMP","compare","isErr","_jsxs","children","_jsx","display","Err","cmpData","Ok","outData","failures","table","range","Math","min","length","map","i","cmpI","outI","max","_","j","cell","pass","trim","match","style","fontFamily","marginBottom","row","DiffCell","pinWidth","start","end","undefined","Error","loadChip","name","fs","hasBuiltinChip","getBuiltinChip","readFile","file","maybeParsedHDL","HDL","chip","isOk","build","parts","toString","buildChip","Chip","ins","pin","width","outs","clocked","part","builtin","partChip","wires","lhs","rhs","to","from","wire","ROM32K","path","load","v","at","busVoltage","RAM","Screen","SCREEN","Keyboard","key","this","KEYBOARD","Memory","RAM16K","add","keyboard","screen","ram","in","voltage","address","inn","OFFSET","eval","startsWith","idx","int10","groups","offset","ClockedChip","CPU","emptyState","_state","cpuTick","cpuInput","state","writeM","pull","HIGH","LOW","ALU","cpuTock","addressM","outM","PC","inM","instruction","reset","ConstantBus","A","D","Computer","get","And","a","b","and","n","And16","and16","DMux","sel","dmux","DMux4Way","dmux4way","c","d","DMux8Way","dmux8way","e","f","g","h","mux16","mux16_4","s2","Mux","mux","set","Mux16","Mux4Way16","Mux8Way16","mux16_8","Nand","nand","Nand16","nand16","Not","Not16","or","Or","Or16","or16","Or8way","Xor","xor","Xor16","xor16","add16","Add16","ALUNoStat","x","y","op","alu","flags","ng","Flags","zr","halfAdder","HalfAdder","sum","carry","FullAdder","s","ca","fullAdder","Inc16","DFF","t","REGISTRY","Map","Bit","Register","RAM8","RAM64","RAM512","RAM4K","VRegister","ChipCtor","has","bit","bits","_memory","MemoryChip","pow","_address","_nextData","assert","size","RamBus","index","num","Bus","newWidth","next","push","forEach","reduce","nextVoltage","InSubBus","bus","connect","mask","high","low","mid","OutSubBus","value","TRUE_BUS","FALSE_BUS","parsePinDecl","toPin","w","Number","Symbol","iterator","Pins","minWidth","insert","values","id","internals","Set","internal","pins","clockedPins","Clock","$","subscribe","hasIn","hasOut","getBuiltin","BUILTIN_NAMES","includes","connections","isOutPin","wireOutPin","wireInPin","toLowerCase","emplace","partPin","assertExists","chipPin","findPin","isInternal","ensureWidth","remove","Low","level","tock","tick","unsubscribe","clock","BehaviorSubject","ticks","Subject","subject","frameSubject","COMMANDS","asm","M","ASSIGN","MD","AM","AD","AMD","JUMP","JGT","JEQ","JGE","JLT","JNE","JLE","JMP","Positive","Zero","Negative","o","flag","BITS","decode","x1","x2","am","d1","d2","d3","j1","j2","j3","alu2","ROM","input","tickState","cpu","FORMATS","memory","Int16Array","format","current","int2","int16","isFinite","updates","slice","fn","grammar","ohm","asmGrammar","grammars","asmSemantics","extendSemantics","baseSemantics","isALabelInstruction","inst","label","addAttribute","Root","instructions","child","AInstruction","_at","val","type","CInstruction","assignN","opN","jmpN","assign","sourceString","replace","jmp","isM","jump","store","Label","_o","_c","ASM","semantics","parser","parse","makeParser","passes","fillLabel","nextLabel","symbols","unfilled","line","emit","makeC","filter","endsWith","loadHack","loadAsm","source","unwrap","split","UNKNOWN_PARSE_ERROR","Base","createSemantics","property","root","succeeded","parsed","message","shortMessage","extendOperation","List","list","asIteration","decNumber","digits","wholeDec","binNumber","hexNumber","Name","ident","identifier","__","String","_a","str","_b","cmpGrammar","cmpSemantics","cells","lines","hdlGrammar","hdlSemantics","SubBus","startNode","endNode","WireSide","Wire","left","right","isTerminal","Wires","node","Part","Parts","BuiltinPart","PartList","ClockedList","PinDecl","PinList","body","Clocked","tstGrammar","tstSemantics","extendAttribute","Index","FileName","_open","dec","_close","OutputFormat","lpad","rpad","TstEvalOperation","TstOutputOperation","TstOutputListOperation","formats","spec","TstSetOperation","setOp","TstEchoOperation","TstClearEchoOperation","TstLoadROMOperation","_r","_l","TstFileOperation","Condition","TstWhile","cond","statements","statement","condition","span","startIdx","endIdx","TstRepeat","count","TstStatement","stmt","ops","operation","break","Tst","tst","TST","Output","variable","len","lPad","rPad","fmt","parseInt","test","substring","padCenter","getVar","padLeft","B","bin","X","hex","padRight","space","leftSpace","floor","rightSpace","padStart","padEnd","Test","FileSystem","_content","_filename","outputs","_outputList","_steps","steps","_step","_log","done","do","step","breakpoints","clear","print","join","header","isTstLineStatment","isTstWhileStatement","ChipTest","pinOrBus","filename","addInstruction","makeLineStatement","repeat","TestWhileInstruction","TestRepeatInstruction","TestCompoundInstruction","makeInstruction","TestTickInstruction","TestTockInstruction","TestEvalInstruction","TestOutputInstruction","TestSetInstruction","TestOutputListInstruction","TestEchoInstruction","TestClearEchoInstruction","TestLoadROMInstruction","checkExhaustive","setVar","specs","addOutput","outputList","_test","innerSteps","hasVar","check","content","echo","clearEcho","pushd","popd","mop","cop","sop","jop","command","cInstruction","aInstruction","aop","mode","C","O","J","Hex","chars","int","radix","hu","hl","lu","ll","precision","uns"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/506.f6bf6957.chunk.js b/web/build/static/js/506.f6bf6957.chunk.js new file mode 100644 index 000000000..159a9a52e --- /dev/null +++ b/web/build/static/js/506.f6bf6957.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[506],{9506:function(n,e,r){r.r(e),r.d(e,{Util:function(){return i}});var t=r(1026),a=r(6167),u=r(7693),c=r(326),o=r(7878),i=function(){var n=(0,a.useState)(0),e=(0,t.Z)(n,2),r=e[0],i=e[1],s=(0,a.useState)("@0"),l=(0,t.Z)(s,2),f=l[0],v=l[1],p=(0,a.useCallback)((function(){return(0,c.Ly)(r)}),[r]),b=(0,a.useCallback)((function(){return(0,c.E_)(r)}),[r]),d=(0,a.useCallback)((function(){return(0,c.nN)(r)}),[r]),A=(0,a.useCallback)((function(){return(0,c.$v)(r)}),[r]),g=(0,a.useCallback)((function(n){var e=n.target.value,r=(0,c.C$)(e);i(r),v((0,u.a)(r))}),[i,v]),D=(0,a.useCallback)((function(n){var e=n.target.value,r=(0,c.o5)(e);i(r),v((0,u.a)(r))}),[i,v]),h=(0,a.useCallback)((function(n){var e=n.target.value,r=(0,c.o5)(e);i(r),v((0,u.a)(r))}),[i,v]),k=(0,a.useCallback)((function(n){var e=n.target.value,r=(0,c.Af)(e);i(r),v((0,u.a)(r))}),[i,v]),x=(0,a.useCallback)((function(n){var e=n.target.value;v(e),i((0,u.op)(e))}),[i,v]);return(0,o.jsx)("form",{children:(0,o.jsxs)("div",{className:"grid",children:[(0,o.jsxs)("label",{children:["Binary ",(0,o.jsx)("input",{type:"text",value:p(),onChange:g})]}),(0,o.jsxs)("label",{children:["Decimal ",(0,o.jsx)("input",{type:"text",value:b(),onChange:D})]}),(0,o.jsxs)("label",{children:["Unsigned",(0,o.jsx)("input",{type:"text",value:d(),onChange:h})]}),(0,o.jsxs)("label",{children:["Hex ",(0,o.jsx)("input",{type:"text",value:A(),onChange:k})]}),(0,o.jsxs)("label",{children:["HACK ASM",(0,o.jsx)("input",{type:"text",value:f,onChange:x})]})]})})};e.default=i},9422:function(n,e,r){r.d(e,{Z:function(){return c}});var t=r(3940),a=r(6983),u=r(7591);function c(){c=function(n,e){return new r(n,void 0,e)};var n=RegExp.prototype,e=new WeakMap;function r(n,t,u){var c=new RegExp(n,t);return e.set(c,u||e.get(n)),(0,a.Z)(c,r.prototype)}function o(n,r){var t=e.get(r);return Object.keys(t).reduce((function(e,r){var a=t[r];if("number"==typeof a)e[r]=n[a];else{for(var u=0;void 0===n[a[u]]&&u+1]+)>/g,(function(n,e){var r=u[e];return"$"+(Array.isArray(r)?r.join("$"):r)})))}if("function"==typeof a){var c=this;return n[Symbol.replace].call(this,r,(function(){var n=arguments;return"object"!=(0,t.Z)(n[n.length-1])&&(n=[].slice.call(n)).push(o(n,c)),a.apply(this,n)}))}return n[Symbol.replace].call(this,r,a)},c.apply(this,arguments)}},6693:function(n,e,r){r.d(e,{Bb:function(){return o},PH:function(){return t},Uc:function(){return a},lK:function(){return u},vU:function(){return c}});var t={asm:{0:42,1:63,"-1":58,D:12,A:48,M:48,"!D":13,"!A":49,"-D":15,"-A":51,"D+1":31,"A+1":55,"D-1":14,"A-1":50,"D+A":2,"D-A":19,"D-M":19,"A-D":7,"D&A":0,"D&M":0,"D|A":21,"D|M":21},op:{42:"0",63:"1",58:"-1",12:"D",48:"A",13:"!D",49:"!A",15:"-D",51:"-A",31:"D+1",55:"A+1",14:"D-1",50:"A-1",2:"D+A",19:"D-A",7:"A-D",0:"D&A",21:"D|A"}},a={asm:{"":0,M:1,D:2,MD:3,A:4,AM:5,AD:6,AMD:7},op:{0:"",1:"M",2:"D",3:"MD",4:"A",5:"AM",6:"AD",7:"AMD"}},u={asm:{"":0,JGT:1,JEQ:2,JGE:3,JLT:4,JNE:5,JLE:6,JMP:7},op:{0:"",1:"JGT",2:"JEQ",3:"JGE",4:"JLT",5:"JNE",6:"JLE",7:"JMP"}},c={1:"Positive",0:"Zero",15:"Negative",Positive:1,Zero:0,Negative:15};function o(n,e,r){var t=0;switch(n){case 42:t=0;break;case 63:t=1;break;case 58:t=-1;break;case 12:t=e;break;case 48:t=r;break;case 13:t=~e;break;case 49:t=~r;break;case 15:t=-e;break;case 51:t=-r;break;case 31:t=e+1;break;case 55:t=r+1;break;case 14:t=e-1;break;case 50:t=r-1;break;case 2:t=e+r;break;case 19:t=e-r;break;case 7:t=r-e;break;case 0:t=e&r;break;case 21:t=e|r}return[t&=65535,0===t?c.Zero:32768&t?c.Negative:c.Positive]}},7693:function(n,e,r){r.d(e,{a:function(){return u},op:function(){return c},p:function(){return o}});var t=r(9422),a=r(6693);function u(n){return 32768&n?function(n){n&=65535;var e=(4096&n)>>12,r=(4032&n)>>6,t=(56&n)>>3,u=7&n;if(void 0===a.PH.op[r])return"#ERR";var c=a.PH.op[r];e&&(c=c.replace(/A/g,"M"));var o=a.Uc.op[t],i=a.lK.op[u],s=c;o&&(s="".concat(o,"=").concat(s));i&&(s="".concat(s,";").concat(i));return s}(n):function(n){return"@"+(32767&n).toString(10)}(n)}function c(n){return"@"===n[0]?function(n){return parseInt(n.substring(1),10)}(n):function(n){var e,r=n.match((0,t.Z)(/(?:([AMD]{1,3})=)?([-!01ADM&|]{1,3})(?:;(JGT|JLT|JGE|JLE|JEQ|JMP))?/,{assign:1,operation:2,jump:3})),u=null!==(e=null===r||void 0===r?void 0:r.groups)&&void 0!==e?e:{},c=u.assign,i=u.operation,s=u.jump,l=i.includes("M")||c.includes("M"),f=a.Uc.asm[null!==c&&void 0!==c?c:""],v=a.lK.asm[null!==s&&void 0!==s?s:""],p=a.PH.asm[null!==i&&void 0!==i?i:""];return o(l,p,f,v)}(n)}function o(n,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=57344,u=n?4096:0,c=e<<6,o=(null!==r&&void 0!==r?r:0)<<3,i=null!==t&&void 0!==t?t:0;return a+u+c+o+i}},326:function(n,e,r){r.d(e,{$v:function(){return l},Af:function(){return o},C$:function(){return s},C2:function(){return b},E_:function(){return v},Ly:function(){return f},nN:function(){return p},o5:function(){return i}});var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];function a(n){var e;return null!==(e=t[n])&&void 0!==e?e:"X"}function u(n){switch(n){case 0:return"0000";case 1:return"0001";case 2:return"0010";case 3:return"0011";case 4:return"0100";case 5:return"0101";case 6:return"0110";case 7:return"0111";case 8:return"1000";case 9:return"1001";case 10:return"1010";case 11:return"1011";case 12:return"1100";case 13:return"1101";case 14:return"1110";case 15:return"1111";default:return"erro"}}function c(n,e){return 65535&parseInt(n.replace(/[^\d+-.xa-fA-F]/g,""),e)}function o(n){return c(n,16)}function i(n){return c(n,10)}function s(n){return c(n,2)}function l(n){var e=a((61440&n)>>12),r=a((3840&n)>>8),t=a((240&n)>>4),u=a(15&n);return"0x".concat(e).concat(r).concat(t).concat(u)}function f(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,r=u((61440&n)>>12),t=u((3840&n)>>8),a=u((240&n)>>4),c=u(15&n);return"".concat(r).concat(t).concat(a).concat(c).substring(16-e)}function v(n){return 32768===(n&=65535)?"-32768":32768&n?"-".concat(n=1+~n&32767):"".concat(n)}function p(n){return"".concat(n&=65535)}function b(n,e){var r=~((n&=65535)&(e&=65535));return r&=65535}}}]); +//# sourceMappingURL=506.f6bf6957.chunk.js.map \ No newline at end of file diff --git a/web/build/static/js/506.f6bf6957.chunk.js.map b/web/build/static/js/506.f6bf6957.chunk.js.map new file mode 100644 index 000000000..e58a387a1 --- /dev/null +++ b/web/build/static/js/506.f6bf6957.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/506.f6bf6957.chunk.js","mappings":"wNAYaA,EAAO,WAClB,OAA0BC,EAAAA,EAAAA,UAAS,GAAE,eAA9BC,EAAK,KAAEC,EAAQ,KACtB,GAAgCF,EAAAA,EAAAA,UAAS,MAAK,eAAvCG,EAAQ,KAAEC,EAAW,KAEtBC,GAAWC,EAAAA,EAAAA,cAAY,kBAAMC,EAAAA,EAAAA,IAAIN,EAAM,GAAE,CAACA,IAC1CO,GAAWF,EAAAA,EAAAA,cAAY,kBAAMG,EAAAA,EAAAA,IAAIR,EAAM,GAAE,CAACA,IAC1CS,GAAWJ,EAAAA,EAAAA,cAAY,kBAAMK,EAAAA,EAAAA,IAAIV,EAAM,GAAE,CAACA,IAC1CW,GAAWN,EAAAA,EAAAA,cAAY,kBAAMO,EAAAA,EAAAA,IAAIZ,EAAM,GAAE,CAACA,IAG1Ca,GAASR,EAAAA,EAAAA,cACb,YAA2D,IAA9CL,EAAK,EAAfc,OAAUd,MACLe,GAASC,EAAAA,EAAAA,IAAKhB,GACpBC,EAASc,GACTZ,GAAYc,EAAAA,EAAAA,GAAIF,GAClB,GACA,CAACd,EAAUE,IAEPe,GAASb,EAAAA,EAAAA,cACb,YAA2D,IAA9CL,EAAK,EAAfc,OAAUd,MACLe,GAASI,EAAAA,EAAAA,IAAMnB,GACrBC,EAASc,GACTZ,GAAYc,EAAAA,EAAAA,GAAIF,GAClB,GACA,CAACd,EAAUE,IAEPiB,GAASf,EAAAA,EAAAA,cACb,YAA2D,IAA9CL,EAAK,EAAfc,OAAUd,MACLe,GAASI,EAAAA,EAAAA,IAAMnB,GACrBC,EAASc,GACTZ,GAAYc,EAAAA,EAAAA,GAAIF,GAClB,GACA,CAACd,EAAUE,IAEPkB,GAAShB,EAAAA,EAAAA,cACb,YAA2D,IAA9CL,EAAK,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AAUqF,EAAOxC,EAAWyC,GAGhC,IAAIC,KAFJ1C,GAAQ,QACRyC,GAAQ,QAGR,OADAC,GAAQ,KAEV,C","sources":["pages/util.tsx","../../node_modules/@babel/runtime/helpers/esm/wrapRegExp.js","../../simulator/src/cpu/alu.ts","../../simulator/src/util/asm.ts","../../simulator/src/util/twos.ts"],"sourcesContent":["import { ChangeEvent, useCallback, useState } from \"react\";\nimport { asm, op } from \"@nand2tetris/simulator/util/asm.js\";\nimport {\n bin,\n dec,\n hex,\n int10,\n int16,\n int2,\n uns,\n} from \"@nand2tetris/simulator/util/twos.js\";\n\nexport const Util = () => {\n const [value, setValue] = useState(0);\n const [asmValue, setAsmValue] = useState(\"@0\");\n\n const binValue = useCallback(() => bin(value), [value]);\n const decValue = useCallback(() => dec(value), [value]);\n const unsValue = useCallback(() => uns(value), [value]);\n const hexValue = useCallback(() => hex(value), [value]);\n // const asmValue = useCallback(() => asm(value), [value]);\n\n const setBin = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n const ivalue = int2(value);\n setValue(ivalue);\n setAsmValue(asm(ivalue));\n },\n [setValue, setAsmValue]\n );\n const setInt = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n const ivalue = int10(value);\n setValue(ivalue);\n setAsmValue(asm(ivalue));\n },\n [setValue, setAsmValue]\n );\n const setUns = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n const ivalue = int10(value);\n setValue(ivalue);\n setAsmValue(asm(ivalue));\n },\n [setValue, setAsmValue]\n );\n const setHex = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n const ivalue = int16(value);\n setValue(ivalue);\n setAsmValue(asm(ivalue));\n },\n [setValue, setAsmValue]\n );\n const setAsm = useCallback(\n ({ target: { value } }: ChangeEvent) => {\n setAsmValue(value);\n setValue(op(value));\n },\n [setValue, setAsmValue]\n );\n\n return (\n
\n
\n \n \n \n \n \n
\n
\n );\n};\n\nexport default Util;\n","import _typeof from \"./typeof.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport inherits from \"./inherits.js\";\nexport default function _wrapRegExp() {\n _wrapRegExp = function _wrapRegExp(re, groups) {\n return new BabelRegExp(re, void 0, groups);\n };\n var _super = RegExp.prototype,\n _groups = new WeakMap();\n function BabelRegExp(re, flags, groups) {\n var _this = new RegExp(re, flags);\n return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype);\n }\n function buildGroups(result, re) {\n var g = _groups.get(re);\n return Object.keys(g).reduce(function (groups, name) {\n var i = g[name];\n if (\"number\" == typeof i) groups[name] = result[i];else {\n for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;\n groups[name] = result[i[k]];\n }\n return groups;\n }, Object.create(null));\n }\n return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {\n var result = _super.exec.call(this, str);\n if (result) {\n result.groups = buildGroups(result, this);\n var indices = result.indices;\n indices && (indices.groups = buildGroups(indices, this));\n }\n return result;\n }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {\n if (\"string\" == typeof substitution) {\n var groups = _groups.get(this);\n return _super[Symbol.replace].call(this, str, substitution.replace(/\\$<([^>]+)>/g, function (_, name) {\n var group = groups[name];\n return \"$\" + (Array.isArray(group) ? group.join(\"$\") : group);\n }));\n }\n if (\"function\" == typeof substitution) {\n var _this = this;\n return _super[Symbol.replace].call(this, str, function () {\n var args = arguments;\n return \"object\" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);\n });\n }\n return _super[Symbol.replace].call(this, str, substitution);\n }, _wrapRegExp.apply(this, arguments);\n}","export type COMMANDS_ASM =\n | \"0\"\n | \"1\"\n | \"-1\"\n | \"D\"\n | \"A\"\n | \"M\"\n | \"!D\"\n | \"!A\"\n | \"-D\"\n | \"-A\"\n | \"D+1\"\n | \"A+1\"\n | \"D-1\"\n | \"A-1\"\n | \"D+A\"\n | \"D-A\"\n | \"D-M\"\n | \"A-D\"\n | \"D&A\"\n | \"D&M\"\n | \"D|A\"\n | \"D|M\";\n\nexport type COMMANDS_OP =\n | 0b101010\n | 0b111111\n | 0b111010\n | 0b001100\n | 0b110000\n | 0b110000\n | 0b001101\n | 0b110001\n | 0b001111\n | 0b110011\n | 0b011111\n | 0b110111\n | 0b001110\n | 0b110010\n | 0b000010\n | 0b010011\n | 0b010011\n | 0b000111\n | 0b000000\n | 0b000000\n | 0b010101\n | 0b010101;\n\nexport const COMMANDS: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"0\": 0b101010, // 42 0x2A\n \"1\": 0b111111, // 63 0x3F\n \"-1\": 0b111010, // 58 0x3A\n D: 0b001100, // 12 0x0C\n A: 0b110000, // 48 0x30\n M: 0b110000, // 48 0x30\n \"!D\": 0b001101, // 13 0x0D\n \"!A\": 0b110001, // 49 0x31\n \"-D\": 0b001111, // 15 0x0F\n \"-A\": 0b110011, // 51 0x33\n \"D+1\": 0b011111, // 31 0x1F\n \"A+1\": 0b110111, // 55 0x37\n \"D-1\": 0b001110, // 14 0x0E\n \"A-1\": 0b110010, // 50 0x32\n \"D+A\": 0b000010, // 2 0x02\n \"D-A\": 0b010011, // 19 0x13\n \"D-M\": 0b010011, // 19 0x13\n \"A-D\": 0b000111, // 7 0x07\n \"D&A\": 0b000000, // 0 0x00\n \"D&M\": 0b000000, // 0 0x00\n \"D|A\": 0b010101, // 21 0x15\n \"D|M\": 0b010101, // 21 0x15\n },\n op: {\n 0x2a: \"0\",\n 0x3f: \"1\",\n 0x3a: \"-1\",\n 0x0c: \"D\",\n 0x30: \"A\",\n 0x0d: \"!D\",\n 0x31: \"!A\",\n 0x0f: \"-D\",\n 0x33: \"-A\",\n 0x1f: \"D+1\",\n 0x37: \"A+1\",\n 0x0e: \"D-1\",\n 0x32: \"A-1\",\n 0x02: \"D+A\",\n 0x13: \"D-A\",\n 0x07: \"A-D\",\n 0x00: \"D&A\",\n 0x15: \"D|A\",\n },\n};\n\nexport type ASSIGN_ASM = \"\" | \"M\" | \"D\" | \"MD\" | \"A\" | \"AM\" | \"AD\" | \"AMD\";\nexport type ASSIGN_OP = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;\n\nexport const ASSIGN: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"\": 0x0,\n M: 0b001,\n D: 0b010,\n MD: 0b011,\n A: 0b100,\n AM: 0b101,\n AD: 0b110,\n AMD: 0b111,\n },\n op: {\n 0x0: \"\",\n 0x1: \"M\",\n 0x2: \"D\",\n 0x3: \"MD\",\n 0x4: \"A\",\n 0x5: \"AM\",\n 0x6: \"AD\",\n 0x7: \"AMD\",\n },\n};\n\nexport type JUMP_ASM =\n | \"\"\n | \"JGT\"\n | \"JEQ\"\n | \"JGE\"\n | \"JLT\"\n | \"JNE\"\n | \"JLE\"\n | \"JMP\";\nexport type JUMP_OP = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;\nexport const JUMP: {\n asm: Record;\n op: Record;\n} = {\n asm: {\n \"\": 0b0,\n JGT: 0b001,\n JEQ: 0b010,\n JGE: 0b011,\n JLT: 0b100,\n JNE: 0b101,\n JLE: 0b110,\n JMP: 0b111,\n },\n op: {\n 0x0: \"\",\n 0x1: \"JGT\",\n 0x2: \"JEQ\",\n 0x3: \"JGE\",\n 0x4: \"JLT\",\n 0x5: \"JNE\",\n 0x6: \"JLE\",\n 0x7: \"JMP\",\n },\n};\n\nexport const Flags = {\n 0x01: \"Positive\",\n 0x00: \"Zero\",\n 0x0f: \"Negative\",\n Positive: 0x01,\n Zero: 0x00,\n Negative: 0x0f,\n};\n\nexport function alu(op: number, d: number, a: number): [number, number] {\n let o = 0;\n switch (op) {\n case 0x2a:\n o = 0;\n break;\n case 0x3f:\n o = 1;\n break;\n case 0x3a:\n o = -1;\n break;\n case 0x0c:\n o = d;\n break;\n case 0x30:\n o = a;\n break;\n case 0x0d:\n o = ~d;\n break;\n case 0x31:\n o = ~a;\n break;\n case 0x0f:\n o = -d;\n break;\n case 0x33:\n o = -a;\n break;\n case 0x1f:\n o = d + 1;\n break;\n case 0x37:\n o = a + 1;\n break;\n case 0x0e:\n o = d - 1;\n break;\n case 0x32:\n o = a - 1;\n break;\n case 0x02:\n o = d + a;\n break;\n case 0x13:\n o = d - a;\n break;\n case 0x07:\n o = a - d;\n break;\n case 0x00:\n o = d & a;\n break;\n case 0x15:\n o = d | a;\n break;\n }\n\n o = o & 0xffff;\n const flags =\n o === 0 ? Flags.Zero : o & 0x8000 ? Flags.Negative : Flags.Positive;\n return [o, flags];\n}\n\nexport function alua(op: number, d: number, a: number): [number, number] {\n if (op & 0b100000) d = 0;\n if (op & 0b010000) d = ~d & 0xffff;\n if (op & 0b001000) a = 0;\n if (op & 0b000100) a = ~a & 0xffff;\n\n let o = (op & 0b000010 ? d + a : d & a) & 0xffff;\n if (op & 0b000001) o = ~o & 0xffff;\n\n const flags =\n o === 0 ? Flags.Zero : o & 0x8000 ? Flags.Negative : Flags.Positive;\n return [o, flags];\n}\n","import {\n ASSIGN,\n ASSIGN_ASM,\n ASSIGN_OP,\n COMMANDS,\n COMMANDS_ASM,\n COMMANDS_OP,\n JUMP,\n JUMP_ASM,\n JUMP_OP,\n} from \"../cpu/alu.js\";\n\nexport type CommandOps = keyof typeof COMMANDS.op;\nexport type JumpOps = keyof typeof JUMP.op;\nexport type StoreOps = keyof typeof ASSIGN.op;\n\nexport function asm(op: number): string {\n if (op & 0x8000) {\n return cInstruction(op);\n }\n return aInstruction(op);\n}\n\nfunction cInstruction(op: number): string {\n op = op & 0xffff; // Clear high order bits\n const mop = (op & 0x1000) >> 12;\n const cop: CommandOps = ((op & 0b0000111111000000) >> 6) as CommandOps;\n const sop: StoreOps = ((op & 0b0000000000111000) >> 3) as StoreOps;\n const jop: JumpOps = (op & 0b0000000000000111) as JumpOps;\n\n if (COMMANDS.op[cop] === undefined) {\n // Invalid commend\n return \"#ERR\";\n }\n\n let command = COMMANDS.op[cop];\n if (mop) {\n command = command.replace(/A/g, \"M\") as COMMANDS_ASM;\n }\n\n const store = ASSIGN.op[sop];\n const jump = JUMP.op[jop];\n\n let instruction: string = command;\n if (store) {\n instruction = `${store}=${instruction}`;\n }\n if (jump) {\n instruction = `${instruction};${jump}`;\n }\n\n return instruction;\n}\n\nfunction aInstruction(op: number): string {\n return \"@\" + (op & 0x7fff).toString(10);\n}\n\nexport function op(asm: string): number {\n if (asm[0] === \"@\") {\n return aop(asm);\n } else {\n return cop(asm);\n }\n}\n\nfunction aop(asm: string): number {\n return parseInt(asm.substring(1), 10);\n}\n\nfunction cop(asm: string): number {\n const parts = asm.match(\n /(?:(?[AMD]{1,3})=)?(?[-!01ADM&|]{1,3})(?:;(?JGT|JLT|JGE|JLE|JEQ|JMP))?/\n );\n const { assign, operation, jump } = parts?.groups ?? {};\n const mode = operation.includes(\"M\") || assign.includes(\"M\");\n const aop = ASSIGN.asm[(assign as ASSIGN_ASM) ?? \"\"];\n const jop = JUMP.asm[(jump as JUMP_ASM) ?? \"\"];\n const cop = COMMANDS.asm[(operation as COMMANDS_ASM) ?? \"\"];\n\n return makeC(mode, cop, aop, jop);\n}\n\nexport function makeC(\n isM: boolean,\n op: COMMANDS_OP,\n assign: ASSIGN_OP = 0,\n jmp: JUMP_OP = 0\n): number {\n const C = 0xe000;\n const A = isM ? 0x1000 : 0;\n const O = op << 6;\n const D = (assign ?? 0) << 3;\n const J = jmp ?? 0;\n return C + A + O + D + J;\n}\n","const Hex = [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n];\n\nexport function chars(i: number): string {\n return Hex[i] ?? \"X\";\n}\n\nexport function bits(i: number): string {\n switch (i) {\n case 0x0:\n return \"0000\";\n case 0x1:\n return \"0001\";\n case 0x2:\n return \"0010\";\n case 0x3:\n return \"0011\";\n case 0x4:\n return \"0100\";\n case 0x5:\n return \"0101\";\n case 0x6:\n return \"0110\";\n case 0x7:\n return \"0111\";\n case 0x8:\n return \"1000\";\n case 0x9:\n return \"1001\";\n case 0xa:\n return \"1010\";\n case 0xb:\n return \"1011\";\n case 0xc:\n return \"1100\";\n case 0xd:\n return \"1101\";\n case 0xe:\n return \"1110\";\n case 0xf:\n return \"1111\";\n default:\n return \"erro\";\n }\n}\n\nexport function int(n: string, radix: number): number {\n const i = parseInt(n.replace(/[^\\d+-.xa-fA-F]/g, \"\"), radix);\n return i & 0xffff;\n}\n\nexport function int16(i: string): number {\n return int(i, 16);\n}\n\nexport function int10(i: string): number {\n return int(i, 10);\n}\n\nexport function int2(i: string): number {\n return int(i, 2);\n}\n\nexport function hex(i: number): string {\n const hu = chars((i & 0xf000) >> 12);\n const hl = chars((i & 0x0f00) >> 8);\n const lu = chars((i & 0x00f0) >> 4);\n const ll = chars(i & 0x000f);\n\n return `0x${hu}${hl}${lu}${ll}`;\n}\n\nexport function bin(i: number, precision = 16): string {\n const hu = bits((i & 0xf000) >> 12);\n const hl = bits((i & 0x0f00) >> 8);\n const lu = bits((i & 0x00f0) >> 4);\n const ll = bits(i & 0x000f);\n\n // return `${hu} ${hl} ${lu} ${ll}`;\n return `${hu}${hl}${lu}${ll}`.substring(16 - precision); // Match the book's formatting\n}\n\nexport function dec(i: number): string {\n i = i & 0xffff;\n if (i === 0x8000) {\n return \"-32768\";\n }\n if (i & 0x8000) {\n i = (~i + 1) & 0x7fff;\n return `-${i}`;\n }\n return `${i}`;\n}\n\nexport function uns(i: number): string {\n i = i & 0xffff;\n return `${i}`;\n}\n\nexport function nand16(a: number, b: number): number {\n a = a & 0xffff;\n b = b & 0xffff;\n let c = ~(a & b);\n c = c & 0xffff;\n return c;\n}\n"],"names":["Util","useState","value","setValue","asmValue","setAsmValue","binValue","useCallback","bin","decValue","dec","unsValue","uns","hexValue","hex","setBin","target","ivalue","int2","asm","setInt","int10","setUns","setHex","int16","setAsm","op","className","type","onChange","_wrapRegExp","re","groups","BabelRegExp","_super","RegExp","prototype","_groups","WeakMap","flags","_this","set","get","buildGroups","result","g","Object","keys","reduce","name","i","k","length","create","exec","str","call","this","indices","Symbol","replace","substitution","_","group","Array","isArray","join","args","arguments","slice","push","apply","COMMANDS","D","A","M","ASSIGN","MD","AM","AD","AMD","JUMP","JGT","JEQ","JGE","JLT","JNE","JLE","JMP","Flags","Positive","Zero","Negative","alu","d","a","o","mop","cop","sop","jop","undefined","command","store","jump","instruction","cInstruction","toString","aInstruction","parseInt","substring","aop","parts","match","assign","operation","mode","includes","makeC","isM","jmp","C","O","J","Hex","chars","bits","int","n","radix","hu","hl","lu","ll","precision","nand16","b","c"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/512.9c0d1032.chunk.js b/web/build/static/js/512.9c0d1032.chunk.js new file mode 100644 index 000000000..10dd3757e --- /dev/null +++ b/web/build/static/js/512.9c0d1032.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[512],{512:function(e,t,n){n.r(t),n.d(t,{getCLS:function(){return y},getFCP:function(){return g},getFID:function(){return C},getLCP:function(){return P},getTTFB:function(){return D}});var i,r,a,o,u=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if("first-input"===e&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},f=function(e,t){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},s=function(e){addEventListener("pageshow",(function(t){t.persisted&&e(t)}),!0)},m=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},v=-1,d=function(){return"hidden"===document.visibilityState?0:1/0},p=function(){f((function(e){var t=e.timeStamp;v=t}),!0)},l=function(){return v<0&&(v=d(),p(),s((function(){setTimeout((function(){v=d(),p()}),0)}))),{get firstHiddenTime(){return v}}},g=function(e,t){var n,i=l(),r=u("FCP"),a=function(e){"first-contentful-paint"===e.name&&(f&&f.disconnect(),e.startTime-1&&e(t)},r=u("CLS",0),a=0,o=[],v=function(e){if(!e.hadRecentInput){var t=o[0],i=o[o.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(a+=e.value,o.push(e)):(a=e.value,o=[e]),a>r.value&&(r.value=a,r.entries=o,n())}},d=c("layout-shift",v);d&&(n=m(i,r,t),f((function(){d.takeRecords().map(v),n(!0)})),s((function(){a=0,T=-1,r=u("CLS",0),n=m(i,r,t)})))},E={passive:!0,capture:!0},w=new Date,L=function(e,t){i||(i=t,r=e,a=new Date,F(removeEventListener),S())},S=function(){if(r>=0&&r1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){L(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,E),removeEventListener("pointercancel",i,E)};addEventListener("pointerup",n,E),addEventListener("pointercancel",i,E)}(t,e):L(t,e)}},F=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,b,E)}))},C=function(e,t){var n,a=l(),v=u("FID"),d=function(e){e.startTimeperformance.now())return;n.entries=[t],e(n)}catch(e){}},"complete"===document.readyState?setTimeout(t,0):addEventListener("load",(function(){return setTimeout(t,0)}))}}}]); +//# sourceMappingURL=512.9c0d1032.chunk.js.map \ No newline at end of file diff --git a/web/build/static/js/512.9c0d1032.chunk.js.map b/web/build/static/js/512.9c0d1032.chunk.js.map new file mode 100644 index 000000000..d201c4d49 --- /dev/null +++ b/web/build/static/js/512.9c0d1032.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/512.9c0d1032.chunk.js","mappings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,WAAWvC,WAAWtC,EAAE,GAAG6B,iBAAiB,QAAQ,WAAW,OAAOS,WAAWtC,EAAE,EAAE,GAAG,C","sources":["../../node_modules/web-vitals/dist/web-vitals.js"],"sourcesContent":["var e,t,n,i,r=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:\"v2-\".concat(Date.now(),\"-\").concat(Math.floor(8999999999999*Math.random())+1e12)}},a=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if(\"first-input\"===e&&!(\"PerformanceEventTiming\"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},o=function(e,t){var n=function n(i){\"pagehide\"!==i.type&&\"hidden\"!==document.visibilityState||(e(i),t&&(removeEventListener(\"visibilitychange\",n,!0),removeEventListener(\"pagehide\",n,!0)))};addEventListener(\"visibilitychange\",n,!0),addEventListener(\"pagehide\",n,!0)},u=function(e){addEventListener(\"pageshow\",(function(t){t.persisted&&e(t)}),!0)},c=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},f=-1,s=function(){return\"hidden\"===document.visibilityState?0:1/0},m=function(){o((function(e){var t=e.timeStamp;f=t}),!0)},v=function(){return f<0&&(f=s(),m(),u((function(){setTimeout((function(){f=s(),m()}),0)}))),{get firstHiddenTime(){return f}}},d=function(e,t){var n,i=v(),o=r(\"FCP\"),f=function(e){\"first-contentful-paint\"===e.name&&(m&&m.disconnect(),e.startTime-1&&e(t)},f=r(\"CLS\",0),s=0,m=[],v=function(e){if(!e.hadRecentInput){var t=m[0],i=m[m.length-1];s&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(s+=e.value,m.push(e)):(s=e.value,m=[e]),s>f.value&&(f.value=s,f.entries=m,n())}},h=a(\"layout-shift\",v);h&&(n=c(i,f,t),o((function(){h.takeRecords().map(v),n(!0)})),u((function(){s=0,l=-1,f=r(\"CLS\",0),n=c(i,f,t)})))},T={passive:!0,capture:!0},y=new Date,g=function(i,r){e||(e=r,t=i,n=new Date,w(removeEventListener),E())},E=function(){if(t>=0&&t1e12?new Date:performance.now())-e.timeStamp;\"pointerdown\"==e.type?function(e,t){var n=function(){g(e,t),r()},i=function(){r()},r=function(){removeEventListener(\"pointerup\",n,T),removeEventListener(\"pointercancel\",i,T)};addEventListener(\"pointerup\",n,T),addEventListener(\"pointercancel\",i,T)}(t,e):g(t,e)}},w=function(e){[\"mousedown\",\"keydown\",\"touchstart\",\"pointerdown\"].forEach((function(t){return e(t,S,T)}))},L=function(n,f){var s,m=v(),d=r(\"FID\"),p=function(e){e.startTimeperformance.now())return;n.entries=[t],e(n)}catch(e){}},\"complete\"===document.readyState?setTimeout(t,0):addEventListener(\"load\",(function(){return setTimeout(t,0)}))};export{h as getCLS,d as getFCP,L as getFID,F as getLCP,P as getTTFB};\n"],"names":["e","t","n","i","r","name","value","delta","entries","id","concat","Date","now","Math","floor","random","a","PerformanceObserver","supportedEntryTypes","includes","self","getEntries","map","observe","type","buffered","o","document","visibilityState","removeEventListener","addEventListener","u","persisted","c","f","s","m","timeStamp","v","setTimeout","firstHiddenTime","d","disconnect","startTime","push","window","performance","getEntriesByName","requestAnimationFrame","p","l","h","hadRecentInput","length","takeRecords","T","passive","capture","y","g","w","E","entryType","target","cancelable","processingStart","forEach","S","L","b","F","once","P","getEntriesByType","timing","max","navigationStart","responseStart","readyState"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/568.4e6a571b.chunk.js b/web/build/static/js/568.4e6a571b.chunk.js new file mode 100644 index 000000000..51e182fe4 --- /dev/null +++ b/web/build/static/js/568.4e6a571b.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[568],{1568:function(e,t,n){n.r(t),n.d(t,{default:function(){return o}});var i=n(6776),s=n(768),p=n(3102),a=n(7878),l=function(e){return e=e.replace("%25PUBLIC_URL%25","/web-ide"),(0,i.A)(e)},h=function(e){var t=e.children;return(0,a.jsx)(s.D,{remarkPlugins:[p.Z],transformImageUri:l,children:t})},o=function(){return(0,a.jsx)("div",{className:"container",style:{maxWidth:"900px",margin:"0 auto",overflow:"none"},children:(0,a.jsx)(h,{children:'# NAND2Tetris Web User Guide\n\nThis web application implements the [NAND2Tetris](https://nand2tetris.org) software suite, including an hdl chip simulator, a hack CPU, and a Hack VM.\nStudents are able to paste their implementations of the various chips and programs\n\n## Chip Simulator\n\n![Empty Chip](%PUBLIC_URL%/user_guide/01_chip_empty.png){:height="256px" width="512px"}\n\nThe chip page has five panels, as well as a project selction bar.\nIn the top left, users can input the text of their HDL chip.\nThe top center panel displays the chip\'s input pins, and the bottom center the output pins.\nThe bottom left panel has any internal pins in the chip.\nThe right panel includes the test program, the expected comparison output, and after executing the test, the test output and a diff of failed lines.\n\n---\n\n![Simple Not Chip](%PUBLIC_URL%/user_guide/02_chip_simple_nand.png)\n\nThe project selection bar loads the chip HDL outlines, tests, and cmp files from the book.\nAfter choosing the "Not" chip, the input and output pins update.\nAfter implementing the chip and clicking "Compile", clicking the input pin buttons will toggle their voltage states.\nThe output pins will update with the simulated state from the hdl spec.\n\n---\n\n![Complex Chip](%PUBLIC_URL%/user_guide/03_chip_complex.png)\n\nLoading a chip with a 16-bit bus changes the pin panels to show a binary representation of the chip.\n\n---\n\n![Implemented Complex Chip](%PUBLIC_URL%/user_guide/04_chip_complex_implemented.png)\n\nClicking an input bus will increment that bus by one.\n\n---\n\n![Complex Chip Pins](%PUBLIC_URL%/user_guide/05_chip_complex_failed_test.png)\n\nClicking "Execute" will run the test against the chip implementation.\nAny failing tests will be put in the bottom of the panel, with a diff between the expected and actual output.\nYou may need to scroll to see all failed lines.\n\n---\n\n![Passed Chip Test](%PUBLIC_URL%/user_guide/06_chip_complex_passed_test.png)\n\nAll tests pass!\n\n---\n\n![Settings](%PUBLIC_URL%/user_guide/07_settings.png)\n\nClicking `Save` in the HDL panel will store the HDL chip to user\'s local storage.\nIn settings, clicking `Files: Reset` will restore the files to the book\' projects.\n'})})}}}]); +//# sourceMappingURL=568.4e6a571b.chunk.js.map \ No newline at end of file diff --git a/web/build/static/js/568.4e6a571b.chunk.js.map b/web/build/static/js/568.4e6a571b.chunk.js.map new file mode 100644 index 000000000..d25f558b6 --- /dev/null +++ b/web/build/static/js/568.4e6a571b.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/568.4e6a571b.chunk.js","mappings":"iNAGMA,EAAe,SAACC,GAEpB,OADAA,EAAOA,EAAKC,QAAQ,mBAAoBC,aACjCC,EAAAA,EAAAA,GAAeH,EACxB,EAQA,EANiB,SAAH,OAAMI,EAAQ,EAARA,SAAQ,OAC1B,SAAC,IAAa,CAACC,cAAe,CAACC,EAAAA,GAAYC,kBAAmBR,EAAa,SACxEK,GACa,ECClB,EATkB,WAAH,OACb,gBACEI,UAAU,YACVC,MAAO,CAAEC,SAAU,QAASC,OAAQ,SAAUC,SAAU,QAAS,UAEjE,SAAC,EAAQ,ssEACL,C","sources":["shell/markdown.tsx","pages/user_guide.tsx"],"sourcesContent":["import ReactMarkdown, { uriTransformer } from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\n\nconst publicImages = (href: string) => {\n href = href.replace(\"%25PUBLIC_URL%25\", process.env.PUBLIC_URL);\n return uriTransformer(href);\n};\n\nconst Markdown = ({ children }: { children: string }) => (\n \n {children}\n \n);\n\nexport default Markdown;\n","import raw from \"raw.macro\";\nimport Markdown from \"../shell/markdown\";\n\nconst UserGuide = () => (\n \n {raw(\"./USER_GUIDE.md\")}\n \n);\n\nexport default UserGuide;\n"],"names":["publicImages","href","replace","process","uriTransformer","children","remarkPlugins","remarkGfm","transformImageUri","className","style","maxWidth","margin","overflow"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/600.6e4176cb.chunk.js b/web/build/static/js/600.6e4176cb.chunk.js new file mode 100644 index 000000000..02afe1707 --- /dev/null +++ b/web/build/static/js/600.6e4176cb.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[600],{5640:function(u,t,e){e.d(t,{Z:function(){return be}});var r=e(1026),n=e(649),i=e(7591),o=e(4337),a=e(2951),s=e(1976),c={exports:{}};function l(u,t,e){if(!function(u){return"description"===u||"string"===u||"code"===u}(e))throw new Error("invalid Failure type: "+e);this.pexpr=u,this.text=t,this.type=e,this.fluffy=!1}l.prototype.getPExpr=function(){return this.pexpr},l.prototype.getText=function(){return this.text},l.prototype.getType=function(){return this.type},l.prototype.isDescription=function(){return"description"===this.type},l.prototype.isStringTerminal=function(){return"string"===this.type},l.prototype.isCode=function(){return"code"===this.type},l.prototype.isFluffy=function(){return this.fluffy},l.prototype.makeFluffy=function(){this.fluffy=!0},l.prototype.clearFluffy=function(){this.fluffy=!1},l.prototype.subsumes=function(u){return this.getText()===u.getText()&&this.type===u.type&&(!this.isFluffy()||this.isFluffy()&&u.isFluffy())},l.prototype.toString=function(){return"string"===this.type?JSON.stringify(this.getText()):this.getText()},l.prototype.clone=function(){var u=new l(this.pexpr,this.text,this.type);return this.isFluffy()&&u.makeFluffy(),u},l.prototype.toKey=function(){return this.toString()+"#"+this.type};var p=l,D={};!function(u){for(var t={},e=0;e<128;e++)t[e]=String.fromCharCode(e);t["'".charCodeAt(0)]="\\'",t['"'.charCodeAt(0)]='\\"',t["\\".charCodeAt(0)]="\\\\",t["\b".charCodeAt(0)]="\\b",t["\f".charCodeAt(0)]="\\f",t["\n".charCodeAt(0)]="\\n",t["\r".charCodeAt(0)]="\\r",t["\t".charCodeAt(0)]="\\t",t["\v".charCodeAt(0)]="\\v",u.abstract=function(u){var t=u||"";return function(){throw new Error("this method "+t+" is abstract! (it has no implementation in class "+this.constructor.name+")")}},u.assert=function(u,t){if(!u)throw new Error(t||"Assertion failed")},u.defineLazyProperty=function(u,t,e){var r;Object.defineProperty(u,t,{get:function(){return r||(r=e.call(this)),r}})},u.clone=function(u){return u?Object.assign({},u):u},u.repeatFn=function(u,t){for(var e=[];t-- >0;)e.push(u());return e},u.repeatStr=function(u,t){return new Array(t+1).join(u)},u.repeat=function(t,e){return u.repeatFn((function(){return t}),e)},u.getDuplicates=function(u){for(var t=[],e=0;e0}},{key:"hasNoChildren",value:function(){return!this.hasChildren()}},{key:"onlyChild",value:function(){if(1!==this.numChildren())throw new Error("cannot get only child of a node of type "+this.ctorName+" (it has "+this.numChildren()+" children)");return this.firstChild()}},{key:"firstChild",value:function(){if(this.hasNoChildren())throw new Error("cannot get first child of a "+this.ctorName+" node, which has no children");return this.childAt(0)}},{key:"lastChild",value:function(){if(this.hasNoChildren())throw new Error("cannot get last child of a "+this.ctorName+" node, which has no children");return this.childAt(this.numChildren()-1)}},{key:"childBefore",value:function(u){var t=this.indexOfChild(u);if(t<0)throw new Error("Node.childBefore() called w/ an argument that is not a child");if(0===t)throw new Error("cannot get child before first child");return this.childAt(t-1)}},{key:"childAfter",value:function(u){var t=this.indexOfChild(u);if(t<0)throw new Error("Node.childAfter() called w/ an argument that is not a child");if(t===this.numChildren()-1)throw new Error("cannot get child after last child");return this.childAt(t+1)}},{key:"isTerminal",value:function(){return!1}},{key:"isNonterminal",value:function(){return!1}},{key:"isIteration",value:function(){return!1}},{key:"isOptional",value:function(){return!1}}]),u}(),f=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(){return(0,a.Z)(this,e),t.apply(this,arguments)}return(0,s.Z)(e,[{key:"ctorName",get:function(){return"_terminal"}},{key:"isTerminal",value:function(){return!0}},{key:"primitiveValue",get:function(){throw new Error("The `primitiveValue` property was removed in Ohm v17.")}}]),e}(A),m={Node:A,TerminalNode:f,NonterminalNode:function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r,n,i){var o;return(0,a.Z)(this,e),(o=t.call(this,i)).ruleName=u,o.children=r,o.childOffsets=n,o}return(0,s.Z)(e,[{key:"ctorName",get:function(){return this.ruleName}},{key:"isNonterminal",value:function(){return!0}},{key:"isLexical",value:function(){return h.isLexical(this.ctorName)}},{key:"isSyntactic",value:function(){return h.isSyntactic(this.ctorName)}}]),e}(A),IterationNode:function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r,n,i){var o;return(0,a.Z)(this,e),(o=t.call(this,n)).children=u,o.childOffsets=r,o.optional=i,o}return(0,s.Z)(e,[{key:"ctorName",get:function(){return"_iter"}},{key:"isIteration",value:function(){return!0}},{key:"isOptional",value:function(){return this.optional}}]),e}(A)},E={},C={Lu:/[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A]|\uD801[\uDC00-\uDC27\uDCB0-\uDCD3]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21]/,Ll:/[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]|\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD83A[\uDD22-\uDD43]/,Lt:/[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/,Lm:/[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C\uA69D\uA717-\uA71F\uA770\uA788\uA7F8\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E\uFF9F]|\uD81A[\uDF40-\uDF43]|\uD81B[\uDF93-\uDF9F\uDFE0]/,Lo:/[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC50-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,Nl:/[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]|\uD800[\uDD40-\uDD74\uDF41\uDF4A\uDFD1-\uDFD5]|\uD809[\uDC00-\uDC6E]/,Nd:/[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD801[\uDCA0-\uDCA9]|\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDEF0-\uDEF9]|[\uD805\uD807][\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF39]|\uD806[\uDCE0-\uDCE9]|\uD81A[\uDE60-\uDE69\uDF50-\uDF59]|\uD835[\uDFCE-\uDFFF]|\uD83A[\uDD50-\uDD59]/,Mn:/[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D01\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA8C4\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0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D0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]/,Mc:/[\u0903-\u0903]|[\u093E-\u0940]|[\u0949-\u094C]|[\u0982-\u0983]|[\u09BE-\u09C0]|[\u09C7-\u09C8]|[\u09CB-\u09CC]|[\u09D7-\u09D7]|[\u0A3E-\u0A40]|[\u0A83-\u0A83]|[\u0ABE-\u0AC0]|[\u0AC9-\u0AC9]|[\u0ACB-\u0ACC]|[\u0B02-\u0B03]|[\u0B3E-\u0B3E]|[\u0B40-\u0B40]|[\u0B47-\u0B48]|[\u0B4B-\u0B4C]|[\u0B57-\u0B57]|[\u0B83-\u0B83]|[\u0BBE-\u0BBF]|[\u0BC1-\u0BC2]|[\u0BC6-\u0BC8]|[\u0BCA-\u0BCC]|[\u0BD7-\u0BD7]|[\u0C01-\u0C03]|[\u0C41-\u0C44]|[\u0C82-\u0C83]|[\u0CBE-\u0CBE]|[\u0CC0-\u0CC4]|[\u0CC7-\u0CC8]|[\u0CCA-\u0CCB]|[\u0CD5-\u0CD6]|[\u0D02-\u0D03]|[\u0D3E-\u0D40]|[\u0D46-\u0D48]|[\u0D4A-\u0D4C]|[\u0D57-\u0D57]|[\u0F3E-\u0F3F]|[\u0F7F-\u0F7F]/,Pc:/[_\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F]/,Zs:/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,L:/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE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D76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,Ltmo:/[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]|[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C\uA69D\uA717-\uA71F\uA770\uA788\uA7F8\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E\uFF9F]|\uD81A[\uDF40-\uDF43]|\uD81B[\uDF93-\uDF9F\uDFE0]|[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC50-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/},F=D,d=function(){function u(){if((0,a.Z)(this,u),this.constructor===u)throw new Error("PExpr cannot be instantiated -- it's abstract")}return(0,s.Z)(u,[{key:"withSource",value:function(u){return u&&(this.source=u.trimmed()),this}}]),u}(),v=Object.create(d.prototype),y=Object.create(d.prototype),g=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).obj=u,r}return(0,s.Z)(e)}(d),B=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r){var n;return(0,a.Z)(this,e),(n=t.call(this)).from=u,n.to=r,n.matchCodePoint=u.length>1||r.length>1,n}return(0,s.Z)(e)}(d),I=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).index=u,r}return(0,s.Z)(e)}(d),x=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).terms=u,r}return(0,s.Z)(e)}(d),b=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r,n){var i;(0,a.Z)(this,e);var o=u.rules[r].body;return(i=t.call(this,[n,o])).superGrammar=u,i.name=r,i.body=n,i}return(0,s.Z)(e)}(x),S=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u,r,i,o){var s;(0,a.Z)(this,e);var c=u.rules[r].body;return(s=t.call(this,[].concat((0,n.Z)(i),[c],(0,n.Z)(o)))).superGrammar=u,s.ruleName=r,s.expansionPos=i.length,s}return(0,s.Z)(e)}(x),w=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).factors=u,r}return(0,s.Z)(e)}(d),_=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).expr=u,r}return(0,s.Z)(e)}(d),O=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(){return(0,a.Z)(this,e),t.apply(this,arguments)}return(0,s.Z)(e)}(_),N=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(){return(0,a.Z)(this,e),t.apply(this,arguments)}return(0,s.Z)(e)}(_),R=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(){return(0,a.Z)(this,e),t.apply(this,arguments)}return(0,s.Z)(e)}(_);O.prototype.operator="*",N.prototype.operator="+",R.prototype.operator="?",O.prototype.minNumMatches=0,N.prototype.minNumMatches=1,R.prototype.minNumMatches=0,O.prototype.maxNumMatches=Number.POSITIVE_INFINITY,N.prototype.maxNumMatches=Number.POSITIVE_INFINITY,R.prototype.maxNumMatches=1;var L=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).expr=u,r}return(0,s.Z)(e)}(d),P=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).expr=u,r}return(0,s.Z)(e)}(d),k=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).expr=u,r}return(0,s.Z)(e)}(d),T=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(0,a.Z)(this,e),(r=t.call(this)).ruleName=u,r.args=n,r}return(0,s.Z)(e,[{key:"isSyntactic",value:function(){return F.isSyntactic(this.ruleName)}},{key:"toMemoKey",value:function(){return this._memoKey||Object.defineProperty(this,"_memoKey",{value:this.toString()}),this._memoKey}}]),e}(d),j=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).category=u,r.pattern=C[u],r}return(0,s.Z)(e)}(d);E.PExpr=d,E.any=v,E.end=y,E.Terminal=g,E.Range=B,E.Param=I,E.Alt=x,E.Extend=b,E.Splice=S,E.Seq=w,E.Iter=_,E.Star=O,E.Plus=N,E.Opt=R,E.Not=L,E.Lookahead=P,E.Lex=k,E.Apply=T,E.UnicodeChar=j;var Z=D,q=E;function M(){}q.PExpr.prototype.allowsSkippingPrecedingSpace=Z.abstract("allowsSkippingPrecedingSpace"),q.any.allowsSkippingPrecedingSpace=q.end.allowsSkippingPrecedingSpace=q.Apply.prototype.allowsSkippingPrecedingSpace=q.Terminal.prototype.allowsSkippingPrecedingSpace=q.Range.prototype.allowsSkippingPrecedingSpace=q.UnicodeChar.prototype.allowsSkippingPrecedingSpace=function(){return!0},q.Alt.prototype.allowsSkippingPrecedingSpace=q.Iter.prototype.allowsSkippingPrecedingSpace=q.Lex.prototype.allowsSkippingPrecedingSpace=q.Lookahead.prototype.allowsSkippingPrecedingSpace=q.Not.prototype.allowsSkippingPrecedingSpace=q.Param.prototype.allowsSkippingPrecedingSpace=q.Seq.prototype.allowsSkippingPrecedingSpace=function(){return!1},M.prototype=Object.create(null),M.asNamespace=function(u){return u instanceof M?u:M.createNamespace(u)},M.createNamespace=function(u){return M.extend(M.prototype,u)},M.extend=function(u,t){if(u!==M.prototype&&!(u instanceof M))throw new TypeError("not a Namespace object: "+u);var e=Object.create(u,{constructor:{value:M,enumerable:!1,writable:!0,configurable:!0}});return Object.assign(e,t)},M.toString=function(u){return Object.prototype.toString.call(u)};var G=M,U=D.assert,z=G,H=E;function K(u,t){var e;return t?((e=new Error(t.getLineAndColumnMessage()+u)).shortMessage=u,e.interval=t):e=new Error(u),e}var V={applicationOfSyntacticRuleFromLexicalContext:function(u,t){return K("Cannot apply syntactic rule "+u+" from here (inside a lexical context)",t.source)},applySyntacticWithLexicalRuleApplication:function(u){var t=u.ruleName;return K("applySyntactic is for syntactic rules, but '".concat(t,"' is a lexical rule. ")+"NOTE: A _syntactic rule_ is a rule whose name begins with a capital letter. See https://ohmjs.org/d/svl for more details.",u.source)},cannotExtendUndeclaredRule:function(u,t,e){return K("Cannot extend rule "+u+" because it is not declared in "+t,e)},cannotOverrideUndeclaredRule:function(u,t,e){return K("Cannot override rule "+u+" because it is not declared in "+t,e)},duplicateGrammarDeclaration:function(u,t){return K("Grammar "+u.name+" is already declared in this namespace")},duplicateParameterNames:function(u,t,e){return K("Duplicate parameter names in rule "+u+": "+t.join(", "),e)},duplicatePropertyNames:function(u){return K("Object pattern has duplicate property names: "+u.join(", "))},duplicateRuleDeclaration:function(u,t,e,r){var n="Duplicate declaration for rule '"+u+"' in grammar '"+t+"'";return t!==e&&(n+=" (originally declared in '"+e+"')"),K(n,r)},inconsistentArity:function(u,t,e,r){return K("Rule "+u+" involves an alternation which has inconsistent arity (expected "+t+", got "+e+")",r.source)},incorrectArgumentType:function(u,t){return K("Incorrect argument type: expected "+u,t.source)},intervalSourcesDontMatch:function(){return K("Interval sources don't match")},invalidCodePoint:function(u){var t,e=u._node;U(e&&e.isNonterminal()&&"escapeChar_unicodeCodePoint"===e.ctorName);var r=u.children.slice(1,-1).map((function(u){return u.source})),i=(t=r[0]).coverageWith.apply(t,(0,n.Z)(r.slice(1)));return K("U+".concat(i.contents," is not a valid Unicode code point"),i)},invalidConstructorCall:function(u,t,e){return K("Attempt to invoke constructor "+t+" with invalid or unexpected arguments")},invalidParameter:function(u,t){return K("Invalid parameter to rule "+u+": "+t+" has arity "+t.getArity()+", but parameter expressions must have arity 1",t.source)},grammarSyntaxError:function(u){var t=new Error;return Object.defineProperty(t,"message",{enumerable:!0,get:function(){return u.message}}),Object.defineProperty(t,"shortMessage",{enumerable:!0,get:function(){return"Expected "+u.getExpectedText()}}),t.interval=u.getInterval(),t},kleeneExprHasNullableOperand:function(u,t){var e=t.length>0?t[t.length-1].args:[],r="Nullable expression "+u.expr.substituteParams(e)+" is not allowed inside '"+u.operator+"' (possible infinite loop)";return t.length>0&&(r+="\nApplication stack (most recent application last):\n"+t.map((function(u){return new H.Apply(u.ruleName,u.args)})).join("\n")),K(r,u.expr.source)},missingSemanticAction:function(u,t,e,r){var n=r.slice(0,-1).map((function(u){var t=" "+u[0].name+" > "+u[1];return 3===u.length?t+" for '"+u[2]+"'":t})).join("\n");n+="\n "+t+" > "+u;var i="";"_iter"===u&&(i=["\nNOTE: as of Ohm v16, there is no default action for iteration nodes \u2014 see "," https://ohmjs.org/d/dsa for details."].join("\n"));var o=K(["Missing semantic action for '".concat(u,"' in ").concat(e," '").concat(t,"'.").concat(i),"Action stack (most recent call last):",n].join("\n"));return o.name="missingSemanticAction",o},multipleSuperSplices:function(u){return K("'...' can appear at most once in a rule body",u.source)},undeclaredGrammar:function(u,t,e){return K(t?"Grammar "+u+" is not declared in namespace "+z.toString(t):"Undeclared grammar "+u,e)},undeclaredRule:function(u,t,e){return K("Rule "+u+" is not declared in grammar "+t,e)},unnecessaryExperimentalApplySyntactic:function(u){return K("applySyntactic is not required here (in a syntactic context)",u.source)},wrongNumberOfArguments:function(u,t,e,r){return K("Wrong number of arguments for rule "+u+" (expected "+t+", got "+e+")",r)},wrongNumberOfParameters:function(u,t,e,r){return K("Wrong number of parameters for rule "+u+" (expected "+t+", got "+e+")",r)},throwErrors:function(u){if(1===u.length)throw u[0];if(u.length>1)throw function(u){var t=u.map((function(u){return u.message}));return K(["Errors:"].concat(t).join("\n- "),u[0].interval)}(u)}},W={};!function(u){var t=D;function e(u){var e=0;return u.map((function(u){var t=u.toString();return e=Math.max(e,t.length),t})).map((function(u){return t.padLeft(u,e)}))}function r(u,t,e){var r=u.length;return(u.slice(0,e)+t+u.slice(e+t.length)).substr(0,r)}function n(){var u=this,n=u.offset,i=t.repeatStr,o=new t.StringBuffer;o.append("Line "+u.lineNum+", col "+u.colNum+":\n");var a=e([null==u.prevLine?0:u.lineNum-1,u.lineNum,null==u.nextLine?0:u.lineNum+1]),s=function(u,t,e){o.append(e+a[u]+" | "+t+"\n")};null!=u.prevLine&&s(0,u.prevLine," "),s(1,u.line,"> ");for(var c=u.line.length,l=i(" ",c+1),p=arguments.length,D=new Array(p),h=0;h=0&&f<=m,"range start must be >= 0 and <= end");var E=n-u.colNum+1;f=Math.max(0,f-E),l=r(l,i("~",(m=Math.min(m-E,c))-f),f)}var C=2+a[1].length+3;return o.append(i(" ",C)),l=r(l,"^",u.colNum-1),o.append(l.replace(/ +$/,"")+"\n"),null!=u.nextLine&&s(2,u.nextLine," "),o.contents()}var i=[];u.awaitBuiltInRules=function(u){i.push(u)},u.announceBuiltInRules=function(u){i.forEach((function(t){t(u)})),i=null},u.getLineAndColumn=function(u,t){for(var e=1,r=1,i=0,o=0,a=null,s=null,c=-1;i=0&&(s=u.slice(c,o).replace(/\r?\n$/,"")),{offset:t,lineNum:e,colNum:r,line:u.slice(o,p).replace(/\r$/,""),prevLine:s,nextLine:a,toString:n}},u.getLineAndColumnMessage=function(t,e){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]&&arguments[2],n=t.rules[this.ruleName],i=X(u)&&0===J;if(!n)throw Y.undeclaredRule(this.ruleName,t.name,this.source);if(!r&&X(this.ruleName)&&!i)throw Y.applicationOfSyntacticRuleFromLexicalContext(this.ruleName,this);var o=this.args.length,a=n.formals.length;if(o!==a)throw Y.wrongNumberOfArguments(this.ruleName,a,o,this.source);var s=$&&n===$.rules.applySyntactic,c=$&&n===$.rules.caseInsensitive;if(c&&!(this.args[0]instanceof uu.Terminal))throw Y.incorrectArgumentType('a Terminal (e.g. "abc")',this.args[0]);if(s){var l=this.args[0];if(!(l instanceof uu.Apply))throw Y.incorrectArgumentType("a syntactic rule application",l);if(!X(l.ruleName))throw Y.applySyntacticWithLexicalRuleApplication(l);if(i)throw Y.unnecessaryExperimentalApplySyntactic(this)}this.args.forEach((function(r){if(r._assertAllApplicationsAreValid(u,t,s),1!==r.getArity())throw Y.invalidParameter(e.ruleName,r)}))};var tu=D,eu=V,ru=E;ru.PExpr.prototype.assertChoicesHaveUniformArity=tu.abstract("assertChoicesHaveUniformArity"),ru.any.assertChoicesHaveUniformArity=ru.end.assertChoicesHaveUniformArity=ru.Terminal.prototype.assertChoicesHaveUniformArity=ru.Range.prototype.assertChoicesHaveUniformArity=ru.Param.prototype.assertChoicesHaveUniformArity=ru.Lex.prototype.assertChoicesHaveUniformArity=ru.UnicodeChar.prototype.assertChoicesHaveUniformArity=function(u){},ru.Alt.prototype.assertChoicesHaveUniformArity=function(u){if(0!==this.terms.length)for(var t=this.terms[0].getArity(),e=0;e1?r-1:0),i=1;i=u.startIdx&&this.endIdx<=u.endIdx,"other interval does not cover this one"),new lu(this.sourceString,this.startIdx-u.startIdx,this.endIdx-u.startIdx)},trimmed:function(){var u=this.contents,t=this.startIdx+u.match(/^\s*/)[0].length,e=this.endIdx-u.match(/\s*$/)[0].length;return new lu(this.sourceString,t,e)},subInterval:function(u,t){var e=this.startIdx+u;return new lu(this.sourceString,e,e+t)}},Object.defineProperties(lu.prototype,{contents:{get:function(){return void 0===this._contents&&(this._contents=this.sourceString.slice(this.startIdx,this.endIdx)),this._contents},enumerable:!0},length:{get:function(){return this.endIdx-this.startIdx},enumerable:!0}});var pu=lu,Du=pu,hu=D,Au={succeeded:1,isRootNode:2,isImplicitSpaces:4,isMemoized:8,isHeadOfLeftRecursion:16,terminatesLR:32};function fu(u){return"string"===typeof u?u.replace(/ /g,"\u22c5").replace(/\t/g,"\u2409").replace(/\n/g,"\u240a").replace(/\r/g,"\u240d"):String(u)}function mu(u,t,e,r,n,i,o){this.input=u,this.pos=this.pos1=t,this.pos2=e,this.source=new Du(u,t,e),this.expr=r,this.bindings=i,this.children=o||[],this.terminatingLREntry=null,this._flags=n?Au.succeeded:0}mu.prototype.SKIP={},Object.defineProperty(mu.prototype,"displayString",{get:function(){return this.expr.toDisplayString()}}),Object.keys(Au).forEach((function(u){var t=Au[u];Object.defineProperty(mu.prototype,u,{get:function(){return 0!==(this._flags&t)},set:function(u){u?this._flags|=t:this._flags&=~t}})})),mu.prototype.clone=function(){return this.cloneWithExpr(this.expr)},mu.prototype.cloneWithExpr=function(u){var t=new mu(this.input,this.pos,this.pos2,u,this.succeeded,this.bindings,this.children);return t.isHeadOfLeftRecursion=this.isHeadOfLeftRecursion,t.isImplicitSpaces=this.isImplicitSpaces,t.isMemoized=this.isMemoized,t.isRootNode=this.isRootNode,t.terminatesLR=this.terminatesLR,t.terminatingLREntry=this.terminatingLREntry,t},mu.prototype.recordLRTermination=function(u,t){this.terminatingLREntry=new mu(this.input,this.pos,this.pos2,this.expr,!1,[t],[u]),this.terminatingLREntry.terminatesLR=!0},mu.prototype.walk=function(u,t){var e=u;function r(u,n,i){var o=!0;e.enter&&e.enter.call(t,u,n,i)===mu.prototype.SKIP&&(o=!1),o&&(u.children.forEach((function(t){r(t,u,i+1)})),e.exit&&e.exit.call(t,u,n,i))}"function"===typeof e&&(e={enter:e}),this.isRootNode?this.children.forEach((function(u){r(u,null,0)})):r(this,null,0)},mu.prototype.toString=function(){var u=this,t=new hu.StringBuffer;return this.walk((function(e,r,n){if(!e)return u.SKIP;if("Alt"!==e.expr.constructor.name){var i;if(t.append(function(u,t,e){var r=fu(u.slice(t,t+e));return r.length0){var h=n[r-1],A=i[r-1];D=A[A.length-1]+h[h.length-1].matchLength-(p=i[0][0])}var f=this instanceof vu.Opt;for(o=0;o=0){if(this.args.length>0)throw new Error("Parameterized rules cannot be passed as arguments to another rule.");return new Ou.Param(t).withSource(this.source)}return this.args.forEach((function(t,e,r){r[e]=t.introduceParams(u)})),this};var Nu=D,Ru=E;Ru.PExpr.prototype.isNullable=function(u){return this._isNullable(u,Object.create(null))},Ru.PExpr.prototype._isNullable=Nu.abstract("_isNullable"),Ru.any._isNullable=Ru.Range.prototype._isNullable=Ru.Param.prototype._isNullable=Ru.Plus.prototype._isNullable=Ru.UnicodeChar.prototype._isNullable=function(u,t){return!1},Ru.end._isNullable=function(u,t){return!0},Ru.Terminal.prototype._isNullable=function(u,t){return"string"===typeof this.obj&&""===this.obj},Ru.Alt.prototype._isNullable=function(u,t){return 0===this.terms.length||this.terms.some((function(e){return e._isNullable(u,t)}))},Ru.Seq.prototype._isNullable=function(u,t){return this.factors.every((function(e){return e._isNullable(u,t)}))},Ru.Star.prototype._isNullable=Ru.Opt.prototype._isNullable=Ru.Not.prototype._isNullable=Ru.Lookahead.prototype._isNullable=function(u,t){return!0},Ru.Lex.prototype._isNullable=function(u,t){return this.expr._isNullable(u,t)},Ru.Apply.prototype._isNullable=function(u,t){var e=this.toMemoKey();if(!Object.prototype.hasOwnProperty.call(t,e)){var r=u.rules[this.ruleName].body.substituteParams(this.args);t[e]=!1,t[e]=r._isNullable(u,t)}return t[e]};var Lu=D,Pu=E;Pu.PExpr.prototype.substituteParams=Lu.abstract("substituteParams"),Pu.any.substituteParams=Pu.end.substituteParams=Pu.Terminal.prototype.substituteParams=Pu.Range.prototype.substituteParams=Pu.UnicodeChar.prototype.substituteParams=function(u){return this},Pu.Param.prototype.substituteParams=function(u){return u[this.index]},Pu.Alt.prototype.substituteParams=function(u){return new Pu.Alt(this.terms.map((function(t){return t.substituteParams(u)})))},Pu.Seq.prototype.substituteParams=function(u){return new Pu.Seq(this.factors.map((function(t){return t.substituteParams(u)})))},Pu.Iter.prototype.substituteParams=Pu.Not.prototype.substituteParams=Pu.Lookahead.prototype.substituteParams=Pu.Lex.prototype.substituteParams=function(u){return new this.constructor(this.expr.substituteParams(u))},Pu.Apply.prototype.substituteParams=function(u){if(0===this.args.length)return this;var t=this.args.map((function(t){return t.substituteParams(u)}));return new Pu.Apply(this.ruleName,t)};var ku=D,Tu=E,ju=ku.copyWithoutDuplicates;function Zu(u){return/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(u)}function qu(u){var t=Object.create(null);u.forEach((function(u){t[u]=(t[u]||0)+1})),Object.keys(t).forEach((function(e){if(!(t[e]<=1)){var r=1;u.forEach((function(t,n){t===e&&(u[n]=t+"_"+r++)}))}}))}Tu.PExpr.prototype.toArgumentNameList=ku.abstract("toArgumentNameList"),Tu.any.toArgumentNameList=function(u,t){return["any"]},Tu.end.toArgumentNameList=function(u,t){return["end"]},Tu.Terminal.prototype.toArgumentNameList=function(u,t){return"string"===typeof this.obj&&/^[_a-zA-Z0-9]+$/.test(this.obj)?["_"+this.obj]:["$"+u]},Tu.Range.prototype.toArgumentNameList=function(u,t){var e=this.from+"_to_"+this.to;return Zu(e)||(e="_"+e),Zu(e)||(e="$"+u),[e]},Tu.Alt.prototype.toArgumentNameList=function(u,t){for(var e=this.terms.map((function(t){return t.toArgumentNameList(u,!0)})),r=[],n=e[0].length,i=0;i0){var u=this.args.map((function(u){return u.toDisplayString()}));return this.ruleName+"<"+u.join(",")+">"}return this.ruleName},Gu.UnicodeChar.prototype.toDisplayString=function(){return"Unicode ["+this.category+"] character"};var Uu=p,zu=D,Hu=E;Hu.PExpr.prototype.toFailure=zu.abstract("toFailure"),Hu.any.toFailure=function(u){return new Uu(this,"any object","description")},Hu.end.toFailure=function(u){return new Uu(this,"end of input","description")},Hu.Terminal.prototype.toFailure=function(u){return new Uu(this,this.obj,"string")},Hu.Range.prototype.toFailure=function(u){return new Uu(this,JSON.stringify(this.from)+".."+JSON.stringify(this.to),"code")},Hu.Not.prototype.toFailure=function(u){var t=this.expr===Hu.any?"nothing":"not "+this.expr.toFailure(u);return new Uu(this,t,"description")},Hu.Lookahead.prototype.toFailure=function(u){return this.expr.toFailure(u)},Hu.Apply.prototype.toFailure=function(u){var t=u.rules[this.ruleName].description;t||(t=(/^[aeiouAEIOU]/.test(this.ruleName)?"an":"a")+" "+this.ruleName);return new Uu(this,t,"description")},Hu.UnicodeChar.prototype.toFailure=function(u){return new Uu(this,"a Unicode ["+this.category+"] character","description")},Hu.Alt.prototype.toFailure=function(u){var t="("+this.terms.map((function(t){return t.toFailure(u)})).join(" or ")+")";return new Uu(this,t,"description")},Hu.Seq.prototype.toFailure=function(u){var t="("+this.factors.map((function(t){return t.toFailure(u)})).join(" ")+")";return new Uu(this,t,"description")},Hu.Iter.prototype.toFailure=function(u){var t="("+this.expr.toFailure(u)+this.operator+")";return new Uu(this,t,"description")};var Ku=D,Vu=E;Vu.PExpr.prototype.toString=Ku.abstract("toString"),Vu.any.toString=function(){return"any"},Vu.end.toString=function(){return"end"},Vu.Terminal.prototype.toString=function(){return JSON.stringify(this.obj)},Vu.Range.prototype.toString=function(){return JSON.stringify(this.from)+".."+JSON.stringify(this.to)},Vu.Param.prototype.toString=function(){return"$"+this.index},Vu.Lex.prototype.toString=function(){return"#("+this.expr.toString()+")"},Vu.Alt.prototype.toString=function(){return 1===this.terms.length?this.terms[0].toString():"("+this.terms.map((function(u){return u.toString()})).join(" | ")+")"},Vu.Seq.prototype.toString=function(){return 1===this.factors.length?this.factors[0].toString():"("+this.factors.map((function(u){return u.toString()})).join(" ")+")"},Vu.Iter.prototype.toString=function(){return this.expr+this.operator},Vu.Not.prototype.toString=function(){return"~"+this.expr},Vu.Lookahead.prototype.toString=function(){return"&"+this.expr},Vu.Apply.prototype.toString=function(){if(this.args.length>0){var u=this.args.map((function(u){return u.toString()}));return this.ruleName+"<"+u.join(",")+">"}return this.ruleName},Vu.UnicodeChar.prototype.toString=function(){return"\\p{"+this.category+"}"};var Wu=E,$u=p,Ju=m.TerminalNode,Qu=D.assert,Xu=Wu.PExpr,Yu=Wu.Terminal,ut=function(u){(0,i.Z)(e,u);var t=(0,o.Z)(e);function e(u){var r;return(0,a.Z)(this,e),(r=t.call(this)).obj=u,r}return(0,s.Z)(e,[{key:"_getString",value:function(u){var t=u.currentApplication().args[this.obj.index];return Qu(t instanceof Yu,"expected a Terminal expression"),t.obj}},{key:"allowsSkippingPrecedingSpace",value:function(){return!0}},{key:"eval",value:function(u){var t=u.inputStream,e=t.pos,r=this._getString(u);return t.matchString(r,!0)?(u.pushBinding(new Ju(r.length),e),!0):(u.processFailure(e,this),!1)}},{key:"getArity",value:function(){return 1}},{key:"substituteParams",value:function(u){return new e(this.obj.substituteParams(u))}},{key:"toDisplayString",value:function(){return this.obj.toDisplayString()+" (case-insensitive)"}},{key:"toFailure",value:function(u){return new $u(this,this.obj.toFailure(u)+" (case-insensitive)","description")}},{key:"_isNullable",value:function(u,t){return this.obj._isNullable(u,t)}}]),e}(Xu),tt=ut,et=pu;function rt(u){this.source=u,this.pos=0,this.examinedLength=0}rt.prototype={atEnd:function(){var u=this.pos===this.source.length;return this.examinedLength=Math.max(this.examinedLength,this.pos+1),u},next:function(){var u=this.source[this.pos++];return this.examinedLength=Math.max(this.examinedLength,this.pos),u},nextCharCode:function(){var u=this.next();return u&&u.charCodeAt(0)},nextCodePoint:function(){var u=this.source.slice(this.pos++).codePointAt(0);return u>65535&&(this.pos+=1),this.examinedLength=Math.max(this.examinedLength,this.pos),u},matchString:function(u,t){var e;if(t){for(e=0;e0&&(e===t.length-1?u.append(t.length>2?", or ":" or "):u.append(", ")),u.append(t[e].toString());return u.contents()},st.prototype.getInterval=function(){var u=this.getRightmostFailurePosition();return new at(this.input,u,u)};var ct=st;function lt(){this.applicationMemoKeyStack=[],this.memo={},this.maxExaminedLength=0,this.maxRightmostFailureOffset=-1,this.currentLeftRecursion=void 0}lt.prototype={isActive:function(u){return this.applicationMemoKeyStack.indexOf(u.toMemoKey())>=0},enter:function(u){this.applicationMemoKeyStack.push(u.toMemoKey())},exit:function(){this.applicationMemoKeyStack.pop()},startLeftRecursion:function(u,t){t.isLeftRecursion=!0,t.headApplication=u,t.nextLeftRecursion=this.currentLeftRecursion,this.currentLeftRecursion=t;var e=this.applicationMemoKeyStack,r=e.indexOf(u.toMemoKey())+1,n=e.slice(r);t.isInvolved=function(u){return n.indexOf(u)>=0},t.updateInvolvedApplicationMemoKeys=function(){for(var u=r;ut?delete r[n]:(e.maxExaminedLength=Math.max(e.maxExaminedLength,i.examinedLength),e.maxRightmostFailureOffset=Math.max(e.maxRightmostFailureOffset,i.rightmostFailureOffset))}))}}};var pt,Dt=nt,ht=ct,At=lt,ft=Eu,mt=Wu;W.awaitBuiltInRules((function(u){pt=u.rules.applySyntactic.body}));var Et=new mt.Apply("spaces");function Ct(u,t,e){this.matcher=u,this.startExpr=t,this.grammar=u.grammar,this.input=u.input,this.inputStream=new Dt(u.input),this.memoTable=u.memoTable,this._bindings=[],this._bindingOffsets=[],this._applicationStack=[],this._posStack=[0],this.inLexifiedContextStack=[!1],this.rightmostFailurePosition=-1,this._rightmostFailurePositionStack=[],this._recordedFailuresStack=[],void 0!==e&&(this.positionToRecordFailures=e,this.recordedFailures=Object.create(null))}Ct.prototype={posToOffset:function(u){return u-this._posStack[this._posStack.length-1]},enterApplication:function(u,t){this._posStack.push(this.inputStream.pos),this._applicationStack.push(t),this.inLexifiedContextStack.push(!1),u.enter(t),this._rightmostFailurePositionStack.push(this.rightmostFailurePosition),this.rightmostFailurePosition=-1},exitApplication:function(u,t){var e=this._posStack.pop();this._applicationStack.pop(),this.inLexifiedContextStack.pop(),u.exit(),this.rightmostFailurePosition=Math.max(this.rightmostFailurePosition,this._rightmostFailurePositionStack.pop()),t&&this.pushBinding(t,e)},enterLexifiedContext:function(){this.inLexifiedContextStack.push(!0)},exitLexifiedContext:function(){this.inLexifiedContextStack.pop()},currentApplication:function(){return this._applicationStack[this._applicationStack.length-1]},inSyntacticContext:function(){var u=this.currentApplication();return u?u.isSyntactic()&&!this.inLexifiedContext():this.startExpr.factors[0].isSyntactic()},inLexifiedContext:function(){return this.inLexifiedContextStack[this.inLexifiedContextStack.length-1]},skipSpaces:function(){return this.pushFailuresInfo(),this.eval(Et),this.popBinding(),this.popFailuresInfo(),this.inputStream.pos},skipSpacesIfInSyntacticContext:function(){return this.inSyntacticContext()?this.skipSpaces():this.inputStream.pos},maybeSkipSpacesBefore:function(u){return u.allowsSkippingPrecedingSpace()&&u!==Et?this.skipSpacesIfInSyntacticContext():this.inputStream.pos},pushBinding:function(u,t){this._bindings.push(u),this._bindingOffsets.push(this.posToOffset(t))},popBinding:function(){this._bindings.pop(),this._bindingOffsets.pop()},numBindings:function(){return this._bindings.length},truncateBindings:function(u){for(;this._bindings.length>u;)this.popBinding()},getCurrentPosInfo:function(){return this.getPosInfo(this.inputStream.pos)},getPosInfo:function(u){var t=this.memoTable[u];return t||(t=this.memoTable[u]=new At),t},processFailure:function(u,t){if(this.rightmostFailurePosition=Math.max(this.rightmostFailurePosition,u),this.recordedFailures&&u===this.positionToRecordFailures){var e=this.currentApplication();e&&(t=t.substituteParams(e.args)),this.recordFailure(t.toFailure(this.grammar),!1)}},recordFailure:function(u,t){var e=u.toKey();this.recordedFailures[e]?this.recordedFailures[e].isFluffy()&&!u.isFluffy()&&this.recordedFailures[e].clearFluffy():this.recordedFailures[e]=t?u.clone():u},recordFailures:function(u,t){var e=this;Object.keys(u).forEach((function(r){e.recordFailure(u[r],t)}))},cloneRecordedFailures:function(){var u=this;if(this.recordedFailures){var t=Object.create(null);return Object.keys(this.recordedFailures).forEach((function(e){t[e]=u.recordedFailures[e].clone()})),t}},getRightmostFailurePosition:function(){return this.rightmostFailurePosition},_getRightmostFailureOffset:function(){return this.rightmostFailurePosition>=0?this.posToOffset(this.rightmostFailurePosition):-1},getMemoizedTraceEntry:function(u,t){var e=this.memoTable[u];if(e&&t instanceof mt.Apply){var r=e.memo[t.toMemoKey()];if(r&&r.traceEntry){var n=r.traceEntry.cloneWithExpr(t);return n.isMemoized=!0,n}}return null},getTraceEntry:function(u,t,e,r){if(t instanceof mt.Apply){var n=this.currentApplication(),i=n?n.args:[];t=t.substituteParams(i)}return this.getMemoizedTraceEntry(u,t)||new ft(this.input,u,this.inputStream.pos,t,e,r,this.trace)},isTracing:function(){return!!this.trace},hasNecessaryInfo:function(u){return!(this.trace&&!u.traceEntry)&&(!this.recordedFailures||this.inputStream.pos+u.rightmostFailureOffset!==this.positionToRecordFailures||!!u.failuresAtRightmostPosition)},useMemoizedResult:function(u,t){this.trace&&this.trace.push(t.traceEntry);var e=this.inputStream.pos+t.rightmostFailureOffset;return this.rightmostFailurePosition=Math.max(this.rightmostFailurePosition,e),this.recordedFailures&&this.positionToRecordFailures===e&&t.failuresAtRightmostPosition&&this.recordFailures(t.failuresAtRightmostPosition,!0),this.inputStream.examinedLength=Math.max(this.inputStream.examinedLength,t.examinedLength+u),!!t.value&&(this.inputStream.pos+=t.matchLength,this.pushBinding(t.value,u),!0)},eval:function(u){var t,e=this,r=this.inputStream,n=this._bindings.length;this.recordedFailures&&(t=this.recordedFailures,this.recordedFailures=Object.create(null));var i,o=r.pos,a=this.maybeSkipSpacesBefore(u);this.trace&&(i=this.trace,this.trace=[]);var s=u.eval(this);if(this.trace){var c=this._bindings.slice(n),l=this.getTraceEntry(a,u,s,c);l.isImplicitSpaces=u===Et,l.isRootNode=u===this.startExpr,i.push(l),this.trace=i}return s?this.recordedFailures&&r.pos===this.positionToRecordFailures&&Object.keys(this.recordedFailures).forEach((function(u){e.recordedFailures[u].makeFluffy()})):(r.pos=o,this.truncateBindings(n)),this.recordedFailures&&this.recordFailures(t,!1),u===pt&&this.skipSpaces(),s},getMatchResult:function(){var u,t=this;this.eval(this.startExpr),this.recordedFailures&&(u=Object.keys(this.recordedFailures).map((function(u){return t.recordedFailures[u]})));var e=this._bindings[0];return e&&(e.grammar=this.grammar),new ht(this.matcher,this.input,this.startExpr,e,this._bindingOffsets[0],this.rightmostFailurePosition,u)},getTrace:function(){this.trace=[];var u=this.getMatchResult(),t=this.trace[this.trace.length-1];return t.result=u,t},pushFailuresInfo:function(){this._rightmostFailurePositionStack.push(this.rightmostFailurePosition),this._recordedFailuresStack.push(this.recordedFailures)},popFailuresInfo:function(){this.rightmostFailurePosition=this._rightmostFailurePositionStack.pop(),this.recordedFailures=this._recordedFailuresStack.pop()}};var Ft=Ct,dt=Wu;function vt(u){this.grammar=u,this.memoTable=[],this.input=""}vt.prototype.getInput=function(){return this.input},vt.prototype.setInput=function(u){return this.input!==u&&this.replaceInputRange(0,this.input.length,u),this},vt.prototype.replaceInputRange=function(u,t,e){var r=this.input;if(u<0||u>r.length||t<0||t>r.length||u>t)throw new Error("Invalid indices: "+u+" and "+t);this.input=r.slice(0,u)+e+r.slice(t);var n=this.memoTable.slice(t);this.memoTable.length=u;for(var i=0;i0&&(p+="("+c.join(", ")+")"),o=e(t)&&t.super[u.toLowerCase()+"s"][i]?"extend"+u:"add"+u,r+="\n ."+o+"("+JSON.stringify(p)+", {";var D=[];Object.keys(s).forEach((function(u){if(s[u]!==l){var t=s[u].toString().trim();t=t.replace(/^.*\(/,"function("),D.push("\n "+JSON.stringify(u)+": "+t)}})),r+=D.join(",")+"\n })"}))})),r+=";\n })",u||(r="(function() {\n var grammar = this.fromRecipe("+this.grammar.toRecipe()+");\n var semantics = "+r+"(grammar);\n return semantics;\n});\n"),r},Nt.prototype.addOperationOrAttribute=function(u,t,e){var n=u+"s",i=Rt(t,u),o=i.name,a=i.formals;this.assertNewName(o,u);var s=function(u,t,e){return function(){var r=this,n=(this._semantics.operations[t]||this._semantics.attributes[t]).formals.map((function(u){return r.args[u]}));if(this.isIteration()||1!==arguments.length)throw bt.missingSemanticAction(this.ctorName,t,u,wt);return e.apply(arguments.length<=0?void 0:arguments[0],n)}}(u,o,p),c={_default:s};Object.keys(e).forEach((function(u){c[u]=e[u]}));var l="operation"===u?new Lt(o,a,c,s):new Pt(o,c,s);function p(){for(var t=arguments.length,e=new Array(t),i=0;i0){var l=r.map((function(u){return"- "+u})),p=new Error(["Found errors in the action dictionary of the '".concat(t,"' ").concat(u,":")].concat((0,n.Z)(l)).join("\n"));throw p.problems=r,p}},_topDownActionArity:function(u){return Ut.includes(u)?0:this.rules[u].body.getArity()},_inheritsFrom:function(u){for(var t=this.superGrammar;t;){if(t.equals(u,!0))return!0;t=t.superGrammar}return!1},toRecipe:function(){var u=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e={};this.source&&(e.source=this.source.contents);var r=null;this.defaultStartRule&&(r=this.defaultStartRule);var i={};Object.keys(this.rules).forEach((function(t){var e,r=u.rules[t],n=r.body,o=!u.superGrammar||!u.superGrammar.rules[t];e=o?"define":n instanceof Gt.Extend?"extend":"override";var a={};if(r.source&&u.source){var s=r.source.relativeTo(u.source);a.sourceInterval=[s.startIdx,s.endIdx]}var c=o?r.description:null,l=n.outputRecipe(r.formals,u.source);i[t]=[e,a,c,r.formals,l]}));var o="null";t?o=t:this.superGrammar&&!this.superGrammar.isBuiltIn()&&(o=this.superGrammar.toRecipe());var a=[].concat((0,n.Z)(["grammar",e,this.name].map(JSON.stringify)),[o],(0,n.Z)([r,i].map(JSON.stringify)));return Vt("[".concat(a.join(","),"]"))},toOperationActionDictionaryTemplate:function(){return this._toOperationOrAttributeActionDictionaryTemplate()},toAttributeActionDictionaryTemplate:function(){return this._toOperationOrAttributeActionDictionaryTemplate()},_toOperationOrAttributeActionDictionaryTemplate:function(){var u=new qt.StringBuffer;u.append("{");var t=!0;for(var e in this.rules){var r=this.rules[e].body;t?t=!1:u.append(","),u.append("\n"),u.append(" "),this.addSemanticActionTemplate(e,r,u)}return u.append("\n}"),u.contents()},addSemanticActionTemplate:function(u,t,e){e.append(u),e.append(": function(");var r=this._topDownActionArity(u);e.append(qt.repeat("_",r).join(", ")),e.append(") {\n"),e.append(" }")},parseApplication:function(u){var t;if(-1===u.indexOf("<"))t=new Gt.Apply(u);else{var e=Ht.match(u,"Base_application");t=Kt(e,{})}if(!(t.ruleName in this.rules))throw Mt.undeclaredRule(t.ruleName,this.name);var r=this.rules[t.ruleName].formals;if(r.length!==t.args.length){var n=this.rules[t.ruleName].source;throw Mt.wrongNumberOfParameters(t.ruleName,r.length,t.args.length,n)}return t}},Wt.ProtoBuiltInRules=new Wt("ProtoBuiltInRules",void 0,{any:{body:Gt.any,formals:[],description:"any character",primitive:!0},end:{body:Gt.end,formals:[],description:"end of input",primitive:!0},caseInsensitive:{body:new Tt(new Gt.Param(0)),formals:["str"],primitive:!0},lower:{body:new Gt.UnicodeChar("Ll"),formals:[],description:"a lowercase letter",primitive:!0},upper:{body:new Gt.UnicodeChar("Lu"),formals:[],description:"an uppercase letter",primitive:!0},unicodeLtmo:{body:new Gt.UnicodeChar("Ltmo"),formals:[],description:"a Unicode character in Lt, Lm, or Lo",primitive:!0},spaces:{body:new Gt.Star(new Gt.Apply("space")),formals:[]},space:{body:new Gt.Range("\0"," "),formals:[],description:"a space"}});var $t=Wt,Jt=$t,Qt=nt,Xt=D,Yt=V,ue=Wu;function te(u){this.name=u}te.prototype.sourceInterval=function(u,t){return this.source.subInterval(u,t-u)},te.prototype.ensureSuperGrammar=function(){return this.superGrammar||this.withSuperGrammar("BuiltInRules"===this.name?Jt.ProtoBuiltInRules:Jt.BuiltInRules),this.superGrammar},te.prototype.ensureSuperGrammarRuleForOverriding=function(u,t){var e=this.ensureSuperGrammar().rules[u];if(!e)throw Yt.cannotOverrideUndeclaredRule(u,this.superGrammar.name,t);return e},te.prototype.installOverriddenOrExtendedRule=function(u,t,e,r){var n=Xt.getDuplicates(t);if(n.length>0)throw Yt.duplicateParameterNames(u,n,r);var i=this.ensureSuperGrammar().rules[u],o=i.formals,a=o?o.length:0;if(t.length!==a)throw Yt.wrongNumberOfParameters(u,a,t.length,r);return this.install(u,t,e,i.description,r)},te.prototype.install=function(u,t,e,r,n){return this.rules[u]={body:e.introduceParams(t),formals:t,description:r,source:n},this},te.prototype.withSuperGrammar=function(u){if(this.superGrammar)throw new Error("the super grammar of a GrammarDecl cannot be set more than once");return this.superGrammar=u,this.rules=Object.create(u.rules),u.isBuiltIn()||(this.defaultStartRule=u.defaultStartRule),this},te.prototype.withDefaultStartRule=function(u){return this.defaultStartRule=u,this},te.prototype.withSource=function(u){return this.source=new Qt(u).interval(0,u.length),this},te.prototype.build=function(){var u=new Jt(this.name,this.ensureSuperGrammar(),this.rules,this.defaultStartRule),t=[],e=!1;return Object.keys(u.rules).forEach((function(r){var n=u.rules[r].body;try{n.assertChoicesHaveUniformArity(r)}catch(i){t.push(i)}try{n.assertAllApplicationsAreValid(r,u)}catch(i){t.push(i),e=!0}})),e||Object.keys(u.rules).forEach((function(e){var r=u.rules[e].body;try{r.assertIteratedExprsAreNotNullable(u,[])}catch(n){t.push(n)}})),t.length>0&&Yt.throwErrors(t),this.source&&(u.source=this.source),u},te.prototype.define=function(u,t,e,r,n){if(this.ensureSuperGrammar(),this.superGrammar.rules[u])throw Yt.duplicateRuleDeclaration(u,this.name,this.superGrammar.name,n);if(this.rules[u])throw Yt.duplicateRuleDeclaration(u,this.name,this.name,n);var i=Xt.getDuplicates(t);if(i.length>0)throw Yt.duplicateParameterNames(u,i,n);return this.install(u,t,e,r,n)},te.prototype.override=function(u,t,e,r,n){return this.ensureSuperGrammarRuleForOverriding(u,n),this.installOverriddenOrExtendedRule(u,t,e,n),this},te.prototype.extend=function(u,t,e,r,n){if(!this.ensureSuperGrammar().rules[u])throw Yt.cannotExtendUndeclaredRule(u,this.superGrammar.name,n);var i=new ue.Extend(this.superGrammar,u,e);return i.source=e.source,this.installOverriddenOrExtendedRule(u,t,i,n),this};var ee=$t,re=te,ne=Wu;function ie(){}ie.prototype={currentDecl:null,currentRuleName:null,newGrammar:function(u){return new re(u)},grammar:function(u,t,e,r,n){var i=this,o=new re(t);return e&&o.withSuperGrammar(e instanceof ee?e:this.fromRecipe(e)),r&&o.withDefaultStartRule(r),u&&u.source&&o.withSource(u.source),this.currentDecl=o,Object.keys(n).forEach((function(u){i.currentRuleName=u;var t,e=n[u],r=e[0],a=e[1],s=e[2],c=e[3],l=i.fromRecipe(e[4]);o.source&&a&&a.sourceInterval&&(t=o.source.subInterval(a.sourceInterval[0],a.sourceInterval[1]-a.sourceInterval[0])),o[r](u,c,l,s,t)})),this.currentRuleName=this.currentDecl=null,o.build()},terminal:function(u){return new ne.Terminal(u)},range:function(u,t){return new ne.Range(u,t)},param:function(u){return new ne.Param(u)},alt:function(){for(var u=[],t=arguments.length,e=new Array(t),r=0;r0&&(t=t.map((function(u){return u instanceof ne.PExpr?u:this.fromRecipe(u)}),this)),new ne.Apply(u,t)},splice:function(u,t){var e=this;return new ne.Splice(this.currentDecl.superGrammar,this.currentRuleName,u.map((function(u){return e.fromRecipe(u)})),t.map((function(u){return e.fromRecipe(u)})))},fromRecipe:function(u){var t,e="grammar"===u[0]?u.slice(1):u.slice(2),r=this[u[0]].apply(this,(0,n.Z)(e)),i=u[1];i&&(i.sourceInterval&&this.currentDecl&&r.withSource((t=this.currentDecl).sourceInterval.apply(t,(0,n.Z)(i.sourceInterval))));return r}};var oe=ie,ae="string"===typeof __GLOBAL_OHM_VERSION__?__GLOBAL_OHM_VERSION__:"16.6.0",se={},ce=oe;se.makeRecipe=function(u){return"function"===typeof u?u.call(new ce):("string"===typeof u&&(u=JSON.parse(u)),(new ce).fromRecipe(u))};var le=(0,se.makeRecipe)(["grammar",{source:'BuiltInRules {\n\n alnum (an alpha-numeric character)\n = letter\n | digit\n\n letter (a letter)\n = lower\n | upper\n | unicodeLtmo\n\n digit (a digit)\n = "0".."9"\n\n hexDigit (a hexadecimal digit)\n = digit\n | "a".."f"\n | "A".."F"\n\n ListOf\n = NonemptyListOf\n | EmptyListOf\n\n NonemptyListOf\n = elem (sep elem)*\n\n EmptyListOf\n = /* nothing */\n\n listOf\n = nonemptyListOf\n | emptyListOf\n\n nonemptyListOf\n = elem (sep elem)*\n\n emptyListOf\n = /* nothing */\n\n // Allows a syntactic rule application within a lexical context.\n applySyntactic = app\n}'},"BuiltInRules",null,null,{alnum:["define",{sourceInterval:[18,78]},"an alpha-numeric character",[],["alt",{sourceInterval:[60,78]},["app",{sourceInterval:[60,66]},"letter",[]],["app",{sourceInterval:[73,78]},"digit",[]]]],letter:["define",{sourceInterval:[82,142]},"a letter",[],["alt",{sourceInterval:[107,142]},["app",{sourceInterval:[107,112]},"lower",[]],["app",{sourceInterval:[119,124]},"upper",[]],["app",{sourceInterval:[131,142]},"unicodeLtmo",[]]]],digit:["define",{sourceInterval:[146,177]},"a digit",[],["range",{sourceInterval:[169,177]},"0","9"]],hexDigit:["define",{sourceInterval:[181,254]},"a hexadecimal digit",[],["alt",{sourceInterval:[219,254]},["app",{sourceInterval:[219,224]},"digit",[]],["range",{sourceInterval:[231,239]},"a","f"],["range",{sourceInterval:[246,254]},"A","F"]]],ListOf:["define",{sourceInterval:[258,336]},null,["elem","sep"],["alt",{sourceInterval:[282,336]},["app",{sourceInterval:[282,307]},"NonemptyListOf",[["param",{sourceInterval:[297,301]},0],["param",{sourceInterval:[303,306]},1]]],["app",{sourceInterval:[314,336]},"EmptyListOf",[["param",{sourceInterval:[326,330]},0],["param",{sourceInterval:[332,335]},1]]]]],NonemptyListOf:["define",{sourceInterval:[340,388]},null,["elem","sep"],["seq",{sourceInterval:[372,388]},["param",{sourceInterval:[372,376]},0],["star",{sourceInterval:[377,388]},["seq",{sourceInterval:[378,386]},["param",{sourceInterval:[378,381]},1],["param",{sourceInterval:[382,386]},0]]]]],EmptyListOf:["define",{sourceInterval:[392,434]},null,["elem","sep"],["seq",{sourceInterval:[438,438]}]],listOf:["define",{sourceInterval:[438,516]},null,["elem","sep"],["alt",{sourceInterval:[462,516]},["app",{sourceInterval:[462,487]},"nonemptyListOf",[["param",{sourceInterval:[477,481]},0],["param",{sourceInterval:[483,486]},1]]],["app",{sourceInterval:[494,516]},"emptyListOf",[["param",{sourceInterval:[506,510]},0],["param",{sourceInterval:[512,515]},1]]]]],nonemptyListOf:["define",{sourceInterval:[520,568]},null,["elem","sep"],["seq",{sourceInterval:[552,568]},["param",{sourceInterval:[552,556]},0],["star",{sourceInterval:[557,568]},["seq",{sourceInterval:[558,566]},["param",{sourceInterval:[558,561]},1],["param",{sourceInterval:[562,566]},0]]]]],emptyListOf:["define",{sourceInterval:[572,682]},null,["elem","sep"],["seq",{sourceInterval:[685,685]}]],applySyntactic:["define",{sourceInterval:[685,710]},null,["app"],["param",{sourceInterval:[707,710]},0]]}]);$t.BuiltInRules=le;var pe=(0,se.makeRecipe)(["grammar",{source:'OperationsAndAttributes {\n\n AttributeSignature =\n name\n\n OperationSignature =\n name Formals?\n\n Formals\n = "(" ListOf ")"\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = "_"\n | letter\n\n nameRest\n = "_"\n | alnum\n\n}'},"OperationsAndAttributes",null,"AttributeSignature",{AttributeSignature:["define",{sourceInterval:[29,58]},null,[],["app",{sourceInterval:[54,58]},"name",[]]],OperationSignature:["define",{sourceInterval:[62,100]},null,[],["seq",{sourceInterval:[87,100]},["app",{sourceInterval:[87,91]},"name",[]],["opt",{sourceInterval:[92,100]},["app",{sourceInterval:[92,99]},"Formals",[]]]]],Formals:["define",{sourceInterval:[104,143]},null,[],["seq",{sourceInterval:[118,143]},["terminal",{sourceInterval:[118,121]},"("],["app",{sourceInterval:[122,139]},"ListOf",[["app",{sourceInterval:[129,133]},"name",[]],["terminal",{sourceInterval:[135,138]},","]]],["terminal",{sourceInterval:[140,143]},")"]]],name:["define",{sourceInterval:[147,187]},"a name",[],["seq",{sourceInterval:[168,187]},["app",{sourceInterval:[168,177]},"nameFirst",[]],["star",{sourceInterval:[178,187]},["app",{sourceInterval:[178,186]},"nameRest",[]]]]],nameFirst:["define",{sourceInterval:[191,223]},null,[],["alt",{sourceInterval:[207,223]},["terminal",{sourceInterval:[207,210]},"_"],["app",{sourceInterval:[217,223]},"letter",[]]]],nameRest:["define",{sourceInterval:[227,257]},null,[],["alt",{sourceInterval:[242,257]},["terminal",{sourceInterval:[242,245]},"_"],["app",{sourceInterval:[252,257]},"alnum",[]]]]}]),De=kt;W.awaitBuiltInRules((function(u){var t=pe;!function(u){var t={empty:function(){return this.iteration()},nonEmpty:function(u,t,e){return this.iteration([u].concat(e.children))}};De.BuiltInSemantics=De.createSemantics(u,null).addOperation("asIteration",{emptyListOf:t.empty,nonemptyListOf:t.nonEmpty,EmptyListOf:t.empty,NonemptyListOf:t.nonEmpty})}(u),function(u){De.prototypeGrammarSemantics=u.createSemantics().addOperation("parse",{AttributeSignature:function(u){return{name:u.parse(),formals:[]}},OperationSignature:function(u,t){return{name:u.parse(),formals:t.children.map((function(u){return u.parse()}))[0]||[]}},Formals:function(u,t,e){return t.asIteration().children.map((function(u){return u.parse()}))},name:function(u,t){return this.sourceString}}),De.prototypeGrammar=u}(t)}));var he,Ae=(0,se.makeRecipe)(["grammar",{source:'Ohm {\n\n Grammars\n = Grammar*\n\n Grammar\n = ident SuperGrammar? "{" Rule* "}"\n\n SuperGrammar\n = "<:" ident\n\n Rule\n = ident Formals? ruleDescr? "=" RuleBody -- define\n | ident Formals? ":=" OverrideRuleBody -- override\n | ident Formals? "+=" RuleBody -- extend\n\n RuleBody\n = "|"? NonemptyListOf\n\n TopLevelTerm\n = Seq caseName -- inline\n | Seq\n\n OverrideRuleBody\n = "|"? NonemptyListOf\n\n OverrideTopLevelTerm\n = "..." -- superSplice\n | TopLevelTerm\n\n Formals\n = "<" ListOf ">"\n\n Params\n = "<" ListOf ">"\n\n Alt\n = NonemptyListOf\n\n Seq\n = Iter*\n\n Iter\n = Pred "*" -- star\n | Pred "+" -- plus\n | Pred "?" -- opt\n | Pred\n\n Pred\n = "~" Lex -- not\n | "&" Lex -- lookahead\n | Lex\n\n Lex\n = "#" Base -- lex\n | Base\n\n Base\n = ident Params? ~(ruleDescr? "=" | ":=" | "+=") -- application\n | oneCharTerminal ".." oneCharTerminal -- range\n | terminal -- terminal\n | "(" Alt ")" -- paren\n\n ruleDescr (a rule description)\n = "(" ruleDescrText ")"\n\n ruleDescrText\n = (~")" any)*\n\n caseName\n = "--" (~"\\n" space)* name (~"\\n" space)* ("\\n" | &"}")\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = "_"\n | letter\n\n nameRest\n = "_"\n | alnum\n\n ident (an identifier)\n = name\n\n terminal\n = "\\"" terminalChar* "\\""\n\n oneCharTerminal\n = "\\"" terminalChar "\\""\n\n terminalChar\n = escapeChar\n | ~"\\\\" ~"\\"" ~"\\n" "\\u{0}".."\\u{10FFFF}"\n\n escapeChar (an escape sequence)\n = "\\\\\\\\" -- backslash\n | "\\\\\\"" -- doubleQuote\n | "\\\\\\\'" -- singleQuote\n | "\\\\b" -- backspace\n | "\\\\n" -- lineFeed\n | "\\\\r" -- carriageReturn\n | "\\\\t" -- tab\n | "\\\\u{" hexDigit hexDigit? hexDigit?\n hexDigit? hexDigit? hexDigit? "}" -- unicodeCodePoint\n | "\\\\u" hexDigit hexDigit hexDigit hexDigit -- unicodeEscape\n | "\\\\x" hexDigit hexDigit -- hexEscape\n\n space\n += comment\n\n comment\n = "//" (~"\\n" any)* &("\\n" | end) -- singleLine\n | "/*" (~"*/" any)* "*/" -- multiLine\n\n tokens = token*\n\n token = caseName | comment | ident | operator | punctuation | terminal | any\n\n operator = "<:" | "=" | ":=" | "+=" | "*" | "+" | "?" | "~" | "&"\n\n punctuation = "<" | ">" | "," | "--"\n}'},"Ohm",null,"Grammars",{Grammars:["define",{sourceInterval:[9,32]},null,[],["star",{sourceInterval:[24,32]},["app",{sourceInterval:[24,31]},"Grammar",[]]]],Grammar:["define",{sourceInterval:[36,83]},null,[],["seq",{sourceInterval:[50,83]},["app",{sourceInterval:[50,55]},"ident",[]],["opt",{sourceInterval:[56,69]},["app",{sourceInterval:[56,68]},"SuperGrammar",[]]],["terminal",{sourceInterval:[70,73]},"{"],["star",{sourceInterval:[74,79]},["app",{sourceInterval:[74,78]},"Rule",[]]],["terminal",{sourceInterval:[80,83]},"}"]]],SuperGrammar:["define",{sourceInterval:[87,116]},null,[],["seq",{sourceInterval:[106,116]},["terminal",{sourceInterval:[106,110]},"<:"],["app",{sourceInterval:[111,116]},"ident",[]]]],Rule_define:["define",{sourceInterval:[131,181]},null,[],["seq",{sourceInterval:[131,170]},["app",{sourceInterval:[131,136]},"ident",[]],["opt",{sourceInterval:[137,145]},["app",{sourceInterval:[137,144]},"Formals",[]]],["opt",{sourceInterval:[146,156]},["app",{sourceInterval:[146,155]},"ruleDescr",[]]],["terminal",{sourceInterval:[157,160]},"="],["app",{sourceInterval:[162,170]},"RuleBody",[]]]],Rule_override:["define",{sourceInterval:[188,248]},null,[],["seq",{sourceInterval:[188,235]},["app",{sourceInterval:[188,193]},"ident",[]],["opt",{sourceInterval:[194,202]},["app",{sourceInterval:[194,201]},"Formals",[]]],["terminal",{sourceInterval:[214,218]},":="],["app",{sourceInterval:[219,235]},"OverrideRuleBody",[]]]],Rule_extend:["define",{sourceInterval:[255,305]},null,[],["seq",{sourceInterval:[255,294]},["app",{sourceInterval:[255,260]},"ident",[]],["opt",{sourceInterval:[261,269]},["app",{sourceInterval:[261,268]},"Formals",[]]],["terminal",{sourceInterval:[281,285]},"+="],["app",{sourceInterval:[286,294]},"RuleBody",[]]]],Rule:["define",{sourceInterval:[120,305]},null,[],["alt",{sourceInterval:[131,305]},["app",{sourceInterval:[131,170]},"Rule_define",[]],["app",{sourceInterval:[188,235]},"Rule_override",[]],["app",{sourceInterval:[255,294]},"Rule_extend",[]]]],RuleBody:["define",{sourceInterval:[309,362]},null,[],["seq",{sourceInterval:[324,362]},["opt",{sourceInterval:[324,328]},["terminal",{sourceInterval:[324,327]},"|"]],["app",{sourceInterval:[329,362]},"NonemptyListOf",[["app",{sourceInterval:[344,356]},"TopLevelTerm",[]],["terminal",{sourceInterval:[358,361]},"|"]]]]],TopLevelTerm_inline:["define",{sourceInterval:[385,408]},null,[],["seq",{sourceInterval:[385,397]},["app",{sourceInterval:[385,388]},"Seq",[]],["app",{sourceInterval:[389,397]},"caseName",[]]]],TopLevelTerm:["define",{sourceInterval:[366,418]},null,[],["alt",{sourceInterval:[385,418]},["app",{sourceInterval:[385,397]},"TopLevelTerm_inline",[]],["app",{sourceInterval:[415,418]},"Seq",[]]]],OverrideRuleBody:["define",{sourceInterval:[422,491]},null,[],["seq",{sourceInterval:[445,491]},["opt",{sourceInterval:[445,449]},["terminal",{sourceInterval:[445,448]},"|"]],["app",{sourceInterval:[450,491]},"NonemptyListOf",[["app",{sourceInterval:[465,485]},"OverrideTopLevelTerm",[]],["terminal",{sourceInterval:[487,490]},"|"]]]]],OverrideTopLevelTerm_superSplice:["define",{sourceInterval:[522,543]},null,[],["terminal",{sourceInterval:[522,527]},"..."]],OverrideTopLevelTerm:["define",{sourceInterval:[495,562]},null,[],["alt",{sourceInterval:[522,562]},["app",{sourceInterval:[522,527]},"OverrideTopLevelTerm_superSplice",[]],["app",{sourceInterval:[550,562]},"TopLevelTerm",[]]]],Formals:["define",{sourceInterval:[566,606]},null,[],["seq",{sourceInterval:[580,606]},["terminal",{sourceInterval:[580,583]},"<"],["app",{sourceInterval:[584,602]},"ListOf",[["app",{sourceInterval:[591,596]},"ident",[]],["terminal",{sourceInterval:[598,601]},","]]],["terminal",{sourceInterval:[603,606]},">"]]],Params:["define",{sourceInterval:[610,647]},null,[],["seq",{sourceInterval:[623,647]},["terminal",{sourceInterval:[623,626]},"<"],["app",{sourceInterval:[627,643]},"ListOf",[["app",{sourceInterval:[634,637]},"Seq",[]],["terminal",{sourceInterval:[639,642]},","]]],["terminal",{sourceInterval:[644,647]},">"]]],Alt:["define",{sourceInterval:[651,685]},null,[],["app",{sourceInterval:[661,685]},"NonemptyListOf",[["app",{sourceInterval:[676,679]},"Seq",[]],["terminal",{sourceInterval:[681,684]},"|"]]]],Seq:["define",{sourceInterval:[689,704]},null,[],["star",{sourceInterval:[699,704]},["app",{sourceInterval:[699,703]},"Iter",[]]]],Iter_star:["define",{sourceInterval:[719,736]},null,[],["seq",{sourceInterval:[719,727]},["app",{sourceInterval:[719,723]},"Pred",[]],["terminal",{sourceInterval:[724,727]},"*"]]],Iter_plus:["define",{sourceInterval:[743,760]},null,[],["seq",{sourceInterval:[743,751]},["app",{sourceInterval:[743,747]},"Pred",[]],["terminal",{sourceInterval:[748,751]},"+"]]],Iter_opt:["define",{sourceInterval:[767,783]},null,[],["seq",{sourceInterval:[767,775]},["app",{sourceInterval:[767,771]},"Pred",[]],["terminal",{sourceInterval:[772,775]},"?"]]],Iter:["define",{sourceInterval:[708,794]},null,[],["alt",{sourceInterval:[719,794]},["app",{sourceInterval:[719,727]},"Iter_star",[]],["app",{sourceInterval:[743,751]},"Iter_plus",[]],["app",{sourceInterval:[767,775]},"Iter_opt",[]],["app",{sourceInterval:[790,794]},"Pred",[]]]],Pred_not:["define",{sourceInterval:[809,824]},null,[],["seq",{sourceInterval:[809,816]},["terminal",{sourceInterval:[809,812]},"~"],["app",{sourceInterval:[813,816]},"Lex",[]]]],Pred_lookahead:["define",{sourceInterval:[831,852]},null,[],["seq",{sourceInterval:[831,838]},["terminal",{sourceInterval:[831,834]},"&"],["app",{sourceInterval:[835,838]},"Lex",[]]]],Pred:["define",{sourceInterval:[798,862]},null,[],["alt",{sourceInterval:[809,862]},["app",{sourceInterval:[809,816]},"Pred_not",[]],["app",{sourceInterval:[831,838]},"Pred_lookahead",[]],["app",{sourceInterval:[859,862]},"Lex",[]]]],Lex_lex:["define",{sourceInterval:[876,892]},null,[],["seq",{sourceInterval:[876,884]},["terminal",{sourceInterval:[876,879]},"#"],["app",{sourceInterval:[880,884]},"Base",[]]]],Lex:["define",{sourceInterval:[866,903]},null,[],["alt",{sourceInterval:[876,903]},["app",{sourceInterval:[876,884]},"Lex_lex",[]],["app",{sourceInterval:[899,903]},"Base",[]]]],Base_application:["define",{sourceInterval:[918,979]},null,[],["seq",{sourceInterval:[918,963]},["app",{sourceInterval:[918,923]},"ident",[]],["opt",{sourceInterval:[924,931]},["app",{sourceInterval:[924,930]},"Params",[]]],["not",{sourceInterval:[932,963]},["alt",{sourceInterval:[934,962]},["seq",{sourceInterval:[934,948]},["opt",{sourceInterval:[934,944]},["app",{sourceInterval:[934,943]},"ruleDescr",[]]],["terminal",{sourceInterval:[945,948]},"="]],["terminal",{sourceInterval:[951,955]},":="],["terminal",{sourceInterval:[958,962]},"+="]]]]],Base_range:["define",{sourceInterval:[986,1041]},null,[],["seq",{sourceInterval:[986,1022]},["app",{sourceInterval:[986,1001]},"oneCharTerminal",[]],["terminal",{sourceInterval:[1002,1006]},".."],["app",{sourceInterval:[1007,1022]},"oneCharTerminal",[]]]],Base_terminal:["define",{sourceInterval:[1048,1106]},null,[],["app",{sourceInterval:[1048,1056]},"terminal",[]]],Base_paren:["define",{sourceInterval:[1113,1168]},null,[],["seq",{sourceInterval:[1113,1124]},["terminal",{sourceInterval:[1113,1116]},"("],["app",{sourceInterval:[1117,1120]},"Alt",[]],["terminal",{sourceInterval:[1121,1124]},")"]]],Base:["define",{sourceInterval:[907,1168]},null,[],["alt",{sourceInterval:[918,1168]},["app",{sourceInterval:[918,963]},"Base_application",[]],["app",{sourceInterval:[986,1022]},"Base_range",[]],["app",{sourceInterval:[1048,1056]},"Base_terminal",[]],["app",{sourceInterval:[1113,1124]},"Base_paren",[]]]],ruleDescr:["define",{sourceInterval:[1172,1231]},"a rule description",[],["seq",{sourceInterval:[1210,1231]},["terminal",{sourceInterval:[1210,1213]},"("],["app",{sourceInterval:[1214,1227]},"ruleDescrText",[]],["terminal",{sourceInterval:[1228,1231]},")"]]],ruleDescrText:["define",{sourceInterval:[1235,1266]},null,[],["star",{sourceInterval:[1255,1266]},["seq",{sourceInterval:[1256,1264]},["not",{sourceInterval:[1256,1260]},["terminal",{sourceInterval:[1257,1260]},")"]],["app",{sourceInterval:[1261,1264]},"any",[]]]]],caseName:["define",{sourceInterval:[1270,1338]},null,[],["seq",{sourceInterval:[1285,1338]},["terminal",{sourceInterval:[1285,1289]},"--"],["star",{sourceInterval:[1290,1304]},["seq",{sourceInterval:[1291,1302]},["not",{sourceInterval:[1291,1296]},["terminal",{sourceInterval:[1292,1296]},"\n"]],["app",{sourceInterval:[1297,1302]},"space",[]]]],["app",{sourceInterval:[1305,1309]},"name",[]],["star",{sourceInterval:[1310,1324]},["seq",{sourceInterval:[1311,1322]},["not",{sourceInterval:[1311,1316]},["terminal",{sourceInterval:[1312,1316]},"\n"]],["app",{sourceInterval:[1317,1322]},"space",[]]]],["alt",{sourceInterval:[1326,1337]},["terminal",{sourceInterval:[1326,1330]},"\n"],["lookahead",{sourceInterval:[1333,1337]},["terminal",{sourceInterval:[1334,1337]},"}"]]]]],name:["define",{sourceInterval:[1342,1382]},"a name",[],["seq",{sourceInterval:[1363,1382]},["app",{sourceInterval:[1363,1372]},"nameFirst",[]],["star",{sourceInterval:[1373,1382]},["app",{sourceInterval:[1373,1381]},"nameRest",[]]]]],nameFirst:["define",{sourceInterval:[1386,1418]},null,[],["alt",{sourceInterval:[1402,1418]},["terminal",{sourceInterval:[1402,1405]},"_"],["app",{sourceInterval:[1412,1418]},"letter",[]]]],nameRest:["define",{sourceInterval:[1422,1452]},null,[],["alt",{sourceInterval:[1437,1452]},["terminal",{sourceInterval:[1437,1440]},"_"],["app",{sourceInterval:[1447,1452]},"alnum",[]]]],ident:["define",{sourceInterval:[1456,1489]},"an identifier",[],["app",{sourceInterval:[1485,1489]},"name",[]]],terminal:["define",{sourceInterval:[1493,1531]},null,[],["seq",{sourceInterval:[1508,1531]},["terminal",{sourceInterval:[1508,1512]},'"'],["star",{sourceInterval:[1513,1526]},["app",{sourceInterval:[1513,1525]},"terminalChar",[]]],["terminal",{sourceInterval:[1527,1531]},'"']]],oneCharTerminal:["define",{sourceInterval:[1535,1579]},null,[],["seq",{sourceInterval:[1557,1579]},["terminal",{sourceInterval:[1557,1561]},'"'],["app",{sourceInterval:[1562,1574]},"terminalChar",[]],["terminal",{sourceInterval:[1575,1579]},'"']]],terminalChar:["define",{sourceInterval:[1583,1660]},null,[],["alt",{sourceInterval:[1602,1660]},["app",{sourceInterval:[1602,1612]},"escapeChar",[]],["seq",{sourceInterval:[1621,1660]},["not",{sourceInterval:[1621,1626]},["terminal",{sourceInterval:[1622,1626]},"\\"]],["not",{sourceInterval:[1627,1632]},["terminal",{sourceInterval:[1628,1632]},'"']],["not",{sourceInterval:[1633,1638]},["terminal",{sourceInterval:[1634,1638]},"\n"]],["range",{sourceInterval:[1639,1660]},"\0","\udbff\udfff"]]]],escapeChar_backslash:["define",{sourceInterval:[1703,1758]},null,[],["terminal",{sourceInterval:[1703,1709]},"\\\\"]],escapeChar_doubleQuote:["define",{sourceInterval:[1765,1822]},null,[],["terminal",{sourceInterval:[1765,1771]},'\\"']],escapeChar_singleQuote:["define",{sourceInterval:[1829,1886]},null,[],["terminal",{sourceInterval:[1829,1835]},"\\'"]],escapeChar_backspace:["define",{sourceInterval:[1893,1948]},null,[],["terminal",{sourceInterval:[1893,1898]},"\\b"]],escapeChar_lineFeed:["define",{sourceInterval:[1955,2009]},null,[],["terminal",{sourceInterval:[1955,1960]},"\\n"]],escapeChar_carriageReturn:["define",{sourceInterval:[2016,2076]},null,[],["terminal",{sourceInterval:[2016,2021]},"\\r"]],escapeChar_tab:["define",{sourceInterval:[2083,2132]},null,[],["terminal",{sourceInterval:[2083,2088]},"\\t"]],escapeChar_unicodeCodePoint:["define",{sourceInterval:[2139,2243]},null,[],["seq",{sourceInterval:[2139,2221]},["terminal",{sourceInterval:[2139,2145]},"\\u{"],["app",{sourceInterval:[2146,2154]},"hexDigit",[]],["opt",{sourceInterval:[2155,2164]},["app",{sourceInterval:[2155,2163]},"hexDigit",[]]],["opt",{sourceInterval:[2165,2174]},["app",{sourceInterval:[2165,2173]},"hexDigit",[]]],["opt",{sourceInterval:[2188,2197]},["app",{sourceInterval:[2188,2196]},"hexDigit",[]]],["opt",{sourceInterval:[2198,2207]},["app",{sourceInterval:[2198,2206]},"hexDigit",[]]],["opt",{sourceInterval:[2208,2217]},["app",{sourceInterval:[2208,2216]},"hexDigit",[]]],["terminal",{sourceInterval:[2218,2221]},"}"]]],escapeChar_unicodeEscape:["define",{sourceInterval:[2250,2309]},null,[],["seq",{sourceInterval:[2250,2291]},["terminal",{sourceInterval:[2250,2255]},"\\u"],["app",{sourceInterval:[2256,2264]},"hexDigit",[]],["app",{sourceInterval:[2265,2273]},"hexDigit",[]],["app",{sourceInterval:[2274,2282]},"hexDigit",[]],["app",{sourceInterval:[2283,2291]},"hexDigit",[]]]],escapeChar_hexEscape:["define",{sourceInterval:[2316,2371]},null,[],["seq",{sourceInterval:[2316,2339]},["terminal",{sourceInterval:[2316,2321]},"\\x"],["app",{sourceInterval:[2322,2330]},"hexDigit",[]],["app",{sourceInterval:[2331,2339]},"hexDigit",[]]]],escapeChar:["define",{sourceInterval:[1664,2371]},"an escape sequence",[],["alt",{sourceInterval:[1703,2371]},["app",{sourceInterval:[1703,1709]},"escapeChar_backslash",[]],["app",{sourceInterval:[1765,1771]},"escapeChar_doubleQuote",[]],["app",{sourceInterval:[1829,1835]},"escapeChar_singleQuote",[]],["app",{sourceInterval:[1893,1898]},"escapeChar_backspace",[]],["app",{sourceInterval:[1955,1960]},"escapeChar_lineFeed",[]],["app",{sourceInterval:[2016,2021]},"escapeChar_carriageReturn",[]],["app",{sourceInterval:[2083,2088]},"escapeChar_tab",[]],["app",{sourceInterval:[2139,2221]},"escapeChar_unicodeCodePoint",[]],["app",{sourceInterval:[2250,2291]},"escapeChar_unicodeEscape",[]],["app",{sourceInterval:[2316,2339]},"escapeChar_hexEscape",[]]]],space:["extend",{sourceInterval:[2375,2394]},null,[],["app",{sourceInterval:[2387,2394]},"comment",[]]],comment_singleLine:["define",{sourceInterval:[2412,2458]},null,[],["seq",{sourceInterval:[2412,2443]},["terminal",{sourceInterval:[2412,2416]},"//"],["star",{sourceInterval:[2417,2429]},["seq",{sourceInterval:[2418,2427]},["not",{sourceInterval:[2418,2423]},["terminal",{sourceInterval:[2419,2423]},"\n"]],["app",{sourceInterval:[2424,2427]},"any",[]]]],["lookahead",{sourceInterval:[2430,2443]},["alt",{sourceInterval:[2432,2442]},["terminal",{sourceInterval:[2432,2436]},"\n"],["app",{sourceInterval:[2439,2442]},"end",[]]]]]],comment_multiLine:["define",{sourceInterval:[2465,2501]},null,[],["seq",{sourceInterval:[2465,2487]},["terminal",{sourceInterval:[2465,2469]},"/*"],["star",{sourceInterval:[2470,2482]},["seq",{sourceInterval:[2471,2480]},["not",{sourceInterval:[2471,2476]},["terminal",{sourceInterval:[2472,2476]},"*/"]],["app",{sourceInterval:[2477,2480]},"any",[]]]],["terminal",{sourceInterval:[2483,2487]},"*/"]]],comment:["define",{sourceInterval:[2398,2501]},null,[],["alt",{sourceInterval:[2412,2501]},["app",{sourceInterval:[2412,2443]},"comment_singleLine",[]],["app",{sourceInterval:[2465,2487]},"comment_multiLine",[]]]],tokens:["define",{sourceInterval:[2505,2520]},null,[],["star",{sourceInterval:[2514,2520]},["app",{sourceInterval:[2514,2519]},"token",[]]]],token:["define",{sourceInterval:[2524,2600]},null,[],["alt",{sourceInterval:[2532,2600]},["app",{sourceInterval:[2532,2540]},"caseName",[]],["app",{sourceInterval:[2543,2550]},"comment",[]],["app",{sourceInterval:[2553,2558]},"ident",[]],["app",{sourceInterval:[2561,2569]},"operator",[]],["app",{sourceInterval:[2572,2583]},"punctuation",[]],["app",{sourceInterval:[2586,2594]},"terminal",[]],["app",{sourceInterval:[2597,2600]},"any",[]]]],operator:["define",{sourceInterval:[2604,2669]},null,[],["alt",{sourceInterval:[2615,2669]},["terminal",{sourceInterval:[2615,2619]},"<:"],["terminal",{sourceInterval:[2622,2625]},"="],["terminal",{sourceInterval:[2628,2632]},":="],["terminal",{sourceInterval:[2635,2639]},"+="],["terminal",{sourceInterval:[2642,2645]},"*"],["terminal",{sourceInterval:[2648,2651]},"+"],["terminal",{sourceInterval:[2654,2657]},"?"],["terminal",{sourceInterval:[2660,2663]},"~"],["terminal",{sourceInterval:[2666,2669]},"&"]]],punctuation:["define",{sourceInterval:[2673,2709]},null,[],["alt",{sourceInterval:[2687,2709]},["terminal",{sourceInterval:[2687,2690]},"<"],["terminal",{sourceInterval:[2693,2696]},">"],["terminal",{sourceInterval:[2699,2702]},","],["terminal",{sourceInterval:[2705,2709]},"--"]]]}]),fe=oe,me=$t,Ee=G,Ce=D,Fe=V,de=Wu,ve=W,ye=ae,ge=se.makeRecipe,Be=Object.create(de.PExpr.prototype);function Ie(u,t,e){var r,i,o,a=new fe,s=!1,c=(e||he).createSemantics().addOperation("visit",{Grammars:function(u){return u.children.map((function(u){return u.visit()}))},Grammar:function(u,e,n,i,o){var s=u.visit();r=a.newGrammar(s,t),e.child(0)&&e.child(0).visit(),i.children.map((function(u){return u.visit()}));var c=r.build();if(c.source=this.source.trimmed(),s in t)throw Fe.duplicateGrammarDeclaration(c,t);return t[s]=c,c},SuperGrammar:function(u,e){var n=e.visit();if("null"===n)r.withSuperGrammar(null);else{if(!t||!(n in t))throw Fe.undeclaredGrammar(n,t,e.source);r.withSuperGrammar(t[n])}},Rule_define:function(u,t,e,n,a){i=u.visit(),o=t.children.map((function(u){return u.visit()}))[0]||[],r.defaultStartRule||r.ensureSuperGrammar()===me.ProtoBuiltInRules||r.withDefaultStartRule(i);var s=a.visit(),c=e.children.map((function(u){return u.visit()}))[0],l=this.source.trimmed();return r.define(i,o,s,c,l)},Rule_override:function(u,t,e,n){i=u.visit(),o=t.children.map((function(u){return u.visit()}))[0]||[];var a=this.source.trimmed();r.ensureSuperGrammarRuleForOverriding(i,a),s=!0;var c=n.visit();return s=!1,r.override(i,o,c,null,a)},Rule_extend:function(u,t,e,n){i=u.visit(),o=t.children.map((function(u){return u.visit()}))[0]||[];var a=n.visit(),s=this.source.trimmed();return r.extend(i,o,a,null,s)},RuleBody:function(u,t){return a.alt.apply(a,(0,n.Z)(t.visit())).withSource(this.source)},OverrideRuleBody:function(u,t){var e=t.visit(),o=e.indexOf(Be);if(o>=0){var s=e.slice(0,o),c=e.slice(o+1);return c.forEach((function(u){if(u===Be)throw Fe.multipleSuperSplices(u)})),new de.Splice(r.superGrammar,i,s,c).withSource(this.source)}return a.alt.apply(a,(0,n.Z)(e)).withSource(this.source)},Formals:function(u,t,e){return t.visit()},Params:function(u,t,e){return t.visit()},Alt:function(u){return a.alt.apply(a,(0,n.Z)(u.visit())).withSource(this.source)},TopLevelTerm_inline:function(u,t){var e=i+"_"+t.visit(),n=u.visit(),c=this.source.trimmed(),l=!(r.superGrammar&&r.superGrammar.rules[e]);s&&!l?r.override(e,o,n,null,c):r.define(e,o,n,null,c);var p=o.map((function(u){return a.app(u)}));return a.app(e,p).withSource(n.source)},OverrideTopLevelTerm_superSplice:function(u){return Be},Seq:function(u){return a.seq.apply(a,(0,n.Z)(u.children.map((function(u){return u.visit()})))).withSource(this.source)},Iter_star:function(u,t){return a.star(u.visit()).withSource(this.source)},Iter_plus:function(u,t){return a.plus(u.visit()).withSource(this.source)},Iter_opt:function(u,t){return a.opt(u.visit()).withSource(this.source)},Pred_not:function(u,t){return a.not(t.visit()).withSource(this.source)},Pred_lookahead:function(u,t){return a.lookahead(t.visit()).withSource(this.source)},Lex_lex:function(u,t){return a.lex(t.visit()).withSource(this.source)},Base_application:function(u,t){var e=t.children.map((function(u){return u.visit()}))[0]||[];return a.app(u.visit(),e).withSource(this.source)},Base_range:function(u,t,e){return a.range(u.visit(),e.visit()).withSource(this.source)},Base_terminal:function(u){return a.terminal(u.visit()).withSource(this.source)},Base_paren:function(u,t,e){return t.visit()},ruleDescr:function(u,t,e){return t.visit()},ruleDescrText:function(u){return this.sourceString.trim()},caseName:function(u,t,e,r,n){return e.visit()},name:function(u,t){return this.sourceString},nameFirst:function(u){},nameRest:function(u){},terminal:function(u,t,e){return t.children.map((function(u){return u.visit()})).join("")},oneCharTerminal:function(u,t,e){return t.visit()},escapeChar:function(u){try{return Ce.unescapeCodePoint(this.sourceString)}catch(t){if(t instanceof RangeError&&t.message.startsWith("Invalid code point "))throw Fe.invalidCodePoint(u);throw t}},NonemptyListOf:function(u,t,e){return[u.visit()].concat(e.children.map((function(u){return u.visit()})))},EmptyListOf:function(){return[]},_terminal:function(){return this.sourceString}});return c(u).visit()}function xe(u,t){var e,r=Ee.extend(Ee.asNamespace(t));if("string"!==typeof u){if(!(e=u).constructor||"function"!==typeof e.constructor.isBuffer||!e.constructor.isBuffer(e))throw new TypeError("Expected string as first argument, got "+Ce.unexpectedObjToString(u));u=u.toString()}return function(u,t){var e=he.match(u,"Grammars");if(e.failed())throw Fe.grammarSyntaxError(e);Ie(e,t)}(u,r),r}c.exports={createNamespace:Ee.createNamespace,grammar:function(u,t){var e=xe(u,t),r=Object.keys(e);if(0===r.length)throw new Error("Missing grammar definition");if(r.length>1){var n=e[r[1]].source;throw new Error(ve.getLineAndColumnMessage(n.sourceString,n.startIdx)+"Found more than one grammar definition -- use ohm.grammars() instead.")}return e[r[0]]},grammars:xe,grammarFromScriptElement:function(u){throw new Error("grammarFromScriptElement was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.")},grammarsFromScriptElements:function(u){throw new Error("grammarsFromScriptElements was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.")},makeRecipe:ge,ohmGrammar:null,pexprs:de,util:ve,version:ye},c.exports._buildGrammar=Ie,ve.announceBuiltInRules(me.BuiltInRules),c.exports.ohmGrammar=he=Ae,me.initApplicationParser(he,Ie);var be=c.exports,Se=D.assert;function we(u,t,e){return e(t[u])}function _e(u,t,e){return t[u].map(e)}function Oe(u){var t=u.split(/ ?\[\]/);return 2===t.length?_e.bind(null,t[0]):we.bind(null,u)}function Ne(u,t,e){return u.map((function(u){return u(t,e)}))}function Re(u){return/^[a-zA-Z_][0-9a-zA-Z_]*$/.test(u)}function Le(u){return u.trim()}function Pe(u){var t=this;this._shapes=u.shapes,this._getTag=u.getTag,this.Adapter=function(u,t){this._adaptee=u,this._family=t},this.Adapter.prototype.valueOf=function(){throw new Error("heeey!")},this.operations={},this._arities=Object.create(null),this._getChildren=Object.create(null),Object.keys(this._shapes).forEach((function(u){var e=t._shapes[u];t._getChildren[u]=function(u){return"string"===typeof u?Ne.bind(null,[Oe(u)]):Array.isArray(u)?Ne.bind(null,u.map(Oe)):(Se("function"===typeof u,"Expected a string, Array, or function"),Se(2===u.length,"Expected a function of arity 2, got "+u.length),u)}(e),"function"!==typeof e&&(t._arities[u]=Array.isArray(e)?e.length:1)})),this._wrap=function(u){return new t.Adapter(u,t)}}Pe.prototype.wrap=function(u){return this._wrap(u)},Pe.prototype._checkActionDict=function(u){var t=this;Object.keys(u).forEach((function(e){Se(e in t._getChildren,"Unrecognized action name '"+e+"'");var r=u[e];if(Se("function"===typeof r,"Key '"+e+"': expected function, got "+r),e in t._arities){var n=t._arities[e],i=u[e].length;Se(i===n,"Action '"+e+"' has the wrong arity: expected "+n+", got "+i)}}))},Pe.prototype.addOperation=function(u,t){var e=function(u){var t=u.split(/[()]/).map(Le);if(3===t.length&&""===t[2]){var e=t[0],r=[];if(t[1].length>0&&(r=t[1].split(",").map(Le)),Re(e)&&r.every(Re))return{name:e,formals:r}}throw new Error("Invalid operation signature: "+u)}(u),n=e.name;this._checkActionDict(t),this.operations[n]={name:n,formals:e.formals,actions:t};var i=this;return this.Adapter.prototype[n]=function(){var u=i._getTag(this._adaptee);Se(u in i._getChildren,"getTag returned unrecognized tag '"+u+"'"),Se(u in t,"No action for '"+u+"' in operation '"+n+"'");for(var o=Object.create(null),a=arguments.length,s=new Array(a),c=0;c0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),u.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(u){return this._throwIfClosed(),this._checkFinalizedStatuses(u),this._innerSubscribe(u)},t.prototype._innerSubscribe=function(u){var t=this,e=this,r=e.hasError,n=e.isStopped,i=e.observers;return r||n?c:(this.currentObservers=null,i.push(u),new s((function(){t.currentObservers=null,a(i,u)})))},t.prototype._checkFinalizedStatuses=function(u){var t=this,e=t.hasError,r=t.thrownError,n=t.isStopped;e?u.error(r):n&&u.complete()},t.prototype.asObservable=function(){var u=new _;return u.source=this,u},t.create=function(u,t){return new L(u,t)},t}(_),L=function(u){function t(t,e){var r=u.call(this)||this;return r.destination=t,r.source=e,r}return(0,r.ZT)(t,u),t.prototype.next=function(u){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===e||e.call(t,u)},t.prototype.error=function(u){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===e||e.call(t,u)},t.prototype.complete=function(){var u,t;null===(t=null===(u=this.destination)||void 0===u?void 0:u.complete)||void 0===t||t.call(u)},t.prototype._subscribe=function(u){var t,e;return null!==(e=null===(t=this.source)||void 0===t?void 0:t.subscribe(u))&&void 0!==e?e:c},t}(R)},4558:function(u,t,e){e.d(t,{CR:function(){return o},XA:function(){return i},ZT:function(){return n},ev:function(){return a}});var r=function(u,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,t){u.__proto__=t}||function(u,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(u[e]=t[e])},r(u,t)};function n(u,t){if("function"!==typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=u}r(u,t),u.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}Object.create;function i(u){var t="function"===typeof Symbol&&Symbol.iterator,e=t&&u[t],r=0;if(e)return e.call(u);if(u&&"number"===typeof u.length)return{next:function(){return u&&r>=u.length&&(u=void 0),{value:u&&u[r++],done:!u}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(u,t){var e="function"===typeof Symbol&&u[Symbol.iterator];if(!e)return u;var r,n,i=e.call(u),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(a){n={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}return o}function a(u,t,e){if(e||2===arguments.length)for(var r,n=0,i=t.length;n]+)>/g,(function(u,t){var e=i[t];return"$"+(Array.isArray(e)?e.join("$"):e)})))}if("function"==typeof n){var o=this;return u[Symbol.replace].call(this,e,(function(){var u=arguments;return"object"!=(0,r.Z)(u[u.length-1])&&(u=[].slice.call(u)).push(a(u,o)),n.apply(this,u)}))}return u[Symbol.replace].call(this,e,n)},o.apply(this,arguments)}},4408:function(u,t,e){e.d(t,{j:function(){return r}});var r=function(u){if(function(u){return"function"===typeof(null===u||void 0===u?void 0:u.toString)||"string"===typeof u}(u)){var t=u.toString();return"[object Object]"===t?JSON.stringify(u):t}return JSON.stringify(u)}},1585:function(u,t,e){function r(u,t){for(var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=[],n=u;n\nvar main$1 = {exports: {}};\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n/*\n `Failure`s represent expressions that weren't matched while parsing. They are used to generate\n error messages automatically. The interface of `Failure`s includes the collowing methods:\n\n - getText() : String\n - getType() : String (one of {\"description\", \"string\", \"code\"})\n - isDescription() : bool\n - isStringTerminal() : bool\n - isCode() : bool\n - isFluffy() : bool\n - makeFluffy() : void\n - subsumes(Failure) : bool\n*/\n\nfunction isValidType(type) {\n return type === 'description' || type === 'string' || type === 'code';\n}\n\nfunction Failure$2(pexpr, text, type) {\n if (!isValidType(type)) {\n throw new Error('invalid Failure type: ' + type);\n }\n this.pexpr = pexpr;\n this.text = text;\n this.type = type;\n this.fluffy = false;\n}\n\nFailure$2.prototype.getPExpr = function() {\n return this.pexpr;\n};\n\nFailure$2.prototype.getText = function() {\n return this.text;\n};\n\nFailure$2.prototype.getType = function() {\n return this.type;\n};\n\nFailure$2.prototype.isDescription = function() {\n return this.type === 'description';\n};\n\nFailure$2.prototype.isStringTerminal = function() {\n return this.type === 'string';\n};\n\nFailure$2.prototype.isCode = function() {\n return this.type === 'code';\n};\n\nFailure$2.prototype.isFluffy = function() {\n return this.fluffy;\n};\n\nFailure$2.prototype.makeFluffy = function() {\n this.fluffy = true;\n};\n\nFailure$2.prototype.clearFluffy = function() {\n this.fluffy = false;\n};\n\nFailure$2.prototype.subsumes = function(that) {\n return (\n this.getText() === that.getText() &&\n this.type === that.type &&\n (!this.isFluffy() || (this.isFluffy() && that.isFluffy()))\n );\n};\n\nFailure$2.prototype.toString = function() {\n return this.type === 'string' ? JSON.stringify(this.getText()) : this.getText();\n};\n\nFailure$2.prototype.clone = function() {\n const failure = new Failure$2(this.pexpr, this.text, this.type);\n if (this.isFluffy()) {\n failure.makeFluffy();\n }\n return failure;\n};\n\nFailure$2.prototype.toKey = function() {\n return this.toString() + '#' + this.type;\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Failure_1 = Failure$2;\n\nvar common$l = {};\n\n(function (exports) {\n\n// --------------------------------------------------------------------\n// Private Stuff\n// --------------------------------------------------------------------\n\n// Helpers\n\nconst escapeStringFor = {};\nfor (let c = 0; c < 128; c++) {\n escapeStringFor[c] = String.fromCharCode(c);\n}\nescapeStringFor[\"'\".charCodeAt(0)] = \"\\\\'\";\nescapeStringFor['\"'.charCodeAt(0)] = '\\\\\"';\nescapeStringFor['\\\\'.charCodeAt(0)] = '\\\\\\\\';\nescapeStringFor['\\b'.charCodeAt(0)] = '\\\\b';\nescapeStringFor['\\f'.charCodeAt(0)] = '\\\\f';\nescapeStringFor['\\n'.charCodeAt(0)] = '\\\\n';\nescapeStringFor['\\r'.charCodeAt(0)] = '\\\\r';\nescapeStringFor['\\t'.charCodeAt(0)] = '\\\\t';\nescapeStringFor['\\u000b'.charCodeAt(0)] = '\\\\v';\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nexports.abstract = function(optMethodName) {\n const methodName = optMethodName || '';\n return function() {\n throw new Error(\n 'this method ' +\n methodName +\n ' is abstract! ' +\n '(it has no implementation in class ' +\n this.constructor.name +\n ')'\n );\n };\n};\n\nexports.assert = function(cond, message) {\n if (!cond) {\n throw new Error(message || 'Assertion failed');\n }\n};\n\n// Define a lazily-computed, non-enumerable property named `propName`\n// on the object `obj`. `getterFn` will be called to compute the value the\n// first time the property is accessed.\nexports.defineLazyProperty = function(obj, propName, getterFn) {\n let memo;\n Object.defineProperty(obj, propName, {\n get() {\n if (!memo) {\n memo = getterFn.call(this);\n }\n return memo;\n },\n });\n};\n\nexports.clone = function(obj) {\n if (obj) {\n return Object.assign({}, obj);\n }\n return obj;\n};\n\nexports.repeatFn = function(fn, n) {\n const arr = [];\n while (n-- > 0) {\n arr.push(fn());\n }\n return arr;\n};\n\nexports.repeatStr = function(str, n) {\n return new Array(n + 1).join(str);\n};\n\nexports.repeat = function(x, n) {\n return exports.repeatFn(() => x, n);\n};\n\nexports.getDuplicates = function(array) {\n const duplicates = [];\n for (let idx = 0; idx < array.length; idx++) {\n const x = array[idx];\n if (array.lastIndexOf(x) !== idx && duplicates.indexOf(x) < 0) {\n duplicates.push(x);\n }\n }\n return duplicates;\n};\n\nexports.copyWithoutDuplicates = function(array) {\n const noDuplicates = [];\n array.forEach(entry => {\n if (noDuplicates.indexOf(entry) < 0) {\n noDuplicates.push(entry);\n }\n });\n return noDuplicates;\n};\n\nexports.isSyntactic = function(ruleName) {\n const firstChar = ruleName[0];\n return firstChar === firstChar.toUpperCase();\n};\n\nexports.isLexical = function(ruleName) {\n return !exports.isSyntactic(ruleName);\n};\n\nexports.padLeft = function(str, len, optChar) {\n const ch = optChar || ' ';\n if (str.length < len) {\n return exports.repeatStr(ch, len - str.length) + str;\n }\n return str;\n};\n\n// StringBuffer\n\nexports.StringBuffer = function() {\n this.strings = [];\n};\n\nexports.StringBuffer.prototype.append = function(str) {\n this.strings.push(str);\n};\n\nexports.StringBuffer.prototype.contents = function() {\n return this.strings.join('');\n};\n\nconst escapeUnicode = str => String.fromCodePoint(parseInt(str, 16));\n\nexports.unescapeCodePoint = function(s) {\n if (s.charAt(0) === '\\\\') {\n switch (s.charAt(1)) {\n case 'b':\n return '\\b';\n case 'f':\n return '\\f';\n case 'n':\n return '\\n';\n case 'r':\n return '\\r';\n case 't':\n return '\\t';\n case 'v':\n return '\\v';\n case 'x':\n return escapeUnicode(s.slice(2, 4));\n case 'u':\n return s.charAt(2) === '{' ?\n escapeUnicode(s.slice(3, -1)) :\n escapeUnicode(s.slice(2, 6));\n default:\n return s.charAt(1);\n }\n } else {\n return s;\n }\n};\n\n// Helper for producing a description of an unknown object in a safe way.\n// Especially useful for error messages where an unexpected type of object was encountered.\nexports.unexpectedObjToString = function(obj) {\n if (obj == null) {\n return String(obj);\n }\n const baseToString = Object.prototype.toString.call(obj);\n try {\n let typeName;\n if (obj.constructor && obj.constructor.name) {\n typeName = obj.constructor.name;\n } else if (baseToString.indexOf('[object ') === 0) {\n typeName = baseToString.slice(8, -1); // Extract e.g. \"Array\" from \"[object Array]\".\n } else {\n typeName = typeof obj;\n }\n return typeName + ': ' + JSON.stringify(String(obj));\n } catch (e) {\n return baseToString;\n }\n};\n}(common$l));\n\nconst common$k = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nclass Node {\n constructor(matchLength) {\n this.matchLength = matchLength;\n }\n\n get ctorName() {\n throw new Error('subclass responsibility');\n }\n\n numChildren() {\n return this.children ? this.children.length : 0;\n }\n\n childAt(idx) {\n if (this.children) {\n return this.children[idx];\n }\n }\n\n indexOfChild(arg) {\n return this.children.indexOf(arg);\n }\n\n hasChildren() {\n return this.numChildren() > 0;\n }\n\n hasNoChildren() {\n return !this.hasChildren();\n }\n\n onlyChild() {\n if (this.numChildren() !== 1) {\n throw new Error(\n 'cannot get only child of a node of type ' +\n this.ctorName +\n ' (it has ' +\n this.numChildren() +\n ' children)'\n );\n } else {\n return this.firstChild();\n }\n }\n\n firstChild() {\n if (this.hasNoChildren()) {\n throw new Error(\n 'cannot get first child of a ' + this.ctorName + ' node, which has no children'\n );\n } else {\n return this.childAt(0);\n }\n }\n\n lastChild() {\n if (this.hasNoChildren()) {\n throw new Error(\n 'cannot get last child of a ' + this.ctorName + ' node, which has no children'\n );\n } else {\n return this.childAt(this.numChildren() - 1);\n }\n }\n\n childBefore(child) {\n const childIdx = this.indexOfChild(child);\n if (childIdx < 0) {\n throw new Error('Node.childBefore() called w/ an argument that is not a child');\n } else if (childIdx === 0) {\n throw new Error('cannot get child before first child');\n } else {\n return this.childAt(childIdx - 1);\n }\n }\n\n childAfter(child) {\n const childIdx = this.indexOfChild(child);\n if (childIdx < 0) {\n throw new Error('Node.childAfter() called w/ an argument that is not a child');\n } else if (childIdx === this.numChildren() - 1) {\n throw new Error('cannot get child after last child');\n } else {\n return this.childAt(childIdx + 1);\n }\n }\n\n isTerminal() {\n return false;\n }\n\n isNonterminal() {\n return false;\n }\n\n isIteration() {\n return false;\n }\n\n isOptional() {\n return false;\n }\n}\n\n// Terminals\n\nclass TerminalNode$2 extends Node {\n get ctorName() {\n return '_terminal';\n }\n\n isTerminal() {\n return true;\n }\n\n get primitiveValue() {\n throw new Error('The `primitiveValue` property was removed in Ohm v17.');\n }\n}\n\n// Nonterminals\n\nclass NonterminalNode$1 extends Node {\n constructor(ruleName, children, childOffsets, matchLength) {\n super(matchLength);\n this.ruleName = ruleName;\n this.children = children;\n this.childOffsets = childOffsets;\n }\n\n get ctorName() {\n return this.ruleName;\n }\n\n isNonterminal() {\n return true;\n }\n\n isLexical() {\n return common$k.isLexical(this.ctorName);\n }\n\n isSyntactic() {\n return common$k.isSyntactic(this.ctorName);\n }\n}\n\n// Iterations\n\nclass IterationNode$2 extends Node {\n constructor(children, childOffsets, matchLength, isOptional) {\n super(matchLength);\n this.children = children;\n this.childOffsets = childOffsets;\n this.optional = isOptional;\n }\n\n get ctorName() {\n return '_iter';\n }\n\n isIteration() {\n return true;\n }\n\n isOptional() {\n return this.optional;\n }\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar nodes$1 = {\n Node,\n TerminalNode: TerminalNode$2,\n NonterminalNode: NonterminalNode$1,\n IterationNode: IterationNode$2,\n};\n\nvar pexprsMain = {};\n\n// Based on https://github.com/mathiasbynens/unicode-9.0.0.\n// These are just categories that are used in ES5/ES2015.\n// The full list of Unicode categories is here: http://www.fileformat.info/info/unicode/category/index.htm.\nvar UnicodeCategories$1 = {\n // Letters\n Lu: /[A-Z\\xC0-\\xD6\\xD8-\\xDE\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C7\\u01CA\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F1\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0370\\u0372\\u0376\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E\\u038F\\u0391-\\u03A1\\u03A3-\\u03AB\\u03CF\\u03D2-\\u03D4\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F4\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0528\\u052A\\u052C\\u052E\\u0531-\\u0556\\u10A0-\\u10C5\\u10C7\\u10CD\\u13A0-\\u13F5\\u1E00\\u1E02\\u1E04\\u1E06\\u1E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D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u2130-\\u2133\\u213E\\u213F\\u2145\\u2183\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\u2CF2\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA698\\uA69A\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA792\\uA796\\uA798\\uA79A\\uA79C\\uA79E\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uA7AA-\\uA7AE\\uA7B0-\\uA7B4\\uA7B6\\uFF21-\\uFF3A]|\\uD801[\\uDC00-\\uDC27\\uDCB0-\\uDCD3]|\\uD803[\\uDC80-\\uDCB2]|\\uD806[\\uDCA0-\\uDCBF]|\\uD835[\\uDC00-\\uDC19\\uDC34-\\uDC4D\\uDC68-\\uDC81\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB5\\uDCD0-\\uDCE9\\uDD04\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD38\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD6C-\\uDD85\\uDDA0-\\uDDB9\\uDDD4-\\uDDED\\uDE08-\\uDE21\\uDE3C-\\uDE55\\uDE70-\\uDE89\\uDEA8-\\uDEC0\\uDEE2-\\uDEFA\\uDF1C-\\uDF34\\uDF56-\\uDF6E\\uDF90-\\uDFA8\\uDFCA]|\\uD83A[\\uDD00-\\uDD21]/,\n Ll: /[a-z\\xB5\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0529\\u052B\\u052D\\u052F\\u0561-\\u0587\\u13F8-\\u13FD\\u1C80-\\u1C88\\u1D00-\\u1D2B\\u1D6B-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1E85\\u1E87\\u1E89\\u1E8B\\u1E8D\\u1E8F\\u1E91\\u1E93\\u1E95-\\u1E9D\\u1E9F\\u1EA1\\u1EA3\\u1EA5\\u1EA7\\u1EA9\\u1EAB\\u1EAD\\u1EAF\\u1EB1\\u1EB3\\u1EB5\\u1EB7\\u1EB9\\u1EBB\\u1EBD\\u1EBF\\u1EC1\\u1EC3\\u1EC5\\u1EC7\\u1EC9\\u1ECB\\u1ECD\\u1ECF\\u1ED1\\u1ED3\\u1ED5\\u1ED7\\u1ED9\\u1EDB\\u1EDD\\u1EDF\\u1EE1\\u1EE3\\u1EE5\\u1EE7\\u1EE9\\u1EEB\\u1EED\\u1EEF\\u1EF1\\u1EF3\\u1EF5\\u1EF7\\u1EF9\\u1EFB\\u1EFD\\u1EFF-\\u1F07\\u1F10-\\u1F15\\u1F20-\\u1F27\\u1F30-\\u1F37\\u1F40-\\u1F45\\u1F50-\\u1F57\\u1F60-\\u1F67\\u1F70-\\u1F7D\\u1F80-\\u1F87\\u1F90-\\u1F97\\u1FA0-\\u1FA7\\u1FB0-\\u1FB4\\u1FB6\\u1FB7\\u1FBE\\u1FC2-\\u1FC4\\u1FC6\\u1FC7\\u1FD0-\\u1FD3\\u1FD6\\u1FD7\\u1FE0-\\u1FE7\\u1FF2-\\u1FF4\\u1FF6\\u1FF7\\u210A\\u210E\\u210F\\u2113\\u212F\\u2134\\u2139\\u213C\\u213D\\u2146-\\u2149\\u214E\\u2184\\u2C30-\\u2C5E\\u2C61\\u2C65\\u2C66\\u2C68\\u2C6A\\u2C6C\\u2C71\\u2C73\\u2C74\\u2C76-\\u2C7B\\u2C81\\u2C83\\u2C85\\u2C87\\u2C89\\u2C8B\\u2C8D\\u2C8F\\u2C91\\u2C93\\u2C95\\u2C97\\u2C99\\u2C9B\\u2C9D\\u2C9F\\u2CA1\\u2CA3\\u2CA5\\u2CA7\\u2CA9\\u2CAB\\u2CAD\\u2CAF\\u2CB1\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3\\u2CE4\\u2CEC\\u2CEE\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA699\\uA69B\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA793-\\uA795\\uA797\\uA799\\uA79B\\uA79D\\uA79F\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7B5\\uA7B7\\uA7FA\\uAB30-\\uAB5A\\uAB60-\\uAB65\\uAB70-\\uABBF\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A]|\\uD801[\\uDC28-\\uDC4F\\uDCD8-\\uDCFB]|\\uD803[\\uDCC0-\\uDCF2]|\\uD806[\\uDCC0-\\uDCDF]|\\uD835[\\uDC1A-\\uDC33\\uDC4E-\\uDC54\\uDC56-\\uDC67\\uDC82-\\uDC9B\\uDCB6-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDCCF\\uDCEA-\\uDD03\\uDD1E-\\uDD37\\uDD52-\\uDD6B\\uDD86-\\uDD9F\\uDDBA-\\uDDD3\\uDDEE-\\uDE07\\uDE22-\\uDE3B\\uDE56-\\uDE6F\\uDE8A-\\uDEA5\\uDEC2-\\uDEDA\\uDEDC-\\uDEE1\\uDEFC-\\uDF14\\uDF16-\\uDF1B\\uDF36-\\uDF4E\\uDF50-\\uDF55\\uDF70-\\uDF88\\uDF8A-\\uDF8F\\uDFAA-\\uDFC2\\uDFC4-\\uDFC9\\uDFCB]|\\uD83A[\\uDD22-\\uDD43]/,\n Lt: /[\\u01C5\\u01C8\\u01CB\\u01F2\\u1F88-\\u1F8F\\u1F98-\\u1F9F\\u1FA8-\\u1FAF\\u1FBC\\u1FCC\\u1FFC]/,\n Lm: /[\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D6A\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA69C\\uA69D\\uA717-\\uA71F\\uA770\\uA788\\uA7F8\\uA7F9\\uA9CF\\uA9E6\\uAA70\\uAADD\\uAAF3\\uAAF4\\uAB5C-\\uAB5F\\uFF70\\uFF9E\\uFF9F]|\\uD81A[\\uDF40-\\uDF43]|\\uD81B[\\uDF93-\\uDF9F\\uDFE0]/,\n Lo: /[\\xAA\\xBA\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A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0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10D0-\\u10FA\\u10FD-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u2135-\\u2138\\u2D30-\\u2D67\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u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\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCFF\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD83A[\\uDC00-\\uDCC4]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1]|\\uD87E[\\uDC00-\\uDE1D]/,\n\n // Numbers\n Nl: /[\\u16EE-\\u16F0\\u2160-\\u2182\\u2185-\\u2188\\u3007\\u3021-\\u3029\\u3038-\\u303A\\uA6E6-\\uA6EF]|\\uD800[\\uDD40-\\uDD74\\uDF41\\uDF4A\\uDFD1-\\uDFD5]|\\uD809[\\uDC00-\\uDC6E]/,\n Nd: /[0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]|\\uD801[\\uDCA0-\\uDCA9]|\\uD804[\\uDC66-\\uDC6F\\uDCF0-\\uDCF9\\uDD36-\\uDD3F\\uDDD0-\\uDDD9\\uDEF0-\\uDEF9]|[\\uD805\\uD807][\\uDC50-\\uDC59\\uDCD0-\\uDCD9\\uDE50-\\uDE59\\uDEC0-\\uDEC9\\uDF30-\\uDF39]|\\uD806[\\uDCE0-\\uDCE9]|\\uD81A[\\uDE60-\\uDE69\\uDF50-\\uDF59]|\\uD835[\\uDFCE-\\uDFFF]|\\uD83A[\\uDD50-\\uDD59]/,\n\n // Marks\n Mn: /[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D4-\\u08E1\\u08E3-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C00\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D01\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4\\u17B5\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u1885\\u1886\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A1B\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1AB0-\\u1ABD\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BAB-\\u1BAD\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1CF4\\u1CF8\\u1CF9\\u1DC0-\\u1DF5\\u1DFB-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302D\\u3099\\u309A\\uA66F\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8C5\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uA9E5\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEC\\uAAED\\uAAF6\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F]|\\uD800[\\uDDF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uDC23\\uDC24\\uDC26-\\uDC2A]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uDB40[\\uDD00-\\uDDEF]/,\n Mc: /[\\u0903-\\u0903]|[\\u093E-\\u0940]|[\\u0949-\\u094C]|[\\u0982-\\u0983]|[\\u09BE-\\u09C0]|[\\u09C7-\\u09C8]|[\\u09CB-\\u09CC]|[\\u09D7-\\u09D7]|[\\u0A3E-\\u0A40]|[\\u0A83-\\u0A83]|[\\u0ABE-\\u0AC0]|[\\u0AC9-\\u0AC9]|[\\u0ACB-\\u0ACC]|[\\u0B02-\\u0B03]|[\\u0B3E-\\u0B3E]|[\\u0B40-\\u0B40]|[\\u0B47-\\u0B48]|[\\u0B4B-\\u0B4C]|[\\u0B57-\\u0B57]|[\\u0B83-\\u0B83]|[\\u0BBE-\\u0BBF]|[\\u0BC1-\\u0BC2]|[\\u0BC6-\\u0BC8]|[\\u0BCA-\\u0BCC]|[\\u0BD7-\\u0BD7]|[\\u0C01-\\u0C03]|[\\u0C41-\\u0C44]|[\\u0C82-\\u0C83]|[\\u0CBE-\\u0CBE]|[\\u0CC0-\\u0CC4]|[\\u0CC7-\\u0CC8]|[\\u0CCA-\\u0CCB]|[\\u0CD5-\\u0CD6]|[\\u0D02-\\u0D03]|[\\u0D3E-\\u0D40]|[\\u0D46-\\u0D48]|[\\u0D4A-\\u0D4C]|[\\u0D57-\\u0D57]|[\\u0F3E-\\u0F3F]|[\\u0F7F-\\u0F7F]/,\n\n // Punctuation, Connector\n Pc: /[_\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]/,\n\n // Separator, Space\n Zs: /[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/,\n\n // These two are not real Unicode categories, but our useful for Ohm.\n // L is a combination of all the letter categories.\n // Ltmo is a combination of Lt, Lm, and Lo.\n L: /[A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\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-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCA0-\\uDCDF\\uDCFF\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50\\uDF93-\\uDF9F\\uDFE0]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6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\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D6A\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA69C\\uA69D\\uA717-\\uA71F\\uA770\\uA788\\uA7F8\\uA7F9\\uA9CF\\uA9E6\\uAA70\\uAADD\\uAAF3\\uAAF4\\uAB5C-\\uAB5F\\uFF70\\uFF9E\\uFF9F]|\\uD81A[\\uDF40-\\uDF43]|\\uD81B[\\uDF93-\\uDF9F\\uDFE0]|[\\xAA\\xBA\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8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E-\\u1070\\u1075-\\u1081\\u108E\\u10D0-\\u10FA\\u10FD-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u2135-\\u2138\\u2D30-\\u2D67\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA014\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA500-\\uA60B\\uA610-\\uA61F\\uA62A\\uA62B\\u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0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD83A[\\uDC00-\\uDCC4]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1]|\\uD87E[\\uDC00-\\uDE1D]/\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst UnicodeCategories = UnicodeCategories$1;\nconst common$j = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// General stuff\n\nclass PExpr$1 {\n constructor() {\n if (this.constructor === PExpr$1) {\n throw new Error(\"PExpr cannot be instantiated -- it's abstract\");\n }\n }\n\n // Set the `source` property to the interval containing the source for this expression.\n withSource(interval) {\n if (interval) {\n this.source = interval.trimmed();\n }\n return this;\n }\n}\n\n// Any\n\nconst any = Object.create(PExpr$1.prototype);\n\n// End\n\nconst end = Object.create(PExpr$1.prototype);\n\n// Terminals\n\nclass Terminal$1 extends PExpr$1 {\n constructor(obj) {\n super();\n this.obj = obj;\n }\n}\n\n// Ranges\n\nclass Range extends PExpr$1 {\n constructor(from, to) {\n super();\n this.from = from;\n this.to = to;\n // If either `from` or `to` is made up of multiple code units, then\n // the range should consume a full code point, not a single code unit.\n this.matchCodePoint = from.length > 1 || to.length > 1;\n }\n}\n\n// Parameters\n\nclass Param extends PExpr$1 {\n constructor(index) {\n super();\n this.index = index;\n }\n}\n\n// Alternation\n\nclass Alt extends PExpr$1 {\n constructor(terms) {\n super();\n this.terms = terms;\n }\n}\n\n// Extend is an implementation detail of rule extension\n\nclass Extend extends Alt {\n constructor(superGrammar, name, body) {\n const origBody = superGrammar.rules[name].body;\n super([body, origBody]);\n\n this.superGrammar = superGrammar;\n this.name = name;\n this.body = body;\n }\n}\n\n// Splice is an implementation detail of rule overriding with the `...` operator.\nclass Splice extends Alt {\n constructor(superGrammar, ruleName, beforeTerms, afterTerms) {\n const origBody = superGrammar.rules[ruleName].body;\n super([...beforeTerms, origBody, ...afterTerms]);\n\n this.superGrammar = superGrammar;\n this.ruleName = ruleName;\n this.expansionPos = beforeTerms.length;\n }\n}\n\n// Sequences\n\nclass Seq extends PExpr$1 {\n constructor(factors) {\n super();\n this.factors = factors;\n }\n}\n\n// Iterators and optionals\n\nclass Iter extends PExpr$1 {\n constructor(expr) {\n super();\n this.expr = expr;\n }\n}\n\nclass Star extends Iter {}\nclass Plus extends Iter {}\nclass Opt extends Iter {}\n\nStar.prototype.operator = '*';\nPlus.prototype.operator = '+';\nOpt.prototype.operator = '?';\n\nStar.prototype.minNumMatches = 0;\nPlus.prototype.minNumMatches = 1;\nOpt.prototype.minNumMatches = 0;\n\nStar.prototype.maxNumMatches = Number.POSITIVE_INFINITY;\nPlus.prototype.maxNumMatches = Number.POSITIVE_INFINITY;\nOpt.prototype.maxNumMatches = 1;\n\n// Predicates\n\nclass Not extends PExpr$1 {\n constructor(expr) {\n super();\n this.expr = expr;\n }\n}\n\nclass Lookahead extends PExpr$1 {\n constructor(expr) {\n super();\n this.expr = expr;\n }\n}\n\n// \"Lexification\"\n\nclass Lex extends PExpr$1 {\n constructor(expr) {\n super();\n this.expr = expr;\n }\n}\n\n// Rule application\n\nclass Apply extends PExpr$1 {\n constructor(ruleName, args = []) {\n super();\n this.ruleName = ruleName;\n this.args = args;\n }\n\n isSyntactic() {\n return common$j.isSyntactic(this.ruleName);\n }\n\n // This method just caches the result of `this.toString()` in a non-enumerable property.\n toMemoKey() {\n if (!this._memoKey) {\n Object.defineProperty(this, '_memoKey', {value: this.toString()});\n }\n return this._memoKey;\n }\n}\n\n// Unicode character\n\nclass UnicodeChar extends PExpr$1 {\n constructor(category) {\n super();\n this.category = category;\n this.pattern = UnicodeCategories[category];\n }\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\npexprsMain.PExpr = PExpr$1;\npexprsMain.any = any;\npexprsMain.end = end;\npexprsMain.Terminal = Terminal$1;\npexprsMain.Range = Range;\npexprsMain.Param = Param;\npexprsMain.Alt = Alt;\npexprsMain.Extend = Extend;\npexprsMain.Splice = Splice;\npexprsMain.Seq = Seq;\npexprsMain.Iter = Iter;\npexprsMain.Star = Star;\npexprsMain.Plus = Plus;\npexprsMain.Opt = Opt;\npexprsMain.Not = Not;\npexprsMain.Lookahead = Lookahead;\npexprsMain.Lex = Lex;\npexprsMain.Apply = Apply;\npexprsMain.UnicodeChar = UnicodeChar;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$i = common$l;\nconst pexprs$l = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Return true if we should skip spaces preceding this expression in a syntactic context.\n*/\npexprs$l.PExpr.prototype.allowsSkippingPrecedingSpace = common$i.abstract(\n 'allowsSkippingPrecedingSpace'\n);\n\n/*\n Generally, these are all first-order expressions and (with the exception of Apply)\n directly read from the input stream.\n*/\npexprs$l.any.allowsSkippingPrecedingSpace =\n pexprs$l.end.allowsSkippingPrecedingSpace =\n pexprs$l.Apply.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Terminal.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Range.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.UnicodeChar.prototype.allowsSkippingPrecedingSpace =\n function() {\n return true;\n };\n\n/*\n Higher-order expressions that don't directly consume input.\n*/\npexprs$l.Alt.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Iter.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Lex.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Lookahead.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Not.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Param.prototype.allowsSkippingPrecedingSpace =\n pexprs$l.Seq.prototype.allowsSkippingPrecedingSpace =\n function() {\n return false;\n };\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction Namespace$2() {}\nNamespace$2.prototype = Object.create(null);\n\nNamespace$2.asNamespace = function(objOrNamespace) {\n if (objOrNamespace instanceof Namespace$2) {\n return objOrNamespace;\n }\n return Namespace$2.createNamespace(objOrNamespace);\n};\n\n// Create a new namespace. If `optProps` is specified, all of its properties\n// will be copied to the new namespace.\nNamespace$2.createNamespace = function(optProps) {\n return Namespace$2.extend(Namespace$2.prototype, optProps);\n};\n\n// Create a new namespace which extends another namespace. If `optProps` is\n// specified, all of its properties will be copied to the new namespace.\nNamespace$2.extend = function(namespace, optProps) {\n if (namespace !== Namespace$2.prototype && !(namespace instanceof Namespace$2)) {\n throw new TypeError('not a Namespace object: ' + namespace);\n }\n const ns = Object.create(namespace, {\n constructor: {\n value: Namespace$2,\n enumerable: false,\n writable: true,\n configurable: true,\n },\n });\n return Object.assign(ns, optProps);\n};\n\n// TODO: Should this be a regular method?\nNamespace$2.toString = function(ns) {\n return Object.prototype.toString.call(ns);\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Namespace_1 = Namespace$2;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst {assert: assert$3} = common$l;\nconst Namespace$1 = Namespace_1;\nconst pexprs$k = pexprsMain;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction createError(message, optInterval) {\n let e;\n if (optInterval) {\n e = new Error(optInterval.getLineAndColumnMessage() + message);\n e.shortMessage = message;\n e.interval = optInterval;\n } else {\n e = new Error(message);\n }\n return e;\n}\n\n// ----------------- errors about intervals -----------------\n\nfunction intervalSourcesDontMatch() {\n return createError(\"Interval sources don't match\");\n}\n\n// ----------------- errors about grammars -----------------\n\n// Grammar syntax error\n\nfunction grammarSyntaxError(matchFailure) {\n const e = new Error();\n Object.defineProperty(e, 'message', {\n enumerable: true,\n get() {\n return matchFailure.message;\n },\n });\n Object.defineProperty(e, 'shortMessage', {\n enumerable: true,\n get() {\n return 'Expected ' + matchFailure.getExpectedText();\n },\n });\n e.interval = matchFailure.getInterval();\n return e;\n}\n\n// Undeclared grammar\n\nfunction undeclaredGrammar(grammarName, namespace, interval) {\n const message = namespace ?\n 'Grammar ' +\n grammarName +\n ' is not declared in namespace ' +\n Namespace$1.toString(namespace) :\n 'Undeclared grammar ' + grammarName;\n return createError(message, interval);\n}\n\n// Duplicate grammar declaration\n\nfunction duplicateGrammarDeclaration(grammar, namespace) {\n return createError('Grammar ' + grammar.name + ' is already declared in this namespace');\n}\n\n// ----------------- rules -----------------\n\n// Undeclared rule\n\nfunction undeclaredRule(ruleName, grammarName, optInterval) {\n return createError(\n 'Rule ' + ruleName + ' is not declared in grammar ' + grammarName,\n optInterval\n );\n}\n\n// Cannot override undeclared rule\n\nfunction cannotOverrideUndeclaredRule(ruleName, grammarName, optSource) {\n return createError(\n 'Cannot override rule ' + ruleName + ' because it is not declared in ' + grammarName,\n optSource\n );\n}\n\n// Cannot extend undeclared rule\n\nfunction cannotExtendUndeclaredRule(ruleName, grammarName, optSource) {\n return createError(\n 'Cannot extend rule ' + ruleName + ' because it is not declared in ' + grammarName,\n optSource\n );\n}\n\n// Duplicate rule declaration\n\nfunction duplicateRuleDeclaration(ruleName, grammarName, declGrammarName, optSource) {\n let message =\n \"Duplicate declaration for rule '\" + ruleName + \"' in grammar '\" + grammarName + \"'\";\n if (grammarName !== declGrammarName) {\n message += \" (originally declared in '\" + declGrammarName + \"')\";\n }\n return createError(message, optSource);\n}\n\n// Wrong number of parameters\n\nfunction wrongNumberOfParameters(ruleName, expected, actual, source) {\n return createError(\n 'Wrong number of parameters for rule ' +\n ruleName +\n ' (expected ' +\n expected +\n ', got ' +\n actual +\n ')',\n source\n );\n}\n\n// Wrong number of arguments\n\nfunction wrongNumberOfArguments(ruleName, expected, actual, expr) {\n return createError(\n 'Wrong number of arguments for rule ' +\n ruleName +\n ' (expected ' +\n expected +\n ', got ' +\n actual +\n ')',\n expr\n );\n}\n\n// Duplicate parameter names\n\nfunction duplicateParameterNames(ruleName, duplicates, source) {\n return createError(\n 'Duplicate parameter names in rule ' + ruleName + ': ' + duplicates.join(', '),\n source\n );\n}\n\n// Invalid parameter expression\n\nfunction invalidParameter(ruleName, expr) {\n return createError(\n 'Invalid parameter to rule ' +\n ruleName +\n ': ' +\n expr +\n ' has arity ' +\n expr.getArity() +\n ', but parameter expressions must have arity 1',\n expr.source\n );\n}\n\n// Application of syntactic rule from lexical rule\n\nconst syntacticVsLexicalNote =\n 'NOTE: A _syntactic rule_ is a rule whose name begins with a capital letter. ' +\n 'See https://ohmjs.org/d/svl for more details.';\n\nfunction applicationOfSyntacticRuleFromLexicalContext(ruleName, applyExpr) {\n return createError(\n 'Cannot apply syntactic rule ' + ruleName + ' from here (inside a lexical context)',\n applyExpr.source\n );\n}\n\n// Lexical rule application used with applySyntactic\n\nfunction applySyntacticWithLexicalRuleApplication(applyExpr) {\n const {ruleName} = applyExpr;\n return createError(\n `applySyntactic is for syntactic rules, but '${ruleName}' is a lexical rule. ` +\n syntacticVsLexicalNote,\n applyExpr.source\n );\n}\n\n// Application of applySyntactic in a syntactic context\n\nfunction unnecessaryExperimentalApplySyntactic(applyExpr) {\n return createError(\n 'applySyntactic is not required here (in a syntactic context)',\n applyExpr.source\n );\n}\n\n// Incorrect argument type\n\nfunction incorrectArgumentType(expectedType, expr) {\n return createError('Incorrect argument type: expected ' + expectedType, expr.source);\n}\n\n// Multiple instances of the super-splice operator (`...`) in the rule body.\n\nfunction multipleSuperSplices(expr) {\n return createError(\"'...' can appear at most once in a rule body\", expr.source);\n}\n\n// Unicode code point escapes\n\nfunction invalidCodePoint(applyWrapper) {\n const node = applyWrapper._node;\n assert$3(node && node.isNonterminal() && node.ctorName === 'escapeChar_unicodeCodePoint');\n\n // Get an interval that covers all of the hex digits.\n const digitIntervals = applyWrapper.children.slice(1, -1).map(d => d.source);\n const fullInterval = digitIntervals[0].coverageWith(...digitIntervals.slice(1));\n return createError(\n `U+${fullInterval.contents} is not a valid Unicode code point`,\n fullInterval\n );\n}\n\n// ----------------- Kleene operators -----------------\n\nfunction kleeneExprHasNullableOperand(kleeneExpr, applicationStack) {\n const actuals =\n applicationStack.length > 0 ? applicationStack[applicationStack.length - 1].args : [];\n const expr = kleeneExpr.expr.substituteParams(actuals);\n let message =\n 'Nullable expression ' +\n expr +\n \" is not allowed inside '\" +\n kleeneExpr.operator +\n \"' (possible infinite loop)\";\n if (applicationStack.length > 0) {\n const stackTrace = applicationStack\n .map(app => new pexprs$k.Apply(app.ruleName, app.args))\n .join('\\n');\n message += '\\nApplication stack (most recent application last):\\n' + stackTrace;\n }\n return createError(message, kleeneExpr.expr.source);\n}\n\n// ----------------- arity -----------------\n\nfunction inconsistentArity(ruleName, expected, actual, expr) {\n return createError(\n 'Rule ' +\n ruleName +\n ' involves an alternation which has inconsistent arity ' +\n '(expected ' +\n expected +\n ', got ' +\n actual +\n ')',\n expr.source\n );\n}\n\n// ----------------- properties -----------------\n\nfunction duplicatePropertyNames(duplicates) {\n return createError('Object pattern has duplicate property names: ' + duplicates.join(', '));\n}\n\n// ----------------- constructors -----------------\n\nfunction invalidConstructorCall(grammar, ctorName, children) {\n return createError(\n 'Attempt to invoke constructor ' + ctorName + ' with invalid or unexpected arguments'\n );\n}\n\n// ----------------- convenience -----------------\n\nfunction multipleErrors(errors) {\n const messages = errors.map(e => e.message);\n return createError(['Errors:'].concat(messages).join('\\n- '), errors[0].interval);\n}\n\n// ----------------- semantic -----------------\n\nfunction missingSemanticAction(ctorName, name, type, stack) {\n let stackTrace = stack\n .slice(0, -1)\n .map(info => {\n const ans = ' ' + info[0].name + ' > ' + info[1];\n return info.length === 3 ? ans + \" for '\" + info[2] + \"'\" : ans;\n })\n .join('\\n');\n stackTrace += '\\n ' + name + ' > ' + ctorName;\n\n let moreInfo = '';\n if (ctorName === '_iter') {\n moreInfo = [\n '\\nNOTE: as of Ohm v16, there is no default action for iteration nodes — see ',\n ' https://ohmjs.org/d/dsa for details.',\n ].join('\\n');\n }\n\n const message = [\n `Missing semantic action for '${ctorName}' in ${type} '${name}'.${moreInfo}`,\n 'Action stack (most recent call last):',\n stackTrace,\n ].join('\\n');\n\n const e = createError(message);\n e.name = 'missingSemanticAction';\n return e;\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar errors$9 = {\n applicationOfSyntacticRuleFromLexicalContext,\n applySyntacticWithLexicalRuleApplication,\n cannotExtendUndeclaredRule,\n cannotOverrideUndeclaredRule,\n duplicateGrammarDeclaration,\n duplicateParameterNames,\n duplicatePropertyNames,\n duplicateRuleDeclaration,\n inconsistentArity,\n incorrectArgumentType,\n intervalSourcesDontMatch,\n invalidCodePoint,\n invalidConstructorCall,\n invalidParameter,\n grammarSyntaxError,\n kleeneExprHasNullableOperand,\n missingSemanticAction,\n multipleSuperSplices,\n undeclaredGrammar,\n undeclaredRule,\n unnecessaryExperimentalApplySyntactic,\n wrongNumberOfArguments,\n wrongNumberOfParameters,\n\n throwErrors(errors) {\n if (errors.length === 1) {\n throw errors[0];\n }\n if (errors.length > 1) {\n throw multipleErrors(errors);\n }\n },\n};\n\nvar util$7 = {};\n\n(function (exports) {\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// Given an array of numbers `arr`, return an array of the numbers as strings,\n// right-justified and padded to the same length.\nfunction padNumbersToEqualLength(arr) {\n let maxLen = 0;\n const strings = arr.map(n => {\n const str = n.toString();\n maxLen = Math.max(maxLen, str.length);\n return str;\n });\n return strings.map(s => common.padLeft(s, maxLen));\n}\n\n// Produce a new string that would be the result of copying the contents\n// of the string `src` onto `dest` at offset `offest`.\nfunction strcpy(dest, src, offset) {\n const origDestLen = dest.length;\n const start = dest.slice(0, offset);\n const end = dest.slice(offset + src.length);\n return (start + src + end).substr(0, origDestLen);\n}\n\n// Casts the underlying lineAndCol object to a formatted message string,\n// highlighting `ranges`.\nfunction lineAndColumnToMessage(...ranges) {\n const lineAndCol = this;\n const {offset} = lineAndCol;\n const {repeatStr} = common;\n\n const sb = new common.StringBuffer();\n sb.append('Line ' + lineAndCol.lineNum + ', col ' + lineAndCol.colNum + ':\\n');\n\n // An array of the previous, current, and next line numbers as strings of equal length.\n const lineNumbers = padNumbersToEqualLength([\n lineAndCol.prevLine == null ? 0 : lineAndCol.lineNum - 1,\n lineAndCol.lineNum,\n lineAndCol.nextLine == null ? 0 : lineAndCol.lineNum + 1,\n ]);\n\n // Helper for appending formatting input lines to the buffer.\n const appendLine = (num, content, prefix) => {\n sb.append(prefix + lineNumbers[num] + ' | ' + content + '\\n');\n };\n\n // Include the previous line for context if possible.\n if (lineAndCol.prevLine != null) {\n appendLine(0, lineAndCol.prevLine, ' ');\n }\n // Line that the error occurred on.\n appendLine(1, lineAndCol.line, '> ');\n\n // Build up the line that points to the offset and possible indicates one or more ranges.\n // Start with a blank line, and indicate each range by overlaying a string of `~` chars.\n const lineLen = lineAndCol.line.length;\n let indicationLine = repeatStr(' ', lineLen + 1);\n for (let i = 0; i < ranges.length; ++i) {\n let startIdx = ranges[i][0];\n let endIdx = ranges[i][1];\n common.assert(startIdx >= 0 && startIdx <= endIdx, 'range start must be >= 0 and <= end');\n\n const lineStartOffset = offset - lineAndCol.colNum + 1;\n startIdx = Math.max(0, startIdx - lineStartOffset);\n endIdx = Math.min(endIdx - lineStartOffset, lineLen);\n\n indicationLine = strcpy(indicationLine, repeatStr('~', endIdx - startIdx), startIdx);\n }\n const gutterWidth = 2 + lineNumbers[1].length + 3;\n sb.append(repeatStr(' ', gutterWidth));\n indicationLine = strcpy(indicationLine, '^', lineAndCol.colNum - 1);\n sb.append(indicationLine.replace(/ +$/, '') + '\\n');\n\n // Include the next line for context if possible.\n if (lineAndCol.nextLine != null) {\n appendLine(2, lineAndCol.nextLine, ' ');\n }\n return sb.contents();\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nlet builtInRulesCallbacks = [];\n\n// Since Grammar.BuiltInRules is bootstrapped, most of Ohm can't directly depend it.\n// This function allows modules that do depend on the built-in rules to register a callback\n// that will be called later in the initialization process.\nexports.awaitBuiltInRules = cb => {\n builtInRulesCallbacks.push(cb);\n};\n\nexports.announceBuiltInRules = grammar => {\n builtInRulesCallbacks.forEach(cb => {\n cb(grammar);\n });\n builtInRulesCallbacks = null;\n};\n\n// Return an object with the line and column information for the given\n// offset in `str`.\nexports.getLineAndColumn = (str, offset) => {\n let lineNum = 1;\n let colNum = 1;\n\n let currOffset = 0;\n let lineStartOffset = 0;\n\n let nextLine = null;\n let prevLine = null;\n let prevLineStartOffset = -1;\n\n while (currOffset < offset) {\n const c = str.charAt(currOffset++);\n if (c === '\\n') {\n lineNum++;\n colNum = 1;\n prevLineStartOffset = lineStartOffset;\n lineStartOffset = currOffset;\n } else if (c !== '\\r') {\n colNum++;\n }\n }\n\n // Find the end of the target line.\n let lineEndOffset = str.indexOf('\\n', lineStartOffset);\n if (lineEndOffset === -1) {\n lineEndOffset = str.length;\n } else {\n // Get the next line.\n const nextLineEndOffset = str.indexOf('\\n', lineEndOffset + 1);\n nextLine =\n nextLineEndOffset === -1 ?\n str.slice(lineEndOffset) :\n str.slice(lineEndOffset, nextLineEndOffset);\n // Strip leading and trailing EOL char(s).\n nextLine = nextLine.replace(/^\\r?\\n/, '').replace(/\\r$/, '');\n }\n\n // Get the previous line.\n if (prevLineStartOffset >= 0) {\n // Strip trailing EOL char(s).\n prevLine = str.slice(prevLineStartOffset, lineStartOffset).replace(/\\r?\\n$/, '');\n }\n\n // Get the target line, stripping a trailing carriage return if necessary.\n const line = str.slice(lineStartOffset, lineEndOffset).replace(/\\r$/, '');\n\n return {\n offset,\n lineNum,\n colNum,\n line,\n prevLine,\n nextLine,\n toString: lineAndColumnToMessage,\n };\n};\n\n// Return a nicely-formatted string describing the line and column for the\n// given offset in `str` highlighting `ranges`.\nexports.getLineAndColumnMessage = function(str, offset, ...ranges) {\n return exports.getLineAndColumn(str, offset).toString(...ranges);\n};\n\nexports.uniqueId = (() => {\n let idCounter = 0;\n return prefix => '' + prefix + idCounter++;\n})();\n}(util$7));\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst {abstract, isSyntactic} = common$l;\nconst errors$8 = errors$9;\nconst pexprs$j = pexprsMain;\nconst util$6 = util$7;\n\nlet BuiltInRules;\n\nutil$6.awaitBuiltInRules(g => {\n BuiltInRules = g;\n});\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\nlet lexifyCount;\n\npexprs$j.PExpr.prototype.assertAllApplicationsAreValid = function(ruleName, grammar) {\n lexifyCount = 0;\n this._assertAllApplicationsAreValid(ruleName, grammar);\n};\n\npexprs$j.PExpr.prototype._assertAllApplicationsAreValid = abstract(\n '_assertAllApplicationsAreValid'\n);\n\npexprs$j.any._assertAllApplicationsAreValid =\n pexprs$j.end._assertAllApplicationsAreValid =\n pexprs$j.Terminal.prototype._assertAllApplicationsAreValid =\n pexprs$j.Range.prototype._assertAllApplicationsAreValid =\n pexprs$j.Param.prototype._assertAllApplicationsAreValid =\n pexprs$j.UnicodeChar.prototype._assertAllApplicationsAreValid =\n function(ruleName, grammar) {\n // no-op\n };\n\npexprs$j.Lex.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) {\n lexifyCount++;\n this.expr._assertAllApplicationsAreValid(ruleName, grammar);\n lexifyCount--;\n};\n\npexprs$j.Alt.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) {\n for (let idx = 0; idx < this.terms.length; idx++) {\n this.terms[idx]._assertAllApplicationsAreValid(ruleName, grammar);\n }\n};\n\npexprs$j.Seq.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) {\n for (let idx = 0; idx < this.factors.length; idx++) {\n this.factors[idx]._assertAllApplicationsAreValid(ruleName, grammar);\n }\n};\n\npexprs$j.Iter.prototype._assertAllApplicationsAreValid =\n pexprs$j.Not.prototype._assertAllApplicationsAreValid =\n pexprs$j.Lookahead.prototype._assertAllApplicationsAreValid =\n function(ruleName, grammar) {\n this.expr._assertAllApplicationsAreValid(ruleName, grammar);\n };\n\npexprs$j.Apply.prototype._assertAllApplicationsAreValid = function(\n ruleName,\n grammar,\n skipSyntacticCheck = false\n) {\n const ruleInfo = grammar.rules[this.ruleName];\n const isContextSyntactic = isSyntactic(ruleName) && lexifyCount === 0;\n\n // Make sure that the rule exists...\n if (!ruleInfo) {\n throw errors$8.undeclaredRule(this.ruleName, grammar.name, this.source);\n }\n\n // ...and that this application is allowed\n if (!skipSyntacticCheck && isSyntactic(this.ruleName) && !isContextSyntactic) {\n throw errors$8.applicationOfSyntacticRuleFromLexicalContext(this.ruleName, this);\n }\n\n // ...and that this application has the correct number of arguments.\n const actual = this.args.length;\n const expected = ruleInfo.formals.length;\n if (actual !== expected) {\n throw errors$8.wrongNumberOfArguments(this.ruleName, expected, actual, this.source);\n }\n\n const isBuiltInApplySyntactic =\n BuiltInRules && ruleInfo === BuiltInRules.rules.applySyntactic;\n const isBuiltInCaseInsensitive =\n BuiltInRules && ruleInfo === BuiltInRules.rules.caseInsensitive;\n\n // If it's an application of 'caseInsensitive', ensure that the argument is a Terminal.\n if (isBuiltInCaseInsensitive) {\n if (!(this.args[0] instanceof pexprs$j.Terminal)) {\n throw errors$8.incorrectArgumentType('a Terminal (e.g. \"abc\")', this.args[0]);\n }\n }\n\n if (isBuiltInApplySyntactic) {\n const arg = this.args[0];\n if (!(arg instanceof pexprs$j.Apply)) {\n throw errors$8.incorrectArgumentType('a syntactic rule application', arg);\n }\n if (!isSyntactic(arg.ruleName)) {\n throw errors$8.applySyntacticWithLexicalRuleApplication(arg);\n }\n if (isContextSyntactic) {\n throw errors$8.unnecessaryExperimentalApplySyntactic(this);\n }\n }\n\n // ...and that all of the argument expressions only have valid applications and have arity 1.\n // If `this` is an application of the built-in applySyntactic rule, then its arg is\n // allowed (and expected) to be a syntactic rule, even if we're in a lexical context.\n this.args.forEach(arg => {\n arg._assertAllApplicationsAreValid(ruleName, grammar, isBuiltInApplySyntactic);\n if (arg.getArity() !== 1) {\n throw errors$8.invalidParameter(this.ruleName, arg);\n }\n });\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$h = common$l;\nconst errors$7 = errors$9;\nconst pexprs$i = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$i.PExpr.prototype.assertChoicesHaveUniformArity = common$h.abstract(\n 'assertChoicesHaveUniformArity'\n);\n\npexprs$i.any.assertChoicesHaveUniformArity =\n pexprs$i.end.assertChoicesHaveUniformArity =\n pexprs$i.Terminal.prototype.assertChoicesHaveUniformArity =\n pexprs$i.Range.prototype.assertChoicesHaveUniformArity =\n pexprs$i.Param.prototype.assertChoicesHaveUniformArity =\n pexprs$i.Lex.prototype.assertChoicesHaveUniformArity =\n pexprs$i.UnicodeChar.prototype.assertChoicesHaveUniformArity =\n function(ruleName) {\n // no-op\n };\n\npexprs$i.Alt.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n if (this.terms.length === 0) {\n return;\n }\n const arity = this.terms[0].getArity();\n for (let idx = 0; idx < this.terms.length; idx++) {\n const term = this.terms[idx];\n term.assertChoicesHaveUniformArity();\n const otherArity = term.getArity();\n if (arity !== otherArity) {\n throw errors$7.inconsistentArity(ruleName, arity, otherArity, term);\n }\n }\n};\n\npexprs$i.Extend.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n // Extend is a special case of Alt that's guaranteed to have exactly two\n // cases: [extensions, origBody].\n const actualArity = this.terms[0].getArity();\n const expectedArity = this.terms[1].getArity();\n if (actualArity !== expectedArity) {\n throw errors$7.inconsistentArity(ruleName, expectedArity, actualArity, this.terms[0]);\n }\n};\n\npexprs$i.Seq.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n for (let idx = 0; idx < this.factors.length; idx++) {\n this.factors[idx].assertChoicesHaveUniformArity(ruleName);\n }\n};\n\npexprs$i.Iter.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n this.expr.assertChoicesHaveUniformArity(ruleName);\n};\n\npexprs$i.Not.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n // no-op (not required b/c the nested expr doesn't show up in the CST)\n};\n\npexprs$i.Lookahead.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n this.expr.assertChoicesHaveUniformArity(ruleName);\n};\n\npexprs$i.Apply.prototype.assertChoicesHaveUniformArity = function(ruleName) {\n // The arities of the parameter expressions is required to be 1 by\n // `assertAllApplicationsAreValid()`.\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$g = common$l;\nconst errors$6 = errors$9;\nconst pexprs$h = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$h.PExpr.prototype.assertIteratedExprsAreNotNullable = common$g.abstract(\n 'assertIteratedExprsAreNotNullable'\n);\n\npexprs$h.any.assertIteratedExprsAreNotNullable =\n pexprs$h.end.assertIteratedExprsAreNotNullable =\n pexprs$h.Terminal.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Range.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Param.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.UnicodeChar.prototype.assertIteratedExprsAreNotNullable =\n function(grammar) {\n // no-op\n };\n\npexprs$h.Alt.prototype.assertIteratedExprsAreNotNullable = function(grammar) {\n for (let idx = 0; idx < this.terms.length; idx++) {\n this.terms[idx].assertIteratedExprsAreNotNullable(grammar);\n }\n};\n\npexprs$h.Seq.prototype.assertIteratedExprsAreNotNullable = function(grammar) {\n for (let idx = 0; idx < this.factors.length; idx++) {\n this.factors[idx].assertIteratedExprsAreNotNullable(grammar);\n }\n};\n\npexprs$h.Iter.prototype.assertIteratedExprsAreNotNullable = function(grammar) {\n // Note: this is the implementation of this method for `Star` and `Plus` expressions.\n // It is overridden for `Opt` below.\n this.expr.assertIteratedExprsAreNotNullable(grammar);\n if (this.expr.isNullable(grammar)) {\n throw errors$6.kleeneExprHasNullableOperand(this, []);\n }\n};\n\npexprs$h.Opt.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Not.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Lookahead.prototype.assertIteratedExprsAreNotNullable =\n pexprs$h.Lex.prototype.assertIteratedExprsAreNotNullable =\n function(grammar) {\n this.expr.assertIteratedExprsAreNotNullable(grammar);\n };\n\npexprs$h.Apply.prototype.assertIteratedExprsAreNotNullable = function(grammar) {\n this.args.forEach(arg => {\n arg.assertIteratedExprsAreNotNullable(grammar);\n });\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst {assert: assert$2} = common$l;\nconst errors$5 = errors$9;\nconst util$5 = util$7;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction Interval$3(sourceString, startIdx, endIdx) {\n this.sourceString = sourceString;\n this.startIdx = startIdx;\n this.endIdx = endIdx;\n}\n\nInterval$3.coverage = function(firstInterval, ...intervals) {\n let {startIdx, endIdx} = firstInterval;\n for (const interval of intervals) {\n if (interval.sourceString !== firstInterval.sourceString) {\n throw errors$5.intervalSourcesDontMatch();\n } else {\n startIdx = Math.min(startIdx, interval.startIdx);\n endIdx = Math.max(endIdx, interval.endIdx);\n }\n }\n return new Interval$3(firstInterval.sourceString, startIdx, endIdx);\n};\n\nInterval$3.prototype = {\n coverageWith(...intervals) {\n return Interval$3.coverage(...intervals, this);\n },\n\n collapsedLeft() {\n return new Interval$3(this.sourceString, this.startIdx, this.startIdx);\n },\n\n collapsedRight() {\n return new Interval$3(this.sourceString, this.endIdx, this.endIdx);\n },\n\n getLineAndColumn() {\n return util$5.getLineAndColumn(this.sourceString, this.startIdx);\n },\n\n getLineAndColumnMessage() {\n const range = [this.startIdx, this.endIdx];\n return util$5.getLineAndColumnMessage(this.sourceString, this.startIdx, range);\n },\n\n // Returns an array of 0, 1, or 2 intervals that represents the result of the\n // interval difference operation.\n minus(that) {\n if (this.sourceString !== that.sourceString) {\n throw errors$5.intervalSourcesDontMatch();\n } else if (this.startIdx === that.startIdx && this.endIdx === that.endIdx) {\n // `this` and `that` are the same interval!\n return [];\n } else if (this.startIdx < that.startIdx && that.endIdx < this.endIdx) {\n // `that` splits `this` into two intervals\n return [\n new Interval$3(this.sourceString, this.startIdx, that.startIdx),\n new Interval$3(this.sourceString, that.endIdx, this.endIdx),\n ];\n } else if (this.startIdx < that.endIdx && that.endIdx < this.endIdx) {\n // `that` contains a prefix of `this`\n return [new Interval$3(this.sourceString, that.endIdx, this.endIdx)];\n } else if (this.startIdx < that.startIdx && that.startIdx < this.endIdx) {\n // `that` contains a suffix of `this`\n return [new Interval$3(this.sourceString, this.startIdx, that.startIdx)];\n } else {\n // `that` and `this` do not overlap\n return [this];\n }\n },\n\n // Returns a new Interval that has the same extent as this one, but which is relative\n // to `that`, an Interval that fully covers this one.\n relativeTo(that) {\n if (this.sourceString !== that.sourceString) {\n throw errors$5.intervalSourcesDontMatch();\n }\n assert$2(\n this.startIdx >= that.startIdx && this.endIdx <= that.endIdx,\n 'other interval does not cover this one'\n );\n return new Interval$3(\n this.sourceString,\n this.startIdx - that.startIdx,\n this.endIdx - that.startIdx\n );\n },\n\n // Returns a new Interval which contains the same contents as this one,\n // but with whitespace trimmed from both ends.\n trimmed() {\n const {contents} = this;\n const startIdx = this.startIdx + contents.match(/^\\s*/)[0].length;\n const endIdx = this.endIdx - contents.match(/\\s*$/)[0].length;\n return new Interval$3(this.sourceString, startIdx, endIdx);\n },\n\n subInterval(offset, len) {\n const newStartIdx = this.startIdx + offset;\n return new Interval$3(this.sourceString, newStartIdx, newStartIdx + len);\n },\n};\n\nObject.defineProperties(Interval$3.prototype, {\n contents: {\n get() {\n if (this._contents === undefined) {\n this._contents = this.sourceString.slice(this.startIdx, this.endIdx);\n }\n return this._contents;\n },\n enumerable: true,\n },\n length: {\n get() {\n return this.endIdx - this.startIdx;\n },\n enumerable: true,\n },\n});\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Interval_1 = Interval$3;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Interval$2 = Interval_1;\nconst common$f = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// Unicode characters that are used in the `toString` output.\nconst BALLOT_X = '\\u2717';\nconst CHECK_MARK = '\\u2713';\nconst DOT_OPERATOR = '\\u22C5';\nconst RIGHTWARDS_DOUBLE_ARROW = '\\u21D2';\nconst SYMBOL_FOR_HORIZONTAL_TABULATION = '\\u2409';\nconst SYMBOL_FOR_LINE_FEED = '\\u240A';\nconst SYMBOL_FOR_CARRIAGE_RETURN = '\\u240D';\n\nconst Flags = {\n succeeded: 1 << 0,\n isRootNode: 1 << 1,\n isImplicitSpaces: 1 << 2,\n isMemoized: 1 << 3,\n isHeadOfLeftRecursion: 1 << 4,\n terminatesLR: 1 << 5,\n};\n\nfunction spaces(n) {\n return common$f.repeat(' ', n).join('');\n}\n\n// Return a string representation of a portion of `input` at offset `pos`.\n// The result will contain exactly `len` characters.\nfunction getInputExcerpt(input, pos, len) {\n const excerpt = asEscapedString(input.slice(pos, pos + len));\n\n // Pad the output if necessary.\n if (excerpt.length < len) {\n return excerpt + common$f.repeat(' ', len - excerpt.length).join('');\n }\n return excerpt;\n}\n\nfunction asEscapedString(obj) {\n if (typeof obj === 'string') {\n // Replace non-printable characters with visible symbols.\n return obj\n .replace(/ /g, DOT_OPERATOR)\n .replace(/\\t/g, SYMBOL_FOR_HORIZONTAL_TABULATION)\n .replace(/\\n/g, SYMBOL_FOR_LINE_FEED)\n .replace(/\\r/g, SYMBOL_FOR_CARRIAGE_RETURN);\n }\n return String(obj);\n}\n\n// ----------------- Trace -----------------\n\nfunction Trace$2(input, pos1, pos2, expr, succeeded, bindings, optChildren) {\n this.input = input;\n this.pos = this.pos1 = pos1;\n this.pos2 = pos2;\n this.source = new Interval$2(input, pos1, pos2);\n this.expr = expr;\n this.bindings = bindings;\n this.children = optChildren || [];\n this.terminatingLREntry = null;\n\n this._flags = succeeded ? Flags.succeeded : 0;\n}\n\n// A value that can be returned from visitor functions to indicate that a\n// node should not be recursed into.\nTrace$2.prototype.SKIP = {};\n\nObject.defineProperty(Trace$2.prototype, 'displayString', {\n get() {\n return this.expr.toDisplayString();\n },\n});\n\n// For convenience, create a getter and setter for the boolean flags in `Flags`.\nObject.keys(Flags).forEach(name => {\n const mask = Flags[name];\n Object.defineProperty(Trace$2.prototype, name, {\n get() {\n return (this._flags & mask) !== 0;\n },\n set(val) {\n if (val) {\n this._flags |= mask;\n } else {\n this._flags &= ~mask;\n }\n },\n });\n});\n\nTrace$2.prototype.clone = function() {\n return this.cloneWithExpr(this.expr);\n};\n\nTrace$2.prototype.cloneWithExpr = function(expr) {\n const ans = new Trace$2(\n this.input,\n this.pos,\n this.pos2,\n expr,\n this.succeeded,\n this.bindings,\n this.children\n );\n\n ans.isHeadOfLeftRecursion = this.isHeadOfLeftRecursion;\n ans.isImplicitSpaces = this.isImplicitSpaces;\n ans.isMemoized = this.isMemoized;\n ans.isRootNode = this.isRootNode;\n ans.terminatesLR = this.terminatesLR;\n ans.terminatingLREntry = this.terminatingLREntry;\n return ans;\n};\n\n// Record the trace information for the terminating condition of the LR loop.\nTrace$2.prototype.recordLRTermination = function(ruleBodyTrace, value) {\n this.terminatingLREntry = new Trace$2(\n this.input,\n this.pos,\n this.pos2,\n this.expr,\n false,\n [value],\n [ruleBodyTrace]\n );\n this.terminatingLREntry.terminatesLR = true;\n};\n\n// Recursively traverse this trace node and all its descendents, calling a visitor function\n// for each node that is visited. If `vistorObjOrFn` is an object, then its 'enter' property\n// is a function to call before visiting the children of a node, and its 'exit' property is\n// a function to call afterwards. If `visitorObjOrFn` is a function, it represents the 'enter'\n// function.\n//\n// The functions are called with three arguments: the Trace node, its parent Trace, and a number\n// representing the depth of the node in the tree. (The root node has depth 0.) `optThisArg`, if\n// specified, is the value to use for `this` when executing the visitor functions.\nTrace$2.prototype.walk = function(visitorObjOrFn, optThisArg) {\n let visitor = visitorObjOrFn;\n if (typeof visitor === 'function') {\n visitor = {enter: visitor};\n }\n\n function _walk(node, parent, depth) {\n let recurse = true;\n if (visitor.enter) {\n if (visitor.enter.call(optThisArg, node, parent, depth) === Trace$2.prototype.SKIP) {\n recurse = false;\n }\n }\n if (recurse) {\n node.children.forEach(child => {\n _walk(child, node, depth + 1);\n });\n if (visitor.exit) {\n visitor.exit.call(optThisArg, node, parent, depth);\n }\n }\n }\n if (this.isRootNode) {\n // Don't visit the root node itself, only its children.\n this.children.forEach(c => {\n _walk(c, null, 0);\n });\n } else {\n _walk(this, null, 0);\n }\n};\n\n// Return a string representation of the trace.\n// Sample:\n// 12⋅+⋅2⋅*⋅3 ✓ exp ⇒ \"12\"\n// 12⋅+⋅2⋅*⋅3 ✓ addExp (LR) ⇒ \"12\"\n// 12⋅+⋅2⋅*⋅3 ✗ addExp_plus\nTrace$2.prototype.toString = function() {\n const sb = new common$f.StringBuffer();\n this.walk((node, parent, depth) => {\n if (!node) {\n return this.SKIP;\n }\n const ctorName = node.expr.constructor.name;\n // Don't print anything for Alt nodes.\n if (ctorName === 'Alt') {\n return; // eslint-disable-line consistent-return\n }\n sb.append(getInputExcerpt(node.input, node.pos, 10) + spaces(depth * 2 + 1));\n sb.append((node.succeeded ? CHECK_MARK : BALLOT_X) + ' ' + node.displayString);\n if (node.isHeadOfLeftRecursion) {\n sb.append(' (LR)');\n }\n if (node.succeeded) {\n const contents = asEscapedString(node.source.contents);\n sb.append(' ' + RIGHTWARDS_DOUBLE_ARROW + ' ');\n sb.append(typeof contents === 'string' ? '\"' + contents + '\"' : contents);\n }\n sb.append('\\n');\n });\n return sb.contents();\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Trace_1 = Trace$2;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Trace$1 = Trace_1;\nconst common$e = common$l;\nconst errors$4 = errors$9;\nconst nodes = nodes$1;\nconst pexprs$g = pexprsMain;\n\nconst {TerminalNode: TerminalNode$1} = nodes;\nconst {NonterminalNode} = nodes;\nconst {IterationNode: IterationNode$1} = nodes;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Evaluate the expression and return `true` if it succeeds, `false` otherwise. This method should\n only be called directly by `State.prototype.eval(expr)`, which also updates the data structures\n that are used for tracing. (Making those updates in a method of `State` enables the trace-specific\n data structures to be \"secrets\" of that class, which is good for modularity.)\n\n The contract of this method is as follows:\n * When the return value is `true`,\n - the state object will have `expr.getArity()` more bindings than it did before the call.\n * When the return value is `false`,\n - the state object may have more bindings than it did before the call, and\n - its input stream's position may be anywhere.\n\n Note that `State.prototype.eval(expr)`, unlike this method, guarantees that neither the state\n object's bindings nor its input stream's position will change if the expression fails to match.\n*/\npexprs$g.PExpr.prototype.eval = common$e.abstract('eval'); // function(state) { ... }\n\npexprs$g.any.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const ch = inputStream.next();\n if (ch) {\n state.pushBinding(new TerminalNode$1(ch.length), origPos);\n return true;\n } else {\n state.processFailure(origPos, this);\n return false;\n }\n};\n\npexprs$g.end.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n if (inputStream.atEnd()) {\n state.pushBinding(new TerminalNode$1(0), origPos);\n return true;\n } else {\n state.processFailure(origPos, this);\n return false;\n }\n};\n\npexprs$g.Terminal.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n if (!inputStream.matchString(this.obj)) {\n state.processFailure(origPos, this);\n return false;\n } else {\n state.pushBinding(new TerminalNode$1(this.obj.length), origPos);\n return true;\n }\n};\n\npexprs$g.Range.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n\n // A range can operate in one of two modes: matching a single, 16-bit _code unit_,\n // or matching a _code point_. (Code points over 0xFFFF take up two 16-bit code units.)\n const cp = this.matchCodePoint ? inputStream.nextCodePoint() : inputStream.nextCharCode();\n\n // Always compare by code point value to get the correct result in all scenarios.\n // Note that for strings of length 1, codePointAt(0) and charPointAt(0) are equivalent.\n if (cp !== undefined && this.from.codePointAt(0) <= cp && cp <= this.to.codePointAt(0)) {\n state.pushBinding(new TerminalNode$1(String.fromCodePoint(cp).length), origPos);\n return true;\n } else {\n state.processFailure(origPos, this);\n return false;\n }\n};\n\npexprs$g.Param.prototype.eval = function(state) {\n return state.eval(state.currentApplication().args[this.index]);\n};\n\npexprs$g.Lex.prototype.eval = function(state) {\n state.enterLexifiedContext();\n const ans = state.eval(this.expr);\n state.exitLexifiedContext();\n return ans;\n};\n\npexprs$g.Alt.prototype.eval = function(state) {\n for (let idx = 0; idx < this.terms.length; idx++) {\n if (state.eval(this.terms[idx])) {\n return true;\n }\n }\n return false;\n};\n\npexprs$g.Seq.prototype.eval = function(state) {\n for (let idx = 0; idx < this.factors.length; idx++) {\n const factor = this.factors[idx];\n if (!state.eval(factor)) {\n return false;\n }\n }\n return true;\n};\n\npexprs$g.Iter.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const arity = this.getArity();\n const cols = [];\n const colOffsets = [];\n while (cols.length < arity) {\n cols.push([]);\n colOffsets.push([]);\n }\n\n let numMatches = 0;\n let prevPos = origPos;\n let idx;\n while (numMatches < this.maxNumMatches && state.eval(this.expr)) {\n if (inputStream.pos === prevPos) {\n throw errors$4.kleeneExprHasNullableOperand(this, state._applicationStack);\n }\n prevPos = inputStream.pos;\n numMatches++;\n const row = state._bindings.splice(state._bindings.length - arity, arity);\n const rowOffsets = state._bindingOffsets.splice(\n state._bindingOffsets.length - arity,\n arity\n );\n for (idx = 0; idx < row.length; idx++) {\n cols[idx].push(row[idx]);\n colOffsets[idx].push(rowOffsets[idx]);\n }\n }\n if (numMatches < this.minNumMatches) {\n return false;\n }\n let offset = state.posToOffset(origPos);\n let matchLength = 0;\n if (numMatches > 0) {\n const lastCol = cols[arity - 1];\n const lastColOffsets = colOffsets[arity - 1];\n\n const endOffset =\n lastColOffsets[lastColOffsets.length - 1] + lastCol[lastCol.length - 1].matchLength;\n offset = colOffsets[0][0];\n matchLength = endOffset - offset;\n }\n const isOptional = this instanceof pexprs$g.Opt;\n for (idx = 0; idx < cols.length; idx++) {\n state._bindings.push(\n new IterationNode$1(cols[idx], colOffsets[idx], matchLength, isOptional)\n );\n state._bindingOffsets.push(offset);\n }\n return true;\n};\n\npexprs$g.Not.prototype.eval = function(state) {\n /*\n TODO:\n - Right now we're just throwing away all of the failures that happen inside a `not`, and\n recording `this` as a failed expression.\n - Double negation should be equivalent to lookahead, but that's not the case right now wrt\n failures. E.g., ~~'foo' produces a failure for ~~'foo', but maybe it should produce\n a failure for 'foo' instead.\n */\n\n const {inputStream} = state;\n const origPos = inputStream.pos;\n state.pushFailuresInfo();\n\n const ans = state.eval(this.expr);\n\n state.popFailuresInfo();\n if (ans) {\n state.processFailure(origPos, this);\n return false;\n }\n\n inputStream.pos = origPos;\n return true;\n};\n\npexprs$g.Lookahead.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n if (state.eval(this.expr)) {\n inputStream.pos = origPos;\n return true;\n } else {\n return false;\n }\n};\n\npexprs$g.Apply.prototype.eval = function(state) {\n const caller = state.currentApplication();\n const actuals = caller ? caller.args : [];\n const app = this.substituteParams(actuals);\n\n const posInfo = state.getCurrentPosInfo();\n if (posInfo.isActive(app)) {\n // This rule is already active at this position, i.e., it is left-recursive.\n return app.handleCycle(state);\n }\n\n const memoKey = app.toMemoKey();\n const memoRec = posInfo.memo[memoKey];\n\n if (memoRec && posInfo.shouldUseMemoizedResult(memoRec)) {\n if (state.hasNecessaryInfo(memoRec)) {\n return state.useMemoizedResult(state.inputStream.pos, memoRec);\n }\n delete posInfo.memo[memoKey];\n }\n return app.reallyEval(state);\n};\n\npexprs$g.Apply.prototype.handleCycle = function(state) {\n const posInfo = state.getCurrentPosInfo();\n const {currentLeftRecursion} = posInfo;\n const memoKey = this.toMemoKey();\n let memoRec = posInfo.memo[memoKey];\n\n if (currentLeftRecursion && currentLeftRecursion.headApplication.toMemoKey() === memoKey) {\n // We already know about this left recursion, but it's possible there are \"involved\n // applications\" that we don't already know about, so...\n memoRec.updateInvolvedApplicationMemoKeys();\n } else if (!memoRec) {\n // New left recursion detected! Memoize a failure to try to get a seed parse.\n memoRec = posInfo.memoize(memoKey, {\n matchLength: 0,\n examinedLength: 0,\n value: false,\n rightmostFailureOffset: -1,\n });\n posInfo.startLeftRecursion(this, memoRec);\n }\n return state.useMemoizedResult(state.inputStream.pos, memoRec);\n};\n\npexprs$g.Apply.prototype.reallyEval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const origPosInfo = state.getCurrentPosInfo();\n const ruleInfo = state.grammar.rules[this.ruleName];\n const {body} = ruleInfo;\n const {description} = ruleInfo;\n\n state.enterApplication(origPosInfo, this);\n\n if (description) {\n state.pushFailuresInfo();\n }\n\n // Reset the input stream's examinedLength property so that we can track\n // the examined length of this particular application.\n const origInputStreamExaminedLength = inputStream.examinedLength;\n inputStream.examinedLength = 0;\n\n let value = this.evalOnce(body, state);\n const currentLR = origPosInfo.currentLeftRecursion;\n const memoKey = this.toMemoKey();\n const isHeadOfLeftRecursion = currentLR && currentLR.headApplication.toMemoKey() === memoKey;\n let memoRec;\n\n if (isHeadOfLeftRecursion) {\n value = this.growSeedResult(body, state, origPos, currentLR, value);\n origPosInfo.endLeftRecursion();\n memoRec = currentLR;\n memoRec.examinedLength = inputStream.examinedLength - origPos;\n memoRec.rightmostFailureOffset = state._getRightmostFailureOffset();\n origPosInfo.memoize(memoKey, memoRec); // updates origPosInfo's maxExaminedLength\n } else if (!currentLR || !currentLR.isInvolved(memoKey)) {\n // This application is not involved in left recursion, so it's ok to memoize it.\n memoRec = origPosInfo.memoize(memoKey, {\n matchLength: inputStream.pos - origPos,\n examinedLength: inputStream.examinedLength - origPos,\n value,\n failuresAtRightmostPosition: state.cloneRecordedFailures(),\n rightmostFailureOffset: state._getRightmostFailureOffset(),\n });\n }\n const succeeded = !!value;\n\n if (description) {\n state.popFailuresInfo();\n if (!succeeded) {\n state.processFailure(origPos, this);\n }\n if (memoRec) {\n memoRec.failuresAtRightmostPosition = state.cloneRecordedFailures();\n }\n }\n\n // Record trace information in the memo table, so that it is available if the memoized result\n // is used later.\n if (state.isTracing() && memoRec) {\n const entry = state.getTraceEntry(origPos, this, succeeded, succeeded ? [value] : []);\n if (isHeadOfLeftRecursion) {\n common$e.assert(entry.terminatingLREntry != null || !succeeded);\n entry.isHeadOfLeftRecursion = true;\n }\n memoRec.traceEntry = entry;\n }\n\n // Fix the input stream's examinedLength -- it should be the maximum examined length\n // across all applications, not just this one.\n inputStream.examinedLength = Math.max(\n inputStream.examinedLength,\n origInputStreamExaminedLength\n );\n\n state.exitApplication(origPosInfo, value);\n\n return succeeded;\n};\n\npexprs$g.Apply.prototype.evalOnce = function(expr, state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n\n if (state.eval(expr)) {\n const arity = expr.getArity();\n const bindings = state._bindings.splice(state._bindings.length - arity, arity);\n const offsets = state._bindingOffsets.splice(state._bindingOffsets.length - arity, arity);\n const matchLength = inputStream.pos - origPos;\n return new NonterminalNode(this.ruleName, bindings, offsets, matchLength);\n } else {\n return false;\n }\n};\n\npexprs$g.Apply.prototype.growSeedResult = function(body, state, origPos, lrMemoRec, newValue) {\n if (!newValue) {\n return false;\n }\n\n const {inputStream} = state;\n\n while (true) {\n lrMemoRec.matchLength = inputStream.pos - origPos;\n lrMemoRec.value = newValue;\n lrMemoRec.failuresAtRightmostPosition = state.cloneRecordedFailures();\n\n if (state.isTracing()) {\n // Before evaluating the body again, add a trace node for this application to the memo entry.\n // Its only child is a copy of the trace node from `newValue`, which will always be the last\n // element in `state.trace`.\n const seedTrace = state.trace[state.trace.length - 1];\n lrMemoRec.traceEntry = new Trace$1(\n state.input,\n origPos,\n inputStream.pos,\n this,\n true,\n [newValue],\n [seedTrace.clone()]\n );\n }\n inputStream.pos = origPos;\n newValue = this.evalOnce(body, state);\n if (inputStream.pos - origPos <= lrMemoRec.matchLength) {\n break;\n }\n if (state.isTracing()) {\n state.trace.splice(-2, 1); // Drop the trace for the old seed.\n }\n }\n if (state.isTracing()) {\n // The last entry is for an unused result -- pop it and save it in the \"real\" entry.\n lrMemoRec.traceEntry.recordLRTermination(state.trace.pop(), newValue);\n }\n inputStream.pos = origPos + lrMemoRec.matchLength;\n return lrMemoRec.value;\n};\n\npexprs$g.UnicodeChar.prototype.eval = function(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const ch = inputStream.next();\n if (ch && this.pattern.test(ch)) {\n state.pushBinding(new TerminalNode$1(ch.length), origPos);\n return true;\n } else {\n state.processFailure(origPos, this);\n return false;\n }\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$d = common$l;\nconst pexprs$f = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$f.PExpr.prototype.getArity = common$d.abstract('getArity');\n\npexprs$f.any.getArity =\n pexprs$f.end.getArity =\n pexprs$f.Terminal.prototype.getArity =\n pexprs$f.Range.prototype.getArity =\n pexprs$f.Param.prototype.getArity =\n pexprs$f.Apply.prototype.getArity =\n pexprs$f.UnicodeChar.prototype.getArity =\n function() {\n return 1;\n };\n\npexprs$f.Alt.prototype.getArity = function() {\n // This is ok b/c all terms must have the same arity -- this property is\n // checked by the Grammar constructor.\n return this.terms.length === 0 ? 0 : this.terms[0].getArity();\n};\n\npexprs$f.Seq.prototype.getArity = function() {\n let arity = 0;\n for (let idx = 0; idx < this.factors.length; idx++) {\n arity += this.factors[idx].getArity();\n }\n return arity;\n};\n\npexprs$f.Iter.prototype.getArity = function() {\n return this.expr.getArity();\n};\n\npexprs$f.Not.prototype.getArity = function() {\n return 0;\n};\n\npexprs$f.Lookahead.prototype.getArity = pexprs$f.Lex.prototype.getArity = function() {\n return this.expr.getArity();\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$c = common$l;\nconst pexprs$e = pexprsMain;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction getMetaInfo(expr, grammarInterval) {\n const metaInfo = {};\n if (expr.source && grammarInterval) {\n const adjusted = expr.source.relativeTo(grammarInterval);\n metaInfo.sourceInterval = [adjusted.startIdx, adjusted.endIdx];\n }\n return metaInfo;\n}\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$e.PExpr.prototype.outputRecipe = common$c.abstract('outputRecipe');\n\npexprs$e.any.outputRecipe = function(formals, grammarInterval) {\n return ['any', getMetaInfo(this, grammarInterval)];\n};\n\npexprs$e.end.outputRecipe = function(formals, grammarInterval) {\n return ['end', getMetaInfo(this, grammarInterval)];\n};\n\npexprs$e.Terminal.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['terminal', getMetaInfo(this, grammarInterval), this.obj];\n};\n\npexprs$e.Range.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['range', getMetaInfo(this, grammarInterval), this.from, this.to];\n};\n\npexprs$e.Param.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['param', getMetaInfo(this, grammarInterval), this.index];\n};\n\npexprs$e.Alt.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['alt', getMetaInfo(this, grammarInterval)].concat(\n this.terms.map(term => term.outputRecipe(formals, grammarInterval))\n );\n};\n\npexprs$e.Extend.prototype.outputRecipe = function(formals, grammarInterval) {\n const extension = this.terms[0]; // [extension, original]\n return extension.outputRecipe(formals, grammarInterval);\n};\n\npexprs$e.Splice.prototype.outputRecipe = function(formals, grammarInterval) {\n const beforeTerms = this.terms.slice(0, this.expansionPos);\n const afterTerms = this.terms.slice(this.expansionPos + 1);\n return [\n 'splice',\n getMetaInfo(this, grammarInterval),\n beforeTerms.map(term => term.outputRecipe(formals, grammarInterval)),\n afterTerms.map(term => term.outputRecipe(formals, grammarInterval)),\n ];\n};\n\npexprs$e.Seq.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['seq', getMetaInfo(this, grammarInterval)].concat(\n this.factors.map(factor => factor.outputRecipe(formals, grammarInterval))\n );\n};\n\npexprs$e.Star.prototype.outputRecipe =\n pexprs$e.Plus.prototype.outputRecipe =\n pexprs$e.Opt.prototype.outputRecipe =\n pexprs$e.Not.prototype.outputRecipe =\n pexprs$e.Lookahead.prototype.outputRecipe =\n pexprs$e.Lex.prototype.outputRecipe =\n function(formals, grammarInterval) {\n return [\n this.constructor.name.toLowerCase(),\n getMetaInfo(this, grammarInterval),\n this.expr.outputRecipe(formals, grammarInterval),\n ];\n };\n\npexprs$e.Apply.prototype.outputRecipe = function(formals, grammarInterval) {\n return [\n 'app',\n getMetaInfo(this, grammarInterval),\n this.ruleName,\n this.args.map(arg => arg.outputRecipe(formals, grammarInterval)),\n ];\n};\n\npexprs$e.UnicodeChar.prototype.outputRecipe = function(formals, grammarInterval) {\n return ['unicodeChar', getMetaInfo(this, grammarInterval), this.category];\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$b = common$l;\nconst pexprs$d = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Called at grammar creation time to rewrite a rule body, replacing each reference to a formal\n parameter with a `Param` node. Returns a PExpr -- either a new one, or the original one if\n it was modified in place.\n*/\npexprs$d.PExpr.prototype.introduceParams = common$b.abstract('introduceParams');\n\npexprs$d.any.introduceParams =\n pexprs$d.end.introduceParams =\n pexprs$d.Terminal.prototype.introduceParams =\n pexprs$d.Range.prototype.introduceParams =\n pexprs$d.Param.prototype.introduceParams =\n pexprs$d.UnicodeChar.prototype.introduceParams =\n function(formals) {\n return this;\n };\n\npexprs$d.Alt.prototype.introduceParams = function(formals) {\n this.terms.forEach((term, idx, terms) => {\n terms[idx] = term.introduceParams(formals);\n });\n return this;\n};\n\npexprs$d.Seq.prototype.introduceParams = function(formals) {\n this.factors.forEach((factor, idx, factors) => {\n factors[idx] = factor.introduceParams(formals);\n });\n return this;\n};\n\npexprs$d.Iter.prototype.introduceParams =\n pexprs$d.Not.prototype.introduceParams =\n pexprs$d.Lookahead.prototype.introduceParams =\n pexprs$d.Lex.prototype.introduceParams =\n function(formals) {\n this.expr = this.expr.introduceParams(formals);\n return this;\n };\n\npexprs$d.Apply.prototype.introduceParams = function(formals) {\n const index = formals.indexOf(this.ruleName);\n if (index >= 0) {\n if (this.args.length > 0) {\n // TODO: Should this be supported? See issue #64.\n throw new Error('Parameterized rules cannot be passed as arguments to another rule.');\n }\n return new pexprs$d.Param(index).withSource(this.source);\n } else {\n this.args.forEach((arg, idx, args) => {\n args[idx] = arg.introduceParams(formals);\n });\n return this;\n }\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$a = common$l;\nconst pexprs$c = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n// Returns `true` if this parsing expression may accept without consuming any input.\npexprs$c.PExpr.prototype.isNullable = function(grammar) {\n return this._isNullable(grammar, Object.create(null));\n};\n\npexprs$c.PExpr.prototype._isNullable = common$a.abstract('_isNullable');\n\npexprs$c.any._isNullable =\n pexprs$c.Range.prototype._isNullable =\n pexprs$c.Param.prototype._isNullable =\n pexprs$c.Plus.prototype._isNullable =\n pexprs$c.UnicodeChar.prototype._isNullable =\n function(grammar, memo) {\n return false;\n };\n\npexprs$c.end._isNullable = function(grammar, memo) {\n return true;\n};\n\npexprs$c.Terminal.prototype._isNullable = function(grammar, memo) {\n if (typeof this.obj === 'string') {\n // This is an over-simplification: it's only correct if the input is a string. If it's an array\n // or an object, then the empty string parsing expression is not nullable.\n return this.obj === '';\n } else {\n return false;\n }\n};\n\npexprs$c.Alt.prototype._isNullable = function(grammar, memo) {\n return this.terms.length === 0 || this.terms.some(term => term._isNullable(grammar, memo));\n};\n\npexprs$c.Seq.prototype._isNullable = function(grammar, memo) {\n return this.factors.every(factor => factor._isNullable(grammar, memo));\n};\n\npexprs$c.Star.prototype._isNullable =\n pexprs$c.Opt.prototype._isNullable =\n pexprs$c.Not.prototype._isNullable =\n pexprs$c.Lookahead.prototype._isNullable =\n function(grammar, memo) {\n return true;\n };\n\npexprs$c.Lex.prototype._isNullable = function(grammar, memo) {\n return this.expr._isNullable(grammar, memo);\n};\n\npexprs$c.Apply.prototype._isNullable = function(grammar, memo) {\n const key = this.toMemoKey();\n if (!Object.prototype.hasOwnProperty.call(memo, key)) {\n const {body} = grammar.rules[this.ruleName];\n const inlined = body.substituteParams(this.args);\n memo[key] = false; // Prevent infinite recursion for recursive rules.\n memo[key] = inlined._isNullable(grammar, memo);\n }\n return memo[key];\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$9 = common$l;\nconst pexprs$b = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Returns a PExpr that results from recursively replacing every formal parameter (i.e., instance\n of `Param`) inside this PExpr with its actual value from `actuals` (an Array).\n\n The receiver must not be modified; a new PExpr must be returned if any replacement is necessary.\n*/\n// function(actuals) { ... }\npexprs$b.PExpr.prototype.substituteParams = common$9.abstract('substituteParams');\n\npexprs$b.any.substituteParams =\n pexprs$b.end.substituteParams =\n pexprs$b.Terminal.prototype.substituteParams =\n pexprs$b.Range.prototype.substituteParams =\n pexprs$b.UnicodeChar.prototype.substituteParams =\n function(actuals) {\n return this;\n };\n\npexprs$b.Param.prototype.substituteParams = function(actuals) {\n return actuals[this.index];\n};\n\npexprs$b.Alt.prototype.substituteParams = function(actuals) {\n return new pexprs$b.Alt(this.terms.map(term => term.substituteParams(actuals)));\n};\n\npexprs$b.Seq.prototype.substituteParams = function(actuals) {\n return new pexprs$b.Seq(this.factors.map(factor => factor.substituteParams(actuals)));\n};\n\npexprs$b.Iter.prototype.substituteParams =\n pexprs$b.Not.prototype.substituteParams =\n pexprs$b.Lookahead.prototype.substituteParams =\n pexprs$b.Lex.prototype.substituteParams =\n function(actuals) {\n return new this.constructor(this.expr.substituteParams(actuals));\n };\n\npexprs$b.Apply.prototype.substituteParams = function(actuals) {\n if (this.args.length === 0) {\n // Avoid making a copy of this application, as an optimization\n return this;\n } else {\n const args = this.args.map(arg => arg.substituteParams(actuals));\n return new pexprs$b.Apply(this.ruleName, args);\n }\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$8 = common$l;\nconst pexprs$a = pexprsMain;\n\nconst {copyWithoutDuplicates} = common$8;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction isRestrictedJSIdentifier(str) {\n return /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(str);\n}\n\nfunction resolveDuplicatedNames(argumentNameList) {\n // `count` is used to record the number of times each argument name occurs in the list,\n // this is useful for checking duplicated argument name. It maps argument names to ints.\n const count = Object.create(null);\n argumentNameList.forEach(argName => {\n count[argName] = (count[argName] || 0) + 1;\n });\n\n // Append subscripts ('_1', '_2', ...) to duplicate argument names.\n Object.keys(count).forEach(dupArgName => {\n if (count[dupArgName] <= 1) {\n return;\n }\n\n // This name shows up more than once, so add subscripts.\n let subscript = 1;\n argumentNameList.forEach((argName, idx) => {\n if (argName === dupArgName) {\n argumentNameList[idx] = argName + '_' + subscript++;\n }\n });\n });\n}\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n Returns a list of strings that will be used as the default argument names for its receiver\n (a pexpr) in a semantic action. This is used exclusively by the Semantics Editor.\n\n `firstArgIndex` is the 1-based index of the first argument name that will be generated for this\n pexpr. It enables us to name arguments positionally, e.g., if the second argument is a\n non-alphanumeric terminal like \"+\", it will be named '$2'.\n\n `noDupCheck` is true if the caller of `toArgumentNameList` is not a top level caller. It enables\n us to avoid nested duplication subscripts appending, e.g., '_1_1', '_1_2', by only checking\n duplicates at the top level.\n\n Here is a more elaborate example that illustrates how this method works:\n `(a \"+\" b).toArgumentNameList(1)` evaluates to `['a', '$2', 'b']` with the following recursive\n calls:\n\n (a).toArgumentNameList(1) -> ['a'],\n (\"+\").toArgumentNameList(2) -> ['$2'],\n (b).toArgumentNameList(3) -> ['b']\n\n Notes:\n * This method must only be called on well-formed expressions, e.g., the receiver must\n not have any Alt sub-expressions with inconsistent arities.\n * e.getArity() === e.toArgumentNameList(1).length\n*/\n// function(firstArgIndex, noDupCheck) { ... }\npexprs$a.PExpr.prototype.toArgumentNameList = common$8.abstract('toArgumentNameList');\n\npexprs$a.any.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return ['any'];\n};\n\npexprs$a.end.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return ['end'];\n};\n\npexprs$a.Terminal.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n if (typeof this.obj === 'string' && /^[_a-zA-Z0-9]+$/.test(this.obj)) {\n // If this terminal is a valid suffix for a JS identifier, just prepend it with '_'\n return ['_' + this.obj];\n } else {\n // Otherwise, name it positionally.\n return ['$' + firstArgIndex];\n }\n};\n\npexprs$a.Range.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n let argName = this.from + '_to_' + this.to;\n // If the `argName` is not valid then try to prepend a `_`.\n if (!isRestrictedJSIdentifier(argName)) {\n argName = '_' + argName;\n }\n // If the `argName` still not valid after prepending a `_`, then name it positionally.\n if (!isRestrictedJSIdentifier(argName)) {\n argName = '$' + firstArgIndex;\n }\n return [argName];\n};\n\npexprs$a.Alt.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n // `termArgNameLists` is an array of arrays where each row is the\n // argument name list that corresponds to a term in this alternation.\n const termArgNameLists = this.terms.map(term =>\n term.toArgumentNameList(firstArgIndex, true)\n );\n\n const argumentNameList = [];\n const numArgs = termArgNameLists[0].length;\n for (let colIdx = 0; colIdx < numArgs; colIdx++) {\n const col = [];\n for (let rowIdx = 0; rowIdx < this.terms.length; rowIdx++) {\n col.push(termArgNameLists[rowIdx][colIdx]);\n }\n const uniqueNames = copyWithoutDuplicates(col);\n argumentNameList.push(uniqueNames.join('_or_'));\n }\n\n if (!noDupCheck) {\n resolveDuplicatedNames(argumentNameList);\n }\n return argumentNameList;\n};\n\npexprs$a.Seq.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n // Generate the argument name list, without worrying about duplicates.\n let argumentNameList = [];\n this.factors.forEach(factor => {\n const factorArgumentNameList = factor.toArgumentNameList(firstArgIndex, true);\n argumentNameList = argumentNameList.concat(factorArgumentNameList);\n\n // Shift the firstArgIndex to take this factor's argument names into account.\n firstArgIndex += factorArgumentNameList.length;\n });\n if (!noDupCheck) {\n resolveDuplicatedNames(argumentNameList);\n }\n return argumentNameList;\n};\n\npexprs$a.Iter.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n const argumentNameList = this.expr\n .toArgumentNameList(firstArgIndex, noDupCheck)\n .map(exprArgumentString =>\n exprArgumentString[exprArgumentString.length - 1] === 's' ?\n exprArgumentString + 'es' :\n exprArgumentString + 's'\n );\n if (!noDupCheck) {\n resolveDuplicatedNames(argumentNameList);\n }\n return argumentNameList;\n};\n\npexprs$a.Opt.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return this.expr.toArgumentNameList(firstArgIndex, noDupCheck).map(argName => {\n return 'opt' + argName[0].toUpperCase() + argName.slice(1);\n });\n};\n\npexprs$a.Not.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return [];\n};\n\npexprs$a.Lookahead.prototype.toArgumentNameList = pexprs$a.Lex.prototype.toArgumentNameList =\n function(firstArgIndex, noDupCheck) {\n return this.expr.toArgumentNameList(firstArgIndex, noDupCheck);\n };\n\npexprs$a.Apply.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return [this.ruleName];\n};\n\npexprs$a.UnicodeChar.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return ['$' + firstArgIndex];\n};\n\npexprs$a.Param.prototype.toArgumentNameList = function(firstArgIndex, noDupCheck) {\n return ['param' + this.index];\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$7 = common$l;\nconst pexprs$9 = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n// Returns a string representing the PExpr, for use as a UI label, etc.\npexprs$9.PExpr.prototype.toDisplayString = common$7.abstract('toDisplayString');\n\npexprs$9.Alt.prototype.toDisplayString = pexprs$9.Seq.prototype.toDisplayString = function() {\n if (this.source) {\n return this.source.trimmed().contents;\n }\n return '[' + this.constructor.name + ']';\n};\n\npexprs$9.any.toDisplayString =\n pexprs$9.end.toDisplayString =\n pexprs$9.Iter.prototype.toDisplayString =\n pexprs$9.Not.prototype.toDisplayString =\n pexprs$9.Lookahead.prototype.toDisplayString =\n pexprs$9.Lex.prototype.toDisplayString =\n pexprs$9.Terminal.prototype.toDisplayString =\n pexprs$9.Range.prototype.toDisplayString =\n pexprs$9.Param.prototype.toDisplayString =\n function() {\n return this.toString();\n };\n\npexprs$9.Apply.prototype.toDisplayString = function() {\n if (this.args.length > 0) {\n const ps = this.args.map(arg => arg.toDisplayString());\n return this.ruleName + '<' + ps.join(',') + '>';\n } else {\n return this.ruleName;\n }\n};\n\npexprs$9.UnicodeChar.prototype.toDisplayString = function() {\n return 'Unicode [' + this.category + '] character';\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Failure$1 = Failure_1;\nconst common$6 = common$l;\nconst pexprs$8 = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\npexprs$8.PExpr.prototype.toFailure = common$6.abstract('toFailure');\n\npexprs$8.any.toFailure = function(grammar) {\n return new Failure$1(this, 'any object', 'description');\n};\n\npexprs$8.end.toFailure = function(grammar) {\n return new Failure$1(this, 'end of input', 'description');\n};\n\npexprs$8.Terminal.prototype.toFailure = function(grammar) {\n return new Failure$1(this, this.obj, 'string');\n};\n\npexprs$8.Range.prototype.toFailure = function(grammar) {\n // TODO: come up with something better\n return new Failure$1(this, JSON.stringify(this.from) + '..' + JSON.stringify(this.to), 'code');\n};\n\npexprs$8.Not.prototype.toFailure = function(grammar) {\n const description =\n this.expr === pexprs$8.any ? 'nothing' : 'not ' + this.expr.toFailure(grammar);\n return new Failure$1(this, description, 'description');\n};\n\npexprs$8.Lookahead.prototype.toFailure = function(grammar) {\n return this.expr.toFailure(grammar);\n};\n\npexprs$8.Apply.prototype.toFailure = function(grammar) {\n let {description} = grammar.rules[this.ruleName];\n if (!description) {\n const article = /^[aeiouAEIOU]/.test(this.ruleName) ? 'an' : 'a';\n description = article + ' ' + this.ruleName;\n }\n return new Failure$1(this, description, 'description');\n};\n\npexprs$8.UnicodeChar.prototype.toFailure = function(grammar) {\n return new Failure$1(this, 'a Unicode [' + this.category + '] character', 'description');\n};\n\npexprs$8.Alt.prototype.toFailure = function(grammar) {\n const fs = this.terms.map(t => t.toFailure(grammar));\n const description = '(' + fs.join(' or ') + ')';\n return new Failure$1(this, description, 'description');\n};\n\npexprs$8.Seq.prototype.toFailure = function(grammar) {\n const fs = this.factors.map(f => f.toFailure(grammar));\n const description = '(' + fs.join(' ') + ')';\n return new Failure$1(this, description, 'description');\n};\n\npexprs$8.Iter.prototype.toFailure = function(grammar) {\n const description = '(' + this.expr.toFailure(grammar) + this.operator + ')';\n return new Failure$1(this, description, 'description');\n};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$5 = common$l;\nconst pexprs$7 = pexprsMain;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\n/*\n e1.toString() === e2.toString() ==> e1 and e2 are semantically equivalent.\n Note that this is not an iff (<==>): e.g.,\n (~\"b\" \"a\").toString() !== (\"a\").toString(), even though\n ~\"b\" \"a\" and \"a\" are interchangeable in any grammar,\n both in terms of the languages they accept and their arities.\n*/\npexprs$7.PExpr.prototype.toString = common$5.abstract('toString');\n\npexprs$7.any.toString = function() {\n return 'any';\n};\n\npexprs$7.end.toString = function() {\n return 'end';\n};\n\npexprs$7.Terminal.prototype.toString = function() {\n return JSON.stringify(this.obj);\n};\n\npexprs$7.Range.prototype.toString = function() {\n return JSON.stringify(this.from) + '..' + JSON.stringify(this.to);\n};\n\npexprs$7.Param.prototype.toString = function() {\n return '$' + this.index;\n};\n\npexprs$7.Lex.prototype.toString = function() {\n return '#(' + this.expr.toString() + ')';\n};\n\npexprs$7.Alt.prototype.toString = function() {\n return this.terms.length === 1 ?\n this.terms[0].toString() :\n '(' + this.terms.map(term => term.toString()).join(' | ') + ')';\n};\n\npexprs$7.Seq.prototype.toString = function() {\n return this.factors.length === 1 ?\n this.factors[0].toString() :\n '(' + this.factors.map(factor => factor.toString()).join(' ') + ')';\n};\n\npexprs$7.Iter.prototype.toString = function() {\n return this.expr + this.operator;\n};\n\npexprs$7.Not.prototype.toString = function() {\n return '~' + this.expr;\n};\n\npexprs$7.Lookahead.prototype.toString = function() {\n return '&' + this.expr;\n};\n\npexprs$7.Apply.prototype.toString = function() {\n if (this.args.length > 0) {\n const ps = this.args.map(arg => arg.toString());\n return this.ruleName + '<' + ps.join(',') + '>';\n } else {\n return this.ruleName;\n }\n};\n\npexprs$7.UnicodeChar.prototype.toString = function() {\n return '\\\\p{' + this.category + '}';\n};\n\n// --------------------------------------------------------------------\n// Re-export classes\n// --------------------------------------------------------------------\n\nvar pexprs$6 = pexprsMain;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Failure = Failure_1;\nconst {TerminalNode} = nodes$1;\nconst {assert: assert$1} = common$l;\nconst {PExpr, Terminal} = pexprs$6;\n\nclass CaseInsensitiveTerminal$1 extends PExpr {\n constructor(param) {\n super();\n this.obj = param;\n }\n\n _getString(state) {\n const terminal = state.currentApplication().args[this.obj.index];\n assert$1(terminal instanceof Terminal, 'expected a Terminal expression');\n return terminal.obj;\n }\n\n // Implementation of the PExpr API\n\n allowsSkippingPrecedingSpace() {\n return true;\n }\n\n eval(state) {\n const {inputStream} = state;\n const origPos = inputStream.pos;\n const matchStr = this._getString(state);\n if (!inputStream.matchString(matchStr, true)) {\n state.processFailure(origPos, this);\n return false;\n } else {\n state.pushBinding(new TerminalNode(matchStr.length), origPos);\n return true;\n }\n }\n\n getArity() {\n return 1;\n }\n\n substituteParams(actuals) {\n return new CaseInsensitiveTerminal$1(this.obj.substituteParams(actuals));\n }\n\n toDisplayString() {\n return this.obj.toDisplayString() + ' (case-insensitive)';\n }\n\n toFailure(grammar) {\n return new Failure(\n this,\n this.obj.toFailure(grammar) + ' (case-insensitive)',\n 'description'\n );\n }\n\n _isNullable(grammar, memo) {\n return this.obj._isNullable(grammar, memo);\n }\n}\n\nvar CaseInsensitiveTerminal_1 = CaseInsensitiveTerminal$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Interval$1 = Interval_1;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction InputStream$3(source) {\n this.source = source;\n this.pos = 0;\n this.examinedLength = 0;\n}\n\nInputStream$3.prototype = {\n atEnd() {\n const ans = this.pos === this.source.length;\n this.examinedLength = Math.max(this.examinedLength, this.pos + 1);\n return ans;\n },\n\n next() {\n const ans = this.source[this.pos++];\n this.examinedLength = Math.max(this.examinedLength, this.pos);\n return ans;\n },\n\n nextCharCode() {\n const nextChar = this.next();\n return nextChar && nextChar.charCodeAt(0);\n },\n\n nextCodePoint() {\n const cp = this.source.slice(this.pos++).codePointAt(0);\n // If the code point is beyond plane 0, it takes up two characters.\n if (cp > 0xffff) {\n this.pos += 1;\n }\n this.examinedLength = Math.max(this.examinedLength, this.pos);\n return cp;\n },\n\n matchString(s, optIgnoreCase) {\n let idx;\n if (optIgnoreCase) {\n /*\n Case-insensitive comparison is a tricky business. Some notable gotchas include the\n \"Turkish I\" problem (http://www.i18nguy.com/unicode/turkish-i18n.html) and the fact\n that the German Esszet (ß) turns into \"SS\" in upper case.\n\n This is intended to be a locale-invariant comparison, which means it may not obey\n locale-specific expectations (e.g. \"i\" => \"İ\").\n */\n for (idx = 0; idx < s.length; idx++) {\n const actual = this.next();\n const expected = s[idx];\n if (actual == null || actual.toUpperCase() !== expected.toUpperCase()) {\n return false;\n }\n }\n return true;\n }\n // Default is case-sensitive comparison.\n for (idx = 0; idx < s.length; idx++) {\n if (this.next() !== s[idx]) {\n return false;\n }\n }\n return true;\n },\n\n sourceSlice(startIdx, endIdx) {\n return this.source.slice(startIdx, endIdx);\n },\n\n interval(startIdx, optEndIdx) {\n return new Interval$1(this.source, startIdx, optEndIdx ? optEndIdx : this.pos);\n },\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar InputStream_1 = InputStream$3;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst common$4 = common$l;\nconst util$4 = util$7;\nconst Interval = Interval_1;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction MatchResult$2(\n matcher,\n input,\n startExpr,\n cst,\n cstOffset,\n rightmostFailurePosition,\n optRecordedFailures\n) {\n this.matcher = matcher;\n this.input = input;\n this.startExpr = startExpr;\n this._cst = cst;\n this._cstOffset = cstOffset;\n this._rightmostFailurePosition = rightmostFailurePosition;\n this._rightmostFailures = optRecordedFailures;\n\n if (this.failed()) {\n /* eslint-disable no-invalid-this */\n common$4.defineLazyProperty(this, 'message', function() {\n const detail = 'Expected ' + this.getExpectedText();\n return (\n util$4.getLineAndColumnMessage(this.input, this.getRightmostFailurePosition()) + detail\n );\n });\n common$4.defineLazyProperty(this, 'shortMessage', function() {\n const detail = 'expected ' + this.getExpectedText();\n const errorInfo = util$4.getLineAndColumn(this.input, this.getRightmostFailurePosition());\n return 'Line ' + errorInfo.lineNum + ', col ' + errorInfo.colNum + ': ' + detail;\n });\n /* eslint-enable no-invalid-this */\n }\n}\n\nMatchResult$2.prototype.succeeded = function() {\n return !!this._cst;\n};\n\nMatchResult$2.prototype.failed = function() {\n return !this.succeeded();\n};\n\nMatchResult$2.prototype.getRightmostFailurePosition = function() {\n return this._rightmostFailurePosition;\n};\n\nMatchResult$2.prototype.getRightmostFailures = function() {\n if (!this._rightmostFailures) {\n this.matcher.setInput(this.input);\n const matchResultWithFailures = this.matcher._match(\n this.startExpr,\n false,\n this.getRightmostFailurePosition()\n );\n this._rightmostFailures = matchResultWithFailures.getRightmostFailures();\n }\n return this._rightmostFailures;\n};\n\nMatchResult$2.prototype.toString = function() {\n return this.succeeded() ?\n '[match succeeded]' :\n '[match failed at position ' + this.getRightmostFailurePosition() + ']';\n};\n\n// Return a string summarizing the expected contents of the input stream when\n// the match failure occurred.\nMatchResult$2.prototype.getExpectedText = function() {\n if (this.succeeded()) {\n throw new Error('cannot get expected text of a successful MatchResult');\n }\n\n const sb = new common$4.StringBuffer();\n let failures = this.getRightmostFailures();\n\n // Filter out the fluffy failures to make the default error messages more useful\n failures = failures.filter(failure => !failure.isFluffy());\n\n for (let idx = 0; idx < failures.length; idx++) {\n if (idx > 0) {\n if (idx === failures.length - 1) {\n sb.append(failures.length > 2 ? ', or ' : ' or ');\n } else {\n sb.append(', ');\n }\n }\n sb.append(failures[idx].toString());\n }\n return sb.contents();\n};\n\nMatchResult$2.prototype.getInterval = function() {\n const pos = this.getRightmostFailurePosition();\n return new Interval(this.input, pos, pos);\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar MatchResult_1 = MatchResult$2;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction PosInfo$1() {\n this.applicationMemoKeyStack = []; // active applications at this position\n this.memo = {};\n this.maxExaminedLength = 0;\n this.maxRightmostFailureOffset = -1;\n this.currentLeftRecursion = undefined;\n}\n\nPosInfo$1.prototype = {\n isActive(application) {\n return this.applicationMemoKeyStack.indexOf(application.toMemoKey()) >= 0;\n },\n\n enter(application) {\n this.applicationMemoKeyStack.push(application.toMemoKey());\n },\n\n exit() {\n this.applicationMemoKeyStack.pop();\n },\n\n startLeftRecursion(headApplication, memoRec) {\n memoRec.isLeftRecursion = true;\n memoRec.headApplication = headApplication;\n memoRec.nextLeftRecursion = this.currentLeftRecursion;\n this.currentLeftRecursion = memoRec;\n\n const {applicationMemoKeyStack} = this;\n const indexOfFirstInvolvedRule =\n applicationMemoKeyStack.indexOf(headApplication.toMemoKey()) + 1;\n const involvedApplicationMemoKeys = applicationMemoKeyStack.slice(\n indexOfFirstInvolvedRule\n );\n\n memoRec.isInvolved = function(applicationMemoKey) {\n return involvedApplicationMemoKeys.indexOf(applicationMemoKey) >= 0;\n };\n\n memoRec.updateInvolvedApplicationMemoKeys = function() {\n for (let idx = indexOfFirstInvolvedRule; idx < applicationMemoKeyStack.length; idx++) {\n const applicationMemoKey = applicationMemoKeyStack[idx];\n if (!this.isInvolved(applicationMemoKey)) {\n involvedApplicationMemoKeys.push(applicationMemoKey);\n }\n }\n };\n },\n\n endLeftRecursion() {\n this.currentLeftRecursion = this.currentLeftRecursion.nextLeftRecursion;\n },\n\n // Note: this method doesn't get called for the \"head\" of a left recursion -- for LR heads,\n // the memoized result (which starts out being a failure) is always used.\n shouldUseMemoizedResult(memoRec) {\n if (!memoRec.isLeftRecursion) {\n return true;\n }\n const {applicationMemoKeyStack} = this;\n for (let idx = 0; idx < applicationMemoKeyStack.length; idx++) {\n const applicationMemoKey = applicationMemoKeyStack[idx];\n if (memoRec.isInvolved(applicationMemoKey)) {\n return false;\n }\n }\n return true;\n },\n\n memoize(memoKey, memoRec) {\n this.memo[memoKey] = memoRec;\n this.maxExaminedLength = Math.max(this.maxExaminedLength, memoRec.examinedLength);\n this.maxRightmostFailureOffset = Math.max(\n this.maxRightmostFailureOffset,\n memoRec.rightmostFailureOffset\n );\n return memoRec;\n },\n\n clearObsoleteEntries(pos, invalidatedIdx) {\n if (pos + this.maxExaminedLength <= invalidatedIdx) {\n // Optimization: none of the rule applications that were memoized here examined the\n // interval of the input that changed, so nothing has to be invalidated.\n return;\n }\n\n const {memo} = this;\n this.maxExaminedLength = 0;\n this.maxRightmostFailureOffset = -1;\n Object.keys(memo).forEach(k => {\n const memoRec = memo[k];\n if (pos + memoRec.examinedLength > invalidatedIdx) {\n delete memo[k];\n } else {\n this.maxExaminedLength = Math.max(this.maxExaminedLength, memoRec.examinedLength);\n this.maxRightmostFailureOffset = Math.max(\n this.maxRightmostFailureOffset,\n memoRec.rightmostFailureOffset\n );\n }\n });\n },\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar PosInfo_1 = PosInfo$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst InputStream$2 = InputStream_1;\nconst MatchResult$1 = MatchResult_1;\nconst PosInfo = PosInfo_1;\nconst Trace = Trace_1;\nconst pexprs$5 = pexprs$6;\nconst util$3 = util$7;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nlet builtInApplySyntacticBody;\n\nutil$3.awaitBuiltInRules(builtInRules => {\n builtInApplySyntacticBody = builtInRules.rules.applySyntactic.body;\n});\n\nconst applySpaces = new pexprs$5.Apply('spaces');\n\nfunction MatchState$1(matcher, startExpr, optPositionToRecordFailures) {\n this.matcher = matcher;\n this.startExpr = startExpr;\n\n this.grammar = matcher.grammar;\n this.input = matcher.input;\n this.inputStream = new InputStream$2(matcher.input);\n this.memoTable = matcher.memoTable;\n\n this._bindings = [];\n this._bindingOffsets = [];\n this._applicationStack = [];\n this._posStack = [0];\n this.inLexifiedContextStack = [false];\n\n this.rightmostFailurePosition = -1;\n this._rightmostFailurePositionStack = [];\n this._recordedFailuresStack = [];\n\n if (optPositionToRecordFailures !== undefined) {\n this.positionToRecordFailures = optPositionToRecordFailures;\n this.recordedFailures = Object.create(null);\n }\n}\n\nMatchState$1.prototype = {\n posToOffset(pos) {\n return pos - this._posStack[this._posStack.length - 1];\n },\n\n enterApplication(posInfo, app) {\n this._posStack.push(this.inputStream.pos);\n this._applicationStack.push(app);\n this.inLexifiedContextStack.push(false);\n posInfo.enter(app);\n this._rightmostFailurePositionStack.push(this.rightmostFailurePosition);\n this.rightmostFailurePosition = -1;\n },\n\n exitApplication(posInfo, optNode) {\n const origPos = this._posStack.pop();\n this._applicationStack.pop();\n this.inLexifiedContextStack.pop();\n posInfo.exit();\n\n this.rightmostFailurePosition = Math.max(\n this.rightmostFailurePosition,\n this._rightmostFailurePositionStack.pop()\n );\n\n if (optNode) {\n this.pushBinding(optNode, origPos);\n }\n },\n\n enterLexifiedContext() {\n this.inLexifiedContextStack.push(true);\n },\n\n exitLexifiedContext() {\n this.inLexifiedContextStack.pop();\n },\n\n currentApplication() {\n return this._applicationStack[this._applicationStack.length - 1];\n },\n\n inSyntacticContext() {\n const currentApplication = this.currentApplication();\n if (currentApplication) {\n return currentApplication.isSyntactic() && !this.inLexifiedContext();\n } else {\n // The top-level context is syntactic if the start application is.\n return this.startExpr.factors[0].isSyntactic();\n }\n },\n\n inLexifiedContext() {\n return this.inLexifiedContextStack[this.inLexifiedContextStack.length - 1];\n },\n\n skipSpaces() {\n this.pushFailuresInfo();\n this.eval(applySpaces);\n this.popBinding();\n this.popFailuresInfo();\n return this.inputStream.pos;\n },\n\n skipSpacesIfInSyntacticContext() {\n return this.inSyntacticContext() ? this.skipSpaces() : this.inputStream.pos;\n },\n\n maybeSkipSpacesBefore(expr) {\n if (expr.allowsSkippingPrecedingSpace() && expr !== applySpaces) {\n return this.skipSpacesIfInSyntacticContext();\n } else {\n return this.inputStream.pos;\n }\n },\n\n pushBinding(node, origPos) {\n this._bindings.push(node);\n this._bindingOffsets.push(this.posToOffset(origPos));\n },\n\n popBinding() {\n this._bindings.pop();\n this._bindingOffsets.pop();\n },\n\n numBindings() {\n return this._bindings.length;\n },\n\n truncateBindings(newLength) {\n // Yes, this is this really faster than setting the `length` property (tested with\n // bin/es5bench on Node v6.1.0).\n // Update 2021-10-25: still true on v14.15.5 — it's ~20% speedup on es5bench.\n while (this._bindings.length > newLength) {\n this.popBinding();\n }\n },\n\n getCurrentPosInfo() {\n return this.getPosInfo(this.inputStream.pos);\n },\n\n getPosInfo(pos) {\n let posInfo = this.memoTable[pos];\n if (!posInfo) {\n posInfo = this.memoTable[pos] = new PosInfo();\n }\n return posInfo;\n },\n\n processFailure(pos, expr) {\n this.rightmostFailurePosition = Math.max(this.rightmostFailurePosition, pos);\n\n if (this.recordedFailures && pos === this.positionToRecordFailures) {\n const app = this.currentApplication();\n if (app) {\n // Substitute parameters with the actual pexprs that were passed to\n // the current rule.\n expr = expr.substituteParams(app.args);\n }\n\n this.recordFailure(expr.toFailure(this.grammar), false);\n }\n },\n\n recordFailure(failure, shouldCloneIfNew) {\n const key = failure.toKey();\n if (!this.recordedFailures[key]) {\n this.recordedFailures[key] = shouldCloneIfNew ? failure.clone() : failure;\n } else if (this.recordedFailures[key].isFluffy() && !failure.isFluffy()) {\n this.recordedFailures[key].clearFluffy();\n }\n },\n\n recordFailures(failures, shouldCloneIfNew) {\n Object.keys(failures).forEach(key => {\n this.recordFailure(failures[key], shouldCloneIfNew);\n });\n },\n\n cloneRecordedFailures() {\n if (!this.recordedFailures) {\n return undefined;\n }\n\n const ans = Object.create(null);\n Object.keys(this.recordedFailures).forEach(key => {\n ans[key] = this.recordedFailures[key].clone();\n });\n return ans;\n },\n\n getRightmostFailurePosition() {\n return this.rightmostFailurePosition;\n },\n\n _getRightmostFailureOffset() {\n return this.rightmostFailurePosition >= 0 ?\n this.posToOffset(this.rightmostFailurePosition) :\n -1;\n },\n\n // Returns the memoized trace entry for `expr` at `pos`, if one exists, `null` otherwise.\n getMemoizedTraceEntry(pos, expr) {\n const posInfo = this.memoTable[pos];\n if (posInfo && expr instanceof pexprs$5.Apply) {\n const memoRec = posInfo.memo[expr.toMemoKey()];\n if (memoRec && memoRec.traceEntry) {\n const entry = memoRec.traceEntry.cloneWithExpr(expr);\n entry.isMemoized = true;\n return entry;\n }\n }\n return null;\n },\n\n // Returns a new trace entry, with the currently active trace array as its children.\n getTraceEntry(pos, expr, succeeded, bindings) {\n if (expr instanceof pexprs$5.Apply) {\n const app = this.currentApplication();\n const actuals = app ? app.args : [];\n expr = expr.substituteParams(actuals);\n }\n return (\n this.getMemoizedTraceEntry(pos, expr) ||\n new Trace(this.input, pos, this.inputStream.pos, expr, succeeded, bindings, this.trace)\n );\n },\n\n isTracing() {\n return !!this.trace;\n },\n\n hasNecessaryInfo(memoRec) {\n if (this.trace && !memoRec.traceEntry) {\n return false;\n }\n\n if (\n this.recordedFailures &&\n this.inputStream.pos + memoRec.rightmostFailureOffset === this.positionToRecordFailures\n ) {\n return !!memoRec.failuresAtRightmostPosition;\n }\n\n return true;\n },\n\n useMemoizedResult(origPos, memoRec) {\n if (this.trace) {\n this.trace.push(memoRec.traceEntry);\n }\n\n const memoRecRightmostFailurePosition =\n this.inputStream.pos + memoRec.rightmostFailureOffset;\n this.rightmostFailurePosition = Math.max(\n this.rightmostFailurePosition,\n memoRecRightmostFailurePosition\n );\n if (\n this.recordedFailures &&\n this.positionToRecordFailures === memoRecRightmostFailurePosition &&\n memoRec.failuresAtRightmostPosition\n ) {\n this.recordFailures(memoRec.failuresAtRightmostPosition, true);\n }\n\n this.inputStream.examinedLength = Math.max(\n this.inputStream.examinedLength,\n memoRec.examinedLength + origPos\n );\n\n if (memoRec.value) {\n this.inputStream.pos += memoRec.matchLength;\n this.pushBinding(memoRec.value, origPos);\n return true;\n }\n return false;\n },\n\n // Evaluate `expr` and return `true` if it succeeded, `false` otherwise. On success, `bindings`\n // will have `expr.getArity()` more elements than before, and the input stream's position may\n // have increased. On failure, `bindings` and position will be unchanged.\n eval(expr) {\n const {inputStream} = this;\n const origNumBindings = this._bindings.length;\n\n let origRecordedFailures;\n if (this.recordedFailures) {\n origRecordedFailures = this.recordedFailures;\n this.recordedFailures = Object.create(null);\n }\n\n const origPos = inputStream.pos;\n const memoPos = this.maybeSkipSpacesBefore(expr);\n\n let origTrace;\n if (this.trace) {\n origTrace = this.trace;\n this.trace = [];\n }\n\n // Do the actual evaluation.\n const ans = expr.eval(this);\n\n if (this.trace) {\n const bindings = this._bindings.slice(origNumBindings);\n const traceEntry = this.getTraceEntry(memoPos, expr, ans, bindings);\n traceEntry.isImplicitSpaces = expr === applySpaces;\n traceEntry.isRootNode = expr === this.startExpr;\n origTrace.push(traceEntry);\n this.trace = origTrace;\n }\n\n if (ans) {\n if (this.recordedFailures && inputStream.pos === this.positionToRecordFailures) {\n Object.keys(this.recordedFailures).forEach(key => {\n this.recordedFailures[key].makeFluffy();\n });\n }\n } else {\n // Reset the position and the bindings.\n inputStream.pos = origPos;\n this.truncateBindings(origNumBindings);\n }\n\n if (this.recordedFailures) {\n this.recordFailures(origRecordedFailures, false);\n }\n\n // The built-in applySyntactic rule needs special handling: we want to skip\n // trailing spaces, just as with the top-level application of a syntactic rule.\n if (expr === builtInApplySyntacticBody) {\n this.skipSpaces();\n }\n\n return ans;\n },\n\n getMatchResult() {\n this.eval(this.startExpr);\n let rightmostFailures;\n if (this.recordedFailures) {\n rightmostFailures = Object.keys(this.recordedFailures).map(\n key => this.recordedFailures[key]\n );\n }\n const cst = this._bindings[0];\n if (cst) {\n cst.grammar = this.grammar;\n }\n return new MatchResult$1(\n this.matcher,\n this.input,\n this.startExpr,\n cst,\n this._bindingOffsets[0],\n this.rightmostFailurePosition,\n rightmostFailures\n );\n },\n\n getTrace() {\n this.trace = [];\n const matchResult = this.getMatchResult();\n\n // The trace node for the start rule is always the last entry. If it is a syntactic rule,\n // the first entry is for an application of 'spaces'.\n // TODO(pdubroy): Clean this up by introducing a special `Match` rule, which will\n // ensure that there is always a single root trace node.\n const rootTrace = this.trace[this.trace.length - 1];\n rootTrace.result = matchResult;\n return rootTrace;\n },\n\n pushFailuresInfo() {\n this._rightmostFailurePositionStack.push(this.rightmostFailurePosition);\n this._recordedFailuresStack.push(this.recordedFailures);\n },\n\n popFailuresInfo() {\n this.rightmostFailurePosition = this._rightmostFailurePositionStack.pop();\n this.recordedFailures = this._recordedFailuresStack.pop();\n },\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar MatchState_1 = MatchState$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst MatchState = MatchState_1;\n\nconst pexprs$4 = pexprs$6;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction Matcher$1(grammar) {\n this.grammar = grammar;\n this.memoTable = [];\n this.input = '';\n}\n\nMatcher$1.prototype.getInput = function() {\n return this.input;\n};\n\nMatcher$1.prototype.setInput = function(str) {\n if (this.input !== str) {\n this.replaceInputRange(0, this.input.length, str);\n }\n return this;\n};\n\nMatcher$1.prototype.replaceInputRange = function(startIdx, endIdx, str) {\n const currentInput = this.input;\n if (\n startIdx < 0 ||\n startIdx > currentInput.length ||\n endIdx < 0 ||\n endIdx > currentInput.length ||\n startIdx > endIdx\n ) {\n throw new Error('Invalid indices: ' + startIdx + ' and ' + endIdx);\n }\n\n // update input\n this.input = currentInput.slice(0, startIdx) + str + currentInput.slice(endIdx);\n\n // update memo table (similar to the above)\n const restOfMemoTable = this.memoTable.slice(endIdx);\n this.memoTable.length = startIdx;\n for (let idx = 0; idx < str.length; idx++) {\n this.memoTable.push(undefined);\n }\n restOfMemoTable.forEach(function(posInfo) {\n this.memoTable.push(posInfo);\n }, this);\n\n // Invalidate memoRecs\n for (let pos = 0; pos < startIdx; pos++) {\n const posInfo = this.memoTable[pos];\n if (posInfo) {\n posInfo.clearObsoleteEntries(pos, startIdx);\n }\n }\n\n return this;\n};\n\nMatcher$1.prototype.match = function(optStartApplicationStr) {\n return this._match(this._getStartExpr(optStartApplicationStr), false);\n};\n\nMatcher$1.prototype.trace = function(optStartApplicationStr) {\n return this._match(this._getStartExpr(optStartApplicationStr), true);\n};\n\nMatcher$1.prototype._match = function(startExpr, tracing, optPositionToRecordFailures) {\n const state = new MatchState(this, startExpr, optPositionToRecordFailures);\n return tracing ? state.getTrace() : state.getMatchResult();\n};\n\n/*\n Returns the starting expression for this Matcher's associated grammar. If `optStartApplicationStr`\n is specified, it is a string expressing a rule application in the grammar. If not specified, the\n grammar's default start rule will be used.\n*/\nMatcher$1.prototype._getStartExpr = function(optStartApplicationStr) {\n const applicationStr = optStartApplicationStr || this.grammar.defaultStartRule;\n if (!applicationStr) {\n throw new Error('Missing start rule argument -- the grammar has no default start rule.');\n }\n\n const startApp = this.grammar.parseApplication(applicationStr);\n return new pexprs$4.Seq([startApp, pexprs$4.end]);\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Matcher_1 = Matcher$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst InputStream$1 = InputStream_1;\nconst {IterationNode} = nodes$1;\nconst MatchResult = MatchResult_1;\nconst common$3 = common$l;\nconst errors$3 = errors$9;\nconst util$2 = util$7;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nconst globalActionStack = [];\n\nconst hasOwnProperty = (x, prop) => Object.prototype.hasOwnProperty.call(x, prop);\n\n// ----------------- Wrappers -----------------\n\n// Wrappers decorate CST nodes with all of the functionality (i.e., operations and attributes)\n// provided by a Semantics (see below). `Wrapper` is the abstract superclass of all wrappers. A\n// `Wrapper` must have `_node` and `_semantics` instance variables, which refer to the CST node and\n// Semantics (resp.) for which it was created, and a `_childWrappers` instance variable which is\n// used to cache the wrapper instances that are created for its child nodes. Setting these instance\n// variables is the responsibility of the constructor of each Semantics-specific subclass of\n// `Wrapper`.\nclass Wrapper {\n constructor(node, sourceInterval, baseInterval) {\n this._node = node;\n this.source = sourceInterval;\n\n // The interval that the childOffsets of `node` are relative to. It should be the source\n // of the closest Nonterminal node.\n this._baseInterval = baseInterval;\n\n if (node.isNonterminal()) {\n common$3.assert(sourceInterval === baseInterval);\n }\n this._childWrappers = [];\n }\n\n toString() {\n return '[semantics wrapper for ' + this._node.grammar.name + ']';\n }\n\n _forgetMemoizedResultFor(attributeName) {\n // Remove the memoized attribute from the cstNode and all its children.\n delete this._node[this._semantics.attributeKeys[attributeName]];\n this.children.forEach(child => {\n child._forgetMemoizedResultFor(attributeName);\n });\n }\n\n // Returns the wrapper of the specified child node. Child wrappers are created lazily and\n // cached in the parent wrapper's `_childWrappers` instance variable.\n child(idx) {\n if (!(0 <= idx && idx < this._node.numChildren())) {\n // TODO: Consider throwing an exception here.\n return undefined;\n }\n let childWrapper = this._childWrappers[idx];\n if (!childWrapper) {\n const childNode = this._node.childAt(idx);\n const offset = this._node.childOffsets[idx];\n\n const source = this._baseInterval.subInterval(offset, childNode.matchLength);\n const base = childNode.isNonterminal() ? source : this._baseInterval;\n childWrapper = this._childWrappers[idx] = this._semantics.wrap(childNode, source, base);\n }\n return childWrapper;\n }\n\n // Returns an array containing the wrappers of all of the children of the node associated\n // with this wrapper.\n _children() {\n // Force the creation of all child wrappers\n for (let idx = 0; idx < this._node.numChildren(); idx++) {\n this.child(idx);\n }\n return this._childWrappers;\n }\n\n // Returns `true` if the CST node associated with this wrapper corresponds to an iteration\n // expression, i.e., a Kleene-*, Kleene-+, or an optional. Returns `false` otherwise.\n isIteration() {\n return this._node.isIteration();\n }\n\n // Returns `true` if the CST node associated with this wrapper is a terminal node, `false`\n // otherwise.\n isTerminal() {\n return this._node.isTerminal();\n }\n\n // Returns `true` if the CST node associated with this wrapper is a nonterminal node, `false`\n // otherwise.\n isNonterminal() {\n return this._node.isNonterminal();\n }\n\n // Returns `true` if the CST node associated with this wrapper is a nonterminal node\n // corresponding to a syntactic rule, `false` otherwise.\n isSyntactic() {\n return this.isNonterminal() && this._node.isSyntactic();\n }\n\n // Returns `true` if the CST node associated with this wrapper is a nonterminal node\n // corresponding to a lexical rule, `false` otherwise.\n isLexical() {\n return this.isNonterminal() && this._node.isLexical();\n }\n\n // Returns `true` if the CST node associated with this wrapper is an iterator node\n // having either one or no child (? operator), `false` otherwise.\n // Otherwise, throws an exception.\n isOptional() {\n return this._node.isOptional();\n }\n\n // Create a new _iter wrapper in the same semantics as this wrapper.\n iteration(optChildWrappers) {\n const childWrappers = optChildWrappers || [];\n\n const childNodes = childWrappers.map(c => c._node);\n const iter = new IterationNode(childNodes, [], -1, false);\n\n const wrapper = this._semantics.wrap(iter, null, null);\n wrapper._childWrappers = childWrappers;\n return wrapper;\n }\n\n // Returns an array containing the children of this CST node.\n get children() {\n return this._children();\n }\n\n // Returns the name of grammar rule that created this CST node.\n get ctorName() {\n return this._node.ctorName;\n }\n\n // TODO: Remove this eventually (deprecated in v0.12).\n get interval() {\n throw new Error('The `interval` property is deprecated -- use `source` instead');\n }\n\n // Returns the number of children of this CST node.\n get numChildren() {\n return this._node.numChildren();\n }\n\n // Returns the contents of the input stream consumed by this CST node.\n get sourceString() {\n return this.source.contents;\n }\n}\n\n// ----------------- Semantics -----------------\n\n// A Semantics is a container for a family of Operations and Attributes for a given grammar.\n// Semantics enable modularity (different clients of a grammar can create their set of operations\n// and attributes in isolation) and extensibility even when operations and attributes are mutually-\n// recursive. This constructor should not be called directly except from\n// `Semantics.createSemantics`. The normal ways to create a Semantics, given a grammar 'g', are\n// `g.createSemantics()` and `g.extendSemantics(parentSemantics)`.\nfunction Semantics$2(grammar, superSemantics) {\n const self = this;\n this.grammar = grammar;\n this.checkedActionDicts = false;\n\n // Constructor for wrapper instances, which are passed as the arguments to the semantic actions\n // of an operation or attribute. Operations and attributes require double dispatch: the semantic\n // action is chosen based on both the node's type and the semantics. Wrappers ensure that\n // the `execute` method is called with the correct (most specific) semantics object as an\n // argument.\n this.Wrapper = class extends (superSemantics ? superSemantics.Wrapper : Wrapper) {\n constructor(node, sourceInterval, baseInterval) {\n super(node, sourceInterval, baseInterval);\n self.checkActionDictsIfHaventAlready();\n this._semantics = self;\n }\n };\n\n this.super = superSemantics;\n if (superSemantics) {\n if (!(grammar.equals(this.super.grammar) || grammar._inheritsFrom(this.super.grammar))) {\n throw new Error(\n \"Cannot extend a semantics for grammar '\" +\n this.super.grammar.name +\n \"' for use with grammar '\" +\n grammar.name +\n \"' (not a sub-grammar)\"\n );\n }\n this.operations = Object.create(this.super.operations);\n this.attributes = Object.create(this.super.attributes);\n this.attributeKeys = Object.create(null);\n\n // Assign unique symbols for each of the attributes inherited from the super-semantics so that\n // they are memoized independently.\n // eslint-disable-next-line guard-for-in\n for (const attributeName in this.attributes) {\n Object.defineProperty(this.attributeKeys, attributeName, {\n value: util$2.uniqueId(attributeName),\n });\n }\n } else {\n this.operations = Object.create(null);\n this.attributes = Object.create(null);\n this.attributeKeys = Object.create(null);\n }\n}\n\nSemantics$2.prototype.toString = function() {\n return '[semantics for ' + this.grammar.name + ']';\n};\n\nSemantics$2.prototype.checkActionDictsIfHaventAlready = function() {\n if (!this.checkedActionDicts) {\n this.checkActionDicts();\n this.checkedActionDicts = true;\n }\n};\n\n// Checks that the action dictionaries for all operations and attributes in this semantics,\n// including the ones that were inherited from the super-semantics, agree with the grammar.\n// Throws an exception if one or more of them doesn't.\nSemantics$2.prototype.checkActionDicts = function() {\n let name;\n // eslint-disable-next-line guard-for-in\n for (name in this.operations) {\n this.operations[name].checkActionDict(this.grammar);\n }\n // eslint-disable-next-line guard-for-in\n for (name in this.attributes) {\n this.attributes[name].checkActionDict(this.grammar);\n }\n};\n\nSemantics$2.prototype.toRecipe = function(semanticsOnly) {\n function hasSuperSemantics(s) {\n return s.super !== Semantics$2.BuiltInSemantics._getSemantics();\n }\n\n let str = '(function(g) {\\n';\n if (hasSuperSemantics(this)) {\n str += ' var semantics = ' + this.super.toRecipe(true) + '(g';\n\n const superSemanticsGrammar = this.super.grammar;\n let relatedGrammar = this.grammar;\n while (relatedGrammar !== superSemanticsGrammar) {\n str += '.superGrammar';\n relatedGrammar = relatedGrammar.superGrammar;\n }\n\n str += ');\\n';\n str += ' return g.extendSemantics(semantics)';\n } else {\n str += ' return g.createSemantics()';\n }\n ['Operation', 'Attribute'].forEach(type => {\n const semanticOperations = this[type.toLowerCase() + 's'];\n Object.keys(semanticOperations).forEach(name => {\n const {actionDict, formals, builtInDefault} = semanticOperations[name];\n\n let signature = name;\n if (formals.length > 0) {\n signature += '(' + formals.join(', ') + ')';\n }\n\n let method;\n if (hasSuperSemantics(this) && this.super[type.toLowerCase() + 's'][name]) {\n method = 'extend' + type;\n } else {\n method = 'add' + type;\n }\n str += '\\n .' + method + '(' + JSON.stringify(signature) + ', {';\n\n const srcArray = [];\n Object.keys(actionDict).forEach(actionName => {\n if (actionDict[actionName] !== builtInDefault) {\n let source = actionDict[actionName].toString().trim();\n\n // Convert method shorthand to plain old function syntax.\n // https://github.com/harc/ohm/issues/263\n source = source.replace(/^.*\\(/, 'function(');\n\n srcArray.push('\\n ' + JSON.stringify(actionName) + ': ' + source);\n }\n });\n str += srcArray.join(',') + '\\n })';\n });\n });\n str += ';\\n })';\n\n if (!semanticsOnly) {\n str =\n '(function() {\\n' +\n ' var grammar = this.fromRecipe(' +\n this.grammar.toRecipe() +\n ');\\n' +\n ' var semantics = ' +\n str +\n '(grammar);\\n' +\n ' return semantics;\\n' +\n '});\\n';\n }\n\n return str;\n};\n\nfunction parseSignature$1(signature, type) {\n if (!Semantics$2.prototypeGrammar) {\n // The Operations and Attributes grammar won't be available while Ohm is loading,\n // but we can get away the following simplification b/c none of the operations\n // that are used while loading take arguments.\n common$3.assert(signature.indexOf('(') === -1);\n return {\n name: signature,\n formals: [],\n };\n }\n\n const r = Semantics$2.prototypeGrammar.match(\n signature,\n type === 'operation' ? 'OperationSignature' : 'AttributeSignature'\n );\n if (r.failed()) {\n throw new Error(r.message);\n }\n\n return Semantics$2.prototypeGrammarSemantics(r).parse();\n}\n\nfunction newDefaultAction(type, name, doIt) {\n return function(...children) {\n const thisThing = this._semantics.operations[name] || this._semantics.attributes[name];\n const args = thisThing.formals.map(formal => this.args[formal]);\n\n if (!this.isIteration() && children.length === 1) {\n // This CST node corresponds to a non-terminal in the grammar (e.g., AddExpr). The fact that\n // we got here means that this action dictionary doesn't have an action for this particular\n // non-terminal or a generic `_nonterminal` action.\n // As a convenience, if this node only has one child, we just return the result of applying\n // this operation / attribute to the child node.\n return doIt.apply(children[0], args);\n } else {\n // Otherwise, we throw an exception to let the programmer know that we don't know what\n // to do with this node.\n throw errors$3.missingSemanticAction(this.ctorName, name, type, globalActionStack);\n }\n };\n}\n\nSemantics$2.prototype.addOperationOrAttribute = function(type, signature, actionDict) {\n const typePlural = type + 's';\n\n const parsedNameAndFormalArgs = parseSignature$1(signature, type);\n const {name} = parsedNameAndFormalArgs;\n const {formals} = parsedNameAndFormalArgs;\n\n // TODO: check that there are no duplicate formal arguments\n\n this.assertNewName(name, type);\n\n // Create the action dictionary for this operation / attribute that contains a `_default` action\n // which defines the default behavior of iteration, terminal, and non-terminal nodes...\n const builtInDefault = newDefaultAction(type, name, doIt);\n const realActionDict = {_default: builtInDefault};\n // ... and add in the actions supplied by the programmer, which may override some or all of the\n // default ones.\n Object.keys(actionDict).forEach(name => {\n realActionDict[name] = actionDict[name];\n });\n\n const entry =\n type === 'operation' ?\n new Operation(name, formals, realActionDict, builtInDefault) :\n new Attribute(name, realActionDict, builtInDefault);\n\n // The following check is not strictly necessary (it will happen later anyway) but it's better to\n // catch errors early.\n entry.checkActionDict(this.grammar);\n\n this[typePlural][name] = entry;\n\n function doIt(...args) {\n // Dispatch to most specific version of this operation / attribute -- it may have been\n // overridden by a sub-semantics.\n const thisThing = this._semantics[typePlural][name];\n\n // Check that the caller passed the correct number of arguments.\n if (arguments.length !== thisThing.formals.length) {\n throw new Error(\n 'Invalid number of arguments passed to ' +\n name +\n ' ' +\n type +\n ' (expected ' +\n thisThing.formals.length +\n ', got ' +\n arguments.length +\n ')'\n );\n }\n\n // Create an \"arguments object\" from the arguments that were passed to this\n // operation / attribute.\n const argsObj = Object.create(null);\n for (const [idx, val] of Object.entries(args)) {\n const formal = thisThing.formals[idx];\n argsObj[formal] = val;\n }\n\n const oldArgs = this.args;\n this.args = argsObj;\n const ans = thisThing.execute(this._semantics, this);\n this.args = oldArgs;\n return ans;\n }\n\n if (type === 'operation') {\n this.Wrapper.prototype[name] = doIt;\n this.Wrapper.prototype[name].toString = function() {\n return '[' + name + ' operation]';\n };\n } else {\n Object.defineProperty(this.Wrapper.prototype, name, {\n get: doIt,\n configurable: true, // So the property can be deleted.\n });\n Object.defineProperty(this.attributeKeys, name, {\n value: util$2.uniqueId(name),\n });\n }\n};\n\nSemantics$2.prototype.extendOperationOrAttribute = function(type, name, actionDict) {\n const typePlural = type + 's';\n\n // Make sure that `name` really is just a name, i.e., that it doesn't also contain formals.\n parseSignature$1(name, 'attribute');\n\n if (!(this.super && name in this.super[typePlural])) {\n throw new Error(\n 'Cannot extend ' +\n type +\n \" '\" +\n name +\n \"': did not inherit an \" +\n type +\n ' with that name'\n );\n }\n if (hasOwnProperty(this[typePlural], name)) {\n throw new Error('Cannot extend ' + type + \" '\" + name + \"' again\");\n }\n\n // Create a new operation / attribute whose actionDict delegates to the super operation /\n // attribute's actionDict, and which has all the keys from `inheritedActionDict`.\n const inheritedFormals = this[typePlural][name].formals;\n const inheritedActionDict = this[typePlural][name].actionDict;\n const newActionDict = Object.create(inheritedActionDict);\n Object.keys(actionDict).forEach(name => {\n newActionDict[name] = actionDict[name];\n });\n\n this[typePlural][name] =\n type === 'operation' ?\n new Operation(name, inheritedFormals, newActionDict) :\n new Attribute(name, newActionDict);\n\n // The following check is not strictly necessary (it will happen later anyway) but it's better to\n // catch errors early.\n this[typePlural][name].checkActionDict(this.grammar);\n};\n\nSemantics$2.prototype.assertNewName = function(name, type) {\n if (hasOwnProperty(Wrapper.prototype, name)) {\n throw new Error('Cannot add ' + type + \" '\" + name + \"': that's a reserved name\");\n }\n if (name in this.operations) {\n throw new Error(\n 'Cannot add ' + type + \" '\" + name + \"': an operation with that name already exists\"\n );\n }\n if (name in this.attributes) {\n throw new Error(\n 'Cannot add ' + type + \" '\" + name + \"': an attribute with that name already exists\"\n );\n }\n};\n\n// Returns a wrapper for the given CST `node` in this semantics.\n// If `node` is already a wrapper, returns `node` itself. // TODO: why is this needed?\nSemantics$2.prototype.wrap = function(node, source, optBaseInterval) {\n const baseInterval = optBaseInterval || source;\n return node instanceof this.Wrapper ? node : new this.Wrapper(node, source, baseInterval);\n};\n\n// Creates a new Semantics instance for `grammar`, inheriting operations and attributes from\n// `optSuperSemantics`, if it is specified. Returns a function that acts as a proxy for the new\n// Semantics instance. When that function is invoked with a CST node as an argument, it returns\n// a wrapper for that node which gives access to the operations and attributes provided by this\n// semantics.\nSemantics$2.createSemantics = function(grammar, optSuperSemantics) {\n const s = new Semantics$2(\n grammar,\n optSuperSemantics !== undefined ?\n optSuperSemantics :\n Semantics$2.BuiltInSemantics._getSemantics()\n );\n\n // To enable clients to invoke a semantics like a function, return a function that acts as a proxy\n // for `s`, which is the real `Semantics` instance.\n const proxy = function ASemantics(matchResult) {\n if (!(matchResult instanceof MatchResult)) {\n throw new TypeError(\n 'Semantics expected a MatchResult, but got ' +\n common$3.unexpectedObjToString(matchResult)\n );\n }\n if (matchResult.failed()) {\n throw new TypeError('cannot apply Semantics to ' + matchResult.toString());\n }\n\n const cst = matchResult._cst;\n if (cst.grammar !== grammar) {\n throw new Error(\n \"Cannot use a MatchResult from grammar '\" +\n cst.grammar.name +\n \"' with a semantics for '\" +\n grammar.name +\n \"'\"\n );\n }\n const inputStream = new InputStream$1(matchResult.input);\n return s.wrap(cst, inputStream.interval(matchResult._cstOffset, matchResult.input.length));\n };\n\n // Forward public methods from the proxy to the semantics instance.\n proxy.addOperation = function(signature, actionDict) {\n s.addOperationOrAttribute('operation', signature, actionDict);\n return proxy;\n };\n proxy.extendOperation = function(name, actionDict) {\n s.extendOperationOrAttribute('operation', name, actionDict);\n return proxy;\n };\n proxy.addAttribute = function(name, actionDict) {\n s.addOperationOrAttribute('attribute', name, actionDict);\n return proxy;\n };\n proxy.extendAttribute = function(name, actionDict) {\n s.extendOperationOrAttribute('attribute', name, actionDict);\n return proxy;\n };\n proxy._getActionDict = function(operationOrAttributeName) {\n const action =\n s.operations[operationOrAttributeName] || s.attributes[operationOrAttributeName];\n if (!action) {\n throw new Error(\n '\"' +\n operationOrAttributeName +\n '\" is not a valid operation or attribute ' +\n 'name in this semantics for \"' +\n grammar.name +\n '\"'\n );\n }\n return action.actionDict;\n };\n proxy._remove = function(operationOrAttributeName) {\n let semantic;\n if (operationOrAttributeName in s.operations) {\n semantic = s.operations[operationOrAttributeName];\n delete s.operations[operationOrAttributeName];\n } else if (operationOrAttributeName in s.attributes) {\n semantic = s.attributes[operationOrAttributeName];\n delete s.attributes[operationOrAttributeName];\n }\n delete s.Wrapper.prototype[operationOrAttributeName];\n return semantic;\n };\n proxy.getOperationNames = function() {\n return Object.keys(s.operations);\n };\n proxy.getAttributeNames = function() {\n return Object.keys(s.attributes);\n };\n proxy.getGrammar = function() {\n return s.grammar;\n };\n proxy.toRecipe = function(semanticsOnly) {\n return s.toRecipe(semanticsOnly);\n };\n\n // Make the proxy's toString() work.\n proxy.toString = s.toString.bind(s);\n\n // Returns the semantics for the proxy.\n proxy._getSemantics = function() {\n return s;\n };\n\n return proxy;\n};\n\n// ----------------- Operation -----------------\n\n// An Operation represents a function to be applied to a concrete syntax tree (CST) -- it's very\n// similar to a Visitor (http://en.wikipedia.org/wiki/Visitor_pattern). An operation is executed by\n// recursively walking the CST, and at each node, invoking the matching semantic action from\n// `actionDict`. See `Operation.prototype.execute` for details of how a CST node's matching semantic\n// action is found.\nclass Operation {\n constructor(name, formals, actionDict, builtInDefault) {\n this.name = name;\n this.formals = formals;\n this.actionDict = actionDict;\n this.builtInDefault = builtInDefault;\n }\n\n checkActionDict(grammar) {\n grammar._checkTopDownActionDict(this.typeName, this.name, this.actionDict);\n }\n\n // Execute this operation on the CST node associated with `nodeWrapper` in the context of the\n // given Semantics instance.\n execute(semantics, nodeWrapper) {\n try {\n // Look for a semantic action whose name matches the node's constructor name, which is either\n // the name of a rule in the grammar, or '_terminal' (for a terminal node), or '_iter' (for an\n // iteration node).\n const {ctorName} = nodeWrapper._node;\n let actionFn = this.actionDict[ctorName];\n if (actionFn) {\n globalActionStack.push([this, ctorName]);\n return actionFn.apply(nodeWrapper, nodeWrapper._children());\n }\n\n // The action dictionary does not contain a semantic action for this specific type of node.\n // If this is a nonterminal node and the programmer has provided a `_nonterminal` semantic\n // action, we invoke it:\n if (nodeWrapper.isNonterminal()) {\n actionFn = this.actionDict._nonterminal;\n if (actionFn) {\n globalActionStack.push([this, '_nonterminal', ctorName]);\n return actionFn.apply(nodeWrapper, nodeWrapper._children());\n }\n }\n\n // Otherwise, we invoke the '_default' semantic action.\n globalActionStack.push([this, 'default action', ctorName]);\n return this.actionDict._default.apply(nodeWrapper, nodeWrapper._children());\n } finally {\n globalActionStack.pop();\n }\n }\n}\n\nOperation.prototype.typeName = 'operation';\n\n// ----------------- Attribute -----------------\n\n// Attributes are Operations whose results are memoized. This means that, for any given semantics,\n// the semantic action for a CST node will be invoked no more than once.\nclass Attribute extends Operation {\n constructor(name, actionDict, builtInDefault) {\n super(name, [], actionDict, builtInDefault);\n }\n\n execute(semantics, nodeWrapper) {\n const node = nodeWrapper._node;\n const key = semantics.attributeKeys[this.name];\n if (!hasOwnProperty(node, key)) {\n // The following is a super-send -- isn't JS beautiful? :/\n node[key] = Operation.prototype.execute.call(this, semantics, nodeWrapper);\n }\n return node[key];\n }\n}\n\nAttribute.prototype.typeName = 'attribute';\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Semantics_1 = Semantics$2;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst CaseInsensitiveTerminal = CaseInsensitiveTerminal_1;\nconst Matcher = Matcher_1;\nconst Semantics$1 = Semantics_1;\nconst common$2 = common$l;\nconst errors$2 = errors$9;\nconst pexprs$3 = pexprs$6;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nconst SPECIAL_ACTION_NAMES = ['_iter', '_terminal', '_nonterminal', '_default'];\n\nfunction getSortedRuleValues(grammar) {\n return Object.keys(grammar.rules)\n .sort()\n .map(name => grammar.rules[name]);\n}\n\n// Until ES2019, JSON was not a valid subset of JavaScript because U+2028 (line separator)\n// and U+2029 (paragraph separator) are allowed in JSON string literals, but not in JS.\n// This function properly encodes those two characters so that the resulting string is\n// represents both valid JSON, and valid JavaScript (for ES2018 and below).\n// See https://v8.dev/features/subsume-json for more details.\nconst jsonToJS = str => str.replace(/\\u2028/g, '\\\\u2028').replace(/\\u2029/g, '\\\\u2029');\n\nfunction Grammar$4(name, superGrammar, rules, optDefaultStartRule) {\n this.name = name;\n this.superGrammar = superGrammar;\n this.rules = rules;\n if (optDefaultStartRule) {\n if (!(optDefaultStartRule in rules)) {\n throw new Error(\n \"Invalid start rule: '\" +\n optDefaultStartRule +\n \"' is not a rule in grammar '\" +\n name +\n \"'\"\n );\n }\n this.defaultStartRule = optDefaultStartRule;\n }\n}\n\nlet ohmGrammar$2;\nlet buildGrammar$1;\n\n// This method is called from main.js once Ohm has loaded.\nGrammar$4.initApplicationParser = function(grammar, builderFn) {\n ohmGrammar$2 = grammar;\n buildGrammar$1 = builderFn;\n};\n\nGrammar$4.prototype = {\n matcher() {\n return new Matcher(this);\n },\n\n // Return true if the grammar is a built-in grammar, otherwise false.\n // NOTE: This might give an unexpected result if called before BuiltInRules is defined!\n isBuiltIn() {\n return this === Grammar$4.ProtoBuiltInRules || this === Grammar$4.BuiltInRules;\n },\n\n equals(g) {\n if (this === g) {\n return true;\n }\n // Do the cheapest comparisons first.\n if (\n g == null ||\n this.name !== g.name ||\n this.defaultStartRule !== g.defaultStartRule ||\n !(this.superGrammar === g.superGrammar || this.superGrammar.equals(g.superGrammar))\n ) {\n return false;\n }\n const myRules = getSortedRuleValues(this);\n const otherRules = getSortedRuleValues(g);\n return (\n myRules.length === otherRules.length &&\n myRules.every((rule, i) => {\n return (\n rule.description === otherRules[i].description &&\n rule.formals.join(',') === otherRules[i].formals.join(',') &&\n rule.body.toString() === otherRules[i].body.toString()\n );\n })\n );\n },\n\n match(input, optStartApplication) {\n const m = this.matcher();\n m.replaceInputRange(0, 0, input);\n return m.match(optStartApplication);\n },\n\n trace(input, optStartApplication) {\n const m = this.matcher();\n m.replaceInputRange(0, 0, input);\n return m.trace(optStartApplication);\n },\n\n createSemantics() {\n return Semantics$1.createSemantics(this);\n },\n\n extendSemantics(superSemantics) {\n return Semantics$1.createSemantics(this, superSemantics._getSemantics());\n },\n\n // Check that every key in `actionDict` corresponds to a semantic action, and that it maps to\n // a function of the correct arity. If not, throw an exception.\n _checkTopDownActionDict(what, name, actionDict) {\n const problems = [];\n\n // eslint-disable-next-line guard-for-in\n for (const k in actionDict) {\n const v = actionDict[k];\n const isSpecialAction = SPECIAL_ACTION_NAMES.includes(k);\n\n if (!isSpecialAction && !(k in this.rules)) {\n problems.push(`'${k}' is not a valid semantic action for '${this.name}'`);\n continue;\n }\n if (typeof v !== 'function') {\n problems.push(`'${k}' must be a function in an action dictionary for '${this.name}'`);\n continue;\n }\n const actual = v.length;\n const expected = this._topDownActionArity(k);\n if (actual !== expected) {\n let details;\n if (k === '_iter' || k === '_nonterminal') {\n details =\n `it should use a rest parameter, e.g. \\`${k}(...children) {}\\`. ` +\n 'NOTE: this is new in Ohm v16 — see https://ohmjs.org/d/ati for details.';\n } else {\n details = `expected ${expected}, got ${actual}`;\n }\n problems.push(`Semantic action '${k}' has the wrong arity: ${details}`);\n }\n }\n if (problems.length > 0) {\n const prettyProblems = problems.map(problem => '- ' + problem);\n const error = new Error(\n [\n `Found errors in the action dictionary of the '${name}' ${what}:`,\n ...prettyProblems,\n ].join('\\n')\n );\n error.problems = problems;\n throw error;\n }\n },\n\n // Return the expected arity for a semantic action named `actionName`, which\n // is either a rule name or a special action name like '_nonterminal'.\n _topDownActionArity(actionName) {\n // All special actions have an expected arity of 0, though all but _terminal\n // are expected to use the rest parameter syntax (e.g. `_iter(...children)`).\n // This is considered to have arity 0, i.e. `((...args) => {}).length` is 0.\n return SPECIAL_ACTION_NAMES.includes(actionName) ?\n 0 :\n this.rules[actionName].body.getArity();\n },\n\n _inheritsFrom(grammar) {\n let g = this.superGrammar;\n while (g) {\n if (g.equals(grammar, true)) {\n return true;\n }\n g = g.superGrammar;\n }\n return false;\n },\n\n toRecipe(superGrammarExpr = undefined) {\n const metaInfo = {};\n // Include the grammar source if it is available.\n if (this.source) {\n metaInfo.source = this.source.contents;\n }\n\n let startRule = null;\n if (this.defaultStartRule) {\n startRule = this.defaultStartRule;\n }\n\n const rules = {};\n Object.keys(this.rules).forEach(ruleName => {\n const ruleInfo = this.rules[ruleName];\n const {body} = ruleInfo;\n const isDefinition = !this.superGrammar || !this.superGrammar.rules[ruleName];\n\n let operation;\n if (isDefinition) {\n operation = 'define';\n } else {\n operation = body instanceof pexprs$3.Extend ? 'extend' : 'override';\n }\n\n const metaInfo = {};\n if (ruleInfo.source && this.source) {\n const adjusted = ruleInfo.source.relativeTo(this.source);\n metaInfo.sourceInterval = [adjusted.startIdx, adjusted.endIdx];\n }\n\n const description = isDefinition ? ruleInfo.description : null;\n const bodyRecipe = body.outputRecipe(ruleInfo.formals, this.source);\n\n rules[ruleName] = [\n operation, // \"define\"/\"extend\"/\"override\"\n metaInfo,\n description,\n ruleInfo.formals,\n bodyRecipe,\n ];\n });\n\n // If the caller provided an expression to use for the supergrammar, use that.\n // Otherwise, if the supergrammar is a user grammar, use its recipe inline.\n let superGrammarOutput = 'null';\n if (superGrammarExpr) {\n superGrammarOutput = superGrammarExpr;\n } else if (this.superGrammar && !this.superGrammar.isBuiltIn()) {\n superGrammarOutput = this.superGrammar.toRecipe();\n }\n\n const recipeElements = [\n ...['grammar', metaInfo, this.name].map(JSON.stringify),\n superGrammarOutput,\n ...[startRule, rules].map(JSON.stringify),\n ];\n return jsonToJS(`[${recipeElements.join(',')}]`);\n },\n\n // TODO: Come up with better names for these methods.\n // TODO: Write the analog of these methods for inherited attributes.\n toOperationActionDictionaryTemplate() {\n return this._toOperationOrAttributeActionDictionaryTemplate();\n },\n toAttributeActionDictionaryTemplate() {\n return this._toOperationOrAttributeActionDictionaryTemplate();\n },\n\n _toOperationOrAttributeActionDictionaryTemplate() {\n // TODO: add the super-grammar's templates at the right place, e.g., a case for AddExpr_plus\n // should appear next to other cases of AddExpr.\n\n const sb = new common$2.StringBuffer();\n sb.append('{');\n\n let first = true;\n // eslint-disable-next-line guard-for-in\n for (const ruleName in this.rules) {\n const {body} = this.rules[ruleName];\n if (first) {\n first = false;\n } else {\n sb.append(',');\n }\n sb.append('\\n');\n sb.append(' ');\n this.addSemanticActionTemplate(ruleName, body, sb);\n }\n\n sb.append('\\n}');\n return sb.contents();\n },\n\n addSemanticActionTemplate(ruleName, body, sb) {\n sb.append(ruleName);\n sb.append(': function(');\n const arity = this._topDownActionArity(ruleName);\n sb.append(common$2.repeat('_', arity).join(', '));\n sb.append(') {\\n');\n sb.append(' }');\n },\n\n // Parse a string which expresses a rule application in this grammar, and return the\n // resulting Apply node.\n parseApplication(str) {\n let app;\n if (str.indexOf('<') === -1) {\n // simple application\n app = new pexprs$3.Apply(str);\n } else {\n // parameterized application\n const cst = ohmGrammar$2.match(str, 'Base_application');\n app = buildGrammar$1(cst, {});\n }\n\n // Ensure that the application is valid.\n if (!(app.ruleName in this.rules)) {\n throw errors$2.undeclaredRule(app.ruleName, this.name);\n }\n const {formals} = this.rules[app.ruleName];\n if (formals.length !== app.args.length) {\n const {source} = this.rules[app.ruleName];\n throw errors$2.wrongNumberOfParameters(\n app.ruleName,\n formals.length,\n app.args.length,\n source\n );\n }\n return app;\n },\n};\n\n// The following grammar contains a few rules that couldn't be written in \"userland\".\n// At the bottom of src/main.js, we create a sub-grammar of this grammar that's called\n// `BuiltInRules`. That grammar contains several convenience rules, e.g., `letter` and\n// `digit`, and is implicitly the super-grammar of any grammar whose super-grammar\n// isn't specified.\nGrammar$4.ProtoBuiltInRules = new Grammar$4(\n 'ProtoBuiltInRules', // name\n undefined, // supergrammar\n {\n any: {\n body: pexprs$3.any,\n formals: [],\n description: 'any character',\n primitive: true,\n },\n end: {\n body: pexprs$3.end,\n formals: [],\n description: 'end of input',\n primitive: true,\n },\n\n caseInsensitive: {\n body: new CaseInsensitiveTerminal(new pexprs$3.Param(0)),\n formals: ['str'],\n primitive: true,\n },\n lower: {\n body: new pexprs$3.UnicodeChar('Ll'),\n formals: [],\n description: 'a lowercase letter',\n primitive: true,\n },\n upper: {\n body: new pexprs$3.UnicodeChar('Lu'),\n formals: [],\n description: 'an uppercase letter',\n primitive: true,\n },\n // Union of Lt (titlecase), Lm (modifier), and Lo (other), i.e. any letter not in Ll or Lu.\n unicodeLtmo: {\n body: new pexprs$3.UnicodeChar('Ltmo'),\n formals: [],\n description: 'a Unicode character in Lt, Lm, or Lo',\n primitive: true,\n },\n\n // These rules are not truly primitive (they could be written in userland) but are defined\n // here for bootstrapping purposes.\n spaces: {\n body: new pexprs$3.Star(new pexprs$3.Apply('space')),\n formals: [],\n },\n space: {\n body: new pexprs$3.Range('\\x00', ' '),\n formals: [],\n description: 'a space',\n },\n }\n);\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Grammar_1 = Grammar$4;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Grammar$3 = Grammar_1;\nconst InputStream = InputStream_1;\nconst common$1 = common$l;\nconst errors$1 = errors$9;\nconst pexprs$2 = pexprs$6;\n\n// --------------------------------------------------------------------\n// Private Stuff\n// --------------------------------------------------------------------\n\n// Constructors\n\nfunction GrammarDecl$1(name) {\n this.name = name;\n}\n\n// Helpers\n\nGrammarDecl$1.prototype.sourceInterval = function(startIdx, endIdx) {\n return this.source.subInterval(startIdx, endIdx - startIdx);\n};\n\nGrammarDecl$1.prototype.ensureSuperGrammar = function() {\n if (!this.superGrammar) {\n this.withSuperGrammar(\n // TODO: The conditional expression below is an ugly hack. It's kind of ok because\n // I doubt anyone will ever try to declare a grammar called `BuiltInRules`. Still,\n // we should try to find a better way to do this.\n this.name === 'BuiltInRules' ? Grammar$3.ProtoBuiltInRules : Grammar$3.BuiltInRules\n );\n }\n return this.superGrammar;\n};\n\nGrammarDecl$1.prototype.ensureSuperGrammarRuleForOverriding = function(name, source) {\n const ruleInfo = this.ensureSuperGrammar().rules[name];\n if (!ruleInfo) {\n throw errors$1.cannotOverrideUndeclaredRule(name, this.superGrammar.name, source);\n }\n return ruleInfo;\n};\n\nGrammarDecl$1.prototype.installOverriddenOrExtendedRule = function(\n name,\n formals,\n body,\n source\n) {\n const duplicateParameterNames = common$1.getDuplicates(formals);\n if (duplicateParameterNames.length > 0) {\n throw errors$1.duplicateParameterNames(name, duplicateParameterNames, source);\n }\n const ruleInfo = this.ensureSuperGrammar().rules[name];\n const expectedFormals = ruleInfo.formals;\n const expectedNumFormals = expectedFormals ? expectedFormals.length : 0;\n if (formals.length !== expectedNumFormals) {\n throw errors$1.wrongNumberOfParameters(name, expectedNumFormals, formals.length, source);\n }\n return this.install(name, formals, body, ruleInfo.description, source);\n};\n\nGrammarDecl$1.prototype.install = function(name, formals, body, description, source) {\n this.rules[name] = {\n body: body.introduceParams(formals),\n formals,\n description,\n source,\n };\n return this;\n};\n\n// Stuff that you should only do once\n\nGrammarDecl$1.prototype.withSuperGrammar = function(superGrammar) {\n if (this.superGrammar) {\n throw new Error('the super grammar of a GrammarDecl cannot be set more than once');\n }\n this.superGrammar = superGrammar;\n this.rules = Object.create(superGrammar.rules);\n\n // Grammars with an explicit supergrammar inherit a default start rule.\n if (!superGrammar.isBuiltIn()) {\n this.defaultStartRule = superGrammar.defaultStartRule;\n }\n return this;\n};\n\nGrammarDecl$1.prototype.withDefaultStartRule = function(ruleName) {\n this.defaultStartRule = ruleName;\n return this;\n};\n\nGrammarDecl$1.prototype.withSource = function(source) {\n this.source = new InputStream(source).interval(0, source.length);\n return this;\n};\n\n// Creates a Grammar instance, and if it passes the sanity checks, returns it.\nGrammarDecl$1.prototype.build = function() {\n const grammar = new Grammar$3(\n this.name,\n this.ensureSuperGrammar(),\n this.rules,\n this.defaultStartRule\n );\n\n // TODO: change the pexpr.prototype.assert... methods to make them add\n // exceptions to an array that's provided as an arg. Then we'll be able to\n // show more than one error of the same type at a time.\n // TODO: include the offending pexpr in the errors, that way we can show\n // the part of the source that caused it.\n const grammarErrors = [];\n let grammarHasInvalidApplications = false;\n Object.keys(grammar.rules).forEach(ruleName => {\n const {body} = grammar.rules[ruleName];\n try {\n body.assertChoicesHaveUniformArity(ruleName);\n } catch (e) {\n grammarErrors.push(e);\n }\n try {\n body.assertAllApplicationsAreValid(ruleName, grammar);\n } catch (e) {\n grammarErrors.push(e);\n grammarHasInvalidApplications = true;\n }\n });\n if (!grammarHasInvalidApplications) {\n // The following check can only be done if the grammar has no invalid applications.\n Object.keys(grammar.rules).forEach(ruleName => {\n const {body} = grammar.rules[ruleName];\n try {\n body.assertIteratedExprsAreNotNullable(grammar, []);\n } catch (e) {\n grammarErrors.push(e);\n }\n });\n }\n if (grammarErrors.length > 0) {\n errors$1.throwErrors(grammarErrors);\n }\n if (this.source) {\n grammar.source = this.source;\n }\n\n return grammar;\n};\n\n// Rule declarations\n\nGrammarDecl$1.prototype.define = function(name, formals, body, description, source) {\n this.ensureSuperGrammar();\n if (this.superGrammar.rules[name]) {\n throw errors$1.duplicateRuleDeclaration(name, this.name, this.superGrammar.name, source);\n } else if (this.rules[name]) {\n throw errors$1.duplicateRuleDeclaration(name, this.name, this.name, source);\n }\n const duplicateParameterNames = common$1.getDuplicates(formals);\n if (duplicateParameterNames.length > 0) {\n throw errors$1.duplicateParameterNames(name, duplicateParameterNames, source);\n }\n return this.install(name, formals, body, description, source);\n};\n\nGrammarDecl$1.prototype.override = function(name, formals, body, descIgnored, source) {\n this.ensureSuperGrammarRuleForOverriding(name, source);\n this.installOverriddenOrExtendedRule(name, formals, body, source);\n return this;\n};\n\nGrammarDecl$1.prototype.extend = function(name, formals, fragment, descIgnored, source) {\n const ruleInfo = this.ensureSuperGrammar().rules[name];\n if (!ruleInfo) {\n throw errors$1.cannotExtendUndeclaredRule(name, this.superGrammar.name, source);\n }\n const body = new pexprs$2.Extend(this.superGrammar, name, fragment);\n body.source = fragment.source;\n this.installOverriddenOrExtendedRule(name, formals, body, source);\n return this;\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar GrammarDecl_1 = GrammarDecl$1;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Grammar$2 = Grammar_1;\nconst GrammarDecl = GrammarDecl_1;\nconst pexprs$1 = pexprs$6;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction Builder$2() {}\n\nBuilder$2.prototype = {\n currentDecl: null,\n currentRuleName: null,\n\n newGrammar(name) {\n return new GrammarDecl(name);\n },\n\n grammar(metaInfo, name, superGrammar, defaultStartRule, rules) {\n const gDecl = new GrammarDecl(name);\n if (superGrammar) {\n // `superGrammar` may be a recipe (i.e. an Array), or an actual grammar instance.\n gDecl.withSuperGrammar(\n superGrammar instanceof Grammar$2 ? superGrammar : this.fromRecipe(superGrammar)\n );\n }\n if (defaultStartRule) {\n gDecl.withDefaultStartRule(defaultStartRule);\n }\n if (metaInfo && metaInfo.source) {\n gDecl.withSource(metaInfo.source);\n }\n\n this.currentDecl = gDecl;\n Object.keys(rules).forEach(ruleName => {\n this.currentRuleName = ruleName;\n const ruleRecipe = rules[ruleName];\n\n const action = ruleRecipe[0]; // define/extend/override\n const metaInfo = ruleRecipe[1];\n const description = ruleRecipe[2];\n const formals = ruleRecipe[3];\n const body = this.fromRecipe(ruleRecipe[4]);\n\n let source;\n if (gDecl.source && metaInfo && metaInfo.sourceInterval) {\n source = gDecl.source.subInterval(\n metaInfo.sourceInterval[0],\n metaInfo.sourceInterval[1] - metaInfo.sourceInterval[0]\n );\n }\n gDecl[action](ruleName, formals, body, description, source);\n });\n this.currentRuleName = this.currentDecl = null;\n return gDecl.build();\n },\n\n terminal(x) {\n return new pexprs$1.Terminal(x);\n },\n\n range(from, to) {\n return new pexprs$1.Range(from, to);\n },\n\n param(index) {\n return new pexprs$1.Param(index);\n },\n\n alt(...termArgs) {\n let terms = [];\n for (let arg of termArgs) {\n if (!(arg instanceof pexprs$1.PExpr)) {\n arg = this.fromRecipe(arg);\n }\n if (arg instanceof pexprs$1.Alt) {\n terms = terms.concat(arg.terms);\n } else {\n terms.push(arg);\n }\n }\n return terms.length === 1 ? terms[0] : new pexprs$1.Alt(terms);\n },\n\n seq(...factorArgs) {\n let factors = [];\n for (let arg of factorArgs) {\n if (!(arg instanceof pexprs$1.PExpr)) {\n arg = this.fromRecipe(arg);\n }\n if (arg instanceof pexprs$1.Seq) {\n factors = factors.concat(arg.factors);\n } else {\n factors.push(arg);\n }\n }\n return factors.length === 1 ? factors[0] : new pexprs$1.Seq(factors);\n },\n\n star(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Star(expr);\n },\n\n plus(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Plus(expr);\n },\n\n opt(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Opt(expr);\n },\n\n not(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Not(expr);\n },\n\n la(expr) {\n // TODO: temporary to still be able to read old recipes\n return this.lookahead(expr);\n },\n\n lookahead(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Lookahead(expr);\n },\n\n lex(expr) {\n if (!(expr instanceof pexprs$1.PExpr)) {\n expr = this.fromRecipe(expr);\n }\n return new pexprs$1.Lex(expr);\n },\n\n app(ruleName, optParams) {\n if (optParams && optParams.length > 0) {\n optParams = optParams.map(function(param) {\n return param instanceof pexprs$1.PExpr ? param : this.fromRecipe(param);\n }, this);\n }\n return new pexprs$1.Apply(ruleName, optParams);\n },\n\n // Note that unlike other methods in this class, this method cannot be used as a\n // convenience constructor. It only works with recipes, because it relies on\n // `this.currentDecl` and `this.currentRuleName` being set.\n splice(beforeTerms, afterTerms) {\n return new pexprs$1.Splice(\n this.currentDecl.superGrammar,\n this.currentRuleName,\n beforeTerms.map(term => this.fromRecipe(term)),\n afterTerms.map(term => this.fromRecipe(term))\n );\n },\n\n fromRecipe(recipe) {\n // the meta-info of 'grammar' is processed in Builder.grammar\n const args = recipe[0] === 'grammar' ? recipe.slice(1) : recipe.slice(2);\n const result = this[recipe[0]](...args);\n\n const metaInfo = recipe[1];\n if (metaInfo) {\n if (metaInfo.sourceInterval && this.currentDecl) {\n result.withSource(this.currentDecl.sourceInterval(...metaInfo.sourceInterval));\n }\n }\n return result;\n },\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar Builder_1 = Builder$2;\n\nvar name = \"ohm-js\";\nvar version$2 = \"16.6.0\";\nvar description = \"An object-oriented language for parsing and pattern matching\";\nvar repository = \"https://github.com/harc/ohm\";\nvar keywords = [\n\t\"parser\",\n\t\"compiler\",\n\t\"pattern matching\",\n\t\"pattern-matching\",\n\t\"ometa\",\n\t\"ometa/js\",\n\t\"ometa-js\",\n\t\"ometajs\",\n\t\"rapid\",\n\t\"prototyping\"\n];\nvar homepage = \"https://ohmjs.org\";\nvar bugs = \"https://github.com/harc/ohm/issues\";\nvar main = \"index.js\";\nvar module = \"dist/ohm.esm.js\";\nvar files = [\n\t\"src\",\n\t\"dist\",\n\t\"extras\",\n\t\"third_party\",\n\t\"index.d.ts\"\n];\nvar types = \"index.d.ts\";\nvar scripts = {\n\tprebootstrap: \"bash scripts/prebootstrap\",\n\tbootstrap: \"bash scripts/bootstrap --test || (echo 'Bootstrap failed.' && mv -v dist/ohm-grammar.js.old dist/ohm-grammar.js && mv -v dist/built-in-rules.js.old dist/built-in-rules.js && mv -v dist/operations-and-attributes.js.old dist/operations-and-attributes.js)\",\n\tbuild: \"yarn build-debug && webpack --mode=production\",\n\t\"build-debug\": \"webpack --mode=development && yarn build-esm && node scripts/generate-types.mjs\",\n\t\"build-esm\": \"rollup -c rollup.config.mjs\",\n\tclean: \"rm -f dist/ohm.js dist/ohm.min.js\",\n\tlint: \"eslint . --ignore-path ../.eslintignore\",\n\tformat: \"prettier . --write --ignore-path ../.prettierignore --config ../.prettierrc && eslint . --ignore-path ../.eslintignore --fix\",\n\ttest: \"ava && ava --config ava-ts.config.js test/test-typings.ts\",\n\t\"test-watch\": \"ava --watch\",\n\t\"pre-commit\": \"yarn run lint && yarn run build && yarn run test\",\n\tprepublishOnly: \"bash scripts/prepublishOnly\",\n\tprepack: \"cp ../../README.md . && yarn build\",\n\tpostpack: \"rm README.md\",\n\tpostpublish: \"echo '👉 Now go to https://github.com/harc/ohm/releases and create a release.'\",\n\t\"unsafe-bootstrap\": \"bash scripts/bootstrap\",\n\t\"update-contributors\": \"bash scripts/update-contributors\",\n\twatch: \"webpack --mode=development --watch\"\n};\nvar license = \"MIT\";\nvar author = \"Alex Warth (http://tinlizzie.org/~awarth)\";\nvar contributors = [\n\t\"Patrick Dubroy \",\n\t\"Meixian Li \",\n\t\"Marko Röder \",\n\t\"Tony Garnock-Jones \",\n\t\"Saketh Kasibatla \",\n\t\"Lionel Landwerlin \",\n\t\"Jason Merrill \",\n\t\"Ray Toal \",\n\t\"Yoshiki Ohshima \",\n\t\"megabuz <3299889+megabuz@users.noreply.github.com>\",\n\t\"Jonathan Edwards \",\n\t\"Milan Lajtoš \",\n\t\"Neil Jewers \",\n\t\"stagas \",\n\t\"AngryPowman \",\n\t\"Arthur Carabott \",\n\t\"Casey Olson \",\n\t\"Daniel Tomlinson \",\n\t\"Ian Harris \",\n\t\"Justin Chase \",\n\t\"Leslie Ying \",\n\t\"Luca Guzzon \",\n\t\"Mike Niebling <(none)>\",\n\t\"Patrick Dubroy \",\n\t\"Pierre Donias \",\n\t\"Stan Rozenraukh \",\n\t\"Stephan Seidt \",\n\t\"Steve Phillips \",\n\t\"Szymon Kaliski \",\n\t\"Thomas Nyberg \",\n\t\"Vse Mozhet Byt \",\n\t\"Wil Chung <10446+iamwilhelm@users.noreply.github.com>\",\n\t\"Zachary Sakowitz \",\n\t\"abego \",\n\t\"acslk \",\n\t\"codeZeilen \",\n\t\"kassadin \",\n\t\"owch \",\n\t\"sfinnie \"\n];\nvar dependencies = {\n};\nvar devDependencies = {\n\t\"@ohm-js/cli\": \"^1.0.0\",\n\t\"@rollup/plugin-commonjs\": \"^21.0.1\",\n\t\"@rollup/plugin-json\": \"^4.1.0\",\n\t\"@rollup/plugin-node-resolve\": \"^13.1.3\",\n\tava: \"^3.15.0\",\n\t\"ava-spec\": \"^1.1.1\",\n\tdedent: \"^0.7.0\",\n\teslint: \"^7.9.0\",\n\t\"eslint-config-google\": \"^0.14.0\",\n\t\"eslint-plugin-ava\": \"^11.0.0\",\n\t\"eslint-plugin-camelcase-ohm\": \"^0.2.1\",\n\t\"eslint-plugin-no-extension-in-require\": \"^0.2.0\",\n\thusky: \"^4.2.5\",\n\tjsdom: \"^9.9.1\",\n\tjson: \"^9.0.6\",\n\tmarkscript: \"^0.5.0\",\n\t\"node-static\": \"^0.7.11\",\n\t\"ohm-grammar-ecmascript\": \"^1.0.0\",\n\trollup: \"^2.63.0\",\n\t\"ts-loader\": \"^8.0.4\",\n\t\"ts-node\": \"^9.0.0\",\n\ttypescript: \"^4.0.3\",\n\t\"walk-sync\": \"^2.2.0\",\n\twebpack: \"^4.44.2\",\n\t\"webpack-cli\": \"^3.3.12\"\n};\nvar engines = {\n\tnode: \">=0.12.1\"\n};\nvar require$$0 = {\n\tname: name,\n\tversion: version$2,\n\tdescription: description,\n\trepository: repository,\n\tkeywords: keywords,\n\thomepage: homepage,\n\tbugs: bugs,\n\tmain: main,\n\tmodule: module,\n\tfiles: files,\n\ttypes: types,\n\tscripts: scripts,\n\tlicense: license,\n\tauthor: author,\n\tcontributors: contributors,\n\tdependencies: dependencies,\n\tdevDependencies: devDependencies,\n\tengines: engines\n};\n\n/* global __GLOBAL_OHM_VERSION__ */\n\n// When running under Node, read the version from package.json. For the browser,\n// use a special global variable defined in the build process (see webpack.config.js).\nvar version$1 =\n typeof __GLOBAL_OHM_VERSION__ === 'string' ?\n __GLOBAL_OHM_VERSION__ :\n require$$0.version;\n\nvar makeRecipe$5 = {};\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Builder$1 = Builder_1;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nfunction makeRecipe$4(recipe) {\n if (typeof recipe === 'function') {\n return recipe.call(new Builder$1());\n } else {\n if (typeof recipe === 'string') {\n // stringified JSON recipe\n recipe = JSON.parse(recipe);\n }\n return new Builder$1().fromRecipe(recipe);\n }\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nmakeRecipe$5.makeRecipe = makeRecipe$4;\n\nvar {makeRecipe: makeRecipe$3} = makeRecipe$5;\nvar builtInRules = makeRecipe$3([\"grammar\",{\"source\":\"BuiltInRules {\\n\\n alnum (an alpha-numeric character)\\n = letter\\n | digit\\n\\n letter (a letter)\\n = lower\\n | upper\\n | unicodeLtmo\\n\\n digit (a digit)\\n = \\\"0\\\"..\\\"9\\\"\\n\\n hexDigit (a hexadecimal digit)\\n = digit\\n | \\\"a\\\"..\\\"f\\\"\\n | \\\"A\\\"..\\\"F\\\"\\n\\n ListOf\\n = NonemptyListOf\\n | EmptyListOf\\n\\n NonemptyListOf\\n = elem (sep elem)*\\n\\n EmptyListOf\\n = /* nothing */\\n\\n listOf\\n = nonemptyListOf\\n | emptyListOf\\n\\n nonemptyListOf\\n = elem (sep elem)*\\n\\n emptyListOf\\n = /* nothing */\\n\\n // Allows a syntactic rule application within a lexical context.\\n applySyntactic = app\\n}\"},\"BuiltInRules\",null,null,{\"alnum\":[\"define\",{\"sourceInterval\":[18,78]},\"an alpha-numeric character\",[],[\"alt\",{\"sourceInterval\":[60,78]},[\"app\",{\"sourceInterval\":[60,66]},\"letter\",[]],[\"app\",{\"sourceInterval\":[73,78]},\"digit\",[]]]],\"letter\":[\"define\",{\"sourceInterval\":[82,142]},\"a letter\",[],[\"alt\",{\"sourceInterval\":[107,142]},[\"app\",{\"sourceInterval\":[107,112]},\"lower\",[]],[\"app\",{\"sourceInterval\":[119,124]},\"upper\",[]],[\"app\",{\"sourceInterval\":[131,142]},\"unicodeLtmo\",[]]]],\"digit\":[\"define\",{\"sourceInterval\":[146,177]},\"a digit\",[],[\"range\",{\"sourceInterval\":[169,177]},\"0\",\"9\"]],\"hexDigit\":[\"define\",{\"sourceInterval\":[181,254]},\"a hexadecimal digit\",[],[\"alt\",{\"sourceInterval\":[219,254]},[\"app\",{\"sourceInterval\":[219,224]},\"digit\",[]],[\"range\",{\"sourceInterval\":[231,239]},\"a\",\"f\"],[\"range\",{\"sourceInterval\":[246,254]},\"A\",\"F\"]]],\"ListOf\":[\"define\",{\"sourceInterval\":[258,336]},null,[\"elem\",\"sep\"],[\"alt\",{\"sourceInterval\":[282,336]},[\"app\",{\"sourceInterval\":[282,307]},\"NonemptyListOf\",[[\"param\",{\"sourceInterval\":[297,301]},0],[\"param\",{\"sourceInterval\":[303,306]},1]]],[\"app\",{\"sourceInterval\":[314,336]},\"EmptyListOf\",[[\"param\",{\"sourceInterval\":[326,330]},0],[\"param\",{\"sourceInterval\":[332,335]},1]]]]],\"NonemptyListOf\":[\"define\",{\"sourceInterval\":[340,388]},null,[\"elem\",\"sep\"],[\"seq\",{\"sourceInterval\":[372,388]},[\"param\",{\"sourceInterval\":[372,376]},0],[\"star\",{\"sourceInterval\":[377,388]},[\"seq\",{\"sourceInterval\":[378,386]},[\"param\",{\"sourceInterval\":[378,381]},1],[\"param\",{\"sourceInterval\":[382,386]},0]]]]],\"EmptyListOf\":[\"define\",{\"sourceInterval\":[392,434]},null,[\"elem\",\"sep\"],[\"seq\",{\"sourceInterval\":[438,438]}]],\"listOf\":[\"define\",{\"sourceInterval\":[438,516]},null,[\"elem\",\"sep\"],[\"alt\",{\"sourceInterval\":[462,516]},[\"app\",{\"sourceInterval\":[462,487]},\"nonemptyListOf\",[[\"param\",{\"sourceInterval\":[477,481]},0],[\"param\",{\"sourceInterval\":[483,486]},1]]],[\"app\",{\"sourceInterval\":[494,516]},\"emptyListOf\",[[\"param\",{\"sourceInterval\":[506,510]},0],[\"param\",{\"sourceInterval\":[512,515]},1]]]]],\"nonemptyListOf\":[\"define\",{\"sourceInterval\":[520,568]},null,[\"elem\",\"sep\"],[\"seq\",{\"sourceInterval\":[552,568]},[\"param\",{\"sourceInterval\":[552,556]},0],[\"star\",{\"sourceInterval\":[557,568]},[\"seq\",{\"sourceInterval\":[558,566]},[\"param\",{\"sourceInterval\":[558,561]},1],[\"param\",{\"sourceInterval\":[562,566]},0]]]]],\"emptyListOf\":[\"define\",{\"sourceInterval\":[572,682]},null,[\"elem\",\"sep\"],[\"seq\",{\"sourceInterval\":[685,685]}]],\"applySyntactic\":[\"define\",{\"sourceInterval\":[685,710]},null,[\"app\"],[\"param\",{\"sourceInterval\":[707,710]},0]]}]);\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Grammar$1 = Grammar_1;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\nGrammar$1.BuiltInRules = builtInRules;\n\nvar {makeRecipe: makeRecipe$2} = makeRecipe$5;\nvar operationsAndAttributes = makeRecipe$2([\"grammar\",{\"source\":\"OperationsAndAttributes {\\n\\n AttributeSignature =\\n name\\n\\n OperationSignature =\\n name Formals?\\n\\n Formals\\n = \\\"(\\\" ListOf \\\")\\\"\\n\\n name (a name)\\n = nameFirst nameRest*\\n\\n nameFirst\\n = \\\"_\\\"\\n | letter\\n\\n nameRest\\n = \\\"_\\\"\\n | alnum\\n\\n}\"},\"OperationsAndAttributes\",null,\"AttributeSignature\",{\"AttributeSignature\":[\"define\",{\"sourceInterval\":[29,58]},null,[],[\"app\",{\"sourceInterval\":[54,58]},\"name\",[]]],\"OperationSignature\":[\"define\",{\"sourceInterval\":[62,100]},null,[],[\"seq\",{\"sourceInterval\":[87,100]},[\"app\",{\"sourceInterval\":[87,91]},\"name\",[]],[\"opt\",{\"sourceInterval\":[92,100]},[\"app\",{\"sourceInterval\":[92,99]},\"Formals\",[]]]]],\"Formals\":[\"define\",{\"sourceInterval\":[104,143]},null,[],[\"seq\",{\"sourceInterval\":[118,143]},[\"terminal\",{\"sourceInterval\":[118,121]},\"(\"],[\"app\",{\"sourceInterval\":[122,139]},\"ListOf\",[[\"app\",{\"sourceInterval\":[129,133]},\"name\",[]],[\"terminal\",{\"sourceInterval\":[135,138]},\",\"]]],[\"terminal\",{\"sourceInterval\":[140,143]},\")\"]]],\"name\":[\"define\",{\"sourceInterval\":[147,187]},\"a name\",[],[\"seq\",{\"sourceInterval\":[168,187]},[\"app\",{\"sourceInterval\":[168,177]},\"nameFirst\",[]],[\"star\",{\"sourceInterval\":[178,187]},[\"app\",{\"sourceInterval\":[178,186]},\"nameRest\",[]]]]],\"nameFirst\":[\"define\",{\"sourceInterval\":[191,223]},null,[],[\"alt\",{\"sourceInterval\":[207,223]},[\"terminal\",{\"sourceInterval\":[207,210]},\"_\"],[\"app\",{\"sourceInterval\":[217,223]},\"letter\",[]]]],\"nameRest\":[\"define\",{\"sourceInterval\":[227,257]},null,[],[\"alt\",{\"sourceInterval\":[242,257]},[\"terminal\",{\"sourceInterval\":[242,245]},\"_\"],[\"app\",{\"sourceInterval\":[252,257]},\"alnum\",[]]]]}]);\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Semantics = Semantics_1;\nconst util$1 = util$7;\n\n// ----------------- Deferred initialization -----------------\n\nutil$1.awaitBuiltInRules(builtInRules => {\n const operationsAndAttributesGrammar = operationsAndAttributes;\n initBuiltInSemantics(builtInRules);\n initPrototypeParser(operationsAndAttributesGrammar); // requires BuiltInSemantics\n});\n\nfunction initBuiltInSemantics(builtInRules) {\n const actions = {\n empty() {\n return this.iteration();\n },\n nonEmpty(first, _, rest) {\n return this.iteration([first].concat(rest.children));\n },\n };\n\n Semantics.BuiltInSemantics = Semantics.createSemantics(builtInRules, null).addOperation(\n 'asIteration',\n {\n emptyListOf: actions.empty,\n nonemptyListOf: actions.nonEmpty,\n EmptyListOf: actions.empty,\n NonemptyListOf: actions.nonEmpty,\n }\n );\n}\n\nfunction initPrototypeParser(grammar) {\n Semantics.prototypeGrammarSemantics = grammar.createSemantics().addOperation('parse', {\n AttributeSignature(name) {\n return {\n name: name.parse(),\n formals: [],\n };\n },\n OperationSignature(name, optFormals) {\n return {\n name: name.parse(),\n formals: optFormals.children.map(c => c.parse())[0] || [],\n };\n },\n Formals(oparen, fs, cparen) {\n return fs.asIteration().children.map(c => c.parse());\n },\n name(first, rest) {\n return this.sourceString;\n },\n });\n Semantics.prototypeGrammar = grammar;\n}\n\nvar {makeRecipe: makeRecipe$1} = makeRecipe$5;\nvar ohmGrammar$1 = makeRecipe$1([\"grammar\",{\"source\":\"Ohm {\\n\\n Grammars\\n = Grammar*\\n\\n Grammar\\n = ident SuperGrammar? \\\"{\\\" Rule* \\\"}\\\"\\n\\n SuperGrammar\\n = \\\"<:\\\" ident\\n\\n Rule\\n = ident Formals? ruleDescr? \\\"=\\\" RuleBody -- define\\n | ident Formals? \\\":=\\\" OverrideRuleBody -- override\\n | ident Formals? \\\"+=\\\" RuleBody -- extend\\n\\n RuleBody\\n = \\\"|\\\"? NonemptyListOf\\n\\n TopLevelTerm\\n = Seq caseName -- inline\\n | Seq\\n\\n OverrideRuleBody\\n = \\\"|\\\"? NonemptyListOf\\n\\n OverrideTopLevelTerm\\n = \\\"...\\\" -- superSplice\\n | TopLevelTerm\\n\\n Formals\\n = \\\"<\\\" ListOf \\\">\\\"\\n\\n Params\\n = \\\"<\\\" ListOf \\\">\\\"\\n\\n Alt\\n = NonemptyListOf\\n\\n Seq\\n = Iter*\\n\\n Iter\\n = Pred \\\"*\\\" -- star\\n | Pred \\\"+\\\" -- plus\\n | Pred \\\"?\\\" -- opt\\n | Pred\\n\\n Pred\\n = \\\"~\\\" Lex -- not\\n | \\\"&\\\" Lex -- lookahead\\n | Lex\\n\\n Lex\\n = \\\"#\\\" Base -- lex\\n | Base\\n\\n Base\\n = ident Params? ~(ruleDescr? \\\"=\\\" | \\\":=\\\" | \\\"+=\\\") -- application\\n | oneCharTerminal \\\"..\\\" oneCharTerminal -- range\\n | terminal -- terminal\\n | \\\"(\\\" Alt \\\")\\\" -- paren\\n\\n ruleDescr (a rule description)\\n = \\\"(\\\" ruleDescrText \\\")\\\"\\n\\n ruleDescrText\\n = (~\\\")\\\" any)*\\n\\n caseName\\n = \\\"--\\\" (~\\\"\\\\n\\\" space)* name (~\\\"\\\\n\\\" space)* (\\\"\\\\n\\\" | &\\\"}\\\")\\n\\n name (a name)\\n = nameFirst nameRest*\\n\\n nameFirst\\n = \\\"_\\\"\\n | letter\\n\\n nameRest\\n = \\\"_\\\"\\n | alnum\\n\\n ident (an identifier)\\n = name\\n\\n terminal\\n = \\\"\\\\\\\"\\\" terminalChar* \\\"\\\\\\\"\\\"\\n\\n oneCharTerminal\\n = \\\"\\\\\\\"\\\" terminalChar \\\"\\\\\\\"\\\"\\n\\n terminalChar\\n = escapeChar\\n | ~\\\"\\\\\\\\\\\" ~\\\"\\\\\\\"\\\" ~\\\"\\\\n\\\" \\\"\\\\u{0}\\\"..\\\"\\\\u{10FFFF}\\\"\\n\\n escapeChar (an escape sequence)\\n = \\\"\\\\\\\\\\\\\\\\\\\" -- backslash\\n | \\\"\\\\\\\\\\\\\\\"\\\" -- doubleQuote\\n | \\\"\\\\\\\\\\\\'\\\" -- singleQuote\\n | \\\"\\\\\\\\b\\\" -- backspace\\n | \\\"\\\\\\\\n\\\" -- lineFeed\\n | \\\"\\\\\\\\r\\\" -- carriageReturn\\n | \\\"\\\\\\\\t\\\" -- tab\\n | \\\"\\\\\\\\u{\\\" hexDigit hexDigit? hexDigit?\\n hexDigit? hexDigit? hexDigit? \\\"}\\\" -- unicodeCodePoint\\n | \\\"\\\\\\\\u\\\" hexDigit hexDigit hexDigit hexDigit -- unicodeEscape\\n | \\\"\\\\\\\\x\\\" hexDigit hexDigit -- hexEscape\\n\\n space\\n += comment\\n\\n comment\\n = \\\"//\\\" (~\\\"\\\\n\\\" any)* &(\\\"\\\\n\\\" | end) -- singleLine\\n | \\\"/*\\\" (~\\\"*/\\\" any)* \\\"*/\\\" -- multiLine\\n\\n tokens = token*\\n\\n token = caseName | comment | ident | operator | punctuation | terminal | any\\n\\n operator = \\\"<:\\\" | \\\"=\\\" | \\\":=\\\" | \\\"+=\\\" | \\\"*\\\" | \\\"+\\\" | \\\"?\\\" | \\\"~\\\" | \\\"&\\\"\\n\\n punctuation = \\\"<\\\" | \\\">\\\" | \\\",\\\" | \\\"--\\\"\\n}\"},\"Ohm\",null,\"Grammars\",{\"Grammars\":[\"define\",{\"sourceInterval\":[9,32]},null,[],[\"star\",{\"sourceInterval\":[24,32]},[\"app\",{\"sourceInterval\":[24,31]},\"Grammar\",[]]]],\"Grammar\":[\"define\",{\"sourceInterval\":[36,83]},null,[],[\"seq\",{\"sourceInterval\":[50,83]},[\"app\",{\"sourceInterval\":[50,55]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[56,69]},[\"app\",{\"sourceInterval\":[56,68]},\"SuperGrammar\",[]]],[\"terminal\",{\"sourceInterval\":[70,73]},\"{\"],[\"star\",{\"sourceInterval\":[74,79]},[\"app\",{\"sourceInterval\":[74,78]},\"Rule\",[]]],[\"terminal\",{\"sourceInterval\":[80,83]},\"}\"]]],\"SuperGrammar\":[\"define\",{\"sourceInterval\":[87,116]},null,[],[\"seq\",{\"sourceInterval\":[106,116]},[\"terminal\",{\"sourceInterval\":[106,110]},\"<:\"],[\"app\",{\"sourceInterval\":[111,116]},\"ident\",[]]]],\"Rule_define\":[\"define\",{\"sourceInterval\":[131,181]},null,[],[\"seq\",{\"sourceInterval\":[131,170]},[\"app\",{\"sourceInterval\":[131,136]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[137,145]},[\"app\",{\"sourceInterval\":[137,144]},\"Formals\",[]]],[\"opt\",{\"sourceInterval\":[146,156]},[\"app\",{\"sourceInterval\":[146,155]},\"ruleDescr\",[]]],[\"terminal\",{\"sourceInterval\":[157,160]},\"=\"],[\"app\",{\"sourceInterval\":[162,170]},\"RuleBody\",[]]]],\"Rule_override\":[\"define\",{\"sourceInterval\":[188,248]},null,[],[\"seq\",{\"sourceInterval\":[188,235]},[\"app\",{\"sourceInterval\":[188,193]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[194,202]},[\"app\",{\"sourceInterval\":[194,201]},\"Formals\",[]]],[\"terminal\",{\"sourceInterval\":[214,218]},\":=\"],[\"app\",{\"sourceInterval\":[219,235]},\"OverrideRuleBody\",[]]]],\"Rule_extend\":[\"define\",{\"sourceInterval\":[255,305]},null,[],[\"seq\",{\"sourceInterval\":[255,294]},[\"app\",{\"sourceInterval\":[255,260]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[261,269]},[\"app\",{\"sourceInterval\":[261,268]},\"Formals\",[]]],[\"terminal\",{\"sourceInterval\":[281,285]},\"+=\"],[\"app\",{\"sourceInterval\":[286,294]},\"RuleBody\",[]]]],\"Rule\":[\"define\",{\"sourceInterval\":[120,305]},null,[],[\"alt\",{\"sourceInterval\":[131,305]},[\"app\",{\"sourceInterval\":[131,170]},\"Rule_define\",[]],[\"app\",{\"sourceInterval\":[188,235]},\"Rule_override\",[]],[\"app\",{\"sourceInterval\":[255,294]},\"Rule_extend\",[]]]],\"RuleBody\":[\"define\",{\"sourceInterval\":[309,362]},null,[],[\"seq\",{\"sourceInterval\":[324,362]},[\"opt\",{\"sourceInterval\":[324,328]},[\"terminal\",{\"sourceInterval\":[324,327]},\"|\"]],[\"app\",{\"sourceInterval\":[329,362]},\"NonemptyListOf\",[[\"app\",{\"sourceInterval\":[344,356]},\"TopLevelTerm\",[]],[\"terminal\",{\"sourceInterval\":[358,361]},\"|\"]]]]],\"TopLevelTerm_inline\":[\"define\",{\"sourceInterval\":[385,408]},null,[],[\"seq\",{\"sourceInterval\":[385,397]},[\"app\",{\"sourceInterval\":[385,388]},\"Seq\",[]],[\"app\",{\"sourceInterval\":[389,397]},\"caseName\",[]]]],\"TopLevelTerm\":[\"define\",{\"sourceInterval\":[366,418]},null,[],[\"alt\",{\"sourceInterval\":[385,418]},[\"app\",{\"sourceInterval\":[385,397]},\"TopLevelTerm_inline\",[]],[\"app\",{\"sourceInterval\":[415,418]},\"Seq\",[]]]],\"OverrideRuleBody\":[\"define\",{\"sourceInterval\":[422,491]},null,[],[\"seq\",{\"sourceInterval\":[445,491]},[\"opt\",{\"sourceInterval\":[445,449]},[\"terminal\",{\"sourceInterval\":[445,448]},\"|\"]],[\"app\",{\"sourceInterval\":[450,491]},\"NonemptyListOf\",[[\"app\",{\"sourceInterval\":[465,485]},\"OverrideTopLevelTerm\",[]],[\"terminal\",{\"sourceInterval\":[487,490]},\"|\"]]]]],\"OverrideTopLevelTerm_superSplice\":[\"define\",{\"sourceInterval\":[522,543]},null,[],[\"terminal\",{\"sourceInterval\":[522,527]},\"...\"]],\"OverrideTopLevelTerm\":[\"define\",{\"sourceInterval\":[495,562]},null,[],[\"alt\",{\"sourceInterval\":[522,562]},[\"app\",{\"sourceInterval\":[522,527]},\"OverrideTopLevelTerm_superSplice\",[]],[\"app\",{\"sourceInterval\":[550,562]},\"TopLevelTerm\",[]]]],\"Formals\":[\"define\",{\"sourceInterval\":[566,606]},null,[],[\"seq\",{\"sourceInterval\":[580,606]},[\"terminal\",{\"sourceInterval\":[580,583]},\"<\"],[\"app\",{\"sourceInterval\":[584,602]},\"ListOf\",[[\"app\",{\"sourceInterval\":[591,596]},\"ident\",[]],[\"terminal\",{\"sourceInterval\":[598,601]},\",\"]]],[\"terminal\",{\"sourceInterval\":[603,606]},\">\"]]],\"Params\":[\"define\",{\"sourceInterval\":[610,647]},null,[],[\"seq\",{\"sourceInterval\":[623,647]},[\"terminal\",{\"sourceInterval\":[623,626]},\"<\"],[\"app\",{\"sourceInterval\":[627,643]},\"ListOf\",[[\"app\",{\"sourceInterval\":[634,637]},\"Seq\",[]],[\"terminal\",{\"sourceInterval\":[639,642]},\",\"]]],[\"terminal\",{\"sourceInterval\":[644,647]},\">\"]]],\"Alt\":[\"define\",{\"sourceInterval\":[651,685]},null,[],[\"app\",{\"sourceInterval\":[661,685]},\"NonemptyListOf\",[[\"app\",{\"sourceInterval\":[676,679]},\"Seq\",[]],[\"terminal\",{\"sourceInterval\":[681,684]},\"|\"]]]],\"Seq\":[\"define\",{\"sourceInterval\":[689,704]},null,[],[\"star\",{\"sourceInterval\":[699,704]},[\"app\",{\"sourceInterval\":[699,703]},\"Iter\",[]]]],\"Iter_star\":[\"define\",{\"sourceInterval\":[719,736]},null,[],[\"seq\",{\"sourceInterval\":[719,727]},[\"app\",{\"sourceInterval\":[719,723]},\"Pred\",[]],[\"terminal\",{\"sourceInterval\":[724,727]},\"*\"]]],\"Iter_plus\":[\"define\",{\"sourceInterval\":[743,760]},null,[],[\"seq\",{\"sourceInterval\":[743,751]},[\"app\",{\"sourceInterval\":[743,747]},\"Pred\",[]],[\"terminal\",{\"sourceInterval\":[748,751]},\"+\"]]],\"Iter_opt\":[\"define\",{\"sourceInterval\":[767,783]},null,[],[\"seq\",{\"sourceInterval\":[767,775]},[\"app\",{\"sourceInterval\":[767,771]},\"Pred\",[]],[\"terminal\",{\"sourceInterval\":[772,775]},\"?\"]]],\"Iter\":[\"define\",{\"sourceInterval\":[708,794]},null,[],[\"alt\",{\"sourceInterval\":[719,794]},[\"app\",{\"sourceInterval\":[719,727]},\"Iter_star\",[]],[\"app\",{\"sourceInterval\":[743,751]},\"Iter_plus\",[]],[\"app\",{\"sourceInterval\":[767,775]},\"Iter_opt\",[]],[\"app\",{\"sourceInterval\":[790,794]},\"Pred\",[]]]],\"Pred_not\":[\"define\",{\"sourceInterval\":[809,824]},null,[],[\"seq\",{\"sourceInterval\":[809,816]},[\"terminal\",{\"sourceInterval\":[809,812]},\"~\"],[\"app\",{\"sourceInterval\":[813,816]},\"Lex\",[]]]],\"Pred_lookahead\":[\"define\",{\"sourceInterval\":[831,852]},null,[],[\"seq\",{\"sourceInterval\":[831,838]},[\"terminal\",{\"sourceInterval\":[831,834]},\"&\"],[\"app\",{\"sourceInterval\":[835,838]},\"Lex\",[]]]],\"Pred\":[\"define\",{\"sourceInterval\":[798,862]},null,[],[\"alt\",{\"sourceInterval\":[809,862]},[\"app\",{\"sourceInterval\":[809,816]},\"Pred_not\",[]],[\"app\",{\"sourceInterval\":[831,838]},\"Pred_lookahead\",[]],[\"app\",{\"sourceInterval\":[859,862]},\"Lex\",[]]]],\"Lex_lex\":[\"define\",{\"sourceInterval\":[876,892]},null,[],[\"seq\",{\"sourceInterval\":[876,884]},[\"terminal\",{\"sourceInterval\":[876,879]},\"#\"],[\"app\",{\"sourceInterval\":[880,884]},\"Base\",[]]]],\"Lex\":[\"define\",{\"sourceInterval\":[866,903]},null,[],[\"alt\",{\"sourceInterval\":[876,903]},[\"app\",{\"sourceInterval\":[876,884]},\"Lex_lex\",[]],[\"app\",{\"sourceInterval\":[899,903]},\"Base\",[]]]],\"Base_application\":[\"define\",{\"sourceInterval\":[918,979]},null,[],[\"seq\",{\"sourceInterval\":[918,963]},[\"app\",{\"sourceInterval\":[918,923]},\"ident\",[]],[\"opt\",{\"sourceInterval\":[924,931]},[\"app\",{\"sourceInterval\":[924,930]},\"Params\",[]]],[\"not\",{\"sourceInterval\":[932,963]},[\"alt\",{\"sourceInterval\":[934,962]},[\"seq\",{\"sourceInterval\":[934,948]},[\"opt\",{\"sourceInterval\":[934,944]},[\"app\",{\"sourceInterval\":[934,943]},\"ruleDescr\",[]]],[\"terminal\",{\"sourceInterval\":[945,948]},\"=\"]],[\"terminal\",{\"sourceInterval\":[951,955]},\":=\"],[\"terminal\",{\"sourceInterval\":[958,962]},\"+=\"]]]]],\"Base_range\":[\"define\",{\"sourceInterval\":[986,1041]},null,[],[\"seq\",{\"sourceInterval\":[986,1022]},[\"app\",{\"sourceInterval\":[986,1001]},\"oneCharTerminal\",[]],[\"terminal\",{\"sourceInterval\":[1002,1006]},\"..\"],[\"app\",{\"sourceInterval\":[1007,1022]},\"oneCharTerminal\",[]]]],\"Base_terminal\":[\"define\",{\"sourceInterval\":[1048,1106]},null,[],[\"app\",{\"sourceInterval\":[1048,1056]},\"terminal\",[]]],\"Base_paren\":[\"define\",{\"sourceInterval\":[1113,1168]},null,[],[\"seq\",{\"sourceInterval\":[1113,1124]},[\"terminal\",{\"sourceInterval\":[1113,1116]},\"(\"],[\"app\",{\"sourceInterval\":[1117,1120]},\"Alt\",[]],[\"terminal\",{\"sourceInterval\":[1121,1124]},\")\"]]],\"Base\":[\"define\",{\"sourceInterval\":[907,1168]},null,[],[\"alt\",{\"sourceInterval\":[918,1168]},[\"app\",{\"sourceInterval\":[918,963]},\"Base_application\",[]],[\"app\",{\"sourceInterval\":[986,1022]},\"Base_range\",[]],[\"app\",{\"sourceInterval\":[1048,1056]},\"Base_terminal\",[]],[\"app\",{\"sourceInterval\":[1113,1124]},\"Base_paren\",[]]]],\"ruleDescr\":[\"define\",{\"sourceInterval\":[1172,1231]},\"a rule description\",[],[\"seq\",{\"sourceInterval\":[1210,1231]},[\"terminal\",{\"sourceInterval\":[1210,1213]},\"(\"],[\"app\",{\"sourceInterval\":[1214,1227]},\"ruleDescrText\",[]],[\"terminal\",{\"sourceInterval\":[1228,1231]},\")\"]]],\"ruleDescrText\":[\"define\",{\"sourceInterval\":[1235,1266]},null,[],[\"star\",{\"sourceInterval\":[1255,1266]},[\"seq\",{\"sourceInterval\":[1256,1264]},[\"not\",{\"sourceInterval\":[1256,1260]},[\"terminal\",{\"sourceInterval\":[1257,1260]},\")\"]],[\"app\",{\"sourceInterval\":[1261,1264]},\"any\",[]]]]],\"caseName\":[\"define\",{\"sourceInterval\":[1270,1338]},null,[],[\"seq\",{\"sourceInterval\":[1285,1338]},[\"terminal\",{\"sourceInterval\":[1285,1289]},\"--\"],[\"star\",{\"sourceInterval\":[1290,1304]},[\"seq\",{\"sourceInterval\":[1291,1302]},[\"not\",{\"sourceInterval\":[1291,1296]},[\"terminal\",{\"sourceInterval\":[1292,1296]},\"\\n\"]],[\"app\",{\"sourceInterval\":[1297,1302]},\"space\",[]]]],[\"app\",{\"sourceInterval\":[1305,1309]},\"name\",[]],[\"star\",{\"sourceInterval\":[1310,1324]},[\"seq\",{\"sourceInterval\":[1311,1322]},[\"not\",{\"sourceInterval\":[1311,1316]},[\"terminal\",{\"sourceInterval\":[1312,1316]},\"\\n\"]],[\"app\",{\"sourceInterval\":[1317,1322]},\"space\",[]]]],[\"alt\",{\"sourceInterval\":[1326,1337]},[\"terminal\",{\"sourceInterval\":[1326,1330]},\"\\n\"],[\"lookahead\",{\"sourceInterval\":[1333,1337]},[\"terminal\",{\"sourceInterval\":[1334,1337]},\"}\"]]]]],\"name\":[\"define\",{\"sourceInterval\":[1342,1382]},\"a name\",[],[\"seq\",{\"sourceInterval\":[1363,1382]},[\"app\",{\"sourceInterval\":[1363,1372]},\"nameFirst\",[]],[\"star\",{\"sourceInterval\":[1373,1382]},[\"app\",{\"sourceInterval\":[1373,1381]},\"nameRest\",[]]]]],\"nameFirst\":[\"define\",{\"sourceInterval\":[1386,1418]},null,[],[\"alt\",{\"sourceInterval\":[1402,1418]},[\"terminal\",{\"sourceInterval\":[1402,1405]},\"_\"],[\"app\",{\"sourceInterval\":[1412,1418]},\"letter\",[]]]],\"nameRest\":[\"define\",{\"sourceInterval\":[1422,1452]},null,[],[\"alt\",{\"sourceInterval\":[1437,1452]},[\"terminal\",{\"sourceInterval\":[1437,1440]},\"_\"],[\"app\",{\"sourceInterval\":[1447,1452]},\"alnum\",[]]]],\"ident\":[\"define\",{\"sourceInterval\":[1456,1489]},\"an identifier\",[],[\"app\",{\"sourceInterval\":[1485,1489]},\"name\",[]]],\"terminal\":[\"define\",{\"sourceInterval\":[1493,1531]},null,[],[\"seq\",{\"sourceInterval\":[1508,1531]},[\"terminal\",{\"sourceInterval\":[1508,1512]},\"\\\"\"],[\"star\",{\"sourceInterval\":[1513,1526]},[\"app\",{\"sourceInterval\":[1513,1525]},\"terminalChar\",[]]],[\"terminal\",{\"sourceInterval\":[1527,1531]},\"\\\"\"]]],\"oneCharTerminal\":[\"define\",{\"sourceInterval\":[1535,1579]},null,[],[\"seq\",{\"sourceInterval\":[1557,1579]},[\"terminal\",{\"sourceInterval\":[1557,1561]},\"\\\"\"],[\"app\",{\"sourceInterval\":[1562,1574]},\"terminalChar\",[]],[\"terminal\",{\"sourceInterval\":[1575,1579]},\"\\\"\"]]],\"terminalChar\":[\"define\",{\"sourceInterval\":[1583,1660]},null,[],[\"alt\",{\"sourceInterval\":[1602,1660]},[\"app\",{\"sourceInterval\":[1602,1612]},\"escapeChar\",[]],[\"seq\",{\"sourceInterval\":[1621,1660]},[\"not\",{\"sourceInterval\":[1621,1626]},[\"terminal\",{\"sourceInterval\":[1622,1626]},\"\\\\\"]],[\"not\",{\"sourceInterval\":[1627,1632]},[\"terminal\",{\"sourceInterval\":[1628,1632]},\"\\\"\"]],[\"not\",{\"sourceInterval\":[1633,1638]},[\"terminal\",{\"sourceInterval\":[1634,1638]},\"\\n\"]],[\"range\",{\"sourceInterval\":[1639,1660]},\"\\u0000\",\"􏿿\"]]]],\"escapeChar_backslash\":[\"define\",{\"sourceInterval\":[1703,1758]},null,[],[\"terminal\",{\"sourceInterval\":[1703,1709]},\"\\\\\\\\\"]],\"escapeChar_doubleQuote\":[\"define\",{\"sourceInterval\":[1765,1822]},null,[],[\"terminal\",{\"sourceInterval\":[1765,1771]},\"\\\\\\\"\"]],\"escapeChar_singleQuote\":[\"define\",{\"sourceInterval\":[1829,1886]},null,[],[\"terminal\",{\"sourceInterval\":[1829,1835]},\"\\\\'\"]],\"escapeChar_backspace\":[\"define\",{\"sourceInterval\":[1893,1948]},null,[],[\"terminal\",{\"sourceInterval\":[1893,1898]},\"\\\\b\"]],\"escapeChar_lineFeed\":[\"define\",{\"sourceInterval\":[1955,2009]},null,[],[\"terminal\",{\"sourceInterval\":[1955,1960]},\"\\\\n\"]],\"escapeChar_carriageReturn\":[\"define\",{\"sourceInterval\":[2016,2076]},null,[],[\"terminal\",{\"sourceInterval\":[2016,2021]},\"\\\\r\"]],\"escapeChar_tab\":[\"define\",{\"sourceInterval\":[2083,2132]},null,[],[\"terminal\",{\"sourceInterval\":[2083,2088]},\"\\\\t\"]],\"escapeChar_unicodeCodePoint\":[\"define\",{\"sourceInterval\":[2139,2243]},null,[],[\"seq\",{\"sourceInterval\":[2139,2221]},[\"terminal\",{\"sourceInterval\":[2139,2145]},\"\\\\u{\"],[\"app\",{\"sourceInterval\":[2146,2154]},\"hexDigit\",[]],[\"opt\",{\"sourceInterval\":[2155,2164]},[\"app\",{\"sourceInterval\":[2155,2163]},\"hexDigit\",[]]],[\"opt\",{\"sourceInterval\":[2165,2174]},[\"app\",{\"sourceInterval\":[2165,2173]},\"hexDigit\",[]]],[\"opt\",{\"sourceInterval\":[2188,2197]},[\"app\",{\"sourceInterval\":[2188,2196]},\"hexDigit\",[]]],[\"opt\",{\"sourceInterval\":[2198,2207]},[\"app\",{\"sourceInterval\":[2198,2206]},\"hexDigit\",[]]],[\"opt\",{\"sourceInterval\":[2208,2217]},[\"app\",{\"sourceInterval\":[2208,2216]},\"hexDigit\",[]]],[\"terminal\",{\"sourceInterval\":[2218,2221]},\"}\"]]],\"escapeChar_unicodeEscape\":[\"define\",{\"sourceInterval\":[2250,2309]},null,[],[\"seq\",{\"sourceInterval\":[2250,2291]},[\"terminal\",{\"sourceInterval\":[2250,2255]},\"\\\\u\"],[\"app\",{\"sourceInterval\":[2256,2264]},\"hexDigit\",[]],[\"app\",{\"sourceInterval\":[2265,2273]},\"hexDigit\",[]],[\"app\",{\"sourceInterval\":[2274,2282]},\"hexDigit\",[]],[\"app\",{\"sourceInterval\":[2283,2291]},\"hexDigit\",[]]]],\"escapeChar_hexEscape\":[\"define\",{\"sourceInterval\":[2316,2371]},null,[],[\"seq\",{\"sourceInterval\":[2316,2339]},[\"terminal\",{\"sourceInterval\":[2316,2321]},\"\\\\x\"],[\"app\",{\"sourceInterval\":[2322,2330]},\"hexDigit\",[]],[\"app\",{\"sourceInterval\":[2331,2339]},\"hexDigit\",[]]]],\"escapeChar\":[\"define\",{\"sourceInterval\":[1664,2371]},\"an escape sequence\",[],[\"alt\",{\"sourceInterval\":[1703,2371]},[\"app\",{\"sourceInterval\":[1703,1709]},\"escapeChar_backslash\",[]],[\"app\",{\"sourceInterval\":[1765,1771]},\"escapeChar_doubleQuote\",[]],[\"app\",{\"sourceInterval\":[1829,1835]},\"escapeChar_singleQuote\",[]],[\"app\",{\"sourceInterval\":[1893,1898]},\"escapeChar_backspace\",[]],[\"app\",{\"sourceInterval\":[1955,1960]},\"escapeChar_lineFeed\",[]],[\"app\",{\"sourceInterval\":[2016,2021]},\"escapeChar_carriageReturn\",[]],[\"app\",{\"sourceInterval\":[2083,2088]},\"escapeChar_tab\",[]],[\"app\",{\"sourceInterval\":[2139,2221]},\"escapeChar_unicodeCodePoint\",[]],[\"app\",{\"sourceInterval\":[2250,2291]},\"escapeChar_unicodeEscape\",[]],[\"app\",{\"sourceInterval\":[2316,2339]},\"escapeChar_hexEscape\",[]]]],\"space\":[\"extend\",{\"sourceInterval\":[2375,2394]},null,[],[\"app\",{\"sourceInterval\":[2387,2394]},\"comment\",[]]],\"comment_singleLine\":[\"define\",{\"sourceInterval\":[2412,2458]},null,[],[\"seq\",{\"sourceInterval\":[2412,2443]},[\"terminal\",{\"sourceInterval\":[2412,2416]},\"//\"],[\"star\",{\"sourceInterval\":[2417,2429]},[\"seq\",{\"sourceInterval\":[2418,2427]},[\"not\",{\"sourceInterval\":[2418,2423]},[\"terminal\",{\"sourceInterval\":[2419,2423]},\"\\n\"]],[\"app\",{\"sourceInterval\":[2424,2427]},\"any\",[]]]],[\"lookahead\",{\"sourceInterval\":[2430,2443]},[\"alt\",{\"sourceInterval\":[2432,2442]},[\"terminal\",{\"sourceInterval\":[2432,2436]},\"\\n\"],[\"app\",{\"sourceInterval\":[2439,2442]},\"end\",[]]]]]],\"comment_multiLine\":[\"define\",{\"sourceInterval\":[2465,2501]},null,[],[\"seq\",{\"sourceInterval\":[2465,2487]},[\"terminal\",{\"sourceInterval\":[2465,2469]},\"/*\"],[\"star\",{\"sourceInterval\":[2470,2482]},[\"seq\",{\"sourceInterval\":[2471,2480]},[\"not\",{\"sourceInterval\":[2471,2476]},[\"terminal\",{\"sourceInterval\":[2472,2476]},\"*/\"]],[\"app\",{\"sourceInterval\":[2477,2480]},\"any\",[]]]],[\"terminal\",{\"sourceInterval\":[2483,2487]},\"*/\"]]],\"comment\":[\"define\",{\"sourceInterval\":[2398,2501]},null,[],[\"alt\",{\"sourceInterval\":[2412,2501]},[\"app\",{\"sourceInterval\":[2412,2443]},\"comment_singleLine\",[]],[\"app\",{\"sourceInterval\":[2465,2487]},\"comment_multiLine\",[]]]],\"tokens\":[\"define\",{\"sourceInterval\":[2505,2520]},null,[],[\"star\",{\"sourceInterval\":[2514,2520]},[\"app\",{\"sourceInterval\":[2514,2519]},\"token\",[]]]],\"token\":[\"define\",{\"sourceInterval\":[2524,2600]},null,[],[\"alt\",{\"sourceInterval\":[2532,2600]},[\"app\",{\"sourceInterval\":[2532,2540]},\"caseName\",[]],[\"app\",{\"sourceInterval\":[2543,2550]},\"comment\",[]],[\"app\",{\"sourceInterval\":[2553,2558]},\"ident\",[]],[\"app\",{\"sourceInterval\":[2561,2569]},\"operator\",[]],[\"app\",{\"sourceInterval\":[2572,2583]},\"punctuation\",[]],[\"app\",{\"sourceInterval\":[2586,2594]},\"terminal\",[]],[\"app\",{\"sourceInterval\":[2597,2600]},\"any\",[]]]],\"operator\":[\"define\",{\"sourceInterval\":[2604,2669]},null,[],[\"alt\",{\"sourceInterval\":[2615,2669]},[\"terminal\",{\"sourceInterval\":[2615,2619]},\"<:\"],[\"terminal\",{\"sourceInterval\":[2622,2625]},\"=\"],[\"terminal\",{\"sourceInterval\":[2628,2632]},\":=\"],[\"terminal\",{\"sourceInterval\":[2635,2639]},\"+=\"],[\"terminal\",{\"sourceInterval\":[2642,2645]},\"*\"],[\"terminal\",{\"sourceInterval\":[2648,2651]},\"+\"],[\"terminal\",{\"sourceInterval\":[2654,2657]},\"?\"],[\"terminal\",{\"sourceInterval\":[2660,2663]},\"~\"],[\"terminal\",{\"sourceInterval\":[2666,2669]},\"&\"]]],\"punctuation\":[\"define\",{\"sourceInterval\":[2673,2709]},null,[],[\"alt\",{\"sourceInterval\":[2687,2709]},[\"terminal\",{\"sourceInterval\":[2687,2690]},\"<\"],[\"terminal\",{\"sourceInterval\":[2693,2696]},\">\"],[\"terminal\",{\"sourceInterval\":[2699,2702]},\",\"],[\"terminal\",{\"sourceInterval\":[2705,2709]},\"--\"]]]}]);\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst Builder = Builder_1;\nconst Grammar = Grammar_1;\nconst Namespace = Namespace_1;\nconst common = common$l;\nconst errors = errors$9;\nconst pexprs = pexprs$6;\nconst util = util$7;\nconst version = version$1;\nconst {makeRecipe} = makeRecipe$5;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// The metagrammar, i.e. the grammar for Ohm grammars. Initialized at the\n// bottom of this file because loading the grammar requires Ohm itself.\nlet ohmGrammar;\n\nconst superSplicePlaceholder = Object.create(pexprs.PExpr.prototype);\n\nconst isBuffer = obj =>\n !!obj.constructor &&\n typeof obj.constructor.isBuffer === 'function' &&\n obj.constructor.isBuffer(obj);\n\n// Returns a Grammar instance (i.e., an object with a `match` method) for\n// `tree`, which is the concrete syntax tree of a user-written grammar.\n// The grammar will be assigned into `namespace` under the name of the grammar\n// as specified in the source.\nfunction buildGrammar(match, namespace, optOhmGrammarForTesting) {\n const builder = new Builder();\n let decl;\n let currentRuleName;\n let currentRuleFormals;\n let overriding = false;\n const metaGrammar = optOhmGrammarForTesting || ohmGrammar;\n\n // A visitor that produces a Grammar instance from the CST.\n const helpers = metaGrammar.createSemantics().addOperation('visit', {\n Grammars(grammarIter) {\n return grammarIter.children.map(c => c.visit());\n },\n Grammar(id, s, _open, rules, _close) {\n const grammarName = id.visit();\n decl = builder.newGrammar(grammarName, namespace);\n s.child(0) && s.child(0).visit();\n rules.children.map(c => c.visit());\n const g = decl.build();\n g.source = this.source.trimmed();\n if (grammarName in namespace) {\n throw errors.duplicateGrammarDeclaration(g, namespace);\n }\n namespace[grammarName] = g;\n return g;\n },\n\n SuperGrammar(_, n) {\n const superGrammarName = n.visit();\n if (superGrammarName === 'null') {\n decl.withSuperGrammar(null);\n } else {\n if (!namespace || !(superGrammarName in namespace)) {\n throw errors.undeclaredGrammar(superGrammarName, namespace, n.source);\n }\n decl.withSuperGrammar(namespace[superGrammarName]);\n }\n },\n\n Rule_define(n, fs, d, _, b) {\n currentRuleName = n.visit();\n currentRuleFormals = fs.children.map(c => c.visit())[0] || [];\n // If there is no default start rule yet, set it now. This must be done before visiting\n // the body, because it might contain an inline rule definition.\n if (!decl.defaultStartRule && decl.ensureSuperGrammar() !== Grammar.ProtoBuiltInRules) {\n decl.withDefaultStartRule(currentRuleName);\n }\n const body = b.visit();\n const description = d.children.map(c => c.visit())[0];\n const source = this.source.trimmed();\n return decl.define(currentRuleName, currentRuleFormals, body, description, source);\n },\n Rule_override(n, fs, _, b) {\n currentRuleName = n.visit();\n currentRuleFormals = fs.children.map(c => c.visit())[0] || [];\n\n const source = this.source.trimmed();\n decl.ensureSuperGrammarRuleForOverriding(currentRuleName, source);\n\n overriding = true;\n const body = b.visit();\n overriding = false;\n return decl.override(currentRuleName, currentRuleFormals, body, null, source);\n },\n Rule_extend(n, fs, _, b) {\n currentRuleName = n.visit();\n currentRuleFormals = fs.children.map(c => c.visit())[0] || [];\n const body = b.visit();\n const source = this.source.trimmed();\n return decl.extend(currentRuleName, currentRuleFormals, body, null, source);\n },\n RuleBody(_, terms) {\n return builder.alt(...terms.visit()).withSource(this.source);\n },\n OverrideRuleBody(_, terms) {\n const args = terms.visit();\n\n // Check if the super-splice operator (`...`) appears in the terms.\n const expansionPos = args.indexOf(superSplicePlaceholder);\n if (expansionPos >= 0) {\n const beforeTerms = args.slice(0, expansionPos);\n const afterTerms = args.slice(expansionPos + 1);\n\n // Ensure it appears no more than once.\n afterTerms.forEach(t => {\n if (t === superSplicePlaceholder) throw errors.multipleSuperSplices(t);\n });\n\n return new pexprs.Splice(\n decl.superGrammar,\n currentRuleName,\n beforeTerms,\n afterTerms\n ).withSource(this.source);\n } else {\n return builder.alt(...args).withSource(this.source);\n }\n },\n Formals(opointy, fs, cpointy) {\n return fs.visit();\n },\n\n Params(opointy, ps, cpointy) {\n return ps.visit();\n },\n\n Alt(seqs) {\n return builder.alt(...seqs.visit()).withSource(this.source);\n },\n\n TopLevelTerm_inline(b, n) {\n const inlineRuleName = currentRuleName + '_' + n.visit();\n const body = b.visit();\n const source = this.source.trimmed();\n const isNewRuleDeclaration = !(\n decl.superGrammar && decl.superGrammar.rules[inlineRuleName]\n );\n if (overriding && !isNewRuleDeclaration) {\n decl.override(inlineRuleName, currentRuleFormals, body, null, source);\n } else {\n decl.define(inlineRuleName, currentRuleFormals, body, null, source);\n }\n const params = currentRuleFormals.map(formal => builder.app(formal));\n return builder.app(inlineRuleName, params).withSource(body.source);\n },\n OverrideTopLevelTerm_superSplice(_) {\n return superSplicePlaceholder;\n },\n\n Seq(expr) {\n return builder.seq(...expr.children.map(c => c.visit())).withSource(this.source);\n },\n\n Iter_star(x, _) {\n return builder.star(x.visit()).withSource(this.source);\n },\n Iter_plus(x, _) {\n return builder.plus(x.visit()).withSource(this.source);\n },\n Iter_opt(x, _) {\n return builder.opt(x.visit()).withSource(this.source);\n },\n\n Pred_not(_, x) {\n return builder.not(x.visit()).withSource(this.source);\n },\n Pred_lookahead(_, x) {\n return builder.lookahead(x.visit()).withSource(this.source);\n },\n\n Lex_lex(_, x) {\n return builder.lex(x.visit()).withSource(this.source);\n },\n\n Base_application(rule, ps) {\n const params = ps.children.map(c => c.visit())[0] || [];\n return builder.app(rule.visit(), params).withSource(this.source);\n },\n Base_range(from, _, to) {\n return builder.range(from.visit(), to.visit()).withSource(this.source);\n },\n Base_terminal(expr) {\n return builder.terminal(expr.visit()).withSource(this.source);\n },\n Base_paren(open, x, close) {\n return x.visit();\n },\n\n ruleDescr(open, t, close) {\n return t.visit();\n },\n ruleDescrText(_) {\n return this.sourceString.trim();\n },\n\n caseName(_, space1, n, space2, end) {\n return n.visit();\n },\n\n name(first, rest) {\n return this.sourceString;\n },\n nameFirst(expr) {},\n nameRest(expr) {},\n\n terminal(open, cs, close) {\n return cs.children.map(c => c.visit()).join('');\n },\n\n oneCharTerminal(open, c, close) {\n return c.visit();\n },\n\n escapeChar(c) {\n try {\n return common.unescapeCodePoint(this.sourceString);\n } catch (err) {\n if (err instanceof RangeError && err.message.startsWith('Invalid code point ')) {\n throw errors.invalidCodePoint(c);\n }\n throw err; // Rethrow\n }\n },\n\n NonemptyListOf(x, _, xs) {\n return [x.visit()].concat(xs.children.map(c => c.visit()));\n },\n EmptyListOf() {\n return [];\n },\n\n _terminal() {\n return this.sourceString;\n },\n });\n return helpers(match).visit();\n}\n\nfunction compileAndLoad(source, namespace) {\n const m = ohmGrammar.match(source, 'Grammars');\n if (m.failed()) {\n throw errors.grammarSyntaxError(m);\n }\n return buildGrammar(m, namespace);\n}\n\nfunction grammar(source, optNamespace) {\n const ns = grammars(source, optNamespace);\n\n // Ensure that the source contained no more than one grammar definition.\n const grammarNames = Object.keys(ns);\n if (grammarNames.length === 0) {\n throw new Error('Missing grammar definition');\n } else if (grammarNames.length > 1) {\n const secondGrammar = ns[grammarNames[1]];\n const interval = secondGrammar.source;\n throw new Error(\n util.getLineAndColumnMessage(interval.sourceString, interval.startIdx) +\n 'Found more than one grammar definition -- use ohm.grammars() instead.'\n );\n }\n return ns[grammarNames[0]]; // Return the one and only grammar.\n}\n\nfunction grammars(source, optNamespace) {\n const ns = Namespace.extend(Namespace.asNamespace(optNamespace));\n if (typeof source !== 'string') {\n // For convenience, detect Node.js Buffer objects and automatically call toString().\n if (isBuffer(source)) {\n source = source.toString();\n } else {\n throw new TypeError(\n 'Expected string as first argument, got ' + common.unexpectedObjToString(source)\n );\n }\n }\n compileAndLoad(source, ns);\n return ns;\n}\n\nfunction grammarFromScriptElement(optNode) {\n throw new Error(\n 'grammarFromScriptElement was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.'\n );\n}\n\nfunction grammarsFromScriptElements(optNodeOrNodeList) {\n throw new Error(\n 'grammarsFromScriptElements was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.'\n );\n}\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\n// Stuff that users should know about\nmain$1.exports = {\n createNamespace: Namespace.createNamespace,\n grammar,\n grammars,\n grammarFromScriptElement,\n grammarsFromScriptElements,\n makeRecipe,\n ohmGrammar: null, // Initialized below, after Grammar.BuiltInRules.\n pexprs,\n util,\n version,\n};\n\n// Stuff for testing, etc.\nmain$1.exports._buildGrammar = buildGrammar;\n\n// Late initialization for stuff that is bootstrapped.\n\n\nutil.announceBuiltInRules(Grammar.BuiltInRules);\n\nmain$1.exports.ohmGrammar = ohmGrammar = ohmGrammar$1;\nGrammar.initApplicationParser(ohmGrammar, buildGrammar);\n\nvar ohm = main$1.exports;\n\n// --------------------------------------------------------------------\n// Imports\n// --------------------------------------------------------------------\n\nconst {assert} = common$l;\n\n// --------------------------------------------------------------------\n// Private stuff\n// --------------------------------------------------------------------\n\n// Helpers\n\nfunction getProp(name, thing, fn) {\n return fn(thing[name]);\n}\n\nfunction mapProp(name, thing, fn) {\n return thing[name].map(fn);\n}\n\n// Returns a function that will walk a single property of a node.\n// `descriptor` is a string indicating the property name, optionally ending\n// with '[]' (e.g., 'children[]').\nfunction getPropWalkFn(descriptor) {\n const parts = descriptor.split(/ ?\\[\\]/);\n if (parts.length === 2) {\n return mapProp.bind(null, parts[0]);\n }\n return getProp.bind(null, descriptor);\n}\n\nfunction getProps(walkFns, thing, fn) {\n return walkFns.map(walkFn => walkFn(thing, fn));\n}\n\nfunction getWalkFn(shape) {\n if (typeof shape === 'string') {\n return getProps.bind(null, [getPropWalkFn(shape)]);\n } else if (Array.isArray(shape)) {\n return getProps.bind(null, shape.map(getPropWalkFn));\n } else {\n assert(typeof shape === 'function', 'Expected a string, Array, or function');\n assert(shape.length === 2, 'Expected a function of arity 2, got ' + shape.length);\n return shape;\n }\n}\n\nfunction isRestrictedIdentifier(str) {\n return /^[a-zA-Z_][0-9a-zA-Z_]*$/.test(str);\n}\n\nfunction trim(s) {\n return s.trim();\n}\n\nfunction parseSignature(sig) {\n const parts = sig.split(/[()]/).map(trim);\n if (parts.length === 3 && parts[2] === '') {\n const name = parts[0];\n let params = [];\n if (parts[1].length > 0) {\n params = parts[1].split(',').map(trim);\n }\n if (isRestrictedIdentifier(name) && params.every(isRestrictedIdentifier)) {\n return {name, formals: params};\n }\n }\n throw new Error('Invalid operation signature: ' + sig);\n}\n\n/*\n A VisitorFamily contains a set of recursive operations that are defined over some kind of\n tree structure. The `config` parameter specifies how to walk the tree:\n - 'getTag' is function which, given a node in the tree, returns the node's 'tag' (type)\n - 'shapes' an object that maps from a tag to a value that describes how to recursively\n evaluate the operation for nodes of that type. The value can be:\n * a string indicating the property name that holds that node's only child\n * an Array of property names (or an empty array indicating a leaf type), or\n * a function taking two arguments (node, fn), and returning an Array which is the result\n of apply `fn` to each of the node's children.\n */\nfunction VisitorFamily(config) {\n this._shapes = config.shapes;\n this._getTag = config.getTag;\n\n this.Adapter = function(thing, family) {\n this._adaptee = thing;\n this._family = family;\n };\n this.Adapter.prototype.valueOf = function() {\n throw new Error('heeey!');\n };\n this.operations = {};\n\n this._arities = Object.create(null);\n this._getChildren = Object.create(null);\n\n Object.keys(this._shapes).forEach(k => {\n const shape = this._shapes[k];\n this._getChildren[k] = getWalkFn(shape);\n\n // A function means the arity isn't fixed, so don't put an entry in the arity map.\n if (typeof shape !== 'function') {\n this._arities[k] = Array.isArray(shape) ? shape.length : 1;\n }\n });\n this._wrap = thing => new this.Adapter(thing, this);\n}\n\nVisitorFamily.prototype.wrap = function(thing) {\n return this._wrap(thing);\n};\n\nVisitorFamily.prototype._checkActionDict = function(dict) {\n Object.keys(dict).forEach(k => {\n assert(k in this._getChildren, \"Unrecognized action name '\" + k + \"'\");\n const action = dict[k];\n assert(typeof action === 'function', \"Key '\" + k + \"': expected function, got \" + action);\n if (k in this._arities) {\n const expected = this._arities[k];\n const actual = dict[k].length;\n assert(\n actual === expected,\n \"Action '\" + k + \"' has the wrong arity: expected \" + expected + ', got ' + actual\n );\n }\n });\n};\n\nVisitorFamily.prototype.addOperation = function(signature, actions) {\n const sig = parseSignature(signature);\n const {name} = sig;\n this._checkActionDict(actions);\n this.operations[name] = {\n name,\n formals: sig.formals,\n actions,\n };\n\n const family = this;\n this.Adapter.prototype[name] = function(...args) {\n const tag = family._getTag(this._adaptee);\n assert(tag in family._getChildren, \"getTag returned unrecognized tag '\" + tag + \"'\");\n assert(tag in actions, \"No action for '\" + tag + \"' in operation '\" + name + \"'\");\n\n // Create an \"arguments object\" from the arguments that were passed to this\n // operation / attribute.\n const argsObj = Object.create(null);\n for (const [i, val] of Object.entries(args)) {\n argsObj[sig.formals[i]] = val;\n }\n\n const oldArgs = this.args;\n this.args = argsObj;\n const ans = actions[tag].apply(\n this,\n family._getChildren[tag](this._adaptee, family._wrap)\n );\n this.args = oldArgs;\n return ans;\n };\n return this;\n};\n\n// --------------------------------------------------------------------\n// Exports\n// --------------------------------------------------------------------\n\nvar VisitorFamily_1 = VisitorFamily;\n\n// --------------------------------------------------------------------\n// Operations\n// --------------------------------------------------------------------\n\nconst defaultOperation = {\n _terminal() {\n return this.sourceString;\n },\n\n _nonterminal(...children) {\n const {ctorName} = this._node;\n const {mapping} = this.args;\n\n // without customization\n if (!Object.prototype.hasOwnProperty.call(mapping, ctorName)) {\n // lexical rule\n if (this.isLexical()) {\n return this.sourceString;\n }\n\n // singular node (e.g. only surrounded by literals or lookaheads)\n const realChildren = children.filter(child => !child.isTerminal());\n if (realChildren.length === 1) {\n return realChildren[0].toAST(mapping);\n }\n\n // rest: terms with multiple children\n }\n\n // direct forward\n if (typeof mapping[ctorName] === 'number') {\n return children[mapping[ctorName]].toAST(mapping);\n }\n\n // named/mapped children or unnamed children ('0', '1', '2', ...)\n const propMap = mapping[ctorName] || children;\n const node = {\n type: ctorName,\n };\n // eslint-disable-next-line guard-for-in\n for (const prop in propMap) {\n const mappedProp = mapping[ctorName] && mapping[ctorName][prop];\n if (typeof mappedProp === 'number') {\n // direct forward\n node[prop] = children[mappedProp].toAST(mapping);\n } else if (\n typeof mappedProp === 'string' ||\n typeof mappedProp === 'boolean' ||\n mappedProp === null\n ) {\n // primitive value\n node[prop] = mappedProp;\n } else if (typeof mappedProp === 'object' && mappedProp instanceof Number) {\n // primitive number (must be unboxed)\n node[prop] = Number(mappedProp);\n } else if (typeof mappedProp === 'function') {\n // computed value\n node[prop] = mappedProp.call(this, children);\n } else if (mappedProp === undefined) {\n if (children[prop] && !children[prop].isTerminal()) {\n node[prop] = children[prop].toAST(mapping);\n } else {\n // delete predefined 'type' properties, like 'type', if explicitely removed\n delete node[prop];\n }\n }\n }\n return node;\n },\n\n _iter(...children) {\n if (this._node.isOptional()) {\n if (this.numChildren === 0) {\n return null;\n } else {\n return children[0].toAST(this.args.mapping);\n }\n }\n\n return children.map(function(child) {\n return child.toAST(this.args.mapping);\n }, this);\n },\n\n NonemptyListOf(first, sep, rest) {\n return [first.toAST(this.args.mapping)].concat(rest.toAST(this.args.mapping));\n },\n\n EmptyListOf() {\n return [];\n },\n};\n\n// Returns a plain JavaScript object that includes an abstract syntax tree (AST)\n// for the given match result `res` containg a concrete syntax tree (CST) and grammar.\n// The optional `mapping` parameter can be used to customize how the nodes of the CST\n// are mapped to the AST (see /doc/extras.md#toastmatchresult-mapping).\nfunction toAST(res, mapping) {\n if (typeof res.failed !== 'function' || res.failed()) {\n throw new Error('toAST() expects a succesful MatchResult as first parameter');\n }\n\n mapping = Object.assign({}, mapping);\n const operation = Object.assign({}, defaultOperation);\n for (const termName in mapping) {\n if (typeof mapping[termName] === 'function') {\n operation[termName] = mapping[termName];\n delete mapping[termName];\n }\n }\n const g = res._cst.grammar;\n const s = g.createSemantics().addOperation('toAST(mapping)', operation);\n return s(res).toAST(mapping);\n}\n\n// Returns a semantics containg the toAST(mapping) operation for the given grammar g.\nfunction semanticsForToAST(g) {\n if (typeof g.createSemantics !== 'function') {\n throw new Error('semanticsToAST() expects a Grammar as parameter');\n }\n\n return g.createSemantics().addOperation('toAST(mapping)', defaultOperation);\n}\n\nvar semanticsToAST = {\n helper: toAST,\n semantics: semanticsForToAST,\n};\n\nvar extras = {\n VisitorFamily: VisitorFamily_1,\n semanticsForToAST: semanticsToAST.semantics,\n toAST: semanticsToAST.helper,\n};\n\nexport { ohm as default, extras };\n","import { Subject } from './Subject';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\n\n/**\n * A variant of Subject that requires an initial value and emits its current\n * value whenever it is subscribed to.\n *\n * @class BehaviorSubject\n */\nexport class BehaviorSubject extends Subject {\n constructor(private _value: T) {\n super();\n }\n\n get value(): T {\n return this.getValue();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n const subscription = super._subscribe(subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n }\n\n getValue(): T {\n const { hasError, thrownError, _value } = this;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n }\n\n next(value: T): void {\n super.next((this._value = value));\n }\n}\n","/**\n * Returns true if the object is a function.\n * @param value The value to check\n */\nexport function isFunction(value: any): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n","/**\n * Used to create Error subclasses until the community moves away from ES5.\n *\n * This is because compiling from TypeScript down to ES5 has issues with subclassing Errors\n * as well as other built-in types: https://github.com/Microsoft/TypeScript/issues/12123\n *\n * @param createImpl A factory function to create the actual constructor implementation. The returned\n * function should be a named function that calls `_super` internally.\n */\nexport function createErrorClass(createImpl: (_super: any) => any): T {\n const _super = (instance: any) => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n","import { createErrorClass } from './createErrorClass';\n\nexport interface UnsubscriptionError extends Error {\n readonly errors: any[];\n}\n\nexport interface UnsubscriptionErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (errors: any[]): UnsubscriptionError;\n}\n\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nexport const UnsubscriptionError: UnsubscriptionErrorCtor = createErrorClass(\n (_super) =>\n function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {\n _super(this);\n this.message = errors\n ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}`\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n }\n);\n","/**\n * Removes an item from an array, mutating it.\n * @param arr The array to remove the item from\n * @param item The item to remove\n */\nexport function arrRemove(arr: T[] | undefined | null, item: T) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { SubscriptionLike, TeardownLogic, Unsubscribable } from './types';\nimport { arrRemove } from './util/arrRemove';\n\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n *\n * @class Subscription\n */\nexport class Subscription implements SubscriptionLike {\n /** @nocollapse */\n public static EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n */\n public closed = false;\n\n private _parentage: Subscription[] | Subscription | null = null;\n\n /**\n * The list of registered finalizers to execute upon unsubscription. Adding and removing from this\n * list occurs in the {@link #add} and {@link #remove} methods.\n */\n private _finalizers: Exclude[] | null = null;\n\n /**\n * @param initialTeardown A function executed first as part of the finalization\n * process that is kicked off when {@link #unsubscribe} is called.\n */\n constructor(private initialTeardown?: () => void) {}\n\n /**\n * Disposes the resources held by the subscription. May, for instance, cancel\n * an ongoing Observable execution or cancel any other type of work that\n * started when the Subscription was created.\n * @return {void}\n */\n unsubscribe(): void {\n let errors: any[] | undefined;\n\n if (!this.closed) {\n this.closed = true;\n\n // Remove this from it's parents.\n const { _parentage } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n\n const { initialTeardown: initialFinalizer } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n\n const { _finalizers } = this;\n if (_finalizers) {\n this._finalizers = null;\n for (const finalizer of _finalizers) {\n try {\n execFinalizer(finalizer);\n } catch (err) {\n errors = errors ?? [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n\n /**\n * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called\n * when this subscription is unsubscribed. If this subscription is already {@link #closed},\n * because it has already been unsubscribed, then whatever finalizer is passed to it\n * will automatically be executed (unless the finalizer itself is also a closed subscription).\n *\n * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed\n * subscription to a any subscription will result in no operation. (A noop).\n *\n * Adding a subscription to itself, or adding `null` or `undefined` will not perform any\n * operation at all. (A noop).\n *\n * `Subscription` instances that are added to this instance will automatically remove themselves\n * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove\n * will need to be removed manually with {@link #remove}\n *\n * @param teardown The finalization logic to add to this subscription.\n */\n add(teardown: TeardownLogic): void {\n // Only add the finalizer if it's not undefined\n // and don't add a subscription to itself.\n if (teardown && teardown !== this) {\n if (this.closed) {\n // If this subscription is already closed,\n // execute whatever finalizer is handed to it automatically.\n execFinalizer(teardown);\n } else {\n if (teardown instanceof Subscription) {\n // We don't add closed subscriptions, and we don't add the same subscription\n // twice. Subscription unsubscribe is idempotent.\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = this._finalizers ?? []).push(teardown);\n }\n }\n }\n\n /**\n * Checks to see if a this subscription already has a particular parent.\n * This will signal that this subscription has already been added to the parent in question.\n * @param parent the parent to check for\n */\n private _hasParent(parent: Subscription) {\n const { _parentage } = this;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n }\n\n /**\n * Adds a parent to this subscription so it can be removed from the parent if it\n * unsubscribes on it's own.\n *\n * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.\n * @param parent The parent subscription to add\n */\n private _addParent(parent: Subscription) {\n const { _parentage } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n\n /**\n * Called on a child when it is removed via {@link #remove}.\n * @param parent The parent to remove\n */\n private _removeParent(parent: Subscription) {\n const { _parentage } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n\n /**\n * Removes a finalizer from this subscription that was previously added with the {@link #add} method.\n *\n * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves\n * from every other `Subscription` they have been added to. This means that using the `remove` method\n * is not a common thing and should be used thoughtfully.\n *\n * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance\n * more than once, you will need to call `remove` the same number of times to remove all instances.\n *\n * All finalizer instances are removed to free up memory upon unsubscription.\n *\n * @param teardown The finalizer to remove from this subscription\n */\n remove(teardown: Exclude): void {\n const { _finalizers } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\n\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\n\nexport function isSubscription(value: any): value is Subscription {\n return (\n value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe))\n );\n}\n\nfunction execFinalizer(finalizer: Unsubscribable | (() => void)) {\n if (isFunction(finalizer)) {\n finalizer();\n } else {\n finalizer.unsubscribe();\n }\n}\n","import { Subscriber } from './Subscriber';\nimport { ObservableNotification } from './types';\n\n/**\n * The {@link GlobalConfig} object for RxJS. It is used to configure things\n * like how to react on unhandled errors.\n */\nexport const config: GlobalConfig = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n\n/**\n * The global configuration object for RxJS, used to configure things\n * like how to react on unhandled errors. Accessible via {@link config}\n * object.\n */\nexport interface GlobalConfig {\n /**\n * A registration point for unhandled errors from RxJS. These are errors that\n * cannot were not handled by consuming code in the usual subscription path. For\n * example, if you have this configured, and you subscribe to an observable without\n * providing an error handler, errors from that subscription will end up here. This\n * will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onUnhandledError: ((err: any) => void) | null;\n\n /**\n * A registration point for notifications that cannot be sent to subscribers because they\n * have completed, errored or have been explicitly unsubscribed. By default, next, complete\n * and error notifications sent to stopped subscribers are noops. However, sometimes callers\n * might want a different behavior. For example, with sources that attempt to report errors\n * to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.\n * This will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onStoppedNotification: ((notification: ObservableNotification, subscriber: Subscriber) => void) | null;\n\n /**\n * The promise constructor used by default for {@link Observable#toPromise toPromise} and {@link Observable#forEach forEach}\n * methods.\n *\n * @deprecated As of version 8, RxJS will no longer support this sort of injection of a\n * Promise constructor. If you need a Promise implementation other than native promises,\n * please polyfill/patch Promise as you see appropriate. Will be removed in v8.\n */\n Promise?: PromiseConstructorLike;\n\n /**\n * If true, turns on synchronous error rethrowing, which is a deprecated behavior\n * in v6 and higher. This behavior enables bad patterns like wrapping a subscribe\n * call in a try/catch block. It also enables producer interference, a nasty bug\n * where a multicast can be broken for all observers by a downstream consumer with\n * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BUY TIME\n * FOR MIGRATION REASONS.\n *\n * @deprecated As of version 8, RxJS will no longer support synchronous throwing\n * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad\n * behaviors described above. Will be removed in v8.\n */\n useDeprecatedSynchronousErrorHandling: boolean;\n\n /**\n * If true, enables an as-of-yet undocumented feature from v5: The ability to access\n * `unsubscribe()` via `this` context in `next` functions created in observers passed\n * to `subscribe`.\n *\n * This is being removed because the performance was severely problematic, and it could also cause\n * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have\n * their `this` context overwritten.\n *\n * @deprecated As of version 8, RxJS will no longer support altering the\n * context of next functions provided as part of an observer to Subscribe. Instead,\n * you will have access to a subscription or a signal or token that will allow you to do things like\n * unsubscribe and test closed status. Will be removed in v8.\n */\n useDeprecatedNextContext: boolean;\n}\n","import type { TimerHandle } from './timerHandle';\ntype SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearTimeoutFunction = (handle: TimerHandle) => void;\n\ninterface TimeoutProvider {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n delegate:\n | {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n }\n | undefined;\n}\n\nexport const timeoutProvider: TimeoutProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setTimeout(handler: () => void, timeout?: number, ...args) {\n const { delegate } = timeoutProvider;\n if (delegate?.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const { delegate } = timeoutProvider;\n return (delegate?.clearTimeout || clearTimeout)(handle as any);\n },\n delegate: undefined,\n};\n","/* tslint:disable:no-empty */\nexport function noop() { }\n","import { CompleteNotification, NextNotification, ErrorNotification } from './types';\n\n/**\n * A completion object optimized for memory use and created to be the\n * same \"shape\" as other notifications in v8.\n * @internal\n */\nexport const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined) as CompleteNotification)();\n\n/**\n * Internal use only. Creates an optimized error notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function errorNotification(error: any): ErrorNotification {\n return createNotification('E', undefined, error) as any;\n}\n\n/**\n * Internal use only. Creates an optimized next notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function nextNotification(value: T) {\n return createNotification('N', value, undefined) as NextNotification;\n}\n\n/**\n * Ensures that all notifications created internally have the same \"shape\" in v8.\n *\n * TODO: This is only exported to support a crazy legacy test in `groupBy`.\n * @internal\n */\nexport function createNotification(kind: 'N' | 'E' | 'C', value: any, error: any) {\n return {\n kind,\n value,\n error,\n };\n}\n","import { config } from '../config';\n\nlet context: { errorThrown: boolean; error: any } | null = null;\n\n/**\n * Handles dealing with errors for super-gross mode. Creates a context, in which\n * any synchronously thrown errors will be passed to {@link captureError}. Which\n * will record the error such that it will be rethrown after the call back is complete.\n * TODO: Remove in v8\n * @param cb An immediately executed function.\n */\nexport function errorContext(cb: () => void) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n const { errorThrown, error } = context!;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n // This is the general non-deprecated path for everyone that\n // isn't crazy enough to use super-gross mode (useDeprecatedSynchronousErrorHandling)\n cb();\n }\n}\n\n/**\n * Captures errors only in super-gross mode.\n * @param err the error to capture\n */\nexport function captureError(err: any) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { Observer, ObservableNotification } from './types';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\n\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n *\n * @class Subscriber\n */\nexport class Subscriber extends Subscription implements Observer {\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param next The `next` callback of an Observer.\n * @param error The `error` callback of an\n * Observer.\n * @param complete The `complete` callback of an\n * Observer.\n * @return A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n * @nocollapse\n * @deprecated Do not use. Will be removed in v8. There is no replacement for this\n * method, and there is no reason to be creating instances of `Subscriber` directly.\n * If you have a specific use case, please file an issue.\n */\n static create(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber {\n return new SafeSubscriber(next, error, complete);\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected isStopped: boolean = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected destination: Subscriber | Observer; // this `any` is the escape hatch to erase extra type param (e.g. R)\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.\n */\n constructor(destination?: Subscriber | Observer) {\n super();\n if (destination) {\n this.destination = destination;\n // Automatically chain subscriptions together here.\n // if destination is a Subscription, then it is a Subscriber.\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `next` from\n * the Observable, with a value. The Observable may call this method 0 or more\n * times.\n * @param {T} [value] The `next` value.\n * @return {void}\n */\n next(value?: T): void {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\n this._next(value!);\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `error` from\n * the Observable, with an attached `Error`. Notifies the Observer that\n * the Observable has experienced an error condition.\n * @param {any} [err] The `error` exception.\n * @return {void}\n */\n error(err?: any): void {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\n this.isStopped = true;\n this._error(err);\n }\n }\n\n /**\n * The {@link Observer} callback to receive a valueless notification of type\n * `complete` from the Observable. Notifies the Observer that the Observable\n * has finished sending push-based notifications.\n * @return {void}\n */\n complete(): void {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n\n unsubscribe(): void {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null!;\n }\n }\n\n protected _next(value: T): void {\n this.destination.next(value);\n }\n\n protected _error(err: any): void {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n\n protected _complete(): void {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\n\n/**\n * This bind is captured here because we want to be able to have\n * compatibility with monoid libraries that tend to use a method named\n * `bind`. In particular, a library called Monio requires this.\n */\nconst _bind = Function.prototype.bind;\n\nfunction bind any>(fn: Fn, thisArg: any): Fn {\n return _bind.call(fn, thisArg);\n}\n\n/**\n * Internal optimization only, DO NOT EXPOSE.\n * @internal\n */\nclass ConsumerObserver implements Observer {\n constructor(private partialObserver: Partial>) {}\n\n next(value: T): void {\n const { partialObserver } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n\n error(err: any): void {\n const { partialObserver } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n } catch (error) {\n handleUnhandledError(error);\n }\n } else {\n handleUnhandledError(err);\n }\n }\n\n complete(): void {\n const { partialObserver } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\n\nexport class SafeSubscriber extends Subscriber {\n constructor(\n observerOrNext?: Partial> | ((value: T) => void) | null,\n error?: ((e?: any) => void) | null,\n complete?: (() => void) | null\n ) {\n super();\n\n let partialObserver: Partial>;\n if (isFunction(observerOrNext) || !observerOrNext) {\n // The first argument is a function, not an observer. The next\n // two arguments *could* be observers, or they could be empty.\n partialObserver = {\n next: (observerOrNext ?? undefined) as (((value: T) => void) | undefined),\n error: error ?? undefined,\n complete: complete ?? undefined,\n };\n } else {\n // The first argument is a partial observer.\n let context: any;\n if (this && config.useDeprecatedNextContext) {\n // This is a deprecated path that made `this.unsubscribe()` available in\n // next handler functions passed to subscribe. This only exists behind a flag\n // now, as it is *very* slow.\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context),\n error: observerOrNext.error && bind(observerOrNext.error, context),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context),\n };\n } else {\n // The \"normal\" path. Just use the partial observer directly.\n partialObserver = observerOrNext;\n }\n }\n\n // Wrap the partial observer to ensure it's a full observer, and\n // make sure proper error handling is accounted for.\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\n\nfunction handleUnhandledError(error: any) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n } else {\n // Ideal path, we report this as an unhandled error,\n // which is thrown on a new call stack.\n reportUnhandledError(error);\n }\n}\n\n/**\n * An error handler used when no error handler was supplied\n * to the SafeSubscriber -- meaning no error handler was supplied\n * do the `subscribe` call on our observable.\n * @param err The error to handle\n */\nfunction defaultErrorHandler(err: any) {\n throw err;\n}\n\n/**\n * A handler for notifications that cannot be sent to a stopped subscriber.\n * @param notification The notification being sent\n * @param subscriber The stopped subscriber\n */\nfunction handleStoppedNotification(notification: ObservableNotification, subscriber: Subscriber) {\n const { onStoppedNotification } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\n\n/**\n * The observer used as a stub for subscriptions where the user did not\n * pass any arguments to `subscribe`. Comes with the default error handling\n * behavior.\n */\nexport const EMPTY_OBSERVER: Readonly> & { closed: true } = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n","import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\n\n/**\n * Handles an error on another job either with the user-configured {@link onUnhandledError},\n * or by throwing it on that new job so it can be picked up by `window.onerror`, `process.on('error')`, etc.\n *\n * This should be called whenever there is an error that is out-of-band with the subscription\n * or when an error hits a terminal boundary of the subscription and no error handler was provided.\n *\n * @param err the error to report\n */\nexport function reportUnhandledError(err: any) {\n timeoutProvider.setTimeout(() => {\n const { onUnhandledError } = config;\n if (onUnhandledError) {\n // Execute the user-configured error handler.\n onUnhandledError(err);\n } else {\n // Throw so it is picked up by the runtime's uncaught error mechanism.\n throw err;\n }\n });\n}\n","/**\n * Symbol.observable or a string \"@@observable\". Used for interop\n *\n * @deprecated We will no longer be exporting this symbol in upcoming versions of RxJS.\n * Instead polyfill and use Symbol.observable directly *or* use https://www.npmjs.com/package/symbol-observable\n */\nexport const observable: string | symbol = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();\n","/**\n * This function takes one parameter and just returns it. Simply put,\n * this is like `(x: T): T => x`.\n *\n * ## Examples\n *\n * This is useful in some cases when using things like `mergeMap`\n *\n * ```ts\n * import { interval, take, map, range, mergeMap, identity } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(5));\n *\n * const result$ = source$.pipe(\n * map(i => range(i)),\n * mergeMap(identity) // same as mergeMap(x => x)\n * );\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * Or when you want to selectively apply an operator\n *\n * ```ts\n * import { interval, take, identity } from 'rxjs';\n *\n * const shouldLimit = () => Math.random() < 0.5;\n *\n * const source$ = interval(1000);\n *\n * const result$ = source$.pipe(shouldLimit() ? take(5) : identity);\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * @param x Any value that is returned by this function\n * @returns The value passed as the first parameter to this function\n */\nexport function identity(x: T): T {\n return x;\n}\n","import { identity } from './identity';\nimport { UnaryFunction } from '../types';\n\nexport function pipe(): typeof identity;\nexport function pipe(fn1: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction,\n fn9: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction,\n fn9: UnaryFunction,\n ...fns: UnaryFunction[]\n): UnaryFunction;\n\n/**\n * pipe() can be called on one or more functions, each of which can take one argument (\"UnaryFunction\")\n * and uses it to return a value.\n * It returns a function that takes one argument, passes it to the first UnaryFunction, and then\n * passes the result to the next one, passes that result to the next one, and so on. \n */\nexport function pipe(...fns: Array>): UnaryFunction {\n return pipeFromArray(fns);\n}\n\n/** @internal */\nexport function pipeFromArray(fns: Array>): UnaryFunction {\n if (fns.length === 0) {\n return identity as UnaryFunction;\n }\n\n if (fns.length === 1) {\n return fns[0];\n }\n\n return function piped(input: T): R {\n return fns.reduce((prev: any, fn: UnaryFunction) => fn(prev), input as any);\n };\n}\n","import { Operator } from './Operator';\nimport { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription, Subscription } from './Subscription';\nimport { TeardownLogic, OperatorFunction, Subscribable, Observer } from './types';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A representation of any set of values over any amount of time. This is the most basic building block\n * of RxJS.\n *\n * @class Observable\n */\nexport class Observable implements Subscribable {\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n source: Observable | undefined;\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n operator: Operator | undefined;\n\n /**\n * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n constructor(subscribe?: (this: Observable, subscriber: Subscriber) => TeardownLogic) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n\n // HACK: Since TypeScript inherits static properties too, we have to\n // fight against TypeScript here so Subject can have a different static create signature\n /**\n * Creates a new Observable by calling the Observable constructor\n * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new observable\n * @nocollapse\n * @deprecated Use `new Observable()` instead. Will be removed in v8.\n */\n static create: (...args: any[]) => any = (subscribe?: (subscriber: Subscriber) => TeardownLogic) => {\n return new Observable(subscribe);\n };\n\n /**\n * Creates a new Observable, with this Observable instance as the source, and the passed\n * operator defined as the new observable's operator.\n * @method lift\n * @param operator the operator defining the operation to take on the observable\n * @return a new observable with the Operator applied\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * If you have implemented an operator using `lift`, it is recommended that you create an\n * operator by simply returning `new Observable()` directly. See \"Creating new operators from\n * scratch\" section here: https://rxjs.dev/guide/operators\n */\n lift(operator?: Operator): Observable {\n const observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n\n subscribe(observerOrNext?: Partial> | ((value: T) => void)): Subscription;\n /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */\n subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;\n /**\n * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.\n *\n * Use it when you have all these Observables, but still nothing is happening.\n *\n * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It\n * might be for example a function that you passed to Observable's constructor, but most of the time it is\n * a library implementation, which defines what will be emitted by an Observable, and when it be will emitted. This means\n * that calling `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often\n * the thought.\n *\n * Apart from starting the execution of an Observable, this method allows you to listen for values\n * that an Observable emits, as well as for when it completes or errors. You can achieve this in two\n * of the following ways.\n *\n * The first way is creating an object that implements {@link Observer} interface. It should have methods\n * defined by that interface, but note that it should be just a regular JavaScript object, which you can create\n * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular, do\n * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also\n * that your object does not have to implement all methods. If you find yourself creating a method that doesn't\n * do anything, you can simply omit it. Note however, if the `error` method is not provided and an error happens,\n * it will be thrown asynchronously. Errors thrown asynchronously cannot be caught using `try`/`catch`. Instead,\n * use the {@link onUnhandledError} configuration option or use a runtime handler (like `window.onerror` or\n * `process.on('error)`) to be notified of unhandled errors. Because of this, it's recommended that you provide\n * an `error` method to avoid missing thrown errors.\n *\n * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.\n * This means you can provide three functions as arguments to `subscribe`, where the first function is equivalent\n * of a `next` method, the second of an `error` method and the third of a `complete` method. Just as in case of an Observer,\n * if you do not need to listen for something, you can omit a function by passing `undefined` or `null`,\n * since `subscribe` recognizes these functions by where they were placed in function call. When it comes\n * to the `error` function, as with an Observer, if not provided, errors emitted by an Observable will be thrown asynchronously.\n *\n * You can, however, subscribe with no parameters at all. This may be the case where you're not interested in terminal events\n * and you also handled emissions internally by using operators (e.g. using `tap`).\n *\n * Whichever style of calling `subscribe` you use, in both cases it returns a Subscription object.\n * This object allows you to call `unsubscribe` on it, which in turn will stop the work that an Observable does and will clean\n * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback\n * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.\n *\n * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.\n * It is an Observable itself that decides when these functions will be called. For example {@link of}\n * by default emits all its values synchronously. Always check documentation for how given Observable\n * will behave when subscribed and if its default behavior can be modified with a `scheduler`.\n *\n * #### Examples\n *\n * Subscribe with an {@link guide/observer Observer}\n *\n * ```ts\n * import { of } from 'rxjs';\n *\n * const sumObserver = {\n * sum: 0,\n * next(value) {\n * console.log('Adding: ' + value);\n * this.sum = this.sum + value;\n * },\n * error() {\n * // We actually could just remove this method,\n * // since we do not really care about errors right now.\n * },\n * complete() {\n * console.log('Sum equals: ' + this.sum);\n * }\n * };\n *\n * of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.\n * .subscribe(sumObserver);\n *\n * // Logs:\n * // 'Adding: 1'\n * // 'Adding: 2'\n * // 'Adding: 3'\n * // 'Sum equals: 6'\n * ```\n *\n * Subscribe with functions ({@link deprecations/subscribe-arguments deprecated})\n *\n * ```ts\n * import { of } from 'rxjs'\n *\n * let sum = 0;\n *\n * of(1, 2, 3).subscribe(\n * value => {\n * console.log('Adding: ' + value);\n * sum = sum + value;\n * },\n * undefined,\n * () => console.log('Sum equals: ' + sum)\n * );\n *\n * // Logs:\n * // 'Adding: 1'\n * // 'Adding: 2'\n * // 'Adding: 3'\n * // 'Sum equals: 6'\n * ```\n *\n * Cancel a subscription\n *\n * ```ts\n * import { interval } from 'rxjs';\n *\n * const subscription = interval(1000).subscribe({\n * next(num) {\n * console.log(num)\n * },\n * complete() {\n * // Will not be called, even when cancelling subscription.\n * console.log('completed!');\n * }\n * });\n *\n * setTimeout(() => {\n * subscription.unsubscribe();\n * console.log('unsubscribed!');\n * }, 2500);\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // 'unsubscribed!' after 2.5s\n * ```\n *\n * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown asynchronously as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {Subscription} a subscription reference to the registered handlers\n * @method subscribe\n */\n subscribe(\n observerOrNext?: Partial> | ((value: T) => void) | null,\n error?: ((error: any) => void) | null,\n complete?: (() => void) | null\n ): Subscription {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n\n errorContext(() => {\n const { operator, source } = this;\n subscriber.add(\n operator\n ? // We're dealing with a subscription in the\n // operator chain to one of our lifted operators.\n operator.call(subscriber, source)\n : source\n ? // If `source` has a value, but `operator` does not, something that\n // had intimate knowledge of our API, like our `Subject`, must have\n // set it. We're going to just call `_subscribe` directly.\n this._subscribe(subscriber)\n : // In all other cases, we're likely wrapping a user-provided initializer\n // function, so we need to catch errors and handle them appropriately.\n this._trySubscribe(subscriber)\n );\n });\n\n return subscriber;\n }\n\n /** @internal */\n protected _trySubscribe(sink: Subscriber): TeardownLogic {\n try {\n return this._subscribe(sink);\n } catch (err) {\n // We don't need to return anything in this case,\n // because it's just going to try to `add()` to a subscription\n // above.\n sink.error(err);\n }\n }\n\n /**\n * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with\n * APIs that expect promises, like `async/await`. You cannot unsubscribe from this.\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * #### Example\n *\n * ```ts\n * import { interval, take } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(4));\n *\n * async function getTotal() {\n * let total = 0;\n *\n * await source$.forEach(value => {\n * total += value;\n * console.log('observable -> ' + value);\n * });\n *\n * return total;\n * }\n *\n * getTotal().then(\n * total => console.log('Total: ' + total)\n * );\n *\n * // Expected:\n * // 'observable -> 0'\n * // 'observable -> 1'\n * // 'observable -> 2'\n * // 'observable -> 3'\n * // 'Total: 6'\n * ```\n *\n * @param next a handler for each value emitted by the observable\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n */\n forEach(next: (value: T) => void): Promise;\n\n /**\n * @param next a handler for each value emitted by the observable\n * @param promiseCtor a constructor function used to instantiate the Promise\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n * @deprecated Passing a Promise constructor will no longer be available\n * in upcoming versions of RxJS. This is because it adds weight to the library, for very\n * little benefit. If you need this functionality, it is recommended that you either\n * polyfill Promise, or you create an adapter to convert the returned native promise\n * to whatever promise implementation you wanted. Will be removed in v8.\n */\n forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise;\n\n forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n const subscriber = new SafeSubscriber({\n next: (value) => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve,\n });\n this.subscribe(subscriber);\n }) as Promise;\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): TeardownLogic {\n return this.source?.subscribe(subscriber);\n }\n\n /**\n * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable;\n pipe(op1: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction,\n op9: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction,\n op9: OperatorFunction,\n ...operations: OperatorFunction[]\n ): Observable;\n /* tslint:enable:max-line-length */\n\n /**\n * Used to stitch together functional operators into a chain.\n * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * ## Example\n *\n * ```ts\n * import { interval, filter, map, scan } from 'rxjs';\n *\n * interval(1000)\n * .pipe(\n * filter(x => x % 2 === 0),\n * map(x => x + x),\n * scan((acc, x) => acc + x)\n * )\n * .subscribe(x => console.log(x));\n * ```\n */\n pipe(...operations: OperatorFunction[]): Observable {\n return pipeFromArray(operations)(this);\n }\n\n /* tslint:disable:max-line-length */\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(): Promise;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: typeof Promise): Promise;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: PromiseConstructorLike): Promise;\n /* tslint:enable:max-line-length */\n\n /**\n * Subscribe to this Observable and get a Promise resolving on\n * `complete` with the last emission (if any).\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * @method toPromise\n * @param [promiseCtor] a constructor function used to instantiate\n * the Promise\n * @return A Promise that resolves with the last value emit, or\n * rejects on an error. If there were no emissions, Promise\n * resolves with undefined.\n * @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise\n */\n toPromise(promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n let value: T | undefined;\n this.subscribe(\n (x: T) => (value = x),\n (err: any) => reject(err),\n () => resolve(value)\n );\n }) as Promise;\n }\n}\n\n/**\n * Decides between a passed promise constructor from consuming code,\n * A default configured promise constructor, and the native promise\n * constructor and returns it. If nothing can be found, it will throw\n * an error.\n * @param promiseCtor The optional promise constructor to passed by consuming code\n */\nfunction getPromiseCtor(promiseCtor: PromiseConstructorLike | undefined) {\n return promiseCtor ?? config.Promise ?? Promise;\n}\n\nfunction isObserver(value: any): value is Observer {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\n\nfunction isSubscriber(value: any): value is Subscriber {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n","import { createErrorClass } from './createErrorClass';\n\nexport interface ObjectUnsubscribedError extends Error {}\n\nexport interface ObjectUnsubscribedErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): ObjectUnsubscribedError;\n}\n\n/**\n * An error thrown when an action is invalid because the object has been\n * unsubscribed.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n *\n * @class ObjectUnsubscribedError\n */\nexport const ObjectUnsubscribedError: ObjectUnsubscribedErrorCtor = createErrorClass(\n (_super) =>\n function ObjectUnsubscribedErrorImpl(this: any) {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n }\n);\n","import { Operator } from './Operator';\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { Observer, SubscriptionLike, TeardownLogic } from './types';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A Subject is a special type of Observable that allows values to be\n * multicasted to many Observers. Subjects are like EventEmitters.\n *\n * Every Subject is an Observable and an Observer. You can subscribe to a\n * Subject, and you can call next to feed values as well as error and complete.\n */\nexport class Subject extends Observable implements SubscriptionLike {\n closed = false;\n\n private currentObservers: Observer[] | null = null;\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n observers: Observer[] = [];\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n isStopped = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n hasError = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n thrownError: any = null;\n\n /**\n * Creates a \"subject\" by basically gluing an observer to an observable.\n *\n * @nocollapse\n * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.\n */\n static create: (...args: any[]) => any = (destination: Observer, source: Observable): AnonymousSubject => {\n return new AnonymousSubject(destination, source);\n };\n\n constructor() {\n // NOTE: This must be here to obscure Observable's constructor.\n super();\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n lift(operator: Operator): Observable {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator as any;\n return subject as any;\n }\n\n /** @internal */\n protected _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n\n next(value: T) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n if (!this.currentObservers) {\n this.currentObservers = Array.from(this.observers);\n }\n for (const observer of this.currentObservers) {\n observer.next(value);\n }\n }\n });\n }\n\n error(err: any) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.hasError = this.isStopped = true;\n this.thrownError = err;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.error(err);\n }\n }\n });\n }\n\n complete() {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.isStopped = true;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.complete();\n }\n }\n });\n }\n\n unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = this.currentObservers = null!;\n }\n\n get observed() {\n return this.observers?.length > 0;\n }\n\n /** @internal */\n protected _trySubscribe(subscriber: Subscriber): TeardownLogic {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n\n /** @internal */\n protected _innerSubscribe(subscriber: Subscriber) {\n const { hasError, isStopped, observers } = this;\n if (hasError || isStopped) {\n return EMPTY_SUBSCRIPTION;\n }\n this.currentObservers = null;\n observers.push(subscriber);\n return new Subscription(() => {\n this.currentObservers = null;\n arrRemove(observers, subscriber);\n });\n }\n\n /** @internal */\n protected _checkFinalizedStatuses(subscriber: Subscriber) {\n const { hasError, thrownError, isStopped } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped) {\n subscriber.complete();\n }\n }\n\n /**\n * Creates a new Observable with this Subject as the source. You can do this\n * to create custom Observer-side logic of the Subject and conceal it from\n * code that uses the Observable.\n * @return {Observable} Observable that the Subject casts to\n */\n asObservable(): Observable {\n const observable: any = new Observable();\n observable.source = this;\n return observable;\n }\n}\n\n/**\n * @class AnonymousSubject\n */\nexport class AnonymousSubject extends Subject {\n constructor(\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n public destination?: Observer,\n source?: Observable\n ) {\n super();\n this.source = source;\n }\n\n next(value: T) {\n this.destination?.next?.(value);\n }\n\n error(err: any) {\n this.destination?.error?.(err);\n }\n\n complete() {\n this.destination?.complete?.();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n return this.source?.subscribe(subscriber) ?? EMPTY_SUBSCRIPTION;\n }\n}\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","export default function _classExtractFieldDescriptor(receiver, privateMap, action) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to \" + action + \" private field on non-instance\");\n }\n return privateMap.get(receiver);\n}","import classApplyDescriptorGet from \"./classApplyDescriptorGet.js\";\nimport classExtractFieldDescriptor from \"./classExtractFieldDescriptor.js\";\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"get\");\n return classApplyDescriptorGet(receiver, descriptor);\n}","export default function _classApplyDescriptorGet(receiver, descriptor) {\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n return descriptor.value;\n}","import checkPrivateRedeclaration from \"./checkPrivateRedeclaration.js\";\nexport default function _classPrivateFieldInitSpec(obj, privateMap, value) {\n checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}","import classApplyDescriptorSet from \"./classApplyDescriptorSet.js\";\nimport classExtractFieldDescriptor from \"./classExtractFieldDescriptor.js\";\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}","export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}","import getPrototypeOf from \"./getPrototypeOf.js\";\nexport default function _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n return object;\n}","import superPropBase from \"./superPropBase.js\";\nexport default function _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n return desc.value;\n };\n }\n return _get.apply(this, arguments);\n}","import _typeof from \"./typeof.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport inherits from \"./inherits.js\";\nexport default function _wrapRegExp() {\n _wrapRegExp = function _wrapRegExp(re, groups) {\n return new BabelRegExp(re, void 0, groups);\n };\n var _super = RegExp.prototype,\n _groups = new WeakMap();\n function BabelRegExp(re, flags, groups) {\n var _this = new RegExp(re, flags);\n return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype);\n }\n function buildGroups(result, re) {\n var g = _groups.get(re);\n return Object.keys(g).reduce(function (groups, name) {\n var i = g[name];\n if (\"number\" == typeof i) groups[name] = result[i];else {\n for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;\n groups[name] = result[i[k]];\n }\n return groups;\n }, Object.create(null));\n }\n return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {\n var result = _super.exec.call(this, str);\n if (result) {\n result.groups = buildGroups(result, this);\n var indices = result.indices;\n indices && (indices.groups = buildGroups(indices, this));\n }\n return result;\n }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {\n if (\"string\" == typeof substitution) {\n var groups = _groups.get(this);\n return _super[Symbol.replace].call(this, str, substitution.replace(/\\$<([^>]+)>/g, function (_, name) {\n var group = groups[name];\n return \"$\" + (Array.isArray(group) ? group.join(\"$\") : group);\n }));\n }\n if (\"function\" == typeof substitution) {\n var _this = this;\n return _super[Symbol.replace].call(this, str, function () {\n var args = arguments;\n return \"object\" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);\n });\n }\n return _super[Symbol.replace].call(this, str, substitution);\n }, _wrapRegExp.apply(this, arguments);\n}","export const isDisplay = (a) => typeof a?.toString === \"function\" ||\n typeof a === \"string\";\nexport const display = (a) => {\n if (isDisplay(a)) {\n const str = a.toString();\n if (str === \"[object Object]\")\n return JSON.stringify(a);\n return str;\n }\n return JSON.stringify(a);\n};\n","export function range(start, end, stride = 1) {\n const range = [];\n for (let i = start; i < end; i += stride) {\n range.push(i);\n }\n return range;\n}\n","export const isNone = (s) => s === null;\nexport const isSome = (s) => s != null;\nexport function None(_) {\n return null;\n}\nexport function Some(t) {\n return t;\n}\nexport const isOk = (t) => t.ok !== undefined;\nexport const isErr = (e) => e.err !== undefined;\nexport const isResult = (t) => isOk(t) || isErr(t);\nexport function Ok(t) {\n return t.ok\n ? t.ok\n : {\n ok: t,\n map(fn) {\n return fn(Ok(this));\n },\n };\n}\nexport function Err(e) {\n return (e.err ?? {\n err: e,\n map(_fn) {\n return this;\n },\n });\n}\nexport function unwrap(t) {\n if (isNone(t)) {\n throw new Error(`Attempted to unwrap None`);\n }\n if (isErr(t)) {\n throw Err(t);\n }\n if (isOk(t)) {\n return Ok(t);\n }\n return t;\n}\nexport function unwrapOr(t, def) {\n if (isNone(t)) {\n return def;\n }\n if (isErr(t)) {\n return def;\n }\n if (isOk(t)) {\n return Ok(t);\n }\n return t;\n}\nexport function unwrapOrElse(t, def) {\n if (isNone(t)) {\n return def();\n }\n if (isErr(t)) {\n return def();\n }\n if (isOk(t)) {\n return Ok(t);\n }\n return t;\n}\n"],"names":["main$1","exports","Failure$2","pexpr","text","type","isValidType","Error","this","fluffy","prototype","getPExpr","getText","getType","isDescription","isStringTerminal","isCode","isFluffy","makeFluffy","clearFluffy","subsumes","that","toString","JSON","stringify","clone","failure","toKey","Failure_1","common$l","escapeStringFor","c","String","fromCharCode","charCodeAt","abstract","optMethodName","methodName","constructor","name","assert","cond","message","defineLazyProperty","obj","propName","getterFn","memo","Object","defineProperty","get","call","assign","repeatFn","fn","n","arr","push","repeatStr","str","Array","join","repeat","x","getDuplicates","array","duplicates","idx","length","lastIndexOf","indexOf","copyWithoutDuplicates","noDuplicates","forEach","entry","isSyntactic","ruleName","firstChar","toUpperCase","isLexical","padLeft","len","optChar","ch","StringBuffer","strings","append","contents","escapeUnicode","fromCodePoint","parseInt","unescapeCodePoint","s","charAt","slice","unexpectedObjToString","baseToString","e","common$k","Node","matchLength","children","arg","numChildren","hasChildren","ctorName","firstChild","hasNoChildren","childAt","child","childIdx","indexOfChild","TerminalNode$2","nodes$1","TerminalNode","NonterminalNode","childOffsets","IterationNode","isOptional","optional","pexprsMain","UnicodeCategories","Lu","Ll","Lt","Lm","Lo","Nl","Nd","Mn","Mc","Pc","Zs","L","Ltmo","common$j","PExpr$1","interval","source","trimmed","any","create","end","Terminal$1","Range","from","to","matchCodePoint","Param","index","Alt","terms","Extend","superGrammar","body","origBody","rules","Splice","beforeTerms","afterTerms","expansionPos","Seq","factors","Iter","expr","Star","Plus","Opt","operator","minNumMatches","maxNumMatches","Number","POSITIVE_INFINITY","Not","Lookahead","Lex","Apply","args","_memoKey","value","UnicodeChar","category","pattern","PExpr","Terminal","common$i","pexprs$l","Namespace$2","allowsSkippingPrecedingSpace","asNamespace","objOrNamespace","createNamespace","optProps","extend","namespace","TypeError","ns","enumerable","writable","configurable","Namespace_1","assert$3","Namespace$1","pexprs$k","createError","optInterval","getLineAndColumnMessage","shortMessage","errors$9","applicationOfSyntacticRuleFromLexicalContext","applyExpr","applySyntacticWithLexicalRuleApplication","cannotExtendUndeclaredRule","grammarName","optSource","cannotOverrideUndeclaredRule","duplicateGrammarDeclaration","grammar","duplicateParameterNames","duplicatePropertyNames","duplicateRuleDeclaration","declGrammarName","inconsistentArity","expected","actual","incorrectArgumentType","expectedType","intervalSourcesDontMatch","invalidCodePoint","applyWrapper","node","_node","isNonterminal","digitIntervals","map","d","fullInterval","coverageWith","invalidConstructorCall","invalidParameter","getArity","grammarSyntaxError","matchFailure","getExpectedText","getInterval","kleeneExprHasNullableOperand","kleeneExpr","applicationStack","actuals","substituteParams","app","missingSemanticAction","stack","stackTrace","info","ans","moreInfo","multipleSuperSplices","undeclaredGrammar","undeclaredRule","unnecessaryExperimentalApplySyntactic","wrongNumberOfArguments","wrongNumberOfParameters","throwErrors","errors","messages","concat","multipleErrors","util$7","common","padNumbersToEqualLength","maxLen","Math","max","strcpy","dest","src","offset","origDestLen","substr","lineAndColumnToMessage","lineAndCol","sb","lineNum","colNum","lineNumbers","prevLine","nextLine","appendLine","num","content","prefix","line","lineLen","indicationLine","ranges","i","startIdx","endIdx","lineStartOffset","min","gutterWidth","replace","builtInRulesCallbacks","awaitBuiltInRules","cb","announceBuiltInRules","getLineAndColumn","currOffset","prevLineStartOffset","lineEndOffset","nextLineEndOffset","uniqueId","idCounter","BuiltInRules","lexifyCount","errors$8","pexprs$j","g","assertAllApplicationsAreValid","_assertAllApplicationsAreValid","skipSyntacticCheck","ruleInfo","isContextSyntactic","formals","isBuiltInApplySyntactic","applySyntactic","isBuiltInCaseInsensitive","caseInsensitive","common$h","errors$7","pexprs$i","assertChoicesHaveUniformArity","arity","term","otherArity","actualArity","expectedArity","common$g","errors$6","pexprs$h","assertIteratedExprsAreNotNullable","isNullable","assert$2","errors$5","util$5","Interval$3","sourceString","coverage","firstInterval","intervals","collapsedLeft","collapsedRight","range","minus","relativeTo","match","subInterval","newStartIdx","defineProperties","undefined","_contents","Interval_1","Interval$2","common$f","Flags","succeeded","isRootNode","isImplicitSpaces","isMemoized","isHeadOfLeftRecursion","terminatesLR","asEscapedString","Trace$2","input","pos1","pos2","bindings","optChildren","pos","terminatingLREntry","_flags","SKIP","toDisplayString","keys","mask","set","val","cloneWithExpr","recordLRTermination","ruleBodyTrace","walk","visitorObjOrFn","optThisArg","visitor","_walk","parent","depth","recurse","enter","exit","excerpt","getInputExcerpt","displayString","Trace_1","Trace$1","common$e","errors$4","pexprs$g","TerminalNode$1","IterationNode$1","eval","state","inputStream","origPos","next","pushBinding","processFailure","atEnd","matchString","cp","nextCodePoint","nextCharCode","codePointAt","currentApplication","enterLexifiedContext","exitLexifiedContext","factor","cols","colOffsets","numMatches","prevPos","_applicationStack","row","_bindings","splice","rowOffsets","_bindingOffsets","posToOffset","lastCol","lastColOffsets","pushFailuresInfo","popFailuresInfo","caller","posInfo","getCurrentPosInfo","isActive","handleCycle","memoKey","toMemoKey","memoRec","shouldUseMemoizedResult","hasNecessaryInfo","useMemoizedResult","reallyEval","currentLeftRecursion","headApplication","updateInvolvedApplicationMemoKeys","memoize","examinedLength","rightmostFailureOffset","startLeftRecursion","origPosInfo","description","enterApplication","origInputStreamExaminedLength","evalOnce","currentLR","growSeedResult","endLeftRecursion","_getRightmostFailureOffset","isInvolved","failuresAtRightmostPosition","cloneRecordedFailures","isTracing","getTraceEntry","traceEntry","exitApplication","offsets","lrMemoRec","newValue","seedTrace","trace","pop","test","common$d","pexprs$f","common$c","pexprs$e","getMetaInfo","grammarInterval","metaInfo","adjusted","sourceInterval","outputRecipe","toLowerCase","common$b","pexprs$d","introduceParams","withSource","common$a","pexprs$c","_isNullable","some","every","key","hasOwnProperty","inlined","common$9","pexprs$b","common$8","pexprs$a","isRestrictedJSIdentifier","resolveDuplicatedNames","argumentNameList","count","argName","dupArgName","subscript","toArgumentNameList","firstArgIndex","noDupCheck","termArgNameLists","numArgs","colIdx","col","rowIdx","uniqueNames","factorArgumentNameList","exprArgumentString","common$7","pexprs$9","ps","Failure$1","common$6","pexprs$8","toFailure","t","f","common$5","pexprs$7","pexprs$6","Failure","assert$1","CaseInsensitiveTerminal$1","param","terminal","matchStr","_getString","CaseInsensitiveTerminal_1","Interval$1","InputStream$3","nextChar","optIgnoreCase","sourceSlice","optEndIdx","InputStream_1","common$4","util$4","Interval","MatchResult$2","matcher","startExpr","cst","cstOffset","rightmostFailurePosition","optRecordedFailures","_cst","_cstOffset","_rightmostFailurePosition","_rightmostFailures","failed","detail","getRightmostFailurePosition","errorInfo","getRightmostFailures","setInput","matchResultWithFailures","_match","failures","filter","MatchResult_1","PosInfo$1","applicationMemoKeyStack","maxExaminedLength","maxRightmostFailureOffset","application","isLeftRecursion","nextLeftRecursion","indexOfFirstInvolvedRule","involvedApplicationMemoKeys","applicationMemoKey","clearObsoleteEntries","invalidatedIdx","k","builtInApplySyntacticBody","InputStream$2","MatchResult$1","PosInfo","Trace","pexprs$5","builtInRules","applySpaces","MatchState$1","optPositionToRecordFailures","memoTable","_posStack","inLexifiedContextStack","_rightmostFailurePositionStack","_recordedFailuresStack","positionToRecordFailures","recordedFailures","optNode","inSyntacticContext","inLexifiedContext","skipSpaces","popBinding","skipSpacesIfInSyntacticContext","maybeSkipSpacesBefore","numBindings","truncateBindings","newLength","getPosInfo","recordFailure","shouldCloneIfNew","recordFailures","getMemoizedTraceEntry","memoRecRightmostFailurePosition","origRecordedFailures","origNumBindings","origTrace","memoPos","getMatchResult","rightmostFailures","getTrace","matchResult","rootTrace","result","MatchState","pexprs$4","Matcher$1","getInput","replaceInputRange","currentInput","restOfMemoTable","optStartApplicationStr","_getStartExpr","tracing","applicationStr","defaultStartRule","startApp","parseApplication","Matcher_1","InputStream$1","MatchResult","common$3","errors$3","util$2","globalActionStack","prop","Wrapper","baseInterval","_baseInterval","_childWrappers","attributeName","_semantics","attributeKeys","_forgetMemoizedResultFor","childWrapper","childNode","base","wrap","isIteration","isTerminal","optChildWrappers","childWrappers","childNodes","iter","wrapper","_children","Semantics$2","superSemantics","self","checkedActionDicts","checkActionDictsIfHaventAlready","super","equals","_inheritsFrom","operations","attributes","parseSignature$1","signature","prototypeGrammar","r","prototypeGrammarSemantics","parse","checkActionDicts","checkActionDict","toRecipe","semanticsOnly","hasSuperSemantics","BuiltInSemantics","_getSemantics","superSemanticsGrammar","relatedGrammar","semanticOperations","method","actionDict","builtInDefault","srcArray","actionName","trim","addOperationOrAttribute","typePlural","parsedNameAndFormalArgs","assertNewName","doIt","formal","apply","newDefaultAction","realActionDict","_default","Operation","Attribute","thisThing","arguments","argsObj","entries","oldArgs","execute","extendOperationOrAttribute","inheritedFormals","inheritedActionDict","newActionDict","optBaseInterval","createSemantics","optSuperSemantics","proxy","addOperation","extendOperation","addAttribute","extendAttribute","_getActionDict","operationOrAttributeName","action","_remove","semantic","getOperationNames","getAttributeNames","getGrammar","bind","_checkTopDownActionDict","typeName","semantics","nodeWrapper","actionFn","_nonterminal","Semantics_1","CaseInsensitiveTerminal","Matcher","Semantics$1","common$2","errors$2","pexprs$3","SPECIAL_ACTION_NAMES","getSortedRuleValues","sort","ohmGrammar$2","buildGrammar$1","jsonToJS","Grammar$4","optDefaultStartRule","initApplicationParser","builderFn","isBuiltIn","ProtoBuiltInRules","myRules","otherRules","rule","optStartApplication","m","extendSemantics","what","problems","v","includes","_topDownActionArity","details","prettyProblems","problem","error","superGrammarExpr","startRule","operation","isDefinition","bodyRecipe","superGrammarOutput","recipeElements","toOperationActionDictionaryTemplate","_toOperationOrAttributeActionDictionaryTemplate","toAttributeActionDictionaryTemplate","first","addSemanticActionTemplate","primitive","lower","upper","unicodeLtmo","spaces","space","Grammar_1","Grammar$3","InputStream","common$1","errors$1","pexprs$2","GrammarDecl$1","ensureSuperGrammar","withSuperGrammar","ensureSuperGrammarRuleForOverriding","installOverriddenOrExtendedRule","expectedFormals","expectedNumFormals","install","withDefaultStartRule","build","grammarErrors","grammarHasInvalidApplications","define","override","descIgnored","fragment","Grammar$2","GrammarDecl","pexprs$1","Builder$2","currentDecl","currentRuleName","newGrammar","gDecl","fromRecipe","ruleRecipe","alt","termArgs","seq","factorArgs","star","plus","opt","not","la","lookahead","lex","optParams","recipe","Builder_1","version$1","__GLOBAL_OHM_VERSION__","makeRecipe$5","Builder$1","makeRecipe","makeRecipe$3","operationsAndAttributes","makeRecipe$2","Semantics","operationsAndAttributesGrammar","actions","empty","iteration","nonEmpty","_","rest","emptyListOf","nonemptyListOf","EmptyListOf","NonemptyListOf","initBuiltInSemantics","AttributeSignature","OperationSignature","optFormals","Formals","oparen","fs","cparen","asIteration","initPrototypeParser","ohmGrammar","ohmGrammar$1","makeRecipe$1","Builder","Grammar","Namespace","pexprs","util","version","superSplicePlaceholder","buildGrammar","optOhmGrammarForTesting","decl","currentRuleFormals","builder","overriding","helpers","Grammars","grammarIter","visit","id","_open","_close","SuperGrammar","superGrammarName","Rule_define","b","Rule_override","Rule_extend","RuleBody","OverrideRuleBody","opointy","cpointy","Params","seqs","TopLevelTerm_inline","inlineRuleName","isNewRuleDeclaration","params","OverrideTopLevelTerm_superSplice","Iter_star","Iter_plus","Iter_opt","Pred_not","Pred_lookahead","Lex_lex","Base_application","Base_range","Base_terminal","Base_paren","open","close","ruleDescr","ruleDescrText","caseName","space1","space2","nameFirst","nameRest","cs","oneCharTerminal","escapeChar","err","RangeError","startsWith","xs","_terminal","grammars","optNamespace","isBuffer","compileAndLoad","grammarNames","grammarFromScriptElement","grammarsFromScriptElements","optNodeOrNodeList","_buildGrammar","ohm","getProp","thing","mapProp","getPropWalkFn","descriptor","parts","split","getProps","walkFns","walkFn","isRestrictedIdentifier","VisitorFamily","config","_shapes","shapes","_getTag","getTag","Adapter","family","_adaptee","_family","valueOf","_arities","_getChildren","shape","isArray","getWalkFn","_wrap","_checkActionDict","dict","sig","parseSignature","tag","_value","_super","_this","__extends","BehaviorSubject","getValue","subscriber","subscription","_subscribe","closed","hasError","thrownError","_throwIfClosed","Subject","isFunction","createErrorClass","createImpl","ctorFunc","instance","UnsubscriptionError","arrRemove","item","initialTeardown","_parentage","_finalizers","Subscription","remove","initialFinalizer","finalizer","execFinalizer","teardown","_hasParent","_addParent","_removeParent","EMPTY_SUBSCRIPTION","EMPTY","isSubscription","add","unsubscribe","onUnhandledError","onStoppedNotification","Promise","useDeprecatedSynchronousErrorHandling","useDeprecatedNextContext","timeoutProvider","setTimeout","handler","timeout","_i","delegate","clearTimeout","handle","noop","COMPLETE_NOTIFICATION","createNotification","kind","context","errorContext","isRoot","errorThrown","destination","EMPTY_OBSERVER","Subscriber","complete","SafeSubscriber","isStopped","handleStoppedNotification","nextNotification","_next","_error","_complete","_bind","Function","thisArg","partialObserver","ConsumerObserver","handleUnhandledError","observerOrNext","context_1","reportUnhandledError","notification","observable","Symbol","identity","pipeFromArray","fns","reduce","prev","subscribe","Observable","isObserver","_trySubscribe","sink","promiseCtor","getPromiseCtor","resolve","reject","Symbol_observable","ObjectUnsubscribedError","subject","AnonymousSubject","currentObservers","observers","shift","_checkFinalizedStatuses","_innerSubscribe","extendStatics","setPrototypeOf","__proto__","p","__","__values","o","iterator","done","__read","ar","__spreadArray","pack","l","_classExtractFieldDescriptor","receiver","privateMap","has","_classPrivateFieldGet","classExtractFieldDescriptor","_classPrivateFieldInitSpec","privateCollection","_classPrivateFieldSet","_superPropBase","object","property","getPrototypeOf","_get","Reflect","target","desc","getOwnPropertyDescriptor","_wrapRegExp","re","groups","BabelRegExp","RegExp","_groups","WeakMap","flags","buildGroups","exec","indices","substitution","group","display","a","isDisplay","start","stride","isNone","isOk","ok","isErr","Ok","Err","_fn","unwrap"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/605.b27434d9.chunk.js b/web/build/static/js/605.b27434d9.chunk.js new file mode 100644 index 000000000..4d6122ade --- /dev/null +++ b/web/build/static/js/605.b27434d9.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[605],{9605:function(e,t,n){n.r(t),n.d(t,{Chip:function(){return Jt},default:function(){return Gt}});var r=n(2951),i=n(1976),o=n(3243),a=n(7597),s=n(7591),c=n(4337),u=n(1092),l=n(7791),d=n(1026),f=n(8061),p=n(6167),h=n(649),v=n(7878),m=n(3300),g=n(3118),x=n(7039),b=n(3116),j=n(6329),y=n(6693),k=n(134),C=n(326),Z=function(e){var t,n=e.A,r=e.op,i=e.D,o=e.out,a=e.flag;return(0,v.jsxs)("div",{children:[(0,v.jsx)("span",{children:"ALU"}),(0,v.jsxs)("dl",{children:[(0,v.jsx)("dt",{children:"A"})," ",(0,v.jsx)("dd",{children:(0,C.Ly)(n)}),(0,v.jsx)("dt",{children:"op"})," ",(0,v.jsx)("dd",{children:null!==(t=y.PH.op[r])&&void 0!==t?t:"(??)"}),(0,v.jsx)("dt",{children:"D"})," ",(0,v.jsx)("dd",{children:(0,C.Ly)(i)}),(0,v.jsx)("dt",{children:"="})," ",(0,v.jsx)("dd",{children:(0,C.Ly)(o)}),(0,v.jsx)("dd",{children:y.vU[a]})]})]})},w=function(e){var t=e.name,n=e.bits;return(0,v.jsxs)("div",{children:[t,": ",(0,C.E_)(n)]})},P={Enter:128,Backspace:129,ArrowLeft:130,ArrowUp:131,ArrowRight:132,ArrowDown:133,Home:134,End:135,PageUp:136,PageDown:137,Insert:138,Delete:139,Escape:140,F1:141,F2:142,F3:143,F4:144,F5:145,F6:146,F7:147,F8:148,F9:149,F10:150,F11:151,F12:152};var S=function(e){var t=e.keyboard,n=(0,p.useState)(!1),r=(0,d.Z)(n,2),i=r[0],o=r[1],a=(0,p.useState)(t.out().busVoltage),s=(0,d.Z)(a,2),c=s[0],u=s[1],l=(0,p.useCallback)((function(e){var n=function(e){var t=P[e.key];if(void 0!==t)return t;if(1===e.key.length){var n=e.key.charCodeAt(0);if(n>=32&&n<=126)return n}return 0}(e);0!==n&&(e.preventDefault(),t.setKey(n),u(t.out().busVoltage),o(!1))}),[t,o,u]),f=(0,p.useCallback)((function(){o(!0)}),[]);return(0,v.jsxs)("div",{className:"flex row align-baseline",children:[(0,v.jsx)("div",{className:"flex-1",children:(0,v.jsx)(w,{name:"Keyboard",bits:c})}),(0,v.jsx)("div",{className:"flex-1",children:i?(0,v.jsx)("input",{ref:function(e){return null===e||void 0===e?void 0:e.focus()},type:"text",onKeyDown:l}):(0,v.jsx)("button",{onClick:f,children:"\u2328\ufe0f"})})]})},F=n(189),N={none:"0px",sm:"0.125rem","":"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},O={"":"",t:"Top",r:"Right",l:"Left",b:"Bottom",tl:"TopLeft",tr:"TopRight",bl:"BottomLeft",br:"BottomRight"},A={"1/4":"25%","1/2":"50%","3/4":"75%",full:"100%"};function E(e){return void 0!==O[e]}function I(e){return N[e]}function M(e){switch(e){case"t":return[].concat((0,h.Z)(M("tl")),(0,h.Z)(M("tr")));case"r":return[].concat((0,h.Z)(M("tr")),(0,h.Z)(M("br")));case"b":return[].concat((0,h.Z)(M("br")),(0,h.Z)(M("bl")));case"l":return[].concat((0,h.Z)(M("tl")),(0,h.Z)(M("bl")));default:return[O[e]]}}function T(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";E(e)&&(t=e,e="");var n=I(e);return M(t).reduce((function(e,t){return""===t?e.borderRadius=n:e["border".concat(t,"Radius")]=n,e}),{})}var R=n(5838),D=n(7693);function H(e,t){var n;return void 0===e&&void 0!==A[t]&&(e=t),(0,F.Z)((0,F.Z)({},"inline"===t?{display:"inline-block"}:{}),{},{width:null!==(n=A[e])&&void 0!==n?n:"0"})}function _(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:G(e)?2:$(e)?3:0}function K(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t){return 2===B(e)?e.get(t):e[t]}function W(e,t,n){var r=B(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function J(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function G(e){return ke&&e instanceof Map}function $(e){return Ce&&e instanceof Set}function q(e){return e.o||e.t}function X(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Oe(e);delete t[Se];for(var n=Ne(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=Q),Object.freeze(e),t&&z(e,(function(e,t){return Y(t,!0)}),!0)),e}function Q(){_(2)}function ee(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function te(e){var t=Ae[e];return t||_(18,e),t}function ne(){return je}function re(e,t){t&&(te("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){oe(e),e.p.forEach(se),e.p=null}function oe(e){e===je&&(je=e.l)}function ae(e){return je={p:[],l:je,h:e,m:!0,_:0}}function se(e){var t=e[Se];0===t.i||1===t.i?t.j():t.O=!0}function ce(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||te("ES5").S(t,e,r),r?(n[Se].P&&(ie(t),_(4)),U(e)&&(e=ue(t,e),t.l||de(t,e)),t.u&&te("Patches").M(n[Se].t,e,t.u,t.s)):e=ue(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==we?e:void 0}function ue(e,t,n){if(ee(t))return t;var r=t[Se];if(!r)return z(t,(function(i,o){return le(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return de(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=X(r.k):r.o;z(3===r.i?new Set(i):i,(function(t,o){return le(e,r,i,t,o,n)})),de(e,i,!1),n&&e.u&&te("Patches").R(r,n,e.u,e.s)}return r.o}function le(e,t,n,r,i,o){if(L(i)){var a=ue(e,i,o&&t&&3!==t.i&&!K(t.D,r)?o.concat(r):void 0);if(W(n,r,a),!L(a))return;e.m=!1}if(U(i)&&!ee(i)){if(!e.h.F&&e._<1)return;ue(e,i),t&&t.A.l||de(e,i)}}function de(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Y(t,n)}function fe(e,t){var n=e[Se];return(n?q(n):e)[t]}function pe(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function he(e){e.P||(e.P=!0,e.l&&he(e.l))}function ve(e){e.o||(e.o=X(e.t))}function me(e,t,n){var r=G(t)?te("MapSet").N(t,n):$(t)?te("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:ne(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=Ee;n&&(i=[r],o=Ie);var a=Proxy.revocable(i,o),s=a.revoke,c=a.proxy;return r.k=c,r.j=s,c}(t,n):te("ES5").J(t,n);return(n?n.A:ne()).p.push(r),r}function ge(e){return L(e)||_(22,e),function e(t){if(!U(t))return t;var n,r=t[Se],i=B(t);if(r){if(!r.P&&(r.i<4||!te("ES5").K(r)))return r.t;r.I=!0,n=xe(t,i),r.I=!1}else n=xe(t,i);return z(n,(function(t,i){r&&V(r.t,t)===i||W(n,t,e(i))})),3===i?new Set(n):n}(e)}function xe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return X(e)}var be,je,ye="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ke="undefined"!=typeof Map,Ce="undefined"!=typeof Set,Ze="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,we=ye?Symbol.for("immer-nothing"):((be={})["immer-nothing"]=!0,be),Pe=ye?Symbol.for("immer-draftable"):"__$immer_draftable",Se=ye?Symbol.for("immer-state"):"__$immer_state",Fe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Ne="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Oe=Object.getOwnPropertyDescriptors||function(e){var t={};return Ne(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ae={},Ee={get:function(e,t){if(t===Se)return e;var n=q(e);if(!K(n,t))return function(e,t,n){var r,i=pe(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!U(r)?r:r===fe(e.t,t)?(ve(e),e.o[t]=me(e.A.h,r,e)):r},has:function(e,t){return t in q(e)},ownKeys:function(e){return Reflect.ownKeys(q(e))},set:function(e,t,n){var r=pe(q(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=fe(q(e),t),o=null==i?void 0:i[Se];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(J(n,i)&&(void 0!==n||K(e.t,t)))return!0;ve(e),he(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==fe(e.t,t)||t in e.t?(e.D[t]=!1,ve(e),he(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=q(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){_(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){_(12)}},Ie={};z(Ee,(function(e,t){Ie[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ie.deleteProperty=function(e,t){return Ie.set.call(this,e,t,void 0)},Ie.set=function(e,t,n){return Ee.set.call(this,e[0],t,n,e[0])};var Me=function(){function e(e){var t=this;this.g=Ze,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,a=Array(r>1?r-1:0),s=1;s1?r-1:0),o=1;o=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var i=te("Patches").$;return L(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Te=new Me,Re=Te.produce,De=(Te.produceWithPatches.bind(Te),Te.setAutoFreeze.bind(Te),Te.setUseProxies.bind(Te),Te.applyPatches.bind(Te),Te.createDraft.bind(Te),Te.finishDraft.bind(Te),Re);function He(e,t){return(0,p.useReducer)((function(t,n){return De(t,(function(t){e[n.action](t,n.payload)}))}),t)}function _e(e){var t=(0,p.useState)(e),n=(0,d.Z)(t,2),r=n[0],i=n[1];return(0,p.useEffect)((function(){i(e)}),[e]),[r,i]}var Le=0,Ue=1,ze=function(e){var t,n=(0,p.useState)(null!==(t=e.mode)&&void 0!==t?t:Le),r=(0,d.Z)(n,2),i=r[0],o=r[1],a=_e(e.value),s=(0,d.Z)(a,2),c=s[0],u=s[1],l=function(){return(0,v.jsx)("span",{style:(0,F.Z)({cursor:"text"},H("full","inline")),onClick:function(){o(Ue)},children:c})},f=(0,p.useCallback)((function(e){return null===e||void 0===e?void 0:e.select()}),[]),h=(0,p.useCallback)((function(t){var n,r;o(Le),u(null!==(n=t.value)&&void 0!==n?n:""),e.onChange(null!==(r=t.value)&&void 0!==r?r:"")}),[e,o,u]),m=function(){var e=(0,v.jsx)("span",{style:{display:"block",position:"relative"},children:(0,v.jsx)("input",{ref:f,style:{zIndex:"10",position:"absolute",left:"0",marginTop:"-0.375rem"},onBlur:function(e){var t=e.target;return h(t)},onKeyPress:function(e){var t=e.key,n=e.target;"Enter"===t&&h(n)},type:"text",defaultValue:c})});return e};return function(){switch(i){case Ue:return m();case Le:return l();default:return(0,v.jsx)("span",{})}}()};function Be(e,t,n){var r=t.totalHeight,i=t.toleranceHeight,o=t.bufferedItems,a=t.settings,s=a.itemHeight,c=a.minIndex,u=a.maxIndex,l=c+Math.floor((e-i)/s),d=function(e,t,n,r,i){var o=Math.max(0,e,n),a=i(o,Math.min(t,n+r-1)-o);return(0,h.Z)(a)}(c,u,l,o,n),f=Math.max((l-c)*s,0);return{scrollTop:e,topPaddingHeight:f,bottomPaddingHeight:Math.max(r-(f+d.length*s),0),data:d}}var Ke=function(e){var t,n=(0,p.useRef)(null),r=(0,p.useMemo)((function(){var t,n=function(e){var t=e.minIndex,n=void 0===t?0:t,r=e.maxIndex,i=void 0===r?Number.MAX_SAFE_INTEGER:r,o=e.startIndex,a=void 0===o?0:o,s=e.itemHeight,c=void 0===s?20:s,u=e.count,l=void 0===u?Math.max(i-n,1):u,d=e.tolerance;return{minIndex:n,maxIndex:i,startIndex:a,itemHeight:c,count:l,tolerance:void 0===d?l:d}}(null!==(t=e.settings)&&void 0!==t?t:{}),r=function(e,t){var n=e.minIndex,r=e.maxIndex,i=e.startIndex,o=e.itemHeight,a=e.count,s=e.tolerance,c=a+2*s,u=Math.max(0,i-s-n),l=a*o,d=Math.min(r-n,1)*o,f=s*o,p=u*o,h={scrollTop:0,settings:e,viewportHeight:l,totalHeight:d,toleranceHeight:f,bufferedItems:c,topPaddingHeight:p,bottomPaddingHeight:d-(p+(l+2*f)),data:[]};return(0,F.Z)((0,F.Z)({},h),Be(p+f,h,t))}(n,e.get),i=function(e){return function(t,n){return(0,F.Z)((0,F.Z)({},t),Be(n,t,e))}}(e.get);return{settings:n,reducer:i,startState:r}}),[e.settings,e.get]),i=r.settings,o=r.startState,a=r.reducer,s=(0,p.useReducer)(a,o),c=(0,d.Z)(s,2),u=c[0],l=c[1];(0,p.useEffect)((function(){null!==n.current&&l(n.current.scrollTop)}),[i,e.row]);var f=(0,p.useCallback)((function(e){e&&(e.scrollTop=n.current?n.current.scrollTop:i.startIndex*i.itemHeight),n.current=e}),[n,i.startIndex,i.itemHeight]),h=u.data.map((function(t){return(0,v.jsx)("div",{style:{height:"".concat(i.itemHeight,"px")},children:e.row(t)},e.rowKey(t))}));return(0,v.jsxs)("div",{ref:f,style:{height:"".concat(u.viewportHeight,"px"),overflowY:"scroll",overflowAnchor:"none"},className:null!==(t=e.className)&&void 0!==t?t:"",onScroll:function(e){return l(e.target.scrollTop)},children:[(0,v.jsx)("div",{style:{height:"".concat(u.topPaddingHeight,"px")}}),h,(0,v.jsx)("div",{style:{height:"".concat(u.bottomPaddingHeight,"px")}})]})},Ve=function(e){var t=e.memory,n=e.jmp,r=void 0===n?{value:0}:n,i=e.highlight,o=void 0===i?-1:i,a=e.editable,s=void 0!==a&&a,c=e.format,u=void 0===c?C.E_:c,l=e.onChange,f=void 0===l?function(){}:l,h=(0,p.useMemo)((function(){return{count:Math.min(t.size,20),maxIndex:t.size,itemHeight:34,startIndex:r.value}}),[t.size,r]),m=(0,p.useCallback)((function(e,n){return t.range(e,e+n).map((function(t,n){return[n+e,t]}))}),[t]),g=(0,p.useCallback)((function(e){var t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,v.jsx)(We,{index:n,value:u(r),editable:s,highlight:n===o,onChange:f})}),[u,s,o,f]);return(0,v.jsx)(Ke,{settings:h,get:m,row:g,rowKey:function(e){return(0,d.Z)(e,1)[0]}})},We=function(e){var t=e.index,n=e.value,r=e.highlight,i=void 0!==r&&r,o=e.editable,a=void 0!==o&&o,s=e.onChange,c=void 0===s?function(){}:s;return(0,v.jsxs)("div",{style:{display:"flex",height:"100%"},children:[(0,v.jsx)("code",{style:(0,F.Z)((0,F.Z)({},T("none")),i?{background:"var(--code-kbd-background-color)"}:{}),children:(0,C.$v)(t)}),(0,v.jsx)("code",{style:(0,F.Z)((0,F.Z)({flex:"1",textAlign:"right"},T("none")),i?{background:"var(--code-kbd-background-color)"}:{}),children:a?(0,v.jsx)(ze,{value:n,onChange:function(e){return c(t,e,Number(n))}}):(0,v.jsx)("span",{children:n})})]})},Je=function(e){var t=e.name,n=void 0===t?"Memory":t,r=e.highlight,i=void 0===r?-1:r,o=e.editable,a=void 0===o||o,s=e.memory,c=e.format,u=void 0===c?"dec":c,l=(0,p.useState)(u),f=(0,d.Z)(l,2),h=f[0],m=f[1],g=(0,p.useState)("0"),x=(0,d.Z)(g,2),b=x[0],j=x[1],y=(0,p.useState)({value:0}),k=(0,d.Z)(y,2),Z=k[0],w=k[1],P=function(){w({value:Number(b)})},S=(0,p.useCallback)((function(e,t){s.update(e,t,null!==h&&void 0!==h?h:"dec")}),[s,h]);return(0,v.jsxs)("article",{className:"panel",children:[(0,v.jsxs)("header",{children:[(0,v.jsx)("div",{children:n}),(0,v.jsxs)("fieldset",{role:"group",children:[(0,v.jsx)("button",{onClick:function(){},className:"flex-0",children:"\ud83d\udcc2"}),(0,v.jsx)("input",{style:{width:"4em",height:"100%"},placeholder:"Goto",onKeyDown:function(e){return"Enter"===e.key&&P()},onChange:function(e){var t=e.target.value;return j(null!==t&&void 0!==t?t:"0")}}),(0,v.jsx)("button",{onClick:P,className:"flex-0",children:"\u2935\ufe0f"}),R.I2.map((function(e){return(0,v.jsxs)("label",{className:"flex-0",role:"button","aria-current":e===h,children:[(0,v.jsx)("input",{type:"radio",name:n,value:e,checked:e===h,onChange:function(){return m(e)}}),e]},e)}))]})]}),(0,v.jsx)(Ve,{jmp:Z,memory:s,highlight:i,editable:a,format:function(e){return function(e,t){switch(e){case"bin":return(0,C.Ly)(t);case"hex":return(0,C.$v)(t);case"asm":return(0,D.a)(t);default:return(0,C.E_)(t)}}(h,e)},onChange:S})]})};var Ge=n(5541),$e=n(4408),qe=n(6531);function Xe(){return(0,$e.j)(qe.S.get())}var Ye=function(){var e=function(){var e=(0,p.useState)(Xe()),t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,p.useEffect)((function(){var e=qe.S.get().$.subscribe((function(){r(Xe())}));return function(){return e.unsubscribe()}}),[]),n}();return(0,v.jsx)("span",{style:{whiteSpace:"nowrap"},children:e})},Qe="white";function et(e,t,n){return 0===(e.get(32*n+(t/16|0))&1<0?(0,v.jsx)(v.Fragment,{children:r}):void 0}var it=n(8582),ot=n(1585);function at(e){return{pin:e,bits:(0,ot.w)(0,e.width).map((function(t){return[t,e.voltage(t)]})).reverse()}}function st(e){return(0,h.Z)(e.entries()).map(at)}var ct=function(e){var t=e.sim,n=t.inPins,r=t.outPins,i=t.internalPins;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("style",{children:"\n table.pinout th {\n font-weight: bold;\n }\n\n table.pinout tbody td:first-child {\n text-align: right;\n --font-size: 1rem;\n width: 0;\n white-space: nowrap;\n border-right: var(--border-width) solid var(--table-border-color);\n }\n\n table.pinout tbody button {\n --font-size: 0.875em;\n font-family: var(--font-family-monospace);\n max-width: 2em;\n }\n "}),(0,v.jsx)("table",{className:"pinout",children:(0,v.jsxs)("tbody",{children:[(0,v.jsx)(ut,{pins:n,header:"Input pins",toggle:e.toggle}),(0,v.jsx)(ut,{pins:r,header:"Output pins",disabled:e.sim.pending}),(0,v.jsx)(ut,{pins:i,header:"Internal pins",disabled:e.sim.pending})]})})]})},ut=function(e){return(0,v.jsxs)(v.Fragment,{children:[e.pins.length>0&&(0,v.jsx)("tr",{children:(0,v.jsx)("th",{colSpan:2,children:e.header})}),(0,h.Z)(e.pins).map((function(t){return(0,v.jsxs)("tr",{children:[(0,v.jsx)("td",{children:t.pin.name}),(0,v.jsx)("td",{children:(0,v.jsx)(lt,{pin:t,toggle:e.toggle,disabled:e.disabled})})]},t.pin.name)}))]})},lt=function(e){var t=e.pin,n=e.toggle,r=e.disabled,i=void 0!==r&&r;return(0,v.jsx)("fieldset",{role:"group",style:{width:"".concat(t.bits.length,"rem")},children:t.bits.map((function(e){var r=(0,d.Z)(e,2),o=r[0],a=r[1];return(0,v.jsx)("button",{onClick:function(){return null===n||void 0===n?void 0:n(t.pin,o)},disabled:i,"data-testid":"pin-".concat(o),children:a},o)}))})};var dt=function(e){var t=function(e){var t=(0,p.useRef)((function(){})),n=(0,p.useMemo)((function(){return function(e,t){var n={running:e.running,speed:e.speed,steps:e.steps},r=e.finishFrame.bind(e);return e.finishFrame=function(){r(),t.current({action:"update"})},{initialState:n,reducers:{update:function(t){t.running=e.running,t.speed=e.speed,t.steps=e.steps},setSteps:function(t,n){t.steps=n,e.steps=n},setSpeed:function(t,n){t.speed=n,e.speed=n}},actions:{frame:function(){e.frame()},start:function(){e.start(),t.current({action:"update"})},stop:function(){e.stop(),t.current({action:"update"})},reset:function(){e.reset(),t.current({action:"update"})}}}}(e,t)}),[e,t]),r=n.initialState,i=n.reducers,o=n.actions,a=He(i,r),s=(0,d.Z)(a,2),c=s[0],u=s[1];return t.current=u,{state:c,dispatch:t.current,actions:o}}(e.runner);return(0,v.jsxs)("fieldset",{role:"group",children:[(0,v.jsx)("button",{className:"flex-0",onClick:function(){return t.actions.frame()},"data-tooltip":"Step","data-placement":"bottom",children:"\u27a1\ufe0f"}),(0,v.jsx)("button",{className:"flex-0",onClick:function(){return t.state.running?t.actions.stop():t.actions.start()},"data-tooltip":t.state.running?"Pause":"Play","data-placement":"bottom",children:t.state.running?"\u23f8":"\ufe0f\u23e9"}),(0,v.jsx)("button",{className:"flex-0",onClick:function(){return t.actions.reset()},"data-tooltip":"Reset","data-placement":"bottom",children:"\u23ee"}),(0,v.jsx)("select",{className:"flex-1",name:"speed",value:t.state.speed,onChange:function(e){var n,r;t.dispatch({action:"setSpeed",payload:Number(null!==(n=null===(r=e.target)||void 0===r?void 0:r.value)&&void 0!==n?n:t.state.speed)})},disabled:t.state.running,children:[[1e3,"Slow"],[500,"Fast"],[16,"Faster"]].map((function(e){var t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,v.jsx)("option",{value:n,children:r},n)}))}),(0,v.jsx)("select",{className:"flex-1",name:"steps",value:t.state.steps,onChange:function(e){var n,r;t.dispatch({action:"setSteps",payload:Number(null!==(n=null===(r=e.target)||void 0===r?void 0:r.value)&&void 0!==n?n:t.state.steps)})},disabled:t.state.running,children:[[1,"1 Step"],[500,"500"],[1e3,"1000"],[2e3,"2000"]].map((function(e){var t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,v.jsx)("option",{value:n,children:r},n)}))}),e.children]})},ft=n(8365),pt=n(8090),ht=n(9647),vt=n(7538),mt=n(4649),gt=n(2648),xt=n(3943),bt=qe.S.get(),jt=new WeakMap,yt=new WeakMap,kt=new WeakMap,Ct=new WeakMap,Zt=function(){function e(){var t=this;(0,r.Z)(this,e),(0,mt.Z)(this,"steps",1),(0,mt.Z)(this,"speed",1e3),(0,vt.Z)(this,jt,{writable:!0,value:!1}),(0,vt.Z)(this,yt,{writable:!0,value:0}),(0,vt.Z)(this,kt,{writable:!0,value:0}),(0,vt.Z)(this,Ct,{writable:!0,value:function(){var e=(0,l.Z)((0,u.Z)().mark((function e(){var n,r,i,o;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((0,xt.Z)(t,jt)){e.next=2;break}return e.abrupt("return");case 2:if(n=Date.now(),r=n-(0,xt.Z)(t,kt),(0,gt.Z)(t,kt,n),(0,gt.Z)(t,yt,(0,xt.Z)(t,yt)+r),!((0,xt.Z)(t,yt)>t.speed)){e.next=19;break}i=!1,o=0;case 9:if(!(o0&&void 0!==arguments[0]?arguments[0]:"";return n(e)},language:r,onMount:g})})},It=function(e){var t=e.className,n=void 0===t?"":t,r=e.style,i=void 0===r?{}:r,o=e.disabled,a=void 0!==o&&o,s=e.value,c=e.onChange,u=e.grammar,l=e.language,f=e.highlight,h=(0,p.useState)(),m=(0,d.Z)(h,2),g=m[0],x=m[1],b=(0,p.useContext)(wt.Il).monaco,j=(0,p.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=u.match(e);x(t.failed()?t:void 0)}),[x,u]);(0,p.useEffect)((function(){return j(s)}),[j,s]);var y=(0,p.useMemo)((function(){return function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;return function(){for(var r=arguments.length,i=new Array(r),o=0;o0&&void 0!==arguments[0]?arguments[0]:"";c(e),y(e)}),[y,c]);return(0,v.jsx)("div",{className:"Editor ".concat(n),style:i,children:b.canUse&&b.wants?(0,v.jsx)(Et,{value:s,onChange:k,language:l,error:g,disabled:a,highlight:f}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(At,{value:s,onChange:k,language:l,disabled:a}),(0,v.jsx)(Ot,{error:g})]})})},Mt=function(e){var t;return(0,v.jsxs)("article",{className:["panel",null!==(t=e.className)&&void 0!==t?t:""].join(" "),children:[e.header&&(0,v.jsx)("header",{children:e.header}),(0,v.jsx)("main",{children:e.children}),e.footer&&(0,v.jsx)("footer",{children:e.footer})]})},Tt=function(e){var t;return(0,v.jsxs)("details",{className:null!==(t=e.className)&&void 0!==t?t:"",open:e.open,style:e.style,children:[(0,v.jsx)("summary",{children:(0,v.jsx)("div",{className:"flex row align-baseline",children:e.summary})}),e.children]})},Rt=n(726),Dt=n(4625),Ht=n(691),_t=n(1277),Lt=n(3389),Ut=n(8698),zt=[["01","Project 1"],["02","Project 2"],["03","Project 3"],["05","Project 5"]];function Bt(e){return"CHIP ".concat(e," {\n IN in;\n OUT out;\n PARTS:\n}")}function Kt(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{clocked:e.clocked,inPins:st(e.ins),outPins:st(e.outs),internalPins:st(e.pins),chip:[e],pending:t,invalid:n}}var Vt=qe.S.get();function Wt(e,t,n,r){var i=function(e){var t,n,r=null!==(t=e["/chip/project"])&&void 0!==t?t:"01",i=_t.CHIP_PROJECTS[r];return{project:r,chips:i,chipName:null!==(n=e["/chip/chip"])&&void 0!==n?n:i[0]}}(n),o=i.project,a=i.chipName,s=i.chips,c=new j.P9,f=new Lt.l1,p=!1,v={setFiles:function(e,t){var n=t.hdl,r=void 0===n?e.files.hdl:n,i=t.tst,o=void 0===i?e.files.tst:i,a=t.cmp,s=void 0===a?e.files.cmp:a,c=t.out,u=void 0===c?"":c;e.files.hdl=r,e.files.tst=o,e.files.cmp=s,e.files.out=u},updateChip:function(e,t){var n,r,i,o,s,u;e.sim=Kt(c,null!==(n=null===t||void 0===t?void 0:t.pending)&&void 0!==n?n:e.sim.pending,null!==(r=null===t||void 0===t?void 0:t.invalid)&&void 0!==r?r:e.sim.invalid),e.controls.error=e.sim.invalid?null!==(i=null===t||void 0===t?void 0:t.error)&&void 0!==i?i:e.controls.error:"",e.controls.chips=_t.CHIP_PROJECTS[e.controls.project],e.controls.chipName=e.sim.invalid?null!==(o=null===t||void 0===t?void 0:t.chipName)&&void 0!==o?o:a:null!==(s=null!==(u=c.name)&&void 0!==u?u:null===t||void 0===t?void 0:t.chipName)&&void 0!==s?s:a,e.controls.chips.includes(e.controls.chipName)||(e.controls.chips=[].concat((0,h.Z)(e.controls.chips),[e.controls.chipName]))},setProject:function(e,t){var n=_t.CHIP_PROJECTS[t],r=e.controls.chipName&&n.includes(e.controls.chipName)?e.controls.chipName:n[0];e.controls.project=t,e.controls.chips=n,this.setChip(e,r)},setChip:function(e,t){e.controls.chipName=t,e.controls.hasBuiltin=g.zZ.has(t)},testRunning:function(e){e.controls.runningTest=!0},testFinished:function(e){e.controls.runningTest=!1;var n=e.files.out.trim()===e.files.cmp.trim();t(n?"Simulation successful: The output file is identical to the compare file":"Simulation error: The output file differs from the compare file")},updateTestStep:function(e){var t,n,r,i;if(e.files.out=null!==(t=null===(n=f)||void 0===n?void 0:n.log())&&void 0!==t?t:"",null!==(r=f)&&void 0!==r&&null!==(i=r.currentStep)&&void 0!==i&&i.span)e.controls.span=f.currentStep.span;else if(f.done){var o=e.files.tst.length;e.controls.span={start:o-1,end:o}}this.updateChip(e,{pending:e.sim.pending,invalid:e.sim.invalid})}},m={setProject:function(e){o=n["/chip/project"]=e,r.current({action:"setProject",payload:o}),this.setChip(_t.CHIP_PROJECTS[o][0])},setChip:function(e){var t=arguments,i=this;return(0,l.Z)((0,u.Z)().mark((function o(){var s,c;return(0,u.Z)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return c=t.length>1&&void 0!==t[1]?t[1]:null!==(s=n["/chip/project"])&&void 0!==s?s:_t.ChipProjects["01"],a=n["/chip/chip"]=e,r.current({action:"setChip",payload:a}),o.next=5,i.loadChip(c,a);case 5:p&&i.useBuiltin();case 6:case"end":return o.stop()}}),o)})))()},reset:function(){qe.S.get().reset(),c.reset(),f.reset(),r.current({action:"setFiles",payload:{}}),r.current({action:"updateChip"})},updateFiles:function(e){var n=this;return(0,l.Z)((0,u.Z)().mark((function i(){var o,a,s;return(0,u.Z)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(o=e.hdl,a=e.tst,s=e.cmp,r.current({action:"setFiles",payload:{hdl:o,tst:a,cmp:s}}),i.prev=2,!o){i.next=6;break}return i.next=6,n.compileChip(o);case 6:a&&n.compileTest(a),i.next=12;break;case 9:i.prev=9,i.t0=i.catch(2),t((0,$e.j)(i.t0));case 12:case"end":return i.stop()}}),i,null,[[2,9]])})))()},compileChip:function(e){var n=this;return(0,l.Z)((0,u.Z)().mark((function i(){var o,a,s;return(0,u.Z)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(c.remove(),o=pt.Gq.parse(e),!(0,Dt.dZ)(o)){i.next=6;break}return t("Failed to parse chip"),r.current({action:"updateChip",payload:{invalid:!0,error:(0,$e.j)((0,Dt.UG)(o))}}),i.abrupt("return");case 6:return i.next=8,(0,Ht.J_)((0,Dt.Ok)(o));case 8:if(a=i.sent,!(0,Dt.dZ)(a)){i.next=14;break}return s=(0,$e.j)((0,Dt.UG)(a)),t(s),r.current({action:"updateChip",payload:{invalid:!0,error:s}}),i.abrupt("return");case 14:t("Compiled ".concat(c.name)),n.replaceChip((0,Dt.Ok)(a));case 16:case"end":return i.stop()}}),i)})))()},replaceChip:function(e){var t,n=c.ins,i=(0,Rt.Z)(n);try{for(i.s();!(t=i.n()).done;){var o=(0,d.Z)(t.value,2),a=o[0],s=o[1].busVoltage,u=e.ins.get(a);u&&(u.busVoltage=s)}}catch(l){i.e(l)}finally{i.f()}Vt.reset(),e.eval(),c=e,f=f.with(c).reset(),r.current({action:"updateChip",payload:{invalid:!1}}),r.current({action:"updateTestStep"})},loadChip:function(t,i){var o=this;return(0,l.Z)((0,u.Z)().mark((function a(){var s,c,l,f,p,h;return(0,u.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return n["/chip/chip"]=i,s=function(e){return"/projects/".concat(t,"/").concat(i,"/").concat(i,".").concat(e)},a.next=4,Promise.all([e.readFile(s("hdl")).catch((function(){return Bt(i)})),e.readFile(s("tst")).catch((function(e){return console.log(e),"repeat 10 {\n tick,\n tock;\n}"})),e.readFile(s("cmp")).catch((function(){return"| in|out|"}))]);case 4:return c=a.sent,l=(0,d.Z)(c,3),f=l[0],p=l[1],h=l[2],r.current({action:"setFiles",payload:{hdl:f,tst:p,cmp:h}}),a.next=12,o.compileChip(f);case 12:o.compileTest(p);case 13:case"end":return a.stop()}}),a)})))()},saveChip:function(n){var i=arguments;return(0,l.Z)((0,u.Z)().mark((function s(){var c,l,d;return(0,u.Z)().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return c=i.length>1&&void 0!==i[1]?i[1]:o,l=i.length>2&&void 0!==i[2]?i[2]:a,r.current({action:"setFiles",payload:{hdl:n}}),d="/projects/".concat(c,"/").concat(l,"/").concat(l,".hdl"),s.next=6,e.writeFile(d,n);case 6:t("Saved ".concat(d));case 7:case"end":return s.stop()}}),s)})))()},toggle:function(e,t){void 0!==t?e.busVoltage=e.busVoltage^1<0&&void 0!==e[0])||e[0],d=e.length>1?e[1]:void 0,l){i.next=7;break}return p=!1,i.next=6,n.loadChip(o,a);case 6:return i.abrupt("return");case 7:if(p=!0,f=null!==(s=c.name)&&void 0!==s?s:a,h=(0,g.cT)(f),!(0,Dt.dZ)(h)){i.next=13;break}return t("Failed to load builtin ".concat(f,": ").concat((0,$e.j)((0,Dt.UG)(h)))),i.abrupt("return");case 13:if(!d){i.next=16;break}return i.next=16,n.saveChip(d,o,a);case 16:v=_t.ChipProjects[o].CHIPS[f]["".concat(f,".hdl")],m=v.replace("PARTS:","PARTS:\n BUILTIN ".concat(f)),r.current({action:"setFiles",payload:{hdl:m}}),n.replaceChip((0,Dt.Ok)(h));case 20:case"end":return i.stop()}}),i)})))()},initialize:function(){var e=this;return(0,l.Z)((0,u.Z)().mark((function t(){return(0,u.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.loadChip(o,a);case 2:case"end":return t.stop()}}),t)})))()},compileTest:function(n){r.current({action:"setFiles",payload:{tst:n}});var i=ht.qH.parse(n);return(0,Dt.dZ)(i)?(t("Failed to parse test"),!1):(t("Parsed tst"),(f=Lt.l1.from((0,Dt.Ok)(i)).with(c).reset()).setFileSystem(e),r.current({action:"updateTestStep"}),!0)},runTest:function(t){var n=this;return(0,l.Z)((0,u.Z)().mark((function i(){return(0,u.Z)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(n.compileTest(t)){i.next=2;break}return i.abrupt("return");case 2:return r.current({action:"testRunning"}),e.pushd("/samples"),i.next=6,f.run();case 6:e.popd(),r.current({action:"updateTestStep"}),r.current({action:"testFinished"});case 9:case"end":return i.stop()}}),i)})))()},tick:function(){return this.stepTest()},stepTest:function(){return(0,l.Z)((0,u.Z)().mark((function e(){var t;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(0,Ge.hu)(f.chipId===c.id,"Test and chip out of sync"),e.next=3,f.step();case 3:return t=e.sent,r.current({action:"updateTestStep"}),t&&r.current({action:"testFinished"}),e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)})))()}};return{initialState:function(){var e={project:o,chips:s,chipName:a,hasBuiltin:g.zZ.has(a),runningTest:!1,error:""},n=(0,g.cT)(e.chipName);return(0,Dt.dZ)(n)?(t((0,$e.j)((0,Dt.UG)(n))),c=new j.P9):c=(0,Dt.Ok)(n),{controls:e,files:{hdl:"",cmp:"",tst:"",out:""},sim:Kt(c)}}(),reducers:v,actions:m}}var Jt=function(){var e=(0,p.useContext)(Ut.r),t=e.fs,n=e.setStatus,m=(0,p.useContext)(wt.Il),g=m.filePicker,x=m.tracking,b=function(){var e=(0,p.useContext)(Ut.r),t=e.fs,n=e.setStatus,r=e.storage,i=(0,p.useRef)((function(){})),o=(0,p.useMemo)((function(){return Wt(t,n,r,i)}),[t,n,r,i]),a=o.initialState,s=o.reducers,c=o.actions,u=He(s,a),l=(0,d.Z)(u,2),f=l[0],h=l[1];return i.current=h,{state:f,dispatch:i,actions:c}}(),j=b.state,y=b.actions,k=b.dispatch,C=_e(j.files.hdl),Z=(0,d.Z)(C,2),w=Z[0],P=Z[1],S=_e(j.files.tst),F=(0,d.Z)(S,2),N=F[0],O=F[1],A=_e(j.files.cmp),E=(0,d.Z)(A,2),I=E[0],M=E[1],T=_e(j.files.out),R=(0,d.Z)(T,1)[0];(0,p.useEffect)((function(){y.initialize()}),[y]),(0,p.useEffect)((function(){x.trackPage("/chip")}),[x]);(0,p.useEffect)((function(){x.trackEvent("action","setProject",j.controls.project),x.trackEvent("action","setChip",j.controls.chipName)}),[]);var D=(0,p.useCallback)((function(e){y.setProject(e),x.trackEvent("action","setProject",e)}),[y,x]),H=(0,p.useCallback)((function(e){y.setChip(e),y.reset(),x.trackEvent("action","setChip",e)}),[y,x]),_=(0,p.useCallback)((function(){y.eval(),x.trackEvent("action","eval")}),[y,x]),L=(0,p.useRef)((function(){}));L.current=(0,l.Z)((0,u.Z)().mark((function e(){var t,n,r,i=arguments;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>0&&void 0!==i[0]?i[0]:{},e.next=3,y.updateFiles({hdl:r.hdl,tst:null!==(t=r.tst)&&void 0!==t?t:N,cmp:null!==(n=r.cmp)&&void 0!==n?n:I});case 3:case"end":return e.stop()}}),e)})));var U=(0,p.useCallback)((0,l.Z)((0,u.Z)().mark((function e(){var r,i;return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,g.select();case 3:return r=e.sent,e.next=6,t.readFile(r);case 6:return i=e.sent,e.next=9,L.current({tst:i});case 9:e.next=15;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0),n("Failed to load into memory");case 15:case"end":return e.stop()}}),e,null,[[0,11]])}))),[g,n,t,L]),z=(0,p.useRef)();(0,p.useEffect)((function(){return z.current=new(function(e){(0,s.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,r.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"reset",value:function(){var e=(0,l.Z)((0,u.Z)().mark((function e(){return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.current();case 2:return e.next=4,y.reset();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"finishFrame",value:function(){(0,o.Z)((0,a.Z)(n.prototype),"finishFrame",this).call(this),k.current({action:"updateTestStep"})}},{key:"tick",value:function(){var e=(0,l.Z)((0,u.Z)().mark((function e(){return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",y.stepTest());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"toggle",value:function(){k.current({action:"updateTestStep"})}}]),n}(Zt)),function(){var e;null===(e=z.current)||void 0===e||e.stop()}}),[L,y,k]);var B=(0,p.useMemo)((function(){return{toggle:function(){y.clock(),x.trackEvent("action","toggleClock")},reset:function(){x.trackEvent("action","resetClock"),y.reset()}}}),[y]),K=(0,p.useState)(!1),V=(0,d.Z)(K,2),W=V[0],J=V[1],G=function(){var e=(0,l.Z)((0,u.Z)().mark((function e(){return(0,u.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!W){e.next=6;break}return J(!1),e.next=4,y.useBuiltin(!1);case 4:e.next=9;break;case 6:return J(!0),e.next=9,y.useBuiltin(!0,w);case 9:y.reset();case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),$=(0,v.jsx)(v.Fragment,{children:(0,v.jsxs)("fieldset",{role:"group",children:[(0,v.jsx)("select",{value:j.controls.project,onChange:function(e){var t=e.target.value;D(t)},"data-testid":"project-picker",children:zt.map((function(e){var t=(0,d.Z)(e,2),n=t[0],r=t[1];return(0,v.jsx)("option",{value:n,children:r},n)}))}),(0,v.jsx)("select",{value:j.controls.chipName,onChange:function(e){var t=e.target.value;H(t)},"data-testid":"chip-picker",children:j.controls.chips.map((function(e){return(0,v.jsx)("option",{value:e,children:e},e)}))}),(0,v.jsx)("button",{className:"flex-0",onClick:function(){y.saveChip(w)},disabled:W,children:(0,v.jsx)(f.cC,{id:"Save"})})]})}),q=(0,v.jsx)(Mt,{className:"_hdl_panel",header:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{tabIndex:0,children:"HDL"}),(0,v.jsx)("fieldset",{children:j.controls.hasBuiltin&&(0,v.jsxs)("label",{children:[(0,v.jsx)("input",{type:"checkbox",role:"switch",checked:W,onChange:G}),(0,v.jsx)(f.cC,{id:"Builtin"})]})}),$]}),children:(0,v.jsx)(It,{className:"flex-1",value:w,onChange:function(e){P(e),L.current(W?{}:{hdl:e})},grammar:pt.Gq.parser,language:"hdl",disabled:W})}),X=(0,v.jsxs)("fieldset",{role:"group",children:[(0,v.jsx)("button",{onClick:_,onKeyDown:_,disabled:!j.sim.pending,children:(0,v.jsx)(f.cC,{id:"Eval"})}),(0,v.jsxs)("button",{onClick:B.toggle,style:{maxWidth:"initial"},disabled:!j.sim.clocked,children:[(0,v.jsx)(f.cC,{id:"Clock"}),":","\xa0",(0,v.jsx)(Ye,{})]}),(0,v.jsx)("button",{onClick:B.reset,style:{maxWidth:"initial"},disabled:!j.sim.clocked,children:(0,v.jsx)(f.cC,{id:"Reset"})})]}),Y=function(e){return(0,h.Z)(e.parts).map((function(e,t){return["".concat(e.id,"_").concat(t),rt(e)]})).filter((function(e){var t=(0,d.Z)(e,2);return t[0],void 0!==t[1]}))}({parts:j.sim.chip}),Q=(0,v.jsx)(Mt,{className:"_parts_panel",header:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:(0,v.jsx)(f.cC,{id:"Chip"})}),X]}),children:j.sim.invalid?(0,v.jsx)(f.cC,{id:"Invalid Chip"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(ct,{sim:j.sim,toggle:y.toggle}),Y.length>0&&(0,v.jsx)(Tt,{summary:(0,v.jsx)(f.cC,{id:"Visualizations"}),open:!0,children:(0,v.jsx)("main",{children:Y.map((function(e){var t=(0,d.Z)(e,2);t[0];return t[1]}))})})]})}),ee=(0,p.useState)("tst"),te=(0,d.Z)(ee,2),ne=te[0],re=te[1],ie=(0,p.useCallback)((function(e){re(e),x.trackEvent("tab","change",e)}),[x]),oe=(0,v.jsx)(Mt,{className:"_test_panel",header:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{className:"flex-1",children:(0,v.jsx)(f.cC,{id:"Test"})}),(0,v.jsx)("div",{className:"flex-2",children:z.current&&(0,v.jsx)(dt,{runner:z.current})}),(0,v.jsx)("div",{children:(0,v.jsxs)("button",{onClick:U,children:[(0,v.jsx)(Pt.J,{name:"upload_file"})," "]})})]}),children:(0,v.jsxs)("div",{role:"tablist",style:{"--tab-count":"3"},children:[(0,v.jsx)("div",{role:"tab",id:"test-tab-tst","aria-controls":"test-tabpanel-tst","aria-selected":"tst"===ne,children:(0,v.jsxs)("label",{children:[(0,v.jsx)("input",{type:"radio",name:"test-tabs","aria-controls":"test-tabpanel-tst",value:"tst",checked:"tst"===ne,onChange:function(){return ie("tst")}}),"Test Script"]})}),(0,v.jsx)("div",{role:"tabpanel","aria-labelledby":"test-tab-tst",id:"test-tabpanel-tst",children:(0,v.jsx)(It,{value:N,onChange:O,grammar:ht.qH.parser,language:"tst",highlight:j.controls.span})}),(0,v.jsx)("div",{role:"tab",id:"test-tab-cmp","aria-controls":"test-tablpanel-cmp","aria-selected":"cmp"===ne,children:(0,v.jsxs)("label",{children:[(0,v.jsx)("input",{type:"radio",name:"test-tabs","aria-controls":"test-tabpanel-cmp",value:"cmp",checked:"cmp"===ne,onChange:function(){return ie("cmp")}}),"Compare File"]})}),(0,v.jsx)("div",{role:"tabpanel","aria-labelledby":"test-tab-cmp",id:"test-tabpanel-cmp",style:{position:"relative"},children:(0,v.jsx)(It,{value:I,onChange:M,grammar:ft.lA.parser,language:"cmp"})}),(0,v.jsx)("div",{role:"tab",id:"test-tab-out","aria-controls":"test-tabpanel-out","aria-selected":"out"===ne,children:(0,v.jsxs)("label",{children:[(0,v.jsx)("input",{type:"radio",name:"test-tabs","aria-controls":"test-tabpanel-out",value:"out",checked:"out"===ne,onChange:function(){return ie("out")}}),"Output File"]})}),(0,v.jsx)("div",{role:"tabpanel",id:"test-tabpanel-out","aria-labelledby":"test-tab-out",children:(0,v.jsx)(it.M,{cmp:I,out:R})})]})});return(0,v.jsxs)("div",{className:"ChipPage grid",children:[q,Q,oe]})},Gt=Jt}}]); +//# sourceMappingURL=605.b27434d9.chunk.js.map \ No newline at end of file diff --git a/web/build/static/js/605.b27434d9.chunk.js.map b/web/build/static/js/605.b27434d9.chunk.js.map new file mode 100644 index 000000000..30b324058 --- /dev/null +++ b/web/build/static/js/605.b27434d9.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/605.b27434d9.chunk.js","mappings":"qZAOaA,EAAe,SAAH,SACvBC,EAAC,EAADA,EACAC,EAAE,EAAFA,GACAC,EAAC,EAADA,EACAC,EAAG,EAAHA,IACAC,EAAI,EAAJA,KAAI,OAQJC,EAAAA,EAAAA,MAAAA,MAAAA,CAAAC,SAAAA,EACEC,EAAAA,EAAAA,KAAAA,OAAAA,CAAAD,SAAAA,SACAD,EAAAA,EAAAA,MAAAA,KAAAA,CAAAC,SAAAA,EACEC,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAAA,MAAU,KAACC,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,UAAKE,EAAAA,EAAAA,IAAIR,MACpBO,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAAA,OAAW,KAACC,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAoB,QAApBA,EAAKG,EAAAA,GAAAA,GAAYR,UAAG,QAAI,UACpCM,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAAA,MAAU,KAACC,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,UAAKE,EAAAA,EAAAA,IAAIN,MACpBK,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAAA,MAAU,KAACC,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,UAAKE,EAAAA,EAAAA,IAAIL,MACpBI,EAAAA,EAAAA,KAAAA,KAAAA,CAAAD,SAAKI,EAAAA,GAAMN,UAET,EC3BKO,EAAoB,SAAH,OAC5BC,EAAI,EAAJA,KACAC,EAAI,EAAJA,KAAI,OAKJR,EAAAA,EAAAA,MAAAA,MAAAA,CAAAC,SAAAA,CACGM,EAAI,MAAIE,EAAAA,EAAAA,IAAID,KACT,ECPFE,EAA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KpmB,IAAKA,WAMlC,OACE,iBAAK0D,UAAU,gBAAe,UAC3B6nB,EACAM,EACAK,KAGP,EAEA,K","sources":["../../components/src/chips/alu.tsx","../../components/src/chips/register.tsx","../../components/src/chips/keyboard.tsx","../../node_modules/@davidsouther/jiffies/lib/esm/dom/css/constants.js","../../node_modules/@davidsouther/jiffies/lib/esm/dom/css/core.js","../../node_modules/@davidsouther/jiffies/lib/esm/dom/css/border.js","../../node_modules/@davidsouther/jiffies/lib/esm/dom/css/sizing.js","../../node_modules/immer/src/utils/errors.ts","../../node_modules/immer/src/utils/common.ts","../../node_modules/immer/src/utils/plugins.ts","../../node_modules/immer/src/core/scope.ts","../../node_modules/immer/src/core/finalize.ts","../../node_modules/immer/src/core/proxy.ts","../../node_modules/immer/src/core/immerClass.ts","../../node_modules/immer/src/core/current.ts","../../node_modules/immer/src/immer.ts","../../node_modules/immer/src/utils/env.ts","../../components/src/react.ts","../../components/src/inline_edit.tsx","../../components/src/virtual_scroll.tsx","../../components/src/chips/memory.tsx","../../components/src/clockface.tsx","../../components/src/chips/screen.tsx","../../components/src/chips/visualizations.tsx","../../components/src/pinout.tsx","../../components/src/runbar.tsx","../../components/src/timer.tsx","../../simulator/src/timer.ts","shell/editor.tsx","../../node_modules/@davidsouther/jiffies/lib/esm/debounce.js","shell/panel.tsx","../../components/src/stores/chip.store.ts","pages/chip.tsx"],"sourcesContent":["import {\n COMMANDS,\n COMMANDS_OP,\n Flags,\n} from \"@nand2tetris/simulator/cpu/alu.js\";\nimport { bin } from \"@nand2tetris/simulator/util/twos.js\";\n\nexport const ALUComponent = ({\n A,\n op,\n D,\n out,\n flag,\n}: {\n A: number;\n op: COMMANDS_OP;\n D: number;\n out: number;\n flag: keyof typeof Flags;\n}) => (\n
\n ALU\n
\n
A
{bin(A)}
\n
op
{COMMANDS.op[op] ?? \"(??)\"}
\n
D
{bin(D)}
\n
=
{bin(out)}
\n
{Flags[flag as keyof typeof Flags]}
\n
\n
\n);\n","import { dec } from \"@nand2tetris/simulator/util/twos.js\";\n\nexport const RegisterComponent = ({\n name,\n bits,\n}: {\n name: string;\n bits: number;\n}) => (\n
\n {name}: {dec(bits)}\n
\n);\n","import { Keyboard as KeyboardChip } from \"@nand2tetris/simulator/chip/builtins/computer/computer.js\";\nimport { KeyboardEvent, useCallback, useState } from \"react\";\nimport { RegisterComponent } from \"./register.js\";\n\nconst KeyMap: Record = {\n // Delete: 127,\n Enter: 128,\n Backspace: 129,\n ArrowLeft: 130,\n ArrowUp: 131,\n ArrowRight: 132,\n ArrowDown: 133,\n Home: 134,\n End: 135,\n PageUp: 136,\n PageDown: 137,\n Insert: 138,\n Delete: 139,\n Escape: 140,\n F1: 141,\n F2: 142,\n F3: 143,\n F4: 144,\n F5: 145,\n F6: 146,\n F7: 147,\n F8: 148,\n F9: 149,\n F10: 150,\n F11: 151,\n F12: 152,\n};\n\nfunction keyPressToHackCharacter(keypress: KeyboardEvent): number {\n const mapping = KeyMap[keypress.key];\n if (mapping !== undefined) {\n return mapping;\n }\n if (keypress.key.length === 1) {\n const code = keypress.key.charCodeAt(0);\n if (code >= 32 && code <= 126) {\n return code;\n }\n }\n\n return 0;\n}\n\nexport const Keyboard = ({ keyboard }: { keyboard: KeyboardChip }) => {\n const [showPicker, setShowPicker] = useState(false);\n const [bits, setBits] = useState(keyboard.out().busVoltage);\n\n const setKey = useCallback(\n (event: KeyboardEvent) => {\n const key = keyPressToHackCharacter(event);\n if (key === 0) {\n return;\n }\n event.preventDefault();\n keyboard.setKey(key);\n setBits(keyboard.out().busVoltage);\n setShowPicker(false);\n },\n [keyboard, setShowPicker, setBits]\n );\n\n const changeKey = useCallback(() => {\n setShowPicker(true);\n }, []);\n\n return (\n
\n
\n \n
\n
\n {showPicker ? (\n e?.focus()} type=\"text\" onKeyDown={setKey} />\n ) : (\n \n )}\n
\n
\n );\n};\n","export const Sizes = {\n none: \"0px\",\n sm: \"0.125rem\",\n \"\": \"0.25rem\",\n md: \"0.375rem\",\n lg: \"0.5rem\",\n xl: \"0.75rem\",\n \"2xl\": \"1rem\",\n \"3xl\": \"1.5rem\",\n full: \"9999px\",\n};\nexport const Sides = {\n \"\": \"\",\n t: \"Top\",\n r: \"Right\",\n l: \"Left\",\n b: \"Bottom\",\n tl: \"TopLeft\",\n tr: \"TopRight\",\n bl: \"BottomLeft\",\n br: \"BottomRight\",\n};\nexport const Widths = {\n \"1/4\": \"25%\",\n \"1/2\": \"50%\",\n \"3/4\": \"75%\",\n full: \"100%\",\n};\n","import { Sides, Sizes } from \"./constants.js\";\nexport function isSide(v) {\n return Sides[v] !== undefined;\n}\nexport function isSize(v) {\n return Sizes[v] !== undefined;\n}\nexport function getSize(size) {\n return Sizes[size];\n}\nexport function getSide(side) {\n switch (side) {\n case \"t\":\n return [...getSide(\"tl\"), ...getSide(\"tr\")];\n case \"r\":\n return [...getSide(\"tr\"), ...getSide(\"br\")];\n case \"b\":\n return [...getSide(\"br\"), ...getSide(\"bl\")];\n case \"l\":\n return [...getSide(\"tl\"), ...getSide(\"bl\")];\n default:\n return [Sides[side]];\n }\n}\n","import { isSide, getSize, getSide } from \"./core.js\";\nexport function rounded(size = \"\", side = \"\") {\n if (isSide(size)) {\n side = size;\n size = \"\";\n }\n const sized = getSize(size);\n return getSide(side).reduce((prev, curr) => {\n if (curr === \"\") {\n prev.borderRadius = sized;\n }\n else {\n // @ts-ignore\n prev[`border${curr}Radius`] = sized;\n }\n return prev;\n }, {});\n}\nexport function border({ side = \"\", style = \"solid\", radius = \"\", width = 1, color = \"black\", }) {\n return {};\n}\nexport function inset(width, color1 = \"gray\", color2 = \"lightgray\") {\n return {\n ...border({ side: \"tl\", width, color: color1, radius: \"none\" }),\n ...border({ side: \"br\", width, color: color2, radius: \"none\" }),\n };\n}\n","import { Widths } from \"./constants.js\";\nexport function width(amount, block) {\n if (amount === undefined && Widths[block] !== undefined) {\n amount = block;\n }\n return {\n ...(block === \"inline\" ? { display: \"inline-block\" } : {}),\n width: Widths[amount] ?? \"0\",\n };\n}\n","const errors = {\n\t0: \"Illegal state\",\n\t1: \"Immer drafts cannot have computed properties\",\n\t2: \"This object has been frozen and should not be mutated\",\n\t3(data: any) {\n\t\treturn (\n\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\tdata\n\t\t)\n\t},\n\t4: \"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t5: \"Immer forbids circular references\",\n\t6: \"The first or second argument to `produce` must be a function\",\n\t7: \"The third argument to `produce` must be a function or undefined\",\n\t8: \"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t9: \"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t10: \"The given draft is already finalized\",\n\t11: \"Object.defineProperty() cannot be used on an Immer draft\",\n\t12: \"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t13: \"Immer only supports deleting array indices\",\n\t14: \"Immer only supports setting array indices and the 'length' property\",\n\t15(path: string) {\n\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t},\n\t16: 'Sets cannot have \"replace\" patches.',\n\t17(op: string) {\n\t\treturn \"Unsupported patch operation: \" + op\n\t},\n\t18(plugin: string) {\n\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t},\n\t20: \"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available\",\n\t21(thing: string) {\n\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t},\n\t22(thing: string) {\n\t\treturn `'current' expects a draft, got: ${thing}`\n\t},\n\t23(thing: string) {\n\t\treturn `'original' expects a draft, got: ${thing}`\n\t},\n\t24: \"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n} as const\n\nexport function die(error: keyof typeof errors, ...args: any[]): never {\n\tif (__DEV__) {\n\t\tconst e = errors[error]\n\t\tconst msg = !e\n\t\t\t? \"unknown error nr: \" + error\n\t\t\t: typeof e === \"function\"\n\t\t\t? e.apply(null, args as any)\n\t\t\t: e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}${\n\t\t\targs.length ? \" \" + args.map(s => `'${s}'`).join(\",\") : \"\"\n\t\t}. Find the full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\thasSet,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\thasMap,\n\tArchtype,\n\tdie\n} from \"../internal\"\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = Object.getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(23, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/*#__PURE__*/\nexport const ownKeys: (target: AnyObject) => PropertyKey[] =\n\ttypeof Reflect !== \"undefined\" && Reflect.ownKeys\n\t\t? Reflect.ownKeys\n\t\t: typeof Object.getOwnPropertySymbols !== \"undefined\"\n\t\t? obj =>\n\t\t\t\tObject.getOwnPropertyNames(obj).concat(\n\t\t\t\t\tObject.getOwnPropertySymbols(obj) as any\n\t\t\t\t)\n\t\t: /* istanbul ignore next */ Object.getOwnPropertyNames\n\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors ||\n\tfunction getOwnPropertyDescriptors(target: any) {\n\t\t// Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n\t\tconst res: any = {}\n\t\townKeys(target).forEach(key => {\n\t\t\tres[key] = Object.getOwnPropertyDescriptor(target, key)\n\t\t})\n\t\treturn res\n\t}\n\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void,\n\tenumerableOnly?: boolean\n): void\nexport function each(obj: any, iter: any, enumerableOnly = false) {\n\tif (getArchtype(obj) === Archtype.Object) {\n\t\t;(enumerableOnly ? Object.keys : ownKeys)(obj).forEach(key => {\n\t\t\tif (!enumerableOnly || typeof key !== \"symbol\") iter(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): Archtype {\n\t/* istanbul ignore next */\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_ > 3\n\t\t\t? state.type_ - 4 // cause Object and Array map back from 4 and 5\n\t\t\t: (state.type_ as any) // others are the same\n\t\t: Array.isArray(thing)\n\t\t? Archtype.Array\n\t\t: isMap(thing)\n\t\t? Archtype.Map\n\t\t: isSet(thing)\n\t\t? Archtype.Set\n\t\t: Archtype.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === Archtype.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === Archtype.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === Archtype.Map) thing.set(propOrOldValue, value)\n\telse if (t === Archtype.Set) {\n\t\tthing.delete(propOrOldValue)\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn hasMap && target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn hasSet && target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any) {\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\tconst descriptors = getOwnPropertyDescriptors(base)\n\tdelete descriptors[DRAFT_STATE as any]\n\tlet keys = ownKeys(descriptors)\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tconst key: any = keys[i]\n\t\tconst desc = descriptors[key]\n\t\tif (desc.writable === false) {\n\t\t\tdesc.writable = true\n\t\t\tdesc.configurable = true\n\t\t}\n\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t// with libraries that trap values, like mobx or vue\n\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\tif (desc.get || desc.set)\n\t\t\tdescriptors[key] = {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\tvalue: base[key]\n\t\t\t}\n\t}\n\treturn Object.create(Object.getPrototypeOf(base), descriptors)\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep) each(obj, (key, value) => freeze(value, true), true)\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\tif (obj == null || typeof obj !== \"object\") return true\n\t// See #600, IE dies on non-objects in Object.isFrozen\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tImmerScope,\n\tDrafted,\n\tAnyObject,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tProxyType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: Patch[]): T\n\t}\n\tES5?: {\n\t\twillFinalizeES5_(scope: ImmerScope, result: any, isReplaced: boolean): void\n\t\tcreateES5Proxy_(\n\t\t\tbase: T,\n\t\t\tparent?: ImmerState\n\t\t): Drafted\n\t\thasChanges_(state: ES5ArrayState | ES5ObjectState): boolean\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(18, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n\n/** ES5 Plugin */\n\ninterface ES5BaseState extends ImmerBaseState {\n\tassigned_: {[key: string]: any}\n\tparent_?: ImmerState\n\trevoked_: boolean\n}\n\nexport interface ES5ObjectState extends ES5BaseState {\n\ttype_: ProxyType.ES5Object\n\tdraft_: Drafted\n\tbase_: AnyObject\n\tcopy_: AnyObject | null\n}\n\nexport interface ES5ArrayState extends ES5BaseState {\n\ttype_: ProxyType.ES5Array\n\tdraft_: Drafted\n\tbase_: any\n\tcopy_: any\n}\n\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ProxyType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ProxyType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tProxyType,\n\tgetPlugin\n} from \"../internal\"\nimport {die} from \"../utils/errors\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\tif (__DEV__ && !currentScope) die(0)\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (\n\t\tstate.type_ === ProxyType.ProxyObject ||\n\t\tstate.type_ === ProxyType.ProxyArray\n\t)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tProxyType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen,\n\tshallowCopy\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (!scope.immer_.useProxies_)\n\t\tgetPlugin(\"ES5\").willFinalizeES5_(scope, result, isReplaced)\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(\n\t\t\tvalue,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path),\n\t\t\ttrue // See #590, don't recurse into non-enumerable of non drafted objects\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result =\n\t\t\t// For ES5, create a good copy from the draft first, with added keys and without deleted keys.\n\t\t\tstate.type_ === ProxyType.ES5Object || state.type_ === ProxyType.ES5Array\n\t\t\t\t? (state.copy_ = shallowCopy(state.draft_))\n\t\t\t\t: state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// Although the original test case doesn't seem valid anyway, so if this in the way we can turn the next line\n\t\t// back to each(result, ....)\n\t\teach(\n\t\t\tstate.type_ === ProxyType.Set ? new Set(result) : result,\n\t\t\t(key, childValue) =>\n\t\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath\n) {\n\tif (__DEV__ && childValue === targetObject) die(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ProxyType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\tif (!parentState || !parentState.scope_.parent_)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\tif (scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tProxyType\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ProxyType.ProxyObject\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ProxyType.ProxyArray\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ProxyType.ProxyArray : (ProxyType.ProxyObject as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(\n\t\t\t\tstate.scope_.immer_,\n\t\t\t\tvalue,\n\t\t\t\tstate\n\t\t\t))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\tstate.copy_![prop] === value &&\n\t\t\t// special case: NaN\n\t\t\ttypeof value !== \"number\" &&\n\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t(value !== undefined || prop in state.copy_)\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\t// @ts-ignore\n\t\tif (state.copy_) delete state.copy_[prop]\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ProxyType.ProxyArray || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn Object.getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (__DEV__ && isNaN(parseInt(prop as any))) die(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (__DEV__ && prop !== \"length\" && isNaN(parseInt(prop as any))) die(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = Object.getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = Object.getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {base_: any; copy_: any}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(state.base_)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\thasProxies,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport class Immer implements ProducersFns {\n\tuseProxies_: boolean = hasProxies\n\n\tautoFreeze_: boolean = true\n\n\tconstructor(config?: {useProxies?: boolean; autoFreeze?: boolean}) {\n\t\tif (typeof config?.useProxies === \"boolean\")\n\t\t\tthis.setUseProxies(config!.useProxies)\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(this, base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tif (typeof Promise !== \"undefined\" && result instanceof Promise) {\n\t\t\t\treturn result.then(\n\t\t\t\t\tresult => {\n\t\t\t\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\t\t\t\treturn processResult(result, scope)\n\t\t\t\t\t},\n\t\t\t\t\terror => {\n\t\t\t\t\t\trevokeScope(scope)\n\t\t\t\t\t\tthrow error\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(21, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (\n\t\tbase: any,\n\t\trecipe?: any,\n\t): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\n\t\tif (typeof Promise !== \"undefined\" && result instanceof Promise) {\n\t\t\treturn result.then(nextState => [nextState, patches!, inversePatches!])\n\t\t}\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(this, base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (__DEV__) {\n\t\t\tif (!state || !state.isManual_) die(9)\n\t\t\tif (state.finalized_) die(10)\n\t\t}\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n\t * always faster than using ES5 proxies.\n\t *\n\t * By default, feature detection is used, so calling this is rarely necessary.\n\t */\n\tsetUseProxies(value: boolean) {\n\t\tif (value && !hasProxies) {\n\t\t\tdie(20)\n\t\t}\n\t\tthis.useProxies_ = value\n\t}\n\n\tapplyPatches(base: T, patches: Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\timmer: Immer,\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: immer.useProxies_\n\t\t? createProxyProxy(value, parent)\n\t\t: getPlugin(\"ES5\").createES5Proxy_(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tget,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tArchtype,\n\tgetArchtype,\n\tgetPlugin\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(22, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tconst archType = getArchtype(value)\n\tif (state) {\n\t\tif (\n\t\t\t!state.modified_ &&\n\t\t\t(state.type_ < 4 || !getPlugin(\"ES5\").hasChanges_(state as any))\n\t\t)\n\t\t\treturn state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = copyHelper(value, archType)\n\t\tstate.finalized_ = false\n\t} else {\n\t\tcopy = copyHelper(value, archType)\n\t}\n\n\teach(copy, (key, childValue) => {\n\t\tif (state && get(state.base_, key) === childValue) return // no need to copy or search in something that didn't change\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\t// In the future, we might consider freezing here, based on the current settings\n\treturn archType === Archtype.Set ? new Set(copy) : copy\n}\n\nfunction copyHelper(value: any, archType: number): any {\n\t// creates a shallow copy, even if it is a map or set\n\tswitch (archType) {\n\t\tcase Archtype.Map:\n\t\t\treturn new Map(value)\n\t\tcase Archtype.Set:\n\t\t\t// Set will be cloned as array temporarily, so that we can replace individual items\n\t\t\treturn Array.from(value)\n\t}\n\treturn shallowCopy(value)\n}\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\nexport default produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n * always faster than using ES5 proxies.\n *\n * By default, feature detection is used, so calling this is rarely necessary.\n */\nexport const setUseProxies = immer.setUseProxies.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enableES5} from \"./plugins/es5\"\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\nexport {enableAllPlugins} from \"./plugins/all\"\n","// Should be no imports here!\n\n// Some things that should be evaluated before all else...\n\n// We only want to know if non-polyfilled symbols are available\nconst hasSymbol =\n\ttypeof Symbol !== \"undefined\" && typeof Symbol(\"x\") === \"symbol\"\nexport const hasMap = typeof Map !== \"undefined\"\nexport const hasSet = typeof Set !== \"undefined\"\nexport const hasProxies =\n\ttypeof Proxy !== \"undefined\" &&\n\ttypeof Proxy.revocable !== \"undefined\" &&\n\ttypeof Reflect !== \"undefined\"\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: Nothing = hasSymbol\n\t? Symbol.for(\"immer-nothing\")\n\t: ({[\"immer-nothing\"]: true} as any)\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = hasSymbol\n\t? Symbol.for(\"immer-draftable\")\n\t: (\"__$immer_draftable\" as any)\n\nexport const DRAFT_STATE: unique symbol = hasSymbol\n\t? Symbol.for(\"immer-state\")\n\t: (\"__$immer_state\" as any)\n\n// Even a polyfilled Symbol might provide Symbol.iterator\nexport const iteratorSymbol: typeof Symbol.iterator =\n\t(typeof Symbol != \"undefined\" && Symbol.iterator) || (\"@@iterator\" as any)\n\n/** Use a class type for `nothing` so its type is unique */\nexport class Nothing {\n\t// This lets us do `Exclude`\n\t// @ts-ignore\n\tprivate _!: unique symbol\n}\n","import produce from \"immer\";\nimport { Dispatch, useEffect, useReducer, useState } from \"react\";\n\nexport function useImmerReducer<\n T,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Reducers extends Record T | void>\n>(reducers: Reducers, initialState: T) {\n return useReducer(\n (\n state: T,\n command: {\n action: keyof Reducers;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload?: any;\n }\n ): T =>\n produce(state, (draft: T) => {\n reducers[command.action](draft, command.payload);\n }),\n initialState\n );\n}\n\nexport function useStateInitializer(init: T): [T, Dispatch] {\n const [state, setState] = useState(init);\n useEffect(() => {\n setState(init);\n }, [init]);\n return [state, setState];\n}\n","import { width } from \"@davidsouther/jiffies/lib/esm/dom/css/sizing.js\";\nimport { useCallback, useState } from \"react\";\nimport { useStateInitializer } from \"./react.js\";\n\nconst Mode = { VIEW: 0, EDIT: 1 };\n\nexport const InlineEdit = (props: {\n mode?: keyof typeof Mode;\n value: string;\n onChange: (value: string) => void;\n}) => {\n const [mode, setMode] = useState(props.mode ?? Mode.VIEW);\n const [value, setValue] = useStateInitializer(props.value);\n\n const render = () => {\n switch (mode) {\n case Mode.EDIT:\n return edit();\n case Mode.VIEW:\n return view();\n default:\n return ;\n }\n };\n\n const view = () => (\n {\n setMode(Mode.EDIT);\n }}\n >\n {value}\n \n );\n\n const doSelect = useCallback(\n (ref: HTMLInputElement | null) => ref?.select(),\n []\n );\n const doChange = useCallback(\n (target: HTMLInputElement) => {\n setMode(Mode.VIEW);\n setValue(target.value ?? \"\");\n props.onChange(target.value ?? \"\");\n },\n [props, setMode, setValue]\n );\n const edit = () => {\n const edit = (\n \n doChange(target)}\n onKeyPress={({ key, target }) => {\n if (key === \"Enter\") {\n doChange(target as HTMLInputElement);\n }\n }}\n type=\"text\"\n defaultValue={value}\n />\n \n );\n return edit;\n };\n\n return render();\n};\n\nexport default InlineEdit;\n","/* eslint-disable @typescript-eslint/ban-types */\nimport {\n Key,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n} from \"react\";\n\nexport interface VirtualScrollSettings {\n /**Minimum offset into the adapter. Default is 0. */\n minIndex: number;\n /** Maximum offset into the adapter. Default is Number.MAX_SAFE_INTEGER. */\n maxIndex: number;\n /** Initial index to start rendering from. Default is minIndex. */\n startIndex: number;\n /**\n * Number of items to render in visible area. Default is entire range from\n * minIndex to maxIndex.\n */\n count: number;\n /**\n * Maximum number of items to render on either side of the visible area.\n * Default is `count`.\n */\n tolerance: number;\n /** Height of each item, in pixels. Default is 20px. */\n itemHeight: number;\n}\n\nexport interface VirtualScrollDataAdapter {\n (offset: number, limit: number): Iterable;\n}\n\nexport function arrayAdapter(data: T[]): VirtualScrollDataAdapter {\n return (offset, limit) => data.slice(offset, offset + limit);\n}\n\nexport interface VirtualScrollProps {\n settings?: Partial;\n get: VirtualScrollDataAdapter;\n row: (t: T) => U;\n rowKey: (t: T) => Key;\n}\n\nexport function fillVirtualScrollSettings(\n settings: Partial\n): VirtualScrollSettings {\n const {\n minIndex = 0,\n maxIndex = Number.MAX_SAFE_INTEGER,\n startIndex = 0,\n itemHeight = 20,\n count = Math.max(maxIndex - minIndex, 1),\n tolerance = count,\n } = settings;\n\n return { minIndex, maxIndex, startIndex, itemHeight, count, tolerance };\n}\n\nexport function initialState(\n settings: VirtualScrollSettings,\n adapter: VirtualScrollDataAdapter\n): VirtualScrollState {\n // From Denis Hilt, https://blog.logrocket.com/virtual-scrolling-core-principles-and-basic-implementation-in-react/\n const { minIndex, maxIndex, startIndex, itemHeight, count, tolerance } =\n settings;\n const bufferedItems = count + 2 * tolerance;\n const itemsAbove = Math.max(0, startIndex - tolerance - minIndex);\n\n const viewportHeight = count * itemHeight;\n const totalHeight = Math.min(maxIndex - minIndex, 1) * itemHeight;\n const toleranceHeight = tolerance * itemHeight;\n const bufferHeight = viewportHeight + 2 * toleranceHeight;\n const topPaddingHeight = itemsAbove * itemHeight;\n const bottomPaddingHeight = totalHeight - (topPaddingHeight + bufferHeight);\n\n const state: VirtualScrollState = {\n scrollTop: 0,\n settings,\n viewportHeight,\n totalHeight,\n toleranceHeight,\n bufferedItems,\n topPaddingHeight,\n bottomPaddingHeight,\n data: [],\n };\n\n return {\n ...state,\n ...doScroll(topPaddingHeight + toleranceHeight, state, adapter),\n };\n}\n\nexport function getData(\n minIndex: number,\n maxIndex: number,\n offset: number,\n limit: number,\n get: VirtualScrollDataAdapter\n): T[] {\n const start = Math.max(0, minIndex, offset);\n const end = Math.min(maxIndex, offset + limit - 1);\n const data = get(start, end - start);\n return [...data];\n}\n\ninterface ScrollUpdate {\n scrollTop: number;\n topPaddingHeight: number;\n bottomPaddingHeight: number;\n data: T[];\n}\n\nexport function doScroll(\n scrollTop: number,\n state: VirtualScrollState,\n get: VirtualScrollDataAdapter\n): ScrollUpdate {\n const {\n totalHeight,\n toleranceHeight,\n bufferedItems,\n settings: { itemHeight, minIndex, maxIndex },\n } = state;\n const index =\n minIndex + Math.floor((scrollTop - toleranceHeight) / itemHeight);\n const data = getData(minIndex, maxIndex, index, bufferedItems, get);\n const topPaddingHeight = Math.max((index - minIndex) * itemHeight, 0);\n const bottomPaddingHeight = Math.max(\n totalHeight - (topPaddingHeight + data.length * itemHeight),\n 0\n );\n\n return { scrollTop, topPaddingHeight, bottomPaddingHeight, data };\n}\n\ninterface VirtualScrollState {\n settings: VirtualScrollSettings;\n scrollTop: number; // px\n bufferedItems: number; // count\n totalHeight: number; // px\n viewportHeight: number; // px\n topPaddingHeight: number; // px\n bottomPaddingHeight: number; // px\n toleranceHeight: number; // px\n data: T[];\n}\n\nconst scrollReducer =\n (get: VirtualScrollDataAdapter) =>\n (state: VirtualScrollState, scrollTop: number) => ({\n ...state,\n ...doScroll(scrollTop, state, get),\n });\n\nexport const VirtualScroll = (\n props: VirtualScrollProps & { className?: string }\n) => {\n const viewportRef = useRef(null);\n\n const { settings, startState, reducer } = useMemo(() => {\n const settings = fillVirtualScrollSettings(props.settings ?? {});\n const startState = initialState(settings, props.get);\n const reducer = scrollReducer(props.get);\n return { settings, reducer, startState };\n }, [props.settings, props.get]);\n\n const [state, dispatchScroll] = useReducer(reducer, startState);\n\n useEffect(() => {\n if (viewportRef.current !== null) {\n dispatchScroll(viewportRef.current.scrollTop);\n }\n }, [settings, props.row]);\n\n const initialScroll = useCallback(\n (div: HTMLDivElement | null) => {\n if (div) {\n div.scrollTop = viewportRef.current\n ? viewportRef.current.scrollTop\n : settings.startIndex * settings.itemHeight;\n }\n viewportRef.current = div;\n },\n [viewportRef, settings.startIndex, settings.itemHeight]\n );\n\n const rows = state.data.map((d) => (\n
\n {props.row(d)}\n
\n ));\n\n return (\n dispatchScroll((e.target as HTMLDivElement).scrollTop)}\n >\n
\n {rows}\n
\n
\n );\n};\n\nexport default VirtualScroll;\n","import { rounded } from \"@davidsouther/jiffies/lib/esm/dom/css/border.js\";\nimport { ReactNode, useCallback, useMemo, useState } from \"react\";\n\nimport {\n Format,\n FORMATS,\n Memory as MemoryChip,\n} from \"@nand2tetris/simulator/cpu/memory.js\";\nimport { asm } from \"@nand2tetris/simulator/util/asm.js\";\nimport { bin, dec, hex } from \"@nand2tetris/simulator/util/twos.js\";\nimport InlineEdit from \"../inline_edit.js\";\nimport VirtualScroll, { VirtualScrollSettings } from \"../virtual_scroll.js\";\n\nconst ITEM_HEIGHT = 34;\n\nexport const MemoryBlock = ({\n memory,\n jmp = { value: 0 },\n highlight = -1,\n editable = false,\n format = dec,\n onChange = () => undefined,\n}: {\n jmp?: { value: number };\n memory: MemoryChip;\n highlight?: number;\n editable?: boolean;\n format?: (v: number) => string;\n onChange?: (i: number, value: string, previous: number) => void;\n}) => {\n const settings = useMemo>(\n () => ({\n count: Math.min(memory.size, 20),\n maxIndex: memory.size,\n itemHeight: ITEM_HEIGHT,\n startIndex: jmp.value,\n }),\n [memory.size, jmp]\n );\n const get = useCallback(\n (offset: number, count: number) =>\n memory\n .range(offset, offset + count)\n .map((v, i) => [i + offset, v] as [number, number]),\n [memory]\n );\n const row = useCallback(\n ([i, v]: [number, number]) => (\n \n ),\n [format, editable, highlight, onChange]\n );\n\n return (\n \n settings={settings}\n get={get}\n row={row}\n rowKey={([i]) => i}\n />\n );\n};\n\nexport const MemoryCell = ({\n index,\n value,\n highlight = false,\n editable = false,\n onChange = () => undefined,\n}: {\n index: number;\n value: string;\n highlight?: boolean;\n editable?: boolean;\n onChange?: (i: number, value: string, previous: number) => void;\n}) => (\n
\n \n {hex(index)}\n \n \n {editable ? (\n \n onChange(index, newValue, Number(value))\n }\n />\n ) : (\n {value}\n )}\n \n
\n);\n\nexport const Memory = ({\n name = \"Memory\",\n highlight = -1,\n editable = true,\n memory,\n format = \"dec\",\n}: {\n name?: string;\n editable?: boolean;\n highlight?: number;\n memory: MemoryChip;\n format: Format;\n}) => {\n const [fmt, setFormat] = useState(format);\n const [jmp, setJmp] = useState(\"0\");\n const [goto, setGoto] = useState({ value: 0 });\n\n const jumpTo = () => {\n setGoto({ value: Number(jmp) });\n };\n\n // const { filePicker, fs } = useContext(AppContext);\n // const doLoad = useCallback(async () => {\n // try {\n // const file = await filePicker.select();\n // await memory.load(fs, file);\n // } catch (e) {\n // console.error(e);\n // }\n // }, [fs, filePicker, memory]);\n\n const doLoad = () => undefined;\n\n const doUpdate = useCallback(\n (i: number, v: string) => {\n memory.update(i, v, fmt ?? \"dec\");\n },\n [memory, fmt]\n );\n\n return (\n
\n
\n
{name}
\n
\n \n key === \"Enter\" && jumpTo()}\n onChange={({ target: { value } }) => setJmp(value ?? \"0\")}\n />\n \n {FORMATS.map((option) => (\n \n setFormat(option)}\n />\n {option}\n \n ))}\n
\n
\n doFormat(fmt, v)}\n onChange={doUpdate}\n />\n
\n );\n};\n\nexport default Memory;\n\nfunction doFormat(format: Format, v: number): string {\n switch (format) {\n case \"bin\":\n return bin(v);\n case \"hex\":\n return hex(v);\n case \"asm\":\n return asm(v);\n case \"dec\":\n default:\n return dec(v);\n }\n}\n","import { useEffect, useMemo, useState } from \"react\";\n\nimport { display } from \"@davidsouther/jiffies/lib/esm/display.js\";\nimport { Clock } from \"@nand2tetris/simulator/chip/clock.js\";\n\nexport function useClock(actions: {\n tick?: () => void;\n toggle?: () => void;\n reset?: () => void;\n}) {\n const clock = useMemo(() => Clock.get(), []);\n\n useEffect(() => {\n const subscription = clock.$.subscribe(() => {\n actions.tick?.();\n });\n return () => subscription.unsubscribe();\n }, [actions, clock.$]);\n\n return {\n toggle() {\n clock.tick();\n actions.toggle?.();\n },\n\n reset() {\n clock.reset();\n actions.reset?.();\n },\n };\n}\n\nexport function useClockFrame(frameFinished: () => void) {\n useEffect(() => {\n const subscription = Clock.get().frame$.subscribe(() => {\n frameFinished();\n });\n return () => subscription.unsubscribe();\n }, [frameFinished]);\n}\n\nexport function displayClock() {\n return display(Clock.get());\n}\n\nexport function useClockface() {\n const [clockface, setClockface] = useState(displayClock());\n\n useEffect(() => {\n const subscription = Clock.get().$.subscribe(() => {\n setClockface(displayClock());\n });\n return () => subscription.unsubscribe();\n }, []);\n\n return clockface;\n}\n\nexport const Clockface = () => {\n const clockface = useClockface();\n return {clockface};\n};\n","import { Memory } from \"@nand2tetris/simulator/cpu/memory.js\";\nimport { assertExists } from \"@davidsouther/jiffies/lib/esm/assert.js\";\nimport { useCallback, useRef } from \"react\";\nimport { useClockFrame } from \"../clockface.js\";\n\nconst WHITE = \"white\";\nconst BLACK = \"black\";\ntype COLOR = typeof WHITE | typeof BLACK;\n\nexport interface ScreenMemory {\n get(idx: number): number;\n}\n\nexport function reduceScreen(memory: Memory, offset = 0): ScreenMemory {\n return {\n get(idx: number): number {\n return memory.get(offset + idx);\n },\n };\n}\n\nfunction get(mem: ScreenMemory, x: number, y: number): COLOR {\n const byte = mem.get(32 * y + ((x / 16) | 0));\n const bit = byte & (1 << x % 16);\n return bit === 0 ? WHITE : BLACK;\n}\n\nfunction set(data: Uint8ClampedArray, x: number, y: number, value: COLOR) {\n const pixel = (y * 512 + x) * 4;\n const color = value === WHITE ? 255 : 0;\n data[pixel] = color;\n data[pixel + 1] = color;\n data[pixel + 2] = color;\n data[pixel + 3] = 255;\n}\n\nfunction drawImage(ctx: CanvasRenderingContext2D, memory: ScreenMemory) {\n const image = assertExists(\n ctx.getImageData(0, 0, 512, 256),\n \"Failed to create Context2d\"\n );\n for (let col = 0; col < 512; col++) {\n for (let row = 0; row < 256; row++) {\n const color = get(memory, col, row);\n set(image.data, col, row, color);\n }\n }\n ctx.putImageData(image, 0, 0);\n}\n\nexport const Screen = ({ memory }: { memory: ScreenMemory }) => {\n const canvas = useRef();\n\n const draw = useCallback(() => {\n const ctx = canvas.current?.getContext(\"2d\") ?? undefined;\n\n if (ctx) {\n drawImage(ctx, memory);\n }\n }, [memory]);\n\n const ctxRef = useCallback(\n (ref: HTMLCanvasElement | null) => {\n canvas.current = ref ?? undefined;\n draw();\n },\n [canvas, draw]\n );\n\n useClockFrame(draw);\n\n return (\n
\n
Screen
\n
\n \n \n \n
\n
\n );\n};\n","import {\n Keyboard,\n Screen,\n} from \"@nand2tetris/simulator/chip/builtins/computer/computer.js\";\nimport { ALU } from \"@nand2tetris/simulator/chip/builtins/index.js\";\nimport {\n PC,\n VRegister,\n} from \"@nand2tetris/simulator/chip/builtins/sequential/bit.js\";\nimport {\n RAM,\n RAM8,\n} from \"@nand2tetris/simulator/chip/builtins/sequential/ram.js\";\nimport { Chip, HIGH } from \"@nand2tetris/simulator/chip/chip.js\";\nimport { Flags } from \"@nand2tetris/simulator/cpu/alu.js\";\nimport { CPU, decode } from \"@nand2tetris/simulator/cpu/cpu.js\";\nimport { ReactElement } from \"react\";\nimport { ALUComponent } from \"./alu.js\";\nimport { Keyboard as KeyboardComponent } from \"./keyboard.js\";\nimport { Memory as MemoryComponent } from \"./memory.js\";\nimport { RegisterComponent } from \"./register.js\";\nimport { Screen as ScreenComponent } from \"./screen.js\";\n\nexport function getBuiltinVisualization(part: Chip): ReactElement | undefined {\n switch (part.name) {\n case \"Register\":\n case \"ARegister\":\n case \"DRegister\":\n case \"PC\":\n case \"KEYBOARD\":\n case \"RAM8\":\n case \"RAM64\":\n case \"RAM512\":\n case \"RAM4K\":\n case \"RAM16K\":\n case \"ROM32K\":\n case \"Screen\":\n case \"Memory\":\n default:\n return undefined;\n }\n}\n\nexport function makeVisualization(chip: Chip): ReactElement | undefined {\n if (chip instanceof ALU) {\n return (\n \n );\n }\n if (chip instanceof VRegister) {\n return (\n \n );\n }\n if (chip instanceof PC) {\n return ;\n }\n if (chip instanceof Keyboard) {\n return ;\n }\n if (chip instanceof Screen) {\n return ;\n }\n if (chip instanceof RAM) {\n return (\n \n );\n }\n if (chip instanceof RAM8) {\n return RAM {chip.width};\n }\n if (chip instanceof CPU) {\n const bits = decode(chip.in(\"instruction\").busVoltage);\n return (\n <>\n \n \n \n \n \n );\n }\n\n const vis = [...chip.parts]\n .map(makeVisualization)\n .filter((v) => v !== undefined);\n return vis.length > 0 ? <>{vis} : undefined;\n}\n\nexport function makeVisualizationsWithId(chip: {\n parts: Chip[];\n}): [string, ReactElement][] {\n return [...chip.parts]\n .map((part, i): [string, ReactElement | undefined] => [\n `${part.id}_${i}`,\n makeVisualization(part),\n ])\n .filter(([_, v]) => v !== undefined) as [string, ReactElement][];\n}\n","// import { plural, Trans } from \"@lingui/macro\";\nimport {\n Pin as ChipPin,\n Pins,\n Voltage,\n} from \"@nand2tetris/simulator/chip/chip.js\";\nimport { range } from \"@davidsouther/jiffies/lib/esm/range.js\";\nimport { ChipSim } from \"./stores/chip.store.js\";\n\nexport interface ImmPin {\n bits: [number, Voltage][];\n pin: ChipPin;\n}\n\nexport function reducePin(pin: ChipPin) {\n return {\n pin,\n bits: range(0, pin.width)\n .map((i) => [i, pin.voltage(i)] as [number, Voltage])\n .reverse(),\n };\n}\n\nexport function reducePins(pins: Pins): ImmPin[] {\n return [...pins.entries()].map(reducePin);\n}\n\nexport interface PinoutPins {\n pins: ImmPin[];\n toggle?: (pin: ChipPin, bit?: number) => void;\n}\n\nexport const FullPinout = (props: {\n sim: ChipSim;\n toggle: (pin: ChipPin, i: number | undefined) => void;\n}) => {\n const { inPins, outPins, internalPins } = props.sim;\n return (\n <>\n \n \n \n \n \n \n \n
\n \n );\n};\n\nexport const PinoutBlock = (\n props: PinoutPins & { header: string; disabled?: boolean }\n) => (\n <>\n {props.pins.length > 0 && (\n \n {props.header}\n \n )}\n {[...props.pins].map((immPin) => (\n \n {immPin.pin.name}\n \n \n \n \n ))}\n \n);\n\nexport const Pinout = ({\n pins,\n toggle,\n}: {\n pins: ImmPin[];\n toggle?: (pin: ChipPin, bit?: number) => void;\n}) => {\n if (pins.length === 0) {\n return <>None;\n }\n return (\n \n \n \n \n \n \n \n \n {[...pins].map((immPin) => (\n \n \n \n \n ))}\n \n
NameValue
{immPin.pin.name}\n \n
\n );\n};\n\nconst Pin = ({\n pin,\n toggle,\n disabled = false,\n}: {\n pin: ImmPin;\n toggle: ((pin: ChipPin, bit?: number) => void) | undefined;\n disabled?: boolean;\n}) => {\n return (\n
\n {pin.bits.map(([i, v]) => (\n toggle?.(pin.pin, i)}\n disabled={disabled}\n data-testid={`pin-${i}`}\n >\n {v}\n \n ))}\n
\n );\n};\n","import { ReactNode } from \"react\";\nimport { Timer } from \"@nand2tetris/simulator/timer.js\";\nimport { useTimer } from \"./timer.js\";\n\nexport const Runbar = (props: { runner: Timer; children?: ReactNode }) => {\n const runner = useTimer(props.runner);\n return (\n
\n runner.actions.frame()}\n data-tooltip={`Step`}\n data-placement=\"bottom\"\n >\n {/* */}\n ➡️\n \n \n runner.state.running ? runner.actions.stop() : runner.actions.start()\n }\n data-tooltip={runner.state.running ? `Pause` : `Play`}\n data-placement=\"bottom\"\n >\n {/* */}\n {runner.state.running ? \"⏸\" : \"️⏩\"}\n \n runner.actions.reset()}\n data-tooltip={`Reset`}\n data-placement=\"bottom\"\n >\n {/* */}⏮\n \n {\n runner.dispatch({\n action: \"setSpeed\",\n payload: Number(e.target?.value ?? runner.state.speed),\n });\n }}\n disabled={runner.state.running}\n >\n {[\n // [2000, `Debug`], // For debugging, basically the same as clicking through\n [1000, `Slow`],\n [500, `Fast`],\n [16, `Faster`],\n ].map(([speed, label]) => (\n \n ))}\n \n {\n runner.dispatch({\n action: \"setSteps\",\n payload: Number(e.target?.value ?? runner.state.steps),\n });\n }}\n disabled={runner.state.running}\n >\n {[\n [1, `1 Step`],\n [500, \"500\"],\n [1000, \"1000\"],\n [2000, \"2000\"],\n ].map(([steps, label]) => (\n \n ))}\n \n {props.children}\n
\n );\n};\n","import { Timer } from \"@nand2tetris/simulator/timer.js\";\nimport { useImmerReducer } from \"./react.js\";\n\nexport interface TimerStoreState {\n steps: number;\n speed: number;\n running: boolean;\n}\n\nimport { Dispatch, MutableRefObject, useMemo, useRef } from \"react\";\nexport type TimerStoreDispatch = Dispatch<{\n action: keyof ReturnType[\"reducers\"];\n payload?: unknown;\n}>;\n\nconst makeTimerStore = (\n timer: Timer,\n dispatch: MutableRefObject\n) => {\n const initialState: TimerStoreState = {\n running: timer.running,\n speed: timer.speed,\n steps: timer.steps,\n };\n\n const finishFrame = timer.finishFrame.bind(timer);\n timer.finishFrame = function () {\n finishFrame();\n dispatch.current({ action: \"update\" });\n };\n\n const reducers = {\n update(state: TimerStoreState) {\n state.running = timer.running;\n state.speed = timer.speed;\n state.steps = timer.steps;\n },\n setSteps(state: TimerStoreState, steps: number) {\n state.steps = steps;\n timer.steps = steps;\n },\n setSpeed(state: TimerStoreState, speed: number) {\n state.speed = speed;\n timer.speed = speed;\n },\n };\n\n const actions = {\n frame() {\n timer.frame();\n },\n start() {\n timer.start();\n dispatch.current({ action: \"update\" });\n },\n stop() {\n timer.stop();\n dispatch.current({ action: \"update\" });\n },\n reset() {\n timer.reset();\n dispatch.current({ action: \"update\" });\n },\n };\n\n return { initialState, reducers, actions };\n};\n\nexport function useTimer(timer: Timer) {\n const dispatch = useRef(() => undefined);\n\n const { initialState, reducers, actions } = useMemo(\n () => makeTimerStore(timer, dispatch),\n [timer, dispatch]\n );\n\n const [state, dispatcher] = useImmerReducer(reducers, initialState);\n\n dispatch.current = dispatcher;\n\n return { state, dispatch: dispatch.current, actions };\n}\n","import { Clock } from \"./chip/clock.js\";\n\nexport const MAX_STEPS = 1000;\n\nconst clock = Clock.get();\n\nexport abstract class Timer {\n frame() {\n this.tick();\n this.finishFrame();\n }\n\n abstract tick(): Promise | boolean;\n\n finishFrame() {\n clock.frame();\n }\n\n abstract reset(): void;\n\n abstract toggle(): void;\n\n steps = 1; // How many steps to take per update\n speed = 1000; // how often to update, in ms\n get running() {\n return this.#running;\n }\n\n #running = false;\n #sinceLastFrame = 0;\n #lastUpdate = 0;\n #run = async () => {\n if (!this.#running) {\n return;\n }\n const now = Date.now();\n const delta = now - this.#lastUpdate;\n this.#lastUpdate = now;\n this.#sinceLastFrame += delta;\n if (this.#sinceLastFrame > this.speed) {\n let done = false;\n for (let i = 0; i < Math.min(this.steps, MAX_STEPS) && !done; i++) {\n done = await this.tick();\n }\n this.finishFrame();\n if (done) {\n this.stop();\n }\n this.#sinceLastFrame -= this.speed;\n }\n requestAnimationFrame(this.#run);\n };\n\n start() {\n this.#running = true;\n this.#lastUpdate = Date.now() - this.speed;\n this.#run();\n this.toggle();\n }\n\n stop() {\n this.#running = false;\n this.toggle();\n }\n}\n","import { debounce } from \"@davidsouther/jiffies/lib/esm/debounce\";\nimport { Trans } from \"@lingui/macro\";\nimport MonacoEditor, { useMonaco } from \"@monaco-editor/react\";\nimport type * as monacoT from \"monaco-editor/esm/vs/editor/editor.api\";\nimport { OnMount } from \"@monaco-editor/react\";\nimport ohm from \"ohm-js\";\nimport {\n CSSProperties,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { AppContext } from \"../App.context\";\n\nimport {\n Span,\n UNKNOWN_PARSE_ERROR,\n} from \"@nand2tetris/simulator/languages/base.js\";\n\nimport \"./editor.scss\";\n\nexport const ErrorPanel = ({ error }: { error?: ohm.MatchResult }) => {\n return error?.failed() ? (\n
\n \n Parse Error\n \n
\n        \n          {error?.message ?? error?.shortMessage ?? UNKNOWN_PARSE_ERROR}\n        \n      
\n
\n ) : (\n <>\n );\n};\n\nconst Textarea = ({\n value,\n onChange,\n language,\n disabled = false,\n}: {\n value: string;\n onChange: (value: string) => void;\n language: string;\n disabled?: boolean;\n}) => {\n const [text, setText] = useState(value);\n return (\n {\n const value = e.target?.value;\n setText(value);\n onChange(value);\n }}\n />\n );\n};\n\nconst MONACO_LIGHT_THEME = \"vs\";\nconst MONACO_DARK_THEME = \"vs-dark\";\n\nconst makeHighlight = (\n monaco: typeof monacoT | null,\n editor: monacoT.editor.IStandaloneCodeEditor | undefined,\n highlight: Span | undefined,\n decorations: string[]\n): string[] => {\n if (!(editor && highlight)) return decorations;\n const model = editor.getModel();\n if (!model) return decorations;\n const start = model.getPositionAt(highlight.start);\n const end = model.getPositionAt(highlight.end);\n const range = monaco?.Range.fromPositions(start, end);\n const nextDecoration: monacoT.editor.IModelDeltaDecoration[] = [];\n if (range) {\n nextDecoration.push({\n range,\n options: { inlineClassName: \"highlight\" },\n });\n editor.revealRangeInCenter(range);\n }\n return editor.deltaDecorations(decorations, nextDecoration);\n};\n\nconst Monaco = ({\n value,\n onChange,\n language,\n error,\n disabled = false,\n highlight: currentHighlight,\n}: {\n value: string;\n onChange: (value: string) => void;\n language: string;\n error?: ohm.MatchResult | undefined;\n disabled?: boolean;\n highlight?: Span;\n}) => {\n const { theme } = useContext(AppContext);\n const monaco = useMonaco();\n\n const editor = useRef();\n const decorations = useRef([]);\n const highlight = useRef(undefined);\n\n const codeTheme = useCallback(() => {\n const isDark =\n theme === \"system\"\n ? window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n : theme === \"dark\";\n return isDark ? MONACO_DARK_THEME : MONACO_LIGHT_THEME;\n }, [theme]);\n\n const doHighlight = useCallback(() => {\n decorations.current = makeHighlight(\n monaco,\n editor.current,\n // I'm not sure why this makes things work, but it is load bearing.\n // Removing the empty span will cause the initial first-statement\n // highlight in the test view to not show. Setting it to [0, 1] will\n // cause a 1-character highlight in the editor view, so don't do that\n // either.\n highlight.current ?? { start: 0, end: 0 },\n decorations.current\n );\n }, [decorations, monaco, editor, highlight]);\n\n // Mark and center highlighted spans\n useEffect(() => {\n highlight.current = currentHighlight;\n doHighlight();\n }, [currentHighlight]);\n\n // Set options when mounting\n const onMount: OnMount = useCallback(\n (ed) => {\n editor.current = ed;\n editor.current?.updateOptions({\n fontFamily: `\"JetBrains Mono\", source-code-pro, Menlo, Monaco,\n Consolas, \"Roboto Mono\", \"Ubuntu Monospace\", \"Noto Mono\", \"Oxygen Mono\",\n \"Liberation Mono\", monospace, \"Apple Color Emoji\", \"Segoe UI Emoji\",\n \"Segoe UI Symbol\", \"Noto Color Emoji\"`,\n fontSize: 16,\n minimap: {\n enabled: false,\n },\n theme: codeTheme(),\n scrollBeyondLastLine: false,\n });\n doHighlight();\n },\n [codeTheme]\n );\n\n // Set themes\n useEffect(() => {\n if (editor.current === undefined) return;\n editor.current.updateOptions({ theme: codeTheme() });\n }, [editor, codeTheme]);\n\n // Prevent editing disabled editors\n useEffect(() => {\n if (editor.current === undefined) return;\n editor.current.updateOptions({ readOnly: disabled });\n }, [editor, disabled]);\n\n // Add error markers on parse failure\n useEffect(() => {\n if (editor.current === undefined) return;\n if (monaco === null) return;\n const model = editor.current.getModel();\n if (model === null) return;\n if (error === undefined || error.succeeded()) {\n monaco.editor.setModelMarkers(model, language, []);\n return;\n }\n // Line 7, col 5:\n const { line, column, message } =\n /Line (?\\d+), col (?\\d+): (?.*)/.exec(\n error.shortMessage ?? \"\"\n )?.groups ?? { line: 1, column: 1, message: \"could not parse error\" };\n const startLineNumber = Number(line);\n const endLineNumber = startLineNumber;\n const startColumn = Number(column);\n const restOfLine = model\n .getLineContent(startLineNumber)\n .substring(startColumn - 1);\n let endColumn =\n startColumn + (restOfLine.match(/([^\\s]+)/)?.[0].length ?? 1);\n if (endColumn <= startColumn) {\n endColumn = startColumn + 1;\n }\n\n monaco.editor.setModelMarkers(model, language, [\n {\n message,\n startColumn,\n startLineNumber,\n endColumn,\n endLineNumber,\n severity: 8, // monacoT.MarkerSeverity.Error,\n },\n ]);\n }, [error, editor, monaco, language]);\n\n return (\n <>\n onChange(v)}\n language={language}\n onMount={onMount}\n />\n \n );\n};\n\nexport const Editor = ({\n className = \"\",\n style = {},\n disabled = false,\n value,\n onChange,\n grammar,\n language,\n highlight,\n}: {\n className?: string;\n style?: CSSProperties;\n disabled?: boolean;\n value: string;\n onChange: (source: string) => void;\n grammar: ohm.Grammar;\n language: string;\n highlight?: Span;\n}) => {\n const [error, setError] = useState();\n const { monaco } = useContext(AppContext);\n\n const parse = useCallback(\n (text = \"\") => {\n const parsed = grammar.match(text);\n setError(parsed.failed() ? parsed : undefined);\n },\n [setError, grammar]\n );\n\n useEffect(() => parse(value), [parse, value]);\n const doParse = useMemo(() => debounce(parse, 500), [parse]);\n\n const onChangeCB = useCallback(\n (text = \"\") => {\n onChange(text);\n doParse(text);\n },\n [doParse, onChange]\n );\n\n return (\n
\n {monaco.canUse && monaco.wants ? (\n \n ) : (\n <>\n \n \n \n )}\n
\n );\n};\n","export function debounce(fn, ms = 32) {\n let timer;\n return (...args) => {\n clearTimeout(timer);\n timer = setTimeout(() => (clearTimeout(timer), fn(...args)), ms);\n return timer;\n };\n}\n","import { CSSProperties, ReactNode } from \"react\";\n\nexport const Panel = (props: {\n children: ReactNode;\n header?: ReactNode;\n footer?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}) => {\n return (\n
\n {props.header &&
{props.header}
}\n
{props.children}
\n {props.footer &&
{props.footer}
}\n
\n );\n};\n\nexport const Accordian = (props: {\n children: ReactNode;\n summary: ReactNode;\n className?: string;\n style?: CSSProperties;\n open?: boolean;\n}) => {\n return (\n \n \n
{props.summary}
\n
\n {props.children}\n \n );\n};\n","import { display } from \"@davidsouther/jiffies/lib/esm/display.js\";\nimport { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\nimport { Err, isErr, Ok } from \"@davidsouther/jiffies/lib/esm/result.js\";\nimport { Dispatch, MutableRefObject, useContext, useMemo, useRef } from \"react\";\n\nimport { build as buildChip } from \"@nand2tetris/simulator/chip/builder.js\";\nimport {\n getBuiltinChip,\n REGISTRY,\n} from \"@nand2tetris/simulator/chip/builtins/index.js\";\nimport {\n Chip,\n Chip as SimChip,\n Low,\n Pin,\n} from \"@nand2tetris/simulator/chip/chip.js\";\nimport { Clock } from \"@nand2tetris/simulator/chip/clock.js\";\nimport { Span } from \"@nand2tetris/simulator/languages/base.js\";\nimport { HDL } from \"@nand2tetris/simulator/languages/hdl.js\";\nimport { TST } from \"@nand2tetris/simulator/languages/tst.js\";\nimport { ChipProjects, CHIP_PROJECTS } from \"@nand2tetris/projects/index.js\";\nimport { ChipTest } from \"@nand2tetris/simulator/tst.js\";\n\nimport { ImmPin, reducePins } from \"../pinout.js\";\nimport { useImmerReducer } from \"../react.js\";\n\nimport { BaseContext } from \"./base.context.js\";\nimport { assert } from \"@davidsouther/jiffies/lib/esm/assert.js\";\n\nexport const PROJECT_NAMES = [\n [\"01\", `Project 1`],\n [\"02\", `Project 2`],\n [\"03\", `Project 3`],\n [\"05\", `Project 5`],\n];\n\nfunction findDropdowns(storage: Record) {\n const project =\n (storage[\"/chip/project\"] as keyof typeof CHIP_PROJECTS) ?? \"01\";\n const chips = CHIP_PROJECTS[project];\n const chipName = storage[\"/chip/chip\"] ?? chips[0];\n return { project, chips, chipName };\n}\n\nfunction makeHdl(name: string) {\n return `CHIP ${name} {\n IN in;\n OUT out;\n PARTS:\n}`;\n}\n\nfunction makeTst() {\n return `repeat 10 {\n tick,\n tock;\n}`;\n}\n\nfunction makeCmp() {\n return `| in|out|`;\n}\n\nexport interface ChipPageState {\n files: Files;\n sim: ChipSim;\n controls: ControlsState;\n}\n\nexport interface ChipSim {\n clocked: boolean;\n inPins: ImmPin[];\n outPins: ImmPin[];\n internalPins: ImmPin[];\n chip: [Chip];\n pending: boolean;\n invalid: boolean;\n}\n\nexport interface Files {\n hdl: string;\n cmp: string;\n tst: string;\n out: string;\n}\n\nexport interface ControlsState {\n project: keyof typeof CHIP_PROJECTS;\n chips: string[];\n chipName: string;\n hasBuiltin: boolean;\n runningTest: boolean;\n span?: Span;\n error: string;\n}\n\nfunction reduceChip(chip: SimChip, pending = false, invalid = false): ChipSim {\n return {\n clocked: chip.clocked,\n inPins: reducePins(chip.ins),\n outPins: reducePins(chip.outs),\n internalPins: reducePins(chip.pins),\n chip: [chip],\n pending,\n invalid,\n };\n}\n\nconst clock = Clock.get();\n\nexport type ChipStoreDispatch = Dispatch<{\n action: keyof ReturnType[\"reducers\"];\n payload?: unknown;\n}>;\n\nexport function makeChipStore(\n fs: FileSystem,\n setStatus: (status: string) => void,\n storage: Record,\n dispatch: MutableRefObject\n) {\n const dropdowns = findDropdowns(storage);\n let { project, chipName } = dropdowns;\n const { chips } = dropdowns;\n let chip = new Low();\n let test = new ChipTest();\n let usingBuiltin = false;\n\n const reducers = {\n setFiles(\n state: ChipPageState,\n {\n hdl = state.files.hdl,\n tst = state.files.tst,\n cmp = state.files.cmp,\n out = \"\",\n }: {\n hdl?: string;\n tst?: string;\n cmp?: string;\n out?: string;\n }\n ) {\n state.files.hdl = hdl;\n state.files.tst = tst;\n state.files.cmp = cmp;\n state.files.out = out;\n },\n\n updateChip(\n state: ChipPageState,\n payload?: {\n pending?: boolean;\n invalid?: boolean;\n chipName?: string;\n error?: string;\n }\n ) {\n state.sim = reduceChip(\n chip,\n payload?.pending ?? state.sim.pending,\n payload?.invalid ?? state.sim.invalid\n );\n state.controls.error = state.sim.invalid\n ? payload?.error ?? state.controls.error\n : \"\";\n state.controls.chips = CHIP_PROJECTS[state.controls.project];\n state.controls.chipName = state.sim.invalid\n ? payload?.chipName ?? chipName\n : chip.name ?? payload?.chipName ?? chipName;\n if (!state.controls.chips.includes(state.controls.chipName)) {\n state.controls.chips = [\n ...state.controls.chips,\n state.controls.chipName,\n ];\n }\n },\n\n setProject(state: ChipPageState, project: keyof typeof CHIP_PROJECTS) {\n const chips = CHIP_PROJECTS[project];\n const chipName =\n state.controls.chipName && chips.includes(state.controls.chipName)\n ? state.controls.chipName\n : chips[0];\n state.controls.project = project;\n state.controls.chips = chips;\n this.setChip(state, chipName);\n },\n\n setChip(state: ChipPageState, chipName: string) {\n state.controls.chipName = chipName;\n state.controls.hasBuiltin = REGISTRY.has(chipName);\n },\n\n testRunning(state: ChipPageState) {\n state.controls.runningTest = true;\n },\n\n testFinished(state: ChipPageState) {\n state.controls.runningTest = false;\n const passed = state.files.out.trim() === state.files.cmp.trim();\n setStatus(\n passed\n ? `Simulation successful: The output file is identical to the compare file`\n : `Simulation error: The output file differs from the compare file`\n );\n },\n\n updateTestStep(state: ChipPageState) {\n state.files.out = test?.log() ?? \"\";\n if (test?.currentStep?.span) {\n state.controls.span = test.currentStep.span;\n } else {\n if (test.done) {\n const end = state.files.tst.length;\n state.controls.span = {\n start: end - 1,\n end,\n };\n }\n }\n this.updateChip(state, {\n pending: state.sim.pending,\n invalid: state.sim.invalid,\n });\n },\n };\n\n const actions = {\n setProject(p: keyof typeof CHIP_PROJECTS) {\n project = storage[\"/chip/project\"] = p;\n dispatch.current({ action: \"setProject\", payload: project });\n this.setChip(CHIP_PROJECTS[project][0]);\n },\n\n async setChip(\n chip: string,\n project = storage[\"/chip/project\"] ?? ChipProjects[\"01\"]\n ) {\n chipName = storage[\"/chip/chip\"] = chip;\n dispatch.current({ action: \"setChip\", payload: chipName });\n await this.loadChip(project, chipName);\n if (usingBuiltin) {\n this.useBuiltin();\n }\n },\n\n reset() {\n Clock.get().reset();\n chip.reset();\n test.reset();\n dispatch.current({ action: \"setFiles\", payload: {} });\n dispatch.current({ action: \"updateChip\" });\n },\n\n async updateFiles({\n hdl,\n tst,\n cmp,\n }: {\n hdl?: string;\n tst?: string;\n cmp: string;\n }) {\n dispatch.current({ action: \"setFiles\", payload: { hdl, tst, cmp } });\n try {\n if (hdl) {\n await this.compileChip(hdl);\n }\n if (tst) {\n this.compileTest(tst);\n }\n } catch (e) {\n setStatus(display(e));\n }\n },\n\n async compileChip(hdl: string) {\n chip.remove();\n const maybeParsed = HDL.parse(hdl);\n if (isErr(maybeParsed)) {\n setStatus(\"Failed to parse chip\");\n dispatch.current({\n action: \"updateChip\",\n payload: { invalid: true, error: display(Err(maybeParsed)) },\n });\n return;\n }\n const maybeChip = await buildChip(Ok(maybeParsed));\n if (isErr(maybeChip)) {\n const error = display(Err(maybeChip));\n setStatus(error);\n dispatch.current({\n action: \"updateChip\",\n payload: { invalid: true, error },\n });\n return;\n }\n setStatus(`Compiled ${chip.name}`);\n this.replaceChip(Ok(maybeChip));\n },\n\n replaceChip(nextChip: SimChip) {\n // Store current inPins\n const inPins = chip.ins;\n for (const [pin, { busVoltage }] of inPins) {\n const nextPin = nextChip.ins.get(pin);\n if (nextPin) {\n nextPin.busVoltage = busVoltage;\n }\n }\n clock.reset();\n nextChip.eval();\n chip = nextChip;\n test = test.with(chip).reset();\n dispatch.current({ action: \"updateChip\", payload: { invalid: false } });\n dispatch.current({ action: \"updateTestStep\" });\n },\n\n async loadChip(project: string, name: string) {\n storage[\"/chip/chip\"] = name;\n const fsName = (ext: string) =>\n `/projects/${project}/${name}/${name}.${ext}`;\n\n const [hdl, tst, cmp] = await Promise.all([\n fs.readFile(fsName(\"hdl\")).catch(() => makeHdl(name)),\n fs.readFile(fsName(\"tst\")).catch((e) => {\n console.log(e);\n return makeTst();\n }),\n fs.readFile(fsName(\"cmp\")).catch(() => makeCmp()),\n ]);\n\n dispatch.current({ action: \"setFiles\", payload: { hdl, tst, cmp } });\n await this.compileChip(hdl);\n this.compileTest(tst);\n },\n\n async saveChip(hdl: string, prj = project, name = chipName) {\n dispatch.current({ action: \"setFiles\", payload: { hdl } });\n const path = `/projects/${prj}/${name}/${name}.hdl`;\n await fs.writeFile(path, hdl);\n setStatus(`Saved ${path}`);\n },\n\n toggle(pin: Pin, i: number | undefined) {\n if (i !== undefined) {\n pin.busVoltage = pin.busVoltage ^ (1 << i);\n } else {\n if (pin.width === 1) {\n pin.toggle();\n } else {\n pin.busVoltage += 1;\n }\n }\n dispatch.current({ action: \"updateChip\", payload: { pending: true } });\n },\n\n eval() {\n chip.eval();\n dispatch.current({ action: \"updateChip\", payload: { pending: false } });\n },\n\n clock() {\n clock.toggle();\n if (clock.isLow) {\n clock.frame();\n }\n dispatch.current({ action: \"updateChip\" });\n },\n\n async useBuiltin(doUseBuiltin = true, hdl?: string) {\n if (!doUseBuiltin) {\n usingBuiltin = false;\n await this.loadChip(project, chipName);\n return;\n }\n usingBuiltin = true;\n const builtinName = chip.name ?? chipName;\n const nextChip = getBuiltinChip(builtinName);\n if (isErr(nextChip)) {\n setStatus(\n `Failed to load builtin ${builtinName}: ${display(Err(nextChip))}`\n );\n return;\n }\n\n // Save hdl code that will be overwritten by the switch\n if (hdl) {\n await this.saveChip(hdl, project, chipName);\n }\n\n const template = (ChipProjects[project].CHIPS as any)[builtinName][\n `${builtinName}.hdl`\n ] as string;\n const builtinCode = template.replace(\n \"PARTS:\",\n `PARTS:\\n BUILTIN ${builtinName}`\n );\n dispatch.current({ action: \"setFiles\", payload: { hdl: builtinCode } });\n this.replaceChip(Ok(nextChip));\n },\n\n async initialize() {\n await this.loadChip(project, chipName);\n },\n\n compileTest(file: string) {\n dispatch.current({ action: \"setFiles\", payload: { tst: file } });\n const tst = TST.parse(file);\n\n if (isErr(tst)) {\n setStatus(`Failed to parse test`);\n return false;\n }\n setStatus(`Parsed tst`);\n\n test = ChipTest.from(Ok(tst)).with(chip).reset();\n test.setFileSystem(fs);\n dispatch.current({ action: \"updateTestStep\" });\n return true;\n },\n\n async runTest(file: string) {\n if (!this.compileTest(file)) {\n return;\n }\n dispatch.current({ action: \"testRunning\" });\n\n fs.pushd(\"/samples\");\n await test.run();\n fs.popd();\n\n dispatch.current({ action: \"updateTestStep\" });\n dispatch.current({ action: \"testFinished\" });\n },\n\n tick(): Promise {\n return this.stepTest();\n },\n\n async stepTest(): Promise {\n assert(test.chipId === chip.id, \"Test and chip out of sync\");\n const done = await test.step();\n dispatch.current({ action: \"updateTestStep\" });\n if (done) {\n dispatch.current({ action: \"testFinished\" });\n }\n return done;\n },\n };\n\n const initialState: ChipPageState = (() => {\n const controls: ControlsState = {\n project,\n chips,\n chipName,\n hasBuiltin: REGISTRY.has(chipName),\n runningTest: false,\n error: \"\",\n };\n\n const maybeChip = getBuiltinChip(controls.chipName);\n if (isErr(maybeChip)) {\n setStatus(display(Err(maybeChip)));\n chip = new Low();\n } else {\n chip = Ok(maybeChip);\n }\n\n const sim = reduceChip(chip);\n\n return {\n controls,\n files: {\n hdl: \"\",\n cmp: \"\",\n tst: \"\",\n out: \"\",\n },\n sim,\n };\n })();\n\n return { initialState, reducers, actions };\n}\n\nexport function useChipPageStore() {\n const { fs, setStatus, storage } = useContext(BaseContext);\n\n const dispatch = useRef(() => undefined);\n\n const { initialState, reducers, actions } = useMemo(\n () => makeChipStore(fs, setStatus, storage, dispatch),\n [fs, setStatus, storage, dispatch]\n );\n\n const [state, dispatcher] = useImmerReducer(\n reducers as unknown as Record<\n string,\n (state: ChipPageState, action?: unknown) => ChipPageState\n >,\n initialState\n );\n dispatch.current = dispatcher;\n\n return { state, dispatch, actions };\n}\n","import { Trans } from \"@lingui/macro\";\nimport {\n CSSProperties,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport \"./chip.scss\";\n\nimport { makeVisualizationsWithId } from \"@nand2tetris/components/chips/visualizations.js\";\nimport { Clockface } from \"@nand2tetris/components/clockface.js\";\nimport { DiffTable } from \"@nand2tetris/components/difftable.js\";\nimport { FullPinout } from \"@nand2tetris/components/pinout.js\";\nimport { useStateInitializer } from \"@nand2tetris/components/react.js\";\nimport { Runbar } from \"@nand2tetris/components/runbar.js\";\nimport { CMP } from \"@nand2tetris/simulator/languages/cmp.js\";\nimport { HDL } from \"@nand2tetris/simulator/languages/hdl.js\";\nimport { TST } from \"@nand2tetris/simulator/languages/tst.js\";\nimport { CHIP_PROJECTS } from \"@nand2tetris/projects/index.js\";\nimport { Timer } from \"@nand2tetris/simulator/timer.js\";\nimport { AppContext } from \"../App.context\";\nimport { Icon } from \"../pico/icon\";\nimport { Editor } from \"../shell/editor\";\nimport { Accordian, Panel } from \"../shell/panel\";\nimport {\n Files,\n PROJECT_NAMES,\n useChipPageStore,\n} from \"@nand2tetris/components/stores/chip.store.js\";\nimport { BaseContext } from \"@nand2tetris/components/stores/base.context.js\";\n\nexport const Chip = () => {\n const { fs, setStatus } = useContext(BaseContext);\n const { filePicker, tracking } = useContext(AppContext);\n const { state, actions, dispatch } = useChipPageStore();\n\n const [hdl, setHdl] = useStateInitializer(state.files.hdl);\n const [tst, setTst] = useStateInitializer(state.files.tst);\n const [cmp, setCmp] = useStateInitializer(state.files.cmp);\n const [out] = useStateInitializer(state.files.out);\n\n useEffect(() => {\n actions.initialize();\n }, [actions]);\n\n useEffect(() => {\n tracking.trackPage(\"/chip\");\n }, [tracking]);\n\n const saveChip = () => {\n actions.saveChip(hdl);\n };\n\n useEffect(() => {\n tracking.trackEvent(\"action\", \"setProject\", state.controls.project);\n tracking.trackEvent(\"action\", \"setChip\", state.controls.chipName);\n }, []);\n\n const setProject = useCallback(\n (project: keyof typeof CHIP_PROJECTS) => {\n actions.setProject(project);\n tracking.trackEvent(\"action\", \"setProject\", project);\n },\n [actions, tracking]\n );\n\n const setChip = useCallback(\n (chip: string) => {\n actions.setChip(chip);\n actions.reset();\n tracking.trackEvent(\"action\", \"setChip\", chip);\n },\n [actions, tracking]\n );\n\n const doEval = useCallback(() => {\n actions.eval();\n tracking.trackEvent(\"action\", \"eval\");\n }, [actions, tracking]);\n\n const compile = useRef<(files?: Partial) => void>(() => undefined);\n compile.current = async (files: Partial = {}) => {\n await actions.updateFiles({\n hdl: files.hdl,\n tst: files.tst ?? tst,\n cmp: files.cmp ?? cmp,\n });\n };\n\n const loadTest = useCallback(async () => {\n try {\n const path = await filePicker.select();\n const tst = await fs.readFile(path);\n await compile.current({ tst });\n } catch (e) {\n console.error(e);\n setStatus(`Failed to load into memory`);\n }\n }, [filePicker, setStatus, fs, compile]);\n\n const runner = useRef();\n useEffect(() => {\n runner.current = new (class ChipTimer extends Timer {\n async reset(): Promise {\n await compile.current();\n await actions.reset();\n }\n\n override finishFrame(): void {\n super.finishFrame();\n dispatch.current({ action: \"updateTestStep\" });\n }\n\n async tick(): Promise {\n return actions.stepTest();\n }\n\n toggle(): void {\n dispatch.current({ action: \"updateTestStep\" });\n }\n })();\n\n return () => {\n runner.current?.stop();\n };\n }, [compile, actions, dispatch]);\n\n const clockActions = useMemo(\n () => ({\n toggle() {\n actions.clock();\n tracking.trackEvent(\"action\", \"toggleClock\");\n },\n reset() {\n tracking.trackEvent(\"action\", \"resetClock\");\n actions.reset();\n },\n }),\n [actions]\n );\n\n const [useBuiltin, setUseBuiltin] = useState(false);\n const toggleUseBuiltin = async () => {\n if (useBuiltin) {\n setUseBuiltin(false);\n await actions.useBuiltin(false);\n } else {\n setUseBuiltin(true);\n await actions.useBuiltin(true, hdl);\n }\n actions.reset();\n };\n\n const selectors = (\n <>\n
\n {\n setProject(value as keyof typeof CHIP_PROJECTS);\n }}\n data-testid=\"project-picker\"\n >\n {PROJECT_NAMES.map(([number, label]) => (\n \n ))}\n \n {\n setChip(value);\n }}\n data-testid=\"chip-picker\"\n >\n {state.controls.chips.map((chip) => (\n \n ))}\n \n \n
\n \n );\n const hdlPanel = (\n \n
HDL
\n
\n {state.controls.hasBuiltin && (\n \n )}\n
\n {selectors}\n \n }\n >\n {\n setHdl(source);\n compile.current(useBuiltin ? {} : { hdl: source });\n }}\n grammar={HDL.parser}\n language={\"hdl\"}\n disabled={useBuiltin}\n />\n \n );\n\n const chipButtons = (\n
\n \n \n Clock:{\"\\u00a0\"}\n \n \n \n Reset\n \n
\n );\n\n const visualizations: [string, ReactNode][] = makeVisualizationsWithId({\n parts: state.sim.chip,\n });\n\n const pinsPanel = (\n \n
\n Chip\n
\n {chipButtons}\n \n }\n >\n {state.sim.invalid ? (\n Invalid Chip\n ) : (\n <>\n \n {visualizations.length > 0 && (\n Visualizations} open={true}>\n
{visualizations.map(([_, v]) => v)}
\n
\n )}\n \n )}\n \n );\n\n const [selectedTestTab, doSetSelectedTestTab] = useState<\n \"tst\" | \"cmp\" | \"out\"\n >(\"tst\");\n\n const setSelectedTestTab = useCallback(\n (tab: typeof selectedTestTab) => {\n doSetSelectedTestTab(tab);\n tracking.trackEvent(\"tab\", \"change\", tab);\n },\n [tracking]\n );\n\n const testPanel = (\n \n
\n Test\n
\n
\n {runner.current && }\n
\n
\n \n
\n \n }\n >\n
\n \n \n
\n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n\n return (\n
\n {hdlPanel}\n {pinsPanel}\n {testPanel}\n
\n );\n};\n\nexport default Chip;\n"],"names":["ALUComponent","A","op","D","out","flag","_jsxs","children","_jsx","bin","COMMANDS","Flags","RegisterComponent","name","bits","dec","KeyMap","Enter","Backspace","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Home","End","PageUp","PageDown","Insert","Delete","Escape","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Keyboard","keyboard","useState","showPicker","setShowPicker","busVoltage","setBits","setKey","useCallback","event","key","keypress","mapping","undefined","length","code","charCodeAt","keyPressToHackCharacter","preventDefault","changeKey","className","ref","e","focus","type","onKeyDown","onClick","Sizes","none","sm","md","lg","xl","full","Sides","t","r","l","b","tl","tr","bl","br","Widths","isSide","v","getSize","size","getSide","side","rounded","sized","reduce","prev","curr","borderRadius","width","amount","block","display","die","error","args","msg","Error","map","s","join","isDraft","value","DRAFT_STATE","isDraftable","proto","Object","getPrototypeOf","Ctor","hasOwnProperty","call","constructor","Function","toString","objectCtorString","Array","isArray","DRAFTABLE","_value$constructor","isMap","isSet","each","obj","iter","enumerableOnly","getArchtype","keys","ownKeys","forEach","entry","index","thing","state","type_","has","prop","prototype","get","set","propOrOldValue","delete","add","is","x","y","target","hasMap","Map","hasSet","Set","latest","copy_","base_","shallowCopy","base","slice","descriptors","getOwnPropertyDescriptors","i","desc","writable","configurable","enumerable","create","freeze","deep","isFrozen","clear","dontMutateFrozenCollections","getPlugin","pluginKey","plugin","plugins","getCurrentScope","currentScope","usePatchesInScope","scope","patchListener","patches_","inversePatches_","patchListener_","revokeScope","leaveScope","drafts_","revokeDraft","parent_","enterScope","immer","immer_","canAutoFreeze_","unfinalizedDrafts_","draft","revoke_","revoked_","processResult","result","baseDraft","isReplaced","useProxies_","willFinalizeES5_","modified_","finalize","maybeFreeze","generateReplacementPatches_","NOTHING","rootScope","path","childValue","finalizeProperty","scope_","finalized_","draft_","generatePatches_","parentState","targetObject","rootPath","res","assigned_","concat","autoFreeze_","peek","getDescriptorFromProto","source","getOwnPropertyDescriptor","markChanged","prepareCopy","createProxy","parent","proxyMap_","proxySet_","isManual_","traps","objectTraps","arrayTraps","Proxy","revocable","revoke","proxy","createES5Proxy_","push","current","currentImpl","copy","archType","hasChanges_","copyHelper","from","hasSymbol","Symbol","hasProxies","Reflect","for","iterator","getOwnPropertySymbols","getOwnPropertyNames","_desc$get","currentState","deleteProperty","owner","defineProperty","setPrototypeOf","fn","arguments","apply","this","Immer","config","recipe","defaultBase","self","_this","produce","_this2","hasError","Promise","then","p","ip","produceWithPatches","patches","inversePatches","n","nextState","useProxies","setUseProxies","autoFreeze","setAutoFreeze","createDraft","finishDraft","applyPatches","patch","applyPatchesImpl","applyPatches_","bind","useImmerReducer","reducers","initialState","useReducer","command","action","payload","useStateInitializer","init","setState","useEffect","Mode","props","mode","setMode","setValue","view","style","cursor","doSelect","select","doChange","onChange","edit","position","zIndex","left","marginTop","onBlur","onKeyPress","defaultValue","render","doScroll","scrollTop","totalHeight","toleranceHeight","bufferedItems","settings","itemHeight","minIndex","maxIndex","Math","floor","data","offset","limit","start","max","min","getData","topPaddingHeight","bottomPaddingHeight","viewportRef","useRef","useMemo","Number","MAX_SAFE_INTEGER","startIndex","count","tolerance","fillVirtualScrollSettings","startState","adapter","itemsAbove","viewportHeight","reducer","scrollReducer","dispatchScroll","row","initialScroll","div","rows","d","height","rowKey","overflowY","overflowAnchor","onScroll","MemoryBlock","memory","jmp","highlight","editable","format","range","MemoryCell","VirtualScroll","background","hex","flex","textAlign","InlineEdit","newValue","Memory","fmt","setFormat","setJmp","goto","setGoto","jumpTo","doUpdate","update","role","placeholder","FORMATS","option","checked","asm","doFormat","displayClock","Clock","Clockface","clockface","setClockface","subscription","$","subscribe","unsubscribe","useClockface","whiteSpace","WHITE","mem","pixel","color","Screen","frameFinished","canvas","draw","ctx","getContext","image","assertExists","getImageData","col","putImageData","drawImage","ctxRef","frame$","maxWidth","boxSizing","marginInline","margin","borderTop","borderLeft","borderBottom","borderRight","makeVisualization","chip","ALU","in","voltage","HIGH","VRegister","id","PC","KeyboardComponent","ScreenComponent","RAM","MemoryComponent","address","RAM8","CPU","decode","am","vis","parts","filter","reducePin","pin","reverse","reducePins","pins","entries","FullPinout","sim","inPins","outPins","internalPins","PinoutBlock","header","toggle","disabled","pending","colSpan","immPin","Pin","Runbar","runner","timer","dispatch","running","speed","steps","finishFrame","setSteps","setSpeed","actions","frame","stop","reset","makeTimerStore","dispatcher","useTimer","label","clock","Timer","now","Date","delta","done","tick","requestAnimationFrame","ErrorPanel","failed","open","message","shortMessage","UNKNOWN_PARSE_ERROR","Textarea","language","text","setText","Monaco","currentHighlight","theme","useContext","AppContext","monaco","useMonaco","editor","decorations","codeTheme","window","matchMedia","matches","doHighlight","model","getModel","getPositionAt","end","Range","fromPositions","nextDecoration","options","inlineClassName","revealRangeInCenter","deltaDecorations","makeHighlight","onMount","ed","updateOptions","fontFamily","fontSize","minimap","enabled","scrollBeyondLastLine","readOnly","succeeded","setModelMarkers","exec","groups","line","column","startLineNumber","endLineNumber","startColumn","endColumn","getLineContent","substring","match","severity","Editor","grammar","setError","parse","parsed","doParse","ms","clearTimeout","setTimeout","debounce","onChangeCB","canUse","wants","Panel","footer","Accordian","summary","PROJECT_NAMES","makeHdl","reduceChip","invalid","clocked","ins","outs","makeChipStore","fs","setStatus","storage","dropdowns","project","chips","CHIP_PROJECTS","chipName","findDropdowns","Low","test","ChipTest","usingBuiltin","setFiles","hdl","files","tst","cmp","updateChip","controls","includes","setProject","setChip","hasBuiltin","REGISTRY","testRunning","runningTest","testFinished","passed","trim","updateTestStep","log","currentStep","span","ChipProjects","loadChip","useBuiltin","updateFiles","compileChip","compileTest","remove","maybeParsed","HDL","isErr","Err","buildChip","Ok","maybeChip","replaceChip","nextChip","nextPin","eval","with","fsName","ext","all","readFile","catch","console","saveChip","prj","writeFile","isLow","doUseBuiltin","builtinName","getBuiltinChip","template","CHIPS","builtinCode","replace","initialize","file","TST","setFileSystem","runTest","pushd","run","popd","stepTest","assert","chipId","step","Chip","BaseContext","filePicker","tracking","useChipPageStore","setHdl","setTst","setCmp","trackPage","trackEvent","doEval","compile","loadTest","clockActions","setUseBuiltin","toggleUseBuiltin","selectors","number","hdlPanel","tabIndex","chipButtons","visualizations","part","makeVisualizationsWithId","pinsPanel","selectedTestTab","doSetSelectedTestTab","setSelectedTestTab","tab","testPanel","CMP"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/681.59527346.chunk.js b/web/build/static/js/681.59527346.chunk.js new file mode 100644 index 000000000..ec5580bf7 --- /dev/null +++ b/web/build/static/js/681.59527346.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[681],{2681:function(n,t,u){u.r(t),u.d(t,{ChipProjects:function(){return M},default:function(){return S},loadSolutions:function(){return y},loaders:function(){return m}});var e={};u.r(e),u.d(e,{SOLS:function(){return c},loadSolutions:function(){return i}});var r={};u.r(r),u.d(r,{SOLS:function(){return h},loadSolutions:function(){return p}});var a={};u.r(a),u.d(a,{SOLS:function(){return b},loadSolutions:function(){return f}});var o={};u.r(o),u.d(o,{SOLS:function(){return x},loadSolutions:function(){return R}});var d=u(1092),s=u(7791),l=u(9956),c={Not:{"Not.hdl":"// REDACTED"},And:{"And.hdl":"CHIP And {\n IN a, b;\n OUT out;\n\n PARTS:\n Nand(a=a, b=b, out=x);\n Not(in=x, out=out);\n}"},Or:{"Or.hdl":"// REDACTED"},XOr:{"XOr.hdl":"// REDACTED"},Mux:{"Mux.hdl":"// REDACTED"},DMux:{"DMux.hdl":"// REDACTED"},Not16:{"Not16.hdl":"// REDACTED"},And16:{"And16.hdl":"CHIP And16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n And (a=a[0], b=b[0], out=out[0]);\n And (a=a[1], b=b[1], out=out[1]);\n And (a=a[2], b=b[2], out=out[2]);\n And (a=a[3], b=b[3], out=out[3]);\n And (a=a[4], b=b[4], out=out[4]);\n And (a=a[5], b=b[5], out=out[5]);\n And (a=a[6], b=b[6], out=out[6]);\n And (a=a[7], b=b[7], out=out[7]);\n And (a=a[8], b=b[8], out=out[8]);\n And (a=a[9], b=b[9], out=out[9]);\n And (a=a[10], b=b[10], out=out[10]);\n And (a=a[11], b=b[11], out=out[11]);\n And (a=a[12], b=b[12], out=out[12]);\n And (a=a[13], b=b[13], out=out[13]);\n And (a=a[14], b=b[14], out=out[14]);\n And (a=a[15], b=b[15], out=out[15]);\n}"},Or16:{"Or16.hdl":"// REDACTED"},Mux16:{"Mux16.hdl":"// REDACTED"},Mux4Way16:{"Mux4Way16.hdl":"// REDACTED"},Mux8Way16:{"Mux8Way16.hdl":"CHIP Mux8Way16 {\n IN a[16], b[16], c[16], d[16],\n e[16], f[16], g[16], h[16],\n sel[3];\n OUT out[16];\n\n PARTS:\n // Binary tree of 2-way multiplexors\n Mux16 (a=a, b=b, sel=sel[0], out=ab);\n Mux16 (a=c, b=d, sel=sel[0], out=cd);\n Mux16 (a=e, b=f, sel=sel[0], out=ef);\n Mux16 (a=g, b=h, sel=sel[0], out=gh);\n Mux16 (a=ab, b=cd, sel=sel[1], out=abcd);\n Mux16 (a=ef, b=gh, sel=sel[1], out=efgh);\n Mux16 (a=abcd, b=efgh, sel=sel[2], out=out);\n\n\n// Alternate implementation\n//\n// This implementation replaces the upper two layers of the\n// tree with 4-way multiplexors.\n/*\n Mux4Way16 (a=a, b=b, c=c, d=d, sel=sel[0..1], out=abcd);\n Mux4Way16 (a=e, b=f, c=g, d=h, sel=sel[0..1], out=efgh);\n Mux16 (a=abcd, b=efgh, sel=sel[2], out=out);\n*/\n\n// Alternate implementation\n//\n// Some students make a Mux8Way chip and apply it 16 times as in Not16.\n}"},DMux4Way:{"DMux4Way.hdl":"// REDACTED"},DMux8Way:{"DMux8Way.hdl":"// REDACTED"},Or8Way:{"Or8Way.hdl":"// REDACTED"}};function i(n){return A.apply(this,arguments)}function A(){return(A=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.pushd("/projects/01");case 2:return n.next=4,(0,l.mc)(t,c);case 4:return n.next=6,t.popd();case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var h={HalfAdder:{"HalfAdder.hdl":"// REDACTED"},FullAdder:{"FullAdder.hdl":"// REDACTED"},Add16:{"Add16.hdl":"// REDACTED"},Inc16:{"Inc16.hdl":"// REDACTED"},AluNoStat:{"AluNoStat.hdl":"// REDACTED"},ALU:{"ALU.hdl":"// REDACTED"}};function p(n){return D.apply(this,arguments)}function D(){return(D=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.pushd("/projects/02");case 2:return n.next=4,(0,l.mc)(t,h);case 4:return n.next=6,t.popd();case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var b={Bit:{"Bit.hdl":"CHIP Bit {\n IN in, load;\n OUT out;\n\n PARTS:\n \n Mux (a=dffOut, b=in, sel=load, out=muxOut);\n DFF (in=muxOut, out=dffOut, out=out);\n}"},Register:{"Register.hdl":"// REDACTED"},PC:{"PC.hdl":"// REDACTED"},RAM8:{"RAM8.hdl":"// REDACTED"},RAM64:{"RAM64.hdl":"// REDACTED"},RAM512:{"RAM512.hdl":"// REDACTED"},RAM4k:{"RAM4k.hdl":"// REDACTED"},RAM16k:{"RAM16k.hdl":"// REDACTED"}};function f(n){return E.apply(this,arguments)}function E(){return(E=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.pushd("/projects/03");case 2:return n.next=4,(0,l.mc)(t,b);case 4:return n.next=6,t.popd();case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var x={Memory:{"Memory.hdl":"// REDACTED"},CPU:{"CPU.hdl":"// REDACTED"},Computer:{"Computer.hdl":"// REDACTED"}};function R(n){return C.apply(this,arguments)}function C(){return(C=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.pushd("/projects/05");case 2:return n.next=4,(0,l.mc)(t,x);case 4:return n.next=6,t.popd();case 6:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var M={"01":e,"02":r,"03":a,"05":o},T=!1,y=function(){var n=(0,s.Z)((0,d.Z)().mark((function n(t){return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!T){n.next=2;break}return n.abrupt("return");case 2:return T=!0,n.next=5,i(t);case 5:return n.next=7,p(t);case 7:return n.next=9,f(t);case 9:return n.next=11,R(t);case 11:T=!1;case 12:case"end":return n.stop()}}),n)})));return function(t){return n.apply(this,arguments)}}(),m={loadSolutions:y},S=m}}]); +//# sourceMappingURL=681.59527346.chunk.js.map \ No newline at end of file diff --git a/web/build/static/js/681.59527346.chunk.js.map b/web/build/static/js/681.59527346.chunk.js.map new file mode 100644 index 000000000..85900538c --- /dev/null +++ b/web/build/static/js/681.59527346.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/681.59527346.chunk.js","mappings":"koBAkBaA,EAAO,CAClBC,IAAK,CACH,UCpBe,eDsBjBC,IAAK,CACH,UEvBe,gHFyBjBC,GAAI,CACF,SG1Be,eH4BjBC,IAAK,CACH,UI7Be,eJ+BjBC,IAAK,CACH,UKhCe,eLkCjBC,KAAM,CACJ,WMnCe,eNqCjBC,MAAO,CACL,YOtCe,ePwCjBC,MAAO,CACL,YQzCe,+tBR2CjBC,KAAM,CACJ,WS5Ce,eT8CjBC,MAAO,CACL,YU/Ce,eViDjBC,UAAW,CACT,gBWlDe,eXoDjBC,UAAW,CACT,gBYrDe,+7BZuDjBC,SAAU,CACR,eaxDe,eb0DjBC,SAAU,CACR,ec3De,ed6DjBC,OAAQ,CACN,ae9De,gBfkEZ,SAAeC,EAAc,GAAD,+BAIlC,8CAJM,WAA6BC,GAAc,sFAC1CA,EAAGC,MAAM,gBAAe,wBACxBC,EAAAA,EAAAA,IAAMF,EAAIjB,GAAK,uBACfiB,EAAGG,OAAM,4CAChB,sBgBtEM,ICSMpB,EAAO,CAClBqB,UAAW,CACT,gBDXe,eCajBC,UAAW,CACT,gBCde,eDgBjBC,MAAO,CACL,YEjBe,eFmBjBC,MAAO,CACL,YGpBe,eH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["../../projects/src/testing/project_01/index.ts","../../projects/src/testing/project_01/01_not.ts","../../projects/src/testing/project_01/02_and.ts","../../projects/src/testing/project_01/03_or.ts","../../projects/src/testing/project_01/04_xor.ts","../../projects/src/testing/project_01/05_mux.ts","../../projects/src/testing/project_01/06_dmux.ts","../../projects/src/testing/project_01/07_not16.ts","../../projects/src/testing/project_01/08_and16.ts","../../projects/src/testing/project_01/09_or16.ts","../../projects/src/testing/project_01/10_mux16.ts","../../projects/src/testing/project_01/11_mux4way16.ts","../../projects/src/testing/project_01/12_mux8way16.ts","../../projects/src/testing/project_01/13_dmux4way.ts","../../projects/src/testing/project_01/14_dmux8way.ts","../../projects/src/testing/project_01/15_or8way.ts","../../projects/src/testing/project_02/01_half_adder.ts","../../projects/src/testing/project_02/index.ts","../../projects/src/testing/project_02/02_full_adder.ts","../../projects/src/testing/project_02/03_add16.ts","../../projects/src/testing/project_02/04_inc16.ts","../../projects/src/testing/project_02/05_alu_no_stat.ts","../../projects/src/testing/project_02/06_alu.ts","../../projects/src/testing/project_03/01_bit.ts","../../projects/src/testing/project_03/index.ts","../../projects/src/testing/project_03/02_register.ts","../../projects/src/testing/project_03/03_pc.ts","../../projects/src/testing/project_03/04_ram8.ts","../../projects/src/testing/project_03/05_ram64.ts","../../projects/src/testing/project_03/06_ram512.ts","../../projects/src/testing/project_03/07_ram4k.ts","../../projects/src/testing/project_03/08_ram16k.ts","../../projects/src/testing/project_05/01_memory.ts","../../projects/src/testing/project_05/index.ts","../../projects/src/testing/project_05/02_cpu.ts","../../projects/src/testing/project_05/03_computer.ts","../../projects/src/testing/index.ts"],"sourcesContent":["import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Not from \"./01_not.js\";\nimport * as And from \"./02_and.js\";\nimport * as Or from \"./03_or.js\";\nimport * as Xor from \"./04_xor.js\";\nimport * as Mux from \"./05_mux.js\";\nimport * as DMux from \"./06_dmux.js\";\nimport * as Not16 from \"./07_not16.js\";\nimport * as And16 from \"./08_and16.js\";\nimport * as Or16 from \"./09_or16.js\";\nimport * as Mux16 from \"./10_mux16.js\";\nimport * as Mux4Way16 from \"./11_mux4way16.js\";\nimport * as Mux8Way16 from \"./12_mux8way16.js\";\nimport * as DMux4Way from \"./13_dmux4way.js\";\nimport * as DMux8Way from \"./14_dmux8way.js\";\nimport * as Or8Way from \"./15_or8way.js\";\n\nexport const SOLS = {\n Not: {\n \"Not.hdl\": Not.sol,\n },\n And: {\n \"And.hdl\": And.sol,\n },\n Or: {\n \"Or.hdl\": Or.sol,\n },\n XOr: {\n \"XOr.hdl\": Xor.sol,\n },\n Mux: {\n \"Mux.hdl\": Mux.sol,\n },\n DMux: {\n \"DMux.hdl\": DMux.sol,\n },\n Not16: {\n \"Not16.hdl\": Not16.sol,\n },\n And16: {\n \"And16.hdl\": And16.sol,\n },\n Or16: {\n \"Or16.hdl\": Or16.sol,\n },\n Mux16: {\n \"Mux16.hdl\": Mux16.sol,\n },\n Mux4Way16: {\n \"Mux4Way16.hdl\": Mux4Way16.sol,\n },\n Mux8Way16: {\n \"Mux8Way16.hdl\": Mux8Way16.sol,\n },\n DMux4Way: {\n \"DMux4Way.hdl\": DMux4Way.sol,\n },\n DMux8Way: {\n \"DMux8Way.hdl\": DMux8Way.sol,\n },\n Or8Way: {\n \"Or8Way.hdl\": Or8Way.sol,\n },\n};\n\nexport async function loadSolutions(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/01\");\n await reset(fs, SOLS);\n await fs.popd();\n}\n","export const sol = `// REDACTED`;\n","export const sol = `CHIP And {\n IN a, b;\n OUT out;\n\n PARTS:\n Nand(a=a, b=b, out=x);\n Not(in=x, out=out);\n}`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `CHIP And16 {\n IN a[16], b[16];\n OUT out[16];\n\n PARTS:\n And (a=a[0], b=b[0], out=out[0]);\n And (a=a[1], b=b[1], out=out[1]);\n And (a=a[2], b=b[2], out=out[2]);\n And (a=a[3], b=b[3], out=out[3]);\n And (a=a[4], b=b[4], out=out[4]);\n And (a=a[5], b=b[5], out=out[5]);\n And (a=a[6], b=b[6], out=out[6]);\n And (a=a[7], b=b[7], out=out[7]);\n And (a=a[8], b=b[8], out=out[8]);\n And (a=a[9], b=b[9], out=out[9]);\n And (a=a[10], b=b[10], out=out[10]);\n And (a=a[11], b=b[11], out=out[11]);\n And (a=a[12], b=b[12], out=out[12]);\n And (a=a[13], b=b[13], out=out[13]);\n And (a=a[14], b=b[14], out=out[14]);\n And (a=a[15], b=b[15], out=out[15]);\n}`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `CHIP Mux8Way16 {\n IN a[16], b[16], c[16], d[16],\n e[16], f[16], g[16], h[16],\n sel[3];\n OUT out[16];\n\n PARTS:\n // Binary tree of 2-way multiplexors\n Mux16 (a=a, b=b, sel=sel[0], out=ab);\n Mux16 (a=c, b=d, sel=sel[0], out=cd);\n Mux16 (a=e, b=f, sel=sel[0], out=ef);\n Mux16 (a=g, b=h, sel=sel[0], out=gh);\n Mux16 (a=ab, b=cd, sel=sel[1], out=abcd);\n Mux16 (a=ef, b=gh, sel=sel[1], out=efgh);\n Mux16 (a=abcd, b=efgh, sel=sel[2], out=out);\n\n\n// Alternate implementation\n//\n// This implementation replaces the upper two layers of the\n// tree with 4-way multiplexors.\n/*\n Mux4Way16 (a=a, b=b, c=c, d=d, sel=sel[0..1], out=abcd);\n Mux4Way16 (a=e, b=f, c=g, d=h, sel=sel[0..1], out=efgh);\n Mux16 (a=abcd, b=efgh, sel=sel[2], out=out);\n*/\n\n// Alternate implementation\n//\n// Some students make a Mux8Way chip and apply it 16 times as in Not16.\n}`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as HalfAdder from \"./01_half_adder.js\";\nimport * as FullAdder from \"./02_full_adder.js\";\nimport * as Add16 from \"./03_add16.js\";\nimport * as Inc16 from \"./04_inc16.js\";\nimport * as Alu from \"./05_alu_no_stat.js\";\nimport * as AluStatus from \"./06_alu.js\";\n\nexport const SOLS = {\n HalfAdder: {\n \"HalfAdder.hdl\": HalfAdder.sol,\n },\n FullAdder: {\n \"FullAdder.hdl\": FullAdder.sol,\n },\n Add16: {\n \"Add16.hdl\": Add16.sol,\n },\n Inc16: {\n \"Inc16.hdl\": Inc16.sol,\n },\n AluNoStat: {\n \"AluNoStat.hdl\": Alu.sol,\n },\n ALU: {\n \"ALU.hdl\": AluStatus.sol,\n },\n};\n\nexport async function loadSolutions(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/02\");\n await reset(fs, SOLS);\n await fs.popd();\n}\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `CHIP Bit {\n IN in, load;\n OUT out;\n\n PARTS:\n \n Mux (a=dffOut, b=in, sel=load, out=muxOut);\n DFF (in=muxOut, out=dffOut, out=out);\n}`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Bit from \"./01_bit.js\";\nimport * as Register from \"./02_register.js\";\nimport * as PC from \"./03_pc.js\";\nimport * as RAM8 from \"./04_ram8.js\";\nimport * as RAM64 from \"./05_ram64.js\";\nimport * as RAM512 from \"./06_ram512.js\";\nimport * as RAM4k from \"./07_ram4k.js\";\nimport * as RAM16k from \"./08_ram16k.js\";\n\nexport const SOLS = {\n Bit: {\n \"Bit.hdl\": Bit.sol,\n },\n Register: {\n \"Register.hdl\": Register.sol,\n },\n PC: {\n \"PC.hdl\": PC.sol,\n },\n RAM8: {\n \"RAM8.hdl\": RAM8.sol,\n },\n RAM64: {\n \"RAM64.hdl\": RAM64.sol,\n },\n RAM512: {\n \"RAM512.hdl\": RAM512.sol,\n },\n RAM4k: {\n \"RAM4k.hdl\": RAM4k.sol,\n },\n RAM16k: {\n \"RAM16k.hdl\": RAM16k.sol,\n },\n};\n\nexport async function loadSolutions(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/03\");\n await reset(fs, SOLS);\n await fs.popd();\n}\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","import { FileSystem, reset } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as Memory from \"./01_memory.js\";\nimport * as CPU from \"./02_cpu.js\";\nimport * as Computer from \"./03_computer.js\";\n\nexport const SOLS = {\n Memory: {\n \"Memory.hdl\": Memory.sol,\n },\n CPU: {\n \"CPU.hdl\": CPU.sol,\n },\n Computer: {\n \"Computer.hdl\": Computer.sol,\n },\n};\n\nexport async function loadSolutions(fs: FileSystem): Promise {\n await fs.pushd(\"/projects/05\");\n await reset(fs, SOLS);\n await fs.popd();\n}\n","export const sol = `// REDACTED`;\n","export const sol = `// REDACTED`;\n","import { FileSystem } from \"@davidsouther/jiffies/lib/esm/fs.js\";\n\nimport * as project_01 from \"./project_01/index.js\";\nimport * as project_02 from \"./project_02/index.js\";\nimport * as project_03 from \"./project_03/index.js\";\nimport * as project_05 from \"./project_05/index.js\";\n\nexport const ChipProjects = {\n \"01\": project_01,\n \"02\": project_02,\n \"03\": project_03,\n \"05\": project_05,\n};\n\nlet reset = false;\nexport const loadSolutions = async (fs: FileSystem) => {\n if (reset) return; // React will double-render a call to resetFiles in useEffect.\n reset = true;\n await project_01.loadSolutions(fs);\n await project_02.loadSolutions(fs);\n await project_03.loadSolutions(fs);\n await project_05.loadSolutions(fs);\n reset = false;\n};\n\nexport const loaders = {\n loadSolutions,\n};\n\nexport default loaders;\n"],"names":["SOLS","Not","And","Or","XOr","Mux","DMux","Not16","And16","Or16","Mux16","Mux4Way16","Mux8Way16","DMux4Way","DMux8Way","Or8Way","loadSolutions","fs","pushd","reset","popd","HalfAdder","FullAdder","Add16","Inc16","AluNoStat","ALU","Bit","Register","PC","RAM8","RAM64","RAM512","RAM4k","RAM16k","Memory","CPU","Computer","ChipProjects","project_01","project_02","project_03","project_05","loaders"],"sourceRoot":""} \ No newline at end of file diff --git a/web/build/static/js/813.65f1d443.chunk.js b/web/build/static/js/813.65f1d443.chunk.js new file mode 100644 index 000000000..3254c23f5 --- /dev/null +++ b/web/build/static/js/813.65f1d443.chunk.js @@ -0,0 +1,3 @@ +/*! For license information please see 813.65f1d443.chunk.js.LICENSE.txt */ +(self.webpackChunk_nand2tetris_web=self.webpackChunk_nand2tetris_web||[]).push([[813],{1959:function(e){"use strict";var n=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(e){return"function"===typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},l=function(e){if(!e||"[object Object]"!==t.call(e))return!1;var r,i=n.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!i&&!o)return!1;for(r in e);return"undefined"===typeof r||n.call(e,r)},u=function(e,n){r&&"__proto__"===n.name?r(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},a=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;if(i)return i(e,t).value}return e[t]};e.exports=function e(){var n,t,r,i,c,s,f=arguments[0],p=1,h=arguments.length,d=!1;for("boolean"===typeof f&&(d=f,f=arguments[1]||{},p=2),(null==f||"object"!==typeof f&&"function"!==typeof f)&&(f={});po?0:o+n:n>o?o:n,t=t>0?t:0,r.length<1e4)(i=Array.from(r)).unshift(n,t),[].splice.apply(e,i);else for(t&&[].splice.apply(e,[n,t]);l0?(r(e,e.length,0,n),e):n}t.d(n,{V:function(){return i},d:function(){return r}})},762:function(e,n,t){"use strict";t.d(n,{r:function(){return i}});var r=t(1964);function i(e){return null===e||(0,r.z3)(e)||(0,r.B8)(e)?1:(0,r.Xh)(e)?2:void 0}},5152:function(e,n,t){"use strict";t.d(n,{W:function(){return o}});var r=t(4115),i={}.hasOwnProperty;function o(e){for(var n={},t=-1;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||65535===(65535&t)||65534===(65535&t)||t>1114111?"\ufffd":String.fromCharCode(t)}t.d(n,{o:function(){return r}})},1522:function(e,n,t){"use strict";t.d(n,{v:function(){return l}});var r=t(421),i=t(4488),o=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function l(e){return e.replace(o,u)}function u(e,n,t){if(n)return n;if(35===t.charCodeAt(0)){var o=t.charCodeAt(1),l=120===o||88===o;return(0,i.o)(t.slice(l?2:1),l?16:10)}return(0,r.T)(t)||e}},7184:function(e,n,t){"use strict";function r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}t.d(n,{d:function(){return r}})},2771:function(e,n,t){"use strict";function r(e,n,t){for(var r=[],i=-1;++ie.length){for(;o--;)if(47===e.charCodeAt(o)){if(t){r=o+1;break}}else i<0&&(t=!0,i=o+1);return i<0?"":e.slice(r,i)}if(n===e)return"";var l=-1,u=n.length-1;for(;o--;)if(47===e.charCodeAt(o)){if(t){r=o+1;break}}else l<0&&(t=!0,l=o+1),u>-1&&(e.charCodeAt(o)===n.charCodeAt(u--)?u<0&&(i=o):(u=-1,i=l));r===i?i=l:i<0&&(i=e.length);return e.slice(r,i)},dirname:function(e){if(x(e),0===e.length)return".";var n,t=-1,r=e.length;for(;--r;)if(47===e.charCodeAt(r)){if(n){t=r;break}}else n||(n=!0);return t<0?47===e.charCodeAt(0)?"/":".":1===t&&47===e.charCodeAt(0)?"//":e.slice(0,t)},extname:function(e){x(e);var n,t=e.length,r=-1,i=0,o=-1,l=0;for(;t--;){var u=e.charCodeAt(t);if(47!==u)r<0&&(n=!0,r=t+1),46===u?o<0?o=t:1!==l&&(l=1):o>-1&&(l=-1);else if(n){i=t+1;break}}if(o<0||r<0||0===l||1===l&&o===r-1&&o===i+1)return"";return e.slice(o,r)},join:function(){for(var e,n=-1,t=arguments.length,r=new Array(t),i=0;i2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",o=0):o=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),l=a,u=0;continue}}else if(i.length>0){i="",o=0,l=a,u=0;continue}n&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(l+1,a):i=e.slice(l+1,a),o=a-l-1;l=a,u=0}else 46===t&&u>-1?u++:u=-1}return i}(e,!n);return 0!==t.length||n||(t="."),t.length>0&&47===e.charCodeAt(e.length-1)&&(t+="/"),n?"/"+t:t}function x(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var b={cwd:function(){return"/"}};function C(e){return null!==e&&"object"===typeof e&&e.href&&e.origin}function w(e){if("string"===typeof e)e=new URL(e);else if(!C(e)){var n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if("file:"!==e.protocol){var t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return function(e){if(""!==e.hostname){var n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}var t=e.pathname,r=-1;for(;++ro.length;a&&o.push(r);try{u=e.apply(this,o)}catch(s){var c=s;if(a&&t)throw c;return r(c)}a||(u instanceof Promise?u.then(i,r):u instanceof Error?r(u):i(u))};function r(e){if(!t){t=!0;for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o1?a-1:0),s=1;s1?t-1:0),a=1;ar))return;for(var c,s,f=i.events.length,p=f;p--;)if("exit"===i.events[p][0]&&"chunkFlow"===i.events[p][1].type){if(c){s=i.events[p][1].end;break}c=!0}for(v(l),a=f;an;){var r=o[t];i.containerState=r[1],r[0].exit.call(i,e)}o.length=n}function y(){n.write([null]),t=void 0,n=void 0,i.containerState._closeFlow=void 0}}},J={tokenize:function(e,n,t){return(0,W.f)(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};var G=t(6848);function ee(e){for(var n,t,r,i,o,l,u,a={},c=-1;++c=4?n(i):e.interrupt(r.parser.constructs.flow,t,n)(i)}},partial:!0};var ie={tokenize:function(e){var n=this,t=e.attempt(G.w,(function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}),e.attempt(this.parser.constructs.flowInitial,r,(0,W.f)(e,e.attempt(this.parser.constructs.flow,r,e.attempt(te,r)),"linePrefix")));return t;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n.currentConstruct=void 0,t;e.consume(r)}}};var oe={resolveAll:ce()},le=ae("string"),ue=ae("text");function ae(e){return{tokenize:function(n){var t=this,r=this.parser.constructs[e],i=n.attempt(r,o,l);return o;function o(e){return a(e)?i(e):l(e)}function l(e){if(null!==e)return n.enter("data"),n.consume(e),u;n.consume(e)}function u(e){return a(e)?(n.exit("data"),i(e)):(n.consume(e),u)}function a(e){if(null===e)return!0;var n=r[e],i=-1;if(n)for(;++i-1&&(t[0]=t[0].slice(i)),l>0&&t.push(e[o].slice(0,l)));return t}(l,e)}function h(){return Object.assign({},r)}function d(){for(var e;r._indexc?t(i):(e.consume(i),d):41===i?s--?(e.consume(i),d):(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),n(i)):null===i||(0,Y.z3)(i)?s?t(i):(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),n(i)):(0,Y.Av)(i)?t(i):(e.consume(i),92===i?g:d)}function g(n){return 40===n||41===n||92===n?(e.consume(n),d):d(n)}}function xe(e,n,t,r,i,o){var l,u=this,a=0;return function(n){return e.enter(r),e.enter(i),e.consume(n),e.exit(i),e.enter(o),c};function c(f){return null===f||91===f||93===f&&!l||94===f&&!a&&"_hiddenFootnoteSupport"in u.parser.constructs||a>999?t(f):93===f?(e.exit(o),e.enter(i),e.consume(f),e.exit(i),e.exit(r),n):(0,Y.Ch)(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),s(f))}function s(n){return null===n||91===n||93===n||(0,Y.Ch)(n)||a++>999?(e.exit("chunkString"),c(n)):(e.consume(n),l=l||!(0,Y.xz)(n),92===n?f:s)}function f(n){return 91===n||92===n||93===n?(e.consume(n),a++,s):s(n)}}function be(e,n,t,r,i,o){var l;return function(n){return e.enter(r),e.enter(i),e.consume(n),e.exit(i),l=40===n?41:n,u};function u(t){return t===l?(e.enter(i),e.consume(t),e.exit(i),e.exit(r),n):(e.enter(o),a(t))}function a(n){return n===l?(e.exit(o),u(l)):null===n?t(n):(0,Y.Ch)(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,W.f)(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(n))}function c(n){return n===l||null===n||(0,Y.Ch)(n)?(e.exit("chunkString"),a(n)):(e.consume(n),92===n?s:c)}function s(n){return n===l||92===n?(e.consume(n),c):c(n)}}function Ce(e,n){var t;return function r(i){if((0,Y.Ch)(i))return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r;if((0,Y.xz)(i))return(0,W.f)(e,r,t?"linePrefix":"lineSuffix")(i);return n(i)}}var we=t(7184),Se={name:"definition",tokenize:function(e,n,t){var r,i=this;return function(n){return e.enter("definition"),xe.call(i,e,o,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function o(n){return r=(0,we.d)(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===n?(e.enter("definitionMarker"),e.consume(n),e.exit("definitionMarker"),Ce(e,ke(e,e.attempt(Ae,(0,W.f)(e,l,"whitespace"),(0,W.f)(e,l,"whitespace")),t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString"))):t(n)}function l(o){return null===o||(0,Y.Ch)(o)?(e.exit("definition"),i.parser.defined.includes(r)||i.parser.defined.push(r),n(o)):t(o)}}},Ae={tokenize:function(e,n,t){return function(n){return(0,Y.z3)(n)?Ce(e,r)(n):t(n)};function r(n){return 34===n||39===n||40===n?be(e,(0,W.f)(e,i,"whitespace"),t,"definitionTitle","definitionTitleMarker","definitionTitleString")(n):t(n)}function i(e){return null===e||(0,Y.Ch)(e)?n(e):t(e)}},partial:!0};var Fe={name:"codeIndented",tokenize:function(e,n,t){var r=this;return function(n){return e.enter("codeIndented"),(0,W.f)(e,i,"linePrefix",5)(n)};function i(e){var n=r.events[r.events.length-1];return n&&"linePrefix"===n[1].type&&n[2].sliceSerialize(n[1],!0).length>=4?o(e):t(e)}function o(n){return null===n?u(n):(0,Y.Ch)(n)?e.attempt(Ee,o,u)(n):(e.enter("codeFlowValue"),l(n))}function l(n){return null===n||(0,Y.Ch)(n)?(e.exit("codeFlowValue"),o(n)):(e.consume(n),l)}function u(t){return e.exit("codeIndented"),n(t)}}},Ee={tokenize:function(e,n,t){var r=this;return i;function i(n){return r.parser.lazy[r.now().line]?t(n):(0,Y.Ch)(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),i):(0,W.f)(e,o,"linePrefix",5)(n)}function o(e){var o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?n(e):(0,Y.Ch)(e)?i(e):t(e)}},partial:!0};var Te={name:"headingAtx",tokenize:function(e,n,t){var r=this,i=0;return function(n){return e.enter("atxHeading"),e.enter("atxHeadingSequence"),o(n)};function o(u){return 35===u&&i++<6?(e.consume(u),o):null===u||(0,Y.z3)(u)?(e.exit("atxHeadingSequence"),r.interrupt?n(u):l(u)):t(u)}function l(t){return 35===t?(e.enter("atxHeadingSequence"),u(t)):null===t||(0,Y.Ch)(t)?(e.exit("atxHeading"),n(t)):(0,Y.xz)(t)?(0,W.f)(e,l,"whitespace")(t):(e.enter("atxHeadingText"),a(t))}function u(n){return 35===n?(e.consume(n),u):(e.exit("atxHeadingSequence"),l(n))}function a(n){return null===n||35===n||(0,Y.z3)(n)?(e.exit("atxHeadingText"),l(n)):(e.consume(n),a)}},resolve:function(e,n){var t,r,i=e.length-2,o=3;"whitespace"===e[o][1].type&&(o+=2);i-2>o&&"whitespace"===e[i][1].type&&(i-=2);"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4);i>o&&(t={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},(0,X.d)(e,o,i-o+1,[["enter",t,n],["enter",r,n],["exit",r,n],["exit",t,n]]));return e}};var De={name:"setextUnderline",tokenize:function(e,n,t){var r,i,o=this,l=o.events.length;for(;l--;)if("lineEnding"!==o.events[l][1].type&&"linePrefix"!==o.events[l][1].type&&"content"!==o.events[l][1].type){i="paragraph"===o.events[l][1].type;break}return function(n){if(!o.parser.lazy[o.now().line]&&(o.interrupt||i))return e.enter("setextHeadingLine"),e.enter("setextHeadingLineSequence"),r=n,u(n);return t(n)};function u(n){return n===r?(e.consume(n),u):(e.exit("setextHeadingLineSequence"),(0,W.f)(e,a,"lineSuffix")(n))}function a(r){return null===r||(0,Y.Ch)(r)?(e.exit("setextHeadingLine"),n(r)):t(r)}},resolveTo:function(e,n){var t,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){t=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);var l={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",l,n]),e.splice(i+1,0,["exit",e[t][1],n]),e[t][1].end=Object.assign({},e[i][1].end)):e[t][1]=l;return e.push(["exit",l,n]),e}};var ze=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Le=["pre","script","style","textarea"],Oe={name:"htmlFlow",tokenize:function(e,n,t){var r,i,o,l,u,a=this;return function(n){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(l){return 33===l?(e.consume(l),s):47===l?(e.consume(l),h):63===l?(e.consume(l),r=3,a.interrupt?n:I):(0,Y.jv)(l)?(e.consume(l),o=String.fromCharCode(l),i=!0,d):t(l)}function s(i){return 45===i?(e.consume(i),r=2,f):91===i?(e.consume(i),r=5,o="CDATA[",l=0,p):(0,Y.jv)(i)?(e.consume(i),r=4,a.interrupt?n:I):t(i)}function f(r){return 45===r?(e.consume(r),a.interrupt?n:I):t(r)}function p(r){return r===o.charCodeAt(l++)?(e.consume(r),l===o.length?a.interrupt?n:F:p):t(r)}function h(n){return(0,Y.jv)(n)?(e.consume(n),o=String.fromCharCode(n),d):t(n)}function d(l){return null===l||47===l||62===l||(0,Y.z3)(l)?47!==l&&i&&Le.includes(o.toLowerCase())?(r=1,a.interrupt?n(l):F(l)):ze.includes(o.toLowerCase())?(r=6,47===l?(e.consume(l),g):a.interrupt?n(l):F(l)):(r=7,a.interrupt&&!a.parser.lazy[a.now().line]?t(l):i?v(l):m(l)):45===l||(0,Y.H$)(l)?(e.consume(l),o+=String.fromCharCode(l),d):t(l)}function g(r){return 62===r?(e.consume(r),a.interrupt?n:F):t(r)}function m(n){return(0,Y.xz)(n)?(e.consume(n),m):S(n)}function v(n){return 47===n?(e.consume(n),S):58===n||95===n||(0,Y.jv)(n)?(e.consume(n),y):(0,Y.xz)(n)?(e.consume(n),v):S(n)}function y(n){return 45===n||46===n||58===n||95===n||(0,Y.H$)(n)?(e.consume(n),y):k(n)}function k(n){return 61===n?(e.consume(n),x):(0,Y.xz)(n)?(e.consume(n),k):v(n)}function x(n){return null===n||60===n||61===n||62===n||96===n?t(n):34===n||39===n?(e.consume(n),u=n,b):(0,Y.xz)(n)?(e.consume(n),x):(u=null,C(n))}function b(n){return null===n||(0,Y.Ch)(n)?t(n):n===u?(e.consume(n),w):(e.consume(n),b)}function C(n){return null===n||34===n||39===n||60===n||61===n||62===n||96===n||(0,Y.z3)(n)?k(n):(e.consume(n),C)}function w(e){return 47===e||62===e||(0,Y.xz)(e)?v(e):t(e)}function S(n){return 62===n?(e.consume(n),A):t(n)}function A(n){return(0,Y.xz)(n)?(e.consume(n),A):null===n||(0,Y.Ch)(n)?F(n):t(n)}function F(n){return 45===n&&2===r?(e.consume(n),z):60===n&&1===r?(e.consume(n),L):62===n&&4===r?(e.consume(n),M):63===n&&3===r?(e.consume(n),I):93===n&&5===r?(e.consume(n),P):!(0,Y.Ch)(n)||6!==r&&7!==r?null===n||(0,Y.Ch)(n)?E(n):(e.consume(n),F):e.check(Pe,M,E)(n)}function E(n){return e.exit("htmlFlowData"),T(n)}function T(n){return null===n?R(n):(0,Y.Ch)(n)?e.attempt({tokenize:D,partial:!0},T,R)(n):(e.enter("htmlFlowData"),F(n))}function D(e,n,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),r};function r(e){return a.parser.lazy[a.now().line]?t(e):n(e)}}function z(n){return 45===n?(e.consume(n),I):F(n)}function L(n){return 47===n?(e.consume(n),o="",O):F(n)}function O(n){return 62===n&&Le.includes(o.toLowerCase())?(e.consume(n),M):(0,Y.jv)(n)&&o.length<8?(e.consume(n),o+=String.fromCharCode(n),O):F(n)}function P(n){return 93===n?(e.consume(n),I):F(n)}function I(n){return 62===n?(e.consume(n),M):45===n&&2===r?(e.consume(n),I):F(n)}function M(n){return null===n||(0,Y.Ch)(n)?(e.exit("htmlFlowData"),R(n)):(e.consume(n),M)}function R(t){return e.exit("htmlFlow"),n(t)}},resolveTo:function(e){var n=e.length;for(;n--&&("enter"!==e[n][0]||"htmlFlow"!==e[n][1].type););n>1&&"linePrefix"===e[n-2][1].type&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2));return e},concrete:!0},Pe={tokenize:function(e,n,t){return function(r){return e.exit("htmlFlowData"),e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),e.attempt(G.w,n,t)}},partial:!0};var Ie={name:"codeFenced",tokenize:function(e,n,t){var r,i=this,o={tokenize:function(e,n,t){var i=0;return(0,W.f)(e,o,"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function o(n){return e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(n)}function l(n){return n===r?(e.consume(n),i++,l):i1&&e[s][1].end.offset-e[s][1].start.offset>1?2:1;var f=Object.assign({},e[t][1].end),p=Object.assign({},e[s][1].start);$e(f,-u),$e(p,u),o={type:u>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[t][1].end)},l={type:u>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[s][1].start),end:p},i={type:u>1?"strongText":"emphasisText",start:Object.assign({},e[t][1].end),end:Object.assign({},e[s][1].start)},r={type:u>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},l.end)},e[t][1].end=Object.assign({},o.start),e[s][1].start=Object.assign({},l.end),a=[],e[t][1].end.offset-e[t][1].start.offset&&(a=(0,X.V)(a,[["enter",e[t][1],n],["exit",e[t][1],n]])),a=(0,X.V)(a,[["enter",r,n],["enter",o,n],["exit",o,n],["enter",i,n]]),a=(0,X.V)(a,(0,fe.C)(n.parser.constructs.insideSpan.null,e.slice(t+1,s),n)),a=(0,X.V)(a,[["exit",i,n],["enter",l,n],["exit",l,n],["exit",r,n]]),e[s][1].end.offset-e[s][1].start.offset?(c=2,a=(0,X.V)(a,[["enter",e[s][1],n],["exit",e[s][1],n]])):c=0,(0,X.d)(e,t-1,s-t+3,a),s=t+a.length-c-2;break}s=-1;for(;++s0&&void 0!==arguments[0]?arguments[0]:{},n=yn({transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(oe),autolinkProtocol:D,autolinkEmail:D,atxHeading:a(ne),blockQuote:a(X),characterEscape:D,characterReference:D,codeFenced:a(K),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:a(K,c),codeText:a(J,c),codeTextData:D,data:D,codeFlowValue:D,definition:a(G),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:a(ee),hardBreakEscape:a(te),hardBreakTrailing:a(te),htmlFlow:a(re,c),htmlFlowData:D,htmlText:a(re,c),htmlTextData:D,image:a(ie),label:c,link:a(oe),listItem:a(ue),listItemValue:m,listOrdered:a(le,g),listUnordered:a(le),paragraph:a(ae),reference:V,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:a(ne),strong:a(ce),thematicBreak:a(fe)},exit:{atxHeading:f(),atxHeadingSequence:A,autolink:f(),autolinkEmail:Q,autolinkProtocol:Y,blockQuote:f(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:W,codeFenced:f(x),codeFencedFence:k,codeFencedFenceInfo:v,codeFencedFenceMeta:y,codeFlowValue:z,codeIndented:f(b),codeText:f(M),codeTextData:z,data:z,definition:f(),definitionDestinationString:S,definitionLabelString:C,definitionTitleString:w,emphasis:f(),hardBreakEscape:f(O),hardBreakTrailing:f(O),htmlFlow:f(P),htmlFlowData:z,htmlText:f(I),htmlTextData:z,image:f(j),label:_,labelText:B,lineEnding:L,link:f(R),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:q,resourceDestinationString:Z,resourceTitleString:H,resource:N,setextHeading:f(T),setextHeadingLineSequence:E,setextHeadingText:F,strong:f(),thematicBreak:f()}},e.mdastExtensions||[]),t={};return r;function r(e){for(var t={type:"root",children:[]},r=[],a=[],f={stack:[t],tokenStack:r,config:n,enter:s,exit:p,buffer:c,resume:d,setData:o,getData:l},h=-1;++h0){var m=r[r.length-1];(m[1]||xn).call(f,void 0,m[0])}for(t.position={start:u(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:u(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},h=-1;++h0&&void 0!==arguments[0]?arguments[0]:{},n=(0,$.W)([r].concat(e.extensions||[])),t={defined:[],lazy:{},constructs:n,content:i(Q),document:i(K),flow:i(ie),string:i(le),text:i(ue)};return t;function i(e){return function(n){return pe(t,e,n)}}}(t).document().write(function(){var e,n=1,t="",r=!0;return function(i,o,l){var u,a,c,s,f,p=[];for(i=t+i.toString(o),c=0,t="",r&&(65279===i.charCodeAt(0)&&c++,r=void 0);c-1?t.offset:null}}}var Tn={}.hasOwnProperty;function Dn(e){return String(e||"").toUpperCase()}var zn={}.hasOwnProperty;function Ln(e,n){var t=n.data||{};return"value"in n&&!(zn.call(t,"hName")||zn.call(t,"hProperties")||zn.call(t,"hChildren"))?e.augment(n,Cn("text",n.value)):e(n,"div",In(e,n))}function On(e,n,t){var r,i=n&&n.type;if(!i)throw new Error("Expected node, got `"+n+"`");return("function"===typeof(r=zn.call(e.handlers,i)?e.handlers[i]:e.passThrough&&e.passThrough.includes(i)?Pn:e.unknownHandler)?r:Ln)(e,n,t)}function Pn(e,n){return"children"in n?(0,o.Z)((0,o.Z)({},n),{},{children:In(e,n)}):n}function In(e,n){var t=[];if("children"in n)for(var r=n.children,i=-1;++i55295&&o<57344){var u=e.charCodeAt(t+1);o<56320&&u>56319&&u<57344?(l=String.fromCharCode(o,u),i=1):l="\ufffd"}else l=String.fromCharCode(o);l&&(n.push(e.slice(r,t),encodeURIComponent(l)),r=t+i+1,l=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function Rn(e,n){var t=[],r=-1;for(n&&t.push(Cn("text","\n"));++r0&&t.push(Cn("text","\n")),t}function jn(e,n){var t,r=String(n.identifier),i=Mn(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);-1===o?(e.footnoteOrder.push(r),e.footnoteCounts[r]=1,t=e.footnoteOrder.length):(e.footnoteCounts[r]++,t=o+1);var l=e.footnoteCounts[r];return e(n,"sup",[e(n.position,"a",{href:"#"+e.clobberPrefix+"fn-"+i,id:e.clobberPrefix+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:"footnote-label"},[Cn("text",String(t))])])}function Bn(e,n){var t=n.referenceType,r="]";if("collapsed"===t?r+="[]":"full"===t&&(r+="["+(n.label||n.identifier)+"]"),"imageReference"===n.type)return Cn("text","!["+n.alt+r);var i=In(e,n),o=i[0];o&&"text"===o.type?o.value="["+o.value:i.unshift(Cn("text","["));var l=i[i.length-1];return l&&"text"===l.type?l.value+=r:i.push(Cn("text",r)),i}function _n(e){var n=e.spread;return void 0===n||null===n?e.children.length>1:n}function Zn(e,n,t){var r=0,i=e.length;if(n)for(var o=e.codePointAt(r);9===o||32===o;)r++,o=e.codePointAt(r);if(t)for(var l=e.codePointAt(i-1);9===l||32===l;)i--,l=e.codePointAt(i-1);return i>r?e.slice(r,i):""}var Hn={blockquote:function(e,n){return e(n,"blockquote",Rn(In(e,n),!0))},break:function(e,n){return[e(n,"br"),Cn("text","\n")]},code:function(e,n){var t=n.value?n.value+"\n":"",r=n.lang&&n.lang.match(/^[^ \t]+(?=[ \t]|$)/),i={};r&&(i.className=["language-"+r]);var o=e(n,"code",i,[Cn("text",t)]);return n.meta&&(o.data={meta:n.meta}),e(n.position,"pre",[o])},delete:function(e,n){return e(n,"del",In(e,n))},emphasis:function(e,n){return e(n,"em",In(e,n))},footnoteReference:jn,footnote:function(e,n){for(var t=e.footnoteById,r=1;r in t;)r++;var i=String(r);return t[i]={type:"footnoteDefinition",identifier:i,children:[{type:"paragraph",children:n.children}],position:n.position},jn(e,{type:"footnoteReference",identifier:i,position:n.position})},heading:function(e,n){return e(n,"h"+n.depth,In(e,n))},html:function(e,n){return e.dangerous?e.augment(n,Cn("raw",n.value)):null},imageReference:function(e,n){var t=e.definition(n.identifier);if(!t)return Bn(e,n);var r={src:Mn(t.url||""),alt:n.alt};return null!==t.title&&void 0!==t.title&&(r.title=t.title),e(n,"img",r)},image:function(e,n){var t={src:Mn(n.url),alt:n.alt};return null!==n.title&&void 0!==n.title&&(t.title=n.title),e(n,"img",t)},inlineCode:function(e,n){return e(n,"code",[Cn("text",n.value.replace(/\r?\n|\r/g," "))])},linkReference:function(e,n){var t=e.definition(n.identifier);if(!t)return Bn(e,n);var r={href:Mn(t.url||"")};return null!==t.title&&void 0!==t.title&&(r.title=t.title),e(n,"a",r,In(e,n))},link:function(e,n){var t={href:Mn(n.url)};return null!==n.title&&void 0!==n.title&&(t.title=n.title),e(n,"a",t,In(e,n))},listItem:function(e,n,t){var r,i=In(e,n),o=t?function(e){var n=e.spread,t=e.children,r=-1;for(;!n&&++r0&&r.children.unshift(Cn("text"," ")),r.children.unshift(e(null,"input",{type:"checkbox",checked:n.checked,disabled:!0})),l.className=["task-list-item"]);for(var c=-1;++c0,!0),r[0]),i=r.index+r[0].length,r=t.exec(n);return o.push(Zn(n.slice(i),i>0,!1)),o.join("")}(String(n.value))))},thematicBreak:function(e,n){return e(n,"hr")},toml:Nn,yaml:Nn,definition:Nn,footnoteDefinition:Nn};function Nn(){return null}var Un={}.hasOwnProperty;function Vn(e,n){var t=n||{},r=t.allowDangerousHtml||!1,i={};return u.dangerous=r,u.clobberPrefix=void 0===t.clobberPrefix||null===t.clobberPrefix?"user-content-":t.clobberPrefix,u.footnoteLabel=t.footnoteLabel||"Footnotes",u.footnoteLabelTagName=t.footnoteLabelTagName||"h2",u.footnoteLabelProperties=t.footnoteLabelProperties||{className:["sr-only"]},u.footnoteBackLabel=t.footnoteBackLabel||"Back to content",u.definition=function(e){var n=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Sn(e,"definition",(function(e){var t=Dn(e.identifier);t&&!Tn.call(n,t)&&(n[t]=e)})),function(e){var t=Dn(e);return t&&Tn.call(n,t)?n[t]:null}}(e),u.footnoteById=i,u.footnoteOrder=[],u.footnoteCounts={},u.augment=l,u.handlers=(0,o.Z)((0,o.Z)({},Hn),t.handlers),u.unknownHandler=t.unknownHandler,u.passThrough=t.passThrough,Sn(e,"footnoteDefinition",(function(e){var n=String(e.identifier).toUpperCase();Un.call(i,n)||(i[n]=e)})),u;function l(e,n){if(e&&"data"in e&&e.data){var t=e.data;t.hName&&("element"!==n.type&&(n={type:"element",tagName:"",properties:{},children:[]}),n.tagName=t.hName),"element"===n.type&&t.hProperties&&(n.properties=(0,o.Z)((0,o.Z)({},n.properties),t.hProperties)),"children"in n&&n.children&&t.hChildren&&(n.children=t.hChildren)}if(e){var r="type"in e?e:{position:e};(i=r)&&i.position&&i.position.start&&i.position.start.line&&i.position.start.column&&i.position.end&&i.position.end.line&&i.position.end.column&&(n.position={start:An(r),end:Fn(r)})}var i;return n}function u(e,n,t,r){return Array.isArray(t)&&(r=t,t={}),l(e,{type:"element",tagName:n,properties:t||{},children:r||[]})}}function qn(e,n){var t=Vn(e,n),r=On(t,e,null),i=function(e){for(var n=-1,t=[];++n1?"-"+a:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:e.footnoteBackLabel},children:[{type:"text",value:"\u21a9"}]};a>1&&s.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(a)}]}),c.length>0&&c.push({type:"text",value:" "}),c.push(s)}var f=i[i.length-1];if(f&&"element"===f.type&&"p"===f.tagName){var p,h=f.children[f.children.length-1];h&&"text"===h.type?h.value+=" ":f.children.push({type:"text",value:" "}),(p=f.children).push.apply(p,c)}else i.push.apply(i,c);var d={type:"element",tagName:"li",properties:{id:e.clobberPrefix+"fn-"+u},children:Rn(i,!0)};r.position&&(d.position=r.position),t.push(d)}}return 0===t.length?null:{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:e.footnoteLabelTagName,properties:(0,o.Z)((0,o.Z)({},JSON.parse(JSON.stringify(e.footnoteLabelProperties))),{},{id:"footnote-label"}),children:[Cn("text",e.footnoteLabel)]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:Rn(t,!0)},{type:"text",value:"\n"}]}}(t);return i&&r.children.push(Cn("text","\n"),i),Array.isArray(r)?{type:"root",children:r}:r}var $n=function(e,n){return e&&"run"in e?function(e,n){return function(t,r,i){e.run(qn(t,n),r,(function(e){i(e)}))}}(e,n):function(e){return function(n){return qn(n,e)}}(e||n)};var Wn=t(7630),Yn=(0,c.Z)((function e(n,t,r){(0,a.Z)(this,e),this.property=n,this.normal=t,r&&(this.space=r)}));function Qn(e,n){for(var t={},r={},i=-1;++i0?l.createElement(d,c,f):l.createElement(d,c)}function Bt(e,n){for(var t=-1,r=0;++t4&&"data"===t.slice(0,4)&&Et.test(n)){if("-"===n.charAt(4)){var o=n.slice(5).replace(Tt,Lt);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{var l=n.slice(4);if(!Tt.test(l)){var u=l.replace(Dt,zt);"-"!==u.charAt(0)&&(u="-"+u),n="data"+u}}i=ct}return new i(r,n)}(r.schema,n),o=t;null!==o&&void 0!==o&&o===o&&(Array.isArray(o)&&(o=i.commaSeparated?function(e,n){var t=n||{};return(""===e[e.length-1]?[].concat((0,u.Z)(e),[""]):e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(o):o.join(" ").trim()),"style"===i.property&&"string"===typeof o&&(o=function(e){var n={};try{Pt(e,t)}catch(r){}return n;function t(e,t){var r="-ms-"===e.slice(0,4)?"ms-".concat(e.slice(4)):e;n[r.replace(/-([a-z])/g,Zt)]=t}}(o)),i.space&&i.property?e[It.call(Ot,i.property)?Ot[i.property]:i.property]=o:i.attribute&&(e[i.attribute]=o))}function Zt(e,n){return n.toUpperCase()}var Ht={}.hasOwnProperty,Nt={plugins:{to:"plugins",id:"change-plugins-to-remarkplugins"},renderers:{to:"components",id:"change-renderers-to-components"},astPlugins:{id:"remove-buggy-html-in-markdown-parser"},allowDangerousHtml:{id:"remove-buggy-html-in-markdown-parser"},escapeHtml:{id:"remove-buggy-html-in-markdown-parser"},source:{to:"children",id:"change-source-to-children"},allowNode:{to:"allowElement",id:"replace-allownode-allowedtypes-and-disallowedtypes"},allowedTypes:{to:"allowedElements",id:"replace-allownode-allowedtypes-and-disallowedtypes"},disallowedTypes:{to:"disallowedElements",id:"replace-allownode-allowedtypes-and-disallowedtypes"},includeNodeIndex:{to:"includeElementIndex",id:"change-includenodeindex-to-includeelementindex"}};function Ut(e){for(var n in Nt)if(Ht.call(Nt,n)&&Ht.call(e,n)){var t=Nt[n];console.warn("[react-markdown] Warning: please ".concat(t.to?"use `".concat(t.to,"` instead of"):"remove"," `").concat(n,"` (see <").concat("https://github.com/remarkjs/react-markdown/blob/main/changelog.md","#").concat(t.id,"> for more info)")),delete Nt[n]}var r=I().use(bn).use(e.remarkPlugins||[]).use($n,(0,o.Z)((0,o.Z)({},e.remarkRehypeOptions),{},{allowDangerousHtml:!0})).use(e.rehypePlugins||[]).use(wt,e),i=new A;"string"===typeof e.children?i.value=e.children:void 0!==e.children&&null!==e.children&&console.warn("[react-markdown] Warning: please pass a string as `children` (not: `".concat(e.children,"`)"));var u=r.runSync(r.parse(i),i);if("root"!==u.type)throw new TypeError("Expected a `root` node");var a=l.createElement(l.Fragment,{},Rt({options:e,schema:bt,listDepth:0},u));return e.className&&(a=l.createElement("div",{className:e.className},a)),a}Ut.defaultProps={transformLinkUri:St.A},Ut.propTypes={children:Wn.string,className:Wn.string,allowElement:Wn.func,allowedElements:Wn.arrayOf(Wn.string),disallowedElements:Wn.arrayOf(Wn.string),unwrapDisallowed:Wn.bool,remarkPlugins:Wn.arrayOf(Wn.oneOfType([Wn.object,Wn.func,Wn.arrayOf(Wn.oneOfType([Wn.bool,Wn.string,Wn.object,Wn.func,Wn.arrayOf(Wn.any)]))])),rehypePlugins:Wn.arrayOf(Wn.oneOfType([Wn.object,Wn.func,Wn.arrayOf(Wn.oneOfType([Wn.bool,Wn.string,Wn.object,Wn.func,Wn.arrayOf(Wn.any)]))])),sourcePos:Wn.bool,rawSourcePos:Wn.bool,skipHtml:Wn.bool,includeElementIndex:Wn.bool,transformLinkUri:Wn.oneOfType([Wn.func,Wn.bool]),linkTarget:Wn.oneOfType([Wn.func,Wn.string]),transformImageUri:Wn.func,components:Wn.object}},6776:function(e,n,t){"use strict";t.d(n,{A:function(){return i}});var r=["http","https","mailto","tel"];function i(e){var n=(e||"").trim(),t=n.charAt(0);if("#"===t||"/"===t)return n;var i=n.indexOf(":");if(-1===i)return n;for(var o=-1;++oo||-1!==(o=n.indexOf("#"))&&i>o?n:"javascript:void(0)"}},3102:function(e,n,t){"use strict";t.d(n,{Z:function(){return Ze}});for(var r=t(5152),i=t(1964),o={tokenize:function(e,n,t){return function(n){return e.consume(n),r};function r(n){return 87===n||119===n?(e.consume(n),o):t(n)}function o(n){return 87===n||119===n?(e.consume(n),l):t(n)}function l(n){return 46===n?(e.consume(n),u):t(n)}function u(e){return null===e||(0,i.Ch)(e)?t(e):n(e)}},partial:!0},l={tokenize:function(e,n,t){var r,o;return l;function l(n){return 38===n?e.check(c,s,u)(n):46===n||95===n?e.check(a,s,u)(n):null===n||(0,i.Av)(n)||(0,i.B8)(n)||45!==n&&(0,i.Xh)(n)?s(n):(e.consume(n),l)}function u(n){return 46===n?(o=r,r=void 0,e.consume(n),l):(95===n&&(r=!0),e.consume(n),l)}function s(e){return o||r?t(e):n(e)}},partial:!0},u={tokenize:function(e,n){var t=0;return r;function r(l){return 38===l?e.check(c,n,i)(l):(40===l&&t++,41===l?e.check(a,o,i)(l):v(l)?n(l):m(l)?e.check(a,n,i)(l):(e.consume(l),r))}function i(n){return e.consume(n),r}function o(e){return--t<0?n(e):i(e)}},partial:!0},a={tokenize:function(e,n,t){return function(n){return e.consume(n),r};function r(i){return m(i)?(e.consume(i),r):v(i)?n(i):t(i)}},partial:!0},c={tokenize:function(e,n,t){return function(n){return e.consume(n),r};function r(n){return(0,i.jv)(n)?(e.consume(n),r):59===n?(e.consume(n),o):t(n)}function o(e){return v(e)?n(e):t(e)}},partial:!0},s={tokenize:function(e,n,t){var r=this;return function(n){if(87!==n&&119!==n||!k(r.previous)||C(r.events))return t(n);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(o,e.attempt(l,e.attempt(u,i),t),t)(n)};function i(t){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(t)}},previous:k},f={tokenize:function(e,n,t){var r=this;return function(n){if(72!==n&&104!==n||!x(r.previous)||C(r.events))return t(n);return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),e.consume(n),o};function o(n){return 84===n||116===n?(e.consume(n),a):t(n)}function a(n){return 84===n||116===n?(e.consume(n),c):t(n)}function c(n){return 80===n||112===n?(e.consume(n),s):t(n)}function s(n){return 83===n||115===n?(e.consume(n),f):f(n)}function f(n){return 58===n?(e.consume(n),p):t(n)}function p(n){return 47===n?(e.consume(n),h):t(n)}function h(n){return 47===n?(e.consume(n),d):t(n)}function d(n){return null===n||(0,i.Av)(n)||(0,i.B8)(n)||(0,i.Xh)(n)?t(n):e.attempt(l,e.attempt(u,g),t)(n)}function g(t){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(t)}},previous:x},p={tokenize:function(e,n,t){var r,o,l=this;return function(n){if(!y(n)||!b(l.previous)||C(l.events))return t(n);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(n)};function u(n){return y(n)?(e.consume(n),u):64===n?(e.consume(n),c):t(n)}function c(n){return 46===n?e.check(a,h,s)(n):45===n||95===n?e.check(a,t,f)(n):(0,i.H$)(n)?(!o&&(0,i.pY)(n)&&(o=!0),e.consume(n),c):h(n)}function s(n){return e.consume(n),r=!0,o=void 0,c}function f(n){return e.consume(n),p}function p(n){return 46===n?e.check(a,t,s)(n):c(n)}function h(i){return r&&!o?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(i)):t(i)}},previous:b},h={},d={text:h},g=48;g<123;)h[g]=p,58===++g?g=65:91===g&&(g=97);function m(e){return 33===e||34===e||39===e||41===e||42===e||44===e||46===e||58===e||59===e||60===e||63===e||95===e||126===e}function v(e){return null===e||60===e||(0,i.z3)(e)}function y(e){return 43===e||45===e||46===e||95===e||(0,i.H$)(e)}function k(e){return null===e||40===e||42===e||95===e||126===e||(0,i.z3)(e)}function x(e){return null===e||!(0,i.jv)(e)}function b(e){return 47!==e&&x(e)}function C(e){for(var n=e.length,t=!1;n--;){var r=e[n][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){t=!0;break}if(r._gfmAutolinkLiteralWalkedInto){t=!1;break}}return e.length>0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}h[43]=p,h[45]=p,h[46]=p,h[95]=p,h[72]=[p,f],h[104]=[p,f],h[87]=[p,s],h[119]=[p,s];var w=t(4649),S=t(6848),A=t(5561),F=t(7184),E={tokenize:function(e,n,t){var r=this;return(0,A.f)(e,(function(e){var i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?n(e):t(e)}),"gfmFootnoteDefinitionIndent",5)},partial:!0};function T(){var e;return{document:(0,w.Z)({},91,{tokenize:O,continuation:{tokenize:P},exit:I}),text:(e={},(0,w.Z)(e,91,{tokenize:L}),(0,w.Z)(e,93,{add:"after",tokenize:D,resolveTo:z}),e)}}function D(e,n,t){for(var r,i=this,o=i.events.length,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);o--;){var u=i.events[o][1];if("labelImage"===u.type){r=u;break}if("gfmFootnoteCall"===u.type||"labelLink"===u.type||"label"===u.type||"image"===u.type||"link"===u.type)break}return function(o){if(!r||!r._balanced)return t(o);var u=(0,F.d)(i.sliceSerialize({start:r.end,end:i.now()}));if(94!==u.charCodeAt(0)||!l.includes(u.slice(1)))return t(o);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),n(o)}}function z(e,n){for(var t=e.length;t--;)if("labelImage"===e[t][1].type&&"enter"===e[t][0]){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";var r={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;var o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[t+1],e[t+2],["enter",r,n],e[t+3],e[t+4],["enter",i,n],["exit",i,n],["enter",o,n],["enter",l,n],["exit",l,n],["exit",o,n],e[e.length-2],e[e.length-1],["exit",r,n]];return e.splice.apply(e,[t,e.length-t+1].concat(u)),e}function L(e,n,t){var r,o=this,l=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),u=0;return function(n){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(n),e.exit("gfmFootnoteCallLabelMarker"),a};function a(n){return 94!==n?t(n):(e.enter("gfmFootnoteCallMarker"),e.consume(n),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(a){var f;return null===a||91===a||u++>999?t(a):93===a?r?(e.exit("chunkString"),f=e.exit("gfmFootnoteCallString"),l.includes((0,F.d)(o.sliceSerialize(f)))?function(t){return e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n}(a):t(a)):t(a):(e.consume(a),(0,i.z3)(a)||(r=!0),92===a?s:c)}function s(n){return 91===n||92===n||93===n?(e.consume(n),u++,c):c(n)}}function O(e,n,t){var r,o,l=this,u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]),a=0;return function(n){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(n),e.exit("gfmFootnoteDefinitionLabelMarker"),c};function c(n){return 94===n?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(n),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),s):t(n)}function s(n){var u;return null===n||91===n||a>999?t(n):93===n?o?(u=e.exit("gfmFootnoteDefinitionLabelString"),r=(0,F.d)(l.sliceSerialize(u)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(n),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h):t(n):(0,i.Ch)(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),a++,s):(e.enter("chunkString").contentType="string",f(n))}function f(n){return null===n||(0,i.Ch)(n)||91===n||93===n||a>999?(e.exit("chunkString"),s(n)):((0,i.z3)(n)||(o=!0),a++,e.consume(n),92===n?p:f)}function p(n){return 91===n||92===n||93===n?(e.consume(n),a++,f):f(n)}function h(n){return 58===n?(e.enter("definitionMarker"),e.consume(n),e.exit("definitionMarker"),(0,A.f)(e,d,"gfmFootnoteDefinitionWhitespace")):t(n)}function d(e){return u.includes(r)||u.push(r),n(e)}}function P(e,n,t){return e.check(S.w,n,e.attempt(E,n,t))}function I(e){e.exit("gfmFootnoteDefinition")}var M=t(4115),R=t(762),j=t(2771);function B(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.singleTilde,t={tokenize:i,resolveAll:r};return null!==n&&void 0!==n||(n=!0),{text:(0,w.Z)({},126,t),insideSpan:{null:[t]},attentionMarkers:{null:[126]}};function r(e,n){for(var t=-1;++t1?r(o):(e.consume(o),l++,u);if(l<2&&!n)return r(o);var c=e.exit("strikethroughSequenceTemporary"),s=(0,R.r)(o);return c._open=!s||2===s&&Boolean(a),c._close=!a||2===a&&Boolean(s),t(o)}}}var _={flow:{null:{tokenize:function(e,n,t){var r,o,l=this,u=[],a=0;return function(n){if(e.enter("table")._align=u,e.enter("tableHead"),e.enter("tableRow"),124===n)return c(n);return a++,e.enter("temporaryTableCellContent"),p(n)};function c(n){return e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),r=!0,s}function s(n){return null===n||(0,i.Ch)(n)?function(n){if(null===n)return t(n);e.exit("tableRow"),e.exit("tableHead");var r=l.interrupt;return l.interrupt=!0,e.attempt({tokenize:z,partial:!0},(function(n){return l.interrupt=r,e.enter("tableDelimiterRow"),d(n)}),(function(e){return l.interrupt=r,t(e)}))(n)}(n):(0,i.xz)(n)?(e.enter("whitespace"),e.consume(n),f):(r&&(r=void 0,a++),124===n?c(n):(e.enter("temporaryTableCellContent"),p(n)))}function f(n){return(0,i.xz)(n)?(e.consume(n),f):(e.exit("whitespace"),s(n))}function p(n){return null===n||124===n||(0,i.z3)(n)?(e.exit("temporaryTableCellContent"),s(n)):(e.consume(n),92===n?h:p)}function h(n){return 92===n||124===n?(e.consume(n),p):p(n)}function d(n){return null===n||(0,i.Ch)(n)?k(n):(0,i.xz)(n)?(e.enter("whitespace"),e.consume(n),g):45===n?(e.enter("tableDelimiterFiller"),e.consume(n),o=!0,u.push("none"),m):58===n?(e.enter("tableDelimiterAlignment"),e.consume(n),e.exit("tableDelimiterAlignment"),u.push("left"),v):124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),d):t(n)}function g(n){return(0,i.xz)(n)?(e.consume(n),g):(e.exit("whitespace"),d(n))}function m(n){return 45===n?(e.consume(n),m):(e.exit("tableDelimiterFiller"),58===n?(e.enter("tableDelimiterAlignment"),e.consume(n),e.exit("tableDelimiterAlignment"),u[u.length-1]="left"===u[u.length-1]?"center":"right",y):d(n))}function v(n){return 45===n?(e.enter("tableDelimiterFiller"),e.consume(n),o=!0,m):t(n)}function y(n){return null===n||(0,i.Ch)(n)?k(n):(0,i.xz)(n)?(e.enter("whitespace"),e.consume(n),g):124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),d):t(n)}function k(n){return e.exit("tableDelimiterRow"),o&&a===u.length?null===n?x(n):e.check(Z,x,e.attempt({tokenize:z,partial:!0},(0,A.f)(e,b,"linePrefix",4),x))(n):t(n)}function x(t){return e.exit("table"),n(t)}function b(n){return e.enter("tableBody"),C(n)}function C(n){return e.enter("tableRow"),124===n?w(n):(e.enter("temporaryTableCellContent"),E(n))}function w(n){return e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),S}function S(n){return null===n||(0,i.Ch)(n)?function(n){if(e.exit("tableRow"),null===n)return D(n);return e.check(Z,D,e.attempt({tokenize:z,partial:!0},(0,A.f)(e,C,"linePrefix",4),D))(n)}(n):(0,i.xz)(n)?(e.enter("whitespace"),e.consume(n),F):124===n?w(n):(e.enter("temporaryTableCellContent"),E(n))}function F(n){return(0,i.xz)(n)?(e.consume(n),F):(e.exit("whitespace"),S(n))}function E(n){return null===n||124===n||(0,i.z3)(n)?(e.exit("temporaryTableCellContent"),S(n)):(e.consume(n),92===n?T:E)}function T(n){return 92===n||124===n?(e.consume(n),E):E(n)}function D(n){return e.exit("tableBody"),x(n)}function z(e,n,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,A.f)(e,r,"linePrefix")};function r(r){if(l.parser.lazy[l.now().line]||null===r||(0,i.Ch)(r))return t(r);var o=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(r):(l._gfmTableDynamicInterruptHack=!0,e.check(l.parser.constructs.flow,(function(e){return l._gfmTableDynamicInterruptHack=!1,t(e)}),(function(e){return l._gfmTableDynamicInterruptHack=!1,n(e)}))(r))}}},resolve:function(e,n){var t,r,i,o,l,u,a,c=-1;for(;++c0?{type:"text",value:d}:void 0),!1!==d){var g;if(l!==t&&f.push({type:"text",value:e.value.slice(l,t)}),Array.isArray(d))(g=f).push.apply(g,(0,$.Z)(d));else d&&f.push(d);l=t+p[0].length,s=!0}if(!i.global)break;p=i.exec(e.value)}if(s){var m;l?\]}]+$/.exec(e);if(o)for(e=e.slice(0,o.index),n=(i=o[0]).indexOf(")"),t=q(e,"("),r=q(e,")");-1!==n&&t>r;)e+=i.slice(0,n+1),n=(i=i.slice(n+1)).indexOf(")"),r++;return[e,i]}(t+r);if(!l[0])return!1;var u={type:"link",title:null,url:o+n+l[0],children:[{type:"text",value:n+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function oe(e,n,t,r){return!(!le(r,!0)||/[_-\d]$/.test(t))&&{type:"link",title:null,url:"mailto:"+n+"@"+t,children:[{type:"text",value:n+"@"+t}]}}function le(e,n){var t=e.input.charCodeAt(e.index-1);return(0===e.index||(0,i.B8)(t)||(0,i.Xh)(t))&&(!n||47!==t)}var ue=t(189),ae=t(1522);function ce(e){return e.label||!e.identifier?e.label||"":(0,ae.v)(e.identifier)}function se(e){var n=e||{},t=n.now||{},r=n.lineShift||0,i=t.line||1,o=t.column||1;return{move:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=e.split(/\r?\n|\r/g),t=n[n.length-1];return i+=n.length-1,o=1===n.length?o+t.length:1+t.length+r,e},current:function(){return{now:{line:i,column:o},lineShift:r}},shift:function(e){r+=e}}}function fe(e,n,t){var r=n.indexStack,i=e.children||[],o=se(t),l=[],u=-1;for(r.push(-1);++u=g||(m+10?" ":"")),i.shift(4),o+=i.move(he(fe(e,t,i.current()),(function(e,n,t){if(n)return(t?"":" ")+e;return e}))),l(),o},footnoteReference:e}};function e(e,n,t,r){var i=se(r),o=i.move("[^"),l=t.enter("footnoteReference"),u=t.enter("reference");return o+=i.move(ve(t,ce(e),(0,ue.Z)((0,ue.Z)({},i.current()),{},{before:o,after:"]"}))),u(),l(),o+=i.move("]")}}function be(e,n,t){var r=n.indexStack,i=e.children||[],o=[],l=-1,u=t.before;r.push(-1);for(var a=se(t);++l0&&("\r"===u||"\n"===u)&&"html"===c.type&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),u=" ",(a=se(t)).move(o.join(""))),o.push(a.move(n.handle(c,e,n,(0,ue.Z)((0,ue.Z)({},a.current()),{},{before:u,after:s})))),u=o[o.length-1].slice(-1)}return r.pop(),o.join("")}var Ce={canContainEols:["delete"],enter:{strikethrough:function(e){this.enter({type:"delete",children:[]},e)}},exit:{strikethrough:function(e){this.exit(e)}}},we={unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"]}],handlers:{delete:Se}};function Se(e,n,t,r){var i=se(r),o=t.enter("emphasis"),l=i.move("~~");return l+=be(e,t,(0,ue.Z)((0,ue.Z)({},i.current()),{},{before:l,after:"~"})),l+=i.move("~~"),o(),l}function Ae(e,n,t){for(var r=e.value||"",i="`",o=-1;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o1&&void 0!==arguments[1]?arguments[1]:{},t=(n.align||[]).concat(),r=n.stringLength||Ee,i=[],o=[],l=[],u=[],a=0,c=-1;++ca&&(a=e[c].length);++pu[p])&&(u[p]=d)}s.push(h)}o[c]=s,l[c]=f}var g=-1;if("object"===typeof t&&"length"in t)for(;++gu[g]&&(u[g]=C),y[g]=C),v[g]=w}o.splice(1,0,v),l.splice(1,0,y),c=-1;for(var S=[];++c-1?n.start:1)+(!1===t.options.incrementListMarker?0:n.children.indexOf(e))+o);var l=o.length+1;("tab"===i||"mixed"===i&&(n&&"list"===n.type&&n.spread||e.spread))&&(l=4*Math.ceil(l/4));var u=se(r);u.move(o+" ".repeat(l-o.length)),u.shift(l);var a=t.enter("listItem"),c=he(fe(e,t,u.current()),(function(e,n,t){if(n)return(t?"":" ".repeat(l))+e;return(t?o:o+" ".repeat(l-o.length))+e}));return a(),c}var Me={exit:{taskListCheckValueChecked:je,taskListCheckValueUnchecked:je,paragraph:function(e){var n,t=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1],i=t.children,o=r.children[0],l=-1;if(t&&"listItem"===t.type&&"boolean"===typeof t.checked&&o&&"text"===o.type){for(;++l0&&void 0!==arguments[0]?arguments[0]:{},n=this.data();function t(e,t){(n[e]?n[e]:n[e]=[]).push(t)}t("micromarkExtensions",V(e)),t("fromMarkdownExtensions",Be()),t("toMarkdownExtensions",_e(e))}},7775:function(e,n,t){"use strict";t.d(n,{O:function(){return r}});var r=function(e){if(void 0===e||null===e)return l;if("string"===typeof e)return function(e){return o(n);function n(n){return n&&n.type===e}}(e);if("object"===typeof e)return Array.isArray(e)?i(e):function(e){return o(n);function n(n){var t;for(t in e)if(n[t]!==e[t])return!1;return!0}}(e);if("function"===typeof e)return o(e);throw new Error("Expected function, string, or object as test")};function i(e){for(var n=[],t=-1;++t":"")+")"}));return f;function f(){var c,s,f,p=[];if((!n||o(r,u,a[a.length-1]||null))&&(p=function(e){if(Array.isArray(e))return e;if("number"===typeof e)return[true,e];return[e]}(t(r,a)),false===p[0]))return p;if(r.children&&"skip"!==p[0])for(s=(i?r.children.length:-1)+l,f=a.concat(r);s>-1&&s + * @license MIT + */ + +/** + * @license React + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ diff --git a/web/build/static/js/813.65f1d443.chunk.js.map b/web/build/static/js/813.65f1d443.chunk.js.map new file mode 100644 index 000000000..2e9a9748c --- /dev/null +++ b/web/build/static/js/813.65f1d443.chunk.js.map @@ -0,0 +1 @@ +{"version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,EAAMkJ,EAAOklB,GAG5B,IAEI7wB,EAFEG,EAAwB,kBAATsC,GAA8B,OAATA,EAAgBA,EAAO,CAAC,EAIxC,kBAAftC,EAAMgE,OACfnE,EAC2B,kBAAlBG,EAAM2iB,QACT3iB,EAAM2iB,QACgB,kBAAf3iB,EAAMH,KACbG,EAAMH,UACNgM,EAENrN,OAAOK,eAAeyxB,EAAO,OAAQ,CACnCtwB,MACE,SACMA,EAAMgE,MAAQnE,EAAO,IAAMA,EAAO,IAAM,IAC9C,OAIN,OAAOywB,EAEP,SAASA,IAEP,IAEIu+B,EAEAx2C,EAEAy2C,EANAl/C,EAAS,GAQb,KAAKpF,GAAQy0B,EAAG38B,EAAMkJ,EAAOklB,EAAQA,EAAQ7vB,OAAS,IAAM,SAC1D+O,EAsCZ,SAAkB5P,GAChB,GAAId,MAAMF,QAAQgB,GAChB,OAAOA,EAGT,GAAqB,kBAAVA,EACT,MAAO,CAtIa,KAsIFA,GAGpB,MAAO,CAACA,EACV,CAhDqB+uD,CAASx+B,EAAQjuB,EAAMouB,IAlFxB,QAoFJ9gB,EAAO,IACT,OAAOA,EAKX,GAAItN,EAAK2T,UA9FC,SA8FWrG,EAAO,GAO1B,IALAyI,GAAUmY,EAAUluB,EAAK2T,SAASpV,QAAU,GAAK0mC,EAEjDunB,EAAep+B,EAAQb,OAAOvtB,GAGvB+V,GAAU,GAAKA,EAAS/V,EAAK2T,SAASpV,QAAQ,CAInD,GArGM,SAmGNguD,EAAYr6B,EAAQlyB,EAAK2T,SAASoC,GAASA,EAAQy2C,EAAvCt6B,IAEE,GACZ,OAAOq6B,EAGTx2C,EAC0B,kBAAjBw2C,EAAU,GAAkBA,EAAU,GAAKx2C,EAASkvB,CAC/D,CAGF,OAAO33B,CACT,CACF,CAzEA4kB,CAAQrf,EAAM,KAAM,GAApBqf,EA0EF","sources":["../../node_modules/extend/index.js","../../node_modules/inline-style-parser/index.js","../../node_modules/is-buffer/index.js","../../node_modules/react-markdown/node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-markdown/node_modules/react-is/index.js","../../node_modules/style-to-object/index.js","../../node_modules/decode-named-character-reference/index.dom.js","../../node_modules/micromark-core-commonmark/lib/blank-line.js","../../node_modules/micromark-factory-space/index.js","../../node_modules/micromark-util-character/lib/unicode-punctuation-regex.js","../../node_modules/micromark-util-character/index.js","../../node_modules/micromark-util-chunked/index.js","../../node_modules/micromark-util-classify-character/index.js","../../node_modules/micromark-util-combine-extensions/index.js","../../node_modules/micromark-util-decode-numeric-character-reference/index.js","../../node_modules/micromark-util-decode-string/index.js","../../node_modules/micromark-util-normalize-identifier/index.js","../../node_modules/micromark-util-resolve-all/index.js","../../node_modules/unist-util-stringify-position/index.js","../../node_modules/vfile-message/index.js","../../node_modules/vfile/lib/minpath.browser.js","../../node_modules/vfile/lib/minproc.browser.js","../../node_modules/vfile/lib/minurl.shared.js","../../node_modules/vfile/lib/minurl.browser.js","../../node_modules/vfile/lib/index.js","../../node_modules/bail/index.js","../../node_modules/is-plain-obj/index.js","../../node_modules/trough/index.js","../../node_modules/unified/lib/index.js","../../node_modules/mdast-util-to-string/index.js","../../node_modules/micromark/lib/initialize/content.js","../../node_modules/micromark/lib/initialize/document.js","../../node_modules/micromark-util-subtokenize/index.js","../../node_modules/micromark-core-commonmark/lib/content.js","../../node_modules/micromark/lib/initialize/flow.js","../../node_modules/micromark/lib/initialize/text.js","../../node_modules/micromark/lib/create-tokenizer.js","../../node_modules/micromark-core-commonmark/lib/thematic-break.js","../../node_modules/micromark-core-commonmark/lib/list.js","../../node_modules/micromark-core-commonmark/lib/block-quote.js","../../node_modules/micromark-factory-destination/index.js","../../node_modules/micromark-factory-label/index.js","../../node_modules/micromark-factory-title/index.js","../../node_modules/micromark-factory-whitespace/index.js","../../node_modules/micromark-core-commonmark/lib/definition.js","../../node_modules/micromark-core-commonmark/lib/code-indented.js","../../node_modules/micromark-core-commonmark/lib/heading-atx.js","../../node_modules/micromark-core-commonmark/lib/setext-underline.js","../../node_modules/micromark-util-html-tag-name/index.js","../../node_modules/micromark-core-commonmark/lib/html-flow.js","../../node_modules/micromark-core-commonmark/lib/code-fenced.js","../../node_modules/micromark-core-commonmark/lib/character-reference.js","../../node_modules/micromark-core-commonmark/lib/character-escape.js","../../node_modules/micromark-core-commonmark/lib/line-ending.js","../../node_modules/micromark-core-commonmark/lib/label-end.js","../../node_modules/micromark-core-commonmark/lib/label-start-image.js","../../node_modules/micromark-core-commonmark/lib/attention.js","../../node_modules/micromark-core-commonmark/lib/autolink.js","../../node_modules/micromark-core-commonmark/lib/html-text.js","../../node_modules/micromark-core-commonmark/lib/label-start-link.js","../../node_modules/micromark-core-commonmark/lib/hard-break-escape.js","../../node_modules/micromark-core-commonmark/lib/code-text.js","../../node_modules/micromark/lib/constructs.js","../../node_modules/micromark/lib/preprocess.js","../../node_modules/mdast-util-from-markdown/lib/index.js","../../node_modules/micromark/lib/postprocess.js","../../node_modules/micromark/lib/parse.js","../../node_modules/remark-parse/index.js","../../node_modules/remark-parse/lib/index.js","../../node_modules/unist-builder/index.js","../../node_modules/unist-util-visit/index.js","../../node_modules/unist-util-position/index.js","../../node_modules/mdast-util-definitions/index.js","../../node_modules/mdast-util-to-hast/lib/traverse.js","../../node_modules/micromark-util-sanitize-uri/index.js","../../node_modules/mdast-util-to-hast/lib/wrap.js","../../node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js","../../node_modules/mdast-util-to-hast/lib/revert.js","../../node_modules/mdast-util-to-hast/lib/handlers/list-item.js","../../node_modules/trim-lines/index.js","../../node_modules/mdast-util-to-hast/lib/handlers/index.js","../../node_modules/mdast-util-to-hast/lib/handlers/blockquote.js","../../node_modules/mdast-util-to-hast/lib/handlers/break.js","../../node_modules/mdast-util-to-hast/lib/handlers/code.js","../../node_modules/mdast-util-to-hast/lib/handlers/delete.js","../../node_modules/mdast-util-to-hast/lib/handlers/emphasis.js","../../node_modules/mdast-util-to-hast/lib/handlers/footnote.js","../../node_modules/mdast-util-to-hast/lib/handlers/heading.js","../../node_modules/mdast-util-to-hast/lib/handlers/html.js","../../node_modules/mdast-util-to-hast/lib/handlers/image-reference.js","../../node_modules/mdast-util-to-hast/lib/handlers/image.js","../../node_modules/mdast-util-to-hast/lib/handlers/inline-code.js","../../node_modules/mdast-util-to-hast/lib/handlers/link-reference.js","../../node_modules/mdast-util-to-hast/lib/handlers/link.js","../../node_modules/mdast-util-to-hast/lib/handlers/list.js","../../node_modules/mdast-util-to-hast/lib/handlers/paragraph.js","../../node_modules/mdast-util-to-hast/lib/handlers/root.js","../../node_modules/mdast-util-to-hast/lib/handlers/strong.js","../../node_modules/mdast-util-to-hast/lib/handlers/table.js","../../node_modules/mdast-util-to-hast/lib/handlers/text.js","../../node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js","../../node_modules/mdast-util-to-hast/lib/index.js","../../node_modules/unist-util-generated/index.js","../../node_modules/mdast-util-to-hast/lib/footer.js","../../node_modules/remark-rehype/lib/index.js","../../node_modules/property-information/lib/util/schema.js","../../node_modules/property-information/lib/util/merge.js","../../node_modules/property-information/lib/normalize.js","../../node_modules/property-information/lib/util/info.js","../../node_modules/property-information/lib/util/types.js","../../node_modules/property-information/lib/util/defined-info.js","../../node_modules/property-information/lib/util/create.js","../../node_modules/property-information/lib/xlink.js","../../node_modules/property-information/lib/xml.js","../../node_modules/property-information/lib/util/case-sensitive-transform.js","../../node_modules/property-information/lib/util/case-insensitive-transform.js","../../node_modules/property-information/lib/xmlns.js","../../node_modules/property-information/lib/aria.js","../../node_modules/property-information/lib/html.js","../../node_modules/property-information/lib/svg.js","../../node_modules/property-information/index.js","../../node_modules/react-markdown/lib/rehype-filter.js","../../node_modules/hast-util-whitespace/index.js","../../node_modules/property-information/lib/find.js","../../node_modules/property-information/lib/hast-to-react.js","../../node_modules/react-markdown/lib/ast-to-react.js","../../node_modules/comma-separated-tokens/index.js","../../node_modules/space-separated-tokens/index.js","../../node_modules/react-markdown/lib/react-markdown.js","../../node_modules/react-markdown/lib/uri-transformer.js","../../node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js","../../node_modules/micromark-extension-gfm-footnote/lib/syntax.js","../../node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js","../../node_modules/micromark-extension-gfm-table/lib/syntax.js","../../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js","../../node_modules/micromark-extension-gfm/index.js","../../node_modules/ccount/index.js","../../node_modules/mdast-util-find-and-replace/lib/index.js","../../node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp/index.js","../../node_modules/mdast-util-gfm-autolink-literal/index.js","../../node_modules/mdast-util-to-markdown/lib/util/association.js","../../node_modules/mdast-util-to-markdown/lib/util/track.js","../../node_modules/mdast-util-to-markdown/lib/util/container-flow.js","../../node_modules/mdast-util-to-markdown/lib/util/indent-lines.js","../../node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js","../../node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js","../../node_modules/mdast-util-to-markdown/lib/util/safe.js","../../node_modules/mdast-util-gfm-footnote/index.js","../../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js","../../node_modules/mdast-util-gfm-strikethrough/index.js","../../node_modules/mdast-util-to-markdown/lib/handle/inline-code.js","../../node_modules/markdown-table/index.js","../../node_modules/mdast-util-gfm-table/lib/index.js","../../node_modules/mdast-util-to-markdown/lib/handle/list-item.js","../../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js","../../node_modules/mdast-util-to-markdown/lib/util/check-bullet.js","../../node_modules/mdast-util-gfm-task-list-item/index.js","../../node_modules/mdast-util-gfm/lib/index.js","../../node_modules/remark-gfm/index.js","../../node_modules/unist-util-is/index.js","../../node_modules/unist-util-visit-parents/index.js"],"sourcesContent":["'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nmodule.exports = function(style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function(node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n};\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n","/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n","/**\n * @license React\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=Symbol.for(\"react.element\"),c=Symbol.for(\"react.portal\"),d=Symbol.for(\"react.fragment\"),e=Symbol.for(\"react.strict_mode\"),f=Symbol.for(\"react.profiler\"),g=Symbol.for(\"react.provider\"),h=Symbol.for(\"react.context\"),k=Symbol.for(\"react.server_context\"),l=Symbol.for(\"react.forward_ref\"),m=Symbol.for(\"react.suspense\"),n=Symbol.for(\"react.suspense_list\"),p=Symbol.for(\"react.memo\"),q=Symbol.for(\"react.lazy\"),t=Symbol.for(\"react.offscreen\"),u;u=Symbol.for(\"react.module.reference\");\nfunction v(a){if(\"object\"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;\nexports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};\nexports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||\"object\"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","var parse = require('inline-style-parser');\n\n/**\n * Parses inline style to object.\n *\n * @example\n * // returns { 'line-height': '42' }\n * StyleToObject('line-height: 42;');\n *\n * @param {String} style - The inline style.\n * @param {Function} [iterator] - The iterator function.\n * @return {null|Object}\n */\nfunction StyleToObject(style, iterator) {\n var output = null;\n if (!style || typeof style !== 'string') {\n return output;\n }\n\n var declaration;\n var declarations = parse(style);\n var hasIterator = typeof iterator === 'function';\n var property;\n var value;\n\n for (var i = 0, len = declarations.length; i < len; i++) {\n declaration = declarations[i];\n property = declaration.property;\n value = declaration.value;\n\n if (hasIterator) {\n iterator(property, value, declaration);\n } else if (value) {\n output || (output = {});\n output[property] = value;\n }\n }\n\n return output;\n}\n\nmodule.exports = StyleToObject;\n","/// \n\n/* eslint-env browser */\n\nconst element = document.createElement('i')\n\n/**\n * @param {string} value\n * @returns {string|false}\n */\nexport function decodeNamedCharacterReference(value) {\n const characterReference = '&' + value + ';'\n element.innerHTML = characterReference\n const char = element.textContent\n\n // Some named character references do not require the closing semicolon\n // (`¬`, for instance), which leads to situations where parsing the assumed\n // named reference of `¬it;` will result in the string `¬it;`.\n // When we encounter a trailing semicolon after parsing, and the character\n // reference to decode was not a semicolon (`;`), we can assume that the\n // matching was not complete.\n // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n // yield `null`.\n if (char.charCodeAt(char.length - 1) === 59 /* `;` */ && value !== 'semi') {\n return false\n }\n\n // If the decoded string is equal to the input, the character reference was\n // not valid.\n // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n // yield `null`.\n return char === characterReference ? false : char\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const blankLine = {\n tokenize: tokenizeBlankLine,\n partial: true\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeBlankLine(effects, ok, nok) {\n return factorySpace(effects, afterWhitespace, 'linePrefix')\n /** @type {State} */\n\n function afterWhitespace(code) {\n return code === null || markdownLineEnding(code) ? ok(code) : nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n */\nimport {markdownSpace} from 'micromark-util-character'\n/**\n * @param {Effects} effects\n * @param {State} ok\n * @param {string} type\n * @param {number} [max=Infinity]\n * @returns {State}\n */\n\nexport function factorySpace(effects, ok, type, max) {\n const limit = max ? max - 1 : Number.POSITIVE_INFINITY\n let size = 0\n return start\n /** @type {State} */\n\n function start(code) {\n if (markdownSpace(code)) {\n effects.enter(type)\n return prefix(code)\n }\n\n return ok(code)\n }\n /** @type {State} */\n\n function prefix(code) {\n if (markdownSpace(code) && size++ < limit) {\n effects.consume(code)\n return prefix\n }\n\n effects.exit(type)\n return ok(code)\n }\n}\n","// This module is generated by `script/`.\n//\n// CommonMark handles attention (emphasis, strong) markers based on what comes\n// before or after them.\n// One such difference is if those characters are Unicode punctuation.\n// This script is generated from the Unicode data.\nexport const unicodePunctuationRegex =\n /[!-/:-@[-`{-~\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u09FD\\u0A76\\u0AF0\\u0C77\\u0C84\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E4F\\u2E52\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]/\n","/**\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {unicodePunctuationRegex} from './lib/unicode-punctuation-regex.js'\n/**\n * Check whether the character code represents an ASCII alpha (`a` through `z`,\n * case insensitive).\n *\n * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.\n *\n * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)\n * to U+005A (`Z`).\n *\n * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)\n * to U+007A (`z`).\n */\n\nexport const asciiAlpha = regexCheck(/[A-Za-z]/)\n/**\n * Check whether the character code represents an ASCII digit (`0` through `9`).\n *\n * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to\n * U+0039 (`9`).\n */\n\nexport const asciiDigit = regexCheck(/\\d/)\n/**\n * Check whether the character code represents an ASCII hex digit (`a` through\n * `f`, case insensitive, or `0` through `9`).\n *\n * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex\n * digit, or an ASCII lower hex digit.\n *\n * An **ASCII upper hex digit** is a character in the inclusive range U+0041\n * (`A`) to U+0046 (`F`).\n *\n * An **ASCII lower hex digit** is a character in the inclusive range U+0061\n * (`a`) to U+0066 (`f`).\n */\n\nexport const asciiHexDigit = regexCheck(/[\\dA-Fa-f]/)\n/**\n * Check whether the character code represents an ASCII alphanumeric (`a`\n * through `z`, case insensitive, or `0` through `9`).\n *\n * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha\n * (see `asciiAlpha`).\n */\n\nexport const asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/)\n/**\n * Check whether the character code represents ASCII punctuation.\n *\n * An **ASCII punctuation** is a character in the inclusive ranges U+0021\n * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT\n * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT\n * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).\n */\n\nexport const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/)\n/**\n * Check whether the character code represents an ASCII atext.\n *\n * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in\n * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),\n * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F\n * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E\n * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE\n * (`{`) to U+007E TILDE (`~`).\n *\n * See:\n * **\\[RFC5322]**:\n * [Internet Message Format](https://tools.ietf.org/html/rfc5322).\n * P. Resnick.\n * IETF.\n */\n\nexport const asciiAtext = regexCheck(/[#-'*+\\--9=?A-Z^-~]/)\n/**\n * Check whether a character code is an ASCII control character.\n *\n * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)\n * to U+001F (US), or U+007F (DEL).\n *\n * @param {Code} code\n * @returns {code is number}\n */\n\nexport function asciiControl(code) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code !== null && (code < 32 || code === 127)\n )\n}\n/**\n * Check whether a character code is a markdown line ending (see\n * `markdownLineEnding`) or markdown space (see `markdownSpace`).\n *\n * @param {Code} code\n * @returns {code is number}\n */\n\nexport function markdownLineEndingOrSpace(code) {\n return code !== null && (code < 0 || code === 32)\n}\n/**\n * Check whether a character code is a markdown line ending.\n *\n * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN\n * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).\n *\n * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE\n * RETURN (CR) are replaced by these virtual characters depending on whether\n * they occurred together.\n *\n * @param {Code} code\n * @returns {code is number}\n */\n\nexport function markdownLineEnding(code) {\n return code !== null && code < -2\n}\n/**\n * Check whether a character code is a markdown space.\n *\n * A **markdown space** is the concrete character U+0020 SPACE (SP) and the\n * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).\n *\n * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is\n * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL\n * SPACE (VS) characters, depending on the column at which the tab occurred.\n *\n * @param {Code} code\n * @returns {code is number}\n */\n\nexport function markdownSpace(code) {\n return code === -2 || code === -1 || code === 32\n}\n/**\n * Check whether the character code represents Unicode whitespace.\n *\n * Note that this does handle micromark specific markdown whitespace characters.\n * See `markdownLineEndingOrSpace` to check that.\n *\n * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,\n * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),\n * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\\[UNICODE]**).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n */\n\nexport const unicodeWhitespace = regexCheck(/\\s/)\n/**\n * Check whether the character code represents Unicode punctuation.\n *\n * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,\n * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`\n * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`\n * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII\n * punctuation (see `asciiPunctuation`).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n */\n// Size note: removing ASCII from the regex and using `asciiPunctuation` here\n// In fact adds to the bundle size.\n\nexport const unicodePunctuation = regexCheck(unicodePunctuationRegex)\n/**\n * Create a code check from a regex.\n *\n * @param {RegExp} regex\n * @returns {(code: Code) => code is number}\n */\n\nfunction regexCheck(regex) {\n return check\n /**\n * Check whether a code matches the bound regex.\n *\n * @param {Code} code Character code\n * @returns {code is number} Whether the character code matches the bound regex\n */\n\n function check(code) {\n return code !== null && regex.test(String.fromCharCode(code))\n }\n}\n","/**\n * Like `Array#splice`, but smarter for giant arrays.\n *\n * `Array#splice` takes all items to be inserted as individual argument which\n * causes a stack overflow in V8 when trying to insert 100k items for instance.\n *\n * Otherwise, this does not return the removed items, and takes `items` as an\n * array instead of rest parameters.\n *\n * @template {unknown} T\n * @param {T[]} list\n * @param {number} start\n * @param {number} remove\n * @param {T[]} items\n * @returns {void}\n */\nexport function splice(list, start, remove, items) {\n const end = list.length\n let chunkStart = 0\n /** @type {unknown[]} */\n\n let parameters // Make start between zero and `end` (included).\n\n if (start < 0) {\n start = -start > end ? 0 : end + start\n } else {\n start = start > end ? end : start\n }\n\n remove = remove > 0 ? remove : 0 // No need to chunk the items if there’s only a couple (10k) items.\n\n if (items.length < 10000) {\n parameters = Array.from(items)\n parameters.unshift(start, remove) // @ts-expect-error Hush, it’s fine.\n ;[].splice.apply(list, parameters)\n } else {\n // Delete `remove` items starting from `start`\n if (remove) [].splice.apply(list, [start, remove]) // Insert the items in chunks to not cause stack overflows.\n\n while (chunkStart < items.length) {\n parameters = items.slice(chunkStart, chunkStart + 10000)\n parameters.unshift(start, 0) // @ts-expect-error Hush, it’s fine.\n ;[].splice.apply(list, parameters)\n chunkStart += 10000\n start += 10000\n }\n }\n}\n/**\n * Append `items` (an array) at the end of `list` (another array).\n * When `list` was empty, returns `items` instead.\n *\n * This prevents a potentially expensive operation when `list` is empty,\n * and adds items in batches to prevent V8 from hanging.\n *\n * @template {unknown} T\n * @param {T[]} list\n * @param {T[]} items\n * @returns {T[]}\n */\n\nexport function push(list, items) {\n if (list.length > 0) {\n splice(list, list.length, 0, items)\n return list\n }\n\n return items\n}\n","/**\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {\n markdownLineEndingOrSpace,\n unicodePunctuation,\n unicodeWhitespace\n} from 'micromark-util-character'\n\n/**\n * Classify whether a character code represents whitespace, punctuation, or\n * something else.\n *\n * Used for attention (emphasis, strong), whose sequences can open or close\n * based on the class of surrounding characters.\n *\n * Note that eof (`null`) is seen as whitespace.\n *\n * @param {Code} code\n * @returns {number|undefined}\n */\nexport function classifyCharacter(code) {\n if (\n code === null ||\n markdownLineEndingOrSpace(code) ||\n unicodeWhitespace(code)\n ) {\n return 1\n }\n\n if (unicodePunctuation(code)) {\n return 2\n }\n}\n","/**\n * @typedef {import('micromark-util-types').NormalizedExtension} NormalizedExtension\n * @typedef {import('micromark-util-types').Extension} Extension\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension\n */\n\nimport {splice} from 'micromark-util-chunked'\n\nconst hasOwnProperty = {}.hasOwnProperty\n\n/**\n * Combine several syntax extensions into one.\n *\n * @param {Extension[]} extensions List of syntax extensions.\n * @returns {NormalizedExtension} A single combined extension.\n */\nexport function combineExtensions(extensions) {\n /** @type {NormalizedExtension} */\n const all = {}\n let index = -1\n\n while (++index < extensions.length) {\n syntaxExtension(all, extensions[index])\n }\n\n return all\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {NormalizedExtension} all Extension to merge into.\n * @param {Extension} extension Extension to merge.\n * @returns {void}\n */\nfunction syntaxExtension(all, extension) {\n /** @type {string} */\n let hook\n\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n const left = maybe || (all[hook] = {})\n const right = extension[hook]\n /** @type {string} */\n let code\n\n for (code in right) {\n if (!hasOwnProperty.call(left, code)) left[code] = []\n const value = right[code]\n constructs(\n // @ts-expect-error Looks like a list.\n left[code],\n Array.isArray(value) ? value : value ? [value] : []\n )\n }\n }\n}\n\n/**\n * Merge `list` into `existing` (both lists of constructs).\n * Mutates `existing`.\n *\n * @param {unknown[]} existing\n * @param {unknown[]} list\n * @returns {void}\n */\nfunction constructs(existing, list) {\n let index = -1\n /** @type {unknown[]} */\n const before = []\n\n while (++index < list.length) {\n // @ts-expect-error Looks like an object.\n ;(list[index].add === 'after' ? existing : before).push(list[index])\n }\n\n splice(existing, 0, 0, before)\n}\n\n/**\n * Combine several HTML extensions into one.\n *\n * @param {HtmlExtension[]} htmlExtensions List of HTML extensions.\n * @returns {HtmlExtension} A single combined extension.\n */\nexport function combineHtmlExtensions(htmlExtensions) {\n /** @type {HtmlExtension} */\n const handlers = {}\n let index = -1\n\n while (++index < htmlExtensions.length) {\n htmlExtension(handlers, htmlExtensions[index])\n }\n\n return handlers\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {HtmlExtension} all Extension to merge into.\n * @param {HtmlExtension} extension Extension to merge.\n * @returns {void}\n */\nfunction htmlExtension(all, extension) {\n /** @type {string} */\n let hook\n\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n const left = maybe || (all[hook] = {})\n const right = extension[hook]\n /** @type {string} */\n let type\n\n if (right) {\n for (type in right) {\n left[type] = right[type]\n }\n }\n }\n}\n","/**\n * Turn the number (in string form as either hexa- or plain decimal) coming from\n * a numeric character reference into a character.\n *\n * @param {string} value\n * Value to decode.\n * @param {number} base\n * Numeric base.\n * @returns {string}\n */\nexport function decodeNumericCharacterReference(value, base) {\n const code = Number.parseInt(value, base)\n\n if (\n // C0 except for HT, LF, FF, CR, space\n code < 9 ||\n code === 11 ||\n (code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls.\n (code > 126 && code < 160) || // Lone high surrogates and low surrogates.\n (code > 55295 && code < 57344) || // Noncharacters.\n (code > 64975 && code < 65008) ||\n (code & 65535) === 65535 ||\n (code & 65535) === 65534 || // Out of range\n code > 1114111\n ) {\n return '\\uFFFD'\n }\n\n return String.fromCharCode(code)\n}\n","import {decodeNamedCharacterReference} from 'decode-named-character-reference'\nimport {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'\nconst characterEscapeOrReference =\n /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi\n/**\n * Utility to decode markdown strings (which occur in places such as fenced\n * code info strings, destinations, labels, and titles).\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * @returns {string}\n */\n\nexport function decodeString(value) {\n return value.replace(characterEscapeOrReference, decode)\n}\n/**\n * @param {string} $0\n * @param {string} $1\n * @param {string} $2\n * @returns {string}\n */\n\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1\n } // Reference.\n\n const head = $2.charCodeAt(0)\n\n if (head === 35) {\n const head = $2.charCodeAt(1)\n const hex = head === 120 || head === 88\n return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10)\n }\n\n return decodeNamedCharacterReference($2) || $0\n}\n","/**\n * Normalize an identifier (such as used in definitions).\n *\n * @param {string} value\n * @returns {string}\n */\nexport function normalizeIdentifier(value) {\n return (\n value // Collapse Markdown whitespace.\n .replace(/[\\t\\n\\r ]+/g, ' ') // Trim.\n .replace(/^ | $/g, '') // Some characters are considered “uppercase”, but if their lowercase\n // counterpart is uppercased will result in a different uppercase\n // character.\n // Hence, to get that form, we perform both lower- and uppercase.\n // Upper case makes sure keys will not interact with default prototypal\n // methods: no method is uppercase.\n .toLowerCase()\n .toUpperCase()\n )\n}\n","/**\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Resolver} Resolver\n */\n\n/**\n * Call all `resolveAll`s.\n *\n * @param {{resolveAll?: Resolver}[]} constructs\n * @param {Event[]} events\n * @param {TokenizeContext} context\n * @returns {Event[]}\n */\nexport function resolveAll(constructs, events, context) {\n /** @type {Resolver[]} */\n const called = []\n let index = -1\n\n while (++index < constructs.length) {\n const resolve = constructs[index].resolveAll\n\n if (resolve && !called.includes(resolve)) {\n events = resolve(events, context)\n called.push(resolve)\n }\n }\n\n return events\n}\n","/**\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {object & {type: string, position?: Position|undefined}} NodeLike\n */\n\n/**\n * Stringify one point, a position (start and end points), or a node’s\n * positional information.\n *\n * @param {Node|NodeLike|Position|Point|null} [value]\n * @returns {string}\n */\nexport function stringifyPosition(value) {\n // Nothing.\n if (!value || typeof value !== 'object') {\n return ''\n }\n\n // Node.\n if ('position' in value || 'type' in value) {\n return position(value.position)\n }\n\n // Position.\n if ('start' in value || 'end' in value) {\n return position(value)\n }\n\n // Point.\n if ('line' in value || 'column' in value) {\n return point(value)\n }\n\n // ?\n return ''\n}\n\n/**\n * @param {Point|undefined} point\n * @returns {string}\n */\nfunction point(point) {\n return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position|undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number|undefined} value\n * @returns {number}\n */\nfunction index(value) {\n return value && typeof value === 'number' ? value : 1\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Point} Point\n * @typedef {object & {type: string, position?: Position|undefined}} NodeLike\n */\n\nimport {stringifyPosition} from 'unist-util-stringify-position'\n\nexport class VFileMessage extends Error {\n /**\n * Create a message for `reason` at `place` from `origin`.\n *\n * When an error is passed in as `reason`, the `stack` is copied.\n *\n * @param {string|Error|VFileMessage} reason\n * Reason for message.\n * Uses the stack and message of the error if given.\n * @param {Node|NodeLike|Position|Point} [place]\n * Place at which the message occurred in a file.\n * @param {string} [origin]\n * Place in code the message originates from (example `'my-package:my-rule-name'`)\n */\n constructor(reason, place, origin) {\n /** @type {[string|null, string|null]} */\n const parts = [null, null]\n /** @type {Position} */\n let position = {\n // @ts-expect-error: we always follows the structure of `position`.\n start: {line: null, column: null},\n // @ts-expect-error: \"\n end: {line: null, column: null}\n }\n\n super()\n\n if (typeof place === 'string') {\n origin = place\n place = undefined\n }\n\n if (typeof origin === 'string') {\n const index = origin.indexOf(':')\n\n if (index === -1) {\n parts[1] = origin\n } else {\n parts[0] = origin.slice(0, index)\n parts[1] = origin.slice(index + 1)\n }\n }\n\n if (place) {\n // Node.\n if ('type' in place || 'position' in place) {\n if (place.position) {\n // @ts-expect-error: looks like a position.\n position = place.position\n }\n }\n // Position.\n else if ('start' in place || 'end' in place) {\n // @ts-expect-error: looks like a position.\n position = place\n }\n // Point.\n else if ('line' in place || 'column' in place) {\n position.start = place\n }\n }\n\n // Fields from `Error`\n this.name = stringifyPosition(place) || '1:1'\n /** @type {string} */\n this.message = typeof reason === 'object' ? reason.message : reason\n /** @type {string} */\n this.stack = ''\n\n if (typeof reason === 'object' && reason.stack) {\n this.stack = reason.stack\n }\n\n /**\n * Reason for message.\n *\n * @type {string}\n */\n this.reason = this.message\n\n /* eslint-disable no-unused-expressions */\n /**\n * Whether this is a fatal problem that marks an associated file as no\n * longer processable.\n * If `true`, marks associated file as no longer processable.\n * If `false`, necessitates a (potential) change.\n * The value can also be `null` or `undefined`, for things that might not\n * need changing.\n *\n * @type {boolean?}\n */\n this.fatal\n\n /**\n * Starting line of error.\n *\n * @type {number?}\n */\n this.line = position.start.line\n\n /**\n * Starting column of error.\n *\n * @type {number?}\n */\n this.column = position.start.column\n\n /**\n * Full range information, when available.\n * Has `start` and `end` fields, both set to an object with `line` and\n * `column`, set to `number?`.\n *\n * @type {Position?}\n */\n this.position = position\n\n /**\n * Namespace of warning (example: `'my-package'`).\n *\n * @type {string?}\n */\n this.source = parts[0]\n\n /**\n * Category of message (example: `'my-rule-name'`).\n *\n * @type {string?}\n */\n this.ruleId = parts[1]\n\n /**\n * Path of a file (used throughout the VFile ecosystem).\n *\n * @type {string?}\n */\n this.file\n\n // The following fields are “well known”.\n // Not standard.\n // Feel free to add other non-standard fields to your messages.\n\n /**\n * Specify the source value that’s being reported, which is deemed\n * incorrect.\n *\n * @type {string?}\n */\n this.actual\n\n /**\n * Suggest values that should be used instead of `actual`, one or more\n * values that are deemed as acceptable.\n *\n * @type {Array?}\n */\n this.expected\n\n /**\n * Link to documentation for the message.\n *\n * @type {string?}\n */\n this.url\n\n /**\n * Long form description of the message (supported by `vfile-reporter`).\n *\n * @type {string?}\n */\n this.note\n /* eslint-enable no-unused-expressions */\n }\n}\n\nVFileMessage.prototype.file = ''\nVFileMessage.prototype.name = ''\nVFileMessage.prototype.reason = ''\nVFileMessage.prototype.message = ''\nVFileMessage.prototype.stack = ''\nVFileMessage.prototype.fatal = null\nVFileMessage.prototype.column = null\nVFileMessage.prototype.line = null\nVFileMessage.prototype.source = null\nVFileMessage.prototype.ruleId = null\nVFileMessage.prototype.position = null\n","// A derivative work based on:\n// .\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// .\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const path = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * @param {string} path\n * @param {string} [ext]\n * @returns {string}\n */\nfunction basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') {\n throw new TypeError('\"ext\" argument must be a string')\n }\n\n assertPath(path)\n let start = 0\n let end = -1\n let index = path.length\n /** @type {boolean|undefined} */\n let seenNonSlash\n\n if (ext === undefined || ext.length === 0 || ext.length > path.length) {\n while (index--) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // path component.\n seenNonSlash = true\n end = index + 1\n }\n }\n\n return end < 0 ? '' : path.slice(start, end)\n }\n\n if (ext === path) {\n return ''\n }\n\n let firstNonSlashEnd = -1\n let extIndex = ext.length - 1\n\n while (index--) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else {\n if (firstNonSlashEnd < 0) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching.\n seenNonSlash = true\n firstNonSlashEnd = index + 1\n }\n\n if (extIndex > -1) {\n // Try to match the explicit extension.\n if (path.charCodeAt(index) === ext.charCodeAt(extIndex--)) {\n if (extIndex < 0) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = index\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIndex = -1\n end = firstNonSlashEnd\n }\n }\n }\n }\n\n if (start === end) {\n end = firstNonSlashEnd\n } else if (end < 0) {\n end = path.length\n }\n\n return path.slice(start, end)\n}\n\n/**\n * @param {string} path\n * @returns {string}\n */\nfunction dirname(path) {\n assertPath(path)\n\n if (path.length === 0) {\n return '.'\n }\n\n let end = -1\n let index = path.length\n /** @type {boolean|undefined} */\n let unmatchedSlash\n\n // Prefix `--` is important to not run on `0`.\n while (--index) {\n if (path.charCodeAt(index) === 47 /* `/` */) {\n if (unmatchedSlash) {\n end = index\n break\n }\n } else if (!unmatchedSlash) {\n // We saw the first non-path separator\n unmatchedSlash = true\n }\n }\n\n return end < 0\n ? path.charCodeAt(0) === 47 /* `/` */\n ? '/'\n : '.'\n : end === 1 && path.charCodeAt(0) === 47 /* `/` */\n ? '//'\n : path.slice(0, end)\n}\n\n/**\n * @param {string} path\n * @returns {string}\n */\nfunction extname(path) {\n assertPath(path)\n\n let index = path.length\n\n let end = -1\n let startPart = 0\n let startDot = -1\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find.\n let preDotState = 0\n /** @type {boolean|undefined} */\n let unmatchedSlash\n\n while (index--) {\n const code = path.charCodeAt(index)\n\n if (code === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (unmatchedSlash) {\n startPart = index + 1\n break\n }\n\n continue\n }\n\n if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // extension.\n unmatchedSlash = true\n end = index + 1\n }\n\n if (code === 46 /* `.` */) {\n // If this is our first dot, mark it as the start of our extension.\n if (startDot < 0) {\n startDot = index\n } else if (preDotState !== 1) {\n preDotState = 1\n }\n } else if (startDot > -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension.\n preDotState = -1\n }\n }\n\n if (\n startDot < 0 ||\n end < 0 ||\n // We saw a non-dot character immediately before the dot.\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly `..`.\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n ) {\n return ''\n }\n\n return path.slice(startDot, end)\n}\n\n/**\n * @param {Array} segments\n * @returns {string}\n */\nfunction join(...segments) {\n let index = -1\n /** @type {string|undefined} */\n let joined\n\n while (++index < segments.length) {\n assertPath(segments[index])\n\n if (segments[index]) {\n joined =\n joined === undefined ? segments[index] : joined + '/' + segments[index]\n }\n }\n\n return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Note: `normalize` is not exposed as `path.normalize`, so some code is\n * manually removed from it.\n *\n * @param {string} path\n * @returns {string}\n */\nfunction normalize(path) {\n assertPath(path)\n\n const absolute = path.charCodeAt(0) === 47 /* `/` */\n\n // Normalize the path according to POSIX rules.\n let value = normalizeString(path, !absolute)\n\n if (value.length === 0 && !absolute) {\n value = '.'\n }\n\n if (value.length > 0 && path.charCodeAt(path.length - 1) === 47 /* / */) {\n value += '/'\n }\n\n return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n * @param {boolean} allowAboveRoot\n * @returns {string}\n */\nfunction normalizeString(path, allowAboveRoot) {\n let result = ''\n let lastSegmentLength = 0\n let lastSlash = -1\n let dots = 0\n let index = -1\n /** @type {number|undefined} */\n let code\n /** @type {number} */\n let lastSlashIndex\n\n while (++index <= path.length) {\n if (index < path.length) {\n code = path.charCodeAt(index)\n } else if (code === 47 /* `/` */) {\n break\n } else {\n code = 47 /* `/` */\n }\n\n if (code === 47 /* `/` */) {\n if (lastSlash === index - 1 || dots === 1) {\n // Empty.\n } else if (lastSlash !== index - 1 && dots === 2) {\n if (\n result.length < 2 ||\n lastSegmentLength !== 2 ||\n result.charCodeAt(result.length - 1) !== 46 /* `.` */ ||\n result.charCodeAt(result.length - 2) !== 46 /* `.` */\n ) {\n if (result.length > 2) {\n lastSlashIndex = result.lastIndexOf('/')\n\n if (lastSlashIndex !== result.length - 1) {\n if (lastSlashIndex < 0) {\n result = ''\n lastSegmentLength = 0\n } else {\n result = result.slice(0, lastSlashIndex)\n lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n }\n\n lastSlash = index\n dots = 0\n continue\n }\n } else if (result.length > 0) {\n result = ''\n lastSegmentLength = 0\n lastSlash = index\n dots = 0\n continue\n }\n }\n\n if (allowAboveRoot) {\n result = result.length > 0 ? result + '/..' : '..'\n lastSegmentLength = 2\n }\n } else {\n if (result.length > 0) {\n result += '/' + path.slice(lastSlash + 1, index)\n } else {\n result = path.slice(lastSlash + 1, index)\n }\n\n lastSegmentLength = index - lastSlash - 1\n }\n\n lastSlash = index\n dots = 0\n } else if (code === 46 /* `.` */ && dots > -1) {\n dots++\n } else {\n dots = -1\n }\n }\n\n return result\n}\n\n/**\n * @param {string} path\n */\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n 'Path must be a string. Received ' + JSON.stringify(path)\n )\n }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// .\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const proc = {cwd}\n\nfunction cwd() {\n return '/'\n}\n","/**\n * @typedef URL\n * @property {string} hash\n * @property {string} host\n * @property {string} hostname\n * @property {string} href\n * @property {string} origin\n * @property {string} password\n * @property {string} pathname\n * @property {string} port\n * @property {string} protocol\n * @property {string} search\n * @property {any} searchParams\n * @property {string} username\n * @property {() => string} toString\n * @property {() => string} toJSON\n */\n\n/**\n * @param {unknown} fileURLOrPath\n * @returns {fileURLOrPath is URL}\n */\n// From: \nexport function isUrl(fileURLOrPath) {\n return (\n fileURLOrPath !== null &&\n typeof fileURLOrPath === 'object' &&\n // @ts-expect-error: indexable.\n fileURLOrPath.href &&\n // @ts-expect-error: indexable.\n fileURLOrPath.origin\n )\n}\n","/// \n\nimport {isUrl} from './minurl.shared.js'\n\n// See: \n\n/**\n * @param {string|URL} path\n */\nexport function urlToPath(path) {\n if (typeof path === 'string') {\n path = new URL(path)\n } else if (!isUrl(path)) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'The \"path\" argument must be of type string or an instance of URL. Received `' +\n path +\n '`'\n )\n error.code = 'ERR_INVALID_ARG_TYPE'\n throw error\n }\n\n if (path.protocol !== 'file:') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError('The URL must be of scheme file')\n error.code = 'ERR_INVALID_URL_SCHEME'\n throw error\n }\n\n return getPathFromURLPosix(path)\n}\n\n/**\n * @param {URL} url\n */\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL host must be \"localhost\" or empty on darwin'\n )\n error.code = 'ERR_INVALID_FILE_URL_HOST'\n throw error\n }\n\n const pathname = url.pathname\n let index = -1\n\n while (++index < pathname.length) {\n if (\n pathname.charCodeAt(index) === 37 /* `%` */ &&\n pathname.charCodeAt(index + 1) === 50 /* `2` */\n ) {\n const third = pathname.charCodeAt(index + 2)\n if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL path must not include encoded / characters'\n )\n error.code = 'ERR_INVALID_FILE_URL_PATH'\n throw error\n }\n }\n }\n\n return decodeURIComponent(pathname)\n}\n\nexport {isUrl} from './minurl.shared.js'\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Point} Point\n * @typedef {Record & {type: string, position?: Position|undefined}} NodeLike\n * @typedef {import('./minurl.shared.js').URL} URL\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Value} Value\n *\n * @typedef {'ascii'|'utf8'|'utf-8'|'utf16le'|'ucs2'|'ucs-2'|'base64'|'base64url'|'latin1'|'binary'|'hex'} BufferEncoding\n * Encodings supported by the buffer class.\n * This is a copy of the typing from Node, copied to prevent Node globals from\n * being needed.\n * Copied from: \n *\n * @typedef {Value|Options|VFile|URL} Compatible\n * Things that can be passed to the constructor.\n *\n * @typedef VFileCoreOptions\n * @property {Value} [value]\n * @property {string} [cwd]\n * @property {Array} [history]\n * @property {string|URL} [path]\n * @property {string} [basename]\n * @property {string} [stem]\n * @property {string} [extname]\n * @property {string} [dirname]\n * @property {Data} [data]\n *\n * @typedef Map\n * Raw source map, see:\n * .\n * @property {number} version\n * @property {Array} sources\n * @property {Array} names\n * @property {string|undefined} [sourceRoot]\n * @property {Array|undefined} [sourcesContent]\n * @property {string} mappings\n * @property {string} file\n *\n * @typedef {{[key: string]: unknown} & VFileCoreOptions} Options\n * Configuration: a bunch of keys that will be shallow copied over to the new\n * file.\n *\n * @typedef {Record} ReporterSettings\n * @typedef {(files: Array, options: T) => string} Reporter\n */\n\nimport buffer from 'is-buffer'\nimport {VFileMessage} from 'vfile-message'\nimport {path} from './minpath.js'\nimport {proc} from './minproc.js'\nimport {urlToPath, isUrl} from './minurl.js'\n\n// Order of setting (least specific to most), we need this because otherwise\n// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n// stem can be set.\nconst order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * If `options` is `string` or `Buffer`, it’s treated as `{value: options}`.\n * If `options` is a `URL`, it’s treated as `{path: options}`.\n * If `options` is a `VFile`, shallow copies its data over to the new file.\n * All fields in `options` are set on the newly created `VFile`.\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * It’s not possible to set either `dirname` or `extname` without setting\n * either `history`, `path`, `basename`, or `stem` as well.\n *\n * @param {Compatible} [value]\n */\n constructor(value) {\n /** @type {Options} */\n let options\n\n if (!value) {\n options = {}\n } else if (typeof value === 'string' || buffer(value)) {\n // @ts-expect-error Looks like a buffer.\n options = {value}\n } else if (isUrl(value)) {\n options = {path: value}\n } else {\n // @ts-expect-error Looks like file or options.\n options = value\n }\n\n /**\n * Place to store custom information (default: `{}`).\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of messages associated with the file.\n * @type {Array}\n */\n this.messages = []\n\n /**\n * List of filepaths the file moved between.\n * The first is the original path and the last is the current path.\n * @type {Array}\n */\n this.history = []\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n * @type {string}\n */\n this.cwd = proc.cwd()\n\n /* eslint-disable no-unused-expressions */\n /**\n * Raw value.\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n\n /**\n * Whether a file was saved to disk.\n * This is used by vfile reporters.\n * @type {boolean}\n */\n this.stored\n\n /**\n * Sometimes files have a non-string, compiled, representation.\n * This can be stored in the `result` field.\n * One example is when turning markdown into React nodes.\n * This is used by unified to store non-string results.\n * @type {unknown}\n */\n this.result\n\n /**\n * Sometimes files have a source map associated with them.\n * This can be stored in the `map` field.\n * This should be a `Map` type, which is equivalent to the `RawSourceMap`\n * type from the `source-map` module.\n * @type {Map|undefined}\n */\n this.map\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const prop = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (prop in options && options[prop] !== undefined) {\n // @ts-expect-error: TS is confused by the different types for `history`.\n this[prop] = prop === 'history' ? [...options[prop]] : options[prop]\n }\n }\n\n /** @type {string} */\n let prop\n\n // Set non-path related properties.\n for (prop in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(prop)) this[prop] = options[prop]\n }\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n * @returns {string}\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n * @param {string|URL} path\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the parent path (example: `'~'`).\n */\n get dirname() {\n return typeof this.path === 'string' ? path.dirname(this.path) : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n * Cannot be set if there’s no `path` yet.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = path.join(dirname || '', this.basename)\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n */\n get basename() {\n return typeof this.path === 'string' ? path.basename(this.path) : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = path.join(this.dirname || '', basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n */\n get extname() {\n return typeof this.path === 'string' ? path.extname(this.path) : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.charCodeAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = path.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n */\n get stem() {\n return typeof this.path === 'string'\n ? path.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = path.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n /**\n * Serialize the file.\n *\n * @param {BufferEncoding} [encoding='utf8']\n * When `value` is a `Buffer`, `encoding` is a character encoding to\n * understand it as (default: `'utf8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n return (this.value || '').toString(encoding)\n }\n\n /**\n * Constructs a new `VFileMessage`, where `fatal` is set to `false`, and\n * associates it with the file by adding it to `vfile.messages` and setting\n * `message.file` to the current filepath.\n *\n * @param {string|Error|VFileMessage} reason\n * Human readable reason for the message, uses the stack and message of the error if given.\n * @param {Node|NodeLike|Position|Point} [place]\n * Place where the message occurred in the file.\n * @param {string} [origin]\n * Computer readable reason for the message\n * @returns {VFileMessage}\n * Message.\n */\n message(reason, place, origin) {\n const message = new VFileMessage(reason, place, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Like `VFile#message()`, but associates an informational message where\n * `fatal` is set to `null`.\n *\n * @param {string|Error|VFileMessage} reason\n * Human readable reason for the message, uses the stack and message of the error if given.\n * @param {Node|NodeLike|Position|Point} [place]\n * Place where the message occurred in the file.\n * @param {string} [origin]\n * Computer readable reason for the message\n * @returns {VFileMessage}\n * Message.\n */\n info(reason, place, origin) {\n const message = this.message(reason, place, origin)\n\n message.fatal = null\n\n return message\n }\n\n /**\n * Like `VFile#message()`, but associates a fatal message where `fatal` is\n * set to `true`, and then immediately throws it.\n *\n * > 👉 **Note**: a fatal error means that a file is no longer processable.\n *\n * @param {string|Error|VFileMessage} reason\n * Human readable reason for the message, uses the stack and message of the error if given.\n * @param {Node|NodeLike|Position|Point} [place]\n * Place where the message occurred in the file.\n * @param {string} [origin]\n * Computer readable reason for the message\n * @returns {never}\n * Message.\n */\n fail(reason, place, origin) {\n const message = this.message(reason, place, origin)\n\n message.fatal = true\n\n throw message\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string|undefined} part\n * @param {string} name\n * @returns {void}\n */\nfunction assertPart(part, name) {\n if (part && part.includes(path.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + path.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string|undefined} part\n * @param {string} name\n * @returns {asserts part is string}\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string|undefined} path\n * @param {string} name\n * @returns {asserts path is string}\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","/**\n * @typedef {(error?: Error|null|undefined, ...output: Array) => void} Callback\n * @typedef {(...input: Array) => any} Middleware\n *\n * @typedef {(...input: Array) => void} Run\n * Call all middleware.\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add `fn` (middleware) to the list.\n * @typedef {{run: Run, use: Use}} Pipeline\n * Middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n */\nexport function trough() {\n /** @type {Array} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error|null|undefined} error\n * @param {Array} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware`.\n * Can be sync or async; return a promise, receive a callback, or return new\n * values and errors.\n *\n * @param {Middleware} middleware\n * @param {Callback} callback\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result instanceof Promise) {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('vfile').VFileCompatible} VFileCompatible\n * @typedef {import('vfile').VFileValue} VFileValue\n * @typedef {import('..').Processor} Processor\n * @typedef {import('..').Plugin} Plugin\n * @typedef {import('..').Preset} Preset\n * @typedef {import('..').Pluggable} Pluggable\n * @typedef {import('..').PluggableList} PluggableList\n * @typedef {import('..').Transformer} Transformer\n * @typedef {import('..').Parser} Parser\n * @typedef {import('..').Compiler} Compiler\n * @typedef {import('..').RunCallback} RunCallback\n * @typedef {import('..').ProcessCallback} ProcessCallback\n *\n * @typedef Context\n * @property {Node} tree\n * @property {VFile} file\n */\n\nimport {bail} from 'bail'\nimport isBuffer from 'is-buffer'\nimport extend from 'extend'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\n\n// Expose a frozen processor.\nexport const unified = base().freeze()\n\nconst own = {}.hasOwnProperty\n\n// Function to create the first processor.\n/**\n * @returns {Processor}\n */\nfunction base() {\n const transformers = trough()\n /** @type {Processor['attachers']} */\n const attachers = []\n /** @type {Record} */\n let namespace = {}\n /** @type {boolean|undefined} */\n let frozen\n let freezeIndex = -1\n\n // Data management.\n // @ts-expect-error: overloads are handled.\n processor.data = data\n processor.Parser = undefined\n processor.Compiler = undefined\n\n // Lock.\n processor.freeze = freeze\n\n // Plugins.\n processor.attachers = attachers\n // @ts-expect-error: overloads are handled.\n processor.use = use\n\n // API.\n processor.parse = parse\n processor.stringify = stringify\n // @ts-expect-error: overloads are handled.\n processor.run = run\n processor.runSync = runSync\n // @ts-expect-error: overloads are handled.\n processor.process = process\n processor.processSync = processSync\n\n // Expose.\n return processor\n\n // Create a new processor based on the processor in the current scope.\n /** @type {Processor} */\n function processor() {\n const destination = base()\n let index = -1\n\n while (++index < attachers.length) {\n destination.use(...attachers[index])\n }\n\n destination.data(extend(true, {}, namespace))\n\n return destination\n }\n\n /**\n * @param {string|Record} [key]\n * @param {unknown} [value]\n * @returns {unknown}\n */\n function data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', frozen)\n namespace[key] = value\n return processor\n }\n\n // Get `key`.\n return (own.call(namespace, key) && namespace[key]) || null\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', frozen)\n namespace = key\n return processor\n }\n\n // Get space.\n return namespace\n }\n\n /** @type {Processor['freeze']} */\n function freeze() {\n if (frozen) {\n return processor\n }\n\n while (++freezeIndex < attachers.length) {\n const [attacher, ...options] = attachers[freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n /** @type {Transformer|void} */\n const transformer = attacher.call(processor, ...options)\n\n if (typeof transformer === 'function') {\n transformers.use(transformer)\n }\n }\n\n frozen = true\n freezeIndex = Number.POSITIVE_INFINITY\n\n return processor\n }\n\n /**\n * @param {Pluggable|null|undefined} [value]\n * @param {...unknown} options\n * @returns {Processor}\n */\n function use(value, ...options) {\n /** @type {Record|undefined} */\n let settings\n\n assertUnfrozen('use', frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, ...options)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n if (settings) {\n namespace.settings = Object.assign(namespace.settings || {}, settings)\n }\n\n return processor\n\n /**\n * @param {import('..').Pluggable} value\n * @returns {void}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...options] = value\n addPlugin(plugin, ...options)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {void}\n */\n function addPreset(result) {\n addList(result.plugins)\n\n if (result.settings) {\n settings = Object.assign(settings || {}, result.settings)\n }\n }\n\n /**\n * @param {PluggableList|null|undefined} [plugins]\n * @returns {void}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {...unknown} [value]\n * @returns {void}\n */\n function addPlugin(plugin, value) {\n let index = -1\n /** @type {Processor['attachers'][number]|undefined} */\n let entry\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entry = attachers[index]\n break\n }\n }\n\n if (entry) {\n if (isPlainObj(entry[1]) && isPlainObj(value)) {\n value = extend(true, entry[1], value)\n }\n\n entry[1] = value\n } else {\n // @ts-expect-error: fine.\n attachers.push([...arguments])\n }\n }\n }\n\n /** @type {Processor['parse']} */\n function parse(doc) {\n processor.freeze()\n const file = vfile(doc)\n const Parser = processor.Parser\n assertParser('parse', Parser)\n\n if (newable(Parser, 'parse')) {\n // @ts-expect-error: `newable` checks this.\n return new Parser(String(file), file).parse()\n }\n\n // @ts-expect-error: `newable` checks this.\n return Parser(String(file), file) // eslint-disable-line new-cap\n }\n\n /** @type {Processor['stringify']} */\n function stringify(node, doc) {\n processor.freeze()\n const file = vfile(doc)\n const Compiler = processor.Compiler\n assertCompiler('stringify', Compiler)\n assertNode(node)\n\n if (newable(Compiler, 'compile')) {\n // @ts-expect-error: `newable` checks this.\n return new Compiler(node, file).compile()\n }\n\n // @ts-expect-error: `newable` checks this.\n return Compiler(node, file) // eslint-disable-line new-cap\n }\n\n /**\n * @param {Node} node\n * @param {VFileCompatible|RunCallback} [doc]\n * @param {RunCallback} [callback]\n * @returns {Promise|void}\n */\n function run(node, doc, callback) {\n assertNode(node)\n processor.freeze()\n\n if (!callback && typeof doc === 'function') {\n callback = doc\n doc = undefined\n }\n\n if (!callback) {\n return new Promise(executor)\n }\n\n executor(null, callback)\n\n /**\n * @param {null|((node: Node) => void)} resolve\n * @param {(error: Error) => void} reject\n * @returns {void}\n */\n function executor(resolve, reject) {\n // @ts-expect-error: `doc` can’t be a callback anymore, we checked.\n transformers.run(node, vfile(doc), done)\n\n /**\n * @param {Error|null} error\n * @param {Node} tree\n * @param {VFile} file\n * @returns {void}\n */\n function done(error, tree, file) {\n tree = tree || node\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(tree)\n } else {\n // @ts-expect-error: `callback` is defined if `resolve` is not.\n callback(null, tree, file)\n }\n }\n }\n }\n\n /** @type {Processor['runSync']} */\n function runSync(node, file) {\n /** @type {Node|undefined} */\n let result\n /** @type {boolean|undefined} */\n let complete\n\n processor.run(node, file, done)\n\n assertDone('runSync', 'run', complete)\n\n // @ts-expect-error: we either bailed on an error or have a tree.\n return result\n\n /**\n * @param {Error|null} [error]\n * @param {Node} [tree]\n * @returns {void}\n */\n function done(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * @param {VFileCompatible} doc\n * @param {ProcessCallback} [callback]\n * @returns {Promise|undefined}\n */\n function process(doc, callback) {\n processor.freeze()\n assertParser('process', processor.Parser)\n assertCompiler('process', processor.Compiler)\n\n if (!callback) {\n return new Promise(executor)\n }\n\n executor(null, callback)\n\n /**\n * @param {null|((file: VFile) => void)} resolve\n * @param {(error?: Error|null|undefined) => void} reject\n * @returns {void}\n */\n function executor(resolve, reject) {\n const file = vfile(doc)\n\n processor.run(processor.parse(file), file, (error, tree, file) => {\n if (error || !tree || !file) {\n done(error)\n } else {\n /** @type {unknown} */\n const result = processor.stringify(tree, file)\n\n if (result === undefined || result === null) {\n // Empty.\n } else if (looksLikeAVFileValue(result)) {\n file.value = result\n } else {\n file.result = result\n }\n\n done(error, file)\n }\n })\n\n /**\n * @param {Error|null|undefined} [error]\n * @param {VFile|undefined} [file]\n * @returns {void}\n */\n function done(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n // @ts-expect-error: `callback` is defined if `resolve` is not.\n callback(null, file)\n }\n }\n }\n }\n\n /** @type {Processor['processSync']} */\n function processSync(doc) {\n /** @type {boolean|undefined} */\n let complete\n\n processor.freeze()\n assertParser('processSync', processor.Parser)\n assertCompiler('processSync', processor.Compiler)\n\n const file = vfile(doc)\n\n processor.process(file, done)\n\n assertDone('processSync', 'process', complete)\n\n return file\n\n /**\n * @param {Error|null|undefined} [error]\n * @returns {void}\n */\n function done(error) {\n complete = true\n bail(error)\n }\n }\n}\n\n/**\n * Check if `value` is a constructor.\n *\n * @param {unknown} value\n * @param {string} name\n * @returns {boolean}\n */\nfunction newable(value, name) {\n return (\n typeof value === 'function' &&\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n value.prototype &&\n // A function with keys in its prototype is probably a constructor.\n // Classes’ prototype methods are not enumerable, so we check if some value\n // exists in the prototype.\n // type-coverage:ignore-next-line\n (keys(value.prototype) || name in value.prototype)\n )\n}\n\n/**\n * Check if `value` is an object with keys.\n *\n * @param {Record} value\n * @returns {boolean}\n */\nfunction keys(value) {\n /** @type {string} */\n let key\n\n for (key in value) {\n if (own.call(value, key)) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `Parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `Compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {VFileCompatible} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {VFileCompatible} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is VFileValue}\n */\nfunction looksLikeAVFileValue(value) {\n return typeof value === 'string' || isBuffer(value)\n}\n","/**\n * @typedef Options\n * @property {boolean} [includeImageAlt=true]\n */\n\n/**\n * Get the text content of a node.\n * Prefer the node’s plain-text fields, otherwise serialize its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} node\n * @param {Options} [options]\n * @returns {string}\n */\nexport function toString(node, options) {\n var {includeImageAlt = true} = options || {}\n return one(node, includeImageAlt)\n}\n\n/**\n * @param {unknown} node\n * @param {boolean} includeImageAlt\n * @returns {string}\n */\nfunction one(node, includeImageAlt) {\n return (\n (node &&\n typeof node === 'object' &&\n // @ts-ignore looks like a literal.\n (node.value ||\n // @ts-ignore looks like an image.\n (includeImageAlt ? node.alt : '') ||\n // @ts-ignore looks like a parent.\n ('children' in node && all(node.children, includeImageAlt)) ||\n (Array.isArray(node) && all(node, includeImageAlt)))) ||\n ''\n )\n}\n\n/**\n * @param {Array.} values\n * @param {boolean} includeImageAlt\n * @returns {string}\n */\nfunction all(values, includeImageAlt) {\n /** @type {Array.} */\n var result = []\n var index = -1\n\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt)\n }\n\n return result.join('')\n}\n","/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {InitialConstruct} */\nexport const content = {\n tokenize: initializeContent\n}\n/** @type {Initializer} */\n\nfunction initializeContent(effects) {\n const contentStart = effects.attempt(\n this.parser.constructs.contentInitial,\n afterContentStartConstruct,\n paragraphInitial\n )\n /** @type {Token} */\n\n let previous\n return contentStart\n /** @type {State} */\n\n function afterContentStartConstruct(code) {\n if (code === null) {\n effects.consume(code)\n return\n }\n\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(effects, contentStart, 'linePrefix')\n }\n /** @type {State} */\n\n function paragraphInitial(code) {\n effects.enter('paragraph')\n return lineStart(code)\n }\n /** @type {State} */\n\n function lineStart(code) {\n const token = effects.enter('chunkText', {\n contentType: 'text',\n previous\n })\n\n if (previous) {\n previous.next = token\n }\n\n previous = token\n return data(code)\n }\n /** @type {State} */\n\n function data(code) {\n if (code === null) {\n effects.exit('chunkText')\n effects.exit('paragraph')\n effects.consume(code)\n return\n }\n\n if (markdownLineEnding(code)) {\n effects.consume(code)\n effects.exit('chunkText')\n return lineStart\n } // Data.\n\n effects.consume(code)\n return data\n }\n}\n","/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Point} Point\n */\n\n/**\n * @typedef {Record} StackState\n * @typedef {[Construct, StackState]} StackItem\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\nimport {splice} from 'micromark-util-chunked'\n/** @type {InitialConstruct} */\n\nexport const document = {\n tokenize: initializeDocument\n}\n/** @type {Construct} */\n\nconst containerConstruct = {\n tokenize: tokenizeContainer\n}\n/** @type {Initializer} */\n\nfunction initializeDocument(effects) {\n const self = this\n /** @type {Array} */\n\n const stack = []\n let continued = 0\n /** @type {TokenizeContext|undefined} */\n\n let childFlow\n /** @type {Token|undefined} */\n\n let childToken\n /** @type {number} */\n\n let lineStartOffset\n return start\n /** @type {State} */\n\n function start(code) {\n // First we iterate through the open blocks, starting with the root\n // document, and descending through last children down to the last open\n // block.\n // Each block imposes a condition that the line must satisfy if the block is\n // to remain open.\n // For example, a block quote requires a `>` character.\n // A paragraph requires a non-blank line.\n // In this phase we may match all or just some of the open blocks.\n // But we cannot close unmatched blocks yet, because we may have a lazy\n // continuation line.\n if (continued < stack.length) {\n const item = stack[continued]\n self.containerState = item[1]\n return effects.attempt(\n item[0].continuation,\n documentContinue,\n checkNewContainers\n )(code)\n } // Done.\n\n return checkNewContainers(code)\n }\n /** @type {State} */\n\n function documentContinue(code) {\n continued++ // Note: this field is called `_closeFlow` but it also closes containers.\n // Perhaps a good idea to rename it but it’s already used in the wild by\n // extensions.\n\n if (self.containerState._closeFlow) {\n self.containerState._closeFlow = undefined\n\n if (childFlow) {\n closeFlow()\n } // Note: this algorithm for moving events around is similar to the\n // algorithm when dealing with lazy lines in `writeToChild`.\n\n const indexBeforeExits = self.events.length\n let indexBeforeFlow = indexBeforeExits\n /** @type {Point|undefined} */\n\n let point // Find the flow chunk.\n\n while (indexBeforeFlow--) {\n if (\n self.events[indexBeforeFlow][0] === 'exit' &&\n self.events[indexBeforeFlow][1].type === 'chunkFlow'\n ) {\n point = self.events[indexBeforeFlow][1].end\n break\n }\n }\n\n exitContainers(continued) // Fix positions.\n\n let index = indexBeforeExits\n\n while (index < self.events.length) {\n self.events[index][1].end = Object.assign({}, point)\n index++\n } // Inject the exits earlier (they’re still also at the end).\n\n splice(\n self.events,\n indexBeforeFlow + 1,\n 0,\n self.events.slice(indexBeforeExits)\n ) // Discard the duplicate exits.\n\n self.events.length = index\n return checkNewContainers(code)\n }\n\n return start(code)\n }\n /** @type {State} */\n\n function checkNewContainers(code) {\n // Next, after consuming the continuation markers for existing blocks, we\n // look for new block starts (e.g. `>` for a block quote).\n // If we encounter a new block start, we close any blocks unmatched in\n // step 1 before creating the new block as a child of the last matched\n // block.\n if (continued === stack.length) {\n // No need to `check` whether there’s a container, of `exitContainers`\n // would be moot.\n // We can instead immediately `attempt` to parse one.\n if (!childFlow) {\n return documentContinued(code)\n } // If we have concrete content, such as block HTML or fenced code,\n // we can’t have containers “pierce” into them, so we can immediately\n // start.\n\n if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {\n return flowStart(code)\n } // If we do have flow, it could still be a blank line,\n // but we’d be interrupting it w/ a new container if there’s a current\n // construct.\n\n self.interrupt = Boolean(\n childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack\n )\n } // Check if there is a new container.\n\n self.containerState = {}\n return effects.check(\n containerConstruct,\n thereIsANewContainer,\n thereIsNoNewContainer\n )(code)\n }\n /** @type {State} */\n\n function thereIsANewContainer(code) {\n if (childFlow) closeFlow()\n exitContainers(continued)\n return documentContinued(code)\n }\n /** @type {State} */\n\n function thereIsNoNewContainer(code) {\n self.parser.lazy[self.now().line] = continued !== stack.length\n lineStartOffset = self.now().offset\n return flowStart(code)\n }\n /** @type {State} */\n\n function documentContinued(code) {\n // Try new containers.\n self.containerState = {}\n return effects.attempt(\n containerConstruct,\n containerContinue,\n flowStart\n )(code)\n }\n /** @type {State} */\n\n function containerContinue(code) {\n continued++\n stack.push([self.currentConstruct, self.containerState]) // Try another.\n\n return documentContinued(code)\n }\n /** @type {State} */\n\n function flowStart(code) {\n if (code === null) {\n if (childFlow) closeFlow()\n exitContainers(0)\n effects.consume(code)\n return\n }\n\n childFlow = childFlow || self.parser.flow(self.now())\n effects.enter('chunkFlow', {\n contentType: 'flow',\n previous: childToken,\n _tokenizer: childFlow\n })\n return flowContinue(code)\n }\n /** @type {State} */\n\n function flowContinue(code) {\n if (code === null) {\n writeToChild(effects.exit('chunkFlow'), true)\n exitContainers(0)\n effects.consume(code)\n return\n }\n\n if (markdownLineEnding(code)) {\n effects.consume(code)\n writeToChild(effects.exit('chunkFlow')) // Get ready for the next line.\n\n continued = 0\n self.interrupt = undefined\n return start\n }\n\n effects.consume(code)\n return flowContinue\n }\n /**\n * @param {Token} token\n * @param {boolean} [eof]\n * @returns {void}\n */\n\n function writeToChild(token, eof) {\n const stream = self.sliceStream(token)\n if (eof) stream.push(null)\n token.previous = childToken\n if (childToken) childToken.next = token\n childToken = token\n childFlow.defineSkip(token.start)\n childFlow.write(stream) // Alright, so we just added a lazy line:\n //\n // ```markdown\n // > a\n // b.\n //\n // Or:\n //\n // > ~~~c\n // d\n //\n // Or:\n //\n // > | e |\n // f\n // ```\n //\n // The construct in the second example (fenced code) does not accept lazy\n // lines, so it marked itself as done at the end of its first line, and\n // then the content construct parses `d`.\n // Most constructs in markdown match on the first line: if the first line\n // forms a construct, a non-lazy line can’t “unmake” it.\n //\n // The construct in the third example is potentially a GFM table, and\n // those are *weird*.\n // It *could* be a table, from the first line, if the following line\n // matches a condition.\n // In this case, that second line is lazy, which “unmakes” the first line\n // and turns the whole into one content block.\n //\n // We’ve now parsed the non-lazy and the lazy line, and can figure out\n // whether the lazy line started a new flow block.\n // If it did, we exit the current containers between the two flow blocks.\n\n if (self.parser.lazy[token.start.line]) {\n let index = childFlow.events.length\n\n while (index--) {\n if (\n // The token starts before the line ending…\n childFlow.events[index][1].start.offset < lineStartOffset && // …and either is not ended yet…\n (!childFlow.events[index][1].end || // …or ends after it.\n childFlow.events[index][1].end.offset > lineStartOffset)\n ) {\n // Exit: there’s still something open, which means it’s a lazy line\n // part of something.\n return\n }\n } // Note: this algorithm for moving events around is similar to the\n // algorithm when closing flow in `documentContinue`.\n\n const indexBeforeExits = self.events.length\n let indexBeforeFlow = indexBeforeExits\n /** @type {boolean|undefined} */\n\n let seen\n /** @type {Point|undefined} */\n\n let point // Find the previous chunk (the one before the lazy line).\n\n while (indexBeforeFlow--) {\n if (\n self.events[indexBeforeFlow][0] === 'exit' &&\n self.events[indexBeforeFlow][1].type === 'chunkFlow'\n ) {\n if (seen) {\n point = self.events[indexBeforeFlow][1].end\n break\n }\n\n seen = true\n }\n }\n\n exitContainers(continued) // Fix positions.\n\n index = indexBeforeExits\n\n while (index < self.events.length) {\n self.events[index][1].end = Object.assign({}, point)\n index++\n } // Inject the exits earlier (they’re still also at the end).\n\n splice(\n self.events,\n indexBeforeFlow + 1,\n 0,\n self.events.slice(indexBeforeExits)\n ) // Discard the duplicate exits.\n\n self.events.length = index\n }\n }\n /**\n * @param {number} size\n * @returns {void}\n */\n\n function exitContainers(size) {\n let index = stack.length // Exit open containers.\n\n while (index-- > size) {\n const entry = stack[index]\n self.containerState = entry[1]\n entry[0].exit.call(self, effects)\n }\n\n stack.length = size\n }\n\n function closeFlow() {\n childFlow.write([null])\n childToken = undefined\n childFlow = undefined\n self.containerState._closeFlow = undefined\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeContainer(effects, ok, nok) {\n return factorySpace(\n effects,\n effects.attempt(this.parser.constructs.document, ok, nok),\n 'linePrefix',\n this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4\n )\n}\n","/**\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Event} Event\n */\nimport {splice} from 'micromark-util-chunked'\n\n/**\n * Tokenize subcontent.\n *\n * @param {Event[]} events\n * @returns {boolean}\n */\nexport function subtokenize(events) {\n /** @type {Record} */\n const jumps = {}\n let index = -1\n /** @type {Event} */\n\n let event\n /** @type {number|undefined} */\n\n let lineIndex\n /** @type {number} */\n\n let otherIndex\n /** @type {Event} */\n\n let otherEvent\n /** @type {Event[]} */\n\n let parameters\n /** @type {Event[]} */\n\n let subevents\n /** @type {boolean|undefined} */\n\n let more\n\n while (++index < events.length) {\n while (index in jumps) {\n index = jumps[index]\n }\n\n event = events[index] // Add a hook for the GFM tasklist extension, which needs to know if text\n // is in the first content of a list item.\n\n if (\n index &&\n event[1].type === 'chunkFlow' &&\n events[index - 1][1].type === 'listItemPrefix'\n ) {\n subevents = event[1]._tokenizer.events\n otherIndex = 0\n\n if (\n otherIndex < subevents.length &&\n subevents[otherIndex][1].type === 'lineEndingBlank'\n ) {\n otherIndex += 2\n }\n\n if (\n otherIndex < subevents.length &&\n subevents[otherIndex][1].type === 'content'\n ) {\n while (++otherIndex < subevents.length) {\n if (subevents[otherIndex][1].type === 'content') {\n break\n }\n\n if (subevents[otherIndex][1].type === 'chunkText') {\n subevents[otherIndex][1]._isInFirstContentOfListItem = true\n otherIndex++\n }\n }\n }\n } // Enter.\n\n if (event[0] === 'enter') {\n if (event[1].contentType) {\n Object.assign(jumps, subcontent(events, index))\n index = jumps[index]\n more = true\n }\n } // Exit.\n else if (event[1]._container) {\n otherIndex = index\n lineIndex = undefined\n\n while (otherIndex--) {\n otherEvent = events[otherIndex]\n\n if (\n otherEvent[1].type === 'lineEnding' ||\n otherEvent[1].type === 'lineEndingBlank'\n ) {\n if (otherEvent[0] === 'enter') {\n if (lineIndex) {\n events[lineIndex][1].type = 'lineEndingBlank'\n }\n\n otherEvent[1].type = 'lineEnding'\n lineIndex = otherIndex\n }\n } else {\n break\n }\n }\n\n if (lineIndex) {\n // Fix position.\n event[1].end = Object.assign({}, events[lineIndex][1].start) // Switch container exit w/ line endings.\n\n parameters = events.slice(lineIndex, index)\n parameters.unshift(event)\n splice(events, lineIndex, index - lineIndex + 1, parameters)\n }\n }\n }\n\n return !more\n}\n/**\n * Tokenize embedded tokens.\n *\n * @param {Event[]} events\n * @param {number} eventIndex\n * @returns {Record}\n */\n\nfunction subcontent(events, eventIndex) {\n const token = events[eventIndex][1]\n const context = events[eventIndex][2]\n let startPosition = eventIndex - 1\n /** @type {number[]} */\n\n const startPositions = []\n const tokenizer =\n token._tokenizer || context.parser[token.contentType](token.start)\n const childEvents = tokenizer.events\n /** @type {[number, number][]} */\n\n const jumps = []\n /** @type {Record} */\n\n const gaps = {}\n /** @type {Chunk[]} */\n\n let stream\n /** @type {Token|undefined} */\n\n let previous\n let index = -1\n /** @type {Token|undefined} */\n\n let current = token\n let adjust = 0\n let start = 0\n const breaks = [start] // Loop forward through the linked tokens to pass them in order to the\n // subtokenizer.\n\n while (current) {\n // Find the position of the event for this token.\n while (events[++startPosition][1] !== current) {\n // Empty.\n }\n\n startPositions.push(startPosition)\n\n if (!current._tokenizer) {\n stream = context.sliceStream(current)\n\n if (!current.next) {\n stream.push(null)\n }\n\n if (previous) {\n tokenizer.defineSkip(current.start)\n }\n\n if (current._isInFirstContentOfListItem) {\n tokenizer._gfmTasklistFirstContentOfListItem = true\n }\n\n tokenizer.write(stream)\n\n if (current._isInFirstContentOfListItem) {\n tokenizer._gfmTasklistFirstContentOfListItem = undefined\n }\n } // Unravel the next token.\n\n previous = current\n current = current.next\n } // Now, loop back through all events (and linked tokens), to figure out which\n // parts belong where.\n\n current = token\n\n while (++index < childEvents.length) {\n if (\n // Find a void token that includes a break.\n childEvents[index][0] === 'exit' &&\n childEvents[index - 1][0] === 'enter' &&\n childEvents[index][1].type === childEvents[index - 1][1].type &&\n childEvents[index][1].start.line !== childEvents[index][1].end.line\n ) {\n start = index + 1\n breaks.push(start) // Help GC.\n\n current._tokenizer = undefined\n current.previous = undefined\n current = current.next\n }\n } // Help GC.\n\n tokenizer.events = [] // If there’s one more token (which is the cases for lines that end in an\n // EOF), that’s perfect: the last point we found starts it.\n // If there isn’t then make sure any remaining content is added to it.\n\n if (current) {\n // Help GC.\n current._tokenizer = undefined\n current.previous = undefined\n } else {\n breaks.pop()\n } // Now splice the events from the subtokenizer into the current events,\n // moving back to front so that splice indices aren’t affected.\n\n index = breaks.length\n\n while (index--) {\n const slice = childEvents.slice(breaks[index], breaks[index + 1])\n const start = startPositions.pop()\n jumps.unshift([start, start + slice.length - 1])\n splice(events, start, 2, slice)\n }\n\n index = -1\n\n while (++index < jumps.length) {\n gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]\n adjust += jumps[index][1] - jumps[index][0] - 1\n }\n\n return gaps\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\nimport {subtokenize} from 'micromark-util-subtokenize'\n\n/**\n * No name because it must not be turned off.\n * @type {Construct}\n */\nexport const content = {\n tokenize: tokenizeContent,\n resolve: resolveContent\n}\n/** @type {Construct} */\n\nconst continuationConstruct = {\n tokenize: tokenizeContinuation,\n partial: true\n}\n/**\n * Content is transparent: it’s parsed right now. That way, definitions are also\n * parsed right now: before text in paragraphs (specifically, media) are parsed.\n *\n * @type {Resolver}\n */\n\nfunction resolveContent(events) {\n subtokenize(events)\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeContent(effects, ok) {\n /** @type {Token} */\n let previous\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('content')\n previous = effects.enter('chunkContent', {\n contentType: 'content'\n })\n return data(code)\n }\n /** @type {State} */\n\n function data(code) {\n if (code === null) {\n return contentEnd(code)\n }\n\n if (markdownLineEnding(code)) {\n return effects.check(\n continuationConstruct,\n contentContinue,\n contentEnd\n )(code)\n } // Data.\n\n effects.consume(code)\n return data\n }\n /** @type {State} */\n\n function contentEnd(code) {\n effects.exit('chunkContent')\n effects.exit('content')\n return ok(code)\n }\n /** @type {State} */\n\n function contentContinue(code) {\n effects.consume(code)\n effects.exit('chunkContent')\n previous.next = effects.enter('chunkContent', {\n contentType: 'content',\n previous\n })\n previous = previous.next\n return data\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeContinuation(effects, ok, nok) {\n const self = this\n return startLookahead\n /** @type {State} */\n\n function startLookahead(code) {\n effects.exit('chunkContent')\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(effects, prefixed, 'linePrefix')\n }\n /** @type {State} */\n\n function prefixed(code) {\n if (code === null || markdownLineEnding(code)) {\n return nok(code)\n }\n\n const tail = self.events[self.events.length - 1]\n\n if (\n !self.parser.constructs.disable.null.includes('codeIndented') &&\n tail &&\n tail[1].type === 'linePrefix' &&\n tail[2].sliceSerialize(tail[1], true).length >= 4\n ) {\n return ok(code)\n }\n\n return effects.interrupt(self.parser.constructs.flow, nok, ok)(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {blankLine, content} from 'micromark-core-commonmark'\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {InitialConstruct} */\nexport const flow = {\n tokenize: initializeFlow\n}\n/** @type {Initializer} */\n\nfunction initializeFlow(effects) {\n const self = this\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine,\n atBlankEnding, // Try to parse initial flow (essentially, only code).\n effects.attempt(\n this.parser.constructs.flowInitial,\n afterConstruct,\n factorySpace(\n effects,\n effects.attempt(\n this.parser.constructs.flow,\n afterConstruct,\n effects.attempt(content, afterConstruct)\n ),\n 'linePrefix'\n )\n )\n )\n return initial\n /** @type {State} */\n\n function atBlankEnding(code) {\n if (code === null) {\n effects.consume(code)\n return\n }\n\n effects.enter('lineEndingBlank')\n effects.consume(code)\n effects.exit('lineEndingBlank')\n self.currentConstruct = undefined\n return initial\n }\n /** @type {State} */\n\n function afterConstruct(code) {\n if (code === null) {\n effects.consume(code)\n return\n }\n\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n self.currentConstruct = undefined\n return initial\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nexport const resolver = {\n resolveAll: createResolver()\n}\nexport const string = initializeFactory('string')\nexport const text = initializeFactory('text')\n/**\n * @param {'string'|'text'} field\n * @returns {InitialConstruct}\n */\n\nfunction initializeFactory(field) {\n return {\n tokenize: initializeText,\n resolveAll: createResolver(\n field === 'text' ? resolveAllLineSuffixes : undefined\n )\n }\n /** @type {Initializer} */\n\n function initializeText(effects) {\n const self = this\n const constructs = this.parser.constructs[field]\n const text = effects.attempt(constructs, start, notText)\n return start\n /** @type {State} */\n\n function start(code) {\n return atBreak(code) ? text(code) : notText(code)\n }\n /** @type {State} */\n\n function notText(code) {\n if (code === null) {\n effects.consume(code)\n return\n }\n\n effects.enter('data')\n effects.consume(code)\n return data\n }\n /** @type {State} */\n\n function data(code) {\n if (atBreak(code)) {\n effects.exit('data')\n return text(code)\n } // Data.\n\n effects.consume(code)\n return data\n }\n /**\n * @param {Code} code\n * @returns {boolean}\n */\n\n function atBreak(code) {\n if (code === null) {\n return true\n }\n\n const list = constructs[code]\n let index = -1\n\n if (list) {\n while (++index < list.length) {\n const item = list[index]\n\n if (!item.previous || item.previous.call(self, self.previous)) {\n return true\n }\n }\n }\n\n return false\n }\n }\n}\n/**\n * @param {Resolver} [extraResolver]\n * @returns {Resolver}\n */\n\nfunction createResolver(extraResolver) {\n return resolveAllText\n /** @type {Resolver} */\n\n function resolveAllText(events, context) {\n let index = -1\n /** @type {number|undefined} */\n\n let enter // A rather boring computation (to merge adjacent `data` events) which\n // improves mm performance by 29%.\n\n while (++index <= events.length) {\n if (enter === undefined) {\n if (events[index] && events[index][1].type === 'data') {\n enter = index\n index++\n }\n } else if (!events[index] || events[index][1].type !== 'data') {\n // Don’t do anything if there is one data token.\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end\n events.splice(enter + 2, index - enter - 2)\n index = enter + 2\n }\n\n enter = undefined\n }\n }\n\n return extraResolver ? extraResolver(events, context) : events\n }\n}\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\n\nfunction resolveAllLineSuffixes(events, context) {\n let eventIndex = 0 // Skip first.\n\n while (++eventIndex <= events.length) {\n if (\n (eventIndex === events.length ||\n events[eventIndex][1].type === 'lineEnding') &&\n events[eventIndex - 1][1].type === 'data'\n ) {\n const data = events[eventIndex - 1][1]\n const chunks = context.sliceStream(data)\n let index = chunks.length\n let bufferIndex = -1\n let size = 0\n /** @type {boolean|undefined} */\n\n let tabs\n\n while (index--) {\n const chunk = chunks[index]\n\n if (typeof chunk === 'string') {\n bufferIndex = chunk.length\n\n while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n size++\n bufferIndex--\n }\n\n if (bufferIndex) break\n bufferIndex = -1\n } // Number\n else if (chunk === -2) {\n tabs = true\n size++\n } else if (chunk === -1) {\n // Empty\n } else {\n // Replacement character, exit.\n index++\n break\n }\n }\n\n if (size) {\n const token = {\n type:\n eventIndex === events.length || tabs || size < 2\n ? 'lineSuffix'\n : 'hardBreakTrailing',\n start: {\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size,\n _index: data.start._index + index,\n _bufferIndex: index\n ? bufferIndex\n : data.start._bufferIndex + bufferIndex\n },\n end: Object.assign({}, data.end)\n }\n data.end = Object.assign({}, token.start)\n\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token)\n } else {\n events.splice(\n eventIndex,\n 0,\n ['enter', token, context],\n ['exit', token, context]\n )\n eventIndex += 2\n }\n }\n\n eventIndex++\n }\n }\n\n return events\n}\n","/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Point} Point\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n */\n\n/**\n * @typedef Info\n * @property {() => void} restore\n * @property {number} from\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * @param {Info} info\n * @returns {void}\n */\nimport {markdownLineEnding} from 'micromark-util-character'\nimport {push, splice} from 'micromark-util-chunked'\nimport {resolveAll} from 'micromark-util-resolve-all'\n\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n * @param {InitialConstruct} initialize\n * @param {Omit} [from]\n * @returns {TokenizeContext}\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = Object.assign(\n from\n ? Object.assign({}, from)\n : {\n line: 1,\n column: 1,\n offset: 0\n },\n {\n _index: 0,\n _bufferIndex: -1\n }\n )\n /** @type {Record} */\n\n const columnStart = {}\n /** @type {Array} */\n\n const resolveAllConstructs = []\n /** @type {Array} */\n\n let chunks = []\n /** @type {Array} */\n\n let stack = []\n /** @type {boolean|undefined} */\n\n let consumed = true\n /**\n * Tools used for tokenizing.\n *\n * @type {Effects}\n */\n\n const effects = {\n consume,\n enter,\n exit,\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\n interrupt: constructFactory(onsuccessfulcheck, {\n interrupt: true\n })\n }\n /**\n * State and tools for resolving and serializing.\n *\n * @type {TokenizeContext}\n */\n\n const context = {\n previous: null,\n code: null,\n containerState: {},\n events: [],\n parser,\n sliceStream,\n sliceSerialize,\n now,\n defineSkip,\n write\n }\n /**\n * The state function.\n *\n * @type {State|void}\n */\n\n let state = initialize.tokenize.call(context, effects)\n /**\n * Track which character we expect to be consumed, to catch bugs.\n *\n * @type {Code}\n */\n\n let expectedCode\n\n if (initialize.resolveAll) {\n resolveAllConstructs.push(initialize)\n }\n\n return context\n /** @type {TokenizeContext['write']} */\n\n function write(slice) {\n chunks = push(chunks, slice)\n main() // Exit if we’re not done, resolve might change stuff.\n\n if (chunks[chunks.length - 1] !== null) {\n return []\n }\n\n addResult(initialize, 0) // Otherwise, resolve, and exit.\n\n context.events = resolveAll(resolveAllConstructs, context.events, context)\n return context.events\n } //\n // Tools.\n //\n\n /** @type {TokenizeContext['sliceSerialize']} */\n\n function sliceSerialize(token, expandTabs) {\n return serializeChunks(sliceStream(token), expandTabs)\n }\n /** @type {TokenizeContext['sliceStream']} */\n\n function sliceStream(token) {\n return sliceChunks(chunks, token)\n }\n /** @type {TokenizeContext['now']} */\n\n function now() {\n return Object.assign({}, point)\n }\n /** @type {TokenizeContext['defineSkip']} */\n\n function defineSkip(value) {\n columnStart[value.line] = value.column\n accountForPotentialSkip()\n } //\n // State management.\n //\n\n /**\n * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n * `consume`).\n * Here is where we walk through the chunks, which either include strings of\n * several characters, or numerical character codes.\n * The reason to do this in a loop instead of a call is so the stack can\n * drain.\n *\n * @returns {void}\n */\n\n function main() {\n /** @type {number} */\n let chunkIndex\n\n while (point._index < chunks.length) {\n const chunk = chunks[point._index] // If we’re in a buffer chunk, loop through it.\n\n if (typeof chunk === 'string') {\n chunkIndex = point._index\n\n if (point._bufferIndex < 0) {\n point._bufferIndex = 0\n }\n\n while (\n point._index === chunkIndex &&\n point._bufferIndex < chunk.length\n ) {\n go(chunk.charCodeAt(point._bufferIndex))\n }\n } else {\n go(chunk)\n }\n }\n }\n /**\n * Deal with one code.\n *\n * @param {Code} code\n * @returns {void}\n */\n\n function go(code) {\n consumed = undefined\n expectedCode = code\n state = state(code)\n }\n /** @type {Effects['consume']} */\n\n function consume(code) {\n if (markdownLineEnding(code)) {\n point.line++\n point.column = 1\n point.offset += code === -3 ? 2 : 1\n accountForPotentialSkip()\n } else if (code !== -1) {\n point.column++\n point.offset++\n } // Not in a string chunk.\n\n if (point._bufferIndex < 0) {\n point._index++\n } else {\n point._bufferIndex++ // At end of string chunk.\n // @ts-expect-error Points w/ non-negative `_bufferIndex` reference\n // strings.\n\n if (point._bufferIndex === chunks[point._index].length) {\n point._bufferIndex = -1\n point._index++\n }\n } // Expose the previous character.\n\n context.previous = code // Mark as consumed.\n\n consumed = true\n }\n /** @type {Effects['enter']} */\n\n function enter(type, fields) {\n /** @type {Token} */\n // @ts-expect-error Patch instead of assign required fields to help GC.\n const token = fields || {}\n token.type = type\n token.start = now()\n context.events.push(['enter', token, context])\n stack.push(token)\n return token\n }\n /** @type {Effects['exit']} */\n\n function exit(type) {\n const token = stack.pop()\n token.end = now()\n context.events.push(['exit', token, context])\n return token\n }\n /**\n * Use results.\n *\n * @type {ReturnHandle}\n */\n\n function onsuccessfulconstruct(construct, info) {\n addResult(construct, info.from)\n }\n /**\n * Discard results.\n *\n * @type {ReturnHandle}\n */\n\n function onsuccessfulcheck(_, info) {\n info.restore()\n }\n /**\n * Factory to attempt/check/interrupt.\n *\n * @param {ReturnHandle} onreturn\n * @param {Record} [fields]\n */\n\n function constructFactory(onreturn, fields) {\n return hook\n /**\n * Handle either an object mapping codes to constructs, a list of\n * constructs, or a single construct.\n *\n * @param {Construct|Array|ConstructRecord} constructs\n * @param {State} returnState\n * @param {State} [bogusState]\n * @returns {State}\n */\n\n function hook(constructs, returnState, bogusState) {\n /** @type {Array} */\n let listOfConstructs\n /** @type {number} */\n\n let constructIndex\n /** @type {Construct} */\n\n let currentConstruct\n /** @type {Info} */\n\n let info\n return Array.isArray(constructs)\n ? /* c8 ignore next 1 */\n handleListOfConstructs(constructs)\n : 'tokenize' in constructs // @ts-expect-error Looks like a construct.\n ? handleListOfConstructs([constructs])\n : handleMapOfConstructs(constructs)\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * @returns {State}\n */\n\n function handleMapOfConstructs(map) {\n return start\n /** @type {State} */\n\n function start(code) {\n const def = code !== null && map[code]\n const all = code !== null && map.null\n const list = [\n // To do: add more extension tests.\n\n /* c8 ignore next 2 */\n ...(Array.isArray(def) ? def : def ? [def] : []),\n ...(Array.isArray(all) ? all : all ? [all] : [])\n ]\n return handleListOfConstructs(list)(code)\n }\n }\n /**\n * Handle a list of construct.\n *\n * @param {Array} list\n * @returns {State}\n */\n\n function handleListOfConstructs(list) {\n listOfConstructs = list\n constructIndex = 0\n\n if (list.length === 0) {\n return bogusState\n }\n\n return handleConstruct(list[constructIndex])\n }\n /**\n * Handle a single construct.\n *\n * @param {Construct} construct\n * @returns {State}\n */\n\n function handleConstruct(construct) {\n return start\n /** @type {State} */\n\n function start(code) {\n // To do: not needed to store if there is no bogus state, probably?\n // Currently doesn’t work because `inspect` in document does a check\n // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n // by not storing.\n info = store()\n currentConstruct = construct\n\n if (!construct.partial) {\n context.currentConstruct = construct\n }\n\n if (\n construct.name &&\n context.parser.constructs.disable.null.includes(construct.name)\n ) {\n return nok(code)\n }\n\n return construct.tokenize.call(\n // If we do have fields, create an object w/ `context` as its\n // prototype.\n // This allows a “live binding”, which is needed for `interrupt`.\n fields ? Object.assign(Object.create(context), fields) : context,\n effects,\n ok,\n nok\n )(code)\n }\n }\n /** @type {State} */\n\n function ok(code) {\n consumed = true\n onreturn(currentConstruct, info)\n return returnState\n }\n /** @type {State} */\n\n function nok(code) {\n consumed = true\n info.restore()\n\n if (++constructIndex < listOfConstructs.length) {\n return handleConstruct(listOfConstructs[constructIndex])\n }\n\n return bogusState\n }\n }\n }\n /**\n * @param {Construct} construct\n * @param {number} from\n * @returns {void}\n */\n\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct)\n }\n\n if (construct.resolve) {\n splice(\n context.events,\n from,\n context.events.length - from,\n construct.resolve(context.events.slice(from), context)\n )\n }\n\n if (construct.resolveTo) {\n context.events = construct.resolveTo(context.events, context)\n }\n }\n /**\n * Store state.\n *\n * @returns {Info}\n */\n\n function store() {\n const startPoint = now()\n const startPrevious = context.previous\n const startCurrentConstruct = context.currentConstruct\n const startEventsIndex = context.events.length\n const startStack = Array.from(stack)\n return {\n restore,\n from: startEventsIndex\n }\n /**\n * Restore state.\n *\n * @returns {void}\n */\n\n function restore() {\n point = startPoint\n context.previous = startPrevious\n context.currentConstruct = startCurrentConstruct\n context.events.length = startEventsIndex\n stack = startStack\n accountForPotentialSkip()\n }\n }\n /**\n * Move the current point a bit forward in the line when it’s on a column\n * skip.\n *\n * @returns {void}\n */\n\n function accountForPotentialSkip() {\n if (point.line in columnStart && point.column < 2) {\n point.column = columnStart[point.line]\n point.offset += columnStart[point.line] - 1\n }\n }\n}\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {Array} chunks\n * @param {Pick} token\n * @returns {Array}\n */\n\nfunction sliceChunks(chunks, token) {\n const startIndex = token.start._index\n const startBufferIndex = token.start._bufferIndex\n const endIndex = token.end._index\n const endBufferIndex = token.end._bufferIndex\n /** @type {Array} */\n\n let view\n\n if (startIndex === endIndex) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]\n } else {\n view = chunks.slice(startIndex, endIndex)\n\n if (startBufferIndex > -1) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view[0] = view[0].slice(startBufferIndex)\n }\n\n if (endBufferIndex > 0) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view.push(chunks[endIndex].slice(0, endBufferIndex))\n }\n }\n\n return view\n}\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {Array} chunks\n * @param {boolean} [expandTabs=false]\n * @returns {string}\n */\n\nfunction serializeChunks(chunks, expandTabs) {\n let index = -1\n /** @type {Array} */\n\n const result = []\n /** @type {boolean|undefined} */\n\n let atTab\n\n while (++index < chunks.length) {\n const chunk = chunks[index]\n /** @type {string} */\n\n let value\n\n if (typeof chunk === 'string') {\n value = chunk\n } else\n switch (chunk) {\n case -5: {\n value = '\\r'\n break\n }\n\n case -4: {\n value = '\\n'\n break\n }\n\n case -3: {\n value = '\\r' + '\\n'\n break\n }\n\n case -2: {\n value = expandTabs ? ' ' : '\\t'\n break\n }\n\n case -1: {\n if (!expandTabs && atTab) continue\n value = ' '\n break\n }\n\n default: {\n // Currently only replacement character.\n value = String.fromCharCode(chunk)\n }\n }\n\n atTab = chunk === -2\n result.push(value)\n }\n\n return result.join('')\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding, markdownSpace} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const thematicBreak = {\n name: 'thematicBreak',\n tokenize: tokenizeThematicBreak\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeThematicBreak(effects, ok, nok) {\n let size = 0\n /** @type {NonNullable} */\n\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('thematicBreak')\n marker = code\n return atBreak(code)\n }\n /** @type {State} */\n\n function atBreak(code) {\n if (code === marker) {\n effects.enter('thematicBreakSequence')\n return sequence(code)\n }\n\n if (markdownSpace(code)) {\n return factorySpace(effects, atBreak, 'whitespace')(code)\n }\n\n if (size < 3 || (code !== null && !markdownLineEnding(code))) {\n return nok(code)\n }\n\n effects.exit('thematicBreak')\n return ok(code)\n }\n /** @type {State} */\n\n function sequence(code) {\n if (code === marker) {\n effects.consume(code)\n size++\n return sequence\n }\n\n effects.exit('thematicBreakSequence')\n return atBreak(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Exiter} Exiter\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\n\n/**\n * @typedef {Record & {marker: Code, type: string, size: number}} ListContainerState\n * @typedef {TokenizeContext & {containerState: ListContainerState}} TokenizeContextWithState\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {asciiDigit, markdownSpace} from 'micromark-util-character'\nimport {blankLine} from './blank-line.js'\nimport {thematicBreak} from './thematic-break.js'\n/** @type {Construct} */\n\nexport const list = {\n name: 'list',\n tokenize: tokenizeListStart,\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd\n}\n/** @type {Construct} */\n\nconst listItemPrefixWhitespaceConstruct = {\n tokenize: tokenizeListItemPrefixWhitespace,\n partial: true\n}\n/** @type {Construct} */\n\nconst indentConstruct = {\n tokenize: tokenizeIndent,\n partial: true\n}\n/**\n * @type {Tokenizer}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this\n const tail = self.events[self.events.length - 1]\n let initialSize =\n tail && tail[1].type === 'linePrefix'\n ? tail[2].sliceSerialize(tail[1], true).length\n : 0\n let size = 0\n return start\n /** @type {State} */\n\n function start(code) {\n const kind =\n self.containerState.type ||\n (code === 42 || code === 43 || code === 45\n ? 'listUnordered'\n : 'listOrdered')\n\n if (\n kind === 'listUnordered'\n ? !self.containerState.marker || code === self.containerState.marker\n : asciiDigit(code)\n ) {\n if (!self.containerState.type) {\n self.containerState.type = kind\n effects.enter(kind, {\n _container: true\n })\n }\n\n if (kind === 'listUnordered') {\n effects.enter('listItemPrefix')\n return code === 42 || code === 45\n ? effects.check(thematicBreak, nok, atMarker)(code)\n : atMarker(code)\n }\n\n if (!self.interrupt || code === 49) {\n effects.enter('listItemPrefix')\n effects.enter('listItemValue')\n return inside(code)\n }\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function inside(code) {\n if (asciiDigit(code) && ++size < 10) {\n effects.consume(code)\n return inside\n }\n\n if (\n (!self.interrupt || size < 2) &&\n (self.containerState.marker\n ? code === self.containerState.marker\n : code === 41 || code === 46)\n ) {\n effects.exit('listItemValue')\n return atMarker(code)\n }\n\n return nok(code)\n }\n /**\n * @type {State}\n **/\n\n function atMarker(code) {\n effects.enter('listItemMarker')\n effects.consume(code)\n effects.exit('listItemMarker')\n self.containerState.marker = self.containerState.marker || code\n return effects.check(\n blankLine, // Can’t be empty when interrupting.\n self.interrupt ? nok : onBlank,\n effects.attempt(\n listItemPrefixWhitespaceConstruct,\n endOfPrefix,\n otherPrefix\n )\n )\n }\n /** @type {State} */\n\n function onBlank(code) {\n self.containerState.initialBlankLine = true\n initialSize++\n return endOfPrefix(code)\n }\n /** @type {State} */\n\n function otherPrefix(code) {\n if (markdownSpace(code)) {\n effects.enter('listItemPrefixWhitespace')\n effects.consume(code)\n effects.exit('listItemPrefixWhitespace')\n return endOfPrefix\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function endOfPrefix(code) {\n self.containerState.size =\n initialSize +\n self.sliceSerialize(effects.exit('listItemPrefix'), true).length\n return ok(code)\n }\n}\n/**\n * @type {Tokenizer}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeListContinuation(effects, ok, nok) {\n const self = this\n self.containerState._closeFlow = undefined\n return effects.check(blankLine, onBlank, notBlank)\n /** @type {State} */\n\n function onBlank(code) {\n self.containerState.furtherBlankLines =\n self.containerState.furtherBlankLines ||\n self.containerState.initialBlankLine // We have a blank line.\n // Still, try to consume at most the items size.\n\n return factorySpace(\n effects,\n ok,\n 'listItemIndent',\n self.containerState.size + 1\n )(code)\n }\n /** @type {State} */\n\n function notBlank(code) {\n if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n self.containerState.furtherBlankLines = undefined\n self.containerState.initialBlankLine = undefined\n return notInCurrentItem(code)\n }\n\n self.containerState.furtherBlankLines = undefined\n self.containerState.initialBlankLine = undefined\n return effects.attempt(indentConstruct, ok, notInCurrentItem)(code)\n }\n /** @type {State} */\n\n function notInCurrentItem(code) {\n // While we do continue, we signal that the flow should be closed.\n self.containerState._closeFlow = true // As we’re closing flow, we’re no longer interrupting.\n\n self.interrupt = undefined\n return factorySpace(\n effects,\n effects.attempt(list, ok, nok),\n 'linePrefix',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )(code)\n }\n}\n/**\n * @type {Tokenizer}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this\n return factorySpace(\n effects,\n afterPrefix,\n 'listItemIndent',\n self.containerState.size + 1\n )\n /** @type {State} */\n\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === 'listItemIndent' &&\n tail[2].sliceSerialize(tail[1], true).length === self.containerState.size\n ? ok(code)\n : nok(code)\n }\n}\n/**\n * @type {Exiter}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type)\n}\n/**\n * @type {Tokenizer}\n * @this {TokenizeContextWithState}\n */\n\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this\n return factorySpace(\n effects,\n afterPrefix,\n 'listItemPrefixWhitespace',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4 + 1\n )\n /** @type {State} */\n\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return !markdownSpace(code) &&\n tail &&\n tail[1].type === 'listItemPrefixWhitespace'\n ? ok(code)\n : nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Exiter} Exiter\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownSpace} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const blockQuote = {\n name: 'blockQuote',\n tokenize: tokenizeBlockQuoteStart,\n continuation: {\n tokenize: tokenizeBlockQuoteContinuation\n },\n exit\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeBlockQuoteStart(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n if (code === 62) {\n const state = self.containerState\n\n if (!state.open) {\n effects.enter('blockQuote', {\n _container: true\n })\n state.open = true\n }\n\n effects.enter('blockQuotePrefix')\n effects.enter('blockQuoteMarker')\n effects.consume(code)\n effects.exit('blockQuoteMarker')\n return after\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function after(code) {\n if (markdownSpace(code)) {\n effects.enter('blockQuotePrefixWhitespace')\n effects.consume(code)\n effects.exit('blockQuotePrefixWhitespace')\n effects.exit('blockQuotePrefix')\n return ok\n }\n\n effects.exit('blockQuotePrefix')\n return ok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeBlockQuoteContinuation(effects, ok, nok) {\n return factorySpace(\n effects,\n effects.attempt(blockQuote, ok, nok),\n 'linePrefix',\n this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4\n )\n}\n/** @type {Exiter} */\n\nfunction exit(effects) {\n effects.exit('blockQuote')\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n */\nimport {\n asciiControl,\n markdownLineEndingOrSpace,\n markdownLineEnding\n} from 'micromark-util-character'\n\n/**\n * @param {Effects} effects\n * @param {State} ok\n * @param {State} nok\n * @param {string} type\n * @param {string} literalType\n * @param {string} literalMarkerType\n * @param {string} rawType\n * @param {string} stringType\n * @param {number} [max=Infinity]\n * @returns {State}\n */\n// eslint-disable-next-line max-params\nexport function factoryDestination(\n effects,\n ok,\n nok,\n type,\n literalType,\n literalMarkerType,\n rawType,\n stringType,\n max\n) {\n const limit = max || Number.POSITIVE_INFINITY\n let balance = 0\n return start\n /** @type {State} */\n\n function start(code) {\n if (code === 60) {\n effects.enter(type)\n effects.enter(literalType)\n effects.enter(literalMarkerType)\n effects.consume(code)\n effects.exit(literalMarkerType)\n return destinationEnclosedBefore\n }\n\n if (code === null || code === 41 || asciiControl(code)) {\n return nok(code)\n }\n\n effects.enter(type)\n effects.enter(rawType)\n effects.enter(stringType)\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return destinationRaw(code)\n }\n /** @type {State} */\n\n function destinationEnclosedBefore(code) {\n if (code === 62) {\n effects.enter(literalMarkerType)\n effects.consume(code)\n effects.exit(literalMarkerType)\n effects.exit(literalType)\n effects.exit(type)\n return ok\n }\n\n effects.enter(stringType)\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return destinationEnclosed(code)\n }\n /** @type {State} */\n\n function destinationEnclosed(code) {\n if (code === 62) {\n effects.exit('chunkString')\n effects.exit(stringType)\n return destinationEnclosedBefore(code)\n }\n\n if (code === null || code === 60 || markdownLineEnding(code)) {\n return nok(code)\n }\n\n effects.consume(code)\n return code === 92 ? destinationEnclosedEscape : destinationEnclosed\n }\n /** @type {State} */\n\n function destinationEnclosedEscape(code) {\n if (code === 60 || code === 62 || code === 92) {\n effects.consume(code)\n return destinationEnclosed\n }\n\n return destinationEnclosed(code)\n }\n /** @type {State} */\n\n function destinationRaw(code) {\n if (code === 40) {\n if (++balance > limit) return nok(code)\n effects.consume(code)\n return destinationRaw\n }\n\n if (code === 41) {\n if (!balance--) {\n effects.exit('chunkString')\n effects.exit(stringType)\n effects.exit(rawType)\n effects.exit(type)\n return ok(code)\n }\n\n effects.consume(code)\n return destinationRaw\n }\n\n if (code === null || markdownLineEndingOrSpace(code)) {\n if (balance) return nok(code)\n effects.exit('chunkString')\n effects.exit(stringType)\n effects.exit(rawType)\n effects.exit(type)\n return ok(code)\n }\n\n if (asciiControl(code)) return nok(code)\n effects.consume(code)\n return code === 92 ? destinationRawEscape : destinationRaw\n }\n /** @type {State} */\n\n function destinationRawEscape(code) {\n if (code === 40 || code === 41 || code === 92) {\n effects.consume(code)\n return destinationRaw\n }\n\n return destinationRaw(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').State} State\n */\nimport {markdownLineEnding, markdownSpace} from 'micromark-util-character'\n\n/**\n * @this {TokenizeContext}\n * @param {Effects} effects\n * @param {State} ok\n * @param {State} nok\n * @param {string} type\n * @param {string} markerType\n * @param {string} stringType\n * @returns {State}\n */\n// eslint-disable-next-line max-params\nexport function factoryLabel(effects, ok, nok, type, markerType, stringType) {\n const self = this\n let size = 0\n /** @type {boolean} */\n\n let data\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter(type)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.enter(stringType)\n return atBreak\n }\n /** @type {State} */\n\n function atBreak(code) {\n if (\n code === null ||\n code === 91 ||\n (code === 93 && !data) ||\n /* To do: remove in the future once we’ve switched from\n * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n * which doesn’t need this */\n\n /* Hidden footnotes hook */\n\n /* c8 ignore next 3 */\n (code === 94 &&\n !size &&\n '_hiddenFootnoteSupport' in self.parser.constructs) ||\n size > 999\n ) {\n return nok(code)\n }\n\n if (code === 93) {\n effects.exit(stringType)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.exit(type)\n return ok\n }\n\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return atBreak\n }\n\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return label(code)\n }\n /** @type {State} */\n\n function label(code) {\n if (\n code === null ||\n code === 91 ||\n code === 93 ||\n markdownLineEnding(code) ||\n size++ > 999\n ) {\n effects.exit('chunkString')\n return atBreak(code)\n }\n\n effects.consume(code)\n data = data || !markdownSpace(code)\n return code === 92 ? labelEscape : label\n }\n /** @type {State} */\n\n function labelEscape(code) {\n if (code === 91 || code === 92 || code === 93) {\n effects.consume(code)\n size++\n return label\n }\n\n return label(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/**\n * @param {Effects} effects\n * @param {State} ok\n * @param {State} nok\n * @param {string} type\n * @param {string} markerType\n * @param {string} stringType\n * @returns {State}\n */\n// eslint-disable-next-line max-params\nexport function factoryTitle(effects, ok, nok, type, markerType, stringType) {\n /** @type {NonNullable} */\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter(type)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n marker = code === 40 ? 41 : code\n return atFirstTitleBreak\n }\n /** @type {State} */\n\n function atFirstTitleBreak(code) {\n if (code === marker) {\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.exit(type)\n return ok\n }\n\n effects.enter(stringType)\n return atTitleBreak(code)\n }\n /** @type {State} */\n\n function atTitleBreak(code) {\n if (code === marker) {\n effects.exit(stringType)\n return atFirstTitleBreak(marker)\n }\n\n if (code === null) {\n return nok(code)\n } // Note: blank lines can’t exist in content.\n\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(effects, atTitleBreak, 'linePrefix')\n }\n\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return title(code)\n }\n /** @type {State} */\n\n function title(code) {\n if (code === marker || code === null || markdownLineEnding(code)) {\n effects.exit('chunkString')\n return atTitleBreak(code)\n }\n\n effects.consume(code)\n return code === 92 ? titleEscape : title\n }\n /** @type {State} */\n\n function titleEscape(code) {\n if (code === marker || code === 92) {\n effects.consume(code)\n return title\n }\n\n return title(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding, markdownSpace} from 'micromark-util-character'\n\n/**\n * @param {Effects} effects\n * @param {State} ok\n */\nexport function factoryWhitespace(effects, ok) {\n /** @type {boolean} */\n let seen\n return start\n /** @type {State} */\n\n function start(code) {\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n seen = true\n return start\n }\n\n if (markdownSpace(code)) {\n return factorySpace(\n effects,\n start,\n seen ? 'linePrefix' : 'lineSuffix'\n )(code)\n }\n\n return ok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factoryDestination} from 'micromark-factory-destination'\nimport {factoryLabel} from 'micromark-factory-label'\nimport {factorySpace} from 'micromark-factory-space'\nimport {factoryTitle} from 'micromark-factory-title'\nimport {factoryWhitespace} from 'micromark-factory-whitespace'\nimport {normalizeIdentifier} from 'micromark-util-normalize-identifier'\nimport {\n markdownLineEnding,\n markdownLineEndingOrSpace\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const definition = {\n name: 'definition',\n tokenize: tokenizeDefinition\n}\n/** @type {Construct} */\n\nconst titleConstruct = {\n tokenize: tokenizeTitle,\n partial: true\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeDefinition(effects, ok, nok) {\n const self = this\n /** @type {string} */\n\n let identifier\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('definition')\n return factoryLabel.call(\n self,\n effects,\n labelAfter,\n nok,\n 'definitionLabel',\n 'definitionLabelMarker',\n 'definitionLabelString'\n )(code)\n }\n /** @type {State} */\n\n function labelAfter(code) {\n identifier = normalizeIdentifier(\n self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)\n )\n\n if (code === 58) {\n effects.enter('definitionMarker')\n effects.consume(code)\n effects.exit('definitionMarker') // Note: blank lines can’t exist in content.\n\n return factoryWhitespace(\n effects,\n factoryDestination(\n effects,\n effects.attempt(\n titleConstruct,\n factorySpace(effects, after, 'whitespace'),\n factorySpace(effects, after, 'whitespace')\n ),\n nok,\n 'definitionDestination',\n 'definitionDestinationLiteral',\n 'definitionDestinationLiteralMarker',\n 'definitionDestinationRaw',\n 'definitionDestinationString'\n )\n )\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function after(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('definition')\n\n if (!self.parser.defined.includes(identifier)) {\n self.parser.defined.push(identifier)\n }\n\n return ok(code)\n }\n\n return nok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeTitle(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n return markdownLineEndingOrSpace(code)\n ? factoryWhitespace(effects, before)(code)\n : nok(code)\n }\n /** @type {State} */\n\n function before(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(\n effects,\n factorySpace(effects, after, 'whitespace'),\n nok,\n 'definitionTitle',\n 'definitionTitleMarker',\n 'definitionTitleString'\n )(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function after(code) {\n return code === null || markdownLineEnding(code) ? ok(code) : nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const codeIndented = {\n name: 'codeIndented',\n tokenize: tokenizeCodeIndented\n}\n/** @type {Construct} */\n\nconst indentedContent = {\n tokenize: tokenizeIndentedContent,\n partial: true\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCodeIndented(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('codeIndented')\n return factorySpace(effects, afterStartPrefix, 'linePrefix', 4 + 1)(code)\n }\n /** @type {State} */\n\n function afterStartPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === 'linePrefix' &&\n tail[2].sliceSerialize(tail[1], true).length >= 4\n ? afterPrefix(code)\n : nok(code)\n }\n /** @type {State} */\n\n function afterPrefix(code) {\n if (code === null) {\n return after(code)\n }\n\n if (markdownLineEnding(code)) {\n return effects.attempt(indentedContent, afterPrefix, after)(code)\n }\n\n effects.enter('codeFlowValue')\n return content(code)\n }\n /** @type {State} */\n\n function content(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('codeFlowValue')\n return afterPrefix(code)\n }\n\n effects.consume(code)\n return content\n }\n /** @type {State} */\n\n function after(code) {\n effects.exit('codeIndented')\n return ok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeIndentedContent(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n // If this is a lazy line, it can’t be code.\n if (self.parser.lazy[self.now().line]) {\n return nok(code)\n }\n\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return start\n }\n\n return factorySpace(effects, afterPrefix, 'linePrefix', 4 + 1)(code)\n }\n /** @type {State} */\n\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === 'linePrefix' &&\n tail[2].sliceSerialize(tail[1], true).length >= 4\n ? ok(code)\n : markdownLineEnding(code)\n ? start(code)\n : nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {\n markdownLineEnding,\n markdownLineEndingOrSpace,\n markdownSpace\n} from 'micromark-util-character'\nimport {splice} from 'micromark-util-chunked'\n\n/** @type {Construct} */\nexport const headingAtx = {\n name: 'headingAtx',\n tokenize: tokenizeHeadingAtx,\n resolve: resolveHeadingAtx\n}\n/** @type {Resolver} */\n\nfunction resolveHeadingAtx(events, context) {\n let contentEnd = events.length - 2\n let contentStart = 3\n /** @type {Token} */\n\n let content\n /** @type {Token} */\n\n let text // Prefix whitespace, part of the opening.\n\n if (events[contentStart][1].type === 'whitespace') {\n contentStart += 2\n } // Suffix whitespace, part of the closing.\n\n if (\n contentEnd - 2 > contentStart &&\n events[contentEnd][1].type === 'whitespace'\n ) {\n contentEnd -= 2\n }\n\n if (\n events[contentEnd][1].type === 'atxHeadingSequence' &&\n (contentStart === contentEnd - 1 ||\n (contentEnd - 4 > contentStart &&\n events[contentEnd - 2][1].type === 'whitespace'))\n ) {\n contentEnd -= contentStart + 1 === contentEnd ? 2 : 4\n }\n\n if (contentEnd > contentStart) {\n content = {\n type: 'atxHeadingText',\n start: events[contentStart][1].start,\n end: events[contentEnd][1].end\n }\n text = {\n type: 'chunkText',\n start: events[contentStart][1].start,\n end: events[contentEnd][1].end,\n // @ts-expect-error Constants are fine to assign.\n contentType: 'text'\n }\n splice(events, contentStart, contentEnd - contentStart + 1, [\n ['enter', content, context],\n ['enter', text, context],\n ['exit', text, context],\n ['exit', content, context]\n ])\n }\n\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeHeadingAtx(effects, ok, nok) {\n const self = this\n let size = 0\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('atxHeading')\n effects.enter('atxHeadingSequence')\n return fenceOpenInside(code)\n }\n /** @type {State} */\n\n function fenceOpenInside(code) {\n if (code === 35 && size++ < 6) {\n effects.consume(code)\n return fenceOpenInside\n }\n\n if (code === null || markdownLineEndingOrSpace(code)) {\n effects.exit('atxHeadingSequence')\n return self.interrupt ? ok(code) : headingBreak(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function headingBreak(code) {\n if (code === 35) {\n effects.enter('atxHeadingSequence')\n return sequence(code)\n }\n\n if (code === null || markdownLineEnding(code)) {\n effects.exit('atxHeading')\n return ok(code)\n }\n\n if (markdownSpace(code)) {\n return factorySpace(effects, headingBreak, 'whitespace')(code)\n }\n\n effects.enter('atxHeadingText')\n return data(code)\n }\n /** @type {State} */\n\n function sequence(code) {\n if (code === 35) {\n effects.consume(code)\n return sequence\n }\n\n effects.exit('atxHeadingSequence')\n return headingBreak(code)\n }\n /** @type {State} */\n\n function data(code) {\n if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {\n effects.exit('atxHeadingText')\n return headingBreak(code)\n }\n\n effects.consume(code)\n return data\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const setextUnderline = {\n name: 'setextUnderline',\n tokenize: tokenizeSetextUnderline,\n resolveTo: resolveToSetextUnderline\n}\n/** @type {Resolver} */\n\nfunction resolveToSetextUnderline(events, context) {\n let index = events.length\n /** @type {number|undefined} */\n\n let content\n /** @type {number|undefined} */\n\n let text\n /** @type {number|undefined} */\n\n let definition // Find the opening of the content.\n // It’ll always exist: we don’t tokenize if it isn’t there.\n\n while (index--) {\n if (events[index][0] === 'enter') {\n if (events[index][1].type === 'content') {\n content = index\n break\n }\n\n if (events[index][1].type === 'paragraph') {\n text = index\n }\n } // Exit\n else {\n if (events[index][1].type === 'content') {\n // Remove the content end (if needed we’ll add it later)\n events.splice(index, 1)\n }\n\n if (!definition && events[index][1].type === 'definition') {\n definition = index\n }\n }\n }\n\n const heading = {\n type: 'setextHeading',\n start: Object.assign({}, events[text][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n } // Change the paragraph to setext heading text.\n\n events[text][1].type = 'setextHeadingText' // If we have definitions in the content, we’ll keep on having content,\n // but we need move it.\n\n if (definition) {\n events.splice(text, 0, ['enter', heading, context])\n events.splice(definition + 1, 0, ['exit', events[content][1], context])\n events[content][1].end = Object.assign({}, events[definition][1].end)\n } else {\n events[content][1] = heading\n } // Add the heading exit at the end.\n\n events.push(['exit', heading, context])\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n const self = this\n let index = self.events.length\n /** @type {NonNullable} */\n\n let marker\n /** @type {boolean} */\n\n let paragraph // Find an opening.\n\n while (index--) {\n // Skip enter/exit of line ending, line prefix, and content.\n // We can now either have a definition or a paragraph.\n if (\n self.events[index][1].type !== 'lineEnding' &&\n self.events[index][1].type !== 'linePrefix' &&\n self.events[index][1].type !== 'content'\n ) {\n paragraph = self.events[index][1].type === 'paragraph'\n break\n }\n }\n\n return start\n /** @type {State} */\n\n function start(code) {\n if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n effects.enter('setextHeadingLine')\n effects.enter('setextHeadingLineSequence')\n marker = code\n return closingSequence(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function closingSequence(code) {\n if (code === marker) {\n effects.consume(code)\n return closingSequence\n }\n\n effects.exit('setextHeadingLineSequence')\n return factorySpace(effects, closingSequenceEnd, 'lineSuffix')(code)\n }\n /** @type {State} */\n\n function closingSequenceEnd(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('setextHeadingLine')\n return ok(code)\n }\n\n return nok(code)\n }\n}\n","/**\n * List of lowercase HTML tag names which when parsing HTML (flow), result\n * in more relaxed rules (condition 6): because they are known blocks, the\n * HTML-like syntax doesn’t have to be strictly parsed.\n * For tag names not in this list, a more strict algorithm (condition 7) is used\n * to detect whether the HTML-like syntax is seen as HTML (flow) or not.\n *\n * This is copied from:\n * .\n */\nexport const htmlBlockNames = [\n 'address',\n 'article',\n 'aside',\n 'base',\n 'basefont',\n 'blockquote',\n 'body',\n 'caption',\n 'center',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'frame',\n 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'iframe',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'menu',\n 'menuitem',\n 'nav',\n 'noframes',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'param',\n 'section',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'track',\n 'ul'\n]\n\n/**\n * List of lowercase HTML tag names which when parsing HTML (flow), result in\n * HTML that can include lines w/o exiting, until a closing tag also in this\n * list is found (condition 1).\n *\n * This module is copied from:\n * .\n *\n * Note that `textarea` was added in `CommonMark@0.30`.\n */\nexport const htmlRawNames = ['pre', 'script', 'style', 'textarea']\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {\n asciiAlpha,\n asciiAlphanumeric,\n markdownLineEnding,\n markdownLineEndingOrSpace,\n markdownSpace\n} from 'micromark-util-character'\nimport {htmlBlockNames, htmlRawNames} from 'micromark-util-html-tag-name'\nimport {blankLine} from './blank-line.js'\n/** @type {Construct} */\n\nexport const htmlFlow = {\n name: 'htmlFlow',\n tokenize: tokenizeHtmlFlow,\n resolveTo: resolveToHtmlFlow,\n concrete: true\n}\n/** @type {Construct} */\n\nconst nextBlankConstruct = {\n tokenize: tokenizeNextBlank,\n partial: true\n}\n/** @type {Resolver} */\n\nfunction resolveToHtmlFlow(events) {\n let index = events.length\n\n while (index--) {\n if (events[index][0] === 'enter' && events[index][1].type === 'htmlFlow') {\n break\n }\n }\n\n if (index > 1 && events[index - 2][1].type === 'linePrefix') {\n // Add the prefix start to the HTML token.\n events[index][1].start = events[index - 2][1].start // Add the prefix start to the HTML line token.\n\n events[index + 1][1].start = events[index - 2][1].start // Remove the line prefix.\n\n events.splice(index - 2, 2)\n }\n\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeHtmlFlow(effects, ok, nok) {\n const self = this\n /** @type {number} */\n\n let kind\n /** @type {boolean} */\n\n let startTag\n /** @type {string} */\n\n let buffer\n /** @type {number} */\n\n let index\n /** @type {Code} */\n\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('htmlFlow')\n effects.enter('htmlFlowData')\n effects.consume(code)\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 33) {\n effects.consume(code)\n return declarationStart\n }\n\n if (code === 47) {\n effects.consume(code)\n return tagCloseStart\n }\n\n if (code === 63) {\n effects.consume(code)\n kind = 3 // While we’re in an instruction instead of a declaration, we’re on a `?`\n // right now, so we do need to search for `>`, similar to declarations.\n\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n if (asciiAlpha(code)) {\n effects.consume(code)\n buffer = String.fromCharCode(code)\n startTag = true\n return tagName\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function declarationStart(code) {\n if (code === 45) {\n effects.consume(code)\n kind = 2\n return commentOpenInside\n }\n\n if (code === 91) {\n effects.consume(code)\n kind = 5\n buffer = 'CDATA['\n index = 0\n return cdataOpenInside\n }\n\n if (asciiAlpha(code)) {\n effects.consume(code)\n kind = 4\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function commentOpenInside(code) {\n if (code === 45) {\n effects.consume(code)\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function cdataOpenInside(code) {\n if (code === buffer.charCodeAt(index++)) {\n effects.consume(code)\n return index === buffer.length\n ? self.interrupt\n ? ok\n : continuation\n : cdataOpenInside\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagCloseStart(code) {\n if (asciiAlpha(code)) {\n effects.consume(code)\n buffer = String.fromCharCode(code)\n return tagName\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagName(code) {\n if (\n code === null ||\n code === 47 ||\n code === 62 ||\n markdownLineEndingOrSpace(code)\n ) {\n if (\n code !== 47 &&\n startTag &&\n htmlRawNames.includes(buffer.toLowerCase())\n ) {\n kind = 1\n return self.interrupt ? ok(code) : continuation(code)\n }\n\n if (htmlBlockNames.includes(buffer.toLowerCase())) {\n kind = 6\n\n if (code === 47) {\n effects.consume(code)\n return basicSelfClosing\n }\n\n return self.interrupt ? ok(code) : continuation(code)\n }\n\n kind = 7 // Do not support complete HTML when interrupting\n\n return self.interrupt && !self.parser.lazy[self.now().line]\n ? nok(code)\n : startTag\n ? completeAttributeNameBefore(code)\n : completeClosingTagAfter(code)\n }\n\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code)\n buffer += String.fromCharCode(code)\n return tagName\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function basicSelfClosing(code) {\n if (code === 62) {\n effects.consume(code)\n return self.interrupt ? ok : continuation\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function completeClosingTagAfter(code) {\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeClosingTagAfter\n }\n\n return completeEnd(code)\n }\n /** @type {State} */\n\n function completeAttributeNameBefore(code) {\n if (code === 47) {\n effects.consume(code)\n return completeEnd\n }\n\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code)\n return completeAttributeName\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeAttributeNameBefore\n }\n\n return completeEnd(code)\n }\n /** @type {State} */\n\n function completeAttributeName(code) {\n if (\n code === 45 ||\n code === 46 ||\n code === 58 ||\n code === 95 ||\n asciiAlphanumeric(code)\n ) {\n effects.consume(code)\n return completeAttributeName\n }\n\n return completeAttributeNameAfter(code)\n }\n /** @type {State} */\n\n function completeAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code)\n return completeAttributeValueBefore\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeAttributeNameAfter\n }\n\n return completeAttributeNameBefore(code)\n }\n /** @type {State} */\n\n function completeAttributeValueBefore(code) {\n if (\n code === null ||\n code === 60 ||\n code === 61 ||\n code === 62 ||\n code === 96\n ) {\n return nok(code)\n }\n\n if (code === 34 || code === 39) {\n effects.consume(code)\n marker = code\n return completeAttributeValueQuoted\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeAttributeValueBefore\n }\n\n marker = null\n return completeAttributeValueUnquoted(code)\n }\n /** @type {State} */\n\n function completeAttributeValueQuoted(code) {\n if (code === null || markdownLineEnding(code)) {\n return nok(code)\n }\n\n if (code === marker) {\n effects.consume(code)\n return completeAttributeValueQuotedAfter\n }\n\n effects.consume(code)\n return completeAttributeValueQuoted\n }\n /** @type {State} */\n\n function completeAttributeValueUnquoted(code) {\n if (\n code === null ||\n code === 34 ||\n code === 39 ||\n code === 60 ||\n code === 61 ||\n code === 62 ||\n code === 96 ||\n markdownLineEndingOrSpace(code)\n ) {\n return completeAttributeNameAfter(code)\n }\n\n effects.consume(code)\n return completeAttributeValueUnquoted\n }\n /** @type {State} */\n\n function completeAttributeValueQuotedAfter(code) {\n if (code === 47 || code === 62 || markdownSpace(code)) {\n return completeAttributeNameBefore(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function completeEnd(code) {\n if (code === 62) {\n effects.consume(code)\n return completeAfter\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function completeAfter(code) {\n if (markdownSpace(code)) {\n effects.consume(code)\n return completeAfter\n }\n\n return code === null || markdownLineEnding(code)\n ? continuation(code)\n : nok(code)\n }\n /** @type {State} */\n\n function continuation(code) {\n if (code === 45 && kind === 2) {\n effects.consume(code)\n return continuationCommentInside\n }\n\n if (code === 60 && kind === 1) {\n effects.consume(code)\n return continuationRawTagOpen\n }\n\n if (code === 62 && kind === 4) {\n effects.consume(code)\n return continuationClose\n }\n\n if (code === 63 && kind === 3) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n if (code === 93 && kind === 5) {\n effects.consume(code)\n return continuationCharacterDataInside\n }\n\n if (markdownLineEnding(code) && (kind === 6 || kind === 7)) {\n return effects.check(\n nextBlankConstruct,\n continuationClose,\n continuationAtLineEnding\n )(code)\n }\n\n if (code === null || markdownLineEnding(code)) {\n return continuationAtLineEnding(code)\n }\n\n effects.consume(code)\n return continuation\n }\n /** @type {State} */\n\n function continuationAtLineEnding(code) {\n effects.exit('htmlFlowData')\n return htmlContinueStart(code)\n }\n /** @type {State} */\n\n function htmlContinueStart(code) {\n if (code === null) {\n return done(code)\n }\n\n if (markdownLineEnding(code)) {\n return effects.attempt(\n {\n tokenize: htmlLineEnd,\n partial: true\n },\n htmlContinueStart,\n done\n )(code)\n }\n\n effects.enter('htmlFlowData')\n return continuation(code)\n }\n /** @type {Tokenizer} */\n\n function htmlLineEnd(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return lineStart\n }\n /** @type {State} */\n\n function lineStart(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code)\n }\n }\n /** @type {State} */\n\n function continuationCommentInside(code) {\n if (code === 45) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationRawTagOpen(code) {\n if (code === 47) {\n effects.consume(code)\n buffer = ''\n return continuationRawEndTag\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationRawEndTag(code) {\n if (code === 62 && htmlRawNames.includes(buffer.toLowerCase())) {\n effects.consume(code)\n return continuationClose\n }\n\n if (asciiAlpha(code) && buffer.length < 8) {\n effects.consume(code)\n buffer += String.fromCharCode(code)\n return continuationRawEndTag\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationCharacterDataInside(code) {\n if (code === 93) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationDeclarationInside(code) {\n if (code === 62) {\n effects.consume(code)\n return continuationClose\n } // More dashes.\n\n if (code === 45 && kind === 2) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n /** @type {State} */\n\n function continuationClose(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('htmlFlowData')\n return done(code)\n }\n\n effects.consume(code)\n return continuationClose\n }\n /** @type {State} */\n\n function done(code) {\n effects.exit('htmlFlow')\n return ok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeNextBlank(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.exit('htmlFlowData')\n effects.enter('lineEndingBlank')\n effects.consume(code)\n effects.exit('lineEndingBlank')\n return effects.attempt(blankLine, ok, nok)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {\n markdownLineEnding,\n markdownLineEndingOrSpace\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const codeFenced = {\n name: 'codeFenced',\n tokenize: tokenizeCodeFenced,\n concrete: true\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCodeFenced(effects, ok, nok) {\n const self = this\n /** @type {Construct} */\n\n const closingFenceConstruct = {\n tokenize: tokenizeClosingFence,\n partial: true\n }\n /** @type {Construct} */\n\n const nonLazyLine = {\n tokenize: tokenizeNonLazyLine,\n partial: true\n }\n const tail = this.events[this.events.length - 1]\n const initialPrefix =\n tail && tail[1].type === 'linePrefix'\n ? tail[2].sliceSerialize(tail[1], true).length\n : 0\n let sizeOpen = 0\n /** @type {NonNullable} */\n\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('codeFenced')\n effects.enter('codeFencedFence')\n effects.enter('codeFencedFenceSequence')\n marker = code\n return sequenceOpen(code)\n }\n /** @type {State} */\n\n function sequenceOpen(code) {\n if (code === marker) {\n effects.consume(code)\n sizeOpen++\n return sequenceOpen\n }\n\n effects.exit('codeFencedFenceSequence')\n return sizeOpen < 3\n ? nok(code)\n : factorySpace(effects, infoOpen, 'whitespace')(code)\n }\n /** @type {State} */\n\n function infoOpen(code) {\n if (code === null || markdownLineEnding(code)) {\n return openAfter(code)\n }\n\n effects.enter('codeFencedFenceInfo')\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return info(code)\n }\n /** @type {State} */\n\n function info(code) {\n if (code === null || markdownLineEndingOrSpace(code)) {\n effects.exit('chunkString')\n effects.exit('codeFencedFenceInfo')\n return factorySpace(effects, infoAfter, 'whitespace')(code)\n }\n\n if (code === 96 && code === marker) return nok(code)\n effects.consume(code)\n return info\n }\n /** @type {State} */\n\n function infoAfter(code) {\n if (code === null || markdownLineEnding(code)) {\n return openAfter(code)\n }\n\n effects.enter('codeFencedFenceMeta')\n effects.enter('chunkString', {\n contentType: 'string'\n })\n return meta(code)\n }\n /** @type {State} */\n\n function meta(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('chunkString')\n effects.exit('codeFencedFenceMeta')\n return openAfter(code)\n }\n\n if (code === 96 && code === marker) return nok(code)\n effects.consume(code)\n return meta\n }\n /** @type {State} */\n\n function openAfter(code) {\n effects.exit('codeFencedFence')\n return self.interrupt ? ok(code) : contentStart(code)\n }\n /** @type {State} */\n\n function contentStart(code) {\n if (code === null) {\n return after(code)\n }\n\n if (markdownLineEnding(code)) {\n return effects.attempt(\n nonLazyLine,\n effects.attempt(\n closingFenceConstruct,\n after,\n initialPrefix\n ? factorySpace(\n effects,\n contentStart,\n 'linePrefix',\n initialPrefix + 1\n )\n : contentStart\n ),\n after\n )(code)\n }\n\n effects.enter('codeFlowValue')\n return contentContinue(code)\n }\n /** @type {State} */\n\n function contentContinue(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('codeFlowValue')\n return contentStart(code)\n }\n\n effects.consume(code)\n return contentContinue\n }\n /** @type {State} */\n\n function after(code) {\n effects.exit('codeFenced')\n return ok(code)\n }\n /** @type {Tokenizer} */\n\n function tokenizeNonLazyLine(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return lineStart\n }\n /** @type {State} */\n\n function lineStart(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code)\n }\n }\n /** @type {Tokenizer} */\n\n function tokenizeClosingFence(effects, ok, nok) {\n let size = 0\n return factorySpace(\n effects,\n closingSequenceStart,\n 'linePrefix',\n this.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )\n /** @type {State} */\n\n function closingSequenceStart(code) {\n effects.enter('codeFencedFence')\n effects.enter('codeFencedFenceSequence')\n return closingSequence(code)\n }\n /** @type {State} */\n\n function closingSequence(code) {\n if (code === marker) {\n effects.consume(code)\n size++\n return closingSequence\n }\n\n if (size < sizeOpen) return nok(code)\n effects.exit('codeFencedFenceSequence')\n return factorySpace(effects, closingSequenceEnd, 'whitespace')(code)\n }\n /** @type {State} */\n\n function closingSequenceEnd(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit('codeFencedFence')\n return ok(code)\n }\n\n return nok(code)\n }\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {decodeNamedCharacterReference} from 'decode-named-character-reference'\nimport {\n asciiAlphanumeric,\n asciiDigit,\n asciiHexDigit\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const characterReference = {\n name: 'characterReference',\n tokenize: tokenizeCharacterReference\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCharacterReference(effects, ok, nok) {\n const self = this\n let size = 0\n /** @type {number} */\n\n let max\n /** @type {(code: Code) => code is number} */\n\n let test\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('characterReference')\n effects.enter('characterReferenceMarker')\n effects.consume(code)\n effects.exit('characterReferenceMarker')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 35) {\n effects.enter('characterReferenceMarkerNumeric')\n effects.consume(code)\n effects.exit('characterReferenceMarkerNumeric')\n return numeric\n }\n\n effects.enter('characterReferenceValue')\n max = 31\n test = asciiAlphanumeric\n return value(code)\n }\n /** @type {State} */\n\n function numeric(code) {\n if (code === 88 || code === 120) {\n effects.enter('characterReferenceMarkerHexadecimal')\n effects.consume(code)\n effects.exit('characterReferenceMarkerHexadecimal')\n effects.enter('characterReferenceValue')\n max = 6\n test = asciiHexDigit\n return value\n }\n\n effects.enter('characterReferenceValue')\n max = 7\n test = asciiDigit\n return value(code)\n }\n /** @type {State} */\n\n function value(code) {\n /** @type {Token} */\n let token\n\n if (code === 59 && size) {\n token = effects.exit('characterReferenceValue')\n\n if (\n test === asciiAlphanumeric &&\n !decodeNamedCharacterReference(self.sliceSerialize(token))\n ) {\n return nok(code)\n }\n\n effects.enter('characterReferenceMarker')\n effects.consume(code)\n effects.exit('characterReferenceMarker')\n effects.exit('characterReference')\n return ok\n }\n\n if (test(code) && size++ < max) {\n effects.consume(code)\n return value\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {asciiPunctuation} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const characterEscape = {\n name: 'characterEscape',\n tokenize: tokenizeCharacterEscape\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCharacterEscape(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('characterEscape')\n effects.enter('escapeMarker')\n effects.consume(code)\n effects.exit('escapeMarker')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (asciiPunctuation(code)) {\n effects.enter('characterEscapeValue')\n effects.consume(code)\n effects.exit('characterEscapeValue')\n effects.exit('characterEscape')\n return ok\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const lineEnding = {\n name: 'lineEnding',\n tokenize: tokenizeLineEnding\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeLineEnding(effects, ok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(effects, ok, 'linePrefix')\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factoryDestination} from 'micromark-factory-destination'\nimport {factoryLabel} from 'micromark-factory-label'\nimport {factoryTitle} from 'micromark-factory-title'\nimport {factoryWhitespace} from 'micromark-factory-whitespace'\nimport {markdownLineEndingOrSpace} from 'micromark-util-character'\nimport {push, splice} from 'micromark-util-chunked'\nimport {normalizeIdentifier} from 'micromark-util-normalize-identifier'\nimport {resolveAll} from 'micromark-util-resolve-all'\n\n/** @type {Construct} */\nexport const labelEnd = {\n name: 'labelEnd',\n tokenize: tokenizeLabelEnd,\n resolveTo: resolveToLabelEnd,\n resolveAll: resolveAllLabelEnd\n}\n/** @type {Construct} */\n\nconst resourceConstruct = {\n tokenize: tokenizeResource\n}\n/** @type {Construct} */\n\nconst fullReferenceConstruct = {\n tokenize: tokenizeFullReference\n}\n/** @type {Construct} */\n\nconst collapsedReferenceConstruct = {\n tokenize: tokenizeCollapsedReference\n}\n/** @type {Resolver} */\n\nfunction resolveAllLabelEnd(events) {\n let index = -1\n /** @type {Token} */\n\n let token\n\n while (++index < events.length) {\n token = events[index][1]\n\n if (\n token.type === 'labelImage' ||\n token.type === 'labelLink' ||\n token.type === 'labelEnd'\n ) {\n // Remove the marker.\n events.splice(index + 1, token.type === 'labelImage' ? 4 : 2)\n token.type = 'data'\n index++\n }\n }\n\n return events\n}\n/** @type {Resolver} */\n\nfunction resolveToLabelEnd(events, context) {\n let index = events.length\n let offset = 0\n /** @type {Token} */\n\n let token\n /** @type {number|undefined} */\n\n let open\n /** @type {number|undefined} */\n\n let close\n /** @type {Event[]} */\n\n let media // Find an opening.\n\n while (index--) {\n token = events[index][1]\n\n if (open) {\n // If we see another link, or inactive link label, we’ve been here before.\n if (\n token.type === 'link' ||\n (token.type === 'labelLink' && token._inactive)\n ) {\n break\n } // Mark other link openings as inactive, as we can’t have links in\n // links.\n\n if (events[index][0] === 'enter' && token.type === 'labelLink') {\n token._inactive = true\n }\n } else if (close) {\n if (\n events[index][0] === 'enter' &&\n (token.type === 'labelImage' || token.type === 'labelLink') &&\n !token._balanced\n ) {\n open = index\n\n if (token.type !== 'labelLink') {\n offset = 2\n break\n }\n }\n } else if (token.type === 'labelEnd') {\n close = index\n }\n }\n\n const group = {\n type: events[open][1].type === 'labelLink' ? 'link' : 'image',\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n }\n const label = {\n type: 'label',\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[close][1].end)\n }\n const text = {\n type: 'labelText',\n start: Object.assign({}, events[open + offset + 2][1].end),\n end: Object.assign({}, events[close - 2][1].start)\n }\n media = [\n ['enter', group, context],\n ['enter', label, context]\n ] // Opening marker.\n\n media = push(media, events.slice(open + 1, open + offset + 3)) // Text open.\n\n media = push(media, [['enter', text, context]]) // Between.\n\n media = push(\n media,\n resolveAll(\n context.parser.constructs.insideSpan.null,\n events.slice(open + offset + 4, close - 3),\n context\n )\n ) // Text close, marker close, label close.\n\n media = push(media, [\n ['exit', text, context],\n events[close - 2],\n events[close - 1],\n ['exit', label, context]\n ]) // Reference, resource, or so.\n\n media = push(media, events.slice(close + 1)) // Media close.\n\n media = push(media, [['exit', group, context]])\n splice(events, open, events.length, media)\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeLabelEnd(effects, ok, nok) {\n const self = this\n let index = self.events.length\n /** @type {Token} */\n\n let labelStart\n /** @type {boolean} */\n\n let defined // Find an opening.\n\n while (index--) {\n if (\n (self.events[index][1].type === 'labelImage' ||\n self.events[index][1].type === 'labelLink') &&\n !self.events[index][1]._balanced\n ) {\n labelStart = self.events[index][1]\n break\n }\n }\n\n return start\n /** @type {State} */\n\n function start(code) {\n if (!labelStart) {\n return nok(code)\n } // It’s a balanced bracket, but contains a link.\n\n if (labelStart._inactive) return balanced(code)\n defined = self.parser.defined.includes(\n normalizeIdentifier(\n self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })\n )\n )\n effects.enter('labelEnd')\n effects.enter('labelMarker')\n effects.consume(code)\n effects.exit('labelMarker')\n effects.exit('labelEnd')\n return afterLabelEnd\n }\n /** @type {State} */\n\n function afterLabelEnd(code) {\n // Resource: `[asd](fgh)`.\n if (code === 40) {\n return effects.attempt(\n resourceConstruct,\n ok,\n defined ? ok : balanced\n )(code)\n } // Collapsed (`[asd][]`) or full (`[asd][fgh]`) reference?\n\n if (code === 91) {\n return effects.attempt(\n fullReferenceConstruct,\n ok,\n defined\n ? effects.attempt(collapsedReferenceConstruct, ok, balanced)\n : balanced\n )(code)\n } // Shortcut reference: `[asd]`?\n\n return defined ? ok(code) : balanced(code)\n }\n /** @type {State} */\n\n function balanced(code) {\n labelStart._balanced = true\n return nok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeResource(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('resource')\n effects.enter('resourceMarker')\n effects.consume(code)\n effects.exit('resourceMarker')\n return factoryWhitespace(effects, open)\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 41) {\n return end(code)\n }\n\n return factoryDestination(\n effects,\n destinationAfter,\n nok,\n 'resourceDestination',\n 'resourceDestinationLiteral',\n 'resourceDestinationLiteralMarker',\n 'resourceDestinationRaw',\n 'resourceDestinationString',\n 32\n )(code)\n }\n /** @type {State} */\n\n function destinationAfter(code) {\n return markdownLineEndingOrSpace(code)\n ? factoryWhitespace(effects, between)(code)\n : end(code)\n }\n /** @type {State} */\n\n function between(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(\n effects,\n factoryWhitespace(effects, end),\n nok,\n 'resourceTitle',\n 'resourceTitleMarker',\n 'resourceTitleString'\n )(code)\n }\n\n return end(code)\n }\n /** @type {State} */\n\n function end(code) {\n if (code === 41) {\n effects.enter('resourceMarker')\n effects.consume(code)\n effects.exit('resourceMarker')\n effects.exit('resource')\n return ok\n }\n\n return nok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeFullReference(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n return factoryLabel.call(\n self,\n effects,\n afterLabel,\n nok,\n 'reference',\n 'referenceMarker',\n 'referenceString'\n )(code)\n }\n /** @type {State} */\n\n function afterLabel(code) {\n return self.parser.defined.includes(\n normalizeIdentifier(\n self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)\n )\n )\n ? ok(code)\n : nok(code)\n }\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCollapsedReference(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('reference')\n effects.enter('referenceMarker')\n effects.consume(code)\n effects.exit('referenceMarker')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 93) {\n effects.enter('referenceMarker')\n effects.consume(code)\n effects.exit('referenceMarker')\n effects.exit('reference')\n return ok\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {labelEnd} from './label-end.js'\n/** @type {Construct} */\n\nexport const labelStartImage = {\n name: 'labelStartImage',\n tokenize: tokenizeLabelStartImage,\n resolveAll: labelEnd.resolveAll\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('labelImage')\n effects.enter('labelImageMarker')\n effects.consume(code)\n effects.exit('labelImageMarker')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 91) {\n effects.enter('labelMarker')\n effects.consume(code)\n effects.exit('labelMarker')\n effects.exit('labelImage')\n return after\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function after(code) {\n /* To do: remove in the future once we’ve switched from\n * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n * which doesn’t need this */\n\n /* Hidden footnotes hook */\n\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs\n ? nok(code)\n : ok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Point} Point\n */\nimport {push, splice} from 'micromark-util-chunked'\nimport {classifyCharacter} from 'micromark-util-classify-character'\nimport {resolveAll} from 'micromark-util-resolve-all'\n\n/** @type {Construct} */\nexport const attention = {\n name: 'attention',\n tokenize: tokenizeAttention,\n resolveAll: resolveAllAttention\n}\n/**\n * Take all events and resolve attention to emphasis or strong.\n *\n * @type {Resolver}\n */\n\nfunction resolveAllAttention(events, context) {\n let index = -1\n /** @type {number} */\n\n let open\n /** @type {Token} */\n\n let group\n /** @type {Token} */\n\n let text\n /** @type {Token} */\n\n let openingSequence\n /** @type {Token} */\n\n let closingSequence\n /** @type {number} */\n\n let use\n /** @type {Event[]} */\n\n let nextEvents\n /** @type {number} */\n\n let offset // Walk through all events.\n //\n // Note: performance of this is fine on an mb of normal markdown, but it’s\n // a bottleneck for malicious stuff.\n\n while (++index < events.length) {\n // Find a token that can close.\n if (\n events[index][0] === 'enter' &&\n events[index][1].type === 'attentionSequence' &&\n events[index][1]._close\n ) {\n open = index // Now walk back to find an opener.\n\n while (open--) {\n // Find a token that can open the closer.\n if (\n events[open][0] === 'exit' &&\n events[open][1].type === 'attentionSequence' &&\n events[open][1]._open && // If the markers are the same:\n context.sliceSerialize(events[open][1]).charCodeAt(0) ===\n context.sliceSerialize(events[index][1]).charCodeAt(0)\n ) {\n // If the opening can close or the closing can open,\n // and the close size *is not* a multiple of three,\n // but the sum of the opening and closing size *is* multiple of three,\n // then don’t match.\n if (\n (events[open][1]._close || events[index][1]._open) &&\n (events[index][1].end.offset - events[index][1].start.offset) % 3 &&\n !(\n (events[open][1].end.offset -\n events[open][1].start.offset +\n events[index][1].end.offset -\n events[index][1].start.offset) %\n 3\n )\n ) {\n continue\n } // Number of markers to use from the sequence.\n\n use =\n events[open][1].end.offset - events[open][1].start.offset > 1 &&\n events[index][1].end.offset - events[index][1].start.offset > 1\n ? 2\n : 1\n const start = Object.assign({}, events[open][1].end)\n const end = Object.assign({}, events[index][1].start)\n movePoint(start, -use)\n movePoint(end, use)\n openingSequence = {\n type: use > 1 ? 'strongSequence' : 'emphasisSequence',\n start,\n end: Object.assign({}, events[open][1].end)\n }\n closingSequence = {\n type: use > 1 ? 'strongSequence' : 'emphasisSequence',\n start: Object.assign({}, events[index][1].start),\n end\n }\n text = {\n type: use > 1 ? 'strongText' : 'emphasisText',\n start: Object.assign({}, events[open][1].end),\n end: Object.assign({}, events[index][1].start)\n }\n group = {\n type: use > 1 ? 'strong' : 'emphasis',\n start: Object.assign({}, openingSequence.start),\n end: Object.assign({}, closingSequence.end)\n }\n events[open][1].end = Object.assign({}, openingSequence.start)\n events[index][1].start = Object.assign({}, closingSequence.end)\n nextEvents = [] // If there are more markers in the opening, add them before.\n\n if (events[open][1].end.offset - events[open][1].start.offset) {\n nextEvents = push(nextEvents, [\n ['enter', events[open][1], context],\n ['exit', events[open][1], context]\n ])\n } // Opening.\n\n nextEvents = push(nextEvents, [\n ['enter', group, context],\n ['enter', openingSequence, context],\n ['exit', openingSequence, context],\n ['enter', text, context]\n ]) // Between.\n\n nextEvents = push(\n nextEvents,\n resolveAll(\n context.parser.constructs.insideSpan.null,\n events.slice(open + 1, index),\n context\n )\n ) // Closing.\n\n nextEvents = push(nextEvents, [\n ['exit', text, context],\n ['enter', closingSequence, context],\n ['exit', closingSequence, context],\n ['exit', group, context]\n ]) // If there are more markers in the closing, add them after.\n\n if (events[index][1].end.offset - events[index][1].start.offset) {\n offset = 2\n nextEvents = push(nextEvents, [\n ['enter', events[index][1], context],\n ['exit', events[index][1], context]\n ])\n } else {\n offset = 0\n }\n\n splice(events, open - 1, index - open + 3, nextEvents)\n index = open + nextEvents.length - offset - 2\n break\n }\n }\n }\n } // Remove remaining sequences.\n\n index = -1\n\n while (++index < events.length) {\n if (events[index][1].type === 'attentionSequence') {\n events[index][1].type = 'data'\n }\n }\n\n return events\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeAttention(effects, ok) {\n const attentionMarkers = this.parser.constructs.attentionMarkers.null\n const previous = this.previous\n const before = classifyCharacter(previous)\n /** @type {NonNullable} */\n\n let marker\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('attentionSequence')\n marker = code\n return sequence(code)\n }\n /** @type {State} */\n\n function sequence(code) {\n if (code === marker) {\n effects.consume(code)\n return sequence\n }\n\n const token = effects.exit('attentionSequence')\n const after = classifyCharacter(code)\n const open =\n !after || (after === 2 && before) || attentionMarkers.includes(code)\n const close =\n !before || (before === 2 && after) || attentionMarkers.includes(previous)\n token._open = Boolean(marker === 42 ? open : open && (before || !close))\n token._close = Boolean(marker === 42 ? close : close && (after || !open))\n return ok(code)\n }\n}\n/**\n * Move a point a bit.\n *\n * Note: `move` only works inside lines! It’s not possible to move past other\n * chunks (replacement characters, tabs, or line endings).\n *\n * @param {Point} point\n * @param {number} offset\n * @returns {void}\n */\n\nfunction movePoint(point, offset) {\n point.column += offset\n point.offset += offset\n point._bufferIndex += offset\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {\n asciiAlpha,\n asciiAlphanumeric,\n asciiAtext,\n asciiControl\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const autolink = {\n name: 'autolink',\n tokenize: tokenizeAutolink\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeAutolink(effects, ok, nok) {\n let size = 1\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('autolink')\n effects.enter('autolinkMarker')\n effects.consume(code)\n effects.exit('autolinkMarker')\n effects.enter('autolinkProtocol')\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (asciiAlpha(code)) {\n effects.consume(code)\n return schemeOrEmailAtext\n }\n\n return asciiAtext(code) ? emailAtext(code) : nok(code)\n }\n /** @type {State} */\n\n function schemeOrEmailAtext(code) {\n return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)\n ? schemeInsideOrEmailAtext(code)\n : emailAtext(code)\n }\n /** @type {State} */\n\n function schemeInsideOrEmailAtext(code) {\n if (code === 58) {\n effects.consume(code)\n return urlInside\n }\n\n if (\n (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) &&\n size++ < 32\n ) {\n effects.consume(code)\n return schemeInsideOrEmailAtext\n }\n\n return emailAtext(code)\n }\n /** @type {State} */\n\n function urlInside(code) {\n if (code === 62) {\n effects.exit('autolinkProtocol')\n return end(code)\n }\n\n if (code === null || code === 32 || code === 60 || asciiControl(code)) {\n return nok(code)\n }\n\n effects.consume(code)\n return urlInside\n }\n /** @type {State} */\n\n function emailAtext(code) {\n if (code === 64) {\n effects.consume(code)\n size = 0\n return emailAtSignOrDot\n }\n\n if (asciiAtext(code)) {\n effects.consume(code)\n return emailAtext\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function emailAtSignOrDot(code) {\n return asciiAlphanumeric(code) ? emailLabel(code) : nok(code)\n }\n /** @type {State} */\n\n function emailLabel(code) {\n if (code === 46) {\n effects.consume(code)\n size = 0\n return emailAtSignOrDot\n }\n\n if (code === 62) {\n // Exit, then change the type.\n effects.exit('autolinkProtocol').type = 'autolinkEmail'\n return end(code)\n }\n\n return emailValue(code)\n }\n /** @type {State} */\n\n function emailValue(code) {\n if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {\n effects.consume(code)\n return code === 45 ? emailValue : emailLabel\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function end(code) {\n effects.enter('autolinkMarker')\n effects.consume(code)\n effects.exit('autolinkMarker')\n effects.exit('autolink')\n return ok\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Code} Code\n */\nimport {factorySpace} from 'micromark-factory-space'\nimport {\n asciiAlpha,\n asciiAlphanumeric,\n markdownLineEnding,\n markdownLineEndingOrSpace,\n markdownSpace\n} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeHtmlText(effects, ok, nok) {\n const self = this\n /** @type {NonNullable|undefined} */\n\n let marker\n /** @type {string} */\n\n let buffer\n /** @type {number} */\n\n let index\n /** @type {State} */\n\n let returnState\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('htmlText')\n effects.enter('htmlTextData')\n effects.consume(code)\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (code === 33) {\n effects.consume(code)\n return declarationOpen\n }\n\n if (code === 47) {\n effects.consume(code)\n return tagCloseStart\n }\n\n if (code === 63) {\n effects.consume(code)\n return instruction\n }\n\n if (asciiAlpha(code)) {\n effects.consume(code)\n return tagOpen\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function declarationOpen(code) {\n if (code === 45) {\n effects.consume(code)\n return commentOpen\n }\n\n if (code === 91) {\n effects.consume(code)\n buffer = 'CDATA['\n index = 0\n return cdataOpen\n }\n\n if (asciiAlpha(code)) {\n effects.consume(code)\n return declaration\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function commentOpen(code) {\n if (code === 45) {\n effects.consume(code)\n return commentStart\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function commentStart(code) {\n if (code === null || code === 62) {\n return nok(code)\n }\n\n if (code === 45) {\n effects.consume(code)\n return commentStartDash\n }\n\n return comment(code)\n }\n /** @type {State} */\n\n function commentStartDash(code) {\n if (code === null || code === 62) {\n return nok(code)\n }\n\n return comment(code)\n }\n /** @type {State} */\n\n function comment(code) {\n if (code === null) {\n return nok(code)\n }\n\n if (code === 45) {\n effects.consume(code)\n return commentClose\n }\n\n if (markdownLineEnding(code)) {\n returnState = comment\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return comment\n }\n /** @type {State} */\n\n function commentClose(code) {\n if (code === 45) {\n effects.consume(code)\n return end\n }\n\n return comment(code)\n }\n /** @type {State} */\n\n function cdataOpen(code) {\n if (code === buffer.charCodeAt(index++)) {\n effects.consume(code)\n return index === buffer.length ? cdata : cdataOpen\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function cdata(code) {\n if (code === null) {\n return nok(code)\n }\n\n if (code === 93) {\n effects.consume(code)\n return cdataClose\n }\n\n if (markdownLineEnding(code)) {\n returnState = cdata\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return cdata\n }\n /** @type {State} */\n\n function cdataClose(code) {\n if (code === 93) {\n effects.consume(code)\n return cdataEnd\n }\n\n return cdata(code)\n }\n /** @type {State} */\n\n function cdataEnd(code) {\n if (code === 62) {\n return end(code)\n }\n\n if (code === 93) {\n effects.consume(code)\n return cdataEnd\n }\n\n return cdata(code)\n }\n /** @type {State} */\n\n function declaration(code) {\n if (code === null || code === 62) {\n return end(code)\n }\n\n if (markdownLineEnding(code)) {\n returnState = declaration\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return declaration\n }\n /** @type {State} */\n\n function instruction(code) {\n if (code === null) {\n return nok(code)\n }\n\n if (code === 63) {\n effects.consume(code)\n return instructionClose\n }\n\n if (markdownLineEnding(code)) {\n returnState = instruction\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return instruction\n }\n /** @type {State} */\n\n function instructionClose(code) {\n return code === 62 ? end(code) : instruction(code)\n }\n /** @type {State} */\n\n function tagCloseStart(code) {\n if (asciiAlpha(code)) {\n effects.consume(code)\n return tagClose\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagClose(code) {\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code)\n return tagClose\n }\n\n return tagCloseBetween(code)\n }\n /** @type {State} */\n\n function tagCloseBetween(code) {\n if (markdownLineEnding(code)) {\n returnState = tagCloseBetween\n return atLineEnding(code)\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return tagCloseBetween\n }\n\n return end(code)\n }\n /** @type {State} */\n\n function tagOpen(code) {\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code)\n return tagOpen\n }\n\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagOpenBetween(code) {\n if (code === 47) {\n effects.consume(code)\n return end\n }\n\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code)\n return tagOpenAttributeName\n }\n\n if (markdownLineEnding(code)) {\n returnState = tagOpenBetween\n return atLineEnding(code)\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return tagOpenBetween\n }\n\n return end(code)\n }\n /** @type {State} */\n\n function tagOpenAttributeName(code) {\n if (\n code === 45 ||\n code === 46 ||\n code === 58 ||\n code === 95 ||\n asciiAlphanumeric(code)\n ) {\n effects.consume(code)\n return tagOpenAttributeName\n }\n\n return tagOpenAttributeNameAfter(code)\n }\n /** @type {State} */\n\n function tagOpenAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code)\n return tagOpenAttributeValueBefore\n }\n\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeNameAfter\n return atLineEnding(code)\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return tagOpenAttributeNameAfter\n }\n\n return tagOpenBetween(code)\n }\n /** @type {State} */\n\n function tagOpenAttributeValueBefore(code) {\n if (\n code === null ||\n code === 60 ||\n code === 61 ||\n code === 62 ||\n code === 96\n ) {\n return nok(code)\n }\n\n if (code === 34 || code === 39) {\n effects.consume(code)\n marker = code\n return tagOpenAttributeValueQuoted\n }\n\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueBefore\n return atLineEnding(code)\n }\n\n if (markdownSpace(code)) {\n effects.consume(code)\n return tagOpenAttributeValueBefore\n }\n\n effects.consume(code)\n marker = undefined\n return tagOpenAttributeValueUnquoted\n }\n /** @type {State} */\n\n function tagOpenAttributeValueQuoted(code) {\n if (code === marker) {\n effects.consume(code)\n return tagOpenAttributeValueQuotedAfter\n }\n\n if (code === null) {\n return nok(code)\n }\n\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueQuoted\n return atLineEnding(code)\n }\n\n effects.consume(code)\n return tagOpenAttributeValueQuoted\n }\n /** @type {State} */\n\n function tagOpenAttributeValueQuotedAfter(code) {\n if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code)\n }\n\n return nok(code)\n }\n /** @type {State} */\n\n function tagOpenAttributeValueUnquoted(code) {\n if (\n code === null ||\n code === 34 ||\n code === 39 ||\n code === 60 ||\n code === 61 ||\n code === 96\n ) {\n return nok(code)\n }\n\n if (code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code)\n }\n\n effects.consume(code)\n return tagOpenAttributeValueUnquoted\n } // We can’t have blank lines in content, so no need to worry about empty\n // tokens.\n\n /** @type {State} */\n\n function atLineEnding(code) {\n effects.exit('htmlTextData')\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return factorySpace(\n effects,\n afterPrefix,\n 'linePrefix',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )\n }\n /** @type {State} */\n\n function afterPrefix(code) {\n effects.enter('htmlTextData')\n return returnState(code)\n }\n /** @type {State} */\n\n function end(code) {\n if (code === 62) {\n effects.consume(code)\n effects.exit('htmlTextData')\n effects.exit('htmlText')\n return ok\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {labelEnd} from './label-end.js'\n/** @type {Construct} */\n\nexport const labelStartLink = {\n name: 'labelStartLink',\n tokenize: tokenizeLabelStartLink,\n resolveAll: labelEnd.resolveAll\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n const self = this\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('labelLink')\n effects.enter('labelMarker')\n effects.consume(code)\n effects.exit('labelMarker')\n effects.exit('labelLink')\n return after\n }\n /** @type {State} */\n\n function after(code) {\n /* To do: remove in the future once we’ve switched from\n * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n * which doesn’t need this */\n\n /* Hidden footnotes hook. */\n\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs\n ? nok(code)\n : ok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').State} State\n */\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const hardBreakEscape = {\n name: 'hardBreakEscape',\n tokenize: tokenizeHardBreakEscape\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeHardBreakEscape(effects, ok, nok) {\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('hardBreakEscape')\n effects.enter('escapeMarker')\n effects.consume(code)\n return open\n }\n /** @type {State} */\n\n function open(code) {\n if (markdownLineEnding(code)) {\n effects.exit('escapeMarker')\n effects.exit('hardBreakEscape')\n return ok(code)\n }\n\n return nok(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n * @typedef {import('micromark-util-types').Previous} Previous\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').State} State\n */\nimport {markdownLineEnding} from 'micromark-util-character'\n\n/** @type {Construct} */\nexport const codeText = {\n name: 'codeText',\n tokenize: tokenizeCodeText,\n resolve: resolveCodeText,\n previous\n}\n/** @type {Resolver} */\n\nfunction resolveCodeText(events) {\n let tailExitIndex = events.length - 4\n let headEnterIndex = 3\n /** @type {number} */\n\n let index\n /** @type {number|undefined} */\n\n let enter // If we start and end with an EOL or a space.\n\n if (\n (events[headEnterIndex][1].type === 'lineEnding' ||\n events[headEnterIndex][1].type === 'space') &&\n (events[tailExitIndex][1].type === 'lineEnding' ||\n events[tailExitIndex][1].type === 'space')\n ) {\n index = headEnterIndex // And we have data.\n\n while (++index < tailExitIndex) {\n if (events[index][1].type === 'codeTextData') {\n // Then we have padding.\n events[headEnterIndex][1].type = 'codeTextPadding'\n events[tailExitIndex][1].type = 'codeTextPadding'\n headEnterIndex += 2\n tailExitIndex -= 2\n break\n }\n }\n } // Merge adjacent spaces and data.\n\n index = headEnterIndex - 1\n tailExitIndex++\n\n while (++index <= tailExitIndex) {\n if (enter === undefined) {\n if (index !== tailExitIndex && events[index][1].type !== 'lineEnding') {\n enter = index\n }\n } else if (\n index === tailExitIndex ||\n events[index][1].type === 'lineEnding'\n ) {\n events[enter][1].type = 'codeTextData'\n\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end\n events.splice(enter + 2, index - enter - 2)\n tailExitIndex -= index - enter - 2\n index = enter + 2\n }\n\n enter = undefined\n }\n }\n\n return events\n}\n/** @type {Previous} */\n\nfunction previous(code) {\n // If there is a previous code, there will always be a tail.\n return (\n code !== 96 ||\n this.events[this.events.length - 1][1].type === 'characterEscape'\n )\n}\n/** @type {Tokenizer} */\n\nfunction tokenizeCodeText(effects, ok, nok) {\n const self = this\n let sizeOpen = 0\n /** @type {number} */\n\n let size\n /** @type {Token} */\n\n let token\n return start\n /** @type {State} */\n\n function start(code) {\n effects.enter('codeText')\n effects.enter('codeTextSequence')\n return openingSequence(code)\n }\n /** @type {State} */\n\n function openingSequence(code) {\n if (code === 96) {\n effects.consume(code)\n sizeOpen++\n return openingSequence\n }\n\n effects.exit('codeTextSequence')\n return gap(code)\n }\n /** @type {State} */\n\n function gap(code) {\n // EOF.\n if (code === null) {\n return nok(code)\n } // Closing fence?\n // Could also be data.\n\n if (code === 96) {\n token = effects.enter('codeTextSequence')\n size = 0\n return closingSequence(code)\n } // Tabs don’t work, and virtual spaces don’t make sense.\n\n if (code === 32) {\n effects.enter('space')\n effects.consume(code)\n effects.exit('space')\n return gap\n }\n\n if (markdownLineEnding(code)) {\n effects.enter('lineEnding')\n effects.consume(code)\n effects.exit('lineEnding')\n return gap\n } // Data.\n\n effects.enter('codeTextData')\n return data(code)\n } // In code.\n\n /** @type {State} */\n\n function data(code) {\n if (\n code === null ||\n code === 32 ||\n code === 96 ||\n markdownLineEnding(code)\n ) {\n effects.exit('codeTextData')\n return gap(code)\n }\n\n effects.consume(code)\n return data\n } // Closing fence.\n\n /** @type {State} */\n\n function closingSequence(code) {\n // More.\n if (code === 96) {\n effects.consume(code)\n size++\n return closingSequence\n } // Done!\n\n if (size === sizeOpen) {\n effects.exit('codeTextSequence')\n effects.exit('codeText')\n return ok(code)\n } // More or less accents: mark as data.\n\n token.type = 'codeTextData'\n return data(code)\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Extension} Extension\n */\nimport {\n attention,\n autolink,\n blockQuote,\n characterEscape,\n characterReference,\n codeFenced,\n codeIndented,\n codeText,\n definition,\n hardBreakEscape,\n headingAtx,\n htmlFlow,\n htmlText,\n labelEnd,\n labelStartImage,\n labelStartLink,\n lineEnding,\n list,\n setextUnderline,\n thematicBreak\n} from 'micromark-core-commonmark'\nimport {resolver as resolveText} from './initialize/text.js'\n/** @type {Extension['document']} */\n\nexport const document = {\n [42]: list,\n [43]: list,\n [45]: list,\n [48]: list,\n [49]: list,\n [50]: list,\n [51]: list,\n [52]: list,\n [53]: list,\n [54]: list,\n [55]: list,\n [56]: list,\n [57]: list,\n [62]: blockQuote\n}\n/** @type {Extension['contentInitial']} */\n\nexport const contentInitial = {\n [91]: definition\n}\n/** @type {Extension['flowInitial']} */\n\nexport const flowInitial = {\n [-2]: codeIndented,\n [-1]: codeIndented,\n [32]: codeIndented\n}\n/** @type {Extension['flow']} */\n\nexport const flow = {\n [35]: headingAtx,\n [42]: thematicBreak,\n [45]: [setextUnderline, thematicBreak],\n [60]: htmlFlow,\n [61]: setextUnderline,\n [95]: thematicBreak,\n [96]: codeFenced,\n [126]: codeFenced\n}\n/** @type {Extension['string']} */\n\nexport const string = {\n [38]: characterReference,\n [92]: characterEscape\n}\n/** @type {Extension['text']} */\n\nexport const text = {\n [-5]: lineEnding,\n [-4]: lineEnding,\n [-3]: lineEnding,\n [33]: labelStartImage,\n [38]: characterReference,\n [42]: attention,\n [60]: [autolink, htmlText],\n [91]: labelStartLink,\n [92]: [hardBreakEscape, characterEscape],\n [93]: labelEnd,\n [95]: attention,\n [96]: codeText\n}\n/** @type {Extension['insideSpan']} */\n\nexport const insideSpan = {\n null: [attention, resolveText]\n}\n/** @type {Extension['attentionMarkers']} */\n\nexport const attentionMarkers = {\n null: [42, 95]\n}\n/** @type {Extension['disable']} */\n\nexport const disable = {\n null: []\n}\n","/**\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Value} Value\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Code} Code\n */\n\n/**\n * @callback Preprocessor\n * @param {Value} value\n * @param {Encoding} [encoding]\n * @param {boolean} [end=false]\n * @returns {Array}\n */\nconst search = /[\\0\\t\\n\\r]/g\n/**\n * @returns {Preprocessor}\n */\n\nexport function preprocess() {\n let column = 1\n let buffer = ''\n /** @type {boolean|undefined} */\n\n let start = true\n /** @type {boolean|undefined} */\n\n let atCarriageReturn\n return preprocessor\n /** @type {Preprocessor} */\n\n function preprocessor(value, encoding, end) {\n /** @type {Array} */\n const chunks = []\n /** @type {RegExpMatchArray|null} */\n\n let match\n /** @type {number} */\n\n let next\n /** @type {number} */\n\n let startPosition\n /** @type {number} */\n\n let endPosition\n /** @type {Code} */\n\n let code // @ts-expect-error `Buffer` does allow an encoding.\n\n value = buffer + value.toString(encoding)\n startPosition = 0\n buffer = ''\n\n if (start) {\n if (value.charCodeAt(0) === 65279) {\n startPosition++\n }\n\n start = undefined\n }\n\n while (startPosition < value.length) {\n search.lastIndex = startPosition\n match = search.exec(value)\n endPosition =\n match && match.index !== undefined ? match.index : value.length\n code = value.charCodeAt(endPosition)\n\n if (!match) {\n buffer = value.slice(startPosition)\n break\n }\n\n if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n chunks.push(-3)\n atCarriageReturn = undefined\n } else {\n if (atCarriageReturn) {\n chunks.push(-5)\n atCarriageReturn = undefined\n }\n\n if (startPosition < endPosition) {\n chunks.push(value.slice(startPosition, endPosition))\n column += endPosition - startPosition\n }\n\n switch (code) {\n case 0: {\n chunks.push(65533)\n column++\n break\n }\n\n case 9: {\n next = Math.ceil(column / 4) * 4\n chunks.push(-2)\n\n while (column++ < next) chunks.push(-1)\n\n break\n }\n\n case 10: {\n chunks.push(-4)\n column = 1\n break\n }\n\n default: {\n atCarriageReturn = true\n column = 1\n }\n }\n }\n\n startPosition = endPosition + 1\n }\n\n if (end) {\n if (atCarriageReturn) chunks.push(-5)\n if (buffer) chunks.push(buffer)\n chunks.push(null)\n }\n\n return chunks\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Value} Value\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist').Point} Point\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n * @typedef {import('mdast').Content} Content\n * @typedef {Root|Content} Node\n * @typedef {Extract} Parent\n * @typedef {import('mdast').Break} Break\n * @typedef {import('mdast').Blockquote} Blockquote\n * @typedef {import('mdast').Code} Code\n * @typedef {import('mdast').Definition} Definition\n * @typedef {import('mdast').Emphasis} Emphasis\n * @typedef {import('mdast').Heading} Heading\n * @typedef {import('mdast').HTML} HTML\n * @typedef {import('mdast').Image} Image\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('mdast').Link} Link\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('mdast').List} List\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast').Strong} Strong\n * @typedef {import('mdast').Text} Text\n * @typedef {import('mdast').ThematicBreak} ThematicBreak\n *\n * @typedef {UnistParent & {type: 'fragment', children: Array}} Fragment\n */\n\n/**\n * @typedef _CompileDataFields\n * @property {boolean|undefined} expectingFirstListItemValue\n * @property {boolean|undefined} flowCodeInside\n * @property {boolean|undefined} setextHeadingSlurpLineEnding\n * @property {boolean|undefined} atHardBreak\n * @property {'collapsed'|'full'} referenceType\n * @property {boolean|undefined} inReference\n * @property {'characterReferenceMarkerHexadecimal'|'characterReferenceMarkerNumeric'} characterReferenceType\n *\n * @typedef {Record & Partial<_CompileDataFields>} CompileData\n *\n * @typedef {(tree: Root) => Root|void} Transform\n * @typedef {(this: CompileContext, token: Token) => void} Handle\n * @typedef {Record} Handles\n * Token types mapping to handles\n * @typedef {Record|Array> & {canContainEols: Array, transforms: Array, enter: Handles, exit: Handles}} NormalizedExtension\n * @typedef {Partial} Extension\n * An mdast extension changes how markdown tokens are turned into mdast.\n *\n * @typedef {(this: Omit, left: Token|undefined, right: Token) => void} OnEnterError\n * @typedef {(this: Omit, left: Token, right: Token) => void} OnExitError\n *\n * @typedef CompileContext\n * mdast compiler context\n * @property {Array} stack\n * @property {Array<[Token, OnEnterError|undefined]>} tokenStack\n * @property {(key: string, value?: unknown) => void} setData\n * Set data into the key-value store.\n * @property {(key: K) => CompileData[K]} getData\n * Get data from the key-value store.\n * @property {(this: CompileContext) => void} buffer\n * Capture some of the output data.\n * @property {(this: CompileContext) => string} resume\n * Stop capturing and access the output data.\n * @property {(this: CompileContext, node: N, token: Token, onError?: OnEnterError) => N} enter\n * Enter a token.\n * @property {(this: CompileContext, token: Token, onError?: OnExitError) => Node} exit\n * Exit a token.\n * @property {TokenizeContext['sliceSerialize']} sliceSerialize\n * Get the string value of a token.\n * @property {NormalizedExtension} config\n * Configuration.\n *\n * @typedef {{mdastExtensions?: Array>}} FromMarkdownOptions\n * @typedef {ParseOptions & FromMarkdownOptions} Options\n */\nimport {toString} from 'mdast-util-to-string'\nimport {parse} from 'micromark/lib/parse.js'\nimport {preprocess} from 'micromark/lib/preprocess.js'\nimport {postprocess} from 'micromark/lib/postprocess.js'\nimport {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'\nimport {decodeString} from 'micromark-util-decode-string'\nimport {normalizeIdentifier} from 'micromark-util-normalize-identifier'\nimport {decodeNamedCharacterReference} from 'decode-named-character-reference'\nimport {stringifyPosition} from 'unist-util-stringify-position'\nconst own = {}.hasOwnProperty\n/**\n * @param value Markdown to parse (`string` or `Buffer`).\n * @param [encoding] Character encoding to understand `value` as when it’s a `Buffer` (`string`, default: `'utf8'`).\n * @param [options] Configuration\n */\n\nexport const fromMarkdown =\n /**\n * @type {(\n * ((value: Value, encoding: Encoding, options?: Options) => Root) &\n * ((value: Value, options?: Options) => Root)\n * )}\n */\n\n /**\n * @param {Value} value\n * @param {Encoding} [encoding]\n * @param {Options} [options]\n * @returns {Root}\n */\n function (value, encoding, options) {\n if (typeof encoding !== 'string') {\n options = encoding\n encoding = undefined\n }\n\n return compiler(options)(\n postprocess(\n parse(options).document().write(preprocess()(value, encoding, true))\n )\n )\n }\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options} [options]\n */\n\nfunction compiler(options = {}) {\n /** @type {NormalizedExtension} */\n // @ts-expect-error: our base has all required fields, so the result will too.\n const config = configure(\n {\n transforms: [],\n canContainEols: [\n 'emphasis',\n 'fragment',\n 'heading',\n 'paragraph',\n 'strong'\n ],\n enter: {\n autolink: opener(link),\n autolinkProtocol: onenterdata,\n autolinkEmail: onenterdata,\n atxHeading: opener(heading),\n blockQuote: opener(blockQuote),\n characterEscape: onenterdata,\n characterReference: onenterdata,\n codeFenced: opener(codeFlow),\n codeFencedFenceInfo: buffer,\n codeFencedFenceMeta: buffer,\n codeIndented: opener(codeFlow, buffer),\n codeText: opener(codeText, buffer),\n codeTextData: onenterdata,\n data: onenterdata,\n codeFlowValue: onenterdata,\n definition: opener(definition),\n definitionDestinationString: buffer,\n definitionLabelString: buffer,\n definitionTitleString: buffer,\n emphasis: opener(emphasis),\n hardBreakEscape: opener(hardBreak),\n hardBreakTrailing: opener(hardBreak),\n htmlFlow: opener(html, buffer),\n htmlFlowData: onenterdata,\n htmlText: opener(html, buffer),\n htmlTextData: onenterdata,\n image: opener(image),\n label: buffer,\n link: opener(link),\n listItem: opener(listItem),\n listItemValue: onenterlistitemvalue,\n listOrdered: opener(list, onenterlistordered),\n listUnordered: opener(list),\n paragraph: opener(paragraph),\n reference: onenterreference,\n referenceString: buffer,\n resourceDestinationString: buffer,\n resourceTitleString: buffer,\n setextHeading: opener(heading),\n strong: opener(strong),\n thematicBreak: opener(thematicBreak)\n },\n exit: {\n atxHeading: closer(),\n atxHeadingSequence: onexitatxheadingsequence,\n autolink: closer(),\n autolinkEmail: onexitautolinkemail,\n autolinkProtocol: onexitautolinkprotocol,\n blockQuote: closer(),\n characterEscapeValue: onexitdata,\n characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n characterReferenceValue: onexitcharacterreferencevalue,\n codeFenced: closer(onexitcodefenced),\n codeFencedFence: onexitcodefencedfence,\n codeFencedFenceInfo: onexitcodefencedfenceinfo,\n codeFencedFenceMeta: onexitcodefencedfencemeta,\n codeFlowValue: onexitdata,\n codeIndented: closer(onexitcodeindented),\n codeText: closer(onexitcodetext),\n codeTextData: onexitdata,\n data: onexitdata,\n definition: closer(),\n definitionDestinationString: onexitdefinitiondestinationstring,\n definitionLabelString: onexitdefinitionlabelstring,\n definitionTitleString: onexitdefinitiontitlestring,\n emphasis: closer(),\n hardBreakEscape: closer(onexithardbreak),\n hardBreakTrailing: closer(onexithardbreak),\n htmlFlow: closer(onexithtmlflow),\n htmlFlowData: onexitdata,\n htmlText: closer(onexithtmltext),\n htmlTextData: onexitdata,\n image: closer(onexitimage),\n label: onexitlabel,\n labelText: onexitlabeltext,\n lineEnding: onexitlineending,\n link: closer(onexitlink),\n listItem: closer(),\n listOrdered: closer(),\n listUnordered: closer(),\n paragraph: closer(),\n referenceString: onexitreferencestring,\n resourceDestinationString: onexitresourcedestinationstring,\n resourceTitleString: onexitresourcetitlestring,\n resource: onexitresource,\n setextHeading: closer(onexitsetextheading),\n setextHeadingLineSequence: onexitsetextheadinglinesequence,\n setextHeadingText: onexitsetextheadingtext,\n strong: closer(),\n thematicBreak: closer()\n }\n },\n options.mdastExtensions || []\n )\n /** @type {CompileData} */\n\n const data = {}\n return compile\n /**\n * @param {Array} events\n * @returns {Root}\n */\n\n function compile(events) {\n /** @type {Root} */\n let tree = {\n type: 'root',\n children: []\n }\n /** @type {CompileContext['stack']} */\n\n const stack = [tree]\n /** @type {CompileContext['tokenStack']} */\n\n const tokenStack = []\n /** @type {Array} */\n\n const listStack = []\n /** @type {Omit} */\n\n const context = {\n stack,\n tokenStack,\n config,\n enter,\n exit,\n buffer,\n resume,\n setData,\n getData\n }\n let index = -1\n\n while (++index < events.length) {\n // We preprocess lists to add `listItem` tokens, and to infer whether\n // items the list itself are spread out.\n if (\n events[index][1].type === 'listOrdered' ||\n events[index][1].type === 'listUnordered'\n ) {\n if (events[index][0] === 'enter') {\n listStack.push(index)\n } else {\n const tail = listStack.pop()\n index = prepareList(events, tail, index)\n }\n }\n }\n\n index = -1\n\n while (++index < events.length) {\n const handler = config[events[index][0]]\n\n if (own.call(handler, events[index][1].type)) {\n handler[events[index][1].type].call(\n Object.assign(\n {\n sliceSerialize: events[index][2].sliceSerialize\n },\n context\n ),\n events[index][1]\n )\n }\n }\n\n if (tokenStack.length > 0) {\n const tail = tokenStack[tokenStack.length - 1]\n const handler = tail[1] || defaultOnError\n handler.call(context, undefined, tail[0])\n } // Figure out `root` position.\n\n tree.position = {\n start: point(\n events.length > 0\n ? events[0][1].start\n : {\n line: 1,\n column: 1,\n offset: 0\n }\n ),\n end: point(\n events.length > 0\n ? events[events.length - 2][1].end\n : {\n line: 1,\n column: 1,\n offset: 0\n }\n )\n }\n index = -1\n\n while (++index < config.transforms.length) {\n tree = config.transforms[index](tree) || tree\n }\n\n return tree\n }\n /**\n * @param {Array} events\n * @param {number} start\n * @param {number} length\n * @returns {number}\n */\n\n function prepareList(events, start, length) {\n let index = start - 1\n let containerBalance = -1\n let listSpread = false\n /** @type {Token|undefined} */\n\n let listItem\n /** @type {number|undefined} */\n\n let lineIndex\n /** @type {number|undefined} */\n\n let firstBlankLineIndex\n /** @type {boolean|undefined} */\n\n let atMarker\n\n while (++index <= length) {\n const event = events[index]\n\n if (\n event[1].type === 'listUnordered' ||\n event[1].type === 'listOrdered' ||\n event[1].type === 'blockQuote'\n ) {\n if (event[0] === 'enter') {\n containerBalance++\n } else {\n containerBalance--\n }\n\n atMarker = undefined\n } else if (event[1].type === 'lineEndingBlank') {\n if (event[0] === 'enter') {\n if (\n listItem &&\n !atMarker &&\n !containerBalance &&\n !firstBlankLineIndex\n ) {\n firstBlankLineIndex = index\n }\n\n atMarker = undefined\n }\n } else if (\n event[1].type === 'linePrefix' ||\n event[1].type === 'listItemValue' ||\n event[1].type === 'listItemMarker' ||\n event[1].type === 'listItemPrefix' ||\n event[1].type === 'listItemPrefixWhitespace'\n ) {\n // Empty.\n } else {\n atMarker = undefined\n }\n\n if (\n (!containerBalance &&\n event[0] === 'enter' &&\n event[1].type === 'listItemPrefix') ||\n (containerBalance === -1 &&\n event[0] === 'exit' &&\n (event[1].type === 'listUnordered' ||\n event[1].type === 'listOrdered'))\n ) {\n if (listItem) {\n let tailIndex = index\n lineIndex = undefined\n\n while (tailIndex--) {\n const tailEvent = events[tailIndex]\n\n if (\n tailEvent[1].type === 'lineEnding' ||\n tailEvent[1].type === 'lineEndingBlank'\n ) {\n if (tailEvent[0] === 'exit') continue\n\n if (lineIndex) {\n events[lineIndex][1].type = 'lineEndingBlank'\n listSpread = true\n }\n\n tailEvent[1].type = 'lineEnding'\n lineIndex = tailIndex\n } else if (\n tailEvent[1].type === 'linePrefix' ||\n tailEvent[1].type === 'blockQuotePrefix' ||\n tailEvent[1].type === 'blockQuotePrefixWhitespace' ||\n tailEvent[1].type === 'blockQuoteMarker' ||\n tailEvent[1].type === 'listItemIndent'\n ) {\n // Empty\n } else {\n break\n }\n }\n\n if (\n firstBlankLineIndex &&\n (!lineIndex || firstBlankLineIndex < lineIndex)\n ) {\n // @ts-expect-error Patched.\n listItem._spread = true\n } // Fix position.\n\n listItem.end = Object.assign(\n {},\n lineIndex ? events[lineIndex][1].start : event[1].end\n )\n events.splice(lineIndex || index, 0, ['exit', listItem, event[2]])\n index++\n length++\n } // Create a new list item.\n\n if (event[1].type === 'listItemPrefix') {\n listItem = {\n type: 'listItem',\n // @ts-expect-error Patched\n _spread: false,\n start: Object.assign({}, event[1].start)\n } // @ts-expect-error: `listItem` is most definitely defined, TS...\n\n events.splice(index, 0, ['enter', listItem, event[2]])\n index++\n length++\n firstBlankLineIndex = undefined\n atMarker = true\n }\n }\n } // @ts-expect-error Patched.\n\n events[start][1]._spread = listSpread\n return length\n }\n /**\n * @type {CompileContext['setData']}\n * @param [value]\n */\n\n function setData(key, value) {\n data[key] = value\n }\n /**\n * @type {CompileContext['getData']}\n * @template {string} K\n * @param {K} key\n * @returns {CompileData[K]}\n */\n\n function getData(key) {\n return data[key]\n }\n /**\n * @param {Point} d\n * @returns {Point}\n */\n\n function point(d) {\n return {\n line: d.line,\n column: d.column,\n offset: d.offset\n }\n }\n /**\n * @param {(token: Token) => Node} create\n * @param {Handle} [and]\n * @returns {Handle}\n */\n\n function opener(create, and) {\n return open\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {void}\n */\n\n function open(token) {\n enter.call(this, create(token), token)\n if (and) and.call(this, token)\n }\n }\n /** @type {CompileContext['buffer']} */\n\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n })\n }\n /**\n * @type {CompileContext['enter']}\n * @template {Node} N\n * @this {CompileContext}\n * @param {N} node\n * @param {Token} token\n * @param {OnEnterError} [errorHandler]\n * @returns {N}\n */\n\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1]\n // @ts-expect-error: Assume `Node` can exist as a child of `parent`.\n parent.children.push(node)\n this.stack.push(node)\n this.tokenStack.push([token, errorHandler]) // @ts-expect-error: `end` will be patched later.\n\n node.position = {\n start: point(token.start)\n }\n return node\n }\n /**\n * @param {Handle} [and]\n * @returns {Handle}\n */\n\n function closer(and) {\n return close\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {void}\n */\n\n function close(token) {\n if (and) and.call(this, token)\n exit.call(this, token)\n }\n }\n /**\n * @type {CompileContext['exit']}\n * @this {CompileContext}\n * @param {Token} token\n * @param {OnExitError} [onExitError]\n * @returns {Node}\n */\n\n function exit(token, onExitError) {\n const node = this.stack.pop()\n const open = this.tokenStack.pop()\n\n if (!open) {\n throw new Error(\n 'Cannot close `' +\n token.type +\n '` (' +\n stringifyPosition({\n start: token.start,\n end: token.end\n }) +\n '): it’s not open'\n )\n } else if (open[0].type !== token.type) {\n if (onExitError) {\n onExitError.call(this, token, open[0])\n } else {\n const handler = open[1] || defaultOnError\n handler.call(this, token, open[0])\n }\n }\n\n node.position.end = point(token.end)\n return node\n }\n /**\n * @this {CompileContext}\n * @returns {string}\n */\n\n function resume() {\n return toString(this.stack.pop())\n } //\n // Handlers.\n //\n\n /** @type {Handle} */\n\n function onenterlistordered() {\n setData('expectingFirstListItemValue', true)\n }\n /** @type {Handle} */\n\n function onenterlistitemvalue(token) {\n if (getData('expectingFirstListItemValue')) {\n const ancestor =\n /** @type {List} */\n this.stack[this.stack.length - 2]\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10)\n setData('expectingFirstListItemValue')\n }\n }\n /** @type {Handle} */\n\n function onexitcodefencedfenceinfo() {\n const data = this.resume()\n const node =\n /** @type {Code} */\n this.stack[this.stack.length - 1]\n node.lang = data\n }\n /** @type {Handle} */\n\n function onexitcodefencedfencemeta() {\n const data = this.resume()\n const node =\n /** @type {Code} */\n this.stack[this.stack.length - 1]\n node.meta = data\n }\n /** @type {Handle} */\n\n function onexitcodefencedfence() {\n // Exit if this is the closing fence.\n if (getData('flowCodeInside')) return\n this.buffer()\n setData('flowCodeInside', true)\n }\n /** @type {Handle} */\n\n function onexitcodefenced() {\n const data = this.resume()\n const node =\n /** @type {Code} */\n this.stack[this.stack.length - 1]\n node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '')\n setData('flowCodeInside')\n }\n /** @type {Handle} */\n\n function onexitcodeindented() {\n const data = this.resume()\n const node =\n /** @type {Code} */\n this.stack[this.stack.length - 1]\n node.value = data.replace(/(\\r?\\n|\\r)$/g, '')\n }\n /** @type {Handle} */\n\n function onexitdefinitionlabelstring(token) {\n // Discard label, use the source content instead.\n const label = this.resume()\n const node =\n /** @type {Definition} */\n this.stack[this.stack.length - 1]\n node.label = label\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase()\n }\n /** @type {Handle} */\n\n function onexitdefinitiontitlestring() {\n const data = this.resume()\n const node =\n /** @type {Definition} */\n this.stack[this.stack.length - 1]\n node.title = data\n }\n /** @type {Handle} */\n\n function onexitdefinitiondestinationstring() {\n const data = this.resume()\n const node =\n /** @type {Definition} */\n this.stack[this.stack.length - 1]\n node.url = data\n }\n /** @type {Handle} */\n\n function onexitatxheadingsequence(token) {\n const node =\n /** @type {Heading} */\n this.stack[this.stack.length - 1]\n\n if (!node.depth) {\n const depth = this.sliceSerialize(token).length\n node.depth = depth\n }\n }\n /** @type {Handle} */\n\n function onexitsetextheadingtext() {\n setData('setextHeadingSlurpLineEnding', true)\n }\n /** @type {Handle} */\n\n function onexitsetextheadinglinesequence(token) {\n const node =\n /** @type {Heading} */\n this.stack[this.stack.length - 1]\n node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2\n }\n /** @type {Handle} */\n\n function onexitsetextheading() {\n setData('setextHeadingSlurpLineEnding')\n }\n /** @type {Handle} */\n\n function onenterdata(token) {\n const parent =\n /** @type {Parent} */\n this.stack[this.stack.length - 1]\n /** @type {Node} */\n\n let tail = parent.children[parent.children.length - 1]\n\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text() // @ts-expect-error: we’ll add `end` later.\n\n tail.position = {\n start: point(token.start)\n } // @ts-expect-error: Assume `parent` accepts `text`.\n\n parent.children.push(tail)\n }\n\n this.stack.push(tail)\n }\n /** @type {Handle} */\n\n function onexitdata(token) {\n const tail = this.stack.pop()\n tail.value += this.sliceSerialize(token)\n tail.position.end = point(token.end)\n }\n /** @type {Handle} */\n\n function onexitlineending(token) {\n const context = this.stack[this.stack.length - 1]\n\n // If we’re at a hard break, include the line ending in there.\n if (getData('atHardBreak')) {\n const tail = context.children[context.children.length - 1]\n tail.position.end = point(token.end)\n setData('atHardBreak')\n return\n }\n\n if (\n !getData('setextHeadingSlurpLineEnding') &&\n config.canContainEols.includes(context.type)\n ) {\n onenterdata.call(this, token)\n onexitdata.call(this, token)\n }\n }\n /** @type {Handle} */\n\n function onexithardbreak() {\n setData('atHardBreak', true)\n }\n /** @type {Handle} */\n\n function onexithtmlflow() {\n const data = this.resume()\n const node =\n /** @type {HTML} */\n this.stack[this.stack.length - 1]\n node.value = data\n }\n /** @type {Handle} */\n\n function onexithtmltext() {\n const data = this.resume()\n const node =\n /** @type {HTML} */\n this.stack[this.stack.length - 1]\n node.value = data\n }\n /** @type {Handle} */\n\n function onexitcodetext() {\n const data = this.resume()\n const node =\n /** @type {InlineCode} */\n this.stack[this.stack.length - 1]\n node.value = data\n }\n /** @type {Handle} */\n\n function onexitlink() {\n const context =\n /** @type {Link & {identifier: string, label: string}} */\n this.stack[this.stack.length - 1] // To do: clean.\n\n if (getData('inReference')) {\n context.type += 'Reference' // @ts-expect-error: mutate.\n\n context.referenceType = getData('referenceType') || 'shortcut' // @ts-expect-error: mutate.\n\n delete context.url\n delete context.title\n } else {\n // @ts-expect-error: mutate.\n delete context.identifier // @ts-expect-error: mutate.\n\n delete context.label\n }\n\n setData('referenceType')\n }\n /** @type {Handle} */\n\n function onexitimage() {\n const context =\n /** @type {Image & {identifier: string, label: string}} */\n this.stack[this.stack.length - 1] // To do: clean.\n\n if (getData('inReference')) {\n context.type += 'Reference' // @ts-expect-error: mutate.\n\n context.referenceType = getData('referenceType') || 'shortcut' // @ts-expect-error: mutate.\n\n delete context.url\n delete context.title\n } else {\n // @ts-expect-error: mutate.\n delete context.identifier // @ts-expect-error: mutate.\n\n delete context.label\n }\n\n setData('referenceType')\n }\n /** @type {Handle} */\n\n function onexitlabeltext(token) {\n const ancestor =\n /** @type {(Link|Image) & {identifier: string, label: string}} */\n this.stack[this.stack.length - 2]\n const string = this.sliceSerialize(token)\n ancestor.label = decodeString(string)\n ancestor.identifier = normalizeIdentifier(string).toLowerCase()\n }\n /** @type {Handle} */\n\n function onexitlabel() {\n const fragment =\n /** @type {Fragment} */\n this.stack[this.stack.length - 1]\n const value = this.resume()\n const node =\n /** @type {(Link|Image) & {identifier: string, label: string}} */\n this.stack[this.stack.length - 1] // Assume a reference.\n\n setData('inReference', true)\n\n if (node.type === 'link') {\n // @ts-expect-error: Assume static phrasing content.\n node.children = fragment.children\n } else {\n node.alt = value\n }\n }\n /** @type {Handle} */\n\n function onexitresourcedestinationstring() {\n const data = this.resume()\n const node =\n /** @type {Link|Image} */\n this.stack[this.stack.length - 1]\n node.url = data\n }\n /** @type {Handle} */\n\n function onexitresourcetitlestring() {\n const data = this.resume()\n const node =\n /** @type {Link|Image} */\n this.stack[this.stack.length - 1]\n node.title = data\n }\n /** @type {Handle} */\n\n function onexitresource() {\n setData('inReference')\n }\n /** @type {Handle} */\n\n function onenterreference() {\n setData('referenceType', 'collapsed')\n }\n /** @type {Handle} */\n\n function onexitreferencestring(token) {\n const label = this.resume()\n const node =\n /** @type {LinkReference|ImageReference} */\n this.stack[this.stack.length - 1]\n node.label = label\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase()\n setData('referenceType', 'full')\n }\n /** @type {Handle} */\n\n function onexitcharacterreferencemarker(token) {\n setData('characterReferenceType', token.type)\n }\n /** @type {Handle} */\n\n function onexitcharacterreferencevalue(token) {\n const data = this.sliceSerialize(token)\n const type = getData('characterReferenceType')\n /** @type {string} */\n\n let value\n\n if (type) {\n value = decodeNumericCharacterReference(\n data,\n type === 'characterReferenceMarkerNumeric' ? 10 : 16\n )\n setData('characterReferenceType')\n } else {\n // @ts-expect-error `decodeNamedCharacterReference` can return false for\n // invalid named character references, but everything we’ve tokenized is\n // valid.\n value = decodeNamedCharacterReference(data)\n }\n\n const tail = this.stack.pop()\n tail.value += value\n tail.position.end = point(token.end)\n }\n /** @type {Handle} */\n\n function onexitautolinkprotocol(token) {\n onexitdata.call(this, token)\n const node =\n /** @type {Link} */\n this.stack[this.stack.length - 1]\n node.url = this.sliceSerialize(token)\n }\n /** @type {Handle} */\n\n function onexitautolinkemail(token) {\n onexitdata.call(this, token)\n const node =\n /** @type {Link} */\n this.stack[this.stack.length - 1]\n node.url = 'mailto:' + this.sliceSerialize(token)\n } //\n // Creaters.\n //\n\n /** @returns {Blockquote} */\n\n function blockQuote() {\n return {\n type: 'blockquote',\n children: []\n }\n }\n /** @returns {Code} */\n\n function codeFlow() {\n return {\n type: 'code',\n lang: null,\n meta: null,\n value: ''\n }\n }\n /** @returns {InlineCode} */\n\n function codeText() {\n return {\n type: 'inlineCode',\n value: ''\n }\n }\n /** @returns {Definition} */\n\n function definition() {\n return {\n type: 'definition',\n identifier: '',\n label: null,\n title: null,\n url: ''\n }\n }\n /** @returns {Emphasis} */\n\n function emphasis() {\n return {\n type: 'emphasis',\n children: []\n }\n }\n /** @returns {Heading} */\n\n function heading() {\n // @ts-expect-error `depth` will be set later.\n return {\n type: 'heading',\n depth: undefined,\n children: []\n }\n }\n /** @returns {Break} */\n\n function hardBreak() {\n return {\n type: 'break'\n }\n }\n /** @returns {HTML} */\n\n function html() {\n return {\n type: 'html',\n value: ''\n }\n }\n /** @returns {Image} */\n\n function image() {\n return {\n type: 'image',\n title: null,\n url: '',\n alt: null\n }\n }\n /** @returns {Link} */\n\n function link() {\n return {\n type: 'link',\n title: null,\n url: '',\n children: []\n }\n }\n /**\n * @param {Token} token\n * @returns {List}\n */\n\n function list(token) {\n return {\n type: 'list',\n ordered: token.type === 'listOrdered',\n start: null,\n // @ts-expect-error Patched.\n spread: token._spread,\n children: []\n }\n }\n /**\n * @param {Token} token\n * @returns {ListItem}\n */\n\n function listItem(token) {\n return {\n type: 'listItem',\n // @ts-expect-error Patched.\n spread: token._spread,\n checked: null,\n children: []\n }\n }\n /** @returns {Paragraph} */\n\n function paragraph() {\n return {\n type: 'paragraph',\n children: []\n }\n }\n /** @returns {Strong} */\n\n function strong() {\n return {\n type: 'strong',\n children: []\n }\n }\n /** @returns {Text} */\n\n function text() {\n return {\n type: 'text',\n value: ''\n }\n }\n /** @returns {ThematicBreak} */\n\n function thematicBreak() {\n return {\n type: 'thematicBreak'\n }\n }\n}\n/**\n * @param {Extension} combined\n * @param {Array>} extensions\n * @returns {Extension}\n */\n\nfunction configure(combined, extensions) {\n let index = -1\n\n while (++index < extensions.length) {\n const value = extensions[index]\n\n if (Array.isArray(value)) {\n configure(combined, value)\n } else {\n extension(combined, value)\n }\n }\n\n return combined\n}\n/**\n * @param {Extension} combined\n * @param {Extension} extension\n * @returns {void}\n */\n\nfunction extension(combined, extension) {\n /** @type {string} */\n let key\n\n for (key in extension) {\n if (own.call(extension, key)) {\n const list = key === 'canContainEols' || key === 'transforms'\n const maybe = own.call(combined, key) ? combined[key] : undefined\n /* c8 ignore next */\n\n const left = maybe || (combined[key] = list ? [] : {})\n const right = extension[key]\n\n if (right) {\n if (list) {\n // @ts-expect-error: `left` is an array.\n combined[key] = [...left, ...right]\n } else {\n Object.assign(left, right)\n }\n }\n }\n }\n}\n/** @type {OnEnterError} */\n\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error(\n 'Cannot close `' +\n left.type +\n '` (' +\n stringifyPosition({\n start: left.start,\n end: left.end\n }) +\n '): a different token (`' +\n right.type +\n '`, ' +\n stringifyPosition({\n start: right.start,\n end: right.end\n }) +\n ') is open'\n )\n } else {\n throw new Error(\n 'Cannot close document, a token (`' +\n right.type +\n '`, ' +\n stringifyPosition({\n start: right.start,\n end: right.end\n }) +\n ') is still open'\n )\n }\n}\n","/**\n * @typedef {import('micromark-util-types').Event} Event\n */\nimport {subtokenize} from 'micromark-util-subtokenize'\n/**\n * @param {Array} events\n * @returns {Array}\n */\n\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n\n return events\n}\n","/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n * @typedef {import('micromark-util-types').Create} Create\n */\nimport {combineExtensions} from 'micromark-util-combine-extensions'\nimport {content} from './initialize/content.js'\nimport {document} from './initialize/document.js'\nimport {flow} from './initialize/flow.js'\nimport {text, string} from './initialize/text.js'\nimport {createTokenizer} from './create-tokenizer.js'\nimport * as defaultConstructs from './constructs.js'\n/**\n * @param {ParseOptions} [options]\n * @returns {ParseContext}\n */\n\nexport function parse(options = {}) {\n /** @type {FullNormalizedExtension} */\n // @ts-expect-error `defaultConstructs` is full, so the result will be too.\n const constructs = combineExtensions(\n // @ts-expect-error Same as above.\n [defaultConstructs].concat(options.extensions || [])\n )\n /** @type {ParseContext} */\n\n const parser = {\n defined: [],\n lazy: {},\n constructs,\n content: create(content),\n document: create(document),\n flow: create(flow),\n string: create(string),\n text: create(text)\n }\n return parser\n /**\n * @param {InitialConstruct} initial\n */\n\n function create(initial) {\n return creator\n /** @type {Create} */\n\n function creator(from) {\n return createTokenizer(parser, initial, from)\n }\n }\n}\n","import remarkParse from './lib/index.js'\n\nexport default remarkParse\n","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/** @type {import('unified').Plugin<[Options?] | void[], string, Root>} */\nexport default function remarkParse(options) {\n /** @type {import('unified').ParserFunction} */\n const parser = (doc) => {\n // Assume options.\n const settings = /** @type {Options} */ (this.data('settings'))\n\n return fromMarkdown(\n doc,\n Object.assign({}, settings, options, {\n // Note: these options are not in the readme.\n // The goal is for them to be set by plugins on `data` instead of being\n // passed by users.\n extensions: this.data('micromarkExtensions') || [],\n mdastExtensions: this.data('fromMarkdownExtensions') || []\n })\n )\n }\n\n Object.assign(this, {Parser: parser})\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('unist').Literal} Literal\n * @typedef {Object.} Props\n * @typedef {Array.|string} ChildrenOrValue\n *\n * @typedef {(, C extends Node[]>(type: T, props: P, children: C) => {type: T, children: C} & P)} BuildParentWithProps\n * @typedef {(>(type: T, props: P, value: string) => {type: T, value: string} & P)} BuildLiteralWithProps\n * @typedef {(>(type: T, props: P) => {type: T} & P)} BuildVoidWithProps\n * @typedef {((type: T, children: C) => {type: T, children: C})} BuildParent\n * @typedef {((type: T, value: string) => {type: T, value: string})} BuildLiteral\n * @typedef {((type: T) => {type: T})} BuildVoid\n */\n\nexport var u = /**\n * @type {BuildVoid & BuildVoidWithProps & BuildLiteral & BuildLiteralWithProps & BuildParent & BuildParentWithProps}\n */ (\n /**\n * @param {string} type Type of node\n * @param {Props|ChildrenOrValue} [props] Additional properties for node (or `children` or `value`)\n * @param {ChildrenOrValue} [value] `children` or `value` of node\n * @returns {Node}\n */\n function (type, props, value) {\n /** @type {Node} */\n var node = {type: String(type)}\n\n if (\n (value === undefined || value === null) &&\n (typeof props === 'string' || Array.isArray(props))\n ) {\n value = props\n } else {\n Object.assign(node, props)\n }\n\n if (Array.isArray(value)) {\n node.children = value\n } else if (value !== undefined && value !== null) {\n node.value = String(value)\n }\n\n return node\n }\n)\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('unist-util-is').Test} Test\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n * @typedef {import('./complex-types.js').Visitor} Visitor\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\n/**\n * Visit children of tree which pass test.\n *\n * @param tree\n * Tree to walk\n * @param [test]\n * `unist-util-is`-compatible test\n * @param visitor\n * Function called for nodes that pass `test`.\n * @param reverse\n * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).\n */\nexport const visit =\n /**\n * @type {(\n * ((tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor, reverse?: boolean) => void) &\n * ((tree: Tree, visitor: import('./complex-types.js').BuildVisitor, reverse?: boolean) => void)\n * )}\n */\n (\n /**\n * @param {Node} tree\n * @param {Test} test\n * @param {import('./complex-types.js').Visitor} visitor\n * @param {boolean} [reverse]\n */\n function (tree, test, visitor, reverse) {\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n visitor = test\n test = null\n }\n\n visitParents(tree, test, overload, reverse)\n\n /**\n * @param {Node} node\n * @param {Array} parents\n */\n function overload(node, parents) {\n const parent = parents[parents.length - 1]\n return visitor(\n node,\n parent ? parent.children.indexOf(node) : null,\n parent\n )\n }\n }\n )\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n","/**\n * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Node} Node\n * @typedef {Record & {type: string, position?: PositionLike|undefined}} NodeLike\n * @typedef {import('unist').Point} Point\n *\n * @typedef {Partial} PointLike\n *\n * @typedef PositionLike\n * @property {PointLike} [start]\n * @property {PointLike} [end]\n */\n\nexport const pointStart = point('start')\nexport const pointEnd = point('end')\n\n/**\n * Get the positional info of `node`.\n *\n * @param {NodeLike|Node} [node]\n * @returns {Position}\n */\nexport function position(node) {\n return {start: pointStart(node), end: pointEnd(node)}\n}\n\n/**\n * Get the positional info of `node`.\n *\n * @param {'start'|'end'} type\n */\nfunction point(type) {\n return point\n\n /**\n * Get the positional info of `node`.\n *\n * @param {NodeLike|Node} [node]\n * @returns {Point}\n */\n function point(node) {\n const point = (node && node.position && node.position[type]) || {}\n\n return {\n line: point.line || null,\n column: point.column || null,\n offset: point.offset > -1 ? point.offset : null\n }\n }\n}\n","/**\n * @typedef {import('mdast').Root|import('mdast').Content} Node\n * @typedef {import('mdast').Definition} Definition\n */\n\nimport {visit} from 'unist-util-visit'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Find definitions in `node`.\n * Uses CommonMark precedence, which means that earlier definitions are\n * preferred over duplicate later definitions.\n *\n * @param {Node} node\n */\nexport function definitions(node) {\n /** @type {Record} */\n const cache = Object.create(null)\n\n if (!node || !node.type) {\n throw new Error('mdast-util-definitions expected node')\n }\n\n visit(node, 'definition', (definition) => {\n const id = clean(definition.identifier)\n if (id && !own.call(cache, id)) {\n cache[id] = definition\n }\n })\n\n return definition\n\n /**\n * Get a node from the bound definition cache.\n *\n * @param {string} identifier\n * @returns {Definition|null}\n */\n function definition(identifier) {\n const id = clean(identifier)\n return id && own.call(cache, id) ? cache[id] : null\n }\n}\n\n/**\n * @param {string} [value]\n * @returns {string}\n */\nfunction clean(value) {\n return String(value || '').toUpperCase()\n}\n","/**\n * @typedef {import('mdast').Root|import('mdast').Parent['children'][number]} MdastNode\n * @typedef {import('./index.js').H} H\n * @typedef {import('./index.js').Handler} Handler\n * @typedef {import('./index.js').Content} Content\n */\n\nimport {u} from 'unist-builder'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Transform an unknown node.\n * @type {Handler}\n * @param {MdastNode} node\n */\nfunction unknown(h, node) {\n const data = node.data || {}\n\n if (\n 'value' in node &&\n !(\n own.call(data, 'hName') ||\n own.call(data, 'hProperties') ||\n own.call(data, 'hChildren')\n )\n ) {\n return h.augment(node, u('text', node.value))\n }\n\n return h(node, 'div', all(h, node))\n}\n\n/**\n * @type {Handler}\n * @param {MdastNode} node\n */\nexport function one(h, node, parent) {\n const type = node && node.type\n /** @type {Handler} */\n let fn\n\n // Fail on non-nodes.\n if (!type) {\n throw new Error('Expected node, got `' + node + '`')\n }\n\n if (own.call(h.handlers, type)) {\n fn = h.handlers[type]\n } else if (h.passThrough && h.passThrough.includes(type)) {\n fn = returnNode\n } else {\n fn = h.unknownHandler\n }\n\n return (typeof fn === 'function' ? fn : unknown)(h, node, parent)\n}\n\n/**\n * @type {Handler}\n * @param {MdastNode} node\n */\nfunction returnNode(h, node) {\n // @ts-expect-error: Pass through custom node.\n return 'children' in node ? {...node, children: all(h, node)} : node\n}\n\n/**\n * @param {H} h\n * @param {MdastNode} parent\n */\nexport function all(h, parent) {\n /** @type {Array} */\n const values = []\n\n if ('children' in parent) {\n const nodes = parent.children\n let index = -1\n\n while (++index < nodes.length) {\n const result = one(h, nodes[index], parent)\n\n if (result) {\n if (index && nodes[index - 1].type === 'break') {\n if (!Array.isArray(result) && result.type === 'text') {\n result.value = result.value.replace(/^\\s+/, '')\n }\n\n if (!Array.isArray(result) && result.type === 'element') {\n const head = result.children[0]\n\n if (head && head.type === 'text') {\n head.value = head.value.replace(/^\\s+/, '')\n }\n }\n }\n\n if (Array.isArray(result)) {\n values.push(...result)\n } else {\n values.push(result)\n }\n }\n }\n }\n\n return values\n}\n","import {asciiAlphanumeric} from 'micromark-util-character'\nimport {encode} from 'micromark-util-encode'\n\n/**\n * Make a value safe for injection as a URL.\n *\n * This encodes unsafe characters with percent-encoding and skips already\n * encoded sequences (see `normalizeUri` below).\n * Further unsafe characters are encoded as character references (see\n * `micromark-util-encode`).\n *\n * Then, a regex of allowed protocols can be given, in which case the URL is\n * sanitized.\n * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`,\n * or `/^https?$/i` for `img[src]`.\n * If the URL includes an unknown protocol (one not matched by `protocol`, such\n * as a dangerous example, `javascript:`), the value is ignored.\n *\n * @param {string|undefined} url\n * @param {RegExp} [protocol]\n * @returns {string}\n */\nexport function sanitizeUri(url, protocol) {\n const value = encode(normalizeUri(url || ''))\n\n if (!protocol) {\n return value\n }\n\n const colon = value.indexOf(':')\n const questionMark = value.indexOf('?')\n const numberSign = value.indexOf('#')\n const slash = value.indexOf('/')\n\n if (\n // If there is no protocol, it’s relative.\n colon < 0 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.\n (slash > -1 && colon > slash) ||\n (questionMark > -1 && colon > questionMark) ||\n (numberSign > -1 && colon > numberSign) || // It is a protocol, it should be allowed.\n protocol.test(value.slice(0, colon))\n ) {\n return value\n }\n\n return ''\n}\n/**\n * Normalize a URL (such as used in definitions).\n *\n * Encode unsafe characters with percent-encoding, skipping already encoded\n * sequences.\n *\n * @param {string} value\n * @returns {string}\n */\n\nexport function normalizeUri(value) {\n /** @type {Array} */\n const result = []\n let index = -1\n let start = 0\n let skip = 0\n\n while (++index < value.length) {\n const code = value.charCodeAt(index)\n /** @type {string} */\n\n let replace = '' // A correct percent encoded value.\n\n if (\n code === 37 &&\n asciiAlphanumeric(value.charCodeAt(index + 1)) &&\n asciiAlphanumeric(value.charCodeAt(index + 2))\n ) {\n skip = 2\n } // ASCII.\n else if (code < 128) {\n if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {\n replace = String.fromCharCode(code)\n }\n } // Astral.\n else if (code > 55295 && code < 57344) {\n const next = value.charCodeAt(index + 1) // A correct surrogate pair.\n\n if (code < 56320 && next > 56319 && next < 57344) {\n replace = String.fromCharCode(code, next)\n skip = 1\n } // Lone surrogate.\n else {\n replace = '\\uFFFD'\n }\n } // Unicode.\n else {\n replace = String.fromCharCode(code)\n }\n\n if (replace) {\n result.push(value.slice(start, index), encodeURIComponent(replace))\n start = index + skip + 1\n replace = ''\n }\n\n if (skip) {\n index += skip\n skip = 0\n }\n }\n\n return result.join('') + value.slice(start)\n}\n","/**\n * @typedef {import('./index.js').Content} Content\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * Wrap `nodes` with line feeds between each entry.\n * Optionally adds line feeds at the start and end.\n *\n * @param {Array} nodes\n * @param {boolean} [loose=false]\n * @returns {Array}\n */\nexport function wrap(nodes, loose) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n if (loose) {\n result.push(u('text', '\\n'))\n }\n\n while (++index < nodes.length) {\n if (index) result.push(u('text', '\\n'))\n result.push(nodes[index])\n }\n\n if (loose && nodes.length > 0) {\n result.push(u('text', '\\n'))\n }\n\n return result\n}\n","/**\n * @typedef {import('mdast').FootnoteReference} FootnoteReference\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {FootnoteReference} node\n */\nexport function footnoteReference(h, node) {\n const id = String(node.identifier)\n const safeId = normalizeUri(id.toLowerCase())\n const index = h.footnoteOrder.indexOf(id)\n /** @type {number} */\n let counter\n\n if (index === -1) {\n h.footnoteOrder.push(id)\n h.footnoteCounts[id] = 1\n counter = h.footnoteOrder.length\n } else {\n h.footnoteCounts[id]++\n counter = index + 1\n }\n\n const reuseCounter = h.footnoteCounts[id]\n\n return h(node, 'sup', [\n h(\n node.position,\n 'a',\n {\n href: '#' + h.clobberPrefix + 'fn-' + safeId,\n id:\n h.clobberPrefix +\n 'fnref-' +\n safeId +\n (reuseCounter > 1 ? '-' + reuseCounter : ''),\n dataFootnoteRef: true,\n ariaDescribedBy: 'footnote-label'\n },\n [u('text', String(counter))]\n )\n ])\n}\n","/**\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('./index.js').Handler} Handler\n * @typedef {import('./index.js').Content} Content\n */\n\nimport {u} from 'unist-builder'\nimport {all} from './traverse.js'\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @type {Handler}\n * @param {ImageReference|LinkReference} node\n * @returns {Content|Array}\n */\nexport function revert(h, node) {\n const subtype = node.referenceType\n let suffix = ']'\n\n if (subtype === 'collapsed') {\n suffix += '[]'\n } else if (subtype === 'full') {\n suffix += '[' + (node.label || node.identifier) + ']'\n }\n\n if (node.type === 'imageReference') {\n return u('text', '![' + node.alt + suffix)\n }\n\n const contents = all(h, node)\n const head = contents[0]\n\n if (head && head.type === 'text') {\n head.value = '[' + head.value\n } else {\n contents.unshift(u('text', '['))\n }\n\n const tail = contents[contents.length - 1]\n\n if (tail && tail.type === 'text') {\n tail.value += suffix\n } else {\n contents.push(u('text', suffix))\n }\n\n return contents\n}\n","/**\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').List} List\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('hast').Element} Element\n * @typedef {import('../index.js').Handler} Handler\n * @typedef {import('../index.js').Content} Content\n */\n\nimport {u} from 'unist-builder'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {ListItem} node\n * @param {List} parent\n */\nexport function listItem(h, node, parent) {\n const result = all(h, node)\n const loose = parent ? listLoose(parent) : listItemLoose(node)\n /** @type {Properties} */\n const props = {}\n /** @type {Array} */\n const wrapped = []\n\n if (typeof node.checked === 'boolean') {\n /** @type {Element} */\n let paragraph\n\n if (\n result[0] &&\n result[0].type === 'element' &&\n result[0].tagName === 'p'\n ) {\n paragraph = result[0]\n } else {\n paragraph = h(null, 'p', [])\n result.unshift(paragraph)\n }\n\n if (paragraph.children.length > 0) {\n paragraph.children.unshift(u('text', ' '))\n }\n\n paragraph.children.unshift(\n h(null, 'input', {\n type: 'checkbox',\n checked: node.checked,\n disabled: true\n })\n )\n\n // According to github-markdown-css, this class hides bullet.\n // See: .\n props.className = ['task-list-item']\n }\n\n let index = -1\n\n while (++index < result.length) {\n const child = result[index]\n\n // Add eols before nodes, except if this is a loose, first paragraph.\n if (\n loose ||\n index !== 0 ||\n child.type !== 'element' ||\n child.tagName !== 'p'\n ) {\n wrapped.push(u('text', '\\n'))\n }\n\n if (child.type === 'element' && child.tagName === 'p' && !loose) {\n wrapped.push(...child.children)\n } else {\n wrapped.push(child)\n }\n }\n\n const tail = result[result.length - 1]\n\n // Add a final eol.\n if (tail && (loose || !('tagName' in tail) || tail.tagName !== 'p')) {\n wrapped.push(u('text', '\\n'))\n }\n\n return h(node, 'li', props, wrapped)\n}\n\n/**\n * @param {List} node\n * @return {Boolean}\n */\nfunction listLoose(node) {\n let loose = node.spread\n const children = node.children\n let index = -1\n\n while (!loose && ++index < children.length) {\n loose = listItemLoose(children[index])\n }\n\n return Boolean(loose)\n}\n\n/**\n * @param {ListItem} node\n * @return {Boolean}\n */\nfunction listItemLoose(node) {\n const spread = node.spread\n\n return spread === undefined || spread === null\n ? node.children.length > 1\n : spread\n}\n","const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Trimmed value.\n */\nexport function trimLines(value) {\n const source = String(value)\n const search = /\\r?\\n|\\r/g\n let match = search.exec(source)\n let last = 0\n /** @type {Array} */\n const lines = []\n\n while (match) {\n lines.push(\n trimLine(source.slice(last, match.index), last > 0, true),\n match[0]\n )\n\n last = match.index + match[0].length\n match = search.exec(source)\n }\n\n lines.push(trimLine(source.slice(last), last > 0, false))\n\n return lines.join('')\n}\n\n/**\n * @param {string} value\n * Line to trim.\n * @param {boolean} start\n * Whether to trim the start of the line.\n * @param {boolean} end\n * Whether to trim the end of the line.\n * @returns {string}\n * Trimmed line.\n */\nfunction trimLine(value, start, end) {\n let startIndex = 0\n let endIndex = value.length\n\n if (start) {\n let code = value.codePointAt(startIndex)\n\n while (code === tab || code === space) {\n startIndex++\n code = value.codePointAt(startIndex)\n }\n }\n\n if (end) {\n let code = value.codePointAt(endIndex - 1)\n\n while (code === tab || code === space) {\n endIndex--\n code = value.codePointAt(endIndex - 1)\n }\n }\n\n return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n","import {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {strikethrough} from './delete.js'\nimport {emphasis} from './emphasis.js'\nimport {footnoteReference} from './footnote-reference.js'\nimport {footnote} from './footnote.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {imageReference} from './image-reference.js'\nimport {image} from './image.js'\nimport {inlineCode} from './inline-code.js'\nimport {linkReference} from './link-reference.js'\nimport {link} from './link.js'\nimport {listItem} from './list-item.js'\nimport {list} from './list.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {table} from './table.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\nexport const handlers = {\n blockquote,\n break: hardBreak,\n code,\n delete: strikethrough,\n emphasis,\n footnoteReference,\n footnote,\n heading,\n html,\n imageReference,\n image,\n inlineCode,\n linkReference,\n link,\n listItem,\n list,\n paragraph,\n root,\n strong,\n table,\n text,\n thematicBreak,\n toml: ignore,\n yaml: ignore,\n definition: ignore,\n footnoteDefinition: ignore\n}\n\n// Return nothing for nodes that are ignored.\nfunction ignore() {\n return null\n}\n","/**\n * @typedef {import('mdast').Blockquote} Blockquote\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {wrap} from '../wrap.js'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Blockquote} node\n */\nexport function blockquote(h, node) {\n return h(node, 'blockquote', wrap(all(h, node), true))\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Text} Text\n * @typedef {import('mdast').Break} Break\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {Break} node\n * @returns {Array}\n */\nexport function hardBreak(h, node) {\n return [h(node, 'br'), u('text', '\\n')]\n}\n","/**\n * @typedef {import('mdast').Code} Code\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {Code} node\n */\nexport function code(h, node) {\n const value = node.value ? node.value + '\\n' : ''\n // To do: next major, use `node.lang` w/o regex, the splitting’s been going\n // on for years in remark now.\n const lang = node.lang && node.lang.match(/^[^ \\t]+(?=[ \\t]|$)/)\n /** @type {Properties} */\n const props = {}\n\n if (lang) {\n props.className = ['language-' + lang]\n }\n\n const code = h(node, 'code', props, [u('text', value)])\n\n if (node.meta) {\n code.data = {meta: node.meta}\n }\n\n return h(node.position, 'pre', [code])\n}\n","/**\n * @typedef {import('mdast').Delete} Delete\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Delete} node\n */\nexport function strikethrough(h, node) {\n return h(node, 'del', all(h, node))\n}\n","/**\n * @typedef {import('mdast').Emphasis} Emphasis\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Emphasis} node\n */\nexport function emphasis(h, node) {\n return h(node, 'em', all(h, node))\n}\n","/**\n * @typedef {import('mdast').Footnote} Footnote\n * @typedef {import('../index.js').Handler} Handler\n *\n * @todo\n * `footnote` (or “inline note”) are a pandoc footnotes feature (`^[a note]`)\n * that does not exist in GFM.\n * We still have support for it, so that things remain working with\n * `micromark-extension-footnote` and `mdast-util-footnote`, but in the future\n * we might be able to remove it?\n */\n\nimport {footnoteReference} from './footnote-reference.js'\n\n/**\n * @type {Handler}\n * @param {Footnote} node\n */\nexport function footnote(h, node) {\n const footnoteById = h.footnoteById\n let no = 1\n\n while (no in footnoteById) no++\n\n const identifier = String(no)\n\n footnoteById[identifier] = {\n type: 'footnoteDefinition',\n identifier,\n children: [{type: 'paragraph', children: node.children}],\n position: node.position\n }\n\n return footnoteReference(h, {\n type: 'footnoteReference',\n identifier,\n position: node.position\n })\n}\n","/**\n * @typedef {import('mdast').Heading} Heading\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Heading} node\n */\nexport function heading(h, node) {\n return h(node, 'h' + node.depth, all(h, node))\n}\n","/**\n * @typedef {import('mdast').HTML} HTML\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * Return either a `raw` node in dangerous mode, otherwise nothing.\n *\n * @type {Handler}\n * @param {HTML} node\n */\nexport function html(h, node) {\n return h.dangerous ? h.augment(node, u('raw', node.value)) : null\n}\n","/**\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * @type {Handler}\n * @param {ImageReference} node\n */\nexport function imageReference(h, node) {\n const def = h.definition(node.identifier)\n\n if (!def) {\n return revert(h, node)\n }\n\n /** @type {Properties} */\n const props = {src: normalizeUri(def.url || ''), alt: node.alt}\n\n if (def.title !== null && def.title !== undefined) {\n props.title = def.title\n }\n\n return h(node, 'img', props)\n}\n","/**\n * @typedef {import('mdast').Image} Image\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * @type {Handler}\n * @param {Image} node\n */\nexport function image(h, node) {\n /** @type {Properties} */\n const props = {src: normalizeUri(node.url), alt: node.alt}\n\n if (node.title !== null && node.title !== undefined) {\n props.title = node.title\n }\n\n return h(node, 'img', props)\n}\n","/**\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {InlineCode} node\n */\nexport function inlineCode(h, node) {\n return h(node, 'code', [u('text', node.value.replace(/\\r?\\n|\\r/g, ' '))])\n}\n","/**\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {LinkReference} node\n */\nexport function linkReference(h, node) {\n const def = h.definition(node.identifier)\n\n if (!def) {\n return revert(h, node)\n }\n\n /** @type {Properties} */\n const props = {href: normalizeUri(def.url || '')}\n\n if (def.title !== null && def.title !== undefined) {\n props.title = def.title\n }\n\n return h(node, 'a', props, all(h, node))\n}\n","/**\n * @typedef {import('mdast').Link} Link\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Link} node\n */\nexport function link(h, node) {\n /** @type {Properties} */\n const props = {href: normalizeUri(node.url)}\n\n if (node.title !== null && node.title !== undefined) {\n props.title = node.title\n }\n\n return h(node, 'a', props, all(h, node))\n}\n","/**\n * @typedef {import('mdast').List} List\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {wrap} from '../wrap.js'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {List} node\n * @returns {Element}\n */\nexport function list(h, node) {\n /** @type {Properties} */\n const props = {}\n const name = node.ordered ? 'ol' : 'ul'\n const items = all(h, node)\n let index = -1\n\n if (typeof node.start === 'number' && node.start !== 1) {\n props.start = node.start\n }\n\n // Like GitHub, add a class for custom styling.\n while (++index < items.length) {\n const item = items[index]\n\n if (\n item.type === 'element' &&\n item.tagName === 'li' &&\n item.properties &&\n Array.isArray(item.properties.className) &&\n item.properties.className.includes('task-list-item')\n ) {\n props.className = ['contains-task-list']\n break\n }\n }\n\n return h(node, name, props, wrap(items, true))\n}\n","/**\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Paragraph} node\n */\nexport function paragraph(h, node) {\n return h(node, 'p', all(h, node))\n}\n","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {u} from 'unist-builder'\nimport {all} from '../traverse.js'\nimport {wrap} from '../wrap.js'\n\n/**\n * @type {Handler}\n * @param {Root} node\n */\nexport function root(h, node) {\n // @ts-expect-error `root`s are also fine.\n return h.augment(node, u('root', wrap(all(h, node))))\n}\n","/**\n * @typedef {import('mdast').Strong} Strong\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Strong} node\n */\nexport function strong(h, node) {\n return h(node, 'strong', all(h, node))\n}\n","/**\n * @typedef {import('mdast').Table} Table\n * @typedef {import('hast').Element} Element\n * @typedef {import('../index.js').Handler} Handler\n * @typedef {import('../index.js').Content} Content\n */\n\nimport {pointStart, pointEnd} from 'unist-util-position'\nimport {wrap} from '../wrap.js'\nimport {all} from '../traverse.js'\n\n/**\n * @type {Handler}\n * @param {Table} node\n */\nexport function table(h, node) {\n const rows = node.children\n let index = -1\n const align = node.align || []\n /** @type {Array} */\n const result = []\n\n while (++index < rows.length) {\n const row = rows[index].children\n const name = index === 0 ? 'th' : 'td'\n /** @type {Array} */\n const out = []\n let cellIndex = -1\n const length = node.align ? align.length : row.length\n\n while (++cellIndex < length) {\n const cell = row[cellIndex]\n out.push(\n h(cell, name, {align: align[cellIndex]}, cell ? all(h, cell) : [])\n )\n }\n\n result[index] = h(rows[index], 'tr', wrap(out, true))\n }\n\n return h(\n node,\n 'table',\n wrap(\n [h(result[0].position, 'thead', wrap([result[0]], true))].concat(\n result[1]\n ? h(\n {\n start: pointStart(result[1]),\n end: pointEnd(result[result.length - 1])\n },\n 'tbody',\n wrap(result.slice(1), true)\n )\n : []\n ),\n true\n )\n )\n}\n","/**\n * @typedef {import('mdast').Text} Text\n * @typedef {import('../index.js').Handler} Handler\n */\n\nimport {trimLines} from 'trim-lines'\nimport {u} from 'unist-builder'\n\n/**\n * @type {Handler}\n * @param {Text} node\n */\nexport function text(h, node) {\n return h.augment(node, u('text', trimLines(String(node.value))))\n}\n","/**\n * @typedef {import('mdast').ThematicBreak} ThematicBreak\n * @typedef {import('hast').Element} Element\n * @typedef {import('../index.js').Handler} Handler\n */\n\n/**\n * @type {Handler}\n * @param {ThematicBreak} [node]\n * @returns {Element}\n */\nexport function thematicBreak(h, node) {\n return h(node, 'hr')\n}\n","/**\n * @typedef {import('mdast').Root|import('mdast').Parent['children'][number]} MdastNode\n * @typedef {import('hast').Root|import('hast').Parent['children'][number]} HastNode\n * @typedef {import('mdast').Parent} Parent\n * @typedef {import('mdast').Definition} Definition\n * @typedef {import('mdast').FootnoteDefinition} FootnoteDefinition\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} Content\n * @typedef {import('unist-util-position').PositionLike} PositionLike\n *\n * @typedef EmbeddedHastFields\n * @property {string} [hName]\n * Defines the tag name of an element.\n * @property {Properties} [hProperties]\n * Defines the properties of an element.\n * @property {Array} [hChildren]\n * Defines the (hast) children of an element.\n *\n * @typedef {Record & EmbeddedHastFields} Data\n * unist data with embedded hast fields.\n *\n * @typedef {MdastNode & {data?: Data}} NodeWithData\n * unist node with embedded hast data.\n *\n * @callback Handler\n * Handle a node.\n * @param {H} h\n * Handle context.\n * @param {any} node\n * mdast node to handle.\n * @param {Parent|null} parent\n * Parent of `node`.\n * @returns {Content|Array|null|undefined}\n * hast node.\n *\n * @callback HFunctionProps\n * @param {MdastNode|PositionLike|null|undefined} node\n * mdast node or unist position.\n * @param {string} tagName\n * HTML tag name.\n * @param {Properties} props\n * Properties.\n * @param {Array?} [children]\n * hast content.\n * @returns {Element}\n * Compiled element.\n *\n * @callback HFunctionNoProps\n * @param {MdastNode|PositionLike|null|undefined} node\n * mdast node or unist position.\n * @param {string} tagName\n * HTML tag name.\n * @param {Array?} [children]\n * hast content\n * @returns {Element}\n * Compiled element.\n *\n * @typedef HFields\n * @property {boolean} dangerous\n * Whether HTML is allowed.\n * @property {string} clobberPrefix\n * Prefix to use to prevent DOM clobbering.\n * @property {string} footnoteLabel\n * Label to use to introduce the footnote section.\n * @property {string} footnoteLabelTagName\n * HTML used for the footnote label.\n * @property {Properties} footnoteLabelProperties\n * Properties on the HTML tag used for the footnote label.\n * @property {string} footnoteBackLabel\n * Label to use to go back to a footnote call from the footnote section.\n * @property {(identifier: string) => Definition|null} definition\n * Definition cache.\n * @property {Record} footnoteById\n * Footnote cache.\n * @property {Array} footnoteOrder\n * Order in which footnotes occur.\n * @property {Record} footnoteCounts\n * Counts the same footnote was used.\n * @property {Handlers} handlers\n * Applied handlers.\n * @property {Handler} unknownHandler\n * Handler for any none not in `passThrough` or otherwise handled.\n * @property {(left: NodeWithData|PositionLike|null|undefined, right: Content) => Content} augment\n * Like `h` but lower-level and usable on non-elements.\n * @property {Array} passThrough\n * List of node types to pass through untouched (except for their children).\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean} [allowDangerousHtml=false]\n * Whether to allow `html` nodes and inject them as `raw` HTML.\n * @property {string} [clobberPrefix='user-content-']\n * Prefix to use before the `id` attribute to prevent it from *clobbering*.\n * attributes.\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available in browsers on the `window` object.\n * Using a prefix prevents this from being a problem.\n * @property {string} [footnoteLabel='Footnotes']\n * Label to use for the footnotes section.\n * Affects screen reader users.\n * Change it if you’re authoring in a different language.\n * @property {string} [footnoteLabelTagName='h2']\n * HTML tag to use for the footnote label.\n * Can be changed to match your document structure and play well with your choice of css.\n * @property {Properties} [footnoteLabelProperties={className: ['sr-only']}]\n * Properties to use on the footnote label.\n * A 'sr-only' class is added by default to hide this from sighted users.\n * Change it to make the label visible, or add classes for other purposes.\n * @property {string} [footnoteBackLabel='Back to content']\n * Label to use from backreferences back to their footnote call.\n * Affects screen reader users.\n * Change it if you’re authoring in a different language.\n * @property {Handlers} [handlers]\n * Object mapping mdast nodes to functions handling them\n * @property {Array} [passThrough]\n * List of custom mdast node types to pass through (keep) in hast\n * @property {Handler} [unknownHandler]\n * Handler for all unknown nodes.\n *\n * @typedef {Record} Handlers\n * Map of node types to handlers\n * @typedef {HFunctionProps & HFunctionNoProps & HFields} H\n * Handle context\n */\n\nimport {u} from 'unist-builder'\nimport {visit} from 'unist-util-visit'\nimport {pointStart, pointEnd} from 'unist-util-position'\nimport {generated} from 'unist-util-generated'\nimport {definitions} from 'mdast-util-definitions'\nimport {one} from './traverse.js'\nimport {footer} from './footer.js'\nimport {handlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Turn mdast into hast.\n *\n * @param {MdastNode} tree\n * mdast node.\n * @param {Options} [options]\n * Configuration (optional).\n * @returns {H}\n * `h` function.\n */\nfunction factory(tree, options) {\n const settings = options || {}\n const dangerous = settings.allowDangerousHtml || false\n /** @type {Record} */\n const footnoteById = {}\n\n h.dangerous = dangerous\n h.clobberPrefix =\n settings.clobberPrefix === undefined || settings.clobberPrefix === null\n ? 'user-content-'\n : settings.clobberPrefix\n h.footnoteLabel = settings.footnoteLabel || 'Footnotes'\n h.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2'\n h.footnoteLabelProperties = settings.footnoteLabelProperties || {\n className: ['sr-only']\n }\n h.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'\n h.definition = definitions(tree)\n h.footnoteById = footnoteById\n /** @type {Array} */\n h.footnoteOrder = []\n /** @type {Record} */\n h.footnoteCounts = {}\n h.augment = augment\n h.handlers = {...handlers, ...settings.handlers}\n h.unknownHandler = settings.unknownHandler\n h.passThrough = settings.passThrough\n\n visit(tree, 'footnoteDefinition', (definition) => {\n const id = String(definition.identifier).toUpperCase()\n\n // Mimick CM behavior of link definitions.\n // See: .\n if (!own.call(footnoteById, id)) {\n footnoteById[id] = definition\n }\n })\n\n // @ts-expect-error Hush, it’s fine!\n return h\n\n /**\n * Finalise the created `right`, a hast node, from `left`, an mdast node.\n *\n * @param {(NodeWithData|PositionLike)?} left\n * @param {Content} right\n * @returns {Content}\n */\n function augment(left, right) {\n // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n if (left && 'data' in left && left.data) {\n /** @type {Data} */\n const data = left.data\n\n if (data.hName) {\n if (right.type !== 'element') {\n right = {\n type: 'element',\n tagName: '',\n properties: {},\n children: []\n }\n }\n\n right.tagName = data.hName\n }\n\n if (right.type === 'element' && data.hProperties) {\n right.properties = {...right.properties, ...data.hProperties}\n }\n\n if ('children' in right && right.children && data.hChildren) {\n right.children = data.hChildren\n }\n }\n\n if (left) {\n const ctx = 'type' in left ? left : {position: left}\n\n if (!generated(ctx)) {\n // @ts-expect-error: fine.\n right.position = {start: pointStart(ctx), end: pointEnd(ctx)}\n }\n }\n\n return right\n }\n\n /**\n * Create an element for `node`.\n *\n * @type {HFunctionProps}\n */\n function h(node, tagName, props, children) {\n if (Array.isArray(props)) {\n children = props\n props = {}\n }\n\n // @ts-expect-error augmenting an element yields an element.\n return augment(node, {\n type: 'element',\n tagName,\n properties: props || {},\n children: children || []\n })\n }\n}\n\n/**\n * Transform `tree` (an mdast node) to a hast node.\n *\n * @param {MdastNode} tree mdast node\n * @param {Options} [options] Configuration\n * @returns {HastNode|null|undefined} hast node\n */\nexport function toHast(tree, options) {\n const h = factory(tree, options)\n const node = one(h, tree, null)\n const foot = footer(h)\n\n if (foot) {\n // @ts-expect-error If there’s a footer, there were definitions, meaning block\n // content.\n // So assume `node` is a parent node.\n node.children.push(u('text', '\\n'), foot)\n }\n\n return Array.isArray(node) ? {type: 'root', children: node} : node\n}\n\nexport {handlers as defaultHandlers} from './handlers/index.js'\n","/**\n * @typedef {Object} PointLike\n * @property {number} [line]\n * @property {number} [column]\n * @property {number} [offset]\n *\n * @typedef {Object} PositionLike\n * @property {PointLike} [start]\n * @property {PointLike} [end]\n *\n * @typedef {Object} NodeLike\n * @property {PositionLike} [position]\n */\n\n/**\n * Check if `node` is *generated*.\n *\n * @param {NodeLike} [node]\n * @returns {boolean}\n */\nexport function generated(node) {\n return (\n !node ||\n !node.position ||\n !node.position.start ||\n !node.position.start.line ||\n !node.position.start.column ||\n !node.position.end ||\n !node.position.end.line ||\n !node.position.end.column\n )\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('./index.js').H} H\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {u} from 'unist-builder'\nimport {all} from './traverse.js'\nimport {wrap} from './wrap.js'\n\n/**\n * @param {H} h\n * @returns {Element|null}\n */\nexport function footer(h) {\n let index = -1\n /** @type {Array} */\n const listItems = []\n\n while (++index < h.footnoteOrder.length) {\n const def = h.footnoteById[h.footnoteOrder[index].toUpperCase()]\n\n if (!def) {\n continue\n }\n\n const content = all(h, def)\n const id = String(def.identifier)\n const safeId = normalizeUri(id.toLowerCase())\n let referenceIndex = 0\n /** @type {Array} */\n const backReferences = []\n\n while (++referenceIndex <= h.footnoteCounts[id]) {\n /** @type {Element} */\n const backReference = {\n type: 'element',\n tagName: 'a',\n properties: {\n href:\n '#' +\n h.clobberPrefix +\n 'fnref-' +\n safeId +\n (referenceIndex > 1 ? '-' + referenceIndex : ''),\n dataFootnoteBackref: true,\n className: ['data-footnote-backref'],\n ariaLabel: h.footnoteBackLabel\n },\n children: [{type: 'text', value: '↩'}]\n }\n\n if (referenceIndex > 1) {\n backReference.children.push({\n type: 'element',\n tagName: 'sup',\n children: [{type: 'text', value: String(referenceIndex)}]\n })\n }\n\n if (backReferences.length > 0) {\n backReferences.push({type: 'text', value: ' '})\n }\n\n backReferences.push(backReference)\n }\n\n const tail = content[content.length - 1]\n\n if (tail && tail.type === 'element' && tail.tagName === 'p') {\n const tailTail = tail.children[tail.children.length - 1]\n if (tailTail && tailTail.type === 'text') {\n tailTail.value += ' '\n } else {\n tail.children.push({type: 'text', value: ' '})\n }\n\n tail.children.push(...backReferences)\n } else {\n content.push(...backReferences)\n }\n\n /** @type {Element} */\n const listItem = {\n type: 'element',\n tagName: 'li',\n properties: {id: h.clobberPrefix + 'fn-' + safeId},\n children: wrap(content, true)\n }\n\n if (def.position) {\n listItem.position = def.position\n }\n\n listItems.push(listItem)\n }\n\n if (listItems.length === 0) {\n return null\n }\n\n return {\n type: 'element',\n tagName: 'section',\n properties: {dataFootnotes: true, className: ['footnotes']},\n children: [\n {\n type: 'element',\n tagName: h.footnoteLabelTagName,\n properties: {\n ...JSON.parse(JSON.stringify(h.footnoteLabelProperties)),\n id: 'footnote-label'\n },\n children: [u('text', h.footnoteLabel)]\n },\n {type: 'text', value: '\\n'},\n {\n type: 'element',\n tagName: 'ol',\n properties: {},\n children: wrap(listItems, true)\n },\n {type: 'text', value: '\\n'}\n ]\n }\n}\n","/**\n * @typedef {import('hast').Root} HastRoot\n * @typedef {import('mdast').Root} MdastRoot\n * @typedef {import('mdast-util-to-hast').Options} Options\n * @typedef {import('unified').Processor} Processor\n *\n * @typedef {import('mdast-util-to-hast')} DoNotTouchAsThisImportIncludesRawInTree\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n// Note: the `` overload doesn’t seem to work :'(\n\n/**\n * Plugin that turns markdown into HTML to support rehype.\n *\n * * If a destination processor is given, that processor runs with a new HTML\n * (hast) tree (bridge-mode).\n * As the given processor runs with a hast tree, and rehype plugins support\n * hast, that means rehype plugins can be used with the given processor.\n * The hast tree is discarded in the end.\n * It’s highly unlikely that you want to do this.\n * * The common case is to not pass a destination processor, in which case the\n * current processor continues running with a new HTML (hast) tree\n * (mutate-mode).\n * As the current processor continues with a hast tree, and rehype plugins\n * support hast, that means rehype plugins can be used after\n * `remark-rehype`.\n * It’s likely that this is what you want to do.\n *\n * @param destination\n * Optional unified processor.\n * @param options\n * Options passed to `mdast-util-to-hast`.\n */\nconst remarkRehype =\n /** @type {(import('unified').Plugin<[Processor, Options?]|[null|undefined, Options?]|[Options]|[], MdastRoot>)} */\n (\n function (destination, options) {\n return destination && 'run' in destination\n ? bridge(destination, options)\n : mutate(destination || options)\n }\n )\n\nexport default remarkRehype\n\n/**\n * Bridge-mode.\n * Runs the destination with the new hast tree.\n *\n * @type {import('unified').Plugin<[Processor, Options?], MdastRoot>}\n */\nfunction bridge(destination, options) {\n return (node, file, next) => {\n destination.run(toHast(node, options), file, (error) => {\n next(error)\n })\n }\n}\n\n/**\n * Mutate-mode.\n * Further plugins run on the hast tree.\n *\n * @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>}\n */\nfunction mutate(options) {\n // @ts-expect-error: assume a corresponding node is returned by `toHast`.\n return (node) => toHast(node, options)\n}\n","/**\n * @typedef {import('./info.js').Info} Info\n * @typedef {Record} Properties\n * @typedef {Record} Normal\n */\n\nexport class Schema {\n /**\n * @constructor\n * @param {Properties} property\n * @param {Normal} normal\n * @param {string} [space]\n */\n constructor(property, normal, space) {\n this.property = property\n this.normal = normal\n if (space) {\n this.space = space\n }\n }\n}\n\n/** @type {Properties} */\nSchema.prototype.property = {}\n/** @type {Normal} */\nSchema.prototype.normal = {}\n/** @type {string|null} */\nSchema.prototype.space = null\n","/**\n * @typedef {import('./schema.js').Properties} Properties\n * @typedef {import('./schema.js').Normal} Normal\n */\n\nimport {Schema} from './schema.js'\n\n/**\n * @param {Schema[]} definitions\n * @param {string} [space]\n * @returns {Schema}\n */\nexport function merge(definitions, space) {\n /** @type {Properties} */\n const property = {}\n /** @type {Normal} */\n const normal = {}\n let index = -1\n\n while (++index < definitions.length) {\n Object.assign(property, definitions[index].property)\n Object.assign(normal, definitions[index].normal)\n }\n\n return new Schema(property, normal, space)\n}\n","/**\n * @param {string} value\n * @returns {string}\n */\nexport function normalize(value) {\n return value.toLowerCase()\n}\n","export class Info {\n /**\n * @constructor\n * @param {string} property\n * @param {string} attribute\n */\n constructor(property, attribute) {\n /** @type {string} */\n this.property = property\n /** @type {string} */\n this.attribute = attribute\n }\n}\n\n/** @type {string|null} */\nInfo.prototype.space = null\nInfo.prototype.boolean = false\nInfo.prototype.booleanish = false\nInfo.prototype.overloadedBoolean = false\nInfo.prototype.number = false\nInfo.prototype.commaSeparated = false\nInfo.prototype.spaceSeparated = false\nInfo.prototype.commaOrSpaceSeparated = false\nInfo.prototype.mustUseProperty = false\nInfo.prototype.defined = false\n","let powers = 0\n\nexport const boolean = increment()\nexport const booleanish = increment()\nexport const overloadedBoolean = increment()\nexport const number = increment()\nexport const spaceSeparated = increment()\nexport const commaSeparated = increment()\nexport const commaOrSpaceSeparated = increment()\n\nfunction increment() {\n return 2 ** ++powers\n}\n","import {Info} from './info.js'\nimport * as types from './types.js'\n\n/** @type {Array} */\n// @ts-expect-error: hush.\nconst checks = Object.keys(types)\n\nexport class DefinedInfo extends Info {\n /**\n * @constructor\n * @param {string} property\n * @param {string} attribute\n * @param {number|null} [mask]\n * @param {string} [space]\n */\n constructor(property, attribute, mask, space) {\n let index = -1\n\n super(property, attribute)\n\n mark(this, 'space', space)\n\n if (typeof mask === 'number') {\n while (++index < checks.length) {\n const check = checks[index]\n mark(this, checks[index], (mask & types[check]) === types[check])\n }\n }\n }\n}\n\nDefinedInfo.prototype.defined = true\n\n/**\n * @param {DefinedInfo} values\n * @param {string} key\n * @param {unknown} value\n */\nfunction mark(values, key, value) {\n if (value) {\n // @ts-expect-error: assume `value` matches the expected value of `key`.\n values[key] = value\n }\n}\n","/**\n * @typedef {import('./schema.js').Properties} Properties\n * @typedef {import('./schema.js').Normal} Normal\n *\n * @typedef {Record} Attributes\n *\n * @typedef {Object} Definition\n * @property {Record} properties\n * @property {(attributes: Attributes, property: string) => string} transform\n * @property {string} [space]\n * @property {Attributes} [attributes]\n * @property {Array} [mustUseProperty]\n */\n\nimport {normalize} from '../normalize.js'\nimport {Schema} from './schema.js'\nimport {DefinedInfo} from './defined-info.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * @param {Definition} definition\n * @returns {Schema}\n */\nexport function create(definition) {\n /** @type {Properties} */\n const property = {}\n /** @type {Normal} */\n const normal = {}\n /** @type {string} */\n let prop\n\n for (prop in definition.properties) {\n if (own.call(definition.properties, prop)) {\n const value = definition.properties[prop]\n const info = new DefinedInfo(\n prop,\n definition.transform(definition.attributes || {}, prop),\n value,\n definition.space\n )\n\n if (\n definition.mustUseProperty &&\n definition.mustUseProperty.includes(prop)\n ) {\n info.mustUseProperty = true\n }\n\n property[prop] = info\n\n normal[normalize(prop)] = prop\n normal[normalize(info.attribute)] = prop\n }\n }\n\n return new Schema(property, normal, definition.space)\n}\n","import {create} from './util/create.js'\n\nexport const xlink = create({\n space: 'xlink',\n transform(_, prop) {\n return 'xlink:' + prop.slice(5).toLowerCase()\n },\n properties: {\n xLinkActuate: null,\n xLinkArcRole: null,\n xLinkHref: null,\n xLinkRole: null,\n xLinkShow: null,\n xLinkTitle: null,\n xLinkType: null\n }\n})\n","import {create} from './util/create.js'\n\nexport const xml = create({\n space: 'xml',\n transform(_, prop) {\n return 'xml:' + prop.slice(3).toLowerCase()\n },\n properties: {xmlLang: null, xmlBase: null, xmlSpace: null}\n})\n","/**\n * @param {Record} attributes\n * @param {string} attribute\n * @returns {string}\n */\nexport function caseSensitiveTransform(attributes, attribute) {\n return attribute in attributes ? attributes[attribute] : attribute\n}\n","import {caseSensitiveTransform} from './case-sensitive-transform.js'\n\n/**\n * @param {Record} attributes\n * @param {string} property\n * @returns {string}\n */\nexport function caseInsensitiveTransform(attributes, property) {\n return caseSensitiveTransform(attributes, property.toLowerCase())\n}\n","import {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const xmlns = create({\n space: 'xmlns',\n attributes: {xmlnsxlink: 'xmlns:xlink'},\n transform: caseInsensitiveTransform,\n properties: {xmlns: null, xmlnsXLink: null}\n})\n","import {booleanish, number, spaceSeparated} from './util/types.js'\nimport {create} from './util/create.js'\n\nexport const aria = create({\n transform(_, prop) {\n return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()\n },\n properties: {\n ariaActiveDescendant: null,\n ariaAtomic: booleanish,\n ariaAutoComplete: null,\n ariaBusy: booleanish,\n ariaChecked: booleanish,\n ariaColCount: number,\n ariaColIndex: number,\n ariaColSpan: number,\n ariaControls: spaceSeparated,\n ariaCurrent: null,\n ariaDescribedBy: spaceSeparated,\n ariaDetails: null,\n ariaDisabled: booleanish,\n ariaDropEffect: spaceSeparated,\n ariaErrorMessage: null,\n ariaExpanded: booleanish,\n ariaFlowTo: spaceSeparated,\n ariaGrabbed: booleanish,\n ariaHasPopup: null,\n ariaHidden: booleanish,\n ariaInvalid: null,\n ariaKeyShortcuts: null,\n ariaLabel: null,\n ariaLabelledBy: spaceSeparated,\n ariaLevel: number,\n ariaLive: null,\n ariaModal: booleanish,\n ariaMultiLine: booleanish,\n ariaMultiSelectable: booleanish,\n ariaOrientation: null,\n ariaOwns: spaceSeparated,\n ariaPlaceholder: null,\n ariaPosInSet: number,\n ariaPressed: booleanish,\n ariaReadOnly: booleanish,\n ariaRelevant: null,\n ariaRequired: booleanish,\n ariaRoleDescription: spaceSeparated,\n ariaRowCount: number,\n ariaRowIndex: number,\n ariaRowSpan: number,\n ariaSelected: booleanish,\n ariaSetSize: number,\n ariaSort: null,\n ariaValueMax: number,\n ariaValueMin: number,\n ariaValueNow: number,\n ariaValueText: null,\n role: null\n }\n})\n","import {\n boolean,\n overloadedBoolean,\n booleanish,\n number,\n spaceSeparated,\n commaSeparated\n} from './util/types.js'\nimport {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const html = create({\n space: 'html',\n attributes: {\n acceptcharset: 'accept-charset',\n classname: 'class',\n htmlfor: 'for',\n httpequiv: 'http-equiv'\n },\n transform: caseInsensitiveTransform,\n mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],\n properties: {\n // Standard Properties.\n abbr: null,\n accept: commaSeparated,\n acceptCharset: spaceSeparated,\n accessKey: spaceSeparated,\n action: null,\n allow: null,\n allowFullScreen: boolean,\n allowPaymentRequest: boolean,\n allowUserMedia: boolean,\n alt: null,\n as: null,\n async: boolean,\n autoCapitalize: null,\n autoComplete: spaceSeparated,\n autoFocus: boolean,\n autoPlay: boolean,\n capture: boolean,\n charSet: null,\n checked: boolean,\n cite: null,\n className: spaceSeparated,\n cols: number,\n colSpan: null,\n content: null,\n contentEditable: booleanish,\n controls: boolean,\n controlsList: spaceSeparated,\n coords: number | commaSeparated,\n crossOrigin: null,\n data: null,\n dateTime: null,\n decoding: null,\n default: boolean,\n defer: boolean,\n dir: null,\n dirName: null,\n disabled: boolean,\n download: overloadedBoolean,\n draggable: booleanish,\n encType: null,\n enterKeyHint: null,\n form: null,\n formAction: null,\n formEncType: null,\n formMethod: null,\n formNoValidate: boolean,\n formTarget: null,\n headers: spaceSeparated,\n height: number,\n hidden: boolean,\n high: number,\n href: null,\n hrefLang: null,\n htmlFor: spaceSeparated,\n httpEquiv: spaceSeparated,\n id: null,\n imageSizes: null,\n imageSrcSet: null,\n inputMode: null,\n integrity: null,\n is: null,\n isMap: boolean,\n itemId: null,\n itemProp: spaceSeparated,\n itemRef: spaceSeparated,\n itemScope: boolean,\n itemType: spaceSeparated,\n kind: null,\n label: null,\n lang: null,\n language: null,\n list: null,\n loading: null,\n loop: boolean,\n low: number,\n manifest: null,\n max: null,\n maxLength: number,\n media: null,\n method: null,\n min: null,\n minLength: number,\n multiple: boolean,\n muted: boolean,\n name: null,\n nonce: null,\n noModule: boolean,\n noValidate: boolean,\n onAbort: null,\n onAfterPrint: null,\n onAuxClick: null,\n onBeforeMatch: null,\n onBeforePrint: null,\n onBeforeUnload: null,\n onBlur: null,\n onCancel: null,\n onCanPlay: null,\n onCanPlayThrough: null,\n onChange: null,\n onClick: null,\n onClose: null,\n onContextLost: null,\n onContextMenu: null,\n onContextRestored: null,\n onCopy: null,\n onCueChange: null,\n onCut: null,\n onDblClick: null,\n onDrag: null,\n onDragEnd: null,\n onDragEnter: null,\n onDragExit: null,\n onDragLeave: null,\n onDragOver: null,\n onDragStart: null,\n onDrop: null,\n onDurationChange: null,\n onEmptied: null,\n onEnded: null,\n onError: null,\n onFocus: null,\n onFormData: null,\n onHashChange: null,\n onInput: null,\n onInvalid: null,\n onKeyDown: null,\n onKeyPress: null,\n onKeyUp: null,\n onLanguageChange: null,\n onLoad: null,\n onLoadedData: null,\n onLoadedMetadata: null,\n onLoadEnd: null,\n onLoadStart: null,\n onMessage: null,\n onMessageError: null,\n onMouseDown: null,\n onMouseEnter: null,\n onMouseLeave: null,\n onMouseMove: null,\n onMouseOut: null,\n onMouseOver: null,\n onMouseUp: null,\n onOffline: null,\n onOnline: null,\n onPageHide: null,\n onPageShow: null,\n onPaste: null,\n onPause: null,\n onPlay: null,\n onPlaying: null,\n onPopState: null,\n onProgress: null,\n onRateChange: null,\n onRejectionHandled: null,\n onReset: null,\n onResize: null,\n onScroll: null,\n onScrollEnd: null,\n onSecurityPolicyViolation: null,\n onSeeked: null,\n onSeeking: null,\n onSelect: null,\n onSlotChange: null,\n onStalled: null,\n onStorage: null,\n onSubmit: null,\n onSuspend: null,\n onTimeUpdate: null,\n onToggle: null,\n onUnhandledRejection: null,\n onUnload: null,\n onVolumeChange: null,\n onWaiting: null,\n onWheel: null,\n open: boolean,\n optimum: number,\n pattern: null,\n ping: spaceSeparated,\n placeholder: null,\n playsInline: boolean,\n poster: null,\n preload: null,\n readOnly: boolean,\n referrerPolicy: null,\n rel: spaceSeparated,\n required: boolean,\n reversed: boolean,\n rows: number,\n rowSpan: number,\n sandbox: spaceSeparated,\n scope: null,\n scoped: boolean,\n seamless: boolean,\n selected: boolean,\n shape: null,\n size: number,\n sizes: null,\n slot: null,\n span: number,\n spellCheck: booleanish,\n src: null,\n srcDoc: null,\n srcLang: null,\n srcSet: null,\n start: number,\n step: null,\n style: null,\n tabIndex: number,\n target: null,\n title: null,\n translate: null,\n type: null,\n typeMustMatch: boolean,\n useMap: null,\n value: booleanish,\n width: number,\n wrap: null,\n\n // Legacy.\n // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis\n align: null, // Several. Use CSS `text-align` instead,\n aLink: null, // ``. Use CSS `a:active {color}` instead\n archive: spaceSeparated, // ``. List of URIs to archives\n axis: null, // `` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: boolean, // Lists. Use CSS to reduce space between items instead\n declare: boolean, // ``\n event: null, // `
\ No newline at end of file