@rohal12/spindle 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/dist/pkg/format.js +1 -0
- package/dist/pkg/index.js +12 -0
- package/dist/pkg/types/globals.d.ts +18 -0
- package/dist/pkg/types/index.d.ts +158 -0
- package/package.json +71 -0
- package/src/components/App.tsx +53 -0
- package/src/components/Passage.tsx +36 -0
- package/src/components/PassageLink.tsx +35 -0
- package/src/components/SaveLoadDialog.tsx +403 -0
- package/src/components/SettingsDialog.tsx +106 -0
- package/src/components/StoryInterface.tsx +31 -0
- package/src/components/macros/Back.tsx +23 -0
- package/src/components/macros/Button.tsx +49 -0
- package/src/components/macros/Checkbox.tsx +41 -0
- package/src/components/macros/Computed.tsx +100 -0
- package/src/components/macros/Cycle.tsx +39 -0
- package/src/components/macros/Do.tsx +46 -0
- package/src/components/macros/For.tsx +113 -0
- package/src/components/macros/Forward.tsx +25 -0
- package/src/components/macros/Goto.tsx +23 -0
- package/src/components/macros/If.tsx +63 -0
- package/src/components/macros/Include.tsx +52 -0
- package/src/components/macros/Listbox.tsx +42 -0
- package/src/components/macros/MacroLink.tsx +107 -0
- package/src/components/macros/Numberbox.tsx +43 -0
- package/src/components/macros/Print.tsx +48 -0
- package/src/components/macros/QuickLoad.tsx +33 -0
- package/src/components/macros/QuickSave.tsx +22 -0
- package/src/components/macros/Radiobutton.tsx +59 -0
- package/src/components/macros/Repeat.tsx +53 -0
- package/src/components/macros/Restart.tsx +27 -0
- package/src/components/macros/Saves.tsx +25 -0
- package/src/components/macros/Set.tsx +36 -0
- package/src/components/macros/SettingsButton.tsx +29 -0
- package/src/components/macros/Stop.tsx +12 -0
- package/src/components/macros/StoryTitle.tsx +20 -0
- package/src/components/macros/Switch.tsx +69 -0
- package/src/components/macros/Textarea.tsx +41 -0
- package/src/components/macros/Textbox.tsx +40 -0
- package/src/components/macros/Timed.tsx +63 -0
- package/src/components/macros/Type.tsx +83 -0
- package/src/components/macros/Unset.tsx +25 -0
- package/src/components/macros/VarDisplay.tsx +44 -0
- package/src/components/macros/Widget.tsx +18 -0
- package/src/components/macros/option-utils.ts +14 -0
- package/src/expression.ts +93 -0
- package/src/index.tsx +120 -0
- package/src/markup/ast.ts +284 -0
- package/src/markup/markdown.ts +21 -0
- package/src/markup/render.tsx +537 -0
- package/src/markup/tokenizer.ts +581 -0
- package/src/parser.ts +72 -0
- package/src/registry.ts +21 -0
- package/src/saves/idb.ts +165 -0
- package/src/saves/save-manager.ts +317 -0
- package/src/saves/types.ts +40 -0
- package/src/settings.ts +96 -0
- package/src/store.ts +317 -0
- package/src/story-api.ts +129 -0
- package/src/story-init.ts +67 -0
- package/src/story-variables.ts +166 -0
- package/src/styles.css +780 -0
- package/src/utils/parse-delay.ts +14 -0
- package/src/widgets/widget-registry.ts +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Spindle
|
|
2
|
+
|
|
3
|
+
A modern [Twine 2](https://twinery.org/) story format built with [Preact](https://preactjs.com/). Variables, macros, saves, settings, widgets, and full CommonMark markdown — all using a concise curly-brace syntax.
|
|
4
|
+
|
|
5
|
+
**[Documentation](https://rohal12.github.io/spindle/)**
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @rohal12/spindle
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Curly-brace macro syntax: `{if $health > 0}...{/if}`, `{set $name = "Hero"}`
|
|
16
|
+
- Story and temporary variables with dot notation
|
|
17
|
+
- Full CommonMark markdown (GFM tables, strikethrough)
|
|
18
|
+
- Form inputs: textbox, numberbox, checkbox, radio, listbox, cycle
|
|
19
|
+
- Save system with playthroughs, quick save/load, and export/import
|
|
20
|
+
- Persistent settings (toggle, list, range)
|
|
21
|
+
- Reusable widgets
|
|
22
|
+
- `window.Story` JavaScript API for scripting
|
|
23
|
+
- StoryVariables passage for strict variable declarations
|
|
24
|
+
|
|
25
|
+
## Usage with twee-ts
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import * as spindle from '@rohal12/spindle';
|
|
29
|
+
import { compile } from '@rohal12/twee-ts';
|
|
30
|
+
|
|
31
|
+
const result = await compile({
|
|
32
|
+
sources: ['src/'],
|
|
33
|
+
format: spindle,
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or install both and let twee-ts auto-discover the format via the `twine-story-format` keyword.
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
|
|
41
|
+
Full docs at **[rohal12.github.io/spindle](https://rohal12.github.io/spindle/)**:
|
|
42
|
+
|
|
43
|
+
- [Markup](https://rohal12.github.io/spindle/markup) — Links, variables, macros, HTML, markdown
|
|
44
|
+
- [Macros](https://rohal12.github.io/spindle/macros) — Complete macro reference
|
|
45
|
+
- [Variables](https://rohal12.github.io/spindle/variables) — Story and temporary variables
|
|
46
|
+
- [Special Passages](https://rohal12.github.io/spindle/special-passages) — StoryInit, StoryVariables, StoryInterface
|
|
47
|
+
- [Saves](https://rohal12.github.io/spindle/saves) — Save system
|
|
48
|
+
- [Settings](https://rohal12.github.io/spindle/settings) — Toggle, list, and range settings
|
|
49
|
+
- [Story API](https://rohal12.github.io/spindle/story-api) — The `window.Story` JavaScript API
|
|
50
|
+
- [Widgets](https://rohal12.github.io/spindle/widgets) — Reusable content blocks
|
|
51
|
+
- [npm Package](https://rohal12.github.io/spindle/story-format-packages) — Packaging guide
|
|
52
|
+
|
|
53
|
+
## Development
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
bun install
|
|
57
|
+
bun run test # run tests
|
|
58
|
+
bun run build # build format
|
|
59
|
+
bun run preview # build + compile dev story
|
|
60
|
+
bun run docs:dev # local docs dev server
|
|
61
|
+
bun run docs:build # build docs for deployment
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
This is free and unencumbered software released into the public domain. See [UNLICENSE](UNLICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.storyFormat({"name":"spindle","version":"0.1.0","author":"Rohal12","description":"A Preact-based story format for Twine 2.","image":"","url":"","license":"Unlicense","proofing":false,"source":"<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\" />\n <meta\n name=\"viewport\"\n content=\"width=device-width, initial-scale=1\"\n />\n <title>{{STORY_NAME}}</title>\n <link id=\"favicon\" rel=\"icon\" type=\"image/svg+xml\" href=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='sg' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23c4b5fd'/%3E%3Cstop offset='50%25' stop-color='%238b5cf6'/%3E%3Cstop offset='100%25' stop-color='%235b21b6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cellipse cx='16' cy='16' rx='13' ry='5' stroke='%237c3aed' stroke-width='1.8' fill='none' opacity='.85' transform='rotate(55,16,16)'/%3E%3Cellipse cx='16' cy='16' rx='13' ry='5' stroke='%238b5cf6' stroke-width='1.8' fill='none' opacity='.85' transform='rotate(-55,16,16)'/%3E%3Cpath d='M16 3Q19.5 9 20.5 16 19.5 23 16 29 12.5 23 11.5 16 12.5 9 16 3Z' fill='url(%23sg)'/%3E%3C/svg%3E\" />\n <script type=\"module\" crossorigin>(function(){const t=document.createElement(\"link\").relList;if(t&&t.supports&&t.supports(\"modulepreload\"))return;for(const i of document.querySelectorAll('link[rel=\"modulepreload\"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type===\"childList\")for(const s of a.addedNodes)s.tagName===\"LINK\"&&s.rel===\"modulepreload\"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin===\"use-credentials\"?a.credentials=\"include\":i.crossOrigin===\"anonymous\"?a.credentials=\"omit\":a.credentials=\"same-origin\",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var it,F,Ir,Ne,$n,Ar,Er,Tr,hn,Wt,jt,Pr,yt={},bt=[],sa=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,at=Array.isArray;function _e(e,t){for(var n in t)e[n]=t[n];return e}function pn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function pe(e,t,n){var r,i,a,s={};for(a in t)a==\"key\"?r=t[a]:a==\"ref\"?i=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?it.call(arguments,2):n),typeof e==\"function\"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return Ye(e,s,r,i,null)}function Ye(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Ir,__i:-1,__u:0};return i==null&&F.vnode!=null&&F.vnode(a),a}function oa(){return{current:null}}function Q(e){return e.children}function ye(e,t){this.props=e,this.context=t}function Me(e,t){if(t==null)return e.__?Me(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==\"function\"?Me(e):null}function la(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=_e({},t);a.__v=t.__v+1,F.vnode&&F.vnode(a),dn(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Me(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,zr(r,a,i),t.__e=t.__=null,a.__e!=n&&Nr(a)}}function Nr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Nr(e)}function Qt(e){(!e.__d&&(e.__d=!0)&&Ne.push(e)&&!xt.__r++||$n!=F.debounceRendering)&&(($n=F.debounceRendering)||Ar)(xt)}function xt(){for(var e,t=1;Ne.length;)Ne.length>t&&Ne.sort(Er),e=Ne.shift(),t=Ne.length,la(e);xt.__r=0}function Dr(e,t,n,r,i,a,s,o,u,l,f){var c,p,h,_,w,I,b,v=r&&r.__k||bt,S=t.length;for(u=ua(n,t,v,u,S),c=0;c<S;c++)(h=n.__k[c])!=null&&(p=h.__i!=-1&&v[h.__i]||yt,h.__i=c,I=dn(e,h,p,i,a,s,o,u,l,f),_=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&mn(p.ref,null,h),f.push(h.ref,h.__c||_,h)),w==null&&_!=null&&(w=_),(b=!!(4&h.__u))||p.__k===h.__k?u=$r(h,u,e,b):typeof h.type==\"function\"&&I!==void 0?u=I:_&&(u=_.nextSibling),h.__u&=-7);return n.__e=w,u}function ua(e,t,n,r,i){var a,s,o,u,l,f=n.length,c=f,p=0;for(e.__k=new Array(i),a=0;a<i;a++)(s=t[a])!=null&&typeof s!=\"boolean\"&&typeof s!=\"function\"?(typeof s==\"string\"||typeof s==\"number\"||typeof s==\"bigint\"||s.constructor==String?s=e.__k[a]=Ye(null,s,null,null,null):at(s)?s=e.__k[a]=Ye(Q,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Ye(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,u=a+p,s.__=e,s.__b=e.__b+1,o=null,(l=s.__i=ca(s,n,u,c))!=-1&&(c--,(o=n[l])&&(o.__u|=2)),o==null||o.__v==null?(l==-1&&(i>f?p--:i<f&&p++),typeof s.type!=\"function\"&&(s.__u|=4)):l!=u&&(l==u-1?p--:l==u+1?p++:(l>u?p--:p++,s.__u|=4))):e.__k[a]=null;if(c)for(a=0;a<f;a++)(o=n[a])!=null&&(2&o.__u)==0&&(o.__e==r&&(r=Me(o)),Or(o,o));return r}function $r(e,t,n,r){var i,a;if(typeof e.type==\"function\"){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=$r(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Me(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ve(e,t){return t=t||[],e==null||typeof e==\"boolean\"||(at(e)?e.some(function(n){ve(n,t)}):t.push(e)),t}function ca(e,t,n,r){var i,a,s,o=e.key,u=e.type,l=t[n],f=l!=null&&(2&l.__u)==0;if(l===null&&o==null||f&&o==l.key&&u==l.type)return n;if(r>(f?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[s=i>=0?i--:a++])!=null&&(2&l.__u)==0&&o==l.key&&u==l.type)return s}return-1}function zn(e,t,n){t[0]==\"-\"?e.setProperty(t,n??\"\"):e[t]=n==null?\"\":typeof n!=\"number\"||sa.test(t)?n:n+\"px\"}function ut(e,t,n,r,i){var a,s;e:if(t==\"style\")if(typeof n==\"string\")e.style.cssText=n;else{if(typeof r==\"string\"&&(e.style.cssText=r=\"\"),r)for(t in r)n&&t in n||zn(e.style,t,\"\");if(n)for(t in n)r&&n[t]==r[t]||zn(e.style,t,n[t])}else if(t[0]==\"o\"&&t[1]==\"n\")a=t!=(t=t.replace(Tr,\"$1\")),s=t.toLowerCase(),t=s in e||t==\"onFocusOut\"||t==\"onFocusIn\"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n.u=r.u:(n.u=hn,e.addEventListener(t,a?jt:Wt,a)):e.removeEventListener(t,a?jt:Wt,a);else{if(i==\"http://www.w3.org/2000/svg\")t=t.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(t!=\"width\"&&t!=\"height\"&&t!=\"href\"&&t!=\"list\"&&t!=\"form\"&&t!=\"tabIndex\"&&t!=\"download\"&&t!=\"rowSpan\"&&t!=\"colSpan\"&&t!=\"role\"&&t!=\"popover\"&&t in e)try{e[t]=n??\"\";break e}catch{}typeof n==\"function\"||(n==null||n===!1&&t[4]!=\"-\"?e.removeAttribute(t):e.setAttribute(t,t==\"popover\"&&n==1?\"\":n))}}function Fn(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=hn++;else if(t.t<n.u)return;return n(F.event?F.event(t):t)}}}function dn(e,t,n,r,i,a,s,o,u,l){var f,c,p,h,_,w,I,b,v,S,z,E,x,P,M,L=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),a=[o=t.__e=n.__e]),(f=F.__b)&&f(t);e:if(typeof L==\"function\")try{if(b=t.props,v=\"prototype\"in L&&L.prototype.render,S=(f=L.contextType)&&r[f.__c],z=f?S?S.props.value:f.__:r,n.__c?I=(c=t.__c=n.__c).__=c.__E:(v?t.__c=c=new L(b,z):(t.__c=c=new ye(b,z),c.constructor=L,c.render=ha),S&&S.sub(c),c.state||(c.state={}),c.__n=r,p=c.__d=!0,c.__h=[],c._sb=[]),v&&c.__s==null&&(c.__s=c.state),v&&L.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=_e({},c.__s)),_e(c.__s,L.getDerivedStateFromProps(b,c.__s))),h=c.props,_=c.state,c.__v=t,p)v&&L.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),v&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(v&&L.getDerivedStateFromProps==null&&b!==h&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(b,z),t.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(b,c.__s,z)===!1){t.__v!=n.__v&&(c.props=b,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(y){y&&(y.__=t)}),bt.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(b,c.__s,z),v&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(h,_,w)})}if(c.context=z,c.props=b,c.__P=e,c.__e=!1,E=F.__r,x=0,v)c.state=c.__s,c.__d=!1,E&&E(t),f=c.render(c.props,c.state,c.context),bt.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,E&&E(t),f=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++x<25);c.state=c.__s,c.getChildContext!=null&&(r=_e(_e({},r),c.getChildContext())),v&&!p&&c.getSnapshotBeforeUpdate!=null&&(w=c.getSnapshotBeforeUpdate(h,_)),P=f!=null&&f.type===Q&&f.key==null?Fr(f.props.children):f,o=Dr(e,at(P)?P:[P],t,n,r,i,a,s,o,u,l),c.base=t.__e,t.__u&=-161,c.__h.length&&s.push(c),I&&(c.__E=c.__=null)}catch(y){if(t.__v=null,u||a!=null)if(y.then){for(t.__u|=u?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;a[a.indexOf(o)]=null,t.__e=o}else{for(M=a.length;M--;)pn(a[M]);Kt(t)}else t.__e=n.__e,t.__k=n.__k,y.then||Kt(t);F.__e(y,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):o=t.__e=fa(n.__e,t,n,r,i,a,s,u,l);return(f=F.diffed)&&f(t),128&t.__u?void 0:o}function Kt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Kt))}function zr(e,t,n){for(var r=0;r<n.length;r++)mn(n[r],n[++r],n[++r]);F.__c&&F.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){F.__e(a,i.__v)}})}function Fr(e){return typeof e!=\"object\"||e==null||e.__b>0?e:at(e)?e.map(Fr):_e({},e)}function fa(e,t,n,r,i,a,s,o,u){var l,f,c,p,h,_,w,I=n.props||yt,b=t.props,v=t.type;if(v==\"svg\"?i=\"http://www.w3.org/2000/svg\":v==\"math\"?i=\"http://www.w3.org/1998/Math/MathML\":i||(i=\"http://www.w3.org/1999/xhtml\"),a!=null){for(l=0;l<a.length;l++)if((h=a[l])&&\"setAttribute\"in h==!!v&&(v?h.localName==v:h.nodeType==3)){e=h,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(b);e=document.createElementNS(i,v,b.is&&b),o&&(F.__m&&F.__m(t,a),o=!1),a=null}if(v==null)I===b||o&&e.data==b||(e.data=b);else{if(a=a&&it.call(e.childNodes),!o&&a!=null)for(I={},l=0;l<e.attributes.length;l++)I[(h=e.attributes[l]).name]=h.value;for(l in I)h=I[l],l==\"dangerouslySetInnerHTML\"?c=h:l==\"children\"||l in b||l==\"value\"&&\"defaultValue\"in b||l==\"checked\"&&\"defaultChecked\"in b||ut(e,l,null,h,i);for(l in b)h=b[l],l==\"children\"?p=h:l==\"dangerouslySetInnerHTML\"?f=h:l==\"value\"?_=h:l==\"checked\"?w=h:o&&typeof h!=\"function\"||I[l]===h||ut(e,l,h,I[l],i);if(f)o||c&&(f.__html==c.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(c&&(e.innerHTML=\"\"),Dr(t.type==\"template\"?e.content:e,at(p)?p:[p],t,n,r,v==\"foreignObject\"?\"http://www.w3.org/1999/xhtml\":i,a,s,a?a[0]:n.__k&&Me(n,0),o,u),a!=null)for(l=a.length;l--;)pn(a[l]);o||(l=\"value\",v==\"progress\"&&_==null?e.removeAttribute(\"value\"):_!=null&&(_!==e[l]||v==\"progress\"&&!_||v==\"option\"&&_!=I[l])&&ut(e,l,_,I[l],i),l=\"checked\",w!=null&&w!=e[l]&&ut(e,l,w,I[l],i))}return e}function mn(e,t,n){try{if(typeof e==\"function\"){var r=typeof e.__u==\"function\";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){F.__e(i,n)}}function Or(e,t,n){var r,i;if(F.unmount&&F.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||mn(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){F.__e(a,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Or(r[i],t,n||typeof e.type!=\"function\");n||pn(e.__e),e.__c=e.__=e.__e=void 0}function ha(e,t,n){return this.constructor(e,n)}function Be(e,t,n){var r,i,a,s;t==document&&(t=document.documentElement),F.__&&F.__(e,t),i=(r=typeof n==\"function\")?null:n&&n.__k||t.__k,a=[],s=[],dn(t,e=(!r&&n||t).__k=pe(Q,null,[e]),i||yt,yt,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?it.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,s),zr(a,e,s)}function Rr(e,t){Be(e,t,Rr)}function pa(e,t,n){var r,i,a,s,o=_e({},e.props);for(a in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)a==\"key\"?r=t[a]:a==\"ref\"?i=t[a]:o[a]=t[a]===void 0&&s!=null?s[a]:t[a];return arguments.length>2&&(o.children=arguments.length>3?it.call(arguments,2):n),Ye(e.type,o,r||e.key,i||e.ref,null)}function gn(e){function t(n){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&r.forEach(function(s){s.__e=!0,Qt(s)})},this.sub=function(a){r.add(a);var s=a.componentWillUnmount;a.componentWillUnmount=function(){r&&r.delete(a),s&&s.call(a)}}),n.children}return t.__c=\"__cC\"+Pr++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,r){return n.children(r)}).contextType=t,t}it=bt.slice,F={__e:function(e,t,n,r){for(var i,a,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(o){e=o}throw e}},Ir=0,ye.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=_e({},this.state),typeof e==\"function\"&&(e=e(_e({},n),this.props)),e&&_e(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Qt(this))},ye.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Qt(this))},ye.prototype.render=Q,Ne=[],Ar=typeof Promise==\"function\"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Er=function(e,t){return e.__v.__b-t.__v.__b},xt.__r=0,Tr=/(PointerCapture)$|Capture$/i,hn=0,Wt=Fn(!1),jt=Fn(!0),Pr=0;var da=0;function g(e,t,n,r,i,a){t||(t={});var s,o,u=t;if(\"ref\"in u)for(o in u={},t)o==\"ref\"?s=t[o]:u[o]=t[o];var l={type:e,props:u,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--da,__i:-1,__u:0,__source:i,__self:a};if(typeof e==\"function\"&&(s=e.defaultProps))for(o in s)u[o]===void 0&&(u[o]=s[o]);return F.vnode&&F.vnode(l),l}var Se,W,Ot,On,Ve=0,Lr=[],j=F,Rn=j.__b,Ln=j.__r,Mn=j.diffed,Bn=j.__c,Vn=j.unmount,Hn=j.__;function Ue(e,t){j.__h&&j.__h(W,e,Ve||t),Ve=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return Ve=1,_n(Hr,e)}function _n(e,t,n){var r=Ue(Se++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Hr(void 0,t),function(o){var u=r.__N?r.__N[0]:r.__[0],l=r.t(u,o);u!==l&&(r.__N=[l,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.__f)){var i=function(o,u,l){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(p){return p.__c});if(f.every(function(p){return!p.__N}))return!a||a.call(this,o,u,l);var c=r.__c.props!==o;return f.some(function(p){if(p.__N){var h=p.__[0];p.__=p.__N,p.__N=void 0,h!==p.__[0]&&(c=!0)}}),a&&a.call(this,o,u,l)||c};W.__f=!0;var a=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(o,u,l){if(this.__e){var f=a;a=void 0,i(o,u,l),a=f}s&&s.call(this,o,u,l)},W.shouldComponentUpdate=i}return r.__N||r.__}function be(e,t){var n=Ue(Se++,3);!j.__s&&yn(n.__H,t)&&(n.__=e,n.u=t,W.__H.__h.push(n))}function ue(e,t){var n=Ue(Se++,4);!j.__s&&yn(n.__H,t)&&(n.__=e,n.u=t,W.__h.push(n))}function Je(e){return Ve=5,qe(function(){return{current:e}},[])}function Mr(e,t,n){Ve=6,ue(function(){if(typeof e==\"function\"){var r=e(t());return function(){e(null),r&&typeof r==\"function\"&&r()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function qe(e,t){var n=Ue(Se++,7);return yn(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function It(e,t){return Ve=8,qe(function(){return e},t)}function we(e){var t=W.context[e.__c],n=Ue(Se++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(W)),t.props.value):e.__}function Br(e,t){j.useDebugValue&&j.useDebugValue(t?t(e):e)}function Vr(){var e=Ue(Se++,11);if(!e.__){for(var t=W.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=\"P\"+n[0]+\"-\"+n[1]++}return e.__}function ma(){for(var e;e=Lr.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(mt),t.__h.some(Gt),t.__h=[]}catch(n){t.__h=[],j.__e(n,e.__v)}}}j.__b=function(e){W=null,Rn&&Rn(e)},j.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Hn&&Hn(e,t)},j.__r=function(e){Ln&&Ln(e),Se=0;var t=(W=e.__c).__H;t&&(Ot===W?(t.__h=[],W.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(mt),t.__h.some(Gt),t.__h=[],Se=0)),Ot=W},j.diffed=function(e){Mn&&Mn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Lr.push(t)!==1&&On===j.requestAnimationFrame||((On=j.requestAnimationFrame)||ga)(ma)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Ot=W=null},j.__c=function(e,t){t.some(function(n){try{n.__h.some(mt),n.__h=n.__h.filter(function(r){return!r.__||Gt(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],j.__e(r,n.__v)}}),Bn&&Bn(e,t)},j.unmount=function(e){Vn&&Vn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{mt(r)}catch(i){t=i}}),n.__H=void 0,t&&j.__e(t,n.__v))};var Un=typeof requestAnimationFrame==\"function\";function ga(e){var t,n=function(){clearTimeout(r),Un&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Un&&(t=requestAnimationFrame(n))}function mt(e){var t=W,n=e.__c;typeof n==\"function\"&&(e.__c=void 0,n()),W=t}function Gt(e){var t=W;e.__c=e.__(),W=t}function yn(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Hr(e,t){return typeof t==\"function\"?t(e):t}const qn=e=>{let t;const n=new Set,r=(l,f)=>{const c=typeof l==\"function\"?l(t):l;if(!Object.is(c,t)){const p=t;t=f??(typeof c!=\"object\"||c===null)?c:Object.assign({},t,c),n.forEach(h=>h(t,p))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>u,subscribe:l=>(n.add(l),()=>n.delete(l))},u=t=e(r,i,o);return o},_a=(e=>e?qn(e):qn);function Ur(e,t){for(var n in t)e[n]=t[n];return e}function Yt(e,t){for(var n in e)if(n!==\"__source\"&&!(n in t))return!0;for(var r in t)if(r!==\"__source\"&&e[r]!==t[r])return!0;return!1}function qr(e,t){var n=t(),r=Y({t:{__:n,u:t}}),i=r[0].t,a=r[1];return ue(function(){i.__=n,i.u=t,Rt(i)&&a({t:i})},[e,n,t]),be(function(){return Rt(i)&&a({t:i}),e(function(){Rt(i)&&a({t:i})})},[e]),n}function Rt(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function Wr(e){e()}function jr(e){return e}function Qr(){return[!1,Wr]}var Kr=ue;function Zt(e,t){this.props=e,this.context=t}function ya(e,t){function n(i){var a=this.props.ref,s=a==i.ref;return!s&&a&&(a.call?a(null):a.current=null),t?!t(this.props,i)||!s:Yt(this.props,i)}function r(i){return this.shouldComponentUpdate=n,pe(e,i)}return r.displayName=\"Memo(\"+(e.displayName||e.name)+\")\",r.prototype.isReactComponent=!0,r.__f=!0,r.type=e,r}(Zt.prototype=new ye).isPureReactComponent=!0,Zt.prototype.shouldComponentUpdate=function(e,t){return Yt(this.props,e)||Yt(this.state,t)};var Wn=F.__b;F.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Wn&&Wn(e)};var ba=typeof Symbol<\"u\"&&Symbol.for&&Symbol.for(\"react.forward_ref\")||3911;function xa(e){function t(n){var r=Ur({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=ba,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=\"ForwardRef(\"+(e.displayName||e.name)+\")\",t}var jn=function(e,t){return e==null?null:ve(ve(e).map(t))},va={map:jn,forEach:jn,count:function(e){return e?ve(e).length:0},only:function(e){var t=ve(e);if(t.length!==1)throw\"Children.only\";return t[0]},toArray:ve},wa=F.__e;F.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}wa(e,t,n,r)};var Qn=F.unmount;function Gr(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c==\"function\"&&r.__c()}),e.__c.__H=null),(e=Ur({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Gr(r,t,n)})),e}function Yr(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Yr(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function gt(){this.__u=0,this.o=null,this.__b=null}function Zr(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ka(e){var t,n,r,i=null;function a(s){if(t||(t=e()).then(function(o){o&&(i=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw t;return i?pe(i,s):null}return a.displayName=\"Lazy\",a.__f=!0,a}function Ge(){this.i=null,this.l=null}F.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Qn&&Qn(e)},(gt.prototype=new ye).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var i=Zr(r.__v),a=!1,s=function(){a||r.__z||(a=!0,n.__R=null,i?i(u):u())};n.__R=s;var o=n.__P;n.__P=null;var u=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Yr(l,l.__c.__P,l.__c.__O)}var f;for(r.setState({__a:r.__b=null});f=r.o.pop();)f.__P=o,f.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},gt.prototype.componentWillUnmount=function(){this.o=[]},gt.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(\"div\"),r=this.__v.__k[0].__c;this.__v.__k[0]=Gr(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&pe(Q,null,e.fallback);return i&&(i.__u&=-33),[pe(Q,null,t.__a?null:e.children),i]};var Kn=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==\"t\"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Sa(e){return this.getChildContext=function(){return e.context},e.children}function Ca(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){Be(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(i,a){this.childNodes.push(i),t.h.insertBefore(i,a)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),t.h.removeChild(i)}}}Be(pe(Sa,{context:t.context},e.__v),t.v)}function Ia(e,t){var n=pe(Ca,{__v:e,h:t});return n.containerInfo=t,n}(Ge.prototype=new ye).__a=function(e){var t=this,n=Zr(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Kn(t,e,r)):i()};n?n(a):a()}},Ge.prototype.render=function(e){this.i=null,this.l=new Map;var t=ve(e.children);e.revealOrder&&e.revealOrder[0]===\"b\"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ge.prototype.componentDidUpdate=Ge.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Kn(e,n,t)})};var Jr=typeof Symbol<\"u\"&&Symbol.for&&Symbol.for(\"react.element\")||60103,Aa=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ea=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ta=/[A-Z0-9]/g,Pa=typeof document<\"u\",Na=function(e){return(typeof Symbol<\"u\"&&typeof Symbol()==\"symbol\"?/fil|che|rad/:/fil|che|ra/).test(e)};function Da(e,t,n){return t.__k==null&&(t.textContent=\"\"),Be(e,t),typeof n==\"function\"&&n(),e?e.__c:null}function $a(e,t,n){return Rr(e,t),typeof n==\"function\"&&n(),e?e.__c:null}ye.prototype.isReactComponent={},[\"componentWillMount\",\"componentWillReceiveProps\",\"componentWillUpdate\"].forEach(function(e){Object.defineProperty(ye.prototype,e,{configurable:!0,get:function(){return this[\"UNSAFE_\"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Gn=F.event;function za(){}function Fa(){return this.cancelBubble}function Oa(){return this.defaultPrevented}F.event=function(e){return Gn&&(e=Gn(e)),e.persist=za,e.isPropagationStopped=Fa,e.isDefaultPrevented=Oa,e.nativeEvent=e};var bn,Ra={enumerable:!1,configurable:!0,get:function(){return this.class}},Yn=F.vnode;F.vnode=function(e){typeof e.type==\"string\"&&(function(t){var n=t.props,r=t.type,i={},a=r.indexOf(\"-\")===-1;for(var s in n){var o=n[s];if(!(s===\"value\"&&\"defaultValue\"in n&&o==null||Pa&&s===\"children\"&&r===\"noscript\"||s===\"class\"||s===\"className\")){var u=s.toLowerCase();s===\"defaultValue\"&&\"value\"in n&&n.value==null?s=\"value\":s===\"download\"&&o===!0?o=\"\":u===\"translate\"&&o===\"no\"?o=!1:u[0]===\"o\"&&u[1]===\"n\"?u===\"ondoubleclick\"?s=\"ondblclick\":u!==\"onchange\"||r!==\"input\"&&r!==\"textarea\"||Na(n.type)?u===\"onfocus\"?s=\"onfocusin\":u===\"onblur\"?s=\"onfocusout\":Ea.test(s)&&(s=u):u=s=\"oninput\":a&&Aa.test(s)?s=s.replace(Ta,\"-$&\").toLowerCase():o===null&&(o=void 0),u===\"oninput\"&&i[s=u]&&(s=\"oninputCapture\"),i[s]=o}}r==\"select\"&&i.multiple&&Array.isArray(i.value)&&(i.value=ve(n.children).forEach(function(l){l.props.selected=i.value.indexOf(l.props.value)!=-1})),r==\"select\"&&i.defaultValue!=null&&(i.value=ve(n.children).forEach(function(l){l.props.selected=i.multiple?i.defaultValue.indexOf(l.props.value)!=-1:i.defaultValue==l.props.value})),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,\"className\",Ra)):n.className&&(i.class=i.className=n.className),t.props=i})(e),e.$$typeof=Jr,Yn&&Yn(e)};var Zn=F.__r;F.__r=function(e){Zn&&Zn(e),bn=e.__c};var Jn=F.diffed;F.diffed=function(e){Jn&&Jn(e);var t=e.props,n=e.__e;n!=null&&e.type===\"textarea\"&&\"value\"in t&&t.value!==n.value&&(n.value=t.value==null?\"\":t.value),bn=null};var La={ReactCurrentDispatcher:{current:{readContext:function(e){return bn.__n[e.__c].props.value},useCallback:It,useContext:we,useDebugValue:Br,useDeferredValue:jr,useEffect:be,useId:Vr,useImperativeHandle:Mr,useInsertionEffect:Kr,useLayoutEffect:ue,useMemo:qe,useReducer:_n,useRef:Je,useState:Y,useSyncExternalStore:qr,useTransition:Qr}}};function Ma(e){return pe.bind(null,e)}function At(e){return!!e&&e.$$typeof===Jr}function Ba(e){return At(e)&&e.type===Q}function Va(e){return!!e&&typeof e.displayName==\"string\"&&e.displayName.startsWith(\"Memo(\")}function Ha(e){return At(e)?pa.apply(null,arguments):e}function Ua(e){return!!e.__k&&(Be(null,e),!0)}function qa(e){return e&&(e.base||e.nodeType===1&&e)||null}var Wa=function(e,t){return e(t)},ja=function(e,t){return e(t)},Qa=Q,Ka=At,ct={useState:Y,useId:Vr,useReducer:_n,useEffect:be,useLayoutEffect:ue,useInsertionEffect:Kr,useTransition:Qr,useDeferredValue:jr,useSyncExternalStore:qr,startTransition:Wr,useRef:Je,useImperativeHandle:Mr,useMemo:qe,useCallback:It,useContext:we,useDebugValue:Br,version:\"18.3.1\",Children:va,render:Da,hydrate:$a,unmountComponentAtNode:Ua,createPortal:Ia,createElement:pe,createContext:gn,createFactory:Ma,cloneElement:Ha,createRef:oa,Fragment:Q,isValidElement:At,isElement:Ka,isFragment:Ba,isMemo:Va,findDOMNode:qa,Component:ye,PureComponent:Zt,memo:ya,forwardRef:xa,flushSync:ja,unstable_batchedUpdates:Wa,StrictMode:Qa,Suspense:gt,SuspenseList:Ge,lazy:ka,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:La};const Ga=e=>e;function Ya(e,t=Ga){const n=ct.useSyncExternalStore(e.subscribe,ct.useCallback(()=>t(e.getState()),[e,t]),ct.useCallback(()=>t(e.getInitialState()),[e,t]));return ct.useDebugValue(n),n}const Za=e=>{const t=_a(e),n=r=>Ya(t,r);return Object.assign(n,t),n},Ja=(e=>Za);var Xr=Symbol.for(\"immer-nothing\"),Xn=Symbol.for(\"immer-draftable\"),se=Symbol.for(\"immer-state\");function he(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Xe=Object.getPrototypeOf;function He(e){return!!e&&!!e[se]}function De(e){return e?ei(e)||Array.isArray(e)||!!e[Xn]||!!e.constructor?.[Xn]||st(e)||Tt(e):!1}var Xa=Object.prototype.constructor.toString(),er=new WeakMap;function ei(e){if(!e||typeof e!=\"object\")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,\"constructor\")&&t.constructor;if(n===Object)return!0;if(typeof n!=\"function\")return!1;let r=er.get(n);return r===void 0&&(r=Function.toString.call(n),er.set(n,r)),r===Xa}function vt(e,t,n=!0){Et(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Et(e){const t=e[se];return t?t.type_:Array.isArray(e)?1:st(e)?2:Tt(e)?3:0}function Jt(e,t){return Et(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ti(e,t,n){const r=Et(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function es(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function st(e){return e instanceof Map}function Tt(e){return e instanceof Set}function Pe(e){return e.copy_||e.base_}function Xt(e,t){if(st(e))return new Map(e);if(Tt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=ei(e);if(t===!0||t===\"class_only\"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[se];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const s=i[a],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(Xe(e),r)}else{const r=Xe(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function xn(e,t=!1){return Pt(e)||He(e)||!De(e)||(Et(e)>1&&Object.defineProperties(e,{set:ft,add:ft,clear:ft,delete:ft}),Object.freeze(e),t&&Object.values(e).forEach(n=>xn(n,!0))),e}function ts(){he(2)}var ft={value:ts};function Pt(e){return e===null||typeof e!=\"object\"?!0:Object.isFrozen(e)}var ns={};function $e(e){const t=ns[e];return t||he(0,e),t}var et;function ni(){return et}function rs(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function tr(e,t){t&&($e(\"Patches\"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function en(e){tn(e),e.drafts_.forEach(is),e.drafts_=null}function tn(e){e===et&&(et=e.parent_)}function nr(e){return et=rs(et,e)}function is(e){const t=e[se];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function rr(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[se].modified_&&(en(t),he(4)),De(e)&&(e=wt(t,e),t.parent_||kt(t,e)),t.patches_&&$e(\"Patches\").generateReplacementPatches_(n[se].base_,e,t.patches_,t.inversePatches_)):e=wt(t,n,[]),en(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Xr?e:void 0}function wt(e,t,n){if(Pt(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[se];if(!i)return vt(t,(a,s)=>ir(e,i,t,a,s,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return kt(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let s=a,o=!1;i.type_===3&&(s=new Set(a),a.clear(),o=!0),vt(s,(u,l)=>ir(e,i,a,u,l,n,o),r),kt(e,a,!1),n&&e.patches_&&$e(\"Patches\").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function ir(e,t,n,r,i,a,s){if(i==null||typeof i!=\"object\"&&!s)return;const o=Pt(i);if(!(o&&!s)){if(He(i)){const u=a&&t&&t.type_!==3&&!Jt(t.assigned_,r)?a.concat(r):void 0,l=wt(e,i,u);if(ti(n,r,l),He(l))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(De(i)&&!o){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&o)return;wt(e,i),(!t||!t.scope_.parent_)&&typeof r!=\"symbol\"&&(st(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&kt(e,i)}}}function kt(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&xn(t,n)}function as(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ni(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=vn;n&&(i=[r],a=tt);const{revoke:s,proxy:o}=Proxy.revocable(i,a);return r.draft_=o,r.revoke_=s,o}var vn={get(e,t){if(t===se)return e;const n=Pe(e);if(!Jt(n,t))return ss(e,n,t);const r=n[t];return e.finalized_||!De(r)?r:r===Lt(e.base_,t)?(Mt(e),e.copy_[t]=rn(r,e)):r},has(e,t){return t in Pe(e)},ownKeys(e){return Reflect.ownKeys(Pe(e))},set(e,t,n){const r=ri(Pe(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Lt(Pe(e),t),a=i?.[se];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(es(n,i)&&(n!==void 0||Jt(e.base_,t)))return!0;Mt(e),nn(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Lt(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Mt(e),nn(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Pe(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==\"length\",enumerable:r.enumerable,value:n[t]}},defineProperty(){he(11)},getPrototypeOf(e){return Xe(e.base_)},setPrototypeOf(){he(12)}},tt={};vt(vn,(e,t)=>{tt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});tt.deleteProperty=function(e,t){return tt.set.call(this,e,t,void 0)};tt.set=function(e,t,n){return vn.set.call(this,e[0],t,n,e[0])};function Lt(e,t){const n=e[se];return(n?Pe(n):e)[t]}function ss(e,t,n){const r=ri(t,n);return r?\"value\"in r?r.value:r.get?.call(e.draft_):void 0}function ri(e,t){if(!(t in e))return;let n=Xe(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Xe(n)}}function nn(e){e.modified_||(e.modified_=!0,e.parent_&&nn(e.parent_))}function Mt(e){e.copy_||(e.copy_=Xt(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var os=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t==\"function\"&&typeof n!=\"function\"){const a=n;n=t;const s=this;return function(u=a,...l){return s.produce(u,f=>n.call(this,f,...l))}}typeof n!=\"function\"&&he(6),r!==void 0&&typeof r!=\"function\"&&he(7);let i;if(De(t)){const a=nr(this),s=rn(t,void 0);let o=!0;try{i=n(s),o=!1}finally{o?en(a):tn(a)}return tr(a,r),rr(i,a)}else if(!t||typeof t!=\"object\"){if(i=n(t),i===void 0&&(i=t),i===Xr&&(i=void 0),this.autoFreeze_&&xn(i,!0),r){const a=[],s=[];$e(\"Patches\").generateReplacementPatches_(t,i,a,s),r(a,s)}return i}else he(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t==\"function\")return(s,...o)=>this.produceWithPatches(s,u=>t(u,...o));let r,i;return[this.produce(t,n,(s,o)=>{r=s,i=o}),r,i]},typeof e?.autoFreeze==\"boolean\"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==\"boolean\"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration==\"boolean\"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){De(e)||he(8),He(e)&&(e=ls(e));const t=nr(this),n=rn(e,void 0);return n[se].isManual_=!0,tn(t),n}finishDraft(e,t){const n=e&&e[se];(!n||!n.isManual_)&&he(9);const{scope_:r}=n;return tr(r,t),rr(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op===\"replace\"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=$e(\"Patches\").applyPatches_;return He(e)?r(e,t):this.produce(e,i=>r(i,t))}};function rn(e,t){const n=st(e)?$e(\"MapSet\").proxyMap_(e,t):Tt(e)?$e(\"MapSet\").proxySet_(e,t):as(e,t);return(t?t.scope_:ni()).drafts_.push(n),n}function ls(e){return He(e)||he(10,e),ii(e)}function ii(e){if(!De(e)||Pt(e))return e;const t=e[se];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Xt(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Xt(e,!0);return vt(n,(i,a)=>{ti(n,i,ii(a))},r),t&&(t.finalized_=!1),n}var us=new os,cs=us.produce;const fs=e=>(t,n,r)=>(r.setState=(i,a,...s)=>{const o=typeof i==\"function\"?cs(i):i;return t(o,a,...s)},e(r.setState,n,r)),hs=fs,ps=new Set([\"a\",\"article\",\"aside\",\"b\",\"blockquote\",\"br\",\"caption\",\"code\",\"col\",\"colgroup\",\"dd\",\"del\",\"details\",\"dfn\",\"div\",\"dl\",\"dt\",\"em\",\"figcaption\",\"figure\",\"footer\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"header\",\"hr\",\"i\",\"img\",\"ins\",\"kbd\",\"li\",\"main\",\"mark\",\"nav\",\"ol\",\"p\",\"pre\",\"q\",\"s\",\"samp\",\"section\",\"small\",\"span\",\"strong\",\"sub\",\"summary\",\"sup\",\"table\",\"tbody\",\"td\",\"tfoot\",\"th\",\"thead\",\"tr\",\"u\",\"ul\",\"wbr\"]),ds=new Set([\"br\",\"col\",\"hr\",\"img\",\"wbr\"]);function ms(e){const t=e.indexOf(\"|\");if(t!==-1)return{display:e.slice(0,t).trim(),target:e.slice(t+1).trim()};const n=e.indexOf(\"->\");if(n!==-1)return{display:e.slice(0,n).trim(),target:e.slice(n+2).trim()};const r=e.indexOf(\"<-\");if(r!==-1)return{target:e.slice(0,r).trim(),display:e.slice(r+2).trim()};const i=e.trim();return{display:i,target:i}}function ar(e){const t=e.trim(),n=t.startsWith(\"/\"),r=n?t.slice(1):t,i=r.search(/\\s/);return i===-1?{name:r,rawArgs:\"\",isClose:n}:{name:r.slice(0,i),rawArgs:r.slice(i+1).trim(),isClose:n}}function sr(e,t){const n=[];let r=\"\",i=t;for(;i<e.length&&(e[i]===\".\"||e[i]===\"#\");){const a=e[i];i++;const s=i;for(;i<e.length&&/[a-zA-Z0-9_-]/.test(e[i]);)i++;if(i>s){const o=e.slice(s,i);a===\".\"?n.push(o):r=o}}return{className:n.join(\" \"),id:r,endIdx:i}}function gs(e,t){const n={};for(;t<e.length;){for(;t<e.length&&/\\s/.test(e[t]);)t++;if(t>=e.length||e[t]===\">\"||e[t]===\"/\"&&e[t+1]===\">\")break;const r=t;for(;t<e.length&&/[a-zA-Z0-9_-]/.test(e[t]);)t++;const i=e.slice(r,t);if(!i)break;if(e[t]===\"=\")if(t++,e[t]==='\"'||e[t]===\"'\"){const a=e[t];t++;const s=t;for(;t<e.length&&e[t]!==a;)t++;n[i]=e.slice(s,t),t<e.length&&t++}else{const a=t;for(;t<e.length&&/[^\\s>]/.test(e[t]);)t++;n[i]=e.slice(a,t)}else n[i]=\"\"}return{attributes:n,endIdx:t}}function ot(e){const t=[];let n=0,r=0;function i(a){a>r&&t.push({type:\"text\",value:e.slice(r,a),start:r,end:a})}for(;n<e.length;){if(e[n]===\"[\"&&e[n+1]===\"[\"){i(n);const a=n;n+=2;let s,o;if(e[n]===\".\"||e[n]===\"#\"){const _=sr(e,n);s=_.className||void 0,o=_.id||void 0,n=_.endIdx,e[n]===\" \"&&n++}let u=1;const l=n;for(;n<e.length&&u>0;)if(e[n]===\"[\"&&e[n+1]===\"[\")u++,n+=2;else if(e[n]===\"]\"&&e[n+1]===\"]\"){if(u--,u===0)break;n+=2}else n++;if(u!==0){n=a+2,r=a;continue}const f=e.slice(l,n);n+=2;const{display:c,target:p}=ms(f),h={type:\"link\",display:c,target:p,start:a,end:n};s&&(h.className=s),o&&(h.id=o),t.push(h),r=n;continue}if(e[n]===\"{\"){const a=n;let s=e[n+1],o,u;if(s===\".\"||s===\"#\"){i(n);const l=sr(e,n+1);o=l.className||void 0,u=l.id||void 0;let f=l.endIdx;e[f]===\" \"&&f++;const c=e[f];if(c===\"$\"){n=f+1;const p=n;for(;n<e.length&&/[\\w.]/.test(e[n]);)n++;const h=e.slice(p,n);if(e[n]===\"}\"){n++;const _={type:\"variable\",name:h,scope:\"variable\",start:a,end:n};o&&(_.className=o),u&&(_.id=u),t.push(_),r=n;continue}n=a+1,r=a;continue}if(c===\"_\"){n=f+1;const p=n;for(;n<e.length&&/[\\w.]/.test(e[n]);)n++;const h=e.slice(p,n);if(e[n]===\"}\"){n++;const _={type:\"variable\",name:h,scope:\"temporary\",start:a,end:n};o&&(_.className=o),u&&(_.id=u),t.push(_),r=n;continue}n=a+1,r=a;continue}if(c!==void 0&&/[a-zA-Z]/.test(c)){n=f;let p=1;const h=n;for(;n<e.length&&p>0;)e[n]===\"{\"?p++:e[n]===\"}\"&&p--,p>0&&n++;if(p!==0){n=a+1,r=a;continue}const _=e.slice(h,n);n++;const{name:w,rawArgs:I,isClose:b}=ar(_),v={type:\"macro\",name:w,rawArgs:I,isClose:b,start:a,end:n};o&&(v.className=o),u&&(v.id=u),t.push(v),r=n;continue}n=a+1,r=a;continue}if(s===\"$\"){i(n),n+=2;const l=n;for(;n<e.length&&/[\\w.]/.test(e[n]);)n++;const f=e.slice(l,n);if(e[n]===\"}\"){n++,t.push({type:\"variable\",name:f,scope:\"variable\",start:a,end:n}),r=n;continue}n=a+1,r=a;continue}if(s===\"_\"){i(n),n+=2;const l=n;for(;n<e.length&&/[\\w.]/.test(e[n]);)n++;const f=e.slice(l,n);if(e[n]===\"}\"){n++,t.push({type:\"variable\",name:f,scope:\"temporary\",start:a,end:n}),r=n;continue}n=a+1,r=a;continue}if(s!==void 0&&(s===\"/\"||/[a-zA-Z]/.test(s))){i(n),n++;let l=1;const f=n;for(;n<e.length&&l>0;)e[n]===\"{\"?l++:e[n]===\"}\"&&l--,l>0&&n++;if(l!==0){n=a+1,r=a;continue}const c=e.slice(f,n);n++;const{name:p,rawArgs:h,isClose:_}=ar(c);t.push({type:\"macro\",name:p,rawArgs:h,isClose:_,start:a,end:n}),r=n;continue}n++;continue}if(e[n]===\"<\"){const a=n;let s=n+1;const o=e[s]===\"/\";o&&s++;const u=s;for(;s<e.length&&/[a-zA-Z0-9]/.test(e[s]);)s++;const l=e.slice(u,s).toLowerCase();if(l&&ps.has(l))if(o){for(;s<e.length&&/\\s/.test(e[s]);)s++;if(e[s]===\">\"){s++,i(a),t.push({type:\"html\",tag:l,attributes:{},isClose:!0,isSelfClose:!1,start:a,end:s}),r=s,n=s;continue}}else{const f=gs(e,s);s=f.endIdx;let c=ds.has(l);if(e[s]===\"/\"&&(c=!0,s++),e[s]===\">\"){s++,i(a),t.push({type:\"html\",tag:l,attributes:f.attributes,isClose:!1,isSelfClose:c,start:a,end:s}),r=s,n=s;continue}}n++;continue}n++}return i(e.length),t}const _s=new Set([\"if\",\"for\",\"do\",\"button\",\"link\",\"listbox\",\"cycle\",\"switch\",\"timed\",\"repeat\",\"type\",\"widget\"]),or={elseif:\"if\",else:\"if\",case:\"switch\",default:\"switch\",next:\"timed\"},ys=new Set([\"if\",\"switch\",\"timed\"]);function lt(e){const t=[],n=[];function r(){if(n.length===0)return t;const i=n[n.length-1].node;return i.type===\"macro\"&&i.branches&&i.branches.length>0?i.branches[i.branches.length-1].children:i.children}for(const i of e)switch(i.type){case\"text\":r().push({type:\"text\",value:i.value});break;case\"link\":{const a={type:\"link\",display:i.display,target:i.target};i.className&&(a.className=i.className),i.id&&(a.id=i.id),r().push(a);break}case\"variable\":{const a={type:\"variable\",name:i.name,scope:i.scope};i.className&&(a.className=i.className),i.id&&(a.id=i.id),r().push(a);break}case\"html\":{if(i.isSelfClose){r().push({type:\"html\",tag:i.tag,attributes:i.attributes,children:[]});break}if(i.isClose){if(n.length===0)throw new Error(`Unexpected closing </${i.tag}> (at character ${i.start})`);const s=n[n.length-1];if(s.node.type!==\"html\"||s.node.tag!==i.tag){const o=s.node.type===\"html\"?`</${s.node.tag}>`:`{/${s.node.name}}`;throw new Error(`Expected ${o} but found </${i.tag}> (at character ${i.start})`)}n.pop(),r().push(s.node);break}const a={type:\"html\",tag:i.tag,attributes:i.attributes,children:[]};n.push({node:a,start:i.start});break}case\"macro\":{if(i.isClose){if(n.length===0)throw new Error(`Unexpected closing {/${i.name}} (at character ${i.start})`);const a=n[n.length-1];if(a.node.type!==\"macro\"||a.node.name!==i.name){const s=a.node.type===\"macro\"?`{/${a.node.name}}`:`</${a.node.tag}>`;throw new Error(`Expected ${s} but found {/${i.name}} (at character ${i.start})`)}n.pop(),r().push(a.node);break}if(or[i.name]){const a=or[i.name],s=n.length>0?n[n.length-1].node:null;if(!s||s.type!==\"macro\"||s.name!==a)throw new Error(`{${i.name}} without matching {${a}} (at character ${i.start})`);const o={rawArgs:i.rawArgs,children:[]};i.className&&(o.className=i.className),i.id&&(o.id=i.id),s.branches.push(o);break}if(_s.has(i.name)){const a={type:\"macro\",name:i.name,rawArgs:i.rawArgs,children:[]};if(ys.has(i.name)){const s={rawArgs:i.rawArgs,children:[]};i.className&&(s.className=i.className),i.id&&(s.id=i.id),a.branches=[s]}else i.className&&(a.className=i.className),i.id&&(a.id=i.id);n.push({node:a,start:i.start});break}{const a={type:\"macro\",name:i.name,rawArgs:i.rawArgs,children:[]};i.className&&(a.className=i.className),i.id&&(a.id=i.id),r().push(a)}break}}if(n.length>0){const i=n[n.length-1],a=i.node.type===\"html\"?`<${i.node.tag}>`:`{${i.node.name}} macro`;throw new Error(`Unclosed ${a} (opened at character ${i.start})`)}return t}const lr=new Map;function ai(e){return e.replace(/\\$(\\w+)/g,'variables[\"$1\"]').replace(/\\b_(\\w+)/g,'temporary[\"$1\"]')}const bs=\"const {visited,hasVisited,hasVisitedAny,hasVisitedAll,rendered,hasRendered,hasRenderedAny,hasRenderedAll}=__fns;\";function si(e,t){let n=lr.get(e);return n||(n=new Function(\"variables\",\"temporary\",\"__fns\",bs+t),lr.set(e,n)),n}function oi(){const e=C.getState(),{visitCounts:t,renderCounts:n}=e,r=c=>t[c]??0,i=c=>r(c)>0,a=(...c)=>c.some(p=>r(p)>0),s=(...c)=>c.every(p=>r(p)>0),o=c=>n[c]??0;return{visited:r,hasVisited:i,hasVisitedAny:a,hasVisitedAll:s,rendered:o,hasRendered:c=>o(c)>0,hasRenderedAny:(...c)=>c.some(p=>o(p)>0),hasRenderedAll:(...c)=>c.every(p=>o(p)>0)}}function Ce(e,t,n){const i=`return (${ai(e)});`;return si(i,i)(t,n,oi())}function ze(e,t,n){const r=ai(e);si(\"exec:\"+r,r)(t,n,oi())}const xs=\"spindle\",vs=1;let ht=null,Bt=null;function Ie(){return Bt||(Bt={saves:new Map,playthroughs:new Map,meta:new Map}),Bt}function ws(){return ht||(typeof indexedDB>\"u\"?Promise.reject(new Error(\"IndexedDB unavailable\")):(ht=new Promise((e,t)=>{const n=indexedDB.open(xs,vs);n.onupgradeneeded=()=>{const r=n.result;if(!r.objectStoreNames.contains(\"saves\")){const i=r.createObjectStore(\"saves\",{keyPath:\"meta.id\"});i.createIndex(\"ifid\",\"meta.ifid\",{unique:!1}),i.createIndex(\"playthroughId\",\"meta.playthroughId\",{unique:!1})}r.objectStoreNames.contains(\"playthroughs\")||r.createObjectStore(\"playthroughs\",{keyPath:\"id\"}).createIndex(\"ifid\",\"ifid\",{unique:!1}),r.objectStoreNames.contains(\"meta\")||r.createObjectStore(\"meta\",{keyPath:\"key\"})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}),ht))}function Ae(e,t){return ws().then(n=>n.transaction(e,t).objectStore(e))}function Ee(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}async function Nt(e){try{const t=await Ae(\"saves\",\"readwrite\");await Ee(t.put(e))}catch{Ie().saves.set(e.meta.id,e)}}async function Dt(e){try{const t=await Ae(\"saves\",\"readonly\");return await Ee(t.get(e))??void 0}catch{return Ie().saves.get(e)}}async function ks(e){try{const t=await Ae(\"saves\",\"readwrite\");await Ee(t.delete(e))}catch{Ie().saves.delete(e)}}async function Ss(e){try{const n=(await Ae(\"saves\",\"readonly\")).index(\"ifid\");return await Ee(n.getAll(e))??[]}catch{return[...Ie().saves.values()].filter(t=>t.meta.ifid===e)}}async function li(e){try{const t=await Ae(\"playthroughs\",\"readwrite\");await Ee(t.put(e))}catch{Ie().playthroughs.set(e.id,e)}}async function wn(e){try{const n=(await Ae(\"playthroughs\",\"readonly\")).index(\"ifid\");return await Ee(n.getAll(e))??[]}catch{return[...Ie().playthroughs.values()].filter(t=>t.ifid===e)}}async function kn(e){try{const t=await Ae(\"meta\",\"readonly\"),n=await Ee(t.get(e));return n?n.value:void 0}catch{return Ie().meta.get(e)}}async function ui(e,t){try{const n=await Ae(\"meta\",\"readwrite\");await Ee(n.put({key:e,value:t}))}catch{Ie().meta.set(e,t)}}let an=null,sn=null,ur=!1;function Cs(e){an=e}function Is(e){sn=e}function As(e){if(sn)try{const i=new Function(\"passage\",\"variables\",sn)(e.passage,e.variables);if(typeof i==\"string\"&&i.trim())return i.trim()}catch{}if(an)try{const r=an(e);if(typeof r==\"string\"&&r.trim())return r.trim()}catch{}const n=new Date().toLocaleTimeString(void 0,{hour:\"2-digit\",minute:\"2-digit\"});return`${e.passage} - ${n}`}async function Es(){ur||(ur=!0)}async function cr(e){const n=(await wn(e)).length+1,r=crypto.randomUUID(),i={id:r,ifid:e,createdAt:new Date().toISOString(),label:`Playthrough ${n}`};return await li(i),await ui(`currentPlaythroughId.${e}`,r),r}async function Ts(e){return kn(`currentPlaythroughId.${e}`)}async function ci(e,t,n,r={}){const i=new Date().toISOString(),s={meta:{id:crypto.randomUUID(),ifid:e,playthroughId:t,createdAt:i,updatedAt:i,title:As(n),passage:n.passage,custom:r},payload:structuredClone(n)};return await Nt(s),s}async function fi(e,t){const n=await Dt(e);if(n)return n.meta.updatedAt=new Date().toISOString(),n.meta.passage=t.passage,n.payload=structuredClone(t),await Nt(n),n}async function Ps(e){return(await Dt(e))?.payload}async function Ns(e){await ks(e)}async function Ds(e,t){const n=await Dt(e);n&&(n.meta.title=t,n.meta.updatedAt=new Date().toISOString(),await Nt(n))}async function $s(e){const[t,n]=await Promise.all([Ss(e),wn(e)]),r=new Map;for(const o of n)r.set(o.id,o);const i=new Map;for(const o of t){const u=o.meta.playthroughId;i.has(u)||i.set(u,[]),i.get(u).push(o)}for(const o of i.values())o.sort((u,l)=>new Date(l.meta.updatedAt).getTime()-new Date(u.meta.updatedAt).getTime());const a=[],s=[...r.values()].sort((o,u)=>new Date(u.createdAt).getTime()-new Date(o.createdAt).getTime());for(const o of s){const u=i.get(o.id)??[];a.push({playthrough:o,saves:u})}for(const[o,u]of i)r.has(o)||a.push({playthrough:{id:o,ifid:e,createdAt:u[0]?.meta.createdAt??new Date().toISOString(),label:\"Unknown Playthrough\"},saves:u});return a}const hi=\"autosave.\";async function zs(e,t,n){const r=`${hi}${e}`,i=await kn(r);if(i){const s=await fi(i,n);if(s)return s}const a=await ci(e,t,n,{isAutosave:!0});return await ui(r,a.meta.id),a}async function Fs(e){const t=`${hi}${e}`,n=await kn(t);if(n)return Ps(n)}async function Os(e){const t=await Dt(e);if(t)return{version:1,ifid:t.meta.ifid,exportedAt:new Date().toISOString(),save:t}}async function Rs(e,t){if(e.version!==1)throw new Error(`Unsupported save version: ${e.version}`);if(e.ifid!==t)throw new Error(`Save is from a different story (expected IFID ${t}, got ${e.ifid})`);const n=structuredClone(e.save);if(n.meta.id=crypto.randomUUID(),n.meta.updatedAt=new Date().toISOString(),!(await wn(t)).some(a=>a.id===n.meta.playthroughId)){const a={id:n.meta.playthroughId,ifid:t,createdAt:n.meta.createdAt,label:\"Imported\"};await li(a)}return await Nt(n),n}function Ls(e,t,n){for(const r of e)if(r.type===\"macro\"){if(r.name===\"set\")ze(r.rawArgs,t,n);else if(r.name===\"do\"){const i=r.children.map(a=>a.type===\"text\"?a.value:\"\").join(\"\");ze(i,t,n)}}}function pi(){const e=C.getState();if(!e.storyData)return;const t=e.storyData.passages.get(\"StoryInit\");if(!t)return;const n=ot(t.content),r=lt(n),i={...e.variables},a={...e.temporary};Ls(r,i,a);for(const o of Object.keys(i))i[o]!==e.variables[o]&&e.setVariable(o,i[o]);for(const o of Object.keys(a))a[o]!==e.temporary[o]&&e.setTemporary(o,a[o]);const s=e.storyData.passages.get(\"SaveTitle\");s&&Is(s.content)}const C=Ja()(hs((e,t)=>({storyData:null,currentPassage:\"\",variables:{},variableDefaults:{},temporary:{},history:[],historyIndex:-1,visitCounts:{},renderCounts:{},saveVersion:0,playthroughId:\"\",init:(n,r={})=>{const i=n.passagesById.get(n.startNode);if(!i)throw new Error(`spindle: Start passage (pid=${n.startNode}) not found.`);const a=structuredClone(r);e(o=>{o.storyData=n,o.currentPassage=i.name,o.variables=a,o.variableDefaults=r,o.temporary={},o.history=[{passage:i.name,variables:structuredClone(a),timestamp:Date.now()}],o.historyIndex=0,o.visitCounts={[i.name]:1},o.renderCounts={[i.name]:1}});const s=n.ifid;Es().then(async()=>{const o=await Ts(s);if(o)e(u=>{u.playthroughId=o});else{const u=await cr(s);e(l=>{l.playthroughId=u})}})},navigate:n=>{const{storyData:r}=t();if(r){if(!r.passages.has(n)){console.error(`spindle: Passage \"${n}\" not found.`);return}e(i=>{i.temporary={},i.currentPassage=n,i.history=i.history.slice(0,i.historyIndex+1),i.history.push({passage:n,variables:{...i.variables},timestamp:Date.now()}),i.historyIndex=i.history.length-1,i.visitCounts[n]=(i.visitCounts[n]??0)+1,i.renderCounts[n]=(i.renderCounts[n]??0)+1})}},goBack:()=>{e(n=>{if(n.historyIndex<=0)return;n.historyIndex--;const r=n.history[n.historyIndex];n.currentPassage=r.passage,n.variables={...r.variables},n.temporary={}})},goForward:()=>{e(n=>{if(n.historyIndex>=n.history.length-1)return;n.historyIndex++;const r=n.history[n.historyIndex];n.currentPassage=r.passage,n.variables={...r.variables},n.temporary={}})},setVariable:(n,r)=>{e(i=>{i.variables[n]=r})},setTemporary:(n,r)=>{e(i=>{i.temporary[n]=r})},deleteVariable:n=>{e(r=>{delete r.variables[n]})},deleteTemporary:n=>{e(r=>{delete r.temporary[n]})},trackRender:n=>{e(r=>{r.renderCounts[n]=(r.renderCounts[n]??0)+1})},restart:()=>{const{storyData:n,variableDefaults:r}=t();if(!n)return;const i=n.passagesById.get(n.startNode);if(!i)return;const a=structuredClone(r);e(s=>{s.currentPassage=i.name,s.variables=a,s.temporary={},s.history=[{passage:i.name,variables:structuredClone(a),timestamp:Date.now()}],s.historyIndex=0,s.visitCounts={[i.name]:1},s.renderCounts={[i.name]:1}}),pi(),cr(n.ifid).then(s=>{e(o=>{o.playthroughId=s})})},save:()=>{const{storyData:n,playthroughId:r,currentPassage:i,variables:a,history:s,historyIndex:o,visitCounts:u,renderCounts:l}=t();if(!n)return;const f={passage:i,variables:structuredClone(a),history:structuredClone(s),historyIndex:o,visitCounts:{...u},renderCounts:{...l}};zs(n.ifid,r,f).then(()=>{e(c=>{c.saveVersion++})})},load:()=>{const{storyData:n}=t();n&&Fs(n.ifid).then(r=>{r&&e(i=>{i.currentPassage=r.passage,i.variables=r.variables,i.history=r.history,i.historyIndex=r.historyIndex,i.visitCounts=r.visitCounts??{},i.renderCounts=r.renderCounts??{},i.temporary={}})})},hasSave:()=>{const{storyData:n,saveVersion:r}=t();return n?r>0:!1},getSavePayload:()=>{const{currentPassage:n,variables:r,history:i,historyIndex:a,visitCounts:s,renderCounts:o}=t();return{passage:n,variables:structuredClone(r),history:structuredClone(i),historyIndex:a,visitCounts:{...s},renderCounts:{...o}}},loadFromPayload:n=>{e(r=>{r.currentPassage=n.passage,r.variables=n.variables,r.history=n.history,r.historyIndex=n.historyIndex,r.visitCounts=n.visitCounts??{},r.renderCounts=n.renderCounts??{},r.temporary={}})}})));function Ms({target:e,className:t,id:n,children:r}){const i=C(o=>o.navigate),a=o=>{o.preventDefault(),i(e)},s=t?`passage-link ${t}`:\"passage-link\";return g(\"a\",{href:\"#\",id:n,class:s,onClick:a,children:r})}function Bs({name:e,scope:t,className:n,id:r}){const i=we(Fe),a=e.split(\".\"),s=a[0],o=C(c=>t===\"variable\"?c.variables[s]:c.temporary[s]),u=t===\"variable\"?`$${s}`:`_${s}`;let l=u in i?i[u]:o;for(let c=1;c<a.length;c++){if(l==null||typeof l!=\"object\"){l=void 0;break}l=l[a[c]]}const f=l==null?\"\":String(l);return n||r?g(\"span\",{id:r,class:n,children:f}):g(Q,{children:f})}function Vs({rawArgs:e}){return ue(()=>{const t=C.getState(),n=structuredClone(t.variables),r=structuredClone(t.temporary);try{ze(e,n,r)}catch(i){console.error(`spindle: Error in {set ${e}}:`,i);return}for(const i of Object.keys(n))n[i]!==t.variables[i]&&t.setVariable(i,n[i]);for(const i of Object.keys(r))r[i]!==t.temporary[i]&&t.setTemporary(i,r[i])},[]),null}function Hs({rawArgs:e,className:t,id:n}){const r=C(u=>u.variables),i=C(u=>u.temporary),a=we(Fe),s={...r},o={...i};for(const[u,l]of Object.entries(a))u.startsWith(\"$\")?s[u.slice(1)]=l:u.startsWith(\"_\")&&(o[u.slice(1)]=l);try{const u=Ce(e,s,o),l=u==null?\"\":String(u);return t||n?g(\"span\",{id:n,class:t,children:l}):g(Q,{children:l})}catch(u){return g(\"span\",{class:\"error\",title:String(u),children:`{print error: ${u.message}}`})}}function Us({branches:e}){const t=C(o=>o.variables),n=C(o=>o.temporary),r=we(Fe),i={...t},a={...n};for(const[o,u]of Object.entries(r))o.startsWith(\"$\")?i[o.slice(1)]=u:o.startsWith(\"_\")&&(a[o.slice(1)]=u);function s(o){const u=le(o.children);return o.className||o.id?g(\"span\",{id:o.id,class:o.className,children:u}):g(Q,{children:u})}for(const o of e){if(o.rawArgs===\"\")return s(o);try{if(Ce(o.rawArgs,i,a))return s(o)}catch(u){return g(\"span\",{class:\"error\",title:String(u),children:`{if error: ${u.message}}`})}}return null}function qs(e){const t=e.indexOf(\" of \");if(t===-1)throw new Error(`{for} requires \"of\" keyword: {for ${e}}`);const n=e.slice(0,t).trim(),r=e.slice(t+4).trim(),i=n.split(\",\").map(o=>o.trim()),a=i[0],s=i.length>1?i[1]:null;return{itemVar:a,indexVar:s,listExpr:r}}function Ws({rawArgs:e,children:t,className:n,id:r}){const i=C(w=>w.variables),a=C(w=>w.temporary),s=we(Fe),o={...i},u={...a};for(const[w,I]of Object.entries(s))w.startsWith(\"$\")?o[w.slice(1)]=I:w.startsWith(\"_\")&&(u[w.slice(1)]=I);let l;try{l=qs(e)}catch(w){return g(\"span\",{class:\"error\",title:String(w),children:`{for error: ${w.message}}`})}const{itemVar:f,indexVar:c,listExpr:p}=l;let h;try{const w=Ce(p,o,u);if(!Array.isArray(w))return g(\"span\",{class:\"error\",children:\"{for error: expression did not evaluate to an array}\"});h=w}catch(w){return g(\"span\",{class:\"error\",title:String(w),children:`{for error: ${w.message}}`})}const _=h.map((w,I)=>{const b={...s,[f]:w};return c&&(b[c]=I),g(Fe.Provider,{value:b,children:le(t)},I)});return n||r?g(\"span\",{id:r,class:n,children:_}):g(Q,{children:_})}function js(e){return e.map(t=>t.type===\"text\"?t.value:\"\").join(\"\")}function Qs({children:e}){const t=js(e);return ue(()=>{const n=C.getState(),r={...n.variables},i={...n.temporary};try{ze(t,r,i)}catch(a){console.error(\"spindle: Error in {do}:\",a);return}for(const a of Object.keys(r))r[a]!==n.variables[a]&&n.setVariable(a,r[a]);for(const a of Object.keys(i))i[a]!==n.temporary[a]&&n.setTemporary(a,i[a])},[]),null}function Ks({rawArgs:e,children:t,className:n,id:r}){const i=()=>{const s=C.getState(),o=structuredClone(s.variables),u=structuredClone(s.temporary);try{ze(e,o,u)}catch(l){console.error(`spindle: Error in {button ${e}}:`,l);return}for(const l of Object.keys(o))o[l]!==s.variables[l]&&s.setVariable(l,o[l]);for(const l of Object.keys(u))u[l]!==s.temporary[l]&&s.setTemporary(l,u[l])},a=n?`macro-button ${n}`:\"macro-button\";return g(\"button\",{id:r,class:a,onClick:i,children:Ni(t)})}function Gs({className:e,id:t}){const n=C(i=>i.storyData?.name||\"\"),r=e?`story-title ${e}`:\"story-title\";return g(\"span\",{id:t,class:r,children:n})}function Ys({className:e,id:t}){const n=C(a=>a.restart),r=e?`menubar-button ${e}`:\"menubar-button\";return g(\"button\",{id:t,class:r,onClick:()=>{confirm(\"Restart the story? All progress will be lost.\")&&n()},children:\"↺ Restart\"})}function Zs({className:e,id:t}){const n=C(a=>a.goBack),r=C(a=>a.historyIndex>0),i=e?`menubar-button ${e}`:\"menubar-button\";return g(\"button\",{id:t,class:i,onClick:n,disabled:!r,children:\"← Back\"})}function Js({className:e,id:t}){const n=C(a=>a.goForward),r=C(a=>a.historyIndex<a.history.length-1),i=e?`menubar-button ${e}`:\"menubar-button\";return g(\"button\",{id:t,class:i,onClick:n,disabled:!r,children:\"Forward →\"})}function Xs({className:e,id:t}){const n=C(i=>i.save),r=e?`menubar-button ${e}`:\"menubar-button\";return g(\"button\",{id:t,class:r,title:\"Quick Save (F6)\",onClick:()=>n(),children:\"QuickSave\"})}function eo({className:e,id:t}){const n=C(o=>o.load),r=C(o=>o.hasSave);C(o=>o.saveVersion);const i=e?`menubar-button ${e}`:\"menubar-button\",a=!r();return g(\"button\",{id:t,class:i,title:\"Quick Load (F9)\",disabled:a,onClick:()=>{confirm(\"Load saved game? Current progress will be lost.\")&&n()},children:\"QuickLoad\"})}const Qe=new Map;let oe={};function di(){return`spindle.${C.getState().storyData?.ifid||\"unknown\"}.settings`}function to(){localStorage.setItem(di(),JSON.stringify(oe))}function Vt(){try{const e=localStorage.getItem(di());e&&(oe={...oe,...JSON.parse(e)})}catch{}}const nt={addToggle(e,t){Qe.set(e,{type:\"toggle\",config:t}),e in oe||(oe[e]=t.default),Vt()},addList(e,t){Qe.set(e,{type:\"list\",config:t}),e in oe||(oe[e]=t.default),Vt()},addRange(e,t){Qe.set(e,{type:\"range\",config:t}),e in oe||(oe[e]=t.default),Vt()},get(e){return oe[e]},set(e,t){oe[e]=t,to()},getAll(){return{...oe}},getDefinitions(){return Qe},hasAny(){return Qe.size>0}};function no({name:e,def:t}){const[n,r]=Y(()=>nt.get(e)),i=a=>{r(a),nt.set(e,a)};switch(t.type){case\"toggle\":return g(\"label\",{class:\"settings-row\",children:[g(\"span\",{children:t.config.label}),g(\"input\",{type:\"checkbox\",checked:!!n,onChange:a=>i(a.target.checked)})]});case\"list\":return g(\"label\",{class:\"settings-row\",children:[g(\"span\",{children:t.config.label}),g(\"select\",{value:String(n),onChange:a=>i(a.target.value),children:t.config.options.map(a=>g(\"option\",{value:a,children:a},a))})]});case\"range\":return g(\"label\",{class:\"settings-row\",children:[g(\"span\",{children:[t.config.label,\": \",String(n)]}),g(\"input\",{type:\"range\",min:t.config.min,max:t.config.max,step:t.config.step,value:Number(n),onInput:a=>i(parseFloat(a.target.value))})]})}}function ro({onClose:e}){const t=nt.getDefinitions();return g(\"div\",{class:\"settings-overlay\",onClick:r=>{r.target.classList.contains(\"settings-overlay\")&&e()},children:g(\"div\",{class:\"settings-panel\",children:[g(\"div\",{class:\"settings-header\",children:[g(\"span\",{children:\"Settings\"}),g(\"button\",{class:\"settings-close\",onClick:e,children:\"✕\"})]}),g(\"div\",{class:\"settings-body\",children:Array.from(t.entries()).map(([r,i])=>g(no,{name:r,def:i},r))})]})})}function io({className:e,id:t}){const[n,r]=Y(!1);if(!nt.hasAny())return null;const i=e?`menubar-button ${e}`:\"menubar-button\";return g(Q,{children:[g(\"button\",{id:t,class:i,onClick:()=>r(!0),children:\"⚙ Settings\"}),n&&g(ro,{onClose:()=>r(!1)})]})}function ao(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<60)return\"just now\";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const a=Math.floor(i/24);return a<30?`${a}d ago`:new Date(e).toLocaleDateString()}function so(e){return new Date(e).toLocaleDateString(void 0,{month:\"short\",day:\"numeric\",year:\"numeric\"})}function oo({onClose:e}){const[t,n]=Y(\"load\"),[r,i]=Y([]),[a,s]=Y(!0),[o,u]=Y(null),[l,f]=Y(new Set),[c,p]=Y(null),[h,_]=Y(\"\"),w=Je(null),I=Je(null),b=C(A=>A.storyData),v=C(A=>A.playthroughId),S=C(A=>A.getSavePayload),z=C(A=>A.loadFromPayload),E=b?.ifid??\"\",x=It(async()=>{if(!E)return;const A=await $s(E);i(A),s(!1)},[E]);be(()=>{x()},[x]),be(()=>{c&&w.current&&(w.current.focus(),w.current.select())},[c]);const P=(A,q=\"success\")=>{u({text:A,type:q}),setTimeout(()=>u(null),3e3)},M=A=>{f(q=>{const d=new Set(q);return d.has(A)?d.delete(A):d.add(A),d})},L=async()=>{if(!(!E||!v))try{const A=S();await ci(E,v,A),P(\"Save created\"),await x()}catch{P(\"Failed to create save\",\"error\")}},y=async A=>{try{const q=S();await fi(A,q),P(\"Save overwritten\"),await x()}catch{P(\"Failed to overwrite save\",\"error\")}},T=async A=>{try{z(A.payload),P(\"Game loaded\"),setTimeout(e,500)}catch{P(\"Failed to load save\",\"error\")}},N=async A=>{if(confirm(\"Delete this save?\"))try{await Ns(A),P(\"Save deleted\"),await x()}catch{P(\"Failed to delete save\",\"error\")}},H=A=>{p(A.meta.id),_(A.meta.title)},U=async()=>{if(!(!c||!h.trim()))try{await Ds(c,h.trim()),p(null),P(\"Save renamed\"),await x()}catch{P(\"Failed to rename\",\"error\")}},R=A=>{A.key===\"Enter\"?U():A.key===\"Escape\"&&p(null)},G=async A=>{try{const q=await Os(A);if(!q)return;const d=new Blob([JSON.stringify(q,null,2)],{type:\"application/json\"}),V=URL.createObjectURL(d),te=document.createElement(\"a\");te.href=V,te.download=`save-${q.save.meta.title.replace(/[^a-z0-9]/gi,\"_\")}.json`,te.click(),URL.revokeObjectURL(V),P(\"Save exported\")}catch{P(\"Failed to export save\",\"error\")}},K=()=>{I.current?.click()},re=async A=>{const q=A.target,d=q.files?.[0];if(d){q.value=\"\";try{const V=await d.text(),te=JSON.parse(V);await Rs(te,E),P(\"Save imported\"),await x()}catch(V){P(V instanceof Error?V.message:\"Failed to import save\",\"error\")}}},ce=A=>{A.target.classList.contains(\"saves-overlay\")&&e()},m=r.reduce((A,q)=>A+q.saves.length,0);return g(\"div\",{class:\"saves-overlay\",onClick:ce,children:g(\"div\",{class:\"saves-panel\",children:[g(\"div\",{class:\"saves-header\",children:[g(\"div\",{class:\"saves-header-left\",children:g(\"div\",{class:\"saves-mode-toggle\",children:[g(\"button\",{class:t===\"save\"?\"active\":\"\",onClick:()=>n(\"save\"),children:\"Save\"}),g(\"button\",{class:t===\"load\"?\"active\":\"\",onClick:()=>n(\"load\"),children:\"Load\"})]})}),g(\"button\",{class:\"saves-close\",onClick:e,children:\"✕\"})]}),g(\"div\",{class:\"saves-toolbar\",children:[g(\"button\",{class:\"saves-toolbar-button\",onClick:K,children:\"Import\"}),g(\"input\",{ref:I,type:\"file\",accept:\".json\",style:\"display:none\",onChange:re})]}),g(\"div\",{class:\"saves-body\",children:[a?g(\"div\",{class:\"saves-empty\",children:\"Loading...\"}):m===0&&t===\"load\"?g(\"div\",{class:\"saves-empty\",children:\"No saves yet\"}):r.map(A=>{const q=l.has(A.playthrough.id),d=A.playthrough.id===v;return t===\"save\"&&!d||t===\"load\"&&A.saves.length===0&&!d?null:g(\"div\",{class:\"playthrough-group\",children:[g(\"div\",{class:\"playthrough-header\",onClick:()=>M(A.playthrough.id),children:[g(\"span\",{class:`playthrough-chevron ${q?\"\":\"open\"}`,children:\"▶\"}),g(\"span\",{class:\"playthrough-label\",children:[A.playthrough.label,d?\" (current)\":\"\"]}),g(\"span\",{class:\"playthrough-date\",children:so(A.playthrough.createdAt)})]}),!q&&g(\"div\",{class:\"playthrough-saves\",children:[A.saves.map(V=>g(\"div\",{class:\"save-slot\",children:[g(\"div\",{class:\"save-slot-info\",children:[c===V.meta.id?g(\"input\",{ref:w,class:\"save-rename-input\",value:h,onInput:te=>_(te.target.value),onKeyDown:R,onBlur:U}):g(\"div\",{class:\"save-slot-title\",children:V.meta.title}),g(\"div\",{class:\"save-slot-meta\",children:[g(\"span\",{children:V.meta.passage}),g(\"span\",{children:ao(V.meta.updatedAt)})]})]}),g(\"div\",{class:\"save-slot-actions\",children:[t===\"save\"?g(\"button\",{class:\"save-slot-action primary\",onClick:()=>y(V.meta.id),children:\"Save Here\"}):g(\"button\",{class:\"save-slot-action primary\",onClick:()=>T(V),children:\"Load\"}),g(\"button\",{class:\"save-slot-action\",onClick:()=>H(V),children:\"Rename\"}),g(\"button\",{class:\"save-slot-action\",onClick:()=>G(V.meta.id),children:\"Export\"}),g(\"button\",{class:\"save-slot-action danger\",onClick:()=>N(V.meta.id),children:\"Delete\"})]})]},V.meta.id)),t===\"save\"&&d&&g(\"button\",{class:\"save-slot-new\",onClick:L,children:\"+ New Save\"})]})]},A.playthrough.id)}),t===\"save\"&&!a&&!r.some(A=>A.playthrough.id===v)&&g(\"div\",{class:\"playthrough-group\",children:g(\"div\",{class:\"playthrough-saves\",children:g(\"button\",{class:\"save-slot-new\",onClick:L,children:\"+ New Save\"})})})]}),o&&g(\"div\",{class:`saves-status ${o.type===\"error\"?\"error\":\"\"}`,children:o.text})]})})}function lo({className:e,id:t}){const[n,r]=Y(!1),i=e?`menubar-button ${e}`:\"menubar-button\";return g(Q,{children:[g(\"button\",{id:t,class:i,onClick:()=>r(!0),children:\"Saves\"}),n&&g(oo,{onClose:()=>r(!1)})]})}function uo({rawArgs:e,className:t,id:n}){const r=C(c=>c.storyData),i=C(c=>c.variables),a=C(c=>c.temporary);if(!r)return null;let s;try{const c=Ce(e,i,a);s=String(c)}catch{s=e.replace(/^[\"']|[\"']$/g,\"\")}const o=r.passages.get(s);if(o&&C.getState().trackRender(s),!o)return g(\"span\",{class:\"error\",children:`{include: passage \"${s}\" not found}`});const u=ot(o.content),l=lt(u),f=le(l);return t||n?g(\"span\",{id:n,class:t,children:f}):g(Q,{children:f})}function co({rawArgs:e}){return ue(()=>{const t=C.getState();let n;try{const r=Ce(e,t.variables,t.temporary);n=String(r)}catch{n=e.replace(/^[\"']|[\"']$/g,\"\")}t.navigate(n)},[]),null}function fo({rawArgs:e}){return ue(()=>{const t=C.getState(),n=e.trim();n.startsWith(\"$\")?t.deleteVariable(n.slice(1)):n.startsWith(\"_\")?t.deleteTemporary(n.slice(1)):console.error(`spindle: {unset} expects a variable ($name or _name), got \"${n}\"`)},[]),null}function ho(e){const t=e.match(/^\\s*([\"']?\\$\\w+[\"']?)\\s*(?:[\"'](.*)[\"'])?\\s*$/);if(!t)return{varName:e.trim(),placeholder:\"\"};const n=t[1].replace(/[\"']/g,\"\"),r=t[2]||\"\";return{varName:n,placeholder:r}}function po({rawArgs:e,className:t,id:n}){const{varName:r,placeholder:i}=ho(e),a=r.startsWith(\"$\")?r.slice(1):r,s=C(l=>l.variables[a]),o=C(l=>l.setVariable),u=t?`macro-textbox ${t}`:\"macro-textbox\";return g(\"input\",{type:\"text\",id:n,class:u,value:s==null?\"\":String(s),placeholder:i,onInput:l=>o(a,l.target.value)})}function mo(e){const t=e.match(/^\\s*([\"']?\\$\\w+[\"']?)\\s*(?:[\"'](.*)[\"'])?\\s*$/);if(!t)return{varName:e.trim(),placeholder:\"\"};const n=t[1].replace(/[\"']/g,\"\"),r=t[2]||\"\";return{varName:n,placeholder:r}}function go({rawArgs:e,className:t,id:n}){const{varName:r,placeholder:i}=mo(e),a=r.startsWith(\"$\")?r.slice(1):r,s=C(l=>l.variables[a]),o=C(l=>l.setVariable),u=t?`macro-numberbox ${t}`:\"macro-numberbox\";return g(\"input\",{type:\"number\",id:n,class:u,value:s==null?\"\":String(s),placeholder:i,onInput:l=>{const f=l.target.value;o(a,f===\"\"?0:Number(f))}})}function _o(e){const t=e.match(/^\\s*([\"']?\\$\\w+[\"']?)\\s*(?:[\"'](.*)[\"'])?\\s*$/);if(!t)return{varName:e.trim(),placeholder:\"\"};const n=t[1].replace(/[\"']/g,\"\"),r=t[2]||\"\";return{varName:n,placeholder:r}}function yo({rawArgs:e,className:t,id:n}){const{varName:r,placeholder:i}=_o(e),a=r.startsWith(\"$\")?r.slice(1):r,s=C(l=>l.variables[a]),o=C(l=>l.setVariable),u=t?`macro-textarea ${t}`:\"macro-textarea\";return g(\"textarea\",{id:n,class:u,value:s==null?\"\":String(s),placeholder:i,onInput:l=>o(a,l.target.value)})}function bo(e){const t=e.match(/^\\s*([\"']?\\$\\w+[\"']?)\\s+[\"']?(.+?)[\"']?\\s*$/);if(!t)return{varName:e.trim(),label:\"\"};const n=t[1].replace(/[\"']/g,\"\"),r=t[2];return{varName:n,label:r}}function xo({rawArgs:e,className:t,id:n}){const{varName:r,label:i}=bo(e),a=r.startsWith(\"$\")?r.slice(1):r,s=C(l=>l.variables[a]),o=C(l=>l.setVariable),u=t?`macro-checkbox ${t}`:\"macro-checkbox\";return g(\"label\",{id:n,class:u,children:[g(\"input\",{type:\"checkbox\",checked:!!s,onChange:()=>o(a,!s)}),i?` ${i}`:null]})}function vo(e){const t=e.match(/^\\s*([\"']?\\$\\w+[\"']?)\\s+[\"'](.+?)[\"']\\s+[\"']?(.+?)[\"']?\\s*$/);if(!t){const n=e.trim().split(/\\s+/);return{varName:(n[0]||\"\").replace(/[\"']/g,\"\"),value:n[1]||\"\",label:n.slice(2).join(\" \")}}return{varName:t[1].replace(/[\"']/g,\"\"),value:t[2],label:t[3]}}function wo({rawArgs:e,className:t,id:n}){const{varName:r,value:i,label:a}=vo(e),s=r.startsWith(\"$\")?r.slice(1):r,o=C(f=>f.variables[s]),u=C(f=>f.setVariable),l=t?`macro-radiobutton ${t}`:\"macro-radiobutton\";return g(\"label\",{id:n,class:l,children:[g(\"input\",{type:\"radio\",name:`radio-${s}`,checked:o===i,onChange:()=>u(s,i)}),a?` ${a}`:null]})}function mi(e){const t=[];for(const n of e)n.type===\"macro\"&&n.name===\"option\"&&t.push(n.rawArgs.trim());return t}function ko({rawArgs:e,children:t,className:n,id:r}){const i=e.trim().replace(/[\"']/g,\"\"),a=i.startsWith(\"$\")?i.slice(1):i,s=C(f=>f.variables[a]),o=C(f=>f.setVariable),u=mi(t),l=n?`macro-listbox ${n}`:\"macro-listbox\";return g(\"select\",{id:r,class:l,value:s==null?\"\":String(s),onChange:f=>o(a,f.target.value),children:u.map(f=>g(\"option\",{value:f,children:f},f))})}function So({rawArgs:e,children:t,className:n,id:r}){const i=e.trim().replace(/[\"']/g,\"\"),a=i.startsWith(\"$\")?i.slice(1):i,s=C(c=>c.variables[a]),o=C(c=>c.setVariable),u=mi(t),l=()=>{if(u.length===0)return;const p=(u.indexOf(String(s))+1)%u.length;o(a,u[p])},f=n?`macro-cycle ${n}`:\"macro-cycle\";return g(\"button\",{id:r,class:f,onClick:l,children:s==null?u[0]||\"\":String(s)})}function Co(e){const t=[],n=/[\"']([^\"']+)[\"']/g;let r;for(;(r=n.exec(e))!==null;)t.push(r[1]);return t.length>=2?{display:t[0],passage:t[1]}:t.length===1?{display:t[0],passage:null}:{display:e.trim(),passage:null}}function Io(e){return e.map(t=>t.type===\"text\"?t.value:\"\").join(\"\")}function Ao(e){const t=C.getState(),n=structuredClone(t.variables),r=structuredClone(t.temporary);for(const i of e)if(i.type===\"macro\"){if(i.name===\"set\")try{ze(i.rawArgs,n,r)}catch(a){console.error(\"spindle: Error in {link} child {set}:\",a)}else if(i.name===\"do\"){const a=Io(i.children);try{ze(a,n,r)}catch(s){console.error(\"spindle: Error in {link} child {do}:\",s)}}}for(const i of Object.keys(n))n[i]!==t.variables[i]&&t.setVariable(i,n[i]);for(const i of Object.keys(r))r[i]!==t.temporary[i]&&t.setTemporary(i,r[i])}function Eo({rawArgs:e,children:t,className:n,id:r}){const{display:i,passage:a}=Co(e),s=u=>{u.preventDefault(),Ao(t),a&&C.getState().navigate(a)},o=n?`macro-link ${n}`:\"macro-link\";return g(\"a\",{id:r,class:o,href:\"#\",onClick:s,children:i})}function To({rawArgs:e,branches:t}){const n=C(l=>l.variables),r=C(l=>l.temporary),i=we(Fe),a={...n},s={...r};for(const[l,f]of Object.entries(i))l.startsWith(\"$\")?a[l.slice(1)]=f:l.startsWith(\"_\")&&(s[l.slice(1)]=f);let o;try{o=Ce(e,a,s)}catch(l){return g(\"span\",{class:\"error\",title:String(l),children:`{switch error: ${l.message}}`})}let u=null;for(const l of t){if(l.rawArgs===\"\"){u=l;continue}try{const f=Ce(l.rawArgs,a,s);if(o===f)return g(Q,{children:le(l.children)})}catch(f){return g(\"span\",{class:\"error\",title:String(f),children:`{case error: ${f.message}}`})}}return u?g(Q,{children:le(u.children)}):null}function St(e){const t=e.trim();return t.endsWith(\"ms\")?parseFloat(t.slice(0,-2)):t.endsWith(\"s\")?parseFloat(t.slice(0,-1))*1e3:parseFloat(t)}function Po({rawArgs:e,children:t,branches:n,className:r,id:i}){const a=[];a.push({delay:St(e),nodes:t});for(const l of n){const f=l.rawArgs?St(l.rawArgs):0;a.push({delay:f,nodes:l.children})}const[s,o]=Y(-1);if(be(()=>{if(s>=a.length-1)return;const l=s+1,f=a[l].delay,c=setTimeout(()=>{o(l)},f);return()=>clearTimeout(c)},[s,a.length]),s<0)return null;const u=le(a[s].nodes);return r||i?g(\"span\",{id:i,class:r,children:u}):g(Q,{children:u})}const gi=gn({stop:()=>{}});function No({rawArgs:e,children:t,className:n,id:r}){const i=St(e),[a,s]=Y(0),[o,u]=Y(!1),l=It(()=>u(!0),[]);if(be(()=>{if(o)return;const p=setInterval(()=>{s(h=>h+1)},i);return()=>clearInterval(p)},[i,o]),a===0&&!o)return null;const f=n?`macro-repeat ${n}`:void 0,c=g(gi.Provider,{value:{stop:l},children:le(t)});return f||r?g(\"span\",{id:r,class:f,children:c}):c}function Do(){const{stop:e}=we(gi);return ue(()=>{e()},[e]),null}function $o({rawArgs:e,children:t,className:n,id:r}){const i=St(e),a=Je(null),[s,o]=Y(0),[u,l]=Y(0);be(()=>{if(a.current){const p=a.current.textContent||\"\";o(p.length)}},[]),be(()=>{if(s===0||u>=s)return;const p=setInterval(()=>{l(h=>h>=s?(clearInterval(p),h):h+1)},i);return()=>clearInterval(p)},[s,i]);const f=u>=s&&s>0,c=[\"macro-type\",f?\"macro-type-done\":\"\",n||\"\"].filter(Boolean).join(\" \");return g(\"span\",{id:r,class:c,ref:a,style:{clipPath:(s>0&&!f,void 0)},children:[g(\"span\",{class:\"macro-type-inner\",style:{display:\"inline\",visibility:s===0?\"hidden\":\"visible\",clipPath:s>0&&!f?`inset(0 ${(s-u)/s*100}% 0 0)`:void 0},children:Ni(t)}),!f&&s>0&&g(\"span\",{class:\"macro-type-cursor\"})]})}const _i=new Map;function yi(e,t){_i.set(e.toLowerCase(),t)}function zo(e){return _i.get(e.toLowerCase())}function Fo({rawArgs:e,children:t}){const n=e.trim().replace(/[\"']/g,\"\");return ue(()=>{yi(n,t)},[]),null}function Oo(e){const t=e.trim();let n=0;for(let r=0;r<t.length;r++){const i=t[r];if(i===\"(\"||i===\"[\"||i===\"{\")n++;else if(i===\")\"||i===\"]\"||i===\"}\")n--;else if(i===\"=\"&&n===0){if(t[r+1]===\"=\"){r++;continue}if(r>0&&t[r-1]===\"!\")continue;const a=t.slice(0,r).trim(),s=t.slice(r+1).trim();if(!a.match(/^[$_]\\w+$/))throw new Error(`{computed}: target must be $name or _name, got \"${a}\"`);return{target:a,expr:s}}}throw new Error(`{computed}: expected \"target = expression\", got \"${e}\"`)}function Ro(e,t){return Object.is(e,t)?!0:typeof e==\"object\"&&e!==null&&typeof t==\"object\"&&t!==null?JSON.stringify(e)===JSON.stringify(t):!1}function Lo({rawArgs:e}){C(s=>s.variables),C(s=>s.temporary);const t=we(Fe),{target:n,expr:r}=Oo(e),i=n.startsWith(\"_\"),a=n.slice(1);return ue(()=>{const s=C.getState(),o={...s.variables},u={...s.temporary};for(const[c,p]of Object.entries(t))c.startsWith(\"$\")?o[c.slice(1)]=p:c.startsWith(\"_\")&&(u[c.slice(1)]=p);let l;try{l=Ce(r,o,u)}catch(c){console.error(`spindle: Error in {computed ${e}}:`,c);return}const f=i?s.temporary[a]:s.variables[a];Ro(f,l)||(i?s.setTemporary(a,l):s.setVariable(a,l))}),null}const Mo=new Map;function Bo(e){return Mo.get(e.toLowerCase())}const fr=document.createElement(\"i\");function bi(e){const t=\"&\"+e+\";\";fr.innerHTML=t;const n=fr.textContent;return n.charCodeAt(n.length-1)===59&&e!==\"semi\"||n===t?!1:n}function ae(e,t,n,r){const i=e.length;let a=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);a<r.length;)s=r.slice(a,a+1e4),s.unshift(t,0),e.splice(...s),a+=1e4,t+=1e4}function X(e,t){return e.length>0?(ae(e,e.length,0,t),e):t}const on={}.hasOwnProperty;function Vo(e){const t={};let n=-1;for(;++n<e.length;)Ho(t,e[n]);return t}function Ho(e,t){let n;for(n in t){const i=(on.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a){on.call(i,s)||(i[s]=[]);const o=a[s];Uo(i[s],Array.isArray(o)?o:o?[o]:[])}}}function Uo(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add===\"after\"?e:r).push(t[n]);ae(e,0,0,r)}function qo(e){const t={};let n=-1;for(;++n<e.length;)Wo(t,e[n]);return t}function Wo(e,t){let n;for(n in t){const i=(on.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a)i[s]=a[s]}}function jo(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?\"�\":String.fromCodePoint(n)}const Qo={'\"':\"quot\",\"&\":\"amp\",\"<\":\"lt\",\">\":\"gt\"};function xi(e){return e.replace(/[\"&<>]/g,t);function t(n){return\"&\"+Qo[n]+\";\"}}function rt(e){return e.replace(/[\\t\\n\\r ]+/g,\" \").replace(/^ | $/g,\"\").toLowerCase().toUpperCase()}const ge=Te(/[A-Za-z]/),ie=Te(/[\\dA-Za-z]/),Ko=Te(/[#-'*+\\--9=?A-Z^-~]/);function ln(e){return e!==null&&(e<32||e===127)}const un=Te(/\\d/),Go=Te(/[\\dA-Fa-f]/),Yo=Te(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function ee(e){return e!==null&&(e<0||e===32)}function O(e){return e===-2||e===-1||e===32}const Zo=Te(/\\p{P}|\\p{S}/u),Jo=Te(/\\s/);function Te(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pt(e,t){const n=xi(Xo(e||\"\"));if(!t)return n;const r=n.indexOf(\":\"),i=n.indexOf(\"?\"),a=n.indexOf(\"#\"),s=n.indexOf(\"/\");return r<0||s>-1&&r>s||i>-1&&r>i||a>-1&&r>a||t.test(n.slice(0,r))?n:\"\"}function Xo(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let s=\"\";if(a===37&&ie(e.charCodeAt(n+1))&&ie(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(s=String.fromCharCode(a));else if(a>55295&&a<57344){const o=e.charCodeAt(n+1);a<56320&&o>56319&&o<57344?(s=String.fromCharCode(a,o),i=1):s=\"�\"}else s=String.fromCharCode(a);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=\"\"),i&&(n+=i,i=0)}return t.join(\"\")+e.slice(r)}const hr={}.hasOwnProperty,pr=/^(https?|ircs?|mailto|xmpp)$/i,el=/^https?$/i;function tl(e){const t=e||{};let n=!0;const r={},i=[[]],a=[],s=[],u=qo([{enter:{blockQuote:R,codeFenced:ce,codeFencedFenceInfo:I,codeFencedFenceMeta:I,codeIndented:q,codeText:Ji,content:Bi,definition:zi,definitionDestinationString:Oi,definitionLabelString:I,definitionTitleString:I,emphasis:Yi,htmlFlow:Gi,htmlText:En,image:V,label:I,link:te,listItemMarker:T,listItemValue:y,listOrdered:M,listUnordered:L,paragraph:K,reference:I,resource:Oe,resourceDestinationString:Re,resourceTitleString:I,setextHeading:Hi,strong:Zi},exit:{atxHeading:qi,atxHeadingSequence:Vi,autolinkEmail:aa,autolinkProtocol:ia,blockQuote:G,characterEscapeValue:je,characterReferenceMarkerHexadecimal:Tn,characterReferenceMarkerNumeric:Tn,characterReferenceValue:ra,codeFenced:d,codeFencedFence:A,codeFencedFenceInfo:m,codeFencedFenceMeta:P,codeFlowValue:Ki,codeIndented:d,codeText:Xi,codeTextData:je,data:je,definition:Mi,definitionDestinationString:Ri,definitionLabelString:Fi,definitionTitleString:Li,emphasis:ea,hardBreakEscape:In,hardBreakTrailing:In,htmlFlow:An,htmlFlowData:je,htmlText:An,htmlTextData:je,image:Cn,label:We,labelText:Z,lineEnding:Qi,link:Cn,listOrdered:N,listUnordered:H,paragraph:re,reference:P,referenceString:ke,resource:P,resourceDestinationString:Ft,resourceTitleString:$i,setextHeading:ji,setextHeadingLineSequence:Wi,setextHeadingText:Ui,strong:ta,thematicBreak:na}},...t.htmlExtensions||[]]),l={definitions:r,tightStack:s},f={buffer:I,encode:x,getData:w,lineEndingIfNeeded:E,options:t,raw:S,resume:b,setData:_,tag:v};let c=t.defaultLineEnding;return p;function p(k){let D=-1,J=0;const fe=[];let de=[],xe=[];for(;++D<k.length;)!c&&(k[D][1].type===\"lineEnding\"||k[D][1].type===\"lineEndingBlank\")&&(c=k[D][2].sliceSerialize(k[D][1])),(k[D][1].type===\"listOrdered\"||k[D][1].type===\"listUnordered\")&&(k[D][0]===\"enter\"?fe.push(D):h(k.slice(fe.pop(),D))),k[D][1].type===\"definition\"&&(k[D][0]===\"enter\"?(xe=X(xe,k.slice(J,D)),J=D):(de=X(de,k.slice(J,D+1)),J=D+1));de=X(de,xe),de=X(de,k.slice(J)),D=-1;const me=de;for(u.enter.null&&u.enter.null.call(f);++D<k.length;){const Pn=u[me[D][0]],Nn=me[D][1].type,Dn=Pn[Nn];hr.call(Pn,Nn)&&Dn&&Dn.call({sliceSerialize:me[D][2].sliceSerialize,...f},me[D][1])}return u.exit.null&&u.exit.null.call(f),i[0].join(\"\")}function h(k){const D=k.length;let J=0,fe=0,de=!1,xe;for(;++J<D;){const me=k[J];if(me[1]._container)xe=void 0,me[0]===\"enter\"?fe++:fe--;else switch(me[1].type){case\"listItemPrefix\":{me[0]===\"exit\"&&(xe=!0);break}case\"linePrefix\":break;case\"lineEndingBlank\":{me[0]===\"enter\"&&!fe&&(xe?xe=void 0:de=!0);break}default:xe=void 0}}k[0][1]._loose=de}function _(k,D){l[k]=D}function w(k){return l[k]}function I(){i.push([])}function b(){return i.pop().join(\"\")}function v(k){n&&(_(\"lastWasTag\",!0),i[i.length-1].push(k))}function S(k){_(\"lastWasTag\"),i[i.length-1].push(k)}function z(){S(c||`\n`)}function E(){const k=i[i.length-1],D=k[k.length-1],J=D?D.charCodeAt(D.length-1):null;J===10||J===13||J===null||z()}function x(k){return w(\"ignoreEncode\")?k:xi(k)}function P(){b()}function M(k){s.push(!k._loose),E(),v(\"<ol\"),_(\"expectFirstItem\",!0)}function L(k){s.push(!k._loose),E(),v(\"<ul\"),_(\"expectFirstItem\",!0)}function y(k){if(w(\"expectFirstItem\")){const D=Number.parseInt(this.sliceSerialize(k),10);D!==1&&v(' start=\"'+x(String(D))+'\"')}}function T(){w(\"expectFirstItem\")?v(\">\"):U(),E(),v(\"<li>\"),_(\"expectFirstItem\"),_(\"lastWasTag\")}function N(){U(),s.pop(),z(),v(\"</ol>\")}function H(){U(),s.pop(),z(),v(\"</ul>\")}function U(){w(\"lastWasTag\")&&!w(\"slurpAllLineEndings\")&&E(),v(\"</li>\"),_(\"slurpAllLineEndings\")}function R(){s.push(!1),E(),v(\"<blockquote>\")}function G(){s.pop(),E(),v(\"</blockquote>\"),_(\"slurpAllLineEndings\")}function K(){s[s.length-1]||(E(),v(\"<p>\")),_(\"slurpAllLineEndings\")}function re(){s[s.length-1]?_(\"slurpAllLineEndings\",!0):v(\"</p>\")}function ce(){E(),v(\"<pre><code\"),_(\"fencesCount\",0)}function m(){const k=b();v(' class=\"language-'+k+'\"')}function A(){const k=w(\"fencesCount\")||0;k||(v(\">\"),_(\"slurpOneLineEnding\",!0)),_(\"fencesCount\",k+1)}function q(){E(),v(\"<pre><code>\")}function d(){const k=w(\"fencesCount\");k!==void 0&&k<2&&l.tightStack.length>0&&!w(\"lastWasTag\")&&z(),w(\"flowCodeSeenData\")&&E(),v(\"</code></pre>\"),k!==void 0&&k<2&&E(),_(\"flowCodeSeenData\"),_(\"fencesCount\"),_(\"slurpOneLineEnding\")}function V(){a.push({image:!0}),n=void 0}function te(){a.push({})}function Z(k){a[a.length-1].labelId=this.sliceSerialize(k)}function We(){a[a.length-1].label=b()}function ke(k){a[a.length-1].referenceId=this.sliceSerialize(k)}function Oe(){I(),a[a.length-1].destination=\"\"}function Re(){I(),_(\"ignoreEncode\",!0)}function Ft(){a[a.length-1].destination=b(),_(\"ignoreEncode\")}function $i(){a[a.length-1].title=b()}function Cn(){let k=a.length-1;const D=a[k],J=D.referenceId||D.labelId,fe=D.destination===void 0?r[rt(J)]:D;for(n=!0;k--;)if(a[k].image){n=void 0;break}D.image?(v('<img src=\"'+pt(fe.destination,t.allowDangerousProtocol?void 0:el)+'\" alt=\"'),S(D.label),v('\"')):v('<a href=\"'+pt(fe.destination,t.allowDangerousProtocol?void 0:pr)+'\"'),v(fe.title?' title=\"'+fe.title+'\"':\"\"),D.image?v(\" />\"):(v(\">\"),S(D.label),v(\"</a>\")),a.pop()}function zi(){I(),a.push({})}function Fi(k){b(),a[a.length-1].labelId=this.sliceSerialize(k)}function Oi(){I(),_(\"ignoreEncode\",!0)}function Ri(){a[a.length-1].destination=b(),_(\"ignoreEncode\")}function Li(){a[a.length-1].title=b()}function Mi(){const k=a[a.length-1],D=rt(k.labelId);b(),hr.call(r,D)||(r[D]=a[a.length-1]),a.pop()}function Bi(){_(\"slurpAllLineEndings\",!0)}function Vi(k){w(\"headingRank\")||(_(\"headingRank\",this.sliceSerialize(k).length),E(),v(\"<h\"+w(\"headingRank\")+\">\"))}function Hi(){I(),_(\"slurpAllLineEndings\")}function Ui(){_(\"slurpAllLineEndings\",!0)}function qi(){v(\"</h\"+w(\"headingRank\")+\">\"),_(\"headingRank\")}function Wi(k){_(\"headingRank\",this.sliceSerialize(k).charCodeAt(0)===61?1:2)}function ji(){const k=b();E(),v(\"<h\"+w(\"headingRank\")+\">\"),S(k),v(\"</h\"+w(\"headingRank\")+\">\"),_(\"slurpAllLineEndings\"),_(\"headingRank\")}function je(k){S(x(this.sliceSerialize(k)))}function Qi(k){if(!w(\"slurpAllLineEndings\")){if(w(\"slurpOneLineEnding\")){_(\"slurpOneLineEnding\");return}if(w(\"inCodeText\")){S(\" \");return}S(x(this.sliceSerialize(k)))}}function Ki(k){S(x(this.sliceSerialize(k))),_(\"flowCodeSeenData\",!0)}function In(){v(\"<br />\")}function Gi(){E(),En()}function An(){_(\"ignoreEncode\")}function En(){t.allowDangerousHtml&&_(\"ignoreEncode\",!0)}function Yi(){v(\"<em>\")}function Zi(){v(\"<strong>\")}function Ji(){_(\"inCodeText\",!0),v(\"<code>\")}function Xi(){_(\"inCodeText\"),v(\"</code>\")}function ea(){v(\"</em>\")}function ta(){v(\"</strong>\")}function na(){E(),v(\"<hr />\")}function Tn(k){_(\"characterReferenceType\",k.type)}function ra(k){const D=this.sliceSerialize(k),J=w(\"characterReferenceType\")?jo(D,w(\"characterReferenceType\")===\"characterReferenceMarkerNumeric\"?10:16):bi(D);S(x(J)),_(\"characterReferenceType\")}function ia(k){const D=this.sliceSerialize(k);v('<a href=\"'+pt(D,t.allowDangerousProtocol?void 0:pr)+'\">'),S(x(D)),v(\"</a>\")}function aa(k){const D=this.sliceSerialize(k);v('<a href=\"'+pt(\"mailto:\"+D)+'\">'),S(x(D)),v(\"</a>\")}}function B(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return s;function s(u){return O(u)?(e.enter(n),o(u)):t(u)}function o(u){return O(u)&&a++<i?(e.consume(u),o):(e.exit(n),t(u))}}const nl={tokenize:rl};function rl(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter(\"lineEnding\"),e.consume(o),e.exit(\"lineEnding\"),B(e,t,\"linePrefix\")}function i(o){return e.enter(\"paragraph\"),a(o)}function a(o){const u=e.enter(\"chunkText\",{contentType:\"text\",previous:n});return n&&(n.next=u),n=u,s(o)}function s(o){if(o===null){e.exit(\"chunkText\"),e.exit(\"paragraph\"),e.consume(o);return}return $(o)?(e.consume(o),e.exit(\"chunkText\"),a):(e.consume(o),s)}}const il={tokenize:al},dr={tokenize:sl};function al(e){const t=this,n=[];let r=0,i,a,s;return o;function o(S){if(r<n.length){const z=n[r];return t.containerState=z[1],e.attempt(z[0].continuation,u,l)(S)}return l(S)}function u(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const z=t.events.length;let E=z,x;for(;E--;)if(t.events[E][0]===\"exit\"&&t.events[E][1].type===\"chunkFlow\"){x=t.events[E][1].end;break}b(r);let P=z;for(;P<t.events.length;)t.events[P][1].end={...x},P++;return ae(t.events,E+1,0,t.events.slice(z)),t.events.length=P,l(S)}return o(S)}function l(S){if(r===n.length){if(!i)return p(S);if(i.currentConstruct&&i.currentConstruct.concrete)return _(S);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(dr,f,c)(S)}function f(S){return i&&v(),b(r),p(S)}function c(S){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,_(S)}function p(S){return t.containerState={},e.attempt(dr,h,_)(S)}function h(S){return r++,n.push([t.currentConstruct,t.containerState]),p(S)}function _(S){if(S===null){i&&v(),b(0),e.consume(S);return}return i=i||t.parser.flow(t.now()),e.enter(\"chunkFlow\",{_tokenizer:i,contentType:\"flow\",previous:a}),w(S)}function w(S){if(S===null){I(e.exit(\"chunkFlow\"),!0),b(0),e.consume(S);return}return $(S)?(e.consume(S),I(e.exit(\"chunkFlow\")),r=0,t.interrupt=void 0,o):(e.consume(S),w)}function I(S,z){const E=t.sliceStream(S);if(z&&E.push(null),S.previous=a,a&&(a.next=S),a=S,i.defineSkip(S.start),i.write(E),t.parser.lazy[S.start.line]){let x=i.events.length;for(;x--;)if(i.events[x][1].start.offset<s&&(!i.events[x][1].end||i.events[x][1].end.offset>s))return;const P=t.events.length;let M=P,L,y;for(;M--;)if(t.events[M][0]===\"exit\"&&t.events[M][1].type===\"chunkFlow\"){if(L){y=t.events[M][1].end;break}L=!0}for(b(r),x=P;x<t.events.length;)t.events[x][1].end={...y},x++;ae(t.events,M+1,0,t.events.slice(P)),t.events.length=x}}function b(S){let z=n.length;for(;z-- >S;){const E=n[z];t.containerState=E[1],E[0].exit.call(t,e)}n.length=S}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function sl(e,t,n){return B(e,e.attempt(this.parser.constructs.document,t,n),\"linePrefix\",this.parser.constructs.disable.null.includes(\"codeIndented\")?void 0:4)}function Ct(e){if(e===null||ee(e)||Jo(e))return 1;if(Zo(e))return 2}function $t(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const cn={name:\"attention\",resolveAll:ol,tokenize:ll};function ol(e,t){let n=-1,r,i,a,s,o,u,l,f;for(;++n<e.length;)if(e[n][0]===\"enter\"&&e[n][1].type===\"attentionSequence\"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===\"exit\"&&e[r][1].type===\"attentionSequence\"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[n][1].start};mr(c,-u),mr(p,u),s={type:u>1?\"strongSequence\":\"emphasisSequence\",start:c,end:{...e[r][1].end}},o={type:u>1?\"strongSequence\":\"emphasisSequence\",start:{...e[n][1].start},end:p},a={type:u>1?\"strongText\":\"emphasisText\",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?\"strong\":\"emphasis\",start:{...s.start},end:{...o.end}},e[r][1].end={...s.start},e[n][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=X(l,[[\"enter\",e[r][1],t],[\"exit\",e[r][1],t]])),l=X(l,[[\"enter\",i,t],[\"enter\",s,t],[\"exit\",s,t],[\"enter\",a,t]]),l=X(l,$t(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=X(l,[[\"exit\",a,t],[\"enter\",o,t],[\"exit\",o,t],[\"exit\",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,l=X(l,[[\"enter\",e[n][1],t],[\"exit\",e[n][1],t]])):f=0,ae(e,r-1,n-r+3,l),n=r+l.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===\"attentionSequence\"&&(e[n][1].type=\"data\");return e}function ll(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ct(r);let a;return s;function s(u){return a=u,e.enter(\"attentionSequence\"),o(u)}function o(u){if(u===a)return e.consume(u),o;const l=e.exit(\"attentionSequence\"),f=Ct(u),c=!f||f===2&&i||n.includes(u),p=!i||i===2&&f||n.includes(r);return l._open=!!(a===42?c:c&&(i||!p)),l._close=!!(a===42?p:p&&(f||!c)),t(u)}}function mr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const ul={name:\"autolink\",tokenize:cl};function cl(e,t,n){let r=0;return i;function i(h){return e.enter(\"autolink\"),e.enter(\"autolinkMarker\"),e.consume(h),e.exit(\"autolinkMarker\"),e.enter(\"autolinkProtocol\"),a}function a(h){return ge(h)?(e.consume(h),s):h===64?n(h):l(h)}function s(h){return h===43||h===45||h===46||ie(h)?(r=1,o(h)):l(h)}function o(h){return h===58?(e.consume(h),r=0,u):(h===43||h===45||h===46||ie(h))&&r++<32?(e.consume(h),o):(r=0,l(h))}function u(h){return h===62?(e.exit(\"autolinkProtocol\"),e.enter(\"autolinkMarker\"),e.consume(h),e.exit(\"autolinkMarker\"),e.exit(\"autolink\"),t):h===null||h===32||h===60||ln(h)?n(h):(e.consume(h),u)}function l(h){return h===64?(e.consume(h),f):Ko(h)?(e.consume(h),l):n(h)}function f(h){return ie(h)?c(h):n(h)}function c(h){return h===46?(e.consume(h),r=0,f):h===62?(e.exit(\"autolinkProtocol\").type=\"autolinkEmail\",e.enter(\"autolinkMarker\"),e.consume(h),e.exit(\"autolinkMarker\"),e.exit(\"autolink\"),t):p(h)}function p(h){if((h===45||ie(h))&&r++<63){const _=h===45?p:c;return e.consume(h),_}return n(h)}}const zt={partial:!0,tokenize:fl};function fl(e,t,n){return r;function r(a){return O(a)?B(e,i,\"linePrefix\")(a):i(a)}function i(a){return a===null||$(a)?t(a):n(a)}}const vi={continuation:{tokenize:pl},exit:dl,name:\"blockQuote\",tokenize:hl};function hl(e,t,n){const r=this;return i;function i(s){if(s===62){const o=r.containerState;return o.open||(e.enter(\"blockQuote\",{_container:!0}),o.open=!0),e.enter(\"blockQuotePrefix\"),e.enter(\"blockQuoteMarker\"),e.consume(s),e.exit(\"blockQuoteMarker\"),a}return n(s)}function a(s){return O(s)?(e.enter(\"blockQuotePrefixWhitespace\"),e.consume(s),e.exit(\"blockQuotePrefixWhitespace\"),e.exit(\"blockQuotePrefix\"),t):(e.exit(\"blockQuotePrefix\"),t(s))}}function pl(e,t,n){const r=this;return i;function i(s){return O(s)?B(e,a,\"linePrefix\",r.parser.constructs.disable.null.includes(\"codeIndented\")?void 0:4)(s):a(s)}function a(s){return e.attempt(vi,t,n)(s)}}function dl(e){e.exit(\"blockQuote\")}const wi={name:\"characterEscape\",tokenize:ml};function ml(e,t,n){return r;function r(a){return e.enter(\"characterEscape\"),e.enter(\"escapeMarker\"),e.consume(a),e.exit(\"escapeMarker\"),i}function i(a){return Yo(a)?(e.enter(\"characterEscapeValue\"),e.consume(a),e.exit(\"characterEscapeValue\"),e.exit(\"characterEscape\"),t):n(a)}}const ki={name:\"characterReference\",tokenize:gl};function gl(e,t,n){const r=this;let i=0,a,s;return o;function o(c){return e.enter(\"characterReference\"),e.enter(\"characterReferenceMarker\"),e.consume(c),e.exit(\"characterReferenceMarker\"),u}function u(c){return c===35?(e.enter(\"characterReferenceMarkerNumeric\"),e.consume(c),e.exit(\"characterReferenceMarkerNumeric\"),l):(e.enter(\"characterReferenceValue\"),a=31,s=ie,f(c))}function l(c){return c===88||c===120?(e.enter(\"characterReferenceMarkerHexadecimal\"),e.consume(c),e.exit(\"characterReferenceMarkerHexadecimal\"),e.enter(\"characterReferenceValue\"),a=6,s=Go,f):(e.enter(\"characterReferenceValue\"),a=7,s=un,f(c))}function f(c){if(c===59&&i){const p=e.exit(\"characterReferenceValue\");return s===ie&&!bi(r.sliceSerialize(p))?n(c):(e.enter(\"characterReferenceMarker\"),e.consume(c),e.exit(\"characterReferenceMarker\"),e.exit(\"characterReference\"),t)}return s(c)&&i++<a?(e.consume(c),f):n(c)}}const gr={partial:!0,tokenize:yl},_r={concrete:!0,name:\"codeFenced\",tokenize:_l};function _l(e,t,n){const r=this,i={partial:!0,tokenize:E};let a=0,s=0,o;return u;function u(x){return l(x)}function l(x){const P=r.events[r.events.length-1];return a=P&&P[1].type===\"linePrefix\"?P[2].sliceSerialize(P[1],!0).length:0,o=x,e.enter(\"codeFenced\"),e.enter(\"codeFencedFence\"),e.enter(\"codeFencedFenceSequence\"),f(x)}function f(x){return x===o?(s++,e.consume(x),f):s<3?n(x):(e.exit(\"codeFencedFenceSequence\"),O(x)?B(e,c,\"whitespace\")(x):c(x))}function c(x){return x===null||$(x)?(e.exit(\"codeFencedFence\"),r.interrupt?t(x):e.check(gr,w,z)(x)):(e.enter(\"codeFencedFenceInfo\"),e.enter(\"chunkString\",{contentType:\"string\"}),p(x))}function p(x){return x===null||$(x)?(e.exit(\"chunkString\"),e.exit(\"codeFencedFenceInfo\"),c(x)):O(x)?(e.exit(\"chunkString\"),e.exit(\"codeFencedFenceInfo\"),B(e,h,\"whitespace\")(x)):x===96&&x===o?n(x):(e.consume(x),p)}function h(x){return x===null||$(x)?c(x):(e.enter(\"codeFencedFenceMeta\"),e.enter(\"chunkString\",{contentType:\"string\"}),_(x))}function _(x){return x===null||$(x)?(e.exit(\"chunkString\"),e.exit(\"codeFencedFenceMeta\"),c(x)):x===96&&x===o?n(x):(e.consume(x),_)}function w(x){return e.attempt(i,z,I)(x)}function I(x){return e.enter(\"lineEnding\"),e.consume(x),e.exit(\"lineEnding\"),b}function b(x){return a>0&&O(x)?B(e,v,\"linePrefix\",a+1)(x):v(x)}function v(x){return x===null||$(x)?e.check(gr,w,z)(x):(e.enter(\"codeFlowValue\"),S(x))}function S(x){return x===null||$(x)?(e.exit(\"codeFlowValue\"),v(x)):(e.consume(x),S)}function z(x){return e.exit(\"codeFenced\"),t(x)}function E(x,P,M){let L=0;return y;function y(R){return x.enter(\"lineEnding\"),x.consume(R),x.exit(\"lineEnding\"),T}function T(R){return x.enter(\"codeFencedFence\"),O(R)?B(x,N,\"linePrefix\",r.parser.constructs.disable.null.includes(\"codeIndented\")?void 0:4)(R):N(R)}function N(R){return R===o?(x.enter(\"codeFencedFenceSequence\"),H(R)):M(R)}function H(R){return R===o?(L++,x.consume(R),H):L>=s?(x.exit(\"codeFencedFenceSequence\"),O(R)?B(x,U,\"whitespace\")(R):U(R)):M(R)}function U(R){return R===null||$(R)?(x.exit(\"codeFencedFence\"),P(R)):M(R)}}}function yl(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter(\"lineEnding\"),e.consume(s),e.exit(\"lineEnding\"),a)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Ht={name:\"codeIndented\",tokenize:xl},bl={partial:!0,tokenize:vl};function xl(e,t,n){const r=this;return i;function i(l){return e.enter(\"codeIndented\"),B(e,a,\"linePrefix\",5)(l)}function a(l){const f=r.events[r.events.length-1];return f&&f[1].type===\"linePrefix\"&&f[2].sliceSerialize(f[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?u(l):$(l)?e.attempt(bl,s,u)(l):(e.enter(\"codeFlowValue\"),o(l))}function o(l){return l===null||$(l)?(e.exit(\"codeFlowValue\"),s(l)):(e.consume(l),o)}function u(l){return e.exit(\"codeIndented\"),t(l)}}function vl(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):$(s)?(e.enter(\"lineEnding\"),e.consume(s),e.exit(\"lineEnding\"),i):B(e,a,\"linePrefix\",5)(s)}function a(s){const o=r.events[r.events.length-1];return o&&o[1].type===\"linePrefix\"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):$(s)?i(s):n(s)}}const wl={name:\"codeText\",previous:Sl,resolve:kl,tokenize:Cl};function kl(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===\"lineEnding\"||e[n][1].type===\"space\")&&(e[t][1].type===\"lineEnding\"||e[t][1].type===\"space\")){for(r=n;++r<t;)if(e[r][1].type===\"codeTextData\"){e[n][1].type=\"codeTextPadding\",e[t][1].type=\"codeTextPadding\",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==\"lineEnding\"&&(i=r):(r===t||e[r][1].type===\"lineEnding\")&&(e[i][1].type=\"codeTextData\",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Sl(e){return e!==96||this.events[this.events.length-1][1].type===\"characterEscape\"}function Cl(e,t,n){let r=0,i,a;return s;function s(c){return e.enter(\"codeText\"),e.enter(\"codeTextSequence\"),o(c)}function o(c){return c===96?(e.consume(c),r++,o):(e.exit(\"codeTextSequence\"),u(c))}function u(c){return c===null?n(c):c===32?(e.enter(\"space\"),e.consume(c),e.exit(\"space\"),u):c===96?(a=e.enter(\"codeTextSequence\"),i=0,f(c)):$(c)?(e.enter(\"lineEnding\"),e.consume(c),e.exit(\"lineEnding\"),u):(e.enter(\"codeTextData\"),l(c))}function l(c){return c===null||c===32||c===96||$(c)?(e.exit(\"codeTextData\"),u(c)):(e.consume(c),l)}function f(c){return c===96?(e.consume(c),i++,f):i===r?(e.exit(\"codeTextSequence\"),e.exit(\"codeText\"),t(c)):(a.type=\"codeTextData\",l(c))}}class Il{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError(\"Cannot access index `\"+t+\"` in a splice buffer of size `\"+(this.left.length+this.right.length)+\"`\");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ke(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ke(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ke(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ke(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ke(this.left,n.reverse())}}}function Ke(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Si(e){const t={};let n=-1,r,i,a,s,o,u,l;const f=new Il(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type===\"chunkFlow\"&&f.get(n-1)[1].type===\"listItemPrefix\"&&(u=r[1]._tokenizer.events,a=0,a<u.length&&u[a][1].type===\"lineEndingBlank\"&&(a+=2),a<u.length&&u[a][1].type===\"content\"))for(;++a<u.length&&u[a][1].type!==\"content\";)u[a][1].type===\"chunkText\"&&(u[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===\"enter\")r[1].contentType&&(Object.assign(t,Al(f,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(s=f.get(a),s[1].type===\"lineEnding\"||s[1].type===\"lineEndingBlank\")s[0]===\"enter\"&&(i&&(f.get(i)[1].type=\"lineEndingBlank\"),s[1].type=\"lineEnding\",i=a);else if(!(s[1].type===\"linePrefix\"||s[1].type===\"listItemIndent\"))break;i&&(r[1].end={...f.get(i)[1].start},o=f.slice(i,n),o.unshift(r),f.splice(i,n-i+1,o))}}return ae(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!l}function Al(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const o=s.events,u=[],l={};let f,c,p=-1,h=n,_=0,w=0;const I=[w];for(;h;){for(;e.get(++i)[1]!==h;);a.push(i),h._tokenizer||(f=r.sliceStream(h),h.next||f.push(null),c&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(f),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),c=h,h=h.next}for(h=n;++p<o.length;)o[p][0]===\"exit\"&&o[p-1][0]===\"enter\"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(w=p+1,I.push(w),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):I.pop(),p=I.length;p--;){const b=o.slice(I[p],I[p+1]),v=a.pop();u.push([v,v+b.length-1]),e.splice(v,2,b)}for(u.reverse(),p=-1;++p<u.length;)l[_+u[p][0]]=_+u[p][1],_+=u[p][1]-u[p][0]-1;return l}const El={resolve:Pl,tokenize:Nl},Tl={partial:!0,tokenize:Dl};function Pl(e){return Si(e),e}function Nl(e,t){let n;return r;function r(o){return e.enter(\"content\"),n=e.enter(\"chunkContent\",{contentType:\"content\"}),i(o)}function i(o){return o===null?a(o):$(o)?e.check(Tl,s,a)(o):(e.consume(o),i)}function a(o){return e.exit(\"chunkContent\"),e.exit(\"content\"),t(o)}function s(o){return e.consume(o),e.exit(\"chunkContent\"),n.next=e.enter(\"chunkContent\",{contentType:\"content\",previous:n}),n=n.next,i}}function Dl(e,t,n){const r=this;return i;function i(s){return e.exit(\"chunkContent\"),e.enter(\"lineEnding\"),e.consume(s),e.exit(\"lineEnding\"),B(e,a,\"linePrefix\")}function a(s){if(s===null||$(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(\"codeIndented\")&&o&&o[1].type===\"linePrefix\"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function Ci(e,t,n,r,i,a,s,o,u){const l=u||Number.POSITIVE_INFINITY;let f=0;return c;function c(b){return b===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(b),e.exit(a),p):b===null||b===32||b===41||ln(b)?n(b):(e.enter(r),e.enter(s),e.enter(o),e.enter(\"chunkString\",{contentType:\"string\"}),w(b))}function p(b){return b===62?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter(\"chunkString\",{contentType:\"string\"}),h(b))}function h(b){return b===62?(e.exit(\"chunkString\"),e.exit(o),p(b)):b===null||b===60||$(b)?n(b):(e.consume(b),b===92?_:h)}function _(b){return b===60||b===62||b===92?(e.consume(b),h):h(b)}function w(b){return!f&&(b===null||b===41||ee(b))?(e.exit(\"chunkString\"),e.exit(o),e.exit(s),e.exit(r),t(b)):f<l&&b===40?(e.consume(b),f++,w):b===41?(e.consume(b),f--,w):b===null||b===32||b===40||ln(b)?n(b):(e.consume(b),b===92?I:w)}function I(b){return b===40||b===41||b===92?(e.consume(b),w):w(b)}}function Ii(e,t,n,r,i,a){const s=this;let o=0,u;return l;function l(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(a),f}function f(h){return o>999||h===null||h===91||h===93&&!u||h===94&&!o&&\"_hiddenFootnoteSupport\"in s.parser.constructs?n(h):h===93?(e.exit(a),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):$(h)?(e.enter(\"lineEnding\"),e.consume(h),e.exit(\"lineEnding\"),f):(e.enter(\"chunkString\",{contentType:\"string\"}),c(h))}function c(h){return h===null||h===91||h===93||$(h)||o++>999?(e.exit(\"chunkString\"),f(h)):(e.consume(h),u||(u=!O(h)),h===92?p:c)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,c):c(h)}}function Ai(e,t,n,r,i,a){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),s=p===40?41:p,u):n(p)}function u(p){return p===s?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(a),l(p))}function l(p){return p===s?(e.exit(a),u(s)):p===null?n(p):$(p)?(e.enter(\"lineEnding\"),e.consume(p),e.exit(\"lineEnding\"),B(e,l,\"linePrefix\")):(e.enter(\"chunkString\",{contentType:\"string\"}),f(p))}function f(p){return p===s||p===null||$(p)?(e.exit(\"chunkString\"),l(p)):(e.consume(p),p===92?c:f)}function c(p){return p===s||p===92?(e.consume(p),f):f(p)}}function Ze(e,t){let n;return r;function r(i){return $(i)?(e.enter(\"lineEnding\"),e.consume(i),e.exit(\"lineEnding\"),n=!0,r):O(i)?B(e,r,n?\"linePrefix\":\"lineSuffix\")(i):t(i)}}const $l={name:\"definition\",tokenize:Fl},zl={partial:!0,tokenize:Ol};function Fl(e,t,n){const r=this;let i;return a;function a(h){return e.enter(\"definition\"),s(h)}function s(h){return Ii.call(r,e,o,n,\"definitionLabel\",\"definitionLabelMarker\",\"definitionLabelString\")(h)}function o(h){return i=rt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter(\"definitionMarker\"),e.consume(h),e.exit(\"definitionMarker\"),u):n(h)}function u(h){return ee(h)?Ze(e,l)(h):l(h)}function l(h){return Ci(e,f,n,\"definitionDestination\",\"definitionDestinationLiteral\",\"definitionDestinationLiteralMarker\",\"definitionDestinationRaw\",\"definitionDestinationString\")(h)}function f(h){return e.attempt(zl,c,c)(h)}function c(h){return O(h)?B(e,p,\"whitespace\")(h):p(h)}function p(h){return h===null||$(h)?(e.exit(\"definition\"),r.parser.defined.push(i),t(h)):n(h)}}function Ol(e,t,n){return r;function r(o){return ee(o)?Ze(e,i)(o):n(o)}function i(o){return Ai(e,a,n,\"definitionTitle\",\"definitionTitleMarker\",\"definitionTitleString\")(o)}function a(o){return O(o)?B(e,s,\"whitespace\")(o):s(o)}function s(o){return o===null||$(o)?t(o):n(o)}}const Rl={name:\"hardBreakEscape\",tokenize:Ll};function Ll(e,t,n){return r;function r(a){return e.enter(\"hardBreakEscape\"),e.consume(a),i}function i(a){return $(a)?(e.exit(\"hardBreakEscape\"),t(a)):n(a)}}const Ml={name:\"headingAtx\",resolve:Bl,tokenize:Vl};function Bl(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===\"whitespace\"&&(r+=2),n-2>r&&e[n][1].type===\"whitespace\"&&(n-=2),e[n][1].type===\"atxHeadingSequence\"&&(r===n-1||n-4>r&&e[n-2][1].type===\"whitespace\")&&(n-=r+1===n?2:4),n>r&&(i={type:\"atxHeadingText\",start:e[r][1].start,end:e[n][1].end},a={type:\"chunkText\",start:e[r][1].start,end:e[n][1].end,contentType:\"text\"},ae(e,r,n-r+1,[[\"enter\",i,t],[\"enter\",a,t],[\"exit\",a,t],[\"exit\",i,t]])),e}function Vl(e,t,n){let r=0;return i;function i(f){return e.enter(\"atxHeading\"),a(f)}function a(f){return e.enter(\"atxHeadingSequence\"),s(f)}function s(f){return f===35&&r++<6?(e.consume(f),s):f===null||ee(f)?(e.exit(\"atxHeadingSequence\"),o(f)):n(f)}function o(f){return f===35?(e.enter(\"atxHeadingSequence\"),u(f)):f===null||$(f)?(e.exit(\"atxHeading\"),t(f)):O(f)?B(e,o,\"whitespace\")(f):(e.enter(\"atxHeadingText\"),l(f))}function u(f){return f===35?(e.consume(f),u):(e.exit(\"atxHeadingSequence\"),o(f))}function l(f){return f===null||f===35||ee(f)?(e.exit(\"atxHeadingText\"),o(f)):(e.consume(f),l)}}const Hl=[\"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\",\"search\",\"section\",\"summary\",\"table\",\"tbody\",\"td\",\"tfoot\",\"th\",\"thead\",\"title\",\"tr\",\"track\",\"ul\"],yr=[\"pre\",\"script\",\"style\",\"textarea\"],Ul={concrete:!0,name:\"htmlFlow\",resolveTo:jl,tokenize:Ql},ql={partial:!0,tokenize:Gl},Wl={partial:!0,tokenize:Kl};function jl(e){let t=e.length;for(;t--&&!(e[t][0]===\"enter\"&&e[t][1].type===\"htmlFlow\"););return t>1&&e[t-2][1].type===\"linePrefix\"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Ql(e,t,n){const r=this;let i,a,s,o,u;return l;function l(d){return f(d)}function f(d){return e.enter(\"htmlFlow\"),e.enter(\"htmlFlowData\"),e.consume(d),c}function c(d){return d===33?(e.consume(d),p):d===47?(e.consume(d),a=!0,w):d===63?(e.consume(d),i=3,r.interrupt?t:m):ge(d)?(e.consume(d),s=String.fromCharCode(d),I):n(d)}function p(d){return d===45?(e.consume(d),i=2,h):d===91?(e.consume(d),i=5,o=0,_):ge(d)?(e.consume(d),i=4,r.interrupt?t:m):n(d)}function h(d){return d===45?(e.consume(d),r.interrupt?t:m):n(d)}function _(d){const V=\"CDATA[\";return d===V.charCodeAt(o++)?(e.consume(d),o===V.length?r.interrupt?t:N:_):n(d)}function w(d){return ge(d)?(e.consume(d),s=String.fromCharCode(d),I):n(d)}function I(d){if(d===null||d===47||d===62||ee(d)){const V=d===47,te=s.toLowerCase();return!V&&!a&&yr.includes(te)?(i=1,r.interrupt?t(d):N(d)):Hl.includes(s.toLowerCase())?(i=6,V?(e.consume(d),b):r.interrupt?t(d):N(d)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(d):a?v(d):S(d))}return d===45||ie(d)?(e.consume(d),s+=String.fromCharCode(d),I):n(d)}function b(d){return d===62?(e.consume(d),r.interrupt?t:N):n(d)}function v(d){return O(d)?(e.consume(d),v):y(d)}function S(d){return d===47?(e.consume(d),y):d===58||d===95||ge(d)?(e.consume(d),z):O(d)?(e.consume(d),S):y(d)}function z(d){return d===45||d===46||d===58||d===95||ie(d)?(e.consume(d),z):E(d)}function E(d){return d===61?(e.consume(d),x):O(d)?(e.consume(d),E):S(d)}function x(d){return d===null||d===60||d===61||d===62||d===96?n(d):d===34||d===39?(e.consume(d),u=d,P):O(d)?(e.consume(d),x):M(d)}function P(d){return d===u?(e.consume(d),u=null,L):d===null||$(d)?n(d):(e.consume(d),P)}function M(d){return d===null||d===34||d===39||d===47||d===60||d===61||d===62||d===96||ee(d)?E(d):(e.consume(d),M)}function L(d){return d===47||d===62||O(d)?S(d):n(d)}function y(d){return d===62?(e.consume(d),T):n(d)}function T(d){return d===null||$(d)?N(d):O(d)?(e.consume(d),T):n(d)}function N(d){return d===45&&i===2?(e.consume(d),G):d===60&&i===1?(e.consume(d),K):d===62&&i===4?(e.consume(d),A):d===63&&i===3?(e.consume(d),m):d===93&&i===5?(e.consume(d),ce):$(d)&&(i===6||i===7)?(e.exit(\"htmlFlowData\"),e.check(ql,q,H)(d)):d===null||$(d)?(e.exit(\"htmlFlowData\"),H(d)):(e.consume(d),N)}function H(d){return e.check(Wl,U,q)(d)}function U(d){return e.enter(\"lineEnding\"),e.consume(d),e.exit(\"lineEnding\"),R}function R(d){return d===null||$(d)?H(d):(e.enter(\"htmlFlowData\"),N(d))}function G(d){return d===45?(e.consume(d),m):N(d)}function K(d){return d===47?(e.consume(d),s=\"\",re):N(d)}function re(d){if(d===62){const V=s.toLowerCase();return yr.includes(V)?(e.consume(d),A):N(d)}return ge(d)&&s.length<8?(e.consume(d),s+=String.fromCharCode(d),re):N(d)}function ce(d){return d===93?(e.consume(d),m):N(d)}function m(d){return d===62?(e.consume(d),A):d===45&&i===2?(e.consume(d),m):N(d)}function A(d){return d===null||$(d)?(e.exit(\"htmlFlowData\"),q(d)):(e.consume(d),A)}function q(d){return e.exit(\"htmlFlow\"),t(d)}}function Kl(e,t,n){const r=this;return i;function i(s){return $(s)?(e.enter(\"lineEnding\"),e.consume(s),e.exit(\"lineEnding\"),a):n(s)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Gl(e,t,n){return r;function r(i){return e.enter(\"lineEnding\"),e.consume(i),e.exit(\"lineEnding\"),e.attempt(zt,t,n)}}const Yl={name:\"htmlText\",tokenize:Zl};function Zl(e,t,n){const r=this;let i,a,s;return o;function o(m){return e.enter(\"htmlText\"),e.enter(\"htmlTextData\"),e.consume(m),u}function u(m){return m===33?(e.consume(m),l):m===47?(e.consume(m),E):m===63?(e.consume(m),S):ge(m)?(e.consume(m),M):n(m)}function l(m){return m===45?(e.consume(m),f):m===91?(e.consume(m),a=0,_):ge(m)?(e.consume(m),v):n(m)}function f(m){return m===45?(e.consume(m),h):n(m)}function c(m){return m===null?n(m):m===45?(e.consume(m),p):$(m)?(s=c,K(m)):(e.consume(m),c)}function p(m){return m===45?(e.consume(m),h):c(m)}function h(m){return m===62?G(m):m===45?p(m):c(m)}function _(m){const A=\"CDATA[\";return m===A.charCodeAt(a++)?(e.consume(m),a===A.length?w:_):n(m)}function w(m){return m===null?n(m):m===93?(e.consume(m),I):$(m)?(s=w,K(m)):(e.consume(m),w)}function I(m){return m===93?(e.consume(m),b):w(m)}function b(m){return m===62?G(m):m===93?(e.consume(m),b):w(m)}function v(m){return m===null||m===62?G(m):$(m)?(s=v,K(m)):(e.consume(m),v)}function S(m){return m===null?n(m):m===63?(e.consume(m),z):$(m)?(s=S,K(m)):(e.consume(m),S)}function z(m){return m===62?G(m):S(m)}function E(m){return ge(m)?(e.consume(m),x):n(m)}function x(m){return m===45||ie(m)?(e.consume(m),x):P(m)}function P(m){return $(m)?(s=P,K(m)):O(m)?(e.consume(m),P):G(m)}function M(m){return m===45||ie(m)?(e.consume(m),M):m===47||m===62||ee(m)?L(m):n(m)}function L(m){return m===47?(e.consume(m),G):m===58||m===95||ge(m)?(e.consume(m),y):$(m)?(s=L,K(m)):O(m)?(e.consume(m),L):G(m)}function y(m){return m===45||m===46||m===58||m===95||ie(m)?(e.consume(m),y):T(m)}function T(m){return m===61?(e.consume(m),N):$(m)?(s=T,K(m)):O(m)?(e.consume(m),T):L(m)}function N(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,H):$(m)?(s=N,K(m)):O(m)?(e.consume(m),N):(e.consume(m),U)}function H(m){return m===i?(e.consume(m),i=void 0,R):m===null?n(m):$(m)?(s=H,K(m)):(e.consume(m),H)}function U(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||ee(m)?L(m):(e.consume(m),U)}function R(m){return m===47||m===62||ee(m)?L(m):n(m)}function G(m){return m===62?(e.consume(m),e.exit(\"htmlTextData\"),e.exit(\"htmlText\"),t):n(m)}function K(m){return e.exit(\"htmlTextData\"),e.enter(\"lineEnding\"),e.consume(m),e.exit(\"lineEnding\"),re}function re(m){return O(m)?B(e,ce,\"linePrefix\",r.parser.constructs.disable.null.includes(\"codeIndented\")?void 0:4)(m):ce(m)}function ce(m){return e.enter(\"htmlTextData\"),s(m)}}const Sn={name:\"labelEnd\",resolveAll:tu,resolveTo:nu,tokenize:ru},Jl={tokenize:iu},Xl={tokenize:au},eu={tokenize:su};function tu(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type===\"labelImage\"||r.type===\"labelLink\"||r.type===\"labelEnd\"){const i=r.type===\"labelImage\"?4:2;r.type=\"data\",t+=i}}return e.length!==n.length&&ae(e,0,e.length,n),e}function nu(e,t){let n=e.length,r=0,i,a,s,o;for(;n--;)if(i=e[n][1],a){if(i.type===\"link\"||i.type===\"labelLink\"&&i._inactive)break;e[n][0]===\"enter\"&&i.type===\"labelLink\"&&(i._inactive=!0)}else if(s){if(e[n][0]===\"enter\"&&(i.type===\"labelImage\"||i.type===\"labelLink\")&&!i._balanced&&(a=n,i.type!==\"labelLink\")){r=2;break}}else i.type===\"labelEnd\"&&(s=n);const u={type:e[a][1].type===\"labelLink\"?\"link\":\"image\",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:\"label\",start:{...e[a][1].start},end:{...e[s][1].end}},f={type:\"labelText\",start:{...e[a+r+2][1].end},end:{...e[s-2][1].start}};return o=[[\"enter\",u,t],[\"enter\",l,t]],o=X(o,e.slice(a+1,a+r+3)),o=X(o,[[\"enter\",f,t]]),o=X(o,$t(t.parser.constructs.insideSpan.null,e.slice(a+r+4,s-3),t)),o=X(o,[[\"exit\",f,t],e[s-2],e[s-1],[\"exit\",l,t]]),o=X(o,e.slice(s+1)),o=X(o,[[\"exit\",u,t]]),ae(e,a,e.length,o),e}function ru(e,t,n){const r=this;let i=r.events.length,a,s;for(;i--;)if((r.events[i][1].type===\"labelImage\"||r.events[i][1].type===\"labelLink\")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return o;function o(p){return a?a._inactive?c(p):(s=r.parser.defined.includes(rt(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(\"labelEnd\"),e.enter(\"labelMarker\"),e.consume(p),e.exit(\"labelMarker\"),e.exit(\"labelEnd\"),u):n(p)}function u(p){return p===40?e.attempt(Jl,f,s?f:c)(p):p===91?e.attempt(Xl,f,s?l:c)(p):s?f(p):c(p)}function l(p){return e.attempt(eu,f,c)(p)}function f(p){return t(p)}function c(p){return a._balanced=!0,n(p)}}function iu(e,t,n){return r;function r(c){return e.enter(\"resource\"),e.enter(\"resourceMarker\"),e.consume(c),e.exit(\"resourceMarker\"),i}function i(c){return ee(c)?Ze(e,a)(c):a(c)}function a(c){return c===41?f(c):Ci(e,s,o,\"resourceDestination\",\"resourceDestinationLiteral\",\"resourceDestinationLiteralMarker\",\"resourceDestinationRaw\",\"resourceDestinationString\",32)(c)}function s(c){return ee(c)?Ze(e,u)(c):f(c)}function o(c){return n(c)}function u(c){return c===34||c===39||c===40?Ai(e,l,n,\"resourceTitle\",\"resourceTitleMarker\",\"resourceTitleString\")(c):f(c)}function l(c){return ee(c)?Ze(e,f)(c):f(c)}function f(c){return c===41?(e.enter(\"resourceMarker\"),e.consume(c),e.exit(\"resourceMarker\"),e.exit(\"resource\"),t):n(c)}}function au(e,t,n){const r=this;return i;function i(o){return Ii.call(r,e,a,s,\"reference\",\"referenceMarker\",\"referenceString\")(o)}function a(o){return r.parser.defined.includes(rt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function su(e,t,n){return r;function r(a){return e.enter(\"reference\"),e.enter(\"referenceMarker\"),e.consume(a),e.exit(\"referenceMarker\"),i}function i(a){return a===93?(e.enter(\"referenceMarker\"),e.consume(a),e.exit(\"referenceMarker\"),e.exit(\"reference\"),t):n(a)}}const ou={name:\"labelStartImage\",resolveAll:Sn.resolveAll,tokenize:lu};function lu(e,t,n){const r=this;return i;function i(o){return e.enter(\"labelImage\"),e.enter(\"labelImageMarker\"),e.consume(o),e.exit(\"labelImageMarker\"),a}function a(o){return o===91?(e.enter(\"labelMarker\"),e.consume(o),e.exit(\"labelMarker\"),e.exit(\"labelImage\"),s):n(o)}function s(o){return o===94&&\"_hiddenFootnoteSupport\"in r.parser.constructs?n(o):t(o)}}const uu={name:\"labelStartLink\",resolveAll:Sn.resolveAll,tokenize:cu};function cu(e,t,n){const r=this;return i;function i(s){return e.enter(\"labelLink\"),e.enter(\"labelMarker\"),e.consume(s),e.exit(\"labelMarker\"),e.exit(\"labelLink\"),a}function a(s){return s===94&&\"_hiddenFootnoteSupport\"in r.parser.constructs?n(s):t(s)}}const Ut={name:\"lineEnding\",tokenize:fu};function fu(e,t){return n;function n(r){return e.enter(\"lineEnding\"),e.consume(r),e.exit(\"lineEnding\"),B(e,t,\"linePrefix\")}}const _t={name:\"thematicBreak\",tokenize:hu};function hu(e,t,n){let r=0,i;return a;function a(l){return e.enter(\"thematicBreak\"),s(l)}function s(l){return i=l,o(l)}function o(l){return l===i?(e.enter(\"thematicBreakSequence\"),u(l)):r>=3&&(l===null||$(l))?(e.exit(\"thematicBreak\"),t(l)):n(l)}function u(l){return l===i?(e.consume(l),r++,u):(e.exit(\"thematicBreakSequence\"),O(l)?B(e,o,\"whitespace\")(l):o(l))}}const ne={continuation:{tokenize:gu},exit:yu,name:\"list\",tokenize:mu},pu={partial:!0,tokenize:bu},du={partial:!0,tokenize:_u};function mu(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type===\"linePrefix\"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(h){const _=r.containerState.type||(h===42||h===43||h===45?\"listUnordered\":\"listOrdered\");if(_===\"listUnordered\"?!r.containerState.marker||h===r.containerState.marker:un(h)){if(r.containerState.type||(r.containerState.type=_,e.enter(_,{_container:!0})),_===\"listUnordered\")return e.enter(\"listItemPrefix\"),h===42||h===45?e.check(_t,n,l)(h):l(h);if(!r.interrupt||h===49)return e.enter(\"listItemPrefix\"),e.enter(\"listItemValue\"),u(h)}return n(h)}function u(h){return un(h)&&++s<10?(e.consume(h),u):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit(\"listItemValue\"),l(h)):n(h)}function l(h){return e.enter(\"listItemMarker\"),e.consume(h),e.exit(\"listItemMarker\"),r.containerState.marker=r.containerState.marker||h,e.check(zt,r.interrupt?n:f,e.attempt(pu,p,c))}function f(h){return r.containerState.initialBlankLine=!0,a++,p(h)}function c(h){return O(h)?(e.enter(\"listItemPrefixWhitespace\"),e.consume(h),e.exit(\"listItemPrefixWhitespace\"),p):n(h)}function p(h){return r.containerState.size=a+r.sliceSerialize(e.exit(\"listItemPrefix\"),!0).length,t(h)}}function gu(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(zt,i,a);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,B(e,t,\"listItemIndent\",r.containerState.size+1)(o)}function a(o){return r.containerState.furtherBlankLines||!O(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(du,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,B(e,e.attempt(ne,t,n),\"linePrefix\",r.parser.constructs.disable.null.includes(\"codeIndented\")?void 0:4)(o)}}function _u(e,t,n){const r=this;return B(e,i,\"listItemIndent\",r.containerState.size+1);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type===\"listItemIndent\"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(a):n(a)}}function yu(e){e.exit(this.containerState.type)}function bu(e,t,n){const r=this;return B(e,i,\"listItemPrefixWhitespace\",r.parser.constructs.disable.null.includes(\"codeIndented\")?void 0:5);function i(a){const s=r.events[r.events.length-1];return!O(a)&&s&&s[1].type===\"listItemPrefixWhitespace\"?t(a):n(a)}}const br={name:\"setextUnderline\",resolveTo:xu,tokenize:vu};function xu(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===\"enter\"){if(e[n][1].type===\"content\"){r=n;break}e[n][1].type===\"paragraph\"&&(i=n)}else e[n][1].type===\"content\"&&e.splice(n,1),!a&&e[n][1].type===\"definition\"&&(a=n);const s={type:\"setextHeading\",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=\"setextHeadingText\",a?(e.splice(i,0,[\"enter\",s,t]),e.splice(a+1,0,[\"exit\",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=s,e.push([\"exit\",s,t]),e}function vu(e,t,n){const r=this;let i;return a;function a(l){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!==\"lineEnding\"&&r.events[f][1].type!==\"linePrefix\"&&r.events[f][1].type!==\"content\"){c=r.events[f][1].type===\"paragraph\";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter(\"setextHeadingLine\"),i=l,s(l)):n(l)}function s(l){return e.enter(\"setextHeadingLineSequence\"),o(l)}function o(l){return l===i?(e.consume(l),o):(e.exit(\"setextHeadingLineSequence\"),O(l)?B(e,u,\"lineSuffix\")(l):u(l))}function u(l){return l===null||$(l)?(e.exit(\"setextHeadingLine\"),t(l)):n(l)}}const wu={tokenize:ku};function ku(e){const t=this,n=e.attempt(zt,r,e.attempt(this.parser.constructs.flowInitial,i,B(e,e.attempt(this.parser.constructs.flow,i,e.attempt(El,i)),\"linePrefix\")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter(\"lineEndingBlank\"),e.consume(a),e.exit(\"lineEndingBlank\"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter(\"lineEnding\"),e.consume(a),e.exit(\"lineEnding\"),t.currentConstruct=void 0,n}}const Su={resolveAll:Ti()},Cu=Ei(\"string\"),Iu=Ei(\"text\");function Ei(e){return{resolveAll:Ti(e===\"text\"?Au:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,s,o);return s;function s(f){return l(f)?a(f):o(f)}function o(f){if(f===null){n.consume(f);return}return n.enter(\"data\"),n.consume(f),u}function u(f){return l(f)?(n.exit(\"data\"),a(f)):(n.consume(f),u)}function l(f){if(f===null)return!0;const c=i[f];let p=-1;if(c)for(;++p<c.length;){const h=c[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Ti(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type===\"data\"&&(a=i,i++):(!n[i]||n[i][1].type!==\"data\")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function Au(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===\"lineEnding\")&&e[n-1][1].type===\"data\"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,s=-1,o=0,u;for(;a--;){const l=i[a];if(typeof l==\"string\"){for(s=l.length;l.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(l===-2)u=!0,o++;else if(l!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const l={type:n===e.length||u||o<2?\"lineSuffix\":\"hardBreakTrailing\",start:{_bufferIndex:a?s:r.start._bufferIndex+s,_index:r.start._index+a,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...l.start},r.start.offset===r.end.offset?Object.assign(r,l):(e.splice(n,0,[\"enter\",l,t],[\"exit\",l,t]),n+=2)}n++}return e}const Eu={42:ne,43:ne,45:ne,48:ne,49:ne,50:ne,51:ne,52:ne,53:ne,54:ne,55:ne,56:ne,57:ne,62:vi},Tu={91:$l},Pu={[-2]:Ht,[-1]:Ht,32:Ht},Nu={35:Ml,42:_t,45:[br,_t],60:Ul,61:br,95:_t,96:_r,126:_r},Du={38:ki,92:wi},$u={[-5]:Ut,[-4]:Ut,[-3]:Ut,33:ou,38:ki,42:cn,60:[ul,Yl],91:uu,92:[Rl,wi],93:Sn,95:cn,96:wl},zu={null:[cn,Su]},Fu={null:[42,95]},Ou={null:[]},Ru=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Fu,contentInitial:Tu,disable:Ou,document:Eu,flow:Nu,flowInitial:Pu,insideSpan:zu,string:Du,text:$u},Symbol.toStringTag,{value:\"Module\"}));function Lu(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let s=[],o=[];const u={attempt:P(E),check:P(x),consume:v,enter:S,exit:z,interrupt:P(x,{interrupt:!0})},l={code:null,containerState:{},defineSkip:w,events:[],now:_,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:c};let f=t.tokenize.call(l,u);return t.resolveAll&&a.push(t),l;function c(T){return s=X(s,T),I(),s[s.length-1]!==null?[]:(M(t,0),l.events=$t(a,l.events,l),l.events)}function p(T,N){return Bu(h(T),N)}function h(T){return Mu(s,T)}function _(){const{_bufferIndex:T,_index:N,line:H,column:U,offset:R}=r;return{_bufferIndex:T,_index:N,line:H,column:U,offset:R}}function w(T){i[T.line]=T.column,y()}function I(){let T;for(;r._index<s.length;){const N=s[r._index];if(typeof N==\"string\")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<N.length;)b(N.charCodeAt(r._bufferIndex));else b(N)}}function b(T){f=f(T)}function v(T){$(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,y()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=T}function S(T,N){const H=N||{};return H.type=T,H.start=_(),l.events.push([\"enter\",H,l]),o.push(H),H}function z(T){const N=o.pop();return N.end=_(),l.events.push([\"exit\",N,l]),N}function E(T,N){M(T,N.from)}function x(T,N){N.restore()}function P(T,N){return H;function H(U,R,G){let K,re,ce,m;return Array.isArray(U)?q(U):\"tokenize\"in U?q([U]):A(U);function A(Z){return We;function We(ke){const Oe=ke!==null&&Z[ke],Re=ke!==null&&Z.null,Ft=[...Array.isArray(Oe)?Oe:Oe?[Oe]:[],...Array.isArray(Re)?Re:Re?[Re]:[]];return q(Ft)(ke)}}function q(Z){return K=Z,re=0,Z.length===0?G:d(Z[re])}function d(Z){return We;function We(ke){return m=L(),ce=Z,Z.partial||(l.currentConstruct=Z),Z.name&&l.parser.constructs.disable.null.includes(Z.name)?te():Z.tokenize.call(N?Object.assign(Object.create(l),N):l,u,V,te)(ke)}}function V(Z){return T(ce,m),R}function te(Z){return m.restore(),++re<K.length?d(K[re]):G}}}function M(T,N){T.resolveAll&&!a.includes(T)&&a.push(T),T.resolve&&ae(l.events,N,l.events.length-N,T.resolve(l.events.slice(N),l)),T.resolveTo&&(l.events=T.resolveTo(l.events,l))}function L(){const T=_(),N=l.previous,H=l.currentConstruct,U=l.events.length,R=Array.from(o);return{from:U,restore:G};function G(){r=T,l.previous=N,l.currentConstruct=H,l.events.length=U,o=R,y()}}function y(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Mu(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,a)];else{if(s=e.slice(n,i),r>-1){const o=s[0];typeof o==\"string\"?s[0]=o.slice(r):s.shift()}a>0&&s.push(e[i].slice(0,a))}return s}function Bu(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let s;if(typeof a==\"string\")s=a;else switch(a){case-5:{s=\"\\r\";break}case-4:{s=`\n`;break}case-3:{s=`\\r\n`;break}case-2:{s=t?\" \":\"\t\";break}case-1:{if(!t&&i)continue;s=\" \";break}default:s=String.fromCharCode(a)}i=a===-2,r.push(s)}return r.join(\"\")}function Vu(e){const r={constructs:Vo([Ru,...(e||{}).extensions||[]]),content:i(nl),defined:[],document:i(il),flow:i(wu),lazy:{},string:i(Cu),text:i(Iu)};return r;function i(a){return s;function s(o){return Lu(r,a,o)}}}function Hu(e){for(;!Si(e););return e}const xr=/[\\0\\t\\n\\r]/g;function Uu(){let e=1,t=\"\",n=!0,r;return i;function i(a,s,o){const u=[];let l,f,c,p,h;for(a=t+(typeof a==\"string\"?a.toString():new TextDecoder(s||void 0).decode(a)),c=0,t=\"\",n&&(a.charCodeAt(0)===65279&&c++,n=void 0);c<a.length;){if(xr.lastIndex=c,l=xr.exec(a),p=l&&l.index!==void 0?l.index:a.length,h=a.charCodeAt(p),!l){t=a.slice(c);break}if(h===10&&c===p&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),c<p&&(u.push(a.slice(c,p)),e+=p-c),h){case 0:{u.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,u.push(-2);e++<f;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}c=p+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}function qu(e,t,n){return typeof t!=\"string\"&&(n=t,t=void 0),tl(n)(Hu(Vu(n).document().write(Uu()(e,t,!0))))}const qt={none:\"\",left:' align=\"left\"',right:' align=\"right\"',center:' align=\"center\"'};function Wu(){return{enter:{table(e){const t=e._align;this.lineEndingIfNeeded(),this.tag(\"<table>\"),this.setData(\"tableAlign\",t)},tableBody(){this.tag(\"<tbody>\")},tableData(){const e=this.getData(\"tableAlign\"),t=this.getData(\"tableColumn\"),n=qt[e[t]];n===void 0?this.buffer():(this.lineEndingIfNeeded(),this.tag(\"<td\"+n+\">\"))},tableHead(){this.lineEndingIfNeeded(),this.tag(\"<thead>\")},tableHeader(){const e=this.getData(\"tableAlign\"),t=this.getData(\"tableColumn\"),n=qt[e[t]];this.lineEndingIfNeeded(),this.tag(\"<th\"+n+\">\")},tableRow(){this.setData(\"tableColumn\",0),this.lineEndingIfNeeded(),this.tag(\"<tr>\")}},exit:{codeTextData(e){let t=this.sliceSerialize(e);this.getData(\"tableAlign\")&&(t=t.replace(/\\\\([\\\\|])/g,ju)),this.raw(this.encode(t))},table(){this.setData(\"tableAlign\"),this.setData(\"slurpAllLineEndings\"),this.lineEndingIfNeeded(),this.tag(\"</table>\")},tableBody(){this.lineEndingIfNeeded(),this.tag(\"</tbody>\")},tableData(){const e=this.getData(\"tableAlign\"),t=this.getData(\"tableColumn\");t in e?(this.tag(\"</td>\"),this.setData(\"tableColumn\",t+1)):this.resume()},tableHead(){this.lineEndingIfNeeded(),this.tag(\"</thead>\")},tableHeader(){const e=this.getData(\"tableColumn\");this.tag(\"</th>\"),this.setData(\"tableColumn\",e+1)},tableRow(){const e=this.getData(\"tableAlign\");let t=this.getData(\"tableColumn\");for(;t<e.length;)this.lineEndingIfNeeded(),this.tag(\"<td\"+qt[e[t]]+\"></td>\"),t++;this.setData(\"tableColumn\",t),this.lineEndingIfNeeded(),this.tag(\"</tr>\")}}}}function ju(e,t){return t===\"|\"?t:e}class Qu{constructor(){this.map=[]}add(t,n,r){Ku(this,t,n,r)}consume(t){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const a of i)t.push(a);i=r.pop()}this.map.length=0}}function Ku(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Gu(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]===\"enter\")i[1].type===\"tableContent\"&&r.push(e[t+1][1].type===\"tableDelimiterMarker\"?\"left\":\"none\");else if(i[1].type===\"tableContent\"){if(e[t-1][1].type===\"tableDelimiterMarker\"){const a=r.length-1;r[a]=r[a]===\"left\"?\"center\":\"right\"}}else if(i[1].type===\"tableDelimiterRow\")break}else i[0]===\"enter\"&&i[1].type===\"tableDelimiterRow\"&&(n=!0);t+=1}return r}function Yu(){return{flow:{null:{name:\"table\",tokenize:Zu,resolveAll:Ju}}}}function Zu(e,t,n){const r=this;let i=0,a=0,s;return o;function o(y){let T=r.events.length-1;for(;T>-1;){const U=r.events[T][1].type;if(U===\"lineEnding\"||U===\"linePrefix\")T--;else break}const N=T>-1?r.events[T][1].type:null,H=N===\"tableHead\"||N===\"tableRow\"?x:u;return H===x&&r.parser.lazy[r.now().line]?n(y):H(y)}function u(y){return e.enter(\"tableHead\"),e.enter(\"tableRow\"),l(y)}function l(y){return y===124||(s=!0,a+=1),f(y)}function f(y){return y===null?n(y):$(y)?a>1?(a=0,r.interrupt=!0,e.exit(\"tableRow\"),e.enter(\"lineEnding\"),e.consume(y),e.exit(\"lineEnding\"),h):n(y):O(y)?B(e,f,\"whitespace\")(y):(a+=1,s&&(s=!1,i+=1),y===124?(e.enter(\"tableCellDivider\"),e.consume(y),e.exit(\"tableCellDivider\"),s=!0,f):(e.enter(\"data\"),c(y)))}function c(y){return y===null||y===124||ee(y)?(e.exit(\"data\"),f(y)):(e.consume(y),y===92?p:c)}function p(y){return y===92||y===124?(e.consume(y),c):c(y)}function h(y){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(y):(e.enter(\"tableDelimiterRow\"),s=!1,O(y)?B(e,_,\"linePrefix\",r.parser.constructs.disable.null.includes(\"codeIndented\")?void 0:4)(y):_(y))}function _(y){return y===45||y===58?I(y):y===124?(s=!0,e.enter(\"tableCellDivider\"),e.consume(y),e.exit(\"tableCellDivider\"),w):E(y)}function w(y){return O(y)?B(e,I,\"whitespace\")(y):I(y)}function I(y){return y===58?(a+=1,s=!0,e.enter(\"tableDelimiterMarker\"),e.consume(y),e.exit(\"tableDelimiterMarker\"),b):y===45?(a+=1,b(y)):y===null||$(y)?z(y):E(y)}function b(y){return y===45?(e.enter(\"tableDelimiterFiller\"),v(y)):E(y)}function v(y){return y===45?(e.consume(y),v):y===58?(s=!0,e.exit(\"tableDelimiterFiller\"),e.enter(\"tableDelimiterMarker\"),e.consume(y),e.exit(\"tableDelimiterMarker\"),S):(e.exit(\"tableDelimiterFiller\"),S(y))}function S(y){return O(y)?B(e,z,\"whitespace\")(y):z(y)}function z(y){return y===124?_(y):y===null||$(y)?!s||i!==a?E(y):(e.exit(\"tableDelimiterRow\"),e.exit(\"tableHead\"),t(y)):E(y)}function E(y){return n(y)}function x(y){return e.enter(\"tableRow\"),P(y)}function P(y){return y===124?(e.enter(\"tableCellDivider\"),e.consume(y),e.exit(\"tableCellDivider\"),P):y===null||$(y)?(e.exit(\"tableRow\"),t(y)):O(y)?B(e,P,\"whitespace\")(y):(e.enter(\"data\"),M(y))}function M(y){return y===null||y===124||ee(y)?(e.exit(\"data\"),P(y)):(e.consume(y),y===92?L:M)}function L(y){return y===92||y===124?(e.consume(y),M):M(y)}}function Ju(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],o=!1,u=0,l,f,c;const p=new Qu;for(;++n<e.length;){const h=e[n],_=h[1];h[0]===\"enter\"?_.type===\"tableHead\"?(o=!1,u!==0&&(vr(p,t,u,l,f),f=void 0,u=0),l={type:\"table\",start:Object.assign({},_.start),end:Object.assign({},_.end)},p.add(n,0,[[\"enter\",l,t]])):_.type===\"tableRow\"||_.type===\"tableDelimiterRow\"?(r=!0,c=void 0,a=[0,0,0,0],s=[0,n+1,0,0],o&&(o=!1,f={type:\"tableBody\",start:Object.assign({},_.start),end:Object.assign({},_.end)},p.add(n,0,[[\"enter\",f,t]])),i=_.type===\"tableDelimiterRow\"?2:f?3:1):i&&(_.type===\"data\"||_.type===\"tableDelimiterMarker\"||_.type===\"tableDelimiterFiller\")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],c=dt(p,t,a,i,void 0,c),a=[0,0,0,0]),s[2]=n)):_.type===\"tableCellDivider\"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],c=dt(p,t,a,i,void 0,c)),a=s,s=[a[1],n,0,0])):_.type===\"tableHead\"?(o=!0,u=n):_.type===\"tableRow\"||_.type===\"tableDelimiterRow\"?(u=n,a[1]!==0?(s[0]=s[1],c=dt(p,t,a,i,n,c)):s[1]!==0&&(c=dt(p,t,s,i,n,c)),i=0):i&&(_.type===\"data\"||_.type===\"tableDelimiterMarker\"||_.type===\"tableDelimiterFiller\")&&(s[3]=n)}for(u!==0&&vr(p,t,u,l,f),p.consume(t.events),n=-1;++n<t.events.length;){const h=t.events[n];h[0]===\"enter\"&&h[1].type===\"table\"&&(h[1]._align=Gu(t.events,n))}return e}function dt(e,t,n,r,i,a){const s=r===1?\"tableHeader\":r===2?\"tableDelimiter\":\"tableData\",o=\"tableContent\";n[0]!==0&&(a.end=Object.assign({},Le(t.events,n[0])),e.add(n[0],0,[[\"exit\",a,t]]));const u=Le(t.events,n[1]);if(a={type:s,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[[\"enter\",a,t]]),n[2]!==0){const l=Le(t.events,n[2]),f=Le(t.events,n[3]),c={type:o,start:Object.assign({},l),end:Object.assign({},f)};if(e.add(n[2],0,[[\"enter\",c,t]]),r!==2){const p=t.events[n[2]],h=t.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type=\"chunkText\",p[1].contentType=\"text\",n[3]>n[2]+1){const _=n[2]+1,w=n[3]-n[2]-1;e.add(_,w,[])}}e.add(n[3]+1,0,[[\"exit\",c,t]])}return i!==void 0&&(a.end=Object.assign({},Le(t.events,i)),e.add(i,0,[[\"exit\",a,t]]),a=void 0),a}function vr(e,t,n,r,i){const a=[],s=Le(t.events,n);i&&(i.end=Object.assign({},s),a.push([\"exit\",i,t])),r.end=Object.assign({},s),a.push([\"exit\",r,t]),e.add(n+1,0,a)}function Le(e,t){const n=e[t],r=n[0]===\"enter\"?\"start\":\"end\";return n[1][r]}function Xu(){return{enter:{strikethrough(){this.tag(\"<del>\")}},exit:{strikethrough(){this.tag(\"</del>\")}}}}function ec(e){let n={}.singleTilde;const r={name:\"strikethrough\",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,o){let u=-1;for(;++u<s.length;)if(s[u][0]===\"enter\"&&s[u][1].type===\"strikethroughSequenceTemporary\"&&s[u][1]._close){let l=u;for(;l--;)if(s[l][0]===\"exit\"&&s[l][1].type===\"strikethroughSequenceTemporary\"&&s[l][1]._open&&s[u][1].end.offset-s[u][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[u][1].type=\"strikethroughSequence\",s[l][1].type=\"strikethroughSequence\";const f={type:\"strikethrough\",start:Object.assign({},s[l][1].start),end:Object.assign({},s[u][1].end)},c={type:\"strikethroughText\",start:Object.assign({},s[l][1].end),end:Object.assign({},s[u][1].start)},p=[[\"enter\",f,o],[\"enter\",s[l][1],o],[\"exit\",s[l][1],o],[\"enter\",c,o]],h=o.parser.constructs.insideSpan.null;h&&ae(p,p.length,0,$t(h,s.slice(l+1,u),o)),ae(p,p.length,0,[[\"exit\",c,o],[\"enter\",s[u][1],o],[\"exit\",s[u][1],o],[\"exit\",f,o]]),ae(s,l-1,u-l+3,p),u=l+p.length-2;break}}for(u=-1;++u<s.length;)s[u][1].type===\"strikethroughSequenceTemporary\"&&(s[u][1].type=\"data\");return s}function a(s,o,u){const l=this.previous,f=this.events;let c=0;return p;function p(_){return l===126&&f[f.length-1][1].type!==\"characterEscape\"?u(_):(s.enter(\"strikethroughSequenceTemporary\"),h(_))}function h(_){const w=Ct(l);if(_===126)return c>1?u(_):(s.consume(_),c++,h);if(c<2&&!n)return u(_);const I=s.exit(\"strikethroughSequenceTemporary\"),b=Ct(_);return I._open=!b||b===2&&!!w,I._close=!w||w===2&&!!b,o(_)}}}function tc(e){return qu(e,{allowDangerousHtml:!0,extensions:[Yu(),ec()],htmlExtensions:[Wu(),Xu()]})}const Fe=gn({});function nc(e,t){const n=document.createElement(\"div\");n.innerHTML=e.trim();const r=Array.from(n.childNodes).map((i,a)=>Pi(i,a,t));return g(Q,{children:r})}function Pi(e,t,n){if(e.nodeType===Node.TEXT_NODE)return e.textContent;if(e.nodeType===Node.ELEMENT_NODE){const r=e,i=r.tagName.toLowerCase(),a=r.getAttribute(\"data-tw\");if(a!=null)return n[parseInt(a,10)];const s={key:t};for(const u of Array.from(r.attributes))s[u.name]=u.value;const o=Array.from(r.childNodes).map((u,l)=>Pi(u,l,n));return pe(i,s,...o)}return null}function rc(e,t){switch(e.name){case\"set\":return g(Vs,{rawArgs:e.rawArgs},t);case\"computed\":return g(Lo,{rawArgs:e.rawArgs},t);case\"print\":return g(Hs,{rawArgs:e.rawArgs,className:e.className,id:e.id},t);case\"if\":return g(Us,{branches:e.branches},t);case\"for\":return g(Ws,{rawArgs:e.rawArgs,children:e.children,className:e.className,id:e.id},t);case\"do\":return g(Qs,{children:e.children},t);case\"button\":return g(Ks,{rawArgs:e.rawArgs,children:e.children,className:e.className,id:e.id},t);case\"story-title\":return g(Gs,{className:e.className,id:e.id},t);case\"back\":return g(Zs,{className:e.className,id:e.id},t);case\"forward\":return g(Js,{className:e.className,id:e.id},t);case\"restart\":return g(Ys,{className:e.className,id:e.id},t);case\"quicksave\":return g(Xs,{className:e.className,id:e.id},t);case\"quickload\":return g(eo,{className:e.className,id:e.id},t);case\"settings\":return g(io,{className:e.className,id:e.id},t);case\"saves\":return g(lo,{className:e.className,id:e.id},t);case\"include\":return g(uo,{rawArgs:e.rawArgs,className:e.className,id:e.id},t);case\"goto\":return g(co,{rawArgs:e.rawArgs},t);case\"unset\":return g(fo,{rawArgs:e.rawArgs},t);case\"textbox\":return g(po,{rawArgs:e.rawArgs,className:e.className,id:e.id},t);case\"numberbox\":return g(go,{rawArgs:e.rawArgs,className:e.className,id:e.id},t);case\"textarea\":return g(yo,{rawArgs:e.rawArgs,className:e.className,id:e.id},t);case\"checkbox\":return g(xo,{rawArgs:e.rawArgs,className:e.className,id:e.id},t);case\"radiobutton\":return g(wo,{rawArgs:e.rawArgs,className:e.className,id:e.id},t);case\"listbox\":return g(ko,{rawArgs:e.rawArgs,children:e.children,className:e.className,id:e.id},t);case\"cycle\":return g(So,{rawArgs:e.rawArgs,children:e.children,className:e.className,id:e.id},t);case\"link\":return g(Eo,{rawArgs:e.rawArgs,children:e.children,className:e.className,id:e.id},t);case\"switch\":return g(To,{rawArgs:e.rawArgs,branches:e.branches},t);case\"timed\":return g(Po,{rawArgs:e.rawArgs,children:e.children,branches:e.branches,className:e.className,id:e.id},t);case\"repeat\":return g(No,{rawArgs:e.rawArgs,children:e.children,className:e.className,id:e.id},t);case\"stop\":return g(Do,{},t);case\"type\":return g($o,{rawArgs:e.rawArgs,children:e.children,className:e.className,id:e.id},t);case\"widget\":return g(Fo,{rawArgs:e.rawArgs,children:e.children},t);case\"option\":case\"case\":case\"default\":case\"next\":return null;default:{const n=zo(e.name);if(n)return g(Q,{children:le(n)});const r=Bo(e.name);return r?g(r,{rawArgs:e.rawArgs,className:e.className,id:e.id,children:le(e.children)},t):g(\"span\",{class:\"error\",children:`{unknown macro: ${e.name}}`},t)}}}function fn(e,t){switch(e.type){case\"text\":return e.value;case\"link\":return g(Ms,{target:e.target,className:e.className,id:e.id,children:e.display},t);case\"variable\":return g(Bs,{name:e.name,scope:e.scope,className:e.className,id:e.id},t);case\"macro\":return rc(e,t);case\"html\":return pe(e.tag,{key:t,...e.attributes},e.children.length>0?le(e.children):void 0)}}function Ni(e){return e.length===0?null:e.map((t,n)=>fn(t,n))}function le(e){if(e.length===0)return null;if(!e.some(a=>a.type===\"text\"))return e.map((a,s)=>fn(a,s));const n=[];let r=\"\";for(let a=0;a<e.length;a++){const s=e[a];if(s.type===\"text\")r+=s.value;else{const o=n.length;n.push(fn(s,a)),r+=`<span data-tw=\"${o}\"></span>`}}const i=tc(r);return nc(i,n)}function ic({passage:e}){const t=qe(()=>{try{const n=ot(e.content),r=lt(n);return le(r)}catch(n){return g(\"div\",{class:\"error\",children:[\"Error parsing passage “\",e.name,\"”:\",\" \",n.message]})}},[e.content,e.name]);return g(\"div\",{class:\"passage\",\"data-passage\":e.name,\"data-tags\":e.tags.join(\" \"),children:t})}const ac=\"{story-title}{back}{forward}{restart}{quicksave}{quickload}{saves}{settings}\";function sc(){const t=C(i=>i.storyData)?.passages.get(\"StoryInterface\"),n=t!==void 0?t.content:ac,r=qe(()=>{try{const i=ot(n),a=lt(i);return le(a)}catch(i){return g(\"span\",{class:\"error\",children:[\"Error in StoryInterface: \",i.message]})}},[n]);return g(Q,{children:r})}function oc(){const e=C(r=>r.currentPassage),t=C(r=>r.storyData);if(be(()=>{const r=i=>{i.key===\"F6\"?(i.preventDefault(),C.getState().save()):i.key===\"F9\"&&(i.preventDefault(),C.getState().load())};return document.addEventListener(\"keydown\",r),()=>document.removeEventListener(\"keydown\",r)},[]),!t||!e)return g(\"div\",{class:\"loading\",children:\"Loading...\"});const n=t.passages.get(e);return n?g(Q,{children:[g(\"header\",{class:\"story-menubar\",children:g(sc,{})}),g(\"div\",{id:\"story\",class:\"story\",children:g(ic,{passage:n},e)})]}):g(\"div\",{class:\"error\",children:[\"Error: Passage “\",e,\"” not found.\"]})}function lc(){const e=document.querySelector(\"tw-storydata\");if(!e)throw new Error(\"spindle: No <tw-storydata> element found in the document.\");const t=e.getAttribute(\"name\")||\"Untitled\",n=parseInt(e.getAttribute(\"startnode\")||\"1\",10),r=e.getAttribute(\"ifid\")||\"\",i=e.getAttribute(\"format\")||\"\",a=e.getAttribute(\"format-version\")||\"\",o=e.querySelector('[type=\"text/twine-css\"]')?.textContent||\"\",l=e.querySelector('[type=\"text/twine-javascript\"]')?.textContent||\"\",f=new Map,c=new Map;for(const p of e.querySelectorAll(\"tw-passagedata\")){const h=parseInt(p.getAttribute(\"pid\")||\"0\",10),_=p.getAttribute(\"name\")||\"\",w=(p.getAttribute(\"tags\")||\"\").split(/\\s+/).filter(v=>v.length>0),I=p.textContent||\"\",b={pid:h,name:_,tags:w,content:I};f.set(_,b),c.set(h,b)}return{name:t,startNode:n,ifid:r,format:i,formatVersion:a,passages:f,passagesById:c,userCSS:o,userScript:l}}function uc(){return{get(e){return C.getState().variables[e]},set(e,t){const n=C.getState();if(typeof e==\"string\")n.setVariable(e,t);else for(const[r,i]of Object.entries(e))n.setVariable(r,i)},goto(e){C.getState().navigate(e)},back(){C.getState().goBack()},forward(){C.getState().goForward()},restart(){C.getState().restart()},save(e){C.getState().save(e)},load(e){C.getState().load(e)},hasSave(e){return C.getState().hasSave(e)},visited(e){return C.getState().visitCounts[e]??0},hasVisited(e){return(C.getState().visitCounts[e]??0)>0},hasVisitedAny(...e){const{visitCounts:t}=C.getState();return e.some(n=>(t[n]??0)>0)},hasVisitedAll(...e){const{visitCounts:t}=C.getState();return e.every(n=>(t[n]??0)>0)},rendered(e){return C.getState().renderCounts[e]??0},hasRendered(e){return(C.getState().renderCounts[e]??0)>0},hasRenderedAny(...e){const{renderCounts:t}=C.getState();return e.some(n=>(t[n]??0)>0)},hasRenderedAll(...e){const{renderCounts:t}=C.getState();return e.every(n=>(t[n]??0)>0)},get title(){return C.getState().storyData?.name||\"\"},settings:nt,saves:{setTitleGenerator(e){Cs(e)}}}}function cc(){window.Story=uc()}const fc=/^\\$(\\w+)\\s*=\\s*(.+)$/,wr=/\\$(\\w+(?:\\.\\w+)*)/g,kr=/\\{for\\s+(\\$\\w+)(?:\\s*,\\s*(\\$\\w+))?\\s+of\\b/g;function Di(e){if(Array.isArray(e))return{type:\"array\"};if(e!==null&&typeof e==\"object\"){const t=new Map;for(const[n,r]of Object.entries(e))t.set(n,Di(r));return{type:\"object\",fields:t}}return{type:typeof e}}function hc(e){const t=new Map;for(const n of e.split(`\n`)){const r=n.trim();if(!r)continue;const i=r.match(fc);if(!i)throw new Error(`StoryVariables: Invalid declaration: \"${r}\". Expected: $name = value`);const[,a,s]=i;let o;try{o=new Function(\"return (\"+s+\")\")()}catch(l){throw new Error(`StoryVariables: Failed to evaluate \"$${a} = ${s}\": ${l instanceof Error?l.message:l}`)}const u=Di(o);t.set(a,{...u,name:a,default:o})}return t}function pc(e){const t=new Set;let n;for(kr.lastIndex=0;(n=kr.exec(e))!==null;)t.add(n[1].slice(1)),n[2]&&t.add(n[2].slice(1));return t}function dc(e,t,n){const r=e.split(\".\"),i=r[0];if(n.has(i))return null;const a=t.get(i);if(!a)return`Undeclared variable: $${e}`;let s=a;for(let o=1;o<r.length;o++){if(s.type===\"array\"&&r[o]===\"length\")return null;if(s.type!==\"object\"||!s.fields)return`Cannot access field \"${r[o]}\" on $${r.slice(0,o).join(\".\")} (type: ${s.type})`;const u=s.fields.get(r[o]);if(!u)return`Undeclared field: $${r.slice(0,o+1).join(\".\")}`;s=u}return null}function mc(e,t){const n=[];for(const[r,i]of e){if(r===\"StoryVariables\")continue;const a=pc(i.content);let s;for(wr.lastIndex=0;(s=wr.exec(i.content))!==null;){const o=s[1],u=dc(o,t,a);u&&n.push(`Passage \"${r}\": ${u}`)}}return n}function gc(e){const t={};for(const[n,r]of e)t[n]=r.default;return t}function Sr(e,t){e.innerHTML=\"\";const n=document.createElement(\"div\");n.style.cssText=\"font-family:monospace;padding:2rem;max-width:60rem;margin:0 auto\";const r=document.createElement(\"h1\");r.style.color=\"#c00\",r.textContent=\"Story Validation Errors\",n.appendChild(r);const i=document.createElement(\"ul\");i.style.cssText=\"line-height:1.6\";for(const a of t){const s=document.createElement(\"li\");s.textContent=a,i.appendChild(s)}n.appendChild(i),e.appendChild(n)}function Cr(){const e=lc();if(cc(),e.userCSS){const s=document.createElement(\"style\");s.textContent=e.userCSS,document.head.appendChild(s)}if(e.userScript)try{new Function(e.userScript)()}catch(s){console.error(\"spindle: Error in story JavaScript:\",s)}let t={};const n=e.passages.get(\"StoryVariables\");if(!n){const s=\"Missing StoryVariables passage. Add a :: StoryVariables passage to declare your variables.\",o=document.getElementById(\"root\");throw o&&Sr(o,[s]),new Error(`spindle: ${s}`)}const r=hc(n.content),i=mc(e.passages,r);if(i.length>0){const s=document.getElementById(\"root\");throw s&&Sr(s,i),new Error(`spindle: ${i.length} validation error(s):\n${i.join(`\n`)}`)}t=gc(r),C.getState().init(e,t),pi();for(const[,s]of e.passages)if(s.tags.includes(\"widget\")){const o=ot(s.content),u=lt(o);for(const l of u)if(l.type===\"macro\"&&l.name===\"widget\"&&l.rawArgs){const f=l.rawArgs.trim().replace(/[\"']/g,\"\");yi(f,l.children)}}const a=document.getElementById(\"root\");if(!a)throw new Error('spindle: No <div id=\"root\"> element found.');Be(g(oc,{}),a)}document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",Cr):Cr();</script>\n <style rel=\"stylesheet\" crossorigin>*,*:before,*:after{box-sizing:border-box}html{font-size:16px;-webkit-text-size-adjust:100%}body{margin:0;padding:0;font-family:Georgia,Times New Roman,serif;line-height:1.75;color:#e0e0e0;background-color:#1a1a2e;min-height:100vh}tw-storydata{display:none!important}#story{max-width:42em;margin:0 auto;padding:2em 1.5em}.passage{animation:passage-fade-in .3s ease-in}@keyframes passage-fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.passage-link{color:#64b5f6;text-decoration:none;border-bottom:1px solid rgba(100,181,246,.3);transition:color .2s,border-color .2s;cursor:pointer}.passage-link:hover{color:#90caf9;border-bottom-color:#90caf9}.passage-link:active{color:#42a5f5}.macro-button{background:#64b5f626;color:#64b5f6;border:1px solid rgba(100,181,246,.4);border-radius:4px;padding:.25em .75em;font:inherit;font-size:.95em;cursor:pointer;transition:background .2s,border-color .2s}.macro-button:hover{background:#64b5f640;border-color:#90caf9}.macro-button:active{background:#64b5f659}.error{color:#ef5350;font-family:monospace;padding:1em;border:1px solid #ef5350;border-radius:4px;background:#ef53501a}.loading{text-align:center;padding:2em;opacity:.6}.story-menubar{position:sticky;top:0;z-index:100;display:flex;align-items:center;gap:.5em;padding:.5em 1.5em;background:#16213e;border-bottom:1px solid rgba(255,255,255,.08);font-family:system-ui,sans-serif;font-size:.9em}.story-title{flex:1;font-weight:600;color:#e0e0e0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.menubar-button{background:transparent;color:#9e9e9e;border:1px solid transparent;padding:.35em .7em;border-radius:4px;cursor:pointer;font:inherit;transition:color .2s,background .2s}.menubar-button:hover{color:#e0e0e0;background:#ffffff14}.menubar-button:disabled{opacity:.4;cursor:default}.menubar-button:disabled:hover{color:#9e9e9e;background:transparent}.settings-overlay{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;background:#0009}.settings-panel{background:#16213e;border:1px solid rgba(255,255,255,.1);border-radius:8px;width:90%;max-width:400px;max-height:80vh;overflow-y:auto;color:#e0e0e0;font-family:system-ui,sans-serif}.settings-header{display:flex;align-items:center;justify-content:space-between;padding:1em 1.25em;border-bottom:1px solid rgba(255,255,255,.08);font-weight:600}.settings-close{background:transparent;border:none;color:#9e9e9e;font-size:1.1em;cursor:pointer;padding:.25em;line-height:1}.settings-close:hover{color:#e0e0e0}.settings-body{padding:1em 1.25em;display:flex;flex-direction:column;gap:1em}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:1em}.settings-row select,.settings-row input[type=range]{accent-color:#64b5f6}.settings-row select{background:#1a1a2e;color:#e0e0e0;border:1px solid rgba(255,255,255,.15);border-radius:4px;padding:.3em .5em;font:inherit}.settings-row input[type=checkbox]{accent-color:#64b5f6;width:1.1em;height:1.1em}.saves-overlay{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;background:#0009}.saves-panel{background:#16213e;border:1px solid rgba(255,255,255,.1);border-radius:8px;width:90%;max-width:550px;max-height:80vh;display:flex;flex-direction:column;color:#e0e0e0;font-family:system-ui,sans-serif}.saves-header{display:flex;align-items:center;justify-content:space-between;padding:1em 1.25em;border-bottom:1px solid rgba(255,255,255,.08);font-weight:600;flex-shrink:0}.saves-header-left{display:flex;align-items:center;gap:.75em}.saves-mode-toggle{display:flex;gap:0;border:1px solid rgba(255,255,255,.15);border-radius:4px;overflow:hidden}.saves-mode-toggle button{background:transparent;color:#9e9e9e;border:none;padding:.3em .8em;font:inherit;font-size:.85em;font-weight:600;cursor:pointer;transition:background .2s,color .2s}.saves-mode-toggle button.active{background:#64b5f633;color:#64b5f6}.saves-mode-toggle button:hover:not(.active){color:#e0e0e0}.saves-close{background:transparent;border:none;color:#9e9e9e;font-size:1.1em;cursor:pointer;padding:.25em;line-height:1}.saves-close:hover{color:#e0e0e0}.saves-body{padding:.75em 1.25em;overflow-y:auto;flex:1;min-height:0}.saves-empty{text-align:center;padding:2em 1em;opacity:.5;font-size:.9em}.saves-toolbar{display:flex;gap:.5em;padding:.5em 1.25em;border-bottom:1px solid rgba(255,255,255,.08);flex-shrink:0}.saves-toolbar-button{background:#ffffff0d;color:#9e9e9e;border:1px solid rgba(255,255,255,.1);border-radius:4px;padding:.3em .7em;font:inherit;font-size:.8em;cursor:pointer;transition:background .2s,color .2s}.saves-toolbar-button:hover{background:#ffffff1a;color:#e0e0e0}.playthrough-group{margin-bottom:.75em}.playthrough-header{display:flex;align-items:center;gap:.5em;padding:.4em 0;cursor:pointer;user-select:none;font-size:.85em;color:#9e9e9e;transition:color .2s}.playthrough-header:hover{color:#e0e0e0}.playthrough-chevron{display:inline-block;font-size:.7em;transition:transform .2s}.playthrough-chevron.open{transform:rotate(90deg)}.playthrough-label{font-weight:600}.playthrough-date{opacity:.6;font-size:.9em}.playthrough-saves{display:flex;flex-direction:column;gap:.4em;padding-left:.25em}.save-slot{display:flex;align-items:center;gap:.75em;padding:.5em .6em;background:#ffffff08;border:1px solid rgba(255,255,255,.06);border-radius:6px;transition:background .15s}.save-slot:hover{background:#ffffff0f}.save-slot-info{flex:1;min-width:0}.save-slot-title{font-weight:500;font-size:.9em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.save-slot-meta{font-size:.75em;color:#9e9e9e;display:flex;gap:.75em}.save-slot-actions{display:flex;gap:.3em;flex-shrink:0}.save-slot-action{background:transparent;color:#9e9e9e;border:1px solid transparent;border-radius:3px;padding:.2em .5em;font:inherit;font-size:.75em;cursor:pointer;transition:color .2s,background .2s;white-space:nowrap}.save-slot-action:hover{color:#e0e0e0;background:#ffffff14}.save-slot-action.primary{color:#64b5f6;border-color:#64b5f64d}.save-slot-action.primary:hover{background:#64b5f626}.save-slot-action.danger:hover{color:#ef5350;background:#ef53501a}.save-slot-new{display:flex;align-items:center;justify-content:center;padding:.5em;margin-top:.25em;border:1px dashed rgba(255,255,255,.12);border-radius:6px;color:#9e9e9e;font:inherit;font-size:.8em;background:transparent;cursor:pointer;width:100%;transition:color .2s,border-color .2s,background .2s}.save-slot-new:hover{color:#64b5f6;border-color:#64b5f64d;background:#64b5f60d}.saves-status{padding:.5em 1.25em;font-size:.8em;color:#81c784;border-top:1px solid rgba(255,255,255,.08);flex-shrink:0;text-align:center}.saves-status.error{color:#ef5350;border:none;border-radius:0;padding:.5em 1.25em;font-family:inherit;background:transparent}.save-rename-input{background:#1a1a2e;color:#e0e0e0;border:1px solid rgba(100,181,246,.4);border-radius:3px;padding:.15em .4em;font:inherit;font-size:.9em;width:100%}.save-rename-input:focus{outline:none;border-color:#64b5f6}.macro-link{color:#64b5f6;text-decoration:none;border-bottom:1px solid rgba(100,181,246,.3);transition:color .2s,border-color .2s;cursor:pointer}.macro-link:hover{color:#90caf9;border-bottom-color:#90caf9}.macro-textbox,.macro-numberbox,.macro-textarea{background:#1a1a2e;color:#e0e0e0;border:1px solid rgba(255,255,255,.15);border-radius:4px;padding:.3em .5em;font:inherit}.macro-textbox:focus,.macro-numberbox:focus,.macro-textarea:focus{outline:none;border-color:#64b5f6}.macro-textarea{min-height:3em;resize:vertical}.macro-checkbox,.macro-radiobutton{cursor:pointer;display:inline-flex;align-items:center;gap:.3em}.macro-checkbox input,.macro-radiobutton input{accent-color:#64b5f6}.macro-listbox{background:#1a1a2e;color:#e0e0e0;border:1px solid rgba(255,255,255,.15);border-radius:4px;padding:.3em .5em;font:inherit}.macro-cycle{background:#64b5f626;color:#64b5f6;border:1px solid rgba(100,181,246,.4);border-radius:4px;padding:.25em .75em;font:inherit;cursor:pointer;transition:background .2s,border-color .2s}.macro-cycle:hover{background:#64b5f640;border-color:#90caf9}.md{display:contents}.passage p{margin:.6em 0}.passage p:first-child{margin-top:0}.passage p:last-child{margin-bottom:0}.passage h1,.passage h2,.passage h3,.passage h4,.passage h5,.passage h6{margin:1em 0 .4em;line-height:1.3;color:#f0f0f0}.passage h1{font-size:1.8em}.passage h2{font-size:1.5em}.passage h3{font-size:1.25em}.passage h4{font-size:1.1em}.passage h5{font-size:1em}.passage h6{font-size:.9em;opacity:.8}.passage code{font-family:Fira Code,Cascadia Code,Consolas,monospace;font-size:.9em;background:#ffffff14;padding:.15em .35em;border-radius:3px}.passage pre{background:#0000004d;border:1px solid rgba(255,255,255,.08);border-radius:6px;padding:1em;overflow-x:auto;margin:.8em 0}.passage pre code{background:none;padding:0;border-radius:0;font-size:.85em}.passage blockquote{border-left:3px solid rgba(100,181,246,.5);margin:.8em 0;padding:.4em 1em;color:#b0b0b0}.passage blockquote p{margin:.3em 0}.passage ul,.passage ol{margin:.6em 0;padding-left:1.8em}.passage li{margin:.2em 0}.passage hr{border:none;border-top:1px solid rgba(255,255,255,.12);margin:1.2em 0}.passage table{border-collapse:collapse;width:100%;margin:.8em 0}.passage th,.passage td{border:1px solid rgba(255,255,255,.12);padding:.5em .75em;text-align:left}.passage th{background:#ffffff0f;font-weight:600}.passage tr:nth-child(2n){background:#ffffff05}.passage del{opacity:.5}.passage strong{color:#f0f0f0}.macro-type-cursor:after{content:\"█\";animation:type-blink .7s step-end infinite;color:#64b5f6}.macro-type-done .macro-type-cursor:after{display:none}@keyframes type-blink{50%{opacity:0}}</style>\n </head>\n <body>\n <div id=\"root\"></div>\n {{STORY_DATA}}\n </body>\n</html>\n"})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const raw = readFileSync(join(__dirname, 'format.js'), 'utf-8');
|
|
7
|
+
const json = JSON.parse(raw.slice(raw.indexOf('{'), raw.lastIndexOf('}') + 1));
|
|
8
|
+
|
|
9
|
+
export const name = json.name;
|
|
10
|
+
export const version = json.version;
|
|
11
|
+
export const source = json.source;
|
|
12
|
+
export const proofing = json.proofing ?? false;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StoryAPI } from './index.js';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
/**
|
|
5
|
+
* The main Spindle story API, available globally at runtime.
|
|
6
|
+
* Provides access to variables, navigation, save/load, and visit tracking.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* Story.set("health", 100);
|
|
11
|
+
* Story.goto("Chapter 2");
|
|
12
|
+
* if (Story.hasVisited("Secret Room")) { ... }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
const Story: StoryAPI;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {};
|